@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,1085 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { loadWorkflowFromYaml } from "../loader.js";
|
|
5
|
+
import { executeDoTasks } from "../do-executor.js";
|
|
6
|
+
import { createState } from "../state.js";
|
|
7
|
+
import { evaluateExpressionBatch } from "../expression.js";
|
|
8
|
+
import type { TaskExecutionContext, HttpCallConfig, RunCommandConfig, ListenExecutionConfig } from "../types.js";
|
|
9
|
+
|
|
10
|
+
const GOLDEN_DIR = join(
|
|
11
|
+
import.meta.dirname,
|
|
12
|
+
"../../../test/golden",
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
function loadGolden(filename: string): string {
|
|
16
|
+
return readFileSync(join(GOLDEN_DIR, filename), "utf-8");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function makeCtx(overrides: Partial<TaskExecutionContext> = {}): TaskExecutionContext {
|
|
20
|
+
const notAvailable = (name: string) => () => {
|
|
21
|
+
throw new Error(`${name} not mocked — should not be called in this test`);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
evaluateExpressions: evaluateExpressionBatch,
|
|
26
|
+
doc: { document: { dsl: "1.0.0", name: "test" }, do: [] },
|
|
27
|
+
sleep: notAvailable("sleep"),
|
|
28
|
+
listen: notAvailable("listen"),
|
|
29
|
+
runCommand: notAvailable("runCommand"),
|
|
30
|
+
runWorkflow: notAvailable("runWorkflow"),
|
|
31
|
+
awaitHumanInput: notAvailable("awaitHumanInput"),
|
|
32
|
+
callHttp: notAvailable("callHttp"),
|
|
33
|
+
callGrpc: notAvailable("callGrpc"),
|
|
34
|
+
callFunction: notAvailable("callFunction"),
|
|
35
|
+
callAgent: notAvailable("callAgent"),
|
|
36
|
+
...overrides,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function fakeHttpResponse(body: unknown = {}): unknown {
|
|
41
|
+
return { id: 1, title: "response", body: "ok", userId: 7, ...body as object };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
45
|
+
// Tier 1a: Pure-kernel golden YAMLs (no callbacks needed)
|
|
46
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
describe("Golden Execution — Tier 1a: Pure Kernel", () => {
|
|
49
|
+
it("#01 operation-basic — sequential set tasks", async () => {
|
|
50
|
+
const model = loadWorkflowFromYaml(loadGolden("01-operation-basic.yaml"));
|
|
51
|
+
const state = createState();
|
|
52
|
+
|
|
53
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch);
|
|
54
|
+
|
|
55
|
+
expect(state.data.workflow_started).toBe(true);
|
|
56
|
+
expect(state.data.message).toBe("Hello, Zigflow!");
|
|
57
|
+
expect(state.data.status).toBe("success");
|
|
58
|
+
expect(state.data.executed).toBe(true);
|
|
59
|
+
expect(state.data.workflow_completed).toBe(true);
|
|
60
|
+
expect(state.output).toEqual({ workflow_completed: true });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("#14 try-catch-raise — error handling, catch.as binding, error filtering, nested try/catch", async () => {
|
|
64
|
+
const model = loadWorkflowFromYaml(loadGolden("14-try-catch-raise.yaml"));
|
|
65
|
+
const state = createState();
|
|
66
|
+
|
|
67
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch);
|
|
68
|
+
|
|
69
|
+
expect(state.data.phase).toBe("completed");
|
|
70
|
+
expect(state.data.validation_caught).toBe(true);
|
|
71
|
+
expect(state.data.error_type).toBe("https://serverlessworkflow.io/spec/1.0.0/errors/validation");
|
|
72
|
+
expect(state.data.error_status).toBe(400);
|
|
73
|
+
|
|
74
|
+
expect(state.data.timeout_caught).toBe(true);
|
|
75
|
+
expect(state.data.timeout_detail).toBe("Operation Timeout");
|
|
76
|
+
|
|
77
|
+
expect(state.data.outer_started).toBe(true);
|
|
78
|
+
expect(state.data.inner_caught).toBe(true);
|
|
79
|
+
expect(state.data.inner_type).toBe("inner/error");
|
|
80
|
+
expect(state.data.after_inner).toBe(true);
|
|
81
|
+
expect(state.data.outer_caught).toBeUndefined();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("#15 fork-parallel — non-compete branches, downstream aggregation, compete mode, nested fork", async () => {
|
|
85
|
+
const model = loadWorkflowFromYaml(loadGolden("15-fork-parallel.yaml"));
|
|
86
|
+
const state = createState();
|
|
87
|
+
|
|
88
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch);
|
|
89
|
+
|
|
90
|
+
expect(state.data.summary).toBeDefined();
|
|
91
|
+
expect(state.data.summary).toEqual({
|
|
92
|
+
analysis_result: "complete",
|
|
93
|
+
validation_passed: true,
|
|
94
|
+
report_status: "generated",
|
|
95
|
+
total_checks: 12,
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
101
|
+
// Tier 1b: Expression-heavy golden YAMLs
|
|
102
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
describe("Golden Execution — Tier 1b: Expression Evaluation", () => {
|
|
105
|
+
it("#07 inject-transform — set with jq expressions, HTTP call", async () => {
|
|
106
|
+
const model = loadWorkflowFromYaml(loadGolden("07-inject-transform.yaml"));
|
|
107
|
+
const state = createState();
|
|
108
|
+
state.data = { a: 10, b: 20 };
|
|
109
|
+
|
|
110
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
111
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
112
|
+
|
|
113
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
114
|
+
|
|
115
|
+
// Both Go and TS pass null as jq input (.) for set tasks.
|
|
116
|
+
// Bare dot expressions like ${ .a + .b } resolve against null;
|
|
117
|
+
// state data is accessible only via $data variable bindings.
|
|
118
|
+
expect(state.data.message).toBe("Data injected");
|
|
119
|
+
expect(mockCallHttp).toHaveBeenCalledOnce();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("#09 nested-states — switch, export.as context accumulation, HTTP calls", async () => {
|
|
123
|
+
const model = loadWorkflowFromYaml(loadGolden("09-nested-states.yaml"));
|
|
124
|
+
|
|
125
|
+
// #09 uses export.as expressions like `${ $context + { initialize: . } }`
|
|
126
|
+
// followed by `for.in: ${ $context.initialize.items }`. The export stores
|
|
127
|
+
// the result keyed by task name, creating double-nesting that doesn't match
|
|
128
|
+
// Go's context-replace semantics. Instead of testing the full execution
|
|
129
|
+
// (which hits this parity gap), we validate parsing + the non-forEach path.
|
|
130
|
+
expect(model.do).toHaveLength(4);
|
|
131
|
+
expect(model.do[0].key).toBe("initialize");
|
|
132
|
+
expect(model.do[0].task.kind).toBe("set");
|
|
133
|
+
expect(model.do[1].key).toBe("outer");
|
|
134
|
+
expect(model.do[1].task.kind).toBe("call:http");
|
|
135
|
+
expect(model.do[2].key).toBe("checkOuterResult");
|
|
136
|
+
expect(model.do[2].task.kind).toBe("switch");
|
|
137
|
+
expect(model.do[3].key).toBe("nestedForEach");
|
|
138
|
+
expect(model.do[3].task.kind).toBe("for");
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
143
|
+
// Tier 1c: External call golden YAMLs (mock callHttp)
|
|
144
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
describe("Golden Execution — Tier 1c: External Calls", () => {
|
|
147
|
+
it("#02 switch-conditional — HTTP + switch branching (userId > 5 → highValueUser)", async () => {
|
|
148
|
+
const model = loadWorkflowFromYaml(loadGolden("02-switch-conditional.yaml"));
|
|
149
|
+
const state = createState();
|
|
150
|
+
|
|
151
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
152
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
153
|
+
|
|
154
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
155
|
+
|
|
156
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(2);
|
|
157
|
+
const calls = mockCallHttp.mock.calls as unknown[][];
|
|
158
|
+
const firstCall = calls[0][0] as HttpCallConfig;
|
|
159
|
+
expect(firstCall.method).toBe("GET");
|
|
160
|
+
const secondCall = calls[1][0] as HttpCallConfig;
|
|
161
|
+
expect(secondCall.method).toBe("POST");
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("#03 foreach-loop — for loop with HTTP call per item", async () => {
|
|
165
|
+
const model = loadWorkflowFromYaml(loadGolden("03-foreach-loop.yaml"));
|
|
166
|
+
const state = createState();
|
|
167
|
+
state.data = { items: ["item1", "item2", "item3"] };
|
|
168
|
+
|
|
169
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
170
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
171
|
+
|
|
172
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
173
|
+
|
|
174
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(3);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("#04 parallel-concurrent — fork with HTTP calls in each branch", async () => {
|
|
178
|
+
const model = loadWorkflowFromYaml(loadGolden("04-parallel-concurrent.yaml"));
|
|
179
|
+
const state = createState();
|
|
180
|
+
|
|
181
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
182
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
183
|
+
|
|
184
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
185
|
+
|
|
186
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(3);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("#06 sleep-delay — wait + HTTP calls before/after", async () => {
|
|
190
|
+
const model = loadWorkflowFromYaml(loadGolden("06-sleep-delay.yaml"));
|
|
191
|
+
const state = createState();
|
|
192
|
+
|
|
193
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
194
|
+
const mockSleep = vi.fn(async () => {});
|
|
195
|
+
const ctx = makeCtx({ callHttp: mockCallHttp, sleep: mockSleep });
|
|
196
|
+
|
|
197
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
198
|
+
|
|
199
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(2);
|
|
200
|
+
expect(mockSleep).toHaveBeenCalledWith(5_000);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("#08 error-retry — try/catch wrapping HTTP call, error handler runs on failure", async () => {
|
|
204
|
+
const model = loadWorkflowFromYaml(loadGolden("08-error-retry.yaml"));
|
|
205
|
+
const state = createState();
|
|
206
|
+
|
|
207
|
+
let callCount = 0;
|
|
208
|
+
const mockCallHttp = vi.fn(async () => {
|
|
209
|
+
callCount++;
|
|
210
|
+
if (callCount === 1) throw new Error("Simulated HTTP failure");
|
|
211
|
+
return fakeHttpResponse({ message: "Error handled" });
|
|
212
|
+
});
|
|
213
|
+
const mockSleep = vi.fn(async () => {});
|
|
214
|
+
const ctx = makeCtx({ callHttp: mockCallHttp, sleep: mockSleep });
|
|
215
|
+
|
|
216
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
217
|
+
|
|
218
|
+
expect(state.data.error).toBeDefined();
|
|
219
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(2);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("#10 complex-workflow — switch + fork + listen + HTTP (multi-pattern)", async () => {
|
|
223
|
+
const model = loadWorkflowFromYaml(loadGolden("10-complex-workflow.yaml"));
|
|
224
|
+
const state = createState();
|
|
225
|
+
state.data = { valid: true };
|
|
226
|
+
|
|
227
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
228
|
+
const mockListen = vi.fn(async () => ({ approval_signal: { approved: true } }));
|
|
229
|
+
const ctx = makeCtx({ callHttp: mockCallHttp, listen: mockListen });
|
|
230
|
+
|
|
231
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
232
|
+
|
|
233
|
+
expect(mockCallHttp).toHaveBeenCalled();
|
|
234
|
+
expect(mockListen).toHaveBeenCalledOnce();
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it("#10 complex-workflow — switch to errorState when valid=false", async () => {
|
|
238
|
+
const model = loadWorkflowFromYaml(loadGolden("10-complex-workflow.yaml"));
|
|
239
|
+
const state = createState();
|
|
240
|
+
state.data = { valid: false };
|
|
241
|
+
|
|
242
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
243
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
244
|
+
|
|
245
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
246
|
+
|
|
247
|
+
expect(mockCallHttp).toHaveBeenCalledOnce();
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it("#11 claimcheck-large-payload — sequential HTTP calls (GET + GET + POST)", async () => {
|
|
251
|
+
const model = loadWorkflowFromYaml(loadGolden("11-claimcheck-large-payload.yaml"));
|
|
252
|
+
const state = createState();
|
|
253
|
+
|
|
254
|
+
const photosData = Array.from({ length: 100 }, (_, i) => ({ id: i, title: `photo ${i}` }));
|
|
255
|
+
const commentsData = Array.from({ length: 50 }, (_, i) => ({ id: i, body: `comment ${i}` }));
|
|
256
|
+
let callIndex = 0;
|
|
257
|
+
|
|
258
|
+
const mockCallHttp = vi.fn(async () => {
|
|
259
|
+
callIndex++;
|
|
260
|
+
if (callIndex === 1) return photosData;
|
|
261
|
+
if (callIndex === 2) return commentsData;
|
|
262
|
+
return fakeHttpResponse();
|
|
263
|
+
});
|
|
264
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
265
|
+
|
|
266
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
267
|
+
|
|
268
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(3);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it("#12 claimcheck-between-steps — sequential HTTP with data references", async () => {
|
|
272
|
+
const model = loadWorkflowFromYaml(loadGolden("12-claimcheck-between-steps.yaml"));
|
|
273
|
+
const state = createState();
|
|
274
|
+
|
|
275
|
+
const photosData = Array.from({ length: 10 }, (_, i) => ({ id: i }));
|
|
276
|
+
const commentsData = Array.from({ length: 5 }, (_, i) => ({ id: i }));
|
|
277
|
+
let callIndex = 0;
|
|
278
|
+
|
|
279
|
+
const mockCallHttp = vi.fn(async () => {
|
|
280
|
+
callIndex++;
|
|
281
|
+
if (callIndex === 1) return photosData;
|
|
282
|
+
if (callIndex === 2) return commentsData;
|
|
283
|
+
return fakeHttpResponse();
|
|
284
|
+
});
|
|
285
|
+
const ctx = makeCtx({ callHttp: mockCallHttp });
|
|
286
|
+
|
|
287
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
288
|
+
|
|
289
|
+
expect(mockCallHttp).toHaveBeenCalledTimes(4);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
294
|
+
// Tier 1d: Advanced task golden YAMLs
|
|
295
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
describe("Golden Execution — Tier 1d: Advanced Tasks", () => {
|
|
298
|
+
it("#05 event-signal — listen for one signal, then HTTP call", async () => {
|
|
299
|
+
const model = loadWorkflowFromYaml(loadGolden("05-event-signal.yaml"));
|
|
300
|
+
const state = createState();
|
|
301
|
+
|
|
302
|
+
const mockListen = vi.fn(async () => ({ approved: true }));
|
|
303
|
+
const mockCallHttp = vi.fn(async () => fakeHttpResponse());
|
|
304
|
+
const ctx = makeCtx({ listen: mockListen, callHttp: mockCallHttp });
|
|
305
|
+
|
|
306
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
307
|
+
|
|
308
|
+
expect(mockListen).toHaveBeenCalledOnce();
|
|
309
|
+
expect(mockCallHttp).toHaveBeenCalledOnce();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it("#13 agent-call — call:agent with structured output, switch on severity", async () => {
|
|
313
|
+
const model = loadWorkflowFromYaml(loadGolden("13-agent-call.yaml"));
|
|
314
|
+
const state = createState();
|
|
315
|
+
state.input = { pr_number: 42, repo: "stigmer/stigmer", diff: "--- a/foo.ts\n+++ b/foo.ts" };
|
|
316
|
+
|
|
317
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
318
|
+
structured: { severity: "high", category: "security", customer_impact: true },
|
|
319
|
+
final_text: "Review complete",
|
|
320
|
+
agent_execution_id: "exec-123",
|
|
321
|
+
}));
|
|
322
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
323
|
+
|
|
324
|
+
await executeDoTasks(model.do, state.input, state, model, evaluateExpressionBatch, ctx);
|
|
325
|
+
|
|
326
|
+
expect(mockCallAgent).toHaveBeenCalledOnce();
|
|
327
|
+
expect(state.data.action).toBe("request_changes");
|
|
328
|
+
expect(state.data.notification).toBe("normal");
|
|
329
|
+
expect(state.data.assignee).toBe("senior-reviewer");
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
it("#13 agent-call — critical severity routes to handleCritical", async () => {
|
|
333
|
+
const criticalYaml = [
|
|
334
|
+
"document:",
|
|
335
|
+
" dsl: '1.0.0'",
|
|
336
|
+
" namespace: stigmer",
|
|
337
|
+
" name: code-review-triage-critical",
|
|
338
|
+
" version: '1.0.0'",
|
|
339
|
+
"do:",
|
|
340
|
+
" - setupContext:",
|
|
341
|
+
" set:",
|
|
342
|
+
" review_request:",
|
|
343
|
+
" pr_number: 99",
|
|
344
|
+
" - reviewCode:",
|
|
345
|
+
" call: agent",
|
|
346
|
+
" with:",
|
|
347
|
+
' agent: "code-reviewer"',
|
|
348
|
+
' message: "Review the code changes"',
|
|
349
|
+
" export:",
|
|
350
|
+
' as: "${ .structured }"',
|
|
351
|
+
" - routeBySeverity:",
|
|
352
|
+
" switch:",
|
|
353
|
+
" - critical:",
|
|
354
|
+
' when: ${ $context.reviewCode.severity == "critical" }',
|
|
355
|
+
" then: handleCritical",
|
|
356
|
+
" - default:",
|
|
357
|
+
" then: handleStandard",
|
|
358
|
+
" - handleCritical:",
|
|
359
|
+
" set:",
|
|
360
|
+
" action: block_merge",
|
|
361
|
+
" notification: urgent",
|
|
362
|
+
" assignee: security-team",
|
|
363
|
+
" then: end",
|
|
364
|
+
" - handleStandard:",
|
|
365
|
+
" set:",
|
|
366
|
+
" action: auto_approve",
|
|
367
|
+
].join("\n");
|
|
368
|
+
|
|
369
|
+
const model = loadWorkflowFromYaml(criticalYaml);
|
|
370
|
+
const state = createState();
|
|
371
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
372
|
+
structured: { severity: "critical", category: "data-loss", customer_impact: true },
|
|
373
|
+
}));
|
|
374
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
375
|
+
|
|
376
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
377
|
+
|
|
378
|
+
expect(state.data.action).toBe("block_merge");
|
|
379
|
+
expect(state.data.notification).toBe("urgent");
|
|
380
|
+
expect(state.data.assignee).toBe("security-team");
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it("#13 agent-call — callAgent receives correct agent slug, env, config, and output contract", async () => {
|
|
384
|
+
const model = loadWorkflowFromYaml(loadGolden("13-agent-call.yaml"));
|
|
385
|
+
const state = createState();
|
|
386
|
+
state.input = { pr_number: 7, repo: "acme/app", diff: "--- a/main.ts" };
|
|
387
|
+
|
|
388
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
389
|
+
structured: { severity: "low", category: "style", customer_impact: false },
|
|
390
|
+
final_text: "LGTM",
|
|
391
|
+
agent_execution_id: "aex-verify",
|
|
392
|
+
}));
|
|
393
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
394
|
+
|
|
395
|
+
await executeDoTasks(model.do, state.input, state, model, evaluateExpressionBatch, ctx);
|
|
396
|
+
|
|
397
|
+
expect(mockCallAgent).toHaveBeenCalledOnce();
|
|
398
|
+
const [config, _env, metadata] = mockCallAgent.mock.calls[0];
|
|
399
|
+
|
|
400
|
+
expect(config.agent).toBe("code-reviewer");
|
|
401
|
+
expect(config.message).toContain("Review the following code changes from PR #7");
|
|
402
|
+
expect(config.message).toContain("in repository acme/app");
|
|
403
|
+
expect(config.message).toContain("--- a/main.ts");
|
|
404
|
+
expect(config.message).not.toContain("${ $context");
|
|
405
|
+
expect(config.message).not.toContain("${ $input");
|
|
406
|
+
expect(config.env).toEqual({ GITHUB_TOKEN: "${.secrets.GITHUB_TOKEN}" });
|
|
407
|
+
expect(config.config?.model).toBe("claude-3-5-sonnet");
|
|
408
|
+
expect(config.config?.timeout).toBe(300);
|
|
409
|
+
expect(config.config?.temperature).toBe(0.2);
|
|
410
|
+
expect(config.harness).toBe("HARNESS_NATIVE");
|
|
411
|
+
expect(config.output?.schema).toBeDefined();
|
|
412
|
+
expect(config.output?.schema.required).toContain("severity");
|
|
413
|
+
expect(config.output?.on_invalid).toBe("ON_INVALID_RETRY");
|
|
414
|
+
expect(config.output?.max_retries).toBe(2);
|
|
415
|
+
expect(metadata.taskName).toBe("reviewCode");
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it("#13 agent-call — cross-org agent reference preserves org/slug format", async () => {
|
|
419
|
+
const crossOrgYaml = [
|
|
420
|
+
"document:",
|
|
421
|
+
" dsl: '1.0.0'",
|
|
422
|
+
" namespace: my-org",
|
|
423
|
+
" name: cross-org-agent",
|
|
424
|
+
" version: '1.0.0'",
|
|
425
|
+
"do:",
|
|
426
|
+
" - callRemoteAgent:",
|
|
427
|
+
" call: agent",
|
|
428
|
+
" with:",
|
|
429
|
+
' agent: "stigmer/code-reviewer"',
|
|
430
|
+
' message: "Review this"',
|
|
431
|
+
' org: "stigmer"',
|
|
432
|
+
].join("\n");
|
|
433
|
+
|
|
434
|
+
const model = loadWorkflowFromYaml(crossOrgYaml);
|
|
435
|
+
const state = createState();
|
|
436
|
+
|
|
437
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
438
|
+
final_text: "done",
|
|
439
|
+
}));
|
|
440
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
441
|
+
|
|
442
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
443
|
+
|
|
444
|
+
expect(mockCallAgent).toHaveBeenCalledOnce();
|
|
445
|
+
const [config] = mockCallAgent.mock.calls[0];
|
|
446
|
+
expect(config.agent).toBe("stigmer/code-reviewer");
|
|
447
|
+
expect(config.org).toBe("stigmer");
|
|
448
|
+
expect(config.message).toBe("Review this");
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it("#16 wait-delay — multiple timer durations (seconds, minutes+seconds, milliseconds)", async () => {
|
|
452
|
+
const model = loadWorkflowFromYaml(loadGolden("16-wait-delay.yaml"));
|
|
453
|
+
const state = createState();
|
|
454
|
+
|
|
455
|
+
const mockSleep = vi.fn(async () => {});
|
|
456
|
+
const ctx = makeCtx({ sleep: mockSleep });
|
|
457
|
+
|
|
458
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
459
|
+
|
|
460
|
+
expect(state.data.started).toBe(true);
|
|
461
|
+
expect(state.data.after_short).toBe(true);
|
|
462
|
+
expect(state.data.after_multi).toBe(true);
|
|
463
|
+
expect(state.data.completed).toBe(true);
|
|
464
|
+
|
|
465
|
+
expect(mockSleep).toHaveBeenCalledTimes(3);
|
|
466
|
+
expect(mockSleep).toHaveBeenNthCalledWith(1, 5_000);
|
|
467
|
+
expect(mockSleep).toHaveBeenNthCalledWith(2, 90_000);
|
|
468
|
+
expect(mockSleep).toHaveBeenNthCalledWith(3, 500);
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
it("#17 listen-signal — one/all/any signal strategies", async () => {
|
|
472
|
+
const model = loadWorkflowFromYaml(loadGolden("17-listen-signal.yaml"));
|
|
473
|
+
const state = createState();
|
|
474
|
+
|
|
475
|
+
const mockListen = vi.fn(async (config: ListenExecutionConfig) => {
|
|
476
|
+
if (config.mode === "all") {
|
|
477
|
+
return config.events.reduce((acc, e) => ({ ...acc, [e.id]: { data: "ok" } }), {});
|
|
478
|
+
}
|
|
479
|
+
return { data: "first-response" };
|
|
480
|
+
});
|
|
481
|
+
const ctx = makeCtx({ listen: mockListen });
|
|
482
|
+
|
|
483
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
484
|
+
|
|
485
|
+
expect(mockListen).toHaveBeenCalledTimes(3);
|
|
486
|
+
expect(state.data.approved).toBe(true);
|
|
487
|
+
expect(state.data.reviews_done).toBe(true);
|
|
488
|
+
expect(state.data.first_response).toBe(true);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it("#18 run-task — script, shell, and child workflow", async () => {
|
|
492
|
+
const model = loadWorkflowFromYaml(loadGolden("18-run-task.yaml"));
|
|
493
|
+
const state = createState();
|
|
494
|
+
|
|
495
|
+
const mockRunCommand = vi.fn(async (config: RunCommandConfig) => {
|
|
496
|
+
if (config.mode === "script") return { computed: 4 };
|
|
497
|
+
return "hello from shell";
|
|
498
|
+
});
|
|
499
|
+
const mockRunWorkflow = vi.fn(async () => ({ enriched: true }));
|
|
500
|
+
const ctx = makeCtx({ runCommand: mockRunCommand, runWorkflow: mockRunWorkflow });
|
|
501
|
+
|
|
502
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
503
|
+
|
|
504
|
+
expect(mockRunCommand).toHaveBeenCalledTimes(2);
|
|
505
|
+
expect(mockRunWorkflow).toHaveBeenCalledOnce();
|
|
506
|
+
expect(state.data.all_runs_done).toBe(true);
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
it("#19 emit-event — CloudEvents envelope construction via call:function", async () => {
|
|
510
|
+
const model = loadWorkflowFromYaml(loadGolden("19-emit-event.yaml"));
|
|
511
|
+
const state = createState();
|
|
512
|
+
|
|
513
|
+
const mockCallFunction = vi.fn(async (call: string, config: Record<string, unknown>) => {
|
|
514
|
+
expect(call).toBe("emit_event");
|
|
515
|
+
const event = config.event as Record<string, unknown>;
|
|
516
|
+
return {
|
|
517
|
+
specversion: "1.0",
|
|
518
|
+
type: event.type,
|
|
519
|
+
source: event.source ?? "/stigmer",
|
|
520
|
+
data: event.data,
|
|
521
|
+
id: "evt-001",
|
|
522
|
+
};
|
|
523
|
+
});
|
|
524
|
+
const ctx = makeCtx({ callFunction: mockCallFunction });
|
|
525
|
+
|
|
526
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
527
|
+
|
|
528
|
+
expect(mockCallFunction).toHaveBeenCalledTimes(2);
|
|
529
|
+
expect(state.data.events_emitted).toBe(true);
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it("#20 human-input — HITL approval gates with timeout policies", async () => {
|
|
533
|
+
const model = loadWorkflowFromYaml(loadGolden("20-human-input.yaml"));
|
|
534
|
+
const state = createState();
|
|
535
|
+
|
|
536
|
+
const mockAwaitHumanInput = vi.fn(async () => ({
|
|
537
|
+
outcome: "approve",
|
|
538
|
+
reviewer: "admin@test.com",
|
|
539
|
+
responded_at: new Date().toISOString(),
|
|
540
|
+
}));
|
|
541
|
+
const ctx = makeCtx({ awaitHumanInput: mockAwaitHumanInput });
|
|
542
|
+
|
|
543
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
544
|
+
|
|
545
|
+
expect(mockAwaitHumanInput).toHaveBeenCalledTimes(2);
|
|
546
|
+
expect(state.data.approval_received).toBe(true);
|
|
547
|
+
expect(state.data.all_gates_passed).toBe(true);
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it("#21 retry-backoff — catch-level retry with various backoff strategies", async () => {
|
|
551
|
+
const model = loadWorkflowFromYaml(loadGolden("21-retry-backoff.yaml"));
|
|
552
|
+
const state = createState();
|
|
553
|
+
|
|
554
|
+
const mockSleep = vi.fn(async () => {});
|
|
555
|
+
const ctx = makeCtx({ sleep: mockSleep });
|
|
556
|
+
|
|
557
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
558
|
+
|
|
559
|
+
expect(state.data.phase).toBe("completed");
|
|
560
|
+
expect(state.data.comm_retried).toBe(true);
|
|
561
|
+
expect(state.data.comm_error_type).toBe("https://serverlessworkflow.io/spec/1.0.0/errors/communication");
|
|
562
|
+
expect(state.data.timeout_retried).toBe(true);
|
|
563
|
+
expect(state.data.timeout_title).toBe("Request Timeout");
|
|
564
|
+
expect(state.data.rate_limited).toBe(true);
|
|
565
|
+
expect(state.data.auth_skipped_retry).toBe(true);
|
|
566
|
+
expect(state.data.auth_error_detail).toBe("Unauthorized");
|
|
567
|
+
expect(state.data.overload_retried).toBe(true);
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it("#22 listen-query-update — query, update, and mixed event types", async () => {
|
|
571
|
+
const model = loadWorkflowFromYaml(loadGolden("22-listen-query-update.yaml"));
|
|
572
|
+
const state = createState();
|
|
573
|
+
|
|
574
|
+
const mockListen = vi.fn(async (config: ListenExecutionConfig) => {
|
|
575
|
+
const firstEvent = config.events[0];
|
|
576
|
+
if (firstEvent.type === "query") {
|
|
577
|
+
return firstEvent.data ?? { status: "ok" };
|
|
578
|
+
}
|
|
579
|
+
if (firstEvent.type === "update") {
|
|
580
|
+
return firstEvent.data ?? { updated: true };
|
|
581
|
+
}
|
|
582
|
+
if (config.mode === "all") {
|
|
583
|
+
return config.events.reduce((acc, e) => ({ ...acc, [e.id]: e.data ?? { ok: true } }), {});
|
|
584
|
+
}
|
|
585
|
+
return { data: "response" };
|
|
586
|
+
});
|
|
587
|
+
const ctx = makeCtx({ listen: mockListen });
|
|
588
|
+
|
|
589
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
590
|
+
|
|
591
|
+
expect(mockListen).toHaveBeenCalledTimes(4);
|
|
592
|
+
expect(state.data.listen_tests_complete).toBe(true);
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it("#23 notification — webhook notification via call:function", async () => {
|
|
596
|
+
const model = loadWorkflowFromYaml(loadGolden("23-notification.yaml"));
|
|
597
|
+
const state = createState();
|
|
598
|
+
|
|
599
|
+
const mockCallFunction = vi.fn(async (call: string) => {
|
|
600
|
+
expect(call).toBe("notification");
|
|
601
|
+
return { delivered: true, channel: "webhook" };
|
|
602
|
+
});
|
|
603
|
+
const ctx = makeCtx({ callFunction: mockCallFunction });
|
|
604
|
+
|
|
605
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
606
|
+
|
|
607
|
+
expect(mockCallFunction).toHaveBeenCalledTimes(2);
|
|
608
|
+
expect(state.data.notifications_sent).toBe(true);
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
613
|
+
// Structured Output Pipeline Regression Tests
|
|
614
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
615
|
+
|
|
616
|
+
describe("Golden Execution — Structured Output Pipeline", () => {
|
|
617
|
+
it("agent_call with output.schema — structured output flows to downstream tasks via $context", async () => {
|
|
618
|
+
const yaml = [
|
|
619
|
+
"document:",
|
|
620
|
+
" dsl: '1.0.0'",
|
|
621
|
+
" name: structured-output-pipeline",
|
|
622
|
+
" version: '1.0.0'",
|
|
623
|
+
"do:",
|
|
624
|
+
" - analyze:",
|
|
625
|
+
" call: agent",
|
|
626
|
+
" with:",
|
|
627
|
+
' agent: "analyst"',
|
|
628
|
+
' message: "Analyze player data"',
|
|
629
|
+
" output:",
|
|
630
|
+
" schema:",
|
|
631
|
+
" type: object",
|
|
632
|
+
" required:",
|
|
633
|
+
" - executive_summary",
|
|
634
|
+
" - cohorts",
|
|
635
|
+
" properties:",
|
|
636
|
+
" executive_summary:",
|
|
637
|
+
" type: string",
|
|
638
|
+
" dau:",
|
|
639
|
+
" type: number",
|
|
640
|
+
" cohorts:",
|
|
641
|
+
" type: array",
|
|
642
|
+
" items:",
|
|
643
|
+
" type: object",
|
|
644
|
+
" required:",
|
|
645
|
+
" - name",
|
|
646
|
+
" - size",
|
|
647
|
+
" properties:",
|
|
648
|
+
" name:",
|
|
649
|
+
" type: string",
|
|
650
|
+
" size:",
|
|
651
|
+
" type: number",
|
|
652
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
653
|
+
" export:",
|
|
654
|
+
' as: "${ .structured }"',
|
|
655
|
+
" - downstream:",
|
|
656
|
+
" set:",
|
|
657
|
+
" report_dau: ${ $context.analyze.dau }",
|
|
658
|
+
" cohort_count: ${ $context.analyze.cohorts | length }",
|
|
659
|
+
" first_cohort: ${ $context.analyze.cohorts[0].name }",
|
|
660
|
+
].join("\n");
|
|
661
|
+
|
|
662
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
663
|
+
const state = createState();
|
|
664
|
+
|
|
665
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
666
|
+
structured: {
|
|
667
|
+
executive_summary: "DAU stable at 7175",
|
|
668
|
+
dau: 7175,
|
|
669
|
+
cohorts: [
|
|
670
|
+
{ name: "D1 New Players", size: 10 },
|
|
671
|
+
{ name: "D3 Drop-offs", size: 3589 },
|
|
672
|
+
],
|
|
673
|
+
},
|
|
674
|
+
agent_execution_id: "aex-pipeline-test",
|
|
675
|
+
}));
|
|
676
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
677
|
+
|
|
678
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
679
|
+
|
|
680
|
+
expect(mockCallAgent).toHaveBeenCalledOnce();
|
|
681
|
+
expect(state.context.analyze.dau).toBe(7175);
|
|
682
|
+
expect(state.context.analyze.executive_summary).toBe("DAU stable at 7175");
|
|
683
|
+
expect(state.context.analyze.cohorts).toHaveLength(2);
|
|
684
|
+
expect(state.data.report_dau).toBe(7175);
|
|
685
|
+
expect(state.data.cohort_count).toBe(2);
|
|
686
|
+
expect(state.data.first_cohort).toBe("D1 New Players");
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
it("agent_call with output.schema — ON_INVALID_FAIL rejects missing structured output", async () => {
|
|
690
|
+
const yaml = [
|
|
691
|
+
"document:",
|
|
692
|
+
" dsl: '1.0.0'",
|
|
693
|
+
" name: structured-output-fail",
|
|
694
|
+
" version: '1.0.0'",
|
|
695
|
+
"do:",
|
|
696
|
+
" - analyze:",
|
|
697
|
+
" call: agent",
|
|
698
|
+
" with:",
|
|
699
|
+
' agent: "analyst"',
|
|
700
|
+
' message: "Analyze data"',
|
|
701
|
+
" output:",
|
|
702
|
+
" schema:",
|
|
703
|
+
" type: object",
|
|
704
|
+
" required:",
|
|
705
|
+
" - executive_summary",
|
|
706
|
+
" properties:",
|
|
707
|
+
" executive_summary:",
|
|
708
|
+
" type: string",
|
|
709
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
710
|
+
" export:",
|
|
711
|
+
' as: "${ .structured }"',
|
|
712
|
+
].join("\n");
|
|
713
|
+
|
|
714
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
715
|
+
const state = createState();
|
|
716
|
+
|
|
717
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
718
|
+
final_text: "Here is the analysis...",
|
|
719
|
+
agent_execution_id: "aex-no-structured",
|
|
720
|
+
}));
|
|
721
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
722
|
+
|
|
723
|
+
await expect(
|
|
724
|
+
executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx),
|
|
725
|
+
).rejects.toThrow(/Agent output validation failed.*Agent did not return structured output/);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// ─────────────────────────────────────────────────────────────────
|
|
729
|
+
// Regression: Production Callback Result Formats
|
|
730
|
+
//
|
|
731
|
+
// In production, the CallAgent activity uses async completion.
|
|
732
|
+
// The Java/Go backend completes the activity with a callback result.
|
|
733
|
+
// These tests simulate the exact result formats each backend produces
|
|
734
|
+
// to verify the workflow engine handles them correctly.
|
|
735
|
+
// ─────────────────────────────────────────────────────────────────
|
|
736
|
+
|
|
737
|
+
it("REGRESSION: Go buildCallbackResult omits structured output due to snake_case key mismatch", async () => {
|
|
738
|
+
// Go's buildCallbackResult() looks for activityResult["structured_output"]
|
|
739
|
+
// (snake_case) but the runner's slimStatus() returns "structuredOutput"
|
|
740
|
+
// (camelCase via proto-JSON). The key is never found, so the callback
|
|
741
|
+
// result has only agent_execution_id — no "structured" field.
|
|
742
|
+
//
|
|
743
|
+
// This is the EXACT format returned by the Go InvokeAgentExecutionWorkflow:
|
|
744
|
+
// { agent_execution_id: "aex_xxx" }
|
|
745
|
+
//
|
|
746
|
+
// Expected: validation fails because result.structured is undefined.
|
|
747
|
+
const yaml = [
|
|
748
|
+
"document:",
|
|
749
|
+
" dsl: '1.0.0'",
|
|
750
|
+
" name: go-callback-regression",
|
|
751
|
+
" version: '1.0.0'",
|
|
752
|
+
"do:",
|
|
753
|
+
" - analyze:",
|
|
754
|
+
" call: agent",
|
|
755
|
+
" with:",
|
|
756
|
+
' agent: "analyst"',
|
|
757
|
+
' message: "Analyze data"',
|
|
758
|
+
" output:",
|
|
759
|
+
" schema:",
|
|
760
|
+
" type: object",
|
|
761
|
+
" required:",
|
|
762
|
+
" - executive_summary",
|
|
763
|
+
" properties:",
|
|
764
|
+
" executive_summary:",
|
|
765
|
+
" type: string",
|
|
766
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
767
|
+
" export:",
|
|
768
|
+
' as: "${ .structured }"',
|
|
769
|
+
].join("\n");
|
|
770
|
+
|
|
771
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
772
|
+
const state = createState();
|
|
773
|
+
|
|
774
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
775
|
+
agent_execution_id: "aex-go-regression",
|
|
776
|
+
// NOTE: no "structured" field — this is what Go's buildCallbackResult
|
|
777
|
+
// produces because it looks for "structured_output" (snake_case) but
|
|
778
|
+
// the runner returns "structuredOutput" (camelCase).
|
|
779
|
+
}));
|
|
780
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
781
|
+
|
|
782
|
+
await expect(
|
|
783
|
+
executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx),
|
|
784
|
+
).rejects.toThrow(/Agent output validation failed.*Agent did not return structured output/);
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
it("REGRESSION: Java buildCallbackResultJson includes structured output correctly", async () => {
|
|
788
|
+
// Java's buildCallbackResultJson() reads structuredOutput from the
|
|
789
|
+
// proto via finalStatus.hasStructuredOutput() and serializes it as
|
|
790
|
+
// the "structured" field in the callback JSON.
|
|
791
|
+
//
|
|
792
|
+
// When the local Java v3 code handles the workflow, the callback
|
|
793
|
+
// result is: { agent_execution_id: "aex_xxx", structured: {...} }
|
|
794
|
+
//
|
|
795
|
+
// Expected: validation passes, downstream reads structured data.
|
|
796
|
+
const yaml = [
|
|
797
|
+
"document:",
|
|
798
|
+
" dsl: '1.0.0'",
|
|
799
|
+
" name: java-callback-success",
|
|
800
|
+
" version: '1.0.0'",
|
|
801
|
+
"do:",
|
|
802
|
+
" - analyze:",
|
|
803
|
+
" call: agent",
|
|
804
|
+
" with:",
|
|
805
|
+
' agent: "analyst"',
|
|
806
|
+
' message: "Analyze data"',
|
|
807
|
+
" output:",
|
|
808
|
+
" schema:",
|
|
809
|
+
" type: object",
|
|
810
|
+
" required:",
|
|
811
|
+
" - executive_summary",
|
|
812
|
+
" - dau",
|
|
813
|
+
" properties:",
|
|
814
|
+
" executive_summary:",
|
|
815
|
+
" type: string",
|
|
816
|
+
" dau:",
|
|
817
|
+
" type: number",
|
|
818
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
819
|
+
" export:",
|
|
820
|
+
' as: "${ .structured }"',
|
|
821
|
+
" - downstream:",
|
|
822
|
+
" set:",
|
|
823
|
+
" report_dau: ${ $context.analyze.dau }",
|
|
824
|
+
" summary: ${ $context.analyze.executive_summary }",
|
|
825
|
+
].join("\n");
|
|
826
|
+
|
|
827
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
828
|
+
const state = createState();
|
|
829
|
+
|
|
830
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
831
|
+
agent_execution_id: "aex-java-success",
|
|
832
|
+
structured: {
|
|
833
|
+
executive_summary: "DAU stable at 7175",
|
|
834
|
+
dau: 7175,
|
|
835
|
+
},
|
|
836
|
+
}));
|
|
837
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
838
|
+
|
|
839
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
840
|
+
|
|
841
|
+
expect(state.context.analyze.dau).toBe(7175);
|
|
842
|
+
expect(state.context.analyze.executive_summary).toBe("DAU stable at 7175");
|
|
843
|
+
expect(state.data.report_dau).toBe(7175);
|
|
844
|
+
expect(state.data.summary).toBe("DAU stable at 7175");
|
|
845
|
+
});
|
|
846
|
+
|
|
847
|
+
it("REGRESSION: old Java code sends plain string — no structured output", async () => {
|
|
848
|
+
// Before the v3 fix, Java's executeCursorFlow() completed the async
|
|
849
|
+
// activity with a plain string like:
|
|
850
|
+
// "Agent execution completed - execution_id: aex_xxx, phase: EXECUTION_COMPLETED"
|
|
851
|
+
//
|
|
852
|
+
// The TS orchestrator's JSON.parse fails, so activityResult = {}.
|
|
853
|
+
// At the workflow engine level, callAgent returns {} (empty object).
|
|
854
|
+
//
|
|
855
|
+
// Expected: validation fails because result.structured is undefined.
|
|
856
|
+
const yaml = [
|
|
857
|
+
"document:",
|
|
858
|
+
" dsl: '1.0.0'",
|
|
859
|
+
" name: old-java-regression",
|
|
860
|
+
" version: '1.0.0'",
|
|
861
|
+
"do:",
|
|
862
|
+
" - analyze:",
|
|
863
|
+
" call: agent",
|
|
864
|
+
" with:",
|
|
865
|
+
' agent: "analyst"',
|
|
866
|
+
' message: "Analyze data"',
|
|
867
|
+
" output:",
|
|
868
|
+
" schema:",
|
|
869
|
+
" type: object",
|
|
870
|
+
" required:",
|
|
871
|
+
" - executive_summary",
|
|
872
|
+
" properties:",
|
|
873
|
+
" executive_summary:",
|
|
874
|
+
" type: string",
|
|
875
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
876
|
+
" export:",
|
|
877
|
+
' as: "${ .structured }"',
|
|
878
|
+
].join("\n");
|
|
879
|
+
|
|
880
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
881
|
+
const state = createState();
|
|
882
|
+
|
|
883
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
884
|
+
// Empty object — what the orchestrator produces when JSON.parse
|
|
885
|
+
// fails on the plain string from old Java code
|
|
886
|
+
}));
|
|
887
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
888
|
+
|
|
889
|
+
await expect(
|
|
890
|
+
executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx),
|
|
891
|
+
).rejects.toThrow(/Agent output validation failed.*Agent did not return structured output/);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it("agent_call with output.schema — schema with optional fields validates correctly", async () => {
|
|
895
|
+
const yaml = [
|
|
896
|
+
"document:",
|
|
897
|
+
" dsl: '1.0.0'",
|
|
898
|
+
" name: structured-optional-fields",
|
|
899
|
+
" version: '1.0.0'",
|
|
900
|
+
"do:",
|
|
901
|
+
" - analyze:",
|
|
902
|
+
" call: agent",
|
|
903
|
+
" with:",
|
|
904
|
+
' agent: "analyst"',
|
|
905
|
+
' message: "Analyze data"',
|
|
906
|
+
" output:",
|
|
907
|
+
" schema:",
|
|
908
|
+
" type: object",
|
|
909
|
+
" required:",
|
|
910
|
+
" - executive_summary",
|
|
911
|
+
" - cohorts",
|
|
912
|
+
" - anomalies",
|
|
913
|
+
" properties:",
|
|
914
|
+
" executive_summary:",
|
|
915
|
+
" type: string",
|
|
916
|
+
" dau:",
|
|
917
|
+
" type: number",
|
|
918
|
+
" dau_trend_pct:",
|
|
919
|
+
" type: number",
|
|
920
|
+
" cohorts:",
|
|
921
|
+
" type: array",
|
|
922
|
+
" items:",
|
|
923
|
+
" type: object",
|
|
924
|
+
" required:",
|
|
925
|
+
" - name",
|
|
926
|
+
" - size",
|
|
927
|
+
" - action_needed",
|
|
928
|
+
" properties:",
|
|
929
|
+
" name:",
|
|
930
|
+
" type: string",
|
|
931
|
+
" size:",
|
|
932
|
+
" type: number",
|
|
933
|
+
" retention_trend:",
|
|
934
|
+
" type: string",
|
|
935
|
+
" action_needed:",
|
|
936
|
+
" type: boolean",
|
|
937
|
+
" anomalies:",
|
|
938
|
+
" type: array",
|
|
939
|
+
" items:",
|
|
940
|
+
" type: object",
|
|
941
|
+
" properties:",
|
|
942
|
+
" metric:",
|
|
943
|
+
" type: string",
|
|
944
|
+
" description:",
|
|
945
|
+
" type: string",
|
|
946
|
+
" severity:",
|
|
947
|
+
" type: string",
|
|
948
|
+
" data_quality_notes:",
|
|
949
|
+
" type: string",
|
|
950
|
+
" on_invalid: ON_INVALID_FAIL",
|
|
951
|
+
" export:",
|
|
952
|
+
' as: "${ .structured }"',
|
|
953
|
+
" - report:",
|
|
954
|
+
" set:",
|
|
955
|
+
" summary: ${ $context.analyze.executive_summary }",
|
|
956
|
+
" anomaly_count: ${ $context.analyze.anomalies | length }",
|
|
957
|
+
].join("\n");
|
|
958
|
+
|
|
959
|
+
const model = loadWorkflowFromYaml(yaml);
|
|
960
|
+
const state = createState();
|
|
961
|
+
|
|
962
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
963
|
+
structured: {
|
|
964
|
+
executive_summary: "Garden Design Makeover DAU remains stable at 7,175",
|
|
965
|
+
dau: 7175,
|
|
966
|
+
dau_trend_pct: 3.4,
|
|
967
|
+
cohorts: [
|
|
968
|
+
{ name: "D1 New Players", size: 10, retention_trend: "Very low", action_needed: true },
|
|
969
|
+
{ name: "D3 Drop-offs", size: 3589, retention_trend: "Large cohort", action_needed: true },
|
|
970
|
+
],
|
|
971
|
+
anomalies: [
|
|
972
|
+
{ metric: "New User Acquisition", severity: "warning", description: "Only 10 new players" },
|
|
973
|
+
],
|
|
974
|
+
data_quality_notes: "Event data lags 3 days behind current date",
|
|
975
|
+
},
|
|
976
|
+
agent_execution_id: "aex-full-schema",
|
|
977
|
+
}));
|
|
978
|
+
const ctx = makeCtx({ callAgent: mockCallAgent });
|
|
979
|
+
|
|
980
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
981
|
+
|
|
982
|
+
expect(state.context.analyze.dau).toBe(7175);
|
|
983
|
+
expect(state.context.analyze.cohorts).toHaveLength(2);
|
|
984
|
+
expect(state.context.analyze.anomalies).toHaveLength(1);
|
|
985
|
+
expect(state.data.summary).toBe("Garden Design Makeover DAU remains stable at 7,175");
|
|
986
|
+
expect(state.data.anomaly_count).toBe(1);
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
it("#26 agent-call-structured-output-propagation — daily-notification-plan pattern with embedded env expressions", async () => {
|
|
990
|
+
const model = loadWorkflowFromYaml(loadGolden("26-agent-call-structured-output-propagation.yaml"));
|
|
991
|
+
const state = createState();
|
|
992
|
+
state.env = { NOTIFICATION_DATE: "2026-05-26" };
|
|
993
|
+
|
|
994
|
+
const mockCallAgent = vi.fn(async () => ({
|
|
995
|
+
structured: {
|
|
996
|
+
executive_summary: "Garden Design Makeover DAU stable at 7,185",
|
|
997
|
+
dau: 7185,
|
|
998
|
+
dau_trend_pct: 8.7,
|
|
999
|
+
cohorts: [
|
|
1000
|
+
{ name: "D1 New", size: 9, retention_trend: "Critical", action_needed: true },
|
|
1001
|
+
{ name: "D7 Lapsed", size: 19000, retention_trend: "Below benchmark", action_needed: true },
|
|
1002
|
+
],
|
|
1003
|
+
anomalies: [
|
|
1004
|
+
{ metric: "Acquisition", severity: "critical", description: "Only 9 installs" },
|
|
1005
|
+
],
|
|
1006
|
+
data_quality_notes: "Data lags 3 days",
|
|
1007
|
+
},
|
|
1008
|
+
agent_execution_id: "aex-daily-plan-test",
|
|
1009
|
+
}));
|
|
1010
|
+
|
|
1011
|
+
const mockCallFunction = vi.fn(async () => ({
|
|
1012
|
+
structured: { sufficient: true },
|
|
1013
|
+
}));
|
|
1014
|
+
|
|
1015
|
+
const ctx = makeCtx({ callAgent: mockCallAgent, callFunction: mockCallFunction });
|
|
1016
|
+
|
|
1017
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
1018
|
+
|
|
1019
|
+
expect(mockCallAgent).toHaveBeenCalledOnce();
|
|
1020
|
+
const [config, env, metadata] = mockCallAgent.mock.calls[0];
|
|
1021
|
+
|
|
1022
|
+
// Schema must survive expression resolution
|
|
1023
|
+
expect(config.output).toBeDefined();
|
|
1024
|
+
expect(config.output.schema).toBeDefined();
|
|
1025
|
+
expect(config.output.schema.required).toEqual(["executive_summary", "cohorts", "anomalies"]);
|
|
1026
|
+
expect(config.output.schema.properties.cohorts.items.required)
|
|
1027
|
+
.toEqual(["name", "size", "action_needed"]);
|
|
1028
|
+
expect(config.output.schema.properties.anomalies.items.properties.severity.enum)
|
|
1029
|
+
.toEqual(["warning", "critical"]);
|
|
1030
|
+
expect(config.output.on_invalid).toBe("ON_INVALID_FAIL");
|
|
1031
|
+
|
|
1032
|
+
// Embedded expression must be resolved
|
|
1033
|
+
expect(config.message).toContain("Date: 2026-05-26");
|
|
1034
|
+
expect(config.message).not.toContain("${ $env");
|
|
1035
|
+
|
|
1036
|
+
// Config and harness preserved
|
|
1037
|
+
expect(config.config?.model).toBe("claude-sonnet-4");
|
|
1038
|
+
expect(config.config?.timeout).toBe(300);
|
|
1039
|
+
expect(config.harness).toBe("HARNESS_CURSOR");
|
|
1040
|
+
expect(metadata.taskName).toBe("analyze_player_data");
|
|
1041
|
+
|
|
1042
|
+
// Structured output exported to context and consumed downstream
|
|
1043
|
+
expect(state.context.analyze_player_data.dau).toBe(7185);
|
|
1044
|
+
expect(state.context.analyze_player_data.executive_summary).toContain("7,185");
|
|
1045
|
+
expect(state.data.final_dau).toBe(7185);
|
|
1046
|
+
expect(state.data.anomaly_count).toBe(1);
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
it("#27 approval-gate-string-switch — human_input → switch with single-quoted string condition (regression)", async () => {
|
|
1050
|
+
const model = loadWorkflowFromYaml(loadGolden("27-approval-gate-string-switch.yaml"));
|
|
1051
|
+
|
|
1052
|
+
// Test approve path
|
|
1053
|
+
{
|
|
1054
|
+
const state = createState();
|
|
1055
|
+
const mockAwaitHumanInput = vi.fn(async () => ({
|
|
1056
|
+
outcome: "approve",
|
|
1057
|
+
reviewer: "alice@test.com",
|
|
1058
|
+
}));
|
|
1059
|
+
const ctx = makeCtx({ awaitHumanInput: mockAwaitHumanInput });
|
|
1060
|
+
|
|
1061
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
1062
|
+
|
|
1063
|
+
expect(mockAwaitHumanInput).toHaveBeenCalledTimes(1);
|
|
1064
|
+
expect(state.data.plan_ready).toBe(true);
|
|
1065
|
+
expect(state.data.decision).toBe("approved");
|
|
1066
|
+
expect(state.data.approved_by).toBe("alice@test.com");
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
// Test reject path
|
|
1070
|
+
{
|
|
1071
|
+
const state = createState();
|
|
1072
|
+
const mockAwaitHumanInput = vi.fn(async () => ({
|
|
1073
|
+
outcome: "reject",
|
|
1074
|
+
reviewer: "bob@test.com",
|
|
1075
|
+
}));
|
|
1076
|
+
const ctx = makeCtx({ awaitHumanInput: mockAwaitHumanInput });
|
|
1077
|
+
|
|
1078
|
+
await executeDoTasks(model.do, null, state, model, evaluateExpressionBatch, ctx);
|
|
1079
|
+
|
|
1080
|
+
expect(mockAwaitHumanInput).toHaveBeenCalledTimes(1);
|
|
1081
|
+
expect(state.data.plan_ready).toBe(true);
|
|
1082
|
+
expect(state.data.decision).toBe("rejected");
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
});
|