@stigmer/runner 3.14.1 → 3.15.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/dist/.build-fingerprint +1 -1
- package/dist/__test-utils__/execution-record-fixture.d.ts +47 -0
- package/dist/__test-utils__/execution-record-fixture.js +68 -0
- package/dist/__test-utils__/execution-record-fixture.js.map +1 -0
- package/dist/__test-utils__/harness-contract/types.d.ts +166 -0
- package/dist/__test-utils__/harness-contract/types.js +49 -0
- package/dist/__test-utils__/harness-contract/types.js.map +1 -0
- package/dist/__test-utils__/hermetic-activity.d.ts +28 -5
- package/dist/__test-utils__/hermetic-activity.js +23 -7
- package/dist/__test-utils__/hermetic-activity.js.map +1 -1
- package/dist/__test-utils__/mock-workspace.d.ts +15 -0
- package/dist/__test-utils__/mock-workspace.js +21 -0
- package/dist/__test-utils__/mock-workspace.js.map +1 -0
- package/dist/__test-utils__/model-registry-fixture.d.ts +56 -0
- package/dist/__test-utils__/model-registry-fixture.js +66 -0
- package/dist/__test-utils__/model-registry-fixture.js.map +1 -0
- package/dist/__test-utils__/turn-input-fixture.d.ts +60 -0
- package/dist/__test-utils__/turn-input-fixture.js +118 -0
- package/dist/__test-utils__/turn-input-fixture.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.d.ts +107 -0
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.js +344 -0
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.d.ts +20 -0
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js +58 -0
- package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js +2 -32
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.d.ts +38 -62
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +47 -121
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.d.ts +17 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js +27 -4
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.d.ts +52 -11
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js +66 -7
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js.map +1 -1
- package/dist/activities/execute-cursor/adapter.d.ts +55 -0
- package/dist/activities/execute-cursor/adapter.js +119 -0
- package/dist/activities/execute-cursor/adapter.js.map +1 -0
- package/dist/activities/execute-cursor/approval-state.d.ts +2 -2
- package/dist/activities/execute-cursor/approval-state.js.map +1 -1
- package/dist/activities/execute-cursor/capture-flow.d.ts +15 -30
- package/dist/activities/execute-cursor/capture-flow.js +17 -26
- package/dist/activities/execute-cursor/capture-flow.js.map +1 -1
- package/dist/activities/execute-cursor/cursor-capabilities.d.ts +23 -0
- package/dist/activities/execute-cursor/cursor-capabilities.js +33 -0
- package/dist/activities/execute-cursor/cursor-capabilities.js.map +1 -0
- package/dist/activities/execute-cursor/cursor-mcp-config.d.ts +2 -2
- package/dist/activities/execute-cursor/cursor-mcp-config.js.map +1 -1
- package/dist/activities/execute-cursor/fetch-interceptor.d.ts +15 -25
- package/dist/activities/execute-cursor/fetch-interceptor.js +39 -33
- package/dist/activities/execute-cursor/fetch-interceptor.js.map +1 -1
- package/dist/activities/execute-cursor/http2-interceptor.d.ts +21 -17
- package/dist/activities/execute-cursor/http2-interceptor.js +38 -31
- package/dist/activities/execute-cursor/http2-interceptor.js.map +1 -1
- package/dist/activities/execute-cursor/message-translator.d.ts +28 -19
- package/dist/activities/execute-cursor/message-translator.js +76 -27
- package/dist/activities/execute-cursor/message-translator.js.map +1 -1
- package/dist/activities/execute-cursor/prompt-builder.d.ts +180 -11
- package/dist/activities/execute-cursor/prompt-builder.js +171 -0
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
- package/dist/activities/execute-cursor/rejection-capture.d.ts +3 -6
- package/dist/activities/execute-cursor/rejection-capture.js +5 -7
- package/dist/activities/execute-cursor/rejection-capture.js.map +1 -1
- package/dist/activities/execute-cursor/session-lifecycle.d.ts +1 -4
- package/dist/activities/execute-cursor/session-lifecycle.js.map +1 -1
- package/dist/activities/execute-cursor/turn-boundary.d.ts +1 -1
- package/dist/activities/execute-cursor/turn-settle.d.ts +49 -0
- package/dist/activities/execute-cursor/turn-settle.js +507 -0
- package/dist/activities/execute-cursor/turn-settle.js.map +1 -0
- package/dist/activities/execute-cursor/turn-setup.d.ts +173 -0
- package/dist/activities/execute-cursor/turn-setup.js +496 -0
- package/dist/activities/execute-cursor/turn-setup.js.map +1 -0
- package/dist/activities/execute-cursor/turn-stream.d.ts +41 -71
- package/dist/activities/execute-cursor/turn-stream.js +70 -135
- package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
- package/dist/activities/execute-cursor/turn.d.ts +43 -0
- package/dist/activities/execute-cursor/turn.js +222 -0
- package/dist/activities/execute-cursor/turn.js.map +1 -0
- package/dist/activities/execute-cursor/usage-pricing.d.ts +38 -0
- package/dist/activities/execute-cursor/usage-pricing.js +50 -0
- package/dist/activities/execute-cursor/usage-pricing.js.map +1 -0
- package/dist/activities/execute-deep-agent/approval-file-change.d.ts +1 -1
- package/dist/activities/execute-deep-agent/approval-file-change.js +1 -1
- package/dist/activities/execute-deep-agent/environment.js +1 -1
- package/dist/activities/execute-deep-agent/environment.js.map +1 -1
- package/dist/activities/execute-deep-agent/setup.js +3 -2
- package/dist/activities/execute-deep-agent/setup.js.map +1 -1
- package/dist/activities/hydrate-workflow-execution.js +1 -1
- package/dist/activities/hydrate-workflow-execution.js.map +1 -1
- package/dist/config.d.ts +15 -0
- package/dist/config.js.map +1 -1
- package/dist/harness/capabilities.d.ts +16 -0
- package/dist/harness/capabilities.js +1 -0
- package/dist/harness/capabilities.js.map +1 -1
- package/dist/harness/persist-chokepoint.d.ts +74 -0
- package/dist/harness/persist-chokepoint.js +88 -0
- package/dist/harness/persist-chokepoint.js.map +1 -0
- package/dist/harness/registry.d.ts +44 -5
- package/dist/harness/registry.js +61 -5
- package/dist/harness/registry.js.map +1 -1
- package/dist/harness/run-turn.d.ts +53 -0
- package/dist/harness/run-turn.js +528 -0
- package/dist/harness/run-turn.js.map +1 -0
- package/dist/harness/stop-controller.d.ts +50 -0
- package/dist/harness/stop-controller.js +62 -0
- package/dist/harness/stop-controller.js.map +1 -0
- package/dist/harness/terminal-table.d.ts +141 -0
- package/dist/harness/terminal-table.js +239 -0
- package/dist/harness/terminal-table.js.map +1 -0
- package/dist/harness/turn-context.d.ts +523 -0
- package/dist/harness/turn-context.js +739 -0
- package/dist/harness/turn-context.js.map +1 -0
- package/dist/harness/types.d.ts +232 -52
- package/dist/harness/types.js +17 -8
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/usage-accumulator.d.ts +68 -0
- package/dist/harness/usage-accumulator.js +101 -0
- package/dist/harness/usage-accumulator.js.map +1 -0
- package/dist/harness-adapters.d.ts +27 -0
- package/dist/harness-adapters.js +28 -0
- package/dist/harness-adapters.js.map +1 -0
- package/dist/main.js.map +1 -1
- package/dist/runner-manager.js +64 -48
- package/dist/runner-manager.js.map +1 -1
- package/dist/runner.d.ts +5 -4
- package/dist/runner.js +65 -64
- package/dist/runner.js.map +1 -1
- package/dist/shared/approval-policy.d.ts +1 -1
- package/dist/shared/approval-policy.js.map +1 -1
- package/dist/{activities/execute-cursor → shared}/attachment-resolver.d.ts +2 -2
- package/dist/{activities/execute-cursor → shared}/attachment-resolver.js +5 -5
- package/dist/shared/attachment-resolver.js.map +1 -0
- package/dist/{activities/execute-cursor → shared}/blueprint-resolver.d.ts +7 -5
- package/dist/{activities/execute-cursor → shared}/blueprint-resolver.js +3 -63
- package/dist/shared/blueprint-resolver.js.map +1 -0
- package/dist/shared/channel-attachment.d.ts +1 -1
- package/dist/shared/channel-attachment.js.map +1 -1
- package/dist/{activities/execute-cursor → shared}/cost-guard.d.ts +5 -1
- package/dist/{activities/execute-cursor → shared}/cost-guard.js +5 -1
- package/dist/shared/cost-guard.js.map +1 -0
- package/dist/{activities/execute-cursor → shared}/env-resolver.d.ts +1 -1
- package/dist/shared/env-resolver.js.map +1 -0
- package/dist/{activities/execute-cursor → shared}/exact-apply.d.ts +1 -1
- package/dist/{activities/execute-cursor → shared}/exact-apply.js +6 -6
- package/dist/shared/exact-apply.js.map +1 -0
- package/dist/shared/execution-context.d.ts +35 -0
- package/dist/shared/execution-context.js +38 -0
- package/dist/shared/execution-context.js.map +1 -0
- package/dist/{activities/execute-cursor → shared}/extract-structured-output.d.ts +5 -2
- package/dist/{activities/execute-cursor → shared}/extract-structured-output.js +9 -6
- package/dist/shared/extract-structured-output.js.map +1 -0
- package/dist/shared/filereview/capture.d.ts +1 -1
- package/dist/shared/filereview/capture.js +1 -1
- package/dist/shared/heartbeat.d.ts +13 -11
- package/dist/shared/heartbeat.js +14 -29
- package/dist/shared/heartbeat.js.map +1 -1
- package/dist/{activities/execute-cursor → shared}/persist-decision.d.ts +5 -2
- package/dist/{activities/execute-cursor → shared}/persist-decision.js +4 -1
- package/dist/shared/persist-decision.js.map +1 -0
- package/dist/{activities/execute-cursor → shared}/skill-resolver.d.ts +16 -3
- package/dist/{activities/execute-cursor → shared}/skill-resolver.js +12 -4
- package/dist/shared/skill-resolver.js.map +1 -0
- package/dist/shared/subagent-rows.d.ts +21 -0
- package/dist/shared/subagent-rows.js +34 -0
- package/dist/shared/subagent-rows.js.map +1 -0
- package/dist/shared/worker-shutdown.d.ts +43 -16
- package/dist/shared/worker-shutdown.js +28 -13
- package/dist/shared/worker-shutdown.js.map +1 -1
- package/dist/shared/workspace/platform-dir.d.ts +1 -1
- package/dist/shared/workspace/platform-dir.js +1 -1
- package/dist/shared/workspace/session-provision.d.ts +54 -0
- package/dist/{activities/execute-cursor/workspace-provision.js → shared/workspace/session-provision.js} +15 -12
- package/dist/shared/workspace/session-provision.js.map +1 -0
- package/package.json +4 -4
- package/src/__test-utils__/__tests__/harness-contract-self-check.test.ts +110 -14
- package/src/__test-utils__/execution-record-fixture.ts +104 -0
- package/src/__test-utils__/harness-boot-order-child.ts +58 -0
- package/src/__test-utils__/harness-contract/contract.ts +128 -83
- package/src/__test-utils__/harness-contract/recording-sink.ts +15 -4
- package/src/__test-utils__/harness-contract/runtime-contract.ts +666 -0
- package/src/__test-utils__/harness-contract/scripted-adapter.ts +92 -32
- package/src/__test-utils__/harness-contract/types.ts +85 -9
- package/src/__test-utils__/hermetic-activity.ts +33 -8
- package/src/__test-utils__/model-registry-fixture.ts +72 -0
- package/src/__test-utils__/module-specifiers.ts +82 -0
- package/src/__test-utils__/turn-input-fixture.ts +155 -0
- package/src/__tests__/harness-boot-order.test.ts +77 -0
- package/src/__tests__/harness-contract.test.ts +7 -5
- package/src/__tests__/runner-manager.test.ts +18 -0
- package/src/activities/execute-cursor/__test-utils__/__tests__/scripted-double.test.ts +102 -0
- package/src/activities/execute-cursor/__test-utils__/contract-subject.ts +396 -0
- package/src/activities/execute-cursor/__test-utils__/cursor-hook-harness.ts +66 -0
- package/src/activities/execute-cursor/__test-utils__/gateway-substrate.ts +2 -43
- package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +65 -145
- package/src/activities/execute-cursor/__test-utils__/scripted-agent.ts +30 -4
- package/src/activities/execute-cursor/__test-utils__/scripted-sdk.ts +96 -8
- package/src/activities/execute-cursor/__tests__/adapter-is-temporal-free.test.ts +45 -0
- package/src/activities/execute-cursor/__tests__/approval-decisions-agree.test.ts +90 -0
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +7 -8
- package/src/activities/execute-cursor/__tests__/capture-flow.test.ts +28 -1
- package/src/activities/execute-cursor/__tests__/deny-gate-exact-apply.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/fetch-interceptor.test.ts +64 -6
- package/src/activities/execute-cursor/__tests__/hermetic/deny-and-retry.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/cost-cap.status.json +53 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/pause.status.json +1 -6
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/platform-stop.status.json +56 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/recovery-transport-timeout.status.json +48 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/resolution-error.status.json +18 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/run-cancelled.status.json +36 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/run-error-non-retryable.status.json +37 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/sdk-error-at-create.status.json +38 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/stall.status.json +59 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +79 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/worker-shutdown.status.json +2 -7
- package/src/activities/execute-cursor/__tests__/hermetic/harness-contract.test.ts +170 -0
- package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +22 -18
- package/src/activities/execute-cursor/__tests__/hermetic/plain-turn.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/recovery-fresh-agent.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/run-wait-arms.test.ts +286 -0
- package/src/activities/execute-cursor/__tests__/hermetic/stream-self-stop-arms.test.ts +332 -0
- package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +193 -0
- package/src/activities/execute-cursor/__tests__/hermetic/tool-call.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/unattributed-hook-block.test.ts +185 -0
- package/src/activities/execute-cursor/__tests__/hermetic/workspace-lock-timeout.test.ts +151 -0
- package/src/activities/execute-cursor/__tests__/http2-interceptor.test.ts +65 -35
- package/src/activities/execute-cursor/__tests__/message-translator.test.ts +0 -40
- package/src/activities/execute-cursor/__tests__/same-identity-reproposal.test.ts +171 -0
- package/src/activities/execute-cursor/__tests__/turn-stream.test.ts +118 -243
- package/src/activities/execute-cursor/__tests__/usage-pricing.test.ts +84 -0
- package/src/activities/execute-cursor/adapter.ts +138 -0
- package/src/activities/execute-cursor/approval-state.ts +2 -2
- package/src/activities/execute-cursor/capture-flow.ts +18 -41
- package/src/activities/execute-cursor/cursor-capabilities.ts +35 -0
- package/src/activities/execute-cursor/cursor-mcp-config.ts +2 -2
- package/src/activities/execute-cursor/fetch-interceptor.ts +48 -45
- package/src/activities/execute-cursor/http2-interceptor.ts +47 -34
- package/src/activities/execute-cursor/message-translator.ts +90 -45
- package/src/activities/execute-cursor/prompt-builder.ts +327 -12
- package/src/activities/execute-cursor/rejection-capture.ts +5 -12
- package/src/activities/execute-cursor/session-lifecycle.ts +1 -5
- package/src/activities/execute-cursor/turn-boundary.ts +1 -1
- package/src/activities/execute-cursor/turn-settle.ts +601 -0
- package/src/activities/execute-cursor/turn-setup.ts +645 -0
- package/src/activities/execute-cursor/turn-stream.ts +84 -210
- package/src/activities/execute-cursor/turn.ts +240 -0
- package/src/activities/execute-cursor/usage-pricing.ts +67 -0
- package/src/activities/execute-deep-agent/approval-file-change.ts +1 -1
- package/src/activities/execute-deep-agent/environment.ts +1 -1
- package/src/activities/execute-deep-agent/setup.ts +3 -2
- package/src/activities/hydrate-workflow-execution.ts +1 -1
- package/src/config.ts +13 -0
- package/src/harness/__tests__/import-direction.test.ts +168 -0
- package/src/harness/__tests__/persist-chokepoint.test.ts +146 -0
- package/src/harness/__tests__/registry.test.ts +1 -0
- package/src/harness/__tests__/run-turn.test.ts +165 -0
- package/src/harness/__tests__/stop-controller.test.ts +49 -0
- package/src/harness/__tests__/turn-context.test.ts +178 -0
- package/src/harness/__tests__/usage-accumulator.test.ts +83 -0
- package/src/harness/capabilities.ts +17 -0
- package/src/harness/persist-chokepoint.ts +112 -0
- package/src/harness/registry.ts +79 -5
- package/src/harness/run-turn.ts +618 -0
- package/src/harness/stop-controller.ts +83 -0
- package/src/harness/terminal-table.ts +276 -0
- package/src/harness/turn-context.ts +1028 -0
- package/src/harness/types.ts +248 -53
- package/src/harness/usage-accumulator.ts +122 -0
- package/src/harness-adapters.ts +30 -0
- package/src/main.ts +1 -1
- package/src/runner-manager.ts +68 -61
- package/src/runner.ts +67 -78
- package/src/shared/__tests__/attachment-naming.test.ts +1 -1
- package/src/{activities/execute-cursor → shared}/__tests__/attachment-resolver.test.ts +6 -4
- package/src/{activities/execute-cursor → shared}/__tests__/cost-guard.test.ts +2 -1
- package/src/{activities/execute-cursor → shared}/__tests__/exact-apply.test.ts +3 -3
- package/src/{activities/execute-cursor → shared}/__tests__/extract-structured-output.test.ts +8 -8
- package/src/{activities/execute-cursor → shared}/__tests__/persist-decision.test.ts +4 -2
- package/src/{activities/execute-cursor → shared}/__tests__/skill-resolver.test.ts +1 -1
- package/src/shared/__tests__/subagent-rows.test.ts +34 -0
- package/src/shared/__tests__/worker-shutdown.test.ts +44 -39
- package/src/shared/approval-policy.ts +1 -1
- package/src/{activities/execute-cursor → shared}/attachment-resolver.ts +6 -6
- package/src/{activities/execute-cursor → shared}/blueprint-resolver.ts +7 -78
- package/src/shared/channel-attachment.ts +1 -1
- package/src/{activities/execute-cursor → shared}/cost-guard.ts +5 -1
- package/src/{activities/execute-cursor → shared}/env-resolver.ts +1 -1
- package/src/{activities/execute-cursor → shared}/exact-apply.ts +7 -7
- package/src/shared/execution-context.ts +45 -0
- package/src/{activities/execute-cursor → shared}/extract-structured-output.ts +10 -7
- package/src/shared/filereview/capture.ts +1 -1
- package/src/shared/heartbeat.ts +13 -33
- package/src/{activities/execute-cursor → shared}/persist-decision.ts +5 -2
- package/src/{activities/execute-cursor → shared}/skill-resolver.ts +20 -6
- package/src/shared/subagent-rows.ts +39 -0
- package/src/shared/worker-shutdown.ts +55 -25
- package/src/{activities/execute-cursor/__tests__/workspace-provision.test.ts → shared/workspace/__tests__/session-provision.test.ts} +25 -28
- package/src/shared/workspace/platform-dir.ts +1 -1
- package/src/{activities/execute-cursor/workspace-provision.ts → shared/workspace/session-provision.ts} +29 -16
- package/dist/activities/execute-cursor/attachment-resolver.js.map +0 -1
- package/dist/activities/execute-cursor/blueprint-resolver.js.map +0 -1
- package/dist/activities/execute-cursor/cost-guard.js.map +0 -1
- package/dist/activities/execute-cursor/env-resolver.js.map +0 -1
- package/dist/activities/execute-cursor/exact-apply.js.map +0 -1
- package/dist/activities/execute-cursor/extract-structured-output.js.map +0 -1
- package/dist/activities/execute-cursor/index.d.ts +0 -209
- package/dist/activities/execute-cursor/index.js +0 -2345
- package/dist/activities/execute-cursor/index.js.map +0 -1
- package/dist/activities/execute-cursor/persist-decision.js.map +0 -1
- package/dist/activities/execute-cursor/skill-resolver.js.map +0 -1
- package/dist/activities/execute-cursor/usage-accumulator.d.ts +0 -89
- package/dist/activities/execute-cursor/usage-accumulator.js +0 -121
- package/dist/activities/execute-cursor/usage-accumulator.js.map +0 -1
- package/dist/activities/execute-cursor/workspace-provision.d.ts +0 -42
- package/dist/activities/execute-cursor/workspace-provision.js.map +0 -1
- package/src/activities/execute-cursor/__tests__/usage-accumulator.test.ts +0 -164
- package/src/activities/execute-cursor/index.ts +0 -2876
- package/src/activities/execute-cursor/usage-accumulator.ts +0 -169
- /package/dist/{activities/execute-cursor → shared}/env-resolver.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-context.js","sourceRoot":"","sources":["../../src/harness/turn-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAA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ment, provisioning and locking the workspace, mounting skills,
|
|
10
10
|
* resolving MCP servers and approval policies, seeding the transcript, the
|
|
11
|
-
* persist
|
|
12
|
-
* shutdown, the cost cap, the
|
|
13
|
-
*
|
|
11
|
+
* persist chokepoint, the stall watchdog, the Temporal heartbeat, pause vs
|
|
12
|
+
* shutdown, the cost cap, the terminal mapping — is the RUNTIME's
|
|
13
|
+
* (`run-turn.ts`), written once. What a harness owns is its SDK slice: how
|
|
14
14
|
* the engine is created or resumed, how the prompt is placed, how MCP servers
|
|
15
15
|
* are bound, how the engine is made to stop before a gated side effect, and
|
|
16
16
|
* how its events become transcript rows. This file is the whole of what a
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
* runtime cannot read anywhere else. Nothing here is speculative: where the
|
|
23
23
|
* program's original sketch and the code disagreed, the code won, and the
|
|
24
24
|
* disagreement was ruled at the entry's gate
|
|
25
|
-
* (stigmer-cloud `_projects/2026-09/20260911.02.sp.harness-contract-and-kit/`
|
|
25
|
+
* (stigmer-cloud `_projects/2026-09/20260911.02.sp.harness-contract-and-kit/`
|
|
26
|
+
* for S1; `20260911.03.sp.turn-runtime-extraction/` M3 for the growth below).
|
|
26
27
|
*
|
|
27
28
|
* What is deliberately NOT on this contract, and why:
|
|
28
29
|
*
|
|
29
30
|
* - No `dispose()`. One adapter object serves many concurrent turns
|
|
30
31
|
* (`maxConcurrentActivities`), so a per-turn teardown method on the
|
|
31
32
|
* adapter is a race. The adapter owns its per-turn teardown in its own
|
|
32
|
-
* `finally` inside `runTurn` (the Cursor harness
|
|
33
|
-
* there).
|
|
33
|
+
* `finally` inside `runTurn` (the Cursor harness parks its agent there).
|
|
34
34
|
* - No `isCancelled()`, no `heartbeat(details)`, no `ExecutionStatusWriter`
|
|
35
35
|
* base. Each would be a second way of saying something `stopSignal`,
|
|
36
36
|
* `recordActivity()` or `requestPersist()` already says, and two writers of
|
|
@@ -46,15 +46,40 @@
|
|
|
46
46
|
* - No `TurnInput.status`. The runtime seeds `TurnSink.status` from the
|
|
47
47
|
* persisted transcript; a second copy on the input is the drift the
|
|
48
48
|
* single-source-of-truth mandate forbids.
|
|
49
|
+
* - No execution context. "This activity is execution X" is the runtime's
|
|
50
|
+
* ambient fact for the WHOLE activity (`shared/execution-context.ts`, an
|
|
51
|
+
* `AsyncLocalStorage` the runtime enters before anything runs); the
|
|
52
|
+
* interceptors read it per request, so no adapter establishes or
|
|
53
|
+
* propagates it.
|
|
54
|
+
* - No persist cadence. The runtime's chokepoint is single-flight and
|
|
55
|
+
* unconditional at settle; WHEN a streaming turn asks for a write is the
|
|
56
|
+
* adapter's (`shared/persist-decision.ts` over its own dirty flags, since
|
|
57
|
+
* what counts as a discrete change is engine knowledge), until S3 lifts
|
|
58
|
+
* the file-review capture and can revisit with both loops in view.
|
|
49
59
|
*
|
|
50
60
|
* Module shape follows `shared/checkpointer/`: `types.ts`, `capabilities.ts`,
|
|
51
|
-
* `registry.ts`, no barrel.
|
|
52
|
-
* until the runtime that consumes it lands (S2 of the program).
|
|
61
|
+
* `registry.ts`, no barrel.
|
|
53
62
|
*/
|
|
54
63
|
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
55
|
-
import type { AgentExecutionStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
64
|
+
import type { AgentExecution, AgentExecutionStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
65
|
+
import type { Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
56
66
|
import type { Config } from "../config.js";
|
|
57
67
|
import type { NormalizedActivityInput } from "../shared/activity-input.js";
|
|
68
|
+
import type { ArtifactStorage } from "../shared/artifact-storage.js";
|
|
69
|
+
import type { TimingRecorder } from "../shared/cold-start-timing.js";
|
|
70
|
+
import type { ResolvedBlueprint } from "../shared/blueprint-resolver.js";
|
|
71
|
+
import type { SessionWorkspaceProvision } from "../shared/workspace/session-provision.js";
|
|
72
|
+
import type { ResolvedMcpServer } from "../shared/mcp-resolver.js";
|
|
73
|
+
import type { ChannelMessagingInfo } from "../shared/channel-attachment.js";
|
|
74
|
+
import type { ActiveLeases, MergedToolPolicy } from "../shared/approval-policy.js";
|
|
75
|
+
import type { SkillMetadata } from "../shared/skill-resolver.js";
|
|
76
|
+
import type { ResolvedAttachment } from "../shared/attachment-resolver.js";
|
|
77
|
+
import type { NotViewableEntry, VisionImage } from "../shared/attachment-vision.js";
|
|
78
|
+
import type { EffectiveServiceTier } from "../shared/service-tier.js";
|
|
79
|
+
import type { EffectiveThinkingMode } from "../shared/thinking-mode.js";
|
|
80
|
+
import type { SenderIdentity } from "../shared/sender-identity.js";
|
|
81
|
+
import type { DeclaredPreferencesContent } from "../shared/declared-preferences.js";
|
|
82
|
+
import type { RecalledMemoriesContent } from "../shared/recalled-memories.js";
|
|
58
83
|
import type { HarnessCapabilities } from "./capabilities.js";
|
|
59
84
|
/**
|
|
60
85
|
* One harness, as the runtime sees it. ONE adapter object exists per worker
|
|
@@ -108,9 +133,9 @@ export interface HarnessAdapter {
|
|
|
108
133
|
* The rules every implementation is held to (the kit's invariants):
|
|
109
134
|
*
|
|
110
135
|
* - Resolves, never rejects. A vendor failure becomes
|
|
111
|
-
* `{ kind: "failed", message }` with the user-facing sentence
|
|
112
|
-
* adapter's classifier produced. A `CancelledFailure` never escapes:
|
|
113
|
-
* runtime, not the adapter, decides what is a pause and what is a
|
|
136
|
+
* `{ kind: "failed", message, surface }` with the user-facing sentence
|
|
137
|
+
* the adapter's classifier produced. A `CancelledFailure` never escapes:
|
|
138
|
+
* the runtime, not the adapter, decides what is a pause and what is a
|
|
114
139
|
* shutdown, and it throws exactly where Temporal semantics require.
|
|
115
140
|
* - Stops promptly when `sink.stopSignal` aborts, whatever the cause,
|
|
116
141
|
* settling `interrupted`. Every call the adapter makes is bounded: the
|
|
@@ -122,23 +147,93 @@ export interface HarnessAdapter {
|
|
|
122
147
|
* `input.approvalDecisions`. APPROVE executes exactly once; REJECT and
|
|
123
148
|
* SKIP never execute.
|
|
124
149
|
* - Owns its own per-turn teardown in a `finally` inside this method.
|
|
150
|
+
* - Imports nothing from `@temporalio/*`: the kit runs an adapter outside
|
|
151
|
+
* any activity context, and every Temporal fact it needs arrives through
|
|
152
|
+
* the sink (`execute-cursor/__tests__/adapter-is-temporal-free.test.ts`).
|
|
125
153
|
*/
|
|
126
154
|
runTurn(input: TurnInput, sink: TurnSink): Promise<TurnOutcome>;
|
|
127
155
|
}
|
|
156
|
+
/** The resolved environment (phase 2b): the MCP-bound env map and the keys that are secrets. */
|
|
157
|
+
export interface TurnEnvironment {
|
|
158
|
+
readonly envVars: Record<string, string>;
|
|
159
|
+
readonly secretKeys: ReadonlySet<string>;
|
|
160
|
+
}
|
|
161
|
+
/** The provisioned workspace (phase 2c) and the capture posture derived from it. */
|
|
162
|
+
export interface TurnWorkspace {
|
|
163
|
+
/** The directories the agent operates in; never empty (`provisionSessionWorkspace` guarantees it). */
|
|
164
|
+
readonly dirs: readonly string[];
|
|
165
|
+
/** `dirs[0]`, the tree the turn's lock, gate, capture and skill mount all key on. */
|
|
166
|
+
readonly primaryDir: string;
|
|
167
|
+
/** True when `primaryDir` is a git work tree: selects the git-diff capture substrate over CAS. */
|
|
168
|
+
readonly gitWorkspace: boolean;
|
|
169
|
+
/** Apply-then-review capture (true) or the classic deny-gate (false); see `shared/filereview/capture.ts` `deriveCaptureMode`. */
|
|
170
|
+
readonly captureMode: boolean;
|
|
171
|
+
/** `${executionId}:${turnSeq}`: the deterministic id of the change set this turn may produce. */
|
|
172
|
+
readonly changeSetId: string;
|
|
173
|
+
readonly provision: SessionWorkspaceProvision;
|
|
174
|
+
}
|
|
175
|
+
/** The tool surface (phases 4 to 4b): the resolved servers with the attachments folded in, and the merged approval policies. */
|
|
176
|
+
export interface TurnMcp {
|
|
177
|
+
/** Every resolved server, synthesized attachments included; the harness projects its SDK config from this list. */
|
|
178
|
+
readonly servers: readonly ResolvedMcpServer[];
|
|
179
|
+
/** Serving proactive channels and their templates (the DD-006 D2 discovery read). */
|
|
180
|
+
readonly channelMessaging: readonly ChannelMessagingInfo[];
|
|
181
|
+
readonly leases: ActiveLeases;
|
|
182
|
+
readonly policies: ReadonlyMap<string, MergedToolPolicy>;
|
|
183
|
+
}
|
|
184
|
+
/** The turn's explicit inputs (phase 5b), resolved into the workspace with the vision facts derived once. */
|
|
185
|
+
export interface TurnAttachments {
|
|
186
|
+
readonly results: readonly ResolvedAttachment[];
|
|
187
|
+
/** The images the model sees inline, in attachment order. */
|
|
188
|
+
readonly visionImages: readonly VisionImage[];
|
|
189
|
+
/** The image-shaped attachments that degraded to path-only, disclosed in the prompt. */
|
|
190
|
+
readonly visionNotViewable: readonly NotViewableEntry[];
|
|
191
|
+
}
|
|
192
|
+
/** What the execution asked for (phase 6, the harness-agnostic half): the raw model name and the effective tier and thinking mode. */
|
|
193
|
+
export interface TurnModelPreferences {
|
|
194
|
+
/** `spec.executionConfig.modelName`, or `"default"`; the harness validates it against its own catalog. */
|
|
195
|
+
readonly requested: string;
|
|
196
|
+
/** Never UNSPECIFIED: `resolveEffectiveServiceTier` is where the platform default is applied. */
|
|
197
|
+
readonly serviceTier: EffectiveServiceTier;
|
|
198
|
+
/** Never UNSPECIFIED: `resolveEffectiveThinkingMode` is where the platform default is applied. */
|
|
199
|
+
readonly thinkingMode: EffectiveThinkingMode;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The standing context a first prompt carries (phase 9c) and the per-turn
|
|
203
|
+
* catchup, read once from the session metadata and the execution spec.
|
|
204
|
+
*/
|
|
205
|
+
export interface TurnStandingContext {
|
|
206
|
+
readonly contextBridge: string | undefined;
|
|
207
|
+
readonly senderIdentity: SenderIdentity | undefined;
|
|
208
|
+
readonly sessionContext: string | undefined;
|
|
209
|
+
readonly declaredPreferences: DeclaredPreferencesContent | undefined;
|
|
210
|
+
readonly conversationCatchup: string | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* The semantic memory selection, memoized to at most one run per
|
|
213
|
+
* invocation and stamping `status.recalledMemoriesReport` once. A thunk
|
|
214
|
+
* because only the harness knows whether its prompt carries standing
|
|
215
|
+
* context (a successfully resumed engine already holds it).
|
|
216
|
+
*/
|
|
217
|
+
readonly selectRecalledMemories: () => Promise<RecalledMemoriesContent | undefined>;
|
|
218
|
+
}
|
|
128
219
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
220
|
+
* Everything the runtime resolved for this turn, as small named groups
|
|
221
|
+
* (`turn-context.ts` produces one per phase; `run-turn.ts` composes them).
|
|
222
|
+
* This is the whole record: the runtime keeps nothing "private" beside it —
|
|
223
|
+
* the lock release and the write-back coordinator are the finally's
|
|
224
|
+
* resources (`run-turn.ts` `TurnFrame`), not facts about the turn.
|
|
134
225
|
*
|
|
135
226
|
* `threadId` is the engine's state id as the runtime knows it: empty on an
|
|
136
227
|
* `engine-minted` harness's first turn (nothing minted yet) and the id the
|
|
137
228
|
* adapter bound through {@link TurnSink.bindHarnessState} on every later
|
|
138
229
|
* invocation; the runtime-minted id on every turn of a `deterministic`
|
|
139
|
-
* harness. An adapter derives create-vs-resume from it and its own state
|
|
140
|
-
*
|
|
141
|
-
* derive it differently.
|
|
230
|
+
* harness. An adapter derives create-vs-resume from it and its own state
|
|
231
|
+
* through `turn-context.ts`'s `isReinvocation`; the contract carries no flag
|
|
232
|
+
* because the two harnesses would derive it differently.
|
|
233
|
+
*
|
|
234
|
+
* Adapter-only facts (the Cursor mode, the service-tier params, the seeded
|
|
235
|
+
* sub-agent rows) are read by the adapter from these records, never resolved
|
|
236
|
+
* by the runtime.
|
|
142
237
|
*/
|
|
143
238
|
export interface TurnInput extends NormalizedActivityInput {
|
|
144
239
|
/**
|
|
@@ -158,11 +253,29 @@ export interface TurnInput extends NormalizedActivityInput {
|
|
|
158
253
|
* verdict from the rows itself.
|
|
159
254
|
*/
|
|
160
255
|
readonly approvalDecisions: ReadonlyMap<string, ApprovalAction>;
|
|
256
|
+
readonly execution: AgentExecution;
|
|
257
|
+
/** The same object as `blueprint.session`; `bindHarnessState` writes it. */
|
|
258
|
+
readonly session: Session;
|
|
259
|
+
readonly blueprint: ResolvedBlueprint;
|
|
260
|
+
readonly environment: TurnEnvironment;
|
|
261
|
+
readonly workspace: TurnWorkspace;
|
|
262
|
+
readonly mcp: TurnMcp;
|
|
263
|
+
/** The mounted skills (phase 5): each under the session's platform dir, reachable from the workspace through its `.stigmer` link; the harness renders them into its prompt. */
|
|
264
|
+
readonly skills: readonly SkillMetadata[];
|
|
265
|
+
readonly attachments: TurnAttachments;
|
|
266
|
+
/** Approved whole-file writes the runtime applied itself this turn (exact-apply); the harness issues no grant for them. */
|
|
267
|
+
readonly appliedToolCallIds: ReadonlySet<string>;
|
|
268
|
+
readonly model: TurnModelPreferences;
|
|
269
|
+
/** `spec.executionConfig.structuredOutputSchema`, when the execution asks for structured output. */
|
|
270
|
+
readonly structuredOutputSchema: Record<string, unknown> | undefined;
|
|
271
|
+
readonly standing: TurnStandingContext;
|
|
272
|
+
/** Resolved once by the runtime before any phase; absent when no substrate works. */
|
|
273
|
+
readonly artifactStorage: ArtifactStorage | undefined;
|
|
161
274
|
}
|
|
162
275
|
/**
|
|
163
|
-
* The runtime's face during one turn:
|
|
164
|
-
*
|
|
165
|
-
*
|
|
276
|
+
* The runtime's face during one turn: what an adapter may ask of it, and the
|
|
277
|
+
* one status it folds into. One sink per turn, owned by the runtime; the
|
|
278
|
+
* adapter never constructs one.
|
|
166
279
|
*
|
|
167
280
|
* Field ownership on `status` before the canonical transcript lands (S4):
|
|
168
281
|
* the adapter appends the engine's transcript rows (assistant messages,
|
|
@@ -170,7 +283,9 @@ export interface TurnInput extends NormalizedActivityInput {
|
|
|
170
283
|
* runtime writes the phase, the terminal system messages, `streamingUsage`,
|
|
171
284
|
* artifacts, write-backs and the file-review projection. An adapter never
|
|
172
285
|
* writes a phase or a terminal copy: those are Temporal semantics the
|
|
173
|
-
* runtime owns once.
|
|
286
|
+
* runtime owns once. (The file-review boundary itself is the adapter's until
|
|
287
|
+
* S3 lifts both harnesses' captures together; `execute-cursor/adapter.ts`
|
|
288
|
+
* says so.)
|
|
174
289
|
*/
|
|
175
290
|
export interface TurnSink {
|
|
176
291
|
/**
|
|
@@ -185,37 +300,68 @@ export interface TurnSink {
|
|
|
185
300
|
* and maps the outcome; the adapter's only job is to settle promptly as
|
|
186
301
|
* `interrupted`. `stopSignal.reason` is the runtime's own evidence — an
|
|
187
302
|
* adapter never branches on it. Check `aborted` at every step boundary and
|
|
188
|
-
* listen for `abort` inside anything long-running
|
|
189
|
-
*
|
|
190
|
-
* work.
|
|
303
|
+
* listen for `abort` inside anything long-running (the Cursor adapter
|
|
304
|
+
* cancels its SDK run from that listener). May already be aborted when
|
|
305
|
+
* `runTurn` is entered; then return `interrupted` before doing any work.
|
|
191
306
|
*/
|
|
192
307
|
readonly stopSignal: AbortSignal;
|
|
193
308
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
* the
|
|
197
|
-
*
|
|
198
|
-
*
|
|
309
|
+
* The runtime's cold-start timeline for this turn, a live handle like
|
|
310
|
+
* `status`. The runtime marked its own resolution segments on it before
|
|
311
|
+
* `runTurn`; the adapter marks its setup segments (skills, gate, engine
|
|
312
|
+
* resolve) and emits the `execution_setup` line once its engine is ready,
|
|
313
|
+
* so the one timeline reads end to end (`shared/cold-start-timing.ts`).
|
|
314
|
+
* Diagnostics only; nothing branches on it.
|
|
315
|
+
*/
|
|
316
|
+
readonly setupTiming: TimingRecorder;
|
|
317
|
+
/**
|
|
318
|
+
* "Persist the status": a write through the runtime's single persist
|
|
319
|
+
* chokepoint (tool-output offload, size cap, secret withholding,
|
|
320
|
+
* `streamingUsage`). Single-flight: a request while a write is in flight
|
|
321
|
+
* coalesces into the next write. Resolves when the state as of the request
|
|
322
|
+
* has been written, so an adapter that needs ordering MAY await it (the
|
|
323
|
+
* Cursor loop awaits before pulling the next event, so a platform STOP
|
|
324
|
+
* answered by that write stops the turn before the next event, as it
|
|
325
|
+
* always has); an adapter never MUST await it, because the runtime
|
|
326
|
+
* persists unconditionally when the turn settles. Never rejects.
|
|
199
327
|
*/
|
|
200
|
-
requestPersist(): void
|
|
328
|
+
requestPersist(): Promise<void>;
|
|
201
329
|
/**
|
|
202
330
|
* "I made progress": resets the runtime's stall watchdog and is carried
|
|
203
|
-
* into the next Temporal heartbeat. Call it on every engine event
|
|
204
|
-
* token delta
|
|
205
|
-
*
|
|
331
|
+
* into the next Temporal heartbeat. Call it on every engine event, every
|
|
332
|
+
* token delta, and every step boundary of the adapter's own setup (engine
|
|
333
|
+
* resolved, send returned, boundary done) — a long generation emits deltas
|
|
334
|
+
* but few discrete events, and resetting only on events false-positives a
|
|
335
|
+
* stall. `detail` names what progressed (the Cursor loop passes the tool
|
|
336
|
+
* name of a `tool_call` event); the runtime quotes the last detail in the
|
|
337
|
+
* stall diagnostic (`last tool: shell`). Never throws.
|
|
206
338
|
*/
|
|
207
|
-
recordActivity(): void;
|
|
339
|
+
recordActivity(detail?: string): void;
|
|
208
340
|
/**
|
|
209
|
-
* Token counts for one engine turn
|
|
210
|
-
*
|
|
211
|
-
* count is a non-negative delta
|
|
341
|
+
* Token counts for one engine turn, priced by the adapter against its own
|
|
342
|
+
* vendor's table. The runtime accumulates and enforces `max_cost_usd`; an
|
|
343
|
+
* adapter reports and never accounts. Every count is a non-negative delta
|
|
344
|
+
* since the previous report.
|
|
212
345
|
*/
|
|
213
346
|
reportUsage(delta: UsageDelta): void;
|
|
347
|
+
/**
|
|
348
|
+
* The user-visible setup label (`status.setupProgress.currentPhase`) for a
|
|
349
|
+
* step only the adapter knows ("Initializing Cursor agent"). The runtime
|
|
350
|
+
* reports its own resolution labels itself; the adapter reports the labels
|
|
351
|
+
* of its setup steps exactly as the orchestrator did, so the UI's spinner
|
|
352
|
+
* copy is unchanged by the extraction (Q-S2-5). Resolves once the label is
|
|
353
|
+
* written; the write carries no phase, so it never advances the execution.
|
|
354
|
+
*/
|
|
355
|
+
reportProgress(label: string): Promise<void>;
|
|
214
356
|
/**
|
|
215
357
|
* The engine-minted state id, the moment it exists and BEFORE the turn
|
|
216
358
|
* proceeds, so a crash mid-turn still resumes on the next invocation. The
|
|
217
|
-
* runtime writes it to the session
|
|
218
|
-
* `harness_state_id`
|
|
359
|
+
* runtime writes it to the session record the adapter was handed
|
|
360
|
+
* (`input.session`, with `harness_state_id` set and the metadata slug
|
|
361
|
+
* cleared, the agnostic quirk of `BuildUpdateStateStep`); the adapter may
|
|
362
|
+
* set its own harness-specific `SessionSpec` fields on that record before
|
|
363
|
+
* binding, one writer per field (`harnessStateId` the runtime's,
|
|
364
|
+
* `cursorMode` the adapter's; Q-S2-11). Called only by adapters whose
|
|
219
365
|
* `capabilities.stateIdSource` is `"engine-minted"`, and before their first
|
|
220
366
|
* `requestPersist`; a `deterministic` harness never calls it. Rejects when
|
|
221
367
|
* the session write fails; the adapter then ends the turn `failed` with
|
|
@@ -224,44 +370,78 @@ export interface TurnSink {
|
|
|
224
370
|
bindHarnessState(harnessStateId: string): Promise<void>;
|
|
225
371
|
}
|
|
226
372
|
/**
|
|
227
|
-
* Token counts for one engine turn,
|
|
228
|
-
* SDK's `turn-ended` delta
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
373
|
+
* Token counts for one engine turn, priced. The four counts are what the
|
|
374
|
+
* Cursor loop reads from the SDK's `turn-ended` delta; `estimatedCostUsd` is
|
|
375
|
+
* the adapter's price for them at its vendor's rates (the runtime cannot
|
|
376
|
+
* price without the vendor's table and must not import it; Q-S2-12), and
|
|
377
|
+
* `model` / `requestedModelParams` name the basis it priced against, which
|
|
378
|
+
* the runtime records into `streamingUsage` (`model` is the catalog-validated
|
|
379
|
+
* id, `requestedModelParams` the JSON of the params sent — a string on the
|
|
380
|
+
* proto, so the SDK type stays inside the adapter). Every field is optional
|
|
381
|
+
* because engines report different subsets; a missing count means zero,
|
|
382
|
+
* never "unknown"; a missing basis inherits the previous delta's.
|
|
232
383
|
*/
|
|
233
384
|
export interface UsageDelta {
|
|
234
385
|
readonly inputTokens?: number;
|
|
235
386
|
readonly outputTokens?: number;
|
|
236
387
|
readonly cacheReadTokens?: number;
|
|
237
388
|
readonly cacheWriteTokens?: number;
|
|
389
|
+
readonly estimatedCostUsd?: number;
|
|
390
|
+
readonly model?: string;
|
|
391
|
+
readonly requestedModelParams?: string;
|
|
238
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Which of the runtime's three failure copies a `failed` outcome takes. A
|
|
395
|
+
* classification, never copy: the runtime owns the words
|
|
396
|
+
* (`terminal-table.ts`), the adapter says what kind of thing failed.
|
|
397
|
+
*
|
|
398
|
+
* - `engine`: the engine reported its run as failed. The transcript already
|
|
399
|
+
* tells the story, so the runtime writes `status.error` and no system row
|
|
400
|
+
* (the Cursor `run.wait()` error arm).
|
|
401
|
+
* - `actionable`: the user can fix it (a foreign hook blocked a tool). One
|
|
402
|
+
* `Execution failed: …` row, the same shape the runtime's own settlements
|
|
403
|
+
* use.
|
|
404
|
+
* - `internal`: the runner or its transport broke unexpectedly (a thrown
|
|
405
|
+
* SDK error, an exception in the adapter). The boilerplate row and an
|
|
406
|
+
* `Error details:` row.
|
|
407
|
+
*/
|
|
408
|
+
export type FailureSurface = "engine" | "actionable" | "internal";
|
|
239
409
|
/**
|
|
240
410
|
* How one turn ended, carrying ONLY what the runtime cannot read from
|
|
241
411
|
* `sink.status` or its own evidence.
|
|
242
412
|
*
|
|
243
413
|
* - `completed`: the engine finished. The final text and any structured
|
|
244
414
|
* output are already folded onto the status; nothing rides here.
|
|
415
|
+
* - `cancelled`: the engine ended its own run cancelled and there is nothing
|
|
416
|
+
* to wait for — an SDK-side cancel, or a deny-and-retry adapter that
|
|
417
|
+
* stopped its run to gate a call and then found nothing to pause for
|
|
418
|
+
* (an unattended denial settled as skipped). Not `interrupted`: the
|
|
419
|
+
* runtime's `stopSignal` never fired. The runtime writes
|
|
420
|
+
* `EXECUTION_CANCELLED` with no copy and completes the turn.
|
|
245
421
|
* - `awaiting_approval`: the engine proposed at least one gated side effect
|
|
246
422
|
* and stopped. The WAITING_APPROVAL rows are already on the status; the
|
|
247
423
|
* runtime persists them and returns to the workflow, which reinvokes with
|
|
248
424
|
* the decisions.
|
|
249
425
|
* - `failed`: the engine or its transport failed in a way the adapter can
|
|
250
|
-
* name. `message` is the user-facing sentence
|
|
251
|
-
* The runtime persists FAILED and RETURNS
|
|
252
|
-
* returned activity; re-running the same
|
|
426
|
+
* name. `message` is the user-facing sentence, `surface` which copy it
|
|
427
|
+
* takes, `cause` is for the log. The runtime persists FAILED and RETURNS
|
|
428
|
+
* (Temporal does not retry a returned activity; re-running the same
|
|
429
|
+
* prompt would fail the same way).
|
|
253
430
|
* - `interrupted`: `sink.stopSignal` aborted and the adapter stopped. WHY it
|
|
254
431
|
* aborted is the runtime's evidence (its watchdog, its accounting, its
|
|
255
|
-
*
|
|
256
|
-
* classifies and applies the throw-vs-return table.
|
|
432
|
+
* chokepoint, the cancellation it was delivered), so no reason rides here;
|
|
433
|
+
* the runtime classifies and applies the throw-vs-return table.
|
|
257
434
|
*/
|
|
258
435
|
export type TurnOutcome = {
|
|
259
436
|
readonly kind: "completed";
|
|
437
|
+
} | {
|
|
438
|
+
readonly kind: "cancelled";
|
|
260
439
|
} | {
|
|
261
440
|
readonly kind: "awaiting_approval";
|
|
262
441
|
} | {
|
|
263
442
|
readonly kind: "failed";
|
|
264
443
|
readonly message: string;
|
|
444
|
+
readonly surface: FailureSurface;
|
|
265
445
|
readonly cause?: unknown;
|
|
266
446
|
} | {
|
|
267
447
|
readonly kind: "interrupted";
|
package/dist/harness/types.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* vendor SDK — fetching the execution, resolving the blueprint and the
|
|
9
9
|
* environment, provisioning and locking the workspace, mounting skills,
|
|
10
10
|
* resolving MCP servers and approval policies, seeding the transcript, the
|
|
11
|
-
* persist
|
|
12
|
-
* shutdown, the cost cap, the
|
|
13
|
-
*
|
|
11
|
+
* persist chokepoint, the stall watchdog, the Temporal heartbeat, pause vs
|
|
12
|
+
* shutdown, the cost cap, the terminal mapping — is the RUNTIME's
|
|
13
|
+
* (`run-turn.ts`), written once. What a harness owns is its SDK slice: how
|
|
14
14
|
* the engine is created or resumed, how the prompt is placed, how MCP servers
|
|
15
15
|
* are bound, how the engine is made to stop before a gated side effect, and
|
|
16
16
|
* how its events become transcript rows. This file is the whole of what a
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
* runtime cannot read anywhere else. Nothing here is speculative: where the
|
|
23
23
|
* program's original sketch and the code disagreed, the code won, and the
|
|
24
24
|
* disagreement was ruled at the entry's gate
|
|
25
|
-
* (stigmer-cloud `_projects/2026-09/20260911.02.sp.harness-contract-and-kit/`
|
|
25
|
+
* (stigmer-cloud `_projects/2026-09/20260911.02.sp.harness-contract-and-kit/`
|
|
26
|
+
* for S1; `20260911.03.sp.turn-runtime-extraction/` M3 for the growth below).
|
|
26
27
|
*
|
|
27
28
|
* What is deliberately NOT on this contract, and why:
|
|
28
29
|
*
|
|
29
30
|
* - No `dispose()`. One adapter object serves many concurrent turns
|
|
30
31
|
* (`maxConcurrentActivities`), so a per-turn teardown method on the
|
|
31
32
|
* adapter is a race. The adapter owns its per-turn teardown in its own
|
|
32
|
-
* `finally` inside `runTurn` (the Cursor harness
|
|
33
|
-
* there).
|
|
33
|
+
* `finally` inside `runTurn` (the Cursor harness parks its agent there).
|
|
34
34
|
* - No `isCancelled()`, no `heartbeat(details)`, no `ExecutionStatusWriter`
|
|
35
35
|
* base. Each would be a second way of saying something `stopSignal`,
|
|
36
36
|
* `recordActivity()` or `requestPersist()` already says, and two writers of
|
|
@@ -46,10 +46,19 @@
|
|
|
46
46
|
* - No `TurnInput.status`. The runtime seeds `TurnSink.status` from the
|
|
47
47
|
* persisted transcript; a second copy on the input is the drift the
|
|
48
48
|
* single-source-of-truth mandate forbids.
|
|
49
|
+
* - No execution context. "This activity is execution X" is the runtime's
|
|
50
|
+
* ambient fact for the WHOLE activity (`shared/execution-context.ts`, an
|
|
51
|
+
* `AsyncLocalStorage` the runtime enters before anything runs); the
|
|
52
|
+
* interceptors read it per request, so no adapter establishes or
|
|
53
|
+
* propagates it.
|
|
54
|
+
* - No persist cadence. The runtime's chokepoint is single-flight and
|
|
55
|
+
* unconditional at settle; WHEN a streaming turn asks for a write is the
|
|
56
|
+
* adapter's (`shared/persist-decision.ts` over its own dirty flags, since
|
|
57
|
+
* what counts as a discrete change is engine knowledge), until S3 lifts
|
|
58
|
+
* the file-review capture and can revisit with both loops in view.
|
|
49
59
|
*
|
|
50
60
|
* Module shape follows `shared/checkpointer/`: `types.ts`, `capabilities.ts`,
|
|
51
|
-
* `registry.ts`, no barrel.
|
|
52
|
-
* until the runtime that consumes it lands (S2 of the program).
|
|
61
|
+
* `registry.ts`, no barrel.
|
|
53
62
|
*/
|
|
54
63
|
export {};
|
|
55
64
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/harness/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The turn runtime's usage accounting: the priced deltas an adapter reports
|
|
3
|
+
* through `TurnSink.reportUsage`, summed into the `streaming_usage` summary
|
|
4
|
+
* the persist chokepoint writes before every status write, and the running
|
|
5
|
+
* cost the `max_cost_usd` cap is enforced against.
|
|
6
|
+
*
|
|
7
|
+
* Who owns what (Q-S2-12): the ADAPTER prices, because only it has its
|
|
8
|
+
* vendor's rate table and variant semantics (`execute-cursor/usage-pricing.ts`
|
|
9
|
+
* for Cursor); the RUNTIME accounts and enforces, because the cap and the
|
|
10
|
+
* summary are the platform's, the same for every engine. A delta therefore
|
|
11
|
+
* arrives already priced, naming the basis it was priced against (`model`,
|
|
12
|
+
* `requestedModelParams`), and this class adds — it never multiplies. The
|
|
13
|
+
* tier and thinking mode it records are the runtime's own effective
|
|
14
|
+
* preferences (`TurnInput.model`), the audit trail that the account default
|
|
15
|
+
* was never left in control (#357, #772).
|
|
16
|
+
*
|
|
17
|
+
* Moved from `activities/execute-cursor/usage-accumulator.ts` at S2 M3, the
|
|
18
|
+
* pricing call split out; the sums, the snapshot shape and the empty
|
|
19
|
+
* snapshot are unchanged, so `streamingUsage` is byte-for-byte what the
|
|
20
|
+
* Cursor orchestrator wrote.
|
|
21
|
+
*
|
|
22
|
+
* This data is display-only. The authoritative billing source is the BiDi
|
|
23
|
+
* proxy, which records usage from the wire.
|
|
24
|
+
*/
|
|
25
|
+
import { ServiceTier, ThinkingMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
26
|
+
import type { UsageDelta } from "./types.js";
|
|
27
|
+
export interface UsageSnapshot {
|
|
28
|
+
readonly inputTokens: bigint;
|
|
29
|
+
readonly outputTokens: bigint;
|
|
30
|
+
readonly cacheReadTokens: bigint;
|
|
31
|
+
readonly cacheWriteTokens: bigint;
|
|
32
|
+
readonly totalTokens: bigint;
|
|
33
|
+
readonly turnCount: number;
|
|
34
|
+
readonly estimatedCostUsd: number;
|
|
35
|
+
/** The basis the adapter last priced against (its catalog-validated model id); `""` until a delta names one. */
|
|
36
|
+
readonly model: string;
|
|
37
|
+
readonly observedAt: string;
|
|
38
|
+
/** Tier the runner requested — always explicit post-translation (#357). */
|
|
39
|
+
readonly requestedServiceTier: ServiceTier;
|
|
40
|
+
/** JSON-encoded params the adapter sent with its model selection; "" when none. */
|
|
41
|
+
readonly requestedModelParams: string;
|
|
42
|
+
/** Thinking mode the runner requested — always explicit post-translation (#772). */
|
|
43
|
+
readonly requestedThinkingMode: ThinkingMode;
|
|
44
|
+
}
|
|
45
|
+
export declare class UsageAccumulator {
|
|
46
|
+
/** The effective tier the runtime resolved (never UNSPECIFIED on a real turn; the default keeps the empty snapshot honest). */
|
|
47
|
+
private readonly requestedServiceTier;
|
|
48
|
+
/** The effective thinking mode the runtime resolved. Price-neutral (#772); recorded purely as the audit trail twin of the tier. */
|
|
49
|
+
private readonly requestedThinkingMode;
|
|
50
|
+
private inputTokens;
|
|
51
|
+
private outputTokens;
|
|
52
|
+
private cacheReadTokens;
|
|
53
|
+
private cacheWriteTokens;
|
|
54
|
+
private turnCount;
|
|
55
|
+
private estimatedCostUsd;
|
|
56
|
+
private observedAt;
|
|
57
|
+
private model;
|
|
58
|
+
private requestedModelParams;
|
|
59
|
+
constructor(
|
|
60
|
+
/** The effective tier the runtime resolved (never UNSPECIFIED on a real turn; the default keeps the empty snapshot honest). */
|
|
61
|
+
requestedServiceTier?: ServiceTier,
|
|
62
|
+
/** The effective thinking mode the runtime resolved. Price-neutral (#772); recorded purely as the audit trail twin of the tier. */
|
|
63
|
+
requestedThinkingMode?: ThinkingMode);
|
|
64
|
+
/** Add one priced delta. A delta without a basis inherits the previous one; a missing count is zero. */
|
|
65
|
+
addTurn(delta: UsageDelta): void;
|
|
66
|
+
get hasTurns(): boolean;
|
|
67
|
+
snapshot(): UsageSnapshot;
|
|
68
|
+
}
|