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,96 @@
|
|
|
1
|
+
import { freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';
|
|
2
|
+
import { StorageError, type StoredRecord } from './contracts.js';
|
|
3
|
+
import type { WorkflowManifest, WorkflowResourcePlan } from './scheduled-workflow-contracts.js';
|
|
4
|
+
import type { WorkflowTreeManifest, WorkflowTreePolicyManifest } from './workflow-tree-contracts.js';
|
|
5
|
+
import { workflowManifest, workflowResources } from './workflow-format2.js';
|
|
6
|
+
import { workflowTreeManifest, workflowTreePolicy, workflowTreeRootResources } from './workflow-tree-contracts.js';
|
|
7
|
+
|
|
8
|
+
export type WorkflowTreeStatus = 'running'|'waiting'|'paused'|'succeeded'|'failed'|'blocked'|'cancelled'|'outcome_unknown';
|
|
9
|
+
export type WorkflowTreeStepStatus = 'pending'|'waiting'|'approved'|'dispatching'|'succeeded'|'failed'|'blocked'|'unknown'|'skipped';
|
|
10
|
+
export interface WorkflowTreeChildLink {
|
|
11
|
+
readonly runId: string; readonly accountId: string; readonly definitionHash: string;
|
|
12
|
+
readonly policyHash: string; readonly inputHash: string; readonly joinedVersion: number|null;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkflowTreeStep {
|
|
15
|
+
readonly kind: 'tool'|'join'|'child'; status: WorkflowTreeStepStatus; readonly callId: string;
|
|
16
|
+
output: JsonValue; receipt: JsonValue; approval: JsonValue; costReserved: number;
|
|
17
|
+
candidateHash: string|null; child: WorkflowTreeChildLink|null;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkflowTreeState {
|
|
20
|
+
readonly format: 4; readonly rootId: string; readonly accountId: string;
|
|
21
|
+
readonly definition: string; readonly policy: string; readonly input: JsonValue;
|
|
22
|
+
status: WorkflowTreeStatus; readonly steps: Record<string,WorkflowTreeStep>;
|
|
23
|
+
readonly maxCostMicros: number; readonly maxCalls: number; spentMicros: number;
|
|
24
|
+
reservedMicros: number; budgetVersion: number; output: JsonValue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const hashPattern = /^[a-f0-9]{64}$/;
|
|
28
|
+
function invalid(): never { throw new StorageError('INVALID_INPUT','Invalid bounded workflow-tree state.'); }
|
|
29
|
+
function corrupt(): never { throw new StorageError('CONFLICT','Stored workflow-tree state failed integrity validation.'); }
|
|
30
|
+
function hash(value: unknown): string { if (typeof value !== 'string' || !hashPattern.test(value)) invalid(); return value; }
|
|
31
|
+
function integer(value: unknown,minimum=0): number { if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum) invalid(); return value; }
|
|
32
|
+
function object(value: JsonValue|undefined): JsonObject { if (!value || typeof value !== 'object' || Array.isArray(value)) invalid(); return value; }
|
|
33
|
+
function fields(value: JsonObject,names: readonly string[]): void { if (Object.keys(value).length !== names.length || names.some(name=>!Object.hasOwn(value,name))) invalid(); }
|
|
34
|
+
|
|
35
|
+
function initial(
|
|
36
|
+
rootId: string, accountId: string, definitionHash: string, policyHash: string, input: JsonValue,
|
|
37
|
+
nodes: readonly {readonly id:string;readonly kind:'tool'|'join'|'child'}[], maxCostMicros: number, maxCalls: number,
|
|
38
|
+
): WorkflowTreeState {
|
|
39
|
+
hash(rootId); hash(definitionHash); hash(policyHash); integer(maxCostMicros); integer(maxCalls,1);
|
|
40
|
+
return freezeJson(jsonValue({format:4,rootId,accountId,definition:definitionHash,policy:policyHash,input,status:'running',
|
|
41
|
+
steps:Object.fromEntries(nodes.map(node=>[node.id,{kind:node.kind,status:'pending',callId:`step:${node.id}`,
|
|
42
|
+
output:null,receipt:null,approval:null,costReserved:0,candidateHash:null,child:null}])),
|
|
43
|
+
maxCostMicros,maxCalls,spentMicros:0,reservedMicros:0,budgetVersion:1,output:null})) as unknown as WorkflowTreeState;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function initialWorkflowTreeRootState(definition: WorkflowTreeManifest,input: JsonValue,rootId:string,definitionHash:string,policyHash:string,policy:WorkflowTreePolicyManifest): WorkflowTreeState {
|
|
47
|
+
const manifest=workflowTreeManifest(definition); const authority=workflowTreePolicy(policy);
|
|
48
|
+
return initial(rootId,'root',definitionHash,policyHash,jsonValue(input,{maxBytes:authority.maxOutputBytes}),manifest.graph,authority.maxCostMicros,authority.maxCalls);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function initialWorkflowTreeLeafState(definition: WorkflowManifest,input: JsonValue,rootId:string,accountId:string,definitionHash:string,policyHash:string,policy:WorkflowTreePolicyManifest): WorkflowTreeState {
|
|
52
|
+
const manifest=workflowManifest(definition); const authority=workflowTreePolicy(policy);
|
|
53
|
+
return initial(rootId,accountId,definitionHash,policyHash,jsonValue(input,{maxBytes:authority.maxOutputBytes}),manifest.graph,authority.maxCostMicros,authority.maxCalls);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Strict structural decoder; manifest/owner/account projections are checked by storage under the root lock. */
|
|
57
|
+
export function workflowTreeState(record: Pick<StoredRecord,'id'|'state'>): WorkflowTreeState {
|
|
58
|
+
try {
|
|
59
|
+
const idDescriptor=Object.getOwnPropertyDescriptor(record,'id'); const stateDescriptor=Object.getOwnPropertyDescriptor(record,'state');
|
|
60
|
+
if(!idDescriptor||!('value'in idDescriptor)||!stateDescriptor||!('value'in stateDescriptor)) corrupt(); hash(idDescriptor.value);
|
|
61
|
+
const state=object(jsonValue(stateDescriptor.value));
|
|
62
|
+
fields(state,['format','rootId','accountId','definition','policy','input','status','steps','maxCostMicros','maxCalls','spentMicros','reservedMicros','budgetVersion','output']);
|
|
63
|
+
if(state['format']!==4||!['running','waiting','paused','succeeded','failed','blocked','cancelled','outcome_unknown'].includes(state['status'] as string)) corrupt();
|
|
64
|
+
hash(state['rootId']); hash(state['definition']); hash(state['policy']);
|
|
65
|
+
if(typeof state['accountId']!=='string'||!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(state['accountId'])) corrupt();
|
|
66
|
+
integer(state['maxCostMicros']); integer(state['maxCalls'],1); const spent=integer(state['spentMicros']); const reserved=integer(state['reservedMicros']); integer(state['budgetVersion'],1);
|
|
67
|
+
if(spent+reserved>Number(state['maxCostMicros'])) corrupt();
|
|
68
|
+
const steps=object(state['steps']); if(!Object.keys(steps).length||Object.keys(steps).length>128) corrupt(); let projected=0;
|
|
69
|
+
for(const [nodeId,raw] of Object.entries(steps)) {
|
|
70
|
+
if(!/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(nodeId)) corrupt(); const step=object(raw);
|
|
71
|
+
fields(step,['kind','status','callId','output','receipt','approval','costReserved','candidateHash','child']);
|
|
72
|
+
if(!['tool','join','child'].includes(step['kind'] as string)||!['pending','waiting','approved','dispatching','succeeded','failed','blocked','unknown','skipped'].includes(step['status'] as string)||step['callId']!==`step:${nodeId}`) corrupt();
|
|
73
|
+
projected+=integer(step['costReserved']); if(step['candidateHash']!==null) hash(step['candidateHash']);
|
|
74
|
+
if(step['kind']!=='tool'&&(step['receipt']!==null||step['approval']!==null||step['costReserved']!==0)) corrupt();
|
|
75
|
+
if(step['kind']!=='child'&&step['child']!==null) corrupt();
|
|
76
|
+
if(step['kind']==='child'&&step['child']!==null){const link=object(step['child']);fields(link,['runId','accountId','definitionHash','policyHash','inputHash','joinedVersion']);hash(link['runId']);hash(link['definitionHash']);hash(link['policyHash']);hash(link['inputHash']);if(typeof link['accountId']!=='string')corrupt();if(link['joinedVersion']!==null)integer(link['joinedVersion'],1);}
|
|
77
|
+
if(step['status']!=='succeeded'&&step['output']!==null) corrupt();
|
|
78
|
+
}
|
|
79
|
+
if(projected!==reserved||(state['status']!=='succeeded'&&state['output']!==null)) corrupt();
|
|
80
|
+
return state as unknown as WorkflowTreeState;
|
|
81
|
+
} catch{return corrupt();}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function assertWorkflowTreeRootState(state:WorkflowTreeState,definition:WorkflowTreeManifest,policy:WorkflowTreePolicyManifest,resources:WorkflowResourcePlan):void {
|
|
85
|
+
try{const manifest=workflowTreeManifest(definition);const authority=workflowTreePolicy(policy);workflowTreeRootResources(resources,manifest);
|
|
86
|
+
if(state.accountId!=='root'||state.rootId===undefined||state.maxCostMicros!==authority.maxCostMicros||state.maxCalls!==authority.maxCalls||Object.keys(state.steps).length!==manifest.graph.length)corrupt();
|
|
87
|
+
for(const node of manifest.graph)if(state.steps[node.id]?.kind!==node.kind)corrupt();
|
|
88
|
+
}catch{return corrupt();}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function assertWorkflowTreeLeafState(state:WorkflowTreeState,definition:WorkflowManifest,policy:WorkflowTreePolicyManifest,resources:WorkflowResourcePlan):void {
|
|
92
|
+
try{const manifest=workflowManifest(definition);const authority=workflowTreePolicy(policy);workflowResources(resources,manifest);
|
|
93
|
+
if(state.accountId==='root'||state.maxCostMicros!==authority.maxCostMicros||state.maxCalls!==authority.maxCalls||Object.keys(state.steps).length!==manifest.graph.length)corrupt();
|
|
94
|
+
for(const node of manifest.graph)if(state.steps[node.id]?.kind!==node.kind)corrupt();
|
|
95
|
+
}catch{return corrupt();}
|
|
96
|
+
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';
|
|
2
|
+
import { StorageError, type StoredRecord } from './contracts.js';
|
|
3
|
+
import type { WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';
|
|
4
|
+
import { workflowManifest, workflowState, type WorkflowFormat2Step, type WorkflowFormat2StepStatus } from './workflow-format2.js';
|
|
5
|
+
|
|
6
|
+
export type WorkflowLifecycleHumanKind = 'information' | 'correction' | 'plan_selection';
|
|
7
|
+
|
|
8
|
+
export interface WorkflowLifecycleHumanNodeManifest {
|
|
9
|
+
readonly kind: 'human';
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly dependsOn: readonly string[];
|
|
12
|
+
readonly requestKind: WorkflowLifecycleHumanKind;
|
|
13
|
+
readonly schemaId: string;
|
|
14
|
+
readonly schemaDigest: string;
|
|
15
|
+
readonly prompt: string;
|
|
16
|
+
readonly context: WorkflowBinding | null;
|
|
17
|
+
readonly subjectDigest: WorkflowBinding | null;
|
|
18
|
+
readonly deadlineAtMs: WorkflowBinding | null;
|
|
19
|
+
readonly when?: WorkflowBinding;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface WorkflowLifecycleTimerNodeManifest {
|
|
23
|
+
readonly kind: 'timer';
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly dependsOn: readonly string[];
|
|
26
|
+
readonly fireAtMs: WorkflowBinding;
|
|
27
|
+
readonly when?: WorkflowBinding;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Any lifecycle node may carry `when`: a binding over the input or a dependency's output. The node runs only when it
|
|
32
|
+
* resolves to a value other than `null` or `false`; otherwise it is `bypassed` without being admitted or charged.
|
|
33
|
+
* The key is present only when declared, so definitions without it keep their digest.
|
|
34
|
+
*/
|
|
35
|
+
export type WorkflowLifecycleManifestNode = (WorkflowManifestNode & { readonly when?: WorkflowBinding })
|
|
36
|
+
| WorkflowLifecycleHumanNodeManifest
|
|
37
|
+
| WorkflowLifecycleTimerNodeManifest;
|
|
38
|
+
|
|
39
|
+
/** Immutable data-only definition material for explicit lifecycle suspension nodes. */
|
|
40
|
+
export interface WorkflowLifecycleManifest {
|
|
41
|
+
readonly format: 5;
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly version: string;
|
|
44
|
+
readonly graph: readonly WorkflowLifecycleManifestNode[];
|
|
45
|
+
readonly result: WorkflowBinding;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type WorkflowLifecycleStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';
|
|
49
|
+
export type WorkflowLifecycleHumanStepStatus = 'pending' | 'waiting' | 'succeeded' | 'timed_out' | 'skipped' | 'bypassed';
|
|
50
|
+
export type WorkflowLifecycleTimerStepStatus = 'pending' | 'waiting' | 'succeeded' | 'skipped' | 'bypassed';
|
|
51
|
+
/** `bypassed`: the step's `when` condition did not hold, so it never started. Dependents treat it like success with output `null`. */
|
|
52
|
+
export type WorkflowLifecycleToolStepStatus = WorkflowFormat2StepStatus | 'bypassed';
|
|
53
|
+
export type WorkflowLifecycleToolStep = Omit<WorkflowFormat2Step, 'status'> & { status: WorkflowLifecycleToolStepStatus };
|
|
54
|
+
|
|
55
|
+
export interface WorkflowLifecycleHumanStep {
|
|
56
|
+
readonly kind: 'human';
|
|
57
|
+
status: WorkflowLifecycleHumanStepStatus;
|
|
58
|
+
readonly callId: string;
|
|
59
|
+
output: JsonValue;
|
|
60
|
+
requestDigest: string | null;
|
|
61
|
+
responseDigest: string | null;
|
|
62
|
+
actorId: string | null;
|
|
63
|
+
deadlineAtMs: number | null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface WorkflowLifecycleTimerStep {
|
|
67
|
+
readonly kind: 'timer';
|
|
68
|
+
status: WorkflowLifecycleTimerStepStatus;
|
|
69
|
+
readonly callId: string;
|
|
70
|
+
output: JsonValue;
|
|
71
|
+
fireAtMs: number | null;
|
|
72
|
+
firedAtMs: number | null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type WorkflowLifecycleStep = WorkflowLifecycleToolStep | WorkflowLifecycleHumanStep | WorkflowLifecycleTimerStep;
|
|
76
|
+
|
|
77
|
+
export interface WorkflowLifecycleState {
|
|
78
|
+
readonly format: 5;
|
|
79
|
+
readonly definition: string;
|
|
80
|
+
readonly policy: string;
|
|
81
|
+
readonly input: JsonValue;
|
|
82
|
+
status: WorkflowLifecycleStatus;
|
|
83
|
+
readonly steps: Record<string, WorkflowLifecycleStep>;
|
|
84
|
+
readonly maxCostMicros: number;
|
|
85
|
+
spentMicros: number;
|
|
86
|
+
reservedMicros: number;
|
|
87
|
+
output: JsonValue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const forbidden = new Set(['constructor', 'prototype', '__proto__']);
|
|
91
|
+
const idPattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;
|
|
92
|
+
const schemaIdPattern = /^[A-Za-z][A-Za-z0-9._/-]{0,127}$/;
|
|
93
|
+
const hashPattern = /^[a-f0-9]{64}$/;
|
|
94
|
+
const humanKinds = new Set<WorkflowLifecycleHumanKind>(['information', 'correction', 'plan_selection']);
|
|
95
|
+
const lifecycleStatuses = new Set<WorkflowLifecycleStatus>(['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown']);
|
|
96
|
+
const humanStepStatuses = new Set<WorkflowLifecycleHumanStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped', 'bypassed']);
|
|
97
|
+
const timerStepStatuses = new Set<WorkflowLifecycleTimerStepStatus>(['pending', 'waiting', 'succeeded', 'skipped', 'bypassed']);
|
|
98
|
+
/** Statuses a dependent step may build on. */
|
|
99
|
+
const satisfied = new Set(['succeeded', 'bypassed']);
|
|
100
|
+
|
|
101
|
+
function invalid(): never {
|
|
102
|
+
throw new StorageError('INVALID_INPUT', 'Invalid bounded workflow lifecycle metadata.');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function corrupt(): never {
|
|
106
|
+
throw new StorageError('CONFLICT', 'Stored workflow lifecycle state failed integrity validation.');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function object(value: JsonValue | undefined): JsonObject {
|
|
110
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) invalid();
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function fields(value: JsonObject, names: readonly string[]): void {
|
|
115
|
+
if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value, name))) invalid();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function integer(value: unknown, minimum = 0): number {
|
|
119
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum) invalid();
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function hash(value: unknown): string {
|
|
124
|
+
if (typeof value !== 'string' || !hashPattern.test(value)) invalid();
|
|
125
|
+
return value;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function identity(value: unknown, maximum = 256): string {
|
|
129
|
+
if (typeof value !== 'string' || value.length < 1 || value.length > maximum || value.includes('\0')) invalid();
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function canonical(value: JsonValue): string {
|
|
134
|
+
if (value === null || typeof value !== 'object') return JSON.stringify(value);
|
|
135
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
|
|
136
|
+
return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key]!)}`).join(',')}}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function binding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {
|
|
140
|
+
const candidate = object(value);
|
|
141
|
+
if (candidate['kind'] === 'literal') fields(candidate, ['kind', 'value']);
|
|
142
|
+
else if (candidate['kind'] === 'input' || candidate['kind'] === 'step') {
|
|
143
|
+
fields(candidate, candidate['kind'] === 'input' ? ['kind', 'path'] : ['kind', 'stepId', 'path']);
|
|
144
|
+
if (!Array.isArray(candidate['path']) || candidate['path'].length > 32
|
|
145
|
+
|| candidate['path'].some(segment => typeof segment !== 'string' || forbidden.has(segment))) invalid();
|
|
146
|
+
if (candidate['kind'] === 'step') {
|
|
147
|
+
if (typeof candidate['stepId'] !== 'string' || !ids.has(candidate['stepId'])
|
|
148
|
+
|| !dependencies.includes(candidate['stepId'])) invalid();
|
|
149
|
+
}
|
|
150
|
+
} else invalid();
|
|
151
|
+
return candidate as unknown as WorkflowBinding;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function temporalBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {
|
|
155
|
+
const candidate = binding(value, ids, dependencies);
|
|
156
|
+
if (candidate.kind === 'literal' && (typeof candidate.value !== 'number'
|
|
157
|
+
|| !Number.isSafeInteger(candidate.value) || candidate.value < 0)) invalid();
|
|
158
|
+
return candidate;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function digestBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {
|
|
162
|
+
const candidate = binding(value, ids, dependencies);
|
|
163
|
+
if (candidate.kind === 'literal' && (typeof candidate.value !== 'string' || !hashPattern.test(candidate.value))) invalid();
|
|
164
|
+
return candidate;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Strict format-5 decoder. It deliberately reuses the immutable format-2 graph
|
|
169
|
+
* projection for common tool/join validation while retaining lifecycle nodes.
|
|
170
|
+
*/
|
|
171
|
+
export function workflowLifecycleManifest(value: unknown): WorkflowLifecycleManifest {
|
|
172
|
+
try {
|
|
173
|
+
const manifest = object(jsonValue(value));
|
|
174
|
+
fields(manifest, ['format', 'id', 'version', 'graph', 'result']);
|
|
175
|
+
if (manifest['format'] !== 5 || !Array.isArray(manifest['graph'])) invalid();
|
|
176
|
+
const graph = manifest['graph'];
|
|
177
|
+
if (graph.length < 1 || graph.length > 128) invalid();
|
|
178
|
+
|
|
179
|
+
const projected = graph.map(raw => {
|
|
180
|
+
const node = object(raw);
|
|
181
|
+
if (node['kind'] === 'tool' || node['kind'] === 'join') {
|
|
182
|
+
if (!Object.hasOwn(node, 'when')) return node;
|
|
183
|
+
const { when: _when, ...rest } = node; return rest;
|
|
184
|
+
}
|
|
185
|
+
if (node['kind'] !== 'human' && node['kind'] !== 'timer') invalid();
|
|
186
|
+
return { kind: 'join', id: node['id'], dependsOn: node['dependsOn'] };
|
|
187
|
+
});
|
|
188
|
+
const common = workflowManifest({ id: manifest['id'], version: manifest['version'], graph: projected, result: manifest['result'] });
|
|
189
|
+
const ids = new Set(common.graph.map(node => node.id));
|
|
190
|
+
let humans = 0; let timers = 0;
|
|
191
|
+
|
|
192
|
+
for (const raw of graph) {
|
|
193
|
+
const node = object(raw);
|
|
194
|
+
const id = typeof node['id'] === 'string' && idPattern.test(node['id']) ? node['id'] : invalid();
|
|
195
|
+
const projectedNode = common.graph.find(item => item.id === id)!;
|
|
196
|
+
const dependencies = projectedNode.dependsOn;
|
|
197
|
+
const conditional = Object.hasOwn(node, 'when');
|
|
198
|
+
if (conditional) binding(node['when'], ids, dependencies);
|
|
199
|
+
if (node['kind'] === 'tool' || node['kind'] === 'join') continue;
|
|
200
|
+
const optional = conditional ? ['when'] : [];
|
|
201
|
+
if (node['kind'] === 'timer') {
|
|
202
|
+
timers += 1;
|
|
203
|
+
fields(node, ['kind', 'id', 'dependsOn', 'fireAtMs', ...optional]);
|
|
204
|
+
temporalBinding(node['fireAtMs'], ids, dependencies);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
humans += 1;
|
|
208
|
+
fields(node, ['kind', 'id', 'dependsOn', 'requestKind', 'schemaId', 'schemaDigest', 'prompt', 'context', 'subjectDigest', 'deadlineAtMs', ...optional]);
|
|
209
|
+
if (!humanKinds.has(node['requestKind'] as WorkflowLifecycleHumanKind)
|
|
210
|
+
|| typeof node['schemaId'] !== 'string' || !schemaIdPattern.test(node['schemaId'])
|
|
211
|
+
|| typeof node['schemaDigest'] !== 'string' || !hashPattern.test(node['schemaDigest'])
|
|
212
|
+
|| typeof node['prompt'] !== 'string' || node['prompt'].length < 1
|
|
213
|
+
|| new TextEncoder().encode(node['prompt']).byteLength > 1_024) invalid();
|
|
214
|
+
if ((node['requestKind'] === 'correction') !== (node['subjectDigest'] !== null)) invalid();
|
|
215
|
+
if (node['context'] !== null) binding(node['context'], ids, dependencies);
|
|
216
|
+
if (node['subjectDigest'] !== null) digestBinding(node['subjectDigest'], ids, dependencies);
|
|
217
|
+
if (node['deadlineAtMs'] !== null) temporalBinding(node['deadlineAtMs'], ids, dependencies);
|
|
218
|
+
}
|
|
219
|
+
if (humans > 32 || timers > 64) invalid();
|
|
220
|
+
return freezeJson(manifest) as unknown as WorkflowLifecycleManifest;
|
|
221
|
+
} catch {
|
|
222
|
+
return invalid();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Construct a detached initial state without activating any suspension or effect. */
|
|
227
|
+
export function initialWorkflowLifecycleState(
|
|
228
|
+
definition: WorkflowLifecycleManifest,
|
|
229
|
+
input: JsonValue,
|
|
230
|
+
definitionHash: string,
|
|
231
|
+
policyHash: string,
|
|
232
|
+
maxCostMicros: number,
|
|
233
|
+
): WorkflowLifecycleState {
|
|
234
|
+
try {
|
|
235
|
+
const manifest = workflowLifecycleManifest(definition);
|
|
236
|
+
hash(definitionHash); hash(policyHash); integer(maxCostMicros);
|
|
237
|
+
return jsonValue({
|
|
238
|
+
format: 5, definition: definitionHash, policy: policyHash, input, status: 'running',
|
|
239
|
+
steps: Object.fromEntries(manifest.graph.map(node => [node.id,
|
|
240
|
+
node.kind === 'human'
|
|
241
|
+
? { kind: 'human', status: 'pending', callId: `step:${node.id}`, output: null,
|
|
242
|
+
requestDigest: null, responseDigest: null, actorId: null, deadlineAtMs: null }
|
|
243
|
+
: node.kind === 'timer'
|
|
244
|
+
? { kind: 'timer', status: 'pending', callId: `step:${node.id}`, output: null,
|
|
245
|
+
fireAtMs: null, firedAtMs: null }
|
|
246
|
+
: { kind: node.kind, status: 'pending', callId: `step:${node.id}`, output: null,
|
|
247
|
+
receipt: null, approval: null, costReserved: 0, candidateHash: null },
|
|
248
|
+
])),
|
|
249
|
+
maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,
|
|
250
|
+
}) as unknown as WorkflowLifecycleState;
|
|
251
|
+
} catch { return invalid(); }
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Strictly decode a mutable format-5 state copy suitable for a checked transition. */
|
|
255
|
+
export function workflowLifecycleState(record: Pick<StoredRecord, 'id' | 'state'>): WorkflowLifecycleState {
|
|
256
|
+
try {
|
|
257
|
+
const idDescriptor = Object.getOwnPropertyDescriptor(record, 'id');
|
|
258
|
+
const stateDescriptor = Object.getOwnPropertyDescriptor(record, 'state');
|
|
259
|
+
if (!idDescriptor || !('value' in idDescriptor) || !stateDescriptor || !('value' in stateDescriptor)) invalid();
|
|
260
|
+
const runId = identity(idDescriptor.value, 512);
|
|
261
|
+
const state = object(jsonValue(stateDescriptor.value));
|
|
262
|
+
fields(state, ['format', 'definition', 'policy', 'input', 'status', 'steps', 'maxCostMicros', 'spentMicros', 'reservedMicros', 'output']);
|
|
263
|
+
if (state['format'] !== 5 || !lifecycleStatuses.has(state['status'] as WorkflowLifecycleStatus)) invalid();
|
|
264
|
+
const definitionHash = hash(state['definition']); const policyHash = hash(state['policy']);
|
|
265
|
+
const input = jsonValue(state['input']);
|
|
266
|
+
const maxCostMicros = integer(state['maxCostMicros']); const spentMicros = integer(state['spentMicros']); const reservedMicros = integer(state['reservedMicros']);
|
|
267
|
+
if (spentMicros > maxCostMicros - reservedMicros) invalid();
|
|
268
|
+
const steps = object(state['steps']); const entries = Object.entries(steps);
|
|
269
|
+
if (entries.length < 1 || entries.length > 128) invalid();
|
|
270
|
+
const common: Record<string, JsonValue> = {}; let computedReserved = 0; let waiting = 0;
|
|
271
|
+
for (const [id, raw] of entries) {
|
|
272
|
+
if (!idPattern.test(id) || forbidden.has(id)) invalid();
|
|
273
|
+
const step = object(raw);
|
|
274
|
+
if (step['callId'] !== `step:${id}`) invalid();
|
|
275
|
+
if (step['kind'] === 'tool' || step['kind'] === 'join') {
|
|
276
|
+
if (step['status'] === 'bypassed') {
|
|
277
|
+
if (step['output'] !== null || step['receipt'] !== null || step['approval'] !== null || step['costReserved'] !== 0 || step['candidateHash'] !== null) invalid();
|
|
278
|
+
common[id] = { ...step, status: 'skipped' }; continue;
|
|
279
|
+
}
|
|
280
|
+
common[id] = step; computedReserved += integer(step['costReserved']);
|
|
281
|
+
if (step['status'] === 'waiting') waiting += 1;
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (step['kind'] === 'human') {
|
|
285
|
+
fields(step, ['kind', 'status', 'callId', 'output', 'requestDigest', 'responseDigest', 'actorId', 'deadlineAtMs']);
|
|
286
|
+
if (!humanStepStatuses.has(step['status'] as WorkflowLifecycleHumanStepStatus)) invalid();
|
|
287
|
+
if (step['requestDigest'] !== null) hash(step['requestDigest']);
|
|
288
|
+
if (step['responseDigest'] !== null) hash(step['responseDigest']);
|
|
289
|
+
if (step['actorId'] !== null) identity(step['actorId']);
|
|
290
|
+
if (step['deadlineAtMs'] !== null) integer(step['deadlineAtMs']);
|
|
291
|
+
if (step['status'] === 'pending' && [step['requestDigest'], step['responseDigest'], step['actorId'], step['deadlineAtMs'], step['output']].some(value => value !== null)) invalid();
|
|
292
|
+
if (step['status'] === 'waiting' && (step['requestDigest'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();
|
|
293
|
+
if (step['status'] === 'succeeded' && (step['requestDigest'] === null || step['responseDigest'] === null || step['actorId'] === null)) invalid();
|
|
294
|
+
if (step['status'] === 'timed_out' && (step['requestDigest'] === null || step['deadlineAtMs'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();
|
|
295
|
+
if ((step['status'] === 'skipped' || step['status'] === 'bypassed') && (step['requestDigest'] !== null || step['responseDigest'] !== null || step['actorId'] !== null || step['deadlineAtMs'] !== null || step['output'] !== null)) invalid();
|
|
296
|
+
if (step['status'] === 'waiting') waiting += 1;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (step['kind'] === 'timer') {
|
|
300
|
+
fields(step, ['kind', 'status', 'callId', 'output', 'fireAtMs', 'firedAtMs']);
|
|
301
|
+
if (!timerStepStatuses.has(step['status'] as WorkflowLifecycleTimerStepStatus)) invalid();
|
|
302
|
+
if (step['fireAtMs'] !== null) integer(step['fireAtMs']);
|
|
303
|
+
if (step['firedAtMs'] !== null) integer(step['firedAtMs']);
|
|
304
|
+
if (step['status'] === 'pending' || step['status'] === 'skipped' || step['status'] === 'bypassed') {
|
|
305
|
+
if (step['fireAtMs'] !== null || step['firedAtMs'] !== null || step['output'] !== null) invalid();
|
|
306
|
+
} else if (step['status'] === 'waiting') {
|
|
307
|
+
if (step['fireAtMs'] === null || step['firedAtMs'] !== null || step['output'] !== null) invalid();
|
|
308
|
+
waiting += 1;
|
|
309
|
+
} else {
|
|
310
|
+
if (step['fireAtMs'] === null || step['firedAtMs'] === null || Number(step['firedAtMs']) < Number(step['fireAtMs'])
|
|
311
|
+
|| canonical(step['output']!) !== canonical(jsonValue({ fireAtMs: step['fireAtMs'], firedAtMs: step['firedAtMs'] }))) invalid();
|
|
312
|
+
}
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
invalid();
|
|
316
|
+
}
|
|
317
|
+
if (computedReserved !== reservedMicros) invalid();
|
|
318
|
+
if (Object.keys(common).length > 0) workflowState({ id: runId, state: {
|
|
319
|
+
format: 2, definition: definitionHash, policy: policyHash, input, status: 'running',
|
|
320
|
+
steps: common, maxCostMicros, spentMicros, reservedMicros, output: null,
|
|
321
|
+
} });
|
|
322
|
+
if (state['status'] === 'waiting' && waiting === 0) invalid();
|
|
323
|
+
if (!['running', 'waiting', 'paused'].includes(state['status'] as string) && waiting > 0) invalid();
|
|
324
|
+
if (state['status'] === 'succeeded' && entries.some(([, raw]) => !satisfied.has(object(raw)['status'] as string))) invalid();
|
|
325
|
+
if (state['status'] !== 'succeeded' && state['output'] !== null) invalid();
|
|
326
|
+
return state as unknown as WorkflowLifecycleState;
|
|
327
|
+
} catch { return corrupt(); }
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Cross-check state node identities, kinds and successful dependency evidence. */
|
|
331
|
+
export function assertWorkflowLifecycleStateMatchesManifest(
|
|
332
|
+
state: WorkflowLifecycleState,
|
|
333
|
+
definition: WorkflowLifecycleManifest,
|
|
334
|
+
): void {
|
|
335
|
+
try {
|
|
336
|
+
const manifest = workflowLifecycleManifest(definition);
|
|
337
|
+
const value = object(jsonValue(state)); const steps = object(value['steps']);
|
|
338
|
+
if (Object.keys(steps).length !== manifest.graph.length) invalid();
|
|
339
|
+
for (const node of manifest.graph) {
|
|
340
|
+
const step = object(steps[node.id]);
|
|
341
|
+
if (step['kind'] !== node.kind) invalid();
|
|
342
|
+
// A step is bypassed only when it declares a condition, and only after its dependencies were satisfied.
|
|
343
|
+
if (step['status'] === 'bypassed' && !Object.hasOwn(node, 'when')) invalid();
|
|
344
|
+
if (satisfied.has(step['status'] as string) && node.dependsOn.some(id => !satisfied.has(object(steps[id])['status'] as string))) invalid();
|
|
345
|
+
if (node.kind === 'tool') {
|
|
346
|
+
if (step['receipt'] !== null && object(step['receipt'])['toolId'] !== node.tool) invalid();
|
|
347
|
+
if (integer(step['costReserved']) > node.costMicros) invalid();
|
|
348
|
+
}
|
|
349
|
+
if (node.kind === 'human' && step['deadlineAtMs'] !== null && node.deadlineAtMs === null) invalid();
|
|
350
|
+
}
|
|
351
|
+
} catch { return corrupt(); }
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Return detached outputs only for successfully completed nodes; a bypassed node's output is `null`. */
|
|
355
|
+
export function workflowLifecycleOutputs(state: WorkflowLifecycleState): Record<string, JsonValue> {
|
|
356
|
+
try {
|
|
357
|
+
const steps = object(object(jsonValue(state))['steps']);
|
|
358
|
+
return Object.fromEntries(Object.entries(steps).filter(([, raw]) => satisfied.has(object(raw)['status'] as string))
|
|
359
|
+
.map(([id, raw]) => {
|
|
360
|
+
const step = object(raw);
|
|
361
|
+
if (step['status'] === 'bypassed') return [id, null];
|
|
362
|
+
if (step['kind'] === 'tool') {
|
|
363
|
+
const evidence = object(step['receipt']);
|
|
364
|
+
if (evidence['execution'] !== 'succeeded' || evidence['disclosure'] !== 'released'
|
|
365
|
+
|| step['candidateHash'] === null || integer(step['costReserved']) !== 0) invalid();
|
|
366
|
+
} else if (step['kind'] === 'human') {
|
|
367
|
+
hash(step['requestDigest']); hash(step['responseDigest']); identity(step['actorId']);
|
|
368
|
+
} else if (step['kind'] === 'timer') {
|
|
369
|
+
const fireAtMs = integer(step['fireAtMs']); const firedAtMs = integer(step['firedAtMs']);
|
|
370
|
+
if (firedAtMs < fireAtMs || canonical(step['output']!) !== canonical(jsonValue({ fireAtMs, firedAtMs }))) invalid();
|
|
371
|
+
} else if (step['kind'] !== 'join') invalid();
|
|
372
|
+
return [id, step['output']!];
|
|
373
|
+
}));
|
|
374
|
+
} catch { return corrupt(); }
|
|
375
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { JsonValue } from '@mayura/core';
|
|
2
|
+
import type { ExecutionRef, ExecutionWaitAggregateStore } from './execution-wait-contracts.js';
|
|
3
|
+
import type { ScheduledEnrollment, ScheduledMigrate, ScheduledWorkflowSnapshot, ScheduledWorkflowStore, WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';
|
|
4
|
+
import type { WorkflowFormat2State, WorkflowFormat2Step } from './workflow-format2.js';
|
|
5
|
+
|
|
6
|
+
/** References are fixed before parent creation; step outputs cannot introduce future back-edges. */
|
|
7
|
+
export type WorkflowGraphTargetBinding =
|
|
8
|
+
| { readonly kind: 'literal'; readonly value: readonly ExecutionRef[] }
|
|
9
|
+
| { readonly kind: 'input'; readonly path: readonly string[] };
|
|
10
|
+
export type WorkflowGraphManifestNode = WorkflowManifestNode | {
|
|
11
|
+
readonly kind: 'wait'; readonly id: string; readonly dependsOn: readonly string[];
|
|
12
|
+
readonly targets: WorkflowGraphTargetBinding;
|
|
13
|
+
};
|
|
14
|
+
/** The explicit format and v2 hash domain keep legacy definitions byte-compatible. */
|
|
15
|
+
export interface WorkflowGraphManifest {
|
|
16
|
+
readonly format: 3; readonly id: string; readonly version: string;
|
|
17
|
+
readonly graph: readonly WorkflowGraphManifestNode[]; readonly result: WorkflowBinding;
|
|
18
|
+
}
|
|
19
|
+
export interface WorkflowGraphFormat3Step extends Omit<WorkflowFormat2Step, 'kind'> { kind: 'tool' | 'join' | 'wait' }
|
|
20
|
+
export interface WorkflowGraphFormat3State extends Omit<WorkflowFormat2State, 'format' | 'steps'> {
|
|
21
|
+
format: 3; steps: Record<string, WorkflowGraphFormat3Step>;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkflowGraphStoreSnapshot extends Omit<ScheduledWorkflowSnapshot, 'profile'> { readonly profile: 'scheduled-v2' }
|
|
24
|
+
export interface WorkflowGraphEnrollment extends Omit<ScheduledEnrollment, 'manifest'> { readonly manifest: WorkflowGraphManifest }
|
|
25
|
+
|
|
26
|
+
/** Only the profile-specific manifest/result change; finite command identities retain their existing semantics. */
|
|
27
|
+
type GraphResponse<T> = T extends ScheduledWorkflowSnapshot ? WorkflowGraphStoreSnapshot
|
|
28
|
+
: T extends { readonly snapshot: ScheduledWorkflowSnapshot } ? Omit<T, 'snapshot'> & { readonly snapshot: WorkflowGraphStoreSnapshot }
|
|
29
|
+
: T;
|
|
30
|
+
type GraphControlStore = {
|
|
31
|
+
[K in Exclude<keyof ScheduledWorkflowStore, 'submit' | 'attach' | 'pause' | 'resume' | 'migrate'>]:
|
|
32
|
+
(...args: Parameters<ScheduledWorkflowStore[K]>) => Promise<GraphResponse<Awaited<ReturnType<ScheduledWorkflowStore[K]>>>>;
|
|
33
|
+
};
|
|
34
|
+
/** New optional capability: never widens or silently changes custom scheduled-v1 adapters. */
|
|
35
|
+
export interface WorkflowGraphStore extends GraphControlStore {
|
|
36
|
+
submit(command: WorkflowGraphEnrollment & { readonly input: JsonValue; readonly idempotencyKey: string }): Promise<{ readonly snapshot: WorkflowGraphStoreSnapshot; readonly created: boolean }>;
|
|
37
|
+
/** Optional quiescent operator pause; refused while any job is leased or started. Custom adapters may omit it. */
|
|
38
|
+
pause?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;
|
|
39
|
+
/** Optional scheduling-only resume; unresolved waits and approvals remain unresolved. */
|
|
40
|
+
resume?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;
|
|
41
|
+
/** Optional reviewed in-place migration of a paused graph run; see `ScheduledWorkflowStore.migrate`. */
|
|
42
|
+
migrate?(command: ScheduledMigrate): Promise<WorkflowGraphStoreSnapshot>;
|
|
43
|
+
}
|
|
44
|
+
export interface WorkflowGraphAggregateStore extends ExecutionWaitAggregateStore { readonly workflowGraphs: WorkflowGraphStore }
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';
|
|
2
|
+
import { StorageError } from './contracts.js';
|
|
3
|
+
import { executionRef, type ExecutionRef } from './execution-wait-contracts.js';
|
|
4
|
+
import type { WorkflowGraphAggregateStore } from './workflow-graph-contracts.js';
|
|
5
|
+
|
|
6
|
+
/** Continuation metadata, not a capability or a stable-snapshot token. */
|
|
7
|
+
export interface WorkflowGraphDiscoveryCursor {
|
|
8
|
+
readonly format: 1;
|
|
9
|
+
readonly scope: string;
|
|
10
|
+
readonly policyHash: string;
|
|
11
|
+
readonly afterId: string;
|
|
12
|
+
}
|
|
13
|
+
/** A currently nonterminal observation, never permission or a promise of dispatch readiness. */
|
|
14
|
+
export interface WorkflowGraphDiscoveryCandidate {
|
|
15
|
+
readonly reference: ExecutionRef;
|
|
16
|
+
readonly version: number;
|
|
17
|
+
/** Paused runs are listed so operators and version inventories see them; coordinators skip them. */
|
|
18
|
+
readonly status: 'running' | 'waiting' | 'paused';
|
|
19
|
+
}
|
|
20
|
+
export interface WorkflowGraphDiscoveryPage {
|
|
21
|
+
readonly candidates: readonly WorkflowGraphDiscoveryCandidate[];
|
|
22
|
+
readonly examined: number;
|
|
23
|
+
readonly nextCursor: WorkflowGraphDiscoveryCursor | null;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkflowGraphDiscoveryScan {
|
|
26
|
+
readonly scope: string;
|
|
27
|
+
readonly policyHash: string;
|
|
28
|
+
readonly cursor: WorkflowGraphDiscoveryCursor | null;
|
|
29
|
+
/** Bounds examined owners, including terminal rows that produce no candidate. */
|
|
30
|
+
readonly limit: number;
|
|
31
|
+
}
|
|
32
|
+
export interface WorkflowGraphDiscoveryStore {
|
|
33
|
+
initialize(): Promise<void>;
|
|
34
|
+
scan(command: WorkflowGraphDiscoveryScan): Promise<WorkflowGraphDiscoveryPage>;
|
|
35
|
+
}
|
|
36
|
+
/** An explicitly selected extra capability; existing custom graph adapters are unchanged. */
|
|
37
|
+
export interface WorkflowGraphDiscoveryAggregateStore extends WorkflowGraphAggregateStore {
|
|
38
|
+
readonly workflowGraphDiscovery: WorkflowGraphDiscoveryStore;
|
|
39
|
+
}
|
|
40
|
+
export type WorkflowGraphDiscoveryMethod = keyof WorkflowGraphDiscoveryStore;
|
|
41
|
+
|
|
42
|
+
const HASH = /^[a-f0-9]{64}$/;
|
|
43
|
+
function invalid(): never { throw new StorageError('INVALID_INPUT', 'Invalid bounded graph discovery metadata.'); }
|
|
44
|
+
function object(value: JsonValue | undefined): JsonObject {
|
|
45
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) invalid(); return value;
|
|
46
|
+
}
|
|
47
|
+
function fields(value: JsonObject, names: readonly string[]): void {
|
|
48
|
+
if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value, name))) invalid();
|
|
49
|
+
}
|
|
50
|
+
function hash(value: unknown): string { if (typeof value !== 'string' || !HASH.test(value)) invalid(); return value; }
|
|
51
|
+
function integer(value: unknown, min: number, max = Number.MAX_SAFE_INTEGER): number {
|
|
52
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < min || value > max) invalid(); return value;
|
|
53
|
+
}
|
|
54
|
+
function owned<T>(raw: unknown, check: (value: JsonObject) => void): T {
|
|
55
|
+
try {
|
|
56
|
+
const value = object(jsonValue(raw, { maxBytes: 65_536, maxNodes: 4_096, maxDepth: 12 }));
|
|
57
|
+
check(value); return freezeJson(value) as unknown as T;
|
|
58
|
+
} catch { return invalid(); }
|
|
59
|
+
}
|
|
60
|
+
function cursorFields(value: JsonObject, scope?: string, policy?: string): void {
|
|
61
|
+
fields(value, ['format', 'scope', 'policyHash', 'afterId']);
|
|
62
|
+
if (value['format'] !== 1) invalid();
|
|
63
|
+
hash(value['scope']); hash(value['policyHash']); hash(value['afterId']);
|
|
64
|
+
if ((scope !== undefined && value['scope'] !== scope) || (policy !== undefined && value['policyHash'] !== policy)) invalid();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Validate exact cursor shape without interpreting it as authorization. */
|
|
68
|
+
export function workflowGraphDiscoveryCursor(raw: unknown): WorkflowGraphDiscoveryCursor {
|
|
69
|
+
return owned(raw, value => cursorFields(value));
|
|
70
|
+
}
|
|
71
|
+
/** Capture complete commands before queueing or awaiting any database operation. */
|
|
72
|
+
export function workflowGraphDiscoveryCommand(method: WorkflowGraphDiscoveryMethod, raw: unknown): JsonObject {
|
|
73
|
+
return owned(raw, value => {
|
|
74
|
+
if (method === 'initialize') { fields(value, []); return; }
|
|
75
|
+
if (method !== 'scan') invalid();
|
|
76
|
+
fields(value, ['scope', 'policyHash', 'cursor', 'limit']);
|
|
77
|
+
const scope = hash(value['scope']); const policy = hash(value['policyHash']); integer(value['limit'], 1, 32);
|
|
78
|
+
if (value['cursor'] !== null) cursorFields(object(value['cursor']), scope, policy);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Enforce page bounds/order/context; the configured adapter remains the persistence authority. */
|
|
82
|
+
export function workflowGraphDiscoveryPage(raw: unknown, context: WorkflowGraphDiscoveryScan): WorkflowGraphDiscoveryPage {
|
|
83
|
+
const command = workflowGraphDiscoveryCommand('scan', context);
|
|
84
|
+
const scope = command['scope'] as string; const policy = command['policyHash'] as string; const limit = command['limit'] as number;
|
|
85
|
+
const afterId = command['cursor'] === null ? '' : object(command['cursor'])['afterId'] as string;
|
|
86
|
+
return owned(raw, value => {
|
|
87
|
+
fields(value, ['candidates', 'examined', 'nextCursor']);
|
|
88
|
+
const examined = integer(value['examined'], 0, limit);
|
|
89
|
+
if (!Array.isArray(value['candidates']) || value['candidates'].length > examined) invalid();
|
|
90
|
+
let lastId = afterId;
|
|
91
|
+
for (const rawCandidate of value['candidates']) {
|
|
92
|
+
const candidate = object(rawCandidate); fields(candidate, ['reference', 'version', 'status']);
|
|
93
|
+
const reference = executionRef(candidate['reference']); integer(candidate['version'], 1);
|
|
94
|
+
if (!['running', 'waiting', 'paused'].includes(candidate['status'] as string)
|
|
95
|
+
|| reference.policyHash !== policy || reference.runId <= lastId) invalid();
|
|
96
|
+
lastId = reference.runId;
|
|
97
|
+
}
|
|
98
|
+
// A full examined page always permits continuation; terminal owners can leave
|
|
99
|
+
// the candidate array empty. A short page ends this non-snapshot sweep.
|
|
100
|
+
if (examined === limit) {
|
|
101
|
+
const cursor = object(value['nextCursor']); cursorFields(cursor, scope, policy);
|
|
102
|
+
const next = cursor['afterId'] as string;
|
|
103
|
+
if (next <= afterId || next < lastId) invalid();
|
|
104
|
+
if (value['candidates'].length === examined && next !== lastId) invalid();
|
|
105
|
+
} else if (value['nextCursor'] !== null) invalid();
|
|
106
|
+
});
|
|
107
|
+
}
|