@stigmer/runner 3.0.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/README.md +212 -0
- package/dist/.build-fingerprint +1 -0
- package/dist/activities/call-agent-status.d.ts +37 -0
- package/dist/activities/call-agent-status.js +91 -0
- package/dist/activities/call-agent-status.js.map +1 -0
- package/dist/activities/call-agent.d.ts +25 -0
- package/dist/activities/call-agent.js +233 -0
- package/dist/activities/call-agent.js.map +1 -0
- package/dist/activities/call-eval.d.ts +50 -0
- package/dist/activities/call-eval.js +244 -0
- package/dist/activities/call-eval.js.map +1 -0
- package/dist/activities/call-function.d.ts +21 -0
- package/dist/activities/call-function.js +54 -0
- package/dist/activities/call-function.js.map +1 -0
- package/dist/activities/call-grpc.d.ts +22 -0
- package/dist/activities/call-grpc.js +101 -0
- package/dist/activities/call-grpc.js.map +1 -0
- package/dist/activities/call-http.d.ts +32 -0
- package/dist/activities/call-http.js +134 -0
- package/dist/activities/call-http.js.map +1 -0
- package/dist/activities/call-llm.d.ts +39 -0
- package/dist/activities/call-llm.js +260 -0
- package/dist/activities/call-llm.js.map +1 -0
- package/dist/activities/call-transform.d.ts +20 -0
- package/dist/activities/call-transform.js +33 -0
- package/dist/activities/call-transform.js.map +1 -0
- package/dist/activities/call-validate.d.ts +41 -0
- package/dist/activities/call-validate.js +163 -0
- package/dist/activities/call-validate.js.map +1 -0
- package/dist/activities/classify-tool-approvals.d.ts +47 -0
- package/dist/activities/classify-tool-approvals.js +207 -0
- package/dist/activities/classify-tool-approvals.js.map +1 -0
- package/dist/activities/discover-mcp-server.d.ts +65 -0
- package/dist/activities/discover-mcp-server.js +269 -0
- package/dist/activities/discover-mcp-server.js.map +1 -0
- package/dist/activities/emit-event.d.ts +46 -0
- package/dist/activities/emit-event.js +125 -0
- package/dist/activities/emit-event.js.map +1 -0
- package/dist/activities/ensure-thread.d.ts +24 -0
- package/dist/activities/ensure-thread.js +44 -0
- package/dist/activities/ensure-thread.js.map +1 -0
- package/dist/activities/evaluate-expressions.d.ts +21 -0
- package/dist/activities/evaluate-expressions.js +39 -0
- package/dist/activities/evaluate-expressions.js.map +1 -0
- package/dist/activities/execute-cursor/approval-policy.d.ts +104 -0
- package/dist/activities/execute-cursor/approval-policy.js +193 -0
- package/dist/activities/execute-cursor/approval-policy.js.map +1 -0
- package/dist/activities/execute-cursor/approval-state.d.ts +157 -0
- package/dist/activities/execute-cursor/approval-state.js +223 -0
- package/dist/activities/execute-cursor/approval-state.js.map +1 -0
- package/dist/activities/execute-cursor/attachment-resolver.d.ts +19 -0
- package/dist/activities/execute-cursor/attachment-resolver.js +52 -0
- package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/blueprint-resolver.d.ts +66 -0
- package/dist/activities/execute-cursor/blueprint-resolver.js +169 -0
- package/dist/activities/execute-cursor/blueprint-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/connect-backfill.d.ts +18 -0
- package/dist/activities/execute-cursor/connect-backfill.js +27 -0
- package/dist/activities/execute-cursor/connect-backfill.js.map +1 -0
- package/dist/activities/execute-cursor/cursor-event-recorder.d.ts +24 -0
- package/dist/activities/execute-cursor/cursor-event-recorder.js +66 -0
- package/dist/activities/execute-cursor/cursor-event-recorder.js.map +1 -0
- package/dist/activities/execute-cursor/cursor-mode.d.ts +32 -0
- package/dist/activities/execute-cursor/cursor-mode.js +36 -0
- package/dist/activities/execute-cursor/cursor-mode.js.map +1 -0
- package/dist/activities/execute-cursor/delta-enricher.d.ts +87 -0
- package/dist/activities/execute-cursor/delta-enricher.js +265 -0
- package/dist/activities/execute-cursor/delta-enricher.js.map +1 -0
- package/dist/activities/execute-cursor/env-resolver.d.ts +19 -0
- package/dist/activities/execute-cursor/env-resolver.js +47 -0
- package/dist/activities/execute-cursor/env-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/error-classifier.d.ts +73 -0
- package/dist/activities/execute-cursor/error-classifier.js +185 -0
- package/dist/activities/execute-cursor/error-classifier.js.map +1 -0
- package/dist/activities/execute-cursor/fetch-interceptor.d.ts +59 -0
- package/dist/activities/execute-cursor/fetch-interceptor.js +317 -0
- package/dist/activities/execute-cursor/fetch-interceptor.js.map +1 -0
- package/dist/activities/execute-cursor/hitl-diagnostics.d.ts +32 -0
- package/dist/activities/execute-cursor/hitl-diagnostics.js +73 -0
- package/dist/activities/execute-cursor/hitl-diagnostics.js.map +1 -0
- package/dist/activities/execute-cursor/hook-script.d.ts +47 -0
- package/dist/activities/execute-cursor/hook-script.js +156 -0
- package/dist/activities/execute-cursor/hook-script.js.map +1 -0
- package/dist/activities/execute-cursor/http2-interceptor.d.ts +94 -0
- package/dist/activities/execute-cursor/http2-interceptor.js +209 -0
- package/dist/activities/execute-cursor/http2-interceptor.js.map +1 -0
- package/dist/activities/execute-cursor/index.d.ts +67 -0
- package/dist/activities/execute-cursor/index.js +1176 -0
- package/dist/activities/execute-cursor/index.js.map +1 -0
- package/dist/activities/execute-cursor/mcp-config.d.ts +30 -0
- package/dist/activities/execute-cursor/mcp-config.js +39 -0
- package/dist/activities/execute-cursor/mcp-config.js.map +1 -0
- package/dist/activities/execute-cursor/mcp-resolver.d.ts +91 -0
- package/dist/activities/execute-cursor/mcp-resolver.js +178 -0
- package/dist/activities/execute-cursor/mcp-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/message-translator.d.ts +211 -0
- package/dist/activities/execute-cursor/message-translator.js +786 -0
- package/dist/activities/execute-cursor/message-translator.js.map +1 -0
- package/dist/activities/execute-cursor/model-pricing-data.d.ts +40 -0
- package/dist/activities/execute-cursor/model-pricing-data.js +114 -0
- package/dist/activities/execute-cursor/model-pricing-data.js.map +1 -0
- package/dist/activities/execute-cursor/model-pricing.d.ts +42 -0
- package/dist/activities/execute-cursor/model-pricing.js +141 -0
- package/dist/activities/execute-cursor/model-pricing.js.map +1 -0
- package/dist/activities/execute-cursor/placeholder-resolver.d.ts +34 -0
- package/dist/activities/execute-cursor/placeholder-resolver.js +82 -0
- package/dist/activities/execute-cursor/placeholder-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/prompt-builder.d.ts +80 -0
- package/dist/activities/execute-cursor/prompt-builder.js +280 -0
- package/dist/activities/execute-cursor/prompt-builder.js.map +1 -0
- package/dist/activities/execute-cursor/rejection-capture.d.ts +30 -0
- package/dist/activities/execute-cursor/rejection-capture.js +80 -0
- package/dist/activities/execute-cursor/rejection-capture.js.map +1 -0
- package/dist/activities/execute-cursor/session-lifecycle.d.ts +189 -0
- package/dist/activities/execute-cursor/session-lifecycle.js +285 -0
- package/dist/activities/execute-cursor/session-lifecycle.js.map +1 -0
- package/dist/activities/execute-cursor/skill-resolver.d.ts +29 -0
- package/dist/activities/execute-cursor/skill-resolver.js +134 -0
- package/dist/activities/execute-cursor/skill-resolver.js.map +1 -0
- package/dist/activities/execute-cursor/subagent-config.d.ts +34 -0
- package/dist/activities/execute-cursor/subagent-config.js +55 -0
- package/dist/activities/execute-cursor/subagent-config.js.map +1 -0
- package/dist/activities/execute-cursor/todo-tracker.d.ts +35 -0
- package/dist/activities/execute-cursor/todo-tracker.js +108 -0
- package/dist/activities/execute-cursor/todo-tracker.js.map +1 -0
- package/dist/activities/execute-cursor/usage-accumulator.d.ts +55 -0
- package/dist/activities/execute-cursor/usage-accumulator.js +89 -0
- package/dist/activities/execute-cursor/usage-accumulator.js.map +1 -0
- package/dist/activities/execute-cursor/workspace-provision.d.ts +22 -0
- package/dist/activities/execute-cursor/workspace-provision.js +37 -0
- package/dist/activities/execute-cursor/workspace-provision.js.map +1 -0
- package/dist/activities/execute-cursor/workspace-setup.d.ts +27 -0
- package/dist/activities/execute-cursor/workspace-setup.js +61 -0
- package/dist/activities/execute-cursor/workspace-setup.js.map +1 -0
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.d.ts +71 -0
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js +182 -0
- package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js.map +1 -0
- package/dist/activities/execute-deep-agent/attachment-injector.d.ts +67 -0
- package/dist/activities/execute-deep-agent/attachment-injector.js +306 -0
- package/dist/activities/execute-deep-agent/attachment-injector.js.map +1 -0
- package/dist/activities/execute-deep-agent/auto-publish.d.ts +17 -0
- package/dist/activities/execute-deep-agent/auto-publish.js +71 -0
- package/dist/activities/execute-deep-agent/auto-publish.js.map +1 -0
- package/dist/activities/execute-deep-agent/environment.d.ts +24 -0
- package/dist/activities/execute-deep-agent/environment.js +50 -0
- package/dist/activities/execute-deep-agent/environment.js.map +1 -0
- package/dist/activities/execute-deep-agent/event-recorder.d.ts +21 -0
- package/dist/activities/execute-deep-agent/event-recorder.js +67 -0
- package/dist/activities/execute-deep-agent/event-recorder.js.map +1 -0
- package/dist/activities/execute-deep-agent/execution-state.d.ts +61 -0
- package/dist/activities/execute-deep-agent/execution-state.js +76 -0
- package/dist/activities/execute-deep-agent/execution-state.js.map +1 -0
- package/dist/activities/execute-deep-agent/execution-status-writer.d.ts +17 -0
- package/dist/activities/execute-deep-agent/execution-status-writer.js +9 -0
- package/dist/activities/execute-deep-agent/execution-status-writer.js.map +1 -0
- package/dist/activities/execute-deep-agent/hitl.d.ts +58 -0
- package/dist/activities/execute-deep-agent/hitl.js +155 -0
- package/dist/activities/execute-deep-agent/hitl.js.map +1 -0
- package/dist/activities/execute-deep-agent/index.d.ts +14 -0
- package/dist/activities/execute-deep-agent/index.js +286 -0
- package/dist/activities/execute-deep-agent/index.js.map +1 -0
- package/dist/activities/execute-deep-agent/inline-publisher.d.ts +36 -0
- package/dist/activities/execute-deep-agent/inline-publisher.js +105 -0
- package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -0
- package/dist/activities/execute-deep-agent/post-stream.d.ts +23 -0
- package/dist/activities/execute-deep-agent/post-stream.js +71 -0
- package/dist/activities/execute-deep-agent/post-stream.js.map +1 -0
- package/dist/activities/execute-deep-agent/prompt-builder.d.ts +27 -0
- package/dist/activities/execute-deep-agent/prompt-builder.js +200 -0
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -0
- package/dist/activities/execute-deep-agent/setup.d.ts +55 -0
- package/dist/activities/execute-deep-agent/setup.js +411 -0
- package/dist/activities/execute-deep-agent/setup.js.map +1 -0
- package/dist/activities/execute-deep-agent/status-builder-shared.d.ts +39 -0
- package/dist/activities/execute-deep-agent/status-builder-shared.js +120 -0
- package/dist/activities/execute-deep-agent/status-builder-shared.js.map +1 -0
- package/dist/activities/execute-deep-agent/status-builder.d.ts +81 -0
- package/dist/activities/execute-deep-agent/status-builder.js +312 -0
- package/dist/activities/execute-deep-agent/status-builder.js.map +1 -0
- package/dist/activities/execute-deep-agent/streaming-scheduler.d.ts +60 -0
- package/dist/activities/execute-deep-agent/streaming-scheduler.js +114 -0
- package/dist/activities/execute-deep-agent/streaming-scheduler.js.map +1 -0
- package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +22 -0
- package/dist/activities/execute-deep-agent/streaming-side-effects.js +83 -0
- package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -0
- package/dist/activities/execute-deep-agent/streaming-terminal.d.ts +12 -0
- package/dist/activities/execute-deep-agent/streaming-terminal.js +71 -0
- package/dist/activities/execute-deep-agent/streaming-terminal.js.map +1 -0
- package/dist/activities/execute-deep-agent/streaming-v3.d.ts +13 -0
- package/dist/activities/execute-deep-agent/streaming-v3.js +170 -0
- package/dist/activities/execute-deep-agent/streaming-v3.js.map +1 -0
- package/dist/activities/execute-deep-agent/streaming.d.ts +66 -0
- package/dist/activities/execute-deep-agent/streaming.js +169 -0
- package/dist/activities/execute-deep-agent/streaming.js.map +1 -0
- package/dist/activities/execute-deep-agent/subagent-tracker.d.ts +90 -0
- package/dist/activities/execute-deep-agent/subagent-tracker.js +364 -0
- package/dist/activities/execute-deep-agent/subagent-tracker.js.map +1 -0
- package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +150 -0
- package/dist/activities/execute-deep-agent/subagent-transformer.js +450 -0
- package/dist/activities/execute-deep-agent/subagent-transformer.js.map +1 -0
- package/dist/activities/execute-deep-agent/subagent-wiring.d.ts +28 -0
- package/dist/activities/execute-deep-agent/subagent-wiring.js +40 -0
- package/dist/activities/execute-deep-agent/subagent-wiring.js.map +1 -0
- package/dist/activities/execute-deep-agent/v3-event-recorder.d.ts +31 -0
- package/dist/activities/execute-deep-agent/v3-event-recorder.js +71 -0
- package/dist/activities/execute-deep-agent/v3-event-recorder.js.map +1 -0
- package/dist/activities/execute-deep-agent/v3-events.d.ts +102 -0
- package/dist/activities/execute-deep-agent/v3-events.js +35 -0
- package/dist/activities/execute-deep-agent/v3-events.js.map +1 -0
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.d.ts +15 -0
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js +235 -0
- package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js.map +1 -0
- package/dist/activities/execute-deep-agent/v3-status-builder.d.ts +68 -0
- package/dist/activities/execute-deep-agent/v3-status-builder.js +394 -0
- package/dist/activities/execute-deep-agent/v3-status-builder.js.map +1 -0
- package/dist/activities/execute-deep-agent/writeback-coordinator.d.ts +71 -0
- package/dist/activities/execute-deep-agent/writeback-coordinator.js +295 -0
- package/dist/activities/execute-deep-agent/writeback-coordinator.js.map +1 -0
- package/dist/activities/hydrate-workflow-execution.d.ts +32 -0
- package/dist/activities/hydrate-workflow-execution.js +212 -0
- package/dist/activities/hydrate-workflow-execution.js.map +1 -0
- package/dist/activities/notification.d.ts +19 -0
- package/dist/activities/notification.js +47 -0
- package/dist/activities/notification.js.map +1 -0
- package/dist/activities/promote-task-output.d.ts +38 -0
- package/dist/activities/promote-task-output.js +90 -0
- package/dist/activities/promote-task-output.js.map +1 -0
- package/dist/activities/run-command.d.ts +15 -0
- package/dist/activities/run-command.js +123 -0
- package/dist/activities/run-command.js.map +1 -0
- package/dist/activities/workflow-event-activities.d.ts +48 -0
- package/dist/activities/workflow-event-activities.js +415 -0
- package/dist/activities/workflow-event-activities.js.map +1 -0
- package/dist/bootstrap.d.ts +80 -0
- package/dist/bootstrap.js +114 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/budget/index.d.ts +1 -0
- package/dist/budget/index.js +2 -0
- package/dist/budget/index.js.map +1 -0
- package/dist/budget/tracker.d.ts +52 -0
- package/dist/budget/tracker.js +123 -0
- package/dist/budget/tracker.js.map +1 -0
- package/dist/claimcheck/compressor.d.ts +2 -0
- package/dist/claimcheck/compressor.js +8 -0
- package/dist/claimcheck/compressor.js.map +1 -0
- package/dist/claimcheck/config.d.ts +7 -0
- package/dist/claimcheck/config.js +10 -0
- package/dist/claimcheck/config.js.map +1 -0
- package/dist/claimcheck/index.d.ts +3 -0
- package/dist/claimcheck/index.js +4 -0
- package/dist/claimcheck/index.js.map +1 -0
- package/dist/claimcheck/payload-codec.d.ts +23 -0
- package/dist/claimcheck/payload-codec.js +81 -0
- package/dist/claimcheck/payload-codec.js.map +1 -0
- package/dist/client/server-contracts.d.ts +52 -0
- package/dist/client/server-contracts.js +72 -0
- package/dist/client/server-contracts.js.map +1 -0
- package/dist/client/stigmer-client.d.ts +131 -0
- package/dist/client/stigmer-client.js +239 -0
- package/dist/client/stigmer-client.js.map +1 -0
- package/dist/config.d.ts +64 -0
- package/dist/config.js +123 -0
- package/dist/config.js.map +1 -0
- package/dist/idle-watchdog.d.ts +11 -0
- package/dist/idle-watchdog.js +24 -0
- package/dist/idle-watchdog.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/workflow-metrics-sink.d.ts +11 -0
- package/dist/interceptors/workflow-metrics-sink.js +51 -0
- package/dist/interceptors/workflow-metrics-sink.js.map +1 -0
- package/dist/ipc-protocol-fixtures.d.ts +32 -0
- package/dist/ipc-protocol-fixtures.js +69 -0
- package/dist/ipc-protocol-fixtures.js.map +1 -0
- package/dist/ipc-protocol.d.ts +60 -0
- package/dist/ipc-protocol.js +19 -0
- package/dist/ipc-protocol.js.map +1 -0
- package/dist/main.d.ts +19 -0
- package/dist/main.js +292 -0
- package/dist/main.js.map +1 -0
- package/dist/middleware/approval-gate.d.ts +30 -0
- package/dist/middleware/approval-gate.js +125 -0
- package/dist/middleware/approval-gate.js.map +1 -0
- package/dist/middleware/cost-cap.d.ts +22 -0
- package/dist/middleware/cost-cap.js +159 -0
- package/dist/middleware/cost-cap.js.map +1 -0
- package/dist/middleware/error-hints.d.ts +27 -0
- package/dist/middleware/error-hints.js +116 -0
- package/dist/middleware/error-hints.js.map +1 -0
- package/dist/middleware/execution-budget.d.ts +20 -0
- package/dist/middleware/execution-budget.js +151 -0
- package/dist/middleware/execution-budget.js.map +1 -0
- package/dist/middleware/graceful-stop.d.ts +17 -0
- package/dist/middleware/graceful-stop.js +63 -0
- package/dist/middleware/graceful-stop.js.map +1 -0
- package/dist/middleware/index.d.ts +27 -0
- package/dist/middleware/index.js +45 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/loop-detection.d.ts +14 -0
- package/dist/middleware/loop-detection.js +156 -0
- package/dist/middleware/loop-detection.js.map +1 -0
- package/dist/middleware/otel-spans.d.ts +11 -0
- package/dist/middleware/otel-spans.js +177 -0
- package/dist/middleware/otel-spans.js.map +1 -0
- package/dist/middleware/think-tool.d.ts +23 -0
- package/dist/middleware/think-tool.js +33 -0
- package/dist/middleware/think-tool.js.map +1 -0
- package/dist/middleware/tool-truncation.d.ts +16 -0
- package/dist/middleware/tool-truncation.js +67 -0
- package/dist/middleware/tool-truncation.js.map +1 -0
- package/dist/middleware/types.d.ts +100 -0
- package/dist/middleware/types.js +9 -0
- package/dist/middleware/types.js.map +1 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/notification/index.js +6 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/notification/provider.d.ts +29 -0
- package/dist/notification/provider.js +25 -0
- package/dist/notification/provider.js.map +1 -0
- package/dist/notification/webhook.d.ts +13 -0
- package/dist/notification/webhook.js +55 -0
- package/dist/notification/webhook.js.map +1 -0
- package/dist/otel-metrics.d.ts +21 -0
- package/dist/otel-metrics.js +54 -0
- package/dist/otel-metrics.js.map +1 -0
- package/dist/otel.d.ts +57 -0
- package/dist/otel.js +164 -0
- package/dist/otel.js.map +1 -0
- package/dist/runner-manager.d.ts +113 -0
- package/dist/runner-manager.js +412 -0
- package/dist/runner-manager.js.map +1 -0
- package/dist/runner-token-coordinator.d.ts +56 -0
- package/dist/runner-token-coordinator.js +84 -0
- package/dist/runner-token-coordinator.js.map +1 -0
- package/dist/runner.d.ts +104 -0
- package/dist/runner.js +234 -0
- package/dist/runner.js.map +1 -0
- package/dist/shared/approval-policy.d.ts +45 -0
- package/dist/shared/approval-policy.js +122 -0
- package/dist/shared/approval-policy.js.map +1 -0
- package/dist/shared/artifact-storage.d.ts +44 -0
- package/dist/shared/artifact-storage.js +162 -0
- package/dist/shared/artifact-storage.js.map +1 -0
- package/dist/shared/checkpointer/factory.d.ts +28 -0
- package/dist/shared/checkpointer/factory.js +55 -0
- package/dist/shared/checkpointer/factory.js.map +1 -0
- package/dist/shared/checkpointer/http-saver.d.ts +34 -0
- package/dist/shared/checkpointer/http-saver.js +274 -0
- package/dist/shared/checkpointer/http-saver.js.map +1 -0
- package/dist/shared/checkpointer/types.d.ts +12 -0
- package/dist/shared/checkpointer/types.js +2 -0
- package/dist/shared/checkpointer/types.js.map +1 -0
- package/dist/shared/connect-backfill.d.ts +58 -0
- package/dist/shared/connect-backfill.js +119 -0
- package/dist/shared/connect-backfill.js.map +1 -0
- package/dist/shared/extract-json.d.ts +26 -0
- package/dist/shared/extract-json.js +140 -0
- package/dist/shared/extract-json.js.map +1 -0
- package/dist/shared/grpc-retry.d.ts +35 -0
- package/dist/shared/grpc-retry.js +78 -0
- package/dist/shared/grpc-retry.js.map +1 -0
- package/dist/shared/heartbeat.d.ts +22 -0
- package/dist/shared/heartbeat.js +55 -0
- package/dist/shared/heartbeat.js.map +1 -0
- package/dist/shared/json-schema-to-zod.d.ts +13 -0
- package/dist/shared/json-schema-to-zod.js +49 -0
- package/dist/shared/json-schema-to-zod.js.map +1 -0
- package/dist/shared/llm-proxy.d.ts +57 -0
- package/dist/shared/llm-proxy.js +116 -0
- package/dist/shared/llm-proxy.js.map +1 -0
- package/dist/shared/mcp-manager.d.ts +47 -0
- package/dist/shared/mcp-manager.js +118 -0
- package/dist/shared/mcp-manager.js.map +1 -0
- package/dist/shared/mcp-resolver.d.ts +41 -0
- package/dist/shared/mcp-resolver.js +96 -0
- package/dist/shared/mcp-resolver.js.map +1 -0
- package/dist/shared/model-pricing-data.d.ts +18 -0
- package/dist/shared/model-pricing-data.js +78 -0
- package/dist/shared/model-pricing-data.js.map +1 -0
- package/dist/shared/model-pricing.d.ts +24 -0
- package/dist/shared/model-pricing.js +58 -0
- package/dist/shared/model-pricing.js.map +1 -0
- package/dist/shared/model-registry.d.ts +55 -0
- package/dist/shared/model-registry.js +178 -0
- package/dist/shared/model-registry.js.map +1 -0
- package/dist/shared/placeholder-resolver.d.ts +27 -0
- package/dist/shared/placeholder-resolver.js +75 -0
- package/dist/shared/placeholder-resolver.js.map +1 -0
- package/dist/shared/plan-artifact.d.ts +56 -0
- package/dist/shared/plan-artifact.js +98 -0
- package/dist/shared/plan-artifact.js.map +1 -0
- package/dist/shared/skill-relevance.d.ts +65 -0
- package/dist/shared/skill-relevance.js +175 -0
- package/dist/shared/skill-relevance.js.map +1 -0
- package/dist/shared/skill-writer.d.ts +73 -0
- package/dist/shared/skill-writer.js +230 -0
- package/dist/shared/skill-writer.js.map +1 -0
- package/dist/shared/status.d.ts +37 -0
- package/dist/shared/status.js +73 -0
- package/dist/shared/status.js.map +1 -0
- package/dist/shared/subagent-gate.d.ts +41 -0
- package/dist/shared/subagent-gate.js +93 -0
- package/dist/shared/subagent-gate.js.map +1 -0
- package/dist/shared/tool-kind.d.ts +22 -0
- package/dist/shared/tool-kind.js +79 -0
- package/dist/shared/tool-kind.js.map +1 -0
- package/dist/shared/workspace/file-tree.d.ts +13 -0
- package/dist/shared/workspace/file-tree.js +101 -0
- package/dist/shared/workspace/file-tree.js.map +1 -0
- package/dist/shared/workspace/local-backend.d.ts +41 -0
- package/dist/shared/workspace/local-backend.js +113 -0
- package/dist/shared/workspace/local-backend.js.map +1 -0
- package/dist/shared/workspace/platform-dir.d.ts +25 -0
- package/dist/shared/workspace/platform-dir.js +36 -0
- package/dist/shared/workspace/platform-dir.js.map +1 -0
- package/dist/shared/workspace/platform-mount.d.ts +95 -0
- package/dist/shared/workspace/platform-mount.js +157 -0
- package/dist/shared/workspace/platform-mount.js.map +1 -0
- package/dist/shared/workspace/provisioner.d.ts +47 -0
- package/dist/shared/workspace/provisioner.js +84 -0
- package/dist/shared/workspace/provisioner.js.map +1 -0
- package/dist/shared/workspace/sources/empty.d.ts +8 -0
- package/dist/shared/workspace/sources/empty.js +18 -0
- package/dist/shared/workspace/sources/empty.js.map +1 -0
- package/dist/shared/workspace/sources/git.d.ts +22 -0
- package/dist/shared/workspace/sources/git.js +207 -0
- package/dist/shared/workspace/sources/git.js.map +1 -0
- package/dist/shared/workspace/sources/local-path.d.ts +17 -0
- package/dist/shared/workspace/sources/local-path.js +57 -0
- package/dist/shared/workspace/sources/local-path.js.map +1 -0
- package/dist/shared/workspace/types.d.ts +58 -0
- package/dist/shared/workspace/types.js +25 -0
- package/dist/shared/workspace/types.js.map +1 -0
- package/dist/shared/zip-extract.d.ts +30 -0
- package/dist/shared/zip-extract.js +150 -0
- package/dist/shared/zip-extract.js.map +1 -0
- package/dist/worker.d.ts +27 -0
- package/dist/worker.js +65 -0
- package/dist/worker.js.map +1 -0
- package/dist/workflow-engine/clone.d.ts +11 -0
- package/dist/workflow-engine/clone.js +21 -0
- package/dist/workflow-engine/clone.js.map +1 -0
- package/dist/workflow-engine/do-executor.d.ts +27 -0
- package/dist/workflow-engine/do-executor.js +418 -0
- package/dist/workflow-engine/do-executor.js.map +1 -0
- package/dist/workflow-engine/duration.d.ts +12 -0
- package/dist/workflow-engine/duration.js +25 -0
- package/dist/workflow-engine/duration.js.map +1 -0
- package/dist/workflow-engine/error-utils.d.ts +42 -0
- package/dist/workflow-engine/error-utils.js +77 -0
- package/dist/workflow-engine/error-utils.js.map +1 -0
- package/dist/workflow-engine/errors.d.ts +46 -0
- package/dist/workflow-engine/errors.js +105 -0
- package/dist/workflow-engine/errors.js.map +1 -0
- package/dist/workflow-engine/expression-utils.d.ts +60 -0
- package/dist/workflow-engine/expression-utils.js +108 -0
- package/dist/workflow-engine/expression-utils.js.map +1 -0
- package/dist/workflow-engine/expression.d.ts +132 -0
- package/dist/workflow-engine/expression.js +366 -0
- package/dist/workflow-engine/expression.js.map +1 -0
- package/dist/workflow-engine/loader.d.ts +23 -0
- package/dist/workflow-engine/loader.js +429 -0
- package/dist/workflow-engine/loader.js.map +1 -0
- package/dist/workflow-engine/recovery.d.ts +53 -0
- package/dist/workflow-engine/recovery.js +46 -0
- package/dist/workflow-engine/recovery.js.map +1 -0
- package/dist/workflow-engine/resolve.d.ts +83 -0
- package/dist/workflow-engine/resolve.js +257 -0
- package/dist/workflow-engine/resolve.js.map +1 -0
- package/dist/workflow-engine/retry.d.ts +30 -0
- package/dist/workflow-engine/retry.js +97 -0
- package/dist/workflow-engine/retry.js.map +1 -0
- package/dist/workflow-engine/state.d.ts +26 -0
- package/dist/workflow-engine/state.js +49 -0
- package/dist/workflow-engine/state.js.map +1 -0
- package/dist/workflow-engine/task-factory.d.ts +20 -0
- package/dist/workflow-engine/task-factory.js +133 -0
- package/dist/workflow-engine/task-factory.js.map +1 -0
- package/dist/workflow-engine/task-status-accumulator.d.ts +59 -0
- package/dist/workflow-engine/task-status-accumulator.js +164 -0
- package/dist/workflow-engine/task-status-accumulator.js.map +1 -0
- package/dist/workflow-engine/tasks/call-agent-output.d.ts +26 -0
- package/dist/workflow-engine/tasks/call-agent-output.js +109 -0
- package/dist/workflow-engine/tasks/call-agent-output.js.map +1 -0
- package/dist/workflow-engine/tasks/call-agent.d.ts +31 -0
- package/dist/workflow-engine/tasks/call-agent.js +161 -0
- package/dist/workflow-engine/tasks/call-agent.js.map +1 -0
- package/dist/workflow-engine/tasks/call-function.d.ts +19 -0
- package/dist/workflow-engine/tasks/call-function.js +64 -0
- package/dist/workflow-engine/tasks/call-function.js.map +1 -0
- package/dist/workflow-engine/tasks/call-grpc.d.ts +15 -0
- package/dist/workflow-engine/tasks/call-grpc.js +27 -0
- package/dist/workflow-engine/tasks/call-grpc.js.map +1 -0
- package/dist/workflow-engine/tasks/call-http.d.ts +19 -0
- package/dist/workflow-engine/tasks/call-http.js +31 -0
- package/dist/workflow-engine/tasks/call-http.js.map +1 -0
- package/dist/workflow-engine/tasks/for.d.ts +39 -0
- package/dist/workflow-engine/tasks/for.js +154 -0
- package/dist/workflow-engine/tasks/for.js.map +1 -0
- package/dist/workflow-engine/tasks/fork.d.ts +42 -0
- package/dist/workflow-engine/tasks/fork.js +142 -0
- package/dist/workflow-engine/tasks/fork.js.map +1 -0
- package/dist/workflow-engine/tasks/human-input.d.ts +33 -0
- package/dist/workflow-engine/tasks/human-input.js +109 -0
- package/dist/workflow-engine/tasks/human-input.js.map +1 -0
- package/dist/workflow-engine/tasks/listen.d.ts +34 -0
- package/dist/workflow-engine/tasks/listen.js +119 -0
- package/dist/workflow-engine/tasks/listen.js.map +1 -0
- package/dist/workflow-engine/tasks/raise.d.ts +18 -0
- package/dist/workflow-engine/tasks/raise.js +60 -0
- package/dist/workflow-engine/tasks/raise.js.map +1 -0
- package/dist/workflow-engine/tasks/run.d.ts +39 -0
- package/dist/workflow-engine/tasks/run.js +114 -0
- package/dist/workflow-engine/tasks/run.js.map +1 -0
- package/dist/workflow-engine/tasks/set.d.ts +15 -0
- package/dist/workflow-engine/tasks/set.js +31 -0
- package/dist/workflow-engine/tasks/set.js.map +1 -0
- package/dist/workflow-engine/tasks/switch.d.ts +25 -0
- package/dist/workflow-engine/tasks/switch.js +76 -0
- package/dist/workflow-engine/tasks/switch.js.map +1 -0
- package/dist/workflow-engine/tasks/try.d.ts +49 -0
- package/dist/workflow-engine/tasks/try.js +189 -0
- package/dist/workflow-engine/tasks/try.js.map +1 -0
- package/dist/workflow-engine/tasks/wait.d.ts +24 -0
- package/dist/workflow-engine/tasks/wait.js +39 -0
- package/dist/workflow-engine/tasks/wait.js.map +1 -0
- package/dist/workflow-engine/types.d.ts +682 -0
- package/dist/workflow-engine/types.js +47 -0
- package/dist/workflow-engine/types.js.map +1 -0
- package/dist/workflows/call-agent-orchestrator.d.ts +31 -0
- package/dist/workflows/call-agent-orchestrator.js +214 -0
- package/dist/workflows/call-agent-orchestrator.js.map +1 -0
- package/dist/workflows/connect-mcp-server.d.ts +20 -0
- package/dist/workflows/connect-mcp-server.js +113 -0
- package/dist/workflows/connect-mcp-server.js.map +1 -0
- package/dist/workflows/engine-core.d.ts +36 -0
- package/dist/workflows/engine-core.js +272 -0
- package/dist/workflows/engine-core.js.map +1 -0
- package/dist/workflows/execute-from-execution.d.ts +32 -0
- package/dist/workflows/execute-from-execution.js +71 -0
- package/dist/workflows/execute-from-execution.js.map +1 -0
- package/dist/workflows/execute-serverless-workflow.d.ts +32 -0
- package/dist/workflows/execute-serverless-workflow.js +36 -0
- package/dist/workflows/execute-serverless-workflow.js.map +1 -0
- package/dist/workflows/human-input-orchestrator.d.ts +19 -0
- package/dist/workflows/human-input-orchestrator.js +59 -0
- package/dist/workflows/human-input-orchestrator.js.map +1 -0
- package/dist/workflows/index.d.ts +22 -0
- package/dist/workflows/index.js +23 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/listen-orchestrator.d.ts +29 -0
- package/dist/workflows/listen-orchestrator.js +143 -0
- package/dist/workflows/listen-orchestrator.js.map +1 -0
- package/dist/workflows/metrics-sink.d.ts +33 -0
- package/dist/workflows/metrics-sink.js +21 -0
- package/dist/workflows/metrics-sink.js.map +1 -0
- package/dist/workflows/run-orchestrator.d.ts +15 -0
- package/dist/workflows/run-orchestrator.js +27 -0
- package/dist/workflows/run-orchestrator.js.map +1 -0
- package/dist/workflows/types.d.ts +46 -0
- package/dist/workflows/types.js +15 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/workflows/workflow-signals.d.ts +29 -0
- package/dist/workflows/workflow-signals.js +46 -0
- package/dist/workflows/workflow-signals.js.map +1 -0
- package/package.json +108 -0
- package/src/__test-utils__/__tests__/replay-fetch.test.ts +155 -0
- package/src/__test-utils__/mock-client.ts +44 -0
- package/src/__test-utils__/mock-workspace.ts +28 -0
- package/src/__test-utils__/proto-helpers.ts +41 -0
- package/src/__test-utils__/replay-fetch.ts +523 -0
- package/src/__tests__/bootstrap.test.ts +221 -0
- package/src/__tests__/claimcheck-codec.test.ts +257 -0
- package/src/__tests__/config.test.ts +150 -0
- package/src/__tests__/deterministic-eval-llm.test.ts +269 -0
- package/src/__tests__/deterministic-mcp-hitl.test.ts +405 -0
- package/src/__tests__/golden-e2e.test.ts +250 -0
- package/src/__tests__/ipc-protocol-fixtures.test.ts +66 -0
- package/src/__tests__/ipc-protocol.test.ts +32 -0
- package/src/__tests__/otel-metrics.test.ts +40 -0
- package/src/__tests__/runner-manager.test.ts +55 -0
- package/src/__tests__/runner-token-coordinator.test.ts +166 -0
- package/src/__tests__/runner.test.ts +182 -0
- package/src/__tests__/worker.test.ts +18 -0
- package/src/activities/__tests__/call-agent-contracts.test.ts +483 -0
- package/src/activities/__tests__/call-agent.test.ts +263 -0
- package/src/activities/__tests__/call-function.test.ts +47 -0
- package/src/activities/__tests__/call-grpc.test.ts +39 -0
- package/src/activities/__tests__/call-http.test.ts +288 -0
- package/src/activities/__tests__/call-llm.test.ts +301 -0
- package/src/activities/__tests__/classify-tool-approvals.test.ts +430 -0
- package/src/activities/__tests__/discover-mcp-server.test.ts +641 -0
- package/src/activities/__tests__/ensure-thread.test.ts +96 -0
- package/src/activities/__tests__/error-classifier.test.ts +372 -0
- package/src/activities/__tests__/evaluate-expressions.test.ts +114 -0
- package/src/activities/__tests__/hydrate-workflow-execution.test.ts +321 -0
- package/src/activities/__tests__/notification.test.ts +151 -0
- package/src/activities/__tests__/workflow-event-activities.test.ts +664 -0
- package/src/activities/call-agent-status.ts +130 -0
- package/src/activities/call-agent.ts +302 -0
- package/src/activities/call-eval.ts +333 -0
- package/src/activities/call-function.ts +73 -0
- package/src/activities/call-grpc.ts +140 -0
- package/src/activities/call-http.ts +185 -0
- package/src/activities/call-llm.ts +379 -0
- package/src/activities/call-transform.ts +54 -0
- package/src/activities/call-validate.ts +223 -0
- package/src/activities/classify-tool-approvals.ts +319 -0
- package/src/activities/discover-mcp-server.ts +411 -0
- package/src/activities/emit-event.ts +195 -0
- package/src/activities/ensure-thread.ts +45 -0
- package/src/activities/evaluate-expressions.ts +47 -0
- package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +188 -0
- package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +111 -0
- package/src/activities/execute-cursor/__tests__/cursor-baseurl-routing.test.ts +86 -0
- package/src/activities/execute-cursor/__tests__/cursor-fetch-interceptor-bypass.test.ts +64 -0
- package/src/activities/execute-cursor/__tests__/cursor-mode.test.ts +95 -0
- package/src/activities/execute-cursor/__tests__/cursor-sdk-auth-smoke.test.ts +90 -0
- package/src/activities/execute-cursor/__tests__/delta-enricher.test.ts +242 -0
- package/src/activities/execute-cursor/__tests__/error-classifier-introspection.test.ts +156 -0
- package/src/activities/execute-cursor/__tests__/fetch-interceptor.test.ts +211 -0
- package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +298 -0
- package/src/activities/execute-cursor/__tests__/http2-interceptor.test.ts +360 -0
- package/src/activities/execute-cursor/__tests__/message-translator.test.ts +657 -0
- package/src/activities/execute-cursor/__tests__/model-pricing.test.ts +92 -0
- package/src/activities/execute-cursor/__tests__/prompt-builder-delegation.test.ts +101 -0
- package/src/activities/execute-cursor/__tests__/runner-error-regressions.test.ts +144 -0
- package/src/activities/execute-cursor/__tests__/session-lifecycle.test.ts +65 -0
- package/src/activities/execute-cursor/__tests__/skill-resolver.test.ts +265 -0
- package/src/activities/execute-cursor/__tests__/subagent-config.test.ts +107 -0
- package/src/activities/execute-cursor/__tests__/todo-tracker.test.ts +498 -0
- package/src/activities/execute-cursor/__tests__/workspace-provision.test.ts +283 -0
- package/src/activities/execute-cursor/approval-policy.ts +224 -0
- package/src/activities/execute-cursor/approval-state.ts +311 -0
- package/src/activities/execute-cursor/attachment-resolver.ts +78 -0
- package/src/activities/execute-cursor/blueprint-resolver.ts +234 -0
- package/src/activities/execute-cursor/connect-backfill.ts +49 -0
- package/src/activities/execute-cursor/cursor-event-recorder.ts +83 -0
- package/src/activities/execute-cursor/cursor-mode.ts +42 -0
- package/src/activities/execute-cursor/delta-enricher.ts +307 -0
- package/src/activities/execute-cursor/env-resolver.ts +64 -0
- package/src/activities/execute-cursor/error-classifier.ts +247 -0
- package/src/activities/execute-cursor/fetch-interceptor.ts +382 -0
- package/src/activities/execute-cursor/hitl-diagnostics.ts +82 -0
- package/src/activities/execute-cursor/hook-script.ts +159 -0
- package/src/activities/execute-cursor/http2-interceptor.ts +253 -0
- package/src/activities/execute-cursor/index.ts +1439 -0
- package/src/activities/execute-cursor/mcp-config.ts +66 -0
- package/src/activities/execute-cursor/mcp-resolver.ts +271 -0
- package/src/activities/execute-cursor/message-translator.ts +896 -0
- package/src/activities/execute-cursor/model-pricing-data.ts +167 -0
- package/src/activities/execute-cursor/model-pricing.ts +167 -0
- package/src/activities/execute-cursor/placeholder-resolver.ts +109 -0
- package/src/activities/execute-cursor/prompt-builder.ts +349 -0
- package/src/activities/execute-cursor/rejection-capture.ts +100 -0
- package/src/activities/execute-cursor/session-lifecycle.ts +429 -0
- package/src/activities/execute-cursor/skill-resolver.ts +176 -0
- package/src/activities/execute-cursor/subagent-config.ts +62 -0
- package/src/activities/execute-cursor/todo-tracker.ts +133 -0
- package/src/activities/execute-cursor/usage-accumulator.ts +126 -0
- package/src/activities/execute-cursor/workspace-provision.ts +55 -0
- package/src/activities/execute-cursor/workspace-setup.ts +75 -0
- package/src/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.ts +281 -0
- package/src/activities/execute-deep-agent/__tests__/attachment-injector.test.ts +720 -0
- package/src/activities/execute-deep-agent/__tests__/auto-publish.test.ts +146 -0
- package/src/activities/execute-deep-agent/__tests__/environment.test.ts +103 -0
- package/src/activities/execute-deep-agent/__tests__/event-recorder.test.ts +150 -0
- package/src/activities/execute-deep-agent/__tests__/execution-state-extended.test.ts +150 -0
- package/src/activities/execute-deep-agent/__tests__/execution-state.test.ts +157 -0
- package/src/activities/execute-deep-agent/__tests__/hitl-integration.test.ts +223 -0
- package/src/activities/execute-deep-agent/__tests__/hitl.test.ts +244 -0
- package/src/activities/execute-deep-agent/__tests__/index.test.ts +91 -0
- package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +240 -0
- package/src/activities/execute-deep-agent/__tests__/post-stream.test.ts +112 -0
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +208 -0
- package/src/activities/execute-deep-agent/__tests__/status-builder.test.ts +1771 -0
- package/src/activities/execute-deep-agent/__tests__/streaming-scheduler.test.ts +199 -0
- package/src/activities/execute-deep-agent/__tests__/streaming-v3.test.ts +527 -0
- package/src/activities/execute-deep-agent/__tests__/streaming.test.ts +508 -0
- package/src/activities/execute-deep-agent/__tests__/subagent-tracker.test.ts +474 -0
- package/src/activities/execute-deep-agent/__tests__/subagent-transformer.test.ts +734 -0
- package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +71 -0
- package/src/activities/execute-deep-agent/__tests__/summarization-verification.test.ts +323 -0
- package/src/activities/execute-deep-agent/__tests__/v3-event-recorder.test.ts +186 -0
- package/src/activities/execute-deep-agent/__tests__/v3-protocol-normalizer.test.ts +324 -0
- package/src/activities/execute-deep-agent/__tests__/v3-status-builder.test.ts +504 -0
- package/src/activities/execute-deep-agent/__tests__/writeback-coordinator.test.ts +399 -0
- package/src/activities/execute-deep-agent/attachment-injector.ts +470 -0
- package/src/activities/execute-deep-agent/auto-publish.ts +80 -0
- package/src/activities/execute-deep-agent/environment.ts +67 -0
- package/src/activities/execute-deep-agent/event-recorder.ts +95 -0
- package/src/activities/execute-deep-agent/execution-state.ts +87 -0
- package/src/activities/execute-deep-agent/execution-status-writer.ts +19 -0
- package/src/activities/execute-deep-agent/hitl.ts +221 -0
- package/src/activities/execute-deep-agent/index.ts +342 -0
- package/src/activities/execute-deep-agent/inline-publisher.ts +134 -0
- package/src/activities/execute-deep-agent/post-stream.ts +109 -0
- package/src/activities/execute-deep-agent/prompt-builder.ts +264 -0
- package/src/activities/execute-deep-agent/setup.ts +599 -0
- package/src/activities/execute-deep-agent/status-builder-shared.ts +136 -0
- package/src/activities/execute-deep-agent/status-builder.ts +412 -0
- package/src/activities/execute-deep-agent/streaming-scheduler.ts +159 -0
- package/src/activities/execute-deep-agent/streaming-side-effects.ts +89 -0
- package/src/activities/execute-deep-agent/streaming-terminal.ts +96 -0
- package/src/activities/execute-deep-agent/streaming-v3.ts +272 -0
- package/src/activities/execute-deep-agent/streaming.ts +303 -0
- package/src/activities/execute-deep-agent/subagent-tracker.ts +445 -0
- package/src/activities/execute-deep-agent/subagent-transformer.ts +648 -0
- package/src/activities/execute-deep-agent/subagent-wiring.ts +56 -0
- package/src/activities/execute-deep-agent/v3-event-recorder.ts +111 -0
- package/src/activities/execute-deep-agent/v3-events.ts +153 -0
- package/src/activities/execute-deep-agent/v3-protocol-normalizer.ts +264 -0
- package/src/activities/execute-deep-agent/v3-status-builder.ts +490 -0
- package/src/activities/execute-deep-agent/writeback-coordinator.ts +420 -0
- package/src/activities/hydrate-workflow-execution.ts +306 -0
- package/src/activities/notification.ts +71 -0
- package/src/activities/promote-task-output.ts +126 -0
- package/src/activities/run-command.ts +148 -0
- package/src/activities/workflow-event-activities.ts +481 -0
- package/src/bootstrap.ts +173 -0
- package/src/budget/__tests__/tracker.test.ts +293 -0
- package/src/budget/index.ts +9 -0
- package/src/budget/tracker.ts +171 -0
- package/src/claimcheck/compressor.ts +9 -0
- package/src/claimcheck/config.ts +20 -0
- package/src/claimcheck/index.ts +3 -0
- package/src/claimcheck/payload-codec.ts +107 -0
- package/src/client/__tests__/server-contracts.test.ts +149 -0
- package/src/client/__tests__/stigmer-client.test.ts +142 -0
- package/src/client/server-contracts.ts +125 -0
- package/src/client/stigmer-client.ts +339 -0
- package/src/config.ts +185 -0
- package/src/idle-watchdog.ts +28 -0
- package/src/index.ts +48 -0
- package/src/interceptors/workflow-metrics-sink.ts +56 -0
- package/src/ipc-protocol-fixtures.ts +117 -0
- package/src/ipc-protocol.ts +113 -0
- package/src/main.ts +324 -0
- package/src/middleware/__tests__/approval-gate.test.ts +231 -0
- package/src/middleware/__tests__/cost-cap.test.ts +192 -0
- package/src/middleware/__tests__/error-hints.test.ts +90 -0
- package/src/middleware/__tests__/execution-budget.test.ts +138 -0
- package/src/middleware/__tests__/graceful-stop.test.ts +105 -0
- package/src/middleware/__tests__/loop-detection.test.ts +137 -0
- package/src/middleware/__tests__/otel-spans.test.ts +89 -0
- package/src/middleware/__tests__/think-tool.test.ts +26 -0
- package/src/middleware/__tests__/tool-truncation.test.ts +112 -0
- package/src/middleware/approval-gate.ts +179 -0
- package/src/middleware/cost-cap.ts +213 -0
- package/src/middleware/error-hints.ts +136 -0
- package/src/middleware/execution-budget.ts +176 -0
- package/src/middleware/graceful-stop.ts +86 -0
- package/src/middleware/index.ts +70 -0
- package/src/middleware/loop-detection.ts +192 -0
- package/src/middleware/otel-spans.ts +205 -0
- package/src/middleware/think-tool.ts +38 -0
- package/src/middleware/tool-truncation.ts +94 -0
- package/src/middleware/types.ts +114 -0
- package/src/notification/__tests__/provider.test.ts +85 -0
- package/src/notification/__tests__/webhook.test.ts +127 -0
- package/src/notification/index.ts +15 -0
- package/src/notification/provider.ts +52 -0
- package/src/notification/webhook.ts +61 -0
- package/src/otel-metrics.ts +73 -0
- package/src/otel.ts +194 -0
- package/src/runner-manager.ts +652 -0
- package/src/runner-token-coordinator.ts +135 -0
- package/src/runner.ts +380 -0
- package/src/shared/__tests__/approval-policy.test.ts +256 -0
- package/src/shared/__tests__/artifact-storage-extended.test.ts +208 -0
- package/src/shared/__tests__/artifact-storage.test.ts +365 -0
- package/src/shared/__tests__/connect-backfill.test.ts +346 -0
- package/src/shared/__tests__/extract-json.test.ts +153 -0
- package/src/shared/__tests__/grpc-retry-extended.test.ts +176 -0
- package/src/shared/__tests__/grpc-retry.test.ts +172 -0
- package/src/shared/__tests__/json-schema-to-zod.test.ts +227 -0
- package/src/shared/__tests__/llm-proxy.test.ts +179 -0
- package/src/shared/__tests__/mcp-manager.test.ts +154 -0
- package/src/shared/__tests__/model-pricing.test.ts +85 -0
- package/src/shared/__tests__/model-registry.test.ts +197 -0
- package/src/shared/__tests__/placeholder-resolver.test.ts +210 -0
- package/src/shared/__tests__/plan-artifact.test.ts +142 -0
- package/src/shared/__tests__/skill-relevance.test.ts +292 -0
- package/src/shared/__tests__/skill-writer.test.ts +349 -0
- package/src/shared/__tests__/status.test.ts +142 -0
- package/src/shared/__tests__/subagent-gate.test.ts +112 -0
- package/src/shared/__tests__/tool-kind.test.ts +58 -0
- package/src/shared/__tests__/zip-extract.test.ts +204 -0
- package/src/shared/approval-policy.ts +146 -0
- package/src/shared/artifact-storage.ts +207 -0
- package/src/shared/checkpointer/__tests__/factory.test.ts +42 -0
- package/src/shared/checkpointer/__tests__/http-saver.test.ts +176 -0
- package/src/shared/checkpointer/factory.ts +73 -0
- package/src/shared/checkpointer/http-saver.ts +349 -0
- package/src/shared/checkpointer/types.ts +12 -0
- package/src/shared/connect-backfill.ts +162 -0
- package/src/shared/extract-json.ts +153 -0
- package/src/shared/grpc-retry.ts +113 -0
- package/src/shared/heartbeat.ts +70 -0
- package/src/shared/json-schema-to-zod.ts +53 -0
- package/src/shared/llm-proxy.ts +138 -0
- package/src/shared/mcp-manager.ts +150 -0
- package/src/shared/mcp-resolver.ts +150 -0
- package/src/shared/model-pricing-data.ts +109 -0
- package/src/shared/model-pricing.ts +81 -0
- package/src/shared/model-registry.ts +214 -0
- package/src/shared/placeholder-resolver.ts +102 -0
- package/src/shared/plan-artifact.ts +120 -0
- package/src/shared/skill-relevance.ts +222 -0
- package/src/shared/skill-writer.ts +300 -0
- package/src/shared/status.ts +94 -0
- package/src/shared/subagent-gate.ts +117 -0
- package/src/shared/tool-kind.ts +91 -0
- package/src/shared/workspace/__tests__/file-tree.test.ts +210 -0
- package/src/shared/workspace/__tests__/git-source.test.ts +423 -0
- package/src/shared/workspace/__tests__/local-backend-platform.test.ts +259 -0
- package/src/shared/workspace/__tests__/local-backend.test.ts +154 -0
- package/src/shared/workspace/__tests__/platform-mount.test.ts +378 -0
- package/src/shared/workspace/__tests__/provisioner.test.ts +145 -0
- package/src/shared/workspace/file-tree.ts +116 -0
- package/src/shared/workspace/local-backend.ts +140 -0
- package/src/shared/workspace/platform-dir.ts +38 -0
- package/src/shared/workspace/platform-mount.ts +190 -0
- package/src/shared/workspace/provisioner.ts +150 -0
- package/src/shared/workspace/sources/empty.ts +20 -0
- package/src/shared/workspace/sources/git.ts +285 -0
- package/src/shared/workspace/sources/local-path.ts +89 -0
- package/src/shared/workspace/types.ts +69 -0
- package/src/shared/zip-extract.ts +193 -0
- package/src/worker.ts +98 -0
- package/src/workflow-engine/__tests__/do-executor-recovery.test.ts +382 -0
- package/src/workflow-engine/__tests__/do-executor.test.ts +963 -0
- package/src/workflow-engine/__tests__/errors.test.ts +174 -0
- package/src/workflow-engine/__tests__/expression.test.ts +776 -0
- package/src/workflow-engine/__tests__/for.test.ts +575 -0
- package/src/workflow-engine/__tests__/fork.test.ts +838 -0
- package/src/workflow-engine/__tests__/golden-execution.test.ts +1085 -0
- package/src/workflow-engine/__tests__/jq-wasm-spike.test.ts +90 -0
- package/src/workflow-engine/__tests__/loader.test.ts +1393 -0
- package/src/workflow-engine/__tests__/pause-resume.test.ts +267 -0
- package/src/workflow-engine/__tests__/recovery.test.ts +115 -0
- package/src/workflow-engine/__tests__/resolve.test.ts +432 -0
- package/src/workflow-engine/__tests__/retry.test.ts +306 -0
- package/src/workflow-engine/__tests__/state.test.ts +174 -0
- package/src/workflow-engine/__tests__/task-status-accumulator.test.ts +373 -0
- package/src/workflow-engine/__tests__/tasks/call-agent-output.test.ts +120 -0
- package/src/workflow-engine/__tests__/tasks/call-agent.test.ts +816 -0
- package/src/workflow-engine/__tests__/tasks/call-function.test.ts +205 -0
- package/src/workflow-engine/__tests__/tasks/call-grpc.test.ts +133 -0
- package/src/workflow-engine/__tests__/tasks/call-http.test.ts +150 -0
- package/src/workflow-engine/__tests__/tasks/emit-event.test.ts +322 -0
- package/src/workflow-engine/__tests__/tasks/human-input.test.ts +416 -0
- package/src/workflow-engine/__tests__/tasks/listen.test.ts +422 -0
- package/src/workflow-engine/__tests__/tasks/raise.test.ts +166 -0
- package/src/workflow-engine/__tests__/tasks/run.test.ts +272 -0
- package/src/workflow-engine/__tests__/tasks/set.test.ts +127 -0
- package/src/workflow-engine/__tests__/tasks/switch.test.ts +277 -0
- package/src/workflow-engine/__tests__/tasks/try.test.ts +590 -0
- package/src/workflow-engine/__tests__/tasks/wait.test.ts +173 -0
- package/src/workflow-engine/clone.ts +18 -0
- package/src/workflow-engine/do-executor.ts +569 -0
- package/src/workflow-engine/duration.ts +22 -0
- package/src/workflow-engine/error-utils.ts +97 -0
- package/src/workflow-engine/errors.ts +130 -0
- package/src/workflow-engine/expression-utils.ts +129 -0
- package/src/workflow-engine/expression.ts +430 -0
- package/src/workflow-engine/loader.ts +524 -0
- package/src/workflow-engine/recovery.ts +80 -0
- package/src/workflow-engine/resolve.ts +342 -0
- package/src/workflow-engine/retry.ts +109 -0
- package/src/workflow-engine/state.ts +56 -0
- package/src/workflow-engine/task-factory.ts +160 -0
- package/src/workflow-engine/task-status-accumulator.ts +204 -0
- package/src/workflow-engine/tasks/call-agent-output.ts +132 -0
- package/src/workflow-engine/tasks/call-agent.ts +221 -0
- package/src/workflow-engine/tasks/call-function.ts +107 -0
- package/src/workflow-engine/tasks/call-grpc.ts +47 -0
- package/src/workflow-engine/tasks/call-http.ts +51 -0
- package/src/workflow-engine/tasks/for.ts +244 -0
- package/src/workflow-engine/tasks/fork.ts +228 -0
- package/src/workflow-engine/tasks/human-input.ts +147 -0
- package/src/workflow-engine/tasks/listen.ts +166 -0
- package/src/workflow-engine/tasks/raise.ts +81 -0
- package/src/workflow-engine/tasks/run.ts +142 -0
- package/src/workflow-engine/tasks/set.ts +47 -0
- package/src/workflow-engine/tasks/switch.ts +102 -0
- package/src/workflow-engine/tasks/try.ts +274 -0
- package/src/workflow-engine/tasks/wait.ts +53 -0
- package/src/workflow-engine/types.ts +911 -0
- package/src/workflows/__tests__/connect-mcp-server.test.ts +359 -0
- package/src/workflows/__tests__/execute-serverless-workflow.test.ts +277 -0
- package/src/workflows/call-agent-orchestrator.ts +283 -0
- package/src/workflows/connect-mcp-server.ts +152 -0
- package/src/workflows/engine-core.ts +406 -0
- package/src/workflows/execute-from-execution.ts +101 -0
- package/src/workflows/execute-serverless-workflow.ts +60 -0
- package/src/workflows/human-input-orchestrator.ts +76 -0
- package/src/workflows/index.ts +32 -0
- package/src/workflows/listen-orchestrator.ts +200 -0
- package/src/workflows/metrics-sink.ts +48 -0
- package/src/workflows/run-orchestrator.ts +34 -0
- package/src/workflows/types.ts +64 -0
- package/src/workflows/workflow-signals.ts +55 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns the runner's two-writer token model.
|
|
3
|
+
*
|
|
4
|
+
* The runner authenticates two surfaces with two credentials that may diverge:
|
|
5
|
+
*
|
|
6
|
+
* - the control-plane token (the host's durable credential, e.g. the desktop's
|
|
7
|
+
* Auth0 token), used for Authorization on control-plane gRPC; and
|
|
8
|
+
* - the proxy token (x-stigmer-auth), used for Cursor-proxy traffic.
|
|
9
|
+
*
|
|
10
|
+
* On most hosts these are the same token. On cloud the control plane mints a
|
|
11
|
+
* dedicated iss=stigmer proxy token during bootstrap; from that point the proxy
|
|
12
|
+
* token is a *separate* credential with its own TTL, owned and refreshed here.
|
|
13
|
+
*
|
|
14
|
+
* This coordinator exists because the proxy token's freshness was the subject of
|
|
15
|
+
* two production fixes (stigmer-cloud _changelog 2026-05-26 and 2026-06-01):
|
|
16
|
+
* before them, the proxy token froze at startup and silently 401'd after the
|
|
17
|
+
* host's token refreshed. The lockstep those fixes established — "every token
|
|
18
|
+
* refresh updates the proxy sink too" — is preserved here for hosts that do not
|
|
19
|
+
* mint (see {@link RunnerTokenCoordinator.onControlPlaneTokenChanged}). Once a
|
|
20
|
+
* token is minted, freshness is instead guaranteed by {@link reMint} on a timer,
|
|
21
|
+
* and a control-plane refresh must NOT overwrite the minted token. Keeping that
|
|
22
|
+
* gate in one tested place is the whole point of this module.
|
|
23
|
+
*/
|
|
24
|
+
/** Fraction of a minted token's lifetime after which the runner re-mints. */
|
|
25
|
+
const REFRESH_FRACTION = 0.8;
|
|
26
|
+
/** Floor for the refresh delay so a tiny/absent TTL cannot spin a hot loop. */
|
|
27
|
+
const MIN_REFRESH_MS = 5_000;
|
|
28
|
+
/** Fallback lifetime when the server omits an expiry alongside a minted token. */
|
|
29
|
+
const FALLBACK_TTL_SECONDS = 3_600;
|
|
30
|
+
/** Retry delay after a failed re-mint, short enough to recover before expiry. */
|
|
31
|
+
const RETRY_DELAY_MS = 60_000;
|
|
32
|
+
export function createRunnerTokenCoordinator(options) {
|
|
33
|
+
const log = options.log ?? console;
|
|
34
|
+
let proxyTokenIsMinted = false;
|
|
35
|
+
let refreshTimer = null;
|
|
36
|
+
const clearTimer = () => {
|
|
37
|
+
if (refreshTimer) {
|
|
38
|
+
clearTimeout(refreshTimer);
|
|
39
|
+
refreshTimer = null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const scheduleRefresh = (expiresInSeconds) => {
|
|
43
|
+
clearTimer();
|
|
44
|
+
const ttlSeconds = expiresInSeconds && expiresInSeconds > 0
|
|
45
|
+
? expiresInSeconds
|
|
46
|
+
: FALLBACK_TTL_SECONDS;
|
|
47
|
+
const delayMs = Math.max(MIN_REFRESH_MS, Math.floor(ttlSeconds * REFRESH_FRACTION * 1000));
|
|
48
|
+
refreshTimer = setTimeout(() => {
|
|
49
|
+
void refresh();
|
|
50
|
+
}, delayMs);
|
|
51
|
+
// Do not keep the process alive solely for a token refresh.
|
|
52
|
+
refreshTimer.unref?.();
|
|
53
|
+
};
|
|
54
|
+
const refresh = async () => {
|
|
55
|
+
const refreshed = await options.reMint();
|
|
56
|
+
if (refreshed) {
|
|
57
|
+
options.applyProxyToken(refreshed.token);
|
|
58
|
+
scheduleRefresh(refreshed.expiresInSeconds);
|
|
59
|
+
log.log("[runner-token] Proxy token refreshed");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Re-mint failed or yielded no token; retry soon. The host keeps the
|
|
63
|
+
// control-plane token fresh, so a later attempt (e.g. after laptop wake)
|
|
64
|
+
// recovers without a process restart.
|
|
65
|
+
scheduleRefresh(RETRY_DELAY_MS / 1000);
|
|
66
|
+
log.warn("[runner-token] Proxy token refresh failed; will retry");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
adoptMintedToken(token, expiresInSeconds) {
|
|
71
|
+
proxyTokenIsMinted = true;
|
|
72
|
+
options.applyProxyToken(token);
|
|
73
|
+
scheduleRefresh(expiresInSeconds);
|
|
74
|
+
},
|
|
75
|
+
onControlPlaneTokenChanged(token) {
|
|
76
|
+
if (!proxyTokenIsMinted && token) {
|
|
77
|
+
options.applyProxyToken(token);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
isProxyTokenMinted: () => proxyTokenIsMinted,
|
|
81
|
+
stop: clearTimer,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=runner-token-coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner-token-coordinator.js","sourceRoot":"","sources":["../src/runner-token-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,6EAA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,KAAK,CAAC,CAAC;YACzC,eAAe,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAC5C,GAAG,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,qEAAqE;YACrE,yEAAyE;YACzE,sCAAsC;YACtC,eAAe,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;YACvC,GAAG,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,gBAAgB,CAAC,KAAK,EAAE,gBAAgB;YACtC,kBAAkB,GAAG,IAAI,CAAC;YAC1B,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC/B,eAAe,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;QACD,0BAA0B,CAAC,KAAK;YAC9B,IAAI,CAAC,kBAAkB,IAAI,KAAK,EAAE,CAAC;gBACjC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,kBAAkB;QAC5C,IAAI,EAAE,UAAU;KACjB,CAAC;AACJ,CAAC"}
|
package/dist/runner.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public factory for the unified Stigmer runner.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the full boot sequence: fetch interceptor installation,
|
|
5
|
+
* dynamic activity imports, Temporal worker creation. Consumers call
|
|
6
|
+
* {@link createStigmerRunner} with typed options and get back a handle
|
|
7
|
+
* to start/shutdown the worker.
|
|
8
|
+
*
|
|
9
|
+
* OTel tracing and metrics are intentionally excluded — they mutate
|
|
10
|
+
* global state and should be initialized by the consumer before calling
|
|
11
|
+
* this factory. The Temporal OTel activity interceptor is still wired
|
|
12
|
+
* internally when OTEL_EXPORTER_OTLP_ENDPOINT is set.
|
|
13
|
+
*/
|
|
14
|
+
import type { Config } from "./config.js";
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for creating a Stigmer runner.
|
|
17
|
+
*
|
|
18
|
+
* Required fields must be provided by the consumer. Optional fields
|
|
19
|
+
* have sensible defaults for local development.
|
|
20
|
+
*/
|
|
21
|
+
export interface StigmerRunnerOptions {
|
|
22
|
+
/** Temporal task queue to poll for work. */
|
|
23
|
+
readonly taskQueue: string;
|
|
24
|
+
/**
|
|
25
|
+
* Temporal server address (e.g. "localhost:7233"). Optional: when omitted, the
|
|
26
|
+
* runner self-discovers it during boot from the control plane using
|
|
27
|
+
* {@link stigmerToken} (see bootstrap.ts). An explicit value always wins.
|
|
28
|
+
*/
|
|
29
|
+
readonly temporalAddress?: string;
|
|
30
|
+
/** Stigmer server endpoint for status updates, artifacts, and blueprints. */
|
|
31
|
+
readonly stigmerEndpoint: string;
|
|
32
|
+
/** Temporal namespace. @default "default" */
|
|
33
|
+
readonly temporalNamespace?: string;
|
|
34
|
+
/** Auth token for authenticating with the Stigmer server. */
|
|
35
|
+
readonly stigmerToken?: string;
|
|
36
|
+
/** Cursor API key for direct mode (not needed in proxy mode). */
|
|
37
|
+
readonly cursorApiKey?: string;
|
|
38
|
+
/** Root directory for agent workspaces. Defaults to ~/.stigmer/workspaces/runner. */
|
|
39
|
+
readonly workspaceRootDir?: string;
|
|
40
|
+
/** Maximum concurrent Temporal activity executions. @default 5 */
|
|
41
|
+
readonly maxConcurrentActivities?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Stigmer proxy endpoint. When set, activates proxy mode: the fetch
|
|
44
|
+
* interceptor rewrites outbound Cursor SDK requests through the proxy,
|
|
45
|
+
* and cloud-specific behaviors (HTTP checkpointer, required auth) activate.
|
|
46
|
+
*/
|
|
47
|
+
readonly proxyEndpoint?: string;
|
|
48
|
+
/** Default LLM model identifier. @default "gpt-4.1" */
|
|
49
|
+
readonly primaryModel?: string;
|
|
50
|
+
/** Checkpointer type for LangGraph agent state. @default "memory" (or "http" if proxyEndpoint is set) */
|
|
51
|
+
readonly checkpointerType?: "memory" | "http";
|
|
52
|
+
/** Checkpointer proxy endpoint. Falls back to proxyEndpoint. */
|
|
53
|
+
readonly checkpointerProxyEndpoint?: string;
|
|
54
|
+
/** Enable Cursor cloud mode for workspace-less execution. @default false */
|
|
55
|
+
readonly cloudModeEnabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Workspace/filesystem execution location — where the agent actually runs.
|
|
58
|
+
*
|
|
59
|
+
* - "local": the agent operates on the host filesystem (local-path workspace
|
|
60
|
+
* entries are valid; the desktop app and CLI daemon use this).
|
|
61
|
+
* - "cloud": the agent runs in a server-provisioned sandbox (git-only).
|
|
62
|
+
*
|
|
63
|
+
* This is intentionally distinct from {@link proxyEndpoint}, which controls
|
|
64
|
+
* credential/artifact *transport*. The desktop runner is the canonical case
|
|
65
|
+
* where the two diverge: it executes locally while routing Cursor traffic and
|
|
66
|
+
* artifacts through the proxy.
|
|
67
|
+
*
|
|
68
|
+
* When unset, the location is derived from {@link proxyEndpoint} for backward
|
|
69
|
+
* compatibility (proxy ⇒ "cloud", otherwise "local"). Set this explicitly to
|
|
70
|
+
* express local execution with proxy transport — the same decoupling
|
|
71
|
+
* {@link createStigmerRunnerManager} provides via its own `executionMode`.
|
|
72
|
+
*/
|
|
73
|
+
readonly executionMode?: "local" | "cloud";
|
|
74
|
+
}
|
|
75
|
+
/** Handle returned by {@link createStigmerRunner}. */
|
|
76
|
+
export interface StigmerRunner {
|
|
77
|
+
/** Start polling for tasks. Blocks until the worker is shut down. */
|
|
78
|
+
start(): Promise<void>;
|
|
79
|
+
/** Signal graceful shutdown — drains in-flight activities then stops. */
|
|
80
|
+
shutdown(): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create a Stigmer runner ready to poll a Temporal task queue.
|
|
84
|
+
*
|
|
85
|
+
* Handles all internal setup: Cursor SDK fetch interceptor, activity
|
|
86
|
+
* registration, and Temporal worker creation. Returns a handle with
|
|
87
|
+
* `start()` and `shutdown()` methods.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* import { createStigmerRunner } from '@stigmer/runner';
|
|
92
|
+
*
|
|
93
|
+
* const runner = await createStigmerRunner({
|
|
94
|
+
* taskQueue: 'session:abc-123',
|
|
95
|
+
* temporalAddress: 'localhost:7233',
|
|
96
|
+
* stigmerEndpoint: 'http://localhost:7234',
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* process.on('SIGTERM', () => runner.shutdown());
|
|
100
|
+
* await runner.start();
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function createStigmerRunner(options: StigmerRunnerOptions): Promise<StigmerRunner>;
|
|
104
|
+
export declare function mapOptionsToConfig(options: StigmerRunnerOptions): Config;
|
package/dist/runner.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public factory for the unified Stigmer runner.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the full boot sequence: fetch interceptor installation,
|
|
5
|
+
* dynamic activity imports, Temporal worker creation. Consumers call
|
|
6
|
+
* {@link createStigmerRunner} with typed options and get back a handle
|
|
7
|
+
* to start/shutdown the worker.
|
|
8
|
+
*
|
|
9
|
+
* OTel tracing and metrics are intentionally excluded — they mutate
|
|
10
|
+
* global state and should be initialized by the consumer before calling
|
|
11
|
+
* this factory. The Temporal OTel activity interceptor is still wired
|
|
12
|
+
* internally when OTEL_EXPORTER_OTLP_ENDPOINT is set.
|
|
13
|
+
*/
|
|
14
|
+
import { mkdirSync } from "node:fs";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { homedir, tmpdir } from "node:os";
|
|
17
|
+
import { resolveRunnerBootstrap } from "./bootstrap.js";
|
|
18
|
+
/**
|
|
19
|
+
* Create a Stigmer runner ready to poll a Temporal task queue.
|
|
20
|
+
*
|
|
21
|
+
* Handles all internal setup: Cursor SDK fetch interceptor, activity
|
|
22
|
+
* registration, and Temporal worker creation. Returns a handle with
|
|
23
|
+
* `start()` and `shutdown()` methods.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createStigmerRunner } from '@stigmer/runner';
|
|
28
|
+
*
|
|
29
|
+
* const runner = await createStigmerRunner({
|
|
30
|
+
* taskQueue: 'session:abc-123',
|
|
31
|
+
* temporalAddress: 'localhost:7233',
|
|
32
|
+
* stigmerEndpoint: 'http://localhost:7234',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* process.on('SIGTERM', () => runner.shutdown());
|
|
36
|
+
* await runner.start();
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export async function createStigmerRunner(options) {
|
|
40
|
+
validateOptions(options);
|
|
41
|
+
const baseConfig = mapOptionsToConfig(options);
|
|
42
|
+
// Install the Cursor SDK interceptors BEFORE resolving Temporal coordinates.
|
|
43
|
+
// Coordinate discovery dials the control plane via StigmerClient, which loads
|
|
44
|
+
// @connectrpc/connect-node and snapshots the node:http2 ESM facade on first
|
|
45
|
+
// import. The HTTP/2 interceptor patches http2.connect and only propagates to
|
|
46
|
+
// that facade if it runs first, so install MUST precede any connect-node load
|
|
47
|
+
// (discovery here, and the SDK later). The interceptors depend only on
|
|
48
|
+
// proxyEndpoint/stigmerToken (already in baseConfig), not resolved coordinates.
|
|
49
|
+
// The Cursor SDK captures a reference to global.fetch at import time.
|
|
50
|
+
// The fetch interceptor MUST be installed before any @cursor/sdk import.
|
|
51
|
+
const { installFetchInterceptor, getExecutionContext } = await import("./activities/execute-cursor/fetch-interceptor.js");
|
|
52
|
+
installFetchInterceptor({
|
|
53
|
+
proxyEndpoint: baseConfig.proxyEndpoint ?? undefined,
|
|
54
|
+
stigmerToken: baseConfig.stigmerToken ?? undefined,
|
|
55
|
+
});
|
|
56
|
+
// The Cursor SDK's Connect RPC transport uses native HTTP/2, bypassing
|
|
57
|
+
// globalThis.fetch. This interceptor injects x-stigmer-execution-id and
|
|
58
|
+
// the Stigmer auth token on HTTP/2 streams so the BiDi proxy can
|
|
59
|
+
// authenticate and meter billing.
|
|
60
|
+
const { installHttp2Interceptor, assertHttp2ConnectPatched } = await import("./activities/execute-cursor/http2-interceptor.js");
|
|
61
|
+
installHttp2Interceptor({
|
|
62
|
+
proxyEndpoint: baseConfig.proxyEndpoint ?? undefined,
|
|
63
|
+
stigmerToken: baseConfig.stigmerToken ?? undefined,
|
|
64
|
+
});
|
|
65
|
+
// Fail loudly at boot if a load-order regression left the node:http2 ESM
|
|
66
|
+
// facade unpatched (otherwise BiDi streams would silently 401). No-op when
|
|
67
|
+
// the interceptor is unconfigured (no proxy/token).
|
|
68
|
+
await assertHttp2ConnectPatched();
|
|
69
|
+
// Resolve Temporal coordinates after the http2 patch is in place (discovery
|
|
70
|
+
// dials the control plane through connect-node). Explicit address wins;
|
|
71
|
+
// otherwise a token triggers control-plane discovery; otherwise localhost.
|
|
72
|
+
// Activities that dial Temporal at runtime (e.g. emit-event) read
|
|
73
|
+
// config.temporalAddress, so this must precede their creation.
|
|
74
|
+
//
|
|
75
|
+
// The static runner brings its own already-proxy-valid token (harness/CLI),
|
|
76
|
+
// so it does not consume the minted runner token from the bootstrap response;
|
|
77
|
+
// that proxy-credential lifecycle lives in createStigmerRunnerManager (the
|
|
78
|
+
// long-lived desktop host that needs it). Only the coordinates are used here.
|
|
79
|
+
const coordinates = await resolveRunnerBootstrap({
|
|
80
|
+
explicitAddress: options.temporalAddress,
|
|
81
|
+
explicitNamespace: options.temporalNamespace,
|
|
82
|
+
token: options.stigmerToken,
|
|
83
|
+
stigmerEndpoint: baseConfig.stigmerBackendEndpoint,
|
|
84
|
+
});
|
|
85
|
+
const config = {
|
|
86
|
+
...baseConfig,
|
|
87
|
+
temporalAddress: coordinates.temporalAddress,
|
|
88
|
+
temporalNamespace: coordinates.temporalNamespace,
|
|
89
|
+
};
|
|
90
|
+
const { setExecutionContextRef } = await import("./activities/execute-cursor/rejection-capture.js");
|
|
91
|
+
setExecutionContextRef(getExecutionContext());
|
|
92
|
+
const activities = await createAllActivities(config);
|
|
93
|
+
console.log(`[runner] Registered activities: ${Object.keys(activities).join(", ")}`);
|
|
94
|
+
console.log(`[runner] Task queue: ${config.taskQueue} | ` +
|
|
95
|
+
`Mode: ${config.mode} | ` +
|
|
96
|
+
`Max concurrency: ${config.maxConcurrentActivities}`);
|
|
97
|
+
const payloadCodec = await createPayloadCodec(config);
|
|
98
|
+
const { startWorker } = await import("./worker.js");
|
|
99
|
+
const worker = await startWorker({ config, activities, payloadCodec });
|
|
100
|
+
return {
|
|
101
|
+
async start() {
|
|
102
|
+
console.log("Worker ready, polling for tasks...");
|
|
103
|
+
await worker.run();
|
|
104
|
+
console.log("Worker stopped");
|
|
105
|
+
},
|
|
106
|
+
shutdown() {
|
|
107
|
+
worker.shutdown();
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function validateOptions(options) {
|
|
112
|
+
if (!options.taskQueue) {
|
|
113
|
+
throw new Error("StigmerRunnerOptions.taskQueue is required — specify the Temporal task queue to poll");
|
|
114
|
+
}
|
|
115
|
+
if (!options.stigmerEndpoint) {
|
|
116
|
+
throw new Error("StigmerRunnerOptions.stigmerEndpoint is required — specify the Stigmer server endpoint (e.g. 'http://localhost:7234')");
|
|
117
|
+
}
|
|
118
|
+
// temporalAddress is intentionally NOT required: when omitted, the runner
|
|
119
|
+
// discovers it from the control plane (token-only embedding), falling back to
|
|
120
|
+
// localhost when no token is present.
|
|
121
|
+
}
|
|
122
|
+
export function mapOptionsToConfig(options) {
|
|
123
|
+
const proxyActive = !!options.proxyEndpoint;
|
|
124
|
+
// Execution location is independent of proxy transport. An explicit
|
|
125
|
+
// `executionMode` always wins; otherwise fall back to the proxy-derived
|
|
126
|
+
// default for backward compatibility. Setting `executionMode: "local"` with a
|
|
127
|
+
// proxy is the desktop case (local-path workspaces + proxied Cursor traffic).
|
|
128
|
+
const mode = options.executionMode ?? (proxyActive ? "cloud" : "local");
|
|
129
|
+
return {
|
|
130
|
+
taskQueue: options.taskQueue,
|
|
131
|
+
// May be empty here; createStigmerRunner resolves it via
|
|
132
|
+
// resolveRunnerBootstrap before the worker connects to Temporal.
|
|
133
|
+
temporalAddress: options.temporalAddress ?? "",
|
|
134
|
+
temporalNamespace: options.temporalNamespace ?? "default",
|
|
135
|
+
stigmerBackendEndpoint: normalizeEndpoint(options.stigmerEndpoint),
|
|
136
|
+
stigmerToken: options.stigmerToken ?? null,
|
|
137
|
+
cursorApiKey: proxyActive
|
|
138
|
+
? (options.cursorApiKey ?? "proxy-managed")
|
|
139
|
+
: (options.cursorApiKey ?? ""),
|
|
140
|
+
workspaceRootDir: options.workspaceRootDir ?? resolveDefaultWorkspaceDir(),
|
|
141
|
+
mode,
|
|
142
|
+
proxyEndpoint: options.proxyEndpoint ?? null,
|
|
143
|
+
maxConcurrentActivities: options.maxConcurrentActivities ?? 5,
|
|
144
|
+
idleTimeoutSeconds: null,
|
|
145
|
+
cloudModeEnabled: options.cloudModeEnabled ?? false,
|
|
146
|
+
checkpointerType: options.checkpointerType
|
|
147
|
+
?? (proxyActive ? "http" : "memory"),
|
|
148
|
+
checkpointerProxyEndpoint: options.checkpointerProxyEndpoint
|
|
149
|
+
?? options.proxyEndpoint
|
|
150
|
+
?? null,
|
|
151
|
+
primaryModel: options.primaryModel ?? "gpt-4.1",
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Dynamically import all activity factories and merge into a single map.
|
|
156
|
+
*
|
|
157
|
+
* Dynamic imports are required because several modules transitively import
|
|
158
|
+
* @cursor/sdk, which captures global.fetch at import time. The fetch
|
|
159
|
+
* interceptor must be installed before these imports.
|
|
160
|
+
*/
|
|
161
|
+
async function createAllActivities(config) {
|
|
162
|
+
const [{ createCursorActivities }, { createDeepAgentActivities }, { createEnsureThreadActivities }, { createClassifyToolApprovalsActivities }, { createDiscoverMcpServerActivities }, { createEvaluateExpressionsActivities }, { createCallHttpActivities }, { createCallGrpcActivities }, { createCallFunctionActivities }, { createCallLlmActivities }, { createCallAgentActivities }, { createCallAgentStatusActivities }, { createRunCommandActivities }, { createHydrateWorkflowActivities }, { createWorkflowEventActivities }, { createPromoteTaskOutputActivities },] = await Promise.all([
|
|
163
|
+
import("./activities/execute-cursor/index.js"),
|
|
164
|
+
import("./activities/execute-deep-agent/index.js"),
|
|
165
|
+
import("./activities/ensure-thread.js"),
|
|
166
|
+
import("./activities/classify-tool-approvals.js"),
|
|
167
|
+
import("./activities/discover-mcp-server.js"),
|
|
168
|
+
import("./activities/evaluate-expressions.js"),
|
|
169
|
+
import("./activities/call-http.js"),
|
|
170
|
+
import("./activities/call-grpc.js"),
|
|
171
|
+
import("./activities/call-function.js"),
|
|
172
|
+
import("./activities/call-llm.js"),
|
|
173
|
+
import("./activities/call-agent.js"),
|
|
174
|
+
import("./activities/call-agent-status.js"),
|
|
175
|
+
import("./activities/run-command.js"),
|
|
176
|
+
import("./activities/hydrate-workflow-execution.js"),
|
|
177
|
+
import("./activities/workflow-event-activities.js"),
|
|
178
|
+
import("./activities/promote-task-output.js"),
|
|
179
|
+
]);
|
|
180
|
+
return {
|
|
181
|
+
...createCursorActivities(config),
|
|
182
|
+
...createDeepAgentActivities(config),
|
|
183
|
+
...createEnsureThreadActivities(),
|
|
184
|
+
...createClassifyToolApprovalsActivities(config),
|
|
185
|
+
...createDiscoverMcpServerActivities(config),
|
|
186
|
+
...createEvaluateExpressionsActivities(),
|
|
187
|
+
...createCallHttpActivities(),
|
|
188
|
+
...createCallGrpcActivities(),
|
|
189
|
+
...createCallFunctionActivities(),
|
|
190
|
+
...createCallLlmActivities(),
|
|
191
|
+
...createCallAgentActivities(),
|
|
192
|
+
...createCallAgentStatusActivities(),
|
|
193
|
+
...createRunCommandActivities(),
|
|
194
|
+
...createHydrateWorkflowActivities(config),
|
|
195
|
+
...createWorkflowEventActivities(),
|
|
196
|
+
...createPromoteTaskOutputActivities(),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
async function createPayloadCodec(config) {
|
|
200
|
+
const { loadClaimcheckConfig, ClaimcheckPayloadCodec } = await import("./claimcheck/index.js");
|
|
201
|
+
const claimcheckConfig = loadClaimcheckConfig();
|
|
202
|
+
if (!claimcheckConfig.enabled) {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
const { loadArtifactStorageConfig, createArtifactStorage } = await import("./shared/artifact-storage.js");
|
|
206
|
+
const storageConfig = loadArtifactStorageConfig(config);
|
|
207
|
+
const storage = createArtifactStorage(storageConfig);
|
|
208
|
+
console.log(`[runner] Claimcheck enabled (threshold=${claimcheckConfig.thresholdBytes}B, ` +
|
|
209
|
+
`compression=${claimcheckConfig.compressionEnabled}, ` +
|
|
210
|
+
`storage=${storageConfig.type})`);
|
|
211
|
+
return new ClaimcheckPayloadCodec(storage, claimcheckConfig);
|
|
212
|
+
}
|
|
213
|
+
function resolveDefaultWorkspaceDir() {
|
|
214
|
+
try {
|
|
215
|
+
const dir = join(homedir(), ".stigmer", "workspaces", "runner");
|
|
216
|
+
mkdirSync(dir, { recursive: true });
|
|
217
|
+
return dir;
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
const dir = join(tmpdir(), "stigmer-runner-workspace");
|
|
221
|
+
mkdirSync(dir, { recursive: true });
|
|
222
|
+
return dir;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function normalizeEndpoint(endpoint) {
|
|
226
|
+
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
227
|
+
return endpoint;
|
|
228
|
+
}
|
|
229
|
+
if (endpoint.endsWith(":443")) {
|
|
230
|
+
return `https://${endpoint}`;
|
|
231
|
+
}
|
|
232
|
+
return `http://${endpoint}`;
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;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system-generated defaults
|
|
6
|
+
* 2. McpServerSpec.pinned_tool_approvals — manual overrides
|
|
7
|
+
* 3. McpServerUsage.tool_approval_overrides — per-agent customization
|
|
8
|
+
* 4. AgentExecutionSpec.auto_approve_all — runtime bypass
|
|
9
|
+
*
|
|
10
|
+
* Used by both ExecuteCursor (hook-deny model) and ExecuteDeepAgent
|
|
11
|
+
* (middleware interruptOn model) to determine which tools need approval.
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolApprovalOverride } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
14
|
+
import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
15
|
+
import type { ResolvedMcpServer } from "./mcp-resolver.js";
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if any tool call in the execution history (root or sub-agent)
|
|
18
|
+
* carries an APPROVE_ALL decision.
|
|
19
|
+
*
|
|
20
|
+
* This is the runner-side realization of the APPROVE_ALL contract (see the
|
|
21
|
+
* ApprovalAction doc in enum.proto): once a user has chosen "approve and don't
|
|
22
|
+
* ask again" at any gate, the rest of THIS execution runs un-gated — exactly as
|
|
23
|
+
* if spec.auto_approve_all were true. Both harnesses (native deepagents and
|
|
24
|
+
* cursor) call this so the behavior is defined in exactly one place.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasApproveAllDecision(execution: AgentExecution): boolean;
|
|
27
|
+
export interface MergedToolPolicy {
|
|
28
|
+
toolName: string;
|
|
29
|
+
mcpServerSlug: string;
|
|
30
|
+
requiresApproval: boolean;
|
|
31
|
+
approvalMessage: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Merge approval policies from all four levels into a single lookup map.
|
|
35
|
+
*
|
|
36
|
+
* Keys are "serverSlug/toolName" to avoid collisions between servers.
|
|
37
|
+
* When autoApproveAll is true, the returned map is empty.
|
|
38
|
+
*/
|
|
39
|
+
export declare function mergeApprovalPolicies(resolvedServers: ResolvedMcpServer[], agentOverrides: ToolApprovalOverride[], autoApproveAll: boolean): Map<string, MergedToolPolicy>;
|
|
40
|
+
export declare function lookupMcpToolPolicy(toolName: string, mcpServerSlug: string, policies: Map<string, MergedToolPolicy>): MergedToolPolicy | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve {{args.field}} placeholders in an approval message using the
|
|
43
|
+
* tool's actual arguments.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveApprovalMessage(template: string, toolName: string, args: Record<string, unknown>): string;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool approval policy evaluation — harness-agnostic.
|
|
3
|
+
*
|
|
4
|
+
* Implements the four-level policy chain:
|
|
5
|
+
* 1. McpServerStatus.tool_approvals — system-generated defaults
|
|
6
|
+
* 2. McpServerSpec.pinned_tool_approvals — manual overrides
|
|
7
|
+
* 3. McpServerUsage.tool_approval_overrides — per-agent customization
|
|
8
|
+
* 4. AgentExecutionSpec.auto_approve_all — runtime bypass
|
|
9
|
+
*
|
|
10
|
+
* Used by both ExecuteCursor (hook-deny model) and ExecuteDeepAgent
|
|
11
|
+
* (middleware interruptOn model) to determine which tools need approval.
|
|
12
|
+
*/
|
|
13
|
+
import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if any tool call in the execution history (root or sub-agent)
|
|
16
|
+
* carries an APPROVE_ALL decision.
|
|
17
|
+
*
|
|
18
|
+
* This is the runner-side realization of the APPROVE_ALL contract (see the
|
|
19
|
+
* ApprovalAction doc in enum.proto): once a user has chosen "approve and don't
|
|
20
|
+
* ask again" at any gate, the rest of THIS execution runs un-gated — exactly as
|
|
21
|
+
* if spec.auto_approve_all were true. Both harnesses (native deepagents and
|
|
22
|
+
* cursor) call this so the behavior is defined in exactly one place.
|
|
23
|
+
*/
|
|
24
|
+
export function hasApproveAllDecision(execution) {
|
|
25
|
+
const status = execution.status;
|
|
26
|
+
if (!status)
|
|
27
|
+
return false;
|
|
28
|
+
for (const message of status.messages) {
|
|
29
|
+
for (const tc of message.toolCalls) {
|
|
30
|
+
if (tc.approvalAction === ApprovalAction.APPROVE_ALL)
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const sa of status.subAgentExecutions) {
|
|
35
|
+
for (const message of sa.messages) {
|
|
36
|
+
for (const tc of message.toolCalls) {
|
|
37
|
+
if (tc.approvalAction === ApprovalAction.APPROVE_ALL)
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merge approval policies from all four levels into a single lookup map.
|
|
46
|
+
*
|
|
47
|
+
* Keys are "serverSlug/toolName" to avoid collisions between servers.
|
|
48
|
+
* When autoApproveAll is true, the returned map is empty.
|
|
49
|
+
*/
|
|
50
|
+
export function mergeApprovalPolicies(resolvedServers, agentOverrides, autoApproveAll) {
|
|
51
|
+
const merged = new Map();
|
|
52
|
+
if (autoApproveAll)
|
|
53
|
+
return merged;
|
|
54
|
+
for (const server of resolvedServers) {
|
|
55
|
+
const serverPolicies = new Map();
|
|
56
|
+
for (const policy of server.toolApprovals) {
|
|
57
|
+
if (!policy.toolName)
|
|
58
|
+
continue;
|
|
59
|
+
serverPolicies.set(policy.toolName, {
|
|
60
|
+
requiresApproval: true,
|
|
61
|
+
message: policy.message || `Execute tool: ${policy.toolName}`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
for (const pinned of server.pinnedToolApprovals) {
|
|
65
|
+
if (!pinned.toolName)
|
|
66
|
+
continue;
|
|
67
|
+
serverPolicies.set(pinned.toolName, {
|
|
68
|
+
requiresApproval: true,
|
|
69
|
+
message: pinned.message || serverPolicies.get(pinned.toolName)?.message || `Execute tool: ${pinned.toolName}`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
for (const override of agentOverrides) {
|
|
73
|
+
if (!override.toolName)
|
|
74
|
+
continue;
|
|
75
|
+
const existing = serverPolicies.get(override.toolName);
|
|
76
|
+
if (existing) {
|
|
77
|
+
existing.requiresApproval = override.requiresApproval;
|
|
78
|
+
if (override.message) {
|
|
79
|
+
existing.message = override.message;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (override.requiresApproval) {
|
|
83
|
+
serverPolicies.set(override.toolName, {
|
|
84
|
+
requiresApproval: true,
|
|
85
|
+
message: override.message || `Execute tool: ${override.toolName}`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const [toolName, policy] of serverPolicies) {
|
|
90
|
+
if (!policy.requiresApproval)
|
|
91
|
+
continue;
|
|
92
|
+
const key = `${server.slug}/${toolName}`;
|
|
93
|
+
merged.set(key, {
|
|
94
|
+
toolName,
|
|
95
|
+
mcpServerSlug: server.slug,
|
|
96
|
+
requiresApproval: true,
|
|
97
|
+
approvalMessage: policy.message,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return merged;
|
|
102
|
+
}
|
|
103
|
+
export function lookupMcpToolPolicy(toolName, mcpServerSlug, policies) {
|
|
104
|
+
return policies.get(`${mcpServerSlug}/${toolName}`);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve {{args.field}} placeholders in an approval message using the
|
|
108
|
+
* tool's actual arguments.
|
|
109
|
+
*/
|
|
110
|
+
export function resolveApprovalMessage(template, toolName, args) {
|
|
111
|
+
return template
|
|
112
|
+
.replace(/\{\{tool_name\}\}/g, toolName)
|
|
113
|
+
.replace(/\{\{args\.(\w+)\}\}/g, (_match, field) => {
|
|
114
|
+
const value = args[field];
|
|
115
|
+
if (value === undefined || value === null)
|
|
116
|
+
return "<unknown>";
|
|
117
|
+
if (typeof value === "string")
|
|
118
|
+
return value;
|
|
119
|
+
return JSON.stringify(value);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=approval-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-policy.js","sourceRoot":"","sources":["../../src/shared/approval-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAG9F;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAyB;IAC7D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAE1B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,IAAI,EAAE,CAAC,cAAc,KAAK,cAAc,CAAC,WAAW;gBAAE,OAAO,IAAI,CAAC;QACpE,CAAC;IACH,CAAC;IACD,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;YAClC,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACnC,IAAI,EAAE,CAAC,cAAc,KAAK,cAAc,CAAC,WAAW;oBAAE,OAAO,IAAI,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AASD;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,eAAoC,EACpC,cAAsC,EACtC,cAAuB;IAEvB,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IAEnD,IAAI,cAAc;QAAE,OAAO,MAAM,CAAC;IAElC,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACrC,MAAM,cAAc,GAAG,IAAI,GAAG,EAA0D,CAAC;QAEzF,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,aAAa,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|
4
|
+
* Two backends:
|
|
5
|
+
* - Local: writes to the filesystem, served by stigmer-server (OSS mode).
|
|
6
|
+
* - Proxy: uses presigned URLs from the Stigmer Side-Channel Proxy (cloud mode).
|
|
7
|
+
*
|
|
8
|
+
* The runner never holds R2/S3 credentials — in cloud mode it calls the proxy
|
|
9
|
+
* to obtain a presigned upload URL, then PUTs content over plain HTTPS.
|
|
10
|
+
*
|
|
11
|
+
* DD-6: No direct R2 backend. Local + Proxy only.
|
|
12
|
+
*/
|
|
13
|
+
import type { Config } from "../config.js";
|
|
14
|
+
export interface ArtifactStorage {
|
|
15
|
+
upload(key: string, content: Buffer, contentType?: string): Promise<string>;
|
|
16
|
+
getDownloadUrl(key: string): Promise<string>;
|
|
17
|
+
exists(key: string): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export type ArtifactStorageType = "local" | "proxy";
|
|
20
|
+
export declare class LocalArtifactStorage implements ArtifactStorage {
|
|
21
|
+
private readonly basePath;
|
|
22
|
+
private readonly serveUrlBase;
|
|
23
|
+
constructor(basePath: string, serveUrlBase: string);
|
|
24
|
+
upload(key: string, content: Buffer, _contentType?: string): Promise<string>;
|
|
25
|
+
getDownloadUrl(key: string): Promise<string>;
|
|
26
|
+
exists(key: string): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export declare class ProxyArtifactStorage implements ArtifactStorage {
|
|
29
|
+
private readonly baseUrl;
|
|
30
|
+
private readonly authToken;
|
|
31
|
+
constructor(proxyEndpoint: string, authToken: string);
|
|
32
|
+
upload(key: string, content: Buffer, contentType?: string): Promise<string>;
|
|
33
|
+
getDownloadUrl(key: string): Promise<string>;
|
|
34
|
+
exists(key: string): Promise<boolean>;
|
|
35
|
+
}
|
|
36
|
+
export interface ArtifactStorageConfig {
|
|
37
|
+
readonly type: ArtifactStorageType;
|
|
38
|
+
readonly localPath: string;
|
|
39
|
+
readonly localServeUrl: string;
|
|
40
|
+
readonly proxyEndpoint: string | null;
|
|
41
|
+
readonly proxyAuthToken: string | null;
|
|
42
|
+
}
|
|
43
|
+
export declare function loadArtifactStorageConfig(config: Config): ArtifactStorageConfig;
|
|
44
|
+
export declare function createArtifactStorage(cfg: ArtifactStorageConfig): ArtifactStorage;
|