looply-cli 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -3
- package/dist/.src-hash +1 -0
- package/dist/acceptance-observe.d.ts +108 -0
- package/dist/acceptance-observe.d.ts.map +1 -0
- package/dist/acceptance-observe.js +152 -0
- package/dist/acceptance-observe.js.map +1 -0
- package/dist/agent-cmd.d.ts +131 -0
- package/dist/agent-cmd.d.ts.map +1 -0
- package/dist/agent-cmd.js +154 -0
- package/dist/agent-cmd.js.map +1 -0
- package/dist/agent-contained.d.ts +114 -0
- package/dist/agent-contained.d.ts.map +1 -0
- package/dist/agent-contained.js +292 -0
- package/dist/agent-contained.js.map +1 -0
- package/dist/agent-driver.d.ts +130 -0
- package/dist/agent-driver.d.ts.map +1 -0
- package/dist/agent-driver.js +170 -0
- package/dist/agent-driver.js.map +1 -0
- package/dist/agent-envelope.d.ts +94 -0
- package/dist/agent-envelope.d.ts.map +1 -0
- package/dist/agent-envelope.js +214 -0
- package/dist/agent-envelope.js.map +1 -0
- package/dist/agent-exec.d.ts +182 -0
- package/dist/agent-exec.d.ts.map +1 -0
- package/dist/agent-exec.js +125 -0
- package/dist/agent-exec.js.map +1 -0
- package/dist/agent-runtime.d.ts +23 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +143 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/approval-gate-read.d.ts +66 -0
- package/dist/approval-gate-read.d.ts.map +1 -0
- package/dist/approval-gate-read.js +138 -0
- package/dist/approval-gate-read.js.map +1 -0
- package/dist/approval-resolution.d.ts +87 -0
- package/dist/approval-resolution.d.ts.map +1 -0
- package/dist/approval-resolution.js +100 -0
- package/dist/approval-resolution.js.map +1 -0
- package/dist/approval-resumes.d.ts +102 -0
- package/dist/approval-resumes.d.ts.map +1 -0
- package/dist/approval-resumes.js +167 -0
- package/dist/approval-resumes.js.map +1 -0
- package/dist/ask-brain.d.ts +167 -0
- package/dist/ask-brain.d.ts.map +1 -0
- package/dist/ask-brain.js +355 -0
- package/dist/ask-brain.js.map +1 -0
- package/dist/autonomy-authority.d.ts +80 -0
- package/dist/autonomy-authority.d.ts.map +1 -0
- package/dist/autonomy-authority.js +82 -0
- package/dist/autonomy-authority.js.map +1 -0
- package/dist/autonomy-controller.d.ts +321 -0
- package/dist/autonomy-controller.d.ts.map +1 -0
- package/dist/autonomy-controller.js +517 -0
- package/dist/autonomy-controller.js.map +1 -0
- package/dist/autonomy-store.d.ts +327 -0
- package/dist/autonomy-store.d.ts.map +1 -0
- package/dist/autonomy-store.js +581 -0
- package/dist/autonomy-store.js.map +1 -0
- package/dist/autonomy-tick.d.ts +257 -0
- package/dist/autonomy-tick.d.ts.map +1 -0
- package/dist/autonomy-tick.js +616 -0
- package/dist/autonomy-tick.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +2727 -0
- package/dist/bin.js.map +1 -0
- package/dist/brain-advice.d.ts +21 -0
- package/dist/brain-advice.d.ts.map +1 -0
- package/dist/brain-advice.js +51 -0
- package/dist/brain-advice.js.map +1 -0
- package/dist/candidate-replay-runtime.d.ts +125 -0
- package/dist/candidate-replay-runtime.d.ts.map +1 -0
- package/dist/candidate-replay-runtime.js +188 -0
- package/dist/candidate-replay-runtime.js.map +1 -0
- package/dist/checkout-carry.d.ts +76 -0
- package/dist/checkout-carry.d.ts.map +1 -0
- package/dist/checkout-carry.js +125 -0
- package/dist/checkout-carry.js.map +1 -0
- package/dist/citation-readers.d.ts +26 -0
- package/dist/citation-readers.d.ts.map +1 -0
- package/dist/citation-readers.js +102 -0
- package/dist/citation-readers.js.map +1 -0
- package/dist/command-receipts.d.ts +79 -0
- package/dist/command-receipts.d.ts.map +1 -0
- package/dist/command-receipts.js +143 -0
- package/dist/command-receipts.js.map +1 -0
- package/dist/command-runner.d.ts +32 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +108 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/compatible-sets.d.ts +67 -0
- package/dist/compatible-sets.d.ts.map +1 -0
- package/dist/compatible-sets.js +81 -0
- package/dist/compatible-sets.js.map +1 -0
- package/dist/compile-check.d.ts +31 -0
- package/dist/compile-check.d.ts.map +1 -0
- package/dist/compile-check.js +34 -0
- package/dist/compile-check.js.map +1 -0
- package/dist/compile-store.d.ts +16 -0
- package/dist/compile-store.d.ts.map +1 -0
- package/dist/compile-store.js +21 -0
- package/dist/compile-store.js.map +1 -0
- package/dist/completion.d.ts +106 -0
- package/dist/completion.d.ts.map +1 -0
- package/dist/completion.js +131 -0
- package/dist/completion.js.map +1 -0
- package/dist/config.d.ts +549 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +763 -0
- package/dist/config.js.map +1 -0
- package/dist/control-file.d.ts +142 -0
- package/dist/control-file.d.ts.map +1 -0
- package/dist/control-file.js +144 -0
- package/dist/control-file.js.map +1 -0
- package/dist/coordinator-state.d.ts +131 -0
- package/dist/coordinator-state.d.ts.map +1 -0
- package/dist/coordinator-state.js +380 -0
- package/dist/coordinator-state.js.map +1 -0
- package/dist/coordinator.d.ts +95 -0
- package/dist/coordinator.d.ts.map +1 -0
- package/dist/coordinator.js +97 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/cursor-store.d.ts +53 -0
- package/dist/cursor-store.d.ts.map +1 -0
- package/dist/cursor-store.js +98 -0
- package/dist/cursor-store.js.map +1 -0
- package/dist/daemon-cmd.d.ts +239 -0
- package/dist/daemon-cmd.d.ts.map +1 -0
- package/dist/daemon-cmd.js +1751 -0
- package/dist/daemon-cmd.js.map +1 -0
- package/dist/daemon-lock.d.ts +140 -0
- package/dist/daemon-lock.d.ts.map +1 -0
- package/dist/daemon-lock.js +352 -0
- package/dist/daemon-lock.js.map +1 -0
- package/dist/daemon-recovery.d.ts +78 -0
- package/dist/daemon-recovery.d.ts.map +1 -0
- package/dist/daemon-recovery.js +161 -0
- package/dist/daemon-recovery.js.map +1 -0
- package/dist/daemon.d.ts +368 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +601 -0
- package/dist/daemon.js.map +1 -0
- package/dist/declared-response-shape.d.ts +93 -0
- package/dist/declared-response-shape.d.ts.map +1 -0
- package/dist/declared-response-shape.js +200 -0
- package/dist/declared-response-shape.js.map +1 -0
- package/dist/declared-surfaces.d.ts +16 -0
- package/dist/declared-surfaces.d.ts.map +1 -0
- package/dist/declared-surfaces.js +19 -0
- package/dist/declared-surfaces.js.map +1 -0
- package/dist/depends-review.d.ts +113 -0
- package/dist/depends-review.d.ts.map +1 -0
- package/dist/depends-review.js +110 -0
- package/dist/depends-review.js.map +1 -0
- package/dist/doctor.d.ts +91 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +71 -0
- package/dist/doctor.js.map +1 -0
- package/dist/edge-approval.d.ts +105 -0
- package/dist/edge-approval.d.ts.map +1 -0
- package/dist/edge-approval.js +100 -0
- package/dist/edge-approval.js.map +1 -0
- package/dist/evidence-cache.d.ts +45 -0
- package/dist/evidence-cache.d.ts.map +1 -0
- package/dist/evidence-cache.js +90 -0
- package/dist/evidence-cache.js.map +1 -0
- package/dist/evidence-cmd.d.ts +133 -0
- package/dist/evidence-cmd.d.ts.map +1 -0
- package/dist/evidence-cmd.js +347 -0
- package/dist/evidence-cmd.js.map +1 -0
- package/dist/evidence-facts.d.ts +40 -0
- package/dist/evidence-facts.d.ts.map +1 -0
- package/dist/evidence-facts.js +114 -0
- package/dist/evidence-facts.js.map +1 -0
- package/dist/exclusive-lock.d.ts +52 -0
- package/dist/exclusive-lock.d.ts.map +1 -0
- package/dist/exclusive-lock.js +150 -0
- package/dist/exclusive-lock.js.map +1 -0
- package/dist/exec-domains.d.ts +140 -0
- package/dist/exec-domains.d.ts.map +1 -0
- package/dist/exec-domains.js +287 -0
- package/dist/exec-domains.js.map +1 -0
- package/dist/exemption-store.d.ts +197 -0
- package/dist/exemption-store.d.ts.map +1 -0
- package/dist/exemption-store.js +266 -0
- package/dist/exemption-store.js.map +1 -0
- package/dist/explicit-start-gate.d.ts +96 -0
- package/dist/explicit-start-gate.d.ts.map +1 -0
- package/dist/explicit-start-gate.js +103 -0
- package/dist/explicit-start-gate.js.map +1 -0
- package/dist/fs-trouble.d.ts +70 -0
- package/dist/fs-trouble.d.ts.map +1 -0
- package/dist/fs-trouble.js +98 -0
- package/dist/fs-trouble.js.map +1 -0
- package/dist/gate.d.ts +278 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +278 -0
- package/dist/gate.js.map +1 -0
- package/dist/git-driver.d.ts +519 -0
- package/dist/git-driver.d.ts.map +1 -0
- package/dist/git-driver.js +900 -0
- package/dist/git-driver.js.map +1 -0
- package/dist/git-push-executor.d.ts +41 -0
- package/dist/git-push-executor.d.ts.map +1 -0
- package/dist/git-push-executor.js +142 -0
- package/dist/git-push-executor.js.map +1 -0
- package/dist/glob.d.ts +26 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +93 -0
- package/dist/glob.js.map +1 -0
- package/dist/goal-adaptive.d.ts +295 -0
- package/dist/goal-adaptive.d.ts.map +1 -0
- package/dist/goal-adaptive.js +393 -0
- package/dist/goal-adaptive.js.map +1 -0
- package/dist/goal-compile.d.ts +342 -0
- package/dist/goal-compile.d.ts.map +1 -0
- package/dist/goal-compile.js +444 -0
- package/dist/goal-compile.js.map +1 -0
- package/dist/goal-depends-executor.d.ts +55 -0
- package/dist/goal-depends-executor.d.ts.map +1 -0
- package/dist/goal-depends-executor.js +202 -0
- package/dist/goal-depends-executor.js.map +1 -0
- package/dist/goal-execution-evidence.d.ts +135 -0
- package/dist/goal-execution-evidence.d.ts.map +1 -0
- package/dist/goal-execution-evidence.js +159 -0
- package/dist/goal-execution-evidence.js.map +1 -0
- package/dist/goal-gap.d.ts +140 -0
- package/dist/goal-gap.d.ts.map +1 -0
- package/dist/goal-gap.js +197 -0
- package/dist/goal-gap.js.map +1 -0
- package/dist/goal-met-target.d.ts +98 -0
- package/dist/goal-met-target.d.ts.map +1 -0
- package/dist/goal-met-target.js +92 -0
- package/dist/goal-met-target.js.map +1 -0
- package/dist/goal-ownership.d.ts +416 -0
- package/dist/goal-ownership.d.ts.map +1 -0
- package/dist/goal-ownership.js +576 -0
- package/dist/goal-ownership.js.map +1 -0
- package/dist/goal-runs.d.ts +82 -0
- package/dist/goal-runs.d.ts.map +1 -0
- package/dist/goal-runs.js +120 -0
- package/dist/goal-runs.js.map +1 -0
- package/dist/goal-store.d.ts +146 -0
- package/dist/goal-store.d.ts.map +1 -0
- package/dist/goal-store.js +294 -0
- package/dist/goal-store.js.map +1 -0
- package/dist/goal-view.d.ts +156 -0
- package/dist/goal-view.d.ts.map +1 -0
- package/dist/goal-view.js +499 -0
- package/dist/goal-view.js.map +1 -0
- package/dist/governed-approvals.d.ts +152 -0
- package/dist/governed-approvals.d.ts.map +1 -0
- package/dist/governed-approvals.js +246 -0
- package/dist/governed-approvals.js.map +1 -0
- package/dist/governed-broker.d.ts +169 -0
- package/dist/governed-broker.d.ts.map +1 -0
- package/dist/governed-broker.js +196 -0
- package/dist/governed-broker.js.map +1 -0
- package/dist/governed-run.d.ts +220 -0
- package/dist/governed-run.d.ts.map +1 -0
- package/dist/governed-run.js +406 -0
- package/dist/governed-run.js.map +1 -0
- package/dist/grant-reconcile.d.ts +63 -0
- package/dist/grant-reconcile.d.ts.map +1 -0
- package/dist/grant-reconcile.js +121 -0
- package/dist/grant-reconcile.js.map +1 -0
- package/dist/index-for-head.d.ts +56 -0
- package/dist/index-for-head.d.ts.map +1 -0
- package/dist/index-for-head.js +103 -0
- package/dist/index-for-head.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/init-detect.d.ts +39 -0
- package/dist/init-detect.d.ts.map +1 -0
- package/dist/init-detect.js +188 -0
- package/dist/init-detect.js.map +1 -0
- package/dist/integration-deps.d.ts +62 -0
- package/dist/integration-deps.d.ts.map +1 -0
- package/dist/integration-deps.js +251 -0
- package/dist/integration-deps.js.map +1 -0
- package/dist/integration-runtime.d.ts +458 -0
- package/dist/integration-runtime.d.ts.map +1 -0
- package/dist/integration-runtime.js +681 -0
- package/dist/integration-runtime.js.map +1 -0
- package/dist/integration.d.ts +45 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +87 -0
- package/dist/integration.js.map +1 -0
- package/dist/integrator.d.ts +84 -0
- package/dist/integrator.d.ts.map +1 -0
- package/dist/integrator.js +193 -0
- package/dist/integrator.js.map +1 -0
- package/dist/lane-claims.d.ts +174 -0
- package/dist/lane-claims.d.ts.map +1 -0
- package/dist/lane-claims.js +218 -0
- package/dist/lane-claims.js.map +1 -0
- package/dist/lane-coverage.d.ts +87 -0
- package/dist/lane-coverage.d.ts.map +1 -0
- package/dist/lane-coverage.js +129 -0
- package/dist/lane-coverage.js.map +1 -0
- package/dist/ledger-replay.d.ts +115 -0
- package/dist/ledger-replay.d.ts.map +1 -0
- package/dist/ledger-replay.js +155 -0
- package/dist/ledger-replay.js.map +1 -0
- package/dist/ledger-store.d.ts +68 -0
- package/dist/ledger-store.d.ts.map +1 -0
- package/dist/ledger-store.js +111 -0
- package/dist/ledger-store.js.map +1 -0
- package/dist/loop-safety-observer.d.ts +132 -0
- package/dist/loop-safety-observer.d.ts.map +1 -0
- package/dist/loop-safety-observer.js +76 -0
- package/dist/loop-safety-observer.js.map +1 -0
- package/dist/loop-safety-store.d.ts +339 -0
- package/dist/loop-safety-store.d.ts.map +1 -0
- package/dist/loop-safety-store.js +800 -0
- package/dist/loop-safety-store.js.map +1 -0
- package/dist/machine-store.d.ts +54 -0
- package/dist/machine-store.d.ts.map +1 -0
- package/dist/machine-store.js +149 -0
- package/dist/machine-store.js.map +1 -0
- package/dist/mcp-main.d.ts +2 -0
- package/dist/mcp-main.d.ts.map +1 -0
- package/dist/mcp-main.js +116 -0
- package/dist/mcp-main.js.map +1 -0
- package/dist/mcp-server.d.ts +72 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +259 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/model-routing.d.ts +75 -0
- package/dist/model-routing.d.ts.map +1 -0
- package/dist/model-routing.js +108 -0
- package/dist/model-routing.js.map +1 -0
- package/dist/model-transport.d.ts +188 -0
- package/dist/model-transport.d.ts.map +1 -0
- package/dist/model-transport.js +625 -0
- package/dist/model-transport.js.map +1 -0
- package/dist/notify-cadence.d.ts +55 -0
- package/dist/notify-cadence.d.ts.map +1 -0
- package/dist/notify-cadence.js +68 -0
- package/dist/notify-cadence.js.map +1 -0
- package/dist/notify-channel.d.ts +69 -0
- package/dist/notify-channel.d.ts.map +1 -0
- package/dist/notify-channel.js +151 -0
- package/dist/notify-channel.js.map +1 -0
- package/dist/notify.d.ts +71 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +125 -0
- package/dist/notify.js.map +1 -0
- package/dist/observation-inventory.d.ts +65 -0
- package/dist/observation-inventory.d.ts.map +1 -0
- package/dist/observation-inventory.js +139 -0
- package/dist/observation-inventory.js.map +1 -0
- package/dist/owned-children.d.ts +45 -0
- package/dist/owned-children.d.ts.map +1 -0
- package/dist/owned-children.js +64 -0
- package/dist/owned-children.js.map +1 -0
- package/dist/packet-for-goal.d.ts +19 -0
- package/dist/packet-for-goal.d.ts.map +1 -0
- package/dist/packet-for-goal.js +32 -0
- package/dist/packet-for-goal.js.map +1 -0
- package/dist/pair-cmd.d.ts +85 -0
- package/dist/pair-cmd.d.ts.map +1 -0
- package/dist/pair-cmd.js +205 -0
- package/dist/pair-cmd.js.map +1 -0
- package/dist/partial-asker.d.ts +96 -0
- package/dist/partial-asker.d.ts.map +1 -0
- package/dist/partial-asker.js +117 -0
- package/dist/partial-asker.js.map +1 -0
- package/dist/pdf-text-lines.d.ts +17 -0
- package/dist/pdf-text-lines.d.ts.map +1 -0
- package/dist/pdf-text-lines.js +70 -0
- package/dist/pdf-text-lines.js.map +1 -0
- package/dist/pdf-text-worker.d.ts +2 -0
- package/dist/pdf-text-worker.d.ts.map +1 -0
- package/dist/pdf-text-worker.js +81 -0
- package/dist/pdf-text-worker.js.map +1 -0
- package/dist/pdf-text.d.ts +56 -0
- package/dist/pdf-text.d.ts.map +1 -0
- package/dist/pdf-text.js +64 -0
- package/dist/pdf-text.js.map +1 -0
- package/dist/pending-action.d.ts +154 -0
- package/dist/pending-action.d.ts.map +1 -0
- package/dist/pending-action.js +148 -0
- package/dist/pending-action.js.map +1 -0
- package/dist/preemptor.d.ts +40 -0
- package/dist/preemptor.d.ts.map +1 -0
- package/dist/preemptor.js +49 -0
- package/dist/preemptor.js.map +1 -0
- package/dist/programme-mode.d.ts +29 -0
- package/dist/programme-mode.d.ts.map +1 -0
- package/dist/programme-mode.js +50 -0
- package/dist/programme-mode.js.map +1 -0
- package/dist/progress-view.d.ts +14 -0
- package/dist/progress-view.d.ts.map +1 -0
- package/dist/progress-view.js +114 -0
- package/dist/progress-view.js.map +1 -0
- package/dist/project-graph-builder.d.ts +81 -0
- package/dist/project-graph-builder.d.ts.map +1 -0
- package/dist/project-graph-builder.js +246 -0
- package/dist/project-graph-builder.js.map +1 -0
- package/dist/project-graph-runtime.d.ts +86 -0
- package/dist/project-graph-runtime.d.ts.map +1 -0
- package/dist/project-graph-runtime.js +112 -0
- package/dist/project-graph-runtime.js.map +1 -0
- package/dist/project-index-builder.d.ts +96 -0
- package/dist/project-index-builder.d.ts.map +1 -0
- package/dist/project-index-builder.js +298 -0
- package/dist/project-index-builder.js.map +1 -0
- package/dist/project-index-facts.d.ts +51 -0
- package/dist/project-index-facts.d.ts.map +1 -0
- package/dist/project-index-facts.js +117 -0
- package/dist/project-index-facts.js.map +1 -0
- package/dist/project-index-store.d.ts +97 -0
- package/dist/project-index-store.d.ts.map +1 -0
- package/dist/project-index-store.js +140 -0
- package/dist/project-index-store.js.map +1 -0
- package/dist/project-memory-store.d.ts +127 -0
- package/dist/project-memory-store.d.ts.map +1 -0
- package/dist/project-memory-store.js +302 -0
- package/dist/project-memory-store.js.map +1 -0
- package/dist/proposal-store.d.ts +14 -0
- package/dist/proposal-store.d.ts.map +1 -0
- package/dist/proposal-store.js +19 -0
- package/dist/proposal-store.js.map +1 -0
- package/dist/prover.d.ts +80 -0
- package/dist/prover.d.ts.map +1 -0
- package/dist/prover.js +137 -0
- package/dist/prover.js.map +1 -0
- package/dist/provider-identity-store.d.ts +34 -0
- package/dist/provider-identity-store.d.ts.map +1 -0
- package/dist/provider-identity-store.js +72 -0
- package/dist/provider-identity-store.js.map +1 -0
- package/dist/provider-identity.d.ts +104 -0
- package/dist/provider-identity.d.ts.map +1 -0
- package/dist/provider-identity.js +167 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/provider-limit.d.ts +79 -0
- package/dist/provider-limit.d.ts.map +1 -0
- package/dist/provider-limit.js +148 -0
- package/dist/provider-limit.js.map +1 -0
- package/dist/provider-preflight.d.ts +171 -0
- package/dist/provider-preflight.d.ts.map +1 -0
- package/dist/provider-preflight.js +395 -0
- package/dist/provider-preflight.js.map +1 -0
- package/dist/provider-state.d.ts +120 -0
- package/dist/provider-state.d.ts.map +1 -0
- package/dist/provider-state.js +182 -0
- package/dist/provider-state.js.map +1 -0
- package/dist/providers.d.ts +132 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +161 -0
- package/dist/providers.js.map +1 -0
- package/dist/publication-recorder.d.ts +117 -0
- package/dist/publication-recorder.d.ts.map +1 -0
- package/dist/publication-recorder.js +124 -0
- package/dist/publication-recorder.js.map +1 -0
- package/dist/pursuit-delivery.d.ts +24 -0
- package/dist/pursuit-delivery.d.ts.map +1 -0
- package/dist/pursuit-delivery.js +38 -0
- package/dist/pursuit-delivery.js.map +1 -0
- package/dist/queue-store.d.ts +132 -0
- package/dist/queue-store.d.ts.map +1 -0
- package/dist/queue-store.js +185 -0
- package/dist/queue-store.js.map +1 -0
- package/dist/queue-summary.d.ts +14 -0
- package/dist/queue-summary.d.ts.map +1 -0
- package/dist/queue-summary.js +82 -0
- package/dist/queue-summary.js.map +1 -0
- package/dist/queue-view.d.ts +20 -0
- package/dist/queue-view.d.ts.map +1 -0
- package/dist/queue-view.js +163 -0
- package/dist/queue-view.js.map +1 -0
- package/dist/queue-write-lease.d.ts +106 -0
- package/dist/queue-write-lease.d.ts.map +1 -0
- package/dist/queue-write-lease.js +282 -0
- package/dist/queue-write-lease.js.map +1 -0
- package/dist/rails-home.d.ts +162 -0
- package/dist/rails-home.d.ts.map +1 -0
- package/dist/rails-home.js +452 -0
- package/dist/rails-home.js.map +1 -0
- package/dist/rails-migrations.d.ts +75 -0
- package/dist/rails-migrations.d.ts.map +1 -0
- package/dist/rails-migrations.js +199 -0
- package/dist/rails-migrations.js.map +1 -0
- package/dist/rails-stores.d.ts +49 -0
- package/dist/rails-stores.d.ts.map +1 -0
- package/dist/rails-stores.js +100 -0
- package/dist/rails-stores.js.map +1 -0
- package/dist/reaper.d.ts +69 -0
- package/dist/reaper.d.ts.map +1 -0
- package/dist/reaper.js +152 -0
- package/dist/reaper.js.map +1 -0
- package/dist/record-store.d.ts +36 -0
- package/dist/record-store.d.ts.map +1 -0
- package/dist/record-store.js +78 -0
- package/dist/record-store.js.map +1 -0
- package/dist/recovery-io.d.ts +50 -0
- package/dist/recovery-io.d.ts.map +1 -0
- package/dist/recovery-io.js +122 -0
- package/dist/recovery-io.js.map +1 -0
- package/dist/recovery.d.ts +146 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +110 -0
- package/dist/recovery.js.map +1 -0
- package/dist/redraw.d.ts +34 -0
- package/dist/redraw.d.ts.map +1 -0
- package/dist/redraw.js +62 -0
- package/dist/redraw.js.map +1 -0
- package/dist/rejected-evidence.d.ts +255 -0
- package/dist/rejected-evidence.d.ts.map +1 -0
- package/dist/rejected-evidence.js +324 -0
- package/dist/rejected-evidence.js.map +1 -0
- package/dist/report-cmd.d.ts +32 -0
- package/dist/report-cmd.d.ts.map +1 -0
- package/dist/report-cmd.js +201 -0
- package/dist/report-cmd.js.map +1 -0
- package/dist/repos-cmd.d.ts +80 -0
- package/dist/repos-cmd.d.ts.map +1 -0
- package/dist/repos-cmd.js +240 -0
- package/dist/repos-cmd.js.map +1 -0
- package/dist/request-body-shape.d.ts +93 -0
- package/dist/request-body-shape.d.ts.map +1 -0
- package/dist/request-body-shape.js +407 -0
- package/dist/request-body-shape.js.map +1 -0
- package/dist/requirement-claims.d.ts +89 -0
- package/dist/requirement-claims.d.ts.map +1 -0
- package/dist/requirement-claims.js +92 -0
- package/dist/requirement-claims.js.map +1 -0
- package/dist/retention-apply-runtime.d.ts +105 -0
- package/dist/retention-apply-runtime.d.ts.map +1 -0
- package/dist/retention-apply-runtime.js +269 -0
- package/dist/retention-apply-runtime.js.map +1 -0
- package/dist/reverify.d.ts +41 -0
- package/dist/reverify.d.ts.map +1 -0
- package/dist/reverify.js +69 -0
- package/dist/reverify.js.map +1 -0
- package/dist/round-records.d.ts +65 -0
- package/dist/round-records.d.ts.map +1 -0
- package/dist/round-records.js +61 -0
- package/dist/round-records.js.map +1 -0
- package/dist/round-runner.d.ts +924 -0
- package/dist/round-runner.d.ts.map +1 -0
- package/dist/round-runner.js +1693 -0
- package/dist/round-runner.js.map +1 -0
- package/dist/run-approval.d.ts +180 -0
- package/dist/run-approval.d.ts.map +1 -0
- package/dist/run-approval.js +199 -0
- package/dist/run-approval.js.map +1 -0
- package/dist/run-cmd.d.ts +359 -0
- package/dist/run-cmd.d.ts.map +1 -0
- package/dist/run-cmd.js +4418 -0
- package/dist/run-cmd.js.map +1 -0
- package/dist/run-delivery.d.ts +71 -0
- package/dist/run-delivery.d.ts.map +1 -0
- package/dist/run-delivery.js +104 -0
- package/dist/run-delivery.js.map +1 -0
- package/dist/run-ended.d.ts +75 -0
- package/dist/run-ended.d.ts.map +1 -0
- package/dist/run-ended.js +27 -0
- package/dist/run-ended.js.map +1 -0
- package/dist/run-ending-locator.d.ts +125 -0
- package/dist/run-ending-locator.d.ts.map +1 -0
- package/dist/run-ending-locator.js +133 -0
- package/dist/run-ending-locator.js.map +1 -0
- package/dist/run-launcher.d.ts +459 -0
- package/dist/run-launcher.d.ts.map +1 -0
- package/dist/run-launcher.js +652 -0
- package/dist/run-launcher.js.map +1 -0
- package/dist/run-lease.d.ts +208 -0
- package/dist/run-lease.d.ts.map +1 -0
- package/dist/run-lease.js +301 -0
- package/dist/run-lease.js.map +1 -0
- package/dist/run-refusal-marks.d.ts +189 -0
- package/dist/run-refusal-marks.d.ts.map +1 -0
- package/dist/run-refusal-marks.js +249 -0
- package/dist/run-refusal-marks.js.map +1 -0
- package/dist/run-start-marks.d.ts +153 -0
- package/dist/run-start-marks.d.ts.map +1 -0
- package/dist/run-start-marks.js +269 -0
- package/dist/run-start-marks.js.map +1 -0
- package/dist/scan-cmd.d.ts +14 -0
- package/dist/scan-cmd.d.ts.map +1 -0
- package/dist/scan-cmd.js +270 -0
- package/dist/scan-cmd.js.map +1 -0
- package/dist/scan-events.d.ts +50 -0
- package/dist/scan-events.d.ts.map +1 -0
- package/dist/scan-events.js +91 -0
- package/dist/scan-events.js.map +1 -0
- package/dist/scan.d.ts +191 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +417 -0
- package/dist/scan.js.map +1 -0
- package/dist/scope-rule.d.ts +148 -0
- package/dist/scope-rule.d.ts.map +1 -0
- package/dist/scope-rule.js +121 -0
- package/dist/scope-rule.js.map +1 -0
- package/dist/self-repo-id.d.ts +18 -0
- package/dist/self-repo-id.d.ts.map +1 -0
- package/dist/self-repo-id.js +70 -0
- package/dist/self-repo-id.js.map +1 -0
- package/dist/serve-cmd.d.ts +115 -0
- package/dist/serve-cmd.d.ts.map +1 -0
- package/dist/serve-cmd.js +505 -0
- package/dist/serve-cmd.js.map +1 -0
- package/dist/serve.d.ts +167 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +336 -0
- package/dist/serve.js.map +1 -0
- package/dist/server-client.d.ts +766 -0
- package/dist/server-client.d.ts.map +1 -0
- package/dist/server-client.js +475 -0
- package/dist/server-client.js.map +1 -0
- package/dist/session-adapter-runtime.d.ts +195 -0
- package/dist/session-adapter-runtime.d.ts.map +1 -0
- package/dist/session-adapter-runtime.js +373 -0
- package/dist/session-adapter-runtime.js.map +1 -0
- package/dist/session-checkpoint-runtime.d.ts +62 -0
- package/dist/session-checkpoint-runtime.d.ts.map +1 -0
- package/dist/session-checkpoint-runtime.js +268 -0
- package/dist/session-checkpoint-runtime.js.map +1 -0
- package/dist/session-control-transport.d.ts +106 -0
- package/dist/session-control-transport.d.ts.map +1 -0
- package/dist/session-control-transport.js +232 -0
- package/dist/session-control-transport.js.map +1 -0
- package/dist/session-observation-store.d.ts +98 -0
- package/dist/session-observation-store.d.ts.map +1 -0
- package/dist/session-observation-store.js +155 -0
- package/dist/session-observation-store.js.map +1 -0
- package/dist/session-observe-runtime.d.ts +123 -0
- package/dist/session-observe-runtime.d.ts.map +1 -0
- package/dist/session-observe-runtime.js +317 -0
- package/dist/session-observe-runtime.js.map +1 -0
- package/dist/session-store.d.ts +98 -0
- package/dist/session-store.d.ts.map +1 -0
- package/dist/session-store.js +116 -0
- package/dist/session-store.js.map +1 -0
- package/dist/sessions-cmd.d.ts +202 -0
- package/dist/sessions-cmd.d.ts.map +1 -0
- package/dist/sessions-cmd.js +609 -0
- package/dist/sessions-cmd.js.map +1 -0
- package/dist/settings-overlay.d.ts +53 -0
- package/dist/settings-overlay.d.ts.map +1 -0
- package/dist/settings-overlay.js +175 -0
- package/dist/settings-overlay.js.map +1 -0
- package/dist/setup-prompt.d.ts +34 -0
- package/dist/setup-prompt.d.ts.map +1 -0
- package/dist/setup-prompt.js +92 -0
- package/dist/setup-prompt.js.map +1 -0
- package/dist/setup.d.ts +103 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +283 -0
- package/dist/setup.js.map +1 -0
- package/dist/shared-grants.d.ts +164 -0
- package/dist/shared-grants.d.ts.map +1 -0
- package/dist/shared-grants.js +242 -0
- package/dist/shared-grants.js.map +1 -0
- package/dist/signals.d.ts +55 -0
- package/dist/signals.d.ts.map +1 -0
- package/dist/signals.js +85 -0
- package/dist/signals.js.map +1 -0
- package/dist/source-cmd.d.ts +201 -0
- package/dist/source-cmd.d.ts.map +1 -0
- package/dist/source-cmd.js +684 -0
- package/dist/source-cmd.js.map +1 -0
- package/dist/source-verdict.d.ts +99 -0
- package/dist/source-verdict.d.ts.map +1 -0
- package/dist/source-verdict.js +182 -0
- package/dist/source-verdict.js.map +1 -0
- package/dist/spend-ledger.d.ts +350 -0
- package/dist/spend-ledger.d.ts.map +1 -0
- package/dist/spend-ledger.js +546 -0
- package/dist/spend-ledger.js.map +1 -0
- package/dist/stale-run-sweep.d.ts +79 -0
- package/dist/stale-run-sweep.d.ts.map +1 -0
- package/dist/stale-run-sweep.js +116 -0
- package/dist/stale-run-sweep.js.map +1 -0
- package/dist/start-attempts.d.ts +385 -0
- package/dist/start-attempts.d.ts.map +1 -0
- package/dist/start-attempts.js +613 -0
- package/dist/start-attempts.js.map +1 -0
- package/dist/status-cmd.d.ts +28 -0
- package/dist/status-cmd.d.ts.map +1 -0
- package/dist/status-cmd.js +116 -0
- package/dist/status-cmd.js.map +1 -0
- package/dist/stop-follow-up.d.ts +107 -0
- package/dist/stop-follow-up.d.ts.map +1 -0
- package/dist/stop-follow-up.js +172 -0
- package/dist/stop-follow-up.js.map +1 -0
- package/dist/surface-lease.d.ts +118 -0
- package/dist/surface-lease.d.ts.map +1 -0
- package/dist/surface-lease.js +485 -0
- package/dist/surface-lease.js.map +1 -0
- package/dist/sync.d.ts +54 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +93 -0
- package/dist/sync.js.map +1 -0
- package/dist/syncing-ledger.d.ts +45 -0
- package/dist/syncing-ledger.d.ts.map +1 -0
- package/dist/syncing-ledger.js +53 -0
- package/dist/syncing-ledger.js.map +1 -0
- package/dist/temp-fixtures.d.ts +68 -0
- package/dist/temp-fixtures.d.ts.map +1 -0
- package/dist/temp-fixtures.js +38 -0
- package/dist/temp-fixtures.js.map +1 -0
- package/dist/token-window.d.ts +84 -0
- package/dist/token-window.d.ts.map +1 -0
- package/dist/token-window.js +143 -0
- package/dist/token-window.js.map +1 -0
- package/dist/tool-bridge.d.ts +177 -0
- package/dist/tool-bridge.d.ts.map +1 -0
- package/dist/tool-bridge.js +329 -0
- package/dist/tool-bridge.js.map +1 -0
- package/dist/tool-call-record.d.ts +197 -0
- package/dist/tool-call-record.d.ts.map +1 -0
- package/dist/tool-call-record.js +276 -0
- package/dist/tool-call-record.js.map +1 -0
- package/dist/tool-protocol.d.ts +135 -0
- package/dist/tool-protocol.d.ts.map +1 -0
- package/dist/tool-protocol.js +104 -0
- package/dist/tool-protocol.js.map +1 -0
- package/dist/tool-worker.d.ts +3 -0
- package/dist/tool-worker.d.ts.map +1 -0
- package/dist/tool-worker.js +478 -0
- package/dist/tool-worker.js.map +1 -0
- package/dist/toolchain-mirror.d.ts +86 -0
- package/dist/toolchain-mirror.d.ts.map +1 -0
- package/dist/toolchain-mirror.js +307 -0
- package/dist/toolchain-mirror.js.map +1 -0
- package/dist/trusted-git.d.ts +243 -0
- package/dist/trusted-git.d.ts.map +1 -0
- package/dist/trusted-git.js +920 -0
- package/dist/trusted-git.js.map +1 -0
- package/dist/ui.d.ts +76 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +118 -0
- package/dist/ui.js.map +1 -0
- package/dist/untrusted-exec.d.ts +275 -0
- package/dist/untrusted-exec.d.ts.map +1 -0
- package/dist/untrusted-exec.js +479 -0
- package/dist/untrusted-exec.js.map +1 -0
- package/dist/untrusted-gate.d.ts +73 -0
- package/dist/untrusted-gate.d.ts.map +1 -0
- package/dist/untrusted-gate.js +226 -0
- package/dist/untrusted-gate.js.map +1 -0
- package/dist/uploader.d.ts +153 -0
- package/dist/uploader.d.ts.map +1 -0
- package/dist/uploader.js +204 -0
- package/dist/uploader.js.map +1 -0
- package/dist/verifier.d.ts +66 -0
- package/dist/verifier.d.ts.map +1 -0
- package/dist/verifier.js +170 -0
- package/dist/verifier.js.map +1 -0
- package/dist/verify-apply.d.ts +26 -0
- package/dist/verify-apply.d.ts.map +1 -0
- package/dist/verify-apply.js +36 -0
- package/dist/verify-apply.js.map +1 -0
- package/dist/verify-cmd.d.ts +44 -0
- package/dist/verify-cmd.d.ts.map +1 -0
- package/dist/verify-cmd.js +125 -0
- package/dist/verify-cmd.js.map +1 -0
- package/dist/verify-pass.d.ts +73 -0
- package/dist/verify-pass.d.ts.map +1 -0
- package/dist/verify-pass.js +103 -0
- package/dist/verify-pass.js.map +1 -0
- package/dist/welcome.d.ts +43 -0
- package/dist/welcome.d.ts.map +1 -0
- package/dist/welcome.js +116 -0
- package/dist/welcome.js.map +1 -0
- package/dist/workspace-provisioner.d.ts +65 -0
- package/dist/workspace-provisioner.d.ts.map +1 -0
- package/dist/workspace-provisioner.js +66 -0
- package/dist/workspace-provisioner.js.map +1 -0
- package/dist/workspace-quarantine.d.ts +64 -0
- package/dist/workspace-quarantine.d.ts.map +1 -0
- package/dist/workspace-quarantine.js +156 -0
- package/dist/workspace-quarantine.js.map +1 -0
- package/dist/workspace-residue-sweep.d.ts +113 -0
- package/dist/workspace-residue-sweep.d.ts.map +1 -0
- package/dist/workspace-residue-sweep.js +158 -0
- package/dist/workspace-residue-sweep.js.map +1 -0
- package/dist/workspace.d.ts +639 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +2026 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +52 -4
- package/win/CredProbe.cs +64 -0
- package/win/FakeClaude.cs +56 -0
- package/win/HandleProbe.cs +116 -0
- package/win/TokenProbe.cs +53 -0
- package/win/appcontainer.ps1 +500 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { AgentInvoke } from './agent-exec';
|
|
2
|
+
import { type PendingActionDeclaration, type ReadDeclaration } from './pending-action';
|
|
3
|
+
/**
|
|
4
|
+
* The agent driver: spawns the coding agent, captures the transcript, and parses
|
|
5
|
+
* the structured implementer result out of it.
|
|
6
|
+
*
|
|
7
|
+
* The one rule here is DESIGN §2.4 / §12 case 4: the round's outcome comes from
|
|
8
|
+
* the implementer's structured result and from nothing else. A missing or
|
|
9
|
+
* unparseable result is `abandoned` — the driver never inspects the working tree
|
|
10
|
+
* to guess whether "something happened", because deciding that from `git status`
|
|
11
|
+
* is exactly how the previous harness made its no-op branch unreachable. The
|
|
12
|
+
* exit code decides nothing either (§12 case 3): an agent that exits non-zero
|
|
13
|
+
* but returned a valid result still goes to the gate, and the gate decides.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* `implemented` and the `blocked` flow are DESIGN §2.2 / §8; `no-op` exists so
|
|
17
|
+
* "there was nothing to do" is a statement the agent makes, never an inference
|
|
18
|
+
* the runner draws from an unchanged tree (§2.4).
|
|
19
|
+
*/
|
|
20
|
+
export type ImplementerOutcome = 'implemented' | 'no-op' | 'blocked';
|
|
21
|
+
export interface ImplementerBlocked {
|
|
22
|
+
path: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
}
|
|
25
|
+
/** The structured result of DESIGN §2.2 — the only thing the runner trusts. */
|
|
26
|
+
export interface ImplementerResult {
|
|
27
|
+
itemId: string;
|
|
28
|
+
outcome: ImplementerOutcome;
|
|
29
|
+
filesTouched: string[];
|
|
30
|
+
testsAdded: number;
|
|
31
|
+
note: string;
|
|
32
|
+
blocked: ImplementerBlocked | null;
|
|
33
|
+
}
|
|
34
|
+
export interface ImplementerInvocation {
|
|
35
|
+
/** The item this round is implementing; a result for any other item is not a result. */
|
|
36
|
+
itemId: string;
|
|
37
|
+
/** The prompt. It goes to the agent's stdin, never onto a command line. */
|
|
38
|
+
prompt: string;
|
|
39
|
+
timeoutMs: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* WHAT A ROUND CAN BE TOLD ABOUT A TURN.
|
|
43
|
+
*
|
|
44
|
+
* Unchanged, and that is load-bearing. The round protocol understands work that
|
|
45
|
+
* happened and work that did not, and a request for human authority is neither
|
|
46
|
+
* — so it is not in this union, and `RoundRunner` cannot come to have an
|
|
47
|
+
* opinion about one. The composition root reads the wider {@link ImplementerTurn}
|
|
48
|
+
* and decides; the runner is handed one of these two either way.
|
|
49
|
+
*/
|
|
50
|
+
export type ImplementerRunResult = {
|
|
51
|
+
kind: 'result';
|
|
52
|
+
result: ImplementerResult;
|
|
53
|
+
transcript: string;
|
|
54
|
+
ms: number;
|
|
55
|
+
exitOk: boolean;
|
|
56
|
+
timedOut: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'abandoned';
|
|
59
|
+
reason: string;
|
|
60
|
+
transcript: string;
|
|
61
|
+
ms: number;
|
|
62
|
+
exitOk: boolean;
|
|
63
|
+
timedOut: boolean;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The turn asked for something only a person may authorise.
|
|
67
|
+
*
|
|
68
|
+
* Carries the model's DECLARATION and not a built request: this file has no
|
|
69
|
+
* project, no actor and no pursuit, and inventing a context here so the shape
|
|
70
|
+
* looked finished is exactly the mistake the whole design is arranged against.
|
|
71
|
+
* Building it belongs where the trusted values live.
|
|
72
|
+
*/
|
|
73
|
+
export interface ImplementerPendingAction {
|
|
74
|
+
kind: 'pending-action';
|
|
75
|
+
declaration: PendingActionDeclaration;
|
|
76
|
+
transcript: string;
|
|
77
|
+
ms: number;
|
|
78
|
+
exitOk: boolean;
|
|
79
|
+
timedOut: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Everything one model turn can produce.
|
|
83
|
+
*
|
|
84
|
+
* Wider than what a round consumes, on purpose. Narrowing happens once, in the
|
|
85
|
+
* composition root, which is the only place that knows what a pending action
|
|
86
|
+
* means — and the only place with the authority to say so.
|
|
87
|
+
*/
|
|
88
|
+
export type ImplementerTurn = ImplementerRunResult | ImplementerPendingAction;
|
|
89
|
+
export declare function runImplementer(invoke: AgentInvoke, inv: ImplementerInvocation): Promise<ImplementerTurn>;
|
|
90
|
+
/**
|
|
91
|
+
* The FIRST declaration in the transcript, not the last.
|
|
92
|
+
*
|
|
93
|
+
* The opposite of `extractImplementerResult`, and for the opposite reason. A
|
|
94
|
+
* result is an answer, so the newest one is the intended one. A request for
|
|
95
|
+
* authority is a BOUNDARY: the turn should have ended at the first, so the
|
|
96
|
+
* first is the only one that can honestly be said to have arisen. Taking the
|
|
97
|
+
* last would let a model that asked for two consequential actions choose which
|
|
98
|
+
* one the person gets shown.
|
|
99
|
+
*
|
|
100
|
+
* `jsonCandidates` sorts newest-first for the result parser's sake, so this
|
|
101
|
+
* walks it backwards rather than scanning the transcript a second way.
|
|
102
|
+
*/
|
|
103
|
+
export declare function extractPendingAction(transcript: string): ReadDeclaration;
|
|
104
|
+
export type ExtractResult = {
|
|
105
|
+
ok: true;
|
|
106
|
+
result: ImplementerResult;
|
|
107
|
+
} | {
|
|
108
|
+
ok: false;
|
|
109
|
+
reason: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Find the implementer result in a transcript: the last JSON candidate (a fenced
|
|
113
|
+
* ```json block or a whole line of JSON) that validates against the §2.2 shape
|
|
114
|
+
* for this item. Scanning from the end and requiring full validation means an
|
|
115
|
+
* echo of the example result in the prompt, or tool output that happens to be
|
|
116
|
+
* JSON, can never be mistaken for the agent's answer.
|
|
117
|
+
*/
|
|
118
|
+
export declare function extractImplementerResult(transcript: string, expectedItemId: string): ExtractResult;
|
|
119
|
+
export interface Candidate {
|
|
120
|
+
at: number;
|
|
121
|
+
value: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Shared by the prover's verdict parser (prover.ts): both transcripts embed an
|
|
125
|
+
* example of the expected JSON in their prompt, so both must scan from the end
|
|
126
|
+
* and require full validation — one scan implementation keeps the two parsers
|
|
127
|
+
* from drifting apart in what they consider a candidate.
|
|
128
|
+
*/
|
|
129
|
+
export declare function jsonCandidates(transcript: string): Candidate[];
|
|
130
|
+
//# sourceMappingURL=agent-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-driver.d.ts","sourceRoot":"","sources":["../src/agent-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,kBAAkB,CAAC;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAA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
|
|
4
|
+
exports.extractPendingAction = extractPendingAction;
|
|
5
|
+
exports.extractImplementerResult = extractImplementerResult;
|
|
6
|
+
exports.jsonCandidates = jsonCandidates;
|
|
7
|
+
const pending_action_1 = require("./pending-action");
|
|
8
|
+
async function runImplementer(invoke, inv) {
|
|
9
|
+
const r = await invoke(inv.prompt, inv.timeoutMs);
|
|
10
|
+
const transcript = r.output ?? '';
|
|
11
|
+
const base = { transcript, ms: r.ms, exitOk: r.ok, timedOut: r.timedOut };
|
|
12
|
+
// BEFORE the result, and it is not a preference. A turn that asked for
|
|
13
|
+
// authority and also filed a result has done the second thing on the far side
|
|
14
|
+
// of a line it should have stopped at; gating and committing that work would
|
|
15
|
+
// be carrying on past the request instead of stopping at it.
|
|
16
|
+
const pending = extractPendingAction(transcript);
|
|
17
|
+
if (pending.kind === 'declared') {
|
|
18
|
+
return { kind: 'pending-action', declaration: pending.declaration, ...base };
|
|
19
|
+
}
|
|
20
|
+
if (pending.kind === 'malformed') {
|
|
21
|
+
// Never the ordinary path. Something asked for a consequential act in a
|
|
22
|
+
// shape nobody can identify, and reading past it to whatever else the
|
|
23
|
+
// transcript holds would be answering a different question than the one
|
|
24
|
+
// that was asked.
|
|
25
|
+
return { kind: 'abandoned', reason: `a pending action was declared and could not be read: ${pending.because}`, ...base };
|
|
26
|
+
}
|
|
27
|
+
const extracted = extractImplementerResult(transcript, inv.itemId);
|
|
28
|
+
if (extracted.ok)
|
|
29
|
+
return { kind: 'result', result: extracted.result, ...base };
|
|
30
|
+
const reason = r.timedOut
|
|
31
|
+
? `${extracted.reason}; the agent hit its ${inv.timeoutMs}ms timeout and was killed`
|
|
32
|
+
: extracted.reason;
|
|
33
|
+
return { kind: 'abandoned', reason, ...base };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The FIRST declaration in the transcript, not the last.
|
|
37
|
+
*
|
|
38
|
+
* The opposite of `extractImplementerResult`, and for the opposite reason. A
|
|
39
|
+
* result is an answer, so the newest one is the intended one. A request for
|
|
40
|
+
* authority is a BOUNDARY: the turn should have ended at the first, so the
|
|
41
|
+
* first is the only one that can honestly be said to have arisen. Taking the
|
|
42
|
+
* last would let a model that asked for two consequential actions choose which
|
|
43
|
+
* one the person gets shown.
|
|
44
|
+
*
|
|
45
|
+
* `jsonCandidates` sorts newest-first for the result parser's sake, so this
|
|
46
|
+
* walks it backwards rather than scanning the transcript a second way.
|
|
47
|
+
*/
|
|
48
|
+
function extractPendingAction(transcript) {
|
|
49
|
+
const candidates = jsonCandidates(transcript);
|
|
50
|
+
for (let i = candidates.length - 1; i >= 0; i -= 1) {
|
|
51
|
+
const read = (0, pending_action_1.readPendingActionDeclaration)(candidates[i].value);
|
|
52
|
+
if (read.kind !== 'none')
|
|
53
|
+
return read;
|
|
54
|
+
}
|
|
55
|
+
return { kind: 'none' };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Find the implementer result in a transcript: the last JSON candidate (a fenced
|
|
59
|
+
* ```json block or a whole line of JSON) that validates against the §2.2 shape
|
|
60
|
+
* for this item. Scanning from the end and requiring full validation means an
|
|
61
|
+
* echo of the example result in the prompt, or tool output that happens to be
|
|
62
|
+
* JSON, can never be mistaken for the agent's answer.
|
|
63
|
+
*/
|
|
64
|
+
function extractImplementerResult(transcript, expectedItemId) {
|
|
65
|
+
let why;
|
|
66
|
+
for (const candidate of jsonCandidates(transcript)) {
|
|
67
|
+
const v = validate(candidate.value, expectedItemId);
|
|
68
|
+
if (v.ok)
|
|
69
|
+
return v;
|
|
70
|
+
// Keep the failure closest to the end: that candidate is the most likely to
|
|
71
|
+
// be the intended result, so its error is the one worth reporting.
|
|
72
|
+
if (why === undefined)
|
|
73
|
+
why = `the last result-shaped JSON is not a valid implementer result: ${v.why}`;
|
|
74
|
+
}
|
|
75
|
+
return { ok: false, reason: why ?? 'no structured implementer result in the transcript' };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Shared by the prover's verdict parser (prover.ts): both transcripts embed an
|
|
79
|
+
* example of the expected JSON in their prompt, so both must scan from the end
|
|
80
|
+
* and require full validation — one scan implementation keeps the two parsers
|
|
81
|
+
* from drifting apart in what they consider a candidate.
|
|
82
|
+
*/
|
|
83
|
+
function jsonCandidates(transcript) {
|
|
84
|
+
const out = [];
|
|
85
|
+
const fence = /```(?:json)?[ \t]*\n([\s\S]*?)```/g;
|
|
86
|
+
for (let m = fence.exec(transcript); m !== null; m = fence.exec(transcript)) {
|
|
87
|
+
const parsed = tryParseObject(m[1] ?? '');
|
|
88
|
+
if (parsed)
|
|
89
|
+
out.push({ at: m.index, value: parsed });
|
|
90
|
+
}
|
|
91
|
+
let offset = 0;
|
|
92
|
+
for (const line of transcript.split('\n')) {
|
|
93
|
+
const trimmed = line.trim();
|
|
94
|
+
if (trimmed.startsWith('{')) {
|
|
95
|
+
const parsed = tryParseObject(trimmed);
|
|
96
|
+
if (parsed)
|
|
97
|
+
out.push({ at: offset, value: parsed });
|
|
98
|
+
}
|
|
99
|
+
offset += line.length + 1;
|
|
100
|
+
}
|
|
101
|
+
return out.sort((a, b) => b.at - a.at);
|
|
102
|
+
}
|
|
103
|
+
function tryParseObject(text) {
|
|
104
|
+
try {
|
|
105
|
+
const v = JSON.parse(text);
|
|
106
|
+
if (typeof v === 'object' && v !== null && !Array.isArray(v))
|
|
107
|
+
return v;
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const OUTCOMES = ['implemented', 'no-op', 'blocked'];
|
|
115
|
+
function validate(v, expectedItemId) {
|
|
116
|
+
const itemId = v['itemId'];
|
|
117
|
+
if (typeof itemId !== 'string' || !itemId)
|
|
118
|
+
return { ok: false, why: 'itemId must be a non-empty string' };
|
|
119
|
+
if (itemId !== expectedItemId) {
|
|
120
|
+
return {
|
|
121
|
+
ok: false,
|
|
122
|
+
why: `the result is for item ${JSON.stringify(itemId)}, not ${JSON.stringify(expectedItemId)}`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const outcome = v['outcome'];
|
|
126
|
+
if (typeof outcome !== 'string' || !OUTCOMES.includes(outcome)) {
|
|
127
|
+
return { ok: false, why: `outcome must be one of ${OUTCOMES.join(' | ')}` };
|
|
128
|
+
}
|
|
129
|
+
const filesTouched = v['filesTouched'];
|
|
130
|
+
if (!Array.isArray(filesTouched) || filesTouched.some((p) => typeof p !== 'string')) {
|
|
131
|
+
return { ok: false, why: 'filesTouched must be a list of strings' };
|
|
132
|
+
}
|
|
133
|
+
const testsAdded = v['testsAdded'];
|
|
134
|
+
if (typeof testsAdded !== 'number' || !Number.isInteger(testsAdded) || testsAdded < 0) {
|
|
135
|
+
return { ok: false, why: 'testsAdded must be a non-negative integer' };
|
|
136
|
+
}
|
|
137
|
+
const note = v['note'];
|
|
138
|
+
if (typeof note !== 'string')
|
|
139
|
+
return { ok: false, why: 'note must be a string' };
|
|
140
|
+
const blocked = parseBlocked(v['blocked']);
|
|
141
|
+
if (blocked === undefined)
|
|
142
|
+
return { ok: false, why: 'blocked must be null or { path, reason }' };
|
|
143
|
+
if ((outcome === 'blocked') !== (blocked !== null)) {
|
|
144
|
+
return { ok: false, why: 'a blocked outcome and blocked details must appear together' };
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
ok: true,
|
|
148
|
+
result: {
|
|
149
|
+
itemId,
|
|
150
|
+
outcome: outcome,
|
|
151
|
+
filesTouched: filesTouched,
|
|
152
|
+
testsAdded,
|
|
153
|
+
note,
|
|
154
|
+
blocked,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function parseBlocked(v) {
|
|
159
|
+
if (v === null)
|
|
160
|
+
return null;
|
|
161
|
+
if (typeof v !== 'object' || Array.isArray(v))
|
|
162
|
+
return undefined;
|
|
163
|
+
const o = v;
|
|
164
|
+
const path = o['path'];
|
|
165
|
+
const reason = o['reason'];
|
|
166
|
+
if (typeof path !== 'string' || !path || typeof reason !== 'string' || !reason)
|
|
167
|
+
return undefined;
|
|
168
|
+
return { path, reason };
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=agent-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-driver.js","sourceRoot":"","sources":["../src/agent-driver.ts"],"names":[],"mappings":";;AAuGA,wCA+BC;AAeD,oDAOC;AAaD,4DAUC;AAaD,wCAoBC;AAnND,qDAI0B;AAkGnB,KAAK,UAAU,cAAc,CAClC,MAAmB,EACnB,GAA0B;IAE1B,MAAM,CAAC,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE1E,uEAAuE;IACvE,8EAA8E;IAC9E,6EAA6E;IAC7E,6DAA6D;IAC7D,MAAM,OAAO,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC;IAC/E,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACjC,wEAAwE;QACxE,sEAAsE;QACtE,wEAAwE;QACxE,kBAAkB;QAClB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,wDAAwD,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;IAC3H,CAAC;IAED,MAAM,SAAS,GAAG,wBAAwB,CAAC,UAAU,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ACJ,CAAC;AAED,SAAS,YAAY,CAAC,CAAU;IAC9B,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,CAAC,GAAG,CAA4B,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACjG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { AgentInvoke } from './agent-exec';
|
|
2
|
+
import type { CommandResult, InvocationCost } from './gate';
|
|
3
|
+
/**
|
|
4
|
+
* Reading `claude -p --output-format json`.
|
|
5
|
+
*
|
|
6
|
+
* The envelope was read off the installed CLI rather than guessed. A success is
|
|
7
|
+
*
|
|
8
|
+
* {"type":"result","subtype":"success","is_error":false,"duration_ms":0,
|
|
9
|
+
* "duration_api_ms":0,"num_turns":0,"result":"…the final message…",
|
|
10
|
+
* "stop_reason":null,"total_cost_usd":0,"usage":{…},"modelUsage":{},
|
|
11
|
+
* "permission_denials":[],"session_id":"…","uuid":"…"}
|
|
12
|
+
*
|
|
13
|
+
* and a failure replaces `result` with `errors: string[]` under one of
|
|
14
|
+
* `subtype: "error_during_execution" | "error_max_turns"`.
|
|
15
|
+
*
|
|
16
|
+
* Two things this buys that scraping `--output-format text` cannot:
|
|
17
|
+
*
|
|
18
|
+
* 1. **A delimited answer.** The command runner merges stdout and stderr (one
|
|
19
|
+
* stream, so a missing tool reads differently from a failing test), so a
|
|
20
|
+
* single warning line from the agent's own startup lands in the middle of
|
|
21
|
+
* what we then try to `JSON.parse` as one document. The envelope's `result`
|
|
22
|
+
* is the final message and nothing else.
|
|
23
|
+
* 2. **A verdict that is not the exit code.** A run truncated at its turn limit
|
|
24
|
+
* can still exit zero; `is_error` is the only thing that says so. Reading a
|
|
25
|
+
* truncation as a completed answer is how a lens reports "nothing found" for
|
|
26
|
+
* a pass that never finished looking.
|
|
27
|
+
*/
|
|
28
|
+
export interface AgentEnvelope {
|
|
29
|
+
/** `is_error` — the run produced an answer rather than a failure report. */
|
|
30
|
+
ok: boolean;
|
|
31
|
+
/** The final message: `result` when there is one, the errors otherwise. */
|
|
32
|
+
text: string;
|
|
33
|
+
/** `success`, `error_during_execution`, `error_max_turns`, … — a label, not the verdict. */
|
|
34
|
+
subtype: string;
|
|
35
|
+
errors: string[];
|
|
36
|
+
/**
|
|
37
|
+
* F35: `api_error_status` — the HTTP status of the API error whose text is in `result`, when
|
|
38
|
+
* there was one. Written by the CLI, never by the model: 429 is the provider's usage limit.
|
|
39
|
+
* Absent when the envelope does not carry a number there.
|
|
40
|
+
*/
|
|
41
|
+
apiErrorStatus?: number;
|
|
42
|
+
/**
|
|
43
|
+
* WHAT THIS TURN COST, WHICH WAS BEING PARSED AWAY.
|
|
44
|
+
*
|
|
45
|
+
* 🔴 `total_cost_usd`, `usage`, `session_id` AND `num_turns` ARRIVE IN EVERY
|
|
46
|
+
* ENVELOPE AND WERE DISCARDED. So the machine could spend all night and
|
|
47
|
+
* nothing on it could say how much — and a budget over numbers nobody counts
|
|
48
|
+
* is theatre, which is why the envelope has to be read before an envelope
|
|
49
|
+
* ceiling can mean anything.
|
|
50
|
+
*
|
|
51
|
+
* ⚠️ EVERY FIELD IS OPTIONAL, and absent means "this provider did not say",
|
|
52
|
+
* never zero. A configured provider emits none of these, and recording a
|
|
53
|
+
* missing cost as $0 would make an unmeasured night look like a free one —
|
|
54
|
+
* exactly the direction a ceiling must never fail in.
|
|
55
|
+
*/
|
|
56
|
+
cost?: InvocationCost;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Pull the envelope out of a captured stream, or null when there is not one.
|
|
60
|
+
*
|
|
61
|
+
* Null is a normal answer, not a fault: an older CLI, `--output-format text`,
|
|
62
|
+
* and a pass killed before it could write its last line all produce output with
|
|
63
|
+
* no envelope in it, and every one of them must fall through to the raw stream
|
|
64
|
+
* rather than be reported as an agent failure.
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseAgentEnvelope(output: string): AgentEnvelope | null;
|
|
67
|
+
/**
|
|
68
|
+
* Turn a raw invocation into one whose `output` is the agent's answer.
|
|
69
|
+
*
|
|
70
|
+
* Composes with the exit code rather than replacing it: a non-zero exit stays a
|
|
71
|
+
* failure whatever the envelope claims, because the process falling over after
|
|
72
|
+
* writing its result is still a run that fell over.
|
|
73
|
+
*/
|
|
74
|
+
export declare function unwrapEnvelope(r: CommandResult): CommandResult;
|
|
75
|
+
/**
|
|
76
|
+
* An invoke whose callers see the model's final message, not the envelope.
|
|
77
|
+
*
|
|
78
|
+
* 🔴 THE ROUND RAN ON `--output-format text` AND SO RECORDED NO USAGE. Every
|
|
79
|
+
* invocation was written to the spend ledger with `usd` absent — honest, but
|
|
80
|
+
* it meant the most expensive path in the system could never report what it
|
|
81
|
+
* cost, and the previous trial's report had to say "no actual usage captured".
|
|
82
|
+
* The JSON path carries `total_cost_usd`, `num_turns`, `usage` and
|
|
83
|
+
* `session_id`; the transport records them at the invocation, and this strips
|
|
84
|
+
* the envelope on the way to the round so `extractImplementerResult` and the
|
|
85
|
+
* verifier's verdict parser read the same final message they always did.
|
|
86
|
+
*
|
|
87
|
+
* ⚠️ THE TWO ARE KEPT APART BY CONSTRUCTION. The transport's `record()` reads
|
|
88
|
+
* the metadata off the envelope BEFORE this runs; what comes out of here is the
|
|
89
|
+
* result text and the parsed cost, and nothing parses the model's prose for a
|
|
90
|
+
* dollar figure. A model that writes "this cost $0.00" in its answer has said
|
|
91
|
+
* something, not recorded anything.
|
|
92
|
+
*/
|
|
93
|
+
export declare function unwrapping(invoke: AgentInvoke): AgentInvoke;
|
|
94
|
+
//# sourceMappingURL=agent-envelope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-envelope.d.ts","sourceRoot":"","sources":["../src/agent-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,EAAE,EAAE,OAAO,CAAC;IACZ,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAmCvE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAoB9D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAE3D"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseAgentEnvelope = parseAgentEnvelope;
|
|
4
|
+
exports.unwrapEnvelope = unwrapEnvelope;
|
|
5
|
+
exports.unwrapping = unwrapping;
|
|
6
|
+
/**
|
|
7
|
+
* Pull the envelope out of a captured stream, or null when there is not one.
|
|
8
|
+
*
|
|
9
|
+
* Null is a normal answer, not a fault: an older CLI, `--output-format text`,
|
|
10
|
+
* and a pass killed before it could write its last line all produce output with
|
|
11
|
+
* no envelope in it, and every one of them must fall through to the raw stream
|
|
12
|
+
* rather than be reported as an agent failure.
|
|
13
|
+
*/
|
|
14
|
+
function parseAgentEnvelope(output) {
|
|
15
|
+
// From the end: the envelope is the last thing written, and anything earlier
|
|
16
|
+
// that happens to be JSON — a tool log, the findings object the lens prompt
|
|
17
|
+
// asked for — is not it.
|
|
18
|
+
for (const start of objectStarts(output).reverse()) {
|
|
19
|
+
const slice = balanced(output, start);
|
|
20
|
+
if (slice === null)
|
|
21
|
+
continue;
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(slice);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
30
|
+
continue;
|
|
31
|
+
const o = parsed;
|
|
32
|
+
if (o['type'] !== 'result')
|
|
33
|
+
continue;
|
|
34
|
+
const errors = Array.isArray(o['errors'])
|
|
35
|
+
? o['errors'].filter((e) => typeof e === 'string')
|
|
36
|
+
: [];
|
|
37
|
+
const result = typeof o['result'] === 'string' ? o['result'] : '';
|
|
38
|
+
return {
|
|
39
|
+
// `is_error`, not the subtype. The CLI emits `subtype:"success"` with
|
|
40
|
+
// `is_error:true` when an API error's text is what landed in `result`, so
|
|
41
|
+
// the subtype names the reason and this field carries the verdict.
|
|
42
|
+
ok: o['is_error'] !== true,
|
|
43
|
+
text: result || errors.join('\n'),
|
|
44
|
+
subtype: typeof o['subtype'] === 'string' ? o['subtype'] : '',
|
|
45
|
+
errors,
|
|
46
|
+
...(typeof o['api_error_status'] === 'number' ? { apiErrorStatus: o['api_error_status'] } : {}),
|
|
47
|
+
...(costOf(o) === null ? {} : { cost: costOf(o) }),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Turn a raw invocation into one whose `output` is the agent's answer.
|
|
54
|
+
*
|
|
55
|
+
* Composes with the exit code rather than replacing it: a non-zero exit stays a
|
|
56
|
+
* failure whatever the envelope claims, because the process falling over after
|
|
57
|
+
* writing its result is still a run that fell over.
|
|
58
|
+
*/
|
|
59
|
+
function unwrapEnvelope(r) {
|
|
60
|
+
const env = parseAgentEnvelope(r.output ?? '');
|
|
61
|
+
if (!env)
|
|
62
|
+
return r;
|
|
63
|
+
return {
|
|
64
|
+
...r,
|
|
65
|
+
ok: r.ok && env.ok,
|
|
66
|
+
// An envelope with nothing in it — no result, no errors — keeps the raw
|
|
67
|
+
// stream. That case is the one where the only diagnosis left is whatever
|
|
68
|
+
// the agent printed on its way to saying nothing.
|
|
69
|
+
output: env.text || r.output,
|
|
70
|
+
/**
|
|
71
|
+
* 🔴 AND THE COST SURVIVES THE UNWRAP. It did not: every production reader
|
|
72
|
+
* goes through this function, and this function built a fresh object with
|
|
73
|
+
* no room for it, so `total_cost_usd` was parsed once per invocation and
|
|
74
|
+
* thrown away three times. Spread rather than defaulted — an envelope that
|
|
75
|
+
* reported no cost must leave the field absent, because absent is what
|
|
76
|
+
* `withinEnvelope` refuses on and zero is what it would wave through.
|
|
77
|
+
*/
|
|
78
|
+
...(env.cost === undefined ? {} : { cost: env.cost }),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* An invoke whose callers see the model's final message, not the envelope.
|
|
83
|
+
*
|
|
84
|
+
* 🔴 THE ROUND RAN ON `--output-format text` AND SO RECORDED NO USAGE. Every
|
|
85
|
+
* invocation was written to the spend ledger with `usd` absent — honest, but
|
|
86
|
+
* it meant the most expensive path in the system could never report what it
|
|
87
|
+
* cost, and the previous trial's report had to say "no actual usage captured".
|
|
88
|
+
* The JSON path carries `total_cost_usd`, `num_turns`, `usage` and
|
|
89
|
+
* `session_id`; the transport records them at the invocation, and this strips
|
|
90
|
+
* the envelope on the way to the round so `extractImplementerResult` and the
|
|
91
|
+
* verifier's verdict parser read the same final message they always did.
|
|
92
|
+
*
|
|
93
|
+
* ⚠️ THE TWO ARE KEPT APART BY CONSTRUCTION. The transport's `record()` reads
|
|
94
|
+
* the metadata off the envelope BEFORE this runs; what comes out of here is the
|
|
95
|
+
* result text and the parsed cost, and nothing parses the model's prose for a
|
|
96
|
+
* dollar figure. A model that writes "this cost $0.00" in its answer has said
|
|
97
|
+
* something, not recorded anything.
|
|
98
|
+
*/
|
|
99
|
+
function unwrapping(invoke) {
|
|
100
|
+
return async (prompt, timeoutMs) => unwrapEnvelope(await invoke(prompt, timeoutMs));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 🔴 THE PARSE IS QUADRATIC, AND A MODEL CHOOSES ITS INPUT.
|
|
104
|
+
*
|
|
105
|
+
* `objectStarts` finds every `{` that opens a line and `balanced` scans
|
|
106
|
+
* forward from each one for a matching brace. When a brace NEVER closes —
|
|
107
|
+
* which is what model prose looks like — every candidate scans to the end of
|
|
108
|
+
* the whole stream, so the cost is O(starts x length).
|
|
109
|
+
*
|
|
110
|
+
* MEASURED against a stream of unclosed braces, on this machine:
|
|
111
|
+
*
|
|
112
|
+
* 0.25 MB (5,699 starts) 3,361 ms
|
|
113
|
+
* 0.50 MB (11,398 starts) 6,338 ms
|
|
114
|
+
* 1.00 MB (22,795 starts) 22,819 ms
|
|
115
|
+
* 2.00 MB (45,590 starts) 110,687 ms <- 110 SECONDS, one core, blocking
|
|
116
|
+
*
|
|
117
|
+
* Four times the work for twice the input, which is the signature. A 4 MB
|
|
118
|
+
* transcript is roughly seven minutes of a pegged core, and the transcript is
|
|
119
|
+
* written by the model.
|
|
120
|
+
*
|
|
121
|
+
* TWO BOUNDS, and both of them are also true statements about where an
|
|
122
|
+
* envelope actually is:
|
|
123
|
+
*
|
|
124
|
+
* TAIL The envelope is the LAST thing a provider writes. Nothing earlier
|
|
125
|
+
* in the stream can be it, so nothing earlier needs scanning.
|
|
126
|
+
* COUNT Only the last few line-opening braces can be the envelope. If
|
|
127
|
+
* hundreds of them follow it, the stream is not envelope-terminated
|
|
128
|
+
* and there is nothing here to find.
|
|
129
|
+
*
|
|
130
|
+
* ⚠️ NEITHER IS A HEURISTIC ABOUT CONTENT. They are bounds on WHERE to look,
|
|
131
|
+
* and the answer for a real envelope is unchanged: it is the first candidate
|
|
132
|
+
* from the end, on every provider this reads.
|
|
133
|
+
*/
|
|
134
|
+
const ENVELOPE_TAIL_BYTES = 1_000_000;
|
|
135
|
+
const MAX_ENVELOPE_CANDIDATES = 40;
|
|
136
|
+
/** Offsets of the last few `{` that open a line, which is where an envelope starts. */
|
|
137
|
+
function objectStarts(text) {
|
|
138
|
+
const from = Math.max(0, text.length - ENVELOPE_TAIL_BYTES);
|
|
139
|
+
const out = [];
|
|
140
|
+
let offset = from;
|
|
141
|
+
for (const line of text.slice(from).split('\n')) {
|
|
142
|
+
const lead = line.length - line.trimStart().length;
|
|
143
|
+
if (line.trimStart().startsWith('{'))
|
|
144
|
+
out.push(offset + lead);
|
|
145
|
+
offset += line.length + 1;
|
|
146
|
+
}
|
|
147
|
+
// The tail of the list: `parseAgentEnvelope` reverses it and takes the last
|
|
148
|
+
// document first, so these are the candidates closest to the end.
|
|
149
|
+
return out.slice(-MAX_ENVELOPE_CANDIDATES);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The substring from `start` to its matching brace, or null when it never
|
|
153
|
+
* closes. String-aware: a `}` inside a quoted review — and the agent's final
|
|
154
|
+
* message is full of them — must not end the document early.
|
|
155
|
+
*/
|
|
156
|
+
function balanced(text, start) {
|
|
157
|
+
let depth = 0;
|
|
158
|
+
let inString = false;
|
|
159
|
+
let escaped = false;
|
|
160
|
+
for (let i = start; i < text.length; i++) {
|
|
161
|
+
const c = text[i];
|
|
162
|
+
if (escaped) {
|
|
163
|
+
escaped = false;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (inString) {
|
|
167
|
+
if (c === '\\')
|
|
168
|
+
escaped = true;
|
|
169
|
+
else if (c === '"')
|
|
170
|
+
inString = false;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (c === '"')
|
|
174
|
+
inString = true;
|
|
175
|
+
else if (c === '{')
|
|
176
|
+
depth++;
|
|
177
|
+
else if (c === '}' && --depth === 0)
|
|
178
|
+
return text.slice(start, i + 1);
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* What the envelope says this turn cost, or null when it says nothing.
|
|
184
|
+
*
|
|
185
|
+
* ⚠️ NULL RATHER THAN ZEROES. A provider that reports no cost has not reported
|
|
186
|
+
* a cost of nothing, and an unmeasured night must never look like a free one —
|
|
187
|
+
* that is the one direction a ceiling can fail in without anybody noticing.
|
|
188
|
+
*
|
|
189
|
+
* ⚠️ AND EVERY FIELD IS CHECKED FOR ITS TYPE. These reach an envelope ceiling
|
|
190
|
+
* and a Decision Record; a string where a number belongs would propagate into
|
|
191
|
+
* arithmetic and produce a budget that silently stopped bounding anything.
|
|
192
|
+
*/
|
|
193
|
+
function costOf(o) {
|
|
194
|
+
const num = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : undefined;
|
|
195
|
+
const usage = o['usage'];
|
|
196
|
+
const u = usage !== null && typeof usage === 'object' ? usage : {};
|
|
197
|
+
const cost = {
|
|
198
|
+
...(num(o['total_cost_usd']) === undefined ? {} : { usd: num(o['total_cost_usd']) }),
|
|
199
|
+
...(num(o['num_turns']) === undefined ? {} : { turns: num(o['num_turns']) }),
|
|
200
|
+
...(typeof o['session_id'] === 'string' && o['session_id'] !== ''
|
|
201
|
+
? { sessionId: o['session_id'] }
|
|
202
|
+
: {}),
|
|
203
|
+
...(num(u['input_tokens']) === undefined ? {} : { inputTokens: num(u['input_tokens']) }),
|
|
204
|
+
...(num(u['output_tokens']) === undefined ? {} : { outputTokens: num(u['output_tokens']) }),
|
|
205
|
+
...(num(u['cache_read_input_tokens']) === undefined
|
|
206
|
+
? {}
|
|
207
|
+
: { cacheReadTokens: num(u['cache_read_input_tokens']) }),
|
|
208
|
+
...(num(u['cache_creation_input_tokens']) === undefined
|
|
209
|
+
? {}
|
|
210
|
+
: { cacheWriteTokens: num(u['cache_creation_input_tokens']) }),
|
|
211
|
+
};
|
|
212
|
+
return Object.keys(cost).length === 0 ? null : cost;
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=agent-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-envelope.js","sourceRoot":"","sources":["../src/agent-envelope.ts"],"names":[],"mappings":";;AAmEA,gDAmCC;AASD,wCAoBC;AAoBD,gCAEC;AA9FD;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,6EAA6E;IAC7E,4EAA4E;IAC5E,yBAAyB;IACzB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC7B,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,SAAS;QAC5D,MAAM,CAAC,GAAG,MAAiC,CAAC;QAC5C,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ;YAAE,SAAS;QAErC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,C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