@loucompanion/forge-bridge 0.1.4-dev.a5a3a7ab2f02 → 0.1.4-dev.a7b2e9125fed

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 (103) hide show
  1. package/README.md +22 -0
  2. package/dist/bridge/bridge-chat-provider-command.d.ts +16 -0
  3. package/dist/bridge/bridge-chat-provider-command.js +137 -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.service.d.ts +1 -1
  7. package/dist/bridge/bridge.service.js +4 -110
  8. package/dist/bridge/runner-host-capabilities.d.ts +3 -0
  9. package/dist/bridge/runner-host-capabilities.js +13 -0
  10. package/dist/runtime/attempt-database-broker.d.ts +1 -1
  11. package/dist/runtime/docker-engine-probe.d.ts +5 -0
  12. package/dist/runtime/docker-engine-probe.js +7 -0
  13. package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
  14. package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
  15. package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
  16. package/dist/runtime/ephemeral-test-postgres.js +303 -0
  17. package/dist/runtime/host-facts.d.ts +2 -1
  18. package/dist/runtime/host-load-admission.d.ts +9 -2
  19. package/dist/runtime/host-load-child-environment.d.ts +11 -6
  20. package/dist/runtime/host-load-child-environment.js +19 -10
  21. package/dist/runtime/host-load-governor-config.d.ts +10 -1
  22. package/dist/runtime/host-load-governor-config.js +7 -0
  23. package/dist/runtime/host-load-governor.d.ts +10 -0
  24. package/dist/runtime/host-load-governor.js +125 -34
  25. package/dist/runtime/host-load-sampler.d.ts +34 -4
  26. package/dist/runtime/host-load-sampler.js +73 -7
  27. package/dist/runtime/host-load-step-class.d.ts +3 -1
  28. package/dist/runtime/host-load-step-class.js +60 -5
  29. package/dist/runtime/host-load-test-slot.d.ts +43 -0
  30. package/dist/runtime/host-load-test-slot.js +81 -0
  31. package/dist/runtime/host-load-token-ledger.d.ts +26 -0
  32. package/dist/runtime/host-load-token-ledger.js +93 -61
  33. package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
  34. package/dist/runtime/host-load-windows-cpu.js +85 -0
  35. package/dist/runtime/host-runtime-lease.d.ts +1 -1
  36. package/dist/runtime/host-runtime-lease.js +1 -1
  37. package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
  38. package/dist/runtime/native-test-postgres-fallback.js +60 -8
  39. package/dist/sandbox/host-capacity-broker.d.ts +7 -1
  40. package/dist/sandbox/host-capacity-broker.js +23 -4
  41. package/dist/session/architect-waits.d.ts +2 -0
  42. package/dist/session/architect-waits.js +138 -0
  43. package/dist/session/managed-attempt-tools.d.ts +0 -7
  44. package/dist/session/managed-attempt-tools.js +51 -62
  45. package/dist/session/managed-command-host-load.d.ts +2 -0
  46. package/dist/session/managed-command-host-load.js +2 -1
  47. package/dist/session/phase-completion.artifacts.js +2 -1
  48. package/dist/session/phase-completion.d.ts +8 -0
  49. package/dist/session/phase-completion.js +1 -0
  50. package/dist/session/phase-completion.mcp-args.d.ts +9 -0
  51. package/dist/session/phase-completion.mcp-args.js +156 -0
  52. package/dist/session/phase-completion.runtime.d.ts +0 -8
  53. package/dist/session/phase-completion.runtime.js +38 -168
  54. package/dist/session/phase-completion.schemas.js +25 -23
  55. package/dist/session/phase-completion.validation.js +3 -1
  56. package/dist/session/pre-publication-native-postgres.d.ts +30 -0
  57. package/dist/session/pre-publication-native-postgres.js +111 -0
  58. package/dist/session/pre-publication-pass.d.ts +61 -0
  59. package/dist/session/pre-publication-pass.js +148 -0
  60. package/dist/session/pre-publication-step-execution.d.ts +2 -1
  61. package/dist/session/pre-publication-step-execution.js +6 -5
  62. package/dist/session/pre-publication-validation.d.ts +30 -14
  63. package/dist/session/pre-publication-validation.js +207 -134
  64. package/dist/session/provider-cli/claude-background-work.d.ts +66 -0
  65. package/dist/session/provider-cli/claude-background-work.js +180 -0
  66. package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
  67. package/dist/session/provider-cli/pre-publication-repair.js +276 -0
  68. package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
  69. package/dist/session/provider-cli/provider-cli.child-environment.js +73 -0
  70. package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
  71. package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
  72. package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
  73. package/dist/session/provider-cli/provider-cli.process.js +39 -430
  74. package/dist/session/provider-cli/provider-cli.prompts.d.ts +5 -0
  75. package/dist/session/provider-cli/provider-cli.prompts.js +58 -8
  76. package/dist/session/provider-cli/provider-cli.runtime.js +7 -0
  77. package/dist/session/provider-cli/provider-cli.service.d.ts +5 -5
  78. package/dist/session/provider-cli/provider-cli.service.js +65 -257
  79. package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
  80. package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
  81. package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
  82. package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
  83. package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
  84. package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
  85. package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
  86. package/dist/session/provider-cli/provider-output-pipes.js +67 -0
  87. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  88. package/dist/session/provider-cli/provider-output-state.js +6 -0
  89. package/dist/session/qa-sidecar-validation.d.ts +6 -0
  90. package/dist/session/qa-sidecar-validation.js +28 -0
  91. package/dist/session/sandbox-host-capacity-gate.js +12 -3
  92. package/dist/session/session-redaction.js +31 -181
  93. package/dist/session/session.types.js +2 -2
  94. package/dist/session/sidecar-json-shape.d.ts +31 -0
  95. package/dist/session/sidecar-json-shape.js +217 -0
  96. package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
  97. package/dist/shared/process/windows-app-execution-alias.js +45 -0
  98. package/dist/shared/process/windows-launch.d.ts +18 -0
  99. package/dist/shared/process/windows-launch.js +68 -0
  100. package/dist/shared/provider-capabilities.js +5 -6
  101. package/dist/version.d.ts +1 -1
  102. package/dist/version.js +1 -1
  103. package/package.json +1 -1
@@ -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 {};