@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,911 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for the workflow execution engine.
|
|
3
|
+
*
|
|
4
|
+
* These types represent the serializable, plain-object form of a
|
|
5
|
+
* CNCF Serverless Workflow DSL 1.0.0 document. The loader converts
|
|
6
|
+
* CNCF SDK class instances into these types; the engine operates
|
|
7
|
+
* exclusively on them. No SDK class instances cross the serialization
|
|
8
|
+
* boundary into the Temporal workflow sandbox.
|
|
9
|
+
*
|
|
10
|
+
* The type system follows the CNCF spec structure but uses a
|
|
11
|
+
* discriminated union (`kind` field) for task types to enable
|
|
12
|
+
* exhaustive type checking in TypeScript.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { TaskStatusAccumulator } from "./task-status-accumulator.js";
|
|
16
|
+
|
|
17
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
18
|
+
// Workflow Model (top-level)
|
|
19
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
export interface WorkflowModel {
|
|
22
|
+
readonly document: WorkflowDocument;
|
|
23
|
+
readonly do: TaskList;
|
|
24
|
+
readonly input?: InputDef;
|
|
25
|
+
readonly output?: OutputDef;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WorkflowDocument {
|
|
29
|
+
readonly dsl: string;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly namespace?: string;
|
|
32
|
+
readonly version?: string;
|
|
33
|
+
readonly description?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
37
|
+
// Task List & Entries
|
|
38
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Ordered list of named tasks. Each entry maps a single task name
|
|
42
|
+
* to its definition — mirrors the CNCF `do:` array where each
|
|
43
|
+
* element is a `{ taskName: TaskDef }` object.
|
|
44
|
+
*/
|
|
45
|
+
export type TaskList = TaskEntry[];
|
|
46
|
+
|
|
47
|
+
export interface TaskEntry {
|
|
48
|
+
readonly key: string;
|
|
49
|
+
readonly task: TaskDef;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
53
|
+
// Task Base (shared by all task types)
|
|
54
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
55
|
+
|
|
56
|
+
export interface TaskBase {
|
|
57
|
+
readonly if?: string;
|
|
58
|
+
readonly input?: InputDef;
|
|
59
|
+
readonly output?: OutputDef;
|
|
60
|
+
readonly export?: ExportDef;
|
|
61
|
+
readonly then?: FlowDirective;
|
|
62
|
+
readonly metadata?: Record<string, unknown>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
66
|
+
// Task Definitions (discriminated union)
|
|
67
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
export type TaskDef =
|
|
70
|
+
| SetTaskDef
|
|
71
|
+
| SwitchTaskDef
|
|
72
|
+
| DoTaskDef
|
|
73
|
+
| ForTaskDef
|
|
74
|
+
| ForkTaskDef
|
|
75
|
+
| TryTaskDef
|
|
76
|
+
| WaitTaskDef
|
|
77
|
+
| ListenTaskDef
|
|
78
|
+
| HumanInputTaskDef
|
|
79
|
+
| RaiseTaskDef
|
|
80
|
+
| CallHttpTaskDef
|
|
81
|
+
| CallGrpcTaskDef
|
|
82
|
+
| CallAgentTaskDef
|
|
83
|
+
| CallFunctionTaskDef
|
|
84
|
+
| RunTaskDef;
|
|
85
|
+
|
|
86
|
+
export interface SetTaskDef extends TaskBase {
|
|
87
|
+
readonly kind: "set";
|
|
88
|
+
readonly set: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface SwitchTaskDef extends TaskBase {
|
|
92
|
+
readonly kind: "switch";
|
|
93
|
+
readonly switch: SwitchCase[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface DoTaskDef extends TaskBase {
|
|
97
|
+
readonly kind: "do";
|
|
98
|
+
readonly do: TaskList;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ForTaskDef extends TaskBase {
|
|
102
|
+
readonly kind: "for";
|
|
103
|
+
readonly for: ForConfig;
|
|
104
|
+
readonly while?: string;
|
|
105
|
+
readonly do: TaskList;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ForkTaskDef extends TaskBase {
|
|
109
|
+
readonly kind: "fork";
|
|
110
|
+
readonly fork: ForkConfig;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface TryTaskDef extends TaskBase {
|
|
114
|
+
readonly kind: "try";
|
|
115
|
+
readonly try: TaskList;
|
|
116
|
+
readonly catch: CatchConfig;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface WaitTaskDef extends TaskBase {
|
|
120
|
+
readonly kind: "wait";
|
|
121
|
+
readonly wait: DurationDef;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface ListenTaskDef extends TaskBase {
|
|
125
|
+
readonly kind: "listen";
|
|
126
|
+
readonly listen: ListenConfig;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface HumanInputTaskDef extends TaskBase {
|
|
130
|
+
readonly kind: "human_input";
|
|
131
|
+
readonly humanInput: HumanInputConfig;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface RaiseTaskDef extends TaskBase {
|
|
135
|
+
readonly kind: "raise";
|
|
136
|
+
readonly raise: RaiseConfig;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface CallHttpTaskDef extends TaskBase {
|
|
140
|
+
readonly kind: "call:http";
|
|
141
|
+
readonly call: "http";
|
|
142
|
+
readonly with: HttpCallConfig;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface CallGrpcTaskDef extends TaskBase {
|
|
146
|
+
readonly kind: "call:grpc";
|
|
147
|
+
readonly call: "grpc";
|
|
148
|
+
readonly with: GrpcCallConfig;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Agent call — invokes a Stigmer agent as a workflow task. Uses
|
|
153
|
+
* Temporal async completion: the activity creates an AgentExecution
|
|
154
|
+
* with a callback token, then the platform completes the activity
|
|
155
|
+
* when the agent finishes. Separate from generic call:function
|
|
156
|
+
* because it requires workflow-side signal handling for HITL.
|
|
157
|
+
*/
|
|
158
|
+
export interface CallAgentTaskDef extends TaskBase {
|
|
159
|
+
readonly kind: "call:agent";
|
|
160
|
+
readonly call: "agent";
|
|
161
|
+
readonly with: AgentCallConfig;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Custom call function — covers Stigmer extensions:
|
|
166
|
+
* call: llm | transform | validate | human_input |
|
|
167
|
+
* emit_event | notification | eval | activity
|
|
168
|
+
*/
|
|
169
|
+
export interface CallFunctionTaskDef extends TaskBase {
|
|
170
|
+
readonly kind: "call:function";
|
|
171
|
+
readonly call: string;
|
|
172
|
+
readonly with?: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface RunTaskDef extends TaskBase {
|
|
176
|
+
readonly kind: "run";
|
|
177
|
+
readonly run: RunConfig;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
181
|
+
// Switch
|
|
182
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
183
|
+
|
|
184
|
+
export interface SwitchCase {
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly when?: string;
|
|
187
|
+
readonly then: FlowDirective;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
191
|
+
// Flow Directives
|
|
192
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Flow control directive on a task's `then` field.
|
|
196
|
+
* - "continue" — proceed to next task (default)
|
|
197
|
+
* - "end" or "exit" — terminate the workflow
|
|
198
|
+
* - any other string — jump to the named task
|
|
199
|
+
*/
|
|
200
|
+
export type FlowDirective = string;
|
|
201
|
+
|
|
202
|
+
export const FLOW_CONTINUE = "continue";
|
|
203
|
+
export const FLOW_END = "end";
|
|
204
|
+
export const FLOW_EXIT = "exit";
|
|
205
|
+
|
|
206
|
+
export function isTermination(directive: FlowDirective): boolean {
|
|
207
|
+
return directive === FLOW_END || directive === FLOW_EXIT;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function isExplicitTarget(directive: FlowDirective): boolean {
|
|
211
|
+
return (
|
|
212
|
+
directive !== FLOW_CONTINUE &&
|
|
213
|
+
directive !== FLOW_END &&
|
|
214
|
+
directive !== FLOW_EXIT
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
219
|
+
// Input / Output / Export
|
|
220
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
export interface InputDef {
|
|
223
|
+
readonly from?: string | Record<string, unknown>;
|
|
224
|
+
readonly schema?: Record<string, unknown>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface OutputDef {
|
|
228
|
+
readonly as?: string | Record<string, unknown>;
|
|
229
|
+
readonly schema?: Record<string, unknown>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface ExportDef {
|
|
233
|
+
readonly as?: string | Record<string, unknown>;
|
|
234
|
+
readonly schema?: Record<string, unknown>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
238
|
+
// For / Fork / Try-Catch
|
|
239
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
240
|
+
|
|
241
|
+
export interface ForConfig {
|
|
242
|
+
readonly each?: string;
|
|
243
|
+
readonly in: string;
|
|
244
|
+
readonly at?: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface ForkConfig {
|
|
248
|
+
readonly branches: TaskList;
|
|
249
|
+
readonly compete?: boolean;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface CatchConfig {
|
|
253
|
+
readonly errors?: CatchErrors;
|
|
254
|
+
readonly as?: string;
|
|
255
|
+
readonly when?: string;
|
|
256
|
+
readonly do?: TaskList;
|
|
257
|
+
readonly retry?: RetryConfig;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface CatchErrors {
|
|
261
|
+
readonly with?: Record<string, unknown>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface RetryConfig {
|
|
265
|
+
readonly when?: string;
|
|
266
|
+
readonly exceptWhen?: string;
|
|
267
|
+
readonly limit?: RetryLimit;
|
|
268
|
+
readonly backoff?: BackoffConfig;
|
|
269
|
+
readonly jitter?: JitterConfig;
|
|
270
|
+
readonly delay?: DurationDef;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface RetryLimit {
|
|
274
|
+
readonly attempt?: { readonly count: number };
|
|
275
|
+
readonly duration?: DurationDef;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface BackoffConfig {
|
|
279
|
+
readonly exponential?: Record<string, unknown>;
|
|
280
|
+
readonly linear?: Record<string, unknown>;
|
|
281
|
+
readonly constant?: Record<string, unknown>;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface JitterConfig {
|
|
285
|
+
readonly from?: DurationDef;
|
|
286
|
+
readonly to?: DurationDef;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
290
|
+
// Wait / Listen / Raise / Run
|
|
291
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
292
|
+
|
|
293
|
+
export interface DurationDef {
|
|
294
|
+
readonly days?: number;
|
|
295
|
+
readonly hours?: number;
|
|
296
|
+
readonly minutes?: number;
|
|
297
|
+
readonly seconds?: number;
|
|
298
|
+
readonly milliseconds?: number;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface ListenConfig {
|
|
302
|
+
readonly to: EventConsumptionConfig;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface EventConsumptionConfig {
|
|
306
|
+
readonly any?: EventFilter[];
|
|
307
|
+
readonly all?: EventFilter[];
|
|
308
|
+
readonly one?: EventFilter;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface EventFilter {
|
|
312
|
+
readonly with?: Record<string, unknown>;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface RaiseConfig {
|
|
316
|
+
readonly error: ErrorDef;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface ErrorDef {
|
|
320
|
+
readonly type: string;
|
|
321
|
+
readonly status: number;
|
|
322
|
+
readonly title?: string;
|
|
323
|
+
readonly detail?: string;
|
|
324
|
+
readonly instance?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
328
|
+
// HTTP / gRPC Call Configs
|
|
329
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
330
|
+
|
|
331
|
+
export interface HttpCallConfig {
|
|
332
|
+
readonly method: string;
|
|
333
|
+
readonly endpoint: EndpointDef;
|
|
334
|
+
readonly headers?: Record<string, string>;
|
|
335
|
+
readonly body?: unknown;
|
|
336
|
+
readonly query?: Record<string, string>;
|
|
337
|
+
readonly output?: string;
|
|
338
|
+
readonly redirect?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export type EndpointDef = string | { readonly uri: string; readonly authentication?: Record<string, unknown> };
|
|
342
|
+
|
|
343
|
+
export interface GrpcCallConfig {
|
|
344
|
+
readonly proto: string;
|
|
345
|
+
readonly service: { readonly name: string; readonly host: string; readonly port?: number };
|
|
346
|
+
readonly method: string;
|
|
347
|
+
readonly arguments?: Record<string, unknown>;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
351
|
+
// Run Config
|
|
352
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
353
|
+
|
|
354
|
+
export interface RunConfig {
|
|
355
|
+
readonly shell?: ShellRunConfig;
|
|
356
|
+
readonly script?: ScriptRunConfig;
|
|
357
|
+
readonly workflow?: WorkflowRunConfig;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface ShellRunConfig {
|
|
361
|
+
readonly command: string;
|
|
362
|
+
readonly arguments?: Record<string, string>;
|
|
363
|
+
readonly environment?: Record<string, string>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface ScriptRunConfig {
|
|
367
|
+
readonly language: string;
|
|
368
|
+
readonly code?: string;
|
|
369
|
+
readonly source?: { readonly endpoint: EndpointDef };
|
|
370
|
+
readonly arguments?: Record<string, unknown>;
|
|
371
|
+
readonly environment?: Record<string, string>;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export interface WorkflowRunConfig {
|
|
375
|
+
readonly namespace: string;
|
|
376
|
+
readonly name: string;
|
|
377
|
+
readonly version: string;
|
|
378
|
+
readonly input?: unknown;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
382
|
+
// Task Builder Contract
|
|
383
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* The function a task builder produces. Called by the DoTask executor
|
|
387
|
+
* to run a single task. Receives the current input and state, returns
|
|
388
|
+
* the task's output (which may be undefined for control-flow tasks).
|
|
389
|
+
*
|
|
390
|
+
* For tasks that need expression evaluation (set, switch, if-guards),
|
|
391
|
+
* the executor provides an `evaluateExpressions` callback that batches
|
|
392
|
+
* jq evaluation into a local activity call.
|
|
393
|
+
*/
|
|
394
|
+
export type TaskExecutorFn = (
|
|
395
|
+
input: unknown,
|
|
396
|
+
state: WorkflowState,
|
|
397
|
+
ctx: TaskExecutionContext,
|
|
398
|
+
) => unknown | Promise<unknown>;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Runtime context passed to task executors. Provides access to
|
|
402
|
+
* expression evaluation, the workflow document, and external call
|
|
403
|
+
* capabilities without coupling task implementations to Temporal APIs.
|
|
404
|
+
*
|
|
405
|
+
* Call callbacks (`callHttp`, `callGrpc`, `callFunction`) are wired
|
|
406
|
+
* to Temporal `proxyActivities` in the workflow function. The kernel
|
|
407
|
+
* invokes them as opaque callbacks — it never imports Temporal APIs.
|
|
408
|
+
*/
|
|
409
|
+
export interface TaskExecutionContext {
|
|
410
|
+
readonly evaluateExpressions: ExpressionEvaluator;
|
|
411
|
+
readonly doc: WorkflowModel;
|
|
412
|
+
readonly sleep: SleepFn;
|
|
413
|
+
readonly listen: ListenFn;
|
|
414
|
+
readonly runCommand: RunCommandFn;
|
|
415
|
+
readonly runWorkflow: RunWorkflowFn;
|
|
416
|
+
readonly awaitHumanInput: AwaitHumanInputFn;
|
|
417
|
+
readonly callHttp: CallHttpFn;
|
|
418
|
+
readonly callGrpc: CallGrpcFn;
|
|
419
|
+
readonly callFunction: CallFunctionFn;
|
|
420
|
+
readonly callAgent: CallAgentFn;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Promote a large task output to the Artifact store (T07). When the
|
|
424
|
+
* serialized output exceeds 256KB, the activity calls
|
|
425
|
+
* ArtifactCommandController.create() and returns an artifact reference.
|
|
426
|
+
* Returns the original output unchanged if below threshold.
|
|
427
|
+
*/
|
|
428
|
+
readonly promoteTaskOutput?: PromoteTaskOutputFn;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Emit workflow execution events to the server. Events are sent as
|
|
432
|
+
* a batch via a local activity call to `updateWorkflowExecutionStatus`.
|
|
433
|
+
* Best-effort — failures are logged but do not block the workflow.
|
|
434
|
+
*
|
|
435
|
+
* Accepts plain event descriptors (no proto imports needed in the
|
|
436
|
+
* sandbox). The activity converts them to `WorkflowExecutionEvent`
|
|
437
|
+
* proto objects before sending.
|
|
438
|
+
*/
|
|
439
|
+
readonly emitEvents?: EmitEventsFn;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Optional pause yield point. When provided, the engine calls this
|
|
443
|
+
* between tasks, between for-each iterations, and between try
|
|
444
|
+
* retries. If the workflow is paused (via Temporal signal), this
|
|
445
|
+
* callback blocks until resumed. If not paused, returns immediately.
|
|
446
|
+
*
|
|
447
|
+
* The engine has no knowledge of Temporal signals — it simply awaits
|
|
448
|
+
* this opaque callback at well-defined yield points.
|
|
449
|
+
*/
|
|
450
|
+
readonly checkPause?: () => Promise<void>;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Accumulates per-task status entries throughout the workflow run.
|
|
454
|
+
* Passed to the emit activity on every event batch so the server
|
|
455
|
+
* receives a complete snapshot of task statuses with each update.
|
|
456
|
+
*/
|
|
457
|
+
readonly taskStatusAccumulator?: TaskStatusAccumulator;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Set by try.ts when the current execution is inside a try block
|
|
461
|
+
* with catch.retry configured. Allows the do-executor to emit
|
|
462
|
+
* accurate `willRetry` on task_failed events.
|
|
463
|
+
*/
|
|
464
|
+
readonly retryContext?: RetryContextInfo;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Communicates retry intent from a try/catch block to the do-executor
|
|
469
|
+
* so task_failed events can report `willRetry` accurately.
|
|
470
|
+
*/
|
|
471
|
+
export interface RetryContextInfo {
|
|
472
|
+
/** Total attempts allowed (first attempt + retry count). Infinity when only duration-limited. */
|
|
473
|
+
readonly maxAttempts: number;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Pauses workflow execution for the specified duration in milliseconds.
|
|
478
|
+
* Wired to Temporal's `sleep()` in the workflow function. Returns
|
|
479
|
+
* undefined when the timer completes or the workflow is cancelled.
|
|
480
|
+
*/
|
|
481
|
+
export type SleepFn = (durationMs: number) => Promise<void>;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Waits for external events (signals) to arrive at the workflow.
|
|
485
|
+
* Wired to the listen-orchestrator which registers Temporal signal
|
|
486
|
+
* channels and blocks until the consumption strategy is satisfied
|
|
487
|
+
* (one/all/any). Returns the received signal payload(s).
|
|
488
|
+
*/
|
|
489
|
+
export type ListenFn = (config: ListenExecutionConfig) => Promise<unknown>;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Normalized listen configuration passed to the workflow-layer
|
|
493
|
+
* orchestrator. The kernel validates and normalizes the raw
|
|
494
|
+
* ListenConfig before invoking this callback.
|
|
495
|
+
*/
|
|
496
|
+
export interface ListenExecutionConfig {
|
|
497
|
+
readonly events: ListenEventDef[];
|
|
498
|
+
readonly mode: "all" | "any";
|
|
499
|
+
readonly timeoutMs: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export interface ListenEventDef {
|
|
503
|
+
readonly id: string;
|
|
504
|
+
readonly type: string;
|
|
505
|
+
readonly acceptIf?: string;
|
|
506
|
+
/** Reply template for query/update handlers — evaluated against state */
|
|
507
|
+
readonly data?: unknown;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Executes a script or shell command via a Temporal activity.
|
|
512
|
+
* The activity writes inline code to a temp file and executes it,
|
|
513
|
+
* or runs a shell command directly. Returns stdout as a string.
|
|
514
|
+
*/
|
|
515
|
+
export type RunCommandFn = (config: RunCommandConfig) => Promise<unknown>;
|
|
516
|
+
|
|
517
|
+
export interface RunCommandConfig {
|
|
518
|
+
readonly mode: "script" | "shell";
|
|
519
|
+
readonly language?: string;
|
|
520
|
+
readonly code?: string;
|
|
521
|
+
readonly command?: string;
|
|
522
|
+
readonly arguments?: unknown;
|
|
523
|
+
readonly environment?: Record<string, string>;
|
|
524
|
+
readonly runtimeEnv: Record<string, unknown>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Executes a child Temporal workflow. When `await` is true, blocks
|
|
529
|
+
* until the child completes and returns its result. When false,
|
|
530
|
+
* fires and forgets (returns undefined immediately).
|
|
531
|
+
*/
|
|
532
|
+
export type RunWorkflowFn = (config: RunWorkflowExecutionConfig) => Promise<unknown>;
|
|
533
|
+
|
|
534
|
+
export interface RunWorkflowExecutionConfig {
|
|
535
|
+
readonly name: string;
|
|
536
|
+
readonly input?: unknown;
|
|
537
|
+
readonly await: boolean;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Blocks workflow execution until a human provides input via signal.
|
|
542
|
+
* Supports configurable timeout with policies (fail, approve, deny).
|
|
543
|
+
*/
|
|
544
|
+
export type AwaitHumanInputFn = (config: HumanInputExecutionConfig) => Promise<HumanInputResult>;
|
|
545
|
+
|
|
546
|
+
export interface HumanInputExecutionConfig {
|
|
547
|
+
readonly signalName: string;
|
|
548
|
+
readonly timeoutSeconds: number;
|
|
549
|
+
readonly onTimeout: "fail" | "approve" | "deny";
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface HumanInputResult {
|
|
553
|
+
readonly outcome: string;
|
|
554
|
+
readonly reviewer?: string;
|
|
555
|
+
readonly responded_at?: string;
|
|
556
|
+
readonly form_data?: Record<string, unknown>;
|
|
557
|
+
readonly auto_resolved?: boolean;
|
|
558
|
+
readonly reason?: string;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface HumanInputConfig {
|
|
562
|
+
readonly prompt: string;
|
|
563
|
+
readonly outcomes?: HumanInputOutcome[];
|
|
564
|
+
readonly formSchema?: Record<string, unknown>;
|
|
565
|
+
readonly approvers?: readonly string[];
|
|
566
|
+
readonly timeout?: number;
|
|
567
|
+
readonly onTimeout?: "fail" | "approve" | "deny";
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export interface HumanInputOutcome {
|
|
571
|
+
readonly name: string;
|
|
572
|
+
readonly label?: string;
|
|
573
|
+
readonly then?: string;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Executes an HTTP call as a Temporal activity. Receives the
|
|
578
|
+
* expression-evaluated config and the runtime environment for
|
|
579
|
+
* just-in-time secret resolution in the activity.
|
|
580
|
+
*/
|
|
581
|
+
export type CallHttpFn = (
|
|
582
|
+
config: HttpCallConfig,
|
|
583
|
+
runtimeEnv: Record<string, unknown>,
|
|
584
|
+
) => Promise<unknown>;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Executes a gRPC call as a Temporal activity. Receives the
|
|
588
|
+
* expression-evaluated config and the runtime environment.
|
|
589
|
+
*/
|
|
590
|
+
export type CallGrpcFn = (
|
|
591
|
+
config: GrpcCallConfig,
|
|
592
|
+
runtimeEnv: Record<string, unknown>,
|
|
593
|
+
) => Promise<unknown>;
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Executes a custom function call (llm, agent, etc.) as a Temporal
|
|
597
|
+
* activity. The `call` string identifies the function type; the
|
|
598
|
+
* activity dispatches internally based on this value.
|
|
599
|
+
*/
|
|
600
|
+
export type CallFunctionFn = (
|
|
601
|
+
call: string,
|
|
602
|
+
config: Record<string, unknown>,
|
|
603
|
+
runtimeEnv: Record<string, unknown>,
|
|
604
|
+
metadata: CallFunctionMetadata,
|
|
605
|
+
) => Promise<unknown>;
|
|
606
|
+
|
|
607
|
+
export interface CallFunctionMetadata {
|
|
608
|
+
readonly workflowExecutionId?: string;
|
|
609
|
+
readonly parentWorkflowId?: string;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Batch expression evaluator. Takes a map of expression keys to
|
|
614
|
+
* jq expression strings, evaluates them against the provided input
|
|
615
|
+
* and state variables, and returns a matching map of results.
|
|
616
|
+
*
|
|
617
|
+
* This runs as a local activity (outside the workflow sandbox)
|
|
618
|
+
* using jq-wasm. The results are recorded in workflow history
|
|
619
|
+
* for deterministic replay.
|
|
620
|
+
*/
|
|
621
|
+
export type ExpressionEvaluator = (
|
|
622
|
+
expressions: Record<string, string>,
|
|
623
|
+
input: unknown,
|
|
624
|
+
stateVars: Record<string, unknown>,
|
|
625
|
+
) => Promise<Record<string, unknown>>;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Contract for task builders. Each task type implements this to
|
|
629
|
+
* produce a TaskExecutorFn from its definition.
|
|
630
|
+
*/
|
|
631
|
+
export interface TaskBuilder {
|
|
632
|
+
readonly taskName: string;
|
|
633
|
+
readonly taskDef: TaskDef;
|
|
634
|
+
build(): TaskExecutorFn;
|
|
635
|
+
shouldRun(state: WorkflowState): Promise<boolean>;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
639
|
+
// Agent Call Types
|
|
640
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Invokes a Stigmer agent as an async-completion Temporal activity.
|
|
644
|
+
* The activity creates a Session + AgentExecution with a callback
|
|
645
|
+
* token. The platform completes the activity when the agent finishes.
|
|
646
|
+
* While pending, the workflow listens for HITL approval signals.
|
|
647
|
+
*/
|
|
648
|
+
export type CallAgentFn = (
|
|
649
|
+
config: AgentCallConfig,
|
|
650
|
+
runtimeEnv: Record<string, unknown>,
|
|
651
|
+
metadata: CallAgentMetadata,
|
|
652
|
+
) => Promise<AgentCallResult>;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Agent call configuration — mirrors the proto `AgentCallTaskConfig`.
|
|
656
|
+
* Parsed from the YAML `with:` block of a `call: agent` task.
|
|
657
|
+
*/
|
|
658
|
+
export interface AgentCallConfig {
|
|
659
|
+
readonly agent: string;
|
|
660
|
+
readonly message: string;
|
|
661
|
+
readonly org?: string;
|
|
662
|
+
readonly env?: Record<string, string>;
|
|
663
|
+
readonly config?: AgentExecutionCallConfig;
|
|
664
|
+
readonly output?: AgentCallOutputContract;
|
|
665
|
+
readonly harness?: string;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
export interface AgentExecutionCallConfig {
|
|
669
|
+
readonly model?: string;
|
|
670
|
+
readonly timeout?: number;
|
|
671
|
+
readonly temperature?: number;
|
|
672
|
+
readonly max_cost_micros?: number;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export interface AgentCallOutputContract {
|
|
676
|
+
readonly schema: Record<string, unknown>;
|
|
677
|
+
readonly on_invalid?: "ON_INVALID_FAIL" | "ON_INVALID_RETRY" | "ON_INVALID_FALLBACK";
|
|
678
|
+
readonly max_retries?: number;
|
|
679
|
+
readonly fallback_task?: string;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface CallAgentMetadata {
|
|
683
|
+
readonly parentWorkflowId: string;
|
|
684
|
+
readonly taskName: string;
|
|
685
|
+
readonly workflowExecutionId: string;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
export interface AgentCallResult {
|
|
689
|
+
readonly structured?: unknown;
|
|
690
|
+
readonly final_text?: string;
|
|
691
|
+
readonly agent_execution_id?: string;
|
|
692
|
+
readonly usage_summary?: AgentUsageSummary;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface AgentUsageSummary {
|
|
696
|
+
readonly total_tokens?: number;
|
|
697
|
+
readonly estimated_cost_usd?: number;
|
|
698
|
+
readonly tool_call_count?: number;
|
|
699
|
+
readonly artifact_count?: number;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
703
|
+
// Workflow Execution Event Descriptors
|
|
704
|
+
//
|
|
705
|
+
// Plain-object event descriptors that can be constructed inside the
|
|
706
|
+
// Temporal deterministic sandbox (no proto imports, no I/O). The
|
|
707
|
+
// emit activity converts these to WorkflowExecutionEvent proto
|
|
708
|
+
// objects before sending to the server.
|
|
709
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
710
|
+
|
|
711
|
+
export type WorkflowEventDescriptor =
|
|
712
|
+
| ExecutionStartedEvent
|
|
713
|
+
| ExecutionCompletedEvent
|
|
714
|
+
| ExecutionFailedEvent
|
|
715
|
+
| TaskStartedEvent
|
|
716
|
+
| TaskCompletedEvent
|
|
717
|
+
| TaskFailedEvent
|
|
718
|
+
| TaskSkippedEvent
|
|
719
|
+
| TaskRetryingEvent
|
|
720
|
+
| ApprovalRequestedEvent
|
|
721
|
+
| ApprovalResolvedEvent
|
|
722
|
+
| AgentCallStartedEvent
|
|
723
|
+
| AgentCallProgressEvent
|
|
724
|
+
| AgentCallCompletedEvent
|
|
725
|
+
| ArtifactCreatedEvent;
|
|
726
|
+
|
|
727
|
+
interface EventBase {
|
|
728
|
+
readonly taskName?: string;
|
|
729
|
+
readonly occurredAt: string;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
export interface ExecutionStartedEvent extends EventBase {
|
|
733
|
+
readonly type: "execution_started";
|
|
734
|
+
readonly totalTasks: number;
|
|
735
|
+
readonly workflowId: string;
|
|
736
|
+
readonly workflowInstanceId: string;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export interface ExecutionCompletedEvent extends EventBase {
|
|
740
|
+
readonly type: "execution_completed";
|
|
741
|
+
readonly durationMs: number;
|
|
742
|
+
readonly totalCostMicros: number;
|
|
743
|
+
readonly totalTokens: number;
|
|
744
|
+
readonly totalInputTokens?: number;
|
|
745
|
+
readonly totalOutputTokens?: number;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export interface ExecutionFailedEvent extends EventBase {
|
|
749
|
+
readonly type: "execution_failed";
|
|
750
|
+
readonly error: string;
|
|
751
|
+
readonly failedTaskName: string;
|
|
752
|
+
readonly durationMs: number;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
export interface TaskStartedEvent extends EventBase {
|
|
756
|
+
readonly type: "task_started";
|
|
757
|
+
readonly taskKind: string;
|
|
758
|
+
readonly attemptNumber: number;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export interface TaskCompletedEvent extends EventBase {
|
|
762
|
+
readonly type: "task_completed";
|
|
763
|
+
readonly taskKind: string;
|
|
764
|
+
readonly durationMs: number;
|
|
765
|
+
readonly costMicros: number;
|
|
766
|
+
readonly tokensUsed: number;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
export interface TaskFailedEvent extends EventBase {
|
|
770
|
+
readonly type: "task_failed";
|
|
771
|
+
readonly taskKind: string;
|
|
772
|
+
readonly error: string;
|
|
773
|
+
readonly attemptNumber: number;
|
|
774
|
+
readonly willRetry: boolean;
|
|
775
|
+
readonly durationMs: number;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
export interface TaskSkippedEvent extends EventBase {
|
|
779
|
+
readonly type: "task_skipped";
|
|
780
|
+
readonly taskKind: string;
|
|
781
|
+
readonly reason: string;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export interface TaskRetryingEvent extends EventBase {
|
|
785
|
+
readonly type: "task_retrying";
|
|
786
|
+
readonly failedAttempt: number;
|
|
787
|
+
readonly nextAttempt: number;
|
|
788
|
+
readonly delayMs: number;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export interface ApprovalRequestedEvent extends EventBase {
|
|
792
|
+
readonly type: "approval_requested";
|
|
793
|
+
readonly prompt: string;
|
|
794
|
+
readonly approvers: readonly string[];
|
|
795
|
+
readonly timeoutSeconds: number;
|
|
796
|
+
readonly outcomes: ReadonlyArray<{ name: string; label: string }>;
|
|
797
|
+
readonly formSchema?: Record<string, unknown>;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export interface ApprovalResolvedEvent extends EventBase {
|
|
801
|
+
readonly type: "approval_resolved";
|
|
802
|
+
readonly outcome: string;
|
|
803
|
+
readonly resolvedBy: string;
|
|
804
|
+
readonly comment: string;
|
|
805
|
+
readonly waitDurationMs: number;
|
|
806
|
+
readonly autoResolved: boolean;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export interface AgentCallStartedEvent extends EventBase {
|
|
810
|
+
readonly type: "agent_call_started";
|
|
811
|
+
readonly childExecutionId: string;
|
|
812
|
+
readonly agentSlug: string;
|
|
813
|
+
readonly messageSummary: string;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
export interface AgentCallProgressEvent extends EventBase {
|
|
817
|
+
readonly type: "agent_call_progress";
|
|
818
|
+
readonly childExecutionId: string;
|
|
819
|
+
readonly agentSlug: string;
|
|
820
|
+
readonly agentPhase: number;
|
|
821
|
+
readonly currentToolName: string;
|
|
822
|
+
readonly tokensConsumed: number;
|
|
823
|
+
readonly messagesCount: number;
|
|
824
|
+
readonly toolCallsCount: number;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export interface AgentCallCompletedEvent extends EventBase {
|
|
828
|
+
readonly type: "agent_call_completed";
|
|
829
|
+
readonly childExecutionId: string;
|
|
830
|
+
readonly durationMs: number;
|
|
831
|
+
readonly tokensConsumed: number;
|
|
832
|
+
readonly costMicros: number;
|
|
833
|
+
readonly error: string;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export interface ArtifactCreatedEvent extends EventBase {
|
|
837
|
+
readonly type: "artifact_created";
|
|
838
|
+
readonly artifactId: string;
|
|
839
|
+
readonly displayName: string;
|
|
840
|
+
readonly contentType: string;
|
|
841
|
+
readonly sizeBytes: number;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
export type EmitEventsFn = (events: WorkflowEventDescriptor[]) => Promise<void>;
|
|
845
|
+
|
|
846
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
847
|
+
// Error types
|
|
848
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Typed error for agent call failures that preserves the child
|
|
852
|
+
* AgentExecution ID across the error propagation chain.
|
|
853
|
+
*
|
|
854
|
+
* The orchestrator throws this when the CallAgent activity fails,
|
|
855
|
+
* carrying the child execution ID that was captured via the
|
|
856
|
+
* `child_execution_started` signal. Downstream consumers
|
|
857
|
+
* (CallAgentTaskBuilder, do-executor) extract the ID to:
|
|
858
|
+
* - Emit `agent_call_completed` events with the correct child ref
|
|
859
|
+
* - Set task metadata so the execution inspector can link to it
|
|
860
|
+
*/
|
|
861
|
+
export class AgentCallError extends Error {
|
|
862
|
+
readonly childExecutionId: string;
|
|
863
|
+
|
|
864
|
+
constructor(message: string, childExecutionId: string) {
|
|
865
|
+
super(message);
|
|
866
|
+
this.name = "AgentCallError";
|
|
867
|
+
this.childExecutionId = childExecutionId;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
export interface PromoteTaskOutputResult {
|
|
872
|
+
output: unknown;
|
|
873
|
+
artifactIds: string[];
|
|
874
|
+
artifactCreatedEvents: Array<{
|
|
875
|
+
type: "artifact_created";
|
|
876
|
+
artifactId: string;
|
|
877
|
+
displayName: string;
|
|
878
|
+
contentType: string;
|
|
879
|
+
sizeBytes: number;
|
|
880
|
+
occurredAt: string;
|
|
881
|
+
}>;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
export type PromoteTaskOutputFn = (
|
|
885
|
+
taskOutput: unknown,
|
|
886
|
+
workflowExecutionId: string,
|
|
887
|
+
taskName: string,
|
|
888
|
+
) => Promise<PromoteTaskOutputResult>;
|
|
889
|
+
|
|
890
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
891
|
+
// WorkflowState (forward declaration — implemented in state.ts)
|
|
892
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* Workflow execution state. Carried through the task chain and
|
|
896
|
+
* provides the jq variable bindings ($context, $data, $env, etc.).
|
|
897
|
+
*
|
|
898
|
+
* Defined here as an interface for use in type signatures.
|
|
899
|
+
* The concrete implementation lives in state.ts.
|
|
900
|
+
*/
|
|
901
|
+
export interface WorkflowState {
|
|
902
|
+
context: unknown;
|
|
903
|
+
data: Record<string, unknown>;
|
|
904
|
+
env: Record<string, unknown>;
|
|
905
|
+
input: unknown;
|
|
906
|
+
output: unknown;
|
|
907
|
+
addData(data: Record<string, unknown>): void;
|
|
908
|
+
getAsMap(): Record<string, unknown>;
|
|
909
|
+
clone(): WorkflowState;
|
|
910
|
+
clearOutput(): void;
|
|
911
|
+
}
|