mayura 0.1.0-dev.0 → 1.0.0-rc.2
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 +152 -35
- package/docs/README.md +82 -0
- package/docs/ai-agents.md +73 -0
- package/docs/cli/dev.md +111 -0
- package/docs/cli/init.md +192 -0
- package/docs/cli/operations.md +235 -0
- package/docs/cli/overview.md +129 -0
- package/docs/cli/run.md +182 -0
- package/docs/concepts/agent.md +197 -0
- package/docs/concepts/costs-and-budgets.md +177 -0
- package/docs/concepts/outcomes.md +154 -0
- package/docs/concepts/permissions.md +155 -0
- package/docs/concepts/runtime.md +172 -0
- package/docs/concepts/tools.md +202 -0
- package/docs/concepts/workflows.md +134 -0
- package/docs/guides/approvals-and-human-input.md +278 -0
- package/docs/guides/artifacts.md +123 -0
- package/docs/guides/child-agents.md +158 -0
- package/docs/guides/code-mode.md +233 -0
- package/docs/guides/deployment.md +644 -0
- package/docs/guides/durable-workflows.md +463 -0
- package/docs/guides/guardrails.md +205 -0
- package/docs/guides/helpers.md +176 -0
- package/docs/guides/lifecycle-hooks.md +187 -0
- package/docs/guides/mcp.md +123 -0
- package/docs/guides/memory-and-context.md +293 -0
- package/docs/guides/model-providers.md +371 -0
- package/docs/guides/model-routing.md +138 -0
- package/docs/guides/observability.md +238 -0
- package/docs/guides/operator-console.md +140 -0
- package/docs/guides/react.md +276 -0
- package/docs/guides/sagas-and-loops.md +212 -0
- package/docs/guides/server-and-client.md +559 -0
- package/docs/guides/skills.md +152 -0
- package/docs/guides/storage.md +251 -0
- package/docs/guides/streaming.md +146 -0
- package/docs/guides/terminal.md +166 -0
- package/docs/guides/testing.md +220 -0
- package/docs/guides/vision.md +155 -0
- package/docs/guides/webhooks.md +172 -0
- package/docs/guides/workflow-composition.md +141 -0
- package/docs/guides/workflow-operations.md +269 -0
- package/docs/installation.md +90 -0
- package/docs/introduction.md +74 -0
- package/docs/project/credits.md +78 -0
- package/docs/project/security.md +178 -0
- package/docs/project/support.md +91 -0
- package/docs/project/versioning.md +122 -0
- package/docs/quickstart.md +190 -0
- package/docs/reference/entry-points.md +146 -0
- package/lib/adapter-code-docker/dist/index.d.ts +8 -1
- package/lib/adapter-code-docker/dist/index.d.ts.map +1 -1
- package/lib/adapter-code-docker/dist/index.js +64 -67
- package/lib/adapter-code-docker/dist/index.js.map +1 -1
- package/lib/adapter-code-docker/dist/options.d.ts +15 -0
- package/lib/adapter-code-docker/dist/options.d.ts.map +1 -0
- package/lib/adapter-code-docker/dist/options.js +56 -0
- package/lib/adapter-code-docker/dist/options.js.map +1 -0
- package/lib/adapter-code-docker/image/Dockerfile +4 -2
- package/lib/adapter-code-docker/package.json +1 -1
- package/lib/adapter-code-docker/src/index.ts +63 -65
- package/lib/adapter-code-docker/src/options.ts +51 -0
- package/lib/adapter-code-quickjs/dist/index.d.ts +16 -4
- package/lib/adapter-code-quickjs/dist/index.d.ts.map +1 -1
- package/lib/adapter-code-quickjs/dist/index.js +94 -50
- package/lib/adapter-code-quickjs/dist/index.js.map +1 -1
- package/lib/adapter-code-quickjs/dist/worker-command.d.ts +27 -0
- package/lib/adapter-code-quickjs/dist/worker-command.d.ts.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker-command.js +66 -0
- package/lib/adapter-code-quickjs/dist/worker-command.js.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker.js +421 -104
- package/lib/adapter-code-quickjs/dist/worker.js.map +1 -1
- package/lib/adapter-code-quickjs/package.json +1 -1
- package/lib/adapter-code-quickjs/src/index.ts +88 -44
- package/lib/adapter-code-quickjs/src/worker-command.ts +68 -0
- package/lib/adapter-code-quickjs/src/worker.ts +315 -89
- package/lib/adapter-mcp/package.json +1 -1
- package/lib/artifacts/dist/contracts.d.ts +6 -2
- package/lib/artifacts/dist/contracts.d.ts.map +1 -1
- package/lib/artifacts/dist/contracts.js.map +1 -1
- package/lib/artifacts/dist/index.d.ts +1 -0
- package/lib/artifacts/dist/index.d.ts.map +1 -1
- package/lib/artifacts/dist/index.js +1 -0
- package/lib/artifacts/dist/index.js.map +1 -1
- package/lib/artifacts/dist/local-store.d.ts.map +1 -1
- package/lib/artifacts/dist/local-store.js +4 -7
- package/lib/artifacts/dist/local-store.js.map +1 -1
- package/lib/artifacts/dist/media.d.ts +11 -0
- package/lib/artifacts/dist/media.d.ts.map +1 -0
- package/lib/artifacts/dist/media.js +18 -0
- package/lib/artifacts/dist/media.js.map +1 -0
- package/lib/artifacts/package.json +1 -1
- package/lib/artifacts/src/contracts.ts +6 -2
- package/lib/artifacts/src/index.ts +1 -0
- package/lib/artifacts/src/local-store.ts +5 -7
- package/lib/artifacts/src/media.ts +20 -0
- package/lib/cli/dist/agent-guide.d.ts +10 -0
- package/lib/cli/dist/agent-guide.d.ts.map +1 -0
- package/lib/cli/dist/agent-guide.js +48 -0
- package/lib/cli/dist/agent-guide.js.map +1 -0
- package/lib/cli/dist/application.d.ts +24 -0
- package/lib/cli/dist/application.d.ts.map +1 -1
- package/lib/cli/dist/application.js +21 -0
- package/lib/cli/dist/application.js.map +1 -1
- package/lib/cli/dist/bin.js +26 -6
- package/lib/cli/dist/bin.js.map +1 -1
- package/lib/cli/dist/dev.d.ts.map +1 -1
- package/lib/cli/dist/dev.js +7 -1
- package/lib/cli/dist/dev.js.map +1 -1
- package/lib/cli/dist/index.d.ts +3 -3
- package/lib/cli/dist/index.d.ts.map +1 -1
- package/lib/cli/dist/index.js +19 -9
- package/lib/cli/dist/index.js.map +1 -1
- package/lib/cli/dist/interactive.d.ts.map +1 -1
- package/lib/cli/dist/interactive.js +52 -11
- package/lib/cli/dist/interactive.js.map +1 -1
- package/lib/cli/dist/operations.d.ts +25 -2
- package/lib/cli/dist/operations.d.ts.map +1 -1
- package/lib/cli/dist/operations.js +125 -12
- package/lib/cli/dist/operations.js.map +1 -1
- package/lib/cli/dist/output.d.ts.map +1 -1
- package/lib/cli/dist/output.js +3 -0
- package/lib/cli/dist/output.js.map +1 -1
- package/lib/cli/dist/providers.d.ts +34 -4
- package/lib/cli/dist/providers.d.ts.map +1 -1
- package/lib/cli/dist/providers.js +26 -5
- package/lib/cli/dist/providers.js.map +1 -1
- package/lib/cli/package.json +1 -1
- package/lib/cli/src/agent-guide.ts +47 -0
- package/lib/cli/src/application.ts +24 -0
- package/lib/cli/src/bin.ts +22 -5
- package/lib/cli/src/dev.ts +5 -1
- package/lib/cli/src/index.ts +18 -10
- package/lib/cli/src/interactive.ts +44 -12
- package/lib/cli/src/operations.ts +82 -12
- package/lib/cli/src/output.ts +3 -0
- package/lib/cli/src/providers.ts +45 -10
- package/lib/cli/starters/approval-workflow/dot-env.example +11 -0
- package/lib/cli/starters/approval-workflow/package.json +1 -2
- package/lib/cli/starters/approval-workflow/src/config.ts +25 -7
- package/lib/cli/starters/approval-workflow/src/intake.ts +1 -2
- package/lib/cli/starters/approval-workflow/src/model.ts +11 -4
- package/lib/cli/starters/approval-workflow/src/workflow.ts +1 -2
- package/lib/cli/starters/cli-agent/README.md +121 -0
- package/lib/cli/starters/cli-agent/dot-env.example +37 -0
- package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/cli-agent/dot-gitignore +10 -0
- package/lib/cli/starters/cli-agent/mayura.project.json +15 -0
- package/lib/cli/starters/cli-agent/package.json +28 -0
- package/lib/cli/starters/cli-agent/skills/release-notes/SKILL.md +18 -0
- package/lib/cli/starters/cli-agent/skills/release-notes/references/example.md +12 -0
- package/lib/cli/starters/cli-agent/src/assistant.ts +124 -0
- package/lib/cli/starters/cli-agent/src/cli.ts +72 -0
- package/lib/cli/starters/cli-agent/src/config.ts +117 -0
- package/lib/cli/starters/cli-agent/src/model.ts +34 -0
- package/lib/cli/starters/cli-agent/src/workspace.ts +170 -0
- package/lib/cli/starters/cli-agent/test/assistant.test.ts +205 -0
- package/lib/cli/starters/cli-agent/tsconfig.json +20 -0
- package/lib/cli/starters/event-automation/README.md +4 -3
- package/lib/cli/starters/event-automation/dot-env.example +11 -0
- package/lib/cli/starters/event-automation/package.json +1 -2
- package/lib/cli/starters/event-automation/src/config.ts +25 -7
- package/lib/cli/starters/event-automation/src/ingress.ts +3 -5
- package/lib/cli/starters/event-automation/src/model.ts +11 -4
- package/lib/cli/starters/event-automation/src/send-sample.ts +1 -1
- package/lib/cli/starters/event-automation/src/tracker/main.ts +1 -1
- package/lib/cli/starters/event-automation/src/tracker/mcp-server.ts +1 -1
- package/lib/cli/starters/event-automation/src/tracker/tickets.ts +1 -1
- package/lib/cli/starters/event-automation/src/tracker-tools.ts +1 -1
- package/lib/cli/starters/event-automation/src/triage.ts +15 -22
- package/lib/cli/starters/event-automation/src/workflows.ts +1 -1
- package/lib/cli/starters/event-automation/test/automation.test.ts +3 -3
- package/lib/cli/starters/research-team/README.md +2 -2
- package/lib/cli/starters/research-team/dot-env.example +11 -0
- package/lib/cli/starters/research-team/package.json +1 -2
- package/lib/cli/starters/research-team/src/config.ts +25 -7
- package/lib/cli/starters/research-team/src/desk.ts +1 -2
- package/lib/cli/starters/research-team/src/library/index.ts +1 -2
- package/lib/cli/starters/research-team/src/model.ts +11 -4
- package/lib/cli/starters/research-team/src/services.ts +1 -1
- package/lib/cli/starters/research-team/src/team.ts +1 -2
- package/lib/cli/starters/research-team/src/workflow.ts +45 -59
- package/lib/cli/starters/support-agent/dot-env.example +11 -0
- package/lib/cli/starters/support-agent/package.json +1 -2
- package/lib/cli/starters/support-agent/src/assistant.ts +5 -5
- package/lib/cli/starters/support-agent/src/config.ts +25 -7
- package/lib/cli/starters/support-agent/src/guardrails.ts +3 -1
- package/lib/cli/starters/support-agent/src/model.ts +11 -4
- package/lib/cli/starters/support-agent/src/returns.ts +1 -2
- package/lib/cli/starters/support-agent/test/support.test.ts +25 -1
- package/lib/cli/templates/basic-agent.ts +1 -2
- package/lib/cli/templates/capability-policy.ts +1 -2
- package/lib/cli/templates/code-mode-workflow.ts +1 -1
- package/lib/cli/templates/durable-approval.ts +1 -1
- package/lib/cli/templates/parallel-research.ts +1 -2
- package/lib/cli/templates/typed-tool-runner.ts +1 -2
- package/lib/client/dist/forms.d.ts.map +1 -1
- package/lib/client/dist/forms.js +3 -4
- package/lib/client/dist/forms.js.map +1 -1
- package/lib/client/dist/headless.d.ts +3 -1
- package/lib/client/dist/headless.d.ts.map +1 -1
- package/lib/client/dist/headless.js +10 -6
- package/lib/client/dist/headless.js.map +1 -1
- package/lib/client/dist/index.d.ts +95 -6
- package/lib/client/dist/index.d.ts.map +1 -1
- package/lib/client/dist/index.js +397 -124
- package/lib/client/dist/index.js.map +1 -1
- package/lib/client/dist/workflows.d.ts +1 -1
- package/lib/client/dist/workflows.d.ts.map +1 -1
- package/lib/client/dist/workflows.js +7 -6
- package/lib/client/dist/workflows.js.map +1 -1
- package/lib/client/package.json +1 -1
- package/lib/client/src/forms.ts +3 -4
- package/lib/client/src/headless.ts +13 -7
- package/lib/client/src/index.ts +344 -74
- package/lib/client/src/workflows.ts +8 -7
- package/lib/client-react/package.json +1 -1
- package/lib/code-mode/dist/index.d.ts +32 -1
- package/lib/code-mode/dist/index.d.ts.map +1 -1
- package/lib/code-mode/dist/index.js +289 -221
- package/lib/code-mode/dist/index.js.map +1 -1
- package/lib/code-mode/package.json +1 -1
- package/lib/code-mode/src/index.ts +288 -184
- package/lib/code-mode-workflows/package.json +1 -1
- package/lib/context/package.json +1 -1
- package/lib/core/dist/budget.d.ts.map +1 -1
- package/lib/core/dist/budget.js +17 -2
- package/lib/core/dist/budget.js.map +1 -1
- package/lib/core/dist/contracts.d.ts +57 -0
- package/lib/core/dist/contracts.d.ts.map +1 -1
- package/lib/core/dist/contracts.js +36 -0
- package/lib/core/dist/contracts.js.map +1 -1
- package/lib/core/dist/destination.d.ts +12 -0
- package/lib/core/dist/destination.d.ts.map +1 -0
- package/lib/core/dist/destination.js +37 -0
- package/lib/core/dist/destination.js.map +1 -0
- package/lib/core/dist/event-stream.d.ts +1 -1
- package/lib/core/dist/event-stream.d.ts.map +1 -1
- package/lib/core/dist/event-stream.js +7 -0
- package/lib/core/dist/event-stream.js.map +1 -1
- package/lib/core/dist/host.d.ts +3 -0
- package/lib/core/dist/host.d.ts.map +1 -1
- package/lib/core/dist/host.js +3 -0
- package/lib/core/dist/host.js.map +1 -1
- package/lib/core/dist/index.d.ts +2 -0
- package/lib/core/dist/index.d.ts.map +1 -1
- package/lib/core/dist/index.js +2 -0
- package/lib/core/dist/index.js.map +1 -1
- package/lib/core/dist/media.d.ts +98 -0
- package/lib/core/dist/media.d.ts.map +1 -0
- package/lib/core/dist/media.js +227 -0
- package/lib/core/dist/media.js.map +1 -0
- package/lib/core/dist/model-schema.d.ts +37 -0
- package/lib/core/dist/model-schema.d.ts.map +1 -0
- package/lib/core/dist/model-schema.js +154 -0
- package/lib/core/dist/model-schema.js.map +1 -0
- package/lib/core/package.json +1 -1
- package/lib/core/src/budget.ts +17 -2
- package/lib/core/src/contracts.ts +71 -3
- package/lib/core/src/destination.ts +33 -0
- package/lib/core/src/event-stream.ts +5 -1
- package/lib/core/src/host.ts +3 -0
- package/lib/core/src/index.ts +2 -0
- package/lib/core/src/media.ts +228 -0
- package/lib/core/src/model-schema.ts +129 -0
- package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
- package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
- package/lib/exporter-otlp/dist/signals.js +2 -2
- package/lib/exporter-otlp/dist/signals.js.map +1 -1
- package/lib/exporter-otlp/package.json +1 -1
- package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
- package/lib/exporter-otlp/src/signals.ts +2 -2
- package/lib/guardrails/package.json +1 -1
- package/lib/helpers/package.json +1 -1
- package/lib/memory/dist/index.js +1 -1
- package/lib/memory/dist/index.js.map +1 -1
- package/lib/memory/dist/native.d.ts.map +1 -1
- package/lib/memory/dist/native.js +4 -3
- package/lib/memory/dist/native.js.map +1 -1
- package/lib/memory/package.json +1 -1
- package/lib/memory/src/index.ts +1 -1
- package/lib/memory/src/native.ts +4 -3
- package/lib/memory-remote/package.json +1 -1
- package/lib/observability/package.json +1 -1
- package/lib/provider-anthropic/dist/index.d.ts +36 -3
- package/lib/provider-anthropic/dist/index.d.ts.map +1 -1
- package/lib/provider-anthropic/dist/index.js +128 -78
- package/lib/provider-anthropic/dist/index.js.map +1 -1
- package/lib/provider-anthropic/package.json +1 -1
- package/lib/provider-anthropic/src/index.ts +152 -76
- package/lib/provider-openai/dist/index.d.ts +71 -4
- package/lib/provider-openai/dist/index.d.ts.map +1 -1
- package/lib/provider-openai/dist/index.js +259 -96
- package/lib/provider-openai/dist/index.js.map +1 -1
- package/lib/provider-openai/package.json +1 -1
- package/lib/provider-openai/src/index.ts +282 -84
- package/lib/runtime/dist/agent.d.ts +18 -1
- package/lib/runtime/dist/agent.d.ts.map +1 -1
- package/lib/runtime/dist/agent.js +59 -3
- package/lib/runtime/dist/agent.js.map +1 -1
- package/lib/runtime/dist/composition.d.ts.map +1 -1
- package/lib/runtime/dist/composition.js +2 -1
- package/lib/runtime/dist/composition.js.map +1 -1
- package/lib/runtime/dist/hooks.d.ts +15 -3
- package/lib/runtime/dist/hooks.d.ts.map +1 -1
- package/lib/runtime/dist/hooks.js.map +1 -1
- package/lib/runtime/dist/index.d.ts +1 -1
- package/lib/runtime/dist/index.d.ts.map +1 -1
- package/lib/runtime/dist/index.js.map +1 -1
- package/lib/runtime/dist/response.d.ts +7 -1
- package/lib/runtime/dist/response.d.ts.map +1 -1
- package/lib/runtime/dist/response.js +23 -2
- package/lib/runtime/dist/response.js.map +1 -1
- package/lib/runtime/dist/router.d.ts +10 -3
- package/lib/runtime/dist/router.d.ts.map +1 -1
- package/lib/runtime/dist/router.js +45 -8
- package/lib/runtime/dist/router.js.map +1 -1
- package/lib/runtime/dist/runtime.d.ts +9 -1
- package/lib/runtime/dist/runtime.d.ts.map +1 -1
- package/lib/runtime/dist/runtime.js +50 -22
- package/lib/runtime/dist/runtime.js.map +1 -1
- package/lib/runtime/package.json +1 -1
- package/lib/runtime/src/agent.ts +69 -3
- package/lib/runtime/src/composition.ts +2 -1
- package/lib/runtime/src/hooks.ts +10 -4
- package/lib/runtime/src/index.ts +1 -1
- package/lib/runtime/src/response.ts +20 -2
- package/lib/runtime/src/router.ts +43 -10
- package/lib/runtime/src/runtime.ts +58 -27
- package/lib/sdk/dist/index.d.ts +9 -1
- package/lib/sdk/dist/index.d.ts.map +1 -1
- package/lib/sdk/dist/index.js +9 -1
- package/lib/sdk/dist/index.js.map +1 -1
- package/lib/sdk/package.json +1 -1
- package/lib/sdk/src/index.ts +9 -1
- package/lib/server/dist/index.d.ts +201 -3
- package/lib/server/dist/index.d.ts.map +1 -1
- package/lib/server/dist/index.js +701 -149
- package/lib/server/dist/index.js.map +1 -1
- package/lib/server/dist/inspector-bundle.d.ts +1 -1
- package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
- package/lib/server/dist/inspector-bundle.js +4 -4
- package/lib/server/dist/inspector-bundle.js.map +1 -1
- package/lib/server/package.json +1 -1
- package/lib/server/src/index.ts +611 -135
- package/lib/server/src/inspector-bundle.ts +4 -4
- package/lib/server-node/dist/hardening.d.ts +1 -1
- package/lib/server-node/dist/hardening.d.ts.map +1 -1
- package/lib/server-node/dist/hardening.js +4 -2
- package/lib/server-node/dist/hardening.js.map +1 -1
- package/lib/server-node/dist/index.d.ts +2 -1
- package/lib/server-node/dist/index.d.ts.map +1 -1
- package/lib/server-node/dist/index.js.map +1 -1
- package/lib/server-node/dist/probe.js +2 -2
- package/lib/server-node/dist/probe.js.map +1 -1
- package/lib/server-node/dist/production.d.ts +8 -1
- package/lib/server-node/dist/production.d.ts.map +1 -1
- package/lib/server-node/dist/production.js +15 -2
- package/lib/server-node/dist/production.js.map +1 -1
- package/lib/server-node/package.json +1 -1
- package/lib/server-node/src/hardening.ts +5 -3
- package/lib/server-node/src/index.ts +2 -1
- package/lib/server-node/src/probe.ts +2 -2
- package/lib/server-node/src/production.ts +23 -3
- package/lib/skills/dist/index.d.ts +81 -0
- package/lib/skills/dist/index.d.ts.map +1 -0
- package/lib/skills/dist/index.js +311 -0
- package/lib/skills/dist/index.js.map +1 -0
- package/lib/skills/package.json +5 -0
- package/lib/skills/src/index.ts +260 -0
- package/lib/storage/dist/index.d.ts +1 -1
- package/lib/storage/dist/index.d.ts.map +1 -1
- package/lib/storage/dist/index.js.map +1 -1
- package/lib/storage/package.json +1 -1
- package/lib/storage/src/index.ts +1 -1
- package/lib/storage-contracts/dist/contracts.d.ts +12 -5
- package/lib/storage-contracts/dist/contracts.d.ts.map +1 -1
- package/lib/storage-contracts/dist/contracts.js +24 -6
- package/lib/storage-contracts/dist/contracts.js.map +1 -1
- package/lib/storage-contracts/dist/index.d.ts +2 -0
- package/lib/storage-contracts/dist/index.d.ts.map +1 -1
- package/lib/storage-contracts/dist/index.js +2 -0
- package/lib/storage-contracts/dist/index.js.map +1 -1
- package/lib/storage-contracts/dist/memory-contracts.js +1 -1
- package/lib/storage-contracts/dist/memory-contracts.js.map +1 -1
- package/lib/storage-contracts/dist/run-records.d.ts +100 -0
- package/lib/storage-contracts/dist/run-records.d.ts.map +1 -0
- package/lib/storage-contracts/dist/run-records.js +464 -0
- package/lib/storage-contracts/dist/run-records.js.map +1 -0
- package/lib/storage-contracts/dist/schema-digest.d.ts +17 -0
- package/lib/storage-contracts/dist/schema-digest.d.ts.map +1 -0
- package/lib/storage-contracts/dist/schema-digest.js +94 -0
- package/lib/storage-contracts/dist/schema-digest.js.map +1 -0
- package/lib/storage-contracts/dist/submission-journal.js +1 -1
- package/lib/storage-contracts/dist/submission-journal.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.d.ts +30 -2
- package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.js +57 -5
- package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
- package/lib/storage-contracts/package.json +1 -1
- package/lib/storage-contracts/src/contracts.ts +29 -5
- package/lib/storage-contracts/src/index.ts +2 -0
- package/lib/storage-contracts/src/memory-contracts.ts +1 -1
- package/lib/storage-contracts/src/run-records.ts +365 -0
- package/lib/storage-contracts/src/schema-digest.ts +71 -0
- package/lib/storage-contracts/src/submission-journal.ts +1 -1
- package/lib/storage-contracts/src/workflow-format5.ts +70 -6
- package/lib/storage-postgres/dist/index.d.ts +1 -1
- package/lib/storage-postgres/dist/index.d.ts.map +1 -1
- package/lib/storage-postgres/dist/index.js.map +1 -1
- package/lib/storage-postgres/dist/postgres.d.ts +15 -0
- package/lib/storage-postgres/dist/postgres.d.ts.map +1 -1
- package/lib/storage-postgres/dist/postgres.js +18 -7
- package/lib/storage-postgres/dist/postgres.js.map +1 -1
- package/lib/storage-postgres/package.json +1 -1
- package/lib/storage-postgres/src/index.ts +1 -1
- package/lib/storage-postgres/src/postgres.ts +34 -8
- package/lib/storage-sql/dist/aggregate-session.js +1 -1
- package/lib/storage-sql/dist/aggregate-session.js.map +1 -1
- package/lib/storage-sql/dist/scheduled-database.js +1 -1
- package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
- package/lib/storage-sql/dist/workflow-tree-validation.js +1 -1
- package/lib/storage-sql/dist/workflow-tree-validation.js.map +1 -1
- package/lib/storage-sql/package.json +1 -1
- package/lib/storage-sql/src/aggregate-session.ts +1 -1
- package/lib/storage-sql/src/scheduled-database.ts +1 -1
- package/lib/storage-sql/src/workflow-tree-validation.ts +1 -1
- package/lib/storage-sqlite/dist/sqlite-database.js +4 -4
- package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -1
- package/lib/storage-sqlite/dist/sqlite-worker.js +2 -2
- package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -1
- package/lib/storage-sqlite/dist/sqlite.js +1 -1
- package/lib/storage-sqlite/dist/sqlite.js.map +1 -1
- package/lib/storage-sqlite/package.json +1 -1
- package/lib/storage-sqlite/src/sqlite-database.ts +4 -4
- package/lib/storage-sqlite/src/sqlite-worker.ts +2 -2
- package/lib/storage-sqlite/src/sqlite.ts +1 -1
- package/lib/terminal/dist/index.d.ts +92 -0
- package/lib/terminal/dist/index.d.ts.map +1 -0
- package/lib/terminal/dist/index.js +397 -0
- package/lib/terminal/dist/index.js.map +1 -0
- package/lib/terminal/package.json +5 -0
- package/lib/terminal/src/index.ts +273 -0
- package/lib/testing/dist/index.d.ts +44 -1
- package/lib/testing/dist/index.d.ts.map +1 -1
- package/lib/testing/dist/index.js +63 -10
- package/lib/testing/dist/index.js.map +1 -1
- package/lib/testing/package.json +1 -1
- package/lib/testing/src/index.ts +83 -10
- package/lib/tools/dist/index.d.ts +32 -4
- package/lib/tools/dist/index.d.ts.map +1 -1
- package/lib/tools/dist/index.js +64 -11
- package/lib/tools/dist/index.js.map +1 -1
- package/lib/tools/package.json +1 -1
- package/lib/tools/src/index.ts +74 -13
- package/lib/workflows/dist/abandoned.d.ts +15 -0
- package/lib/workflows/dist/abandoned.d.ts.map +1 -0
- package/lib/workflows/dist/abandoned.js +33 -0
- package/lib/workflows/dist/abandoned.js.map +1 -0
- package/lib/workflows/dist/agent-step.d.ts +83 -0
- package/lib/workflows/dist/agent-step.d.ts.map +1 -0
- package/lib/workflows/dist/agent-step.js +161 -0
- package/lib/workflows/dist/agent-step.js.map +1 -0
- package/lib/workflows/dist/children-runtime.js +8 -8
- package/lib/workflows/dist/children-runtime.js.map +1 -1
- package/lib/workflows/dist/composite-fleet.js +2 -2
- package/lib/workflows/dist/composite-fleet.js.map +1 -1
- package/lib/workflows/dist/composite-host.d.ts.map +1 -1
- package/lib/workflows/dist/composite-host.js +26 -2
- package/lib/workflows/dist/composite-host.js.map +1 -1
- package/lib/workflows/dist/hook-relay.js +2 -2
- package/lib/workflows/dist/hook-relay.js.map +1 -1
- package/lib/workflows/dist/index.d.ts +1 -1
- package/lib/workflows/dist/index.d.ts.map +1 -1
- package/lib/workflows/dist/index.js.map +1 -1
- package/lib/workflows/dist/leadership.js +3 -3
- package/lib/workflows/dist/leadership.js.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.d.ts +26 -4
- package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.js +31 -6
- package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
- package/lib/workflows/dist/lifecycle-fleet.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-fleet.js +9 -11
- package/lib/workflows/dist/lifecycle-fleet.js.map +1 -1
- package/lib/workflows/dist/lifecycle-host.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-host.js +26 -2
- package/lib/workflows/dist/lifecycle-host.js.map +1 -1
- package/lib/workflows/dist/lifecycle-human-transport.d.ts +22 -2
- package/lib/workflows/dist/lifecycle-human-transport.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-human-transport.js +115 -33
- package/lib/workflows/dist/lifecycle-human-transport.js.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.d.ts +62 -1
- package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.js +268 -64
- package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
- package/lib/workflows/dist/lifecycle.d.ts +6 -4
- package/lib/workflows/dist/lifecycle.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle.js +2 -0
- package/lib/workflows/dist/lifecycle.js.map +1 -1
- package/lib/workflows/dist/loop-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/loop-runtime.js +38 -26
- package/lib/workflows/dist/loop-runtime.js.map +1 -1
- package/lib/workflows/dist/migration.d.ts +1 -1
- package/lib/workflows/dist/migration.d.ts.map +1 -1
- package/lib/workflows/dist/migration.js +3 -3
- package/lib/workflows/dist/migration.js.map +1 -1
- package/lib/workflows/dist/operator-transports.d.ts +24 -2
- package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
- package/lib/workflows/dist/operator-transports.js +49 -3
- package/lib/workflows/dist/operator-transports.js.map +1 -1
- package/lib/workflows/dist/runtime.d.ts.map +1 -1
- package/lib/workflows/dist/runtime.js +34 -22
- package/lib/workflows/dist/runtime.js.map +1 -1
- package/lib/workflows/dist/saga-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/saga-runtime.js +44 -30
- package/lib/workflows/dist/saga-runtime.js.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.js +3 -3
- package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
- package/lib/workflows/dist/storage-failure.d.ts +16 -0
- package/lib/workflows/dist/storage-failure.d.ts.map +1 -0
- package/lib/workflows/dist/storage-failure.js +38 -0
- package/lib/workflows/dist/storage-failure.js.map +1 -0
- package/lib/workflows/dist/sweep-position.d.ts +22 -0
- package/lib/workflows/dist/sweep-position.d.ts.map +1 -0
- package/lib/workflows/dist/sweep-position.js +45 -0
- package/lib/workflows/dist/sweep-position.js.map +1 -0
- package/lib/workflows/dist/traces.js +2 -2
- package/lib/workflows/dist/traces.js.map +1 -1
- package/lib/workflows/dist/worker.d.ts +31 -0
- package/lib/workflows/dist/worker.d.ts.map +1 -1
- package/lib/workflows/dist/worker.js +94 -0
- package/lib/workflows/dist/worker.js.map +1 -1
- package/lib/workflows/package.json +1 -1
- package/lib/workflows/src/abandoned.ts +32 -0
- package/lib/workflows/src/agent-step.ts +199 -0
- package/lib/workflows/src/children-runtime.ts +8 -8
- package/lib/workflows/src/composite-fleet.ts +2 -2
- package/lib/workflows/src/composite-host.ts +21 -3
- package/lib/workflows/src/hook-relay.ts +2 -2
- package/lib/workflows/src/index.ts +2 -1
- package/lib/workflows/src/leadership.ts +3 -3
- package/lib/workflows/src/lifecycle-definition.ts +50 -9
- package/lib/workflows/src/lifecycle-fleet.ts +7 -8
- package/lib/workflows/src/lifecycle-host.ts +21 -5
- package/lib/workflows/src/lifecycle-human-transport.ts +110 -26
- package/lib/workflows/src/lifecycle-runtime.ts +270 -60
- package/lib/workflows/src/lifecycle.ts +7 -0
- package/lib/workflows/src/loop-runtime.ts +34 -25
- package/lib/workflows/src/migration.ts +2 -2
- package/lib/workflows/src/operator-transports.ts +48 -4
- package/lib/workflows/src/runtime.ts +28 -22
- package/lib/workflows/src/saga-runtime.ts +38 -28
- package/lib/workflows/src/scheduled-helpers.ts +3 -3
- package/lib/workflows/src/storage-failure.ts +37 -0
- package/lib/workflows/src/sweep-position.ts +52 -0
- package/lib/workflows/src/traces.ts +2 -2
- package/lib/workflows/src/worker.ts +79 -1
- package/lib/workstream/dist/humans.d.ts +7 -3
- package/lib/workstream/dist/humans.d.ts.map +1 -1
- package/lib/workstream/dist/humans.js +13 -2
- package/lib/workstream/dist/humans.js.map +1 -1
- package/lib/workstream/dist/index.js +2 -2
- package/lib/workstream/dist/index.js.map +1 -1
- package/lib/workstream/dist/timers.js +2 -2
- package/lib/workstream/dist/timers.js.map +1 -1
- package/lib/workstream/dist/webhooks.d.ts +6 -2
- package/lib/workstream/dist/webhooks.d.ts.map +1 -1
- package/lib/workstream/dist/webhooks.js +17 -7
- package/lib/workstream/dist/webhooks.js.map +1 -1
- package/lib/workstream/package.json +1 -1
- package/lib/workstream/src/humans.ts +15 -5
- package/lib/workstream/src/index.ts +2 -2
- package/lib/workstream/src/timers.ts +2 -2
- package/lib/workstream/src/webhooks.ts +21 -8
- package/llms-full.txt +9766 -0
- package/llms.txt +92 -0
- package/package.json +18 -6
|
@@ -43,7 +43,7 @@ export interface WorkflowCommandJournalOptions {
|
|
|
43
43
|
export declare function createWorkflowCommandJournal(options: WorkflowCommandJournalOptions): WorkflowCommandJournal;
|
|
44
44
|
/** Structural copies of the agent server's workflow transport records. */
|
|
45
45
|
export type WorkflowOperatorStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';
|
|
46
|
-
export type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer';
|
|
46
|
+
export type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer' | 'signal';
|
|
47
47
|
export type WorkflowOperatorStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';
|
|
48
48
|
export interface WorkflowOperatorView {
|
|
49
49
|
readonly format: 3 | 4 | 5;
|
|
@@ -125,12 +125,23 @@ export interface WorkflowOperatorTarget {
|
|
|
125
125
|
readonly childRunId: string | null;
|
|
126
126
|
readonly actorId: string;
|
|
127
127
|
}): Promise<unknown>;
|
|
128
|
+
/** Deliver a signal to the run's signal step named `signalName` (lifecycle runs). Targets without signal steps omit it. */
|
|
129
|
+
signal?(runId: string, command: WorkflowOperatorSignal): Promise<unknown>;
|
|
130
|
+
/** Whether the run's signal step named `signalName` already holds the signal `signalId`. */
|
|
131
|
+
signalled?(runId: string, command: Pick<WorkflowOperatorSignal, 'signalName' | 'signalId'>): Promise<boolean>;
|
|
128
132
|
migrate(migration: WorkflowMigration, command: MigrationCommand): Promise<{
|
|
129
133
|
readonly plan: MigrationPlan;
|
|
130
134
|
readonly snapshot?: unknown;
|
|
131
135
|
}>;
|
|
132
136
|
readonly fleet: WorkflowFleetTarget;
|
|
133
137
|
}
|
|
138
|
+
/** A signal as the operator API delivers it: the verified operator is its sender. */
|
|
139
|
+
export interface WorkflowOperatorSignal {
|
|
140
|
+
readonly signalName: string;
|
|
141
|
+
readonly signalId: string;
|
|
142
|
+
readonly value: JsonValue;
|
|
143
|
+
readonly actorId: string;
|
|
144
|
+
}
|
|
134
145
|
/** Maps the authenticated operator to the credential the runtime's `verifyHuman` accepts; without it approvals are unavailable. */
|
|
135
146
|
export type WorkflowApprovalCredential = (actorId: string) => unknown;
|
|
136
147
|
/** Format-5 lifecycle runs through the fleet runtime and its index. */
|
|
@@ -217,6 +228,14 @@ export interface WorkflowOperatorTransports {
|
|
|
217
228
|
readonly workflowPauses: {
|
|
218
229
|
pause(input: ControlInput): Promise<WorkflowOperatorResult>;
|
|
219
230
|
};
|
|
231
|
+
/** Signals for lifecycle signal steps. A run whose target has no signal steps answers `not_found`. */
|
|
232
|
+
readonly workflowSignals: {
|
|
233
|
+
deliver(input: ControlInput & {
|
|
234
|
+
readonly signalId: string;
|
|
235
|
+
readonly signalName: string;
|
|
236
|
+
readonly value: JsonValue;
|
|
237
|
+
}): Promise<WorkflowOperatorResult>;
|
|
238
|
+
};
|
|
220
239
|
readonly workflowResumes: {
|
|
221
240
|
resume(input: ControlInput): Promise<WorkflowOperatorResult>;
|
|
222
241
|
};
|
|
@@ -259,7 +278,10 @@ export interface WorkflowOperatorTransports {
|
|
|
259
278
|
}>;
|
|
260
279
|
};
|
|
261
280
|
}
|
|
262
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* Server transports (`workflowIndex`, `workflowViews`, `workflowControls`, `workflowSignals`, `workflowPauses`,
|
|
283
|
+
* `workflowResumes`, and optionally `workflowFleet` and `workflowMigrations`).
|
|
284
|
+
*/
|
|
263
285
|
export declare function createWorkflowOperatorTransports(options: WorkflowOperatorTransportOptions): WorkflowOperatorTransports;
|
|
264
286
|
export {};
|
|
265
287
|
//# sourceMappingURL=operator-transports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-transports.d.ts","sourceRoot":"","sources":["../src/operator-transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAgB,KAAK,cAAc,EAAqB,MAAM,2BAA2B,CAAC;AAEjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE5G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,E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,MAAM,EAAE,UAAU,CAAA;SAAE,CAAC,CAAC;KACvO,CAAC;IACF,QAAQ,CAAC,kBAAkB,CAAC,EAAE;QAC5B,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,SAAS,4BAA4B,EAAE,GAAG,IAAI,CAAC,CAAC;QAC/G,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;QACnH,KAAK,CAAC,KAAK,EAAE,YAAY,GAAG;YAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;YAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;YAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;SAAE,GACxK;YAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;YAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;SAAE,GAAG;YAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;SAAE,GAAG;YAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KACxI,CAAC;CACH;AACD;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,gCAAgC,GAAG,0BAA0B,CAmFtH"}
|
|
@@ -141,6 +141,14 @@ export function lifecycleOperatorTarget(options) {
|
|
|
141
141
|
const { runtime, store, scope } = options;
|
|
142
142
|
const definitions = catalog(options.definitions);
|
|
143
143
|
const scopeKey = digest('mayura:scope:v1', { principalId: scope.principalId, projectId: scope.projectId });
|
|
144
|
+
/** The registered definition a run is pinned to; NOT_FOUND when the run is missing or its version is not registered. */
|
|
145
|
+
const pinned = async (runId) => {
|
|
146
|
+
const hash = await pinnedDefinitionHash(store, scope, runId);
|
|
147
|
+
const definition = hash === undefined ? undefined : definitions.get(hash);
|
|
148
|
+
if (!definition)
|
|
149
|
+
throw new MayuraError('NOT_FOUND', 'The run was not found, or its definition version is not registered with this target.');
|
|
150
|
+
return definition;
|
|
151
|
+
};
|
|
144
152
|
return Object.freeze({ name: options.name ?? 'lifecycle',
|
|
145
153
|
async page(after, limit) {
|
|
146
154
|
// Cursor string: `<shard>` or `<shard>.<afterId>` over the 256 index shards.
|
|
@@ -192,6 +200,16 @@ export function lifecycleOperatorTarget(options) {
|
|
|
192
200
|
},
|
|
193
201
|
pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),
|
|
194
202
|
approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),
|
|
203
|
+
async signal(id, command) {
|
|
204
|
+
const definition = await pinned(id);
|
|
205
|
+
return runtime.signal(definition, { id, name: command.signalName, signalId: command.signalId, payload: command.value, actorId: command.actorId });
|
|
206
|
+
},
|
|
207
|
+
async signalled(id, command) {
|
|
208
|
+
const definition = await pinned(id);
|
|
209
|
+
const node = definition.nodes.find(candidate => candidate.kind === 'signal' && candidate.name === command.signalName);
|
|
210
|
+
const step = node ? (await runtime.inspect(id)).steps[node.id] : undefined;
|
|
211
|
+
return step?.kind === 'signal' && step.signalId === command.signalId;
|
|
212
|
+
},
|
|
195
213
|
migrate: (migration, command) => runtime.migrate(migration, command),
|
|
196
214
|
fleet: lifecycleFleetTarget(runtime, options.name ?? 'lifecycle'), });
|
|
197
215
|
}
|
|
@@ -250,7 +268,10 @@ export function treeOperatorTarget(options) {
|
|
|
250
268
|
migrate: (migration, command) => runtime.migrate(migration, command),
|
|
251
269
|
fleet: treeFleetTarget(discovery, runtime, options.name ?? 'trees'), });
|
|
252
270
|
}
|
|
253
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* Server transports (`workflowIndex`, `workflowViews`, `workflowControls`, `workflowSignals`, `workflowPauses`,
|
|
273
|
+
* `workflowResumes`, and optionally `workflowFleet` and `workflowMigrations`).
|
|
274
|
+
*/
|
|
254
275
|
export function createWorkflowOperatorTransports(options) {
|
|
255
276
|
const { targets, journal } = options;
|
|
256
277
|
if (!Array.isArray(targets) || targets.length < 1 || targets.length > 16 || new Set(targets.map(target => target.name)).size !== targets.length
|
|
@@ -274,14 +295,19 @@ export function createWorkflowOperatorTransports(options) {
|
|
|
274
295
|
};
|
|
275
296
|
const conflicts = (error) => isCode(error, 'CONFLICT') ? 'conflict' : isCode(error, 'NOT_FOUND') ? 'not_found' : undefined;
|
|
276
297
|
/** Revision-checked, journaled command. The runtimes guard state themselves; the revision check is the operator's review point. */
|
|
277
|
-
const command = async (input, action, request, observe, operate) => {
|
|
298
|
+
const command = async (input, action, request, observe, operate, happened) => {
|
|
278
299
|
if (!inScope(input))
|
|
279
300
|
return { status: 'not_found' };
|
|
280
301
|
const found = await locate(input.runId);
|
|
281
302
|
if (!found)
|
|
282
303
|
return { status: 'not_found' };
|
|
283
304
|
const { outcome } = await journal.run({ runId: input.runId, action, commandId: input.commandId, request: { revision: input.revision, request },
|
|
284
|
-
observe: async () => {
|
|
305
|
+
observe: async () => {
|
|
306
|
+
if (happened)
|
|
307
|
+
return happened();
|
|
308
|
+
const current = await found.target.view(input.runId);
|
|
309
|
+
return current !== null && observe(current);
|
|
310
|
+
},
|
|
285
311
|
apply: async () => {
|
|
286
312
|
const current = await found.target.view(input.runId);
|
|
287
313
|
if (!current)
|
|
@@ -334,6 +360,26 @@ export function createWorkflowOperatorTransports(options) {
|
|
|
334
360
|
view => input.childRunId === null && !['pending', 'waiting'].includes(view.steps.find(step => step.id === input.nodeId)?.status ?? 'pending'), target => target.approve(input.runId, { nodeId: input.nodeId, digest: input.approvalDigest, childRunId: input.childRunId, actorId: input.actorId })),
|
|
335
361
|
},
|
|
336
362
|
workflowPauses: { pause: (input) => command(input, 'pause', null, view => view.status === 'paused', target => target.pause(input.runId)) },
|
|
363
|
+
workflowSignals: { deliver: async (input) => {
|
|
364
|
+
const found = inScope(input) ? await locate(input.runId) : null;
|
|
365
|
+
if (!found?.target.signal || !found.target.signalled)
|
|
366
|
+
return { status: 'not_found' };
|
|
367
|
+
const target = found.target;
|
|
368
|
+
const signal = { signalName: input.signalName, signalId: input.signalId, value: input.value, actorId: input.actorId };
|
|
369
|
+
// Delivery is idempotent on the signal id, so an attempt that died after delivering is recognised, not repeated.
|
|
370
|
+
// A payload the step's schema refuses is answered like any refused command (conflict), not as unavailable storage.
|
|
371
|
+
const deliver = async () => {
|
|
372
|
+
try {
|
|
373
|
+
return await target.signal(input.runId, signal);
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
if (isCode(error, 'INVALID_INPUT'))
|
|
377
|
+
throw new MayuraError('CONFLICT', 'The signal payload does not match the step.');
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
return command(input, 'signal', { signalName: input.signalName, signalId: input.signalId, value: input.value }, () => false, deliver, () => target.signalled(input.runId, signal));
|
|
382
|
+
} },
|
|
337
383
|
workflowResumes: { resume: (input) => command(input, 'resume', null, view => view.status !== 'paused', async (target) => { if ((await target.view(input.runId))?.status === 'paused')
|
|
338
384
|
await target.resume(input.runId); }) },
|
|
339
385
|
...(options.fleet ? { workflowFleet: fleetTransport(options.fleet, targets.map(target => target.fleet), inScope) } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-transports.js","sourceRoot":"","sources":["../src/operator-transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAA+C,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,YAAY,EAA0C,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,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AkB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAkC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAmB,EAAE,CAAC;QACjK,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { MayuraError, jsonValue, type JsonObject, type JsonValue, type Scope } from '@mayura/core';\nimport { StorageError, type AggregateStore, type StoredRecord } from '@mayura/storage-contracts';\nimport { digest } from './definition.js';\nimport type { WorkflowFleetControl, WorkflowFleetHoldState, WorkflowFleetTarget } from './fleet-control.js';\nimport { graphFleetTarget, lifecycleFleetTarget, treeFleetTarget } from './fleet-control.js';\nimport type { WorkflowGraphDiscovery } from './graph-discovery.js';\nimport type { AnyWorkflowGraph } from './graph-definition.js';\nimport type { AnyWorkflowTree } from './children-definition.js';\nimport type { AnyWorkflowLifecycle } from './lifecycle-definition.js';\nimport type { WorkflowLifecycleFleetRuntime } from './lifecycle-fleet.js';\nimport type { WorkflowGraphRuntime } from './graphs.js';\nimport type { WorkflowTreeRuntime } from './children-runtime.js';\nimport type { WorkflowTreeDiscovery } from './children-discovery.js';\nimport type { MigrationCommand, MigrationPlan, WorkflowMigration, WorkflowMigrationCatalog } from './migration.js';\nimport { createWorkflowMigrationService, pinnedDefinitionHash, type WorkflowMigrationOfferRecord } from './migration-service.js';\n\n/*\n * Production operator adapters. They implement the agent server's workflow transports (structurally: this package does\n * not depend on the server) over the real format runtimes, so a host does not hand-write revision checks, command\n * idempotency, multi-version views or index paging.\n */\n\nexport type WorkflowCommandOutcome = 'applied' | 'conflict' | 'not_found';\n/** An outcome plus an optional small result recorded with it (at most 256 KiB), returned again on every retry. */\nexport interface WorkflowCommandResult { readonly outcome: WorkflowCommandOutcome; readonly detail?: JsonValue }\nexport interface WorkflowCommandJournal {\n /**\n * Run one operator command at most once per `commandId`. A retry with the same request returns the recorded outcome;\n * a different request under the same id is a conflict. If an earlier attempt died mid-flight, `observe` decides whether\n * its effect already happened before anything is applied again.\n */\n run(command: {\n readonly runId: string; readonly action: string; readonly commandId: string; readonly request: JsonValue;\n readonly observe: () => Promise<boolean>; readonly apply: () => Promise<WorkflowCommandResult>;\n }): Promise<WorkflowCommandResult>;\n}\nexport interface WorkflowCommandJournalOptions {\n readonly store: AggregateStore; readonly scope: Scope;\n /** How long an in-flight attempt owns its command before a retry may take over (default 60 s). */\n readonly leaseMs?: number;\n readonly now?: () => number;\n}\ninterface JournalState { format: 1; digest: string; action: string; status: 'pending' | 'completed'; attempt: number; leaseUntilMs: number; outcome: WorkflowCommandOutcome | null; detail: JsonValue }\n\nconst hashPattern = /^[a-f0-9]{64}$/;\nconst commandPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;\nconst outcomes = new Set<WorkflowCommandOutcome>(['applied', 'conflict', 'not_found']);\nconst isCode = (error: unknown, code: string): boolean => (error instanceof StorageError || error instanceof MayuraError) && error.code === code;\n\n/** Durable, aggregate-backed command journal. One small permanent record per command id. */\nexport function createWorkflowCommandJournal(options: WorkflowCommandJournalOptions): WorkflowCommandJournal {\n const { store } = options; const leaseMs = options.leaseMs ?? 60_000; const now = options.now ?? Date.now;\n if (!store || typeof store.create !== 'function' || typeof store.update !== 'function' || !Number.isSafeInteger(leaseMs) || leaseMs < 1_000 || leaseMs > 3_600_000) {\n throw new MayuraError('INVALID_CONFIG', 'A workflow command journal needs an aggregate store and a lease between 1 s and 1 h.');\n }\n const scope = digest('mayura:workflow-command-journal:v1', { principalId: options.scope?.principalId, projectId: options.scope?.projectId });\n const definitionHash = digest('mayura:workflow-command-format:v1', {});\n const decode = (record: StoredRecord): JournalState => {\n const state = record.state as unknown as JournalState;\n if (record.definitionHash !== definitionHash || state?.format !== 1 || typeof state.digest !== 'string' || !hashPattern.test(state.digest)\n || !['pending', 'completed'].includes(state.status) || !Number.isSafeInteger(state.attempt) || state.attempt < 1 || !Number.isSafeInteger(state.leaseUntilMs)\n || (state.status === 'completed') !== (state.outcome !== null && outcomes.has(state.outcome))) {\n throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored workflow command failed integrity validation.');\n }\n return state;\n };\n const write = (record: StoredRecord, state: JournalState, type: string) => store.update({ scope, id: record.id, expectedVersion: record.version,\n state: state as unknown as JsonObject, events: [{ type, data: { attempt: state.attempt, ...(state.outcome ? { outcome: state.outcome } : {}) } }] });\n return Object.freeze<WorkflowCommandJournal>({\n async run(command) {\n if (typeof command?.runId !== 'string' || !hashPattern.test(command.runId) || typeof command.action !== 'string' || !/^[a-z][a-z-]{0,31}$/.test(command.action)\n || typeof command.commandId !== 'string' || !commandPattern.test(command.commandId)) throw new MayuraError('INVALID_INPUT', 'A workflow command needs a run id, an action and a bounded command id.');\n const id = digest('mayura:workflow-command-entry:v1', { runId: command.runId, commandId: command.commandId });\n const requestDigest = digest('mayura:workflow-command-request:v1', { runId: command.runId, action: command.action, request: jsonValue(command.request, { maxBytes: 65_536 }) });\n // A failed attempt releases its lease so a retry can take over at once (after checking whether the effect happened).\n const attemptOn = async (record: StoredRecord, state: JournalState, operation: () => Promise<WorkflowCommandResult>): Promise<WorkflowCommandResult> => {\n let result: WorkflowCommandResult;\n try { result = await operation(); }\n catch (error) { await write(record, { ...state, leaseUntilMs: 0 }, 'command.released').catch(() => undefined); throw error; }\n return finish(record, state, result);\n };\n const finish = async (record: StoredRecord, state: JournalState, result: WorkflowCommandResult): Promise<WorkflowCommandResult> => {\n if (!outcomes.has(result?.outcome)) throw new MayuraError('INVALID_INPUT', 'A workflow command must report applied, conflict or not_found.');\n const detail = result.detail === undefined ? null : jsonValue(result.detail, { maxBytes: 262_144 });\n try { await write(record, { ...state, status: 'completed', outcome: result.outcome, detail }, 'command.completed'); }\n catch (error) { if (!isCode(error, 'CONFLICT')) throw error; }\n return detail === null ? { outcome: result.outcome } : { outcome: result.outcome, detail };\n };\n for (let attempt = 0; attempt < 8; attempt++) {\n const existing = await store.read(scope, id);\n if (!existing) {\n const state: JournalState = { format: 1, digest: requestDigest, action: command.action, status: 'pending', attempt: 1, leaseUntilMs: now() + leaseMs, outcome: null, detail: null };\n let created: { record: StoredRecord; created: boolean };\n try { created = await store.create({ scope, id, idempotencyKey: id, definitionHash, state: state as unknown as JsonObject, events: [{ type: 'command.claimed', data: { action: command.action } }] }); }\n catch (error) { if (isCode(error, 'CONFLICT')) continue; throw error; }\n if (!created.created) continue;\n return attemptOn(created.record, state, command.apply);\n }\n const state = decode(existing);\n if (state.digest !== requestDigest) return { outcome: 'conflict' };\n if (state.status === 'completed') return state.detail === null ? { outcome: state.outcome! } : { outcome: state.outcome!, detail: state.detail };\n // Another attempt owns the command until its lease ends; answering conflict makes the client re-read.\n if (state.leaseUntilMs > now()) return { outcome: 'conflict' };\n let taken: StoredRecord; const next: JournalState = { ...state, attempt: state.attempt + 1, leaseUntilMs: now() + leaseMs };\n try { taken = await write(existing, next, 'command.retaken'); }\n catch (error) { if (isCode(error, 'CONFLICT')) continue; throw error; }\n // The abandoned attempt may have applied its effect before dying: never apply twice.\n return attemptOn(taken, next, async () => (await command.observe()) ? { outcome: 'applied' } : command.apply());\n }\n return { outcome: 'conflict' };\n },\n });\n}\n\n/** Structural copies of the agent server's workflow transport records. */\nexport type WorkflowOperatorStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';\nexport type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer';\nexport type WorkflowOperatorStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';\nexport interface WorkflowOperatorView {\n readonly format: 3 | 4 | 5; readonly definitionId: string; readonly definitionVersion: string; readonly runId: string; readonly revision: number;\n readonly status: WorkflowOperatorStatus;\n readonly nodes: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly dependsOn: readonly string[] }[];\n readonly steps: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly status: WorkflowOperatorStepStatus; readonly childRunId?: string;\n readonly approval?: WorkflowOperatorApproval }[];\n}\n/**\n * A tool step waiting for approval: the digest to approve and when the request lapses (it is then re-requested with a\n * new digest). Targets that can reconstruct it also show the exact tool call, verified against the digest.\n */\nexport interface WorkflowOperatorApproval {\n readonly digest: string; readonly expiresAtMs: number;\n readonly subject?: { readonly toolId: string; readonly toolVersion: string; readonly input: JsonValue };\n}\nexport type WorkflowOperatorIndexRecord = Pick<WorkflowOperatorView, 'format' | 'definitionId' | 'definitionVersion' | 'runId' | 'revision' | 'status'>;\n/** A run in the settled view: finished, or with an unknown outcome that still needs reconciling. */\nexport type WorkflowOperatorSettledRecord = WorkflowOperatorIndexRecord & { readonly settledAtMs: number };\nexport type WorkflowOperatorResult = { readonly status: 'applied'; readonly workflow: WorkflowOperatorView } | { readonly status: 'conflict' } | { readonly status: 'not_found' };\ntype Result = WorkflowOperatorResult;\nexport interface WorkflowOperatorControlInput { readonly scope: Scope; readonly agentIds: readonly string[]; readonly actorId: string; readonly runId: string; readonly revision: number; readonly commandId: string; readonly signal: AbortSignal }\ntype ControlInput = WorkflowOperatorControlInput;\n\n/** One workflow format's operator surface. Build it with `lifecycleOperatorTarget`, `graphOperatorTarget` or `treeOperatorTarget`. */\nexport interface WorkflowOperatorTarget {\n readonly name: string;\n /** One page of active runs (running, waiting or paused); `after` and `next` are this target's opaque cursor strings. */\n page(after: string | null, limit: number): Promise<{ readonly items: readonly WorkflowOperatorIndexRecord[]; readonly next: string | null }>;\n /** Recently settled runs, when the target keeps them (lifecycle runs do; graph and tree runs do not yet). */\n settledPage?(after: string | null, limit: number): Promise<{ readonly items: readonly WorkflowOperatorSettledRecord[]; readonly next: string | null }>;\n /** The run projected on its pinned definition; null when this target does not own the run or its version is not registered. */\n view(runId: string): Promise<WorkflowOperatorView | null>;\n pause(runId: string): Promise<unknown>;\n resume(runId: string): Promise<unknown>;\n cancel(runId: string): Promise<unknown>;\n approve(runId: string, command: { readonly nodeId: string; readonly digest: string; readonly childRunId: string | null; readonly actorId: string }): Promise<unknown>;\n migrate(migration: WorkflowMigration, command: MigrationCommand): Promise<{ readonly plan: MigrationPlan; readonly snapshot?: unknown }>;\n readonly fleet: WorkflowFleetTarget;\n}\ninterface Registered { readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }\n/** Maps the authenticated operator to the credential the runtime's `verifyHuman` accepts; without it approvals are unavailable. */\nexport type WorkflowApprovalCredential = (actorId: string) => unknown;\n\nconst catalog = <D extends Registered>(definitions: readonly D[]): Map<string, D> => {\n if (!Array.isArray(definitions) || definitions.length < 1 || definitions.length > 256) throw new MayuraError('INVALID_CONFIG', 'An operator target needs 1–256 registered definitions.');\n return new Map(definitions.map(definition => [definition.digest, definition]));\n};\ntype Subjects = ReadonlyMap<string, NonNullable<WorkflowOperatorApproval['subject']>>;\nconst project = (format: 3 | 4 | 5, definition: Registered, snapshot: { readonly id: string; readonly version: number; readonly status: string;\n readonly steps: Readonly<Record<string, { readonly status: string; readonly child?: { readonly runId: string } | null;\n readonly approval?: unknown }>> }, subjects: Subjects = new Map()): WorkflowOperatorView => Object.freeze({\n format, definitionId: definition.id, definitionVersion: definition.version, runId: snapshot.id, revision: snapshot.version, status: snapshot.status as WorkflowOperatorStatus,\n nodes: definition.nodes.map(node => ({ id: node.id, kind: node.kind as WorkflowOperatorNodeKind, dependsOn: [...(node.dependsOn ?? [])] })),\n steps: definition.nodes.map(node => { const step = snapshot.steps[node.id]!;\n // Lifecycle and graph tool steps carry their own approval; a tree's approvals live in its child runs.\n const pending = format !== 4 && step.status === 'waiting' && step.approval ? step.approval as { readonly digest: string; readonly expiresAt: number } : null;\n const subject = pending ? subjects.get(node.id) : undefined;\n // A lifecycle step whose condition did not hold shows as skipped: it never ran.\n const status = (step.status === 'bypassed' ? 'skipped' : step.status) as WorkflowOperatorStepStatus;\n return { id: node.id, kind: node.kind as WorkflowOperatorNodeKind, status, ...(step.child?.runId ? { childRunId: step.child.runId } : {}),\n ...(pending ? { approval: { digest: pending.digest, expiresAtMs: pending.expiresAt, ...(subject ? { subject } : {}) } } : {}) }; }),\n});\nconst approval = (credential: WorkflowApprovalCredential | undefined, actorId: string): unknown => {\n if (!credential) throw new MayuraError('UNSUPPORTED_PROFILE', 'Operator approvals need an approval credential mapping.');\n return credential(actorId);\n};\nconst owned = async <T>(read: () => Promise<T>): Promise<T | null> => {\n try { return await read(); } catch (error) { if (isCode(error, 'NOT_FOUND') || isCode(error, 'CONFLICT') || isCode(error, 'INVALID_INPUT')) return null; throw error; }\n};\n\n/** Format-5 lifecycle runs through the fleet runtime and its index. */\nexport function lifecycleOperatorTarget(options: { readonly runtime: WorkflowLifecycleFleetRuntime; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowLifecycle[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, store, scope } = options; const definitions = catalog(options.definitions);\n const scopeKey = digest('mayura:scope:v1', { principalId: scope.principalId, projectId: scope.projectId });\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'lifecycle',\n async page(after, limit) {\n // Cursor string: `<shard>` or `<shard>.<afterId>` over the 256 index shards.\n const match = after === null ? null : /^(\\d{1,3})(?:\\.([a-f0-9]{64}))?$/.exec(after);\n if (after !== null && (!match || Number(match[1]) > 255)) throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle index cursor.');\n const page = await runtime.scan({ cursor: match ? { format: 1, scope: scopeKey, shard: Number(match[1]), afterId: match[2] ?? '' } : null, limit: Math.min(limit, 128), maxShardReads: 256 });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.definitionHash); return definition\n ? [{ format: 5 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.runId, revision: candidate.version, status: candidate.status }] : []; });\n const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;\n return { items, next };\n },\n async settledPage(after, limit) {\n const match = after === null ? null : /^(\\d{1,3})(?:\\.([a-f0-9]{64}))?$/.exec(after);\n if (after !== null && (!match || Number(match[1]) > 255)) throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle settled cursor.');\n const page = await runtime.settled({ cursor: match ? { format: 1, scope: scopeKey, shard: Number(match[1]), afterId: match[2] ?? '' } : null, limit: Math.min(limit, 128), maxShardReads: 256 });\n const items = page.entries.flatMap(entry => { const definition = definitions.get(entry.definitionHash); return definition\n ? [{ format: 5 as const, definitionId: definition.id, definitionVersion: definition.version, runId: entry.runId, revision: entry.version, status: entry.status, settledAtMs: entry.settledAtMs }] : []; });\n const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;\n return { items, next };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n if (!snapshot) return null;\n // Show each pending approval's exact tool call; the runtime verifies it reproduces the approval digest.\n const subjects = new Map<string, NonNullable<WorkflowOperatorApproval['subject']>>();\n for (const [nodeId, step] of Object.entries(snapshot.steps)) {\n if (step.kind !== 'tool' || step.status !== 'waiting' || !step.approval) continue;\n const request = await owned(() => runtime.approvalRequest(definition, runId, nodeId));\n // A large input is left out rather than truncated; the digest still identifies exactly what is approved.\n if (request && request.digest === step.approval.digest && Buffer.byteLength(JSON.stringify(request.input), 'utf8') <= 8_192) {\n subjects.set(nodeId, { toolId: request.toolId, toolVersion: request.toolVersion, input: request.input });\n }\n }\n return project(5, definition, snapshot, subjects);\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: lifecycleFleetTarget(runtime, options.name ?? 'lifecycle'),\n });\n}\n\n/** Format-3 graph runs through discovery and the graph runtime. */\nexport function graphOperatorTarget(options: { readonly runtime: WorkflowGraphRuntime; readonly discovery: WorkflowGraphDiscovery; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowGraph[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, discovery, store, scope } = options; const definitions = catalog(options.definitions);\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'graphs',\n async page(after, limit) {\n const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.reference.definitionHash); return definition\n ? [{ format: 3 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.reference.runId, revision: candidate.version, status: candidate.status }] : []; });\n return { items, next: page.nextCursor ? page.nextCursor.afterId : null };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n return snapshot ? project(3, definition, snapshot) : null;\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: graphFleetTarget(discovery, runtime, options.name ?? 'graphs'),\n });\n}\n\n/** Format-4 workflow trees through discovery and the tree runtime. */\nexport function treeOperatorTarget(options: { readonly runtime: WorkflowTreeRuntime; readonly discovery: WorkflowTreeDiscovery; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowTree[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, discovery, store, scope } = options; const definitions = catalog(options.definitions);\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'trees',\n async page(after, limit) {\n const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.definitionHash); return definition\n ? [{ format: 4 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.rootId, revision: candidate.version, status: candidate.status }] : []; });\n return { items, next: page.nextCursor ? page.nextCursor.afterId : null };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n return snapshot ? project(4, definition, snapshot) : null;\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, ...(command.childRunId ? { childId: command.childRunId } : {}), nodeId: command.nodeId, digest: command.digest,\n credential: approval(options.approvalCredential, command.actorId) }),\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: treeFleetTarget(discovery, runtime, options.name ?? 'trees'),\n });\n}\n\nexport interface WorkflowOperatorTransportOptions {\n readonly targets: readonly WorkflowOperatorTarget[];\n readonly journal: WorkflowCommandJournal;\n readonly fleet?: WorkflowFleetControl;\n readonly migrations?: WorkflowMigrationCatalog;\n readonly store: AggregateStore;\n /** The one scope these transports serve. Requests authenticated for any other scope see nothing and change nothing. */\n readonly scope: Scope;\n}\ntype ScopedInput = { readonly scope: Scope };\n/** One run's outcome in a fleet sweep page (a structural copy of the server's sweep record). */\nexport type WorkflowOperatorFleetSweepOutcome =\n | { readonly target: string; readonly runId: string;\n readonly outcome: 'paused' | 'already_paused' | 'terminal' | 'busy' | 'resumed' | 'not_paused' | 'missing' | 'unregistered' }\n | { readonly target: string; readonly runId: string; readonly outcome: 'failed'; readonly code: string };\ntype FleetSweep = { readonly outcomes: readonly WorkflowOperatorFleetSweepOutcome[]; readonly nextCursor: JsonObject | null };\n/** Structurally the agent server's workflow transport options: spread it into the server options. */\nexport interface WorkflowOperatorTransports {\n readonly workflowIndex: { list(input: ScopedInput & { readonly after: string | null; readonly limit: number; readonly view?: 'settled' }): Promise<{ readonly items: readonly WorkflowOperatorIndexRecord[]; readonly next: string | null }> };\n readonly workflowViews: { inspect(input: ScopedInput & { readonly runId: string }): Promise<WorkflowOperatorView | null> };\n readonly workflowControls: {\n cancel(input: ControlInput): Promise<WorkflowOperatorResult>;\n approve(input: ControlInput & { readonly nodeId: string; readonly approvalDigest: string; readonly childRunId: string | null }): Promise<WorkflowOperatorResult>;\n };\n readonly workflowPauses: { pause(input: ControlInput): Promise<WorkflowOperatorResult> };\n readonly workflowResumes: { resume(input: ControlInput): Promise<WorkflowOperatorResult> };\n readonly workflowFleet?: {\n inspect(input: ScopedInput): Promise<WorkflowFleetHoldState>; hold(input: ScopedInput): Promise<WorkflowFleetHoldState>; release(input: ScopedInput): Promise<WorkflowFleetHoldState>;\n sweep(input: ScopedInput & { readonly phase: 'pause' | 'resume'; readonly cursor: JsonObject | null; readonly limit: number }): Promise<{ readonly status: 'applied'; readonly sweep: FleetSweep } | { readonly status: 'conflict' }>;\n };\n readonly workflowMigrations?: {\n list(input: ScopedInput & { readonly runId: string }): Promise<readonly WorkflowMigrationOfferRecord[] | null>;\n plan(input: ScopedInput & { readonly runId: string; readonly migrationId: string }): Promise<MigrationPlan | null>;\n apply(input: ControlInput & { readonly migrationId: string }): Promise<{ readonly status: 'applied'; readonly plan: MigrationPlan; readonly workflow: WorkflowOperatorView }\n | { readonly status: 'refused'; readonly plan: MigrationPlan } | { readonly status: 'conflict' } | { readonly status: 'not_found' }>;\n };\n}\n/** Server transports (`workflowIndex`, `workflowViews`, `workflowControls`, `workflowPauses`, `workflowResumes`, and optionally `workflowFleet` and `workflowMigrations`). */\nexport function createWorkflowOperatorTransports(options: WorkflowOperatorTransportOptions): WorkflowOperatorTransports {\n const { targets, journal } = options;\n if (!Array.isArray(targets) || targets.length < 1 || targets.length > 16 || new Set(targets.map(target => target.name)).size !== targets.length\n || targets.some(target => !/^[a-z][a-z0-9-]{0,31}$/.test(target.name)) || !journal || typeof journal.run !== 'function') {\n throw new MayuraError('INVALID_CONFIG', 'Operator transports need 1–16 uniquely named targets and a command journal.');\n }\n if (!options.store || typeof options.store.read !== 'function' || typeof options.scope?.principalId !== 'string' || typeof options.scope.projectId !== 'string') {\n throw new MayuraError('INVALID_CONFIG', 'Operator transports need the store and the scope they serve.');\n }\n const served = options.scope;\n const inScope = (input: { readonly scope?: Scope }): boolean => input?.scope?.principalId === served.principalId && input.scope.projectId === served.projectId;\n const locate = async (runId: string): Promise<{ target: WorkflowOperatorTarget; view: WorkflowOperatorView } | null> => {\n if (!hashPattern.test(runId)) return null;\n for (const target of targets) { const view = await target.view(runId); if (view) return { target, view }; }\n return null;\n };\n const conflicts = (error: unknown): WorkflowCommandOutcome | undefined => isCode(error, 'CONFLICT') ? 'conflict' : isCode(error, 'NOT_FOUND') ? 'not_found' : undefined;\n /** Revision-checked, journaled command. The runtimes guard state themselves; the revision check is the operator's review point. */\n const command = async (input: ControlInput, action: string, request: JsonValue, observe: (view: WorkflowOperatorView) => boolean,\n operate: (target: WorkflowOperatorTarget) => Promise<unknown>): Promise<Result> => {\n if (!inScope(input)) return { status: 'not_found' };\n const found = await locate(input.runId); if (!found) return { status: 'not_found' };\n const { outcome } = await journal.run({ runId: input.runId, action, commandId: input.commandId, request: { revision: input.revision, request },\n observe: async () => { const current = await found.target.view(input.runId); return current !== null && observe(current); },\n apply: async () => {\n const current = await found.target.view(input.runId); if (!current) return { outcome: 'not_found' };\n if (current.revision !== input.revision) return { outcome: 'conflict' };\n try { await operate(found.target); return { outcome: 'applied' }; } catch (error) { const mapped = conflicts(error); if (mapped) return { outcome: mapped }; throw error; }\n } });\n if (outcome !== 'applied') return { status: outcome };\n const workflow = await found.target.view(input.runId);\n return workflow ? { status: 'applied', workflow } : { status: 'not_found' };\n };\n const decode = (after: string | null): { index: number; inner: string | null } => {\n if (after === null) return { index: 0, inner: null };\n const match = /^(\\d{1,2}):(-|[A-Za-z0-9.]{1,124})$/.exec(after);\n if (!match || Number(match[1]) >= targets.length) throw new MayuraError('INVALID_INPUT', 'Invalid workflow index cursor.');\n return { index: Number(match[1]), inner: match[2] === '-' ? null : match[2]! };\n };\n const transports = {\n workflowIndex: { list: async (input: { readonly scope: Scope; readonly after: string | null; readonly limit: number; readonly view?: 'settled' }) => {\n if (!inScope(input)) return { items: [], next: null };\n // One target per page: a short page is normal and the cursor moves on to the next format. The settled view\n // reads only targets that keep settled runs.\n const settled = input.view === 'settled'; const { index, inner } = decode(input.after); const target = targets[index]!;\n const page = !settled ? await target.page(inner, input.limit) : target.settledPage ? await target.settledPage(inner, input.limit) : { items: [], next: null };\n const following = targets.findIndex((candidate, position) => position > index && (!settled || candidate.settledPage !== undefined));\n const next = page.next !== null ? `${index}:${page.next}` : following >= 0 ? `${following}:-` : null;\n return { items: page.items.slice(0, input.limit), next };\n } },\n workflowViews: { inspect: async (input: { readonly scope: Scope; readonly runId: string }) => inScope(input) ? (await locate(input.runId))?.view ?? null : null },\n workflowControls: {\n cancel: (input: ControlInput) => command(input, 'cancel', null, view => view.status === 'cancelled', target => target.cancel(input.runId)),\n approve: (input: ControlInput & { readonly nodeId: string; readonly approvalDigest: string; readonly childRunId: string | null }) =>\n command(input, 'approve', { nodeId: input.nodeId, approvalDigest: input.approvalDigest, childRunId: input.childRunId },\n // A child's approval is not visible on the root view; re-applying it is safe because approvals are digest-bound.\n view => input.childRunId === null && !['pending', 'waiting'].includes(view.steps.find(step => step.id === input.nodeId)?.status ?? 'pending'),\n target => target.approve(input.runId, { nodeId: input.nodeId, digest: input.approvalDigest, childRunId: input.childRunId, actorId: input.actorId })),\n },\n workflowPauses: { pause: (input: ControlInput) => command(input, 'pause', null, view => view.status === 'paused', target => target.pause(input.runId)) },\n workflowResumes: { resume: (input: ControlInput) => command(input, 'resume', null, view => view.status !== 'paused',\n async target => { if ((await target.view(input.runId))?.status === 'paused') await target.resume(input.runId); }) },\n ...(options.fleet ? { workflowFleet: fleetTransport(options.fleet, targets.map(target => target.fleet), inScope) } : {}),\n ...(options.migrations ? { workflowMigrations: migrationTransport(options.migrations, options.store, served, locate, journal, inScope) } : {}),\n };\n return Object.freeze(transports);\n}\n\nfunction fleetTransport(fleet: WorkflowFleetControl, targets: readonly WorkflowFleetTarget[], inScope: (input: { readonly scope?: Scope }) => boolean) {\n const guard = (input: { readonly scope?: Scope }): void => { if (!inScope(input)) throw new MayuraError('PERMISSION_DENIED', 'This fleet belongs to another scope.'); };\n return {\n inspect: async (input: { readonly scope: Scope }) => { guard(input); return fleet.inspect(); },\n hold: async (input: { readonly scope: Scope }) => { guard(input); return fleet.hold(); },\n release: async (input: { readonly scope: Scope }) => { guard(input); return fleet.release(); },\n sweep: async (input: { readonly scope: Scope; readonly phase: 'pause' | 'resume'; readonly cursor: JsonObject | null; readonly limit: number }) => {\n guard(input);\n try {\n const sweep = input.phase === 'pause' ? await fleet.sweepPause(targets, { cursor: input.cursor as never, limit: input.limit })\n : await fleet.sweepResume(targets, { cursor: input.cursor as never, limit: input.limit });\n return { status: 'applied' as const, sweep: sweep as unknown as FleetSweep };\n } catch (error) { if (isCode(error, 'CONFLICT')) return { status: 'conflict' as const }; throw error; }\n },\n };\n}\n\nfunction migrationTransport(catalogue: WorkflowMigrationCatalog, store: AggregateStore, scope: Scope,\n locate: (runId: string) => Promise<{ target: WorkflowOperatorTarget; view: WorkflowOperatorView } | null>, journal: WorkflowCommandJournal,\n inScope: (input: { readonly scope?: Scope }) => boolean) {\n const service = async (runId: string) => {\n const found = await locate(runId); if (!found) return null;\n return { found, service: createWorkflowMigrationService({ catalog: catalogue, pinned: id => pinnedDefinitionHash(store, scope, id),\n inspect: async id => ({ version: (await found.target.view(id))?.revision ?? -1 }), migrate: (migration, command) => found.target.migrate(migration, command) as never }) };\n };\n return {\n list: async (input: { readonly scope: Scope; readonly runId: string }): Promise<readonly WorkflowMigrationOfferRecord[] | null> =>\n inScope(input) ? (await service(input.runId))?.service.list(input.runId) ?? null : null,\n plan: async (input: { readonly scope: Scope; readonly runId: string; readonly migrationId: string }): Promise<MigrationPlan | null> =>\n inScope(input) ? (await service(input.runId))?.service.plan(input.runId, input.migrationId) ?? null : null,\n apply: async (input: ControlInput & { readonly migrationId: string }) => {\n const resolved = inScope(input) ? await service(input.runId) : null; if (!resolved) return { status: 'not_found' as const };\n let refused: MigrationPlan | undefined;\n const target = (catalogue.get(input.migrationId)?.to as { readonly digest?: string } | undefined)?.digest;\n const result = await journal.run({ runId: input.runId, action: 'migrate', commandId: input.commandId, request: { revision: input.revision, migrationId: input.migrationId },\n observe: async () => target !== undefined && (await pinnedDefinitionHash(store, scope, input.runId)) === target,\n apply: async () => {\n const applied = await resolved.service.apply(input.runId, input.migrationId, { revision: input.revision, actorId: input.actorId, commandId: input.commandId });\n if (applied.status === 'refused') { refused = applied.plan; return { outcome: 'conflict' }; }\n // The applied plan is recorded with the command, so a retry reports the same plan.\n return applied.status === 'applied' ? { outcome: 'applied', detail: applied.plan as unknown as JsonValue } : { outcome: applied.status };\n } });\n if (refused) return { status: 'refused' as const, plan: refused };\n if (result.outcome !== 'applied') return { status: result.outcome };\n const workflow = (await locate(input.runId))?.view;\n // Recovered after a crash without a recorded plan: the migration applied, but the operator must re-read the run.\n return workflow && result.detail ? { status: 'applied' as const, plan: result.detail as unknown as MigrationPlan, workflow } : { status: 'conflict' as const };\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"operator-transports.js","sourceRoot":"","sources":["../src/operator-transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAA+C,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,YAAY,EAA0C,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA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QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;YACnD,iHAAiH;YACjH,OAAO,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAkB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAkC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAmB,EAAE,CAAC;QACjK,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { MayuraError, jsonValue, type JsonObject, type JsonValue, type Scope } from '@mayura/core';\nimport { StorageError, type AggregateStore, type StoredRecord } from '@mayura/storage-contracts';\nimport { digest } from './definition.js';\nimport type { WorkflowFleetControl, WorkflowFleetHoldState, WorkflowFleetTarget } from './fleet-control.js';\nimport { graphFleetTarget, lifecycleFleetTarget, treeFleetTarget } from './fleet-control.js';\nimport type { WorkflowGraphDiscovery } from './graph-discovery.js';\nimport type { AnyWorkflowGraph } from './graph-definition.js';\nimport type { AnyWorkflowTree } from './children-definition.js';\nimport type { AnyWorkflowLifecycle } from './lifecycle-definition.js';\nimport type { WorkflowLifecycleFleetRuntime } from './lifecycle-fleet.js';\nimport type { WorkflowGraphRuntime } from './graphs.js';\nimport type { WorkflowTreeRuntime } from './children-runtime.js';\nimport type { WorkflowTreeDiscovery } from './children-discovery.js';\nimport type { MigrationCommand, MigrationPlan, WorkflowMigration, WorkflowMigrationCatalog } from './migration.js';\nimport { createWorkflowMigrationService, pinnedDefinitionHash, type WorkflowMigrationOfferRecord } from './migration-service.js';\n\n/*\n * Production operator adapters. They implement the agent server's workflow transports (structurally: this package does\n * not depend on the server) over the real format runtimes, so a host does not hand-write revision checks, command\n * idempotency, multi-version views or index paging.\n */\n\nexport type WorkflowCommandOutcome = 'applied' | 'conflict' | 'not_found';\n/** An outcome plus an optional small result recorded with it (at most 256 KiB), returned again on every retry. */\nexport interface WorkflowCommandResult { readonly outcome: WorkflowCommandOutcome; readonly detail?: JsonValue }\nexport interface WorkflowCommandJournal {\n /**\n * Run one operator command at most once per `commandId`. A retry with the same request returns the recorded outcome;\n * a different request under the same id is a conflict. If an earlier attempt died mid-flight, `observe` decides whether\n * its effect already happened before anything is applied again.\n */\n run(command: {\n readonly runId: string; readonly action: string; readonly commandId: string; readonly request: JsonValue;\n readonly observe: () => Promise<boolean>; readonly apply: () => Promise<WorkflowCommandResult>;\n }): Promise<WorkflowCommandResult>;\n}\nexport interface WorkflowCommandJournalOptions {\n readonly store: AggregateStore; readonly scope: Scope;\n /** How long an in-flight attempt owns its command before a retry may take over (default 60 s). */\n readonly leaseMs?: number;\n readonly now?: () => number;\n}\ninterface JournalState { format: 1; digest: string; action: string; status: 'pending' | 'completed'; attempt: number; leaseUntilMs: number; outcome: WorkflowCommandOutcome | null; detail: JsonValue }\n\nconst hashPattern = /^[a-f0-9]{64}$/;\nconst commandPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;\nconst outcomes = new Set<WorkflowCommandOutcome>(['applied', 'conflict', 'not_found']);\nconst isCode = (error: unknown, code: string): boolean => (error instanceof StorageError || error instanceof MayuraError) && error.code === code;\n\n/** Durable, aggregate-backed command journal. One small permanent record per command id. */\nexport function createWorkflowCommandJournal(options: WorkflowCommandJournalOptions): WorkflowCommandJournal {\n const { store } = options; const leaseMs = options.leaseMs ?? 60_000; const now = options.now ?? Date.now;\n if (!store || typeof store.create !== 'function' || typeof store.update !== 'function' || !Number.isSafeInteger(leaseMs) || leaseMs < 1_000 || leaseMs > 3_600_000) {\n throw new MayuraError('INVALID_CONFIG', 'A workflow command journal needs an aggregate store and a lease between 1 s and 1 h.');\n }\n const scope = digest('mayura:workflow-command-journal:v1', { principalId: options.scope?.principalId, projectId: options.scope?.projectId });\n const definitionHash = digest('mayura:workflow-command-format:v1', {});\n const decode = (record: StoredRecord): JournalState => {\n const state = record.state as unknown as JournalState;\n if (record.definitionHash !== definitionHash || state?.format !== 1 || typeof state.digest !== 'string' || !hashPattern.test(state.digest)\n || !['pending', 'completed'].includes(state.status) || !Number.isSafeInteger(state.attempt) || state.attempt < 1 || !Number.isSafeInteger(state.leaseUntilMs)\n || (state.status === 'completed') !== (state.outcome !== null && outcomes.has(state.outcome))) {\n throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored workflow command failed integrity validation.');\n }\n return state;\n };\n const write = (record: StoredRecord, state: JournalState, type: string) => store.update({ scope, id: record.id, expectedVersion: record.version,\n state: state as unknown as JsonObject, events: [{ type, data: { attempt: state.attempt, ...(state.outcome ? { outcome: state.outcome } : {}) } }] });\n return Object.freeze<WorkflowCommandJournal>({\n async run(command) {\n if (typeof command?.runId !== 'string' || !hashPattern.test(command.runId) || typeof command.action !== 'string' || !/^[a-z][a-z-]{0,31}$/.test(command.action)\n || typeof command.commandId !== 'string' || !commandPattern.test(command.commandId)) throw new MayuraError('INVALID_INPUT', 'A workflow command needs a run id, an action and a bounded command id.');\n const id = digest('mayura:workflow-command-entry:v1', { runId: command.runId, commandId: command.commandId });\n const requestDigest = digest('mayura:workflow-command-request:v1', { runId: command.runId, action: command.action, request: jsonValue(command.request, { maxBytes: 65_536 }) });\n // A failed attempt releases its lease so a retry can take over at once (after checking whether the effect happened).\n const attemptOn = async (record: StoredRecord, state: JournalState, operation: () => Promise<WorkflowCommandResult>): Promise<WorkflowCommandResult> => {\n let result: WorkflowCommandResult;\n try { result = await operation(); }\n catch (error) { await write(record, { ...state, leaseUntilMs: 0 }, 'command.released').catch(() => undefined); throw error; }\n return finish(record, state, result);\n };\n const finish = async (record: StoredRecord, state: JournalState, result: WorkflowCommandResult): Promise<WorkflowCommandResult> => {\n if (!outcomes.has(result?.outcome)) throw new MayuraError('INVALID_INPUT', 'A workflow command must report applied, conflict or not_found.');\n const detail = result.detail === undefined ? null : jsonValue(result.detail, { maxBytes: 262_144 });\n try { await write(record, { ...state, status: 'completed', outcome: result.outcome, detail }, 'command.completed'); }\n catch (error) { if (!isCode(error, 'CONFLICT')) throw error; }\n return detail === null ? { outcome: result.outcome } : { outcome: result.outcome, detail };\n };\n for (let attempt = 0; attempt < 8; attempt++) {\n const existing = await store.read(scope, id);\n if (!existing) {\n const state: JournalState = { format: 1, digest: requestDigest, action: command.action, status: 'pending', attempt: 1, leaseUntilMs: now() + leaseMs, outcome: null, detail: null };\n let created: { record: StoredRecord; created: boolean };\n try { created = await store.create({ scope, id, idempotencyKey: id, definitionHash, state: state as unknown as JsonObject, events: [{ type: 'command.claimed', data: { action: command.action } }] }); }\n catch (error) { if (isCode(error, 'CONFLICT')) continue; throw error; }\n if (!created.created) continue;\n return attemptOn(created.record, state, command.apply);\n }\n const state = decode(existing);\n if (state.digest !== requestDigest) return { outcome: 'conflict' };\n if (state.status === 'completed') return state.detail === null ? { outcome: state.outcome! } : { outcome: state.outcome!, detail: state.detail };\n // Another attempt owns the command until its lease ends; answering conflict makes the client re-read.\n if (state.leaseUntilMs > now()) return { outcome: 'conflict' };\n let taken: StoredRecord; const next: JournalState = { ...state, attempt: state.attempt + 1, leaseUntilMs: now() + leaseMs };\n try { taken = await write(existing, next, 'command.retaken'); }\n catch (error) { if (isCode(error, 'CONFLICT')) continue; throw error; }\n // The abandoned attempt may have applied its effect before dying: never apply twice.\n return attemptOn(taken, next, async () => (await command.observe()) ? { outcome: 'applied' } : command.apply());\n }\n return { outcome: 'conflict' };\n },\n });\n}\n\n/** Structural copies of the agent server's workflow transport records. */\nexport type WorkflowOperatorStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';\nexport type WorkflowOperatorNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer' | 'signal';\nexport type WorkflowOperatorStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';\nexport interface WorkflowOperatorView {\n readonly format: 3 | 4 | 5; readonly definitionId: string; readonly definitionVersion: string; readonly runId: string; readonly revision: number;\n readonly status: WorkflowOperatorStatus;\n readonly nodes: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly dependsOn: readonly string[] }[];\n readonly steps: readonly { readonly id: string; readonly kind: WorkflowOperatorNodeKind; readonly status: WorkflowOperatorStepStatus; readonly childRunId?: string;\n readonly approval?: WorkflowOperatorApproval }[];\n}\n/**\n * A tool step waiting for approval: the digest to approve and when the request lapses (it is then re-requested with a\n * new digest). Targets that can reconstruct it also show the exact tool call, verified against the digest.\n */\nexport interface WorkflowOperatorApproval {\n readonly digest: string; readonly expiresAtMs: number;\n readonly subject?: { readonly toolId: string; readonly toolVersion: string; readonly input: JsonValue };\n}\nexport type WorkflowOperatorIndexRecord = Pick<WorkflowOperatorView, 'format' | 'definitionId' | 'definitionVersion' | 'runId' | 'revision' | 'status'>;\n/** A run in the settled view: finished, or with an unknown outcome that still needs reconciling. */\nexport type WorkflowOperatorSettledRecord = WorkflowOperatorIndexRecord & { readonly settledAtMs: number };\nexport type WorkflowOperatorResult = { readonly status: 'applied'; readonly workflow: WorkflowOperatorView } | { readonly status: 'conflict' } | { readonly status: 'not_found' };\ntype Result = WorkflowOperatorResult;\nexport interface WorkflowOperatorControlInput { readonly scope: Scope; readonly agentIds: readonly string[]; readonly actorId: string; readonly runId: string; readonly revision: number; readonly commandId: string; readonly signal: AbortSignal }\ntype ControlInput = WorkflowOperatorControlInput;\n\n/** One workflow format's operator surface. Build it with `lifecycleOperatorTarget`, `graphOperatorTarget` or `treeOperatorTarget`. */\nexport interface WorkflowOperatorTarget {\n readonly name: string;\n /** One page of active runs (running, waiting or paused); `after` and `next` are this target's opaque cursor strings. */\n page(after: string | null, limit: number): Promise<{ readonly items: readonly WorkflowOperatorIndexRecord[]; readonly next: string | null }>;\n /** Recently settled runs, when the target keeps them (lifecycle runs do; graph and tree runs do not yet). */\n settledPage?(after: string | null, limit: number): Promise<{ readonly items: readonly WorkflowOperatorSettledRecord[]; readonly next: string | null }>;\n /** The run projected on its pinned definition; null when this target does not own the run or its version is not registered. */\n view(runId: string): Promise<WorkflowOperatorView | null>;\n pause(runId: string): Promise<unknown>;\n resume(runId: string): Promise<unknown>;\n cancel(runId: string): Promise<unknown>;\n approve(runId: string, command: { readonly nodeId: string; readonly digest: string; readonly childRunId: string | null; readonly actorId: string }): Promise<unknown>;\n /** Deliver a signal to the run's signal step named `signalName` (lifecycle runs). Targets without signal steps omit it. */\n signal?(runId: string, command: WorkflowOperatorSignal): Promise<unknown>;\n /** Whether the run's signal step named `signalName` already holds the signal `signalId`. */\n signalled?(runId: string, command: Pick<WorkflowOperatorSignal, 'signalName' | 'signalId'>): Promise<boolean>;\n migrate(migration: WorkflowMigration, command: MigrationCommand): Promise<{ readonly plan: MigrationPlan; readonly snapshot?: unknown }>;\n readonly fleet: WorkflowFleetTarget;\n}\n/** A signal as the operator API delivers it: the verified operator is its sender. */\nexport interface WorkflowOperatorSignal { readonly signalName: string; readonly signalId: string; readonly value: JsonValue; readonly actorId: string }\ninterface Registered { readonly id: string; readonly version: string; readonly digest: string; readonly nodes: readonly { readonly id: string; readonly kind: string; readonly dependsOn?: readonly string[] }[] }\n/** Maps the authenticated operator to the credential the runtime's `verifyHuman` accepts; without it approvals are unavailable. */\nexport type WorkflowApprovalCredential = (actorId: string) => unknown;\n\nconst catalog = <D extends Registered>(definitions: readonly D[]): Map<string, D> => {\n if (!Array.isArray(definitions) || definitions.length < 1 || definitions.length > 256) throw new MayuraError('INVALID_CONFIG', 'An operator target needs 1–256 registered definitions.');\n return new Map(definitions.map(definition => [definition.digest, definition]));\n};\ntype Subjects = ReadonlyMap<string, NonNullable<WorkflowOperatorApproval['subject']>>;\nconst project = (format: 3 | 4 | 5, definition: Registered, snapshot: { readonly id: string; readonly version: number; readonly status: string;\n readonly steps: Readonly<Record<string, { readonly status: string; readonly child?: { readonly runId: string } | null;\n readonly approval?: unknown }>> }, subjects: Subjects = new Map()): WorkflowOperatorView => Object.freeze({\n format, definitionId: definition.id, definitionVersion: definition.version, runId: snapshot.id, revision: snapshot.version, status: snapshot.status as WorkflowOperatorStatus,\n nodes: definition.nodes.map(node => ({ id: node.id, kind: node.kind as WorkflowOperatorNodeKind, dependsOn: [...(node.dependsOn ?? [])] })),\n steps: definition.nodes.map(node => { const step = snapshot.steps[node.id]!;\n // Lifecycle and graph tool steps carry their own approval; a tree's approvals live in its child runs.\n const pending = format !== 4 && step.status === 'waiting' && step.approval ? step.approval as { readonly digest: string; readonly expiresAt: number } : null;\n const subject = pending ? subjects.get(node.id) : undefined;\n // A lifecycle step whose condition did not hold shows as skipped: it never ran.\n const status = (step.status === 'bypassed' ? 'skipped' : step.status) as WorkflowOperatorStepStatus;\n return { id: node.id, kind: node.kind as WorkflowOperatorNodeKind, status, ...(step.child?.runId ? { childRunId: step.child.runId } : {}),\n ...(pending ? { approval: { digest: pending.digest, expiresAtMs: pending.expiresAt, ...(subject ? { subject } : {}) } } : {}) }; }),\n});\nconst approval = (credential: WorkflowApprovalCredential | undefined, actorId: string): unknown => {\n if (!credential) throw new MayuraError('UNSUPPORTED_PROFILE', 'Operator approvals need an approval credential mapping.');\n return credential(actorId);\n};\nconst owned = async <T>(read: () => Promise<T>): Promise<T | null> => {\n try { return await read(); } catch (error) { if (isCode(error, 'NOT_FOUND') || isCode(error, 'CONFLICT') || isCode(error, 'INVALID_INPUT')) return null; throw error; }\n};\n\n/** Format-5 lifecycle runs through the fleet runtime and its index. */\nexport function lifecycleOperatorTarget(options: { readonly runtime: WorkflowLifecycleFleetRuntime; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowLifecycle[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, store, scope } = options; const definitions = catalog(options.definitions);\n const scopeKey = digest('mayura:scope:v1', { principalId: scope.principalId, projectId: scope.projectId });\n /** The registered definition a run is pinned to; NOT_FOUND when the run is missing or its version is not registered. */\n const pinned = async (runId: string): Promise<AnyWorkflowLifecycle> => {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) throw new MayuraError('NOT_FOUND', 'The run was not found, or its definition version is not registered with this target.');\n return definition;\n };\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'lifecycle',\n async page(after, limit) {\n // Cursor string: `<shard>` or `<shard>.<afterId>` over the 256 index shards.\n const match = after === null ? null : /^(\\d{1,3})(?:\\.([a-f0-9]{64}))?$/.exec(after);\n if (after !== null && (!match || Number(match[1]) > 255)) throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle index cursor.');\n const page = await runtime.scan({ cursor: match ? { format: 1, scope: scopeKey, shard: Number(match[1]), afterId: match[2] ?? '' } : null, limit: Math.min(limit, 128), maxShardReads: 256 });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.definitionHash); return definition\n ? [{ format: 5 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.runId, revision: candidate.version, status: candidate.status }] : []; });\n const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;\n return { items, next };\n },\n async settledPage(after, limit) {\n const match = after === null ? null : /^(\\d{1,3})(?:\\.([a-f0-9]{64}))?$/.exec(after);\n if (after !== null && (!match || Number(match[1]) > 255)) throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle settled cursor.');\n const page = await runtime.settled({ cursor: match ? { format: 1, scope: scopeKey, shard: Number(match[1]), afterId: match[2] ?? '' } : null, limit: Math.min(limit, 128), maxShardReads: 256 });\n const items = page.entries.flatMap(entry => { const definition = definitions.get(entry.definitionHash); return definition\n ? [{ format: 5 as const, definitionId: definition.id, definitionVersion: definition.version, runId: entry.runId, revision: entry.version, status: entry.status, settledAtMs: entry.settledAtMs }] : []; });\n const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;\n return { items, next };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n if (!snapshot) return null;\n // Show each pending approval's exact tool call; the runtime verifies it reproduces the approval digest.\n const subjects = new Map<string, NonNullable<WorkflowOperatorApproval['subject']>>();\n for (const [nodeId, step] of Object.entries(snapshot.steps)) {\n if (step.kind !== 'tool' || step.status !== 'waiting' || !step.approval) continue;\n const request = await owned(() => runtime.approvalRequest(definition, runId, nodeId));\n // A large input is left out rather than truncated; the digest still identifies exactly what is approved.\n if (request && request.digest === step.approval.digest && Buffer.byteLength(JSON.stringify(request.input), 'utf8') <= 8_192) {\n subjects.set(nodeId, { toolId: request.toolId, toolVersion: request.toolVersion, input: request.input });\n }\n }\n return project(5, definition, snapshot, subjects);\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),\n async signal(id, command) {\n const definition = await pinned(id);\n return runtime.signal(definition, { id, name: command.signalName, signalId: command.signalId, payload: command.value, actorId: command.actorId });\n },\n async signalled(id, command) {\n const definition = await pinned(id);\n const node = definition.nodes.find(candidate => candidate.kind === 'signal' && candidate.name === command.signalName);\n const step = node ? (await runtime.inspect(id)).steps[node.id] : undefined;\n return step?.kind === 'signal' && step.signalId === command.signalId;\n },\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: lifecycleFleetTarget(runtime, options.name ?? 'lifecycle'),\n });\n}\n\n/** Format-3 graph runs through discovery and the graph runtime. */\nexport function graphOperatorTarget(options: { readonly runtime: WorkflowGraphRuntime; readonly discovery: WorkflowGraphDiscovery; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowGraph[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, discovery, store, scope } = options; const definitions = catalog(options.definitions);\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'graphs',\n async page(after, limit) {\n const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.reference.definitionHash); return definition\n ? [{ format: 3 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.reference.runId, revision: candidate.version, status: candidate.status }] : []; });\n return { items, next: page.nextCursor ? page.nextCursor.afterId : null };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n return snapshot ? project(3, definition, snapshot) : null;\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: graphFleetTarget(discovery, runtime, options.name ?? 'graphs'),\n });\n}\n\n/** Format-4 workflow trees through discovery and the tree runtime. */\nexport function treeOperatorTarget(options: { readonly runtime: WorkflowTreeRuntime; readonly discovery: WorkflowTreeDiscovery; readonly store: AggregateStore; readonly scope: Scope;\n readonly definitions: readonly AnyWorkflowTree[]; readonly approvalCredential?: WorkflowApprovalCredential; readonly name?: string }): WorkflowOperatorTarget {\n const { runtime, discovery, store, scope } = options; const definitions = catalog(options.definitions);\n return Object.freeze<WorkflowOperatorTarget>({ name: options.name ?? 'trees',\n async page(after, limit) {\n const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });\n const items = page.candidates.flatMap(candidate => { const definition = definitions.get(candidate.definitionHash); return definition\n ? [{ format: 4 as const, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.rootId, revision: candidate.version, status: candidate.status }] : []; });\n return { items, next: page.nextCursor ? page.nextCursor.afterId : null };\n },\n async view(runId) {\n const hash = await pinnedDefinitionHash(store, scope, runId); const definition = hash === undefined ? undefined : definitions.get(hash);\n if (!definition) return null; const snapshot = await owned(() => runtime.inspect(runId));\n return snapshot ? project(4, definition, snapshot) : null;\n },\n pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),\n approve: (id, command) => runtime.approve({ id, ...(command.childRunId ? { childId: command.childRunId } : {}), nodeId: command.nodeId, digest: command.digest,\n credential: approval(options.approvalCredential, command.actorId) }),\n migrate: (migration, command) => runtime.migrate(migration as never, command),\n fleet: treeFleetTarget(discovery, runtime, options.name ?? 'trees'),\n });\n}\n\nexport interface WorkflowOperatorTransportOptions {\n readonly targets: readonly WorkflowOperatorTarget[];\n readonly journal: WorkflowCommandJournal;\n readonly fleet?: WorkflowFleetControl;\n readonly migrations?: WorkflowMigrationCatalog;\n readonly store: AggregateStore;\n /** The one scope these transports serve. Requests authenticated for any other scope see nothing and change nothing. */\n readonly scope: Scope;\n}\ntype ScopedInput = { readonly scope: Scope };\n/** One run's outcome in a fleet sweep page (a structural copy of the server's sweep record). */\nexport type WorkflowOperatorFleetSweepOutcome =\n | { readonly target: string; readonly runId: string;\n readonly outcome: 'paused' | 'already_paused' | 'terminal' | 'busy' | 'resumed' | 'not_paused' | 'missing' | 'unregistered' }\n | { readonly target: string; readonly runId: string; readonly outcome: 'failed'; readonly code: string };\ntype FleetSweep = { readonly outcomes: readonly WorkflowOperatorFleetSweepOutcome[]; readonly nextCursor: JsonObject | null };\n/** Structurally the agent server's workflow transport options: spread it into the server options. */\nexport interface WorkflowOperatorTransports {\n readonly workflowIndex: { list(input: ScopedInput & { readonly after: string | null; readonly limit: number; readonly view?: 'settled' }): Promise<{ readonly items: readonly WorkflowOperatorIndexRecord[]; readonly next: string | null }> };\n readonly workflowViews: { inspect(input: ScopedInput & { readonly runId: string }): Promise<WorkflowOperatorView | null> };\n readonly workflowControls: {\n cancel(input: ControlInput): Promise<WorkflowOperatorResult>;\n approve(input: ControlInput & { readonly nodeId: string; readonly approvalDigest: string; readonly childRunId: string | null }): Promise<WorkflowOperatorResult>;\n };\n readonly workflowPauses: { pause(input: ControlInput): Promise<WorkflowOperatorResult> };\n /** Signals for lifecycle signal steps. A run whose target has no signal steps answers `not_found`. */\n readonly workflowSignals: { deliver(input: ControlInput & { readonly signalId: string; readonly signalName: string; readonly value: JsonValue }): Promise<WorkflowOperatorResult> };\n readonly workflowResumes: { resume(input: ControlInput): Promise<WorkflowOperatorResult> };\n readonly workflowFleet?: {\n inspect(input: ScopedInput): Promise<WorkflowFleetHoldState>; hold(input: ScopedInput): Promise<WorkflowFleetHoldState>; release(input: ScopedInput): Promise<WorkflowFleetHoldState>;\n sweep(input: ScopedInput & { readonly phase: 'pause' | 'resume'; readonly cursor: JsonObject | null; readonly limit: number }): Promise<{ readonly status: 'applied'; readonly sweep: FleetSweep } | { readonly status: 'conflict' }>;\n };\n readonly workflowMigrations?: {\n list(input: ScopedInput & { readonly runId: string }): Promise<readonly WorkflowMigrationOfferRecord[] | null>;\n plan(input: ScopedInput & { readonly runId: string; readonly migrationId: string }): Promise<MigrationPlan | null>;\n apply(input: ControlInput & { readonly migrationId: string }): Promise<{ readonly status: 'applied'; readonly plan: MigrationPlan; readonly workflow: WorkflowOperatorView }\n | { readonly status: 'refused'; readonly plan: MigrationPlan } | { readonly status: 'conflict' } | { readonly status: 'not_found' }>;\n };\n}\n/**\n * Server transports (`workflowIndex`, `workflowViews`, `workflowControls`, `workflowSignals`, `workflowPauses`,\n * `workflowResumes`, and optionally `workflowFleet` and `workflowMigrations`).\n */\nexport function createWorkflowOperatorTransports(options: WorkflowOperatorTransportOptions): WorkflowOperatorTransports {\n const { targets, journal } = options;\n if (!Array.isArray(targets) || targets.length < 1 || targets.length > 16 || new Set(targets.map(target => target.name)).size !== targets.length\n || targets.some(target => !/^[a-z][a-z0-9-]{0,31}$/.test(target.name)) || !journal || typeof journal.run !== 'function') {\n throw new MayuraError('INVALID_CONFIG', 'Operator transports need 1–16 uniquely named targets and a command journal.');\n }\n if (!options.store || typeof options.store.read !== 'function' || typeof options.scope?.principalId !== 'string' || typeof options.scope.projectId !== 'string') {\n throw new MayuraError('INVALID_CONFIG', 'Operator transports need the store and the scope they serve.');\n }\n const served = options.scope;\n const inScope = (input: { readonly scope?: Scope }): boolean => input?.scope?.principalId === served.principalId && input.scope.projectId === served.projectId;\n const locate = async (runId: string): Promise<{ target: WorkflowOperatorTarget; view: WorkflowOperatorView } | null> => {\n if (!hashPattern.test(runId)) return null;\n for (const target of targets) { const view = await target.view(runId); if (view) return { target, view }; }\n return null;\n };\n const conflicts = (error: unknown): WorkflowCommandOutcome | undefined => isCode(error, 'CONFLICT') ? 'conflict' : isCode(error, 'NOT_FOUND') ? 'not_found' : undefined;\n /** Revision-checked, journaled command. The runtimes guard state themselves; the revision check is the operator's review point. */\n const command = async (input: ControlInput, action: string, request: JsonValue, observe: (view: WorkflowOperatorView) => boolean,\n operate: (target: WorkflowOperatorTarget) => Promise<unknown>, happened?: () => Promise<boolean>): Promise<Result> => {\n if (!inScope(input)) return { status: 'not_found' };\n const found = await locate(input.runId); if (!found) return { status: 'not_found' };\n const { outcome } = await journal.run({ runId: input.runId, action, commandId: input.commandId, request: { revision: input.revision, request },\n observe: async () => {\n if (happened) return happened();\n const current = await found.target.view(input.runId); return current !== null && observe(current);\n },\n apply: async () => {\n const current = await found.target.view(input.runId); if (!current) return { outcome: 'not_found' };\n if (current.revision !== input.revision) return { outcome: 'conflict' };\n try { await operate(found.target); return { outcome: 'applied' }; } catch (error) { const mapped = conflicts(error); if (mapped) return { outcome: mapped }; throw error; }\n } });\n if (outcome !== 'applied') return { status: outcome };\n const workflow = await found.target.view(input.runId);\n return workflow ? { status: 'applied', workflow } : { status: 'not_found' };\n };\n const decode = (after: string | null): { index: number; inner: string | null } => {\n if (after === null) return { index: 0, inner: null };\n const match = /^(\\d{1,2}):(-|[A-Za-z0-9.]{1,124})$/.exec(after);\n if (!match || Number(match[1]) >= targets.length) throw new MayuraError('INVALID_INPUT', 'Invalid workflow index cursor.');\n return { index: Number(match[1]), inner: match[2] === '-' ? null : match[2]! };\n };\n const transports = {\n workflowIndex: { list: async (input: { readonly scope: Scope; readonly after: string | null; readonly limit: number; readonly view?: 'settled' }) => {\n if (!inScope(input)) return { items: [], next: null };\n // One target per page: a short page is normal and the cursor moves on to the next format. The settled view\n // reads only targets that keep settled runs.\n const settled = input.view === 'settled'; const { index, inner } = decode(input.after); const target = targets[index]!;\n const page = !settled ? await target.page(inner, input.limit) : target.settledPage ? await target.settledPage(inner, input.limit) : { items: [], next: null };\n const following = targets.findIndex((candidate, position) => position > index && (!settled || candidate.settledPage !== undefined));\n const next = page.next !== null ? `${index}:${page.next}` : following >= 0 ? `${following}:-` : null;\n return { items: page.items.slice(0, input.limit), next };\n } },\n workflowViews: { inspect: async (input: { readonly scope: Scope; readonly runId: string }) => inScope(input) ? (await locate(input.runId))?.view ?? null : null },\n workflowControls: {\n cancel: (input: ControlInput) => command(input, 'cancel', null, view => view.status === 'cancelled', target => target.cancel(input.runId)),\n approve: (input: ControlInput & { readonly nodeId: string; readonly approvalDigest: string; readonly childRunId: string | null }) =>\n command(input, 'approve', { nodeId: input.nodeId, approvalDigest: input.approvalDigest, childRunId: input.childRunId },\n // A child's approval is not visible on the root view; re-applying it is safe because approvals are digest-bound.\n view => input.childRunId === null && !['pending', 'waiting'].includes(view.steps.find(step => step.id === input.nodeId)?.status ?? 'pending'),\n target => target.approve(input.runId, { nodeId: input.nodeId, digest: input.approvalDigest, childRunId: input.childRunId, actorId: input.actorId })),\n },\n workflowPauses: { pause: (input: ControlInput) => command(input, 'pause', null, view => view.status === 'paused', target => target.pause(input.runId)) },\n workflowSignals: { deliver: async (input: ControlInput & { readonly signalId: string; readonly signalName: string; readonly value: JsonValue }) => {\n const found = inScope(input) ? await locate(input.runId) : null;\n if (!found?.target.signal || !found.target.signalled) return { status: 'not_found' as const };\n const target = found.target as Required<Pick<WorkflowOperatorTarget, 'signal' | 'signalled'>>;\n const signal: WorkflowOperatorSignal = { signalName: input.signalName, signalId: input.signalId, value: input.value, actorId: input.actorId };\n // Delivery is idempotent on the signal id, so an attempt that died after delivering is recognised, not repeated.\n // A payload the step's schema refuses is answered like any refused command (conflict), not as unavailable storage.\n const deliver = async (): Promise<unknown> => {\n try { return await target.signal(input.runId, signal); }\n catch (error) { if (isCode(error, 'INVALID_INPUT')) throw new MayuraError('CONFLICT', 'The signal payload does not match the step.'); throw error; }\n };\n return command(input, 'signal', { signalName: input.signalName, signalId: input.signalId, value: input.value }, () => false,\n deliver, () => target.signalled(input.runId, signal));\n } },\n workflowResumes: { resume: (input: ControlInput) => command(input, 'resume', null, view => view.status !== 'paused',\n async target => { if ((await target.view(input.runId))?.status === 'paused') await target.resume(input.runId); }) },\n ...(options.fleet ? { workflowFleet: fleetTransport(options.fleet, targets.map(target => target.fleet), inScope) } : {}),\n ...(options.migrations ? { workflowMigrations: migrationTransport(options.migrations, options.store, served, locate, journal, inScope) } : {}),\n };\n return Object.freeze(transports);\n}\n\nfunction fleetTransport(fleet: WorkflowFleetControl, targets: readonly WorkflowFleetTarget[], inScope: (input: { readonly scope?: Scope }) => boolean) {\n const guard = (input: { readonly scope?: Scope }): void => { if (!inScope(input)) throw new MayuraError('PERMISSION_DENIED', 'This fleet belongs to another scope.'); };\n return {\n inspect: async (input: { readonly scope: Scope }) => { guard(input); return fleet.inspect(); },\n hold: async (input: { readonly scope: Scope }) => { guard(input); return fleet.hold(); },\n release: async (input: { readonly scope: Scope }) => { guard(input); return fleet.release(); },\n sweep: async (input: { readonly scope: Scope; readonly phase: 'pause' | 'resume'; readonly cursor: JsonObject | null; readonly limit: number }) => {\n guard(input);\n try {\n const sweep = input.phase === 'pause' ? await fleet.sweepPause(targets, { cursor: input.cursor as never, limit: input.limit })\n : await fleet.sweepResume(targets, { cursor: input.cursor as never, limit: input.limit });\n return { status: 'applied' as const, sweep: sweep as unknown as FleetSweep };\n } catch (error) { if (isCode(error, 'CONFLICT')) return { status: 'conflict' as const }; throw error; }\n },\n };\n}\n\nfunction migrationTransport(catalogue: WorkflowMigrationCatalog, store: AggregateStore, scope: Scope,\n locate: (runId: string) => Promise<{ target: WorkflowOperatorTarget; view: WorkflowOperatorView } | null>, journal: WorkflowCommandJournal,\n inScope: (input: { readonly scope?: Scope }) => boolean) {\n const service = async (runId: string) => {\n const found = await locate(runId); if (!found) return null;\n return { found, service: createWorkflowMigrationService({ catalog: catalogue, pinned: id => pinnedDefinitionHash(store, scope, id),\n inspect: async id => ({ version: (await found.target.view(id))?.revision ?? -1 }), migrate: (migration, command) => found.target.migrate(migration, command) as never }) };\n };\n return {\n list: async (input: { readonly scope: Scope; readonly runId: string }): Promise<readonly WorkflowMigrationOfferRecord[] | null> =>\n inScope(input) ? (await service(input.runId))?.service.list(input.runId) ?? null : null,\n plan: async (input: { readonly scope: Scope; readonly runId: string; readonly migrationId: string }): Promise<MigrationPlan | null> =>\n inScope(input) ? (await service(input.runId))?.service.plan(input.runId, input.migrationId) ?? null : null,\n apply: async (input: ControlInput & { readonly migrationId: string }) => {\n const resolved = inScope(input) ? await service(input.runId) : null; if (!resolved) return { status: 'not_found' as const };\n let refused: MigrationPlan | undefined;\n const target = (catalogue.get(input.migrationId)?.to as { readonly digest?: string } | undefined)?.digest;\n const result = await journal.run({ runId: input.runId, action: 'migrate', commandId: input.commandId, request: { revision: input.revision, migrationId: input.migrationId },\n observe: async () => target !== undefined && (await pinnedDefinitionHash(store, scope, input.runId)) === target,\n apply: async () => {\n const applied = await resolved.service.apply(input.runId, input.migrationId, { revision: input.revision, actorId: input.actorId, commandId: input.commandId });\n if (applied.status === 'refused') { refused = applied.plan; return { outcome: 'conflict' }; }\n // The applied plan is recorded with the command, so a retry reports the same plan.\n return applied.status === 'applied' ? { outcome: 'applied', detail: applied.plan as unknown as JsonValue } : { outcome: applied.status };\n } });\n if (refused) return { status: 'refused' as const, plan: refused };\n if (result.outcome !== 'applied') return { status: result.outcome };\n const workflow = (await locate(input.runId))?.view;\n // Recovered after a crash without a recorded plan: the migration applied, but the operator must re-read the run.\n return workflow && result.detail ? { status: 'applied' as const, plan: result.detail as unknown as MigrationPlan, workflow } : { status: 'conflict' as const };\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuH,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuH,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAGjM,OAAO,EAA2B,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC1G,OAAO,EAC+B,KAAK,mBAAmB,IAAI,IAAI,EACpE,KAAK,qBAAqB,IAAI,MAAM,EAAE,KAAK,cAAc,EAAqB,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAmD,KAAK,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AACvH,OAAO,EACkB,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAI7H,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACvE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE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