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,814 @@
|
|
|
1
|
+
/** Safe machine-readable transport error; server/provider response bodies are never used as its message. */
|
|
2
|
+
export class ClientError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
status;
|
|
5
|
+
constructor(code, status) {
|
|
6
|
+
super(`Mayura request failed (${code}).`);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.name = 'ClientError';
|
|
10
|
+
Object.freeze(this);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const encoder = new TextEncoder();
|
|
14
|
+
const migrationIdPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
15
|
+
const migrationNodePattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;
|
|
16
|
+
const migrationActions = ['keep', 'update', 'reset', 'accept', 'add', 'remove'];
|
|
17
|
+
function plainObject(value) {
|
|
18
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
19
|
+
return fail();
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function exactKeys(value, keys) {
|
|
23
|
+
if (Object.keys(value).length !== keys.length || keys.some(key => !Object.hasOwn(value, key)))
|
|
24
|
+
fail();
|
|
25
|
+
}
|
|
26
|
+
function migrationOffer(value) {
|
|
27
|
+
const raw = plainObject(value);
|
|
28
|
+
exactKeys(raw, ['id', 'description', 'fromVersion', 'toVersion', 'fromDigest', 'toDigest']);
|
|
29
|
+
if (typeof raw['id'] !== 'string' || !migrationIdPattern.test(raw['id']) || typeof raw['description'] !== 'string' || raw['description'].length > 2_048
|
|
30
|
+
|| typeof raw['fromVersion'] !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/.test(raw['fromVersion'])
|
|
31
|
+
|| typeof raw['toVersion'] !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/.test(raw['toVersion'])
|
|
32
|
+
|| typeof raw['fromDigest'] !== 'string' || !/^[a-f0-9]{64}$/.test(raw['fromDigest'])
|
|
33
|
+
|| typeof raw['toDigest'] !== 'string' || !/^[a-f0-9]{64}$/.test(raw['toDigest']))
|
|
34
|
+
fail();
|
|
35
|
+
return Object.freeze({ ...raw });
|
|
36
|
+
}
|
|
37
|
+
function migrationPlan(value, runId, migrationId) {
|
|
38
|
+
const raw = plainObject(value);
|
|
39
|
+
exactKeys(raw, ['migrationId', 'format', 'runId', 'fromDigest', 'toDigest', 'entries', 'blockers', 'allowed']);
|
|
40
|
+
const entries = raw['entries'];
|
|
41
|
+
const blockers = raw['blockers'];
|
|
42
|
+
if (raw['migrationId'] !== migrationId || raw['runId'] !== runId || typeof raw['format'] !== 'string' || !/^[a-z0-9-]{1,32}$/.test(raw['format'])
|
|
43
|
+
|| typeof raw['fromDigest'] !== 'string' || !/^[a-f0-9]{64}$/.test(raw['fromDigest']) || typeof raw['toDigest'] !== 'string' || !/^[a-f0-9]{64}$/.test(raw['toDigest'])
|
|
44
|
+
|| !Array.isArray(entries) || entries.length > 512 || !Array.isArray(blockers) || blockers.length > 512 || raw['allowed'] !== (blockers.length === 0))
|
|
45
|
+
fail();
|
|
46
|
+
const frozenEntries = entries.map(item => {
|
|
47
|
+
const entry = plainObject(item);
|
|
48
|
+
if (Object.keys(entry).some(key => !['action', 'target', 'source', 'status'].includes(key)) || !migrationActions.includes(String(entry['action']))
|
|
49
|
+
|| (entry['target'] === undefined && entry['source'] === undefined)
|
|
50
|
+
|| [entry['target'], entry['source']].some(node => node !== undefined && (typeof node !== 'string' || !migrationNodePattern.test(node)))
|
|
51
|
+
|| (entry['status'] !== undefined && (typeof entry['status'] !== 'string' || !/^[a-z_]{1,32}$/.test(entry['status']))))
|
|
52
|
+
fail();
|
|
53
|
+
return Object.freeze({ ...entry });
|
|
54
|
+
});
|
|
55
|
+
const frozenBlockers = blockers.map(item => {
|
|
56
|
+
const blocker = plainObject(item);
|
|
57
|
+
exactKeys(blocker, ['node', 'reason']);
|
|
58
|
+
if (typeof blocker['node'] !== 'string' || !(blocker['node'] === '*' || migrationNodePattern.test(blocker['node']))
|
|
59
|
+
|| typeof blocker['reason'] !== 'string' || !blocker['reason'] || blocker['reason'].length > 512)
|
|
60
|
+
fail();
|
|
61
|
+
return Object.freeze({ node: blocker['node'], reason: blocker['reason'] });
|
|
62
|
+
});
|
|
63
|
+
return Object.freeze({ ...raw, entries: Object.freeze(frozenEntries), blockers: Object.freeze(frozenBlockers) });
|
|
64
|
+
}
|
|
65
|
+
/** Encode untrusted text for an HTML text node. Prefer DOM `textContent` when a DOM is available. */
|
|
66
|
+
export function escapeHtmlText(value, maxBytes = 1_048_576) {
|
|
67
|
+
if (typeof value !== 'string' || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 1_048_576)
|
|
68
|
+
throw new ClientError('INVALID_RENDER_INPUT');
|
|
69
|
+
if (encoder.encode(value).length > maxBytes)
|
|
70
|
+
throw new ClientError('RESPONSE_LIMIT');
|
|
71
|
+
return value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
|
|
72
|
+
}
|
|
73
|
+
const statuses = ['running', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown'];
|
|
74
|
+
const eventTypes = ['run.started', 'model.started', 'model.completed', 'tool.started', 'tool.completed', 'hook.started', 'hook.completed',
|
|
75
|
+
'step.started', 'step.completed', 'delegate.started', 'delegate.completed', 'run.completed', 'events.gap', 'output.delta', 'output.withheld'];
|
|
76
|
+
/** Streamed output is released text with an exact position; nothing else rides along. */
|
|
77
|
+
function outputMetadata(metadata, delta) {
|
|
78
|
+
const required = delta ? ['step', 'modelCall', 'index', 'text'] : ['step', 'modelCall'];
|
|
79
|
+
if (Object.keys(metadata).length !== required.length || required.some(key => !Object.hasOwn(metadata, key)))
|
|
80
|
+
throw new ClientError('INVALID_STREAM');
|
|
81
|
+
for (const key of ['step', 'modelCall', ...(delta ? ['index'] : [])]) {
|
|
82
|
+
if (typeof metadata[key] !== 'number' || !Number.isSafeInteger(metadata[key]) || metadata[key] < 0)
|
|
83
|
+
throw new ClientError('INVALID_STREAM');
|
|
84
|
+
}
|
|
85
|
+
if (delta && (typeof metadata['text'] !== 'string' || metadata['text'].length > 4_096))
|
|
86
|
+
throw new ClientError('INVALID_STREAM');
|
|
87
|
+
}
|
|
88
|
+
const hookFields = ['hookId', 'hookVersion', 'stage', 'invocationId', 'step', 'attempt'];
|
|
89
|
+
const hookStages = ['beforeExecution', 'beforeStep', 'beforeModelCall', 'beforeToolCall', 'beforeDelegate', 'beforeOutputRelease',
|
|
90
|
+
'afterStep', 'afterModelCall', 'afterToolCall', 'afterDelegate', 'onViolation', 'afterExecution', 'onError', 'onCancel', 'onBlocked', 'onFinally'];
|
|
91
|
+
const hookStatuses = ['continued', 'blocked', 'failed', 'cancelled', 'outcome_unknown'];
|
|
92
|
+
/** Hook observations have an exact content-free schema; the browser never admits hook arguments or messages. */
|
|
93
|
+
function hookMetadata(metadata, completed) {
|
|
94
|
+
const required = completed ? [...hookFields, 'status'] : hookFields;
|
|
95
|
+
if (Object.keys(metadata).length !== required.length || required.some(key => !Object.hasOwn(metadata, key)))
|
|
96
|
+
throw new ClientError('INVALID_STREAM');
|
|
97
|
+
for (const key of ['hookId', 'hookVersion']) {
|
|
98
|
+
if (typeof metadata[key] !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(metadata[key]))
|
|
99
|
+
throw new ClientError('INVALID_STREAM');
|
|
100
|
+
}
|
|
101
|
+
const stage = metadata['stage'];
|
|
102
|
+
const invocation = metadata['invocationId'];
|
|
103
|
+
const step = metadata['step'];
|
|
104
|
+
if (typeof stage !== 'string' || !hookStages.includes(stage)
|
|
105
|
+
|| typeof invocation !== 'string' || !/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/.test(invocation)
|
|
106
|
+
|| typeof step !== 'number' || !Number.isSafeInteger(step) || step < 0 || (stage === 'beforeExecution' && step !== 0)
|
|
107
|
+
|| metadata['attempt'] !== 1 || (completed && (typeof metadata['status'] !== 'string' || !hookStatuses.includes(metadata['status'])))) {
|
|
108
|
+
throw new ClientError('INVALID_STREAM');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function fail() { throw new ClientError('INVALID_RESPONSE'); }
|
|
112
|
+
const fleetOutcomes = new Set(['paused', 'already_paused', 'terminal', 'busy', 'resumed', 'not_paused', 'missing', 'unregistered']);
|
|
113
|
+
function fleetHold(value) {
|
|
114
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
115
|
+
return fail();
|
|
116
|
+
const raw = value;
|
|
117
|
+
const keys = Object.keys(raw);
|
|
118
|
+
if (keys.length !== 3 || !['held', 'generation', 'changedAtMs'].every(key => Object.hasOwn(raw, key)))
|
|
119
|
+
return fail();
|
|
120
|
+
const { held, generation, changedAtMs } = raw;
|
|
121
|
+
if (typeof held !== 'boolean' || typeof generation !== 'number' || !Number.isSafeInteger(generation) || generation < (held ? 1 : 0)
|
|
122
|
+
|| (changedAtMs !== null && (typeof changedAtMs !== 'number' || !Number.isSafeInteger(changedAtMs) || changedAtMs < 0)))
|
|
123
|
+
return fail();
|
|
124
|
+
return Object.freeze({ held, generation, changedAtMs: changedAtMs });
|
|
125
|
+
}
|
|
126
|
+
function fleetSweep(value, limit) {
|
|
127
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
128
|
+
return fail();
|
|
129
|
+
const raw = value;
|
|
130
|
+
if (Object.keys(raw).length !== 2 || !Array.isArray(raw['outcomes']) || !Object.hasOwn(raw, 'nextCursor') || raw['outcomes'].length > limit)
|
|
131
|
+
return fail();
|
|
132
|
+
const outcomes = raw['outcomes'].map((entry) => {
|
|
133
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
134
|
+
return fail();
|
|
135
|
+
const item = entry;
|
|
136
|
+
const failed = item['outcome'] === 'failed';
|
|
137
|
+
if (Object.keys(item).length !== (failed ? 4 : 3) || typeof item['target'] !== 'string' || !/^[a-z][a-z0-9-]{0,31}$/.test(item['target'])
|
|
138
|
+
|| typeof item['runId'] !== 'string' || !/^[a-f0-9]{64}$/.test(item['runId'])
|
|
139
|
+
|| (failed ? typeof item['code'] !== 'string' || !/^[A-Z][A-Z_]{0,39}$/.test(item['code']) : !fleetOutcomes.has(String(item['outcome']))))
|
|
140
|
+
return fail();
|
|
141
|
+
return Object.freeze({ ...item });
|
|
142
|
+
});
|
|
143
|
+
const next = raw['nextCursor'];
|
|
144
|
+
if (next !== null && (!next || typeof next !== 'object' || Array.isArray(next)))
|
|
145
|
+
return fail();
|
|
146
|
+
return Object.freeze({ outcomes: Object.freeze(outcomes), nextCursor: next === null ? null : json(next, 4_096) });
|
|
147
|
+
}
|
|
148
|
+
function record(value) { if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
149
|
+
return fail(); return value; }
|
|
150
|
+
function text(value, maximum = 256) { if (typeof value !== 'string' || value.length === 0 || value.length > maximum)
|
|
151
|
+
return fail(); return value; }
|
|
152
|
+
function natural(value) { if (!Number.isSafeInteger(value) || value < 0)
|
|
153
|
+
return fail(); return value; }
|
|
154
|
+
function runId(value) { const id = text(value, 36); if (!/^[a-f0-9-]{36}$/.test(id))
|
|
155
|
+
return fail(); return id; }
|
|
156
|
+
function json(value, maximum) {
|
|
157
|
+
let nodes = 0;
|
|
158
|
+
const seen = new Set();
|
|
159
|
+
const copy = (item, depth) => {
|
|
160
|
+
if (++nodes > 100_000 || depth > 32)
|
|
161
|
+
return fail();
|
|
162
|
+
if (typeof item === 'string' && item.length > maximum)
|
|
163
|
+
return fail();
|
|
164
|
+
if (item === null || typeof item === 'boolean' || typeof item === 'string')
|
|
165
|
+
return item;
|
|
166
|
+
if (typeof item === 'number' && Number.isFinite(item) && (!Number.isInteger(item) || Number.isSafeInteger(item)))
|
|
167
|
+
return item;
|
|
168
|
+
if (typeof item !== 'object' || seen.has(item) || (!Array.isArray(item) && ![null, Object.prototype].includes(Object.getPrototypeOf(item))))
|
|
169
|
+
return fail();
|
|
170
|
+
seen.add(item);
|
|
171
|
+
const descriptors = Object.getOwnPropertyDescriptors(item);
|
|
172
|
+
let result;
|
|
173
|
+
if (Array.isArray(item)) {
|
|
174
|
+
const entries = [];
|
|
175
|
+
for (let index = 0; index < item.length; index++) {
|
|
176
|
+
const descriptor = descriptors[String(index)];
|
|
177
|
+
if (!descriptor || !('value' in descriptor))
|
|
178
|
+
return fail();
|
|
179
|
+
entries.push(copy(descriptor.value, depth + 1));
|
|
180
|
+
}
|
|
181
|
+
result = Object.freeze(entries);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
const entries = {};
|
|
185
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
186
|
+
if (typeof key !== 'string' || ['__proto__', 'constructor', 'prototype'].includes(key))
|
|
187
|
+
return fail();
|
|
188
|
+
const descriptor = descriptors[key];
|
|
189
|
+
if (!('value' in descriptor) || !descriptor.enumerable)
|
|
190
|
+
return fail();
|
|
191
|
+
entries[key] = copy(descriptor.value, depth + 1);
|
|
192
|
+
}
|
|
193
|
+
result = Object.freeze(entries);
|
|
194
|
+
}
|
|
195
|
+
seen.delete(item);
|
|
196
|
+
return result;
|
|
197
|
+
};
|
|
198
|
+
try {
|
|
199
|
+
const result = copy(value, 0);
|
|
200
|
+
if (encoder.encode(JSON.stringify(result)).byteLength > maximum)
|
|
201
|
+
throw new Error();
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
throw new ClientError('INVALID_JSON');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function workflowView(value, expectedId) {
|
|
209
|
+
const raw = record(value);
|
|
210
|
+
const expected = ['format', 'definitionId', 'definitionVersion', 'runId', 'revision', 'status', 'nodes', 'steps'];
|
|
211
|
+
if (!Object.isFrozen(raw) || Object.keys(raw).length !== expected.length || expected.some(key => !Object.hasOwn(raw, key)))
|
|
212
|
+
return fail();
|
|
213
|
+
const format = raw['format'];
|
|
214
|
+
const nodes = raw['nodes'];
|
|
215
|
+
const steps = raw['steps'];
|
|
216
|
+
const admittedKinds = { 2: ['tool', 'join'], 3: ['tool', 'join', 'wait'], 4: ['tool', 'join', 'child'], 5: ['tool', 'join', 'human', 'timer'] };
|
|
217
|
+
const runStatuses = ['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown'];
|
|
218
|
+
const stepStatuses = ['pending', 'waiting', 'approved', 'dispatching', 'succeeded', 'failed', 'blocked', 'unknown', 'skipped', 'timed_out'];
|
|
219
|
+
if (typeof format !== 'number' || ![2, 3, 4, 5].includes(format) || typeof raw['definitionId'] !== 'string' || !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(raw['definitionId'])
|
|
220
|
+
|| typeof raw['definitionVersion'] !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/.test(raw['definitionVersion']) || raw['runId'] !== expectedId
|
|
221
|
+
|| typeof raw['revision'] !== 'number' || !Number.isSafeInteger(raw['revision']) || raw['revision'] < 1 || typeof raw['status'] !== 'string' || !runStatuses.includes(raw['status'])
|
|
222
|
+
|| !Array.isArray(nodes) || !Object.isFrozen(nodes) || nodes.length < 1 || nodes.length > 128 || !Array.isArray(steps) || !Object.isFrozen(steps) || steps.length !== nodes.length)
|
|
223
|
+
return fail();
|
|
224
|
+
const ids = new Map();
|
|
225
|
+
let edgeCount = 0;
|
|
226
|
+
for (const candidate of nodes) {
|
|
227
|
+
if (!candidate || typeof candidate !== 'object' || !Object.isFrozen(candidate))
|
|
228
|
+
return fail();
|
|
229
|
+
const node = Object.getOwnPropertyDescriptors(candidate);
|
|
230
|
+
if (Reflect.ownKeys(node).length !== 3 || ['id', 'kind', 'dependsOn'].some(key => !node[key] || !('value' in node[key])))
|
|
231
|
+
return fail();
|
|
232
|
+
const nodeId = node['id'].value;
|
|
233
|
+
const kind = node['kind'].value;
|
|
234
|
+
const dependencies = node['dependsOn'].value;
|
|
235
|
+
if (typeof nodeId !== 'string' || !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(nodeId) || ids.has(nodeId) || typeof kind !== 'string' || !admittedKinds[format].includes(kind)
|
|
236
|
+
|| !Array.isArray(dependencies) || !Object.isFrozen(dependencies) || dependencies.length > 127 || new Set(dependencies).size !== dependencies.length
|
|
237
|
+
|| dependencies.some(dependency => typeof dependency !== 'string' || !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(dependency)))
|
|
238
|
+
return fail();
|
|
239
|
+
edgeCount += dependencies.length;
|
|
240
|
+
if (edgeCount > 512)
|
|
241
|
+
return fail();
|
|
242
|
+
ids.set(nodeId, kind);
|
|
243
|
+
}
|
|
244
|
+
const seen = new Set();
|
|
245
|
+
for (const candidate of steps) {
|
|
246
|
+
if (!candidate || typeof candidate !== 'object' || !Object.isFrozen(candidate))
|
|
247
|
+
return fail();
|
|
248
|
+
const step = Object.getOwnPropertyDescriptors(candidate);
|
|
249
|
+
const keys = Reflect.ownKeys(step);
|
|
250
|
+
const allowed = ['id', 'kind', 'status', 'childRunId', 'approval'];
|
|
251
|
+
if (keys.some(key => typeof key !== 'string' || !allowed.includes(key) || !('value' in step[key])) || !['id', 'kind', 'status'].every(key => step[key]))
|
|
252
|
+
return fail();
|
|
253
|
+
const stepId = step['id'].value;
|
|
254
|
+
const kind = step['kind'].value;
|
|
255
|
+
const status = step['status'].value;
|
|
256
|
+
const childRunId = step['childRunId']?.value;
|
|
257
|
+
const approval = step['approval']?.value;
|
|
258
|
+
if (typeof stepId !== 'string' || seen.has(stepId) || kind !== ids.get(stepId) || typeof status !== 'string' || !stepStatuses.includes(status)
|
|
259
|
+
|| (childRunId !== undefined && (kind !== 'child' || typeof childRunId !== 'string' || !/^[a-f0-9]{64}$/.test(childRunId)))
|
|
260
|
+
|| (approval !== undefined && (kind !== 'tool' || status !== 'waiting' || !workflowApproval(approval))))
|
|
261
|
+
return fail();
|
|
262
|
+
seen.add(stepId);
|
|
263
|
+
}
|
|
264
|
+
if (seen.size !== ids.size)
|
|
265
|
+
return fail();
|
|
266
|
+
return raw;
|
|
267
|
+
}
|
|
268
|
+
/** A pending approval: exact digest, expiry and optionally the verified tool call it binds. */
|
|
269
|
+
function workflowApproval(value) {
|
|
270
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || !Object.isFrozen(value))
|
|
271
|
+
return false;
|
|
272
|
+
const approval = value;
|
|
273
|
+
const subject = approval['subject'];
|
|
274
|
+
return Object.keys(approval).every(key => ['digest', 'expiresAtMs', 'subject'].includes(key)) && typeof approval['digest'] === 'string'
|
|
275
|
+
&& /^[a-f0-9]{64}$/.test(approval['digest']) && typeof approval['expiresAtMs'] === 'number' && Number.isSafeInteger(approval['expiresAtMs']) && approval['expiresAtMs'] > 0
|
|
276
|
+
&& (subject === undefined || (!!subject && typeof subject === 'object' && !Array.isArray(subject) && Object.isFrozen(subject) && Object.keys(subject).length === 3
|
|
277
|
+
&& Object.hasOwn(subject, 'input') && typeof subject['toolId'] === 'string' && /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(subject['toolId'])
|
|
278
|
+
&& typeof subject['toolVersion'] === 'string' && /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(subject['toolVersion'])));
|
|
279
|
+
}
|
|
280
|
+
function workflowIndexEntry(value, settled = false) {
|
|
281
|
+
const raw = record(value);
|
|
282
|
+
const expected = ['format', 'definitionId', 'definitionVersion', 'runId', 'revision', 'status', ...(settled ? ['settledAtMs'] : [])];
|
|
283
|
+
if (settled && (typeof raw['settledAtMs'] !== 'number' || !Number.isSafeInteger(raw['settledAtMs']) || raw['settledAtMs'] < 0
|
|
284
|
+
|| ['running', 'waiting', 'paused'].includes(raw['status'])))
|
|
285
|
+
return fail();
|
|
286
|
+
if (!Object.isFrozen(raw) || Object.keys(raw).length !== expected.length || expected.some(key => !Object.hasOwn(raw, key))
|
|
287
|
+
|| typeof raw['format'] !== 'number' || ![2, 3, 4, 5].includes(raw['format']) || typeof raw['definitionId'] !== 'string'
|
|
288
|
+
|| !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(raw['definitionId']) || typeof raw['definitionVersion'] !== 'string'
|
|
289
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/.test(raw['definitionVersion']) || typeof raw['runId'] !== 'string'
|
|
290
|
+
|| !/^[a-f0-9]{64}$/.test(raw['runId']) || typeof raw['revision'] !== 'number' || !Number.isSafeInteger(raw['revision']) || raw['revision'] < 1
|
|
291
|
+
|| typeof raw['status'] !== 'string' || !['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown'].includes(raw['status']))
|
|
292
|
+
return fail();
|
|
293
|
+
return raw;
|
|
294
|
+
}
|
|
295
|
+
async function race(work, signal) {
|
|
296
|
+
if (signal.aborted) {
|
|
297
|
+
void Promise.resolve(work).catch(() => { });
|
|
298
|
+
throw new ClientError('ABORTED');
|
|
299
|
+
}
|
|
300
|
+
return await new Promise((resolve, reject) => {
|
|
301
|
+
const abort = () => { cleanup(); reject(new ClientError('ABORTED')); };
|
|
302
|
+
const cleanup = () => { signal.removeEventListener('abort', abort); };
|
|
303
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
304
|
+
Promise.resolve(work).then(value => { cleanup(); resolve(value); }, () => { cleanup(); reject(new ClientError('TRANSPORT_FAILED')); });
|
|
305
|
+
if (signal.aborted)
|
|
306
|
+
abort();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
/** Explicit credentials and destination. Commands never retry automatically or follow redirects. */
|
|
310
|
+
export function createClient(options) {
|
|
311
|
+
const base = new URL(options.baseUrl);
|
|
312
|
+
if (!['https:', 'http:'].includes(base.protocol) || base.username || base.password || base.pathname !== '/' || base.search || base.hash)
|
|
313
|
+
throw new ClientError('INVALID_CONFIG');
|
|
314
|
+
if (base.protocol === 'http:' && !['localhost', '127.0.0.1', '[::1]'].includes(base.hostname))
|
|
315
|
+
throw new ClientError('INVALID_CONFIG');
|
|
316
|
+
if (typeof options.token !== 'function')
|
|
317
|
+
throw new ClientError('INVALID_CONFIG');
|
|
318
|
+
const token = options.token;
|
|
319
|
+
const transport = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
320
|
+
const maxBytes = options.maxResponseBytes ?? 4_194_304;
|
|
321
|
+
const frameBytes = options.maxEventBytes ?? 16_384;
|
|
322
|
+
const timeout = options.requestTimeoutMs ?? 30_000;
|
|
323
|
+
if ([maxBytes, frameBytes, timeout].some(value => !Number.isSafeInteger(value) || value < 1 || value > 16_777_216))
|
|
324
|
+
throw new ClientError('INVALID_CONFIG');
|
|
325
|
+
const request = async (path, method, signal, body, key) => {
|
|
326
|
+
const credential = await race(Promise.resolve().then(() => { if (signal.aborted)
|
|
327
|
+
throw new ClientError('ABORTED'); return token(); }), signal);
|
|
328
|
+
if (typeof credential !== 'string' || !/^[\x21-\x7e]{1,8192}$/.test(credential))
|
|
329
|
+
throw new ClientError('INVALID_CREDENTIAL');
|
|
330
|
+
const headers = { Authorization: `Bearer ${credential}` };
|
|
331
|
+
if (body !== undefined)
|
|
332
|
+
headers['Content-Type'] = 'application/json';
|
|
333
|
+
if (key !== undefined)
|
|
334
|
+
headers['Idempotency-Key'] = key;
|
|
335
|
+
if (signal.aborted)
|
|
336
|
+
throw new ClientError('ABORTED');
|
|
337
|
+
const response = await race(Promise.resolve().then(() => {
|
|
338
|
+
if (signal.aborted)
|
|
339
|
+
throw new ClientError('ABORTED');
|
|
340
|
+
return transport(new URL(path, base), {
|
|
341
|
+
method, headers, signal, redirect: 'error', credentials: 'omit', cache: 'no-store',
|
|
342
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
343
|
+
});
|
|
344
|
+
}).then(response => {
|
|
345
|
+
if (signal.aborted) {
|
|
346
|
+
void response.body?.cancel().catch(() => { });
|
|
347
|
+
throw new ClientError('ABORTED');
|
|
348
|
+
}
|
|
349
|
+
return response;
|
|
350
|
+
}), signal);
|
|
351
|
+
if (response.redirected || (response.url && new URL(response.url).origin !== base.origin) || !response.ok) {
|
|
352
|
+
void response.body?.cancel().catch(() => { });
|
|
353
|
+
throw new ClientError(response.redirected ? 'REDIRECT_DENIED' : 'HTTP_ERROR', response.status);
|
|
354
|
+
}
|
|
355
|
+
return response;
|
|
356
|
+
};
|
|
357
|
+
const scope = (external) => {
|
|
358
|
+
const controller = new AbortController();
|
|
359
|
+
const abort = () => { controller.abort(); };
|
|
360
|
+
external?.addEventListener('abort', abort, { once: true });
|
|
361
|
+
if (external?.aborted)
|
|
362
|
+
abort();
|
|
363
|
+
const timer = setTimeout(abort, timeout);
|
|
364
|
+
return { signal: controller.signal, close() { clearTimeout(timer); external?.removeEventListener('abort', abort); controller.abort(); } };
|
|
365
|
+
};
|
|
366
|
+
const readJson = async (response, signal) => {
|
|
367
|
+
if (!/^application\/json(?:\s*;|$)/i.test(response.headers.get('content-type') ?? '')) {
|
|
368
|
+
void response.body?.cancel().catch(() => { });
|
|
369
|
+
return fail();
|
|
370
|
+
}
|
|
371
|
+
const reader = response.body?.getReader();
|
|
372
|
+
if (!reader)
|
|
373
|
+
return fail();
|
|
374
|
+
const chunks = [];
|
|
375
|
+
let size = 0;
|
|
376
|
+
let done = false;
|
|
377
|
+
try {
|
|
378
|
+
while (true) {
|
|
379
|
+
const next = await race(reader.read(), signal);
|
|
380
|
+
if (next.done) {
|
|
381
|
+
done = true;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
size += next.value.byteLength;
|
|
385
|
+
if (size > maxBytes)
|
|
386
|
+
throw new ClientError('RESPONSE_LIMIT');
|
|
387
|
+
chunks.push(next.value);
|
|
388
|
+
}
|
|
389
|
+
const bytes = new Uint8Array(size);
|
|
390
|
+
let offset = 0;
|
|
391
|
+
for (const chunk of chunks) {
|
|
392
|
+
bytes.set(chunk, offset);
|
|
393
|
+
offset += chunk.byteLength;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
return record(json(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)), maxBytes));
|
|
397
|
+
}
|
|
398
|
+
catch {
|
|
399
|
+
return fail();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
finally {
|
|
403
|
+
if (!done)
|
|
404
|
+
void reader.cancel().catch(() => { });
|
|
405
|
+
reader.releaseLock();
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const command = async (path, method, external, body, key) => {
|
|
409
|
+
const control = scope(external);
|
|
410
|
+
try {
|
|
411
|
+
return await readJson(await request(path, method, control.signal, body, key), control.signal);
|
|
412
|
+
}
|
|
413
|
+
finally {
|
|
414
|
+
control.close();
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
const snapshot = (raw, id) => {
|
|
418
|
+
if (raw['id'] !== id || !statuses.includes(String(raw['status'])))
|
|
419
|
+
return fail();
|
|
420
|
+
const budget = record(raw['budget']);
|
|
421
|
+
const spent = budget['spentMicros'];
|
|
422
|
+
if (typeof spent === 'string' ? !/^\d{1,64}$/.test(spent) : natural(spent) < 0)
|
|
423
|
+
return fail();
|
|
424
|
+
if (!Array.isArray(raw['evidence']) || raw['evidence'].length > 4096)
|
|
425
|
+
return fail();
|
|
426
|
+
const evidence = raw['evidence'].map(value => {
|
|
427
|
+
const entry = record(value);
|
|
428
|
+
const receipt = record(entry['receipt']);
|
|
429
|
+
if (!['not_started', 'succeeded', 'failed', 'unknown'].includes(String(receipt['execution'])) || !['released', 'withheld'].includes(String(receipt['disclosure'])))
|
|
430
|
+
return fail();
|
|
431
|
+
return Object.freeze({ runId: runId(entry['runId']), receipt: Object.freeze({ callId: text(receipt['callId']), toolId: text(receipt['toolId']), execution: receipt['execution'], disclosure: receipt['disclosure'] }) });
|
|
432
|
+
});
|
|
433
|
+
return Object.freeze({ id, status: raw['status'], budget: Object.freeze({ spentMicros: spent, reservedMicros: natural(budget['reservedMicros']), calls: natural(budget['calls']) }), evidence: Object.freeze(evidence) });
|
|
434
|
+
};
|
|
435
|
+
const human = (value) => {
|
|
436
|
+
const item = record(value);
|
|
437
|
+
const allowed = ['id', 'agentId', 'kind', 'schemaId', 'schemaDigest', 'prompt', 'digest', 'status', 'context', 'subjectDigest', 'deadlineAtMs'];
|
|
438
|
+
if (Object.keys(item).some(key => !allowed.includes(key)) || !['id', 'agentId', 'kind', 'schemaId', 'schemaDigest', 'prompt', 'digest', 'status'].every(key => Object.hasOwn(item, key)))
|
|
439
|
+
return fail();
|
|
440
|
+
const humanId = text(item['id'], 80);
|
|
441
|
+
const agentId = text(item['agentId']);
|
|
442
|
+
const schemaId = text(item['schemaId']);
|
|
443
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/.test(humanId) || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(agentId)
|
|
444
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(schemaId) || !['information', 'correction', 'plan_selection'].includes(String(item['kind']))
|
|
445
|
+
|| !/^[a-f0-9]{64}$/.test(String(item['schemaDigest'])) || !/^[a-f0-9]{64}$/.test(String(item['digest']))
|
|
446
|
+
|| !['waiting', 'answered', 'cancelled', 'timed_out'].includes(String(item['status'])) || typeof item['prompt'] !== 'string' || encoder.encode(item['prompt']).byteLength < 1 || encoder.encode(item['prompt']).byteLength > 1_024
|
|
447
|
+
|| (item['subjectDigest'] !== undefined && !/^[a-f0-9]{64}$/.test(String(item['subjectDigest'])))
|
|
448
|
+
|| ((item['kind'] === 'correction') !== (item['subjectDigest'] !== undefined))
|
|
449
|
+
|| (item['deadlineAtMs'] !== undefined && (!Number.isSafeInteger(item['deadlineAtMs']) || item['deadlineAtMs'] < 0)))
|
|
450
|
+
return fail();
|
|
451
|
+
return Object.freeze({ id: humanId, agentId, kind: item['kind'], schemaId,
|
|
452
|
+
schemaDigest: item['schemaDigest'], prompt: item['prompt'], digest: item['digest'], status: item['status'],
|
|
453
|
+
...(item['context'] === undefined ? {} : { context: json(item['context'], maxBytes) }),
|
|
454
|
+
...(item['subjectDigest'] === undefined ? {} : { subjectDigest: item['subjectDigest'] }),
|
|
455
|
+
...(item['deadlineAtMs'] === undefined ? {} : { deadlineAtMs: item['deadlineAtMs'] }) });
|
|
456
|
+
};
|
|
457
|
+
const run = (id) => {
|
|
458
|
+
runId(id);
|
|
459
|
+
const path = `/v1/runs/${id}`;
|
|
460
|
+
return Object.freeze({
|
|
461
|
+
id,
|
|
462
|
+
async inspect(settings) { return snapshot(await command(path, 'GET', settings?.signal), id); },
|
|
463
|
+
async result(schema, settings) {
|
|
464
|
+
const raw = await command(path, 'GET', settings?.signal);
|
|
465
|
+
const state = snapshot(raw, id);
|
|
466
|
+
if (state.status === 'running')
|
|
467
|
+
return undefined;
|
|
468
|
+
const outcome = record(raw['outcome']);
|
|
469
|
+
if (outcome['status'] !== state.status)
|
|
470
|
+
return fail();
|
|
471
|
+
if (outcome['status'] !== 'succeeded')
|
|
472
|
+
return Object.freeze({ status: state.status, error: Object.freeze({ code: text(record(outcome['error'])['code'], 128) }), evidence: state.evidence });
|
|
473
|
+
let validationAborted = false;
|
|
474
|
+
try {
|
|
475
|
+
if (schema['~standard'].version !== 1)
|
|
476
|
+
throw new Error();
|
|
477
|
+
const control = scope(settings?.signal);
|
|
478
|
+
try {
|
|
479
|
+
const validated = await race(Promise.resolve(schema['~standard'].validate(outcome['output'])), control.signal);
|
|
480
|
+
if (validated.issues)
|
|
481
|
+
throw new Error();
|
|
482
|
+
return Object.freeze({ status: 'succeeded', output: json(validated.value, maxBytes), evidence: state.evidence });
|
|
483
|
+
}
|
|
484
|
+
catch (error) {
|
|
485
|
+
validationAborted = control.signal.aborted;
|
|
486
|
+
throw error;
|
|
487
|
+
}
|
|
488
|
+
finally {
|
|
489
|
+
control.close();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
catch {
|
|
493
|
+
throw new ClientError(validationAborted ? 'ABORTED' : 'INVALID_OUTPUT');
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
async cancel(settings) {
|
|
497
|
+
const value = await command(`${path}/cancel`, 'POST', settings?.signal);
|
|
498
|
+
if (value['id'] !== id || value['cancellationRequested'] !== true)
|
|
499
|
+
fail();
|
|
500
|
+
},
|
|
501
|
+
async *events(settings) {
|
|
502
|
+
let cursor = natural(settings?.after ?? 0);
|
|
503
|
+
const control = scope(settings?.signal);
|
|
504
|
+
let reader;
|
|
505
|
+
try {
|
|
506
|
+
const response = await request(`${path}/events?after=${cursor}`, 'GET', control.signal);
|
|
507
|
+
if (!/^text\/event-stream(?:\s*;|$)/i.test(response.headers.get('content-type') ?? '')) {
|
|
508
|
+
void response.body?.cancel().catch(() => { });
|
|
509
|
+
fail();
|
|
510
|
+
}
|
|
511
|
+
reader = response.body?.getReader();
|
|
512
|
+
if (!reader)
|
|
513
|
+
fail();
|
|
514
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
515
|
+
let pending = '';
|
|
516
|
+
while (true) {
|
|
517
|
+
const next = await race(reader.read(), control.signal);
|
|
518
|
+
if (!next.done && next.value.byteLength > maxBytes)
|
|
519
|
+
throw new ClientError('STREAM_LIMIT');
|
|
520
|
+
try {
|
|
521
|
+
pending += next.done ? decoder.decode() : decoder.decode(next.value, { stream: true });
|
|
522
|
+
}
|
|
523
|
+
catch {
|
|
524
|
+
throw new ClientError('INVALID_STREAM');
|
|
525
|
+
}
|
|
526
|
+
// Handle LF/CRLF independently of how UTF-8/network chunks were split.
|
|
527
|
+
while (true) {
|
|
528
|
+
const boundary = /\r?\n\r?\n/.exec(pending);
|
|
529
|
+
if (!boundary || boundary.index === undefined)
|
|
530
|
+
break;
|
|
531
|
+
const frame = pending.slice(0, boundary.index);
|
|
532
|
+
pending = pending.slice(boundary.index + boundary[0].length);
|
|
533
|
+
if (encoder.encode(frame).byteLength > frameBytes)
|
|
534
|
+
throw new ClientError('STREAM_LIMIT');
|
|
535
|
+
let event = '';
|
|
536
|
+
let eventId = '';
|
|
537
|
+
const data = [];
|
|
538
|
+
for (const line of frame.split(/\r?\n/)) {
|
|
539
|
+
if (!line || line.startsWith(':'))
|
|
540
|
+
continue;
|
|
541
|
+
const colon = line.indexOf(':');
|
|
542
|
+
const key = colon < 0 ? line : line.slice(0, colon);
|
|
543
|
+
const value = colon < 0 ? '' : line.slice(colon + 1).replace(/^ /, '');
|
|
544
|
+
if (key === 'event')
|
|
545
|
+
event = value;
|
|
546
|
+
else if (key === 'id')
|
|
547
|
+
eventId = value;
|
|
548
|
+
else if (key === 'data')
|
|
549
|
+
data.push(value);
|
|
550
|
+
}
|
|
551
|
+
if (data.length === 0)
|
|
552
|
+
continue;
|
|
553
|
+
if (event === 'stream.error')
|
|
554
|
+
throw new ClientError('OBSERVATION_FAILED');
|
|
555
|
+
let raw;
|
|
556
|
+
try {
|
|
557
|
+
raw = record(json(JSON.parse(data.join('\n')), frameBytes));
|
|
558
|
+
}
|
|
559
|
+
catch {
|
|
560
|
+
throw new ClientError('INVALID_STREAM');
|
|
561
|
+
}
|
|
562
|
+
const sequence = natural(raw['sequence']);
|
|
563
|
+
if (!eventTypes.includes(event) || raw['type'] !== event || raw['runId'] !== id || String(sequence) !== eventId || sequence <= cursor)
|
|
564
|
+
throw new ClientError('INVALID_STREAM');
|
|
565
|
+
const metadata = record(raw['metadata']);
|
|
566
|
+
if (Object.keys(metadata).length > 64 || Object.values(metadata).some(value => !['string', 'number', 'boolean'].includes(typeof value)))
|
|
567
|
+
throw new ClientError('INVALID_STREAM');
|
|
568
|
+
if (event === 'hook.started' || event === 'hook.completed')
|
|
569
|
+
hookMetadata(metadata, event === 'hook.completed');
|
|
570
|
+
if (event === 'output.delta' || event === 'output.withheld')
|
|
571
|
+
outputMetadata(metadata, event === 'output.delta');
|
|
572
|
+
if (event === 'events.gap') {
|
|
573
|
+
if (metadata['from'] !== cursor + 1 || metadata['to'] !== sequence
|
|
574
|
+
|| !Number.isSafeInteger(metadata['from']) || !Number.isSafeInteger(metadata['to']) || metadata['to'] < metadata['from'])
|
|
575
|
+
throw new ClientError('INVALID_STREAM');
|
|
576
|
+
}
|
|
577
|
+
else if (sequence !== cursor + 1)
|
|
578
|
+
throw new ClientError('INVALID_STREAM');
|
|
579
|
+
const timestamp = text(raw['timestamp'], 64);
|
|
580
|
+
if (!Number.isFinite(Date.parse(timestamp)))
|
|
581
|
+
throw new ClientError('INVALID_STREAM');
|
|
582
|
+
cursor = sequence;
|
|
583
|
+
yield Object.freeze({ runId: id, sequence, timestamp, type: event, metadata: Object.freeze(metadata) });
|
|
584
|
+
}
|
|
585
|
+
if (encoder.encode(pending).byteLength > frameBytes)
|
|
586
|
+
throw new ClientError('STREAM_LIMIT');
|
|
587
|
+
if (next.done) {
|
|
588
|
+
if (pending.trim())
|
|
589
|
+
throw new ClientError('TRUNCATED_STREAM');
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
finally {
|
|
595
|
+
control.close();
|
|
596
|
+
if (reader) {
|
|
597
|
+
void reader.cancel().catch(() => { });
|
|
598
|
+
reader.releaseLock();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
};
|
|
604
|
+
return Object.freeze({
|
|
605
|
+
run,
|
|
606
|
+
async agents(settings) {
|
|
607
|
+
const raw = await command('/v1/agents', 'GET', settings?.signal);
|
|
608
|
+
if (!Array.isArray(raw['agents']) || raw['agents'].length > 256)
|
|
609
|
+
return fail();
|
|
610
|
+
return Object.freeze(raw['agents'].map(value => { const item = record(value); return Object.freeze({ id: text(item['id']), version: text(item['version']) }); }));
|
|
611
|
+
},
|
|
612
|
+
async submit(agentId, input, settings) {
|
|
613
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(settings.idempotencyKey))
|
|
614
|
+
throw new ClientError('INVALID_IDEMPOTENCY_KEY');
|
|
615
|
+
const raw = await command('/v1/runs', 'POST', settings.signal, json({ agentId, input }, maxBytes), settings.idempotencyKey);
|
|
616
|
+
if (raw['profile'] !== 'ephemeral')
|
|
617
|
+
return fail();
|
|
618
|
+
return run(runId(raw['id']));
|
|
619
|
+
},
|
|
620
|
+
async humanRequests(settings) {
|
|
621
|
+
const after = settings?.after;
|
|
622
|
+
const limit = settings?.limit ?? 50;
|
|
623
|
+
if ((after !== undefined && !/^[A-Za-z0-9._:-]{1,128}$/.test(after)) || !Number.isSafeInteger(limit) || limit < 1 || limit > 100)
|
|
624
|
+
throw new ClientError('INVALID_CURSOR');
|
|
625
|
+
const query = new URLSearchParams({ limit: String(limit), ...(after === undefined ? {} : { after }) });
|
|
626
|
+
const raw = await command(`/v1/human-requests?${query}`, 'GET', settings?.signal);
|
|
627
|
+
if (!Array.isArray(raw['items']) || raw['items'].length > limit || (raw['next'] !== null && (typeof raw['next'] !== 'string' || !/^[A-Za-z0-9._:-]{1,128}$/.test(raw['next']))))
|
|
628
|
+
return fail();
|
|
629
|
+
const items = raw['items'].map(human);
|
|
630
|
+
if (new Set(items.map(item => item.id)).size !== items.length)
|
|
631
|
+
return fail();
|
|
632
|
+
return Object.freeze({ items: Object.freeze(items), next: raw['next'] });
|
|
633
|
+
},
|
|
634
|
+
async humanRequest(id, settings) {
|
|
635
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/.test(id))
|
|
636
|
+
throw new ClientError('INVALID_REQUEST');
|
|
637
|
+
const result = human(record((await command(`/v1/human-requests/${id}`, 'GET', settings?.signal))['request']));
|
|
638
|
+
if (result.id !== id)
|
|
639
|
+
return fail();
|
|
640
|
+
return result;
|
|
641
|
+
},
|
|
642
|
+
async workflow(id, settings) {
|
|
643
|
+
if (!/^[a-f0-9]{64}$/.test(id))
|
|
644
|
+
throw new ClientError('INVALID_REQUEST');
|
|
645
|
+
const raw = await command(`/v1/workflow-runs/${id}`, 'GET', settings?.signal);
|
|
646
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
647
|
+
return fail();
|
|
648
|
+
return workflowView(raw['workflow'], id);
|
|
649
|
+
},
|
|
650
|
+
async workflows(settings) {
|
|
651
|
+
const limit = settings?.limit ?? 20;
|
|
652
|
+
const after = settings?.after;
|
|
653
|
+
const view = settings?.view ?? 'active';
|
|
654
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 100 || (after !== undefined && !/^[A-Za-z0-9._:-]{1,128}$/.test(after))
|
|
655
|
+
|| (view !== 'active' && view !== 'settled'))
|
|
656
|
+
throw new ClientError('INVALID_REQUEST');
|
|
657
|
+
const settled = view === 'settled';
|
|
658
|
+
const query = new URLSearchParams({ limit: String(limit), ...(after === undefined ? {} : { after }), ...(settled ? { view } : {}) });
|
|
659
|
+
const raw = await command(`/v1/workflow-runs?${query}`, 'GET', settings?.signal);
|
|
660
|
+
const keys = Object.keys(raw);
|
|
661
|
+
if (keys.length !== 2 || !Object.hasOwn(raw, 'items') || !Object.hasOwn(raw, 'next') || !Array.isArray(raw['items']) || raw['items'].length > limit
|
|
662
|
+
|| (raw['next'] !== null && (typeof raw['next'] !== 'string' || !/^[A-Za-z0-9._:-]{1,128}$/.test(raw['next']) || raw['next'] === after)))
|
|
663
|
+
return fail();
|
|
664
|
+
const items = raw['items'].map(item => workflowIndexEntry(item, settled));
|
|
665
|
+
if (new Set(items.map(item => item.runId)).size !== items.length)
|
|
666
|
+
return fail();
|
|
667
|
+
return Object.freeze({ items: Object.freeze(items), next: raw['next'] });
|
|
668
|
+
},
|
|
669
|
+
async cancelWorkflow(id, revision, settings) {
|
|
670
|
+
if (!/^[a-f0-9]{64}$/.test(id) || !Number.isSafeInteger(revision) || revision < 1 || !settings
|
|
671
|
+
|| typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
672
|
+
throw new ClientError('INVALID_REQUEST');
|
|
673
|
+
const raw = await command(`/v1/workflow-runs/${id}/cancel`, 'POST', settings.signal, json({ commandId: settings.commandId, revision }, maxBytes));
|
|
674
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
675
|
+
return fail();
|
|
676
|
+
return workflowView(raw['workflow'], id);
|
|
677
|
+
},
|
|
678
|
+
async approveWorkflow(id, approval, settings) {
|
|
679
|
+
if (!/^[a-f0-9]{64}$/.test(id) || !approval || typeof approval.revision !== 'number' || !Number.isSafeInteger(approval.revision) || approval.revision < 1
|
|
680
|
+
|| typeof approval.nodeId !== 'string' || !/^[A-Za-z][A-Za-z0-9._-]{0,127}$/.test(approval.nodeId)
|
|
681
|
+
|| typeof approval.approvalDigest !== 'string' || !/^[a-f0-9]{64}$/.test(approval.approvalDigest)
|
|
682
|
+
|| (approval.childRunId !== undefined && (typeof approval.childRunId !== 'string' || !/^[a-f0-9]{64}$/.test(approval.childRunId)))
|
|
683
|
+
|| !settings || typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
684
|
+
throw new ClientError('INVALID_REQUEST');
|
|
685
|
+
const raw = await command(`/v1/workflow-runs/${id}/approvals`, 'POST', settings.signal, json({ commandId: settings.commandId, revision: approval.revision, nodeId: approval.nodeId,
|
|
686
|
+
approvalDigest: approval.approvalDigest, childRunId: approval.childRunId ?? null }, maxBytes));
|
|
687
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
688
|
+
return fail();
|
|
689
|
+
return workflowView(raw['workflow'], id);
|
|
690
|
+
},
|
|
691
|
+
async signalWorkflow(id, workflowSignal, settings) {
|
|
692
|
+
if (!/^[a-f0-9]{64}$/.test(id) || !workflowSignal || typeof workflowSignal.revision !== 'number'
|
|
693
|
+
|| !Number.isSafeInteger(workflowSignal.revision) || workflowSignal.revision < 1
|
|
694
|
+
|| typeof workflowSignal.signalId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(workflowSignal.signalId)
|
|
695
|
+
|| typeof workflowSignal.signalName !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(workflowSignal.signalName)
|
|
696
|
+
|| !settings || typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
697
|
+
throw new ClientError('INVALID_REQUEST');
|
|
698
|
+
let value;
|
|
699
|
+
try {
|
|
700
|
+
value = json(workflowSignal.value, 4_096);
|
|
701
|
+
}
|
|
702
|
+
catch {
|
|
703
|
+
throw new ClientError('INVALID_REQUEST');
|
|
704
|
+
}
|
|
705
|
+
const raw = await command(`/v1/workflow-runs/${id}/signals`, 'POST', settings.signal, json({ commandId: settings.commandId, revision: workflowSignal.revision, signalId: workflowSignal.signalId,
|
|
706
|
+
signalName: workflowSignal.signalName, value }, maxBytes));
|
|
707
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
708
|
+
return fail();
|
|
709
|
+
return workflowView(raw['workflow'], id);
|
|
710
|
+
},
|
|
711
|
+
async resumeWorkflow(id, revision, settings) {
|
|
712
|
+
if (!/^[a-f0-9]{64}$/.test(id) || !Number.isSafeInteger(revision) || revision < 1 || !settings
|
|
713
|
+
|| typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
714
|
+
throw new ClientError('INVALID_REQUEST');
|
|
715
|
+
const raw = await command(`/v1/workflow-runs/${id}/resume`, 'POST', settings.signal, json({ commandId: settings.commandId, revision }, maxBytes));
|
|
716
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
717
|
+
return fail();
|
|
718
|
+
return workflowView(raw['workflow'], id);
|
|
719
|
+
},
|
|
720
|
+
async pauseWorkflow(id, revision, settings) {
|
|
721
|
+
if (!/^[a-f0-9]{64}$/.test(id) || !Number.isSafeInteger(revision) || revision < 1 || !settings
|
|
722
|
+
|| typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
723
|
+
throw new ClientError('INVALID_REQUEST');
|
|
724
|
+
const raw = await command(`/v1/workflow-runs/${id}/pause`, 'POST', settings.signal, json({ commandId: settings.commandId, revision }, maxBytes));
|
|
725
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'workflow'))
|
|
726
|
+
return fail();
|
|
727
|
+
return workflowView(raw['workflow'], id);
|
|
728
|
+
},
|
|
729
|
+
async workflowMigrations(id, settings) {
|
|
730
|
+
if (!/^[a-f0-9]{64}$/.test(id))
|
|
731
|
+
throw new ClientError('INVALID_REQUEST');
|
|
732
|
+
const raw = await command(`/v1/workflow-runs/${id}/migrations`, 'GET', settings?.signal);
|
|
733
|
+
if (Object.keys(raw).length !== 1 || !Array.isArray(raw['migrations']) || raw['migrations'].length > 256)
|
|
734
|
+
return fail();
|
|
735
|
+
const offers = raw['migrations'].map(migrationOffer);
|
|
736
|
+
if (new Set(offers.map(item => item.id)).size !== offers.length)
|
|
737
|
+
return fail();
|
|
738
|
+
return Object.freeze(offers);
|
|
739
|
+
},
|
|
740
|
+
async planWorkflowMigration(id, migrationId, settings) {
|
|
741
|
+
if (!/^[a-f0-9]{64}$/.test(id) || typeof migrationId !== 'string' || !migrationIdPattern.test(migrationId))
|
|
742
|
+
throw new ClientError('INVALID_REQUEST');
|
|
743
|
+
const raw = await command(`/v1/workflow-runs/${id}/migrations/${migrationId}`, 'GET', settings?.signal);
|
|
744
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'plan'))
|
|
745
|
+
return fail();
|
|
746
|
+
return migrationPlan(raw['plan'], id, migrationId);
|
|
747
|
+
},
|
|
748
|
+
async migrateWorkflow(id, migrationId, revision, settings) {
|
|
749
|
+
if (!/^[a-f0-9]{64}$/.test(id) || typeof migrationId !== 'string' || !migrationIdPattern.test(migrationId) || !Number.isSafeInteger(revision) || revision < 1 || !settings
|
|
750
|
+
|| typeof settings.commandId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
751
|
+
throw new ClientError('INVALID_REQUEST');
|
|
752
|
+
const raw = await command(`/v1/workflow-runs/${id}/migrations/${migrationId}`, 'POST', settings.signal, json({ commandId: settings.commandId, revision }, maxBytes));
|
|
753
|
+
if (Object.keys(raw).length !== 2 || !Object.hasOwn(raw, 'plan') || !Object.hasOwn(raw, 'workflow'))
|
|
754
|
+
return fail();
|
|
755
|
+
const plan = migrationPlan(raw['plan'], id, migrationId);
|
|
756
|
+
const workflow = workflowView(raw['workflow'], id);
|
|
757
|
+
if (!plan.allowed || workflow.revision <= revision)
|
|
758
|
+
return fail();
|
|
759
|
+
return Object.freeze({ plan, workflow });
|
|
760
|
+
},
|
|
761
|
+
async workflowFleet(settings) {
|
|
762
|
+
const raw = await command('/v1/workflow-fleet', 'GET', settings?.signal);
|
|
763
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'fleet'))
|
|
764
|
+
return fail();
|
|
765
|
+
return fleetHold(raw['fleet']);
|
|
766
|
+
},
|
|
767
|
+
async holdWorkflowFleet(settings) {
|
|
768
|
+
const raw = await command('/v1/workflow-fleet/hold', 'POST', settings?.signal, json({}, maxBytes));
|
|
769
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'fleet'))
|
|
770
|
+
return fail();
|
|
771
|
+
const fleet = fleetHold(raw['fleet']);
|
|
772
|
+
if (!fleet.held)
|
|
773
|
+
return fail();
|
|
774
|
+
return fleet;
|
|
775
|
+
},
|
|
776
|
+
async releaseWorkflowFleet(settings) {
|
|
777
|
+
const raw = await command('/v1/workflow-fleet/release', 'POST', settings?.signal, json({}, maxBytes));
|
|
778
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'fleet'))
|
|
779
|
+
return fail();
|
|
780
|
+
const fleet = fleetHold(raw['fleet']);
|
|
781
|
+
if (fleet.held)
|
|
782
|
+
return fail();
|
|
783
|
+
return fleet;
|
|
784
|
+
},
|
|
785
|
+
async sweepWorkflowFleet(phase, sweep, settings) {
|
|
786
|
+
const limit = sweep?.limit ?? 32;
|
|
787
|
+
if (!['pause', 'resume'].includes(phase) || !Number.isSafeInteger(limit) || limit < 1 || limit > 128
|
|
788
|
+
|| (sweep.cursor !== null && (!sweep.cursor || typeof sweep.cursor !== 'object' || Array.isArray(sweep.cursor))))
|
|
789
|
+
throw new ClientError('INVALID_REQUEST');
|
|
790
|
+
let cursor;
|
|
791
|
+
try {
|
|
792
|
+
cursor = sweep.cursor === null ? null : json(sweep.cursor, 4_096);
|
|
793
|
+
}
|
|
794
|
+
catch {
|
|
795
|
+
throw new ClientError('INVALID_REQUEST');
|
|
796
|
+
}
|
|
797
|
+
const raw = await command(`/v1/workflow-fleet/sweeps/${phase}`, 'POST', settings?.signal, json({ cursor, limit }, maxBytes));
|
|
798
|
+
if (Object.keys(raw).length !== 1 || !Object.hasOwn(raw, 'sweep'))
|
|
799
|
+
return fail();
|
|
800
|
+
return fleetSweep(raw['sweep'], limit);
|
|
801
|
+
},
|
|
802
|
+
async respondHumanRequest(id, requestDigest, value, settings) {
|
|
803
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/.test(id) || !/^[a-f0-9]{64}$/.test(requestDigest)
|
|
804
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(settings.commandId))
|
|
805
|
+
throw new ClientError('INVALID_REQUEST');
|
|
806
|
+
const raw = await command(`/v1/human-requests/${id}/responses`, 'POST', settings.signal, json({ commandId: settings.commandId, requestDigest, value }, maxBytes));
|
|
807
|
+
const result = human(record(raw['request']));
|
|
808
|
+
if (result.id !== id || result.digest !== requestDigest || result.status === 'waiting')
|
|
809
|
+
return fail();
|
|
810
|
+
return result;
|
|
811
|
+
},
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
//# sourceMappingURL=index.js.map
|