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,68 @@
|
|
|
1
|
+
import { createHash, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import type { ServerIdentity } from 'mayura/server-node';
|
|
5
|
+
import type { Config } from './config.js';
|
|
6
|
+
|
|
7
|
+
// Bearer tokens are 64 hex characters. Configuration holds only their SHA-256 digests, never the tokens themselves.
|
|
8
|
+
export const newToken = (): string => randomBytes(32).toString('hex');
|
|
9
|
+
export const tokenDigest = (token: string): string => createHash('sha256').update(token).digest('hex');
|
|
10
|
+
|
|
11
|
+
function matches(token: string, digests: readonly string[]): boolean {
|
|
12
|
+
if (!/^[a-f0-9]{64}$/u.test(token)) return false;
|
|
13
|
+
const supplied = createHash('sha256').update(token).digest(); let found = false;
|
|
14
|
+
// Compare against every configured digest so the time taken does not reveal which one matched.
|
|
15
|
+
for (const digest of digests) found = timingSafeEqual(supplied, Buffer.from(digest, 'hex')) || found;
|
|
16
|
+
return found;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Two kinds of caller:
|
|
21
|
+
* - operators use the console and the workflow API to review, approve, pause, migrate and hold refunds;
|
|
22
|
+
* - the support system (intake) submits refund requests to the intake agent and reads their results.
|
|
23
|
+
* Identities last one minute; clients re-present their token on each request.
|
|
24
|
+
*/
|
|
25
|
+
export function authenticate(config: Config, intakeAgentId: string) {
|
|
26
|
+
return async ({ token }: { readonly token: string }): Promise<ServerIdentity | null> => {
|
|
27
|
+
const expiresAtMs = Date.now() + 60_000;
|
|
28
|
+
if (matches(token, config.operatorTokens)) {
|
|
29
|
+
// Operator commands are journaled under the service scope; per-person attribution needs your identity provider.
|
|
30
|
+
return { scope: config.scope, agentIds: [intakeAgentId], expiresAtMs,
|
|
31
|
+
capabilities: ['runs:read', 'operations:read', 'workflows:read', 'workflows:control', 'workflows:fleet', 'workflows:migrate'] };
|
|
32
|
+
}
|
|
33
|
+
if (matches(token, config.intakeTokens)) {
|
|
34
|
+
return { scope: { principalId: 'support-intake', projectId: config.scope.projectId }, agentIds: [intakeAgentId], expiresAtMs,
|
|
35
|
+
capabilities: ['runs:submit', 'runs:read'] };
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Approvals: the operator API turns the authenticated operator into a credential, and the workflow runtime verifies it.
|
|
42
|
+
// Only credentials minted here in this process verify, so an approval cannot be forged from request data.
|
|
43
|
+
const minted = new WeakSet<object>();
|
|
44
|
+
export function approvalCredential(actorId: string): object {
|
|
45
|
+
const credential = Object.freeze({ actorId }); minted.add(credential); return credential;
|
|
46
|
+
}
|
|
47
|
+
export function verifyApprover(projectId: string) {
|
|
48
|
+
return async (credential: unknown): Promise<{ readonly id: string; readonly projectId: string; readonly canApprove: boolean }> => {
|
|
49
|
+
if (typeof credential !== 'object' || credential === null || !minted.has(credential)) throw new Error('Unverified approval credential.');
|
|
50
|
+
return { id: (credential as { readonly actorId: string }).actorId, projectId, canApprove: true };
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Development secrets, kept in `.data/dev-secrets.json` (owner-only, ignored by git) so a restart under `mayura dev`
|
|
56
|
+
* keeps the same tokens and an open console stays signed in. Production never uses this: it configures digests.
|
|
57
|
+
*/
|
|
58
|
+
export async function devSecrets<const N extends string>(names: readonly N[], file = '.data/dev-secrets.json'): Promise<Record<N, string>> {
|
|
59
|
+
let stored: Record<string, unknown> = {};
|
|
60
|
+
try { stored = JSON.parse(await readFile(file, 'utf8')) as Record<string, unknown>; } catch { /* The first run creates them. */ }
|
|
61
|
+
const valid = (value: unknown): value is string => typeof value === 'string' && /^[a-f0-9]{64}$/u.test(value);
|
|
62
|
+
const secrets = Object.fromEntries(names.map(name => [name, valid(stored[name]) ? stored[name] : newToken()])) as Record<N, string>;
|
|
63
|
+
if (names.some(name => secrets[name] !== stored[name])) {
|
|
64
|
+
await mkdir(dirname(file), { recursive: true });
|
|
65
|
+
await writeFile(file, `${JSON.stringify({ ...stored, ...secrets }, null, 2)}\n`, { mode: 0o600 });
|
|
66
|
+
}
|
|
67
|
+
return secrets;
|
|
68
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { validatedEnvironment } from 'mayura/helpers';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
// Every setting comes from the environment and is validated once at startup. Nothing is discovered implicitly:
|
|
5
|
+
// no config files, no default credentials, and no provider is contacted unless MAYURA_MODEL_PROVIDER says so.
|
|
6
|
+
|
|
7
|
+
const sha256 = z.string().regex(/^[a-f0-9]{64}$/u, 'Expected a lowercase SHA-256 hex digest.');
|
|
8
|
+
/** A comma-separated list, so a token can be rotated by listing the old and new digests together. */
|
|
9
|
+
const digests = z.string().max(4_096).transform(value => value.split(',').map(entry => entry.trim()).filter(Boolean)).pipe(z.array(sha256).max(16));
|
|
10
|
+
const micros = z.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
11
|
+
|
|
12
|
+
const schema = z.object({
|
|
13
|
+
environment: z.enum(['development', 'production']).default('development'),
|
|
14
|
+
projectId: z.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u).default('refunds'),
|
|
15
|
+
databaseUrl: z.string().regex(/^postgres(ql)?:\/\//u, 'DATABASE_URL must be a postgres:// URL.').optional(),
|
|
16
|
+
sqlitePath: z.string().min(1).max(1_024).default('.data/refunds.sqlite'),
|
|
17
|
+
port: z.coerce.number().int().min(0).max(65_535).default(8080),
|
|
18
|
+
bind: z.string().min(1).max(64).default('0.0.0.0'),
|
|
19
|
+
publicOrigin: z.url({ protocol: /^https$/u }).optional(),
|
|
20
|
+
allowedOrigins: z.string().max(4_096).default('').transform(value => value.split(',').map(entry => entry.trim()).filter(Boolean)),
|
|
21
|
+
operatorTokens: digests.default([]),
|
|
22
|
+
intakeTokens: digests.default([]),
|
|
23
|
+
modelProvider: z.enum(['offline', 'openai', 'anthropic', 'compatible']).default('offline'),
|
|
24
|
+
openaiApiKey: z.string().min(1).optional(),
|
|
25
|
+
anthropicApiKey: z.string().min(1).optional(),
|
|
26
|
+
// An OpenAI-compatible provider (Groq, Mistral, Azure OpenAI, Gemini, ...): its HTTPS chat-completions endpoint, a short
|
|
27
|
+
// id that names its adapter (`openai-compatible.<id>`), how it takes the key, and the key.
|
|
28
|
+
compatibleEndpoint: z.string().url().max(2_048).optional(),
|
|
29
|
+
compatibleId: z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}$/u, 'Use a short lower-case id such as groq.').optional(),
|
|
30
|
+
compatibleAuth: z.enum(['bearer', 'api-key']).default('bearer'),
|
|
31
|
+
compatibleApiKey: z.string().min(1).optional(),
|
|
32
|
+
modelName: z.string().min(1).max(128).optional(),
|
|
33
|
+
inputMicrosPerMillionTokens: micros.optional(),
|
|
34
|
+
outputMicrosPerMillionTokens: micros.optional(),
|
|
35
|
+
maxCallCostMicros: micros.default(0),
|
|
36
|
+
maxRunCostMicros: micros.default(0),
|
|
37
|
+
refundLimitCents: z.coerce.number().int().min(1).max(100_000_000).default(50_000),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export type ModelSettings =
|
|
41
|
+
| { readonly provider: 'offline' }
|
|
42
|
+
| { readonly provider: 'openai' | 'anthropic'; readonly apiKey: string; readonly name: string; readonly maxCallCostMicros: number;
|
|
43
|
+
readonly pricing: { readonly inputMicrosPerMillionTokens: number; readonly outputMicrosPerMillionTokens: number } }
|
|
44
|
+
| { readonly provider: 'compatible'; readonly apiKey: string; readonly name: string; readonly maxCallCostMicros: number;
|
|
45
|
+
readonly endpoint: string; readonly providerId: string; readonly auth: 'bearer' | 'api-key';
|
|
46
|
+
readonly pricing: { readonly inputMicrosPerMillionTokens: number; readonly outputMicrosPerMillionTokens: number } };
|
|
47
|
+
|
|
48
|
+
export interface Config {
|
|
49
|
+
readonly environment: 'development' | 'production';
|
|
50
|
+
/** Every run, approval and command lives in this one scope. */
|
|
51
|
+
readonly scope: { readonly principalId: string; readonly projectId: string };
|
|
52
|
+
readonly storage: { readonly kind: 'sqlite'; readonly filename: string } | { readonly kind: 'postgres'; readonly connectionString: string };
|
|
53
|
+
readonly server: { readonly port: number; readonly bind: string; readonly publicOrigin?: string; readonly allowedOrigins: readonly string[] };
|
|
54
|
+
readonly operatorTokens: readonly string[];
|
|
55
|
+
readonly intakeTokens: readonly string[];
|
|
56
|
+
readonly model: ModelSettings;
|
|
57
|
+
readonly maxRunCostMicros: number;
|
|
58
|
+
readonly refundLimitCents: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function loadConfig(source: Readonly<Record<string, string | undefined>> = process.env): Promise<Config> {
|
|
62
|
+
const value = await validatedEnvironment({
|
|
63
|
+
source,
|
|
64
|
+
schema,
|
|
65
|
+
fields: {
|
|
66
|
+
environment: 'MAYURA_ENV', projectId: 'MAYURA_PROJECT', databaseUrl: 'DATABASE_URL', sqlitePath: 'MAYURA_SQLITE_PATH',
|
|
67
|
+
port: 'PORT', bind: 'MAYURA_BIND', publicOrigin: 'MAYURA_PUBLIC_ORIGIN', allowedOrigins: 'MAYURA_ALLOWED_ORIGINS',
|
|
68
|
+
operatorTokens: 'MAYURA_OPERATOR_TOKEN_SHA256', intakeTokens: 'MAYURA_INTAKE_TOKEN_SHA256',
|
|
69
|
+
modelProvider: 'MAYURA_MODEL_PROVIDER', openaiApiKey: 'OPENAI_API_KEY', anthropicApiKey: 'ANTHROPIC_API_KEY',
|
|
70
|
+
compatibleEndpoint: 'MAYURA_MODEL_ENDPOINT', compatibleId: 'MAYURA_MODEL_PROVIDER_ID', compatibleAuth: 'MAYURA_MODEL_AUTH', compatibleApiKey: 'MAYURA_MODEL_API_KEY', modelName: 'MAYURA_MODEL',
|
|
71
|
+
inputMicrosPerMillionTokens: 'MAYURA_MODEL_INPUT_MICROS_PER_MILLION_TOKENS', outputMicrosPerMillionTokens: 'MAYURA_MODEL_OUTPUT_MICROS_PER_MILLION_TOKENS',
|
|
72
|
+
maxCallCostMicros: 'MAYURA_MODEL_MAX_CALL_COST_MICROS', maxRunCostMicros: 'MAYURA_MAX_RUN_COST_MICROS', refundLimitCents: 'REFUND_LIMIT_CENTS',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
if (value.environment === 'production') {
|
|
76
|
+
if (!value.publicOrigin) throw new Error('MAYURA_PUBLIC_ORIGIN (https://...) is required in production.');
|
|
77
|
+
if (value.operatorTokens.length === 0) throw new Error('MAYURA_OPERATOR_TOKEN_SHA256 is required in production; run `npm run token`.');
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
environment: value.environment,
|
|
81
|
+
scope: { principalId: 'refunds-service', projectId: value.projectId },
|
|
82
|
+
storage: value.databaseUrl ? { kind: 'postgres', connectionString: value.databaseUrl } : { kind: 'sqlite', filename: value.sqlitePath },
|
|
83
|
+
server: { port: value.port, bind: value.bind, allowedOrigins: value.allowedOrigins, ...(value.publicOrigin ? { publicOrigin: value.publicOrigin.replace(/\/$/u, '') } : {}) },
|
|
84
|
+
operatorTokens: value.operatorTokens,
|
|
85
|
+
intakeTokens: value.intakeTokens,
|
|
86
|
+
model: modelSettings(value),
|
|
87
|
+
maxRunCostMicros: value.maxRunCostMicros,
|
|
88
|
+
refundLimitCents: value.refundLimitCents,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function modelSettings(value: z.infer<typeof schema>): ModelSettings {
|
|
93
|
+
if (value.modelProvider === 'offline') return { provider: 'offline' };
|
|
94
|
+
const apiKey = value.modelProvider === 'openai' ? value.openaiApiKey : value.modelProvider === 'anthropic' ? value.anthropicApiKey : value.compatibleApiKey;
|
|
95
|
+
const keyName = value.modelProvider === 'openai' ? 'OPENAI_API_KEY' : value.modelProvider === 'anthropic' ? 'ANTHROPIC_API_KEY' : 'MAYURA_MODEL_API_KEY';
|
|
96
|
+
if (value.modelProvider === 'compatible' && (!value.compatibleEndpoint || !value.compatibleId)) {
|
|
97
|
+
throw new Error('MAYURA_MODEL_PROVIDER=compatible requires MAYURA_MODEL_ENDPOINT (the https://.../chat/completions URL) and MAYURA_MODEL_PROVIDER_ID (such as groq).');
|
|
98
|
+
}
|
|
99
|
+
if (!apiKey || !value.modelName || value.inputMicrosPerMillionTokens === undefined || value.outputMicrosPerMillionTokens === undefined || value.maxCallCostMicros === 0) {
|
|
100
|
+
throw new Error(`MAYURA_MODEL_PROVIDER=${value.modelProvider} requires ${keyName}, MAYURA_MODEL, both MAYURA_MODEL_*_MICROS_PER_MILLION_TOKENS prices and MAYURA_MODEL_MAX_CALL_COST_MICROS.`);
|
|
101
|
+
}
|
|
102
|
+
if (value.maxRunCostMicros < value.maxCallCostMicros) throw new Error('MAYURA_MAX_RUN_COST_MICROS must cover at least one model call.');
|
|
103
|
+
const pricing = { inputMicrosPerMillionTokens: value.inputMicrosPerMillionTokens, outputMicrosPerMillionTokens: value.outputMicrosPerMillionTokens };
|
|
104
|
+
if (value.modelProvider === 'compatible') return { provider: 'compatible', apiKey, name: value.modelName, maxCallCostMicros: value.maxCallCostMicros,
|
|
105
|
+
endpoint: value.compatibleEndpoint!, providerId: value.compatibleId!, auth: value.compatibleAuth, pricing };
|
|
106
|
+
return { provider: value.modelProvider, apiKey, name: value.modelName, maxCallCostMicros: value.maxCallCostMicros, pricing };
|
|
107
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ClientError, createClient } from 'mayura/client';
|
|
2
|
+
import { createWorkflowLifecycleFleetRuntime } from 'mayura/workflows/lifecycle';
|
|
3
|
+
import { devSecrets, tokenDigest } from './auth.js';
|
|
4
|
+
import { loadConfig } from './config.js';
|
|
5
|
+
import { intakeOutput } from './intake.js';
|
|
6
|
+
import { startServer } from './server.js';
|
|
7
|
+
import { openServices } from './services.js';
|
|
8
|
+
import { createRefundWorker } from './worker.js';
|
|
9
|
+
|
|
10
|
+
// Local development in one process: server and worker on SQLite, tokens kept in .data/dev-secrets.json across restarts, a few demo refunds.
|
|
11
|
+
// Production runs `npm run serve` and `npm run worker` as separate processes instead (see README).
|
|
12
|
+
const { operatorToken, intakeToken } = await devSecrets(['operatorToken', 'intakeToken']);
|
|
13
|
+
const config = await loadConfig({ ...process.env, MAYURA_ENV: 'development',
|
|
14
|
+
MAYURA_OPERATOR_TOKEN_SHA256: tokenDigest(operatorToken), MAYURA_INTAKE_TOKEN_SHA256: tokenDigest(intakeToken) });
|
|
15
|
+
const services = await openServices(config);
|
|
16
|
+
const server = await startServer(config, services);
|
|
17
|
+
const { worker } = createRefundWorker(config, services); worker.start();
|
|
18
|
+
|
|
19
|
+
// Demo data: three refund requests through the intake agent, and one run on workflow v1 so the console can show a
|
|
20
|
+
// reviewed migration to v2. Each uses a fixed idempotency key. On a restart the server's durable submission journal
|
|
21
|
+
// refuses the repeated keys (HTTP 409) instead of starting duplicates, and the demo keeps the runs it already has.
|
|
22
|
+
const intake = createClient({ baseUrl: server.origin, token: () => intakeToken });
|
|
23
|
+
const requests = [
|
|
24
|
+
{ ticketId: 'T-100', customerId: 'cus-ada', orderId: 'ord-1001', amountCents: 4_999, reason: 'The mug arrived cracked.' },
|
|
25
|
+
{ ticketId: 'T-101', customerId: 'cus-grace', orderId: 'ord-2001', amountCents: 18_450, reason: 'My parcel never arrived.' },
|
|
26
|
+
{ ticketId: 'T-102', customerId: 'cus-ada', orderId: 'ord-1002', amountCents: 129_900, reason: 'Not what I expected.' },
|
|
27
|
+
];
|
|
28
|
+
const opened = [];
|
|
29
|
+
for (const request of requests) {
|
|
30
|
+
let run;
|
|
31
|
+
try { run = await intake.submit('refunds.intake', request, { idempotencyKey: `dev-${request.ticketId}` }); }
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof ClientError && error.status === 409) { opened.push({ ticketId: request.ticketId, status: 'opened on an earlier run' }); continue; }
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
for await (const _event of run.events()) { /* The stream ends when the run settles. */ }
|
|
37
|
+
const outcome = await run.result(intakeOutput);
|
|
38
|
+
opened.push(outcome?.status === 'succeeded' ? outcome.output : { ticketId: request.ticketId, status: outcome?.status ?? 'running' });
|
|
39
|
+
}
|
|
40
|
+
// Submit through the fleet runtime so the run is indexed for the worker and the console.
|
|
41
|
+
const runtimeForSeed = createWorkflowLifecycleFleetRuntime(services.runtimeOptions);
|
|
42
|
+
await runtimeForSeed.submit(services.workflows.v1, { idempotencyKey: 'rf-T-099', input: { refundId: 'rf-T-099', customerId: 'cus-ada',
|
|
43
|
+
orderId: 'ord-1001', amountCents: 1_500, currency: 'USD', reason: 'Shipping was late.', category: 'other', riskTier: 'low',
|
|
44
|
+
summary: 'Partial refund for late shipping (started on workflow v1).' } });
|
|
45
|
+
runtimeForSeed.close();
|
|
46
|
+
|
|
47
|
+
console.log(JSON.stringify({
|
|
48
|
+
console: `${server.origin}/inspector`,
|
|
49
|
+
operatorToken, intakeToken,
|
|
50
|
+
opened,
|
|
51
|
+
next: 'Open the console, paste the operator token, and approve a refund. The worker issues it within a second.',
|
|
52
|
+
}, null, 2));
|
|
53
|
+
|
|
54
|
+
let stopping = false;
|
|
55
|
+
const stop = async (): Promise<void> => {
|
|
56
|
+
if (stopping) process.exit(1); stopping = true;
|
|
57
|
+
await worker.drain({ timeoutMs: 10_000 }); await server.close(); await services.close();
|
|
58
|
+
};
|
|
59
|
+
process.once('SIGINT', () => { void stop(); }); process.once('SIGTERM', () => { void stop(); });
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ModelAdapter, ModelRequest, ModelResponse } from 'mayura/core';
|
|
2
|
+
import { defineAgent, defineTool } from 'mayura';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import type { ModelSettings } from './config.js';
|
|
5
|
+
import { jsonSchema, selectModel } from './model.js';
|
|
6
|
+
import { refundRequest, type RefundRequest } from './workflow.js';
|
|
7
|
+
|
|
8
|
+
const identifier = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/u);
|
|
9
|
+
|
|
10
|
+
/** A support system asks for a refund: the ticket, the order and the customer's own words. */
|
|
11
|
+
export const intakeInput = z.strictObject({
|
|
12
|
+
ticketId: identifier,
|
|
13
|
+
customerId: identifier,
|
|
14
|
+
orderId: identifier,
|
|
15
|
+
amountCents: z.number().int().min(1).max(100_000_000),
|
|
16
|
+
reason: z.string().min(1).max(2_000),
|
|
17
|
+
});
|
|
18
|
+
export type IntakeInput = z.infer<typeof intakeInput>;
|
|
19
|
+
|
|
20
|
+
const judgement = { category: refundRequest.shape.category, riskTier: refundRequest.shape.riskTier, summary: refundRequest.shape.summary };
|
|
21
|
+
/** What the model decides. Identifiers and amounts are checked against the order directory by the tool. */
|
|
22
|
+
const openInput = z.strictObject({ ticketId: identifier, customerId: identifier, orderId: identifier, amountCents: z.number().int().min(1).max(100_000_000),
|
|
23
|
+
reason: z.string().min(1).max(2_000), ...judgement });
|
|
24
|
+
export const intakeOutput = z.strictObject({ refundId: identifier, runId: z.string(), ...judgement });
|
|
25
|
+
export type IntakeOutput = z.infer<typeof intakeOutput>;
|
|
26
|
+
|
|
27
|
+
/** Your order system. The tool trusts it, not the model, for who owns an order and what it cost. */
|
|
28
|
+
export interface OrderDirectory {
|
|
29
|
+
find(orderId: string): Promise<{ readonly orderId: string; readonly customerId: string; readonly totalCents: number; readonly currency: string } | undefined>;
|
|
30
|
+
}
|
|
31
|
+
/** Local stand-in with a few fixed orders. */
|
|
32
|
+
export const sampleOrders: OrderDirectory = {
|
|
33
|
+
find: async orderId => ({
|
|
34
|
+
'ord-1001': { orderId: 'ord-1001', customerId: 'cus-ada', totalCents: 4_999, currency: 'USD' },
|
|
35
|
+
'ord-1002': { orderId: 'ord-1002', customerId: 'cus-ada', totalCents: 129_900, currency: 'USD' },
|
|
36
|
+
'ord-2001': { orderId: 'ord-2001', customerId: 'cus-grace', totalCents: 18_450, currency: 'EUR' },
|
|
37
|
+
} as Record<string, { orderId: string; customerId: string; totalCents: number; currency: string }>)[orderId],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export interface IntakeDependencies {
|
|
41
|
+
readonly model: ModelSettings;
|
|
42
|
+
readonly orders: OrderDirectory;
|
|
43
|
+
/** Start (or find) the durable approval for one refund. Idempotent on `refundId`. */
|
|
44
|
+
readonly openRefund: (request: RefundRequest) => Promise<{ readonly runId: string }>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function intakeAgent(dependencies: IntakeDependencies) {
|
|
48
|
+
const open = defineTool({
|
|
49
|
+
id: 'refunds.open', version: '1', effects: 'write', capabilities: ['refunds:open'],
|
|
50
|
+
description: 'Open the durable refund approval for one order. Call exactly once, with your category, risk tier and a one-sentence summary for the reviewer.',
|
|
51
|
+
input: openInput, inputJsonSchema: jsonSchema(openInput), output: z.strictObject({ refundId: identifier, runId: z.string() }),
|
|
52
|
+
execute: async request => {
|
|
53
|
+
const order = await dependencies.orders.find(request.orderId);
|
|
54
|
+
if (!order || order.customerId !== request.customerId) throw new Error('The order does not belong to this customer.');
|
|
55
|
+
if (request.amountCents > order.totalCents) throw new Error('The refund exceeds the order total.');
|
|
56
|
+
const refundId = `rf-${request.ticketId}`;
|
|
57
|
+
const { runId } = await dependencies.openRefund({ refundId, customerId: order.customerId, orderId: order.orderId, amountCents: request.amountCents,
|
|
58
|
+
currency: order.currency, reason: request.reason, category: request.category, riskTier: request.riskTier, summary: request.summary });
|
|
59
|
+
return { refundId, runId };
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const model = selectModel(dependencies.model, { outputJsonSchema: jsonSchema(intakeOutput), offline: offlineIntakeModel });
|
|
63
|
+
const agent = defineAgent({
|
|
64
|
+
id: 'refunds.intake', version: '1', input: intakeInput, output: intakeOutput, tools: [open], model,
|
|
65
|
+
instructions: [
|
|
66
|
+
'You triage refund requests for a support team.',
|
|
67
|
+
'Classify the reason as damaged, not_received, wrong_item, changed_mind or other.',
|
|
68
|
+
'Rate risk low, medium or high: larger amounts, vague reasons and repeat requests are riskier.',
|
|
69
|
+
'Call refunds.open exactly once with the request fields unchanged plus your category, risk tier and a one-sentence summary for the human reviewer.',
|
|
70
|
+
'Then answer with the refundId and runId it returned and the same category, risk tier and summary.',
|
|
71
|
+
].join('\n'),
|
|
72
|
+
});
|
|
73
|
+
return { agent, model, permissions: [`tool:${open.id}`, 'refunds:open', 'effect:write'] } as const;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---- Offline stand-in ------------------------------------------------------------------------------------------------
|
|
77
|
+
// Rule-based and deterministic: keyword classification and amount bands. It shows the tool-call protocol a real model
|
|
78
|
+
// follows; it is not inference and makes no judgement a real reviewer should rely on.
|
|
79
|
+
|
|
80
|
+
function classify(input: IntakeInput): Pick<IntakeOutput, 'category' | 'riskTier' | 'summary'> {
|
|
81
|
+
const reason = input.reason.toLowerCase();
|
|
82
|
+
const category = /broken|damaged|cracked|defect/u.test(reason) ? 'damaged'
|
|
83
|
+
: /never (arrived|came)|not (received|delivered)|missing|lost/u.test(reason) ? 'not_received'
|
|
84
|
+
: /wrong|incorrect|different (item|size|colou?r)/u.test(reason) ? 'wrong_item'
|
|
85
|
+
: /changed my mind|no longer|don't (want|need)/u.test(reason) ? 'changed_mind' : 'other';
|
|
86
|
+
const riskTier = input.amountCents >= 50_000 || category === 'other' ? 'high' : input.amountCents >= 10_000 ? 'medium' : 'low';
|
|
87
|
+
return { category, riskTier, summary: `${category.replace('_', ' ')} refund request for order ${input.orderId} (ticket ${input.ticketId}).` };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const offlineIntakeModel: ModelAdapter = {
|
|
91
|
+
id: 'offline.refund-intake',
|
|
92
|
+
capabilities: { tools: true, structuredOutput: true },
|
|
93
|
+
maxCostMicros: 0,
|
|
94
|
+
async generate(request: ModelRequest): Promise<ModelResponse> {
|
|
95
|
+
const first = request.messages[0];
|
|
96
|
+
const input = intakeInput.parse(first?.role === 'user' ? first.content : undefined);
|
|
97
|
+
const result = request.messages.find(message => message.role === 'tool');
|
|
98
|
+
if (!result) {
|
|
99
|
+
return { type: 'tool_calls', calls: [{ id: 'open-1', toolId: 'refunds.open', input: { ...input, ...classify(input) } }], usage: { costMicros: 0 } };
|
|
100
|
+
}
|
|
101
|
+
const opened = z.strictObject({ refundId: identifier, runId: z.string() }).parse(result.result);
|
|
102
|
+
return { type: 'final', output: { ...opened, ...classify(input) }, usage: { costMicros: 0 } };
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { JsonObject, ModelAdapter } from 'mayura/core';
|
|
2
|
+
import { anthropicMessages } from 'mayura/provider-anthropic';
|
|
3
|
+
import { openAICompatibleChat, openAIResponses } from 'mayura/provider-openai';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { ModelSettings } from './config.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The configured model for one agent. `offline` returns the agent's own rule-based stand-in: it performs no inference,
|
|
9
|
+
* needs no key and costs nothing, so the whole starter runs and tests without a network. Set MAYURA_MODEL_PROVIDER to
|
|
10
|
+
* `openai`, `anthropic` or `compatible` (any OpenAI-compatible endpoint) to use a real model with the same agent, tools
|
|
11
|
+
* and output schema. Each compatible provider gets its own adapter id, `openai-compatible.<MAYURA_MODEL_PROVIDER_ID>`.
|
|
12
|
+
*/
|
|
13
|
+
export function selectModel(settings: ModelSettings, agent: { readonly outputJsonSchema: JsonObject; readonly offline: ModelAdapter }): ModelAdapter {
|
|
14
|
+
if (settings.provider === 'offline') return agent.offline;
|
|
15
|
+
const options = { apiKey: settings.apiKey, model: settings.name, outputJsonSchema: agent.outputJsonSchema,
|
|
16
|
+
maxCostMicros: settings.maxCallCostMicros, pricing: settings.pricing, timeoutMs: 30_000 };
|
|
17
|
+
if (settings.provider === 'compatible') {
|
|
18
|
+
return openAICompatibleChat({ ...options, endpoint: settings.endpoint, remote: { id: settings.providerId, auth: settings.auth } });
|
|
19
|
+
}
|
|
20
|
+
return settings.provider === 'openai' ? openAIResponses(options) : anthropicMessages(options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Runtimes must allow each model explicitly, as `model:<adapter id>`. */
|
|
24
|
+
export const modelPermission = (model: ModelAdapter): string => `model:${model.id}`;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A zod schema as the plain JSON Schema object a tool or provider takes. Zod attaches non-enumerable metadata and
|
|
28
|
+
* Mayura accepts only plain JSON, so the result is round-tripped through JSON; `$schema` is dropped for providers.
|
|
29
|
+
*/
|
|
30
|
+
export function jsonSchema(schema: z.ZodType): JsonObject {
|
|
31
|
+
const { $schema: _dialect, ...plain } = JSON.parse(JSON.stringify(z.toJSONSchema(schema))) as JsonObject;
|
|
32
|
+
return plain;
|
|
33
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createAggregateSubmissionJournal } from 'mayura/storage-contracts';
|
|
2
|
+
import { listenAgentServer, listenProductionServer } from 'mayura/server-node';
|
|
3
|
+
import { createWorkflowCommandJournal, createWorkflowMigrationCatalog, createWorkflowOperatorTransports, lifecycleOperatorTarget } from 'mayura/workflows';
|
|
4
|
+
import { createWorkflowLifecycleFleetRuntime } from 'mayura/workflows/lifecycle';
|
|
5
|
+
import { approvalCredential, authenticate, verifyApprover } from './auth.js';
|
|
6
|
+
import type { Config } from './config.js';
|
|
7
|
+
import { intakeAgent, sampleOrders, type OrderDirectory } from './intake.js';
|
|
8
|
+
import { modelPermission } from './model.js';
|
|
9
|
+
import type { Services } from './services.js';
|
|
10
|
+
|
|
11
|
+
export interface RunningServer { readonly origin: string; isAccepting(): boolean; close(): Promise<void> }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The HTTP side: the intake agent for the support system, the operator console at /inspector and the operator API.
|
|
15
|
+
* It submits refund runs but never advances them; that is the worker's job.
|
|
16
|
+
*/
|
|
17
|
+
export async function startServer(config: Config, services: Services, options: { readonly orders?: OrderDirectory } = {}): Promise<RunningServer> {
|
|
18
|
+
const { store, workflows, runtimeOptions, fleet } = services; const { scope } = config;
|
|
19
|
+
const runtime = createWorkflowLifecycleFleetRuntime({ ...runtimeOptions, verifyHuman: verifyApprover(scope.projectId) });
|
|
20
|
+
const intake = intakeAgent({
|
|
21
|
+
model: config.model,
|
|
22
|
+
// Replace the sample orders with a lookup in your order system.
|
|
23
|
+
orders: options.orders ?? sampleOrders,
|
|
24
|
+
// Idempotent: a retried request for the same refund finds the run it already started.
|
|
25
|
+
openRefund: async request => ({ runId: (await runtime.submit(workflows.latest, { input: request, idempotencyKey: request.refundId })).id }),
|
|
26
|
+
});
|
|
27
|
+
// Production operator adapters: journaled commands (a retried command id never applies twice), revision checks,
|
|
28
|
+
// views across every registered version, fleet hold and sweeps, and the reviewed migrations.
|
|
29
|
+
const operator = createWorkflowOperatorTransports({ store, scope, journal: createWorkflowCommandJournal({ store, scope }), fleet,
|
|
30
|
+
migrations: createWorkflowMigrationCatalog([...workflows.migrations]),
|
|
31
|
+
targets: [lifecycleOperatorTarget({ runtime, store, scope, definitions: [...workflows.definitions], approvalCredential })] });
|
|
32
|
+
const settings = {
|
|
33
|
+
agents: [{ agent: intake.agent, permissions: { allow: [modelPermission(intake.model), ...intake.permissions] },
|
|
34
|
+
limits: { maxSteps: 4, maxModelCalls: 3, maxToolCalls: 1, maxDurationMs: 60_000, maxCostMicros: config.maxRunCostMicros } }],
|
|
35
|
+
authenticate: authenticate(config, intake.agent.id),
|
|
36
|
+
// A retried submission after a restart is refused instead of starting a second run.
|
|
37
|
+
submissionJournal: createAggregateSubmissionJournal(store),
|
|
38
|
+
inspector: true,
|
|
39
|
+
allowedOrigins: config.server.allowedOrigins,
|
|
40
|
+
...operator,
|
|
41
|
+
limits: { maxRequests: 256, maxRuns: 128, maxWorkflowOperations: 32, requestTimeoutMs: 30_000 },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (config.environment === 'production') {
|
|
45
|
+
const server = await listenProductionServer({ ...settings, publicOrigin: config.server.publicOrigin!, hostname: config.server.bind,
|
|
46
|
+
port: config.server.port, tls: { terminatedBy: 'proxy' },
|
|
47
|
+
readiness: async () => { await store.read('readiness', 'probe'); return true; } });
|
|
48
|
+
return { origin: server.publicOrigin, isAccepting: () => server.isAccepting(),
|
|
49
|
+
close: async () => { await server.close(); runtime.close(); } };
|
|
50
|
+
}
|
|
51
|
+
// Development: loopback only, plain HTTP.
|
|
52
|
+
const server = await listenAgentServer({ ...settings, port: config.server.port });
|
|
53
|
+
let accepting = true;
|
|
54
|
+
return { origin: server.origin, isAccepting: () => accepting,
|
|
55
|
+
close: async () => { accepting = false; await server.close(); runtime.close(); } };
|
|
56
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mkdir } from 'node:fs/promises';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { createPostgresStore } from 'mayura/storage-postgres';
|
|
4
|
+
import { createSqliteStore } from 'mayura/storage-sqlite';
|
|
5
|
+
import { createWorkflowFleetControl } from 'mayura/workflows';
|
|
6
|
+
import type { Config } from './config.js';
|
|
7
|
+
import { refundWorkflows, simulatedNotifier, simulatedPayments } from './workflow.js';
|
|
8
|
+
|
|
9
|
+
/** Storage and the pieces the server and the worker share. Both must use the same store, scope and definitions. */
|
|
10
|
+
export async function openServices(config: Config) {
|
|
11
|
+
let store;
|
|
12
|
+
if (config.storage.kind === 'postgres') store = createPostgresStore({ connectionString: config.storage.connectionString });
|
|
13
|
+
else {
|
|
14
|
+
const filename = config.storage.filename === ':memory:' ? ':memory:' : resolve(config.storage.filename);
|
|
15
|
+
if (filename !== ':memory:') await mkdir(dirname(filename), { recursive: true });
|
|
16
|
+
store = createSqliteStore({ filename });
|
|
17
|
+
}
|
|
18
|
+
await store.initialize();
|
|
19
|
+
// Replace the simulated payment gateway and notifier with your providers before handling real money.
|
|
20
|
+
const workflows = refundWorkflows({ payments: simulatedPayments, notifier: simulatedNotifier, refundLimitCents: config.refundLimitCents });
|
|
21
|
+
const runtimeOptions = { store, scope: config.scope, permissions: { allow: [...workflows.permissions] }, policyVersion: '1', maxCostMicros: 0 };
|
|
22
|
+
// The durable fleet hold: operators can stop every worker from advancing runs, for example during an incident.
|
|
23
|
+
const fleet = createWorkflowFleetControl({ store, scope: config.scope });
|
|
24
|
+
return { store, workflows, runtimeOptions, fleet, close: () => store.close() };
|
|
25
|
+
}
|
|
26
|
+
export type Services = Awaited<ReturnType<typeof openServices>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { newToken, tokenDigest } from './auth.js';
|
|
2
|
+
|
|
3
|
+
// Prints a new bearer token and the SHA-256 digest to configure. Give the token to the caller (store it in their
|
|
4
|
+
// secret manager); put only the digest in MAYURA_OPERATOR_TOKEN_SHA256 or MAYURA_INTAKE_TOKEN_SHA256.
|
|
5
|
+
const token = newToken();
|
|
6
|
+
console.log(JSON.stringify({ token, sha256: tokenDigest(token) }, null, 2));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { hostname } from 'node:os';
|
|
2
|
+
import { createWorkflowLeadership, createWorkflowWorker } from 'mayura/workflows';
|
|
3
|
+
import { createWorkflowLifecycleHost } from 'mayura/workflows/lifecycle';
|
|
4
|
+
import type { Config } from './config.js';
|
|
5
|
+
import type { Services } from './services.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The worker advances refund runs: policy checks, approved payments and notifications. Run as many replicas as you
|
|
9
|
+
* like; leadership lets one advance the fleet at a time, and a crashed leader's lease expires so another takes over.
|
|
10
|
+
* An effect that was dispatched when a process died is never repeated automatically; it waits for reconciliation.
|
|
11
|
+
*/
|
|
12
|
+
export function createRefundWorker(config: Config, services: Services, options: { readonly intervalMs?: number } = {}) {
|
|
13
|
+
const host = createWorkflowLifecycleHost({ ...services.runtimeOptions, definitions: [...services.workflows.definitions],
|
|
14
|
+
hold: services.fleet, intervalMs: options.intervalMs ?? 1_000, maxBackoffMs: 30_000 });
|
|
15
|
+
const worker = createWorkflowWorker({ units: [host], leadership: createWorkflowLeadership({ store: services.store, scope: config.scope,
|
|
16
|
+
role: 'refunds-worker', holderId: process.env['MAYURA_WORKER_ID'] ?? `${hostname()}-${process.pid}` }) });
|
|
17
|
+
return { host, worker };
|
|
18
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { defineTool } from 'mayura';
|
|
3
|
+
import { defineWorkflowLifecycle, defineWorkflowMigration } from 'mayura/workflows/lifecycle';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
const identifier = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/u);
|
|
7
|
+
|
|
8
|
+
/** What a refund run carries. Order facts come from the order directory, never from the model. */
|
|
9
|
+
export const refundRequest = z.strictObject({
|
|
10
|
+
refundId: identifier,
|
|
11
|
+
customerId: identifier,
|
|
12
|
+
orderId: identifier,
|
|
13
|
+
amountCents: z.number().int().min(1).max(100_000_000),
|
|
14
|
+
currency: z.string().regex(/^[A-Z]{3}$/u),
|
|
15
|
+
reason: z.string().min(1).max(2_000),
|
|
16
|
+
category: z.enum(['damaged', 'not_received', 'wrong_item', 'changed_mind', 'other']),
|
|
17
|
+
riskTier: z.enum(['low', 'medium', 'high']),
|
|
18
|
+
summary: z.string().min(1).max(500),
|
|
19
|
+
});
|
|
20
|
+
export type RefundRequest = z.infer<typeof refundRequest>;
|
|
21
|
+
|
|
22
|
+
/** Your payment provider. A refund must be idempotent on `refundId`, so a retried call never pays twice. */
|
|
23
|
+
export interface PaymentGateway {
|
|
24
|
+
refund(refund: { readonly refundId: string; readonly orderId: string; readonly amountCents: number; readonly currency: string }): Promise<{ readonly receiptId: string }>;
|
|
25
|
+
}
|
|
26
|
+
/** Your customer messaging (email, SMS, in-app). Idempotent on `refundId`. */
|
|
27
|
+
export interface CustomerNotifier {
|
|
28
|
+
send(message: { readonly refundId: string; readonly customerId: string; readonly text: string }): Promise<{ readonly messageId: string }>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const reference = (prefix: string, value: string): string => `${prefix}_${createHash('sha256').update(value).digest('hex').slice(0, 16)}`;
|
|
32
|
+
/** Local stand-ins: deterministic receipts and message ids, no network. Replace both before handling real money. */
|
|
33
|
+
export const simulatedPayments: PaymentGateway = { refund: async refund => ({ receiptId: reference('re', refund.refundId) }) };
|
|
34
|
+
export const simulatedNotifier: CustomerNotifier = { send: async message => ({ messageId: reference('msg', message.refundId) }) };
|
|
35
|
+
|
|
36
|
+
export interface RefundDependencies {
|
|
37
|
+
readonly payments: PaymentGateway;
|
|
38
|
+
readonly notifier: CustomerNotifier;
|
|
39
|
+
/** Largest refund the workflow will ever pay, in minor units; larger requests fail at the policy step. */
|
|
40
|
+
readonly refundLimitCents: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Two versions of one durable workflow, and the reviewed migration between them.
|
|
45
|
+
*
|
|
46
|
+
* v1: check policy, then issue the refund once an operator approves the exact request.
|
|
47
|
+
* v2: also notifies the customer after the refund is issued.
|
|
48
|
+
*
|
|
49
|
+
* New refunds start on the latest version. Runs already in flight keep the version they started on until an operator
|
|
50
|
+
* migrates them (console, or `POST /v1/workflow-runs/:id/migrations` through the operator API); the migration is planned and shown before it applies.
|
|
51
|
+
* Keep every version with runs in flight registered.
|
|
52
|
+
*/
|
|
53
|
+
export function refundWorkflows(dependencies: RefundDependencies) {
|
|
54
|
+
const policy = defineTool({
|
|
55
|
+
id: 'refunds.policy', version: '1', description: 'Check a refund request against the refund policy.',
|
|
56
|
+
input: refundRequest, output: z.strictObject({ reviewNotes: z.array(z.string()) }), effects: 'none', capabilities: [],
|
|
57
|
+
execute: request => {
|
|
58
|
+
if (request.amountCents > dependencies.refundLimitCents) throw new Error('Refund exceeds the policy limit.');
|
|
59
|
+
const reviewNotes = [`${request.category} (${request.riskTier} risk): ${request.summary}`];
|
|
60
|
+
if (request.riskTier === 'high') reviewNotes.push('High risk: confirm the order and customer history before approving.');
|
|
61
|
+
return { reviewNotes };
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const issue = defineTool({
|
|
65
|
+
id: 'refunds.issue', version: '1', description: 'Issue the refund through the payment gateway.',
|
|
66
|
+
input: refundRequest, output: z.strictObject({ receiptId: z.string() }), effects: 'write', capabilities: ['payments:refund'],
|
|
67
|
+
execute: request => dependencies.payments.refund(request),
|
|
68
|
+
});
|
|
69
|
+
const notify = defineTool({
|
|
70
|
+
id: 'refunds.notify', version: '1', description: 'Tell the customer their refund was issued.',
|
|
71
|
+
input: refundRequest, output: z.strictObject({ messageId: z.string() }), effects: 'write', capabilities: ['customers:notify'],
|
|
72
|
+
execute: request => dependencies.notifier.send({ refundId: request.refundId, customerId: request.customerId,
|
|
73
|
+
text: `Your refund of ${(request.amountCents / 100).toFixed(2)} ${request.currency} for order ${request.orderId} is on its way.` }),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const whole = { kind: 'input', path: [] } as const;
|
|
77
|
+
const steps = [
|
|
78
|
+
{ kind: 'tool', id: 'policy', tool: policy, input: whole },
|
|
79
|
+
// `approval: true` stops the run until an operator approves this exact request; nothing is paid before that.
|
|
80
|
+
{ kind: 'tool', id: 'issue', tool: issue, input: whole, dependsOn: ['policy'], approval: true },
|
|
81
|
+
] as const;
|
|
82
|
+
const output = z.strictObject({ receiptId: z.string() });
|
|
83
|
+
const v1 = defineWorkflowLifecycle({ id: 'refunds.approval', version: '1', input: refundRequest, output, nodes: [...steps],
|
|
84
|
+
result: { kind: 'step', stepId: 'issue', path: [] } });
|
|
85
|
+
const v2 = defineWorkflowLifecycle({ id: 'refunds.approval', version: '2', input: refundRequest, output, nodes: [...steps,
|
|
86
|
+
{ kind: 'tool', id: 'notify', tool: notify, input: whole, dependsOn: ['issue'] }], result: { kind: 'step', stepId: 'issue', path: [] } });
|
|
87
|
+
const migration = defineWorkflowMigration({ id: 'refunds-approval-1-to-2', from: v1, to: v2,
|
|
88
|
+
description: 'Notify the customer once the refund is issued.' });
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
/** New runs start here. */
|
|
92
|
+
latest: v2,
|
|
93
|
+
/** Every version that may still have runs in flight. */
|
|
94
|
+
definitions: [v1, v2],
|
|
95
|
+
migrations: [migration],
|
|
96
|
+
/** What the workflow runtime must allow: each tool, each capability it declares, and the write effect. */
|
|
97
|
+
permissions: ['tool:refunds.policy', 'tool:refunds.issue', 'tool:refunds.notify', 'payments:refund', 'customers:notify', 'effect:write'],
|
|
98
|
+
v1,
|
|
99
|
+
} as const;
|
|
100
|
+
}
|