mayura 0.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +8 -0
- package/README.md +55 -0
- package/lib/adapter-code-docker/dist/index.d.ts +65 -0
- package/lib/adapter-code-docker/dist/index.d.ts.map +1 -0
- package/lib/adapter-code-docker/dist/index.js +228 -0
- package/lib/adapter-code-docker/dist/index.js.map +1 -0
- package/lib/adapter-code-docker/image/Dockerfile +12 -0
- package/lib/adapter-code-docker/package.json +5 -0
- package/lib/adapter-code-docker/src/index.ts +244 -0
- package/lib/adapter-code-quickjs/dist/index.d.ts +40 -0
- package/lib/adapter-code-quickjs/dist/index.d.ts.map +1 -0
- package/lib/adapter-code-quickjs/dist/index.js +169 -0
- package/lib/adapter-code-quickjs/dist/index.js.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker.d.ts +2 -0
- package/lib/adapter-code-quickjs/dist/worker.d.ts.map +1 -0
- package/lib/adapter-code-quickjs/dist/worker.js +164 -0
- package/lib/adapter-code-quickjs/dist/worker.js.map +1 -0
- package/lib/adapter-code-quickjs/package.json +5 -0
- package/lib/adapter-code-quickjs/src/index.ts +174 -0
- package/lib/adapter-code-quickjs/src/worker.ts +142 -0
- package/lib/adapter-mcp/dist/index.d.ts +29 -0
- package/lib/adapter-mcp/dist/index.d.ts.map +1 -0
- package/lib/adapter-mcp/dist/index.js +54 -0
- package/lib/adapter-mcp/dist/index.js.map +1 -0
- package/lib/adapter-mcp/package.json +5 -0
- package/lib/adapter-mcp/src/index.ts +82 -0
- package/lib/artifacts/dist/contracts.d.ts +139 -0
- package/lib/artifacts/dist/contracts.d.ts.map +1 -0
- package/lib/artifacts/dist/contracts.js +2 -0
- package/lib/artifacts/dist/contracts.js.map +1 -0
- package/lib/artifacts/dist/index.d.ts +3 -0
- package/lib/artifacts/dist/index.d.ts.map +1 -0
- package/lib/artifacts/dist/index.js +2 -0
- package/lib/artifacts/dist/index.js.map +1 -0
- package/lib/artifacts/dist/local-store.d.ts +3 -0
- package/lib/artifacts/dist/local-store.d.ts.map +1 -0
- package/lib/artifacts/dist/local-store.js +922 -0
- package/lib/artifacts/dist/local-store.js.map +1 -0
- package/lib/artifacts/package.json +5 -0
- package/lib/artifacts/src/contracts.ts +159 -0
- package/lib/artifacts/src/index.ts +26 -0
- package/lib/artifacts/src/local-store.ts +816 -0
- package/lib/cli/dist/application.d.ts +85 -0
- package/lib/cli/dist/application.d.ts.map +1 -0
- package/lib/cli/dist/application.js +116 -0
- package/lib/cli/dist/application.js.map +1 -0
- package/lib/cli/dist/bin.d.ts +3 -0
- package/lib/cli/dist/bin.d.ts.map +1 -0
- package/lib/cli/dist/bin.js +394 -0
- package/lib/cli/dist/bin.js.map +1 -0
- package/lib/cli/dist/dev.d.ts +21 -0
- package/lib/cli/dist/dev.d.ts.map +1 -0
- package/lib/cli/dist/dev.js +205 -0
- package/lib/cli/dist/dev.js.map +1 -0
- package/lib/cli/dist/index.d.ts +72 -0
- package/lib/cli/dist/index.d.ts.map +1 -0
- package/lib/cli/dist/index.js +423 -0
- package/lib/cli/dist/index.js.map +1 -0
- package/lib/cli/dist/interactive.d.ts +19 -0
- package/lib/cli/dist/interactive.d.ts.map +1 -0
- package/lib/cli/dist/interactive.js +163 -0
- package/lib/cli/dist/interactive.js.map +1 -0
- package/lib/cli/dist/operations.d.ts +215 -0
- package/lib/cli/dist/operations.d.ts.map +1 -0
- package/lib/cli/dist/operations.js +580 -0
- package/lib/cli/dist/operations.js.map +1 -0
- package/lib/cli/dist/output.d.ts +29 -0
- package/lib/cli/dist/output.d.ts.map +1 -0
- package/lib/cli/dist/output.js +244 -0
- package/lib/cli/dist/output.js.map +1 -0
- package/lib/cli/dist/providers.d.ts +54 -0
- package/lib/cli/dist/providers.d.ts.map +1 -0
- package/lib/cli/dist/providers.js +96 -0
- package/lib/cli/dist/providers.js.map +1 -0
- package/lib/cli/package.json +5 -0
- package/lib/cli/src/application.ts +109 -0
- package/lib/cli/src/bin.ts +261 -0
- package/lib/cli/src/dev.ts +139 -0
- package/lib/cli/src/index.ts +386 -0
- package/lib/cli/src/interactive.ts +132 -0
- package/lib/cli/src/operations.ts +458 -0
- package/lib/cli/src/output.ts +205 -0
- package/lib/cli/src/providers.ts +102 -0
- package/lib/cli/starters/approval-workflow/Dockerfile +20 -0
- package/lib/cli/starters/approval-workflow/README.md +102 -0
- package/lib/cli/starters/approval-workflow/compose.yaml +33 -0
- package/lib/cli/starters/approval-workflow/dot-dockerignore +7 -0
- package/lib/cli/starters/approval-workflow/dot-env.example +41 -0
- package/lib/cli/starters/approval-workflow/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/approval-workflow/dot-gitignore +10 -0
- package/lib/cli/starters/approval-workflow/mayura.project.json +16 -0
- package/lib/cli/starters/approval-workflow/package.json +30 -0
- package/lib/cli/starters/approval-workflow/src/app.ts +19 -0
- package/lib/cli/starters/approval-workflow/src/auth.ts +68 -0
- package/lib/cli/starters/approval-workflow/src/config.ts +107 -0
- package/lib/cli/starters/approval-workflow/src/dev.ts +59 -0
- package/lib/cli/starters/approval-workflow/src/intake.ts +104 -0
- package/lib/cli/starters/approval-workflow/src/model.ts +33 -0
- package/lib/cli/starters/approval-workflow/src/server.ts +56 -0
- package/lib/cli/starters/approval-workflow/src/services.ts +26 -0
- package/lib/cli/starters/approval-workflow/src/token.ts +6 -0
- package/lib/cli/starters/approval-workflow/src/worker.ts +18 -0
- package/lib/cli/starters/approval-workflow/src/workflow.ts +100 -0
- package/lib/cli/starters/approval-workflow/test/refunds.test.ts +140 -0
- package/lib/cli/starters/approval-workflow/tsconfig.json +20 -0
- package/lib/cli/starters/event-automation/Dockerfile +21 -0
- package/lib/cli/starters/event-automation/README.md +150 -0
- package/lib/cli/starters/event-automation/compose.yaml +41 -0
- package/lib/cli/starters/event-automation/dot-dockerignore +7 -0
- package/lib/cli/starters/event-automation/dot-env.example +51 -0
- package/lib/cli/starters/event-automation/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/event-automation/dot-gitignore +10 -0
- package/lib/cli/starters/event-automation/mayura.project.json +17 -0
- package/lib/cli/starters/event-automation/package.json +32 -0
- package/lib/cli/starters/event-automation/src/app.ts +19 -0
- package/lib/cli/starters/event-automation/src/auth.ts +61 -0
- package/lib/cli/starters/event-automation/src/config.ts +138 -0
- package/lib/cli/starters/event-automation/src/dev.ts +54 -0
- package/lib/cli/starters/event-automation/src/ingress.ts +129 -0
- package/lib/cli/starters/event-automation/src/mcp.ts +139 -0
- package/lib/cli/starters/event-automation/src/model.ts +33 -0
- package/lib/cli/starters/event-automation/src/send-sample.ts +29 -0
- package/lib/cli/starters/event-automation/src/server.ts +58 -0
- package/lib/cli/starters/event-automation/src/services.ts +54 -0
- package/lib/cli/starters/event-automation/src/signing.ts +30 -0
- package/lib/cli/starters/event-automation/src/token.ts +7 -0
- package/lib/cli/starters/event-automation/src/tracker/main.ts +18 -0
- package/lib/cli/starters/event-automation/src/tracker/mcp-server.ts +145 -0
- package/lib/cli/starters/event-automation/src/tracker/samples.ts +19 -0
- package/lib/cli/starters/event-automation/src/tracker/tickets.ts +54 -0
- package/lib/cli/starters/event-automation/src/tracker-tools.ts +38 -0
- package/lib/cli/starters/event-automation/src/triage.ts +151 -0
- package/lib/cli/starters/event-automation/src/worker.ts +19 -0
- package/lib/cli/starters/event-automation/src/workflows.ts +57 -0
- package/lib/cli/starters/event-automation/test/automation.test.ts +200 -0
- package/lib/cli/starters/event-automation/tsconfig.json +20 -0
- package/lib/cli/starters/research-team/Dockerfile +22 -0
- package/lib/cli/starters/research-team/README.md +189 -0
- package/lib/cli/starters/research-team/compose.yaml +38 -0
- package/lib/cli/starters/research-team/dot-dockerignore +7 -0
- package/lib/cli/starters/research-team/dot-env.example +49 -0
- package/lib/cli/starters/research-team/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/research-team/dot-gitignore +10 -0
- package/lib/cli/starters/research-team/mayura.project.json +22 -0
- package/lib/cli/starters/research-team/package.json +30 -0
- package/lib/cli/starters/research-team/src/app.ts +19 -0
- package/lib/cli/starters/research-team/src/auth.ts +56 -0
- package/lib/cli/starters/research-team/src/config.ts +170 -0
- package/lib/cli/starters/research-team/src/desk.ts +124 -0
- package/lib/cli/starters/research-team/src/dev.ts +58 -0
- package/lib/cli/starters/research-team/src/library/corpus.ts +76 -0
- package/lib/cli/starters/research-team/src/library/index.ts +109 -0
- package/lib/cli/starters/research-team/src/model.ts +33 -0
- package/lib/cli/starters/research-team/src/server.ts +69 -0
- package/lib/cli/starters/research-team/src/services.ts +48 -0
- package/lib/cli/starters/research-team/src/team.ts +173 -0
- package/lib/cli/starters/research-team/src/telemetry.ts +95 -0
- package/lib/cli/starters/research-team/src/token.ts +6 -0
- package/lib/cli/starters/research-team/src/worker.ts +21 -0
- package/lib/cli/starters/research-team/src/workflow.ts +197 -0
- package/lib/cli/starters/research-team/test/research.test.ts +271 -0
- package/lib/cli/starters/research-team/tsconfig.json +20 -0
- package/lib/cli/starters/support-agent/Dockerfile +21 -0
- package/lib/cli/starters/support-agent/README.md +128 -0
- package/lib/cli/starters/support-agent/compose.yaml +33 -0
- package/lib/cli/starters/support-agent/dot-dockerignore +7 -0
- package/lib/cli/starters/support-agent/dot-env.example +44 -0
- package/lib/cli/starters/support-agent/dot-github/workflows/ci.yml +13 -0
- package/lib/cli/starters/support-agent/dot-gitignore +10 -0
- package/lib/cli/starters/support-agent/mayura.project.json +18 -0
- package/lib/cli/starters/support-agent/package.json +43 -0
- package/lib/cli/starters/support-agent/src/app.ts +19 -0
- package/lib/cli/starters/support-agent/src/assistant.ts +313 -0
- package/lib/cli/starters/support-agent/src/auth.ts +69 -0
- package/lib/cli/starters/support-agent/src/config.ts +120 -0
- package/lib/cli/starters/support-agent/src/dev.ts +115 -0
- package/lib/cli/starters/support-agent/src/guardrails.ts +71 -0
- package/lib/cli/starters/support-agent/src/model.ts +33 -0
- package/lib/cli/starters/support-agent/src/orders.ts +62 -0
- package/lib/cli/starters/support-agent/src/returns.ts +86 -0
- package/lib/cli/starters/support-agent/src/server.ts +72 -0
- package/lib/cli/starters/support-agent/src/services.ts +32 -0
- package/lib/cli/starters/support-agent/src/session.ts +55 -0
- package/lib/cli/starters/support-agent/src/token.ts +9 -0
- package/lib/cli/starters/support-agent/src/worker.ts +19 -0
- package/lib/cli/starters/support-agent/test/support.test.ts +263 -0
- package/lib/cli/starters/support-agent/tsconfig.json +20 -0
- package/lib/cli/starters/support-agent/web/index.html +12 -0
- package/lib/cli/starters/support-agent/web/src/App.tsx +43 -0
- package/lib/cli/starters/support-agent/web/src/components/chat.tsx +161 -0
- package/lib/cli/starters/support-agent/web/src/components/ui/button.tsx +33 -0
- package/lib/cli/starters/support-agent/web/src/components/ui/primitives.tsx +48 -0
- package/lib/cli/starters/support-agent/web/src/env.d.ts +1 -0
- package/lib/cli/starters/support-agent/web/src/lib/api.ts +56 -0
- package/lib/cli/starters/support-agent/web/src/lib/utils.ts +4 -0
- package/lib/cli/starters/support-agent/web/src/main.tsx +6 -0
- package/lib/cli/starters/support-agent/web/src/styles.css +86 -0
- package/lib/cli/starters/support-agent/web/tsconfig.json +9 -0
- package/lib/cli/starters/support-agent/web/vite.config.ts +13 -0
- package/lib/cli/templates/basic-agent.ts +10 -0
- package/lib/cli/templates/capability-policy.ts +18 -0
- package/lib/cli/templates/code-mode-workflow.ts +34 -0
- package/lib/cli/templates/durable-approval.ts +25 -0
- package/lib/cli/templates/guarded-streaming-app.ts +23 -0
- package/lib/cli/templates/native-memory.ts +15 -0
- package/lib/cli/templates/parallel-research.ts +21 -0
- package/lib/cli/templates/typed-tool-runner.ts +15 -0
- package/lib/client/dist/forms.d.ts +77 -0
- package/lib/client/dist/forms.d.ts.map +1 -0
- package/lib/client/dist/forms.js +282 -0
- package/lib/client/dist/forms.js.map +1 -0
- package/lib/client/dist/headless.d.ts +84 -0
- package/lib/client/dist/headless.d.ts.map +1 -0
- package/lib/client/dist/headless.js +376 -0
- package/lib/client/dist/headless.js.map +1 -0
- package/lib/client/dist/index.d.ts +266 -0
- package/lib/client/dist/index.d.ts.map +1 -0
- package/lib/client/dist/index.js +814 -0
- package/lib/client/dist/index.js.map +1 -0
- package/lib/client/dist/workflows.d.ts +128 -0
- package/lib/client/dist/workflows.d.ts.map +1 -0
- package/lib/client/dist/workflows.js +379 -0
- package/lib/client/dist/workflows.js.map +1 -0
- package/lib/client/package.json +5 -0
- package/lib/client/src/forms.ts +215 -0
- package/lib/client/src/headless.ts +265 -0
- package/lib/client/src/index.ts +646 -0
- package/lib/client/src/workflows.ts +307 -0
- package/lib/client-react/dist/components.d.ts +70 -0
- package/lib/client-react/dist/components.d.ts.map +1 -0
- package/lib/client-react/dist/components.js +173 -0
- package/lib/client-react/dist/components.js.map +1 -0
- package/lib/client-react/dist/index.d.ts +29 -0
- package/lib/client-react/dist/index.d.ts.map +1 -0
- package/lib/client-react/dist/index.js +57 -0
- package/lib/client-react/dist/index.js.map +1 -0
- package/lib/client-react/package.json +5 -0
- package/lib/client-react/src/components.ts +183 -0
- package/lib/client-react/src/index.ts +70 -0
- package/lib/code-mode/dist/index.d.ts +142 -0
- package/lib/code-mode/dist/index.d.ts.map +1 -0
- package/lib/code-mode/dist/index.js +498 -0
- package/lib/code-mode/dist/index.js.map +1 -0
- package/lib/code-mode/package.json +5 -0
- package/lib/code-mode/src/index.ts +605 -0
- package/lib/code-mode-workflows/dist/index.d.ts +51 -0
- package/lib/code-mode-workflows/dist/index.d.ts.map +1 -0
- package/lib/code-mode-workflows/dist/index.js +231 -0
- package/lib/code-mode-workflows/dist/index.js.map +1 -0
- package/lib/code-mode-workflows/package.json +5 -0
- package/lib/code-mode-workflows/src/index.ts +259 -0
- package/lib/context/dist/assemble.d.ts +11 -0
- package/lib/context/dist/assemble.d.ts.map +1 -0
- package/lib/context/dist/assemble.js +265 -0
- package/lib/context/dist/assemble.js.map +1 -0
- package/lib/context/dist/cache.d.ts +53 -0
- package/lib/context/dist/cache.d.ts.map +1 -0
- package/lib/context/dist/cache.js +147 -0
- package/lib/context/dist/cache.js.map +1 -0
- package/lib/context/dist/contracts.d.ts +145 -0
- package/lib/context/dist/contracts.d.ts.map +1 -0
- package/lib/context/dist/contracts.js +2 -0
- package/lib/context/dist/contracts.js.map +1 -0
- package/lib/context/dist/index.d.ts +4 -0
- package/lib/context/dist/index.d.ts.map +1 -0
- package/lib/context/dist/index.js +3 -0
- package/lib/context/dist/index.js.map +1 -0
- package/lib/context/package.json +5 -0
- package/lib/context/src/assemble.ts +205 -0
- package/lib/context/src/cache.ts +143 -0
- package/lib/context/src/contracts.ts +124 -0
- package/lib/context/src/index.ts +3 -0
- package/lib/core/dist/budget.d.ts +85 -0
- package/lib/core/dist/budget.d.ts.map +1 -0
- package/lib/core/dist/budget.js +328 -0
- package/lib/core/dist/budget.js.map +1 -0
- package/lib/core/dist/contracts.d.ts +156 -0
- package/lib/core/dist/contracts.d.ts.map +1 -0
- package/lib/core/dist/contracts.js +13 -0
- package/lib/core/dist/contracts.js.map +1 -0
- package/lib/core/dist/errors.d.ts +17 -0
- package/lib/core/dist/errors.d.ts.map +1 -0
- package/lib/core/dist/errors.js +22 -0
- package/lib/core/dist/errors.js.map +1 -0
- package/lib/core/dist/event-stream.d.ts +26 -0
- package/lib/core/dist/event-stream.d.ts.map +1 -0
- package/lib/core/dist/event-stream.js +116 -0
- package/lib/core/dist/event-stream.js.map +1 -0
- package/lib/core/dist/host.d.ts +7 -0
- package/lib/core/dist/host.d.ts.map +1 -0
- package/lib/core/dist/host.js +7 -0
- package/lib/core/dist/host.js.map +1 -0
- package/lib/core/dist/index.d.ts +8 -0
- package/lib/core/dist/index.d.ts.map +1 -0
- package/lib/core/dist/index.js +7 -0
- package/lib/core/dist/index.js.map +1 -0
- package/lib/core/dist/json.d.ts +18 -0
- package/lib/core/dist/json.d.ts.map +1 -0
- package/lib/core/dist/json.js +100 -0
- package/lib/core/dist/json.js.map +1 -0
- package/lib/core/dist/lifecycle.d.ts +45 -0
- package/lib/core/dist/lifecycle.d.ts.map +1 -0
- package/lib/core/dist/lifecycle.js +114 -0
- package/lib/core/dist/lifecycle.js.map +1 -0
- package/lib/core/dist/local-guards.d.ts +4 -0
- package/lib/core/dist/local-guards.d.ts.map +1 -0
- package/lib/core/dist/local-guards.js +47 -0
- package/lib/core/dist/local-guards.js.map +1 -0
- package/lib/core/dist/managed-guards.d.ts +44 -0
- package/lib/core/dist/managed-guards.d.ts.map +1 -0
- package/lib/core/dist/managed-guards.js +146 -0
- package/lib/core/dist/managed-guards.js.map +1 -0
- package/lib/core/dist/schema.d.ts +36 -0
- package/lib/core/dist/schema.d.ts.map +1 -0
- package/lib/core/dist/schema.js +24 -0
- package/lib/core/dist/schema.js.map +1 -0
- package/lib/core/package.json +5 -0
- package/lib/core/src/budget.ts +366 -0
- package/lib/core/src/contracts.ts +107 -0
- package/lib/core/src/errors.ts +33 -0
- package/lib/core/src/event-stream.ts +87 -0
- package/lib/core/src/host.ts +6 -0
- package/lib/core/src/index.ts +7 -0
- package/lib/core/src/json.ts +81 -0
- package/lib/core/src/lifecycle.ts +133 -0
- package/lib/core/src/local-guards.ts +37 -0
- package/lib/core/src/managed-guards.ts +154 -0
- package/lib/core/src/schema.ts +43 -0
- package/lib/exporter-otlp/dist/contracts.d.ts +112 -0
- package/lib/exporter-otlp/dist/contracts.d.ts.map +1 -0
- package/lib/exporter-otlp/dist/contracts.js +2 -0
- package/lib/exporter-otlp/dist/contracts.js.map +1 -0
- package/lib/exporter-otlp/dist/index.d.ts +5 -0
- package/lib/exporter-otlp/dist/index.d.ts.map +1 -0
- package/lib/exporter-otlp/dist/index.js +4 -0
- package/lib/exporter-otlp/dist/index.js.map +1 -0
- package/lib/exporter-otlp/dist/otlp-http-json.d.ts +4 -0
- package/lib/exporter-otlp/dist/otlp-http-json.d.ts.map +1 -0
- package/lib/exporter-otlp/dist/otlp-http-json.js +286 -0
- package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -0
- package/lib/exporter-otlp/dist/run-traces.d.ts +15 -0
- package/lib/exporter-otlp/dist/run-traces.d.ts.map +1 -0
- package/lib/exporter-otlp/dist/run-traces.js +114 -0
- package/lib/exporter-otlp/dist/run-traces.js.map +1 -0
- package/lib/exporter-otlp/dist/signals.d.ts +4 -0
- package/lib/exporter-otlp/dist/signals.d.ts.map +1 -0
- package/lib/exporter-otlp/dist/signals.js +330 -0
- package/lib/exporter-otlp/dist/signals.js.map +1 -0
- package/lib/exporter-otlp/package.json +5 -0
- package/lib/exporter-otlp/src/contracts.ts +119 -0
- package/lib/exporter-otlp/src/index.ts +23 -0
- package/lib/exporter-otlp/src/otlp-http-json.ts +189 -0
- package/lib/exporter-otlp/src/run-traces.ts +86 -0
- package/lib/exporter-otlp/src/signals.ts +185 -0
- package/lib/guardrails/dist/agent-guard.d.ts +9 -0
- package/lib/guardrails/dist/agent-guard.d.ts.map +1 -0
- package/lib/guardrails/dist/agent-guard.js +23 -0
- package/lib/guardrails/dist/agent-guard.js.map +1 -0
- package/lib/guardrails/dist/auxiliary-helpers.d.ts +63 -0
- package/lib/guardrails/dist/auxiliary-helpers.d.ts.map +1 -0
- package/lib/guardrails/dist/auxiliary-helpers.js +147 -0
- package/lib/guardrails/dist/auxiliary-helpers.js.map +1 -0
- package/lib/guardrails/dist/auxiliary.d.ts +51 -0
- package/lib/guardrails/dist/auxiliary.d.ts.map +1 -0
- package/lib/guardrails/dist/auxiliary.js +230 -0
- package/lib/guardrails/dist/auxiliary.js.map +1 -0
- package/lib/guardrails/dist/batches.d.ts +18 -0
- package/lib/guardrails/dist/batches.d.ts.map +1 -0
- package/lib/guardrails/dist/batches.js +160 -0
- package/lib/guardrails/dist/batches.js.map +1 -0
- package/lib/guardrails/dist/disclosure.d.ts +30 -0
- package/lib/guardrails/dist/disclosure.d.ts.map +1 -0
- package/lib/guardrails/dist/disclosure.js +109 -0
- package/lib/guardrails/dist/disclosure.js.map +1 -0
- package/lib/guardrails/dist/helpers.d.ts +20 -0
- package/lib/guardrails/dist/helpers.d.ts.map +1 -0
- package/lib/guardrails/dist/helpers.js +72 -0
- package/lib/guardrails/dist/helpers.js.map +1 -0
- package/lib/guardrails/dist/index.d.ts +9 -0
- package/lib/guardrails/dist/index.d.ts.map +1 -0
- package/lib/guardrails/dist/index.js +9 -0
- package/lib/guardrails/dist/index.js.map +1 -0
- package/lib/guardrails/dist/managed.d.ts +18 -0
- package/lib/guardrails/dist/managed.d.ts.map +1 -0
- package/lib/guardrails/dist/managed.js +67 -0
- package/lib/guardrails/dist/managed.js.map +1 -0
- package/lib/guardrails/dist/pipeline.d.ts +55 -0
- package/lib/guardrails/dist/pipeline.d.ts.map +1 -0
- package/lib/guardrails/dist/pipeline.js +201 -0
- package/lib/guardrails/dist/pipeline.js.map +1 -0
- package/lib/guardrails/package.json +5 -0
- package/lib/guardrails/src/agent-guard.ts +22 -0
- package/lib/guardrails/src/auxiliary-helpers.ts +146 -0
- package/lib/guardrails/src/auxiliary.ts +202 -0
- package/lib/guardrails/src/batches.ts +130 -0
- package/lib/guardrails/src/disclosure.ts +92 -0
- package/lib/guardrails/src/helpers.ts +67 -0
- package/lib/guardrails/src/index.ts +8 -0
- package/lib/guardrails/src/managed.ts +64 -0
- package/lib/guardrails/src/pipeline.ts +185 -0
- package/lib/helpers/dist/concurrency.d.ts +25 -0
- package/lib/helpers/dist/concurrency.d.ts.map +1 -0
- package/lib/helpers/dist/concurrency.js +106 -0
- package/lib/helpers/dist/concurrency.js.map +1 -0
- package/lib/helpers/dist/configuration.d.ts +42 -0
- package/lib/helpers/dist/configuration.d.ts.map +1 -0
- package/lib/helpers/dist/configuration.js +119 -0
- package/lib/helpers/dist/configuration.js.map +1 -0
- package/lib/helpers/dist/control.d.ts +61 -0
- package/lib/helpers/dist/control.d.ts.map +1 -0
- package/lib/helpers/dist/control.js +220 -0
- package/lib/helpers/dist/control.js.map +1 -0
- package/lib/helpers/dist/credentials.d.ts +42 -0
- package/lib/helpers/dist/credentials.d.ts.map +1 -0
- package/lib/helpers/dist/credentials.js +126 -0
- package/lib/helpers/dist/credentials.js.map +1 -0
- package/lib/helpers/dist/data.d.ts +30 -0
- package/lib/helpers/dist/data.d.ts.map +1 -0
- package/lib/helpers/dist/data.js +90 -0
- package/lib/helpers/dist/data.js.map +1 -0
- package/lib/helpers/dist/index.d.ts +6 -0
- package/lib/helpers/dist/index.d.ts.map +1 -0
- package/lib/helpers/dist/index.js +6 -0
- package/lib/helpers/dist/index.js.map +1 -0
- package/lib/helpers/package.json +5 -0
- package/lib/helpers/src/concurrency.ts +92 -0
- package/lib/helpers/src/configuration.ts +131 -0
- package/lib/helpers/src/control.ts +231 -0
- package/lib/helpers/src/credentials.ts +113 -0
- package/lib/helpers/src/data.ts +105 -0
- package/lib/helpers/src/index.ts +5 -0
- package/lib/memory/dist/contracts.d.ts +146 -0
- package/lib/memory/dist/contracts.d.ts.map +1 -0
- package/lib/memory/dist/contracts.js +2 -0
- package/lib/memory/dist/contracts.js.map +1 -0
- package/lib/memory/dist/index.d.ts +10 -0
- package/lib/memory/dist/index.d.ts.map +1 -0
- package/lib/memory/dist/index.js +316 -0
- package/lib/memory/dist/index.js.map +1 -0
- package/lib/memory/dist/native.d.ts +157 -0
- package/lib/memory/dist/native.d.ts.map +1 -0
- package/lib/memory/dist/native.js +664 -0
- package/lib/memory/dist/native.js.map +1 -0
- package/lib/memory/dist/validation.d.ts +21 -0
- package/lib/memory/dist/validation.d.ts.map +1 -0
- package/lib/memory/dist/validation.js +123 -0
- package/lib/memory/dist/validation.js.map +1 -0
- package/lib/memory/dist/vectors.d.ts +40 -0
- package/lib/memory/dist/vectors.d.ts.map +1 -0
- package/lib/memory/dist/vectors.js +134 -0
- package/lib/memory/dist/vectors.js.map +1 -0
- package/lib/memory/package.json +5 -0
- package/lib/memory/src/contracts.ts +113 -0
- package/lib/memory/src/index.ts +241 -0
- package/lib/memory/src/native.ts +568 -0
- package/lib/memory/src/validation.ts +103 -0
- package/lib/memory/src/vectors.ts +121 -0
- package/lib/memory-remote/dist/index.d.ts +91 -0
- package/lib/memory-remote/dist/index.d.ts.map +1 -0
- package/lib/memory-remote/dist/index.js +434 -0
- package/lib/memory-remote/dist/index.js.map +1 -0
- package/lib/memory-remote/package.json +5 -0
- package/lib/memory-remote/src/index.ts +367 -0
- package/lib/observability/dist/contracts.d.ts +102 -0
- package/lib/observability/dist/contracts.d.ts.map +1 -0
- package/lib/observability/dist/contracts.js +2 -0
- package/lib/observability/dist/contracts.js.map +1 -0
- package/lib/observability/dist/index.d.ts +5 -0
- package/lib/observability/dist/index.d.ts.map +1 -0
- package/lib/observability/dist/index.js +4 -0
- package/lib/observability/dist/index.js.map +1 -0
- package/lib/observability/dist/observer.d.ts +4 -0
- package/lib/observability/dist/observer.d.ts.map +1 -0
- package/lib/observability/dist/observer.js +354 -0
- package/lib/observability/dist/observer.js.map +1 -0
- package/lib/observability/dist/validation.d.ts +6 -0
- package/lib/observability/dist/validation.d.ts.map +1 -0
- package/lib/observability/dist/validation.js +203 -0
- package/lib/observability/dist/validation.js.map +1 -0
- package/lib/observability/package.json +5 -0
- package/lib/observability/src/contracts.ts +85 -0
- package/lib/observability/src/index.ts +4 -0
- package/lib/observability/src/observer.ts +246 -0
- package/lib/observability/src/validation.ts +132 -0
- package/lib/provider-anthropic/dist/index.d.ts +19 -0
- package/lib/provider-anthropic/dist/index.d.ts.map +1 -0
- package/lib/provider-anthropic/dist/index.js +342 -0
- package/lib/provider-anthropic/dist/index.js.map +1 -0
- package/lib/provider-anthropic/package.json +5 -0
- package/lib/provider-anthropic/src/index.ts +317 -0
- package/lib/provider-openai/dist/index.d.ts +77 -0
- package/lib/provider-openai/dist/index.d.ts.map +1 -0
- package/lib/provider-openai/dist/index.js +577 -0
- package/lib/provider-openai/dist/index.js.map +1 -0
- package/lib/provider-openai/package.json +5 -0
- package/lib/provider-openai/src/index.ts +459 -0
- package/lib/runtime/dist/agent.d.ts +63 -0
- package/lib/runtime/dist/agent.d.ts.map +1 -0
- package/lib/runtime/dist/agent.js +134 -0
- package/lib/runtime/dist/agent.js.map +1 -0
- package/lib/runtime/dist/composition.d.ts +21 -0
- package/lib/runtime/dist/composition.d.ts.map +1 -0
- package/lib/runtime/dist/composition.js +54 -0
- package/lib/runtime/dist/composition.js.map +1 -0
- package/lib/runtime/dist/event-buffer.d.ts +18 -0
- package/lib/runtime/dist/event-buffer.d.ts.map +1 -0
- package/lib/runtime/dist/event-buffer.js +66 -0
- package/lib/runtime/dist/event-buffer.js.map +1 -0
- package/lib/runtime/dist/hook-execution.d.ts +40 -0
- package/lib/runtime/dist/hook-execution.d.ts.map +1 -0
- package/lib/runtime/dist/hook-execution.js +186 -0
- package/lib/runtime/dist/hook-execution.js.map +1 -0
- package/lib/runtime/dist/hooks.d.ts +178 -0
- package/lib/runtime/dist/hooks.d.ts.map +1 -0
- package/lib/runtime/dist/hooks.js +120 -0
- package/lib/runtime/dist/hooks.js.map +1 -0
- package/lib/runtime/dist/index.d.ts +6 -0
- package/lib/runtime/dist/index.d.ts.map +1 -0
- package/lib/runtime/dist/index.js +6 -0
- package/lib/runtime/dist/index.js.map +1 -0
- package/lib/runtime/dist/managed-guards.d.ts +27 -0
- package/lib/runtime/dist/managed-guards.d.ts.map +1 -0
- package/lib/runtime/dist/managed-guards.js +183 -0
- package/lib/runtime/dist/managed-guards.js.map +1 -0
- package/lib/runtime/dist/permits.d.ts +9 -0
- package/lib/runtime/dist/permits.d.ts.map +1 -0
- package/lib/runtime/dist/permits.js +77 -0
- package/lib/runtime/dist/permits.js.map +1 -0
- package/lib/runtime/dist/response.d.ts +8 -0
- package/lib/runtime/dist/response.d.ts.map +1 -0
- package/lib/runtime/dist/response.js +83 -0
- package/lib/runtime/dist/response.js.map +1 -0
- package/lib/runtime/dist/router.d.ts +51 -0
- package/lib/runtime/dist/router.d.ts.map +1 -0
- package/lib/runtime/dist/router.js +181 -0
- package/lib/runtime/dist/router.js.map +1 -0
- package/lib/runtime/dist/runtime.d.ts +98 -0
- package/lib/runtime/dist/runtime.d.ts.map +1 -0
- package/lib/runtime/dist/runtime.js +945 -0
- package/lib/runtime/dist/runtime.js.map +1 -0
- package/lib/runtime/dist/stream.d.ts +25 -0
- package/lib/runtime/dist/stream.d.ts.map +1 -0
- package/lib/runtime/dist/stream.js +226 -0
- package/lib/runtime/dist/stream.js.map +1 -0
- package/lib/runtime/package.json +5 -0
- package/lib/runtime/src/agent.ts +167 -0
- package/lib/runtime/src/composition.ts +63 -0
- package/lib/runtime/src/event-buffer.ts +55 -0
- package/lib/runtime/src/hook-execution.ts +188 -0
- package/lib/runtime/src/hooks.ts +227 -0
- package/lib/runtime/src/index.ts +5 -0
- package/lib/runtime/src/managed-guards.ts +176 -0
- package/lib/runtime/src/permits.ts +65 -0
- package/lib/runtime/src/response.ts +68 -0
- package/lib/runtime/src/router.ts +178 -0
- package/lib/runtime/src/runtime.ts +909 -0
- package/lib/runtime/src/stream.ts +130 -0
- package/lib/sdk/dist/index.d.ts +5 -0
- package/lib/sdk/dist/index.d.ts.map +1 -0
- package/lib/sdk/dist/index.js +5 -0
- package/lib/sdk/dist/index.js.map +1 -0
- package/lib/sdk/package.json +5 -0
- package/lib/sdk/src/index.ts +4 -0
- package/lib/server/dist/index.d.ts +343 -0
- package/lib/server/dist/index.d.ts.map +1 -0
- package/lib/server/dist/index.js +1356 -0
- package/lib/server/dist/index.js.map +1 -0
- package/lib/server/dist/inspector-bundle.d.ts +6 -0
- package/lib/server/dist/inspector-bundle.d.ts.map +1 -0
- package/lib/server/dist/inspector-bundle.js +6 -0
- package/lib/server/dist/inspector-bundle.js.map +1 -0
- package/lib/server/dist/inspector.d.ts +3 -0
- package/lib/server/dist/inspector.d.ts.map +1 -0
- package/lib/server/dist/inspector.js +27 -0
- package/lib/server/dist/inspector.js.map +1 -0
- package/lib/server/package.json +5 -0
- package/lib/server/src/index.ts +1033 -0
- package/lib/server/src/inspector-bundle.ts +5 -0
- package/lib/server/src/inspector.ts +27 -0
- package/lib/server-node/dist/hardening.d.ts +19 -0
- package/lib/server-node/dist/hardening.d.ts.map +1 -0
- package/lib/server-node/dist/hardening.js +79 -0
- package/lib/server-node/dist/hardening.js.map +1 -0
- package/lib/server-node/dist/index.d.ts +18 -0
- package/lib/server-node/dist/index.d.ts.map +1 -0
- package/lib/server-node/dist/index.js +53 -0
- package/lib/server-node/dist/index.js.map +1 -0
- package/lib/server-node/dist/probe.d.ts +13 -0
- package/lib/server-node/dist/probe.d.ts.map +1 -0
- package/lib/server-node/dist/probe.js +44 -0
- package/lib/server-node/dist/probe.js.map +1 -0
- package/lib/server-node/dist/production.d.ts +32 -0
- package/lib/server-node/dist/production.d.ts.map +1 -0
- package/lib/server-node/dist/production.js +125 -0
- package/lib/server-node/dist/production.js.map +1 -0
- package/lib/server-node/package.json +5 -0
- package/lib/server-node/src/hardening.ts +79 -0
- package/lib/server-node/src/index.ts +58 -0
- package/lib/server-node/src/probe.ts +36 -0
- package/lib/server-node/src/production.ts +116 -0
- package/lib/storage/dist/index.d.ts +4 -0
- package/lib/storage/dist/index.d.ts.map +1 -0
- package/lib/storage/dist/index.js +5 -0
- package/lib/storage/dist/index.js.map +1 -0
- package/lib/storage/package.json +5 -0
- package/lib/storage/src/index.ts +5 -0
- package/lib/storage-contracts/dist/contracts.d.ts +69 -0
- package/lib/storage-contracts/dist/contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/contracts.js +15 -0
- package/lib/storage-contracts/dist/contracts.js.map +1 -0
- package/lib/storage-contracts/dist/durable-budget-contracts.d.ts +110 -0
- package/lib/storage-contracts/dist/durable-budget-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/durable-budget-contracts.js +430 -0
- package/lib/storage-contracts/dist/durable-budget-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/execution-wait-contracts.d.ts +74 -0
- package/lib/storage-contracts/dist/execution-wait-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/execution-wait-contracts.js +159 -0
- package/lib/storage-contracts/dist/execution-wait-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/index.d.ts +18 -0
- package/lib/storage-contracts/dist/index.d.ts.map +1 -0
- package/lib/storage-contracts/dist/index.js +18 -0
- package/lib/storage-contracts/dist/index.js.map +1 -0
- package/lib/storage-contracts/dist/memory-contracts.d.ts +208 -0
- package/lib/storage-contracts/dist/memory-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/memory-contracts.js +350 -0
- package/lib/storage-contracts/dist/memory-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +171 -0
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.js +2 -0
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/scheduler-contracts.d.ts +133 -0
- package/lib/storage-contracts/dist/scheduler-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/scheduler-contracts.js +2 -0
- package/lib/storage-contracts/dist/scheduler-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/submission-journal.d.ts +21 -0
- package/lib/storage-contracts/dist/submission-journal.d.ts.map +1 -0
- package/lib/storage-contracts/dist/submission-journal.js +51 -0
- package/lib/storage-contracts/dist/submission-journal.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-format2.d.ts +54 -0
- package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-format2.js +398 -0
- package/lib/storage-contracts/dist/workflow-format2.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-format3.d.ts +20 -0
- package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-format3.js +309 -0
- package/lib/storage-contracts/dist/workflow-format3.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-format4.d.ts +48 -0
- package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-format4.js +132 -0
- package/lib/storage-contracts/dist/workflow-format4.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-format5.d.ts +94 -0
- package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-format5.js +365 -0
- package/lib/storage-contracts/dist/workflow-format5.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +69 -0
- package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-graph-contracts.js +2 -0
- package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-graph-discovery.d.ts +45 -0
- package/lib/storage-contracts/dist/workflow-graph-discovery.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-graph-discovery.js +101 -0
- package/lib/storage-contracts/dist/workflow-graph-discovery.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-loop-format1.d.ts +52 -0
- package/lib/storage-contracts/dist/workflow-loop-format1.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-loop-format1.js +134 -0
- package/lib/storage-contracts/dist/workflow-loop-format1.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-saga-format1.d.ts +52 -0
- package/lib/storage-contracts/dist/workflow-saga-format1.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-saga-format1.js +235 -0
- package/lib/storage-contracts/dist/workflow-saga-format1.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +428 -0
- package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-tree-contracts.js +151 -0
- package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -0
- package/lib/storage-contracts/dist/workflow-tree-discovery.d.ts +38 -0
- package/lib/storage-contracts/dist/workflow-tree-discovery.d.ts.map +1 -0
- package/lib/storage-contracts/dist/workflow-tree-discovery.js +57 -0
- package/lib/storage-contracts/dist/workflow-tree-discovery.js.map +1 -0
- package/lib/storage-contracts/package.json +5 -0
- package/lib/storage-contracts/src/contracts.ts +73 -0
- package/lib/storage-contracts/src/durable-budget-contracts.ts +266 -0
- package/lib/storage-contracts/src/execution-wait-contracts.ts +169 -0
- package/lib/storage-contracts/src/index.ts +17 -0
- package/lib/storage-contracts/src/memory-contracts.ts +322 -0
- package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +88 -0
- package/lib/storage-contracts/src/scheduler-contracts.ts +68 -0
- package/lib/storage-contracts/src/submission-journal.ts +50 -0
- package/lib/storage-contracts/src/workflow-format2.ts +288 -0
- package/lib/storage-contracts/src/workflow-format3.ts +201 -0
- package/lib/storage-contracts/src/workflow-format4.ts +96 -0
- package/lib/storage-contracts/src/workflow-format5.ts +375 -0
- package/lib/storage-contracts/src/workflow-graph-contracts.ts +44 -0
- package/lib/storage-contracts/src/workflow-graph-discovery.ts +107 -0
- package/lib/storage-contracts/src/workflow-loop-format1.ts +102 -0
- package/lib/storage-contracts/src/workflow-saga-format1.ts +165 -0
- package/lib/storage-contracts/src/workflow-tree-contracts.ts +191 -0
- package/lib/storage-contracts/src/workflow-tree-discovery.ts +39 -0
- package/lib/storage-postgres/dist/index.d.ts +2 -0
- package/lib/storage-postgres/dist/index.d.ts.map +1 -0
- package/lib/storage-postgres/dist/index.js +2 -0
- package/lib/storage-postgres/dist/index.js.map +1 -0
- package/lib/storage-postgres/dist/postgres.d.ts +8 -0
- package/lib/storage-postgres/dist/postgres.d.ts.map +1 -0
- package/lib/storage-postgres/dist/postgres.js +233 -0
- package/lib/storage-postgres/dist/postgres.js.map +1 -0
- package/lib/storage-postgres/package.json +5 -0
- package/lib/storage-postgres/src/index.ts +1 -0
- package/lib/storage-postgres/src/postgres.ts +222 -0
- package/lib/storage-sql/dist/aggregate-session.d.ts +31 -0
- package/lib/storage-sql/dist/aggregate-session.d.ts.map +1 -0
- package/lib/storage-sql/dist/aggregate-session.js +78 -0
- package/lib/storage-sql/dist/aggregate-session.js.map +1 -0
- package/lib/storage-sql/dist/contracts.d.ts +2 -0
- package/lib/storage-sql/dist/contracts.d.ts.map +1 -0
- package/lib/storage-sql/dist/contracts.js +3 -0
- package/lib/storage-sql/dist/contracts.js.map +1 -0
- package/lib/storage-sql/dist/durable-budget-database.d.ts +33 -0
- package/lib/storage-sql/dist/durable-budget-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/durable-budget-database.js +191 -0
- package/lib/storage-sql/dist/durable-budget-database.js.map +1 -0
- package/lib/storage-sql/dist/durable-budget-state.d.ts +24 -0
- package/lib/storage-sql/dist/durable-budget-state.d.ts.map +1 -0
- package/lib/storage-sql/dist/durable-budget-state.js +211 -0
- package/lib/storage-sql/dist/durable-budget-state.js.map +1 -0
- package/lib/storage-sql/dist/durable-budget-validation.d.ts +5 -0
- package/lib/storage-sql/dist/durable-budget-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/durable-budget-validation.js +22 -0
- package/lib/storage-sql/dist/durable-budget-validation.js.map +1 -0
- package/lib/storage-sql/dist/execution-completions.d.ts +12 -0
- package/lib/storage-sql/dist/execution-completions.d.ts.map +1 -0
- package/lib/storage-sql/dist/execution-completions.js +60 -0
- package/lib/storage-sql/dist/execution-completions.js.map +1 -0
- package/lib/storage-sql/dist/execution-wait-database.d.ts +22 -0
- package/lib/storage-sql/dist/execution-wait-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/execution-wait-database.js +288 -0
- package/lib/storage-sql/dist/execution-wait-database.js.map +1 -0
- package/lib/storage-sql/dist/execution-wait-validation.d.ts +8 -0
- package/lib/storage-sql/dist/execution-wait-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/execution-wait-validation.js +125 -0
- package/lib/storage-sql/dist/execution-wait-validation.js.map +1 -0
- package/lib/storage-sql/dist/host.d.ts +22 -0
- package/lib/storage-sql/dist/host.d.ts.map +1 -0
- package/lib/storage-sql/dist/host.js +21 -0
- package/lib/storage-sql/dist/host.js.map +1 -0
- package/lib/storage-sql/dist/memory-database.d.ts +24 -0
- package/lib/storage-sql/dist/memory-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/memory-database.js +359 -0
- package/lib/storage-sql/dist/memory-database.js.map +1 -0
- package/lib/storage-sql/dist/scheduled-database.d.ts +74 -0
- package/lib/storage-sql/dist/scheduled-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/scheduled-database.js +1152 -0
- package/lib/storage-sql/dist/scheduled-database.js.map +1 -0
- package/lib/storage-sql/dist/scheduled-validation.d.ts +9 -0
- package/lib/storage-sql/dist/scheduled-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/scheduled-validation.js +200 -0
- package/lib/storage-sql/dist/scheduled-validation.js.map +1 -0
- package/lib/storage-sql/dist/scheduler-contracts.d.ts +2 -0
- package/lib/storage-sql/dist/scheduler-contracts.d.ts.map +1 -0
- package/lib/storage-sql/dist/scheduler-contracts.js +3 -0
- package/lib/storage-sql/dist/scheduler-contracts.js.map +1 -0
- package/lib/storage-sql/dist/scheduler-database.d.ts +55 -0
- package/lib/storage-sql/dist/scheduler-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/scheduler-database.js +655 -0
- package/lib/storage-sql/dist/scheduler-database.js.map +1 -0
- package/lib/storage-sql/dist/scheduler-validation.d.ts +22 -0
- package/lib/storage-sql/dist/scheduler-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/scheduler-validation.js +201 -0
- package/lib/storage-sql/dist/scheduler-validation.js.map +1 -0
- package/lib/storage-sql/dist/validation.d.ts +14 -0
- package/lib/storage-sql/dist/validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/validation.js +106 -0
- package/lib/storage-sql/dist/validation.js.map +1 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-index.d.ts +7 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-index.d.ts.map +1 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-index.js +55 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-index.js.map +1 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-validation.d.ts +5 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-validation.js +22 -0
- package/lib/storage-sql/dist/workflow-graph-discovery-validation.js.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-database.d.ts +270 -0
- package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-database.js +1692 -0
- package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-discovery-validation.d.ts +5 -0
- package/lib/storage-sql/dist/workflow-tree-discovery-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-discovery-validation.js +15 -0
- package/lib/storage-sql/dist/workflow-tree-discovery-validation.js.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-validation.d.ts +9 -0
- package/lib/storage-sql/dist/workflow-tree-validation.d.ts.map +1 -0
- package/lib/storage-sql/dist/workflow-tree-validation.js +576 -0
- package/lib/storage-sql/dist/workflow-tree-validation.js.map +1 -0
- package/lib/storage-sql/package.json +5 -0
- package/lib/storage-sql/src/aggregate-session.ts +72 -0
- package/lib/storage-sql/src/contracts.ts +2 -0
- package/lib/storage-sql/src/durable-budget-database.ts +180 -0
- package/lib/storage-sql/src/durable-budget-state.ts +155 -0
- package/lib/storage-sql/src/durable-budget-validation.ts +23 -0
- package/lib/storage-sql/src/execution-completions.ts +58 -0
- package/lib/storage-sql/src/execution-wait-database.ts +219 -0
- package/lib/storage-sql/src/execution-wait-validation.ts +108 -0
- package/lib/storage-sql/src/host.ts +21 -0
- package/lib/storage-sql/src/memory-database.ts +320 -0
- package/lib/storage-sql/src/scheduled-database.ts +811 -0
- package/lib/storage-sql/src/scheduled-validation.ts +89 -0
- package/lib/storage-sql/src/scheduler-contracts.ts +2 -0
- package/lib/storage-sql/src/scheduler-database.ts +475 -0
- package/lib/storage-sql/src/scheduler-validation.ts +112 -0
- package/lib/storage-sql/src/validation.ts +104 -0
- package/lib/storage-sql/src/workflow-graph-discovery-index.ts +60 -0
- package/lib/storage-sql/src/workflow-graph-discovery-validation.ts +21 -0
- package/lib/storage-sql/src/workflow-tree-database.ts +450 -0
- package/lib/storage-sql/src/workflow-tree-discovery-validation.ts +13 -0
- package/lib/storage-sql/src/workflow-tree-validation.ts +166 -0
- package/lib/storage-sqlite/dist/backup.d.ts +24 -0
- package/lib/storage-sqlite/dist/backup.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/backup.js +84 -0
- package/lib/storage-sqlite/dist/backup.js.map +1 -0
- package/lib/storage-sqlite/dist/index.d.ts +4 -0
- package/lib/storage-sqlite/dist/index.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/index.js +4 -0
- package/lib/storage-sqlite/dist/index.js.map +1 -0
- package/lib/storage-sqlite/dist/migrations.d.ts +6 -0
- package/lib/storage-sqlite/dist/migrations.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/migrations.js +50 -0
- package/lib/storage-sqlite/dist/migrations.js.map +1 -0
- package/lib/storage-sqlite/dist/sqlite-database.d.ts +36 -0
- package/lib/storage-sqlite/dist/sqlite-database.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/sqlite-database.js +179 -0
- package/lib/storage-sqlite/dist/sqlite-database.js.map +1 -0
- package/lib/storage-sqlite/dist/sqlite-worker.d.ts +2 -0
- package/lib/storage-sqlite/dist/sqlite-worker.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/sqlite-worker.js +95 -0
- package/lib/storage-sqlite/dist/sqlite-worker.js.map +1 -0
- package/lib/storage-sqlite/dist/sqlite.d.ts +7 -0
- package/lib/storage-sqlite/dist/sqlite.d.ts.map +1 -0
- package/lib/storage-sqlite/dist/sqlite.js +78 -0
- package/lib/storage-sqlite/dist/sqlite.js.map +1 -0
- package/lib/storage-sqlite/package.json +5 -0
- package/lib/storage-sqlite/src/backup.ts +58 -0
- package/lib/storage-sqlite/src/index.ts +3 -0
- package/lib/storage-sqlite/src/migrations.ts +46 -0
- package/lib/storage-sqlite/src/sqlite-database.ts +172 -0
- package/lib/storage-sqlite/src/sqlite-worker.ts +52 -0
- package/lib/storage-sqlite/src/sqlite.ts +72 -0
- package/lib/testing/dist/index.d.ts +10 -0
- package/lib/testing/dist/index.d.ts.map +1 -0
- package/lib/testing/dist/index.js +24 -0
- package/lib/testing/dist/index.js.map +1 -0
- package/lib/testing/package.json +5 -0
- package/lib/testing/src/index.ts +26 -0
- package/lib/tools/dist/batch.d.ts +71 -0
- package/lib/tools/dist/batch.d.ts.map +1 -0
- package/lib/tools/dist/batch.js +542 -0
- package/lib/tools/dist/batch.js.map +1 -0
- package/lib/tools/dist/budget-binding.d.ts +18 -0
- package/lib/tools/dist/budget-binding.d.ts.map +1 -0
- package/lib/tools/dist/budget-binding.js +65 -0
- package/lib/tools/dist/budget-binding.js.map +1 -0
- package/lib/tools/dist/context.d.ts +17 -0
- package/lib/tools/dist/context.d.ts.map +1 -0
- package/lib/tools/dist/context.js +52 -0
- package/lib/tools/dist/context.js.map +1 -0
- package/lib/tools/dist/host.d.ts +3 -0
- package/lib/tools/dist/host.d.ts.map +1 -0
- package/lib/tools/dist/host.js +3 -0
- package/lib/tools/dist/host.js.map +1 -0
- package/lib/tools/dist/index.d.ts +79 -0
- package/lib/tools/dist/index.d.ts.map +1 -0
- package/lib/tools/dist/index.js +462 -0
- package/lib/tools/dist/index.js.map +1 -0
- package/lib/tools/package.json +5 -0
- package/lib/tools/src/batch.ts +496 -0
- package/lib/tools/src/budget-binding.ts +63 -0
- package/lib/tools/src/context.ts +56 -0
- package/lib/tools/src/host.ts +2 -0
- package/lib/tools/src/index.ts +479 -0
- package/lib/workflows/dist/agents.d.ts +24 -0
- package/lib/workflows/dist/agents.d.ts.map +1 -0
- package/lib/workflows/dist/agents.js +55 -0
- package/lib/workflows/dist/agents.js.map +1 -0
- package/lib/workflows/dist/children-coordinator.d.ts +58 -0
- package/lib/workflows/dist/children-coordinator.d.ts.map +1 -0
- package/lib/workflows/dist/children-coordinator.js +148 -0
- package/lib/workflows/dist/children-coordinator.js.map +1 -0
- package/lib/workflows/dist/children-definition.d.ts +43 -0
- package/lib/workflows/dist/children-definition.d.ts.map +1 -0
- package/lib/workflows/dist/children-definition.js +74 -0
- package/lib/workflows/dist/children-definition.js.map +1 -0
- package/lib/workflows/dist/children-discovery.d.ts +20 -0
- package/lib/workflows/dist/children-discovery.d.ts.map +1 -0
- package/lib/workflows/dist/children-discovery.js +103 -0
- package/lib/workflows/dist/children-discovery.js.map +1 -0
- package/lib/workflows/dist/children-runtime.d.ts +72 -0
- package/lib/workflows/dist/children-runtime.d.ts.map +1 -0
- package/lib/workflows/dist/children-runtime.js +600 -0
- package/lib/workflows/dist/children-runtime.js.map +1 -0
- package/lib/workflows/dist/children.d.ts +9 -0
- package/lib/workflows/dist/children.d.ts.map +1 -0
- package/lib/workflows/dist/children.js +6 -0
- package/lib/workflows/dist/children.js.map +1 -0
- package/lib/workflows/dist/composite-fleet.d.ts +87 -0
- package/lib/workflows/dist/composite-fleet.d.ts.map +1 -0
- package/lib/workflows/dist/composite-fleet.js +259 -0
- package/lib/workflows/dist/composite-fleet.js.map +1 -0
- package/lib/workflows/dist/composite-host.d.ts +45 -0
- package/lib/workflows/dist/composite-host.d.ts.map +1 -0
- package/lib/workflows/dist/composite-host.js +132 -0
- package/lib/workflows/dist/composite-host.js.map +1 -0
- package/lib/workflows/dist/composites.d.ts +4 -0
- package/lib/workflows/dist/composites.d.ts.map +1 -0
- package/lib/workflows/dist/composites.js +3 -0
- package/lib/workflows/dist/composites.js.map +1 -0
- package/lib/workflows/dist/definition.d.ts +61 -0
- package/lib/workflows/dist/definition.d.ts.map +1 -0
- package/lib/workflows/dist/definition.js +112 -0
- package/lib/workflows/dist/definition.js.map +1 -0
- package/lib/workflows/dist/drain.d.ts +21 -0
- package/lib/workflows/dist/drain.d.ts.map +1 -0
- package/lib/workflows/dist/drain.js +53 -0
- package/lib/workflows/dist/drain.js.map +1 -0
- package/lib/workflows/dist/ephemeral.d.ts +24 -0
- package/lib/workflows/dist/ephemeral.d.ts.map +1 -0
- package/lib/workflows/dist/ephemeral.js +122 -0
- package/lib/workflows/dist/ephemeral.js.map +1 -0
- package/lib/workflows/dist/fleet-control.d.ts +129 -0
- package/lib/workflows/dist/fleet-control.d.ts.map +1 -0
- package/lib/workflows/dist/fleet-control.js +356 -0
- package/lib/workflows/dist/fleet-control.js.map +1 -0
- package/lib/workflows/dist/graph-coordinator.d.ts +60 -0
- package/lib/workflows/dist/graph-coordinator.d.ts.map +1 -0
- package/lib/workflows/dist/graph-coordinator.js +266 -0
- package/lib/workflows/dist/graph-coordinator.js.map +1 -0
- package/lib/workflows/dist/graph-definition.d.ts +40 -0
- package/lib/workflows/dist/graph-definition.d.ts.map +1 -0
- package/lib/workflows/dist/graph-definition.js +58 -0
- package/lib/workflows/dist/graph-definition.js.map +1 -0
- package/lib/workflows/dist/graph-discovery.d.ts +27 -0
- package/lib/workflows/dist/graph-discovery.d.ts.map +1 -0
- package/lib/workflows/dist/graph-discovery.js +165 -0
- package/lib/workflows/dist/graph-discovery.js.map +1 -0
- package/lib/workflows/dist/graphs.d.ts +55 -0
- package/lib/workflows/dist/graphs.d.ts.map +1 -0
- package/lib/workflows/dist/graphs.js +10 -0
- package/lib/workflows/dist/graphs.js.map +1 -0
- package/lib/workflows/dist/hook-relay.d.ts +67 -0
- package/lib/workflows/dist/hook-relay.d.ts.map +1 -0
- package/lib/workflows/dist/hook-relay.js +157 -0
- package/lib/workflows/dist/hook-relay.js.map +1 -0
- package/lib/workflows/dist/index.d.ts +16 -0
- package/lib/workflows/dist/index.d.ts.map +1 -0
- package/lib/workflows/dist/index.js +15 -0
- package/lib/workflows/dist/index.js.map +1 -0
- package/lib/workflows/dist/leadership.d.ts +33 -0
- package/lib/workflows/dist/leadership.d.ts.map +1 -0
- package/lib/workflows/dist/leadership.js +109 -0
- package/lib/workflows/dist/leadership.js.map +1 -0
- package/lib/workflows/dist/lifecycle-definition.d.ts +89 -0
- package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle-definition.js +137 -0
- package/lib/workflows/dist/lifecycle-definition.js.map +1 -0
- package/lib/workflows/dist/lifecycle-fleet.d.ts +90 -0
- package/lib/workflows/dist/lifecycle-fleet.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle-fleet.js +406 -0
- package/lib/workflows/dist/lifecycle-fleet.js.map +1 -0
- package/lib/workflows/dist/lifecycle-host.d.ts +44 -0
- package/lib/workflows/dist/lifecycle-host.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle-host.js +133 -0
- package/lib/workflows/dist/lifecycle-host.js.map +1 -0
- package/lib/workflows/dist/lifecycle-human-transport.d.ts +67 -0
- package/lib/workflows/dist/lifecycle-human-transport.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle-human-transport.js +149 -0
- package/lib/workflows/dist/lifecycle-human-transport.js.map +1 -0
- package/lib/workflows/dist/lifecycle-runtime.d.ts +115 -0
- package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle-runtime.js +831 -0
- package/lib/workflows/dist/lifecycle-runtime.js.map +1 -0
- package/lib/workflows/dist/lifecycle.d.ts +10 -0
- package/lib/workflows/dist/lifecycle.d.ts.map +1 -0
- package/lib/workflows/dist/lifecycle.js +7 -0
- package/lib/workflows/dist/lifecycle.js.map +1 -0
- package/lib/workflows/dist/loop-definition.d.ts +46 -0
- package/lib/workflows/dist/loop-definition.d.ts.map +1 -0
- package/lib/workflows/dist/loop-definition.js +55 -0
- package/lib/workflows/dist/loop-definition.js.map +1 -0
- package/lib/workflows/dist/loop-runtime.d.ts +47 -0
- package/lib/workflows/dist/loop-runtime.d.ts.map +1 -0
- package/lib/workflows/dist/loop-runtime.js +358 -0
- package/lib/workflows/dist/loop-runtime.js.map +1 -0
- package/lib/workflows/dist/loops.d.ts +6 -0
- package/lib/workflows/dist/loops.d.ts.map +1 -0
- package/lib/workflows/dist/loops.js +4 -0
- package/lib/workflows/dist/loops.js.map +1 -0
- package/lib/workflows/dist/migration-service.d.ts +55 -0
- package/lib/workflows/dist/migration-service.d.ts.map +1 -0
- package/lib/workflows/dist/migration-service.js +73 -0
- package/lib/workflows/dist/migration-service.js.map +1 -0
- package/lib/workflows/dist/migration.d.ts +123 -0
- package/lib/workflows/dist/migration.d.ts.map +1 -0
- package/lib/workflows/dist/migration.js +217 -0
- package/lib/workflows/dist/migration.js.map +1 -0
- package/lib/workflows/dist/operator-transports.d.ts +265 -0
- package/lib/workflows/dist/operator-transports.d.ts.map +1 -0
- package/lib/workflows/dist/operator-transports.js +404 -0
- package/lib/workflows/dist/operator-transports.js.map +1 -0
- package/lib/workflows/dist/reconciliation.d.ts +25 -0
- package/lib/workflows/dist/reconciliation.d.ts.map +1 -0
- package/lib/workflows/dist/reconciliation.js +109 -0
- package/lib/workflows/dist/reconciliation.js.map +1 -0
- package/lib/workflows/dist/runtime.d.ts +65 -0
- package/lib/workflows/dist/runtime.d.ts.map +1 -0
- package/lib/workflows/dist/runtime.js +492 -0
- package/lib/workflows/dist/runtime.js.map +1 -0
- package/lib/workflows/dist/saga-definition.d.ts +46 -0
- package/lib/workflows/dist/saga-definition.d.ts.map +1 -0
- package/lib/workflows/dist/saga-definition.js +71 -0
- package/lib/workflows/dist/saga-definition.js.map +1 -0
- package/lib/workflows/dist/saga-runtime.d.ts +51 -0
- package/lib/workflows/dist/saga-runtime.d.ts.map +1 -0
- package/lib/workflows/dist/saga-runtime.js +499 -0
- package/lib/workflows/dist/saga-runtime.js.map +1 -0
- package/lib/workflows/dist/sagas.d.ts +6 -0
- package/lib/workflows/dist/sagas.d.ts.map +1 -0
- package/lib/workflows/dist/sagas.js +4 -0
- package/lib/workflows/dist/sagas.js.map +1 -0
- package/lib/workflows/dist/scheduled-helpers.d.ts +53 -0
- package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -0
- package/lib/workflows/dist/scheduled-helpers.js +230 -0
- package/lib/workflows/dist/scheduled-helpers.js.map +1 -0
- package/lib/workflows/dist/scheduled.d.ts +116 -0
- package/lib/workflows/dist/scheduled.d.ts.map +1 -0
- package/lib/workflows/dist/scheduled.js +781 -0
- package/lib/workflows/dist/scheduled.js.map +1 -0
- package/lib/workflows/dist/traces.d.ts +158 -0
- package/lib/workflows/dist/traces.d.ts.map +1 -0
- package/lib/workflows/dist/traces.js +366 -0
- package/lib/workflows/dist/traces.js.map +1 -0
- package/lib/workflows/dist/versions.d.ts +57 -0
- package/lib/workflows/dist/versions.d.ts.map +1 -0
- package/lib/workflows/dist/versions.js +87 -0
- package/lib/workflows/dist/versions.js.map +1 -0
- package/lib/workflows/dist/worker.d.ts +51 -0
- package/lib/workflows/dist/worker.d.ts.map +1 -0
- package/lib/workflows/dist/worker.js +143 -0
- package/lib/workflows/dist/worker.js.map +1 -0
- package/lib/workflows/package.json +5 -0
- package/lib/workflows/src/agents.ts +65 -0
- package/lib/workflows/src/children-coordinator.ts +50 -0
- package/lib/workflows/src/children-definition.ts +88 -0
- package/lib/workflows/src/children-discovery.ts +32 -0
- package/lib/workflows/src/children-runtime.ts +169 -0
- package/lib/workflows/src/children.ts +12 -0
- package/lib/workflows/src/composite-fleet.ts +155 -0
- package/lib/workflows/src/composite-host.ts +67 -0
- package/lib/workflows/src/composites.ts +6 -0
- package/lib/workflows/src/definition.ts +113 -0
- package/lib/workflows/src/drain.ts +56 -0
- package/lib/workflows/src/ephemeral.ts +124 -0
- package/lib/workflows/src/fleet-control.ts +326 -0
- package/lib/workflows/src/graph-coordinator.ts +223 -0
- package/lib/workflows/src/graph-definition.ts +70 -0
- package/lib/workflows/src/graph-discovery.ts +145 -0
- package/lib/workflows/src/graphs.ts +56 -0
- package/lib/workflows/src/hook-relay.ts +177 -0
- package/lib/workflows/src/index.ts +27 -0
- package/lib/workflows/src/leadership.ts +102 -0
- package/lib/workflows/src/lifecycle-definition.ts +194 -0
- package/lib/workflows/src/lifecycle-fleet.ts +346 -0
- package/lib/workflows/src/lifecycle-host.ts +109 -0
- package/lib/workflows/src/lifecycle-human-transport.ts +170 -0
- package/lib/workflows/src/lifecycle-runtime.ts +673 -0
- package/lib/workflows/src/lifecycle.ts +59 -0
- package/lib/workflows/src/loop-definition.ts +62 -0
- package/lib/workflows/src/loop-runtime.ts +260 -0
- package/lib/workflows/src/loops.ts +7 -0
- package/lib/workflows/src/migration-service.ts +83 -0
- package/lib/workflows/src/migration.ts +242 -0
- package/lib/workflows/src/operator-transports.ts +439 -0
- package/lib/workflows/src/reconciliation.ts +121 -0
- package/lib/workflows/src/runtime.ts +348 -0
- package/lib/workflows/src/saga-definition.ts +104 -0
- package/lib/workflows/src/saga-runtime.ts +406 -0
- package/lib/workflows/src/sagas.ts +24 -0
- package/lib/workflows/src/scheduled-helpers.ts +214 -0
- package/lib/workflows/src/scheduled.ts +707 -0
- package/lib/workflows/src/traces.ts +381 -0
- package/lib/workflows/src/versions.ts +114 -0
- package/lib/workflows/src/worker.ts +115 -0
- package/lib/workstream/dist/executions.d.ts +34 -0
- package/lib/workstream/dist/executions.d.ts.map +1 -0
- package/lib/workstream/dist/executions.js +344 -0
- package/lib/workstream/dist/executions.js.map +1 -0
- package/lib/workstream/dist/humans.d.ts +76 -0
- package/lib/workstream/dist/humans.d.ts.map +1 -0
- package/lib/workstream/dist/humans.js +273 -0
- package/lib/workstream/dist/humans.js.map +1 -0
- package/lib/workstream/dist/index.d.ts +61 -0
- package/lib/workstream/dist/index.d.ts.map +1 -0
- package/lib/workstream/dist/index.js +310 -0
- package/lib/workstream/dist/index.js.map +1 -0
- package/lib/workstream/dist/timers.d.ts +41 -0
- package/lib/workstream/dist/timers.d.ts.map +1 -0
- package/lib/workstream/dist/timers.js +240 -0
- package/lib/workstream/dist/timers.js.map +1 -0
- package/lib/workstream/dist/webhooks.d.ts +69 -0
- package/lib/workstream/dist/webhooks.d.ts.map +1 -0
- package/lib/workstream/dist/webhooks.js +313 -0
- package/lib/workstream/dist/webhooks.js.map +1 -0
- package/lib/workstream/package.json +5 -0
- package/lib/workstream/src/executions.ts +253 -0
- package/lib/workstream/src/humans.ts +323 -0
- package/lib/workstream/src/index.ts +279 -0
- package/lib/workstream/src/timers.ts +212 -0
- package/lib/workstream/src/webhooks.ts +180 -0
- package/package.json +281 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { MayuraError, jsonValue } from '../../core/dist/index.js';
|
|
2
|
+
import { StorageError } from '../../storage-contracts/dist/index.js';
|
|
3
|
+
import { digest } from './definition.js';
|
|
4
|
+
import { graphFleetTarget, lifecycleFleetTarget, treeFleetTarget } from './fleet-control.js';
|
|
5
|
+
import { createWorkflowMigrationService, pinnedDefinitionHash } from './migration-service.js';
|
|
6
|
+
const hashPattern = /^[a-f0-9]{64}$/;
|
|
7
|
+
const commandPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
8
|
+
const outcomes = new Set(['applied', 'conflict', 'not_found']);
|
|
9
|
+
const isCode = (error, code) => (error instanceof StorageError || error instanceof MayuraError) && error.code === code;
|
|
10
|
+
/** Durable, aggregate-backed command journal. One small permanent record per command id. */
|
|
11
|
+
export function createWorkflowCommandJournal(options) {
|
|
12
|
+
const { store } = options;
|
|
13
|
+
const leaseMs = options.leaseMs ?? 60_000;
|
|
14
|
+
const now = options.now ?? Date.now;
|
|
15
|
+
if (!store || typeof store.create !== 'function' || typeof store.update !== 'function' || !Number.isSafeInteger(leaseMs) || leaseMs < 1_000 || leaseMs > 3_600_000) {
|
|
16
|
+
throw new MayuraError('INVALID_CONFIG', 'A workflow command journal needs an aggregate store and a lease between 1 s and 1 h.');
|
|
17
|
+
}
|
|
18
|
+
const scope = digest('mayura:workflow-command-journal:v1', { principalId: options.scope?.principalId, projectId: options.scope?.projectId });
|
|
19
|
+
const definitionHash = digest('mayura:workflow-command-format:v1', {});
|
|
20
|
+
const decode = (record) => {
|
|
21
|
+
const state = record.state;
|
|
22
|
+
if (record.definitionHash !== definitionHash || state?.format !== 1 || typeof state.digest !== 'string' || !hashPattern.test(state.digest)
|
|
23
|
+
|| !['pending', 'completed'].includes(state.status) || !Number.isSafeInteger(state.attempt) || state.attempt < 1 || !Number.isSafeInteger(state.leaseUntilMs)
|
|
24
|
+
|| (state.status === 'completed') !== (state.outcome !== null && outcomes.has(state.outcome))) {
|
|
25
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored workflow command failed integrity validation.');
|
|
26
|
+
}
|
|
27
|
+
return state;
|
|
28
|
+
};
|
|
29
|
+
const write = (record, state, type) => store.update({ scope, id: record.id, expectedVersion: record.version,
|
|
30
|
+
state: state, events: [{ type, data: { attempt: state.attempt, ...(state.outcome ? { outcome: state.outcome } : {}) } }] });
|
|
31
|
+
return Object.freeze({
|
|
32
|
+
async run(command) {
|
|
33
|
+
if (typeof command?.runId !== 'string' || !hashPattern.test(command.runId) || typeof command.action !== 'string' || !/^[a-z][a-z-]{0,31}$/.test(command.action)
|
|
34
|
+
|| typeof command.commandId !== 'string' || !commandPattern.test(command.commandId))
|
|
35
|
+
throw new MayuraError('INVALID_INPUT', 'A workflow command needs a run id, an action and a bounded command id.');
|
|
36
|
+
const id = digest('mayura:workflow-command-entry:v1', { runId: command.runId, commandId: command.commandId });
|
|
37
|
+
const requestDigest = digest('mayura:workflow-command-request:v1', { runId: command.runId, action: command.action, request: jsonValue(command.request, { maxBytes: 65_536 }) });
|
|
38
|
+
// A failed attempt releases its lease so a retry can take over at once (after checking whether the effect happened).
|
|
39
|
+
const attemptOn = async (record, state, operation) => {
|
|
40
|
+
let result;
|
|
41
|
+
try {
|
|
42
|
+
result = await operation();
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
await write(record, { ...state, leaseUntilMs: 0 }, 'command.released').catch(() => undefined);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
return finish(record, state, result);
|
|
49
|
+
};
|
|
50
|
+
const finish = async (record, state, result) => {
|
|
51
|
+
if (!outcomes.has(result?.outcome))
|
|
52
|
+
throw new MayuraError('INVALID_INPUT', 'A workflow command must report applied, conflict or not_found.');
|
|
53
|
+
const detail = result.detail === undefined ? null : jsonValue(result.detail, { maxBytes: 262_144 });
|
|
54
|
+
try {
|
|
55
|
+
await write(record, { ...state, status: 'completed', outcome: result.outcome, detail }, 'command.completed');
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (!isCode(error, 'CONFLICT'))
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
return detail === null ? { outcome: result.outcome } : { outcome: result.outcome, detail };
|
|
62
|
+
};
|
|
63
|
+
for (let attempt = 0; attempt < 8; attempt++) {
|
|
64
|
+
const existing = await store.read(scope, id);
|
|
65
|
+
if (!existing) {
|
|
66
|
+
const state = { format: 1, digest: requestDigest, action: command.action, status: 'pending', attempt: 1, leaseUntilMs: now() + leaseMs, outcome: null, detail: null };
|
|
67
|
+
let created;
|
|
68
|
+
try {
|
|
69
|
+
created = await store.create({ scope, id, idempotencyKey: id, definitionHash, state: state, events: [{ type: 'command.claimed', data: { action: command.action } }] });
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (isCode(error, 'CONFLICT'))
|
|
73
|
+
continue;
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
if (!created.created)
|
|
77
|
+
continue;
|
|
78
|
+
return attemptOn(created.record, state, command.apply);
|
|
79
|
+
}
|
|
80
|
+
const state = decode(existing);
|
|
81
|
+
if (state.digest !== requestDigest)
|
|
82
|
+
return { outcome: 'conflict' };
|
|
83
|
+
if (state.status === 'completed')
|
|
84
|
+
return state.detail === null ? { outcome: state.outcome } : { outcome: state.outcome, detail: state.detail };
|
|
85
|
+
// Another attempt owns the command until its lease ends; answering conflict makes the client re-read.
|
|
86
|
+
if (state.leaseUntilMs > now())
|
|
87
|
+
return { outcome: 'conflict' };
|
|
88
|
+
let taken;
|
|
89
|
+
const next = { ...state, attempt: state.attempt + 1, leaseUntilMs: now() + leaseMs };
|
|
90
|
+
try {
|
|
91
|
+
taken = await write(existing, next, 'command.retaken');
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (isCode(error, 'CONFLICT'))
|
|
95
|
+
continue;
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
// The abandoned attempt may have applied its effect before dying: never apply twice.
|
|
99
|
+
return attemptOn(taken, next, async () => (await command.observe()) ? { outcome: 'applied' } : command.apply());
|
|
100
|
+
}
|
|
101
|
+
return { outcome: 'conflict' };
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const catalog = (definitions) => {
|
|
106
|
+
if (!Array.isArray(definitions) || definitions.length < 1 || definitions.length > 256)
|
|
107
|
+
throw new MayuraError('INVALID_CONFIG', 'An operator target needs 1–256 registered definitions.');
|
|
108
|
+
return new Map(definitions.map(definition => [definition.digest, definition]));
|
|
109
|
+
};
|
|
110
|
+
const project = (format, definition, snapshot, subjects = new Map()) => Object.freeze({
|
|
111
|
+
format, definitionId: definition.id, definitionVersion: definition.version, runId: snapshot.id, revision: snapshot.version, status: snapshot.status,
|
|
112
|
+
nodes: definition.nodes.map(node => ({ id: node.id, kind: node.kind, dependsOn: [...(node.dependsOn ?? [])] })),
|
|
113
|
+
steps: definition.nodes.map(node => {
|
|
114
|
+
const step = snapshot.steps[node.id];
|
|
115
|
+
// Lifecycle and graph tool steps carry their own approval; a tree's approvals live in its child runs.
|
|
116
|
+
const pending = format !== 4 && step.status === 'waiting' && step.approval ? step.approval : null;
|
|
117
|
+
const subject = pending ? subjects.get(node.id) : undefined;
|
|
118
|
+
// A lifecycle step whose condition did not hold shows as skipped: it never ran.
|
|
119
|
+
const status = (step.status === 'bypassed' ? 'skipped' : step.status);
|
|
120
|
+
return { id: node.id, kind: node.kind, status, ...(step.child?.runId ? { childRunId: step.child.runId } : {}),
|
|
121
|
+
...(pending ? { approval: { digest: pending.digest, expiresAtMs: pending.expiresAt, ...(subject ? { subject } : {}) } } : {}) };
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
const approval = (credential, actorId) => {
|
|
125
|
+
if (!credential)
|
|
126
|
+
throw new MayuraError('UNSUPPORTED_PROFILE', 'Operator approvals need an approval credential mapping.');
|
|
127
|
+
return credential(actorId);
|
|
128
|
+
};
|
|
129
|
+
const owned = async (read) => {
|
|
130
|
+
try {
|
|
131
|
+
return await read();
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (isCode(error, 'NOT_FOUND') || isCode(error, 'CONFLICT') || isCode(error, 'INVALID_INPUT'))
|
|
135
|
+
return null;
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/** Format-5 lifecycle runs through the fleet runtime and its index. */
|
|
140
|
+
export function lifecycleOperatorTarget(options) {
|
|
141
|
+
const { runtime, store, scope } = options;
|
|
142
|
+
const definitions = catalog(options.definitions);
|
|
143
|
+
const scopeKey = digest('mayura:scope:v1', { principalId: scope.principalId, projectId: scope.projectId });
|
|
144
|
+
return Object.freeze({ name: options.name ?? 'lifecycle',
|
|
145
|
+
async page(after, limit) {
|
|
146
|
+
// Cursor string: `<shard>` or `<shard>.<afterId>` over the 256 index shards.
|
|
147
|
+
const match = after === null ? null : /^(\d{1,3})(?:\.([a-f0-9]{64}))?$/.exec(after);
|
|
148
|
+
if (after !== null && (!match || Number(match[1]) > 255))
|
|
149
|
+
throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle index cursor.');
|
|
150
|
+
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 });
|
|
151
|
+
const items = page.candidates.flatMap(candidate => {
|
|
152
|
+
const definition = definitions.get(candidate.definitionHash);
|
|
153
|
+
return definition
|
|
154
|
+
? [{ format: 5, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.runId, revision: candidate.version, status: candidate.status }] : [];
|
|
155
|
+
});
|
|
156
|
+
const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;
|
|
157
|
+
return { items, next };
|
|
158
|
+
},
|
|
159
|
+
async settledPage(after, limit) {
|
|
160
|
+
const match = after === null ? null : /^(\d{1,3})(?:\.([a-f0-9]{64}))?$/.exec(after);
|
|
161
|
+
if (after !== null && (!match || Number(match[1]) > 255))
|
|
162
|
+
throw new MayuraError('INVALID_INPUT', 'Invalid lifecycle settled cursor.');
|
|
163
|
+
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 });
|
|
164
|
+
const items = page.entries.flatMap(entry => {
|
|
165
|
+
const definition = definitions.get(entry.definitionHash);
|
|
166
|
+
return definition
|
|
167
|
+
? [{ format: 5, definitionId: definition.id, definitionVersion: definition.version, runId: entry.runId, revision: entry.version, status: entry.status, settledAtMs: entry.settledAtMs }] : [];
|
|
168
|
+
});
|
|
169
|
+
const next = page.nextCursor ? `${page.nextCursor.shard}${page.nextCursor.afterId ? `.${page.nextCursor.afterId}` : ''}` : null;
|
|
170
|
+
return { items, next };
|
|
171
|
+
},
|
|
172
|
+
async view(runId) {
|
|
173
|
+
const hash = await pinnedDefinitionHash(store, scope, runId);
|
|
174
|
+
const definition = hash === undefined ? undefined : definitions.get(hash);
|
|
175
|
+
if (!definition)
|
|
176
|
+
return null;
|
|
177
|
+
const snapshot = await owned(() => runtime.inspect(runId));
|
|
178
|
+
if (!snapshot)
|
|
179
|
+
return null;
|
|
180
|
+
// Show each pending approval's exact tool call; the runtime verifies it reproduces the approval digest.
|
|
181
|
+
const subjects = new Map();
|
|
182
|
+
for (const [nodeId, step] of Object.entries(snapshot.steps)) {
|
|
183
|
+
if (step.kind !== 'tool' || step.status !== 'waiting' || !step.approval)
|
|
184
|
+
continue;
|
|
185
|
+
const request = await owned(() => runtime.approvalRequest(definition, runId, nodeId));
|
|
186
|
+
// A large input is left out rather than truncated; the digest still identifies exactly what is approved.
|
|
187
|
+
if (request && request.digest === step.approval.digest && Buffer.byteLength(JSON.stringify(request.input), 'utf8') <= 8_192) {
|
|
188
|
+
subjects.set(nodeId, { toolId: request.toolId, toolVersion: request.toolVersion, input: request.input });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return project(5, definition, snapshot, subjects);
|
|
192
|
+
},
|
|
193
|
+
pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),
|
|
194
|
+
approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),
|
|
195
|
+
migrate: (migration, command) => runtime.migrate(migration, command),
|
|
196
|
+
fleet: lifecycleFleetTarget(runtime, options.name ?? 'lifecycle'), });
|
|
197
|
+
}
|
|
198
|
+
/** Format-3 graph runs through discovery and the graph runtime. */
|
|
199
|
+
export function graphOperatorTarget(options) {
|
|
200
|
+
const { runtime, discovery, store, scope } = options;
|
|
201
|
+
const definitions = catalog(options.definitions);
|
|
202
|
+
return Object.freeze({ name: options.name ?? 'graphs',
|
|
203
|
+
async page(after, limit) {
|
|
204
|
+
const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });
|
|
205
|
+
const items = page.candidates.flatMap(candidate => {
|
|
206
|
+
const definition = definitions.get(candidate.reference.definitionHash);
|
|
207
|
+
return definition
|
|
208
|
+
? [{ format: 3, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.reference.runId, revision: candidate.version, status: candidate.status }] : [];
|
|
209
|
+
});
|
|
210
|
+
return { items, next: page.nextCursor ? page.nextCursor.afterId : null };
|
|
211
|
+
},
|
|
212
|
+
async view(runId) {
|
|
213
|
+
const hash = await pinnedDefinitionHash(store, scope, runId);
|
|
214
|
+
const definition = hash === undefined ? undefined : definitions.get(hash);
|
|
215
|
+
if (!definition)
|
|
216
|
+
return null;
|
|
217
|
+
const snapshot = await owned(() => runtime.inspect(runId));
|
|
218
|
+
return snapshot ? project(3, definition, snapshot) : null;
|
|
219
|
+
},
|
|
220
|
+
pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),
|
|
221
|
+
approve: (id, command) => runtime.approve({ id, nodeId: command.nodeId, digest: command.digest, credential: approval(options.approvalCredential, command.actorId) }),
|
|
222
|
+
migrate: (migration, command) => runtime.migrate(migration, command),
|
|
223
|
+
fleet: graphFleetTarget(discovery, runtime, options.name ?? 'graphs'), });
|
|
224
|
+
}
|
|
225
|
+
/** Format-4 workflow trees through discovery and the tree runtime. */
|
|
226
|
+
export function treeOperatorTarget(options) {
|
|
227
|
+
const { runtime, discovery, store, scope } = options;
|
|
228
|
+
const definitions = catalog(options.definitions);
|
|
229
|
+
return Object.freeze({ name: options.name ?? 'trees',
|
|
230
|
+
async page(after, limit) {
|
|
231
|
+
const page = await discovery.scan({ ...(after === null ? {} : { cursor: discovery.cursorAfter(after) }), limit: Math.min(limit, 32) });
|
|
232
|
+
const items = page.candidates.flatMap(candidate => {
|
|
233
|
+
const definition = definitions.get(candidate.definitionHash);
|
|
234
|
+
return definition
|
|
235
|
+
? [{ format: 4, definitionId: definition.id, definitionVersion: definition.version, runId: candidate.rootId, revision: candidate.version, status: candidate.status }] : [];
|
|
236
|
+
});
|
|
237
|
+
return { items, next: page.nextCursor ? page.nextCursor.afterId : null };
|
|
238
|
+
},
|
|
239
|
+
async view(runId) {
|
|
240
|
+
const hash = await pinnedDefinitionHash(store, scope, runId);
|
|
241
|
+
const definition = hash === undefined ? undefined : definitions.get(hash);
|
|
242
|
+
if (!definition)
|
|
243
|
+
return null;
|
|
244
|
+
const snapshot = await owned(() => runtime.inspect(runId));
|
|
245
|
+
return snapshot ? project(4, definition, snapshot) : null;
|
|
246
|
+
},
|
|
247
|
+
pause: id => runtime.pause(id), resume: id => runtime.resume(id), cancel: id => runtime.cancel(id),
|
|
248
|
+
approve: (id, command) => runtime.approve({ id, ...(command.childRunId ? { childId: command.childRunId } : {}), nodeId: command.nodeId, digest: command.digest,
|
|
249
|
+
credential: approval(options.approvalCredential, command.actorId) }),
|
|
250
|
+
migrate: (migration, command) => runtime.migrate(migration, command),
|
|
251
|
+
fleet: treeFleetTarget(discovery, runtime, options.name ?? 'trees'), });
|
|
252
|
+
}
|
|
253
|
+
/** Server transports (`workflowIndex`, `workflowViews`, `workflowControls`, `workflowPauses`, `workflowResumes`, and optionally `workflowFleet` and `workflowMigrations`). */
|
|
254
|
+
export function createWorkflowOperatorTransports(options) {
|
|
255
|
+
const { targets, journal } = options;
|
|
256
|
+
if (!Array.isArray(targets) || targets.length < 1 || targets.length > 16 || new Set(targets.map(target => target.name)).size !== targets.length
|
|
257
|
+
|| targets.some(target => !/^[a-z][a-z0-9-]{0,31}$/.test(target.name)) || !journal || typeof journal.run !== 'function') {
|
|
258
|
+
throw new MayuraError('INVALID_CONFIG', 'Operator transports need 1–16 uniquely named targets and a command journal.');
|
|
259
|
+
}
|
|
260
|
+
if (!options.store || typeof options.store.read !== 'function' || typeof options.scope?.principalId !== 'string' || typeof options.scope.projectId !== 'string') {
|
|
261
|
+
throw new MayuraError('INVALID_CONFIG', 'Operator transports need the store and the scope they serve.');
|
|
262
|
+
}
|
|
263
|
+
const served = options.scope;
|
|
264
|
+
const inScope = (input) => input?.scope?.principalId === served.principalId && input.scope.projectId === served.projectId;
|
|
265
|
+
const locate = async (runId) => {
|
|
266
|
+
if (!hashPattern.test(runId))
|
|
267
|
+
return null;
|
|
268
|
+
for (const target of targets) {
|
|
269
|
+
const view = await target.view(runId);
|
|
270
|
+
if (view)
|
|
271
|
+
return { target, view };
|
|
272
|
+
}
|
|
273
|
+
return null;
|
|
274
|
+
};
|
|
275
|
+
const conflicts = (error) => isCode(error, 'CONFLICT') ? 'conflict' : isCode(error, 'NOT_FOUND') ? 'not_found' : undefined;
|
|
276
|
+
/** 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) => {
|
|
278
|
+
if (!inScope(input))
|
|
279
|
+
return { status: 'not_found' };
|
|
280
|
+
const found = await locate(input.runId);
|
|
281
|
+
if (!found)
|
|
282
|
+
return { status: 'not_found' };
|
|
283
|
+
const { outcome } = await journal.run({ runId: input.runId, action, commandId: input.commandId, request: { revision: input.revision, request },
|
|
284
|
+
observe: async () => { const current = await found.target.view(input.runId); return current !== null && observe(current); },
|
|
285
|
+
apply: async () => {
|
|
286
|
+
const current = await found.target.view(input.runId);
|
|
287
|
+
if (!current)
|
|
288
|
+
return { outcome: 'not_found' };
|
|
289
|
+
if (current.revision !== input.revision)
|
|
290
|
+
return { outcome: 'conflict' };
|
|
291
|
+
try {
|
|
292
|
+
await operate(found.target);
|
|
293
|
+
return { outcome: 'applied' };
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
const mapped = conflicts(error);
|
|
297
|
+
if (mapped)
|
|
298
|
+
return { outcome: mapped };
|
|
299
|
+
throw error;
|
|
300
|
+
}
|
|
301
|
+
} });
|
|
302
|
+
if (outcome !== 'applied')
|
|
303
|
+
return { status: outcome };
|
|
304
|
+
const workflow = await found.target.view(input.runId);
|
|
305
|
+
return workflow ? { status: 'applied', workflow } : { status: 'not_found' };
|
|
306
|
+
};
|
|
307
|
+
const decode = (after) => {
|
|
308
|
+
if (after === null)
|
|
309
|
+
return { index: 0, inner: null };
|
|
310
|
+
const match = /^(\d{1,2}):(-|[A-Za-z0-9.]{1,124})$/.exec(after);
|
|
311
|
+
if (!match || Number(match[1]) >= targets.length)
|
|
312
|
+
throw new MayuraError('INVALID_INPUT', 'Invalid workflow index cursor.');
|
|
313
|
+
return { index: Number(match[1]), inner: match[2] === '-' ? null : match[2] };
|
|
314
|
+
};
|
|
315
|
+
const transports = {
|
|
316
|
+
workflowIndex: { list: async (input) => {
|
|
317
|
+
if (!inScope(input))
|
|
318
|
+
return { items: [], next: null };
|
|
319
|
+
// One target per page: a short page is normal and the cursor moves on to the next format. The settled view
|
|
320
|
+
// reads only targets that keep settled runs.
|
|
321
|
+
const settled = input.view === 'settled';
|
|
322
|
+
const { index, inner } = decode(input.after);
|
|
323
|
+
const target = targets[index];
|
|
324
|
+
const page = !settled ? await target.page(inner, input.limit) : target.settledPage ? await target.settledPage(inner, input.limit) : { items: [], next: null };
|
|
325
|
+
const following = targets.findIndex((candidate, position) => position > index && (!settled || candidate.settledPage !== undefined));
|
|
326
|
+
const next = page.next !== null ? `${index}:${page.next}` : following >= 0 ? `${following}:-` : null;
|
|
327
|
+
return { items: page.items.slice(0, input.limit), next };
|
|
328
|
+
} },
|
|
329
|
+
workflowViews: { inspect: async (input) => inScope(input) ? (await locate(input.runId))?.view ?? null : null },
|
|
330
|
+
workflowControls: {
|
|
331
|
+
cancel: (input) => command(input, 'cancel', null, view => view.status === 'cancelled', target => target.cancel(input.runId)),
|
|
332
|
+
approve: (input) => command(input, 'approve', { nodeId: input.nodeId, approvalDigest: input.approvalDigest, childRunId: input.childRunId },
|
|
333
|
+
// A child's approval is not visible on the root view; re-applying it is safe because approvals are digest-bound.
|
|
334
|
+
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
|
+
},
|
|
336
|
+
workflowPauses: { pause: (input) => command(input, 'pause', null, view => view.status === 'paused', target => target.pause(input.runId)) },
|
|
337
|
+
workflowResumes: { resume: (input) => command(input, 'resume', null, view => view.status !== 'paused', async (target) => { if ((await target.view(input.runId))?.status === 'paused')
|
|
338
|
+
await target.resume(input.runId); }) },
|
|
339
|
+
...(options.fleet ? { workflowFleet: fleetTransport(options.fleet, targets.map(target => target.fleet), inScope) } : {}),
|
|
340
|
+
...(options.migrations ? { workflowMigrations: migrationTransport(options.migrations, options.store, served, locate, journal, inScope) } : {}),
|
|
341
|
+
};
|
|
342
|
+
return Object.freeze(transports);
|
|
343
|
+
}
|
|
344
|
+
function fleetTransport(fleet, targets, inScope) {
|
|
345
|
+
const guard = (input) => { if (!inScope(input))
|
|
346
|
+
throw new MayuraError('PERMISSION_DENIED', 'This fleet belongs to another scope.'); };
|
|
347
|
+
return {
|
|
348
|
+
inspect: async (input) => { guard(input); return fleet.inspect(); },
|
|
349
|
+
hold: async (input) => { guard(input); return fleet.hold(); },
|
|
350
|
+
release: async (input) => { guard(input); return fleet.release(); },
|
|
351
|
+
sweep: async (input) => {
|
|
352
|
+
guard(input);
|
|
353
|
+
try {
|
|
354
|
+
const sweep = input.phase === 'pause' ? await fleet.sweepPause(targets, { cursor: input.cursor, limit: input.limit })
|
|
355
|
+
: await fleet.sweepResume(targets, { cursor: input.cursor, limit: input.limit });
|
|
356
|
+
return { status: 'applied', sweep: sweep };
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
if (isCode(error, 'CONFLICT'))
|
|
360
|
+
return { status: 'conflict' };
|
|
361
|
+
throw error;
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function migrationTransport(catalogue, store, scope, locate, journal, inScope) {
|
|
367
|
+
const service = async (runId) => {
|
|
368
|
+
const found = await locate(runId);
|
|
369
|
+
if (!found)
|
|
370
|
+
return null;
|
|
371
|
+
return { found, service: createWorkflowMigrationService({ catalog: catalogue, pinned: id => pinnedDefinitionHash(store, scope, id),
|
|
372
|
+
inspect: async (id) => ({ version: (await found.target.view(id))?.revision ?? -1 }), migrate: (migration, command) => found.target.migrate(migration, command) }) };
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
list: async (input) => inScope(input) ? (await service(input.runId))?.service.list(input.runId) ?? null : null,
|
|
376
|
+
plan: async (input) => inScope(input) ? (await service(input.runId))?.service.plan(input.runId, input.migrationId) ?? null : null,
|
|
377
|
+
apply: async (input) => {
|
|
378
|
+
const resolved = inScope(input) ? await service(input.runId) : null;
|
|
379
|
+
if (!resolved)
|
|
380
|
+
return { status: 'not_found' };
|
|
381
|
+
let refused;
|
|
382
|
+
const target = catalogue.get(input.migrationId)?.to?.digest;
|
|
383
|
+
const result = await journal.run({ runId: input.runId, action: 'migrate', commandId: input.commandId, request: { revision: input.revision, migrationId: input.migrationId },
|
|
384
|
+
observe: async () => target !== undefined && (await pinnedDefinitionHash(store, scope, input.runId)) === target,
|
|
385
|
+
apply: async () => {
|
|
386
|
+
const applied = await resolved.service.apply(input.runId, input.migrationId, { revision: input.revision, actorId: input.actorId, commandId: input.commandId });
|
|
387
|
+
if (applied.status === 'refused') {
|
|
388
|
+
refused = applied.plan;
|
|
389
|
+
return { outcome: 'conflict' };
|
|
390
|
+
}
|
|
391
|
+
// The applied plan is recorded with the command, so a retry reports the same plan.
|
|
392
|
+
return applied.status === 'applied' ? { outcome: 'applied', detail: applied.plan } : { outcome: applied.status };
|
|
393
|
+
} });
|
|
394
|
+
if (refused)
|
|
395
|
+
return { status: 'refused', plan: refused };
|
|
396
|
+
if (result.outcome !== 'applied')
|
|
397
|
+
return { status: result.outcome };
|
|
398
|
+
const workflow = (await locate(input.runId))?.view;
|
|
399
|
+
// Recovered after a crash without a recorded plan: the migration applied, but the operator must re-read the run.
|
|
400
|
+
return workflow && result.detail ? { status: 'applied', plan: result.detail, workflow } : { status: 'conflict' };
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
//# sourceMappingURL=operator-transports.js.map
|
|
@@ -0,0 +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,EAAE,oBAAoB,EAAE,eAAe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AM,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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ExternalEffectReconciliationRequest, VerifiedExternalEffect } from './scheduled.js';
|
|
2
|
+
export interface ExternalEffectProviderAttestation {
|
|
3
|
+
readonly attestationId: string;
|
|
4
|
+
readonly execution: 'not_started' | 'succeeded' | 'failed';
|
|
5
|
+
readonly knownCostMicros: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ExternalEffectVerifierOptions {
|
|
8
|
+
/** Stable provider/audit authority recorded with accepted evidence. */
|
|
9
|
+
readonly authorityId: string;
|
|
10
|
+
readonly toolId: string;
|
|
11
|
+
readonly toolVersion: string;
|
|
12
|
+
/** Authenticate and inspect the provider using only the caller-supplied credential. */
|
|
13
|
+
readonly verify: (request: ExternalEffectReconciliationRequest, credential: unknown) => PromiseLike<ExternalEffectProviderAttestation>;
|
|
14
|
+
}
|
|
15
|
+
export interface ExternalEffectVerifier {
|
|
16
|
+
readonly authorityId: string;
|
|
17
|
+
readonly toolId: string;
|
|
18
|
+
readonly toolVersion: string;
|
|
19
|
+
}
|
|
20
|
+
export type ExternalEffectVerificationRouter = (request: ExternalEffectReconciliationRequest, credential: unknown) => Promise<VerifiedExternalEffect>;
|
|
21
|
+
/** Defines one exact provider/tool verification route without exposing its credential callback as public data. */
|
|
22
|
+
export declare function defineExternalEffectVerifier(options: ExternalEffectVerifierOptions): ExternalEffectVerifier;
|
|
23
|
+
/** Composes registered exact provider/tool routes into the scheduled runtime's trusted verification callback. */
|
|
24
|
+
export declare function composeExternalEffectVerifiers(verifiers: readonly ExternalEffectVerifier[]): ExternalEffectVerificationRouter;
|
|
25
|
+
//# sourceMappingURL=reconciliation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconciliation.d.ts","sourceRoot":"","sources":["../src/reconciliation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mCAAmC,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAKlG,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,6BAA6B;IAC5C,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,mCAAmC,EAAE,UAAU,EAAE,OAAO,KAAK,WAAW,CAAC,iCAAiC,CAAC,CAAC;CACxI;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,EAAE,mCAAmC,EAAE,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAezG,kHAAkH;AAClH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,6BAA6B,GAAG,sBAAsB,CAW3G;AA4CD,iHAAiH;AACjH,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,GAAG,gCAAgC,CAoB7H"}
|