@caupulican/pi-adaptative 0.91.4 → 0.93.0
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.
- package/CHANGELOG.md +43 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +24 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli.js +6 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +1 -0
- package/dist/core/agent-session-contracts.d.ts.map +1 -1
- package/dist/core/agent-session-contracts.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +15 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +7 -1
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +2 -4
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +0 -1
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +1 -0
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/bash-executor.d.ts +2 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +13 -4
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +2 -1
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/context/context-composition.d.ts +1 -1
- package/dist/core/context/context-composition.d.ts.map +1 -1
- package/dist/core/context/context-composition.js +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts +0 -10
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +3 -1
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/extensions/bundled-virtual-modules.js +8 -0
- package/dist/core/extensions/bundled-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +4 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +4 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +6 -2
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +15 -4
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
- package/dist/core/goals/compact-goal-context.js +10 -14
- package/dist/core/goals/compact-goal-context.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.d.ts +0 -2
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +0 -2
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +7 -7
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +27 -5
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +7 -0
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/goal-tool-names.d.ts +7 -0
- package/dist/core/goals/goal-tool-names.d.ts.map +1 -0
- package/dist/core/goals/goal-tool-names.js +8 -0
- package/dist/core/goals/goal-tool-names.js.map +1 -0
- package/dist/core/model-capability.d.ts +1 -1
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +3 -1
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/models/perf-profile.d.ts +2 -1
- package/dist/core/models/perf-profile.d.ts.map +1 -1
- package/dist/core/models/perf-profile.js +1 -1
- package/dist/core/models/perf-profile.js.map +1 -1
- package/dist/core/provider-request-context-controller.d.ts.map +1 -1
- package/dist/core/provider-request-context-controller.js +6 -5
- package/dist/core/provider-request-context-controller.js.map +1 -1
- package/dist/core/provider-request-runtime-controller.d.ts.map +1 -1
- package/dist/core/provider-request-runtime-controller.js +3 -2
- package/dist/core/provider-request-runtime-controller.js.map +1 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +13 -4
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/sdk.d.ts +3 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-analytics.d.ts +2 -2
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +3 -2
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-manager-factory.d.ts +1 -1
- package/dist/core/session-manager-factory.d.ts.map +1 -1
- package/dist/core/session-manager-factory.js +1 -1
- package/dist/core/session-manager-factory.js.map +1 -1
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +2 -0
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/session-tree-navigator.d.ts +2 -2
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +1 -1
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/skill-vault.d.ts +6 -7
- package/dist/core/skill-vault.d.ts.map +1 -1
- package/dist/core/skill-vault.js +12 -12
- package/dist/core/skill-vault.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts.map +1 -1
- package/dist/core/tool-capability-policy.js +2 -1
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +27 -12
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/early-powershell-session.d.ts +21 -0
- package/dist/core/tools/early-powershell-session.d.ts.map +1 -0
- package/dist/core/tools/early-powershell-session.js +137 -0
- package/dist/core/tools/early-powershell-session.js.map +1 -0
- package/dist/core/tools/edit.d.ts +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-failure-recovery.d.ts +1 -1
- package/dist/core/tools/file-failure-recovery.d.ts.map +1 -1
- package/dist/core/tools/file-failure-recovery.js +1 -1
- package/dist/core/tools/file-failure-recovery.js.map +1 -1
- package/dist/core/tools/goal.d.ts +9 -2
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +64 -1
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +2 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +2 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/persistent-process-coordinator.d.ts.map +1 -1
- package/dist/core/tools/persistent-process-coordinator.js +2 -11
- package/dist/core/tools/persistent-process-coordinator.js.map +1 -1
- package/dist/core/tools/read.d.ts +2 -2
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +11 -9
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/shell-output-decoder.d.ts +7 -0
- package/dist/core/tools/shell-output-decoder.d.ts.map +1 -0
- package/dist/core/tools/shell-output-decoder.js +135 -0
- package/dist/core/tools/shell-output-decoder.js.map +1 -0
- package/dist/core/tools/shell-session.d.ts +23 -6
- package/dist/core/tools/shell-session.d.ts.map +1 -1
- package/dist/core/tools/shell-session.js +275 -88
- package/dist/core/tools/shell-session.js.map +1 -1
- package/dist/core/tools/skill.js +2 -2
- package/dist/core/tools/skill.js.map +1 -1
- package/dist/core/tools/write.d.ts +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -33
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +63 -27
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/utils/child-process-ref.d.ts +4 -0
- package/dist/utils/child-process-ref.d.ts.map +1 -0
- package/dist/utils/child-process-ref.js +15 -0
- package/dist/utils/child-process-ref.js.map +1 -0
- package/dist/utils/powershell-session-protocol.d.ts +16 -0
- package/dist/utils/powershell-session-protocol.d.ts.map +1 -0
- package/dist/utils/powershell-session-protocol.js +63 -0
- package/dist/utils/powershell-session-protocol.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -4
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +38 -23
- package/dist/utils/shell.js.map +1 -1
- package/docs/settings.md +2 -2
- package/docs/windows.md +9 -8
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +318 -332
- package/package.json +4 -4
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Native PowerShell cold starts can cross five seconds under loaded Windows/WSL hosts. */
|
|
2
|
+
export const POWERSHELL_STARTUP_PROBE_TIMEOUT_MS = 15_000;
|
|
3
|
+
export const POWERSHELL_ARGS = ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command"];
|
|
4
|
+
export const POWERSHELL_7_GUARD = "if ($PSVersionTable.PSVersion.Major -lt 7) { throw 'Pi requires PowerShell 7 or newer.' }\n";
|
|
5
|
+
export const POWERSHELL_SESSION_READY_MARKER = "\x1epi-shell-ready\x1e";
|
|
6
|
+
export const POWERSHELL_SESSION_STDERR_READY_MARKER = "\x1epi-shell-stderr-ready\x1e\n";
|
|
7
|
+
export const POWERSHELL_STDERR_BARRIER_LABEL = "stderr";
|
|
8
|
+
const POWERSHELL_HEADLESS_ENVIRONMENT = {
|
|
9
|
+
NO_COLOR: "1",
|
|
10
|
+
POWERSHELL_DIAGNOSTICS_OPTOUT: "1",
|
|
11
|
+
POWERSHELL_TELEMETRY_OPTOUT: "1",
|
|
12
|
+
POWERSHELL_UPDATECHECK: "Off",
|
|
13
|
+
};
|
|
14
|
+
const POWERSHELL_HEADLESS_ENVIRONMENT_NAMES = new Set(Object.keys(POWERSHELL_HEADLESS_ENVIRONMENT).map((name) => name.toLowerCase()));
|
|
15
|
+
/** Deterministic process-only settings for Pi's non-interactive PowerShell host. */
|
|
16
|
+
export function createPowerShellHostEnvironment(environment) {
|
|
17
|
+
const resolved = {};
|
|
18
|
+
for (const [name, value] of Object.entries(environment)) {
|
|
19
|
+
if (!POWERSHELL_HEADLESS_ENVIRONMENT_NAMES.has(name.toLowerCase()))
|
|
20
|
+
resolved[name] = value;
|
|
21
|
+
}
|
|
22
|
+
return { ...resolved, ...POWERSHELL_HEADLESS_ENVIRONMENT };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* PowerShell 7 persistent REPL bootstrap. The stdout/stderr readiness markers let the process that
|
|
26
|
+
* actually serves commands double as its own availability probe and prime both pipes. Command I/O
|
|
27
|
+
* encoding remains owned by PowerShell and the invoked program; only Pi's base64 wire is UTF-8.
|
|
28
|
+
*/
|
|
29
|
+
export const POWERSHELL_BOOTSTRAP = [
|
|
30
|
+
POWERSHELL_7_GUARD.trimEnd(),
|
|
31
|
+
"$ProgressPreference = 'SilentlyContinue'",
|
|
32
|
+
"$__pi_stdout = [System.IO.StreamWriter]::new([Console]::OpenStandardOutput(), [System.Text.UTF8Encoding]::new($false))",
|
|
33
|
+
"$__pi_stdout.AutoFlush = $true",
|
|
34
|
+
"[Console]::SetOut($__pi_stdout)",
|
|
35
|
+
"$__pi_stderr = [System.IO.StreamWriter]::new([Console]::OpenStandardError(), [System.Text.UTF8Encoding]::new($false))",
|
|
36
|
+
"$__pi_stderr.AutoFlush = $true",
|
|
37
|
+
"[Console]::SetError($__pi_stderr)",
|
|
38
|
+
"$null = Invoke-Expression \"Write-Output '__pi_warmup'\"",
|
|
39
|
+
"[Console]::Error.Write(([char]30) + 'pi-shell-stderr-ready' + ([char]30) + ([char]10))",
|
|
40
|
+
"[Console]::Error.Flush()",
|
|
41
|
+
"[Console]::Out.Write(([char]30) + 'pi-shell-ready' + ([char]30))",
|
|
42
|
+
"function global:__pi_complete_status([int]$Code) { $global:LASTEXITCODE = $Code }",
|
|
43
|
+
"$__pi_in = [Console]::In",
|
|
44
|
+
"while ($true) {",
|
|
45
|
+
"\t$__pi_line = $__pi_in.ReadLine()",
|
|
46
|
+
"\tif ($null -eq $__pi_line) { break }",
|
|
47
|
+
"\t$__pi_sp = $__pi_line.IndexOf(' ')",
|
|
48
|
+
"\tif ($__pi_sp -lt 1) { continue }",
|
|
49
|
+
"\t$__pi_nonce = $__pi_line.Substring(0, $__pi_sp)",
|
|
50
|
+
"\t$__pi_cmd = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($__pi_line.Substring($__pi_sp + 1)))",
|
|
51
|
+
"\t$global:LASTEXITCODE = $null",
|
|
52
|
+
"\t$__pi_thrown = $false",
|
|
53
|
+
"\t$__pi_succeeded = $false",
|
|
54
|
+
"\ttry { Invoke-Expression $__pi_cmd; $__pi_succeeded = $? } catch { $__pi_thrown = $true; $__pi_msg = ($_ | Out-String).TrimEnd(); if ($__pi_msg) { [Console]::Out.WriteLine($__pi_msg) } }",
|
|
55
|
+
"\t$__pi_code = $global:LASTEXITCODE",
|
|
56
|
+
"\tif ($null -eq $__pi_code) { $__pi_code = if ($__pi_succeeded) { 0 } else { 1 } }",
|
|
57
|
+
"\tif ($__pi_thrown -and ($__pi_code -eq 0)) { $__pi_code = 1 }",
|
|
58
|
+
`\t[Console]::Error.Write(('{0}{1}:${POWERSHELL_STDERR_BARRIER_LABEL}{0}{2}' -f [char]30, $__pi_nonce, [char]10))`,
|
|
59
|
+
"\t[Console]::Error.Flush()",
|
|
60
|
+
"\t[Console]::Out.Write(('{0}{1}{2}:{3}{1}' -f [char]10, [char]30, $__pi_nonce, $__pi_code))",
|
|
61
|
+
"}",
|
|
62
|
+
].join("\n");
|
|
63
|
+
//# sourceMappingURL=powershell-session-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powershell-session-protocol.js","sourceRoot":"","sources":["../../src/utils/powershell-session-protocol.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,YAAY,EAA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F;IACnF,0BAA0B;IAC1B,iBAAiB;IACjB,oCAAoC;IACpC,uCAAuC;IACvC,sCAAsC;IACtC,oCAAoC;IACpC,mDAAmD;IACnD,8HAA8H;IAC9H,gCAAgC;IAChC,yBAAyB;IACzB,4BAA4B;IAC5B,6LAA6L;IAC7L,qCAAqC;IACrC,oFAAoF;IACpF,gEAAgE;IAChE,qCAAqC,+BAA+B,8CAA8C;IAClH,4BAA4B;IAC5B,6FAA6F;IAC7F,GAAG;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC","sourcesContent":["/** Native PowerShell cold starts can cross five seconds under loaded Windows/WSL hosts. */\nexport const POWERSHELL_STARTUP_PROBE_TIMEOUT_MS = 15_000;\nexport const POWERSHELL_ARGS = [\"-NoLogo\", \"-NoProfile\", \"-NonInteractive\", \"-Command\"] as const;\nexport const POWERSHELL_7_GUARD =\n\t\"if ($PSVersionTable.PSVersion.Major -lt 7) { throw 'Pi requires PowerShell 7 or newer.' }\\n\";\nexport const POWERSHELL_SESSION_READY_MARKER = \"\\x1epi-shell-ready\\x1e\";\nexport const POWERSHELL_SESSION_STDERR_READY_MARKER = \"\\x1epi-shell-stderr-ready\\x1e\\n\";\nexport const POWERSHELL_STDERR_BARRIER_LABEL = \"stderr\";\n\nconst POWERSHELL_HEADLESS_ENVIRONMENT = {\n\tNO_COLOR: \"1\",\n\tPOWERSHELL_DIAGNOSTICS_OPTOUT: \"1\",\n\tPOWERSHELL_TELEMETRY_OPTOUT: \"1\",\n\tPOWERSHELL_UPDATECHECK: \"Off\",\n} as const;\nconst POWERSHELL_HEADLESS_ENVIRONMENT_NAMES = new Set(\n\tObject.keys(POWERSHELL_HEADLESS_ENVIRONMENT).map((name) => name.toLowerCase()),\n);\n\n/** Deterministic process-only settings for Pi's non-interactive PowerShell host. */\nexport function createPowerShellHostEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n\tconst resolved: NodeJS.ProcessEnv = {};\n\tfor (const [name, value] of Object.entries(environment)) {\n\t\tif (!POWERSHELL_HEADLESS_ENVIRONMENT_NAMES.has(name.toLowerCase())) resolved[name] = value;\n\t}\n\treturn { ...resolved, ...POWERSHELL_HEADLESS_ENVIRONMENT };\n}\n\n/**\n * PowerShell 7 persistent REPL bootstrap. The stdout/stderr readiness markers let the process that\n * actually serves commands double as its own availability probe and prime both pipes. Command I/O\n * encoding remains owned by PowerShell and the invoked program; only Pi's base64 wire is UTF-8.\n */\nexport const POWERSHELL_BOOTSTRAP = [\n\tPOWERSHELL_7_GUARD.trimEnd(),\n\t\"$ProgressPreference = 'SilentlyContinue'\",\n\t\"$__pi_stdout = [System.IO.StreamWriter]::new([Console]::OpenStandardOutput(), [System.Text.UTF8Encoding]::new($false))\",\n\t\"$__pi_stdout.AutoFlush = $true\",\n\t\"[Console]::SetOut($__pi_stdout)\",\n\t\"$__pi_stderr = [System.IO.StreamWriter]::new([Console]::OpenStandardError(), [System.Text.UTF8Encoding]::new($false))\",\n\t\"$__pi_stderr.AutoFlush = $true\",\n\t\"[Console]::SetError($__pi_stderr)\",\n\t\"$null = Invoke-Expression \\\"Write-Output '__pi_warmup'\\\"\",\n\t\"[Console]::Error.Write(([char]30) + 'pi-shell-stderr-ready' + ([char]30) + ([char]10))\",\n\t\"[Console]::Error.Flush()\",\n\t\"[Console]::Out.Write(([char]30) + 'pi-shell-ready' + ([char]30))\",\n\t\"function global:__pi_complete_status([int]$Code) { $global:LASTEXITCODE = $Code }\",\n\t\"$__pi_in = [Console]::In\",\n\t\"while ($true) {\",\n\t\"\\t$__pi_line = $__pi_in.ReadLine()\",\n\t\"\\tif ($null -eq $__pi_line) { break }\",\n\t\"\\t$__pi_sp = $__pi_line.IndexOf(' ')\",\n\t\"\\tif ($__pi_sp -lt 1) { continue }\",\n\t\"\\t$__pi_nonce = $__pi_line.Substring(0, $__pi_sp)\",\n\t\"\\t$__pi_cmd = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($__pi_line.Substring($__pi_sp + 1)))\",\n\t\"\\t$global:LASTEXITCODE = $null\",\n\t\"\\t$__pi_thrown = $false\",\n\t\"\\t$__pi_succeeded = $false\",\n\t\"\\ttry { Invoke-Expression $__pi_cmd; $__pi_succeeded = $? } catch { $__pi_thrown = $true; $__pi_msg = ($_ | Out-String).TrimEnd(); if ($__pi_msg) { [Console]::Out.WriteLine($__pi_msg) } }\",\n\t\"\\t$__pi_code = $global:LASTEXITCODE\",\n\t\"\\tif ($null -eq $__pi_code) { $__pi_code = if ($__pi_succeeded) { 0 } else { 1 } }\",\n\t\"\\tif ($__pi_thrown -and ($__pi_code -eq 0)) { $__pi_code = 1 }\",\n\t`\\t[Console]::Error.Write(('{0}{1}:${POWERSHELL_STDERR_BARRIER_LABEL}{0}{2}' -f [char]30, $__pi_nonce, [char]10))`,\n\t\"\\t[Console]::Error.Flush()\",\n\t\"\\t[Console]::Out.Write(('{0}{1}{2}:{3}{1}' -f [char]10, [char]30, $__pi_nonce, $__pi_code))\",\n\t\"}\",\n].join(\"\\n\");\n"]}
|
package/dist/utils/shell.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
export { POWERSHELL_STARTUP_PROBE_TIMEOUT_MS } from "./powershell-session-protocol.ts";
|
|
1
2
|
export type PlatformShellToolName = "bash" | "powershell";
|
|
2
3
|
export interface ShellConfig {
|
|
3
4
|
shell: string;
|
|
4
5
|
args: string[];
|
|
5
6
|
}
|
|
6
|
-
export declare const POWERSHELL_UTF8_PREFIX = "try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\n";
|
|
7
|
-
/** Native PowerShell cold starts can cross five seconds under loaded Windows/WSL hosts. */
|
|
8
|
-
export declare const POWERSHELL_STARTUP_PROBE_TIMEOUT_MS = 15000;
|
|
9
7
|
export declare function getPlatformShellToolName(platform?: NodeJS.Platform): PlatformShellToolName;
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Ordered PowerShell candidates without launching a disposable interpreter. Persistent sessions
|
|
10
|
+
* validate these candidates with their real long-lived bootstrap, so the normal path pays for one
|
|
11
|
+
* PowerShell process instead of probing one process and then spawning another.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPowerShellCandidateConfigs(): ShellConfig[];
|
|
11
14
|
/** Resolve the requested shell. Runtime callers omit shellName to select PowerShell on Windows and Bash elsewhere. */
|
|
12
15
|
export declare function getShellConfig(customShellPath?: string, shellName?: PlatformShellToolName): ShellConfig;
|
|
13
16
|
export declare function getShellEnv(): NodeJS.ProcessEnv;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,mCAAmC,EAAE,MAAM,kCAAkC,CAAC;AAEvF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,YAAY,CAAC;AAE1D,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;CACf;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,qBAAqB,CAE5G;AAuCD;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,WAAW,EAAE,CAqB7D;AAkCD,sHAAsH;AACtH,wBAAgB,cAAc,CAC7B,eAAe,CAAC,EAAE,MAAM,EACxB,SAAS,GAAE,qBAAkD,GAC3D,WAAW,CAkBb;AAED,wBAAgB,WAAW,IAAI,MAAM,CAAC,UAAU,CAoB/C;AAQD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAyBjD"}
|
package/dist/utils/shell.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { delimiter } from "node:path";
|
|
2
|
+
import { basename, delimiter } from "node:path";
|
|
3
3
|
import { spawnSync } from "child_process";
|
|
4
4
|
import { getBinDir } from "../config.js";
|
|
5
5
|
import { ensureManagedJscpd } from "./bundled-jscpd.js";
|
|
6
6
|
import { normalizePath } from "./paths.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const POWERSHELL_STARTUP_PROBE_TIMEOUT_MS = 15_000;
|
|
10
|
-
const POWERSHELL_ARGS = ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command"];
|
|
7
|
+
import { createPowerShellHostEnvironment, POWERSHELL_7_GUARD, POWERSHELL_ARGS, POWERSHELL_STARTUP_PROBE_TIMEOUT_MS, } from "./powershell-session-protocol.js";
|
|
8
|
+
export { POWERSHELL_STARTUP_PROBE_TIMEOUT_MS } from "./powershell-session-protocol.js";
|
|
11
9
|
export function getPlatformShellToolName(platform = process.platform) {
|
|
12
10
|
return platform === "win32" ? "powershell" : "bash";
|
|
13
11
|
}
|
|
14
|
-
export function prefixPowerShellCommand(command) {
|
|
15
|
-
return command.trimStart().startsWith(POWERSHELL_UTF8_PREFIX) ? command : `${POWERSHELL_UTF8_PREFIX}${command}`;
|
|
16
|
-
}
|
|
17
12
|
function findExecutableOnPath(executable) {
|
|
18
13
|
const locator = process.platform === "win32" ? "where" : "which";
|
|
19
14
|
try {
|
|
@@ -35,8 +30,9 @@ function findExecutableOnPath(executable) {
|
|
|
35
30
|
}
|
|
36
31
|
function isPowerShellExecutableAvailable(executable) {
|
|
37
32
|
try {
|
|
38
|
-
return (spawnSync(executable, [...POWERSHELL_ARGS,
|
|
33
|
+
return (spawnSync(executable, [...POWERSHELL_ARGS, `${POWERSHELL_7_GUARD}Write-Output ok`], {
|
|
39
34
|
encoding: "utf-8",
|
|
35
|
+
env: createPowerShellHostEnvironment(process.env),
|
|
40
36
|
timeout: POWERSHELL_STARTUP_PROBE_TIMEOUT_MS,
|
|
41
37
|
windowsHide: true,
|
|
42
38
|
}).status === 0);
|
|
@@ -45,28 +41,44 @@ function isPowerShellExecutableAvailable(executable) {
|
|
|
45
41
|
return false;
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
|
-
function
|
|
44
|
+
function isPowerShell7Executable(executable) {
|
|
45
|
+
return /^pwsh(?:\.exe)?$/iu.test(basename(executable));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ordered PowerShell candidates without launching a disposable interpreter. Persistent sessions
|
|
49
|
+
* validate these candidates with their real long-lived bootstrap, so the normal path pays for one
|
|
50
|
+
* PowerShell process instead of probing one process and then spawning another.
|
|
51
|
+
*/
|
|
52
|
+
export function getPowerShellCandidateConfigs() {
|
|
53
|
+
const candidates = [];
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const addCandidate = (shell) => {
|
|
56
|
+
if (!shell || !isPowerShell7Executable(shell))
|
|
57
|
+
return;
|
|
58
|
+
const identity = process.platform === "win32" ? shell.toLowerCase() : shell;
|
|
59
|
+
if (seen.has(identity))
|
|
60
|
+
return;
|
|
61
|
+
seen.add(identity);
|
|
62
|
+
candidates.push({ shell, args: [...POWERSHELL_ARGS] });
|
|
63
|
+
};
|
|
49
64
|
const pwshOnPath = findExecutableOnPath(process.platform === "win32" ? "pwsh.exe" : "pwsh");
|
|
50
|
-
|
|
51
|
-
return { shell: pwshOnPath, args: [...POWERSHELL_ARGS] };
|
|
52
|
-
}
|
|
65
|
+
addCandidate(pwshOnPath);
|
|
53
66
|
const knownPaths = [];
|
|
54
67
|
const programFiles = process.env.ProgramFiles;
|
|
55
68
|
if (programFiles)
|
|
56
69
|
knownPaths.push(`${programFiles}\\PowerShell\\7\\pwsh.exe`);
|
|
57
|
-
const systemRoot = process.env.SystemRoot;
|
|
58
|
-
if (systemRoot)
|
|
59
|
-
knownPaths.push(`${systemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`);
|
|
60
70
|
for (const path of knownPaths) {
|
|
61
|
-
if (existsSync(path)
|
|
62
|
-
|
|
63
|
-
}
|
|
71
|
+
if (existsSync(path))
|
|
72
|
+
addCandidate(path);
|
|
64
73
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
return candidates;
|
|
75
|
+
}
|
|
76
|
+
function getPowerShellConfig() {
|
|
77
|
+
for (const candidate of getPowerShellCandidateConfigs()) {
|
|
78
|
+
if (isPowerShellExecutableAvailable(candidate.shell))
|
|
79
|
+
return candidate;
|
|
68
80
|
}
|
|
69
|
-
throw new Error("
|
|
81
|
+
throw new Error("PowerShell 7 (pwsh) was not found. Install pwsh or set shellPath to a pwsh executable.");
|
|
70
82
|
}
|
|
71
83
|
function getBashConfig() {
|
|
72
84
|
if (process.platform === "win32") {
|
|
@@ -100,6 +112,9 @@ let managedJscpdProvisionAttempted = false;
|
|
|
100
112
|
export function getShellConfig(customShellPath, shellName = getPlatformShellToolName()) {
|
|
101
113
|
if (customShellPath) {
|
|
102
114
|
const resolvedShellPath = normalizePath(customShellPath);
|
|
115
|
+
if (shellName === "powershell" && !isPowerShell7Executable(resolvedShellPath)) {
|
|
116
|
+
throw new Error(`Custom PowerShell host must be PowerShell 7 (pwsh): ${resolvedShellPath}`);
|
|
117
|
+
}
|
|
103
118
|
if (!existsSync(resolvedShellPath))
|
|
104
119
|
throw new Error(`Custom shell path not found: ${resolvedShellPath}`);
|
|
105
120
|
return {
|
package/dist/utils/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,C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AI,GAAG,EAAU,CAAC;AAEnD,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAChD,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAW;IAClD,wBAAwB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,2BAA2B;IAC1C,KAAK,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC5C,eAAe,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IACD,wBAAwB,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,uFAAuF;QACvF,6DAA6D;QAC7D,IAAI,CAAC;YACJ,SAAS,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACxD,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,IAAI;aACjB,CAAC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACR,kCAAkC;QACnC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,gCAAgC;QAChC,IAAI,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,iEAAiE;YACjE,IAAI,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACR,uBAAuB;YACxB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { delimiter } from \"node:path\";\nimport { spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.ts\";\nimport { ensureManagedJscpd } from \"./bundled-jscpd.ts\";\nimport { normalizePath } from \"./paths.ts\";\n\nexport type PlatformShellToolName = \"bash\" | \"powershell\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n}\n\nexport const POWERSHELL_UTF8_PREFIX = \"try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\\n\";\n/** Native PowerShell cold starts can cross five seconds under loaded Windows/WSL hosts. */\nexport const POWERSHELL_STARTUP_PROBE_TIMEOUT_MS = 15_000;\n\nconst POWERSHELL_ARGS = [\"-NoLogo\", \"-NoProfile\", \"-NonInteractive\", \"-Command\"];\n\nexport function getPlatformShellToolName(platform: NodeJS.Platform = process.platform): PlatformShellToolName {\n\treturn platform === \"win32\" ? \"powershell\" : \"bash\";\n}\n\nexport function prefixPowerShellCommand(command: string): string {\n\treturn command.trimStart().startsWith(POWERSHELL_UTF8_PREFIX) ? command : `${POWERSHELL_UTF8_PREFIX}${command}`;\n}\n\nfunction findExecutableOnPath(executable: string): string | null {\n\tconst locator = process.platform === \"win32\" ? \"where\" : \"which\";\n\ttry {\n\t\tconst result = spawnSync(locator, [executable], {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 5_000,\n\t\t\twindowsHide: true,\n\t\t});\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch && (process.platform !== \"win32\" || existsSync(firstMatch))) return firstMatch;\n\t\t}\n\t} catch {\n\t\t// Resolution falls through to known paths or the platform fallback.\n\t}\n\treturn null;\n}\n\nfunction isPowerShellExecutableAvailable(executable: string): boolean {\n\ttry {\n\t\treturn (\n\t\t\tspawnSync(executable, [...POWERSHELL_ARGS, \"Write-Output ok\"], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\ttimeout: POWERSHELL_STARTUP_PROBE_TIMEOUT_MS,\n\t\t\t\twindowsHide: true,\n\t\t\t}).status === 0\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction getPowerShellConfig(): ShellConfig {\n\tconst pwshOnPath = findExecutableOnPath(process.platform === \"win32\" ? \"pwsh.exe\" : \"pwsh\");\n\tif (pwshOnPath && isPowerShellExecutableAvailable(pwshOnPath)) {\n\t\treturn { shell: pwshOnPath, args: [...POWERSHELL_ARGS] };\n\t}\n\n\tconst knownPaths: string[] = [];\n\tconst programFiles = process.env.ProgramFiles;\n\tif (programFiles) knownPaths.push(`${programFiles}\\\\PowerShell\\\\7\\\\pwsh.exe`);\n\tconst systemRoot = process.env.SystemRoot;\n\tif (systemRoot) knownPaths.push(`${systemRoot}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`);\n\tfor (const path of knownPaths) {\n\t\tif (existsSync(path) && isPowerShellExecutableAvailable(path)) {\n\t\t\treturn { shell: path, args: [...POWERSHELL_ARGS] };\n\t\t}\n\t}\n\n\tconst windowsPowerShellOnPath = findExecutableOnPath(\"powershell.exe\");\n\tif (windowsPowerShellOnPath && isPowerShellExecutableAvailable(windowsPowerShellOnPath)) {\n\t\treturn { shell: windowsPowerShellOnPath, args: [...POWERSHELL_ARGS] };\n\t}\n\tthrow new Error(\n\t\t\"No PowerShell executable found. Install PowerShell 7 (pwsh), restore Windows PowerShell, or set shellPath in settings.json.\",\n\t);\n}\n\nfunction getBashConfig(): ShellConfig {\n\tif (process.platform === \"win32\") {\n\t\tconst knownPaths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) knownPaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) knownPaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\tfor (const path of knownPaths) {\n\t\t\tif (existsSync(path)) return { shell: path, args: [\"-c\"] };\n\t\t}\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) return { shell: bashOnPath, args: [\"-c\"] };\n\t\tthrow new Error(\"No Bash executable found. Install Git Bash or set shellPath in settings.json.\");\n\t}\n\tif (existsSync(\"/bin/bash\")) return { shell: \"/bin/bash\", args: [\"-c\"] };\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\treturn bashOnPath ? { shell: bashOnPath, args: [\"-c\"] } : { shell: \"sh\", args: [\"-c\"] };\n}\n\n// Platform shell resolution spawns probe processes (`where`/`which`, plus a full PowerShell\n// boot on Windows) and is a process-lifetime invariant, so successful resolutions are cached.\n// Failures are not cached: the user can install a shell and retry without restarting.\nconst resolvedPlatformShellConfigs = new Map<PlatformShellToolName, ShellConfig>();\nlet managedJscpdProvisionAttempted = false;\n\n/** Resolve the requested shell. Runtime callers omit shellName to select PowerShell on Windows and Bash elsewhere. */\nexport function getShellConfig(\n\tcustomShellPath?: string,\n\tshellName: PlatformShellToolName = getPlatformShellToolName(),\n): ShellConfig {\n\tif (customShellPath) {\n\t\tconst resolvedShellPath = normalizePath(customShellPath);\n\t\tif (!existsSync(resolvedShellPath)) throw new Error(`Custom shell path not found: ${resolvedShellPath}`);\n\t\treturn {\n\t\t\tshell: resolvedShellPath,\n\t\t\targs: shellName === \"powershell\" ? [...POWERSHELL_ARGS] : [\"-c\"],\n\t\t};\n\t}\n\tlet resolved = resolvedPlatformShellConfigs.get(shellName);\n\tif (!resolved) {\n\t\tresolved = shellName === \"powershell\" ? getPowerShellConfig() : getBashConfig();\n\t\tresolvedPlatformShellConfigs.set(shellName, resolved);\n\t}\n\treturn { shell: resolved.shell, args: [...resolved.args] };\n}\n\nexport function getShellEnv(): NodeJS.ProcessEnv {\n\tif (!managedJscpdProvisionAttempted) {\n\t\tmanagedJscpdProvisionAttempted = true;\n\t\ttry {\n\t\t\tensureManagedJscpd();\n\t\t} catch {\n\t\t\t// The jscpd wrapper and doctor surface the exact packaging failure. Shell startup stays usable.\n\t\t}\n\t}\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = process.env[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...process.env,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM).\n */\nconst trackedDetachedChildPids = new Set<number>();\n\nexport function trackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.add(pid);\n}\n\nexport function untrackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.delete(pid);\n}\n\nexport function killTrackedDetachedChildren(): void {\n\tfor (const pid of trackedDetachedChildPids) {\n\t\tkillProcessTree(pid);\n\t}\n\ttrackedDetachedChildPids.clear();\n}\n\n/**\n * Kill a process and all its children (cross-platform).\n *\n * Windows uses `spawnSync` (not `spawn`) deliberately: callers rely on this function returning\n * only once the tree is actually gone (e.g. before removing a directory that was the killed\n * process's cwd — a directory Windows keeps locked until every handle into it, including a\n * live process's cwd handle, is released). A fire-and-forget async `taskkill` would return before\n * termination completed, leaving a race where the directory is still locked.\n */\nexport function killProcessTree(pid: number): void {\n\tif (process.platform === \"win32\") {\n\t\t// Use taskkill on Windows to kill process tree; spawnSync blocks until taskkill itself\n\t\t// (and therefore the termination it requested) has finished.\n\t\ttry {\n\t\t\tspawnSync(\"taskkill\", [\"/F\", \"/T\", \"/PID\", String(pid)], {\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails\n\t\t}\n\t} else {\n\t\t// Use SIGKILL on Unix/Linux/Mac\n\t\ttry {\n\t\t\tprocess.kill(-pid, \"SIGKILL\");\n\t\t} catch {\n\t\t\t// Fallback to killing just the child if process group kill fails\n\t\t\tt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AM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACxD,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,IAAI;aACjB,CAAC,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACR,kCAAkC;QACnC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,gCAAgC;QAChC,IAAI,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,iEAAiE;YACjE,IAAI,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACR,uBAAuB;YACxB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { basename, delimiter } from \"node:path\";\nimport { spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.ts\";\nimport { ensureManagedJscpd } from \"./bundled-jscpd.ts\";\nimport { normalizePath } from \"./paths.ts\";\nimport {\n\tcreatePowerShellHostEnvironment,\n\tPOWERSHELL_7_GUARD,\n\tPOWERSHELL_ARGS,\n\tPOWERSHELL_STARTUP_PROBE_TIMEOUT_MS,\n} from \"./powershell-session-protocol.ts\";\n\nexport { POWERSHELL_STARTUP_PROBE_TIMEOUT_MS } from \"./powershell-session-protocol.ts\";\n\nexport type PlatformShellToolName = \"bash\" | \"powershell\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n}\n\nexport function getPlatformShellToolName(platform: NodeJS.Platform = process.platform): PlatformShellToolName {\n\treturn platform === \"win32\" ? \"powershell\" : \"bash\";\n}\n\nfunction findExecutableOnPath(executable: string): string | null {\n\tconst locator = process.platform === \"win32\" ? \"where\" : \"which\";\n\ttry {\n\t\tconst result = spawnSync(locator, [executable], {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 5_000,\n\t\t\twindowsHide: true,\n\t\t});\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch && (process.platform !== \"win32\" || existsSync(firstMatch))) return firstMatch;\n\t\t}\n\t} catch {\n\t\t// Resolution falls through to known paths or the platform fallback.\n\t}\n\treturn null;\n}\n\nfunction isPowerShellExecutableAvailable(executable: string): boolean {\n\ttry {\n\t\treturn (\n\t\t\tspawnSync(executable, [...POWERSHELL_ARGS, `${POWERSHELL_7_GUARD}Write-Output ok`], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\tenv: createPowerShellHostEnvironment(process.env),\n\t\t\t\ttimeout: POWERSHELL_STARTUP_PROBE_TIMEOUT_MS,\n\t\t\t\twindowsHide: true,\n\t\t\t}).status === 0\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction isPowerShell7Executable(executable: string): boolean {\n\treturn /^pwsh(?:\\.exe)?$/iu.test(basename(executable));\n}\n\n/**\n * Ordered PowerShell candidates without launching a disposable interpreter. Persistent sessions\n * validate these candidates with their real long-lived bootstrap, so the normal path pays for one\n * PowerShell process instead of probing one process and then spawning another.\n */\nexport function getPowerShellCandidateConfigs(): ShellConfig[] {\n\tconst candidates: ShellConfig[] = [];\n\tconst seen = new Set<string>();\n\tconst addCandidate = (shell: string | null): void => {\n\t\tif (!shell || !isPowerShell7Executable(shell)) return;\n\t\tconst identity = process.platform === \"win32\" ? shell.toLowerCase() : shell;\n\t\tif (seen.has(identity)) return;\n\t\tseen.add(identity);\n\t\tcandidates.push({ shell, args: [...POWERSHELL_ARGS] });\n\t};\n\n\tconst pwshOnPath = findExecutableOnPath(process.platform === \"win32\" ? \"pwsh.exe\" : \"pwsh\");\n\taddCandidate(pwshOnPath);\n\n\tconst knownPaths: string[] = [];\n\tconst programFiles = process.env.ProgramFiles;\n\tif (programFiles) knownPaths.push(`${programFiles}\\\\PowerShell\\\\7\\\\pwsh.exe`);\n\tfor (const path of knownPaths) {\n\t\tif (existsSync(path)) addCandidate(path);\n\t}\n\treturn candidates;\n}\n\nfunction getPowerShellConfig(): ShellConfig {\n\tfor (const candidate of getPowerShellCandidateConfigs()) {\n\t\tif (isPowerShellExecutableAvailable(candidate.shell)) return candidate;\n\t}\n\tthrow new Error(\"PowerShell 7 (pwsh) was not found. Install pwsh or set shellPath to a pwsh executable.\");\n}\n\nfunction getBashConfig(): ShellConfig {\n\tif (process.platform === \"win32\") {\n\t\tconst knownPaths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) knownPaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) knownPaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\tfor (const path of knownPaths) {\n\t\t\tif (existsSync(path)) return { shell: path, args: [\"-c\"] };\n\t\t}\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) return { shell: bashOnPath, args: [\"-c\"] };\n\t\tthrow new Error(\"No Bash executable found. Install Git Bash or set shellPath in settings.json.\");\n\t}\n\tif (existsSync(\"/bin/bash\")) return { shell: \"/bin/bash\", args: [\"-c\"] };\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\treturn bashOnPath ? { shell: bashOnPath, args: [\"-c\"] } : { shell: \"sh\", args: [\"-c\"] };\n}\n\n// Platform shell resolution spawns probe processes (`where`/`which`, plus a full PowerShell\n// boot on Windows) and is a process-lifetime invariant, so successful resolutions are cached.\n// Failures are not cached: the user can install a shell and retry without restarting.\nconst resolvedPlatformShellConfigs = new Map<PlatformShellToolName, ShellConfig>();\nlet managedJscpdProvisionAttempted = false;\n\n/** Resolve the requested shell. Runtime callers omit shellName to select PowerShell on Windows and Bash elsewhere. */\nexport function getShellConfig(\n\tcustomShellPath?: string,\n\tshellName: PlatformShellToolName = getPlatformShellToolName(),\n): ShellConfig {\n\tif (customShellPath) {\n\t\tconst resolvedShellPath = normalizePath(customShellPath);\n\t\tif (shellName === \"powershell\" && !isPowerShell7Executable(resolvedShellPath)) {\n\t\t\tthrow new Error(`Custom PowerShell host must be PowerShell 7 (pwsh): ${resolvedShellPath}`);\n\t\t}\n\t\tif (!existsSync(resolvedShellPath)) throw new Error(`Custom shell path not found: ${resolvedShellPath}`);\n\t\treturn {\n\t\t\tshell: resolvedShellPath,\n\t\t\targs: shellName === \"powershell\" ? [...POWERSHELL_ARGS] : [\"-c\"],\n\t\t};\n\t}\n\tlet resolved = resolvedPlatformShellConfigs.get(shellName);\n\tif (!resolved) {\n\t\tresolved = shellName === \"powershell\" ? getPowerShellConfig() : getBashConfig();\n\t\tresolvedPlatformShellConfigs.set(shellName, resolved);\n\t}\n\treturn { shell: resolved.shell, args: [...resolved.args] };\n}\n\nexport function getShellEnv(): NodeJS.ProcessEnv {\n\tif (!managedJscpdProvisionAttempted) {\n\t\tmanagedJscpdProvisionAttempted = true;\n\t\ttry {\n\t\t\tensureManagedJscpd();\n\t\t} catch {\n\t\t\t// The jscpd wrapper and doctor surface the exact packaging failure. Shell startup stays usable.\n\t\t}\n\t}\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = process.env[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...process.env,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM).\n */\nconst trackedDetachedChildPids = new Set<number>();\n\nexport function trackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.add(pid);\n}\n\nexport function untrackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.delete(pid);\n}\n\nexport function killTrackedDetachedChildren(): void {\n\tfor (const pid of trackedDetachedChildPids) {\n\t\tkillProcessTree(pid);\n\t}\n\ttrackedDetachedChildPids.clear();\n}\n\n/**\n * Kill a process and all its children (cross-platform).\n *\n * Windows uses `spawnSync` (not `spawn`) deliberately: callers rely on this function returning\n * only once the tree is actually gone (e.g. before removing a directory that was the killed\n * process's cwd — a directory Windows keeps locked until every handle into it, including a\n * live process's cwd handle, is released). A fire-and-forget async `taskkill` would return before\n * termination completed, leaving a race where the directory is still locked.\n */\nexport function killProcessTree(pid: number): void {\n\tif (process.platform === \"win32\") {\n\t\t// Use taskkill on Windows to kill process tree; spawnSync blocks until taskkill itself\n\t\t// (and therefore the termination it requested) has finished.\n\t\ttry {\n\t\t\tspawnSync(\"taskkill\", [\"/F\", \"/T\", \"/PID\", String(pid)], {\n\t\t\t\tstdio: \"ignore\",\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails\n\t\t}\n\t} else {\n\t\t// Use SIGKILL on Unix/Linux/Mac\n\t\ttry {\n\t\t\tprocess.kill(-pid, \"SIGKILL\");\n\t\t} catch {\n\t\t\t// Fallback to killing just the child if process group kill fails\n\t\t\ttry {\n\t\t\t\tprocess.kill(pid, \"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t// Process already dead\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
package/docs/settings.md
CHANGED
|
@@ -480,12 +480,12 @@ To keep captures in an explicit location:
|
|
|
480
480
|
|
|
481
481
|
| Setting | Type | Default | Description |
|
|
482
482
|
|---------|------|---------|-------------|
|
|
483
|
-
| `shellPath` | string | platform default | Custom platform-shell path (`pwsh.exe
|
|
483
|
+
| `shellPath` | string | platform default | Custom platform-shell path (`pwsh.exe` on Windows; Bash-compatible shell elsewhere) |
|
|
484
484
|
| `shellCommandPrefix` | string | - | Platform-shell snippet prepended to every command (for example, `"shopt -s expand_aliases"` on Bash) |
|
|
485
485
|
| `npmCommand` | string[] | - | Command argv used for npm package lookup/install operations (e.g., `["mise", "exec", "node@24", "--", "npm"]`) |
|
|
486
486
|
| `windowsShell.pythonEngine` | boolean | `true` | Windows only. Routes pipelines, redirection, expansion, chaining, and state-mutating commands (`cd`/`export`/`unset`) through the bundled Python shell engine. Explicit `false` restores the PowerShell-only, simple-command-only contract verbatim — the same fail-closed behavior for pipelines/redirection/expansion/chaining as before the engine existed. |
|
|
487
487
|
|
|
488
|
-
Pi exposes one stable `bash` contract to the model on every platform. On Windows, the tool router parses a finite simple-command grammar, converts supported Bash-like forms to literal-path PowerShell, and rejects pipelines, redirection, expansion, chaining, nested shells, POSIX scripts, and unsupported builtin forms instead of guessing. Legacy `powershell` tool/profile references map to `bash`. The Windows backend
|
|
488
|
+
Pi exposes one stable `bash` contract to the model on every platform. On Windows, the tool router parses a finite simple-command grammar, converts supported Bash-like forms to literal-path PowerShell, and rejects pipelines, redirection, expansion, chaining, nested shells, POSIX scripts, and unsupported builtin forms instead of guessing. Legacy `powershell` tool/profile references map to `bash`. The Windows backend requires PowerShell 7 (`pwsh.exe`) and runs it with `-NoLogo -NoProfile -NonInteractive -Command`, process-only headless settings, silent progress, and a warmed persistent command path. Pi does not overwrite PowerShell's input or output encoding; its output path preserves Unicode UTF-8 and recovers Windows-1252 bytes. `shellCommandPrefix` uses backend-native syntax because Pi applies it after routing. Agent, interactive, and RPC shell calls default to a 120-second wall-clock deadline; agent-tool overrides cap at one hour.
|
|
489
489
|
|
|
490
490
|
With `windowsShell.pythonEngine` at its default (`true`), the router also sends pipelines, redirection, expansion, chaining, and `cd`/`export`/`unset` to a bundled, uv-provisioned Python 3.13 engine implementing a bounded Bash grammar and coreutils vocabulary; state persists across calls and across the PowerShell/engine tiers. If the Python runtime cannot be resolved (uv/network unavailable), the simple-command PowerShell floor keeps working and engine-only commands return a named, actionable error — never a silent downgrade. See [Windows](windows.md) for the full supported-forms table.
|
|
491
491
|
|
package/docs/windows.md
CHANGED
|
@@ -6,7 +6,7 @@ Pi supports native Windows on x64 and ARM64. The Node.js package runs under Wind
|
|
|
6
6
|
|
|
7
7
|
- Windows 10 or newer
|
|
8
8
|
- Node.js 24.18 or newer for the npm package
|
|
9
|
-
-
|
|
9
|
+
- PowerShell 7 (`pwsh.exe`)
|
|
10
10
|
- Git for Windows for native Git commands
|
|
11
11
|
- Windows Terminal, WezTerm, or the VS Code terminal for the best keyboard support
|
|
12
12
|
|
|
@@ -20,13 +20,12 @@ External programs are not reimplemented. A simple `rg` call runs the installed n
|
|
|
20
20
|
|
|
21
21
|
Shell persistence preserves process state; it does not require every raw command byte to remain in model context. Recognized single test-runner commands use a bounded command-aware projection after execution: passing/progress chatter is counted, failure blocks and summaries remain visible, exit status is unchanged, and exact raw bytes are saved to the reported managed path. Mixed commands and unknown nonzero formats stay raw, and Pi also falls back to raw output if it cannot create the exact-output handoff.
|
|
22
22
|
|
|
23
|
-
The agent never selects a shell or emits native PowerShell or Python. Pi
|
|
23
|
+
The agent never selects a shell or emits native PowerShell or Python. Pi accepts only PowerShell 7 and resolves its executable in this order:
|
|
24
24
|
|
|
25
|
-
1. `shellPath` in `%USERPROFILE%\.pi\agent\settings.json`
|
|
25
|
+
1. A `shellPath` ending in `pwsh.exe` in `%USERPROFILE%\.pi\agent\settings.json`
|
|
26
26
|
2. PowerShell 7 (`pwsh.exe`) on `PATH` or under `Program Files`
|
|
27
|
-
3. Windows PowerShell (`powershell.exe`) under `System32` or on `PATH`
|
|
28
27
|
|
|
29
|
-
The PowerShell tier runs with `-NoLogo -NoProfile -NonInteractive -Command
|
|
28
|
+
The PowerShell tier runs with `-NoLogo -NoProfile -NonInteractive -Command`. Pi applies process-only headless settings before startup: PowerShell telemetry, update notifications, diagnostic IPC, ANSI color, and progress rendering are disabled. It warms the long-lived command path once, then reuses that process. Pi gives managed PowerShell output a UTF-8 writer without overwriting `[Console]::InputEncoding`, `[Console]::OutputEncoding`, or `$OutputEncoding`, so native programs retain their code-page choice. The Windows output decoder preserves valid Unicode UTF-8 and recovers Windows-1252 bytes, including mixed streams and UTF-8 sequences split across chunks. Pi's private command framing remains line-safe Base64 with ASCII control markers. Every agent, interactive, and RPC shell call has a 120-second wall-clock default, even while output continues.
|
|
30
29
|
|
|
31
30
|
### Supported forms
|
|
32
31
|
|
|
@@ -106,6 +105,8 @@ The Windows release archive includes `collect-pi-incident.ps1` beside `pi.exe`.
|
|
|
106
105
|
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\collect-pi-incident.ps1
|
|
107
106
|
```
|
|
108
107
|
|
|
108
|
+
This explicit `powershell.exe` invocation is an isolated Windows incident-collection integration, not the agent shell. The agent shell itself requires `pwsh.exe`.
|
|
109
|
+
|
|
109
110
|
From a source checkout, use `-File .\scripts\collect-pi-incident.ps1`. The collector selects the latest human session by default and creates `pi-incident-<timestamp>.zip` beside the collector script. To select exact evidence or another destination:
|
|
110
111
|
|
|
111
112
|
```powershell
|
|
@@ -169,12 +170,12 @@ See [Terminal setup](terminal-setup.md) for VS Code, WezTerm, and other terminal
|
|
|
169
170
|
|
|
170
171
|
## Troubleshooting
|
|
171
172
|
|
|
172
|
-
###
|
|
173
|
+
### PowerShell 7 (`pwsh`) not found
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
Install PowerShell 7 or set `shellPath` to an existing `pwsh.exe`. Confirm discovery from a terminal:
|
|
175
176
|
|
|
176
177
|
```powershell
|
|
177
|
-
Get-Command pwsh
|
|
178
|
+
Get-Command pwsh -ErrorAction Stop
|
|
178
179
|
```
|
|
179
180
|
|
|
180
181
|
### Modified Enter does not reach Pi
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.93.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider-anthropic",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.93.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "echo 'nothing to clean'",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@anthropic-ai/sdk": "0.
|
|
17
|
+
"@anthropic-ai/sdk": "0.117.1"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.93.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.93.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"clean": "echo 'nothing to clean'",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@anthropic-ai/sandbox-runtime": "0.0.
|
|
17
|
+
"@anthropic-ai/sandbox-runtime": "0.0.73"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.93.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|