@stigmer/runner 3.15.3-dev.20260914121148 → 3.16.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/README.md +2 -1
- package/dist/.build-fingerprint +1 -1
- package/dist/__test-utils__/approval-contract/types.d.ts +1 -1
- package/dist/__test-utils__/hermetic-activity.d.ts +61 -7
- package/dist/__test-utils__/hermetic-activity.js +100 -9
- package/dist/__test-utils__/hermetic-activity.js.map +1 -1
- package/dist/__test-utils__/model-registry-fixture.d.ts +22 -3
- package/dist/__test-utils__/model-registry-fixture.js +22 -7
- package/dist/__test-utils__/model-registry-fixture.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.d.ts +2 -2
- package/dist/activities/execute-cursor/__test-utils__/contract-subject.js +2 -2
- package/dist/activities/execute-cursor/__test-utils__/fold.d.ts +61 -0
- package/dist/activities/execute-cursor/__test-utils__/fold.js +94 -0
- package/dist/activities/execute-cursor/__test-utils__/fold.js.map +1 -0
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js +1 -1
- package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.d.ts +47 -12
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +41 -10
- package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.d.ts +15 -6
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js +17 -4
- package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js.map +1 -1
- package/dist/activities/execute-cursor/adapter.d.ts +4 -4
- package/dist/activities/execute-cursor/adapter.js +4 -4
- package/dist/activities/execute-cursor/approval-policy.d.ts +10 -10
- package/dist/activities/execute-cursor/approval-policy.js +12 -23
- package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
- package/dist/activities/execute-cursor/approval-state.d.ts +35 -1
- package/dist/activities/execute-cursor/approval-state.js +65 -0
- package/dist/activities/execute-cursor/approval-state.js.map +1 -1
- package/dist/activities/execute-cursor/{message-translator.d.ts → boundary-rows.d.ts} +45 -341
- package/dist/activities/execute-cursor/boundary-rows.js +1018 -0
- package/dist/activities/execute-cursor/boundary-rows.js.map +1 -0
- package/dist/activities/execute-cursor/cursor-capabilities.d.ts +1 -1
- package/dist/activities/execute-cursor/cursor-capabilities.js +1 -1
- package/dist/activities/execute-cursor/cursor-event-recorder.d.ts +33 -14
- package/dist/activities/execute-cursor/cursor-event-recorder.js +43 -21
- package/dist/activities/execute-cursor/cursor-event-recorder.js.map +1 -1
- package/dist/activities/execute-cursor/prompt-builder.d.ts +3 -3
- package/dist/activities/execute-cursor/prompt-builder.js +4 -4
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
- package/dist/activities/execute-cursor/service-tier.js +1 -2
- package/dist/activities/execute-cursor/service-tier.js.map +1 -1
- package/dist/activities/execute-cursor/sub-agent-steps.d.ts +79 -0
- package/dist/activities/execute-cursor/sub-agent-steps.js +180 -0
- package/dist/activities/execute-cursor/sub-agent-steps.js.map +1 -0
- package/dist/activities/execute-cursor/tool-result.d.ts +49 -0
- package/dist/activities/execute-cursor/tool-result.js +130 -0
- package/dist/activities/execute-cursor/tool-result.js.map +1 -0
- package/dist/activities/execute-cursor/translator.d.ts +178 -0
- package/dist/activities/execute-cursor/translator.js +485 -0
- package/dist/activities/execute-cursor/translator.js.map +1 -0
- package/dist/activities/execute-cursor/turn-boundary.d.ts +15 -5
- package/dist/activities/execute-cursor/turn-boundary.js +10 -14
- package/dist/activities/execute-cursor/turn-boundary.js.map +1 -1
- package/dist/activities/execute-cursor/turn-settle.d.ts +11 -7
- package/dist/activities/execute-cursor/turn-settle.js +47 -34
- package/dist/activities/execute-cursor/turn-settle.js.map +1 -1
- package/dist/activities/execute-cursor/turn-setup.d.ts +2 -2
- package/dist/activities/execute-cursor/turn-setup.js +5 -5
- package/dist/activities/execute-cursor/turn-setup.js.map +1 -1
- package/dist/activities/execute-cursor/turn-stream.d.ts +23 -14
- package/dist/activities/execute-cursor/turn-stream.js +41 -28
- package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
- package/dist/activities/execute-cursor/turn.d.ts +4 -4
- package/dist/activities/execute-cursor/turn.js +5 -5
- package/dist/activities/execute-cursor/usage-pricing.d.ts +2 -2
- package/dist/activities/execute-cursor/usage-pricing.js +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.d.ts +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.js +2 -2
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.d.ts +16 -11
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js +22 -10
- package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.d.ts +2 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js +2 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.d.ts +12 -3
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js +18 -4
- package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js.map +1 -1
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.d.ts +10 -1
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js +24 -11
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js.map +1 -1
- package/dist/activities/execute-deep-agent/adapter.d.ts +1 -1
- package/dist/activities/execute-deep-agent/adapter.js +1 -1
- package/dist/activities/execute-deep-agent/approval-file-change.d.ts +19 -19
- package/dist/activities/execute-deep-agent/approval-file-change.js +16 -15
- package/dist/activities/execute-deep-agent/approval-file-change.js.map +1 -1
- package/dist/activities/execute-deep-agent/deep-agent-capabilities.d.ts +2 -2
- package/dist/activities/execute-deep-agent/deep-agent-capabilities.js +2 -2
- package/dist/activities/execute-deep-agent/hitl.d.ts +2 -2
- package/dist/activities/execute-deep-agent/hitl.js +2 -2
- package/dist/activities/execute-deep-agent/inline-publisher.d.ts +13 -3
- package/dist/activities/execute-deep-agent/inline-publisher.js +3 -3
- package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +3 -3
- package/dist/activities/execute-deep-agent/prompt-builder.js +6 -7
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +16 -8
- package/dist/activities/execute-deep-agent/streaming-side-effects.js +20 -33
- package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
- package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +3 -3
- package/dist/activities/execute-deep-agent/subagent-transformer.js +1 -1
- package/dist/activities/execute-deep-agent/translator.d.ts +134 -0
- package/dist/activities/execute-deep-agent/translator.js +418 -0
- package/dist/activities/execute-deep-agent/translator.js.map +1 -0
- package/dist/activities/execute-deep-agent/turn-settle.d.ts +13 -7
- package/dist/activities/execute-deep-agent/turn-settle.js +34 -45
- package/dist/activities/execute-deep-agent/turn-settle.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn-setup.d.ts +8 -8
- package/dist/activities/execute-deep-agent/turn-setup.js +7 -7
- package/dist/activities/execute-deep-agent/turn-stream.d.ts +13 -10
- package/dist/activities/execute-deep-agent/turn-stream.js +44 -41
- package/dist/activities/execute-deep-agent/turn-stream.js.map +1 -1
- package/dist/activities/execute-deep-agent/turn.d.ts +3 -3
- package/dist/activities/execute-deep-agent/turn.js +3 -3
- package/dist/activities/generate-session-subject.d.ts +25 -4
- package/dist/activities/generate-session-subject.js +17 -7
- package/dist/activities/generate-session-subject.js.map +1 -1
- package/dist/client/stigmer-client.d.ts +17 -6
- package/dist/client/stigmer-client.js +47 -14
- package/dist/client/stigmer-client.js.map +1 -1
- package/dist/config.d.ts +6 -3
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/harness/approval-decisions.d.ts +1 -1
- package/dist/harness/approval-decisions.js +1 -1
- package/dist/harness/capabilities.d.ts +21 -11
- package/dist/harness/capabilities.js +2 -2
- package/dist/harness/capture.d.ts +4 -4
- package/dist/harness/capture.js +4 -4
- package/dist/harness/persist-chokepoint.d.ts +3 -3
- package/dist/harness/persist-chokepoint.js +3 -3
- package/dist/harness/registry.d.ts +2 -2
- package/dist/harness/registry.js +2 -2
- package/dist/harness/run-turn.d.ts +6 -4
- package/dist/harness/run-turn.js +31 -9
- package/dist/harness/run-turn.js.map +1 -1
- package/dist/harness/stop-controller.d.ts +1 -1
- package/dist/harness/stop-controller.js +1 -1
- package/dist/harness/terminal-table.d.ts +7 -7
- package/dist/harness/terminal-table.js +7 -7
- package/dist/harness/transcript/builder.d.ts +182 -0
- package/dist/harness/transcript/builder.js +693 -0
- package/dist/harness/transcript/builder.js.map +1 -0
- package/dist/harness/transcript/events.d.ts +218 -0
- package/dist/harness/transcript/events.js +50 -0
- package/dist/harness/transcript/events.js.map +1 -0
- package/dist/harness/transcript/state.d.ts +110 -0
- package/dist/harness/transcript/state.js +148 -0
- package/dist/harness/transcript/state.js.map +1 -0
- package/dist/harness/turn-context.d.ts +54 -38
- package/dist/harness/turn-context.js +42 -43
- package/dist/harness/turn-context.js.map +1 -1
- package/dist/harness/types.d.ts +63 -22
- package/dist/harness/types.js +12 -11
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/usage-accumulator.d.ts +2 -2
- package/dist/harness/usage-accumulator.js +2 -2
- package/dist/harness-adapters.d.ts +5 -4
- package/dist/harness-adapters.js +5 -4
- package/dist/harness-adapters.js.map +1 -1
- package/dist/interceptors/run-credential-activity.d.ts +28 -0
- package/dist/interceptors/run-credential-activity.js +56 -0
- package/dist/interceptors/run-credential-activity.js.map +1 -0
- package/dist/middleware/approval-gate.d.ts +6 -0
- package/dist/middleware/approval-gate.js +7 -57
- package/dist/middleware/approval-gate.js.map +1 -1
- package/dist/middleware/cost-advisory.d.ts +3 -3
- package/dist/middleware/cost-advisory.js +3 -3
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/runner-manager.js +10 -4
- package/dist/runner-manager.js.map +1 -1
- package/dist/shared/activity-input.d.ts +9 -0
- package/dist/shared/activity-input.js +17 -0
- package/dist/shared/activity-input.js.map +1 -1
- package/dist/shared/approval-policy.d.ts +53 -0
- package/dist/shared/approval-policy.js +76 -0
- package/dist/shared/approval-policy.js.map +1 -1
- package/dist/shared/args-preview.d.ts +45 -22
- package/dist/shared/args-preview.js +51 -41
- package/dist/shared/args-preview.js.map +1 -1
- package/dist/shared/attachment-resolver.d.ts +4 -4
- package/dist/shared/attachment-resolver.js +4 -4
- package/dist/shared/attachment-zip.d.ts +2 -2
- package/dist/shared/attachment-zip.js +2 -2
- package/dist/shared/channel-attachment.d.ts +8 -5
- package/dist/shared/channel-attachment.js +10 -6
- package/dist/shared/channel-attachment.js.map +1 -1
- package/dist/shared/cost-guard.d.ts +2 -2
- package/dist/shared/cost-guard.js +2 -2
- package/dist/shared/exact-apply.d.ts +1 -1
- package/dist/shared/exact-apply.js +1 -1
- package/dist/shared/execution-context.d.ts +2 -2
- package/dist/shared/execution-context.js +2 -2
- package/dist/shared/extract-structured-output.d.ts +2 -2
- package/dist/shared/extract-structured-output.js +2 -2
- package/dist/shared/filereview/cas-touched.d.ts +2 -2
- package/dist/shared/filereview/cas-touched.js +2 -2
- package/dist/shared/filereview/progress.d.ts +13 -0
- package/dist/shared/filereview/progress.js +13 -0
- package/dist/shared/filereview/progress.js.map +1 -1
- package/dist/shared/heartbeat.d.ts +1 -1
- package/dist/shared/heartbeat.js +1 -1
- package/dist/shared/llm-backend.d.ts +0 -4
- package/dist/shared/llm-backend.js +0 -4
- package/dist/shared/llm-backend.js.map +1 -1
- package/dist/shared/memory-attachment.d.ts +16 -9
- package/dist/shared/memory-attachment.js +18 -10
- package/dist/shared/memory-attachment.js.map +1 -1
- package/dist/shared/model-error.d.ts +1 -2
- package/dist/shared/model-error.js +1 -2
- package/dist/shared/model-error.js.map +1 -1
- package/dist/shared/persist-decision.d.ts +18 -24
- package/dist/shared/persist-decision.js +19 -11
- package/dist/shared/persist-decision.js.map +1 -1
- package/dist/shared/prompt-sections.d.ts +4 -4
- package/dist/shared/prompt-sections.js +4 -4
- package/dist/shared/run-credential-store.d.ts +32 -0
- package/dist/shared/run-credential-store.js +39 -0
- package/dist/shared/run-credential-store.js.map +1 -0
- package/dist/shared/run-credential.d.ts +61 -0
- package/dist/shared/run-credential.js +68 -0
- package/dist/shared/run-credential.js.map +1 -0
- package/dist/shared/skill-resolver.d.ts +3 -3
- package/dist/shared/skill-resolver.js +3 -3
- package/dist/shared/status-offload.d.ts +1 -1
- package/dist/shared/status-offload.js +2 -2
- package/dist/shared/status-offload.js.map +1 -1
- package/dist/shared/streaming-scheduler.d.ts +2 -7
- package/dist/shared/streaming-scheduler.js +6 -14
- package/dist/shared/streaming-scheduler.js.map +1 -1
- package/dist/shared/subagent-rows.d.ts +2 -2
- package/dist/shared/subagent-rows.js +2 -2
- package/dist/shared/synthesized-attachment.d.ts +30 -3
- package/dist/shared/synthesized-attachment.js +26 -0
- package/dist/shared/synthesized-attachment.js.map +1 -1
- package/dist/shared/todos.d.ts +3 -3
- package/dist/shared/todos.js +3 -3
- package/dist/shared/tool-row.d.ts +19 -1
- package/dist/shared/tool-row.js +36 -2
- package/dist/shared/tool-row.js.map +1 -1
- package/dist/shared/worker-shutdown.d.ts +1 -1
- package/dist/shared/worker-shutdown.js +1 -1
- package/dist/shared/workspace/session-provision.d.ts +1 -1
- package/dist/shared/workspace/session-provision.js +1 -1
- package/dist/shared/workspace/sources/empty.d.ts +1 -1
- package/dist/shared/workspace/sources/empty.js +1 -2
- package/dist/shared/workspace/sources/empty.js.map +1 -1
- package/dist/shared/workspace/sources/git.js +4 -4
- package/dist/shared/workspace/sources/git.js.map +1 -1
- package/dist/shared/workspace/sources/local-path.js +6 -6
- package/dist/shared/workspace/sources/local-path.js.map +1 -1
- package/dist/shared/workspace/stigmer-link.d.ts +1 -1
- package/dist/shared/workspace/stigmer-link.js +1 -1
- package/dist/shared/workspace/types.d.ts +2 -5
- package/dist/shared/workspace/types.js +0 -6
- package/dist/shared/workspace/types.js.map +1 -1
- package/dist/shared/workspace/writeback-coordinator.d.ts +17 -4
- package/dist/shared/workspace/writeback-coordinator.js +7 -9
- package/dist/shared/workspace/writeback-coordinator.js.map +1 -1
- package/dist/worker.js +10 -3
- package/dist/worker.js.map +1 -1
- package/dist/workflow-source.d.ts +10 -0
- package/dist/workflow-source.js +12 -0
- package/dist/workflow-source.js.map +1 -1
- package/dist/workflows/execute-from-execution.d.ts +15 -0
- package/dist/workflows/execute-from-execution.js +11 -0
- package/dist/workflows/execute-from-execution.js.map +1 -1
- package/dist/workflows/index.d.ts +5 -3
- package/dist/workflows/index.js +5 -3
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/interceptors/run-credential.d.ts +34 -0
- package/dist/workflows/interceptors/run-credential.js +71 -0
- package/dist/workflows/interceptors/run-credential.js.map +1 -0
- package/package.json +4 -4
- package/src/__test-utils__/__tests__/execution-record-barrier.test.ts +70 -0
- package/src/__test-utils__/__tests__/harness-contract-self-check.test.ts +35 -1
- package/src/__test-utils__/approval-contract/contract.ts +1 -1
- package/src/__test-utils__/approval-contract/types.ts +1 -1
- package/src/__test-utils__/harness-boot-order-child.ts +1 -1
- package/src/__test-utils__/harness-contract/contract.ts +8 -8
- package/src/__test-utils__/harness-contract/recording-sink.ts +11 -1
- package/src/__test-utils__/harness-contract/runtime-contract.ts +52 -16
- package/src/__test-utils__/harness-contract/scripted-adapter.ts +47 -43
- package/src/__test-utils__/hermetic-activity.ts +113 -9
- package/src/__test-utils__/model-registry-fixture.ts +31 -7
- package/src/__test-utils__/module-specifiers.ts +32 -3
- package/src/__tests__/harness-boot-order.test.ts +1 -1
- package/src/__tests__/harness-contract.test.ts +1 -1
- package/src/__tests__/run-credential-e2e.test.ts +233 -0
- package/src/__tests__/run-credential-registration.test.ts +80 -0
- package/src/__tests__/runner-manager.test.ts +1 -1
- package/src/activities/__tests__/generate-session-subject-wire.test.ts +119 -0
- package/src/activities/execute-cursor/__test-utils__/__tests__/scripted-double.test.ts +1 -1
- package/src/activities/execute-cursor/__test-utils__/contract-subject.ts +2 -2
- package/src/activities/execute-cursor/__test-utils__/fold.ts +116 -0
- package/src/activities/execute-cursor/__test-utils__/gateway-substrate.ts +1 -1
- package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +67 -17
- package/src/activities/execute-cursor/__test-utils__/scripted-agent.ts +19 -5
- package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/approval-state.test.ts +14 -21
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +3 -3
- package/src/activities/execute-cursor/__tests__/coarse-fingerprint.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/cursor-event-recorder.test.ts +142 -0
- package/src/activities/execute-cursor/__tests__/cursor-fetch-interceptor-bypass.test.ts +19 -8
- package/src/activities/execute-cursor/__tests__/cursor-sdk-auth-smoke.test.ts +10 -8
- package/src/activities/execute-cursor/__tests__/cursor-transcript-live.test.ts +298 -0
- package/src/activities/execute-cursor/__tests__/deny-gate-exact-apply.test.ts +4 -2
- package/src/activities/execute-cursor/__tests__/fetch-interceptor.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/deny-and-retry.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/mcp-tool-call.status.json +71 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/sdk-task-note.status.json +73 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.error-delta.status.json +78 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.output-first.status.json +72 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.status.json +72 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/sub-agent-delegation.status.json +109 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/thinking-turn.status.json +78 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/todo-write.status.json +119 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-error.status.json +68 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-only-step.status.json +67 -0
- package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/harness-contract.test.ts +7 -7
- package/src/activities/execute-cursor/__tests__/hermetic/mcp-tool-call.test.ts +146 -0
- package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +5 -5
- package/src/activities/execute-cursor/__tests__/hermetic/plain-turn.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/hermetic/run-wait-arms.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/hermetic/sdk-task-note.test.ts +122 -0
- package/src/activities/execute-cursor/__tests__/hermetic/shell-output-delta.test.ts +276 -0
- package/src/activities/execute-cursor/__tests__/hermetic/stream-self-stop-arms.test.ts +8 -8
- package/src/activities/execute-cursor/__tests__/hermetic/sub-agent-delegation.test.ts +196 -0
- package/src/activities/execute-cursor/__tests__/hermetic/thinking-turn.test.ts +145 -0
- package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/hermetic/todo-write.test.ts +165 -0
- package/src/activities/execute-cursor/__tests__/hermetic/tool-call.test.ts +3 -3
- package/src/activities/execute-cursor/__tests__/hermetic/tool-error.test.ts +138 -0
- package/src/activities/execute-cursor/__tests__/hermetic/tool-only-step.test.ts +130 -0
- package/src/activities/execute-cursor/__tests__/hermetic/unattributed-hook-block.test.ts +13 -1
- package/src/activities/execute-cursor/__tests__/hermetic/workspace-lock-timeout.test.ts +2 -2
- package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +43 -60
- package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +23 -28
- package/src/activities/execute-cursor/__tests__/hook-script.test.ts +2 -1
- package/src/activities/execute-cursor/__tests__/http2-interceptor.test.ts +1 -1
- package/src/activities/execute-cursor/__tests__/prompt-goldens.test.ts +5 -5
- package/src/activities/execute-cursor/__tests__/same-identity-reproposal.test.ts +11 -13
- package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +8 -11
- package/src/activities/execute-cursor/__tests__/tool-result-image.test.ts +8 -22
- package/src/activities/execute-cursor/__tests__/translator.test.ts +594 -0
- package/src/activities/execute-cursor/__tests__/turn-boundary.test.ts +8 -5
- package/src/activities/execute-cursor/__tests__/turn-stream.test.ts +87 -63
- package/src/activities/execute-cursor/adapter.ts +4 -4
- package/src/activities/execute-cursor/approval-policy.ts +12 -24
- package/src/activities/execute-cursor/approval-state.ts +66 -1
- package/src/activities/execute-cursor/boundary-rows.ts +1132 -0
- package/src/activities/execute-cursor/cursor-capabilities.ts +1 -1
- package/src/activities/execute-cursor/cursor-event-recorder.ts +57 -28
- package/src/activities/execute-cursor/fetch-interceptor.ts +1 -1
- package/src/activities/execute-cursor/http2-interceptor.ts +1 -1
- package/src/activities/execute-cursor/prompt-builder.ts +6 -6
- package/src/activities/execute-cursor/service-tier.ts +1 -2
- package/src/activities/execute-cursor/sub-agent-steps.ts +188 -0
- package/src/activities/execute-cursor/tool-result.ts +128 -0
- package/src/activities/execute-cursor/translator.ts +541 -0
- package/src/activities/execute-cursor/turn-boundary.ts +21 -14
- package/src/activities/execute-cursor/turn-settle.ts +46 -34
- package/src/activities/execute-cursor/turn-setup.ts +5 -5
- package/src/activities/execute-cursor/turn-stream.ts +49 -46
- package/src/activities/execute-cursor/turn.ts +5 -5
- package/src/activities/execute-cursor/usage-pricing.ts +2 -2
- package/src/activities/execute-deep-agent/__test-utils__/contract-subject.ts +2 -2
- package/src/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.ts +23 -11
- package/src/activities/execute-deep-agent/__test-utils__/hitl-script.ts +1 -1
- package/src/activities/execute-deep-agent/__test-utils__/scripted-model-module.ts +2 -3
- package/src/activities/execute-deep-agent/__test-utils__/scripted-model.ts +25 -4
- package/src/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.ts +25 -11
- package/src/activities/execute-deep-agent/__tests__/adapter-graph-is-sdk-free.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/adapter-is-temporal-free.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/approval-file-change.test.ts +6 -17
- package/src/activities/execute-deep-agent/__tests__/hermetic/file-review-capture.test.ts +25 -8
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn1.status.json +2 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn2.status.json +4 -14
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/file-review-capture.status.json +4 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/gate.turn1.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn1.status.json +2 -9
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn2.status.json +2 -9
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.after-tool.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.mid-tool.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/platform-stop.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/recursion-limit.persisted.status.json +109 -76
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/reject.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn2.status.json +2 -10
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn3.status.json +2 -10
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/skip.turn2.status.json +1 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sub-agent-delegation.status.json +3 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/tool-call.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/worker-shutdown.status.json +1 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/write-todos.status.json +92 -0
- package/src/activities/execute-deep-agent/__tests__/hermetic/harness-contract.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-approve-all-lease.test.ts +9 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-round-trips.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-sequential-gates.test.ts +3 -3
- package/src/activities/execute-deep-agent/__tests__/hermetic/inline-artifact-across-gate.test.ts +7 -6
- package/src/activities/execute-deep-agent/__tests__/hermetic/pause-vs-shutdown.test.ts +10 -11
- package/src/activities/execute-deep-agent/__tests__/hermetic/plain-turn.test.ts +4 -4
- package/src/activities/execute-deep-agent/__tests__/hermetic/platform-stop.test.ts +9 -8
- package/src/activities/execute-deep-agent/__tests__/hermetic/recursion-limit.test.ts +21 -13
- package/src/activities/execute-deep-agent/__tests__/hermetic/resolution-error.test.ts +2 -2
- package/src/activities/execute-deep-agent/__tests__/hermetic/structured-output.test.ts +7 -7
- package/src/activities/execute-deep-agent/__tests__/hermetic/sub-agent-delegation.test.ts +28 -12
- package/src/activities/execute-deep-agent/__tests__/hermetic/tool-call.test.ts +21 -21
- package/src/activities/execute-deep-agent/__tests__/hermetic/workspace-lock-timeout.test.ts +5 -5
- package/src/activities/execute-deep-agent/__tests__/hermetic/write-todos.test.ts +160 -0
- package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +35 -30
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +3 -4
- package/src/activities/execute-deep-agent/__tests__/prompt-goldens.test.ts +12 -10
- package/src/activities/execute-deep-agent/__tests__/scripted-model.test.ts +13 -3
- package/src/activities/execute-deep-agent/__tests__/streaming-side-effects.test.ts +26 -18
- package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +1 -1
- package/src/activities/execute-deep-agent/__tests__/{subagent-tracker.test.ts → translator-subagents.test.ts} +76 -57
- package/src/activities/execute-deep-agent/__tests__/{v3-status-builder.test.ts → translator-through-builder.test.ts} +213 -299
- package/src/activities/execute-deep-agent/__tests__/translator.test.ts +505 -0
- package/src/activities/execute-deep-agent/__tests__/turn-stream.test.ts +11 -29
- package/src/activities/execute-deep-agent/adapter.ts +1 -1
- package/src/activities/execute-deep-agent/approval-file-change.ts +20 -22
- package/src/activities/execute-deep-agent/deep-agent-capabilities.ts +2 -2
- package/src/activities/execute-deep-agent/hitl.ts +2 -2
- package/src/activities/execute-deep-agent/inline-publisher.ts +16 -5
- package/src/activities/execute-deep-agent/prompt-builder.ts +6 -7
- package/src/activities/execute-deep-agent/streaming-side-effects.ts +22 -31
- package/src/activities/execute-deep-agent/subagent-transformer.ts +3 -3
- package/src/activities/execute-deep-agent/translator.ts +463 -0
- package/src/activities/execute-deep-agent/turn-settle.ts +35 -43
- package/src/activities/execute-deep-agent/turn-setup.ts +8 -8
- package/src/activities/execute-deep-agent/turn-stream.ts +53 -51
- package/src/activities/execute-deep-agent/turn.ts +3 -3
- package/src/activities/generate-session-subject.ts +29 -4
- package/src/client/__tests__/stigmer-client.test.ts +92 -0
- package/src/client/stigmer-client.ts +48 -14
- package/src/config.ts +6 -3
- package/src/harness/README.md +335 -0
- package/src/harness/__tests__/approval-decisions.test.ts +2 -2
- package/src/harness/__tests__/capture.test.ts +3 -3
- package/src/harness/__tests__/import-direction.test.ts +3 -2
- package/src/harness/__tests__/mount-skills.test.ts +4 -1
- package/src/harness/__tests__/readme-index.test.ts +339 -0
- package/src/harness/__tests__/run-turn.test.ts +131 -6
- package/src/harness/__tests__/transcript-is-engine-free.test.ts +83 -0
- package/src/harness/__tests__/transcript-writers.test.ts +191 -0
- package/src/harness/__tests__/turn-attachments-vision.test.ts +5 -2
- package/src/harness/__tests__/turn-context.test.ts +5 -5
- package/src/harness/approval-decisions.ts +1 -1
- package/src/harness/capabilities.ts +21 -11
- package/src/harness/capture.ts +4 -4
- package/src/harness/persist-chokepoint.ts +3 -3
- package/src/harness/registry.ts +2 -2
- package/src/harness/run-turn.ts +33 -9
- package/src/harness/stop-controller.ts +1 -1
- package/src/harness/terminal-table.ts +7 -7
- package/src/harness/transcript/__tests__/builder.test.ts +975 -0
- package/src/harness/transcript/__tests__/state.test.ts +143 -0
- package/src/harness/transcript/builder.ts +755 -0
- package/src/harness/transcript/events.ts +262 -0
- package/src/harness/transcript/state.ts +167 -0
- package/src/harness/turn-context.ts +61 -46
- package/src/harness/types.ts +64 -22
- package/src/harness/usage-accumulator.ts +2 -2
- package/src/harness-adapters.ts +5 -4
- package/src/interceptors/__tests__/run-credential-activity.test.ts +133 -0
- package/src/interceptors/run-credential-activity.ts +67 -0
- package/src/middleware/__tests__/cost-advisory.test.ts +2 -2
- package/src/middleware/approval-gate.ts +7 -74
- package/src/middleware/cost-advisory.ts +3 -3
- package/src/middleware/index.ts +1 -1
- package/src/runner-manager.ts +14 -4
- package/src/shared/__tests__/approval-policy.test.ts +45 -0
- package/src/shared/__tests__/args-preview.test.ts +40 -20
- package/src/shared/__tests__/attachment-naming.test.ts +1 -1
- package/src/shared/__tests__/attachment-resolver.test.ts +5 -5
- package/src/shared/__tests__/attachment-zip.test.ts +1 -1
- package/src/shared/__tests__/blueprint-resolver.test.ts +1 -1
- package/src/shared/__tests__/channel-attachment.test.ts +12 -0
- package/src/shared/__tests__/cost-guard.test.ts +1 -1
- package/src/shared/__tests__/exact-apply.test.ts +2 -1
- package/src/shared/__tests__/memory-attachment.test.ts +17 -0
- package/src/shared/__tests__/persist-decision.test.ts +19 -33
- package/src/shared/__tests__/prompt-sections.test.ts +1 -1
- package/src/shared/__tests__/run-credential.test.ts +111 -0
- package/src/shared/__tests__/stamp-flowed-rows.test.ts +1 -1
- package/src/shared/__tests__/status-offload.test.ts +1 -1
- package/src/shared/__tests__/streaming-scheduler.test.ts +8 -9
- package/src/shared/__tests__/todos.test.ts +1 -1
- package/src/shared/__tests__/tool-row.test.ts +1 -1
- package/src/shared/activity-input.ts +21 -0
- package/src/shared/approval-policy.ts +95 -0
- package/src/shared/args-preview.ts +51 -42
- package/src/shared/attachment-resolver.ts +4 -4
- package/src/shared/attachment-zip.ts +2 -2
- package/src/shared/channel-attachment.ts +14 -6
- package/src/shared/cost-guard.ts +2 -2
- package/src/shared/exact-apply.ts +1 -1
- package/src/shared/execution-context.ts +2 -2
- package/src/shared/extract-structured-output.ts +2 -2
- package/src/shared/filereview/__tests__/capture.test.ts +9 -5
- package/src/shared/filereview/__tests__/git-substrate.test.ts +4 -1
- package/src/shared/filereview/__tests__/proxy-reconcile.test.ts +3 -3
- package/src/shared/filereview/cas-touched.ts +2 -2
- package/src/shared/filereview/progress.ts +13 -0
- package/src/shared/heartbeat.ts +1 -1
- package/src/shared/llm-backend.ts +0 -4
- package/src/shared/memory-attachment.ts +22 -10
- package/src/shared/model-error.ts +1 -2
- package/src/shared/persist-decision.ts +19 -28
- package/src/shared/prompt-sections.ts +4 -4
- package/src/shared/run-credential-store.ts +45 -0
- package/src/shared/run-credential.ts +70 -0
- package/src/shared/skill-resolver.ts +3 -3
- package/src/shared/status-offload.ts +2 -2
- package/src/shared/streaming-scheduler.ts +8 -13
- package/src/shared/subagent-rows.ts +2 -2
- package/src/shared/synthesized-attachment.ts +38 -3
- package/src/shared/todos.ts +3 -3
- package/src/shared/tool-row.ts +38 -2
- package/src/shared/worker-shutdown.ts +1 -1
- package/src/shared/workspace/__tests__/git-source.test.ts +3 -3
- package/src/shared/workspace/__tests__/provisioner.test.ts +5 -5
- package/src/shared/workspace/__tests__/session-provision.test.ts +2 -2
- package/src/shared/workspace/__tests__/writeback-coordinator.integration.test.ts +8 -9
- package/src/shared/workspace/__tests__/writeback-coordinator.test.ts +25 -25
- package/src/shared/workspace/provisioner.ts +1 -1
- package/src/shared/workspace/session-provision.ts +1 -1
- package/src/shared/workspace/sources/empty.ts +2 -2
- package/src/shared/workspace/sources/git.ts +3 -4
- package/src/shared/workspace/sources/local-path.ts +5 -6
- package/src/shared/workspace/stigmer-link.ts +1 -1
- package/src/shared/workspace/types.ts +2 -5
- package/src/shared/workspace/writeback-coordinator.ts +23 -12
- package/src/worker.ts +15 -3
- package/src/workflow-source.ts +15 -0
- package/src/workflows/__tests__/run-credential-interceptor.test.ts +178 -0
- package/src/workflows/execute-from-execution.ts +17 -0
- package/src/workflows/index.ts +5 -3
- package/src/workflows/interceptors/run-credential.ts +101 -0
- package/dist/activities/execute-cursor/delta-enricher.d.ts +0 -87
- package/dist/activities/execute-cursor/delta-enricher.js +0 -265
- package/dist/activities/execute-cursor/delta-enricher.js.map +0 -1
- package/dist/activities/execute-cursor/message-translator.js +0 -2040
- package/dist/activities/execute-cursor/message-translator.js.map +0 -1
- package/dist/activities/execute-cursor/todo-tracker.d.ts +0 -40
- package/dist/activities/execute-cursor/todo-tracker.js +0 -80
- package/dist/activities/execute-cursor/todo-tracker.js.map +0 -1
- package/dist/activities/execute-deep-agent/execution-state.d.ts +0 -54
- package/dist/activities/execute-deep-agent/execution-state.js +0 -68
- package/dist/activities/execute-deep-agent/execution-state.js.map +0 -1
- package/dist/activities/execute-deep-agent/status-builder-shared.d.ts +0 -65
- package/dist/activities/execute-deep-agent/status-builder-shared.js +0 -90
- package/dist/activities/execute-deep-agent/status-builder-shared.js.map +0 -1
- package/dist/activities/execute-deep-agent/subagent-tracker.d.ts +0 -113
- package/dist/activities/execute-deep-agent/subagent-tracker.js +0 -400
- package/dist/activities/execute-deep-agent/subagent-tracker.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-events.d.ts +0 -102
- package/dist/activities/execute-deep-agent/v3-events.js +0 -35
- package/dist/activities/execute-deep-agent/v3-events.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.d.ts +0 -15
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js +0 -235
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js.map +0 -1
- package/dist/activities/execute-deep-agent/v3-status-builder.d.ts +0 -111
- package/dist/activities/execute-deep-agent/v3-status-builder.js +0 -457
- package/dist/activities/execute-deep-agent/v3-status-builder.js.map +0 -1
- package/dist/shared/execution-status-writer.d.ts +0 -31
- package/dist/shared/execution-status-writer.js +0 -43
- package/dist/shared/execution-status-writer.js.map +0 -1
- package/src/activities/execute-cursor/__tests__/delta-enricher.test.ts +0 -310
- package/src/activities/execute-cursor/__tests__/message-translator.test.ts +0 -1033
- package/src/activities/execute-cursor/__tests__/todo-tracker.test.ts +0 -498
- package/src/activities/execute-cursor/delta-enricher.ts +0 -307
- package/src/activities/execute-cursor/message-translator.ts +0 -2319
- package/src/activities/execute-cursor/todo-tracker.ts +0 -91
- package/src/activities/execute-deep-agent/__tests__/execution-state-extended.test.ts +0 -148
- package/src/activities/execute-deep-agent/__tests__/execution-state.test.ts +0 -154
- package/src/activities/execute-deep-agent/__tests__/status-builder-shared.test.ts +0 -47
- package/src/activities/execute-deep-agent/__tests__/v3-protocol-normalizer.test.ts +0 -324
- package/src/activities/execute-deep-agent/execution-state.ts +0 -78
- package/src/activities/execute-deep-agent/status-builder-shared.ts +0 -142
- package/src/activities/execute-deep-agent/subagent-tracker.ts +0 -479
- package/src/activities/execute-deep-agent/v3-events.ts +0 -153
- package/src/activities/execute-deep-agent/v3-protocol-normalizer.ts +0 -264
- package/src/activities/execute-deep-agent/v3-status-builder.ts +0 -565
- package/src/shared/execution-status-writer.ts +0 -56
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The activity boundary's ONE entry into the run-credential store.
|
|
3
|
+
*
|
|
4
|
+
* Every activity a worker runs — the server-dispatched turn activities, the
|
|
5
|
+
* server-dispatched GenerateSessionSubject, and every local or remote
|
|
6
|
+
* activity the runner's own serverless-workflow engine schedules — passes
|
|
7
|
+
* through this inbound interceptor. It reads the run credential from
|
|
8
|
+
* whichever channel the dispatch used (`shared/run-credential.ts`: the
|
|
9
|
+
* Temporal header the runner's workflow stamps, else the input object's
|
|
10
|
+
* key the server's workflow sets) and runs the activity inside
|
|
11
|
+
* `withRunCredential`, so that every control-plane request the activity
|
|
12
|
+
* makes — however deep, however detached — is made as the run's human.
|
|
13
|
+
*
|
|
14
|
+
* Header before input: a runner-dispatched activity's header is the nearer
|
|
15
|
+
* authority; in practice a dispatch carries exactly one of the two. An
|
|
16
|
+
* activity whose dispatch carried neither runs with no credential in the
|
|
17
|
+
* store, and the client falls back to the process credential exactly as it
|
|
18
|
+
* did before the store existed — an older server, and the cloud, see no
|
|
19
|
+
* change.
|
|
20
|
+
*
|
|
21
|
+
* Both worker roots (`worker.ts`, `runner-manager.ts`) register this
|
|
22
|
+
* unconditionally; it is inert without a credential. It logs nothing: a
|
|
23
|
+
* credential is never written to a log, and the arguments it inspects may
|
|
24
|
+
* carry anything.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ActivityInterceptorsFactory } from "@temporalio/worker";
|
|
28
|
+
import { defaultPayloadConverter } from "@temporalio/common";
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
RUN_CREDENTIAL_HEADER,
|
|
32
|
+
readRunCredentialFromInput,
|
|
33
|
+
} from "../shared/run-credential.js";
|
|
34
|
+
import { withRunCredential } from "../shared/run-credential-store.js";
|
|
35
|
+
|
|
36
|
+
/** The inbound interceptor factory both worker roots register. */
|
|
37
|
+
export const runCredentialActivityInterceptor: ActivityInterceptorsFactory =
|
|
38
|
+
() => ({
|
|
39
|
+
inbound: {
|
|
40
|
+
async execute(input, next) {
|
|
41
|
+
const credential =
|
|
42
|
+
readRunCredentialFromHeader(input.headers[RUN_CREDENTIAL_HEADER]) ??
|
|
43
|
+
readRunCredentialFromInput(input.args[0]);
|
|
44
|
+
if (credential === undefined) {
|
|
45
|
+
return next(input);
|
|
46
|
+
}
|
|
47
|
+
return withRunCredential(credential, () => next(input));
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The credential a header payload carries, or `undefined` when there is no
|
|
54
|
+
* such header or it does not decode to a non-empty string. Decoding uses the
|
|
55
|
+
* default converter, never the worker's data converter: headers bypass the
|
|
56
|
+
* payload codecs by SDK design, and the stamping side encodes with the same
|
|
57
|
+
* default converter.
|
|
58
|
+
*/
|
|
59
|
+
function readRunCredentialFromHeader(payload: unknown): string | undefined {
|
|
60
|
+
if (payload === undefined) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const value: unknown = defaultPayloadConverter.fromPayload(
|
|
64
|
+
payload as Parameters<typeof defaultPayloadConverter.fromPayload>[0],
|
|
65
|
+
);
|
|
66
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
67
|
+
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* running total the sub-agent views share, and warns the model ONCE at the
|
|
4
4
|
* configured share of `max_cost_usd`. Nothing here caps: the enforcement is
|
|
5
5
|
* the turn runtime's (`shared/__tests__/cost-guard.test.ts`,
|
|
6
|
-
* `harness/__tests__/run-turn.test.ts`'s cost-cap arm). Until
|
|
6
|
+
* `harness/__tests__/run-turn.test.ts`'s cost-cap arm). Until #1096 this
|
|
7
7
|
* file was `cost-cap.test.ts` and also pinned the in-graph tool block and
|
|
8
|
-
* the "exceeded" message — retired with that half
|
|
8
|
+
* the "exceeded" message — retired with that half.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { describe, it, expect } from "vitest";
|
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
* unrecognized mutating built-in (e.g. `bash`, `overwrite_file`) is therefore
|
|
25
25
|
* gated by what it does, not by whether someone remembered to list it.
|
|
26
26
|
*
|
|
27
|
+
* The decision itself — `resolveToolApproval` — lives in
|
|
28
|
+
* `shared/approval-policy.ts` beside its provenance twin since #1097:
|
|
29
|
+
* the native translator reports the same answer on every
|
|
30
|
+
* `tool_started`, so the transcript row and this gate can never disagree
|
|
31
|
+
* about whether a call waits. This module is where the decision is ACTED on.
|
|
32
|
+
*
|
|
27
33
|
* Gateway invariant (Phase 2): this middleware IS the in-process execution
|
|
28
34
|
* gateway for the deep-agent harness — `handler(request)` is the side effect. A
|
|
29
35
|
* side effect runs only with a backing authorization: either (a) the tool was
|
|
@@ -50,7 +56,7 @@ import {
|
|
|
50
56
|
type MergedToolPolicy,
|
|
51
57
|
type PolicySource,
|
|
52
58
|
POLICY_ENGINE_VERSION,
|
|
53
|
-
|
|
59
|
+
resolveToolApproval,
|
|
54
60
|
unattendedSkipMessage,
|
|
55
61
|
} from "../shared/approval-policy.js";
|
|
56
62
|
import { toolApprovalCategory, type ToolApprovalCategory } from "../shared/tool-kind.js";
|
|
@@ -164,16 +170,6 @@ interface ApprovalDecision {
|
|
|
164
170
|
readonly comment?: string;
|
|
165
171
|
}
|
|
166
172
|
|
|
167
|
-
// Approval-message template per mutating category. Keyed by category (not raw
|
|
168
|
-
// tool name) so every alias of a mutation renders one message; placeholders
|
|
169
|
-
// resolve against the deep-agent stream arg shape (`path`/`command`). Mirrors
|
|
170
|
-
// the Cursor side's CATEGORY_APPROVAL_MESSAGE.
|
|
171
|
-
const CATEGORY_APPROVAL_MESSAGE: Record<ToolApprovalCategory, string> = {
|
|
172
|
-
write: "Write file: {{args.path}}",
|
|
173
|
-
delete: "Delete: {{args.path}}",
|
|
174
|
-
shell: "Execute command: {{args.command}}",
|
|
175
|
-
};
|
|
176
|
-
|
|
177
173
|
/**
|
|
178
174
|
* The ToolMessage returned when a secret-like write is hard-blocked (DD-E /
|
|
179
175
|
* DD-26 #2): the write is NEVER applied and the graph continues (this replaces
|
|
@@ -383,69 +379,6 @@ export function createApprovalGateMiddleware(
|
|
|
383
379
|
};
|
|
384
380
|
}
|
|
385
381
|
|
|
386
|
-
interface ApprovalRequirement {
|
|
387
|
-
readonly requiresApproval: boolean;
|
|
388
|
-
readonly message: string;
|
|
389
|
-
/** Which policy layer determined this verdict — stamped on the shadow receipt. */
|
|
390
|
-
readonly source: PolicySource;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function resolveToolApproval(
|
|
394
|
-
toolName: string,
|
|
395
|
-
serverSlug: string,
|
|
396
|
-
args: Record<string, unknown>,
|
|
397
|
-
policies: ReadonlyMap<string, MergedToolPolicy>,
|
|
398
|
-
leasedCategories: ReadonlySet<ToolApprovalCategory>,
|
|
399
|
-
): ApprovalRequirement {
|
|
400
|
-
if (serverSlug) {
|
|
401
|
-
// MCP tools stay governed by the connect-flow classifier + four-level policy
|
|
402
|
-
// chain. The policy map carries only the tools that REQUIRE approval, so an
|
|
403
|
-
// absent entry means the classifier already auto-approved it — fail-OPEN is
|
|
404
|
-
// correct here (a fail-closed default would re-gate everything the classifier
|
|
405
|
-
// cleared). This is deliberately NOT changed by the built-in fail-closed flip.
|
|
406
|
-
//
|
|
407
|
-
// A server-scoped lease surfaces here as an absent entry too: the leased
|
|
408
|
-
// server's tools are dropped from `policies` upstream (mergeApprovalPolicies),
|
|
409
|
-
// so a lease-cleared MCP tool takes this same auto-approve path. (Its shadow
|
|
410
|
-
// receipt therefore reads classifier_default rather than approval_lease; a
|
|
411
|
-
// faithful per-server lease provenance would need the lease set threaded here
|
|
412
|
-
// and is deferred with the rest of the persisted-receipt work.)
|
|
413
|
-
const key = `${serverSlug}/${toolName}`;
|
|
414
|
-
const policy = policies.get(key);
|
|
415
|
-
if (policy) {
|
|
416
|
-
return {
|
|
417
|
-
requiresApproval: policy.requiresApproval,
|
|
418
|
-
message: resolveApprovalMessage(policy.approvalMessage, toolName, args),
|
|
419
|
-
source: policy.source,
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
// Absent = cleared by the MCP four-level chain (classifier base) or by a
|
|
423
|
-
// server-scoped lease (dropped upstream).
|
|
424
|
-
return { requiresApproval: false, message: "", source: "classifier_default" };
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// Built-in/platform tool: gate exactly the mutating categories via the shared
|
|
428
|
-
// classifier. Fail-CLOSED for the mutating set — any built-in classifyTool
|
|
429
|
-
// deems write/edit/delete/shell requires approval. Read-only and unclassified
|
|
430
|
-
// built-ins are not mutating, so they remain fail-open.
|
|
431
|
-
const category = toolApprovalCategory(toolName);
|
|
432
|
-
if (category) {
|
|
433
|
-
// Run-lifetime category lease: the user chose "approve all <category>"
|
|
434
|
-
// earlier in this run, so every built-in of that category is auto-approved
|
|
435
|
-
// for the rest of the run (the scoped successor to auto-approve-all).
|
|
436
|
-
if (leasedCategories.has(category)) {
|
|
437
|
-
return { requiresApproval: false, message: "", source: "approval_lease" };
|
|
438
|
-
}
|
|
439
|
-
return {
|
|
440
|
-
requiresApproval: true,
|
|
441
|
-
message: resolveApprovalMessage(CATEGORY_APPROVAL_MESSAGE[category], toolName, args),
|
|
442
|
-
source: "builtin_category",
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return { requiresApproval: false, message: "", source: "builtin_category" };
|
|
447
|
-
}
|
|
448
|
-
|
|
449
382
|
/** Shared empty set so a config without leases allocates nothing per call. */
|
|
450
383
|
const EMPTY_CATEGORY_SET: ReadonlySet<ToolApprovalCategory> = new Set();
|
|
451
384
|
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
* shape `execution-budget.ts` already has beside LangGraph's `recursionLimit`:
|
|
12
12
|
* the middleware warns inside the graph, the engine's own limit enforces.
|
|
13
13
|
*
|
|
14
|
-
* Until
|
|
14
|
+
* Until #1096 this module was `cost-cap.ts` and did both: it also
|
|
15
15
|
* blocked every tool call once the running cost passed the cap and gave the
|
|
16
16
|
* model one tool-free round to summarize. That second enforcement lived
|
|
17
17
|
* inside the graph, where the runtime could not see it, and a platform STOP
|
|
18
18
|
* had a sibling (`graceful-stop.ts`, deleted with it) that let the run spend
|
|
19
19
|
* a summary round after the platform said stop. Both went when the runtime
|
|
20
|
-
* became the one place a turn is stopped
|
|
20
|
+
* became the one place a turn is stopped.
|
|
21
21
|
*
|
|
22
22
|
* afterModel — reads `usage_metadata` off the latest AIMessage, prices the
|
|
23
23
|
* call at the parent's rates (a sub-agent on its own model is priced the
|
|
24
|
-
* same way the enforcement prices it; per-sub-agent pricing is
|
|
24
|
+
* same way the enforcement prices it; per-sub-agent pricing is #1121),
|
|
25
25
|
* accumulates the running total, and injects the warning SystemMessage once
|
|
26
26
|
* at `warningPct` of the cap.
|
|
27
27
|
*
|
package/src/middleware/index.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Every middleware here either shapes the graph's tool surface or ADVISES
|
|
22
22
|
* the model; none of them stops the run. A stop — the platform's, the
|
|
23
23
|
* cost cap's, a stall's — is the turn runtime's, delivered to the graph
|
|
24
|
-
* through its abort signal (
|
|
24
|
+
* through its abort signal (since #1096; until then a
|
|
25
25
|
* graceful-stop middleware and the cost cap's tool block were second stops
|
|
26
26
|
* inside the graph that the runtime could not see).
|
|
27
27
|
*
|
package/src/runner-manager.ts
CHANGED
|
@@ -29,7 +29,12 @@ import { DEFAULT_CURSOR_AGENT_RESOLVE_TIMEOUT_MS, DEFAULT_CURSOR_STREAM_STALL_TI
|
|
|
29
29
|
// desktop manager never calls emitRunnerBootTiming, so marks cost nothing).
|
|
30
30
|
import { markBoot } from "./shared/cold-start-timing.js";
|
|
31
31
|
import type { WorkerActivities } from "./worker.js";
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
resolveWorkflowSource,
|
|
34
|
+
runCredentialWorkflowInterceptorModule,
|
|
35
|
+
OTEL_WORKFLOW_INTERCEPTOR_MODULE,
|
|
36
|
+
} from "./workflow-source.js";
|
|
37
|
+
import { runCredentialActivityInterceptor } from "./interceptors/run-credential-activity.js";
|
|
33
38
|
import { resolveRunnerBootstrap, refreshRunnerAccessToken } from "./bootstrap.js";
|
|
34
39
|
import { assertLlmBackendsPreflight } from "./preflight.js";
|
|
35
40
|
import {
|
|
@@ -701,7 +706,7 @@ export function mapManagerOptionsToConfig(
|
|
|
701
706
|
// The manager's proxy credential is the minted runner token once adopted
|
|
702
707
|
// (the control-plane token in lockstep before that), so it is this ref and
|
|
703
708
|
// not `tokenRef`: binding `tokenRef` would keep sending the desktop's own
|
|
704
|
-
// Auth0 token as x-stigmer-auth after the mint
|
|
709
|
+
// Auth0 token as x-stigmer-auth after the mint.
|
|
705
710
|
proxyTokenRef: runnerTokenRef,
|
|
706
711
|
cursorApiKey: proxyActive
|
|
707
712
|
? (options.cursorApiKey ?? "proxy-managed")
|
|
@@ -816,9 +821,14 @@ async function buildInterceptorConfig(): Promise<InterceptorConfig> {
|
|
|
816
821
|
"./interceptors/workflow-metrics-sink.js"
|
|
817
822
|
);
|
|
818
823
|
|
|
819
|
-
|
|
824
|
+
// The run credential's two ends (shared/run-credential.ts), always on and
|
|
825
|
+
// inert without a credential — the same pair the static root registers
|
|
826
|
+
// (worker.ts). The workflow module reaches the bundle through
|
|
827
|
+
// `workflowInterceptorModules` on the runtime path and is baked in on the
|
|
828
|
+
// pre-built path (scripts/bundle-slim.mjs).
|
|
829
|
+
const activityInterceptors: ActivityInterceptorsFactory[] = [runCredentialActivityInterceptor];
|
|
820
830
|
let sinks: InjectedSinks<any> = { ...createWorkflowMetricsSinks() };
|
|
821
|
-
const workflowInterceptorModules: string[] = [];
|
|
831
|
+
const workflowInterceptorModules: string[] = [runCredentialWorkflowInterceptorModule()];
|
|
822
832
|
|
|
823
833
|
// In-flight activity counter: keeps a session/wfexec worker alive while one of
|
|
824
834
|
// its activities (notably the long ExecuteCursor) is running, so a view close
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
resolveApprovalMessage,
|
|
14
14
|
deriveActiveLeases,
|
|
15
15
|
resolveApprovalProvenance,
|
|
16
|
+
resolveToolApproval,
|
|
16
17
|
toProtoPolicySource,
|
|
17
18
|
type ActiveLeases,
|
|
18
19
|
type MergedToolPolicy,
|
|
@@ -510,6 +511,50 @@ describe("resolveApprovalProvenance", () => {
|
|
|
510
511
|
// cases assert the mapping is total and that undefined collapses to UNSPECIFIED.
|
|
511
512
|
// ---------------------------------------------------------------------------
|
|
512
513
|
|
|
514
|
+
describe("resolveToolApproval — THE gate decision, shared by the gate and the translators", () => {
|
|
515
|
+
const NO_CATEGORIES: ReadonlySet<ToolApprovalCategory> = new Set();
|
|
516
|
+
const gated: ReadonlyMap<string, MergedToolPolicy> = new Map([
|
|
517
|
+
["github/create_issue", { toolName: "create_issue", mcpServerSlug: "github", requiresApproval: true, approvalMessage: "Create issue '{{args.title}}'?", source: "agent_override" }],
|
|
518
|
+
]);
|
|
519
|
+
|
|
520
|
+
it("an MCP tool with a gating policy waits, with the policy's message resolved and its layer as source", () => {
|
|
521
|
+
expect(resolveToolApproval("create_issue", "github", { title: "Fix crash" }, gated, NO_CATEGORIES)).toEqual({
|
|
522
|
+
requiresApproval: true,
|
|
523
|
+
message: "Create issue 'Fix crash'?",
|
|
524
|
+
source: "agent_override",
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it("an MCP tool absent from the policy map runs — the classifier cleared it (fail-open), source classifier_default", () => {
|
|
529
|
+
expect(resolveToolApproval("list_issues", "github", {}, gated, NO_CATEGORIES)).toEqual({
|
|
530
|
+
requiresApproval: false,
|
|
531
|
+
message: "",
|
|
532
|
+
source: "classifier_default",
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
it("a mutating built-in waits with its category's message (fail-closed), source builtin_category", () => {
|
|
537
|
+
expect(resolveToolApproval("execute", "", { command: "rm -rf build" }, new Map(), NO_CATEGORIES)).toEqual({
|
|
538
|
+
requiresApproval: true,
|
|
539
|
+
message: "Run command: rm -rf build",
|
|
540
|
+
source: "builtin_category",
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it("a mutating built-in whose category is leased runs, source approval_lease", () => {
|
|
545
|
+
expect(resolveToolApproval("execute", "", { command: "ls" }, new Map(), new Set<ToolApprovalCategory>(["shell"]))).toEqual({
|
|
546
|
+
requiresApproval: false,
|
|
547
|
+
message: "",
|
|
548
|
+
source: "approval_lease",
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it("a read-only or unclassified built-in runs (fail-open)", () => {
|
|
553
|
+
expect(resolveToolApproval("read_file", "", { path: "/x" }, new Map(), NO_CATEGORIES).requiresApproval).toBe(false);
|
|
554
|
+
expect(resolveToolApproval("think", "", {}, new Map(), NO_CATEGORIES).requiresApproval).toBe(false);
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
|
|
513
558
|
describe("toProtoPolicySource", () => {
|
|
514
559
|
it("maps undefined (no governing layer) to UNSPECIFIED", () => {
|
|
515
560
|
expect(toProtoPolicySource(undefined)).toBe(ApprovalPolicySource.UNSPECIFIED);
|
|
@@ -1,38 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Unit tests for the shared args-preview
|
|
2
|
+
* Unit tests for the shared args-preview builder — the ONE preview rule every
|
|
3
|
+
* tool row carries since #1097.
|
|
3
4
|
*
|
|
4
5
|
* The Cursor gate path depends on {@link buildElidedArgsPreview} producing a
|
|
5
6
|
* SMALL, ALWAYS-VALID, salient-preserving preview: the resumed turn re-parses it
|
|
6
7
|
* to rebuild an approval grant's identity, and the persist-time size backstop
|
|
7
8
|
* would replace an oversized preview with an unparseable marker. These pin those
|
|
8
9
|
* invariants so a large write can never silently break the resume round-trip.
|
|
10
|
+
* (The native harness's whole-string-truncating `sanitizeArgsPreview` and its
|
|
11
|
+
* two arms went with it: a preview that could truncate to invalid JSON has no
|
|
12
|
+
* caller left.)
|
|
9
13
|
*/
|
|
10
14
|
|
|
11
15
|
import { describe, it, expect } from "vitest";
|
|
12
|
-
import {
|
|
13
|
-
buildElidedArgsPreview,
|
|
14
|
-
sanitizeArgsPreview,
|
|
15
|
-
MAX_ARGS_PREVIEW_LENGTH,
|
|
16
|
-
} from "../args-preview.js";
|
|
16
|
+
import { buildElidedArgsPreview, redactSensitiveArgs, SALIENT_ARG_FIELDS } from "../args-preview.js";
|
|
17
17
|
|
|
18
|
-
describe("
|
|
19
|
-
it("
|
|
20
|
-
|
|
21
|
-
expect(out.api_key).toBe("[REDACTED]");
|
|
22
|
-
expect(out.path).toBe("a.txt");
|
|
18
|
+
describe("SALIENT_ARG_FIELDS", () => {
|
|
19
|
+
it("spans both harnesses' shapes for a file and a shell command, in priority order", () => {
|
|
20
|
+
expect([...SALIENT_ARG_FIELDS]).toEqual(["file_path", "path", "target_notebook", "command"]);
|
|
23
21
|
});
|
|
22
|
+
});
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
expect(
|
|
28
|
-
expect(preview.endsWith("…")).toBe(true);
|
|
24
|
+
describe("redactSensitiveArgs", () => {
|
|
25
|
+
it("redacts secret keys case-insensitively and keeps everything else verbatim", () => {
|
|
26
|
+
expect(redactSensitiveArgs({ Api_Key: "sk-123", path: "a.txt", n: 1 })).toEqual({ Api_Key: "[REDACTED]", path: "a.txt", n: 1 });
|
|
29
27
|
});
|
|
30
28
|
});
|
|
31
29
|
|
|
32
|
-
describe("buildElidedArgsPreview
|
|
33
|
-
const SALIENT =
|
|
30
|
+
describe("buildElidedArgsPreview", () => {
|
|
31
|
+
const SALIENT = SALIENT_ARG_FIELDS;
|
|
32
|
+
|
|
33
|
+
it("is exactly JSON.stringify(args) for short, secret-free args (what every native row now carries)", () => {
|
|
34
|
+
expect(buildElidedArgsPreview({ path: "/x", n: 2 }, SALIENT)).toBe(JSON.stringify({ path: "/x", n: 2 }));
|
|
35
|
+
});
|
|
34
36
|
|
|
35
|
-
it("
|
|
37
|
+
it("yields an empty string for unserializable args instead of throwing", () => {
|
|
38
|
+
const cyclic: Record<string, unknown> = {};
|
|
39
|
+
cyclic.self = cyclic;
|
|
40
|
+
expect(buildElidedArgsPreview(cyclic, SALIENT)).toBe("");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("stays valid JSON and small for a large write, leaving the content value out", () => {
|
|
36
44
|
const content = "line\n".repeat(100_000); // ~500 KB
|
|
37
45
|
const preview = buildElidedArgsPreview(
|
|
38
46
|
{ path: "src/big.ts", contents: content },
|
|
@@ -43,9 +51,21 @@ describe("buildElidedArgsPreview (cursor gate)", () => {
|
|
|
43
51
|
const parsed = JSON.parse(preview) as Record<string, unknown>;
|
|
44
52
|
// Bounded — nowhere near the raw content size.
|
|
45
53
|
expect(preview.length).toBeLessThan(1_000);
|
|
46
|
-
// The salient path survives verbatim (grant identity)
|
|
54
|
+
// The salient path survives verbatim (grant identity); the content is not
|
|
55
|
+
// in the preview at all — never an in-band marker a reader could mistake
|
|
56
|
+
// for the file (stigmer#1107): a surface that needs it reads the row's args.
|
|
47
57
|
expect(parsed.path).toBe("src/big.ts");
|
|
48
|
-
expect(parsed
|
|
58
|
+
expect("contents" in parsed).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("a value at the cap is carried whole; one character over is left out", () => {
|
|
62
|
+
const atCap = "a".repeat(200);
|
|
63
|
+
const overCap = "a".repeat(201);
|
|
64
|
+
const parsed = JSON.parse(
|
|
65
|
+
buildElidedArgsPreview({ path: "x", note: atCap, essay: overCap }, SALIENT),
|
|
66
|
+
) as Record<string, unknown>;
|
|
67
|
+
expect(parsed.note).toBe(atCap);
|
|
68
|
+
expect("essay" in parsed).toBe(false);
|
|
49
69
|
});
|
|
50
70
|
|
|
51
71
|
it("never elides a salient field, even a very long shell command", () => {
|
|
@@ -129,7 +129,7 @@ describe("cross-harness naming parity", () => {
|
|
|
129
129
|
makeAttachment("Makefile", "attachments/01D/Makefile"),
|
|
130
130
|
];
|
|
131
131
|
|
|
132
|
-
// One attachment pipeline serves both harnesses since
|
|
132
|
+
// One attachment pipeline serves both harnesses since #1096;
|
|
133
133
|
// the names it lands are the ones the React SDK's table above predicts.
|
|
134
134
|
const resolved = await resolveAttachments(attachments, {
|
|
135
135
|
sessionId,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tests for the attachment resolver — the turn runtime's attachment phase,
|
|
3
|
-
* the one pipeline for both harnesses since
|
|
3
|
+
* the one pipeline for both harnesses since #1096 (the native twin,
|
|
4
4
|
* `attachment-injector.ts`, retired then; its ZIP guards moved to
|
|
5
|
-
* `attachment-zip.ts`
|
|
5
|
+
* `attachment-zip.ts` in the same PR).
|
|
6
6
|
*
|
|
7
7
|
* The load-bearing behaviors: storage-key attachments materialize under the
|
|
8
8
|
* platform inputs dir (the universal path — every server-created attachment
|
|
9
9
|
* carries a storage key), the workspace `.stigmer` symlink exists even when
|
|
10
10
|
* the agent has no skills, and any attachment that cannot be materialized
|
|
11
11
|
* fails the resolution loudly (the silent-skip regression behind "plan file
|
|
12
|
-
* wasn't found"). Since
|
|
12
|
+
* wasn't found"). Since #1096 the resolver is the one
|
|
13
13
|
* attachment pipeline for every harness, so it also pins the two behaviors
|
|
14
14
|
* lifted from the native injector: `extract` archives land under their mount
|
|
15
15
|
* directory through the shared #567 guards, and an explicit `mountPath` is
|
|
@@ -279,7 +279,7 @@ describe("resolveAttachments", () => {
|
|
|
279
279
|
|
|
280
280
|
// ── Explicit mountPath: honoured inside the inputs namespace, refused outside ──
|
|
281
281
|
|
|
282
|
-
describe("mountPath
|
|
282
|
+
describe("mountPath", () => {
|
|
283
283
|
it("places a file at its explicit `inputs/…` path, in every spelling the producers use", async () => {
|
|
284
284
|
const { storage } = makeInMemoryArtifactStorage();
|
|
285
285
|
await storage.upload("k/a", Buffer.from("A"), "text/plain");
|
|
@@ -364,7 +364,7 @@ describe("resolveAttachments", () => {
|
|
|
364
364
|
|
|
365
365
|
// ── Archives: `extract` lands the entries under the mount directory ──────
|
|
366
366
|
|
|
367
|
-
describe("extract
|
|
367
|
+
describe("extract", () => {
|
|
368
368
|
const archive = () =>
|
|
369
369
|
Buffer.from(
|
|
370
370
|
buildZip([
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (`shared/attachment-zip.ts`): the manifest checks (paths, traversal, null
|
|
4
4
|
* bytes, duplicates, methods, emptiness, count and declared-size caps) and
|
|
5
5
|
* the central-directory parsing that issue #567 made authoritative. Moved
|
|
6
|
-
* from the native injector's test file
|
|
6
|
+
* from the native injector's test file in #1096 with the code; every
|
|
7
7
|
* archive comes from the shared real-shape builder
|
|
8
8
|
* (@stigmer/zip-structure/testing). The write of an admitted entry is each
|
|
9
9
|
* caller's and is pinned in that caller's tests (`attachment-resolver.test.ts`).
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* (`resolveAgentBlueprint`). Union, deduplicated by slug, the session's ref
|
|
5
5
|
* winning a collision (it may pin a different version).
|
|
6
6
|
*
|
|
7
|
-
* Carried from `skill-writer.test.ts`
|
|
7
|
+
* Carried from `skill-writer.test.ts` in #1096, when the native
|
|
8
8
|
* orchestrator's byte-twin of this function was deleted with its module;
|
|
9
9
|
* until then the runtime's copy was tested only through the twin.
|
|
10
10
|
*/
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
type ChannelMessagingInfo,
|
|
29
29
|
} from "../channel-attachment.js";
|
|
30
30
|
import type { ResolvedMcpServer } from "../mcp-resolver.js";
|
|
31
|
+
import { STDIO_CREDENTIAL_ENV } from "../synthesized-attachment.js";
|
|
31
32
|
|
|
32
33
|
function channel(slug: string): MessagingChannel {
|
|
33
34
|
return { channel: slug, provider: "whatsapp" } as MessagingChannel;
|
|
@@ -158,9 +159,20 @@ describe("synthesizeChannelAttachment", () => {
|
|
|
158
159
|
});
|
|
159
160
|
});
|
|
160
161
|
|
|
162
|
+
it("the stdio child receives the run's credential as its startup bearer — the memory attachment's twin, one carrier", () => {
|
|
163
|
+
const attachment = synthesizeChannelAttachment([info("isc-whatsapp", [])], {
|
|
164
|
+
bridgeEndpoint: null,
|
|
165
|
+
credential: "run-credential",
|
|
166
|
+
backendEndpoint: "http://localhost:7234",
|
|
167
|
+
});
|
|
168
|
+
expect(attachment?.env).toMatchObject({ [STDIO_CREDENTIAL_ENV]: "run-credential" });
|
|
169
|
+
});
|
|
170
|
+
|
|
161
171
|
it("pins the cross-repo strings the mcp-server side guards too", () => {
|
|
162
172
|
expect(CHANNEL_ATTACHMENT_SLUG).toBe("stigmer-channels");
|
|
163
173
|
expect(CHANNELS_ROUTE).toBe("/channels");
|
|
174
|
+
// The mcp-server's startup-credential variable (mcp-server/src/config.ts).
|
|
175
|
+
expect(STDIO_CREDENTIAL_ENV).toBe("STIGMER_API_KEY");
|
|
164
176
|
});
|
|
165
177
|
|
|
166
178
|
it("is approval-free by construction: zero entries in the merged approval map", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Unit tests for the max_cost_usd hard-stop guard (cost-guard.ts), which the
|
|
3
|
-
* Cursor activity
|
|
3
|
+
* Cursor activity called until the turn runtime took it over in #1070.
|
|
4
4
|
*
|
|
5
5
|
* The guard is the cursor-side analog of the native cost-cap middleware
|
|
6
6
|
* (middleware/cost-cap.ts): same proto semantics (0/unset = no cap), same
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @regression file-hitl-phase0 — pins
|
|
2
|
+
* @regression file-hitl-phase0 — pins exact-apply: the runner applies the exact
|
|
3
|
+
* approved whole-file bytes, never model-regenerated ones.
|
|
3
4
|
*
|
|
4
5
|
* Unit tests for resume-time exact-apply (the HITL "what you approve is what gets
|
|
5
6
|
* applied" guarantee for the Cursor deny-only harness).
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
type MemoryCaptureContext,
|
|
31
31
|
} from "../memory-attachment.js";
|
|
32
32
|
import type { ResolvedMcpServer } from "../mcp-resolver.js";
|
|
33
|
+
import { STDIO_CREDENTIAL_ENV } from "../synthesized-attachment.js";
|
|
33
34
|
|
|
34
35
|
const context: MemoryCaptureContext = {
|
|
35
36
|
org: "acme",
|
|
@@ -117,6 +118,22 @@ describe("synthesizeMemoryAttachment", () => {
|
|
|
117
118
|
});
|
|
118
119
|
});
|
|
119
120
|
|
|
121
|
+
it("the stdio child receives the run's credential as its startup bearer — the same credential the bridge shape presents per request", () => {
|
|
122
|
+
const attachment = synthesizeMemoryAttachment(enabled, context, {
|
|
123
|
+
...ossOptions,
|
|
124
|
+
credential: "run-credential",
|
|
125
|
+
});
|
|
126
|
+
expect(attachment?.connectionType).toBe("stdio");
|
|
127
|
+
expect(attachment?.env).toMatchObject({
|
|
128
|
+
[STDIO_CREDENTIAL_ENV]: "run-credential",
|
|
129
|
+
STIGMER_MCP_ROSTER: "memory",
|
|
130
|
+
});
|
|
131
|
+
// The child's environment is byte-for-byte today's when the run carried no credential.
|
|
132
|
+
expect(synthesizeMemoryAttachment(enabled, context, ossOptions)?.env).not.toHaveProperty(
|
|
133
|
+
STDIO_CREDENTIAL_ENV,
|
|
134
|
+
);
|
|
135
|
+
});
|
|
136
|
+
|
|
120
137
|
it("omits empty context fields from the carrier — best-effort attribution, never blank entries", () => {
|
|
121
138
|
const partial: MemoryCaptureContext = {
|
|
122
139
|
org: "acme",
|