@loucompanion/forge-bridge 0.1.4-dev.8901ba056f68 → 0.1.4-dev.894bcbd53d64

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.
Files changed (225) hide show
  1. package/README.md +142 -1
  2. package/dist/bridge/bridge-chat-provider-command.d.ts +19 -0
  3. package/dist/bridge/bridge-chat-provider-command.js +132 -0
  4. package/dist/bridge/bridge-chat.types.d.ts +10 -0
  5. package/dist/bridge/bridge-chat.types.js +16 -1
  6. package/dist/bridge/bridge-state-file.d.ts +161 -0
  7. package/dist/bridge/bridge-state-file.js +376 -0
  8. package/dist/bridge/bridge-state-io.d.ts +11 -0
  9. package/dist/bridge/bridge-state-io.js +50 -0
  10. package/dist/bridge/bridge-state-lock.d.ts +11 -0
  11. package/dist/bridge/bridge-state-lock.js +102 -0
  12. package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
  13. package/dist/bridge/bridge-state-unpublished.js +111 -0
  14. package/dist/bridge/bridge.base.d.ts +9 -0
  15. package/dist/bridge/bridge.service.d.ts +87 -14
  16. package/dist/bridge/bridge.service.js +394 -338
  17. package/dist/bridge/bridge.types.d.ts +16 -0
  18. package/dist/bridge/in-flight-registry.d.ts +62 -0
  19. package/dist/bridge/in-flight-registry.js +207 -0
  20. package/dist/bridge/local-yield-flag.d.ts +6 -0
  21. package/dist/bridge/local-yield-flag.js +34 -0
  22. package/dist/bridge/readiness-result-outbox.d.ts +5 -1
  23. package/dist/bridge/readiness-result-outbox.js +20 -0
  24. package/dist/bridge/runner-host-capabilities.d.ts +3 -0
  25. package/dist/bridge/runner-host-capabilities.js +13 -0
  26. package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
  27. package/dist/bridge/sandbox-resource-accounting.js +150 -0
  28. package/dist/cleanup/cleanup-wip.d.ts +12 -0
  29. package/dist/cleanup/cleanup-wip.js +66 -0
  30. package/dist/cleanup/cleanup.service.d.ts +20 -1
  31. package/dist/cleanup/cleanup.service.js +150 -169
  32. package/dist/cleanup/cleanup.types.d.ts +6 -0
  33. package/dist/cleanup/forge-owned-paths.d.ts +9 -0
  34. package/dist/cleanup/forge-owned-paths.js +53 -0
  35. package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
  36. package/dist/cleanup/host-runtime-ledger.js +130 -0
  37. package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
  38. package/dist/cleanup/managed-branch-sweep.js +111 -0
  39. package/dist/cli/cli.help.js +74 -12
  40. package/dist/cli/cli.service.d.ts +19 -10
  41. package/dist/cli/cli.service.js +149 -186
  42. package/dist/cli/idle-status.d.ts +84 -0
  43. package/dist/cli/idle-status.js +181 -0
  44. package/dist/cli/local-config.d.ts +6 -0
  45. package/dist/cli/local-config.js +32 -4
  46. package/dist/cli/provider-cli-detection.d.ts +10 -0
  47. package/dist/cli/provider-cli-detection.js +160 -0
  48. package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
  49. package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
  50. package/dist/runtime/attempt-database-broker.d.ts +1 -1
  51. package/dist/runtime/attempt-node-runtime-launcher.js +9 -0
  52. package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
  53. package/dist/runtime/attempt-process-supervisor.js +12 -6
  54. package/dist/runtime/docker-engine-probe.d.ts +5 -0
  55. package/dist/runtime/docker-engine-probe.js +7 -0
  56. package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
  57. package/dist/runtime/dotnet-build-outputs.js +402 -0
  58. package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
  59. package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
  60. package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
  61. package/dist/runtime/ephemeral-test-postgres.js +303 -0
  62. package/dist/runtime/host-facts.d.ts +2 -1
  63. package/dist/runtime/host-load-admission.d.ts +18 -3
  64. package/dist/runtime/host-load-admission.js +19 -4
  65. package/dist/runtime/host-load-child-environment.d.ts +11 -6
  66. package/dist/runtime/host-load-child-environment.js +22 -11
  67. package/dist/runtime/host-load-governor-config.d.ts +19 -1
  68. package/dist/runtime/host-load-governor-config.js +37 -0
  69. package/dist/runtime/host-load-governor.d.ts +14 -0
  70. package/dist/runtime/host-load-governor.js +139 -26
  71. package/dist/runtime/host-load-ledger-lock.js +6 -4
  72. package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
  73. package/dist/runtime/host-load-runtime-settings.js +80 -0
  74. package/dist/runtime/host-load-sampler.d.ts +34 -4
  75. package/dist/runtime/host-load-sampler.js +73 -7
  76. package/dist/runtime/host-load-step-class.d.ts +3 -1
  77. package/dist/runtime/host-load-step-class.js +60 -5
  78. package/dist/runtime/host-load-test-slot.d.ts +43 -0
  79. package/dist/runtime/host-load-test-slot.js +81 -0
  80. package/dist/runtime/host-load-token-ledger.d.ts +26 -0
  81. package/dist/runtime/host-load-token-ledger.js +93 -61
  82. package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
  83. package/dist/runtime/host-load-windows-cpu.js +85 -0
  84. package/dist/runtime/host-runtime-contract.d.ts +12 -0
  85. package/dist/runtime/host-runtime-contract.js +29 -1
  86. package/dist/runtime/host-runtime-lease.d.ts +59 -3
  87. package/dist/runtime/host-runtime-lease.js +212 -61
  88. package/dist/runtime/host-runtime-promotion.d.ts +23 -0
  89. package/dist/runtime/host-runtime-promotion.js +36 -0
  90. package/dist/runtime/managed-command-teardown.js +5 -16
  91. package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
  92. package/dist/runtime/native-test-postgres-fallback.js +60 -8
  93. package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
  94. package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
  95. package/dist/runtime/runner-settings.d.ts +104 -0
  96. package/dist/runtime/runner-settings.js +236 -0
  97. package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
  98. package/dist/runtime/supervised-runtime-build-guard.js +112 -0
  99. package/dist/sandbox/host-capacity-broker.d.ts +10 -2
  100. package/dist/sandbox/host-capacity-broker.js +27 -6
  101. package/dist/sandbox/managed-branch.d.ts +13 -0
  102. package/dist/sandbox/managed-branch.js +90 -0
  103. package/dist/sandbox/provider-auth/codex.js +11 -11
  104. package/dist/sandbox/runtime.js +2 -6
  105. package/dist/session/architect-waits.d.ts +2 -0
  106. package/dist/session/architect-waits.js +138 -0
  107. package/dist/session/managed-attempt-tools.d.ts +2 -7
  108. package/dist/session/managed-attempt-tools.js +94 -104
  109. package/dist/session/managed-build-coordinator.d.ts +16 -0
  110. package/dist/session/managed-build-coordinator.js +10 -0
  111. package/dist/session/managed-build-receipt.d.ts +5 -0
  112. package/dist/session/managed-build-receipt.js +8 -3
  113. package/dist/session/managed-command-host-load.d.ts +2 -0
  114. package/dist/session/managed-command-host-load.js +2 -1
  115. package/dist/session/mcp-argument-coercion.d.ts +23 -0
  116. package/dist/session/mcp-argument-coercion.js +121 -0
  117. package/dist/session/phase-completion.artifacts.d.ts +7 -0
  118. package/dist/session/phase-completion.artifacts.js +96 -26
  119. package/dist/session/phase-completion.command-validation.d.ts +7 -0
  120. package/dist/session/phase-completion.command-validation.js +77 -0
  121. package/dist/session/phase-completion.d.ts +10 -0
  122. package/dist/session/phase-completion.helpers.js +13 -12
  123. package/dist/session/phase-completion.js +5 -0
  124. package/dist/session/phase-completion.mcp-args.d.ts +9 -0
  125. package/dist/session/phase-completion.mcp-args.js +156 -0
  126. package/dist/session/phase-completion.prompts.js +6 -1
  127. package/dist/session/phase-completion.runtime.d.ts +4 -10
  128. package/dist/session/phase-completion.runtime.js +77 -209
  129. package/dist/session/phase-completion.schema-parts.d.ts +19 -0
  130. package/dist/session/phase-completion.schema-parts.js +188 -0
  131. package/dist/session/phase-completion.schemas.d.ts +3 -3
  132. package/dist/session/phase-completion.schemas.js +208 -231
  133. package/dist/session/phase-completion.validation.d.ts +2 -3
  134. package/dist/session/phase-completion.validation.js +49 -93
  135. package/dist/session/pre-publication-native-postgres.d.ts +30 -0
  136. package/dist/session/pre-publication-native-postgres.js +111 -0
  137. package/dist/session/pre-publication-pass.d.ts +61 -0
  138. package/dist/session/pre-publication-pass.js +148 -0
  139. package/dist/session/pre-publication-process.js +10 -10
  140. package/dist/session/pre-publication-step-execution.d.ts +2 -1
  141. package/dist/session/pre-publication-step-execution.js +6 -5
  142. package/dist/session/pre-publication-validation.d.ts +30 -14
  143. package/dist/session/pre-publication-validation.js +207 -134
  144. package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
  145. package/dist/session/provider-cli/claude-background-work.js +181 -0
  146. package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
  147. package/dist/session/provider-cli/host-build-lock.js +30 -0
  148. package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
  149. package/dist/session/provider-cli/pre-publication-repair.js +276 -0
  150. package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
  151. package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
  152. package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
  153. package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
  154. package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
  155. package/dist/session/provider-cli/provider-cli.process.js +39 -430
  156. package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
  157. package/dist/session/provider-cli/provider-cli.prompts.js +72 -32
  158. package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
  159. package/dist/session/provider-cli/provider-cli.runtime.js +29 -1
  160. package/dist/session/provider-cli/provider-cli.service.d.ts +7 -1
  161. package/dist/session/provider-cli/provider-cli.service.js +78 -171
  162. package/dist/session/provider-cli/provider-cli.types.d.ts +26 -0
  163. package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
  164. package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
  165. package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
  166. package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
  167. package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
  168. package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
  169. package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
  170. package/dist/session/provider-cli/provider-output-pipes.js +67 -0
  171. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  172. package/dist/session/provider-cli/provider-output-state.js +6 -0
  173. package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
  174. package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
  175. package/dist/session/qa-sidecar-validation.d.ts +6 -0
  176. package/dist/session/qa-sidecar-validation.js +28 -0
  177. package/dist/session/sandbox-host-capacity-gate.d.ts +22 -1
  178. package/dist/session/sandbox-host-capacity-gate.js +42 -14
  179. package/dist/session/session-redaction.js +31 -181
  180. package/dist/session/session.base.d.ts +6 -1
  181. package/dist/session/session.service.d.ts +9 -2
  182. package/dist/session/session.service.js +169 -66
  183. package/dist/session/session.types.js +4 -4
  184. package/dist/session/sidecar-json-shape.d.ts +31 -0
  185. package/dist/session/sidecar-json-shape.js +217 -0
  186. package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
  187. package/dist/session/workspace-runtime-fingerprint.js +138 -0
  188. package/dist/shared/fs/file-identity.d.ts +10 -0
  189. package/dist/shared/fs/file-identity.js +15 -0
  190. package/dist/shared/fs/replace-file.d.ts +7 -0
  191. package/dist/shared/fs/replace-file.js +33 -0
  192. package/dist/shared/process/host-process-recovery.d.ts +14 -3
  193. package/dist/shared/process/host-process-recovery.js +23 -3
  194. package/dist/shared/process/host-process-supervisor.d.ts +13 -1
  195. package/dist/shared/process/host-process-supervisor.js +66 -14
  196. package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
  197. package/dist/shared/process/windows-app-execution-alias.js +45 -0
  198. package/dist/shared/process/windows-launch.d.ts +18 -0
  199. package/dist/shared/process/windows-launch.js +68 -0
  200. package/dist/shared/provider-capabilities.js +14 -7
  201. package/dist/version.d.ts +1 -1
  202. package/dist/version.js +1 -1
  203. package/dist/worktree/orphan-relink.d.ts +19 -0
  204. package/dist/worktree/orphan-relink.js +106 -0
  205. package/dist/worktree/wip-git.d.ts +33 -0
  206. package/dist/worktree/wip-git.js +122 -0
  207. package/dist/worktree/wip-refs.d.ts +62 -0
  208. package/dist/worktree/wip-refs.js +119 -0
  209. package/dist/worktree/wip-restore.d.ts +38 -0
  210. package/dist/worktree/wip-restore.js +190 -0
  211. package/dist/worktree/wip-snapshot.d.ts +50 -0
  212. package/dist/worktree/wip-snapshot.js +268 -0
  213. package/dist/worktree/worktree-inputs.d.ts +8 -0
  214. package/dist/worktree/worktree-inputs.js +134 -0
  215. package/dist/worktree/worktree-origin-sync.d.ts +34 -0
  216. package/dist/worktree/worktree-origin-sync.js +127 -0
  217. package/dist/worktree/worktree-wip-events.d.ts +18 -0
  218. package/dist/worktree/worktree-wip-events.js +98 -0
  219. package/dist/worktree/worktree-wip.d.ts +50 -0
  220. package/dist/worktree/worktree-wip.js +185 -0
  221. package/dist/worktree/worktree.base.d.ts +7 -1
  222. package/dist/worktree/worktree.service.d.ts +31 -5
  223. package/dist/worktree/worktree.service.js +120 -163
  224. package/dist/worktree/worktree.types.d.ts +31 -0
  225. package/package.json +2 -2
@@ -0,0 +1,75 @@
1
+ import os from "node:os";
2
+ import { normalizeWindowsProviderEnvironment, windowsAllowedProviderParentEnvNames } from "./provider-cli.windows-environment.js";
3
+ // The environment a provider child process starts with: an allowlist of the Bridge's own
4
+ // variables, the request's values, the Windows defaults, then the .NET build-server settings.
5
+ // CLAUDE_CONFIG_DIR is not passed: it would point Claude Code at a user configuration directory
6
+ // of the host's choosing (provider-user-config-isolation.ts). Claude signs in from the provider
7
+ // home's default `.claude` directory under HOME or USERPROFILE, or with a Forge-granted API key.
8
+ const allowedProviderParentEnvNames = [
9
+ "PATH",
10
+ "HOME",
11
+ "USERPROFILE",
12
+ "TMPDIR",
13
+ "TEMP",
14
+ "TMP",
15
+ "LANG"
16
+ ];
17
+ export function buildProviderChildEnvironment(requestEnv, options = {}) {
18
+ const parentEnv = options.parentEnv ?? process.env;
19
+ const platform = options.platform ?? process.platform;
20
+ const env = {};
21
+ for (const [key, value] of Object.entries(parentEnv)) {
22
+ if (typeof value === "string" && isAllowedProviderParentEnv(key, platform)) {
23
+ env[key] = value;
24
+ }
25
+ }
26
+ if (requestEnv) {
27
+ for (const [key, value] of Object.entries(requestEnv)) {
28
+ const trimmedKey = key.trim();
29
+ if (trimmedKey.length > 0) {
30
+ env[trimmedKey] = value;
31
+ }
32
+ }
33
+ }
34
+ if (platform === "win32") {
35
+ normalizeWindowsProviderEnvironment(env, parentEnv, options.homeDir ?? os.homedir(), options.arch ?? os.arch());
36
+ }
37
+ normalizeProviderBuildEnvironment(env);
38
+ return env;
39
+ }
40
+ function normalizeProviderBuildEnvironment(env) {
41
+ // Provider sessions are long lived and commonly run many dotnet builds. Persistent
42
+ // MSBuild and Roslyn compiler servers otherwise survive individual commands and can
43
+ // retain more memory than the active Forge lane. Keep those caches process-scoped by
44
+ // default on every runner OS; an explicitly supplied request value still wins.
45
+ setCanonicalProviderBuildEnvironmentValue(env, "DOTNET_CLI_USE_MSBUILD_SERVER", "0");
46
+ setCanonicalProviderBuildEnvironmentValue(env, "MSBUILDDISABLENODEREUSE", "1");
47
+ setCanonicalProviderBuildEnvironmentValue(env, "UseSharedCompilation", "false");
48
+ }
49
+ function setCanonicalProviderBuildEnvironmentValue(env, name, value) {
50
+ // The dotnet CLI uses case-sensitive environment lookup on POSIX, while MSBuild
51
+ // property names are case-insensitive on every OS. Collapse request aliases to
52
+ // one canonical key so the explicit value wins without producing ambiguity.
53
+ const exact = env[name];
54
+ const alias = Object.entries(env).find(([key, candidate]) => key !== name
55
+ && key.toLowerCase() === name.toLowerCase()
56
+ && typeof candidate === "string"
57
+ && candidate.trim().length > 0)?.[1];
58
+ const resolved = typeof exact === "string" && exact.trim().length > 0
59
+ ? exact
60
+ : alias ?? value;
61
+ for (const key of Object.keys(env)) {
62
+ if (key !== name && key.toLowerCase() === name.toLowerCase()) {
63
+ delete env[key];
64
+ }
65
+ }
66
+ env[name] = resolved;
67
+ }
68
+ function isAllowedProviderParentEnv(key, platform = process.platform) {
69
+ return isAllowedProviderParentEnvName(key, allowedProviderParentEnvNames)
70
+ || key.toUpperCase().startsWith("LC_")
71
+ || (platform === "win32" && isAllowedProviderParentEnvName(key, windowsAllowedProviderParentEnvNames));
72
+ }
73
+ function isAllowedProviderParentEnvName(key, allowedNames) {
74
+ return allowedNames.some((allowed) => allowed.toLowerCase() === key.toLowerCase());
75
+ }
@@ -0,0 +1,3 @@
1
+ import type { ProviderProcessRunResult } from "./provider-cli.process.js";
2
+ export declare function isCodexModelsCacheSchemaFailure(result: ProviderProcessRunResult): boolean;
3
+ export declare function quarantineIncompatibleCodexModelsCache(requestEnv?: Readonly<Record<string, string>>): Promise<boolean>;
@@ -0,0 +1,37 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { readEnvironmentValue } from "./provider-cli.windows-environment.js";
6
+ const maximumRecoverableCodexModelsCacheBytes = 16 * 1024 * 1024;
7
+ export function isCodexModelsCacheSchemaFailure(result) {
8
+ const output = `${result.stderr}\n${result.stdout}`.toLowerCase();
9
+ return output.includes("base_instructions")
10
+ && output.includes("missing field")
11
+ && (output.includes("models_cache") || output.includes("models cache") || output.includes("model cache"));
12
+ }
13
+ export async function quarantineIncompatibleCodexModelsCache(requestEnv) {
14
+ const configuredHome = readEnvironmentValue(requestEnv ?? {}, "CODEX_HOME")
15
+ ?? readEnvironmentValue(process.env, "CODEX_HOME")
16
+ ?? readEnvironmentValue(process.env, "FORGE_CODEX_HOME");
17
+ const codexHome = path.resolve(configuredHome ?? path.join(os.homedir(), ".codex"));
18
+ if (!path.isAbsolute(codexHome) || codexHome === path.parse(codexHome).root)
19
+ return false;
20
+ const cachePath = path.join(codexHome, "models_cache.json");
21
+ const cacheStat = await fs.promises.lstat(cachePath).catch(error => {
22
+ if (error.code === "ENOENT")
23
+ return null;
24
+ throw error;
25
+ });
26
+ if (!cacheStat
27
+ || !cacheStat.isFile()
28
+ || cacheStat.isSymbolicLink()
29
+ || cacheStat.nlink !== 1
30
+ || cacheStat.size <= 0
31
+ || cacheStat.size > maximumRecoverableCodexModelsCacheBytes) {
32
+ return false;
33
+ }
34
+ const quarantinePath = path.join(codexHome, `models_cache.forge-incompatible-${Date.now()}-${randomUUID()}.json`);
35
+ await fs.promises.rename(cachePath, quarantinePath);
36
+ return true;
37
+ }
@@ -1,7 +1,10 @@
1
- import { type LaunchCommand } from "../../shared/process/windows-launch.js";
1
+ import type { LaunchCommand } from "../../shared/process/windows-launch.js";
2
2
  import { ForgeFailureError } from "../session.types.js";
3
+ export { chooseWindowsCommandCandidate, resolveWindowsCommandFromPath } from "../../shared/process/windows-launch.js";
4
+ export { buildProviderChildEnvironment, type ProviderChildEnvironmentOptions } from "./provider-cli.child-environment.js";
3
5
  export declare const PROVIDER_OUTPUT_CAPTURE_LIMIT_CHARS: number;
4
6
  export type ProviderCliCommand = LaunchCommand;
7
+ export { resolveClaudeNpmDirectLaunch, resolveCodexNpmDirectLaunch, resolvePackageManagerDirectLaunch } from "./provider-cli.windows-launch.js";
5
8
  export interface ProviderProcessRunRequest {
6
9
  readonly command: string;
7
10
  readonly args: readonly string[];
@@ -22,8 +25,8 @@ export interface ProviderProcessRunRequest {
22
25
  */
23
26
  readonly resumesProviderThread?: boolean;
24
27
  }
25
- /** Why Forge stopped a provider that was still resident after a successful turn. */
26
- export type ProviderTerminalStopReason = "turn_exit_grace" | "success_ceiling";
28
+ /** Why Forge stopped a provider still resident after its turn (or its background work, for Claude). */
29
+ export type ProviderTerminalStopReason = "turn_exit_grace" | "success_ceiling" | "turn_ended_with_background_work";
27
30
  export interface ProviderProcessRunResult {
28
31
  readonly exitCode: number;
29
32
  readonly stdout: string;
@@ -34,8 +37,10 @@ export interface ProviderProcessRunResult {
34
37
  readonly memoryObservedAt?: string;
35
38
  /** Present when the caller's cancellation stopped the process before it exited on its own. */
36
39
  readonly cancelled?: true;
37
- /** Present when Forge stopped a provider that stayed resident after a successful turn. */
40
+ /** Present when Forge stopped a provider that stayed resident after its turn ended. */
38
41
  readonly terminalStopReason?: ProviderTerminalStopReason;
42
+ /** Present when Forge closed output pipes a descendant still held after the provider exited. */
43
+ readonly outputPipesReleasedAfterExit?: true;
39
44
  }
40
45
  export interface ProviderProcessRunner {
41
46
  run(request: ProviderProcessRunRequest, handlers?: ProviderProcessHandlers, signal?: AbortSignal): Promise<ProviderProcessRunResult>;
@@ -59,7 +64,8 @@ export interface ProviderProcessHandlers {
59
64
  onGenerationStart?(): void;
60
65
  }
61
66
  /** Recovery must wrap the attempt coordinator, never its raw OS runner. Each
62
- * relaunch needs a new fenced child generation and exclusive launch files. */
67
+ * relaunch needs a new fenced child generation and exclusive launch files. The outer
68
+ * layer fails any run Forge stopped because its turn ended with background work live. */
63
69
  export declare function recoveringProviderProcessRunner(inner: ProviderProcessRunner): ProviderProcessRunner;
64
70
  /**
65
71
  * Codex Desktop and an independently installed Codex CLI can briefly disagree
@@ -88,48 +94,21 @@ export declare class CodexResumeRecoveringProcessRunner implements ProviderProce
88
94
  * arbitrary tool/command output and therefore cannot mint retry authority.
89
95
  */
90
96
  export declare function isTransientCodexProviderNotFoundFailure(command: string, result: ProviderProcessRunResult): boolean;
91
- interface ProviderChildEnvironmentOptions {
92
- readonly parentEnv?: NodeJS.ProcessEnv;
93
- readonly platform?: NodeJS.Platform;
94
- readonly homeDir?: string;
95
- }
96
- export declare function buildProviderChildEnvironment(requestEnv?: Readonly<Record<string, string>>, options?: ProviderChildEnvironmentOptions): NodeJS.ProcessEnv;
97
97
  export declare class StreamingProviderProcessRunner implements ProviderProcessRunner {
98
98
  private readonly terminalExitGraceMs;
99
99
  private readonly terminalSuccessCeilingMs;
100
100
  private readonly terminalWorkPollMs;
101
- constructor(terminalExitGraceMs?: number, terminalSuccessCeilingMs?: number, terminalWorkPollMs?: number);
101
+ private readonly outputPipeReleaseGraceMs;
102
+ constructor(terminalExitGraceMs?: number, terminalSuccessCeilingMs?: number, terminalWorkPollMs?: number, outputPipeReleaseGraceMs?: number);
102
103
  run(request: ProviderProcessRunRequest, handlers?: ProviderProcessHandlers, signal?: AbortSignal): Promise<ProviderProcessRunResult>;
103
104
  }
104
105
  /**
105
106
  * The typed failure for a provider run that ended without calling its required Forge
106
- * completion tool. A run Forge stopped at the success ceiling is reported as such, so it
107
- * is not mistaken for an agent that simply ended its turn.
107
+ * completion tool. A run Forge stopped at the success ceiling or for background work is
108
+ * reported as such, so it is not mistaken for an agent that simply ended its turn.
108
109
  */
109
110
  export declare function providerCompletionToolMissingFailure(message: string, result?: Pick<ProviderProcessRunResult, "terminalStopReason"> | null): ForgeFailureError;
110
111
  /** Returns aggregate resident bytes for the exact supervised Unix process group. */
111
112
  export declare function processGroupResidentMemoryBytes(processGroupId: number, platform?: NodeJS.Platform, procRoot?: string): number | null;
112
113
  export declare const UNIX_PROVIDER_START_GRANT_LINE = "forge-provider-start-granted\n";
113
114
  export declare function buildUnixProviderStartGateLaunch(command: string, args: readonly string[]): LaunchCommand;
114
- export declare function resolveCodexNpmDirectLaunch(commandPath: string, args: readonly string[]): LaunchCommand | null;
115
- /**
116
- * npm installs of Claude Code (`npm i -g @anthropic-ai/claude-code`) put a `claude.cmd` shim on
117
- * PATH; launch its cli.js directly for the same Job Object reasons as Codex. The native installer
118
- * ships `claude.exe`, which is preferred by PATH resolution and needs no rewrite.
119
- */
120
- export declare function resolveClaudeNpmDirectLaunch(commandPath: string, args: readonly string[]): LaunchCommand | null;
121
- /**
122
- * Avoids cmd.exe's nested-quote handling for package-manager shims. That
123
- * quoting loses executable paths containing spaces after the command is
124
- * wrapped by the Windows Job Object supervisor.
125
- */
126
- export declare function resolvePackageManagerDirectLaunch(commandPath: string, args: readonly string[]): LaunchCommand | null;
127
- /**
128
- * Resolves Windows commands without spawning where.exe. Runtime launches can
129
- * happen while the machine is under enough process pressure for where.exe to
130
- * miss its timeout; returning the unresolved package-manager name in that case
131
- * makes Node fall back to a shell shim that cannot survive Job Object wrapping.
132
- */
133
- export declare function resolveWindowsCommandFromPath(command: string, pathValue?: string, pathExtValue?: string): string | null;
134
- export declare function chooseWindowsCommandCandidate(candidates: readonly string[]): string | null;
135
- export {};