@stigmer/runner 3.15.3-dev.20260914100347 → 3.15.3-dev.20260916211208
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 +1 -0
- package/dist/.build-fingerprint +1 -1
- package/dist/__test-utils__/approval-contract/types.d.ts +1 -1
- package/dist/__test-utils__/hermetic-activity.d.ts +61 -7
- package/dist/__test-utils__/hermetic-activity.js +100 -9
- package/dist/__test-utils__/hermetic-activity.js.map +1 -1
- package/dist/__test-utils__/model-registry-fixture.d.ts +22 -3
- package/dist/__test-utils__/model-registry-fixture.js +22 -7
- package/dist/__test-utils__/model-registry-fixture.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.d.ts +2 -2
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.js +14 -11
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/fold.d.ts +61 -0
- package/dist/activities/execute-cursor/__test-utils__/fold.js +94 -0
- package/dist/activities/execute-cursor/__test-utils__/fold.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js +1 -1
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.d.ts +52 -14
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +46 -12
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.d.ts +21 -28
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js +27 -11
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.d.ts +70 -26
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js +82 -32
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js.map +1 -1
- package/dist/activities/execute-cursor/adapter.d.ts +8 -7
- package/dist/activities/execute-cursor/adapter.js +13 -9
- package/dist/activities/execute-cursor/adapter.js.map +1 -1
- package/dist/activities/execute-cursor/approval-policy.d.ts +10 -10
- package/dist/activities/execute-cursor/approval-policy.js +12 -23
- package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
- package/dist/activities/execute-cursor/approval-state.d.ts +35 -1
- package/dist/activities/execute-cursor/approval-state.js +65 -0
- package/dist/activities/execute-cursor/approval-state.js.map +1 -1
- package/dist/activities/execute-cursor/{message-translator.d.ts → boundary-rows.d.ts} +45 -341
- package/dist/activities/execute-cursor/boundary-rows.js +1018 -0
- package/dist/activities/execute-cursor/boundary-rows.js.map +1 -0
- package/dist/activities/execute-cursor/cursor-capabilities.d.ts +1 -1
- package/dist/activities/execute-cursor/cursor-capabilities.js +1 -1
- package/dist/activities/execute-cursor/cursor-event-recorder.d.ts +33 -14
- package/dist/activities/execute-cursor/cursor-event-recorder.js +43 -21
- package/dist/activities/execute-cursor/cursor-event-recorder.js.map +1 -1
- package/dist/activities/execute-cursor/prompt-builder.d.ts +3 -3
- package/dist/activities/execute-cursor/prompt-builder.js +4 -4
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
- package/dist/activities/execute-cursor/sdk-warmup.d.ts +15 -6
- package/dist/activities/execute-cursor/sdk-warmup.js +15 -6
- package/dist/activities/execute-cursor/sdk-warmup.js.map +1 -1
- package/dist/activities/execute-cursor/service-tier.js +1 -2
- package/dist/activities/execute-cursor/service-tier.js.map +1 -1
- package/dist/activities/execute-cursor/session-lifecycle.d.ts +38 -59
- package/dist/activities/execute-cursor/session-lifecycle.js +59 -96
- package/dist/activities/execute-cursor/session-lifecycle.js.map +1 -1
- package/dist/activities/execute-cursor/session-store.d.ts +100 -0
- package/dist/activities/execute-cursor/session-store.js +157 -0
- package/dist/activities/execute-cursor/session-store.js.map +1 -0
- package/dist/activities/execute-cursor/sub-agent-steps.d.ts +79 -0
- package/dist/activities/execute-cursor/sub-agent-steps.js +180 -0
- package/dist/activities/execute-cursor/sub-agent-steps.js.map +1 -0
- package/dist/activities/execute-cursor/tool-result.d.ts +49 -0
- package/dist/activities/execute-cursor/tool-result.js +130 -0
- package/dist/activities/execute-cursor/tool-result.js.map +1 -0
- package/dist/activities/execute-cursor/translator.d.ts +178 -0
- package/dist/activities/execute-cursor/translator.js +485 -0
- package/dist/activities/execute-cursor/translator.js.map +1 -0
- package/dist/activities/execute-cursor/turn-boundary.d.ts +15 -5
- package/dist/activities/execute-cursor/turn-boundary.js +10 -14
- package/dist/activities/execute-cursor/turn-boundary.js.map +1 -1
- package/dist/activities/execute-cursor/turn-settle.d.ts +11 -7
- package/dist/activities/execute-cursor/turn-settle.js +47 -34
- package/dist/activities/execute-cursor/turn-settle.js.map +1 -1
- package/dist/activities/execute-cursor/turn-setup.d.ts +2 -2
- package/dist/activities/execute-cursor/turn-setup.js +5 -5
- package/dist/activities/execute-cursor/turn-setup.js.map +1 -1
- package/dist/activities/execute-cursor/turn-stream.d.ts +23 -14
- package/dist/activities/execute-cursor/turn-stream.js +41 -28
- package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
- package/dist/activities/execute-cursor/turn.d.ts +4 -4
- package/dist/activities/execute-cursor/turn.js +5 -5
- package/dist/activities/execute-cursor/usage-pricing.d.ts +2 -2
- package/dist/activities/execute-cursor/usage-pricing.js +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.d.ts +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.js +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.d.ts +16 -11
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js +22 -10
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.d.ts +2 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js +2 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.d.ts +12 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js +18 -4
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.d.ts +10 -1
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js +24 -11
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js.map +1 -1
- package/dist/activities/execute-deep-agent/adapter.d.ts +1 -1
- package/dist/activities/execute-deep-agent/adapter.js +1 -1
- package/dist/activities/execute-deep-agent/approval-file-change.d.ts +19 -19
- package/dist/activities/execute-deep-agent/approval-file-change.js +16 -15
- package/dist/activities/execute-deep-agent/approval-file-change.js.map +1 -1
- package/dist/activities/execute-deep-agent/deep-agent-capabilities.d.ts +2 -2
- package/dist/activities/execute-deep-agent/deep-agent-capabilities.js +2 -2
- package/dist/activities/execute-deep-agent/hitl.d.ts +2 -2
- package/dist/activities/execute-deep-agent/hitl.js +2 -2
- package/dist/activities/execute-deep-agent/inline-publisher.d.ts +13 -3
- package/dist/activities/execute-deep-agent/inline-publisher.js +3 -3
- package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +3 -3
- package/dist/activities/execute-deep-agent/prompt-builder.js +6 -7
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +16 -8
- package/dist/activities/execute-deep-agent/streaming-side-effects.js +20 -33
- package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
- package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +3 -3
- package/dist/activities/execute-deep-agent/subagent-transformer.js +1 -1
- package/dist/activities/execute-deep-agent/translator.d.ts +134 -0
- package/dist/activities/execute-deep-agent/translator.js +418 -0
- package/dist/activities/execute-deep-agent/translator.js.map +1 -0
- package/dist/activities/execute-deep-agent/turn-settle.d.ts +13 -7
- package/dist/activities/execute-deep-agent/turn-settle.js +34 -45
- package/dist/activities/execute-deep-agent/turn-settle.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-setup.d.ts +8 -8
- package/dist/activities/execute-deep-agent/turn-setup.js +7 -7
- package/dist/activities/execute-deep-agent/turn-stream.d.ts +13 -10
- package/dist/activities/execute-deep-agent/turn-stream.js +44 -41
- package/dist/activities/execute-deep-agent/turn-stream.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn.d.ts +3 -3
- package/dist/activities/execute-deep-agent/turn.js +3 -3
- package/dist/config.d.ts +2 -2
- package/dist/harness/approval-decisions.d.ts +1 -1
- package/dist/harness/approval-decisions.js +1 -1
- package/dist/harness/capabilities.d.ts +21 -11
- package/dist/harness/capabilities.js +2 -2
- package/dist/harness/capture.d.ts +4 -4
- package/dist/harness/capture.js +4 -4
- package/dist/harness/persist-chokepoint.d.ts +3 -3
- package/dist/harness/persist-chokepoint.js +3 -3
- package/dist/harness/registry.d.ts +2 -2
- package/dist/harness/registry.js +2 -2
- package/dist/harness/run-turn.d.ts +6 -4
- package/dist/harness/run-turn.js +31 -9
- package/dist/harness/run-turn.js.map +1 -1
- package/dist/harness/stop-controller.d.ts +1 -1
- package/dist/harness/stop-controller.js +1 -1
- package/dist/harness/terminal-table.d.ts +7 -7
- package/dist/harness/terminal-table.js +7 -7
- package/dist/harness/transcript/builder.d.ts +182 -0
- package/dist/harness/transcript/builder.js +693 -0
- package/dist/harness/transcript/builder.js.map +1 -0
- package/dist/harness/transcript/events.d.ts +218 -0
- package/dist/harness/transcript/events.js +50 -0
- package/dist/harness/transcript/events.js.map +1 -0
- package/dist/harness/transcript/state.d.ts +110 -0
- package/dist/harness/transcript/state.js +148 -0
- package/dist/harness/transcript/state.js.map +1 -0
- package/dist/harness/turn-context.d.ts +54 -38
- package/dist/harness/turn-context.js +42 -43
- package/dist/harness/turn-context.js.map +1 -1
- package/dist/harness/types.d.ts +63 -22
- package/dist/harness/types.js +12 -11
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/usage-accumulator.d.ts +2 -2
- package/dist/harness/usage-accumulator.js +2 -2
- package/dist/harness-adapters.d.ts +5 -4
- package/dist/harness-adapters.js +5 -4
- package/dist/harness-adapters.js.map +1 -1
- package/dist/middleware/approval-gate.d.ts +6 -0
- package/dist/middleware/approval-gate.js +7 -57
- package/dist/middleware/approval-gate.js.map +1 -1
- package/dist/middleware/cost-advisory.d.ts +3 -3
- package/dist/middleware/cost-advisory.js +3 -3
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/runner-manager.js +1 -1
- package/dist/runner-manager.js.map +1 -1
- package/dist/shared/approval-policy.d.ts +53 -0
- package/dist/shared/approval-policy.js +76 -0
- package/dist/shared/approval-policy.js.map +1 -1
- package/dist/shared/args-preview.d.ts +45 -22
- package/dist/shared/args-preview.js +51 -41
- package/dist/shared/args-preview.js.map +1 -1
- package/dist/shared/attachment-resolver.d.ts +4 -4
- package/dist/shared/attachment-resolver.js +4 -4
- package/dist/shared/attachment-vision.d.ts +2 -1
- package/dist/shared/attachment-vision.js.map +1 -1
- package/dist/shared/attachment-zip.d.ts +2 -2
- package/dist/shared/attachment-zip.js +2 -2
- package/dist/shared/cost-guard.d.ts +2 -2
- package/dist/shared/cost-guard.js +2 -2
- package/dist/shared/exact-apply.d.ts +1 -1
- package/dist/shared/exact-apply.js +1 -1
- package/dist/shared/execution-context.d.ts +2 -2
- package/dist/shared/execution-context.js +2 -2
- package/dist/shared/extract-structured-output.d.ts +2 -2
- package/dist/shared/extract-structured-output.js +2 -2
- package/dist/shared/filereview/cas-touched.d.ts +2 -2
- package/dist/shared/filereview/cas-touched.js +2 -2
- package/dist/shared/heartbeat.d.ts +1 -1
- package/dist/shared/heartbeat.js +1 -1
- package/dist/shared/llm-backend.d.ts +0 -4
- package/dist/shared/llm-backend.js +0 -4
- package/dist/shared/llm-backend.js.map +1 -1
- package/dist/shared/model-error.d.ts +1 -2
- package/dist/shared/model-error.js +1 -2
- package/dist/shared/model-error.js.map +1 -1
- package/dist/shared/persist-decision.d.ts +18 -24
- package/dist/shared/persist-decision.js +19 -11
- package/dist/shared/persist-decision.js.map +1 -1
- package/dist/shared/prompt-sections.d.ts +4 -4
- package/dist/shared/prompt-sections.js +4 -4
- package/dist/shared/skill-resolver.d.ts +3 -3
- package/dist/shared/skill-resolver.js +3 -3
- package/dist/shared/status-offload.d.ts +1 -1
- package/dist/shared/status-offload.js +2 -2
- package/dist/shared/status-offload.js.map +1 -1
- package/dist/shared/streaming-scheduler.d.ts +2 -7
- package/dist/shared/streaming-scheduler.js +6 -14
- package/dist/shared/streaming-scheduler.js.map +1 -1
- package/dist/shared/subagent-rows.d.ts +2 -2
- package/dist/shared/subagent-rows.js +2 -2
- package/dist/shared/todos.d.ts +3 -3
- package/dist/shared/todos.js +3 -3
- package/dist/shared/tool-row.d.ts +19 -1
- package/dist/shared/tool-row.js +36 -2
- package/dist/shared/tool-row.js.map +1 -1
- package/dist/shared/worker-shutdown.d.ts +1 -1
- package/dist/shared/worker-shutdown.js +1 -1
- package/dist/shared/workspace/session-provision.d.ts +1 -1
- package/dist/shared/workspace/session-provision.js +1 -1
- package/dist/shared/workspace/sources/empty.d.ts +1 -1
- package/dist/shared/workspace/sources/empty.js +1 -2
- package/dist/shared/workspace/sources/empty.js.map +1 -1
- package/dist/shared/workspace/sources/git.js +4 -4
- package/dist/shared/workspace/sources/git.js.map +1 -1
- package/dist/shared/workspace/sources/local-path.js +6 -6
- package/dist/shared/workspace/sources/local-path.js.map +1 -1
- package/dist/shared/workspace/stigmer-link.d.ts +1 -1
- package/dist/shared/workspace/stigmer-link.js +1 -1
- package/dist/shared/workspace/types.d.ts +2 -5
- package/dist/shared/workspace/types.js +0 -6
- package/dist/shared/workspace/types.js.map +1 -1
- package/dist/shared/workspace/writeback-coordinator.d.ts +17 -4
- package/dist/shared/workspace/writeback-coordinator.js +7 -9
- package/dist/shared/workspace/writeback-coordinator.js.map +1 -1
- package/package.json +5 -5
- package/src/__test-utils__/__tests__/execution-record-barrier.test.ts +70 -0
- package/src/__test-utils__/__tests__/harness-contract-self-check.test.ts +35 -1
- package/src/__test-utils__/approval-contract/contract.ts +1 -1
- package/src/__test-utils__/approval-contract/types.ts +1 -1
- package/src/__test-utils__/harness-boot-order-child.ts +1 -1
- package/src/__test-utils__/harness-contract/contract.ts +8 -8
- package/src/__test-utils__/harness-contract/recording-sink.ts +11 -1
- package/src/__test-utils__/harness-contract/runtime-contract.ts +52 -16
- package/src/__test-utils__/harness-contract/scripted-adapter.ts +47 -43
- package/src/__test-utils__/hermetic-activity.ts +113 -9
- package/src/__test-utils__/model-registry-fixture.ts +31 -7
- package/src/__test-utils__/module-specifiers.ts +32 -3
- package/src/__tests__/harness-boot-order.test.ts +1 -1
- package/src/__tests__/harness-contract.test.ts +1 -1
- package/src/__tests__/runner-manager.test.ts +1 -1
- package/src/activities/execute-cursor/__test-utils__/__tests__/scripted-double.test.ts +32 -8
- package/src/activities/execute-cursor/__test-utils__/contract-subject.ts +12 -10
- package/src/activities/execute-cursor/__test-utils__/fold.ts +116 -0
- package/src/activities/execute-cursor/__test-utils__/gateway-substrate.ts +1 -1
- package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +72 -19
- package/src/activities/execute-cursor/__test-utils__/scripted-agent.ts +35 -29
- package/src/activities/execute-cursor/__test-utils__/scripted-sdk.ts +94 -38
- package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/approval-state.test.ts +14 -21
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +3 -3
- package/src/activities/execute-cursor/__tests__/coarse-fingerprint.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/cursor-baseurl-routing.test.ts +10 -8
- package/src/activities/execute-cursor/__tests__/cursor-event-recorder.test.ts +142 -0
- package/src/activities/execute-cursor/__tests__/cursor-fetch-interceptor-bypass.test.ts +24 -12
- package/src/activities/execute-cursor/__tests__/cursor-generate-image-live.test.ts +7 -2
- package/src/activities/execute-cursor/__tests__/cursor-hook-protocol-live.test.ts +163 -0
- package/src/activities/execute-cursor/__tests__/cursor-sdk-auth-smoke.test.ts +23 -20
- package/src/activities/execute-cursor/__tests__/cursor-transcript-live.test.ts +298 -0
- package/src/activities/execute-cursor/__tests__/deny-gate-exact-apply.test.ts +4 -2
- package/src/activities/execute-cursor/__tests__/fetch-interceptor.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/deny-and-retry.test.ts +5 -2
- package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +5 -2
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/mcp-tool-call.status.json +71 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/sdk-task-note.status.json +73 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.error-delta.status.json +78 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.output-first.status.json +72 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.status.json +72 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/sub-agent-delegation.status.json +109 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/thinking-turn.status.json +78 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/todo-write.status.json +119 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-error.status.json +68 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-only-step.status.json +67 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/harness-contract.test.ts +10 -7
- package/src/activities/execute-cursor/__tests__/hermetic/mcp-tool-call.test.ts +146 -0
- package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +8 -5
- package/src/activities/execute-cursor/__tests__/hermetic/plain-turn.test.ts +6 -2
- package/src/activities/execute-cursor/__tests__/hermetic/recovery-fresh-agent.test.ts +4 -1
- package/src/activities/execute-cursor/__tests__/hermetic/run-wait-arms.test.ts +6 -2
- package/src/activities/execute-cursor/__tests__/hermetic/sdk-task-note.test.ts +122 -0
- package/src/activities/execute-cursor/__tests__/hermetic/shell-output-delta.test.ts +276 -0
- package/src/activities/execute-cursor/__tests__/hermetic/stream-self-stop-arms.test.ts +12 -9
- package/src/activities/execute-cursor/__tests__/hermetic/sub-agent-delegation.test.ts +196 -0
- package/src/activities/execute-cursor/__tests__/hermetic/thinking-turn.test.ts +145 -0
- package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +4 -1
- package/src/activities/execute-cursor/__tests__/hermetic/todo-write.test.ts +165 -0
- package/src/activities/execute-cursor/__tests__/hermetic/tool-call.test.ts +7 -4
- package/src/activities/execute-cursor/__tests__/hermetic/tool-error.test.ts +138 -0
- package/src/activities/execute-cursor/__tests__/hermetic/tool-only-step.test.ts +130 -0
- package/src/activities/execute-cursor/__tests__/hermetic/unattributed-hook-block.test.ts +17 -2
- package/src/activities/execute-cursor/__tests__/hermetic/workspace-lock-timeout.test.ts +5 -2
- package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +43 -60
- package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +23 -28
- package/src/activities/execute-cursor/__tests__/hook-script.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/http2-interceptor.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/prompt-goldens.test.ts +5 -5
- package/src/activities/execute-cursor/__tests__/same-identity-reproposal.test.ts +11 -13
- package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +8 -11
- package/src/activities/execute-cursor/__tests__/session-lifecycle.test.ts +86 -58
- package/src/activities/execute-cursor/__tests__/session-store.test.ts +220 -0
- package/src/activities/execute-cursor/__tests__/tool-result-image.test.ts +8 -22
- package/src/activities/execute-cursor/__tests__/translator.test.ts +594 -0
- package/src/activities/execute-cursor/__tests__/turn-boundary.test.ts +8 -5
- package/src/activities/execute-cursor/__tests__/turn-stream.test.ts +87 -63
- package/src/activities/execute-cursor/adapter.ts +13 -9
- package/src/activities/execute-cursor/approval-policy.ts +12 -24
- package/src/activities/execute-cursor/approval-state.ts +66 -1
- package/src/activities/execute-cursor/boundary-rows.ts +1132 -0
- package/src/activities/execute-cursor/cursor-capabilities.ts +1 -1
- package/src/activities/execute-cursor/cursor-event-recorder.ts +57 -28
- package/src/activities/execute-cursor/fetch-interceptor.ts +1 -1
- package/src/activities/execute-cursor/http2-interceptor.ts +1 -1
- package/src/activities/execute-cursor/prompt-builder.ts +6 -6
- package/src/activities/execute-cursor/sdk-warmup.ts +15 -6
- package/src/activities/execute-cursor/service-tier.ts +1 -2
- package/src/activities/execute-cursor/session-lifecycle.ts +63 -109
- package/src/activities/execute-cursor/session-store.ts +187 -0
- package/src/activities/execute-cursor/sub-agent-steps.ts +188 -0
- package/src/activities/execute-cursor/tool-result.ts +128 -0
- package/src/activities/execute-cursor/translator.ts +541 -0
- package/src/activities/execute-cursor/turn-boundary.ts +21 -14
- package/src/activities/execute-cursor/turn-settle.ts +46 -34
- package/src/activities/execute-cursor/turn-setup.ts +5 -5
- package/src/activities/execute-cursor/turn-stream.ts +49 -46
- package/src/activities/execute-cursor/turn.ts +5 -5
- package/src/activities/execute-cursor/usage-pricing.ts +2 -2
- package/src/activities/execute-deep-agent/__test-utils__/contract-subject.ts +2 -2
- package/src/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.ts +23 -11
- package/src/activities/execute-deep-agent/__test-utils__/hitl-script.ts +1 -1
- package/src/activities/execute-deep-agent/__test-utils__/scripted-model-module.ts +2 -3
- package/src/activities/execute-deep-agent/__test-utils__/scripted-model.ts +25 -4
- package/src/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.ts +25 -11
- package/src/activities/execute-deep-agent/__tests__/adapter-graph-is-sdk-free.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/adapter-is-temporal-free.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/approval-file-change.test.ts +6 -17
- package/src/activities/execute-deep-agent/__tests__/hermetic/file-review-capture.test.ts +25 -8
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn1.status.json +2 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn2.status.json +4 -14
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/file-review-capture.status.json +4 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/gate.turn1.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn1.status.json +2 -9
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn2.status.json +2 -9
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.after-tool.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.mid-tool.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/platform-stop.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/recursion-limit.persisted.status.json +109 -76
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/reject.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn2.status.json +2 -10
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn3.status.json +2 -10
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/skip.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sub-agent-delegation.status.json +3 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/tool-call.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/worker-shutdown.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/write-todos.status.json +92 -0
- package/src/activities/execute-deep-agent/__tests__/hermetic/harness-contract.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-approve-all-lease.test.ts +9 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-round-trips.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-sequential-gates.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/inline-artifact-across-gate.test.ts +7 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/pause-vs-shutdown.test.ts +10 -11
- package/src/activities/execute-deep-agent/__tests__/hermetic/plain-turn.test.ts +4 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/platform-stop.test.ts +9 -8
- package/src/activities/execute-deep-agent/__tests__/hermetic/recursion-limit.test.ts +21 -13
- package/src/activities/execute-deep-agent/__tests__/hermetic/resolution-error.test.ts +2 -2
- package/src/activities/execute-deep-agent/__tests__/hermetic/structured-output.test.ts +7 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/sub-agent-delegation.test.ts +28 -12
- package/src/activities/execute-deep-agent/__tests__/hermetic/tool-call.test.ts +21 -21
- package/src/activities/execute-deep-agent/__tests__/hermetic/workspace-lock-timeout.test.ts +5 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/write-todos.test.ts +160 -0
- package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +35 -30
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +3 -4
- package/src/activities/execute-deep-agent/__tests__/prompt-goldens.test.ts +12 -10
- package/src/activities/execute-deep-agent/__tests__/scripted-model.test.ts +13 -3
- package/src/activities/execute-deep-agent/__tests__/streaming-side-effects.test.ts +26 -18
- package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/{subagent-tracker.test.ts → translator-subagents.test.ts} +76 -57
- package/src/activities/execute-deep-agent/__tests__/{v3-status-builder.test.ts → translator-through-builder.test.ts} +213 -299
- package/src/activities/execute-deep-agent/__tests__/translator.test.ts +505 -0
- package/src/activities/execute-deep-agent/__tests__/turn-stream.test.ts +11 -29
- package/src/activities/execute-deep-agent/adapter.ts +1 -1
- package/src/activities/execute-deep-agent/approval-file-change.ts +20 -22
- package/src/activities/execute-deep-agent/deep-agent-capabilities.ts +2 -2
- package/src/activities/execute-deep-agent/hitl.ts +2 -2
- package/src/activities/execute-deep-agent/inline-publisher.ts +16 -5
- package/src/activities/execute-deep-agent/prompt-builder.ts +6 -7
- package/src/activities/execute-deep-agent/streaming-side-effects.ts +22 -31
- package/src/activities/execute-deep-agent/subagent-transformer.ts +3 -3
- package/src/activities/execute-deep-agent/translator.ts +463 -0
- package/src/activities/execute-deep-agent/turn-settle.ts +35 -43
- package/src/activities/execute-deep-agent/turn-setup.ts +8 -8
- package/src/activities/execute-deep-agent/turn-stream.ts +53 -51
- package/src/activities/execute-deep-agent/turn.ts +3 -3
- package/src/config.ts +2 -2
- package/src/harness/README.md +335 -0
- package/src/harness/__tests__/approval-decisions.test.ts +2 -2
- package/src/harness/__tests__/capture.test.ts +3 -3
- package/src/harness/__tests__/import-direction.test.ts +3 -2
- package/src/harness/__tests__/mount-skills.test.ts +4 -1
- package/src/harness/__tests__/readme-index.test.ts +339 -0
- package/src/harness/__tests__/run-turn.test.ts +131 -6
- package/src/harness/__tests__/transcript-is-engine-free.test.ts +83 -0
- package/src/harness/__tests__/transcript-writers.test.ts +191 -0
- package/src/harness/__tests__/turn-attachments-vision.test.ts +5 -2
- package/src/harness/__tests__/turn-context.test.ts +5 -5
- package/src/harness/approval-decisions.ts +1 -1
- package/src/harness/capabilities.ts +21 -11
- package/src/harness/capture.ts +4 -4
- package/src/harness/persist-chokepoint.ts +3 -3
- package/src/harness/registry.ts +2 -2
- package/src/harness/run-turn.ts +33 -9
- package/src/harness/stop-controller.ts +1 -1
- package/src/harness/terminal-table.ts +7 -7
- package/src/harness/transcript/__tests__/builder.test.ts +975 -0
- package/src/harness/transcript/__tests__/state.test.ts +143 -0
- package/src/harness/transcript/builder.ts +755 -0
- package/src/harness/transcript/events.ts +262 -0
- package/src/harness/transcript/state.ts +167 -0
- package/src/harness/turn-context.ts +61 -46
- package/src/harness/types.ts +64 -22
- package/src/harness/usage-accumulator.ts +2 -2
- package/src/harness-adapters.ts +5 -4
- package/src/middleware/__tests__/cost-advisory.test.ts +2 -2
- package/src/middleware/approval-gate.ts +7 -74
- package/src/middleware/cost-advisory.ts +3 -3
- package/src/middleware/index.ts +1 -1
- package/src/runner-manager.ts +1 -1
- package/src/shared/__tests__/approval-policy.test.ts +45 -0
- package/src/shared/__tests__/args-preview.test.ts +40 -20
- package/src/shared/__tests__/attachment-naming.test.ts +1 -1
- package/src/shared/__tests__/attachment-resolver.test.ts +5 -5
- package/src/shared/__tests__/attachment-zip.test.ts +1 -1
- package/src/shared/__tests__/blueprint-resolver.test.ts +1 -1
- package/src/shared/__tests__/cost-guard.test.ts +1 -1
- package/src/shared/__tests__/exact-apply.test.ts +2 -1
- package/src/shared/__tests__/persist-decision.test.ts +19 -33
- package/src/shared/__tests__/prompt-sections.test.ts +1 -1
- package/src/shared/__tests__/stamp-flowed-rows.test.ts +1 -1
- package/src/shared/__tests__/status-offload.test.ts +1 -1
- package/src/shared/__tests__/streaming-scheduler.test.ts +8 -9
- package/src/shared/__tests__/todos.test.ts +1 -1
- package/src/shared/__tests__/tool-row.test.ts +1 -1
- package/src/shared/approval-policy.ts +95 -0
- package/src/shared/args-preview.ts +51 -42
- package/src/shared/attachment-resolver.ts +4 -4
- package/src/shared/attachment-vision.ts +2 -1
- package/src/shared/attachment-zip.ts +2 -2
- package/src/shared/cost-guard.ts +2 -2
- package/src/shared/exact-apply.ts +1 -1
- package/src/shared/execution-context.ts +2 -2
- package/src/shared/extract-structured-output.ts +2 -2
- package/src/shared/filereview/__tests__/capture.test.ts +9 -5
- package/src/shared/filereview/__tests__/git-substrate.test.ts +4 -1
- package/src/shared/filereview/__tests__/proxy-reconcile.test.ts +3 -3
- package/src/shared/filereview/cas-touched.ts +2 -2
- package/src/shared/heartbeat.ts +1 -1
- package/src/shared/llm-backend.ts +0 -4
- package/src/shared/model-error.ts +1 -2
- package/src/shared/persist-decision.ts +19 -28
- package/src/shared/prompt-sections.ts +4 -4
- package/src/shared/skill-resolver.ts +3 -3
- package/src/shared/status-offload.ts +2 -2
- package/src/shared/streaming-scheduler.ts +8 -13
- package/src/shared/subagent-rows.ts +2 -2
- package/src/shared/todos.ts +3 -3
- package/src/shared/tool-row.ts +38 -2
- package/src/shared/worker-shutdown.ts +1 -1
- package/src/shared/workspace/__tests__/git-source.test.ts +3 -3
- package/src/shared/workspace/__tests__/provisioner.test.ts +5 -5
- package/src/shared/workspace/__tests__/session-provision.test.ts +2 -2
- package/src/shared/workspace/__tests__/writeback-coordinator.integration.test.ts +8 -9
- package/src/shared/workspace/__tests__/writeback-coordinator.test.ts +25 -25
- package/src/shared/workspace/provisioner.ts +1 -1
- package/src/shared/workspace/session-provision.ts +1 -1
- package/src/shared/workspace/sources/empty.ts +2 -2
- package/src/shared/workspace/sources/git.ts +3 -4
- package/src/shared/workspace/sources/local-path.ts +5 -6
- package/src/shared/workspace/stigmer-link.ts +1 -1
- package/src/shared/workspace/types.ts +2 -5
- package/src/shared/workspace/writeback-coordinator.ts +23 -12
- package/dist/activities/execute-cursor/delta-enricher.d.ts +0 -87
- package/dist/activities/execute-cursor/delta-enricher.js +0 -265
- package/dist/activities/execute-cursor/delta-enricher.js.map +0 -1
- package/dist/activities/execute-cursor/message-translator.js +0 -2040
- package/dist/activities/execute-cursor/message-translator.js.map +0 -1
- package/dist/activities/execute-cursor/todo-tracker.d.ts +0 -40
- package/dist/activities/execute-cursor/todo-tracker.js +0 -80
- package/dist/activities/execute-cursor/todo-tracker.js.map +0 -1
- package/dist/activities/execute-deep-agent/execution-state.d.ts +0 -54
- package/dist/activities/execute-deep-agent/execution-state.js +0 -68
- package/dist/activities/execute-deep-agent/execution-state.js.map +0 -1
- package/dist/activities/execute-deep-agent/status-builder-shared.d.ts +0 -65
- package/dist/activities/execute-deep-agent/status-builder-shared.js +0 -90
- package/dist/activities/execute-deep-agent/status-builder-shared.js.map +0 -1
- package/dist/activities/execute-deep-agent/subagent-tracker.d.ts +0 -113
- package/dist/activities/execute-deep-agent/subagent-tracker.js +0 -400
- package/dist/activities/execute-deep-agent/subagent-tracker.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-events.d.ts +0 -102
- package/dist/activities/execute-deep-agent/v3-events.js +0 -35
- package/dist/activities/execute-deep-agent/v3-events.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.d.ts +0 -15
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js +0 -235
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-status-builder.d.ts +0 -111
- package/dist/activities/execute-deep-agent/v3-status-builder.js +0 -457
- package/dist/activities/execute-deep-agent/v3-status-builder.js.map +0 -1
- package/dist/shared/execution-status-writer.d.ts +0 -31
- package/dist/shared/execution-status-writer.js +0 -43
- package/dist/shared/execution-status-writer.js.map +0 -1
- package/src/activities/execute-cursor/__tests__/delta-enricher.test.ts +0 -310
- package/src/activities/execute-cursor/__tests__/message-translator.test.ts +0 -1033
- package/src/activities/execute-cursor/__tests__/todo-tracker.test.ts +0 -498
- package/src/activities/execute-cursor/delta-enricher.ts +0 -307
- package/src/activities/execute-cursor/message-translator.ts +0 -2319
- package/src/activities/execute-cursor/todo-tracker.ts +0 -91
- package/src/activities/execute-deep-agent/__tests__/execution-state-extended.test.ts +0 -148
- package/src/activities/execute-deep-agent/__tests__/execution-state.test.ts +0 -154
- package/src/activities/execute-deep-agent/__tests__/status-builder-shared.test.ts +0 -47
- package/src/activities/execute-deep-agent/__tests__/v3-protocol-normalizer.test.ts +0 -324
- package/src/activities/execute-deep-agent/execution-state.ts +0 -78
- package/src/activities/execute-deep-agent/status-builder-shared.ts +0 -142
- package/src/activities/execute-deep-agent/subagent-tracker.ts +0 -479
- package/src/activities/execute-deep-agent/v3-events.ts +0 -153
- package/src/activities/execute-deep-agent/v3-protocol-normalizer.ts +0 -264
- package/src/activities/execute-deep-agent/v3-status-builder.ts +0 -565
- package/src/shared/execution-status-writer.ts +0 -56
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
* knows are reported through the sink exactly as the orchestrator reported
|
|
26
26
|
* them (the resolution labels are the runtime's).
|
|
27
27
|
*
|
|
28
|
-
* One root for everything
|
|
28
|
+
* One root for everything: the deepagents backend, the CAS
|
|
29
29
|
* observer, the gate's path normalization and the publisher are all rooted
|
|
30
30
|
* at `workspace.primaryDir` — the same tree the runtime locks, links and
|
|
31
31
|
* captures. For zero or one workspace entry this is byte-identical to the
|
|
32
32
|
* orchestrator's `workspaceBackend.rootDir`.
|
|
33
33
|
*
|
|
34
34
|
* Moved from `setup.ts` `performSetup` (the LangGraph half; the resolution
|
|
35
|
-
* half is the runtime's twelve phases)
|
|
35
|
+
* half is the runtime's twelve phases) in #1096; the step bodies are the
|
|
36
36
|
* orchestrator's, verbatim where nothing changed.
|
|
37
37
|
*/
|
|
38
38
|
import type { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
|
|
@@ -52,7 +52,7 @@ import { CasCaptureObserver } from "./cas-capture-observer.js";
|
|
|
52
52
|
* (`execute-cursor/turn-setup.ts` `CursorAdapterConfig` is the idiom): a
|
|
53
53
|
* whole `Config` satisfies it, a test constructs these fields and nothing
|
|
54
54
|
* else. Smaller than the orchestrator's reach — the synthesized attachments'
|
|
55
|
-
* endpoints it read are the runtime's now (
|
|
55
|
+
* endpoints it read are the runtime's now (since #1096).
|
|
56
56
|
*/
|
|
57
57
|
export type DeepAgentAdapterConfig = Pick<Config, "checkpointerType" | "checkpointerProxyEndpoint" | "stigmerToken" | "proxyEndpoint" | "mode">;
|
|
58
58
|
/** The deepagents graph as this module holds it; deepagents exports no stable type for the compiled agent. */
|
|
@@ -109,8 +109,8 @@ export type DeepAgentGraphInput = {
|
|
|
109
109
|
* spec named none — the one reader of `spec.executionConfig.modelName`, which
|
|
110
110
|
* the Cursor adapter reads too), or the registry's default for `"default"`.
|
|
111
111
|
* The same reading the runtime's attachment phase made for the vision budget,
|
|
112
|
-
* so the model that sees the images is the model that runs. (Until
|
|
113
|
-
* read the spec field beside the runtime's resolved copy
|
|
112
|
+
* so the model that sees the images is the model that runs. (Until #1096 this
|
|
113
|
+
* read the spec field beside the runtime's resolved copy.)
|
|
114
114
|
*/
|
|
115
115
|
export declare function resolveModelName(input: TurnInput): Promise<string>;
|
|
116
116
|
/**
|
|
@@ -122,7 +122,7 @@ export declare function resolveModelName(input: TurnInput): Promise<string>;
|
|
|
122
122
|
export declare function openCheckpointer(input: TurnInput, sink: TurnSink, config: DeepAgentAdapterConfig): Promise<BaseCheckpointSaver>;
|
|
123
123
|
/**
|
|
124
124
|
* The workspace as the engine sees it, rooted at the runtime's primary tree
|
|
125
|
-
* (
|
|
125
|
+
* (the one root). The platform dir the shared provision ensured rides along so
|
|
126
126
|
* the backend routes `.stigmer/…` reads to it.
|
|
127
127
|
*
|
|
128
128
|
* CAS capture (design docs 08/11/12): the single per-turn observer owns the
|
|
@@ -143,7 +143,7 @@ export declare function buildDeepAgentWorkspace(input: TurnInput): DeepAgentWork
|
|
|
143
143
|
* refuses an empty config, which is what the orchestrator's MCP gate
|
|
144
144
|
* (`mcp-gate.ts`) guarded against beside its channel-only reason; the
|
|
145
145
|
* runtime resolves unconditionally, so the one remaining question is
|
|
146
|
-
* "anything to connect?" (
|
|
146
|
+
* "anything to connect?" (since #1096).
|
|
147
147
|
*/
|
|
148
148
|
export declare function connectTools(input: TurnInput, sink: TurnSink): Promise<DeepAgentTools>;
|
|
149
149
|
/**
|
|
@@ -186,7 +186,7 @@ export declare function composeSystemPrompt(input: TurnInput, recalledMemories:
|
|
|
186
186
|
* stop on the invoke config and the budget middleware's ~80% advisory, so
|
|
187
187
|
* the warning and the enforcement can never disagree.
|
|
188
188
|
*
|
|
189
|
-
* Nothing in the middleware stack stops the run (
|
|
189
|
+
* Nothing in the middleware stack stops the run (since #1096):
|
|
190
190
|
* the runtime's abort is the platform's one stop, and its TERMINATED arm the
|
|
191
191
|
* one enforcement of `max_cost_usd`; the cost advisory warns the model at
|
|
192
192
|
* ~80% of the cap the way the budget middleware warns at ~80% of the
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
* knows are reported through the sink exactly as the orchestrator reported
|
|
26
26
|
* them (the resolution labels are the runtime's).
|
|
27
27
|
*
|
|
28
|
-
* One root for everything
|
|
28
|
+
* One root for everything: the deepagents backend, the CAS
|
|
29
29
|
* observer, the gate's path normalization and the publisher are all rooted
|
|
30
30
|
* at `workspace.primaryDir` — the same tree the runtime locks, links and
|
|
31
31
|
* captures. For zero or one workspace entry this is byte-identical to the
|
|
32
32
|
* orchestrator's `workspaceBackend.rootDir`.
|
|
33
33
|
*
|
|
34
34
|
* Moved from `setup.ts` `performSetup` (the LangGraph half; the resolution
|
|
35
|
-
* half is the runtime's twelve phases)
|
|
35
|
+
* half is the runtime's twelve phases) in #1096; the step bodies are the
|
|
36
36
|
* orchestrator's, verbatim where nothing changed.
|
|
37
37
|
*/
|
|
38
38
|
import { createDeepAgent } from "deepagents";
|
|
@@ -71,8 +71,8 @@ import { modelHasNativeThinking, transformAndCompileSubagents } from "./subagent
|
|
|
71
71
|
* spec named none — the one reader of `spec.executionConfig.modelName`, which
|
|
72
72
|
* the Cursor adapter reads too), or the registry's default for `"default"`.
|
|
73
73
|
* The same reading the runtime's attachment phase made for the vision budget,
|
|
74
|
-
* so the model that sees the images is the model that runs. (Until
|
|
75
|
-
* read the spec field beside the runtime's resolved copy
|
|
74
|
+
* so the model that sees the images is the model that runs. (Until #1096 this
|
|
75
|
+
* read the spec field beside the runtime's resolved copy.)
|
|
76
76
|
*/
|
|
77
77
|
export async function resolveModelName(input) {
|
|
78
78
|
return input.model.requested === "default" ? await getDefaultModel() : input.model.requested;
|
|
@@ -95,7 +95,7 @@ export async function openCheckpointer(input, sink, config) {
|
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* The workspace as the engine sees it, rooted at the runtime's primary tree
|
|
98
|
-
* (
|
|
98
|
+
* (the one root). The platform dir the shared provision ensured rides along so
|
|
99
99
|
* the backend routes `.stigmer/…` reads to it.
|
|
100
100
|
*
|
|
101
101
|
* CAS capture (design docs 08/11/12): the single per-turn observer owns the
|
|
@@ -129,7 +129,7 @@ export function buildDeepAgentWorkspace(input) {
|
|
|
129
129
|
* refuses an empty config, which is what the orchestrator's MCP gate
|
|
130
130
|
* (`mcp-gate.ts`) guarded against beside its channel-only reason; the
|
|
131
131
|
* runtime resolves unconditionally, so the one remaining question is
|
|
132
|
-
* "anything to connect?" (
|
|
132
|
+
* "anything to connect?" (since #1096).
|
|
133
133
|
*/
|
|
134
134
|
export async function connectTools(input, sink) {
|
|
135
135
|
if (input.mcp.servers.length === 0) {
|
|
@@ -231,7 +231,7 @@ export function composeSystemPrompt(input, recalledMemories) {
|
|
|
231
231
|
* stop on the invoke config and the budget middleware's ~80% advisory, so
|
|
232
232
|
* the warning and the enforcement can never disagree.
|
|
233
233
|
*
|
|
234
|
-
* Nothing in the middleware stack stops the run (
|
|
234
|
+
* Nothing in the middleware stack stops the run (since #1096):
|
|
235
235
|
* the runtime's abort is the platform's one stop, and its TERMINATED arm the
|
|
236
236
|
* one enforcement of `max_cost_usd`; the cost advisory warns the model at
|
|
237
237
|
* ~80% of the cap the way the budget middleware warns at ~80% of the
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* runtime's stall watchdog measures the engine; `reportUsage()` per parent
|
|
10
10
|
* `message_finish`, priced here at the registry's rates for the model the
|
|
11
11
|
* turn runs on (`shared/model-pricing.ts`), so the runtime accounts and
|
|
12
|
-
* enforces the cost cap and writes `streamingUsage
|
|
12
|
+
* enforces the cost cap and writes `streamingUsage`; `requestPersist()`
|
|
13
13
|
* where a discrete change or the streaming cadence says so
|
|
14
14
|
* (`shared/persist-decision.ts` over the builder's one dirty flag), AWAITED,
|
|
15
15
|
* so a platform STOP the runtime reads from that write aborts the signal
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* this loop never does). An error the aborted run throws is the abort itself
|
|
20
20
|
* and settles `interrupted`, never `failed`.
|
|
21
21
|
*
|
|
22
|
-
* WHEN the run is aborted
|
|
22
|
+
* WHEN the run is aborted: on the arrival of the next
|
|
23
23
|
* event — the graph's own step boundary — or after {@link STOP_GRACE_MS} if
|
|
24
24
|
* no event arrives. A LangGraph run aborted while a step is in flight leaves
|
|
25
25
|
* `@langchain/core` with an orphaned rejection (`AsyncGeneratorWithSetup`
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* here) is forced, and that one orphan is the price of unblocking it — the
|
|
35
35
|
* contract's bound on settling `interrupted` is what wins.
|
|
36
36
|
*
|
|
37
|
-
* Until
|
|
37
|
+
* Until #1096 this loop (`streaming-v3.ts`) armed its own 120 s stall
|
|
38
38
|
* check, pulsed the Temporal heartbeat every 2 s, read STOP from its own
|
|
39
39
|
* persist and activated a graceful-stop middleware on it, told a pause from
|
|
40
40
|
* the activity's cancellation signal, and wrote PAUSED, COMPLETED and
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
import type { TurnInput, TurnSink } from "../../harness/types.js";
|
|
48
48
|
import { InlinePublisher } from "./inline-publisher.js";
|
|
49
49
|
import { type V3ProtocolEvent } from "./v3-event-recorder.js";
|
|
50
|
-
import {
|
|
50
|
+
import { DeepAgentTranslator } from "./translator.js";
|
|
51
51
|
import type { DeepAgentEngine, DeepAgentGraphInput, DeepAgentWorkspace } from "./turn-setup.js";
|
|
52
52
|
/**
|
|
53
53
|
* The subset of the v3 `GraphRunStream` this loop consumes. Kept structural
|
|
@@ -71,14 +71,17 @@ export interface DeepAgentStreamResult {
|
|
|
71
71
|
readonly pendingPublishPromises: readonly Promise<void>[];
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
74
|
+
* This harness's transcript writers for one turn: the translator that turns
|
|
75
|
+
* the engine's events into canonical ones (over the gate's posture, so every
|
|
76
|
+
* tool start carries its attribution and gate answer), and the publisher
|
|
77
|
+
* that registers artifacts on the runtime's builder (`sink.transcript`, so
|
|
78
|
+
* a published artifact still dirties the next persist). The builder itself
|
|
79
|
+
* is the runtime's, one per turn, and is read from the sink where it is
|
|
80
|
+
* needed. Built by the adapter's turn once and shared by the stream and the
|
|
81
|
+
* settle.
|
|
79
82
|
*/
|
|
80
83
|
export interface DeepAgentTranscript {
|
|
81
|
-
readonly
|
|
84
|
+
readonly translator: DeepAgentTranslator;
|
|
82
85
|
readonly publisher: InlinePublisher;
|
|
83
86
|
}
|
|
84
87
|
export declare function createDeepAgentTranscript(input: TurnInput, sink: TurnSink, engine: DeepAgentEngine, workspace: DeepAgentWorkspace): DeepAgentTranscript;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* runtime's stall watchdog measures the engine; `reportUsage()` per parent
|
|
10
10
|
* `message_finish`, priced here at the registry's rates for the model the
|
|
11
11
|
* turn runs on (`shared/model-pricing.ts`), so the runtime accounts and
|
|
12
|
-
* enforces the cost cap and writes `streamingUsage
|
|
12
|
+
* enforces the cost cap and writes `streamingUsage`; `requestPersist()`
|
|
13
13
|
* where a discrete change or the streaming cadence says so
|
|
14
14
|
* (`shared/persist-decision.ts` over the builder's one dirty flag), AWAITED,
|
|
15
15
|
* so a platform STOP the runtime reads from that write aborts the signal
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* this loop never does). An error the aborted run throws is the abort itself
|
|
20
20
|
* and settles `interrupted`, never `failed`.
|
|
21
21
|
*
|
|
22
|
-
* WHEN the run is aborted
|
|
22
|
+
* WHEN the run is aborted: on the arrival of the next
|
|
23
23
|
* event — the graph's own step boundary — or after {@link STOP_GRACE_MS} if
|
|
24
24
|
* no event arrives. A LangGraph run aborted while a step is in flight leaves
|
|
25
25
|
* `@langchain/core` with an orphaned rejection (`AsyncGeneratorWithSetup`
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* here) is forced, and that one orphan is the price of unblocking it — the
|
|
35
35
|
* contract's bound on settling `interrupted` is what wins.
|
|
36
36
|
*
|
|
37
|
-
* Until
|
|
37
|
+
* Until #1096 this loop (`streaming-v3.ts`) armed its own 120 s stall
|
|
38
38
|
* check, pulsed the Temporal heartbeat every 2 s, read STOP from its own
|
|
39
39
|
* persist and activated a graceful-stop middleware on it, told a pause from
|
|
40
40
|
* the activity's cancellation signal, and wrote PAUSED, COMPLETED and
|
|
@@ -51,8 +51,7 @@ import { TimeoutError, withTimeout } from "../../shared/with-timeout.js";
|
|
|
51
51
|
import { InlinePublisher } from "./inline-publisher.js";
|
|
52
52
|
import { StreamingSideEffects } from "./streaming-side-effects.js";
|
|
53
53
|
import { createV3EventRecorder } from "./v3-event-recorder.js";
|
|
54
|
-
import {
|
|
55
|
-
import { V3StatusBuilder } from "./v3-status-builder.js";
|
|
54
|
+
import { DeepAgentTranslator, usageOf } from "./translator.js";
|
|
56
55
|
/**
|
|
57
56
|
* How long the loop waits for `run.output` after the stream ended before
|
|
58
57
|
* proceeding without the final state (the structured response rides it).
|
|
@@ -65,41 +64,39 @@ const RUN_OUTPUT_TIMEOUT_MS = 30_000;
|
|
|
65
64
|
*/
|
|
66
65
|
const STOP_GRACE_MS = 1_000;
|
|
67
66
|
export function createDeepAgentTranscript(input, sink, engine, workspace) {
|
|
68
|
-
const
|
|
69
|
-
onUsage: (usage) => {
|
|
70
|
-
// LangChain's `input_tokens` already INCLUDES the cache buckets (the
|
|
71
|
-
// Anthropic adapter folds them in; the cost advisory reads them the
|
|
72
|
-
// same way), so the counts are reported as delivered and the price
|
|
73
|
-
// is computed over the disjoint buckets.
|
|
74
|
-
const inputTokens = usage.input_tokens ?? 0;
|
|
75
|
-
const outputTokens = usage.output_tokens ?? 0;
|
|
76
|
-
const cacheReadTokens = usage.input_token_details?.cache_read ?? 0;
|
|
77
|
-
const cacheWriteTokens = usage.input_token_details?.cache_creation ?? 0;
|
|
78
|
-
const uncachedInput = Math.max(inputTokens - cacheReadTokens - cacheWriteTokens, 0);
|
|
79
|
-
sink.reportUsage({
|
|
80
|
-
inputTokens,
|
|
81
|
-
outputTokens,
|
|
82
|
-
cacheReadTokens,
|
|
83
|
-
cacheWriteTokens,
|
|
84
|
-
estimatedCostUsd: computeTurnCost(engine.pricing, uncachedInput, outputTokens, cacheWriteTokens, cacheReadTokens),
|
|
85
|
-
model: engine.modelName,
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
builder.setApprovalProvider({
|
|
90
|
-
policies: engine.gate.policies,
|
|
91
|
-
toolServerMap: engine.gate.toolServerMap,
|
|
92
|
-
leasedCategories: engine.gate.leasedCategories,
|
|
93
|
-
globalBypass: engine.gate.globalBypass,
|
|
94
|
-
unattended: engine.gate.unattended,
|
|
95
|
-
});
|
|
67
|
+
const translator = new DeepAgentTranslator(engine.gate);
|
|
96
68
|
const publisher = new InlinePublisher({
|
|
97
69
|
workspaceBackend: workspace.backend,
|
|
98
70
|
artifactStorage: input.artifactStorage,
|
|
99
|
-
|
|
71
|
+
artifacts: sink.transcript,
|
|
100
72
|
executionId: input.executionId,
|
|
101
73
|
});
|
|
102
|
-
return {
|
|
74
|
+
return { translator, publisher };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Price one `message-finish`'s usage at the engine's rates and report it to
|
|
78
|
+
* the sink, which accounts, enforces the cost cap and writes `streamingUsage`
|
|
79
|
+
* (one writer of the summary). LangChain's `input_tokens` already INCLUDES the cache buckets
|
|
80
|
+
* (the Anthropic adapter folds them in; the cost advisory reads them the same
|
|
81
|
+
* way), so the counts are reported as delivered and the price is computed
|
|
82
|
+
* over the disjoint buckets. A sub-agent on its own model is priced at the
|
|
83
|
+
* parent's rate, as the in-graph cost cap always did (per-sub-agent pricing
|
|
84
|
+
* is #1121).
|
|
85
|
+
*/
|
|
86
|
+
function reportUsage(sink, engine, usage) {
|
|
87
|
+
const inputTokens = usage.input_tokens ?? 0;
|
|
88
|
+
const outputTokens = usage.output_tokens ?? 0;
|
|
89
|
+
const cacheReadTokens = usage.input_token_details?.cache_read ?? 0;
|
|
90
|
+
const cacheWriteTokens = usage.input_token_details?.cache_creation ?? 0;
|
|
91
|
+
const uncachedInput = Math.max(inputTokens - cacheReadTokens - cacheWriteTokens, 0);
|
|
92
|
+
sink.reportUsage({
|
|
93
|
+
inputTokens,
|
|
94
|
+
outputTokens,
|
|
95
|
+
cacheReadTokens,
|
|
96
|
+
cacheWriteTokens,
|
|
97
|
+
estimatedCostUsd: computeTurnCost(engine.pricing, uncachedInput, outputTokens, cacheWriteTokens, cacheReadTokens),
|
|
98
|
+
model: engine.modelName,
|
|
99
|
+
});
|
|
103
100
|
}
|
|
104
101
|
/**
|
|
105
102
|
* Start the graph run and consume it to the end, folding every event into
|
|
@@ -109,7 +106,8 @@ export function createDeepAgentTranscript(input, sink, engine, workspace) {
|
|
|
109
106
|
export async function consumeDeepAgentStream(deps) {
|
|
110
107
|
const { input, sink, engine, graphInput, transcript } = deps;
|
|
111
108
|
const { executionId } = input;
|
|
112
|
-
const {
|
|
109
|
+
const { translator, publisher } = transcript;
|
|
110
|
+
const builder = sink.transcript;
|
|
113
111
|
const scheduler = new StreamingUpdateScheduler(loadStreamingConfig());
|
|
114
112
|
const recorder = createV3EventRecorder(executionId, process.env.V3_EVENT_RECORD_DIR);
|
|
115
113
|
const sideEffects = new StreamingSideEffects({ inlinePublisher: publisher });
|
|
@@ -152,18 +150,23 @@ export async function consumeDeepAgentStream(deps) {
|
|
|
152
150
|
return interrupted();
|
|
153
151
|
recorder?.record(event, eventsProcessed);
|
|
154
152
|
let detail;
|
|
155
|
-
for (const normalized of
|
|
156
|
-
builder.
|
|
153
|
+
for (const normalized of translator.translate(event)) {
|
|
154
|
+
builder.apply(normalized);
|
|
155
|
+
sideEffects.onEvent(normalized);
|
|
157
156
|
if (normalized.kind === "tool_started")
|
|
158
157
|
detail = normalized.name;
|
|
159
158
|
}
|
|
160
|
-
|
|
159
|
+
const usage = usageOf(event);
|
|
160
|
+
if (usage)
|
|
161
|
+
reportUsage(sink, engine, usage);
|
|
161
162
|
eventsProcessed++;
|
|
162
163
|
sink.recordActivity(detail);
|
|
163
|
-
const persist = shouldPersistStreamingStatus(
|
|
164
|
+
const persist = shouldPersistStreamingStatus(builder.dirty, scheduler, eventsProcessed);
|
|
164
165
|
if (!persist)
|
|
165
166
|
continue;
|
|
166
|
-
|
|
167
|
+
// Cleared as the write is requested, not after it lands: a change
|
|
168
|
+
// that folds while the write is in flight must dirty the next one.
|
|
169
|
+
builder.markPersisted();
|
|
167
170
|
// The runtime attaches the mid-run file-change progress on this write
|
|
168
171
|
// (the chokepoint's step 2), as it does on every write. Awaited so a platform STOP the runtime reads from this write has
|
|
169
172
|
// aborted the signal by the time the next event arrives — where the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn-stream.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/turn-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;A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EACrB,qCAAqC,qBAAqB,IAAI,EAC9D,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CACjB,CAAC;QACF,MAAM,MAAM,GAAG,UAAqC,CAAC;QACrD,OAAO,CAAC,GAAG,CACT,2BAA2B,WAAW,0BAA0B;YAChE,UAAU,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,MAAM,EAAE,kBAAkB,KAAK,SAAS,EAAE,CACrH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,MAAM,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC;YACzG,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,2BAA2B,GAAG,EAAE,CAAC,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* other exception — a provider error unwrapped from LangChain's middleware
|
|
25
25
|
* wrapper, an MCP connect failure, an empty stream — is `failed` on the
|
|
26
26
|
* `internal` surface with `describeExecutionError`'s sentence as
|
|
27
|
-
* `status.error` whole
|
|
27
|
+
* `status.error` whole. Never branches on why `stopSignal`
|
|
28
28
|
* aborted, never writes a phase or a terminal copy, never imports
|
|
29
29
|
* `@temporalio/*` (`__tests__/adapter-is-temporal-free.test.ts`).
|
|
30
30
|
*
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
* are connected and closed per turn. Both are closed on EVERY exit path in
|
|
34
34
|
* the `finally`, before the runtime removes the link and releases the lock.
|
|
35
35
|
*
|
|
36
|
-
* Extracted from `index.ts` `createDeepAgentActivities`
|
|
36
|
+
* Extracted from `index.ts` `createDeepAgentActivities` in #1096; the
|
|
37
37
|
* hermetic goldens under `__tests__/hermetic/` pin the result byte for
|
|
38
|
-
* byte, with
|
|
38
|
+
* byte, with that move's deliberate alignments quoted in their headers.
|
|
39
39
|
*/
|
|
40
40
|
import type { TurnInput, TurnOutcome, TurnSink } from "../../harness/types.js";
|
|
41
41
|
import { type DeepAgentAdapterConfig } from "./turn-setup.js";
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* other exception — a provider error unwrapped from LangChain's middleware
|
|
25
25
|
* wrapper, an MCP connect failure, an empty stream — is `failed` on the
|
|
26
26
|
* `internal` surface with `describeExecutionError`'s sentence as
|
|
27
|
-
* `status.error` whole
|
|
27
|
+
* `status.error` whole. Never branches on why `stopSignal`
|
|
28
28
|
* aborted, never writes a phase or a terminal copy, never imports
|
|
29
29
|
* `@temporalio/*` (`__tests__/adapter-is-temporal-free.test.ts`).
|
|
30
30
|
*
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
* are connected and closed per turn. Both are closed on EVERY exit path in
|
|
34
34
|
* the `finally`, before the runtime removes the link and releases the lock.
|
|
35
35
|
*
|
|
36
|
-
* Extracted from `index.ts` `createDeepAgentActivities`
|
|
36
|
+
* Extracted from `index.ts` `createDeepAgentActivities` in #1096; the
|
|
37
37
|
* hermetic goldens under `__tests__/hermetic/` pin the result byte for
|
|
38
|
-
* byte, with
|
|
38
|
+
* byte, with that move's deliberate alignments quoted in their headers.
|
|
39
39
|
*/
|
|
40
40
|
import { tryInferProvider } from "../../shared/llm-proxy.js";
|
|
41
41
|
import { describeExecutionError } from "../../shared/model-error.js";
|
package/dist/config.d.ts
CHANGED
|
@@ -142,8 +142,8 @@ export interface Config {
|
|
|
142
142
|
* provides the proxy credential and mints no other, so
|
|
143
143
|
* `proxyTokenRef === stigmerTokenRef`), the manager binds the minted runner
|
|
144
144
|
* token (`proxyTokenRef === stigmerRunnerTokenRef`). Reading either sibling
|
|
145
|
-
* directly would send the wrong credential from one of the two roots
|
|
146
|
-
*
|
|
145
|
+
* directly would send the wrong credential from one of the two roots.
|
|
146
|
+
* Required whenever `proxyEndpoint` is set; the Cursor adapter's
|
|
147
147
|
* boot refuses a proxy without it.
|
|
148
148
|
*/
|
|
149
149
|
readonly proxyTokenRef?: {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*
|
|
35
35
|
* This is the contract as of stigmer#197: REJECT denies the tool and the run
|
|
36
36
|
* CONTINUES; it never fails the execution. The native harness proved it
|
|
37
|
-
* (`hitl.ts` `reconcileNonExecutingDecisions`, moved here
|
|
37
|
+
* (`hitl.ts` `reconcileNonExecutingDecisions`, moved here in #1096) and the
|
|
38
38
|
* conformance suite (`agentexecution-approval.conformance.test.ts`) is its
|
|
39
39
|
* arbiter for both harnesses.
|
|
40
40
|
*/
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*
|
|
35
35
|
* This is the contract as of stigmer#197: REJECT denies the tool and the run
|
|
36
36
|
* CONTINUES; it never fails the execution. The native harness proved it
|
|
37
|
-
* (`hitl.ts` `reconcileNonExecutingDecisions`, moved here
|
|
37
|
+
* (`hitl.ts` `reconcileNonExecutingDecisions`, moved here in #1096) and the
|
|
38
38
|
* conformance suite (`agentexecution-approval.conformance.test.ts`) is its
|
|
39
39
|
* arbiter for both harnesses.
|
|
40
40
|
*/
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* the Cursor builder renders the session's first user message), and the
|
|
16
16
|
* shared prompt glue (`shared/prompt-sections.ts`) is written so that
|
|
17
17
|
* placement stays each adapter's. The runtime would branch on it only if it
|
|
18
|
-
* ever composed prompts itself —
|
|
19
|
-
* that exists
|
|
18
|
+
* ever composed prompts itself — an open unification question (#1135), not a
|
|
19
|
+
* phase that exists.
|
|
20
20
|
*
|
|
21
21
|
* The matrix the contract was designed against (2026-09; Claude and Codex are
|
|
22
22
|
* the surveyed SDKs, not built harnesses):
|
|
@@ -51,12 +51,22 @@ import type { VisionProfile } from "../shared/attachment-vision.js";
|
|
|
51
51
|
* - `deny-and-retry`: an out-of-process hook denies the tool, the adapter
|
|
52
52
|
* records the denial, cancels the run, and re-runs with grants on the next
|
|
53
53
|
* invocation.
|
|
54
|
-
* - `callback`: an in-process callback decides per tool
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
54
|
+
* - `callback`: an in-process callback decides per tool. The intended shape
|
|
55
|
+
* is the `interrupt` one seen from the runtime: the turn still ends
|
|
56
|
+
* `awaiting_approval` and reinvokes, and the adapter answers the callback
|
|
57
|
+
* with "deny, stop" and resumes with the decisions.
|
|
58
|
+
* - `none`: the engine offers no gate. The intended shape is that the
|
|
59
|
+
* runtime confines such a harness to capture-only work (a read-only
|
|
60
|
+
* sandbox) so a gated action never reaches the engine.
|
|
61
|
+
*
|
|
62
|
+
* Two of the four are built and two are reserved. `interrupt` (native) and
|
|
63
|
+
* `deny-and-retry` (Cursor) each have a real adapter and the contract kit
|
|
64
|
+
* runs under both. `callback` and `none` come from the 2026-09 survey of the
|
|
65
|
+
* Claude and Codex SDKs: the type carries them so an adapter can declare
|
|
66
|
+
* them, but no adapter does, and the runtime reads `pausePrimitive` in one
|
|
67
|
+
* place only (`turn-context.ts` `regeneratesApprovedWrites`, which returns
|
|
68
|
+
* false for `none`). The capture-only confinement for `none` is design
|
|
69
|
+
* still to be done before the first gate-less harness lands.
|
|
60
70
|
*/
|
|
61
71
|
export type PausePrimitive = "interrupt" | "deny-and-retry" | "callback" | "none";
|
|
62
72
|
/**
|
|
@@ -74,9 +84,9 @@ export type StateIdSource = "deterministic" | "engine-minted";
|
|
|
74
84
|
* workspace-relative paths the harness writes into the repo that a turn's
|
|
75
85
|
* diff must never show (Cursor's transient `.cursor/hooks.json`). Declared
|
|
76
86
|
* once per adapter, read by `harness/capture.ts` (the pin, the progress
|
|
77
|
-
* slice, the candidate) and `turn-context.ts` (the reconcile).
|
|
78
|
-
* as an argument, homed here
|
|
79
|
-
* reader
|
|
87
|
+
* slice, the candidate) and `turn-context.ts` (the reconcile). First passed
|
|
88
|
+
* as an argument, then homed here as a capability (#1070); the capture joined
|
|
89
|
+
* the reconcile as a reader in #1096.
|
|
80
90
|
*/
|
|
81
91
|
export interface FileReviewIdentity {
|
|
82
92
|
readonly harnessId: string;
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* the Cursor builder renders the session's first user message), and the
|
|
16
16
|
* shared prompt glue (`shared/prompt-sections.ts`) is written so that
|
|
17
17
|
* placement stays each adapter's. The runtime would branch on it only if it
|
|
18
|
-
* ever composed prompts itself —
|
|
19
|
-
* that exists
|
|
18
|
+
* ever composed prompts itself — an open unification question (#1135), not a
|
|
19
|
+
* phase that exists.
|
|
20
20
|
*
|
|
21
21
|
* The matrix the contract was designed against (2026-09; Claude and Codex are
|
|
22
22
|
* the surveyed SDKs, not built harnesses):
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* that the runtime cannot read is what its engine observed touching
|
|
22
22
|
* CAS-owned paths (`TurnSink.bindCasObservations`).
|
|
23
23
|
*
|
|
24
|
-
* Until
|
|
24
|
+
* Until #1096 both adapters carried this whole act (Cursor in its
|
|
25
25
|
* `turn-boundary.ts` between the stream and `run.wait()`, the deep-agent in
|
|
26
26
|
* its `turn-settle.ts`), each with its own evidence source and its own
|
|
27
27
|
* scoping rules for the provenance and the stamp. The two rules here are the
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* position, because on BOTH engines an approved command executes on the
|
|
34
34
|
* row the runtime seeded for it (the deep-agent's builder and Cursor's
|
|
35
35
|
* translator both reconcile the re-attempt onto the seeded WAITING row),
|
|
36
|
-
* at its prior position; a positional scope misses it (
|
|
36
|
+
* at its prior position; a positional scope misses it (Cursor's
|
|
37
37
|
* did, so its auto-keep never qualified a gated-then-approved command).
|
|
38
38
|
* "Executed" is a COMPLETED row. "Consented" is the row's own
|
|
39
39
|
* server-authored `approval_action` — the seeded row keeps its id and its
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
* The substrate and the ledger authoring (`shared/filereview/capture.ts`,
|
|
51
51
|
* `cas-touched.ts`, `progress.ts`); the resume-time reconcile
|
|
52
52
|
* (`turn-context.ts` `reconcileReinvocation`, already the runtime's since
|
|
53
|
-
*
|
|
53
|
+
* #1070); the outcome matrix that turns "a review is pending" into a phase
|
|
54
54
|
* (`run-turn.ts`, through `terminal-table.ts` `awaitingReviewArm`).
|
|
55
55
|
*
|
|
56
|
-
* TWO GAPS THIS MODULE DOES NOT CLOSE (recorded
|
|
56
|
+
* TWO GAPS THIS MODULE DOES NOT CLOSE (recorded as #1115)
|
|
57
57
|
* ----------------------------------------------------------------------
|
|
58
58
|
* A turn that ends `interrupted` is not captured (a stop fired; the tree may
|
|
59
59
|
* be mid-edit). So a platform STOP returns COMPLETED with unreviewed edits
|
package/dist/harness/capture.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* that the runtime cannot read is what its engine observed touching
|
|
22
22
|
* CAS-owned paths (`TurnSink.bindCasObservations`).
|
|
23
23
|
*
|
|
24
|
-
* Until
|
|
24
|
+
* Until #1096 both adapters carried this whole act (Cursor in its
|
|
25
25
|
* `turn-boundary.ts` between the stream and `run.wait()`, the deep-agent in
|
|
26
26
|
* its `turn-settle.ts`), each with its own evidence source and its own
|
|
27
27
|
* scoping rules for the provenance and the stamp. The two rules here are the
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* position, because on BOTH engines an approved command executes on the
|
|
34
34
|
* row the runtime seeded for it (the deep-agent's builder and Cursor's
|
|
35
35
|
* translator both reconcile the re-attempt onto the seeded WAITING row),
|
|
36
|
-
* at its prior position; a positional scope misses it (
|
|
36
|
+
* at its prior position; a positional scope misses it (Cursor's
|
|
37
37
|
* did, so its auto-keep never qualified a gated-then-approved command).
|
|
38
38
|
* "Executed" is a COMPLETED row. "Consented" is the row's own
|
|
39
39
|
* server-authored `approval_action` — the seeded row keeps its id and its
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
* The substrate and the ledger authoring (`shared/filereview/capture.ts`,
|
|
51
51
|
* `cas-touched.ts`, `progress.ts`); the resume-time reconcile
|
|
52
52
|
* (`turn-context.ts` `reconcileReinvocation`, already the runtime's since
|
|
53
|
-
*
|
|
53
|
+
* #1070); the outcome matrix that turns "a review is pending" into a phase
|
|
54
54
|
* (`run-turn.ts`, through `terminal-table.ts` `awaitingReviewArm`).
|
|
55
55
|
*
|
|
56
|
-
* TWO GAPS THIS MODULE DOES NOT CLOSE (recorded
|
|
56
|
+
* TWO GAPS THIS MODULE DOES NOT CLOSE (recorded as #1115)
|
|
57
57
|
* ----------------------------------------------------------------------
|
|
58
58
|
* A turn that ends `interrupted` is not captured (a stop fired; the tree may
|
|
59
59
|
* be mid-edit). So a platform STOP returns COMPLETED with unreviewed edits
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* the tree is read at most once per floor interval and only re-attached
|
|
16
16
|
* when it moved (`shared/filereview/progress.ts`), so a write that
|
|
17
17
|
* changed nothing on disk carries the snapshot it already had. Before
|
|
18
|
-
*
|
|
18
|
+
* #1096 each adapter's stream loop did this before its own persists; the
|
|
19
19
|
* runtime owns the capture now, so the display field it derives is
|
|
20
20
|
* refreshed where every other runtime-owned field is — here.
|
|
21
21
|
* 3. `streaming_usage` is refreshed from the accumulator when it has turns,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* 4. `persistStatus` (`shared/status.ts`): tool-output offload, the
|
|
24
24
|
* aggregate size cap, transient retry, oversize recovery. Never rejects.
|
|
25
25
|
* 5. A Temporal heartbeat, so a long streaming turn's liveness is proven by
|
|
26
|
-
* the writes it makes
|
|
26
|
+
* the writes it makes.
|
|
27
27
|
* 6. The control plane's answer: STOP becomes the runtime's platform-stop
|
|
28
28
|
* cause on the stop controller, which aborts the adapter's signal.
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* and resolves when that follow-up has. The promise it returns therefore
|
|
35
35
|
* always means "the state as of my request is on the control plane", which
|
|
36
36
|
* is what lets the Cursor loop await it and see a STOP before it pulls the
|
|
37
|
-
* next event, exactly as its own inline persist did
|
|
37
|
+
* next event, exactly as its own inline persist did.
|
|
38
38
|
*
|
|
39
39
|
* The runtime's terminal writes use the same path (`write()`), so the
|
|
40
40
|
* secret backstop and the usage summary ride the final status too, as they
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* the tree is read at most once per floor interval and only re-attached
|
|
16
16
|
* when it moved (`shared/filereview/progress.ts`), so a write that
|
|
17
17
|
* changed nothing on disk carries the snapshot it already had. Before
|
|
18
|
-
*
|
|
18
|
+
* #1096 each adapter's stream loop did this before its own persists; the
|
|
19
19
|
* runtime owns the capture now, so the display field it derives is
|
|
20
20
|
* refreshed where every other runtime-owned field is — here.
|
|
21
21
|
* 3. `streaming_usage` is refreshed from the accumulator when it has turns,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* 4. `persistStatus` (`shared/status.ts`): tool-output offload, the
|
|
24
24
|
* aggregate size cap, transient retry, oversize recovery. Never rejects.
|
|
25
25
|
* 5. A Temporal heartbeat, so a long streaming turn's liveness is proven by
|
|
26
|
-
* the writes it makes
|
|
26
|
+
* the writes it makes.
|
|
27
27
|
* 6. The control plane's answer: STOP becomes the runtime's platform-stop
|
|
28
28
|
* cause on the stop controller, which aborts the adapter's signal.
|
|
29
29
|
*
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* and resolves when that follow-up has. The promise it returns therefore
|
|
35
35
|
* always means "the state as of my request is on the control plane", which
|
|
36
36
|
* is what lets the Cursor loop await it and see a STOP before it pulls the
|
|
37
|
-
* next event, exactly as its own inline persist did
|
|
37
|
+
* next event, exactly as its own inline persist did.
|
|
38
38
|
*
|
|
39
39
|
* The runtime's terminal writes use the same path (`write()`), so the
|
|
40
40
|
* secret backstop and the usage summary ride the final status too, as they
|