Skip to content

Commit d4303e0

Browse files
Merge pull request #50 from yeelam-gordon/dev/vanzue/agent
Latest features into main
2 parents 368a10b + 93b98c9 commit d4303e0

1,043 files changed

Lines changed: 9063 additions & 8342 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/scheduled_tasks.lock

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33

4-
# Rust build output
5-
wta/target/
4+
# Rust build output (including parallel CARGO_TARGET_DIR variants like target-hotfix/)
5+
tools/wta/target*/
6+
7+
# WTA diagram / rendered-image artifacts (regeneratable, not needed for build)
8+
tools/wta/*.excalidraw
9+
tools/wta/*.png
610

711
# Claude Code local settings
812
.claude/settings.local.json
@@ -293,6 +297,6 @@ profiles.json
293297
# MSBuildCache
294298
/MSBuildCacheLogs/
295299

296-
tmpclaude-*
297-
# Per-issue git worktrees created locally
300+
tmpclaude-*
301+
# Per-issue git worktrees created locally
298302
.worktree/

ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ WTA Library (Rust)
110110
## WTA Rust Crate Structure
111111

112112
```
113-
wta/
113+
tools/wta/
114114
├── Cargo.toml # [lib] + [[bin]] targets
115115
├── src/
116116
│ ├── lib.rs # Public API for lib mode (C-ABI)

CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Detects command failures in other panes and auto-suggests fixes via the agent.
7878

7979
**Requirements**: PowerShell shell integration (OSC 133 marks), agent pane open, `wtcli` on PATH.
8080

81-
**Key code**: `wta/src/app.rs` (`classify_wt_event`, `maybe_trigger_autofix`), `TerminalPage.cpp:2650-2740` (event handlers), `TerminalProtocolComServer.cpp` (`_ensurePageEventsRegistered`).
81+
**Key code**: `tools/wta/src/app.rs` (`classify_wt_event`, `maybe_trigger_autofix`), `TerminalPage.cpp:2650-2740` (event handlers), `TerminalProtocolComServer.cpp` (`_ensurePageEventsRegistered`).
8282

8383
**Diag log**: `wta-ensure-host.log` in the WTA log directory — shows event flow, classification, and autofix triggers.
8484

@@ -114,11 +114,11 @@ There are two independent build systems. **Both must be built** before F5.
114114
# Kill stale WTA processes first
115115
taskkill //f //im wta.exe 2>/dev/null; true
116116

117-
cargo build --target x86_64-pc-windows-msvc --manifest-path wta/Cargo.toml
118-
# Output: wta/target/x86_64-pc-windows-msvc/debug/wta.exe
117+
cargo build --target x86_64-pc-windows-msvc --manifest-path tools/wta/Cargo.toml
118+
# Output: tools/wta/target/x86_64-pc-windows-msvc/debug/wta.exe
119119
#
120120
# Always pass --target explicitly — the wapproj prefers
121-
# wta/target/<triple>/<profile>/wta.exe over the bare target/<profile>
121+
# tools/wta/target/<triple>/<profile>/wta.exe over the bare target/<profile>
122122
# fallback, and a stale explicit-target binary will silently shadow your
123123
# fresh bare-target build.
124124
```
@@ -144,7 +144,7 @@ cmd.exe //c "tools\razzle.cmd && bcz no_clean"
144144
```bash
145145
# 1. Build WTA (always use --target — see note above)
146146
taskkill //f //im wta.exe 2>/dev/null; true
147-
cargo build --target x86_64-pc-windows-msvc --manifest-path wta/Cargo.toml
147+
cargo build --target x86_64-pc-windows-msvc --manifest-path tools/wta/Cargo.toml
148148

149149
# 2. Build & run Terminal from VS
150150
# F5 in Visual Studio (CascadiaPackage project)
@@ -160,7 +160,7 @@ package identity to activate it via `CoCreateInstance`. This is why:
160160

161161
- `wta.exe` is deployed **inside the package** (next to `WindowsTerminal.exe`)
162162
- `_DetectWtaPath()` prefers the co-located `wta.exe` over dev-build paths
163-
- Running `wta.exe` from `wta/target/debug/` directly will fail with
163+
- Running `wta.exe` from `tools/wta/target/debug/` directly will fail with
164164
`0x80073D54` (APPMODEL_ERROR_NO_PACKAGE) when calling COM methods
165165

166166
If autofix or the agent pane stops working after a debug launch, check

TelemetryEvents.md

Lines changed: 592 additions & 0 deletions
Large diffs are not rendered by default.

_build_msix_arm64.cmd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@echo off
2+
cd /d "%~dp0"
3+
4+
rem Wipe ARM64 Release intermediates so glob Content items (wt-agent-hooks\**)
5+
rem get re-evaluated; otherwise an incremental MSIX build silently drops
6+
rem freshly-added files. See _build_msix_x64.cmd for the long-form note.
7+
if exist "src\cascadia\CascadiaPackage\obj\ARM64\Release" rmdir /s /q "src\cascadia\CascadiaPackage\obj\ARM64\Release"
8+
if exist "src\cascadia\CascadiaPackage\bin\ARM64\Release\AppX" rmdir /s /q "src\cascadia\CascadiaPackage\bin\ARM64\Release\AppX"
9+
10+
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" src\cascadia\CascadiaPackage\CascadiaPackage.wapproj /p:Platform=ARM64 /p:Configuration=Release /p:WindowsTerminalBranding=Dev /p:GenerateAppxPackageOnBuild=true /p:AppxBundle=Never /p:SolutionDir=%CD%\ /m /nologo > _build_msix_arm64.log 2>&1
11+
set BUILD_EXIT=%ERRORLEVEL%
12+
echo Exit code: %BUILD_EXIT%
13+
exit /b %BUILD_EXIT%

_build_msix_x64.cmd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@echo off
2+
cd /d "%~dp0"
3+
set MSBUILD="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
4+
set SOLUTION_DIR=%CD%\
5+
set COMMON=/p:Platform=x64 /p:Configuration=Release /p:WindowsTerminalBranding=Dev /p:SolutionDir=%SOLUTION_DIR% /m /nologo
6+
7+
rem Wipe the wapproj's Release intermediates so glob-based Content items
8+
rem (like wt-agent-hooks\**) get re-evaluated. Without this, an incremental
9+
rem MSIX build keeps the cached file list and silently drops freshly-added
10+
rem files from the package.
11+
if exist "src\cascadia\CascadiaPackage\obj\x64\Release" rmdir /s /q "src\cascadia\CascadiaPackage\obj\x64\Release"
12+
if exist "src\cascadia\CascadiaPackage\bin\x64\Release\AppX" rmdir /s /q "src\cascadia\CascadiaPackage\bin\x64\Release\AppX"
13+
14+
rem Build Settings Model first. Its winmd is the source-of-truth for the
15+
rem Profile / Globals WinRT projection. If we don't pin its build ahead
16+
rem of consumer projects, cppwinrt can scan a stale older winmd elsewhere
17+
rem and generate consumer projections missing newer members (e.g.
18+
rem DragDropDelimiter), producing C2039 in TerminalSettingsAppAdapterLib.
19+
%MSBUILD% src\cascadia\TerminalSettingsModel\Microsoft.Terminal.Settings.ModelLib.vcxproj %COMMON% >> _build_msix_x64.log 2>&1
20+
if %ERRORLEVEL% NEQ 0 (
21+
echo Settings Model build failed: %ERRORLEVEL%
22+
exit /b %ERRORLEVEL%
23+
)
24+
25+
rem Build Settings Editor next (generates XBF files)
26+
%MSBUILD% src\cascadia\TerminalSettingsEditor\Microsoft.Terminal.Settings.Editor.vcxproj %COMMON% >> _build_msix_x64.log 2>&1
27+
if %ERRORLEVEL% NEQ 0 (
28+
echo Settings Editor build failed: %ERRORLEVEL%
29+
exit /b %ERRORLEVEL%
30+
)
31+
32+
rem Now build the full package
33+
%MSBUILD% src\cascadia\CascadiaPackage\CascadiaPackage.wapproj %COMMON% /p:GenerateAppxPackageOnBuild=true /p:AppxBundle=Never >> _build_msix_x64.log 2>&1
34+
set BUILD_EXIT=%ERRORLEVEL%
35+
echo Exit code: %BUILD_EXIT%
36+
exit /b %BUILD_EXIT%

_regen_logos.ps1

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
param(
2+
[string]$Source = 'C:\Users\kaitao\Downloads\intelligent terminal.png',
3+
[string]$Dir = 'res\terminal\images-Dev',
4+
[int]$MaxBytes = 204800
5+
)
6+
$ErrorActionPreference = 'Stop'
7+
8+
Add-Type -AssemblyName System.Drawing
9+
Add-Type -AssemblyName PresentationCore
10+
11+
$src = [System.Drawing.Image]::FromFile($Source)
12+
Write-Host "Source: $($src.Width)x$($src.Height) $Source"
13+
14+
$files = Get-ChildItem -Path $Dir -Filter *.png -File
15+
Write-Host "Regenerating $($files.Count) files into $Dir (max bytes: $MaxBytes)"
16+
17+
function Save-Indexed-Via-WPF {
18+
param([System.Drawing.Bitmap]$Bitmap, [string]$Path, [int]$Colors)
19+
# Convert System.Drawing.Bitmap to BitmapSource
20+
$ms = New-Object System.IO.MemoryStream
21+
$Bitmap.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
22+
$ms.Position = 0
23+
$bs = [System.Windows.Media.Imaging.BitmapFrame]::Create($ms,
24+
[System.Windows.Media.Imaging.BitmapCreateOptions]::PreservePixelFormat,
25+
[System.Windows.Media.Imaging.BitmapCacheOption]::OnLoad)
26+
27+
# Quantize to indexed by converting to Indexed8 format
28+
$palette = [System.Windows.Media.Imaging.BitmapPalettes]::Halftone256Transparent
29+
$converted = New-Object System.Windows.Media.Imaging.FormatConvertedBitmap
30+
$converted.BeginInit()
31+
$converted.Source = $bs
32+
$converted.DestinationFormat = [System.Windows.Media.PixelFormats]::Indexed8
33+
$converted.DestinationPalette = $palette
34+
$converted.EndInit()
35+
36+
$encoder = New-Object System.Windows.Media.Imaging.PngBitmapEncoder
37+
$encoder.Frames.Add([System.Windows.Media.Imaging.BitmapFrame]::Create($converted))
38+
$fs = [System.IO.File]::Open($Path, [System.IO.FileMode]::Create)
39+
$encoder.Save($fs)
40+
$fs.Dispose()
41+
$ms.Dispose()
42+
}
43+
44+
foreach ($f in $files) {
45+
$existing = [System.Drawing.Image]::FromFile($f.FullName)
46+
$w = $existing.Width
47+
$h = $existing.Height
48+
$existing.Dispose()
49+
50+
$srcAR = $src.Width / $src.Height
51+
$dstAR = $w / $h
52+
if ($srcAR -gt $dstAR) {
53+
$dw = $w
54+
$dh = [int]($w / $srcAR)
55+
} else {
56+
$dh = $h
57+
$dw = [int]($h * $srcAR)
58+
}
59+
$dx = [int](($w - $dw) / 2)
60+
$dy = [int](($h - $dh) / 2)
61+
62+
$bmp = New-Object System.Drawing.Bitmap $w, $h, ([System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
63+
$g = [System.Drawing.Graphics]::FromImage($bmp)
64+
$g.Clear([System.Drawing.Color]::Transparent)
65+
$g.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
66+
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
67+
$g.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
68+
$rect = New-Object System.Drawing.Rectangle $dx, $dy, $dw, $dh
69+
$g.DrawImage($src, $rect)
70+
$g.Dispose()
71+
72+
$bmp.Save($f.FullName, [System.Drawing.Imaging.ImageFormat]::Png)
73+
74+
# If too big, re-save as indexed with progressively smaller palettes
75+
$size = (Get-Item $f.FullName).Length
76+
$palettes = @(
77+
[System.Windows.Media.Imaging.BitmapPalettes]::Halftone256Transparent,
78+
[System.Windows.Media.Imaging.BitmapPalettes]::Halftone125Transparent,
79+
[System.Windows.Media.Imaging.BitmapPalettes]::Halftone64Transparent,
80+
[System.Windows.Media.Imaging.BitmapPalettes]::Halftone27Transparent,
81+
[System.Windows.Media.Imaging.BitmapPalettes]::Halftone8Transparent
82+
)
83+
if ($size -gt $MaxBytes) {
84+
foreach ($pal in $palettes) {
85+
$ms2 = New-Object System.IO.MemoryStream
86+
$bmp.Save($ms2, [System.Drawing.Imaging.ImageFormat]::Png)
87+
$ms2.Position = 0
88+
$bs2 = [System.Windows.Media.Imaging.BitmapFrame]::Create($ms2,
89+
[System.Windows.Media.Imaging.BitmapCreateOptions]::PreservePixelFormat,
90+
[System.Windows.Media.Imaging.BitmapCacheOption]::OnLoad)
91+
$conv = New-Object System.Windows.Media.Imaging.FormatConvertedBitmap
92+
$conv.BeginInit()
93+
$conv.Source = $bs2
94+
$conv.DestinationFormat = [System.Windows.Media.PixelFormats]::Indexed8
95+
$conv.DestinationPalette = $pal
96+
$conv.EndInit()
97+
$enc = New-Object System.Windows.Media.Imaging.PngBitmapEncoder
98+
$enc.Frames.Add([System.Windows.Media.Imaging.BitmapFrame]::Create($conv))
99+
$fs = [System.IO.File]::Open($f.FullName, [System.IO.FileMode]::Create)
100+
$enc.Save($fs)
101+
$fs.Dispose()
102+
$ms2.Dispose()
103+
$size = (Get-Item $f.FullName).Length
104+
if ($size -le $MaxBytes) { break }
105+
}
106+
if ($size -gt $MaxBytes) {
107+
Write-Warning "$($f.Name) still $size bytes after all palette reductions"
108+
}
109+
}
110+
$bmp.Dispose()
111+
}
112+
113+
$src.Dispose()
114+
Write-Host "Done."

_sign_msix.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
cd /d "%~dp0"
3+
set SIGNTOOL="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\signtool.exe"
4+
%SIGNTOOL% sign /fd SHA256 /p "" /f cert\IntelligentTerminalDev.pfx "src\cascadia\CascadiaPackage\AppPackages\CascadiaPackage_0.7.0.16_x64_Test\CascadiaPackage_0.7.0.16_x64.msix"
5+
if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
6+
%SIGNTOOL% sign /fd SHA256 /p "" /f cert\IntelligentTerminalDev.pfx "src\cascadia\CascadiaPackage\AppPackages\CascadiaPackage_0.7.0.16_ARM64_Test\CascadiaPackage_0.7.0.16_ARM64.msix"
7+
echo Exit code: %ERRORLEVEL%

build/scripts/New-WtaLocalInstaller.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ $unpackagedScript = Join-Path $repoRoot 'build\scripts\New-UnpackagedTerminalDis
393393
$installerScript = Join-Path $repoRoot 'installer\install-local-terminal.ps1'
394394
$installerCmd = Join-Path $repoRoot 'installer\install.cmd'
395395
$installerBootstrapManifest = Join-Path $repoRoot 'installer\bootstrap\Cargo.toml'
396-
$plannerPromptTemplate = Join-Path $repoRoot 'wta\prompts\terminal-agent.md'
396+
$plannerPromptTemplate = Join-Path $repoRoot 'tools\wta\prompts\terminal-agent.md'
397397
$devManifestPath = Join-Path $repoRoot 'src\cascadia\CascadiaPackage\Package-Dev.appxmanifest'
398398

399399
if (-not (Test-Path $unpackagedScript -PathType Leaf)) {
@@ -497,9 +497,9 @@ if ($SkipWtaBuild) {
497497
$resolvedWtaExePath = Resolve-AbsolutePath -Path $WtaExePath
498498
} else {
499499
Write-Status "Building wta.exe for $rustTarget with a static CRT ..."
500-
$manifestPath = Join-Path $repoRoot 'wta\Cargo.toml'
500+
$manifestPath = Join-Path $repoRoot 'tools\wta\Cargo.toml'
501501
Invoke-RustBuild -CargoPath $cargoPath -ManifestPath $manifestPath -RustTarget $rustTarget
502-
$resolvedWtaExePath = Join-Path $repoRoot ("wta\target\{0}\release\wta.exe" -f $rustTarget)
502+
$resolvedWtaExePath = Join-Path $repoRoot ("tools\wta\target\{0}\release\wta.exe" -f $rustTarget)
503503
}
504504

505505
if (-not (Test-Path $resolvedWtaExePath -PathType Leaf)) {

0 commit comments

Comments
 (0)