@stigmer/runner 3.14.0 → 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 +268 -0
- package/dist/__test-utils__/hermetic-activity.js +385 -0
- package/dist/__test-utils__/hermetic-activity.js.map +1 -0
- package/dist/__test-utils__/mock-client.d.ts +13 -0
- package/dist/__test-utils__/mock-client.js +45 -0
- package/dist/__test-utils__/mock-client.js.map +1 -0
- 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 +148 -0
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +257 -0
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.d.ts +183 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js +262 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.d.ts +138 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js +191 -0
- package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js.map +1 -0
- 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 +87 -0
- package/dist/harness/capabilities.js +37 -0
- package/dist/harness/capabilities.js.map +1 -0
- 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 +106 -0
- package/dist/harness/registry.js +168 -0
- package/dist/harness/registry.js.map +1 -0
- 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 +448 -0
- package/dist/harness/types.js +64 -0
- package/dist/harness/types.js.map +1 -0
- 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 +325 -0
- package/src/__test-utils__/config-fixture.ts +63 -0
- 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 +581 -0
- package/src/__test-utils__/harness-contract/recording-sink.ts +107 -0
- package/src/__test-utils__/harness-contract/runtime-contract.ts +666 -0
- package/src/__test-utils__/harness-contract/scripted-adapter.ts +349 -0
- package/src/__test-utils__/harness-contract/types.ts +176 -0
- package/src/__test-utils__/hermetic-activity.ts +502 -0
- package/src/__test-utils__/model-registry-fixture.ts +72 -0
- package/src/__test-utils__/module-specifiers.ts +82 -0
- package/src/__test-utils__/proto-helpers.ts +25 -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 +27 -0
- 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 +342 -0
- package/src/activities/execute-cursor/__test-utils__/scripted-agent.ts +368 -0
- package/src/activities/execute-cursor/__test-utils__/scripted-sdk.ts +254 -0
- 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 +228 -0
- package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +180 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/cost-cap.status.json +53 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/deny-and-retry.turn1.status.json +55 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/deny-and-retry.turn2.status.json +77 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/file-review-capture.status.json +126 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/pause.status.json +40 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/plain-turn.status.json +48 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/platform-stop.status.json +56 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/recovery-fresh-agent.status.json +53 -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/tool-call.status.json +68 -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 +42 -0
- 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 +205 -0
- package/src/activities/execute-cursor/__tests__/hermetic/plain-turn.test.ts +171 -0
- package/src/activities/execute-cursor/__tests__/hermetic/recovery-fresh-agent.test.ts +156 -0
- 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 +137 -0
- 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 +168 -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 +92 -0
- package/src/harness/persist-chokepoint.ts +112 -0
- package/src/harness/registry.ts +197 -0
- 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 +473 -0
- 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,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Cursor harness's setup — what this engine needs before it can be sent
|
|
3
|
+
* a turn, as small named steps over the runtime's resolved `TurnInput`, each
|
|
4
|
+
* returning a typed slice (the `SetupResult` mold, never one long function).
|
|
5
|
+
*
|
|
6
|
+
* Everything harness-agnostic has already happened when these run: the
|
|
7
|
+
* execution, session and blueprint are fetched, the workspace is provisioned
|
|
8
|
+
* and locked, the MCP servers and policies are merged, the skills are mounted,
|
|
9
|
+
* the attachments are resolved. What remains is Cursor's own reading of that
|
|
10
|
+
* record: the cursor mode; the row facts beside the runtime's approval
|
|
11
|
+
* verdicts; the SDK's MCP config; the prompt-shaped view of the attachments;
|
|
12
|
+
* the HITL gate (hook script, approval state, grants, denial watcher,
|
|
13
|
+
* capture baseline, progress substrate); the catalog validation of the
|
|
14
|
+
* requested model; the credential, the sub-agents, the variant params and
|
|
15
|
+
* the agent itself (parked or resolved); the bind of a new agent's id through
|
|
16
|
+
* the sink; the prompt in one of its four shapes; the vision payload; the
|
|
17
|
+
* pricer; the OTel span.
|
|
18
|
+
*
|
|
19
|
+
* Every step reads `TurnInput` and the sink and nothing else of the runtime's.
|
|
20
|
+
* The `execution_setup` cold-start line is emitted here, once the agent is
|
|
21
|
+
* resolved, over the runtime's timeline (`sink.setupTiming`), so the one
|
|
22
|
+
* timeline reads end to end.
|
|
23
|
+
*
|
|
24
|
+
* Moved from `index.ts` `executeCursorInner` phases 4c to 10c at S2 M3b; the
|
|
25
|
+
* step bodies are the orchestrator's, verbatim where nothing changed.
|
|
26
|
+
*/
|
|
27
|
+
import { InteractionMode } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
28
|
+
import { CursorMode } from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
29
|
+
import { isReinvocation } from "../../harness/turn-context.js";
|
|
30
|
+
import { toCursorImages } from "../../shared/attachment-vision.js";
|
|
31
|
+
import { emitTimingLog } from "../../shared/cold-start-timing.js";
|
|
32
|
+
import { deriveExecutionFingerprintKey } from "../../shared/approval-fingerprint.js";
|
|
33
|
+
import { isUnattendedApprovalMode } from "../../shared/approval-policy.js";
|
|
34
|
+
import { excludeAppliedFromGrants } from "../../shared/exact-apply.js";
|
|
35
|
+
import { getRunnerHitlMasterSecret } from "../../shared/fingerprint-secret.js";
|
|
36
|
+
import { newProgressCaptureState } from "../../shared/filereview/progress.js";
|
|
37
|
+
import { enabledToolsBySlug } from "../../shared/mcp-enabled-tools.js";
|
|
38
|
+
import { ensureHitlDir } from "../../shared/workspace/platform-dir.js";
|
|
39
|
+
import { computeAgentFingerprint, takeCachedAgent } from "./agent-session-cache.js";
|
|
40
|
+
import { buildApprovalGrants, buildApprovalState, emitCursorGrantReceipts, reconstructAdjudicatedApprovals, watchDenialLedger } from "./approval-state.js";
|
|
41
|
+
import { buildCursorProgressSubstrate, captureBaselineToLedger } from "./capture-flow.js";
|
|
42
|
+
import { CURSOR_CAPABILITIES } from "./cursor-capabilities.js";
|
|
43
|
+
import { toCursorMcpConfig, validateMcpServerEnv } from "./cursor-mcp-config.js";
|
|
44
|
+
import { determineCursorMode, isCloudMode } from "./cursor-mode.js";
|
|
45
|
+
import { closeProxySessions } from "./http2-interceptor.js";
|
|
46
|
+
import { seededSubAgentsOf } from "./message-translator.js";
|
|
47
|
+
import { ensureLoaded as ensurePricingLoaded, resolveModelId } from "./model-pricing.js";
|
|
48
|
+
import { appendStructuredOutputDirective, buildPrompt, primarySendCarriesImages, promptCarriesStandingContext, } from "./prompt-builder.js";
|
|
49
|
+
import { resolveServiceTierParams } from "./service-tier.js";
|
|
50
|
+
import { createAgent, createCloudAgent, resolveAgentWithTransportRecovery, } from "./session-lifecycle.js";
|
|
51
|
+
import { composeTurnRecoveryDigest } from "./turn-recovery.js";
|
|
52
|
+
import { buildCursorSubAgentDefinitions } from "./subagent-config.js";
|
|
53
|
+
import { CursorUsagePricer } from "./usage-pricing.js";
|
|
54
|
+
import { installHitlGate, removeHitlGate } from "./workspace-setup.js";
|
|
55
|
+
// ── Steps ───────────────────────────────────────────────────────────────────
|
|
56
|
+
/**
|
|
57
|
+
* Cloud Cursor agents are disabled platform-wide (see determineCursorMode),
|
|
58
|
+
* so every session runs LOCAL. Any persisted cursor_mode is deliberately
|
|
59
|
+
* ignored so a session can never route to the cloud path while it is
|
|
60
|
+
* disabled — even one that was created when cloud was enabled.
|
|
61
|
+
*/
|
|
62
|
+
export function resolveCursorMode(input, config) {
|
|
63
|
+
const cursorMode = determineCursorMode(input.blueprint.sessionSpec.workspaceEntries, config.cloudModeEnabled);
|
|
64
|
+
return { cursorMode, agentMode: isCloudMode(cursorMode) ? "cloud" : "local" };
|
|
65
|
+
}
|
|
66
|
+
/** The adapter's own read of the adjudicated rows the runtime already turned into verdicts. */
|
|
67
|
+
export function readAdjudicatedRows(input) {
|
|
68
|
+
const reinvoked = isReinvocation(CURSOR_CAPABILITIES.stateIdSource, input);
|
|
69
|
+
const adjudicated = reinvoked ? reconstructAdjudicatedApprovals(input.execution.status?.messages ?? []) : undefined;
|
|
70
|
+
return {
|
|
71
|
+
isReinvocation: reinvoked,
|
|
72
|
+
seededSubAgents: seededSubAgentsOf(input.execution),
|
|
73
|
+
adjudicatedApprovals: adjudicated?.pendingApprovals ?? [],
|
|
74
|
+
adjudicatedContentDigests: adjudicated?.contentDigests ?? new Map(),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The Cursor SDK config, projected from the runtime's final server list
|
|
79
|
+
* exactly once, plus the MCP env pre-flight (diagnostic, non-blocking).
|
|
80
|
+
*/
|
|
81
|
+
export function projectMcpConfig(input) {
|
|
82
|
+
const mcpWarnings = validateMcpServerEnv(input.mcp.servers, input.blueprint.mergedMcpServerUsages);
|
|
83
|
+
if (mcpWarnings.length > 0) {
|
|
84
|
+
console.warn(`ExecuteCursor MCP pre-flight warnings: execution=${input.executionId}\n` +
|
|
85
|
+
mcpWarnings.map((w) => ` - ${w}`).join("\n"));
|
|
86
|
+
}
|
|
87
|
+
return toCursorMcpConfig(input.mcp.servers);
|
|
88
|
+
}
|
|
89
|
+
/** The prompt-shaped projections of the runtime's attachments: the `<input_files>` entries and the vision disclosure. */
|
|
90
|
+
export function prepareAttachmentPrompt(input) {
|
|
91
|
+
const { visionImages, visionNotViewable } = input.attachments;
|
|
92
|
+
const attachmentEntries = input.attachments.results.map((a) => ({
|
|
93
|
+
path: a.relativePath,
|
|
94
|
+
...(a.renamedFrom !== undefined ? { renamedFrom: a.renamedFrom } : {}),
|
|
95
|
+
...(a.downloadUrl !== undefined ? { downloadUrl: a.downloadUrl } : {}),
|
|
96
|
+
}));
|
|
97
|
+
const visionPromptInfo = visionImages.length > 0 || visionNotViewable.length > 0
|
|
98
|
+
? { inlineFilenames: visionImages.map((v) => v.filename), notViewable: visionNotViewable }
|
|
99
|
+
: undefined;
|
|
100
|
+
return { attachmentEntries, visionPromptInfo };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Install the HITL approval gate BEFORE resolving the agent.
|
|
104
|
+
*
|
|
105
|
+
* The gate's runtime artifacts (hook script, approval-state file, denial
|
|
106
|
+
* ledger) live in the session HITL directory OUTSIDE the workspace; only a
|
|
107
|
+
* minimal, merged, transient .cursor/hooks.json is written into the repo,
|
|
108
|
+
* pointing at the hook script by absolute path. The hook is scoped to this
|
|
109
|
+
* runner's own process so the user's interactive IDE — sharing the same repo
|
|
110
|
+
* hooks.json — is never gated (issue #173). Installing here (rather than
|
|
111
|
+
* after agent create/resume) guarantees the hook is present no matter when
|
|
112
|
+
* the SDK reads hook config, and the adapter's finally restores the repo.
|
|
113
|
+
*
|
|
114
|
+
* On reinvocation, turn the user's approvals into tool-identity grants so
|
|
115
|
+
* the resumed agent's re-attempt (which carries a fresh tool-call id) is
|
|
116
|
+
* allowed through. Exact-applied writes are EXCLUDED from the grants: with no
|
|
117
|
+
* grant, a further write to that file is re-gated (the user sees every change).
|
|
118
|
+
* Capture mode: pin the pre-turn baseline tree before the agent runs (and
|
|
119
|
+
* before the gate is installed, though the gate files are excluded from the
|
|
120
|
+
* capture anyway). The turn-end capture diffs the post-turn tree against this
|
|
121
|
+
* to build the per-file cards; the baseline ref is also what a reject reverts
|
|
122
|
+
* to on resume. Covers a fresh turn and the approved-irreversible resume
|
|
123
|
+
* fall-through (the agent will run and may make further edits).
|
|
124
|
+
*/
|
|
125
|
+
export async function installGate(input, sink, rows, streamState) {
|
|
126
|
+
const { executionId, sessionId, workspace, mcp, approvalDecisions, appliedToolCallIds, artifactStorage } = input;
|
|
127
|
+
const { primaryDir, gitWorkspace, captureMode, changeSetId } = workspace;
|
|
128
|
+
const globalBypass = mcp.leases.global;
|
|
129
|
+
let baselineTree;
|
|
130
|
+
if (captureMode && primaryDir) {
|
|
131
|
+
// Pin the pre-turn tree AND author BASELINE_CAPTURED so the projection can
|
|
132
|
+
// materialize the change set (status CAPTURING) before any candidate exists.
|
|
133
|
+
// The event rides the next persist; CAPTURING does not arm the unified gate.
|
|
134
|
+
baselineTree = await captureBaselineToLedger({ status: sink.status, gitRoot: primaryDir, executionId, changeSetId, gitWorkspace });
|
|
135
|
+
}
|
|
136
|
+
const hitlDir = await ensureHitlDir(sessionId);
|
|
137
|
+
const grantApprovals = excludeAppliedFromGrants(rows.adjudicatedApprovals, appliedToolCallIds);
|
|
138
|
+
const approvalGrants = approvalDecisions.size > 0
|
|
139
|
+
? buildApprovalGrants(grantApprovals, approvalDecisions, rows.adjudicatedContentDigests)
|
|
140
|
+
: undefined;
|
|
141
|
+
if (approvalGrants && approvalGrants.length > 0 && !globalBypass) {
|
|
142
|
+
emitCursorGrantReceipts(approvalGrants, deriveExecutionFingerprintKey(getRunnerHitlMasterSecret(), executionId), executionId);
|
|
143
|
+
}
|
|
144
|
+
// CAS capture requires artifact storage to persist blobs
|
|
145
|
+
// (captureCandidateToLedger throws without it). In a git tree, captureMode
|
|
146
|
+
// alone governs tracked-file capture (no storage needed) and captureIgnored is
|
|
147
|
+
// the narrower switch (git tree + storage) that also captures gitignored
|
|
148
|
+
// writes. In a non-git workspace ALL capture is CAS, so captureMode already
|
|
149
|
+
// required storage — captureIgnored then equals captureMode. When storage is
|
|
150
|
+
// absent a git tree keeps gating gitignored writes and a non-git workspace
|
|
151
|
+
// falls back to the deny-gate entirely (no regression).
|
|
152
|
+
const captureIgnored = captureMode && !!artifactStorage;
|
|
153
|
+
// Unattended approval mode (DD-014): approver-less surfaces (channels,
|
|
154
|
+
// guest shares) stamp APPROVAL_MODE_UNATTENDED; the hook then records
|
|
155
|
+
// approval denials with the non-pausing "unattended" kind, so the
|
|
156
|
+
// first-denial stop never fires and the turn boundary settles the denied
|
|
157
|
+
// calls as SKIPPED instead of pausing a turn nobody can approve.
|
|
158
|
+
const approvalState = buildApprovalState(mcp.policies, globalBypass, mcp.leases.categories, approvalGrants, captureMode, captureIgnored, gitWorkspace, isUnattendedApprovalMode(input.execution),
|
|
159
|
+
// The enabled_tools capability manifest (issue #350): restricted
|
|
160
|
+
// servers' allow-lists, enforced by the hook's "disabled" arm ahead of
|
|
161
|
+
// every approval bypass. The Cursor SDK config cannot hide a server's
|
|
162
|
+
// tools, so this deny-at-call is the harness's enforcement.
|
|
163
|
+
enabledToolsBySlug(mcp.servers));
|
|
164
|
+
const hitlGate = await installHitlGate({ workspaceRoot: primaryDir, hitlDir, approvalState, runnerPid: process.pid });
|
|
165
|
+
// Issue #205 diagnosability: the merge preserved the user's own hooks on
|
|
166
|
+
// the gating events, and Cursor runs every configured hook — so any of
|
|
167
|
+
// these can deny this turn's tools without writing our denial ledger. Log
|
|
168
|
+
// the exposure up front; the turn boundary uses the same list to name the
|
|
169
|
+
// likely culprit if it detects an unattributed hook block.
|
|
170
|
+
if (hitlGate.foreignGatingHooks.length > 0) {
|
|
171
|
+
console.warn(`ExecuteCursor: workspace hooks.json carries ${hitlGate.foreignGatingHooks.length} ` +
|
|
172
|
+
`foreign gating hook(s) [${hitlGate.foreignGatingHooks.join(", ")}] — a deny from ` +
|
|
173
|
+
`any of them blocks the runner's tools outside Stigmer's approval flow ` +
|
|
174
|
+
`(execution=${executionId})`);
|
|
175
|
+
}
|
|
176
|
+
// Arm the denial watcher as soon as the gate exists. The per-turn ledger
|
|
177
|
+
// reset may flip the flag once before the run starts; the loop's read then
|
|
178
|
+
// sees an empty ledger and clears it — harmless by construction.
|
|
179
|
+
const stopDenialWatcher = watchDenialLedger(hitlDir, () => {
|
|
180
|
+
streamState.denialLedgerDirty = true;
|
|
181
|
+
});
|
|
182
|
+
sink.setupTiming.mark("install_hitl_gate");
|
|
183
|
+
// Mid-run live capture (DD-32 / DD-33): choose the progress substrate for this
|
|
184
|
+
// turn's workspace shape ONCE (git / non-git CAS / hybrid). It owns its own
|
|
185
|
+
// short-circuit cache across the loop's persists; the floor lives in
|
|
186
|
+
// progressState. Undefined outside capture mode — writes are deny-gated and
|
|
187
|
+
// nothing is captured.
|
|
188
|
+
const progressSubstrate = buildCursorProgressSubstrate({
|
|
189
|
+
captureMode,
|
|
190
|
+
gitWorkspace,
|
|
191
|
+
workspaceRoot: primaryDir,
|
|
192
|
+
baselineTree,
|
|
193
|
+
executionId,
|
|
194
|
+
hitlDir,
|
|
195
|
+
storage: artifactStorage,
|
|
196
|
+
});
|
|
197
|
+
return {
|
|
198
|
+
hitlDir,
|
|
199
|
+
hitlGate,
|
|
200
|
+
approvalGrants,
|
|
201
|
+
baselineTree,
|
|
202
|
+
progressSubstrate,
|
|
203
|
+
progressState: newProgressCaptureState(),
|
|
204
|
+
stopDenialWatcher,
|
|
205
|
+
removeGate: () => removeHitlGate(hitlGate),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Resolve the Cursor agent (parked, created, resumed, or created after a
|
|
210
|
+
* resume failure), emit the cold-start line, and bind a NEW agent's id
|
|
211
|
+
* through the sink before anything else runs (Q-S2-11: a rejected bind ends
|
|
212
|
+
* the turn `failed`; the sink rejects and the caller's catch names it).
|
|
213
|
+
*
|
|
214
|
+
* The requested name and the effective tier and thinking mode are the
|
|
215
|
+
* runtime's; validating the NAME against Cursor's catalog is this harness's.
|
|
216
|
+
*/
|
|
217
|
+
export async function resolveEngine(input, sink, config, mode) {
|
|
218
|
+
const { executionId, sessionId, threadId, blueprint, workspace, session } = input;
|
|
219
|
+
const { cursorMode, agentMode } = mode;
|
|
220
|
+
const mcpConfig = projectMcpConfig(input);
|
|
221
|
+
// Phase 5d: Ensure model pricing registry is populated before validation
|
|
222
|
+
await ensurePricingLoaded();
|
|
223
|
+
sink.setupTiming.mark("load_pricing");
|
|
224
|
+
const requestedModel = input.model.requested;
|
|
225
|
+
const validatedModel = resolveModelId(requestedModel);
|
|
226
|
+
if (validatedModel !== requestedModel) {
|
|
227
|
+
console.log(`ExecuteCursor model resolved: execution=${executionId}, requested="${requestedModel}", using="${validatedModel}"`);
|
|
228
|
+
}
|
|
229
|
+
await sink.reportProgress("Initializing Cursor agent");
|
|
230
|
+
// In proxy mode, use the stigmer token as the API key — the proxy
|
|
231
|
+
// validates it and injects the real Cursor API key server-side.
|
|
232
|
+
// In direct mode, use the user's own CURSOR_API_KEY.
|
|
233
|
+
const effectiveApiKey = config.proxyEndpoint
|
|
234
|
+
? (config.stigmerTokenRef?.current ?? config.stigmerToken ?? config.cursorApiKey)
|
|
235
|
+
: config.cursorApiKey;
|
|
236
|
+
if (!effectiveApiKey || effectiveApiKey === "proxy-managed") {
|
|
237
|
+
const source = config.proxyEndpoint ? "proxy (STIGMER_TOKEN)" : "direct (CURSOR_API_KEY)";
|
|
238
|
+
throw new Error(`No Cursor API credential available. Mode=${source}, ` +
|
|
239
|
+
`proxyEndpoint=${config.proxyEndpoint ?? "unset"}, ` +
|
|
240
|
+
`hasStigmerToken=${!!config.stigmerToken}, ` +
|
|
241
|
+
`hasTokenRef=${!!config.stigmerTokenRef?.current}`);
|
|
242
|
+
}
|
|
243
|
+
// Register blueprint sub-agents with the Cursor SDK so the parent can
|
|
244
|
+
// delegate to them by name via the Task tool. Re-supplied on every
|
|
245
|
+
// create/resume (the SDK does not persist agent config across resume).
|
|
246
|
+
const cursorSubAgents = buildCursorSubAgentDefinitions(blueprint.subAgents);
|
|
247
|
+
if (cursorSubAgents) {
|
|
248
|
+
console.log(`ExecuteCursor registering ${Object.keys(cursorSubAgents).length} custom sub-agent(s): ` +
|
|
249
|
+
`execution=${executionId}, names=${Object.keys(cursorSubAgents).join(", ")}`);
|
|
250
|
+
}
|
|
251
|
+
// Translate the tier + thinking mode into the explicit variant params
|
|
252
|
+
// sent with every create/resume. Never a bare { id }: the catalog's
|
|
253
|
+
// default variant is account-influenced and picks the served variant
|
|
254
|
+
// (#357 fast pricing, #772 thinking).
|
|
255
|
+
const modelParams = await resolveServiceTierParams({
|
|
256
|
+
apiKey: effectiveApiKey,
|
|
257
|
+
modelId: validatedModel,
|
|
258
|
+
tier: input.model.serviceTier,
|
|
259
|
+
thinking: input.model.thinkingMode,
|
|
260
|
+
executionId,
|
|
261
|
+
});
|
|
262
|
+
const createOptions = agentMode === "cloud"
|
|
263
|
+
? {
|
|
264
|
+
apiKey: effectiveApiKey,
|
|
265
|
+
model: validatedModel || undefined,
|
|
266
|
+
modelParams,
|
|
267
|
+
repos: blueprint.cloudRepos,
|
|
268
|
+
sessionId,
|
|
269
|
+
mcpServers: mcpConfig,
|
|
270
|
+
agents: cursorSubAgents,
|
|
271
|
+
}
|
|
272
|
+
: {
|
|
273
|
+
apiKey: effectiveApiKey,
|
|
274
|
+
model: validatedModel,
|
|
275
|
+
modelParams,
|
|
276
|
+
workspaceDirs: [...workspace.dirs],
|
|
277
|
+
sessionId,
|
|
278
|
+
workspaceRootDir: config.workspaceRootDir,
|
|
279
|
+
mcpServers: mcpConfig,
|
|
280
|
+
agents: cursorSubAgents,
|
|
281
|
+
};
|
|
282
|
+
// Agent.create/Agent.resume have no timeout of their own — a degraded
|
|
283
|
+
// transport (dead proxy connection, stale HTTP/2 session) hangs them
|
|
284
|
+
// forever, which the periodic heartbeat would happily keep alive. Each
|
|
285
|
+
// attempt is bounded; on expiry the wrapper resets the proxy transport
|
|
286
|
+
// and retries once, so a stale-session hang recovers without failing the
|
|
287
|
+
// execution. A second expiry propagates a plain Error to the adapter's
|
|
288
|
+
// catch, which settles the turn `failed`.
|
|
289
|
+
const resolveTimeoutSeconds = Math.round(config.agentResolveTimeoutMs / 1000);
|
|
290
|
+
// Close the segment since load_pricing here so the resolve_agent segment
|
|
291
|
+
// below measures the SDK Agent.create/resume call alone, not the
|
|
292
|
+
// progress-report gRPC + options assembly above (issue #209: resolve_agent
|
|
293
|
+
// is the largest user-visible setup segment; this split keeps its
|
|
294
|
+
// historical meaning — the SDK call was already 98%+ of it).
|
|
295
|
+
sink.setupTiming.mark("prepare_agent");
|
|
296
|
+
// Reuse the previous turn's agent when this session parked one (#215). A
|
|
297
|
+
// checkout hit skips Agent.resume() AND — the real win — keeps the SDK
|
|
298
|
+
// executor lease alive, so agent.send() re-acquires the warm executor
|
|
299
|
+
// instead of re-spawning every stdio MCP server (the measured 2.2–3.2s
|
|
300
|
+
// `send_returned` tax). The fingerprint covers the full acquisition
|
|
301
|
+
// config, so any drift (rotated credential, edited MCP servers, model
|
|
302
|
+
// change) falls through to a fresh resolve.
|
|
303
|
+
const agentFingerprint = computeAgentFingerprint(createOptions);
|
|
304
|
+
const parkedAgent = takeCachedAgent(sessionId, agentFingerprint, threadId ?? "");
|
|
305
|
+
let resolution;
|
|
306
|
+
if (parkedAgent) {
|
|
307
|
+
console.log(`ExecuteCursor reusing parked session agent: execution=${executionId}, session=${sessionId}, agentId=${parkedAgent.agentId}`);
|
|
308
|
+
resolution = {
|
|
309
|
+
agent: parkedAgent,
|
|
310
|
+
agentId: parkedAgent.agentId,
|
|
311
|
+
isNew: false,
|
|
312
|
+
resumed: true,
|
|
313
|
+
mode: agentMode,
|
|
314
|
+
// The parked handle IS the live conversation — every consumer of
|
|
315
|
+
// "resumed_successfully" (prompt selection, poisoned-handle
|
|
316
|
+
// recovery eligibility) wants exactly those semantics.
|
|
317
|
+
reason: "resumed_successfully",
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
resolution = await resolveAgentWithTransportRecovery({
|
|
322
|
+
harnessStateId: threadId,
|
|
323
|
+
createOptions,
|
|
324
|
+
mode: agentMode,
|
|
325
|
+
timeoutMs: config.agentResolveTimeoutMs,
|
|
326
|
+
buildTimeoutMessage: (finalAttempt) => `Cursor agent ${threadId ? "resume" : "create"} timed out after ${resolveTimeoutSeconds}s ` +
|
|
327
|
+
`(${config.proxyEndpoint ? `via proxy ${config.proxyEndpoint}` : "direct Cursor API connection"}). ` +
|
|
328
|
+
`The transport connection is likely dead. ` +
|
|
329
|
+
(finalAttempt
|
|
330
|
+
? `An automatic retry on a fresh transport connection also timed out. ` +
|
|
331
|
+
`Retry the message later; if this persists, check proxy and network health.`
|
|
332
|
+
: `Resetting the transport and retrying automatically.`),
|
|
333
|
+
resetTransport: closeProxySessions,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
console.log(`ExecuteCursor agent resolved: execution=${executionId}, ` +
|
|
337
|
+
`reason=${resolution.reason}, mode=${resolution.mode}, ` +
|
|
338
|
+
`agentId=${resolution.agentId}, resumed=${resolution.resumed}` +
|
|
339
|
+
(resolution.resumeFailureDetail ? `, failureDetail=${resolution.resumeFailureDetail}` : ""));
|
|
340
|
+
sink.setupTiming.mark("resolve_agent");
|
|
341
|
+
emitTimingLog("execution_setup", {
|
|
342
|
+
execution_id: executionId,
|
|
343
|
+
session_id: sessionId,
|
|
344
|
+
harness: "cursor",
|
|
345
|
+
agent_resumed: resolution.resumed,
|
|
346
|
+
cursor_mode: agentMode,
|
|
347
|
+
mcp_server_count: blueprint.mergedMcpServerUsages.length,
|
|
348
|
+
skill_count: blueprint.mergedSkillRefs.length,
|
|
349
|
+
workspace_entry_count: session.spec?.workspaceEntries?.length ?? 0,
|
|
350
|
+
}, sink.setupTiming);
|
|
351
|
+
// A NEW agent's id is bound at once, before anything else runs, so a crash
|
|
352
|
+
// mid-turn still resumes on the next invocation. The mode is this
|
|
353
|
+
// harness's field on the session record, set before the runtime writes it
|
|
354
|
+
// (one writer per field, Q-S2-11); the runtime sets harness_state_id and
|
|
355
|
+
// clears the slug.
|
|
356
|
+
if (resolution.isNew && resolution.agentId) {
|
|
357
|
+
if (blueprint.sessionSpec.cursorMode === CursorMode.UNSPECIFIED) {
|
|
358
|
+
blueprint.sessionSpec.cursorMode = cursorMode;
|
|
359
|
+
}
|
|
360
|
+
try {
|
|
361
|
+
await sink.bindHarnessState(resolution.agentId);
|
|
362
|
+
}
|
|
363
|
+
catch (bindErr) {
|
|
364
|
+
// The handle this function just created has no owner yet (the adapter
|
|
365
|
+
// receives the engine only when this returns) and its id was never
|
|
366
|
+
// saved, so no later turn can resume it: close it here, or its executor
|
|
367
|
+
// lease and MCP subprocesses outlive the failed turn with nothing to
|
|
368
|
+
// release them (S2 M4, Q-M4-8). Then let the rejection settle the turn
|
|
369
|
+
// `failed` as R3 rules.
|
|
370
|
+
try {
|
|
371
|
+
resolution.agent.close();
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
/* best effort */
|
|
375
|
+
}
|
|
376
|
+
throw bindErr;
|
|
377
|
+
}
|
|
378
|
+
console.log(`Stored Cursor agentId=${resolution.agentId} as harness_state_id, cursorMode=${CursorMode[cursorMode]} on session ${sessionId}`);
|
|
379
|
+
}
|
|
380
|
+
return {
|
|
381
|
+
agentMode,
|
|
382
|
+
cursorMode,
|
|
383
|
+
requestedModel,
|
|
384
|
+
validatedModel,
|
|
385
|
+
effectiveApiKey,
|
|
386
|
+
createOptions,
|
|
387
|
+
agentFingerprint,
|
|
388
|
+
resolution,
|
|
389
|
+
modelParams,
|
|
390
|
+
usagePricer: new CursorUsagePricer(validatedModel, input.model.serviceTier, modelParams),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** Create a fresh agent for a recovery spine (the same options as the primary resolve). */
|
|
394
|
+
export async function createFreshAgent(engine) {
|
|
395
|
+
return engine.agentMode === "cloud"
|
|
396
|
+
? createCloudAgent(engine.createOptions)
|
|
397
|
+
: createAgent(engine.createOptions);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Build the prompt in the shape the resolution calls for (`prompt-builder.ts`
|
|
401
|
+
* `buildPrompt`), with the per-turn directives that ride every send this
|
|
402
|
+
* turn makes (the structured-output contract, the implement-plan directive)
|
|
403
|
+
* and the vision payload policy.
|
|
404
|
+
*/
|
|
405
|
+
export async function buildTurnPrompt(input, sink, engine, rows) {
|
|
406
|
+
const { executionId, blueprint, standing, attachments, workspace, approvalDecisions, appliedToolCallIds, structuredOutputSchema } = input;
|
|
407
|
+
const spec = input.execution.spec;
|
|
408
|
+
const { attachmentEntries, visionPromptInfo } = prepareAttachmentPrompt(input);
|
|
409
|
+
const interactionMode = spec.executionConfig?.interactionMode ?? InteractionMode.UNSPECIFIED;
|
|
410
|
+
const buildFromPlan = spec.executionConfig?.buildFromPlan ?? false;
|
|
411
|
+
const shared = () => ({
|
|
412
|
+
approvalDecisions,
|
|
413
|
+
instructions: blueprint.instructions,
|
|
414
|
+
userMessage: spec.message,
|
|
415
|
+
skills: input.skills,
|
|
416
|
+
channelMessaging: input.mcp.channelMessaging,
|
|
417
|
+
subAgents: blueprint.subAgents,
|
|
418
|
+
workspaceDirs: [...workspace.dirs],
|
|
419
|
+
workspaceFileRefs: spec.workspaceFileRefs ?? [],
|
|
420
|
+
attachments: attachmentEntries,
|
|
421
|
+
vision: visionPromptInfo,
|
|
422
|
+
downloadUrlKind: input.artifactStorage?.downloadUrlKind,
|
|
423
|
+
pendingApprovals: rows.adjudicatedApprovals,
|
|
424
|
+
appliedToolCallIds,
|
|
425
|
+
interactionMode,
|
|
426
|
+
buildFromPlan,
|
|
427
|
+
contextBridge: standing.contextBridge,
|
|
428
|
+
senderIdentity: standing.senderIdentity,
|
|
429
|
+
sessionContext: standing.sessionContext,
|
|
430
|
+
declaredPreferences: standing.declaredPreferences,
|
|
431
|
+
conversationCatchup: standing.conversationCatchup,
|
|
432
|
+
});
|
|
433
|
+
// The memory selection is the runtime's memoized thunk; whether THIS prompt
|
|
434
|
+
// carries it is decided by how the agent resolved — a successfully resumed
|
|
435
|
+
// agent already holds its standing context. Deliberately NOT decided once
|
|
436
|
+
// here: a mid-send poisoned-handle failure rebuilds on a FRESH agent whose
|
|
437
|
+
// recovery prompt does carry it, so that build site awaits the same thunk.
|
|
438
|
+
const recalledMemories = promptCarriesStandingContext(engine.resolution.reason)
|
|
439
|
+
? await standing.selectRecalledMemories()
|
|
440
|
+
: undefined;
|
|
441
|
+
const prompt = buildPrompt({
|
|
442
|
+
...shared(),
|
|
443
|
+
resolution: engine.resolution,
|
|
444
|
+
recalledMemories,
|
|
445
|
+
// The turn's recorded transcript, seeded from the persisted execution on
|
|
446
|
+
// a reinvocation. Consumed only by the HITL-recovery shape — reached from
|
|
447
|
+
// HERE when the stored handle failed to resume at resolution time (issue
|
|
448
|
+
// #366 crossing 2).
|
|
449
|
+
turnRecoveryDigest: rows.isReinvocation ? composeTurnRecoveryDigest(sink.status.messages) : undefined,
|
|
450
|
+
});
|
|
451
|
+
// The structured output instruction is a per-turn directive, so like
|
|
452
|
+
// buildFromPlan it must ride every prompt this turn sends — the primary AND
|
|
453
|
+
// the poisoned-handle recovery rebuild (the transport retry re-sends
|
|
454
|
+
// effectivePrompt and inherits it).
|
|
455
|
+
const effectivePrompt = appendStructuredOutputDirective(prompt, structuredOutputSchema);
|
|
456
|
+
// The turn's vision payload. The invariant is "images accompany the user's
|
|
457
|
+
// turn message, wherever the conversation does not already hold them"
|
|
458
|
+
// (primarySendCarriesImages): the ONLY send that skips them is a HITL
|
|
459
|
+
// re-invocation of a successfully RESUMED agent, whose native conversation
|
|
460
|
+
// carries the images from the original send. Every send that starts an
|
|
461
|
+
// empty conversation re-delivers them — the ordinary first/fresh-agent
|
|
462
|
+
// primary send, the HITL primary send after a resolution-time resume
|
|
463
|
+
// failure, and both mid-send recovery retries (which always run on a fresh
|
|
464
|
+
// agent, so their sites pass turnImages unconditionally). Attachments
|
|
465
|
+
// re-resolve on every invocation, so the bytes are in hand even on a
|
|
466
|
+
// re-invocation.
|
|
467
|
+
const turnImages = toCursorImages(attachments.visionImages);
|
|
468
|
+
const primarySendImages = primarySendCarriesImages(approvalDecisions, engine.resolution.reason) ? turnImages : [];
|
|
469
|
+
const toSendMessage = (sendPrompt, images) => images.length > 0 ? { text: sendPrompt, images } : sendPrompt;
|
|
470
|
+
const promptChars = effectivePrompt.length;
|
|
471
|
+
const promptEstimatedTokens = Math.ceil(promptChars / 4);
|
|
472
|
+
console.log(`ExecuteCursor prompt built: execution=${executionId}, ` +
|
|
473
|
+
`chars=${promptChars}, estimatedTokens=${promptEstimatedTokens}, ` +
|
|
474
|
+
`resolution=${engine.resolution.reason}, mode=${engine.resolution.mode}`);
|
|
475
|
+
return {
|
|
476
|
+
effectivePrompt,
|
|
477
|
+
turnImages,
|
|
478
|
+
primarySendImages,
|
|
479
|
+
toSendMessage,
|
|
480
|
+
promptEstimatedTokens,
|
|
481
|
+
// Same per-turn directive rule as buildFromPlan: a structured-output turn
|
|
482
|
+
// keeps its output contract on the rebuilt prompt (the transport retry
|
|
483
|
+
// re-sends effectivePrompt and inherits it without help).
|
|
484
|
+
buildRecoveryPrompt: async (fresh) => appendStructuredOutputDirective(buildPrompt({
|
|
485
|
+
...shared(),
|
|
486
|
+
resolution: fresh,
|
|
487
|
+
// Lazily selected: the primary send may have been a resumed-agent
|
|
488
|
+
// shape that carried no memories, but this fresh agent's prompt must.
|
|
489
|
+
recalledMemories: await standing.selectRecalledMemories(),
|
|
490
|
+
// Composed fresh: the failed primary stream may have appended partial
|
|
491
|
+
// work onto the transcript, and the replacement agent should know it.
|
|
492
|
+
turnRecoveryDigest: composeTurnRecoveryDigest(sink.status.messages),
|
|
493
|
+
}), structuredOutputSchema),
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
//# sourceMappingURL=turn-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-setup.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/turn-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAInF,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAqD,MAAM,qCAAqC,CAAC;AACjI,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,iBAAiB,EAAsB,MAAM,qBAAqB,CAAC;AAC/K,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,E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