@loucompanion/forge-bridge 0.1.4-dev.fb770705136a → 0.2.1-dev.0f07274d438b
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/README.md +183 -4
- package/dist/bridge/bridge-chat-giphy-look.d.ts +48 -0
- package/dist/bridge/bridge-chat-giphy-look.js +55 -0
- package/dist/bridge/bridge-chat-provider-command.d.ts +40 -0
- package/dist/bridge/bridge-chat-provider-command.js +230 -0
- package/dist/bridge/bridge-chat.types.d.ts +20 -0
- package/dist/bridge/bridge-chat.types.js +28 -1
- package/dist/bridge/bridge-state-file.d.ts +161 -0
- package/dist/bridge/bridge-state-file.js +376 -0
- package/dist/bridge/bridge-state-io.d.ts +15 -0
- package/dist/bridge/bridge-state-io.js +68 -0
- package/dist/bridge/bridge-state-lock.d.ts +11 -0
- package/dist/bridge/bridge-state-lock.js +102 -0
- package/dist/bridge/bridge-state-unpublished.d.ts +17 -0
- package/dist/bridge/bridge-state-unpublished.js +111 -0
- package/dist/bridge/bridge.base.d.ts +9 -0
- package/dist/bridge/bridge.service.d.ts +102 -14
- package/dist/bridge/bridge.service.js +499 -471
- package/dist/bridge/bridge.types.d.ts +37 -0
- package/dist/bridge/bridge.types.js +2 -1
- package/dist/bridge/default-session-service.d.ts +13 -0
- package/dist/bridge/default-session-service.js +22 -0
- package/dist/bridge/dispatch-offer-policy.d.ts +22 -0
- package/dist/bridge/dispatch-offer-policy.js +58 -0
- package/dist/bridge/in-flight-registry.d.ts +62 -0
- package/dist/bridge/in-flight-registry.js +207 -0
- package/dist/bridge/local-yield-flag.d.ts +6 -0
- package/dist/bridge/local-yield-flag.js +34 -0
- package/dist/bridge/readiness-result-outbox.d.ts +5 -1
- package/dist/bridge/readiness-result-outbox.js +20 -0
- package/dist/bridge/runner-host-capabilities.d.ts +5 -0
- package/dist/bridge/runner-host-capabilities.js +31 -1
- package/dist/bridge/sandbox-resource-accounting.d.ts +16 -0
- package/dist/bridge/sandbox-resource-accounting.js +150 -0
- package/dist/bridge/test-postgres-capability.d.ts +14 -0
- package/dist/bridge/test-postgres-capability.js +120 -0
- package/dist/bridge/windows-bash-resolution.d.ts +31 -0
- package/dist/bridge/windows-bash-resolution.js +153 -0
- package/dist/cleanup/cleanup-wip.d.ts +12 -0
- package/dist/cleanup/cleanup-wip.js +66 -0
- package/dist/cleanup/cleanup.service.d.ts +20 -1
- package/dist/cleanup/cleanup.service.js +150 -169
- package/dist/cleanup/cleanup.types.d.ts +6 -0
- package/dist/cleanup/forge-owned-paths.d.ts +11 -0
- package/dist/cleanup/forge-owned-paths.js +62 -0
- package/dist/cleanup/host-runtime-ledger.d.ts +7 -0
- package/dist/cleanup/host-runtime-ledger.js +130 -0
- package/dist/cleanup/managed-branch-sweep.d.ts +27 -0
- package/dist/cleanup/managed-branch-sweep.js +111 -0
- package/dist/cli/cli.help.js +75 -13
- package/dist/cli/cli.service.d.ts +19 -10
- package/dist/cli/cli.service.js +161 -228
- package/dist/cli/idle-status.d.ts +84 -0
- package/dist/cli/idle-status.js +181 -0
- package/dist/cli/local-config.d.ts +18 -1
- package/dist/cli/local-config.js +67 -5
- package/dist/cli/provider-cli-advertising.d.ts +24 -0
- package/dist/cli/provider-cli-advertising.js +88 -0
- package/dist/cli/provider-cli-detection.d.ts +10 -0
- package/dist/cli/provider-cli-detection.js +160 -0
- package/dist/runtime/aspnet-runtime-prebuild.d.ts +20 -0
- package/dist/runtime/aspnet-runtime-prebuild.js +184 -18
- package/dist/runtime/attempt-database-broker.d.ts +1 -1
- package/dist/runtime/attempt-node-runtime-launcher.d.ts +36 -0
- package/dist/runtime/attempt-node-runtime-launcher.js +169 -0
- package/dist/runtime/attempt-process-supervisor.d.ts +2 -0
- package/dist/runtime/attempt-process-supervisor.js +12 -6
- package/dist/runtime/docker-engine-probe.d.ts +5 -0
- package/dist/runtime/docker-engine-probe.js +7 -0
- package/dist/runtime/dotnet-build-outputs.d.ts +107 -0
- package/dist/runtime/dotnet-build-outputs.js +402 -0
- package/dist/runtime/ephemeral-test-postgres-grant.d.ts +37 -0
- package/dist/runtime/ephemeral-test-postgres-grant.js +85 -0
- package/dist/runtime/ephemeral-test-postgres.d.ts +57 -0
- package/dist/runtime/ephemeral-test-postgres.js +303 -0
- package/dist/runtime/host-facts.d.ts +2 -1
- package/dist/runtime/host-listener-inspector.d.ts +26 -0
- package/dist/runtime/host-listener-inspector.js +84 -3
- package/dist/runtime/host-load-admission.d.ts +72 -0
- package/dist/runtime/host-load-admission.js +99 -0
- package/dist/runtime/host-load-capacity.d.ts +198 -0
- package/dist/runtime/host-load-capacity.js +353 -0
- package/dist/runtime/host-load-child-environment.d.ts +40 -0
- package/dist/runtime/host-load-child-environment.js +110 -0
- package/dist/runtime/host-load-forge-cgroups.d.ts +49 -0
- package/dist/runtime/host-load-forge-cgroups.js +140 -0
- package/dist/runtime/host-load-governor-config.d.ts +82 -0
- package/dist/runtime/host-load-governor-config.js +104 -0
- package/dist/runtime/host-load-governor.d.ts +273 -0
- package/dist/runtime/host-load-governor.js +831 -0
- package/dist/runtime/host-load-ledger-lock.d.ts +69 -0
- package/dist/runtime/host-load-ledger-lock.js +187 -0
- package/dist/runtime/host-load-live-test-slots.d.ts +61 -0
- package/dist/runtime/host-load-live-test-slots.js +193 -0
- package/dist/runtime/host-load-runtime-settings.d.ts +25 -0
- package/dist/runtime/host-load-runtime-settings.js +80 -0
- package/dist/runtime/host-load-sampler.d.ts +92 -2
- package/dist/runtime/host-load-sampler.js +166 -8
- package/dist/runtime/host-load-step-class.d.ts +70 -0
- package/dist/runtime/host-load-step-class.js +161 -0
- package/dist/runtime/host-load-step-reaper.d.ts +27 -0
- package/dist/runtime/host-load-step-reaper.js +95 -0
- package/dist/runtime/host-load-step-run.d.ts +107 -0
- package/dist/runtime/host-load-step-run.js +158 -0
- package/dist/runtime/host-load-test-slot.d.ts +46 -0
- package/dist/runtime/host-load-test-slot.js +100 -0
- package/dist/runtime/host-load-token-ledger.d.ts +200 -0
- package/dist/runtime/host-load-token-ledger.js +453 -0
- package/dist/runtime/host-load-windows-cpu.d.ts +34 -0
- package/dist/runtime/host-load-windows-cpu.js +85 -0
- package/dist/runtime/host-pressure-stall.d.ts +21 -1
- package/dist/runtime/host-pressure-stall.js +48 -1
- package/dist/runtime/host-runtime-contract.d.ts +15 -0
- package/dist/runtime/host-runtime-contract.js +39 -6
- package/dist/runtime/host-runtime-lease.d.ts +101 -6
- package/dist/runtime/host-runtime-lease.js +408 -294
- package/dist/runtime/host-runtime-ledger-recovery.d.ts +20 -0
- package/dist/runtime/host-runtime-ledger-recovery.js +134 -0
- package/dist/runtime/host-runtime-promotion.d.ts +101 -2
- package/dist/runtime/host-runtime-promotion.js +355 -14
- package/dist/runtime/host-runtime-requirements-check.d.ts +17 -0
- package/dist/runtime/host-runtime-requirements-check.js +29 -0
- package/dist/runtime/host-runtime-requirements.d.ts +36 -0
- package/dist/runtime/host-runtime-requirements.js +117 -0
- package/dist/runtime/managed-command-teardown.js +5 -16
- package/dist/runtime/native-test-postgres-fallback.d.ts +51 -7
- package/dist/runtime/native-test-postgres-fallback.js +60 -8
- package/dist/runtime/playwright-host-runtime-adapter.d.ts +7 -0
- package/dist/runtime/playwright-host-runtime-adapter.js +13 -1
- package/dist/runtime/prepared-runtime-identity.d.ts +4 -0
- package/dist/runtime/prepared-runtime-identity.js +130 -9
- package/dist/runtime/prepared-runtime-readiness.d.ts +23 -1
- package/dist/runtime/prepared-runtime-readiness.js +89 -18
- package/dist/runtime/runner-settings.d.ts +104 -0
- package/dist/runtime/runner-settings.js +236 -0
- package/dist/runtime/supervised-runtime-build-guard.d.ts +45 -0
- package/dist/runtime/supervised-runtime-build-guard.js +112 -0
- package/dist/sandbox/host-capacity-broker.d.ts +115 -0
- package/dist/sandbox/host-capacity-broker.js +336 -0
- package/dist/sandbox/managed-branch.d.ts +13 -0
- package/dist/sandbox/managed-branch.js +90 -0
- package/dist/sandbox/provider-auth/codex.js +11 -11
- package/dist/sandbox/runtime.d.ts +11 -3
- package/dist/sandbox/runtime.js +53 -20
- package/dist/sandbox/sandbox-cgroups.d.ts +14 -0
- package/dist/sandbox/sandbox-cgroups.js +42 -0
- package/dist/sandbox/sandbox-input.d.ts +22 -0
- package/dist/sandbox/sandbox-input.js +49 -0
- package/dist/sandbox/workspace.service.js +15 -2
- package/dist/session/architect-waits.d.ts +2 -0
- package/dist/session/architect-waits.js +138 -0
- package/dist/session/managed-attempt-tools.d.ts +2 -7
- package/dist/session/managed-attempt-tools.js +204 -141
- package/dist/session/managed-build-coordinator.d.ts +16 -0
- package/dist/session/managed-build-coordinator.js +10 -0
- package/dist/session/managed-build-receipt.d.ts +7 -0
- package/dist/session/managed-build-receipt.js +11 -3
- package/dist/session/managed-command-environment.d.ts +8 -0
- package/dist/session/managed-command-environment.js +28 -0
- package/dist/session/managed-command-host-load.d.ts +52 -0
- package/dist/session/managed-command-host-load.js +87 -0
- package/dist/session/mcp-argument-coercion.d.ts +23 -0
- package/dist/session/mcp-argument-coercion.js +121 -0
- package/dist/session/phase-completion.artifact-bundle.d.ts +20 -0
- package/dist/session/phase-completion.artifact-bundle.js +167 -0
- package/dist/session/phase-completion.artifacts.d.ts +9 -17
- package/dist/session/phase-completion.artifacts.js +158 -190
- package/dist/session/phase-completion.command-validation.d.ts +7 -0
- package/dist/session/phase-completion.command-validation.js +77 -0
- package/dist/session/phase-completion.d.ts +31 -2
- package/dist/session/phase-completion.helpers.js +18 -65
- package/dist/session/phase-completion.js +19 -32
- package/dist/session/phase-completion.mcp-args.d.ts +9 -0
- package/dist/session/phase-completion.mcp-args.js +195 -0
- package/dist/session/phase-completion.phase-aliases.d.ts +5 -0
- package/dist/session/phase-completion.phase-aliases.js +43 -0
- package/dist/session/phase-completion.pr-review-schema.d.ts +1 -0
- package/dist/session/phase-completion.pr-review-schema.js +75 -0
- package/dist/session/phase-completion.pr-review-validation.d.ts +11 -0
- package/dist/session/phase-completion.pr-review-validation.js +212 -0
- package/dist/session/phase-completion.pr-review.d.ts +36 -0
- package/dist/session/phase-completion.pr-review.js +294 -0
- package/dist/session/phase-completion.prompts.d.ts +1 -1
- package/dist/session/phase-completion.prompts.js +20 -1
- package/dist/session/phase-completion.runtime.d.ts +13 -12
- package/dist/session/phase-completion.runtime.js +113 -214
- package/dist/session/phase-completion.schema-parts.d.ts +19 -0
- package/dist/session/phase-completion.schema-parts.js +188 -0
- package/dist/session/phase-completion.schemas.d.ts +3 -3
- package/dist/session/phase-completion.schemas.js +219 -232
- package/dist/session/phase-completion.validation.d.ts +3 -3
- package/dist/session/phase-completion.validation.js +58 -94
- package/dist/session/pr-review-diff-base.d.ts +18 -0
- package/dist/session/pr-review-diff-base.js +44 -0
- package/dist/session/pr-review-placement.d.ts +50 -0
- package/dist/session/pr-review-placement.js +91 -0
- package/dist/session/pre-publication-change-set.d.ts +62 -0
- package/dist/session/pre-publication-change-set.js +166 -0
- package/dist/session/pre-publication-host-load.d.ts +27 -0
- package/dist/session/pre-publication-host-load.js +112 -0
- package/dist/session/pre-publication-native-postgres.d.ts +30 -0
- package/dist/session/pre-publication-native-postgres.js +111 -0
- package/dist/session/pre-publication-pass.d.ts +61 -0
- package/dist/session/pre-publication-pass.js +148 -0
- package/dist/session/pre-publication-process.d.ts +3 -0
- package/dist/session/pre-publication-process.js +32 -19
- package/dist/session/pre-publication-step-execution.d.ts +12 -0
- package/dist/session/pre-publication-step-execution.js +50 -0
- package/dist/session/pre-publication-validation.d.ts +39 -22
- package/dist/session/pre-publication-validation.js +241 -207
- package/dist/session/provider-cli/claude-background-work.d.ts +67 -0
- package/dist/session/provider-cli/claude-background-work.js +181 -0
- package/dist/session/provider-cli/dispatch-target-branch.d.ts +7 -0
- package/dist/session/provider-cli/dispatch-target-branch.js +8 -0
- package/dist/session/provider-cli/host-build-lock.d.ts +18 -0
- package/dist/session/provider-cli/host-build-lock.js +30 -0
- package/dist/session/provider-cli/pr-review-credential-isolation.d.ts +83 -0
- package/dist/session/provider-cli/pr-review-credential-isolation.js +144 -0
- package/dist/session/provider-cli/pr-review-guardrails.d.ts +70 -0
- package/dist/session/provider-cli/pr-review-guardrails.js +360 -0
- package/dist/session/provider-cli/pr-review-prompt.d.ts +2 -0
- package/dist/session/provider-cli/pr-review-prompt.js +119 -0
- package/dist/session/provider-cli/pre-publication-repair.d.ts +56 -0
- package/dist/session/provider-cli/pre-publication-repair.js +281 -0
- package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.child-environment.d.ts +7 -0
- package/dist/session/provider-cli/provider-cli.child-environment.js +75 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.d.ts +3 -0
- package/dist/session/provider-cli/provider-cli.codex-models-cache.js +37 -0
- package/dist/session/provider-cli/provider-cli.deterministic.d.ts +1 -0
- package/dist/session/provider-cli/provider-cli.deterministic.js +5 -0
- package/dist/session/provider-cli/provider-cli.merge-integrity.d.ts +6 -3
- package/dist/session/provider-cli/provider-cli.merge-integrity.js +29 -10
- package/dist/session/provider-cli/provider-cli.pr-review.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.pr-review.js +213 -0
- package/dist/session/provider-cli/provider-cli.process.d.ts +15 -36
- package/dist/session/provider-cli/provider-cli.process.js +41 -432
- package/dist/session/provider-cli/provider-cli.prompts.d.ts +15 -3
- package/dist/session/provider-cli/provider-cli.prompts.js +183 -90
- package/dist/session/provider-cli/provider-cli.reapply-conflicts.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.reapply-conflicts.js +37 -0
- package/dist/session/provider-cli/provider-cli.runtime.d.ts +15 -0
- package/dist/session/provider-cli/provider-cli.runtime.js +43 -1
- package/dist/session/provider-cli/provider-cli.service-support.d.ts +37 -0
- package/dist/session/provider-cli/provider-cli.service-support.js +146 -0
- package/dist/session/provider-cli/provider-cli.service.d.ts +18 -18
- package/dist/session/provider-cli/provider-cli.service.js +127 -317
- package/dist/session/provider-cli/provider-cli.types.d.ts +35 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.d.ts +10 -0
- package/dist/session/provider-cli/provider-cli.windows-environment.js +151 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.d.ts +23 -0
- package/dist/session/provider-cli/provider-cli.windows-launch.js +131 -0
- package/dist/session/provider-cli/provider-in-flight-work.d.ts +4 -0
- package/dist/session/provider-cli/provider-in-flight-work.js +45 -0
- package/dist/session/provider-cli/provider-output-pipes.d.ts +30 -0
- package/dist/session/provider-cli/provider-output-pipes.js +67 -0
- package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
- package/dist/session/provider-cli/provider-output-state.js +6 -0
- package/dist/session/provider-cli/provider-user-config-isolation.d.ts +69 -0
- package/dist/session/provider-cli/provider-user-config-isolation.js +164 -0
- package/dist/session/qa-sidecar-validation.d.ts +6 -0
- package/dist/session/qa-sidecar-validation.js +28 -0
- package/dist/session/sandbox-host-capacity-gate.d.ts +51 -0
- package/dist/session/sandbox-host-capacity-gate.js +279 -0
- package/dist/session/session-host-project.d.ts +22 -0
- package/dist/session/session-host-project.js +98 -0
- package/dist/session/session-redaction.js +31 -181
- package/dist/session/session.base.d.ts +9 -1
- package/dist/session/session.parse-helpers.d.ts +10 -0
- package/dist/session/session.parse-helpers.js +84 -0
- package/dist/session/session.runtime-refresh.d.ts +46 -0
- package/dist/session/session.runtime-refresh.js +116 -0
- package/dist/session/session.service.d.ts +16 -2
- package/dist/session/session.service.js +208 -155
- package/dist/session/session.types.d.ts +8 -0
- package/dist/session/session.types.js +13 -83
- package/dist/session/session.types.pr-review.d.ts +48 -0
- package/dist/session/session.types.pr-review.js +51 -0
- package/dist/session/sidecar-json-shape.d.ts +31 -0
- package/dist/session/sidecar-json-shape.js +217 -0
- package/dist/session/workspace-runtime-fingerprint.d.ts +32 -0
- package/dist/session/workspace-runtime-fingerprint.js +138 -0
- package/dist/shared/fs/file-identity.d.ts +10 -0
- package/dist/shared/fs/file-identity.js +15 -0
- package/dist/shared/fs/replace-file.d.ts +7 -0
- package/dist/shared/fs/replace-file.js +33 -0
- package/dist/shared/process/host-process-recovery.d.ts +14 -3
- package/dist/shared/process/host-process-recovery.js +23 -3
- package/dist/shared/process/host-process-supervisor.d.ts +14 -1
- package/dist/shared/process/host-process-supervisor.js +67 -15
- package/dist/shared/process/process-tree.d.ts +52 -0
- package/dist/shared/process/process-tree.js +144 -0
- package/dist/shared/process/process.d.ts +67 -0
- package/dist/shared/process/process.js +213 -11
- package/dist/shared/process/windows-app-execution-alias.d.ts +19 -0
- package/dist/shared/process/windows-app-execution-alias.js +45 -0
- package/dist/shared/process/windows-launch.d.ts +18 -0
- package/dist/shared/process/windows-launch.js +68 -0
- package/dist/shared/provider-capabilities.d.ts +2 -0
- package/dist/shared/provider-capabilities.js +23 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worktree/artifact-injector.js +24 -0
- package/dist/worktree/dependency-warmer.d.ts +25 -0
- package/dist/worktree/dependency-warmer.js +46 -10
- package/dist/worktree/orphan-relink.d.ts +19 -0
- package/dist/worktree/orphan-relink.js +106 -0
- package/dist/worktree/wip-git.d.ts +58 -0
- package/dist/worktree/wip-git.js +182 -0
- package/dist/worktree/wip-refs.d.ts +85 -0
- package/dist/worktree/wip-refs.js +169 -0
- package/dist/worktree/wip-restore.d.ts +51 -0
- package/dist/worktree/wip-restore.js +324 -0
- package/dist/worktree/wip-snapshot.d.ts +53 -0
- package/dist/worktree/wip-snapshot.js +270 -0
- package/dist/worktree/worktree-inputs.d.ts +8 -0
- package/dist/worktree/worktree-inputs.js +134 -0
- package/dist/worktree/worktree-origin-sync.d.ts +35 -0
- package/dist/worktree/worktree-origin-sync.js +128 -0
- package/dist/worktree/worktree-wip-events.d.ts +20 -0
- package/dist/worktree/worktree-wip-events.js +148 -0
- package/dist/worktree/worktree-wip.d.ts +57 -0
- package/dist/worktree/worktree-wip.js +200 -0
- package/dist/worktree/worktree.base.d.ts +7 -1
- package/dist/worktree/worktree.service.d.ts +58 -5
- package/dist/worktree/worktree.service.js +237 -161
- package/dist/worktree/worktree.types.d.ts +54 -0
- package/package.json +2 -2
- package/runtime/windows-listener-owner.ps1 +12 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { RepositoryCoordinatorLock } from "../../sandbox/repository-lock.js";
|
|
3
|
+
import { defaultWorktreeCoordinatorStateRoot } from "../../worktree/worktree-paths.js";
|
|
4
|
+
import { ForgeFailureError } from "../session.types.js";
|
|
5
|
+
import { isTransientCodexProviderNotFoundFailure } from "./provider-cli.process.js";
|
|
6
|
+
import { clipTail } from "./provider-output-state.js";
|
|
7
|
+
// Collaborators shared by the provider CLI service and its review-only runner: failure
|
|
8
|
+
// classification, the tool-activity heartbeat and the default coordinator.
|
|
9
|
+
/** The repository coordinator a provider CLI service publishes through when none is injected. */
|
|
10
|
+
export function defaultPublicationCoordinator() {
|
|
11
|
+
return new RepositoryCoordinatorLock(defaultWorktreeCoordinatorStateRoot());
|
|
12
|
+
}
|
|
13
|
+
export function providerCliExitFailure(command, result) {
|
|
14
|
+
const output = [result.stderr.trim(), result.stdout.trim()]
|
|
15
|
+
.filter(value => value.length > 0)
|
|
16
|
+
.join("\n");
|
|
17
|
+
const detail = clipTail(output, 1200);
|
|
18
|
+
const suffix = detail ? `: ${detail}` : "";
|
|
19
|
+
if (isProviderConfigurationFailure(command, result)) {
|
|
20
|
+
return new ForgeFailureError("provider_configuration_invalid", `${command} rejected its model configuration; correct the configuration before retrying${suffix}`, "provider");
|
|
21
|
+
}
|
|
22
|
+
if (isTransientCodexProviderNotFoundFailure(command, result)) {
|
|
23
|
+
return new ForgeFailureError("provider_request_not_found", `${command} received a transient not-found response from its provider service${suffix}`, "provider");
|
|
24
|
+
}
|
|
25
|
+
if (isProviderCapacityFailure(result)) {
|
|
26
|
+
return new ForgeFailureError("provider_capacity_unavailable", `${command} was deferred because the selected provider model is temporarily at capacity${suffix}`, "provider");
|
|
27
|
+
}
|
|
28
|
+
if (isProviderContextWindowExhausted(command, result)) {
|
|
29
|
+
return new ForgeFailureError("provider_context_window_exhausted", `${command} exhausted the provider context window and must continue in a fresh session${suffix}`, "provider");
|
|
30
|
+
}
|
|
31
|
+
return new Error(`${command} exited ${result.exitCode}${suffix}`);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Capacity is trusted only when a nonzero provider process writes one of the
|
|
35
|
+
* narrow service-level messages to stderr. Stdout can contain arbitrary agent
|
|
36
|
+
* command output and account usage-limit messages remain ordinary failures.
|
|
37
|
+
*/
|
|
38
|
+
export function isProviderCapacityFailure(result) {
|
|
39
|
+
if (result.exitCode === 0)
|
|
40
|
+
return false;
|
|
41
|
+
const capacityMessages = new Set([
|
|
42
|
+
"the selected model is at capacity. please try again later.",
|
|
43
|
+
"the selected model is currently at capacity. please try again later.",
|
|
44
|
+
"the model is currently overloaded. please try again later.",
|
|
45
|
+
"the provider is currently overloaded. please try again later.",
|
|
46
|
+
]);
|
|
47
|
+
return result.stderr
|
|
48
|
+
.split(/\r?\n/u)
|
|
49
|
+
.map(line => line.trim().toLowerCase().replace(/^error:\s*/u, ""))
|
|
50
|
+
.some(line => capacityMessages.has(line));
|
|
51
|
+
}
|
|
52
|
+
/** Only a nonzero Codex service diagnostic can classify a configuration rejection.
|
|
53
|
+
* JSONL turn.failed is a provider envelope; item/tool output is not retry authority. */
|
|
54
|
+
export function isProviderConfigurationFailure(command, result) {
|
|
55
|
+
const names = [path.posix.parse(command).name, path.win32.parse(command).name];
|
|
56
|
+
if (result.exitCode === 0 || !names.some(name => name.toLowerCase() === "codex"))
|
|
57
|
+
return false;
|
|
58
|
+
const reasoningRejected = /Unsupported value: '[^'\r\n]+' is not supported with the '[^'\r\n]+' model\./u.test(result.stderr)
|
|
59
|
+
&& result.stderr.includes("reasoning.effort")
|
|
60
|
+
&& result.stderr.includes("invalid_request_error")
|
|
61
|
+
&& result.stderr.includes("unsupported_value");
|
|
62
|
+
if (reasoningRejected)
|
|
63
|
+
return true;
|
|
64
|
+
return [result.stderr, result.stdout].some(output => output.split(/\r?\n/u).some(line => {
|
|
65
|
+
try {
|
|
66
|
+
const event = JSON.parse(line);
|
|
67
|
+
if (event.type !== "turn.failed")
|
|
68
|
+
return false;
|
|
69
|
+
const error = event.error;
|
|
70
|
+
if (typeof error?.message !== "string")
|
|
71
|
+
return false;
|
|
72
|
+
const service = JSON.parse(error.message);
|
|
73
|
+
return service.type === "error" && service.status === 400
|
|
74
|
+
&& service.error?.type === "invalid_request_error"
|
|
75
|
+
&& typeof service.error.message === "string"
|
|
76
|
+
&& /^The '[^'\r\n]+' model is not supported when using Codex with a ChatGPT account\.$/u.test(service.error.message);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A context limit is trusted only at the provider process boundary. The exact
|
|
85
|
+
* Codex message can be embedded in its JSONL stderr envelope, so substring
|
|
86
|
+
* matching is intentional but remains narrow and stderr-only.
|
|
87
|
+
*/
|
|
88
|
+
export function isProviderContextWindowExhausted(command, result) {
|
|
89
|
+
const executableNames = [path.posix.parse(command).name, path.win32.parse(command).name]
|
|
90
|
+
.map(name => name.toLowerCase());
|
|
91
|
+
if (result.exitCode === 0 || !executableNames.includes("codex"))
|
|
92
|
+
return false;
|
|
93
|
+
return result.stderr.toLowerCase().includes("codex ran out of room in the model's context window");
|
|
94
|
+
}
|
|
95
|
+
export class ProviderToolActivityHeartbeat {
|
|
96
|
+
outputState;
|
|
97
|
+
emit;
|
|
98
|
+
intervalMs;
|
|
99
|
+
timer = null;
|
|
100
|
+
/** Lets the provider runner hold its end-of-turn timers while a tool call is in flight. */
|
|
101
|
+
isToolCallInFlight = () => this.outputState.hasActiveToolCall;
|
|
102
|
+
/** Forgets tool calls a previous generation left open; called before every relaunch. */
|
|
103
|
+
startGeneration = () => this.outputState.resetActiveToolCalls();
|
|
104
|
+
constructor(outputState, emit, intervalMs) {
|
|
105
|
+
this.outputState = outputState;
|
|
106
|
+
this.emit = emit;
|
|
107
|
+
this.intervalMs = intervalMs;
|
|
108
|
+
// Each heartbeat watches one provider generation. Calls an earlier generation left
|
|
109
|
+
// open died with it; inheriting them would hold the new generation's timers forever.
|
|
110
|
+
this.outputState.resetActiveToolCalls();
|
|
111
|
+
}
|
|
112
|
+
async consume(line) {
|
|
113
|
+
const events = this.outputState.consume(line);
|
|
114
|
+
this.sync();
|
|
115
|
+
for (const event of events) {
|
|
116
|
+
await this.emit(event);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
stop() {
|
|
120
|
+
if (this.timer) {
|
|
121
|
+
clearInterval(this.timer);
|
|
122
|
+
this.timer = null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
sync() {
|
|
126
|
+
if (!this.outputState.hasActiveToolCall) {
|
|
127
|
+
this.stop();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (this.timer) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this.timer = setInterval(() => {
|
|
134
|
+
if (!this.outputState.hasActiveToolCall) {
|
|
135
|
+
this.stop();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
void this.emit({
|
|
139
|
+
role: "runner",
|
|
140
|
+
kind: "status",
|
|
141
|
+
content: "A supervised provider tool is still running.",
|
|
142
|
+
eventType: "provider_tool_heartbeat",
|
|
143
|
+
}).catch(() => undefined);
|
|
144
|
+
}, Math.max(1, this.intervalMs));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
import { GitClient } from "../../shared/git/git.js";
|
|
2
|
-
import type { WorktreeLifecycleCoordinator } from "../../worktree/worktree.base.js";
|
|
3
2
|
import { type RunnerDispatchEvent } from "../session.types.js";
|
|
4
3
|
import type { ProviderCliService } from "./provider-cli.base.js";
|
|
5
4
|
import type { ProviderCliDraftContext, ProviderCliRunContext, ProviderCliRunResult } from "./provider-cli.types.js";
|
|
6
|
-
import { type ProviderProcessRunner
|
|
5
|
+
import { type ProviderProcessRunner } from "./provider-cli.process.js";
|
|
6
|
+
import { type WorktreeLifecycleCoordinator } from "./provider-cli.service-support.js";
|
|
7
7
|
import { PrePublicationValidator } from "../pre-publication-validation.js";
|
|
8
8
|
export { parseClaudeMcpToolName } from "./provider-output-state.js";
|
|
9
9
|
export { DeterministicProviderCliService } from "./provider-cli.deterministic.js";
|
|
10
10
|
export { buildProviderCliCommand, codexSandboxModeForPlatform, formatProviderCliCommand, formatProviderCliCommandForCheckpoint } from "./provider-cli.prompts.js";
|
|
11
11
|
export { buildProviderChildEnvironment, chooseWindowsCommandCandidate, resolveCodexNpmDirectLaunch, resolveClaudeNpmDirectLaunch, resolvePackageManagerDirectLaunch, resolveWindowsCommandFromPath, PROVIDER_OUTPUT_CAPTURE_LIMIT_CHARS, CodexModelsCacheRecoveringProcessRunner, CodexResumeRecoveringProcessRunner, isTransientCodexProviderNotFoundFailure, StreamingProviderProcessRunner } from "./provider-cli.process.js";
|
|
12
|
+
export { isProviderCapacityFailure, isProviderConfigurationFailure, isProviderContextWindowExhausted } from "./provider-cli.service-support.js";
|
|
12
13
|
export { buildWindowsLaunchCommand } from "../../shared/process/windows-launch.js";
|
|
13
14
|
export type { ProviderCliCommand, ProviderProcessRunner, ProviderProcessRunRequest, ProviderProcessRunResult } from "./provider-cli.process.js";
|
|
14
|
-
/**
|
|
15
|
-
* Capacity is trusted only when a nonzero provider process writes one of the
|
|
16
|
-
* narrow service-level messages to stderr. Stdout can contain arbitrary agent
|
|
17
|
-
* command output and account usage-limit messages remain ordinary failures.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isProviderCapacityFailure(result: ProviderProcessRunResult): boolean;
|
|
20
|
-
/** Only a nonzero Codex service diagnostic can classify a configuration rejection.
|
|
21
|
-
* JSONL turn.failed is a provider envelope; item/tool output is not retry authority. */
|
|
22
|
-
export declare function isProviderConfigurationFailure(command: string, result: ProviderProcessRunResult): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* A context limit is trusted only at the provider process boundary. The exact
|
|
25
|
-
* Codex message can be embedded in its JSONL stderr envelope, so substring
|
|
26
|
-
* matching is intentional but remains narrow and stderr-only.
|
|
27
|
-
*/
|
|
28
|
-
export declare function isProviderContextWindowExhausted(command: string, result: ProviderProcessRunResult): boolean;
|
|
29
15
|
export declare class ManagedVerificationProgressEmitter {
|
|
30
16
|
private readonly logDirectory;
|
|
31
17
|
private readonly emit;
|
|
@@ -47,6 +33,7 @@ export declare class RoutingProviderCliService implements ProviderCliService {
|
|
|
47
33
|
runArchitect(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
48
34
|
runCiRepair(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
49
35
|
runConflictResolve(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
36
|
+
runPrReview(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
50
37
|
runQa(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
51
38
|
runDraft(context: ProviderCliDraftContext): Promise<ProviderCliRunResult>;
|
|
52
39
|
}
|
|
@@ -56,7 +43,8 @@ export declare class ProcessBackedProviderCliService implements ProviderCliServi
|
|
|
56
43
|
private readonly providerToolHeartbeatIntervalMs;
|
|
57
44
|
private readonly publicationCoordinator;
|
|
58
45
|
private readonly prePublicationValidator;
|
|
59
|
-
|
|
46
|
+
private readonly prePublicationRepairTurns;
|
|
47
|
+
constructor(processRunner?: ProviderProcessRunner, git?: GitClient, providerToolHeartbeatIntervalMs?: number, publicationCoordinator?: WorktreeLifecycleCoordinator, prePublicationValidator?: PrePublicationValidator, prePublicationRepairTurns?: number);
|
|
60
48
|
runDraft(context: ProviderCliDraftContext): Promise<ProviderCliRunResult>;
|
|
61
49
|
runImplementation(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
62
50
|
runArchitect(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
@@ -64,7 +52,19 @@ export declare class ProcessBackedProviderCliService implements ProviderCliServi
|
|
|
64
52
|
runCiRepair(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
65
53
|
runConflictResolve(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
66
54
|
private runPullRequestRepair;
|
|
55
|
+
/**
|
|
56
|
+
* Review-only session for a pull request head. Never routed through implementation: the worktree
|
|
57
|
+
* is detached at the dispatched head, the provider cannot change or publish anything, and the
|
|
58
|
+
* review is handed to Forge only through the completion tool. No commit, push or GitHub call
|
|
59
|
+
* is made here; a worktree that differs after the session fails with `guardrail_violation`.
|
|
60
|
+
*/
|
|
61
|
+
runPrReview(context: ProviderCliRunContext): Promise<ProviderCliRunResult>;
|
|
67
62
|
private recoverMissingQaCompletion;
|
|
68
63
|
private recoverMissingCommentRepairCompletion;
|
|
69
64
|
private validatePrePublicationWithRecovery;
|
|
65
|
+
/**
|
|
66
|
+
* Resumes the provider thread for one in-place repair turn; the turn must leave HEAD where it was.
|
|
67
|
+
* The turn launches with its own Forge MCP server (prepareRepairTurnLaunch), removed when it exits.
|
|
68
|
+
*/
|
|
69
|
+
private runPrePublicationRepairTurn;
|
|
70
70
|
}
|