@loucompanion/forge-bridge 0.1.4-dev.ccffca94938b → 0.1.4-dev.deb7f72e7930

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 (141) hide show
  1. package/README.md +87 -1
  2. package/dist/bridge/bridge-chat-provider-command.d.ts +4 -1
  3. package/dist/bridge/bridge-chat-provider-command.js +14 -19
  4. package/dist/bridge/bridge-state-file.d.ts +161 -0
  5. package/dist/bridge/bridge-state-file.js +376 -0
  6. package/dist/bridge/bridge-state-io.d.ts +11 -0
  7. package/dist/bridge/bridge-state-io.js +50 -0
  8. package/dist/bridge/bridge-state-lock.d.ts +11 -0
  9. package/dist/bridge/bridge-state-lock.js +102 -0
  10. package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
  11. package/dist/bridge/bridge-state-unpublished.js +111 -0
  12. package/dist/bridge/bridge.service.d.ts +16 -12
  13. package/dist/bridge/bridge.service.js +131 -243
  14. package/dist/bridge/bridge.types.d.ts +5 -0
  15. package/dist/bridge/in-flight-registry.d.ts +62 -0
  16. package/dist/bridge/in-flight-registry.js +207 -0
  17. package/dist/bridge/readiness-result-outbox.d.ts +5 -1
  18. package/dist/bridge/readiness-result-outbox.js +20 -0
  19. package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
  20. package/dist/bridge/sandbox-resource-accounting.js +150 -0
  21. package/dist/cleanup/cleanup-wip.d.ts +12 -0
  22. package/dist/cleanup/cleanup-wip.js +66 -0
  23. package/dist/cleanup/cleanup.service.d.ts +11 -1
  24. package/dist/cleanup/cleanup.service.js +80 -62
  25. package/dist/cleanup/cleanup.types.d.ts +2 -0
  26. package/dist/cleanup/host-runtime-ledger.d.ts +2 -0
  27. package/dist/cleanup/host-runtime-ledger.js +30 -9
  28. package/dist/cli/cli.help.js +56 -12
  29. package/dist/cli/cli.service.d.ts +3 -10
  30. package/dist/cli/cli.service.js +10 -171
  31. package/dist/cli/idle-status.d.ts +84 -0
  32. package/dist/cli/idle-status.js +181 -0
  33. package/dist/cli/local-config.d.ts +2 -0
  34. package/dist/cli/local-config.js +7 -1
  35. package/dist/cli/provider-cli-detection.d.ts +10 -0
  36. package/dist/cli/provider-cli-detection.js +160 -0
  37. package/dist/runtime/aspnet-runtime-prebuild.d.ts +5 -0
  38. package/dist/runtime/aspnet-runtime-prebuild.js +46 -1
  39. package/dist/runtime/attempt-database-broker.d.ts +1 -1
  40. package/dist/runtime/docker-engine-probe.d.ts +5 -0
  41. package/dist/runtime/docker-engine-probe.js +7 -0
  42. package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
  43. package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
  44. package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
  45. package/dist/runtime/ephemeral-test-postgres.js +303 -0
  46. package/dist/runtime/host-load-governor.d.ts +2 -0
  47. package/dist/runtime/host-load-ledger-lock.js +6 -4
  48. package/dist/runtime/host-load-runtime-settings.js +4 -2
  49. package/dist/runtime/host-runtime-contract.d.ts +12 -0
  50. package/dist/runtime/host-runtime-contract.js +29 -1
  51. package/dist/runtime/host-runtime-lease.js +10 -50
  52. package/dist/runtime/managed-command-teardown.js +5 -16
  53. package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
  54. package/dist/runtime/native-test-postgres-fallback.js +60 -8
  55. package/dist/runtime/runner-settings.d.ts +4 -0
  56. package/dist/runtime/runner-settings.js +22 -0
  57. package/dist/sandbox/host-capacity-broker.d.ts +3 -1
  58. package/dist/sandbox/host-capacity-broker.js +4 -2
  59. package/dist/sandbox/managed-branch.d.ts +13 -0
  60. package/dist/sandbox/managed-branch.js +36 -0
  61. package/dist/sandbox/provider-auth/codex.js +11 -11
  62. package/dist/sandbox/runtime.js +2 -6
  63. package/dist/session/managed-attempt-tools.d.ts +0 -7
  64. package/dist/session/managed-attempt-tools.js +45 -77
  65. package/dist/session/managed-build-receipt.d.ts +5 -0
  66. package/dist/session/managed-build-receipt.js +8 -3
  67. package/dist/session/phase-completion.artifacts.js +2 -1
  68. package/dist/session/phase-completion.d.ts +8 -0
  69. package/dist/session/phase-completion.js +1 -0
  70. package/dist/session/phase-completion.mcp-args.d.ts +9 -0
  71. package/dist/session/phase-completion.mcp-args.js +156 -0
  72. package/dist/session/phase-completion.runtime.d.ts +0 -8
  73. package/dist/session/phase-completion.runtime.js +43 -197
  74. package/dist/session/pre-publication-native-postgres.d.ts +30 -0
  75. package/dist/session/pre-publication-native-postgres.js +111 -0
  76. package/dist/session/pre-publication-process.js +10 -10
  77. package/dist/session/pre-publication-step-execution.d.ts +2 -1
  78. package/dist/session/pre-publication-step-execution.js +6 -5
  79. package/dist/session/pre-publication-validation.d.ts +7 -3
  80. package/dist/session/pre-publication-validation.js +32 -30
  81. package/dist/session/provider-cli/claude-background-work.d.ts +3 -2
  82. package/dist/session/provider-cli/claude-background-work.js +4 -3
  83. package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
  84. package/dist/session/provider-cli/host-build-lock.js +30 -0
  85. package/dist/session/provider-cli/pre-publication-repair.d.ts +16 -0
  86. package/dist/session/provider-cli/pre-publication-repair.js +33 -0
  87. package/dist/session/provider-cli/provider-cli.child-environment.js +4 -2
  88. package/dist/session/provider-cli/provider-cli.process.d.ts +2 -14
  89. package/dist/session/provider-cli/provider-cli.process.js +4 -94
  90. package/dist/session/provider-cli/provider-cli.prompts.d.ts +3 -0
  91. package/dist/session/provider-cli/provider-cli.prompts.js +27 -27
  92. package/dist/session/provider-cli/provider-cli.runtime.d.ts +8 -0
  93. package/dist/session/provider-cli/provider-cli.runtime.js +23 -2
  94. package/dist/session/provider-cli/provider-cli.service.d.ts +4 -1
  95. package/dist/session/provider-cli/provider-cli.service.js +27 -43
  96. package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
  97. package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
  98. package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
  99. package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
  100. package/dist/session/qa-sidecar-validation.d.ts +6 -0
  101. package/dist/session/qa-sidecar-validation.js +28 -0
  102. package/dist/session/sandbox-host-capacity-gate.d.ts +22 -1
  103. package/dist/session/sandbox-host-capacity-gate.js +34 -15
  104. package/dist/session/session-redaction.js +31 -181
  105. package/dist/session/session.service.d.ts +2 -0
  106. package/dist/session/session.service.js +62 -56
  107. package/dist/session/session.types.js +1 -1
  108. package/dist/session/sidecar-json-shape.d.ts +31 -0
  109. package/dist/session/sidecar-json-shape.js +217 -0
  110. package/dist/shared/fs/file-identity.d.ts +10 -0
  111. package/dist/shared/fs/file-identity.js +15 -0
  112. package/dist/shared/fs/replace-file.d.ts +7 -0
  113. package/dist/shared/fs/replace-file.js +33 -0
  114. package/dist/shared/process/host-process-recovery.d.ts +14 -3
  115. package/dist/shared/process/host-process-recovery.js +23 -3
  116. package/dist/shared/process/host-process-supervisor.d.ts +13 -1
  117. package/dist/shared/process/host-process-supervisor.js +66 -14
  118. package/dist/shared/provider-capabilities.js +9 -1
  119. package/dist/version.d.ts +1 -1
  120. package/dist/version.js +1 -1
  121. package/dist/worktree/wip-git.d.ts +33 -0
  122. package/dist/worktree/wip-git.js +122 -0
  123. package/dist/worktree/wip-refs.d.ts +62 -0
  124. package/dist/worktree/wip-refs.js +119 -0
  125. package/dist/worktree/wip-restore.d.ts +38 -0
  126. package/dist/worktree/wip-restore.js +190 -0
  127. package/dist/worktree/wip-snapshot.d.ts +50 -0
  128. package/dist/worktree/wip-snapshot.js +268 -0
  129. package/dist/worktree/worktree-inputs.d.ts +8 -0
  130. package/dist/worktree/worktree-inputs.js +134 -0
  131. package/dist/worktree/worktree-origin-sync.d.ts +34 -0
  132. package/dist/worktree/worktree-origin-sync.js +127 -0
  133. package/dist/worktree/worktree-wip-events.d.ts +18 -0
  134. package/dist/worktree/worktree-wip-events.js +98 -0
  135. package/dist/worktree/worktree-wip.d.ts +49 -0
  136. package/dist/worktree/worktree-wip.js +182 -0
  137. package/dist/worktree/worktree.base.d.ts +7 -1
  138. package/dist/worktree/worktree.service.d.ts +27 -5
  139. package/dist/worktree/worktree.service.js +106 -181
  140. package/dist/worktree/worktree.types.d.ts +31 -0
  141. package/package.json +1 -1
@@ -4,23 +4,26 @@ import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminE
4
4
  import { withoutHostLoadGovernorVariables } from "../runtime/host-load-child-environment.js";
5
5
  import { isSubPath } from "../shared/path/path.js";
6
6
  import { NodeProcessRunner, ProcessTreeTerminationError } from "../shared/process/process.js";
7
+ import { buildWindowsCmdLaunch } from "../shared/process/windows-launch.js";
7
8
  /** Output kept per stream for one validation step (the tail). */
8
9
  export const prePublicationOutputLimitChars = 4 * 1024 * 1024;
9
10
  export class ProcessPrePublicationCommandRunner {
10
11
  async run(command, args, cwd, signal, environment) {
11
12
  try {
12
13
  const launch = await pnpmDirectoryLaunch(command, args, cwd);
13
- const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm");
14
- const executable = windowsBatch ? (process.env.ComSpec ?? "cmd.exe") : command;
15
- const commandArgs = windowsBatch
16
- ? ["/d", "/s", "/c", [`${command}.cmd`, ...launch.args].map(quoteWindowsCommandArgument).join(" ")]
17
- : [...launch.args];
14
+ // npm and pnpm are batch files on Windows, run through cmd.exe. Its command line is
15
+ // passed verbatim: Node's own quoting escapes inner quotes as \", which cmd.exe does
16
+ // not read, so a quoted argument reached the package manager with its quotes.
17
+ const windowsBatch = process.platform === "win32" && (command === "npm" || command === "pnpm")
18
+ ? buildWindowsCmdLaunch(`${command}.cmd`, launch.args)
19
+ : null;
18
20
  // A process group the runner stops as a whole, settling only once it is gone:
19
21
  // a validation step's host capacity is never returned while its test hosts,
20
22
  // build nodes or browser workers still run.
21
23
  const result = await new NodeProcessRunner().run({
22
- command: executable,
23
- args: commandArgs,
24
+ command: windowsBatch?.command ?? command,
25
+ args: windowsBatch?.args ?? [...launch.args],
26
+ windowsVerbatimArguments: windowsBatch !== null,
24
27
  cwd: launch.cwd,
25
28
  env: prePublicationChildEnvironment(environment),
26
29
  rawOutput: true,
@@ -48,9 +51,6 @@ export class ProcessPrePublicationCommandRunner {
48
51
  }
49
52
  }
50
53
  }
51
- function quoteWindowsCommandArgument(value) {
52
- return /^[A-Za-z0-9_./:@=-]+$/u.test(value) ? value : `"${value.replaceAll('"', '""')}"`;
53
- }
54
54
  export function prePublicationChildEnvironment(environment) {
55
55
  const child = {};
56
56
  const privilegedNames = new Set([
@@ -1,3 +1,4 @@
1
+ import { type NativeTestPostgresGrant } from "../runtime/native-test-postgres-fallback.js";
1
2
  import type { PrePublicationExecutionContext } from "./pre-publication-validation.js";
2
3
  export interface ValidationStep {
3
4
  readonly command: string;
@@ -8,4 +9,4 @@ export interface ValidationStep {
8
9
  }
9
10
  export declare function managedAttemptInvocation(checkId: string, step: ValidationStep, environment?: Readonly<Record<string, string>>): Pick<ValidationStep, "command" | "args">;
10
11
  export declare function supportsNativeTestPostgresFallback(checkId: string): boolean;
11
- export declare function validationExecutionForStep(checkId: string, step: ValidationStep, execution?: PrePublicationExecutionContext, postgresAdminConnection?: string): PrePublicationExecutionContext | undefined;
12
+ export declare function validationExecutionForStep(checkId: string, step: ValidationStep, execution?: PrePublicationExecutionContext, postgresAdminConnection?: NativeTestPostgresGrant): PrePublicationExecutionContext | undefined;
@@ -29,21 +29,22 @@ export function supportsNativeTestPostgresFallback(checkId) {
29
29
  return nativeFallbackCheckIds.has(checkId);
30
30
  }
31
31
  export function validationExecutionForStep(checkId, step, execution, postgresAdminConnection) {
32
- // The connection only exists when Docker is unavailable and the operator
33
- // provisioned a dedicated native test cluster. Only the runner-authored
34
- // .NET test tiers and the suite-identity check receive it; build, client,
35
- // Bridge, and E2E steps never do.
32
+ // The grant only exists when the operator provisioned a dedicated native test
33
+ // cluster, and only the runner-authored .NET test tiers and the suite-identity
34
+ // check receive it; build, client, Bridge, and E2E steps never do.
36
35
  if (!postgresAdminConnection || !nativeFallbackCheckIds.has(checkId))
37
36
  return execution;
38
37
  const runsDotnetTier = step.args.some(argument => nativeFallbackDotnetTierScripts
39
38
  .some(script => argument.replaceAll("\\", "/").endsWith(script)));
40
39
  if (checkId !== "owned-suite-registration" && !runsDotnetTier)
41
40
  return execution;
41
+ // Re-validate the connection before it reaches attempt code.
42
+ parseNativeTestPostgresFallback(postgresAdminConnection.connectionString);
42
43
  return {
43
44
  ...execution,
44
45
  environment: {
45
46
  ...execution?.environment,
46
- ...nativeTestPostgresFallbackEnvironment(parseNativeTestPostgresFallback(postgresAdminConnection)),
47
+ ...nativeTestPostgresFallbackEnvironment(postgresAdminConnection),
47
48
  },
48
49
  };
49
50
  }
@@ -1,7 +1,7 @@
1
1
  import type { DockerEngineProbe } from "../runtime/docker-engine-probe.js";
2
- import type { NativeTestPostgresFallback } from "../runtime/native-test-postgres-fallback.js";
3
2
  import type { HostLoadStepGate } from "../runtime/host-load-governor.js";
4
3
  import { type PrePublicationHostLoadOwner } from "./pre-publication-host-load.js";
4
+ import { type NativeTestPostgresFallback, type StartEphemeralTestPostgresGrant } from "./pre-publication-native-postgres.js";
5
5
  import { type ValidationStep } from "./pre-publication-step-execution.js";
6
6
  import { PrePublicationValidationError, type PrePublicationCheckFailure } from "./pre-publication-pass.js";
7
7
  import type { ProviderProcessRunner } from "./provider-cli/provider-cli.process.js";
@@ -56,7 +56,8 @@ export declare class PrePublicationValidator {
56
56
  private readonly dockerEngineProbe?;
57
57
  private readonly nativeTestPostgresFallback;
58
58
  private readonly hostLoad?;
59
- constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null, hostLoad?: HostLoadStepGate | undefined);
59
+ private readonly startEphemeral?;
60
+ constructor(commands?: PrePublicationCommandRunner, dockerEngineProbe?: DockerEngineProbe | undefined, nativeTestPostgresFallback?: () => NativeTestPostgresFallback | null, hostLoad?: HostLoadStepGate | undefined, startEphemeral?: StartEphemeralTestPostgresGrant | undefined);
60
61
  /**
61
62
  * Runs one pre-publication pass. A failed check does not end the pass: every remaining check that
62
63
  * can still meaningfully run keeps going, and the pass then throws all of its failures as one
@@ -66,13 +67,16 @@ export declare class PrePublicationValidator {
66
67
  private runChecks;
67
68
  /** Runs one check's steps in order; the first failed step ends the check, since later steps use its output. */
68
69
  private runCheck;
70
+ private runCheckSteps;
69
71
  /** Runs a step, confirming once a failure that matches a known transient pattern. */
70
72
  private runConfirmedStep;
71
73
  private runCheckedStep;
72
74
  private confirmStep;
73
75
  private confirmInfrastructure;
74
- /** Returns the native fallback connection when this check must use it instead of Docker. */
76
+ /** Returns the native cluster grant when this check uses it instead of Docker. */
75
77
  private ensurePrerequisite;
78
+ /** Waits for Docker; returns the native cluster grant when Docker stays down and a cluster is provisioned. */
79
+ private ensureDockerPrerequisite;
76
80
  private throwIfPrerequisiteWasLost;
77
81
  private checkTestOnlyExports;
78
82
  private changedPaths;
@@ -4,7 +4,8 @@ import path from "node:path";
4
4
  import { attemptDatabaseCapabilityEnvironment, attemptDatabaseCapabilitySecrets, } from "../runtime/attempt-database-broker.js";
5
5
  import { assertHostDatabaseCapabilityBoundary } from "../runtime/host-database-capability-boundary.js";
6
6
  import { runHostGovernedValidationStep } from "./pre-publication-host-load.js";
7
- import { managedAttemptInvocation, supportsNativeTestPostgresFallback, validationExecutionForStep, } from "./pre-publication-step-execution.js";
7
+ import { dockerFreeGrant, dockerUnavailableNativeTestPostgres, isolatedPostgresProvided, preferredNativeTestPostgres, releaseCheckPostgres, } from "./pre-publication-native-postgres.js";
8
+ import { managedAttemptInvocation, validationExecutionForStep, } from "./pre-publication-step-execution.js";
8
9
  import { hostRuntimeLegacyTestPostgresEnvironment, hostRuntimeTestPostgresAdminEnvironment, hostRuntimeTestPostgresProvisionerEnvironment, } from "../runtime/host-runtime-contract.js";
9
10
  import { redactText } from "../shared/redaction/redaction.js";
10
11
  import { PrePublicationPass, PrePublicationValidationError, SkippedTestTally, skippedCheckEvent, validationEvent, } from "./pre-publication-pass.js";
@@ -100,11 +101,13 @@ export class PrePublicationValidator {
100
101
  dockerEngineProbe;
101
102
  nativeTestPostgresFallback;
102
103
  hostLoad;
103
- constructor(commands = new ProcessPrePublicationCommandRunner(), dockerEngineProbe, nativeTestPostgresFallback = () => null, hostLoad) {
104
+ startEphemeral;
105
+ constructor(commands = new ProcessPrePublicationCommandRunner(), dockerEngineProbe, nativeTestPostgresFallback = () => null, hostLoad, startEphemeral) {
104
106
  this.commands = commands;
105
107
  this.dockerEngineProbe = dockerEngineProbe;
106
108
  this.nativeTestPostgresFallback = nativeTestPostgresFallback;
107
109
  this.hostLoad = hostLoad;
110
+ this.startEphemeral = startEphemeral;
108
111
  }
109
112
  /**
110
113
  * Runs one pre-publication pass. A failed check does not end the pass: every remaining check that
@@ -189,8 +192,16 @@ export class PrePublicationValidator {
189
192
  if (check.requiredCapability && !run.capabilities.has(check.requiredCapability)) {
190
193
  throw new ForgeFailureError("prepublication_capability_unavailable", `prepublication_capability_unavailable: ${check.id} requires ${check.requiredCapability}; publication is holding until a capable runner is available.`, "bridge");
191
194
  }
192
- const postgresAdminConnection = await this.ensurePrerequisite(check, run.execution?.environment, run.postgresAdminConnection, run.emit) ?? run.postgresAdminConnection;
193
- const stepRun = { ...run, check, postgresAdminConnection };
195
+ const granted = await this.ensurePrerequisite(check, run.execution?.environment, run.postgresAdminConnection, run.emit);
196
+ try {
197
+ return await this.runCheckSteps({ ...run, check, postgresAdminConnection: granted ?? run.postgresAdminConnection });
198
+ }
199
+ finally {
200
+ await releaseCheckPostgres(check.id, granted, run.emit);
201
+ }
202
+ }
203
+ async runCheckSteps(stepRun) {
204
+ const { check, ...run } = stepRun;
194
205
  await run.emit?.(validationEvent("prepublication_validation_started", check.id, `Running pre-publication CI parity check '${check.id}'.`));
195
206
  const skipped = new SkippedTestTally(run.worktreePath, run.execution?.environment);
196
207
  for (const step of check.steps) {
@@ -206,7 +217,11 @@ export class PrePublicationValidator {
206
217
  }
207
218
  await skipped.add(result.args, stepStartedMs);
208
219
  }
209
- await run.emit?.(skipped.passedEvent(check.id, validationExactSecrets(run.execution?.environment)));
220
+ // The check's own grant reaches only its steps' derived environments, so name its secrets too.
221
+ await run.emit?.(skipped.passedEvent(check.id, [
222
+ ...validationExactSecrets(run.execution?.environment),
223
+ ...attemptDatabaseCapabilitySecrets(run.postgresAdminConnection?.connectionString),
224
+ ]));
210
225
  return null;
211
226
  }
212
227
  /** Runs a step, confirming once a failure that matches a known transient pattern. */
@@ -255,7 +270,7 @@ export class PrePublicationValidator {
255
270
  await run.emit?.(validationEvent("prepublication_infrastructure_failed", checkId, `Pre-publication infrastructure for '${checkId}' remained unavailable${detail ? `: ${detail}` : "."}`));
256
271
  throw new PrePublicationInfrastructureError(checkId, result.exitCode, result.command, result.args, detail);
257
272
  }
258
- /** Returns the native fallback connection when this check must use it instead of Docker. */
273
+ /** Returns the native cluster grant when this check uses it instead of Docker. */
259
274
  async ensurePrerequisite(check, environment, postgresAdminConnection, emit) {
260
275
  if (check.requiredPrerequisite === "isolated_postgres"
261
276
  && isolatedPostgresProvided(check.id, environment, postgresAdminConnection)) {
@@ -264,6 +279,11 @@ export class PrePublicationValidator {
264
279
  : `Pre-publication check '${check.id}' is using the configured loopback PostgreSQL test server with per-run owned databases. No Docker daemon is required.`));
265
280
  return undefined;
266
281
  }
282
+ return await preferredNativeTestPostgres(check.id, check.requiredPrerequisite, this.nativeTestPostgresFallback, this.dockerEngineProbe, emit, this.startEphemeral)
283
+ ?? await this.ensureDockerPrerequisite(check, emit);
284
+ }
285
+ /** Waits for Docker; returns the native cluster grant when Docker stays down and a cluster is provisioned. */
286
+ async ensureDockerPrerequisite(check, emit) {
267
287
  if (check.requiredPrerequisite === undefined || !this.dockerEngineProbe)
268
288
  return undefined;
269
289
  const current = this.dockerEngineProbe.current();
@@ -275,12 +295,10 @@ export class PrePublicationValidator {
275
295
  const snapshot = await this.dockerEngineProbe.ensureAvailableForRequiredWork();
276
296
  if (!snapshot.available) {
277
297
  const detail = `Docker prerequisite unavailable (${snapshot.unavailableCode ?? "docker_engine_unavailable"}): ${snapshot.unavailableReason ?? "the daemon did not pass a fresh readiness probe"}`;
278
- const fallback = check.requiredPrerequisite === "isolated_postgres" && supportsNativeTestPostgresFallback(check.id)
279
- ? this.nativeTestPostgresFallback()
280
- : null;
298
+ const fallback = dockerUnavailableNativeTestPostgres(check.id, check.requiredPrerequisite, this.nativeTestPostgresFallback);
281
299
  if (fallback) {
282
300
  await emit?.(validationEvent("prepublication_prerequisite_native_fallback", check.id, `${detail}. Pre-publication check '${check.id}' is using the dedicated native PostgreSQL test cluster at ${fallback.endpoint} with per-run owned databases.`));
283
- return fallback.connectionString;
301
+ return fallback;
284
302
  }
285
303
  await emit?.(validationEvent("prepublication_prerequisite_unavailable", check.id, `Pre-publication check '${check.id}' is waiting for Docker infrastructure recovery: ${detail}`));
286
304
  throw new PrePublicationInfrastructureError(check.id, 75, "docker", ["info"], detail);
@@ -292,7 +310,7 @@ export class PrePublicationValidator {
292
310
  if (result.exitCode === 0
293
311
  || check.requiredPrerequisite === undefined
294
312
  || (check.requiredPrerequisite === "isolated_postgres"
295
- && isolatedPostgresProvided(check.id, environment, postgresAdminConnection))
313
+ && isolatedPostgresProvided(check.id, environment, dockerFreeGrant(postgresAdminConnection)))
296
314
  || !this.dockerEngineProbe)
297
315
  return;
298
316
  const snapshot = await this.dockerEngineProbe.refresh(true);
@@ -435,27 +453,11 @@ export class PrePublicationValidator {
435
453
  }
436
454
  }
437
455
  }
438
- function environmentValue(environment, name) {
439
- return Object.prototype.hasOwnProperty.call(environment ?? {}, name)
440
- ? environment?.[name]?.trim() ?? ""
441
- : process.env[name]?.trim() ?? "";
442
- }
443
- function isolatedPostgresProvided(checkId, environment, postgresAdminConnection) {
444
- if (checkId === "playwright-e2e") {
445
- const attemptId = environmentValue(environment, "FORGE_DISPATCH_ATTEMPT_ID");
446
- return (environmentValue(environment, "FORGE_E2E_OWNERSHIP_MODE") === "attempt"
447
- || /^[0-9a-f-]{36}$/iu.test(attemptId))
448
- && /^forge_attempt_[0-9a-f]{32}$/u.test(environmentValue(environment, "FORGE_ATTEMPT_DATABASE_SCHEMA"))
449
- && path.isAbsolute(environmentValue(environment, "FORGE_ATTEMPT_DATABASE_READINESS_PATH"))
450
- // The attempt owns a database only once the Bridge's broker has issued it one.
451
- && environmentValue(environment, attemptDatabaseCapabilityEnvironment).length > 0;
452
- }
453
- return Boolean(postgresAdminConnection);
454
- }
455
456
  function validationExactSecrets(environment) {
456
457
  return [
457
- environment?.[hostRuntimeTestPostgresAdminEnvironment]?.trim() ?? "",
458
- environment?.[hostRuntimeLegacyTestPostgresEnvironment]?.trim() ?? "",
458
+ // The connection strings and their passwords: a test may print either.
459
+ ...attemptDatabaseCapabilitySecrets(environment?.[hostRuntimeTestPostgresAdminEnvironment]),
460
+ ...attemptDatabaseCapabilitySecrets(environment?.[hostRuntimeLegacyTestPostgresEnvironment]),
459
461
  environment?.[hostRuntimeTestPostgresProvisionerEnvironment]?.trim() ?? "",
460
462
  ...attemptDatabaseCapabilitySecrets(environment?.[attemptDatabaseCapabilityEnvironment]),
461
463
  ].filter((value, index, values) => value.length > 0 && values.indexOf(value) === index);
@@ -19,9 +19,10 @@ export declare const claudeHeadlessEnvironment: Readonly<Record<string, string>>
19
19
  export declare const claudeHeadlessDisallowedTools: readonly string[];
20
20
  /**
21
21
  * The Claude Code arguments that apply the restrictions: the tool deny list, and the environment
22
- * again as flag settings, which outrank a user's or repository's settings `env` block.
22
+ * again as flag settings, which outrank a user's or repository's settings `env` block. Other flag
23
+ * settings (`provider-user-config-isolation.ts`) share the one `--settings` value.
23
24
  */
24
- export declare function claudeHeadlessToolArgs(): readonly string[];
25
+ export declare function claudeHeadlessToolArgs(additionalSettings?: Readonly<Record<string, unknown>>): readonly string[];
25
26
  /**
26
27
  * The provider ended its turn while background work it started (a background subagent or
27
28
  * shell, a Monitor watch, a wakeup) was still live. Claude Code withholds the turn's terminal
@@ -40,12 +40,13 @@ export const claudeHeadlessDisallowedTools = Object.freeze([
40
40
  ]);
41
41
  /**
42
42
  * The Claude Code arguments that apply the restrictions: the tool deny list, and the environment
43
- * again as flag settings, which outrank a user's or repository's settings `env` block.
43
+ * again as flag settings, which outrank a user's or repository's settings `env` block. Other flag
44
+ * settings (`provider-user-config-isolation.ts`) share the one `--settings` value.
44
45
  */
45
- export function claudeHeadlessToolArgs() {
46
+ export function claudeHeadlessToolArgs(additionalSettings = {}) {
46
47
  return [
47
48
  "--disallowedTools", claudeHeadlessDisallowedTools.join(","),
48
- "--settings", JSON.stringify({ env: claudeHeadlessEnvironment }),
49
+ "--settings", JSON.stringify({ ...additionalSettings, env: claudeHeadlessEnvironment }),
49
50
  ];
50
51
  }
51
52
  /**
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A runner host can allow only one local .NET build or test at a time across everything that runs
3
+ * on it: Forge agents, the owner's own sessions and their tools. Parallel builds there exhaust
4
+ * memory and break each other's shared test output. The host's owner names the lock wrapper in the
5
+ * bridge's own environment; Forge passes it to every host-mode agent turn and Bridge Chat turn and
6
+ * tells the agent to run its .NET builds and tests through it. The rule reaches agents only from Forge, never from a
7
+ * user-level instruction file (provider-user-config-isolation.ts).
8
+ */
9
+ export declare const hostDotnetBuildLockVariable = "FORGE_HOST_DOTNET_BUILD_LOCK";
10
+ /** The host's .NET build lock wrapper, when the bridge's environment names one. */
11
+ export declare function hostDotnetBuildLock(environment?: NodeJS.ProcessEnv): string | null;
12
+ export declare function hostDotnetBuildLockEnvironment(environment?: NodeJS.ProcessEnv): Readonly<Record<string, string>>;
13
+ /**
14
+ * The runtime-context instruction for a host that names a .NET build lock, or an empty string.
15
+ * Session turns also hear that the commands Forge runs for them are scheduled by Forge; Bridge
16
+ * Chat turns have no Forge tools.
17
+ */
18
+ export declare function hostDotnetBuildLockInstruction(environment?: NodeJS.ProcessEnv, turn?: "session" | "chat"): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A runner host can allow only one local .NET build or test at a time across everything that runs
3
+ * on it: Forge agents, the owner's own sessions and their tools. Parallel builds there exhaust
4
+ * memory and break each other's shared test output. The host's owner names the lock wrapper in the
5
+ * bridge's own environment; Forge passes it to every host-mode agent turn and Bridge Chat turn and
6
+ * tells the agent to run its .NET builds and tests through it. The rule reaches agents only from Forge, never from a
7
+ * user-level instruction file (provider-user-config-isolation.ts).
8
+ */
9
+ export const hostDotnetBuildLockVariable = "FORGE_HOST_DOTNET_BUILD_LOCK";
10
+ /** The host's .NET build lock wrapper, when the bridge's environment names one. */
11
+ export function hostDotnetBuildLock(environment = process.env) {
12
+ return environment[hostDotnetBuildLockVariable]?.trim() || null;
13
+ }
14
+ export function hostDotnetBuildLockEnvironment(environment = process.env) {
15
+ const lock = hostDotnetBuildLock(environment);
16
+ return lock ? { [hostDotnetBuildLockVariable]: lock } : {};
17
+ }
18
+ /**
19
+ * The runtime-context instruction for a host that names a .NET build lock, or an empty string.
20
+ * Session turns also hear that the commands Forge runs for them are scheduled by Forge; Bridge
21
+ * Chat turns have no Forge tools.
22
+ */
23
+ export function hostDotnetBuildLockInstruction(environment = process.env, turn = "session") {
24
+ if (!hostDotnetBuildLock(environment))
25
+ return "";
26
+ const forgeScheduled = turn === "session"
27
+ ? " Commands Forge runs for you (`forge.start_managed_verification`, pre-publication checks) are scheduled by Forge."
28
+ : "";
29
+ return `\n- This host runs one local .NET build or test at a time. Run every \`dotnet build\` and \`dotnet test\` you start yourself through the host lock in \`${hostDotnetBuildLockVariable}\`, for example \`"$${hostDotnetBuildLockVariable}" dotnet test <project> --filter <tests>\`. It waits while another build or test holds the lock and exits 75 if the wait times out; wait and retry rather than running without it.${forgeScheduled}`;
30
+ }
@@ -1,5 +1,8 @@
1
1
  import { PrePublicationValidationError, type PrePublicationProfile, type PrePublicationValidator } from "../pre-publication-validation.js";
2
+ import { prepareCompletionToolRuntime } from "../phase-completion.js";
3
+ import { type RunOnceDispatchPacket } from "../session.types.js";
2
4
  import type { ProviderProcessRunner } from "./provider-cli.process.js";
5
+ import { buildProviderCliCommand } from "./provider-cli.prompts.js";
3
6
  import type { ProviderCliRunContext } from "./provider-cli.types.js";
4
7
  import { type ProviderOutputState } from "./provider-output-state.js";
5
8
  /**
@@ -37,4 +40,17 @@ export interface PrePublicationRepairDependencies {
37
40
  readonly runRepairTurn: (turn: PrePublicationRepairTurn) => Promise<void>;
38
41
  }
39
42
  export declare function validatePrePublicationWithRepair(options: PrePublicationRepairOptions, dependencies: PrePublicationRepairDependencies): Promise<void>;
43
+ /**
44
+ * The resumed command for one pre-publication repair turn. The main turn's Forge MCP server was
45
+ * cleaned up when that turn exited, so the repair turn gets its own: the managed-attempt tools its
46
+ * prompt directs long checks to, without the completion tools whose artifacts are already recorded.
47
+ * The caller owns the returned runtime and cleans it up when the turn exits.
48
+ */
49
+ export declare function prepareRepairTurnLaunch(context: ProviderCliRunContext, turn: PrePublicationRepairTurn): Promise<{
50
+ readonly repairDispatch: RunOnceDispatchPacket;
51
+ readonly providerPrompt: string;
52
+ readonly pipePromptToStdin: boolean;
53
+ readonly completionTools: Awaited<ReturnType<typeof prepareCompletionToolRuntime>>;
54
+ readonly command: ReturnType<typeof buildProviderCliCommand>;
55
+ }>;
40
56
  export declare function buildPrePublicationRepairPrompt(error: PrePublicationValidationError, repairTurn: number, maxRepairTurns: number, repairScope: "implementation" | "pull_request"): string;
@@ -2,7 +2,9 @@ import { HostPortCollisionError } from "../../runtime/host-port-broker.js";
2
2
  import { runtimeAdmissionPriority } from "../../runtime/host-runtime-lease.js";
3
3
  import { runtimeRestartCheckId } from "../pre-publication-pass.js";
4
4
  import { PrePublicationValidationError, } from "../pre-publication-validation.js";
5
+ import { prepareCompletionToolRuntime } from "../phase-completion.js";
5
6
  import { ForgeFailureError } from "../session.types.js";
7
+ import { buildProviderCliCommand, buildProviderCliPrompt, shouldPipePromptToStdin, usesManagedWindowsHost, } from "./provider-cli.prompts.js";
6
8
  import { prePublicationValidationEnv, providerProcessEnv } from "./provider-cli.runtime.js";
7
9
  import { clip } from "./provider-output-state.js";
8
10
  // Pre-publication validation with bounded in-place repair: each pass restarts the attempt's runtime
@@ -88,6 +90,37 @@ export async function validatePrePublicationWithRepair(options, dependencies) {
88
90
  });
89
91
  }
90
92
  }
93
+ /**
94
+ * The resumed command for one pre-publication repair turn. The main turn's Forge MCP server was
95
+ * cleaned up when that turn exited, so the repair turn gets its own: the managed-attempt tools its
96
+ * prompt directs long checks to, without the completion tools whose artifacts are already recorded.
97
+ * The caller owns the returned runtime and cleans it up when the turn exits.
98
+ */
99
+ export async function prepareRepairTurnLaunch(context, turn) {
100
+ const { dispatch, worktree } = context;
101
+ const { prompt: focusedPrompt, repairEnvironment } = turn;
102
+ const repairDispatch = {
103
+ ...dispatch,
104
+ session: { ...dispatch.session, resumeProviderThreadId: turn.providerThreadId },
105
+ };
106
+ const providerPrompt = buildProviderCliPrompt(repairDispatch, focusedPrompt, repairEnvironment);
107
+ const pipePromptToStdin = shouldPipePromptToStdin(repairDispatch.execution.provider, providerPrompt, usesManagedWindowsHost(repairDispatch));
108
+ const completionTools = await prepareCompletionToolRuntime({
109
+ dispatch: repairDispatch,
110
+ worktree,
111
+ runtimeEnvironment: repairEnvironment,
112
+ hostLoadEnvironment: context.hostLoadEnvironment,
113
+ managedToolsOnly: true,
114
+ });
115
+ const command = buildProviderCliCommand(repairDispatch, {
116
+ worktreePath: worktree.worktreePath,
117
+ prompt: focusedPrompt,
118
+ promptFromStdin: pipePromptToStdin,
119
+ completionTools,
120
+ runtimeEnvironment: repairEnvironment,
121
+ });
122
+ return { repairDispatch, providerPrompt, pipePromptToStdin, completionTools, command };
123
+ }
91
124
  /** Restarts the runtime stack if needed, then validates; returns every failure of the pass, or null. */
92
125
  async function runValidationPass(options, dependencies, environments, repairTurn) {
93
126
  const { context, validationProfile, preparedHeadSha } = options;
@@ -2,6 +2,9 @@ import os from "node:os";
2
2
  import { normalizeWindowsProviderEnvironment, windowsAllowedProviderParentEnvNames } from "./provider-cli.windows-environment.js";
3
3
  // The environment a provider child process starts with: an allowlist of the Bridge's own
4
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.
5
8
  const allowedProviderParentEnvNames = [
6
9
  "PATH",
7
10
  "HOME",
@@ -9,8 +12,7 @@ const allowedProviderParentEnvNames = [
9
12
  "TMPDIR",
10
13
  "TEMP",
11
14
  "TMP",
12
- "LANG",
13
- "CLAUDE_CONFIG_DIR"
15
+ "LANG"
14
16
  ];
15
17
  export function buildProviderChildEnvironment(requestEnv, options = {}) {
16
18
  const parentEnv = options.parentEnv ?? process.env;
@@ -1,9 +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
3
  export { chooseWindowsCommandCandidate, resolveWindowsCommandFromPath } from "../../shared/process/windows-launch.js";
4
4
  export { buildProviderChildEnvironment, type ProviderChildEnvironmentOptions } from "./provider-cli.child-environment.js";
5
5
  export declare const PROVIDER_OUTPUT_CAPTURE_LIMIT_CHARS: number;
6
6
  export type ProviderCliCommand = LaunchCommand;
7
+ export { resolveClaudeNpmDirectLaunch, resolveCodexNpmDirectLaunch, resolvePackageManagerDirectLaunch } from "./provider-cli.windows-launch.js";
7
8
  export interface ProviderProcessRunRequest {
8
9
  readonly command: string;
9
10
  readonly args: readonly string[];
@@ -111,16 +112,3 @@ export declare function providerCompletionToolMissingFailure(message: string, re
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;
@@ -1,11 +1,9 @@
1
- import { execFile, execFileSync, spawn } from "node:child_process";
1
+ import { execFileSync, spawn } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
- import { promisify } from "node:util";
5
- import { resolveCursorAgentDirectLaunch } from "../../shared/cursor-agent/cursor-agent.launch.js";
6
4
  import { persistHostProcessSupervisorMetadata, resolveHostProcessSupervisedLaunch, terminateHostProcessTree, } from "../../shared/process/host-process-supervisor.js";
7
- import { buildWindowsLaunchCommand, chooseWindowsCommandCandidate, resolveWindowsCommandFromPath } from "../../shared/process/windows-launch.js";
8
5
  import { buildProviderChildEnvironment } from "./provider-cli.child-environment.js";
6
+ import { resolveWindowsProviderLaunch } from "./provider-cli.windows-launch.js";
9
7
  import { isCodexModelsCacheSchemaFailure, quarantineIncompatibleCodexModelsCache } from "./provider-cli.codex-models-cache.js";
10
8
  import { assertHostDatabaseCapabilityBoundary } from "../../runtime/host-database-capability-boundary.js";
11
9
  import { ForgeFailureError } from "../session.types.js";
@@ -14,7 +12,6 @@ import { hasNonterminalManagedCommand, isProviderTerminalFailure, isProviderTerm
14
12
  import { OutputPipeRelease, readProcessLines, PROVIDER_OUTPUT_PIPE_RELEASE_GRACE_MS } from "./provider-output-pipes.js";
15
13
  export { chooseWindowsCommandCandidate, resolveWindowsCommandFromPath } from "../../shared/process/windows-launch.js";
16
14
  export { buildProviderChildEnvironment } from "./provider-cli.child-environment.js";
17
- const execFileAsync = promisify(execFile);
18
15
  // Provider processes can emit many gigabytes over a long-running session. The
19
16
  // line handlers stream that output to Forge as it arrives; the completed result
20
17
  // only needs a bounded diagnostic tail for failure classification.
@@ -26,6 +23,7 @@ const PROVIDER_TERMINAL_EXIT_GRACE_MS = 15_000;
26
23
  const PROVIDER_TERMINAL_SUCCESS_CEILING_MS = 10 * 60_000;
27
24
  // How often the end-of-turn timers re-check whether supervised work is still in flight.
28
25
  const PROVIDER_TERMINAL_WORK_POLL_MS = 1_000;
26
+ export { resolveClaudeNpmDirectLaunch, resolveCodexNpmDirectLaunch, resolvePackageManagerDirectLaunch } from "./provider-cli.windows-launch.js";
29
27
  /** Recovery must wrap the attempt coordinator, never its raw OS runner. Each
30
28
  * relaunch needs a new fenced child generation and exclusive launch files. The outer
31
29
  * layer fails any run Forge stopped because its turn ended with background work live. */
@@ -648,18 +646,7 @@ async function resolveProviderProcessLaunch(command, args) {
648
646
  if (process.platform !== "win32") {
649
647
  return { command, args };
650
648
  }
651
- const cursorDirect = await resolveCursorAgentDirectLaunch(command, args);
652
- if (cursorDirect) {
653
- return cursorDirect;
654
- }
655
- const resolved = await resolveWindowsCommand(command);
656
- if (!resolved) {
657
- return { command, args };
658
- }
659
- return resolveCodexNpmDirectLaunch(resolved, args)
660
- ?? resolveClaudeNpmDirectLaunch(resolved, args)
661
- ?? resolvePackageManagerDirectLaunch(resolved, args)
662
- ?? buildWindowsLaunchCommand(resolved, args);
649
+ return await resolveWindowsProviderLaunch(command, args);
663
650
  }
664
651
  const UNIX_PROVIDER_START_GATE_SHELL = "/bin/sh";
665
652
  const UNIX_PROVIDER_START_GATE_NAME = "forge-provider-start-gate";
@@ -768,80 +755,3 @@ async function waitForWindowsProviderReady(launch, signal, isClosed) {
768
755
  await new Promise(resolve => setTimeout(resolve, 25));
769
756
  }
770
757
  }
771
- export function resolveCodexNpmDirectLaunch(commandPath, args) {
772
- const extension = path.extname(commandPath).toLowerCase();
773
- if ((extension !== ".cmd" && extension !== ".ps1")
774
- || path.basename(commandPath, extension).toLowerCase() !== "codex") {
775
- return null;
776
- }
777
- const entryPoint = path.join(path.dirname(commandPath), "node_modules", "@openai", "codex", "bin", "codex.js");
778
- return fs.existsSync(entryPoint)
779
- ? { command: process.execPath, args: [entryPoint, ...args] }
780
- : null;
781
- }
782
- /**
783
- * npm installs of Claude Code (`npm i -g @anthropic-ai/claude-code`) put a `claude.cmd` shim on
784
- * PATH; launch its cli.js directly for the same Job Object reasons as Codex. The native installer
785
- * ships `claude.exe`, which is preferred by PATH resolution and needs no rewrite.
786
- */
787
- export function resolveClaudeNpmDirectLaunch(commandPath, args) {
788
- const extension = path.extname(commandPath).toLowerCase();
789
- if ((extension !== ".cmd" && extension !== ".ps1")
790
- || path.basename(commandPath, extension).toLowerCase() !== "claude") {
791
- return null;
792
- }
793
- const entryPoint = path.join(path.dirname(commandPath), "node_modules", "@anthropic-ai", "claude-code", "cli.js");
794
- return fs.existsSync(entryPoint)
795
- ? { command: process.execPath, args: [entryPoint, ...args] }
796
- : null;
797
- }
798
- /**
799
- * Avoids cmd.exe's nested-quote handling for package-manager shims. That
800
- * quoting loses executable paths containing spaces after the command is
801
- * wrapped by the Windows Job Object supervisor.
802
- */
803
- export function resolvePackageManagerDirectLaunch(commandPath, args) {
804
- const extension = path.extname(commandPath).toLowerCase();
805
- if (extension !== ".cmd" && extension !== ".ps1")
806
- return null;
807
- const packageManager = path.basename(commandPath, extension).toLowerCase();
808
- if (!["corepack", "npm", "npx", "pnpm", "pnpx", "yarn", "yarnpkg"].includes(packageManager))
809
- return null;
810
- const root = path.dirname(commandPath);
811
- const candidates = [
812
- path.join(root, "node_modules", "corepack", "dist", packageManager === "corepack" ? "corepack.js" : `${packageManager}.js`),
813
- ...(packageManager === "npm" || packageManager === "npx"
814
- ? [path.join(root, "node_modules", "npm", "bin", `${packageManager}-cli.js`)]
815
- : []),
816
- ...(packageManager === "pnpm" || packageManager === "pnpx"
817
- ? [path.join(root, "node_modules", "pnpm", "bin", `${packageManager}.cjs`)]
818
- : []),
819
- ...(packageManager === "yarn" || packageManager === "yarnpkg"
820
- ? [path.join(root, "node_modules", "yarn", "bin", "yarn.js")]
821
- : []),
822
- ];
823
- const entryPoint = candidates.find(candidate => fs.existsSync(candidate));
824
- if (!entryPoint)
825
- return null;
826
- const adjacentNode = path.join(root, "node.exe");
827
- return {
828
- command: fs.existsSync(adjacentNode) ? adjacentNode : process.execPath,
829
- args: [entryPoint, ...args],
830
- };
831
- }
832
- async function resolveWindowsCommand(command) {
833
- if (path.isAbsolute(command)) {
834
- return command;
835
- }
836
- const resolvedFromPath = resolveWindowsCommandFromPath(command);
837
- if (resolvedFromPath) {
838
- return resolvedFromPath;
839
- }
840
- try {
841
- const result = await execFileAsync("where.exe", [command], { timeout: 2000 });
842
- return chooseWindowsCommandCandidate(result.stdout.split(/\r?\n/));
843
- }
844
- catch {
845
- return null;
846
- }
847
- }
@@ -29,6 +29,9 @@ export declare function buildProviderCliCommand(dispatch: RunOnceDispatchPacket,
29
29
  * Values the provider does not accept are dropped rather than failing the attempt; Forge validates on save.
30
30
  */
31
31
  export declare function providerEffort(provider: string, effort: string | null | undefined): string | null;
32
+ /** Whether the provider reads its prompt from stdin rather than the command line. */
33
+ export declare function shouldPipePromptToStdin(provider: string, prompt: string, force?: boolean): boolean;
34
+ export declare function usesManagedWindowsHost(dispatch: RunOnceDispatchPacket): boolean;
32
35
  export declare function buildProviderCliPrompt(dispatch: RunOnceDispatchPacket, prompt: string, runtimeEnvironment?: Readonly<Record<string, string>>): string;
33
36
  export declare function codexSandboxModeForPlatform(platform?: NodeJS.Platform, executionMode?: string): "workspace-write" | "danger-full-access";
34
37
  export declare function buildArchitectPrompt(dispatch: RunOnceDispatchPacket): string;