@stigmer/runner 3.14.1 → 3.15.1
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
package/dist/.build-fingerprint
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"hash":"
|
|
1
|
+
{"hash":"2ac96be487c6ce2c","builtAt":"2026-09-13T19:21:26.263Z","fileCount":325}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four resources of one execution, wired by id into the chain the turn
|
|
3
|
+
* runtime resolves (`execution.spec.sessionId` → `session.spec.
|
|
4
|
+
* agentInstanceId` → `agentInstance.spec.agentId` → the agent), as an
|
|
5
|
+
* `ExecutionRecord` the hermetic client answers from.
|
|
6
|
+
*
|
|
7
|
+
* Harness-agnostic: the record is the control plane's, and the runtime's
|
|
8
|
+
* phases read it the same way whatever engine runs the turn. A harness's
|
|
9
|
+
* driver supplies its own fixture ids and model (`execute-cursor/__test-
|
|
10
|
+
* utils__/hermetic-cursor.ts` `cursorExecutionRecord`); the runtime's own
|
|
11
|
+
* tests use the defaults. Ids are fixed so goldens are readable and
|
|
12
|
+
* byte-stable.
|
|
13
|
+
*/
|
|
14
|
+
import type { WorkspaceEntry } from "@stigmer/protos/ai/stigmer/agentic/session/v1/workspace_pb";
|
|
15
|
+
import { ExecutionRecord, type ExecutionRecordInput } from "./hermetic-activity.js";
|
|
16
|
+
/** The ids a record's four resources carry. */
|
|
17
|
+
export interface ExecutionRecordIds {
|
|
18
|
+
readonly org: string;
|
|
19
|
+
readonly executionId: string;
|
|
20
|
+
readonly sessionId: string;
|
|
21
|
+
readonly agentInstanceId: string;
|
|
22
|
+
readonly agentId: string;
|
|
23
|
+
readonly agentName: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_RECORD_IDS: ExecutionRecordIds;
|
|
26
|
+
export interface ExecutionRecordOptions {
|
|
27
|
+
/** The user's message for this execution. */
|
|
28
|
+
readonly message: string;
|
|
29
|
+
/** The agent's instructions (system prompt body). */
|
|
30
|
+
readonly instructions?: string;
|
|
31
|
+
/** Session workspace entries (a `local_path` entry turns on capture mode). */
|
|
32
|
+
readonly workspaceEntries?: WorkspaceEntry[];
|
|
33
|
+
/** The requested model; the pinned fixture model when omitted. */
|
|
34
|
+
readonly modelName?: string;
|
|
35
|
+
readonly autoApproveAll?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* `ExecutionConfig.max_cost_usd`: the per-message cost budget the runtime
|
|
38
|
+
* enforces as a hard stop (cost-guard.ts). Omitted or 0 = no cap, the
|
|
39
|
+
* proto's default. Priced against the registry fixture's round numbers, so
|
|
40
|
+
* a scenario can state its overrun exactly (600 000 input tokens = $0.60).
|
|
41
|
+
*/
|
|
42
|
+
readonly maxCostUsd?: number;
|
|
43
|
+
/** The control plane's STOP lever; see `ExecutionRecordInput.controlSignal`. */
|
|
44
|
+
readonly controlSignal?: ExecutionRecordInput["controlSignal"];
|
|
45
|
+
readonly ids?: ExecutionRecordIds;
|
|
46
|
+
}
|
|
47
|
+
export declare function executionRecordFixture(options: ExecutionRecordOptions): ExecutionRecord;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four resources of one execution, wired by id into the chain the turn
|
|
3
|
+
* runtime resolves (`execution.spec.sessionId` → `session.spec.
|
|
4
|
+
* agentInstanceId` → `agentInstance.spec.agentId` → the agent), as an
|
|
5
|
+
* `ExecutionRecord` the hermetic client answers from.
|
|
6
|
+
*
|
|
7
|
+
* Harness-agnostic: the record is the control plane's, and the runtime's
|
|
8
|
+
* phases read it the same way whatever engine runs the turn. A harness's
|
|
9
|
+
* driver supplies its own fixture ids and model (`execute-cursor/__test-
|
|
10
|
+
* utils__/hermetic-cursor.ts` `cursorExecutionRecord`); the runtime's own
|
|
11
|
+
* tests use the defaults. Ids are fixed so goldens are readable and
|
|
12
|
+
* byte-stable.
|
|
13
|
+
*/
|
|
14
|
+
import { create } from "@bufbuild/protobuf";
|
|
15
|
+
import { AgentExecutionSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
16
|
+
import { AgentExecutionSpecSchema, ExecutionConfigSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
|
|
17
|
+
import { SessionSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
18
|
+
import { SessionSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/spec_pb";
|
|
19
|
+
import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
20
|
+
import { AgentSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
21
|
+
import { AgentInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
|
|
22
|
+
import { AgentInstanceSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/spec_pb";
|
|
23
|
+
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
24
|
+
import { ExecutionRecord } from "./hermetic-activity.js";
|
|
25
|
+
import { FIXTURE_MODEL } from "./model-registry-fixture.js";
|
|
26
|
+
export const DEFAULT_RECORD_IDS = {
|
|
27
|
+
org: "hermetic-org",
|
|
28
|
+
executionId: "aex_hermetic_0001",
|
|
29
|
+
sessionId: "ses_hermetic_0001",
|
|
30
|
+
agentInstanceId: "ain_hermetic_0001",
|
|
31
|
+
agentId: "agt_hermetic_0001",
|
|
32
|
+
agentName: "hermetic-agent",
|
|
33
|
+
};
|
|
34
|
+
export function executionRecordFixture(options) {
|
|
35
|
+
const ids = options.ids ?? DEFAULT_RECORD_IDS;
|
|
36
|
+
const execution = create(AgentExecutionSchema, {
|
|
37
|
+
metadata: create(ApiResourceMetadataSchema, { id: ids.executionId, org: ids.org, name: ids.executionId }),
|
|
38
|
+
spec: create(AgentExecutionSpecSchema, {
|
|
39
|
+
sessionId: ids.sessionId,
|
|
40
|
+
message: options.message,
|
|
41
|
+
autoApproveAll: options.autoApproveAll ?? false,
|
|
42
|
+
executionConfig: create(ExecutionConfigSchema, {
|
|
43
|
+
modelName: options.modelName ?? FIXTURE_MODEL,
|
|
44
|
+
maxCostUsd: options.maxCostUsd ?? 0,
|
|
45
|
+
}),
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
const session = create(SessionSchema, {
|
|
49
|
+
metadata: create(ApiResourceMetadataSchema, { id: ids.sessionId, org: ids.org, name: ids.sessionId }),
|
|
50
|
+
spec: create(SessionSpecSchema, {
|
|
51
|
+
agentInstanceId: ids.agentInstanceId,
|
|
52
|
+
workspaceEntries: options.workspaceEntries ?? [],
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
const agentInstance = create(AgentInstanceSchema, {
|
|
56
|
+
metadata: create(ApiResourceMetadataSchema, { id: ids.agentInstanceId, org: ids.org, name: ids.agentInstanceId }),
|
|
57
|
+
spec: create(AgentInstanceSpecSchema, { agentId: ids.agentId }),
|
|
58
|
+
});
|
|
59
|
+
const agent = create(AgentSchema, {
|
|
60
|
+
metadata: create(ApiResourceMetadataSchema, { id: ids.agentId, org: ids.org, name: ids.agentName }),
|
|
61
|
+
spec: create(AgentSpecSchema, {
|
|
62
|
+
description: "Hermetic fixture agent",
|
|
63
|
+
instructions: options.instructions ?? "You are the hermetic fixture agent. Answer briefly.",
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
return new ExecutionRecord({ execution, session, agentInstance, agent, controlSignal: options.controlSignal });
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=execution-record-fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-record-fixture.js","sourceRoot":"","sources":["../../src/__test-utils__/execution-record-fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAuB,MAAM,6DAA6D,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AAC/H,OAAO,EAAE,aAAa,EAAgB,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,WAAW,EAAc,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAsB,MAAM,4DAA4D,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,M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AE,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QACrG,IAAI,EAAE,MAAM,CAAC,iBAAiB,EAAE;YAC9B,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;SACjD,CAAC;KACH,CAAC,CAAC;IACH,MAAM,aAAa,GAAkB,MAAM,CAAC,mBAAmB,EAAE;QAC/D,QAAQ,EAAE,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,eAAe,EAAE,CAAC;QACjH,IAAI,EAAE,MAAM,CAAC,uBAAuB,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;KAChE,CAAC,CAAC;IACH,MAAM,KAAK,GAAU,MAAM,CAAC,WAAW,EAAE;QACvC,QAAQ,EAAE,MAAM,CAAC,yBAAyB,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QACnG,IAAI,EAAE,MAAM,CAAC,eAAe,EAAE;YAC5B,WAAW,EAAE,wBAAwB;YACrC,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,qDAAqD;SAC5F,CAAC;KACH,CAAC,CAAC;IACH,OAAO,IAAI,eAAe,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The test-facing seam of the harness contract kit.
|
|
3
|
+
*
|
|
4
|
+
* `HarnessAdapter.runTurn(input, sink)` gives a test no way to make the
|
|
5
|
+
* engine DO anything: propose a gated action, emit usage, hang, fail. The
|
|
6
|
+
* approval-contract kit met the same problem with `GatewaySubstrate` — a
|
|
7
|
+
* small interface each real substrate adapts so one invariant catalog can
|
|
8
|
+
* drive all of them. This is that seam for harnesses: a
|
|
9
|
+
* {@link HarnessContractSubject} owns the ENGINE (what the next turn will
|
|
10
|
+
* do), and the kit owns everything the runtime would own (the sink, the
|
|
11
|
+
* `TurnInput`, the state id threading, the reinvocation).
|
|
12
|
+
*
|
|
13
|
+
* The scenario vocabulary is deliberately small and engine-neutral: it says
|
|
14
|
+
* what the kit needs to PROVOKE, never how an engine behaves. The scripted
|
|
15
|
+
* fake consumes it directly; a real harness's subject translates it onto that
|
|
16
|
+
* harness's own double (the Cursor subject onto the scripted `@cursor/sdk`
|
|
17
|
+
* agent of `execute-cursor/__test-utils__/`). One vocabulary, not one per
|
|
18
|
+
* engine, so the kit cannot drift from what the fake can do.
|
|
19
|
+
*
|
|
20
|
+
* Gated actions reuse `ProposedAction` from `approval-contract/types.ts`, the
|
|
21
|
+
* taxonomy-free action every enforcement substrate already translates, so the
|
|
22
|
+
* two kits speak of the same logical side effect and neither restates the
|
|
23
|
+
* HITL taxonomy.
|
|
24
|
+
*/
|
|
25
|
+
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
26
|
+
import type { Config } from "../../config.js";
|
|
27
|
+
import type { HarnessName } from "../../harness/registry.js";
|
|
28
|
+
import type { FailureSurface, HarnessAdapter, UsageDelta } from "../../harness/types.js";
|
|
29
|
+
import type { ProposedAction } from "../approval-contract/types.js";
|
|
30
|
+
import type { TurnInputFixtureOverrides } from "../turn-input-fixture.js";
|
|
31
|
+
/**
|
|
32
|
+
* One thing the engine does during a turn. A turn plays its steps in order
|
|
33
|
+
* and ends `completed` when none is left, unless a step ends it first.
|
|
34
|
+
*
|
|
35
|
+
* - `say`: the engine emits assistant text (a transcript row).
|
|
36
|
+
* - `propose`: the engine reaches a gated side effect identified by
|
|
37
|
+
* `toolCallId`. Undecided → the turn ends `awaiting_approval` and later
|
|
38
|
+
* steps do not run; APPROVE → the effect runs once and the turn continues;
|
|
39
|
+
* REJECT / SKIP → the effect never runs and the turn continues. WHICH
|
|
40
|
+
* kinds a harness gates is the harness's policy and the workspace's
|
|
41
|
+
* posture: a `shell` is gated by every harness in every posture; a `write`
|
|
42
|
+
* is gated only outside apply-then-review capture (a git tree, or artifact
|
|
43
|
+
* storage), so an arm that must gate on every subject proposes a `shell`.
|
|
44
|
+
* - `read`: the engine performs an UNGATED read of `path` — a tool-call row
|
|
45
|
+
* that runs at once, never pauses, and is the discrete event every harness
|
|
46
|
+
* flushes a persist on (the lever an arm pulls when it needs the control
|
|
47
|
+
* plane to answer a mid-turn persist).
|
|
48
|
+
* - `usage`: the engine reports one turn's token counts.
|
|
49
|
+
* - `hang`: the engine makes no further progress until told to stop. The
|
|
50
|
+
* step that the stop-signal invariants and the runtime's stall watchdog
|
|
51
|
+
* are built around; it must be parked on the signal, never on a timer.
|
|
52
|
+
* - `fail`: the engine fails with a message the adapter can name; the turn
|
|
53
|
+
* ends `failed` on the given surface (`engine` unless the scenario says
|
|
54
|
+
* otherwise — the runtime's three failure copies are its own invariant).
|
|
55
|
+
* - `cancelled`: the engine ends its own run cancelled with nothing to
|
|
56
|
+
* wait for (an SDK-side cancel); the turn ends `cancelled`.
|
|
57
|
+
*/
|
|
58
|
+
export type ScenarioStep = {
|
|
59
|
+
readonly kind: "say";
|
|
60
|
+
readonly text: string;
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "propose";
|
|
63
|
+
readonly toolCallId: string;
|
|
64
|
+
readonly action: ProposedAction;
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "read";
|
|
67
|
+
readonly toolCallId: string;
|
|
68
|
+
readonly path: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: "usage";
|
|
71
|
+
readonly delta: UsageDelta;
|
|
72
|
+
} | {
|
|
73
|
+
readonly kind: "hang";
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: "fail";
|
|
76
|
+
readonly message: string;
|
|
77
|
+
readonly surface: FailureSurface;
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "cancelled";
|
|
80
|
+
};
|
|
81
|
+
/** One turn's worth of engine behaviour. */
|
|
82
|
+
export type TurnScenario = readonly ScenarioStep[];
|
|
83
|
+
/** Step builders — the vocabulary a kit invariant reads as. */
|
|
84
|
+
export declare const scenario: {
|
|
85
|
+
readonly say: (text: string) => ScenarioStep;
|
|
86
|
+
readonly propose: (toolCallId: string, action: ProposedAction) => ScenarioStep;
|
|
87
|
+
readonly read: (toolCallId: string, path: string) => ScenarioStep;
|
|
88
|
+
readonly usage: (delta: UsageDelta) => ScenarioStep;
|
|
89
|
+
readonly hang: () => ScenarioStep;
|
|
90
|
+
readonly fail: (message: string, surface?: FailureSurface) => ScenarioStep;
|
|
91
|
+
readonly cancelled: () => ScenarioStep;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* What the engine can know about the turn it is about to play, handed to the
|
|
95
|
+
* subject with every {@link HarnessContractSubject.arrange}: which execution
|
|
96
|
+
* and session it serves (a real engine is per session — its handle is parked
|
|
97
|
+
* under the session, its workspace and hook state live under the session —
|
|
98
|
+
* so a subject arranges THAT session's engine, never "the next turn"), and
|
|
99
|
+
* the approval decisions the prompt will carry (the runtime's
|
|
100
|
+
* `approvalDecisionsOf` over the persisted status — the one reader both
|
|
101
|
+
* drivers call). A subject whose engine cannot re-run a settled action, or
|
|
102
|
+
* whose model is told not to perform a skipped one, reads its decision here
|
|
103
|
+
* instead of parsing the prompt for it.
|
|
104
|
+
*/
|
|
105
|
+
export interface EngineView {
|
|
106
|
+
readonly executionId: string;
|
|
107
|
+
readonly sessionId: string;
|
|
108
|
+
readonly approvalDecisions: ReadonlyMap<string, ApprovalAction>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* What a subject may say about the record its engine is handed, laid UNDER
|
|
112
|
+
* the driver's own facts: the five it threads (`executionId`, `threadId`,
|
|
113
|
+
* `turnSeq`, `sessionId`, `approvalDecisions`) and the persisted status it
|
|
114
|
+
* seeds are the kit's bookkeeping and never a subject's to state.
|
|
115
|
+
*/
|
|
116
|
+
export type SubjectInputOverrides = Omit<TurnInputFixtureOverrides, "executionId" | "threadId" | "turnSeq" | "sessionId" | "approvalDecisions" | "persistedStatus">;
|
|
117
|
+
/**
|
|
118
|
+
* One adapter under test, with the engine controls the kit needs. Adapters
|
|
119
|
+
* translate scenarios into their own double's drives and report what the
|
|
120
|
+
* double observed; they never reimplement contract behaviour.
|
|
121
|
+
*
|
|
122
|
+
* The kit owns the adapter's lifetime: it boots the adapter before the first
|
|
123
|
+
* turn and shuts it down after the last (the registry boots every adapter
|
|
124
|
+
* before the worker polls, and a real adapter refuses a turn before boot).
|
|
125
|
+
* The exported assertion functions therefore REQUIRE a booted adapter.
|
|
126
|
+
*/
|
|
127
|
+
export interface HarnessContractSubject {
|
|
128
|
+
/** Stable name, used in suite titles and every assertion message. */
|
|
129
|
+
readonly name: string;
|
|
130
|
+
/** The registry row this adapter fills; the runtime half selects the activity by it. */
|
|
131
|
+
readonly harness: HarnessName;
|
|
132
|
+
/** The adapter under test — the real implementation of the contract. */
|
|
133
|
+
readonly adapter: HarnessAdapter;
|
|
134
|
+
/** What `adapter.boot` needs. The subject knows its adapter's fields; the kit does not. */
|
|
135
|
+
readonly config: Config;
|
|
136
|
+
/**
|
|
137
|
+
* Arrange the engine so that the NEXT `runTurn` for `view.sessionId` plays
|
|
138
|
+
* `turn` — REPLACING whatever was arranged for that session and not yet
|
|
139
|
+
* played (a turn interrupted before its engine ran leaves no stale script
|
|
140
|
+
* behind). Called by the kit before every `runTurn`, including a
|
|
141
|
+
* reinvocation (the engine re-reaches the same gated call on resume, so the
|
|
142
|
+
* same proposal is arranged again).
|
|
143
|
+
*/
|
|
144
|
+
arrange(turn: TurnScenario, view: EngineView): void;
|
|
145
|
+
/**
|
|
146
|
+
* What this engine needs the record to say beyond the driver's facts (the
|
|
147
|
+
* model the adapter validates, the workspace its gate installs into). A
|
|
148
|
+
* subject whose engine reads nothing of the record omits it.
|
|
149
|
+
*/
|
|
150
|
+
inputOverrides?(view: EngineView): SubjectInputOverrides;
|
|
151
|
+
/**
|
|
152
|
+
* Resolves the next time a turn parks on a `hang` step — the moment the
|
|
153
|
+
* kit stops a turn from the outside, and the moment the runtime half
|
|
154
|
+
* delivers a cancellation, a drain or the clock tick that trips the stall
|
|
155
|
+
* watchdog. A real engine reaches its hang only after real setup (file
|
|
156
|
+
* writes, catalog fetches); a stop delivered any earlier would land in that
|
|
157
|
+
* setup and prove nothing about the hang. Never a timer.
|
|
158
|
+
*/
|
|
159
|
+
whenHanging(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* How many times the side effect behind `toolCallId` actually ran, as the
|
|
162
|
+
* subject's double observed it. The safety-critical observable; zero for an
|
|
163
|
+
* id the engine never reached.
|
|
164
|
+
*/
|
|
165
|
+
executionCount(toolCallId: string): number;
|
|
166
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The test-facing seam of the harness contract kit.
|
|
3
|
+
*
|
|
4
|
+
* `HarnessAdapter.runTurn(input, sink)` gives a test no way to make the
|
|
5
|
+
* engine DO anything: propose a gated action, emit usage, hang, fail. The
|
|
6
|
+
* approval-contract kit met the same problem with `GatewaySubstrate` — a
|
|
7
|
+
* small interface each real substrate adapts so one invariant catalog can
|
|
8
|
+
* drive all of them. This is that seam for harnesses: a
|
|
9
|
+
* {@link HarnessContractSubject} owns the ENGINE (what the next turn will
|
|
10
|
+
* do), and the kit owns everything the runtime would own (the sink, the
|
|
11
|
+
* `TurnInput`, the state id threading, the reinvocation).
|
|
12
|
+
*
|
|
13
|
+
* The scenario vocabulary is deliberately small and engine-neutral: it says
|
|
14
|
+
* what the kit needs to PROVOKE, never how an engine behaves. The scripted
|
|
15
|
+
* fake consumes it directly; a real harness's subject translates it onto that
|
|
16
|
+
* harness's own double (the Cursor subject onto the scripted `@cursor/sdk`
|
|
17
|
+
* agent of `execute-cursor/__test-utils__/`). One vocabulary, not one per
|
|
18
|
+
* engine, so the kit cannot drift from what the fake can do.
|
|
19
|
+
*
|
|
20
|
+
* Gated actions reuse `ProposedAction` from `approval-contract/types.ts`, the
|
|
21
|
+
* taxonomy-free action every enforcement substrate already translates, so the
|
|
22
|
+
* two kits speak of the same logical side effect and neither restates the
|
|
23
|
+
* HITL taxonomy.
|
|
24
|
+
*/
|
|
25
|
+
/** Step builders — the vocabulary a kit invariant reads as. */
|
|
26
|
+
export const scenario = {
|
|
27
|
+
say(text) {
|
|
28
|
+
return { kind: "say", text };
|
|
29
|
+
},
|
|
30
|
+
propose(toolCallId, action) {
|
|
31
|
+
return { kind: "propose", toolCallId, action };
|
|
32
|
+
},
|
|
33
|
+
read(toolCallId, path) {
|
|
34
|
+
return { kind: "read", toolCallId, path };
|
|
35
|
+
},
|
|
36
|
+
usage(delta) {
|
|
37
|
+
return { kind: "usage", delta };
|
|
38
|
+
},
|
|
39
|
+
hang() {
|
|
40
|
+
return { kind: "hang" };
|
|
41
|
+
},
|
|
42
|
+
fail(message, surface = "engine") {
|
|
43
|
+
return { kind: "fail", message, surface };
|
|
44
|
+
},
|
|
45
|
+
cancelled() {
|
|
46
|
+
return { kind: "cancelled" };
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/__test-utils__/harness-contract/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAiDH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,CAAC,IAAY;QACd,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,UAAkB,EAAE,MAAsB;QAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,CAAC,UAAkB,EAAE,IAAY;QACnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC5C,CAAC;IACD,KAAK,CAAC,KAAiB;QACrB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;IACD,IAAI;QACF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,CAAC,OAAe,EAAE,UAA0B,QAAQ;QACtD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;IACD,SAAS;QACP,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC;CACO,CAAC"}
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
*/
|
|
63
63
|
import { CancelledFailure } from "@temporalio/activity";
|
|
64
64
|
import { type AgentExecution, type AgentExecutionStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
65
|
-
import { ApprovalAction, ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
65
|
+
import { ApprovalAction, ExecutionControlSignal, ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
66
66
|
import type { ToolCall } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
67
|
-
import type
|
|
67
|
+
import { type Session } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
68
68
|
import type { Agent } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
69
69
|
import type { AgentInstance } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
|
|
70
70
|
import type { StigmerClient } from "../client/stigmer-client.js";
|
|
@@ -78,10 +78,19 @@ export interface ExecutionRecordInput {
|
|
|
78
78
|
readonly session: Session;
|
|
79
79
|
readonly agentInstance: AgentInstance;
|
|
80
80
|
readonly agent: Agent;
|
|
81
|
+
/**
|
|
82
|
+
* What `UpdateStatus` answers for each FULL status write — the platform's
|
|
83
|
+
* STOP lever (`ExecutionControlSignal`), decided by the control plane per
|
|
84
|
+
* write and read by the harness stream loop on its mid-stream persist.
|
|
85
|
+
* Evaluated AFTER the write lands, on the snapshot just persisted, so a
|
|
86
|
+
* policy can key on the transcript ("stop once the first assistant message
|
|
87
|
+
* is in"). Defaults to UNSPECIFIED: keep going.
|
|
88
|
+
*/
|
|
89
|
+
readonly controlSignal?: (status: AgentExecutionStatus) => ExecutionControlSignal;
|
|
81
90
|
}
|
|
82
91
|
/**
|
|
83
92
|
* An in-memory stand-in for the server's execution row, with the TWO merge
|
|
84
|
-
* rules the activity depends on and no others:
|
|
93
|
+
* rules and the ONE control lever the activity depends on, and no others:
|
|
85
94
|
*
|
|
86
95
|
* - A status whose phase is UNSPECIFIED is a setup-progress report
|
|
87
96
|
* (`reportSetupProgress`): the server keeps `setup_progress` and leaves the
|
|
@@ -90,6 +99,10 @@ export interface ExecutionRecordInput {
|
|
|
90
99
|
* writer of the transcript; the server's own field-ownership merge — approval
|
|
91
100
|
* fields it owns — is exercised by the test SETTING `approvalAction` on the
|
|
92
101
|
* record between invocations, exactly as `SubmitApproval` would).
|
|
102
|
+
* - Every `UpdateStatus` answers a control signal ({@link ExecutionRecordInput.controlSignal});
|
|
103
|
+
* the server's STOP is the one instruction that travels back to the runner
|
|
104
|
+
* on this channel, and it is a server decision, so it is modelled here and
|
|
105
|
+
* not by the test hand-writing the client.
|
|
93
106
|
*
|
|
94
107
|
* Every persisted status is also kept in order (`persisted`) so a test can
|
|
95
108
|
* assert the phase sequence the activity wrote, independent of the final state.
|
|
@@ -99,11 +112,16 @@ export declare class ExecutionRecord {
|
|
|
99
112
|
readonly session: Session;
|
|
100
113
|
readonly agentInstance: AgentInstance;
|
|
101
114
|
readonly agent: Agent;
|
|
115
|
+
private readonly controlSignal;
|
|
102
116
|
/** Every `updateStatus` payload, in order, snapshotted at write time. */
|
|
103
117
|
readonly persisted: AgentExecutionStatus[];
|
|
104
118
|
/** Setup-progress labels reported before the stream started, in order. */
|
|
105
119
|
readonly setupProgress: string[];
|
|
106
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Every `updateSession` payload, in order (the `harness_state_id` write-back),
|
|
122
|
+
* snapshotted at write time: the activity re-binds the SAME session object on
|
|
123
|
+
* a fresh-agent recovery, so a live reference would show the second id twice.
|
|
124
|
+
*/
|
|
107
125
|
readonly sessionUpdates: Session[];
|
|
108
126
|
constructor(input: ExecutionRecordInput);
|
|
109
127
|
get executionId(): string;
|
|
@@ -129,7 +147,12 @@ export declare class ExecutionRecord {
|
|
|
129
147
|
* resumed turn runs the tool, exactly as in production.
|
|
130
148
|
*/
|
|
131
149
|
decideWaitingToolCalls(action: ApprovalAction, decidedAt: string): number;
|
|
132
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Apply one `UpdateStatus` write and answer the control signal the server
|
|
152
|
+
* would. A setup-progress report never carries a signal (the runner ignores
|
|
153
|
+
* the response there; the server has nothing to say about a label).
|
|
154
|
+
*/
|
|
155
|
+
applyStatusUpdate(status: AgentExecutionStatus): ExecutionControlSignal;
|
|
133
156
|
/**
|
|
134
157
|
* The control-plane client the activity sees: every read answers from this
|
|
135
158
|
* record; every write lands in it. Reads the activity makes for optional
|
|
@@ -69,13 +69,14 @@ import { CancelledFailure } from "@temporalio/activity";
|
|
|
69
69
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
70
70
|
import { clone, create } from "@bufbuild/protobuf";
|
|
71
71
|
import { AgentExecutionSchema, AgentExecutionStatusSchema, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
72
|
-
import { ExecutionPhase, ToolCallStatus, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
72
|
+
import { ExecutionControlSignal, ExecutionPhase, ToolCallStatus, } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
73
73
|
import { UpdateStatusResponseSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/io_pb";
|
|
74
|
+
import { SessionSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/api_pb";
|
|
74
75
|
import { registerWorkerShutdownSignal, signalWorkerShutdown, unregisterWorkerShutdownSignal, } from "../shared/worker-shutdown.js";
|
|
75
76
|
import { mockStigmerClient } from "./mock-client.js";
|
|
76
77
|
/**
|
|
77
78
|
* An in-memory stand-in for the server's execution row, with the TWO merge
|
|
78
|
-
* rules the activity depends on and no others:
|
|
79
|
+
* rules and the ONE control lever the activity depends on, and no others:
|
|
79
80
|
*
|
|
80
81
|
* - A status whose phase is UNSPECIFIED is a setup-progress report
|
|
81
82
|
* (`reportSetupProgress`): the server keeps `setup_progress` and leaves the
|
|
@@ -84,6 +85,10 @@ import { mockStigmerClient } from "./mock-client.js";
|
|
|
84
85
|
* writer of the transcript; the server's own field-ownership merge — approval
|
|
85
86
|
* fields it owns — is exercised by the test SETTING `approvalAction` on the
|
|
86
87
|
* record between invocations, exactly as `SubmitApproval` would).
|
|
88
|
+
* - Every `UpdateStatus` answers a control signal ({@link ExecutionRecordInput.controlSignal});
|
|
89
|
+
* the server's STOP is the one instruction that travels back to the runner
|
|
90
|
+
* on this channel, and it is a server decision, so it is modelled here and
|
|
91
|
+
* not by the test hand-writing the client.
|
|
87
92
|
*
|
|
88
93
|
* Every persisted status is also kept in order (`persisted`) so a test can
|
|
89
94
|
* assert the phase sequence the activity wrote, independent of the final state.
|
|
@@ -93,17 +98,23 @@ export class ExecutionRecord {
|
|
|
93
98
|
session;
|
|
94
99
|
agentInstance;
|
|
95
100
|
agent;
|
|
101
|
+
controlSignal;
|
|
96
102
|
/** Every `updateStatus` payload, in order, snapshotted at write time. */
|
|
97
103
|
persisted = [];
|
|
98
104
|
/** Setup-progress labels reported before the stream started, in order. */
|
|
99
105
|
setupProgress = [];
|
|
100
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Every `updateSession` payload, in order (the `harness_state_id` write-back),
|
|
108
|
+
* snapshotted at write time: the activity re-binds the SAME session object on
|
|
109
|
+
* a fresh-agent recovery, so a live reference would show the second id twice.
|
|
110
|
+
*/
|
|
101
111
|
sessionUpdates = [];
|
|
102
112
|
constructor(input) {
|
|
103
113
|
this.execution = clone(AgentExecutionSchema, input.execution);
|
|
104
114
|
this.session = input.session;
|
|
105
115
|
this.agentInstance = input.agentInstance;
|
|
106
116
|
this.agent = input.agent;
|
|
117
|
+
this.controlSignal = input.controlSignal ?? (() => ExecutionControlSignal.UNSPECIFIED);
|
|
107
118
|
}
|
|
108
119
|
get executionId() {
|
|
109
120
|
return this.execution.metadata?.id ?? "";
|
|
@@ -159,6 +170,11 @@ export class ExecutionRecord {
|
|
|
159
170
|
}
|
|
160
171
|
return waiting.length;
|
|
161
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Apply one `UpdateStatus` write and answer the control signal the server
|
|
175
|
+
* would. A setup-progress report never carries a signal (the runner ignores
|
|
176
|
+
* the response there; the server has nothing to say about a label).
|
|
177
|
+
*/
|
|
162
178
|
applyStatusUpdate(status) {
|
|
163
179
|
const snapshot = clone(AgentExecutionStatusSchema, status);
|
|
164
180
|
this.persisted.push(snapshot);
|
|
@@ -166,9 +182,10 @@ export class ExecutionRecord {
|
|
|
166
182
|
if (snapshot.setupProgress?.currentPhase) {
|
|
167
183
|
this.setupProgress.push(snapshot.setupProgress.currentPhase);
|
|
168
184
|
}
|
|
169
|
-
return;
|
|
185
|
+
return ExecutionControlSignal.UNSPECIFIED;
|
|
170
186
|
}
|
|
171
187
|
this.execution.status = clone(AgentExecutionStatusSchema, snapshot);
|
|
188
|
+
return this.controlSignal(snapshot);
|
|
172
189
|
}
|
|
173
190
|
/**
|
|
174
191
|
* The control-plane client the activity sees: every read answers from this
|
|
@@ -185,12 +202,11 @@ export class ExecutionRecord {
|
|
|
185
202
|
getAgentInstance: vi.fn(async () => this.agentInstance),
|
|
186
203
|
getAgent: vi.fn(async () => this.agent),
|
|
187
204
|
updateStatus: vi.fn(async (_id, status) => {
|
|
188
|
-
this.applyStatusUpdate(status);
|
|
189
205
|
// The activity reads only `.signal`; UNSPECIFIED means "keep going".
|
|
190
|
-
return create(UpdateStatusResponseSchema, {});
|
|
206
|
+
return create(UpdateStatusResponseSchema, { signal: this.applyStatusUpdate(status) });
|
|
191
207
|
}),
|
|
192
208
|
updateSession: vi.fn(async (session) => {
|
|
193
|
-
this.sessionUpdates.push(session);
|
|
209
|
+
this.sessionUpdates.push(clone(SessionSchema, session));
|
|
194
210
|
return session;
|
|
195
211
|
}),
|
|
196
212
|
getExecutionContextByExecutionId: vi.fn(async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hermetic-activity.js","sourceRoot":"","sources":["../../src/__test-utils__/hermetic-activity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAG3B,MAAM,6DA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EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAEpE,4EAA4E;IAC5E,wEAAwE;IACxE,4BAA4B,CAAC,SAAS,CAAC,CAAC;IACxC,OAAO,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE;QAC1B,oBAAoB,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC;KAC5D,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IACzE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IACtE,CAAC;YAAS,CAAC;QACT,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CAAC,OAAwB;IAC5D,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,YAAY,gBAAgB,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock factory for WorkspaceBackend used across test suites.
|
|
3
|
+
*
|
|
4
|
+
* Returns a typed mock that satisfies the WorkspaceBackend interface.
|
|
5
|
+
* Individual tests can override specific methods via the overrides param
|
|
6
|
+
* or by reassigning the mock after creation.
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkspaceBackend } from "../shared/workspace/types.js";
|
|
9
|
+
type MockOverrides = {
|
|
10
|
+
[K in keyof Omit<WorkspaceBackend, "rootDir">]?: WorkspaceBackend[K];
|
|
11
|
+
} & {
|
|
12
|
+
rootDir?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function mockWorkspaceBackend(overrides?: MockOverrides): WorkspaceBackend;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mock factory for WorkspaceBackend used across test suites.
|
|
3
|
+
*
|
|
4
|
+
* Returns a typed mock that satisfies the WorkspaceBackend interface.
|
|
5
|
+
* Individual tests can override specific methods via the overrides param
|
|
6
|
+
* or by reassigning the mock after creation.
|
|
7
|
+
*/
|
|
8
|
+
import { vi } from "vitest";
|
|
9
|
+
export function mockWorkspaceBackend(overrides = {}) {
|
|
10
|
+
const { rootDir = "/tmp/test-workspace", ...methodOverrides } = overrides;
|
|
11
|
+
return {
|
|
12
|
+
rootDir,
|
|
13
|
+
execute: vi.fn().mockResolvedValue(""),
|
|
14
|
+
readFile: vi.fn().mockResolvedValue(""),
|
|
15
|
+
writeFile: vi.fn().mockResolvedValue(undefined),
|
|
16
|
+
writeFileBuffer: vi.fn().mockResolvedValue(undefined),
|
|
17
|
+
exists: vi.fn().mockResolvedValue(false),
|
|
18
|
+
...methodOverrides,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=mock-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-workspace.js","sourceRoot":"","sources":["../../src/__test-utils__/mock-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAO5B,MAAM,UAAU,oBAAoB,CAAC,YAA2B,EAAE;IAChE,MAAM,EAAE,OAAO,GAAG,qBAAqB,EAAE,GAAG,eAAe,EAAE,GAAG,SAAS,CAAC;IAE1E,OAAO;QACL,OAAO;QACP,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACtC,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;QAC/C,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;QACrD,MAAM,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;QACxC,GAAG,eAAe;KACnB,CAAC;AACJ,CAAC"}
|