@harness-reins/linux-x64 0.9.3 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,449 +0,0 @@
1
- <#
2
- Experimental opt-in: let Codex Desktop own a Reins-enabled App Server wrapper.
3
- Close Codex Desktop yourself before starting. This script never stops an app.
4
- -CheckOnly inspects paths and the Core version, then tests native GUI process
5
- creation with its initial thread suspended. It immediately terminates only that
6
- new probe process; it never runs GUI code, starts a server, or changes settings.
7
- Requires the Windows-capable Reins installation and an authenticated profile.
8
- Pass -Python from the Reins installation; no checkout or virtualenv is assumed.
9
- -BridgeFile accepts a fixed absolute metadata path for the selected profile.
10
- -PackageContext opts into the Windows package diagnostic launcher. Its token is
11
- not guaranteed equivalent to normal app activation. No persistent settings change.
12
- #>
13
- [CmdletBinding()]
14
- param(
15
- [Parameter(Mandatory = $true)][string]$Python,
16
- [string]$CodexHome = $(if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }),
17
- [string]$CodexBin,
18
- [string]$CoreWrapper,
19
- [string]$DesktopExe,
20
- [string]$BridgeFile,
21
- [switch]$PackageContext,
22
- [switch]$CheckOnly
23
- )
24
- $ErrorActionPreference = 'Stop'
25
- $scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
26
-
27
- function Get-DesktopPackage {
28
- if ($PSVersionTable.PSEdition -eq 'Desktop') {
29
- return Get-AppxPackage -Name 'OpenAI.Codex' | Select-Object -First 1
30
- }
31
- # Some PowerShell 7 installations cannot load Appx. Query Windows
32
- # PowerShell rather than guessing a package path.
33
- $windowsPowerShell = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'
34
- $text = & $windowsPowerShell -NoProfile -NonInteractive -Command "Get-AppxPackage -Name 'OpenAI.Codex' | Select-Object -First 1 Name,Version,InstallLocation,PackageFullName,PackageFamilyName | ConvertTo-Json -Compress"
35
- if ($LASTEXITCODE -ne 0) { throw 'Cannot inspect the Desktop package; supply -DesktopExe and -CodexBin explicitly.' }
36
- if ($text) { return $text | ConvertFrom-Json }
37
- return $null
38
- }
39
-
40
- function Resolve-Executable([string]$Value) {
41
- if (Test-Path -LiteralPath $Value -PathType Leaf) {
42
- return (Resolve-Path -LiteralPath $Value).Path
43
- }
44
- $command = Get-Command -Name $Value -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
45
- if (-not $command) { throw "Executable not found: $Value" }
46
- return $command.Source
47
- }
48
-
49
- function Get-BridgeStatus {
50
- $text = & $Python -B -m harness_reins.harness.codex.desktop.bridge --codex-home $CodexHome --metadata-file $metadata --status
51
- if ($LASTEXITCODE -notin @(0, 1)) { throw 'Cannot safely inspect the existing bridge state.' }
52
- try { $status = $text | ConvertFrom-Json } catch { throw 'The bridge status response is invalid.' }
53
- if ($null -eq $status -or $status.running -isnot [bool]) { throw 'The bridge status response has no valid running state.' }
54
- return $status
55
- }
56
-
57
- function Get-WrapperVersion {
58
- # --version is transparently delegated to REAL_CODEX by the wrapper. Only
59
- # this child receives its override; the launching shell is never mutated.
60
- $info = New-Object System.Diagnostics.ProcessStartInfo
61
- $info.FileName = $CoreWrapper
62
- $info.Arguments = '--version'
63
- $info.UseShellExecute = $false
64
- $info.CreateNoWindow = $true
65
- $info.RedirectStandardOutput = $true
66
- $info.RedirectStandardError = $true
67
- $info.EnvironmentVariables['REINS_DESKTOP_REAL_CODEX'] = $CodexBin
68
- $info.EnvironmentVariables['CODEX_HOME'] = $CodexHome
69
- $info.EnvironmentVariables['PYTHONDONTWRITEBYTECODE'] = '1'
70
- $probe = New-Object System.Diagnostics.Process
71
- $probe.StartInfo = $info
72
- try {
73
- if (-not $probe.Start()) { throw 'Cannot start the Core wrapper version check.' }
74
- $output = $probe.StandardOutput.ReadToEndAsync()
75
- $errors = $probe.StandardError.ReadToEndAsync()
76
- if (-not $probe.WaitForExit(15000)) {
77
- $probe.Kill()
78
- $probe.WaitForExit()
79
- throw 'The Core wrapper version check timed out.'
80
- }
81
- $version = $output.Result.Trim()
82
- if ($probe.ExitCode -ne 0 -or $version -ne $coreVersion) {
83
- throw 'The Core wrapper did not report the selected Desktop Core version; reinstall the matching Reins package.'
84
- }
85
- return $version
86
- } finally {
87
- $probe.Dispose()
88
- }
89
- }
90
-
91
- function Get-DesktopLaunchProbe {
92
- $probeScript = Join-Path $scriptDirectory 'probe-desktop-launch.py'
93
- if (-not (Test-Path -LiteralPath $probeScript -PathType Leaf)) {
94
- throw 'The native launch probe is missing. Reinstall the complete Reins package.'
95
- }
96
- $info = New-Object System.Diagnostics.ProcessStartInfo
97
- $info.FileName = $Python
98
- $info.Arguments = '-B "{0}" "{1}"' -f $probeScript, $DesktopExe
99
- $info.UseShellExecute = $false
100
- $info.CreateNoWindow = $true
101
- $info.RedirectStandardOutput = $true
102
- $info.RedirectStandardError = $true
103
- foreach ($key in $settings.Keys) {
104
- if ($null -eq $settings[$key]) {
105
- $info.EnvironmentVariables.Remove($key)
106
- } else {
107
- $info.EnvironmentVariables[$key] = $settings[$key]
108
- }
109
- }
110
- $probe = New-Object System.Diagnostics.Process
111
- $probe.StartInfo = $info
112
- try {
113
- if (-not $probe.Start()) { throw 'Cannot start the native Desktop launch probe.' }
114
- $output = $probe.StandardOutput.ReadToEndAsync()
115
- $errors = $probe.StandardError.ReadToEndAsync()
116
- if (-not $probe.WaitForExit(15000)) {
117
- # Do not kill a probe that might still be cleaning up its suspended
118
- # child. In particular, never substitute a PID-based GUI kill.
119
- throw "The launch probe did not finish cleanup (probe PID $($probe.Id)). No normal Desktop launch was attempted."
120
- }
121
- if ($probe.ExitCode -ne 0) {
122
- throw "The native launch probe failed or could not confirm cleanup: $($errors.Result.Trim())"
123
- }
124
- try { $result = $output.Result | ConvertFrom-Json } catch { throw 'Invalid native launch probe response.' }
125
- if ($result.can_create_suspended -isnot [bool] -or
126
- $result.cleanup_complete -ne $true -or $result.probe_resumed -ne $false) {
127
- throw 'The native launch probe did not confirm safe completion.'
128
- }
129
- return $result
130
- } finally {
131
- $probe.Dispose()
132
- }
133
- }
134
-
135
- function Invoke-PackageDesktop([bool]$ProbeOnly) {
136
- # Invoke-CommandInDesktopPackage does not guarantee inheritance of our
137
- # shell environment. Transfer only the seven intended overrides in a
138
- # temporary request, and apply them inside the package-identity helper.
139
- $basePython = (& $Python -I -c 'import sys; print(sys._base_executable)').Trim()
140
- if ($LASTEXITCODE -ne 0 -or -not $basePython) { throw 'Cannot find the base Python interpreter.' }
141
- $windowlessPython = Join-Path (Split-Path -Parent $basePython) 'pythonw.exe'
142
- if (-not (Test-Path -LiteralPath $windowlessPython -PathType Leaf)) {
143
- throw 'PackageContext requires pythonw.exe beside the base Python interpreter to keep the diagnostic helper hidden.'
144
- }
145
- $helper = Join-Path $scriptDirectory 'desktop-package-launch.py'
146
- $facade = Join-Path $scriptDirectory 'invoke-desktop-package.ps1'
147
- foreach ($file in @($helper, $facade)) {
148
- if (-not (Test-Path -LiteralPath $file -PathType Leaf)) { throw "Package launch helper is missing: $file" }
149
- }
150
- $requestDirectory = Join-Path ([IO.Path]::GetTempPath()) ('reins-desktop-launch-' + [Guid]::NewGuid().ToString('N'))
151
- [void](New-Item -ItemType Directory -Path $requestDirectory)
152
- $requestFile = Join-Path $requestDirectory 'request.json'
153
- $resultFile = Join-Path $requestDirectory 'result.json'
154
- $request = @{
155
- expected_package_full_name = $package.PackageFullName
156
- desktop_executable = $DesktopExe
157
- environment = $settings
158
- result_file = $resultFile
159
- check_only = $ProbeOnly
160
- }
161
- $invoker = $null
162
- $helperFinished = $false
163
- try {
164
- [IO.File]::WriteAllText($requestFile, ($request | ConvertTo-Json -Depth 4), (New-Object Text.UTF8Encoding($false)))
165
- $info = New-Object System.Diagnostics.ProcessStartInfo
166
- $info.FileName = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'
167
- $info.Arguments = '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File "{0}" -PackageFamilyName "{1}" -Python "{2}" -Helper "{3}" -RequestFile "{4}"' -f $facade, $package.PackageFamilyName, $windowlessPython, $helper, $requestFile
168
- $info.UseShellExecute = $false
169
- $info.CreateNoWindow = $true
170
- $info.RedirectStandardOutput = $true
171
- $info.RedirectStandardError = $true
172
- $invoker = New-Object System.Diagnostics.Process
173
- $invoker.StartInfo = $info
174
- if (-not $invoker.Start()) { throw 'Cannot start the Windows package diagnostic launcher.' }
175
- $output = $invoker.StandardOutput.ReadToEndAsync()
176
- $errors = $invoker.StandardError.ReadToEndAsync()
177
- if (-not $invoker.WaitForExit(15000)) {
178
- throw "Package activation did not return. Do not retry until the helper's outcome is resolved. Diagnostic files: $requestDirectory"
179
- }
180
- if ($invoker.ExitCode -ne 0) {
181
- throw "Windows package activation failed: $($errors.Result.Trim()). Diagnostic files: $requestDirectory"
182
- }
183
- $deadline = [DateTime]::UtcNow.AddSeconds(20)
184
- $result = $null
185
- do {
186
- if (Test-Path -LiteralPath $resultFile -PathType Leaf) {
187
- try { $result = [IO.File]::ReadAllText($resultFile) | ConvertFrom-Json } catch { $result = $null }
188
- }
189
- if ($null -ne $result) { break }
190
- Start-Sleep -Milliseconds 100
191
- } while ([DateTime]::UtcNow -lt $deadline)
192
- if ($null -eq $result) {
193
- throw "Package helper did not report completion. Do not retry until its outcome is resolved. Diagnostic files: $requestDirectory"
194
- }
195
- $helperFinished = $true
196
- if ($result.ok -ne $true) {
197
- $nativeDetail = ''
198
- if ($null -ne $result.native_launch_probe) {
199
- $nativeDetail = " Win32 error $($result.native_launch_probe.native_error_code): $($result.native_launch_probe.native_error_message)."
200
- }
201
- throw "Package helper failed: $($result.error_type): $($result.message).$nativeDetail"
202
- }
203
- if ($result.package_full_name -ne $package.PackageFullName -or
204
- $result.native_launch_probe.cleanup_complete -ne $true -or
205
- $result.native_launch_probe.probe_resumed -ne $false) {
206
- throw 'Package helper did not confirm the expected identity and probe cleanup.'
207
- }
208
- return $result
209
- } finally {
210
- if ($null -ne $invoker) { $invoker.Dispose() }
211
- # Never remove input while an uncertain helper might still need it.
212
- # No recursive deletion: these are the two exact temporary files only.
213
- if ($helperFinished) {
214
- $cleanupComplete = $false
215
- $cleanupDeadline = [DateTime]::UtcNow.AddSeconds(3)
216
- do {
217
- try {
218
- foreach ($file in @($requestFile, $resultFile)) {
219
- if (Test-Path -LiteralPath $file -PathType Leaf) { Remove-Item -LiteralPath $file -Force }
220
- }
221
- [IO.Directory]::Delete($requestDirectory, $false)
222
- $cleanupComplete = $true
223
- } catch {
224
- # A complete result can be readable just before pythonw
225
- # closes it. Retry sharing conflicts without masking launch.
226
- Start-Sleep -Milliseconds 50
227
- }
228
- } while (-not $cleanupComplete -and [DateTime]::UtcNow -lt $cleanupDeadline)
229
- if (-not $cleanupComplete) { Write-Warning "Temporary diagnostic files were retained: $requestDirectory" }
230
- }
231
- }
232
- }
233
-
234
- $Python = (Resolve-Path -LiteralPath $Python).Path
235
- $CodexHome = (Resolve-Path -LiteralPath $CodexHome).Path
236
- if (-not $DesktopExe -or $PackageContext) {
237
- $package = Get-DesktopPackage
238
- if (-not $package) { throw 'Codex Desktop package not found; supply -DesktopExe with its actual executable.' }
239
- [xml]$manifest = Get-Content -LiteralPath (Join-Path $package.InstallLocation 'AppxManifest.xml') -Raw
240
- $application = $manifest.SelectSingleNode("/*[local-name()='Package']/*[local-name()='Applications']/*[local-name()='Application'][@Id='App']")
241
- if (-not $application -or -not $application.Executable) {
242
- throw 'Cannot identify the main Desktop application in its manifest; supply -DesktopExe explicitly.'
243
- }
244
- $manifestExecutable = Join-Path $package.InstallLocation $application.Executable
245
- if ($DesktopExe -and (Resolve-Path -LiteralPath $DesktopExe).Path -ine (Resolve-Path -LiteralPath $manifestExecutable).Path) {
246
- throw 'PackageContext accepts only the installed package manifest main executable.'
247
- }
248
- $DesktopExe = $manifestExecutable
249
- }
250
- $DesktopExe = (Resolve-Path -LiteralPath $DesktopExe).Path
251
- $desktopDirectory = Split-Path -Parent $DesktopExe
252
- $bundledCore = Join-Path $desktopDirectory 'resources\codex.exe'
253
- $coreSource = 'explicit override'
254
- if (-not $CodexBin) {
255
- if (-not (Test-Path -LiteralPath $bundledCore -PathType Leaf)) {
256
- throw 'The Desktop Core was not found beside the GUI; supply -CodexBin with the matching Core executable.'
257
- }
258
- $bundledInfo = Get-Item -LiteralPath $bundledCore
259
- $bundledHash = (Get-FileHash -LiteralPath $bundledCore -Algorithm SHA256).Hash
260
- $cacheRoot = Join-Path $env:LOCALAPPDATA 'OpenAI\Codex\bin'
261
- # Packaged resources may deny direct execution. Accept a per-user cache
262
- # copy only after hashing it against this Desktop's bundle; no PATH fallback.
263
- if (Test-Path -LiteralPath $cacheRoot -PathType Container) {
264
- $directories = Get-ChildItem -LiteralPath $cacheRoot -Directory | Sort-Object LastWriteTime -Descending | Select-Object -First 64
265
- foreach ($directory in $directories) {
266
- $candidate = Join-Path $directory.FullName 'codex.exe'
267
- if (-not (Test-Path -LiteralPath $candidate -PathType Leaf)) { continue }
268
- $candidateInfo = Get-Item -LiteralPath $candidate
269
- if ($candidateInfo.Length -ne $bundledInfo.Length) { continue }
270
- if ((Get-FileHash -LiteralPath $candidate -Algorithm SHA256).Hash -eq $bundledHash) {
271
- $CodexBin = $candidate
272
- $coreSource = 'Desktop cache copy with matching bundle SHA256'
273
- break
274
- }
275
- }
276
- }
277
- if (-not $CodexBin) {
278
- $CodexBin = $bundledCore
279
- $coreSource = 'Desktop bundled Core'
280
- }
281
- }
282
- $CodexBin = Resolve-Executable $CodexBin
283
- if ([IO.Path]::GetExtension($CodexBin) -ine '.exe') {
284
- throw 'The Desktop wrapper requires the actual Core .exe; supply -CodexBin with the Desktop Core instead of a command shim.'
285
- }
286
- try {
287
- $coreVersion = ((& $CodexBin --version 2>&1) | Out-String).Trim()
288
- if ($LASTEXITCODE -ne 0 -or $coreVersion -notmatch '^codex-cli \S+$') { throw 'Unexpected Core version response.' }
289
- } catch {
290
- throw 'The selected Core cannot be executed. Supply -CodexBin with a runnable Core matching this Desktop version; global CLI fallback is intentionally disabled.'
291
- }
292
- if (-not $CoreWrapper) {
293
- $CoreWrapper = Join-Path (Split-Path -Parent $Python) 'reins-desktop-core.exe'
294
- }
295
- if (-not (Test-Path -LiteralPath $CoreWrapper -PathType Leaf)) {
296
- throw 'The reins-desktop-core.exe wrapper is not installed beside the selected Python. Install the current Reins package or supply -CoreWrapper explicitly.'
297
- }
298
- $CoreWrapper = (Resolve-Path -LiteralPath $CoreWrapper).Path
299
- if ([IO.Path]::GetExtension($CoreWrapper) -ine '.exe' -or $CoreWrapper -ieq $CodexBin) {
300
- throw 'The Core wrapper must be a separate Windows executable.'
301
- }
302
- $wrapperVersion = Get-WrapperVersion
303
- if ($BridgeFile) {
304
- $bridgeRoot = [IO.Path]::GetPathRoot($BridgeFile)
305
- # IsPathRooted alone accepts drive-relative C:foo and current-drive \foo.
306
- if (-not $bridgeRoot -or $bridgeRoot -match '^[\\/]{1}$' -or $bridgeRoot -match '^[A-Za-z]:$') {
307
- throw 'BridgeFile must be an absolute metadata path.'
308
- }
309
- $metadata = [IO.Path]::GetFullPath($BridgeFile)
310
- } else {
311
- $metadata = Join-Path $CodexHome 'harness-reins\desktop-bridge.json'
312
- }
313
- $settings = @{
314
- CODEX_HOME = $CodexHome
315
- CODEX_CLI_PATH = $CoreWrapper
316
- CODEX_APP_SERVER_FORCE_CLI = '1'
317
- CODEX_APP_SERVER_WS_URL = $null
318
- REINS_DESKTOP_REAL_CODEX = $CodexBin
319
- REINS_DESKTOP_BRIDGE_FILE = $metadata
320
- REINS_DESKTOP_APP_SERVER = '1'
321
- }
322
- $guiPaths = @($DesktopExe, (Join-Path $desktopDirectory 'ChatGPT.exe'), (Join-Path $desktopDirectory 'Codex.exe'))
323
- $guiNames = @('ChatGPT', 'Codex', [IO.Path]::GetFileNameWithoutExtension($DesktopExe)) | Select-Object -Unique
324
- $existing = @()
325
- $uninspectable = @()
326
- foreach ($process in @(Get-Process -Name $guiNames -ErrorAction SilentlyContinue)) {
327
- $processPath = $null
328
- try { $processPath = $process.Path } catch { }
329
- if (-not $processPath) {
330
- $uninspectable += $process.Id
331
- } elseif ($guiPaths -contains $processPath) {
332
- $existing += $process.Id
333
- }
334
- }
335
- if ($CheckOnly) {
336
- $packageResult = $null
337
- if ($PackageContext) {
338
- $packageResult = Invoke-PackageDesktop $true
339
- $launchProbe = $packageResult.native_launch_probe
340
- } else {
341
- $launchProbe = Get-DesktopLaunchProbe
342
- }
343
- $blockers = @()
344
- if (-not $launchProbe.can_create_suspended) { $blockers += "Native GUI creation failed: Win32 error $($launchProbe.native_error_code)." }
345
- if ($existing.Count -gt 0) { $blockers += 'Desktop is already running.' }
346
- if ($uninspectable.Count -gt 0) { $blockers += 'A matching Desktop process could not be inspected.' }
347
- if (Test-Path -LiteralPath $metadata) {
348
- try {
349
- if ((Get-BridgeStatus).running) { $blockers += 'A live bridge already exists.' }
350
- } catch {
351
- $blockers += "Existing bridge state could not be inspected: $($_.Exception.Message)"
352
- }
353
- }
354
- [pscustomobject]@{
355
- check_only = $true
356
- preflight_passed = ($blockers.Count -eq 0)
357
- native_creation_passed = $launchProbe.can_create_suspended
358
- launch_blockers = $blockers
359
- launch_mode = $(if ($PackageContext) { 'experimental package diagnostic context' } else { 'direct native creation' })
360
- verified_package_identity = $(if ($null -ne $packageResult) { $packageResult.package_full_name } else { $null })
361
- python = $Python
362
- codex_home = $CodexHome
363
- desktop_executable = $DesktopExe
364
- core_executable = $CodexBin
365
- core_source = $coreSource
366
- core_version = $coreVersion
367
- core_wrapper = $CoreWrapper
368
- wrapper_core_version = $wrapperVersion
369
- bridge_metadata = $metadata
370
- child_environment = $settings
371
- desktop_running = ($existing.Count -gt 0)
372
- desktop_process_ids = $existing
373
- uninspectable_process_ids = $uninspectable
374
- native_launch_probe = $launchProbe
375
- launch_validation = 'Only suspended native process creation was tested. GUI execution, wrapper inheritance, App Tools and original-session ACK remain unverified.'
376
- } | ConvertTo-Json -Depth 3
377
- if ($blockers.Count -gt 0) { exit 1 }
378
- return
379
- }
380
- if ($existing.Count -gt 0 -or $uninspectable.Count -gt 0) {
381
- throw 'Codex Desktop is running, or a matching process could not be inspected. Save work and close Desktop before switching its App Server connection. No process was stopped.'
382
- }
383
- if (Test-Path -LiteralPath $metadata) {
384
- $status = Get-BridgeStatus
385
- if ($status.running -eq $true) { throw 'A bridge already exists. Inspect it and use its documented connection, or stop it after its clients close.' }
386
- }
387
- if ($PackageContext) {
388
- Write-Output 'Using the experimental Windows package diagnostic context. It is not guaranteed equivalent to normal app activation.'
389
- $packageResult = Invoke-PackageDesktop $false
390
- if (-not $packageResult.native_launch_probe.can_create_suspended -or -not $packageResult.desktop_pid) {
391
- throw 'Package helper did not confirm native creation and a Desktop launch request.'
392
- }
393
- $deadline = [DateTime]::UtcNow.AddSeconds(20)
394
- $bridgeReady = $false
395
- do {
396
- if (Test-Path -LiteralPath $metadata -PathType Leaf) {
397
- try {
398
- $bridgeStatus = Get-BridgeStatus
399
- $bridgeReady = ($bridgeStatus.running -eq $true -and
400
- $bridgeStatus.codex_home -ieq $CodexHome -and
401
- $bridgeStatus.active_clients -ge 1)
402
- } catch { $bridgeReady = $false }
403
- }
404
- if ($bridgeReady) { break }
405
- Start-Sleep -Milliseconds 250
406
- } while ([DateTime]::UtcNow -lt $deadline)
407
- if (-not $bridgeReady) {
408
- throw "Desktop launch was requested (PID $($packageResult.desktop_pid)), but a live bridge was not observed. Do not assume callback support or retry blindly. Inspect $metadata and Desktop's startup logs; no existing process was stopped."
409
- }
410
- Write-Output "A live bridge with a connected client was observed for this Codex profile: $metadata"
411
- Write-Output 'Validate App Tools and original-session delivery/ACK before relying on this experimental startup path.'
412
- return
413
- }
414
- $launchProbe = Get-DesktopLaunchProbe
415
- if (-not $launchProbe.can_create_suspended) {
416
- throw "Desktop native launch is unavailable (Win32 error $($launchProbe.native_error_code): $($launchProbe.native_error_message)). Executable: $DesktopExe. This launcher cannot yet start this packaged Desktop with its bridge environment. Repeating a restart or using an elevated shell is not a verified fix. No existing Desktop process was stopped and no server was started."
417
- }
418
- # Desktop creates the wrapper itself and supplies fresh App Tools IPC settings
419
- # and exact Core arguments. Never prestart an external server with stale IPC.
420
- $launchInfo = New-Object System.Diagnostics.ProcessStartInfo
421
- $launchInfo.FileName = $DesktopExe
422
- $launchInfo.WorkingDirectory = $desktopDirectory
423
- $launchInfo.UseShellExecute = $false
424
- foreach ($key in $settings.Keys) {
425
- if ($null -eq $settings[$key]) {
426
- $launchInfo.EnvironmentVariables.Remove($key)
427
- } else {
428
- $launchInfo.EnvironmentVariables[$key] = $settings[$key]
429
- }
430
- }
431
- try {
432
- # UseShellExecute=false passes this child-only environment directly. Do not
433
- # substitute ShellAppsFolder activation: override inheritance is unverified.
434
- $desktopProcess = [System.Diagnostics.Process]::Start($launchInfo)
435
- if (-not $desktopProcess) { throw 'Desktop process creation returned no process.' }
436
- $desktopProcess.Dispose()
437
- } catch {
438
- $launchError = $_.Exception
439
- while ($launchError.InnerException) { $launchError = $launchError.InnerException }
440
- $errorCode = if ($launchError -is [System.ComponentModel.Win32Exception]) {
441
- "Win32 error $($launchError.NativeErrorCode)"
442
- } else {
443
- $launchError.GetType().FullName
444
- }
445
- throw "Desktop launch failed ($errorCode): $($launchError.Message). Executable: $DesktopExe. No server was prestarted and no existing Desktop process was stopped."
446
- }
447
- Write-Output 'Desktop launch was requested with its experimental Core wrapper. Open the original conversation and validate tools and callback delivery before relying on it.'
448
- Write-Output "For Reins setup in another terminal, set REINS_DESKTOP_BRIDGE_FILE to: $metadata"
449
- Write-Output 'Desktop owns the wrapper and its App Server. Closing Desktop closes its stdio connection and the wrapper-managed bridge.'
@@ -1,18 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: harness-reins
3
- Version: 0.9.3
4
- Summary: Harness Reins: a harness for your harnesses. Dispatch work to Codex, Claude Code or Pi and route the result back to the session that asked.
5
- Author: Local
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/lz59970062/harness-reins
8
- Project-URL: Repository, https://github.com/lz59970062/harness-reins
9
- Project-URL: Changelog, https://github.com/lz59970062/harness-reins/blob/main/CHANGELOG.md
10
- Project-URL: Issues, https://github.com/lz59970062/harness-reins/issues
11
- Keywords: agents,harness,codex,claude-code,pi,callback,long-running-tasks
12
- Classifier: Operating System :: Microsoft :: Windows
13
- Classifier: Operating System :: MacOS :: MacOS X
14
- Classifier: Operating System :: POSIX :: Linux
15
- Classifier: Programming Language :: Python :: 3
16
- Requires-Python: >=3.9
17
- Description-Content-Type: text/markdown
18
- Requires-Dist: PyYAML>=6.0