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,56 @@
|
|
|
1
|
+
import { MayuraError } from '@mayura/core';
|
|
2
|
+
|
|
3
|
+
export interface WorkflowDrainOptions {
|
|
4
|
+
/** Upper bound for letting admitted work settle before the worker closes. Default 30 s, maximum 300 s. */
|
|
5
|
+
readonly timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowDrainReport {
|
|
8
|
+
/** True when every admitted wave, including its external effects and receipts, settled before the deadline. */
|
|
9
|
+
readonly drained: boolean;
|
|
10
|
+
/** Admitted waves still running at the deadline; the subsequent close aborts them and recovery owns their effects. */
|
|
11
|
+
readonly interrupted: number;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowDrainGate {
|
|
14
|
+
readonly draining: boolean;
|
|
15
|
+
/** Admit one unit of work, or return undefined once draining has begun. Admission is synchronous. */
|
|
16
|
+
enter(): (() => void) | undefined;
|
|
17
|
+
/** Stop admission, wait for admitted work within the deadline, then close exactly once. */
|
|
18
|
+
drain(options: WorkflowDrainOptions | undefined, close: () => void | Promise<void>): Promise<WorkflowDrainReport>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function drainTimeout(options: WorkflowDrainOptions | undefined): number {
|
|
22
|
+
const value = options?.timeoutMs ?? 30_000;
|
|
23
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > 300_000) throw new MayuraError('INVALID_INPUT', 'Drain timeout must be 1–300000 ms.');
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Counts admitted work so a worker can stop taking new work and let started effects settle before closing. */
|
|
28
|
+
export function createWorkflowDrainGate(): WorkflowDrainGate {
|
|
29
|
+
let admitted = 0; let draining = false; let result: Promise<WorkflowDrainReport> | undefined;
|
|
30
|
+
const idle = new Set<() => void>();
|
|
31
|
+
return {
|
|
32
|
+
get draining() { return draining; },
|
|
33
|
+
enter() {
|
|
34
|
+
if (draining) return undefined;
|
|
35
|
+
admitted += 1; let released = false;
|
|
36
|
+
return () => {
|
|
37
|
+
if (released) return; released = true; admitted -= 1;
|
|
38
|
+
if (admitted === 0) for (const notify of [...idle]) notify();
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
drain(options, close) {
|
|
42
|
+
if (result) return result;
|
|
43
|
+
const timeoutMs = drainTimeout(options); draining = true;
|
|
44
|
+
result = (async () => {
|
|
45
|
+
if (admitted > 0) {
|
|
46
|
+
let timer: ReturnType<typeof setTimeout> | undefined; let notify!: () => void;
|
|
47
|
+
await new Promise<void>(resolve => { notify = resolve; idle.add(notify); timer = setTimeout(resolve, timeoutMs); });
|
|
48
|
+
idle.delete(notify); if (timer) clearTimeout(timer);
|
|
49
|
+
}
|
|
50
|
+
const interrupted = admitted; await close();
|
|
51
|
+
return Object.freeze({ drained: interrupted === 0, interrupted });
|
|
52
|
+
})();
|
|
53
|
+
return result;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
freezeJson, jsonValue, MayuraError, ModelInvocationError,
|
|
3
|
+
type Guard, type InferOutput, type JsonValue, type ModelAdapter, type ModelMessage,
|
|
4
|
+
type ModelResponse, type ModelToolCall, type Schema,
|
|
5
|
+
} from '@mayura/core';
|
|
6
|
+
import { agentAsTool, defineAgent, type AgentDefinition, type AgentToolOptions } from '@mayura/runtime';
|
|
7
|
+
import type { AnyTool, ToolDefinition } from '@mayura/tools';
|
|
8
|
+
import { assertWorkflow, digest, resolveBinding, type AnyWorkflow, type WorkflowDefinition } from './definition.js';
|
|
9
|
+
|
|
10
|
+
export interface WorkflowAgentOptions {
|
|
11
|
+
/** Explicit opt-in: no persistence, approval, lease, or restart semantics are implied. */
|
|
12
|
+
readonly profile: 'ephemeral';
|
|
13
|
+
/** Requires an explicit model:<plannerId> grant. The local planner performs no inference. */
|
|
14
|
+
readonly plannerId?: string;
|
|
15
|
+
readonly guards?: { readonly input?: readonly Guard[]; readonly output?: readonly Guard[] };
|
|
16
|
+
}
|
|
17
|
+
export interface WorkflowToolOptions extends WorkflowAgentOptions, AgentToolOptions {}
|
|
18
|
+
|
|
19
|
+
/** Reject malformed history without retaining input, result content, or plugin diagnostics. */
|
|
20
|
+
function invalid(): never { throw new ModelInvocationError(0); }
|
|
21
|
+
function exact(value: object, keys: readonly string[]): void {
|
|
22
|
+
if (Object.keys(value).length !== keys.length || keys.some(key => !Object.hasOwn(value, key))) invalid();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Reconstruct one finite graph from the owning runtime's admitted history.
|
|
27
|
+
* There is deliberately no run state captured by the shared planner adapter.
|
|
28
|
+
*/
|
|
29
|
+
function plan(definition: AnyWorkflow, supplied: readonly ModelMessage[]): ModelResponse {
|
|
30
|
+
const messages = jsonValue(supplied, { maxBytes: 8_388_608, maxNodes: 300_000 }) as unknown as readonly ModelMessage[];
|
|
31
|
+
if (!Array.isArray(messages) || messages.length === 0 || messages.length > 257) invalid();
|
|
32
|
+
const first = messages[0];
|
|
33
|
+
if (!first || first.role !== 'user') invalid();
|
|
34
|
+
exact(first, ['role', 'content']);
|
|
35
|
+
const input = first.content;
|
|
36
|
+
const results: Record<string, JsonValue> = Object.create(null) as Record<string, JsonValue>;
|
|
37
|
+
const finished = (id: string): boolean => Object.hasOwn(results, id);
|
|
38
|
+
const ready = (): readonly ModelToolCall[] => {
|
|
39
|
+
// Joins can depend on other joins declared later, so project to a finite fixed point.
|
|
40
|
+
for (let pass = 0; pass < definition.nodes.length; pass++) {
|
|
41
|
+
let changed = false;
|
|
42
|
+
for (const node of definition.nodes) {
|
|
43
|
+
if (node.kind === 'join' && !finished(node.id) && node.dependsOn.every(finished)) {
|
|
44
|
+
results[node.id] = node.dependsOn.map(id => results[id]!);
|
|
45
|
+
changed = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!changed) break;
|
|
49
|
+
}
|
|
50
|
+
return definition.nodes.flatMap(node => node.kind === 'tool' && !finished(node.id)
|
|
51
|
+
&& (node.dependsOn ?? []).every(finished)
|
|
52
|
+
? [{ id: node.id, toolId: node.tool.id, input: resolveBinding(node.input, input, results) }] : []);
|
|
53
|
+
};
|
|
54
|
+
let cursor = 1;
|
|
55
|
+
while (cursor < messages.length) {
|
|
56
|
+
const expected = ready();
|
|
57
|
+
const assistant = messages[cursor++];
|
|
58
|
+
if (!assistant || assistant.role !== 'assistant' || expected.length === 0) invalid();
|
|
59
|
+
exact(assistant, ['role', 'calls']);
|
|
60
|
+
if (!Array.isArray(assistant.calls) || assistant.calls.length !== expected.length) invalid();
|
|
61
|
+
for (let index = 0; index < expected.length; index++) {
|
|
62
|
+
const call = assistant.calls[index];
|
|
63
|
+
const wanted = expected[index]!;
|
|
64
|
+
if (!call || typeof call !== 'object') invalid();
|
|
65
|
+
exact(call, ['id', 'toolId', 'input']);
|
|
66
|
+
if (call.id !== wanted.id || call.toolId !== wanted.toolId
|
|
67
|
+
|| digest('mayura:workflow-binding:v1', call.input) !== digest('mayura:workflow-binding:v1', wanted.input)) invalid();
|
|
68
|
+
const result = messages[cursor++];
|
|
69
|
+
if (!result || result.role !== 'tool') invalid();
|
|
70
|
+
exact(result, ['role', 'callId', 'toolId', 'result']);
|
|
71
|
+
if (result.callId !== wanted.id || result.toolId !== wanted.toolId || finished(wanted.id)) invalid();
|
|
72
|
+
results[wanted.id] = result.result;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const calls = ready();
|
|
76
|
+
if (calls.length > 0) return { type: 'tool_calls', calls, usage: { costMicros: 0 } };
|
|
77
|
+
if (!definition.nodes.every(node => finished(node.id))) invalid();
|
|
78
|
+
return { type: 'final', output: resolveBinding(definition.result, input, results), usage: { costMicros: 0 } };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Compile an approval-free finite workflow into the existing ephemeral execution contract.
|
|
83
|
+
* Each deterministic planning wave consumes a zero-cost model-call/step allowance.
|
|
84
|
+
*/
|
|
85
|
+
export function workflowAsAgent<I extends Schema, O extends Schema>(
|
|
86
|
+
definition: WorkflowDefinition<I, O>, options: WorkflowAgentOptions,
|
|
87
|
+
): AgentDefinition<I, O> {
|
|
88
|
+
assertWorkflow(definition);
|
|
89
|
+
if (options?.profile !== 'ephemeral') throw new MayuraError('UNSUPPORTED_PROFILE', 'Workflow composition requires the explicit ephemeral profile.');
|
|
90
|
+
const tools = new Map<string, AnyTool>();
|
|
91
|
+
for (const node of definition.nodes) {
|
|
92
|
+
if (node.kind !== 'tool') continue;
|
|
93
|
+
if (node.approval) throw new MayuraError('UNSUPPORTED_PROFILE', 'Approval-required workflows need the durable execution profile.');
|
|
94
|
+
const registered = tools.get(node.tool.id);
|
|
95
|
+
if (registered && registered !== node.tool) throw new MayuraError('INVALID_CONFIG', 'Workflow tool identities must resolve to one immutable definition.');
|
|
96
|
+
tools.set(node.tool.id, node.tool);
|
|
97
|
+
}
|
|
98
|
+
const model: ModelAdapter = {
|
|
99
|
+
id: options.plannerId ?? 'mayura.workflow',
|
|
100
|
+
capabilities: { tools: true, structuredOutput: true }, maxCostMicros: 0,
|
|
101
|
+
async generate(request) {
|
|
102
|
+
request.signal.throwIfAborted();
|
|
103
|
+
try {
|
|
104
|
+
const response = plan(definition, request.messages);
|
|
105
|
+
request.signal.throwIfAborted();
|
|
106
|
+
return freezeJson(jsonValue(response, { maxBytes: 8_388_608, maxNodes: 300_000 })) as unknown as ModelResponse;
|
|
107
|
+
} catch { return invalid(); }
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
// The workflow stores Standard Schema snapshots, not the consumer library's methods.
|
|
111
|
+
// Its declared generic input/output directions are unchanged by that normalization.
|
|
112
|
+
return defineAgent({
|
|
113
|
+
id: `workflow.${definition.digest}`, version: '1', instructions: 'Execute the registered finite workflow graph.',
|
|
114
|
+
model, tools: [...tools.values()], input: definition.input, output: definition.output,
|
|
115
|
+
...(options.guards === undefined ? {} : { guards: options.guards }),
|
|
116
|
+
}) as AgentDefinition<I, O>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Compose through the same required-child gateway; no independent budget or authority is minted. */
|
|
120
|
+
export function workflowAsTool<I extends Schema, O extends Schema>(
|
|
121
|
+
definition: WorkflowDefinition<I, O>, options: WorkflowToolOptions,
|
|
122
|
+
): ToolDefinition<I, Schema<InferOutput<O>>> {
|
|
123
|
+
return agentAsTool(workflowAsAgent(definition, options), options);
|
|
124
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { freezeJson, jsonValue, MayuraError, type ErrorCode, type JsonObject, type JsonValue, type Scope } from '@mayura/core';
|
|
2
|
+
import { StorageError, type AggregateStore, type StoredRecord } from '@mayura/storage-contracts';
|
|
3
|
+
import { digest } from './definition.js';
|
|
4
|
+
import type { WorkflowGraphDiscovery } from './graph-discovery.js';
|
|
5
|
+
import type { WorkflowLifecycleFleetRuntime } from './lifecycle-fleet.js';
|
|
6
|
+
import type { WorkflowCompositeFleetRuntime } from './composite-fleet.js';
|
|
7
|
+
|
|
8
|
+
/** Minimal durable hold reader that hosts and coordinators consult before driving a page. */
|
|
9
|
+
export interface WorkflowFleetHoldReader { isHeld(): Promise<boolean> }
|
|
10
|
+
export interface WorkflowFleetHoldState {
|
|
11
|
+
readonly held: boolean;
|
|
12
|
+
/** Increments each time the scope enters the held state. */
|
|
13
|
+
readonly generation: number;
|
|
14
|
+
readonly changedAtMs: number | null;
|
|
15
|
+
}
|
|
16
|
+
/** One format's pausable population. Discovery candidates are hints; every pause/resume goes through the format runtime. */
|
|
17
|
+
export interface WorkflowFleetTarget {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
discover(cursor: JsonValue | null, limit: number): Promise<{ readonly runIds: readonly string[]; readonly nextCursor: JsonValue | null }>;
|
|
20
|
+
inspect(runId: string): Promise<{ readonly status: string }>;
|
|
21
|
+
pause(runId: string): Promise<{ readonly status: string }>;
|
|
22
|
+
resume(runId: string): Promise<{ readonly status: string }>;
|
|
23
|
+
}
|
|
24
|
+
export type WorkflowFleetSweepOutcome =
|
|
25
|
+
| { readonly target: string; readonly runId: string; readonly outcome: 'paused' | 'already_paused' | 'terminal' | 'busy' }
|
|
26
|
+
| { readonly target: string; readonly runId: string; readonly outcome: 'resumed' | 'not_paused' | 'missing' | 'unregistered' }
|
|
27
|
+
| { readonly target: string; readonly runId: string; readonly outcome: 'failed'; readonly code: ErrorCode };
|
|
28
|
+
export interface WorkflowFleetSweepCursor { readonly format: 1; readonly scope: string; readonly phase: 'pause' | 'resume'; readonly position: number; readonly inner: JsonValue | null }
|
|
29
|
+
export interface WorkflowFleetSweepReport {
|
|
30
|
+
readonly outcomes: readonly WorkflowFleetSweepOutcome[];
|
|
31
|
+
/** Null once every target (pause) or ledger shard (resume) has been visited. */
|
|
32
|
+
readonly nextCursor: WorkflowFleetSweepCursor | null;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkflowFleetControl extends WorkflowFleetHoldReader {
|
|
35
|
+
inspect(): Promise<WorkflowFleetHoldState>;
|
|
36
|
+
/** Durably hold the scope. Idempotent; hosts and coordinators configured with this control stop driving runs. */
|
|
37
|
+
hold(): Promise<WorkflowFleetHoldState>;
|
|
38
|
+
/** Durably lift the hold. Idempotent; it resumes no run by itself. */
|
|
39
|
+
release(): Promise<WorkflowFleetHoldState>;
|
|
40
|
+
/** While held, pause one discovery page of runs and record exactly which runs this fleet paused. */
|
|
41
|
+
sweepPause(targets: readonly WorkflowFleetTarget[], command?: { readonly cursor?: WorkflowFleetSweepCursor | null; readonly limit?: number }): Promise<WorkflowFleetSweepReport>;
|
|
42
|
+
/** After release, resume only runs this fleet paused, never runs paused individually. */
|
|
43
|
+
sweepResume(targets: readonly WorkflowFleetTarget[], command?: { readonly cursor?: WorkflowFleetSweepCursor | null; readonly limit?: number }): Promise<WorkflowFleetSweepReport>;
|
|
44
|
+
}
|
|
45
|
+
export interface WorkflowFleetControlOptions {
|
|
46
|
+
readonly store: AggregateStore;
|
|
47
|
+
readonly scope: Scope;
|
|
48
|
+
readonly now?: () => number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface HoldState { format: 1; held: boolean; generation: number; changedAtMs: number | null }
|
|
52
|
+
interface LedgerEntry { target: string; runId: string; state: 'pending' | 'confirmed' }
|
|
53
|
+
interface LedgerState { format: 1; shard: number; entries: LedgerEntry[] }
|
|
54
|
+
const terminal = new Set(['succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown']);
|
|
55
|
+
const runPattern = /^[a-f0-9]{64}$/;
|
|
56
|
+
const namePattern = /^[a-z][a-z0-9-]{0,31}$/;
|
|
57
|
+
const shardCapacity = 256;
|
|
58
|
+
const retries = 32;
|
|
59
|
+
const codes = new Set<ErrorCode>(['INVALID_INPUT', 'PERMISSION_DENIED', 'LIMIT_EXCEEDED', 'CANCELLED', 'TIMEOUT', 'UNSUPPORTED_PROFILE',
|
|
60
|
+
'NOT_FOUND', 'CONFLICT', 'STORAGE_UNAVAILABLE']);
|
|
61
|
+
const code = (error: unknown): ErrorCode => error instanceof MayuraError && codes.has(error.code) ? error.code : 'STORAGE_UNAVAILABLE';
|
|
62
|
+
const isCode = (error: unknown, expected: string): boolean =>
|
|
63
|
+
(error instanceof MayuraError || error instanceof StorageError) && error.code === expected;
|
|
64
|
+
|
|
65
|
+
/** Durable per-scope fleet hold plus an exact ledger of the runs a fleet pause paused. */
|
|
66
|
+
export function createWorkflowFleetControl(options: WorkflowFleetControlOptions): WorkflowFleetControl {
|
|
67
|
+
const { store } = options;
|
|
68
|
+
if (!store || typeof store.read !== 'function' || typeof store.create !== 'function' || typeof store.update !== 'function') {
|
|
69
|
+
throw new MayuraError('INVALID_CONFIG', 'Fleet control requires an aggregate store.');
|
|
70
|
+
}
|
|
71
|
+
const scope = digest('mayura:scope:v1', { principalId: options.scope?.principalId, projectId: options.scope?.projectId });
|
|
72
|
+
const holdId = digest('mayura:workflow-fleet-hold:v1', { scope });
|
|
73
|
+
const ledgerId = (shard: number): string => digest('mayura:workflow-fleet-ledger:v1', { scope, shard });
|
|
74
|
+
const now = (): number => {
|
|
75
|
+
const value = (options.now ?? Date.now)();
|
|
76
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new MayuraError('STORAGE_UNAVAILABLE', 'The trusted fleet clock returned an invalid timestamp.');
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
79
|
+
const guarded = async <T>(operation: () => Promise<T>): Promise<T> => {
|
|
80
|
+
try { return await operation(); }
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error instanceof MayuraError || isCode(error, 'CONFLICT')) throw error;
|
|
83
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Fleet control storage is unavailable.');
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const holdFrom = (record: StoredRecord | undefined): HoldState => {
|
|
87
|
+
if (!record) return { format: 1, held: false, generation: 0, changedAtMs: null };
|
|
88
|
+
const state = record.state;
|
|
89
|
+
if (record.scope !== scope || record.id !== holdId || state['format'] !== 1 || typeof state['held'] !== 'boolean'
|
|
90
|
+
|| !Number.isSafeInteger(state['generation']) || (state['generation'] as number) < 0
|
|
91
|
+
|| (state['changedAtMs'] !== null && !Number.isSafeInteger(state['changedAtMs']))) {
|
|
92
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored fleet hold failed integrity validation.');
|
|
93
|
+
}
|
|
94
|
+
return { format: 1, held: state['held'], generation: state['generation'] as number, changedAtMs: state['changedAtMs'] as number | null };
|
|
95
|
+
};
|
|
96
|
+
const publicHold = (state: HoldState): WorkflowFleetHoldState =>
|
|
97
|
+
freezeJson(jsonValue({ held: state.held, generation: state.generation, changedAtMs: state.changedAtMs })) as unknown as WorkflowFleetHoldState;
|
|
98
|
+
const inspect = async (): Promise<WorkflowFleetHoldState> => publicHold(holdFrom(await guarded(() => store.read(scope, holdId))));
|
|
99
|
+
|
|
100
|
+
const transition = async (held: boolean): Promise<WorkflowFleetHoldState> => {
|
|
101
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
102
|
+
const record = await guarded(() => store.read(scope, holdId)); const current = holdFrom(record);
|
|
103
|
+
if (current.held === held) return publicHold(current);
|
|
104
|
+
const next: HoldState = { format: 1, held, generation: held ? current.generation + 1 : current.generation, changedAtMs: now() };
|
|
105
|
+
const event = { type: held ? 'fleet.held' : 'fleet.released', data: { generation: next.generation } };
|
|
106
|
+
try {
|
|
107
|
+
if (!record) {
|
|
108
|
+
const created = await store.create({ scope, id: holdId, idempotencyKey: holdId, definitionHash: digest('mayura:workflow-fleet-hold-format:v1', {}),
|
|
109
|
+
state: jsonValue(next) as JsonObject, events: [event] });
|
|
110
|
+
if (!created.created) continue;
|
|
111
|
+
} else await store.update({ scope, id: holdId, expectedVersion: record.version, state: jsonValue(next) as JsonObject, events: [event] });
|
|
112
|
+
return publicHold(next);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (isCode(error, 'CONFLICT')) continue;
|
|
115
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Fleet hold transition could not be confirmed.');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
throw new MayuraError('CONFLICT', 'Fleet hold remained busy after bounded retries.');
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const ledgerFrom = (record: StoredRecord | undefined, shard: number): LedgerState => {
|
|
122
|
+
if (!record) return { format: 1, shard, entries: [] };
|
|
123
|
+
const state = record.state; const entries = state['entries'];
|
|
124
|
+
if (record.scope !== scope || record.id !== ledgerId(shard) || state['format'] !== 1 || state['shard'] !== shard
|
|
125
|
+
|| !Array.isArray(entries) || entries.length > shardCapacity) throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored fleet ledger failed integrity validation.');
|
|
126
|
+
return { format: 1, shard, entries: entries.map(raw => {
|
|
127
|
+
const entry = raw as JsonObject;
|
|
128
|
+
if (!entry || typeof entry !== 'object' || Object.keys(entry).length !== 3 || typeof entry['target'] !== 'string' || !namePattern.test(entry['target'])
|
|
129
|
+
|| typeof entry['runId'] !== 'string' || !runPattern.test(entry['runId']) || parseInt(entry['runId'].slice(0, 2), 16) !== shard
|
|
130
|
+
|| !['pending', 'confirmed'].includes(entry['state'] as string)) throw new MayuraError('STORAGE_UNAVAILABLE', 'Stored fleet ledger failed integrity validation.');
|
|
131
|
+
return { target: entry['target'], runId: entry['runId'], state: entry['state'] as LedgerEntry['state'] };
|
|
132
|
+
}) };
|
|
133
|
+
};
|
|
134
|
+
/** Apply one bounded change to a ledger shard with compare-and-set retries. */
|
|
135
|
+
const editLedger = async (shard: number, change: (entries: LedgerEntry[]) => boolean): Promise<void> => {
|
|
136
|
+
for (let attempt = 0; attempt < retries; attempt++) {
|
|
137
|
+
const record = await guarded(() => store.read(scope, ledgerId(shard))); const state = ledgerFrom(record, shard);
|
|
138
|
+
if (!change(state.entries)) return;
|
|
139
|
+
if (state.entries.length > shardCapacity) throw new MayuraError('LIMIT_EXCEEDED', 'Fleet ledger shard is full.');
|
|
140
|
+
state.entries.sort((left, right) => left.runId < right.runId ? -1 : left.runId > right.runId ? 1 : left.target < right.target ? -1 : 1);
|
|
141
|
+
const event = { type: 'fleet.ledger.updated', data: { shard, entries: state.entries.length } };
|
|
142
|
+
try {
|
|
143
|
+
if (!record) {
|
|
144
|
+
const created = await store.create({ scope, id: ledgerId(shard), idempotencyKey: ledgerId(shard),
|
|
145
|
+
definitionHash: digest('mayura:workflow-fleet-ledger-format:v1', {}), state: jsonValue(state) as JsonObject, events: [event] });
|
|
146
|
+
if (!created.created) continue;
|
|
147
|
+
} else await store.update({ scope, id: ledgerId(shard), expectedVersion: record.version, state: jsonValue(state) as JsonObject, events: [event] });
|
|
148
|
+
return;
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (isCode(error, 'CONFLICT')) continue;
|
|
151
|
+
if (error instanceof MayuraError) throw error;
|
|
152
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Fleet ledger update could not be confirmed.');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
throw new MayuraError('CONFLICT', 'Fleet ledger remained busy after bounded retries.');
|
|
156
|
+
};
|
|
157
|
+
const shardOf = (runId: string): number => parseInt(runId.slice(0, 2), 16);
|
|
158
|
+
const setEntry = (target: string, runId: string, state: LedgerEntry['state'] | null): Promise<void> => editLedger(shardOf(runId), entries => {
|
|
159
|
+
const index = entries.findIndex(entry => entry.target === target && entry.runId === runId);
|
|
160
|
+
if (state === null) { if (index < 0) return false; entries.splice(index, 1); return true; }
|
|
161
|
+
if (index >= 0) { if (entries[index]!.state === state) return false; entries[index] = { target, runId, state }; return true; }
|
|
162
|
+
entries.push({ target, runId, state }); return true;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const admitTargets = (targets: readonly WorkflowFleetTarget[]): Map<string, WorkflowFleetTarget> => {
|
|
166
|
+
if (!Array.isArray(targets) || targets.length < 1 || targets.length > 16) throw new MayuraError('INVALID_INPUT', 'Fleet sweeps require 1–16 targets.');
|
|
167
|
+
const byName = new Map<string, WorkflowFleetTarget>();
|
|
168
|
+
for (const target of targets) {
|
|
169
|
+
if (!target || typeof target.name !== 'string' || !namePattern.test(target.name) || byName.has(target.name)
|
|
170
|
+
|| ['discover', 'inspect', 'pause', 'resume'].some(method => typeof (target as unknown as Record<string, unknown>)[method] !== 'function')) {
|
|
171
|
+
throw new MayuraError('INVALID_INPUT', 'Fleet targets require unique names and discover/inspect/pause/resume methods.');
|
|
172
|
+
}
|
|
173
|
+
byName.set(target.name, target);
|
|
174
|
+
}
|
|
175
|
+
return byName;
|
|
176
|
+
};
|
|
177
|
+
const admitCommand = (command: { readonly cursor?: WorkflowFleetSweepCursor | null; readonly limit?: number } | undefined,
|
|
178
|
+
phase: 'pause' | 'resume', positions: number, fallback: number): { position: number; inner: JsonValue | null; limit: number } => {
|
|
179
|
+
const limit = command?.limit ?? fallback;
|
|
180
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 128) throw new MayuraError('INVALID_INPUT', 'Fleet sweep limit must be 1–128.');
|
|
181
|
+
const cursor = command?.cursor ?? null;
|
|
182
|
+
if (cursor === null) return { position: 0, inner: null, limit };
|
|
183
|
+
if (typeof cursor !== 'object' || cursor.format !== 1 || cursor.scope !== scope || cursor.phase !== phase
|
|
184
|
+
|| !Number.isSafeInteger(cursor.position) || cursor.position < 0 || cursor.position >= positions) {
|
|
185
|
+
throw new MayuraError('INVALID_INPUT', 'Fleet sweep cursor does not match this scope, phase or target list.');
|
|
186
|
+
}
|
|
187
|
+
return { position: cursor.position, inner: cursor.inner === undefined ? null : jsonValue(cursor.inner), limit };
|
|
188
|
+
};
|
|
189
|
+
const cursorFor = (phase: 'pause' | 'resume', position: number, inner: JsonValue | null): WorkflowFleetSweepCursor =>
|
|
190
|
+
freezeJson(jsonValue({ format: 1, scope, phase, position, inner })) as unknown as WorkflowFleetSweepCursor;
|
|
191
|
+
const report = (outcomes: WorkflowFleetSweepOutcome[], nextCursor: WorkflowFleetSweepCursor | null): WorkflowFleetSweepReport =>
|
|
192
|
+
freezeJson(jsonValue({ outcomes, nextCursor })) as unknown as WorkflowFleetSweepReport;
|
|
193
|
+
const statusOf = async (target: WorkflowFleetTarget, runId: string): Promise<string> => (await target.inspect(runId)).status;
|
|
194
|
+
|
|
195
|
+
return Object.freeze<WorkflowFleetControl>({
|
|
196
|
+
inspect,
|
|
197
|
+
isHeld: async () => (await inspect()).held,
|
|
198
|
+
hold: () => transition(true),
|
|
199
|
+
release: () => transition(false),
|
|
200
|
+
async sweepPause(targets, command) {
|
|
201
|
+
const byName = admitTargets(targets); const list = [...byName.values()];
|
|
202
|
+
const { position, inner, limit } = admitCommand(command, 'pause', list.length, 32);
|
|
203
|
+
if (!(await inspect()).held) throw new MayuraError('CONFLICT', 'Hold the fleet before sweeping it into the paused state.');
|
|
204
|
+
const target = list[position]!; const page = await target.discover(inner, limit); const outcomes: WorkflowFleetSweepOutcome[] = [];
|
|
205
|
+
if (!Array.isArray(page.runIds) || page.runIds.length > limit) throw new MayuraError('STORAGE_UNAVAILABLE', 'Fleet target returned an invalid discovery page.');
|
|
206
|
+
for (const runId of page.runIds) {
|
|
207
|
+
if (typeof runId !== 'string' || !runPattern.test(runId)) throw new MayuraError('STORAGE_UNAVAILABLE', 'Fleet target returned an invalid run identity.');
|
|
208
|
+
try {
|
|
209
|
+
const before = await statusOf(target, runId);
|
|
210
|
+
if (terminal.has(before)) { outcomes.push({ target: target.name, runId, outcome: 'terminal' }); continue; }
|
|
211
|
+
if (before === 'paused') { outcomes.push({ target: target.name, runId, outcome: 'already_paused' }); continue; }
|
|
212
|
+
// Record intent first: a crash after the pause but before confirmation must still be resumable by the fleet.
|
|
213
|
+
await setEntry(target.name, runId, 'pending');
|
|
214
|
+
try { await target.pause(runId); await setEntry(target.name, runId, 'confirmed'); outcomes.push({ target: target.name, runId, outcome: 'paused' }); }
|
|
215
|
+
catch (error) {
|
|
216
|
+
if (!isCode(error, 'CONFLICT')) throw error;
|
|
217
|
+
const after = await statusOf(target, runId);
|
|
218
|
+
// Only a pause this sweep committed may stay in the ledger.
|
|
219
|
+
if (after === 'paused') { await setEntry(target.name, runId, 'confirmed'); outcomes.push({ target: target.name, runId, outcome: 'paused' }); }
|
|
220
|
+
else { await setEntry(target.name, runId, null); outcomes.push({ target: target.name, runId, outcome: terminal.has(after) ? 'terminal' : 'busy' }); }
|
|
221
|
+
}
|
|
222
|
+
} catch (error) {
|
|
223
|
+
// Keep any pending entry: the pause may have committed, and the resume sweep settles pending entries safely.
|
|
224
|
+
outcomes.push({ target: target.name, runId, outcome: 'failed', code: code(error) });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const nextInner = page.nextCursor === undefined ? null : page.nextCursor;
|
|
228
|
+
const next = nextInner !== null ? cursorFor('pause', position, nextInner) : position + 1 < list.length ? cursorFor('pause', position + 1, null) : null;
|
|
229
|
+
return report(outcomes, next);
|
|
230
|
+
},
|
|
231
|
+
async sweepResume(targets, command) {
|
|
232
|
+
const byName = admitTargets(targets); const { position, inner, limit } = admitCommand(command, 'resume', 256, 64);
|
|
233
|
+
if (inner !== null && (typeof inner !== 'string' || inner.length > 128)) throw new MayuraError('INVALID_INPUT', 'Fleet sweep cursor does not match this scope, phase or target list.');
|
|
234
|
+
if ((await inspect()).held) throw new MayuraError('CONFLICT', 'Release the fleet hold before resuming the runs it paused.');
|
|
235
|
+
const outcomes: WorkflowFleetSweepOutcome[] = []; const key = (entry: LedgerEntry): string => `${entry.runId}/${entry.target}`;
|
|
236
|
+
// Entries are sorted, so the last visited key resumes a partially processed shard without revisiting retained entries.
|
|
237
|
+
let shard = position; let after = inner as string | null; let last: string | null = null;
|
|
238
|
+
for (; shard < 256; shard++, after = null) {
|
|
239
|
+
const { entries } = ledgerFrom(await guarded(() => store.read(scope, ledgerId(shard))), shard);
|
|
240
|
+
const pending = entries.filter(entry => after === null || key(entry) > after);
|
|
241
|
+
for (const entry of pending) {
|
|
242
|
+
if (outcomes.length >= limit) break;
|
|
243
|
+
last = key(entry);
|
|
244
|
+
const target = byName.get(entry.target);
|
|
245
|
+
if (!target) { outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'unregistered' }); continue; }
|
|
246
|
+
try {
|
|
247
|
+
let status: string;
|
|
248
|
+
try { status = await statusOf(target, entry.runId); }
|
|
249
|
+
catch (error) { if (!isCode(error, 'NOT_FOUND')) throw error; await setEntry(entry.target, entry.runId, null); outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'missing' }); continue; }
|
|
250
|
+
if (status === 'paused') {
|
|
251
|
+
try { await target.resume(entry.runId); outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'resumed' }); }
|
|
252
|
+
catch (error) { if (!isCode(error, 'CONFLICT') || (await statusOf(target, entry.runId)) === 'paused') throw error; outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'not_paused' }); }
|
|
253
|
+
} else outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'not_paused' });
|
|
254
|
+
await setEntry(entry.target, entry.runId, null);
|
|
255
|
+
} catch (error) { outcomes.push({ target: entry.target, runId: entry.runId, outcome: 'failed', code: code(error) }); }
|
|
256
|
+
}
|
|
257
|
+
if (outcomes.length >= limit) {
|
|
258
|
+
const remaining = pending.some(entry => key(entry) > last!);
|
|
259
|
+
return report(outcomes, remaining ? cursorFor('resume', shard, last) : shard + 1 < 256 ? cursorFor('resume', shard + 1, null) : null);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return report(outcomes, null);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Format-5 lifecycle fleet runs, discovered through the fleet index. */
|
|
268
|
+
export function lifecycleFleetTarget(runtime: WorkflowLifecycleFleetRuntime, name = 'lifecycle', options: { readonly includePaused?: boolean } = {}): WorkflowFleetTarget {
|
|
269
|
+
return Object.freeze({ name,
|
|
270
|
+
discover: async (cursor: JsonValue | null, limit: number) => {
|
|
271
|
+
const page = await runtime.scan({ cursor: cursor as never, limit });
|
|
272
|
+
// Pause sweeps skip already-paused runs; version inventories must count them.
|
|
273
|
+
return { runIds: page.candidates.filter(candidate => options.includePaused === true || candidate.status !== 'paused').map(candidate => candidate.runId),
|
|
274
|
+
nextCursor: page.nextCursor as unknown as JsonValue | null };
|
|
275
|
+
},
|
|
276
|
+
inspect: (runId: string) => runtime.inspect(runId), pause: (runId: string) => runtime.pause(runId), resume: (runId: string) => runtime.resume(runId) });
|
|
277
|
+
}
|
|
278
|
+
/** Format-3 graphs and format-4 trees share discovery-plus-runtime adapters. */
|
|
279
|
+
export function graphFleetTarget(discovery: WorkflowGraphDiscovery, runtime: {
|
|
280
|
+
inspect(id: string): Promise<{ readonly status: string }>; pause(id: string): Promise<{ readonly status: string }>; resume(id: string): Promise<{ readonly status: string }>;
|
|
281
|
+
}, name = 'graphs', options: { readonly includePaused?: boolean } = {}): WorkflowFleetTarget {
|
|
282
|
+
return Object.freeze({ name,
|
|
283
|
+
discover: async (cursor: JsonValue | null, limit: number) => {
|
|
284
|
+
// Discovery pages hold at most 32 candidates; sweeps and inventories may ask for more.
|
|
285
|
+
const page = await discovery.scan({ cursor: cursor as never, limit: Math.min(limit, 32) });
|
|
286
|
+
return { runIds: page.candidates.filter(candidate => options.includePaused === true || candidate.status !== 'paused').map(candidate => candidate.reference.runId),
|
|
287
|
+
nextCursor: page.nextCursor as unknown as JsonValue | null };
|
|
288
|
+
},
|
|
289
|
+
inspect: (runId: string) => runtime.inspect(runId), pause: (runId: string) => runtime.pause(runId), resume: (runId: string) => runtime.resume(runId) });
|
|
290
|
+
}
|
|
291
|
+
export function treeFleetTarget(discovery: { scan(command?: { readonly cursor?: never; readonly limit?: number }): Promise<{
|
|
292
|
+
readonly candidates: readonly { readonly rootId: string; readonly status: string }[]; readonly nextCursor: unknown }> }, runtime: {
|
|
293
|
+
inspect(id: string): Promise<{ readonly status: string }>; pause(id: string): Promise<{ readonly status: string }>; resume(id: string): Promise<{ readonly status: string }>;
|
|
294
|
+
}, name = 'trees', options: { readonly includePaused?: boolean } = {}): WorkflowFleetTarget {
|
|
295
|
+
return Object.freeze({ name,
|
|
296
|
+
discover: async (cursor: JsonValue | null, limit: number) => {
|
|
297
|
+
const page = await discovery.scan({ cursor: cursor as never, limit: Math.min(limit, 32) });
|
|
298
|
+
return { runIds: page.candidates.filter(candidate => options.includePaused === true || candidate.status !== 'paused').map(candidate => candidate.rootId),
|
|
299
|
+
nextCursor: page.nextCursor as JsonValue | null };
|
|
300
|
+
},
|
|
301
|
+
inspect: (runId: string) => runtime.inspect(runId), pause: (runId: string) => runtime.pause(runId), resume: (runId: string) => runtime.resume(runId) });
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Saga and loop runs from the composite fleet index; both formats support quiescent operator pause. */
|
|
305
|
+
export function compositeFleetTarget(runtime: WorkflowCompositeFleetRuntime, name = 'composites', options: { readonly includePaused?: boolean } = {}): WorkflowFleetTarget {
|
|
306
|
+
const kinds = new Map<string, 'saga' | 'loop'>();
|
|
307
|
+
const kind = async (runId: string): Promise<'saga' | 'loop'> => {
|
|
308
|
+
const known = kinds.get(runId) ?? await runtime.kindOf(runId);
|
|
309
|
+
if (!known) throw new MayuraError('NOT_FOUND', 'The run is not in this composite fleet index.');
|
|
310
|
+
kinds.set(runId, known); return known;
|
|
311
|
+
};
|
|
312
|
+
return Object.freeze({ name,
|
|
313
|
+
discover: async (cursor: JsonValue | null, limit: number) => {
|
|
314
|
+
const page = await runtime.scan({ cursor: cursor as never, limit: Math.min(limit, 128) });
|
|
315
|
+
const runIds: string[] = [];
|
|
316
|
+
for (const candidate of page.candidates) {
|
|
317
|
+
kinds.set(candidate.runId, candidate.kind);
|
|
318
|
+
if (options.includePaused !== true && (await (candidate.kind === 'loop' ? runtime.loops : runtime.sagas).inspect(candidate.runId)).status === 'paused') continue;
|
|
319
|
+
runIds.push(candidate.runId);
|
|
320
|
+
}
|
|
321
|
+
return { runIds, nextCursor: page.nextCursor as unknown as JsonValue | null };
|
|
322
|
+
},
|
|
323
|
+
inspect: async (runId: string) => (await kind(runId)) === 'loop' ? runtime.loops.inspect(runId) : runtime.sagas.inspect(runId),
|
|
324
|
+
pause: async (runId: string) => (await kind(runId)) === 'loop' ? runtime.loops.pause(runId) : runtime.sagas.pause(runId),
|
|
325
|
+
resume: async (runId: string) => (await kind(runId)) === 'loop' ? runtime.loops.resume(runId) : runtime.sagas.resume(runId) });
|
|
326
|
+
}
|