跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

提交记录
修改scripts/ci-windows-build.ps1+1 −1看文件
@@ -53,7 +53,7 @@ try {
5353 Invoke-BuildTool 'node' @('--test', 'internal/cage/browser-clipboard.test.mjs', 'scripts/windows-native-bridge.test.mjs')
5454 Invoke-BuildTool (Get-BuildCommand @('pwsh.exe', 'pwsh')) @('-NoProfile', '-NonInteractive', '-File', 'scripts/windows-workbench-smoke.test.ps1')
5555 $windowsPowerShell = Join-Path ([Environment]::SystemDirectory) 'WindowsPowerShell/v1.0/powershell.exe'
56删除: & (Join-Path $PSScriptRoot 'test-windows-installation-files.ps1') -HelperShell $windowsPowerShell
56新增: & (Join-Path $PSScriptRoot 'test-windows-installation-files.ps1') -HelperShell $windowsPowerShell -InstallerSmoke
5757 if ($Release) {
5858 & (Join-Path $PSScriptRoot 'prepare-qemu-release.ps1')
5959 $qemuSource = Join-Path $repository '_output/windows-qemu-sources/full-source.tar.gz'
修改scripts/test-windows-installation-files.ps1+55 −1看文件
@@ -1,5 +1,5 @@
11#requires -Version 5.1
2删除:param([string]$HelperShell = (Get-Process -Id $PID).Path)
2新增:param([string]$HelperShell = (Get-Process -Id $PID).Path, [switch]$InstallerSmoke)
33$ErrorActionPreference = 'Stop'
44$helper = Join-Path $PSScriptRoot '../packaging/windows/installation-files.ps1'
55$root = Join-Path ([IO.Path]::GetTempPath()) ('cage-install-files-' + [guid]::NewGuid().ToString('N'))
@@ -62,7 +62,61 @@ function Commit([string]$Old, [string]$Stage, [string]$Receipt) {
6262 Invoke-Helper @('-Operation','cleanup','-Source',$backup,'-Target',$Old,'-Receipt',$Receipt)
6363 return $backup
6464}
65新增:function Test-InstallerTransaction {
66新增: if (!$windows -or $PSVersionTable.PSVersion.Major -lt 7) { throw 'The optional NSIS fixture requires PowerShell 7 on a disposable Windows user.' }
67新增: $key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ClaudeCage'
68新增: $desktop = Join-Path ([Environment]::GetFolderPath('DesktopDirectory')) 'Cage.lnk'
69新增: $menu = Join-Path ([Environment]::GetFolderPath('Programs')) 'Cage'
70新增: if ((Test-Path $key) -or (Test-Path -LiteralPath $desktop) -or (Test-Path -LiteralPath $menu)) { throw 'The NSIS fixture refuses an existing Cage registration or shortcuts.' }
71新增: $runtime = $false
72新增: foreach ($hive in @([Microsoft.Win32.RegistryHive]::LocalMachine, [Microsoft.Win32.RegistryHive]::CurrentUser)) {
73新增: $base = [Microsoft.Win32.RegistryKey]::OpenBaseKey($hive, [Microsoft.Win32.RegistryView]::Registry32)
74新增: $client = $base.OpenSubKey('SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}')
75新增: try { if ($client -and [string]$client.GetValue('pv') -notin @('','0.0.0.0')) { $runtime = $true } }
76新增: finally { if ($client) { $client.Dispose() }; $base.Dispose() }
77新增: }
78新增: if (!$runtime) { Write-Output 'SKIP: quick NSIS transaction needs an existing WebView2 runtime; full installer acceptance is still required.'; return }
79新增: $scenario = Join-Path $root 'nsis-transaction'; $app = Join-Path $scenario 'payload'; $target = Join-Path $scenario 'empty target'
80新增: $setup = Join-Path $scenario 'fixture-setup.exe'
81新增: $reportBase = if ($env:RUNNER_TEMP) { $env:RUNNER_TEMP } else { [IO.Path]::GetTempPath() }
82新增: $report = Join-Path $reportBase ('cage-smoke-installation-fixture-' + [guid]::NewGuid().ToString('N') + '.json')
83新增: Write-File (Join-Path $app 'LICENSE.txt') 'Compile-only text payload; no Cage application or VM.'
84新增: App $app 'fixture'
85新增: $version = (Get-Content (Join-Path $PSScriptRoot '../VERSION') -Raw).Trim()
86新增: & (Get-Command makensis.exe -ErrorAction Stop).Source /V2 /INPUTCHARSET UTF8 "/DAPP_DIR=$app" "/DVERSION=$version" "/DVERSION_NUMERIC=$(($version -split '-')[0]).0" "/DFILE_MANIFEST=$app\Cage.install-files.json" "/DOUTPUT_FILE=$setup" (Join-Path $PSScriptRoot '../packaging/windows/Cage.nsi')
87新增: if ($LASTEXITCODE -ne 0) { throw 'The production NSIS fixture did not compile.' }
88新增: function Run-Fixture([string]$Executable, [string[]]$Arguments) {
89新增: $process = Start-Process -FilePath $Executable -ArgumentList $Arguments -PassThru
90新增: try {
91新增: if (!$process.WaitForExit(30000)) { $process.Kill($true); $process.WaitForExit(); throw 'The owned NSIS fixture exceeded 30 seconds.' }
92新增: if ($process.ExitCode -ne 0) {
93新增: foreach ($path in @($report, "$report.helper.json")) {
94新增: if ((Test-Path -LiteralPath $path) -and (Get-Item -LiteralPath $path).Length -le 8192) { Write-Output ('Quick NSIS diagnostic: ' + (Get-Content -LiteralPath $path -Raw)) }
95新增: }
96新增: throw "The NSIS fixture returned $($process.ExitCode)."
97新增: }
98新增: } finally { $process.Dispose() }
99新增: }
100新增: try {
101新增: [IO.Directory]::CreateDirectory($target) | Out-Null
102新增: Run-Fixture $setup @('/S','/DESKTOPSHORTCUT=0','/STARTMENUSHORTCUT=0',"/DIAGNOSTICS=`"$report`"","/D=$target")
103新增: Check ((Get-Content (Join-Path $target 'program.txt') -Raw) -eq 'fixture') 'NSIS did not publish its text payload.'
104新增: Check (!(Test-Path -LiteralPath ($target + '.cage-installation.json'))) 'NSIS left the first-install receipt unfinished.'
105新增: Check ((Get-ItemProperty $key).InstallLocation -eq $target) 'NSIS registered a different fixture target.'
106新增: } finally {
107新增: if (Test-Path $key) {
108新增: if ((Get-ItemProperty $key).InstallLocation -ne $target) { throw 'NSIS fixture registration changed owner; retained for inspection.' }
109新增: Run-Fixture (Join-Path $target 'Uninstall.exe') @('/S')
110新增: $deadline = [DateTime]::UtcNow.AddSeconds(20)
111新增: while ((Test-Path -LiteralPath $target) -and [DateTime]::UtcNow -lt $deadline) { Start-Sleep -Milliseconds 100 }
112新增: }
113新增: }
114新增: Check (!(Test-Path $key) -and !(Test-Path -LiteralPath $desktop) -and !(Test-Path -LiteralPath $menu)) 'NSIS fixture left registry or shortcut changes.'
115新增: Check (!(Test-Path -LiteralPath $target)) 'NSIS fixture did not uninstall its owned files.'
116新增: Write-Output 'PASS: production NSIS silently installed/uninstalled its text-only fixture through PowerShell 5.1 transactions; no application or VM was started.'
117新增:}
65118try {
119新增: if ($InstallerSmoke) { Test-InstallerTransaction }
66120 # A new install has no backup path or existing ownership manifest.
67121 $scenario = Join-Path $root 'first-install'
68122 $old = Join-Path $scenario 'empty-destination'; $stage = Join-Path $scenario 'staged'; $receipt = Join-Path $scenario 'receipt.json'