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,138 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { validatedEnvironment } from 'mayura/helpers';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
// Every setting comes from the environment and is validated once at startup. Nothing is discovered implicitly:
|
|
6
|
+
// no config files, no default credentials, and no provider is contacted unless MAYURA_MODEL_PROVIDER says so.
|
|
7
|
+
|
|
8
|
+
const sha256 = z.string().regex(/^[a-f0-9]{64}$/u, 'Expected a lowercase SHA-256 hex digest.');
|
|
9
|
+
/** A comma-separated list, so a token can be rotated by listing the old and new digests together. */
|
|
10
|
+
const digests = z.string().max(4_096).transform(value => value.split(',').map(entry => entry.trim()).filter(Boolean)).pipe(z.array(sha256).max(16));
|
|
11
|
+
const micros = z.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
12
|
+
const port = z.coerce.number().int().min(0).max(65_535);
|
|
13
|
+
|
|
14
|
+
const schema = z.object({
|
|
15
|
+
environment: z.enum(['development', 'production']).default('development'),
|
|
16
|
+
projectId: z.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u).default('tickets'),
|
|
17
|
+
databaseUrl: z.string().regex(/^postgres(ql)?:\/\//u, 'DATABASE_URL must be a postgres:// URL.').optional(),
|
|
18
|
+
sqlitePath: z.string().min(1).max(1_024).default('.data/event-automation.sqlite'),
|
|
19
|
+
port: port.default(8080),
|
|
20
|
+
bind: z.string().min(1).max(64).default('0.0.0.0'),
|
|
21
|
+
publicOrigin: z.url({ protocol: /^https$/u }).optional(),
|
|
22
|
+
allowedOrigins: z.string().max(4_096).default('').transform(value => value.split(',').map(entry => entry.trim()).filter(Boolean)),
|
|
23
|
+
operatorTokens: digests.default([]),
|
|
24
|
+
// The shared HMAC secret the tracker signs deliveries with. At least 32 characters; `npm run token` makes one.
|
|
25
|
+
webhookSecret: z.string().min(32, 'WEBHOOK_SECRET must be at least 32 characters.').max(1_024).optional(),
|
|
26
|
+
webhookPort: port.default(8081),
|
|
27
|
+
trackerUrl: z.url({ protocol: /^https?$/u }).optional(),
|
|
28
|
+
trackerToken: z.string().min(1).max(4_096).optional(),
|
|
29
|
+
oncallAssignee: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._@-]{0,63}$/u).default('oncall'),
|
|
30
|
+
modelProvider: z.enum(['offline', 'openai', 'anthropic', 'compatible']).default('offline'),
|
|
31
|
+
openaiApiKey: z.string().min(1).optional(),
|
|
32
|
+
anthropicApiKey: z.string().min(1).optional(),
|
|
33
|
+
// An OpenAI-compatible provider (Groq, Mistral, Azure OpenAI, Gemini, ...): its HTTPS chat-completions endpoint, a short
|
|
34
|
+
// id that names its adapter (`openai-compatible.<id>`), how it takes the key, and the key.
|
|
35
|
+
compatibleEndpoint: z.string().url().max(2_048).optional(),
|
|
36
|
+
compatibleId: z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}$/u, 'Use a short lower-case id such as groq.').optional(),
|
|
37
|
+
compatibleAuth: z.enum(['bearer', 'api-key']).default('bearer'),
|
|
38
|
+
compatibleApiKey: z.string().min(1).optional(),
|
|
39
|
+
modelName: z.string().min(1).max(128).optional(),
|
|
40
|
+
inputMicrosPerMillionTokens: micros.optional(),
|
|
41
|
+
outputMicrosPerMillionTokens: micros.optional(),
|
|
42
|
+
maxCallCostMicros: micros.default(0),
|
|
43
|
+
maxRunCostMicros: micros.default(0),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export type ModelSettings =
|
|
47
|
+
| { readonly provider: 'offline' }
|
|
48
|
+
| { readonly provider: 'openai' | 'anthropic'; readonly apiKey: string; readonly name: string; readonly maxCallCostMicros: number;
|
|
49
|
+
readonly pricing: { readonly inputMicrosPerMillionTokens: number; readonly outputMicrosPerMillionTokens: number } }
|
|
50
|
+
| { readonly provider: 'compatible'; readonly apiKey: string; readonly name: string; readonly maxCallCostMicros: number;
|
|
51
|
+
readonly endpoint: string; readonly providerId: string; readonly auth: 'bearer' | 'api-key';
|
|
52
|
+
readonly pricing: { readonly inputMicrosPerMillionTokens: number; readonly outputMicrosPerMillionTokens: number } };
|
|
53
|
+
|
|
54
|
+
export interface Config {
|
|
55
|
+
readonly environment: 'development' | 'production';
|
|
56
|
+
/** Every run, delivery, approval and command lives in this one scope. */
|
|
57
|
+
readonly scope: { readonly principalId: string; readonly projectId: string };
|
|
58
|
+
readonly storage: { readonly kind: 'sqlite'; readonly filename: string } | { readonly kind: 'postgres'; readonly connectionString: string };
|
|
59
|
+
readonly server: { readonly port: number; readonly bind: string; readonly publicOrigin?: string; readonly allowedOrigins: readonly string[] };
|
|
60
|
+
readonly operatorTokens: readonly string[];
|
|
61
|
+
readonly webhook: {
|
|
62
|
+
readonly port: number;
|
|
63
|
+
/** Loopback in development; MAYURA_BIND in production (behind your TLS proxy). */
|
|
64
|
+
readonly bind: string;
|
|
65
|
+
readonly secret: string;
|
|
66
|
+
/** True when development generated a throwaway secret because WEBHOOK_SECRET was not set. */
|
|
67
|
+
readonly secretGenerated: boolean;
|
|
68
|
+
};
|
|
69
|
+
/** The tracker's MCP endpoint (Streamable HTTP) and the bearer token it expects, if any. */
|
|
70
|
+
readonly tracker: { readonly url: string; readonly token?: string };
|
|
71
|
+
/** Who an approved escalation assigns the ticket to. Configuration decides this, never the model. */
|
|
72
|
+
readonly oncallAssignee: string;
|
|
73
|
+
readonly model: ModelSettings;
|
|
74
|
+
readonly maxRunCostMicros: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Where `npm run tracker` listens by default, and so where development looks for the tracker. */
|
|
78
|
+
export const LOCAL_TRACKER_URL = 'http://127.0.0.1:8090/mcp';
|
|
79
|
+
|
|
80
|
+
export async function loadConfig(source: Readonly<Record<string, string | undefined>> = process.env): Promise<Config> {
|
|
81
|
+
const value = await validatedEnvironment({
|
|
82
|
+
source,
|
|
83
|
+
schema,
|
|
84
|
+
fields: {
|
|
85
|
+
environment: 'MAYURA_ENV', projectId: 'MAYURA_PROJECT', databaseUrl: 'DATABASE_URL', sqlitePath: 'MAYURA_SQLITE_PATH',
|
|
86
|
+
port: 'PORT', bind: 'MAYURA_BIND', publicOrigin: 'MAYURA_PUBLIC_ORIGIN', allowedOrigins: 'MAYURA_ALLOWED_ORIGINS',
|
|
87
|
+
operatorTokens: 'MAYURA_OPERATOR_TOKEN_SHA256',
|
|
88
|
+
webhookSecret: 'WEBHOOK_SECRET', webhookPort: 'WEBHOOK_PORT', trackerUrl: 'TRACKER_MCP_URL', trackerToken: 'TRACKER_MCP_TOKEN',
|
|
89
|
+
oncallAssignee: 'ONCALL_ASSIGNEE',
|
|
90
|
+
modelProvider: 'MAYURA_MODEL_PROVIDER', openaiApiKey: 'OPENAI_API_KEY', anthropicApiKey: 'ANTHROPIC_API_KEY',
|
|
91
|
+
compatibleEndpoint: 'MAYURA_MODEL_ENDPOINT', compatibleId: 'MAYURA_MODEL_PROVIDER_ID', compatibleAuth: 'MAYURA_MODEL_AUTH', compatibleApiKey: 'MAYURA_MODEL_API_KEY', modelName: 'MAYURA_MODEL',
|
|
92
|
+
inputMicrosPerMillionTokens: 'MAYURA_MODEL_INPUT_MICROS_PER_MILLION_TOKENS', outputMicrosPerMillionTokens: 'MAYURA_MODEL_OUTPUT_MICROS_PER_MILLION_TOKENS',
|
|
93
|
+
maxCallCostMicros: 'MAYURA_MODEL_MAX_CALL_COST_MICROS', maxRunCostMicros: 'MAYURA_MAX_RUN_COST_MICROS',
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
if (value.environment === 'production') {
|
|
97
|
+
if (!value.publicOrigin) throw new Error('MAYURA_PUBLIC_ORIGIN (https://...) is required in production.');
|
|
98
|
+
if (value.operatorTokens.length === 0) throw new Error('MAYURA_OPERATOR_TOKEN_SHA256 is required in production; run `npm run token`.');
|
|
99
|
+
if (!value.webhookSecret) throw new Error('WEBHOOK_SECRET is required in production; share it with the tracker that signs deliveries.');
|
|
100
|
+
if (!value.trackerUrl) throw new Error('TRACKER_MCP_URL is required in production: the MCP endpoint of your tracker.');
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
environment: value.environment,
|
|
104
|
+
scope: { principalId: 'tickets-service', projectId: value.projectId },
|
|
105
|
+
storage: value.databaseUrl ? { kind: 'postgres', connectionString: value.databaseUrl } : { kind: 'sqlite', filename: value.sqlitePath },
|
|
106
|
+
server: { port: value.port, bind: value.bind, allowedOrigins: value.allowedOrigins, ...(value.publicOrigin ? { publicOrigin: value.publicOrigin.replace(/\/$/u, '') } : {}) },
|
|
107
|
+
operatorTokens: value.operatorTokens,
|
|
108
|
+
webhook: {
|
|
109
|
+
port: value.webhookPort,
|
|
110
|
+
bind: value.environment === 'production' ? value.bind : '127.0.0.1',
|
|
111
|
+
// Development without a configured secret gets a random one: deliveries are refused until you set your own,
|
|
112
|
+
// which is the safe failure. `npm run dev` sets and prints one for you.
|
|
113
|
+
secret: value.webhookSecret ?? randomBytes(32).toString('hex'),
|
|
114
|
+
secretGenerated: value.webhookSecret === undefined,
|
|
115
|
+
},
|
|
116
|
+
tracker: { url: value.trackerUrl ?? LOCAL_TRACKER_URL, ...(value.trackerToken ? { token: value.trackerToken } : {}) },
|
|
117
|
+
oncallAssignee: value.oncallAssignee,
|
|
118
|
+
model: modelSettings(value),
|
|
119
|
+
maxRunCostMicros: value.maxRunCostMicros,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function modelSettings(value: z.infer<typeof schema>): ModelSettings {
|
|
124
|
+
if (value.modelProvider === 'offline') return { provider: 'offline' };
|
|
125
|
+
const apiKey = value.modelProvider === 'openai' ? value.openaiApiKey : value.modelProvider === 'anthropic' ? value.anthropicApiKey : value.compatibleApiKey;
|
|
126
|
+
const keyName = value.modelProvider === 'openai' ? 'OPENAI_API_KEY' : value.modelProvider === 'anthropic' ? 'ANTHROPIC_API_KEY' : 'MAYURA_MODEL_API_KEY';
|
|
127
|
+
if (value.modelProvider === 'compatible' && (!value.compatibleEndpoint || !value.compatibleId)) {
|
|
128
|
+
throw new Error('MAYURA_MODEL_PROVIDER=compatible requires MAYURA_MODEL_ENDPOINT (the https://.../chat/completions URL) and MAYURA_MODEL_PROVIDER_ID (such as groq).');
|
|
129
|
+
}
|
|
130
|
+
if (!apiKey || !value.modelName || value.inputMicrosPerMillionTokens === undefined || value.outputMicrosPerMillionTokens === undefined || value.maxCallCostMicros === 0) {
|
|
131
|
+
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.`);
|
|
132
|
+
}
|
|
133
|
+
if (value.maxRunCostMicros < value.maxCallCostMicros) throw new Error('MAYURA_MAX_RUN_COST_MICROS must cover at least one model call.');
|
|
134
|
+
const pricing = { inputMicrosPerMillionTokens: value.inputMicrosPerMillionTokens, outputMicrosPerMillionTokens: value.outputMicrosPerMillionTokens };
|
|
135
|
+
if (value.modelProvider === 'compatible') return { provider: 'compatible', apiKey, name: value.modelName, maxCallCostMicros: value.maxCallCostMicros,
|
|
136
|
+
endpoint: value.compatibleEndpoint!, providerId: value.compatibleId!, auth: value.compatibleAuth, pricing };
|
|
137
|
+
return { provider: value.modelProvider, apiKey, name: value.modelName, maxCallCostMicros: value.maxCallCostMicros, pricing };
|
|
138
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { devSecrets, tokenDigest } from './auth.js';
|
|
4
|
+
import { loadConfig } from './config.js';
|
|
5
|
+
import { startServer } from './server.js';
|
|
6
|
+
import { openServices } from './services.js';
|
|
7
|
+
import { sendDelivery } from './signing.js';
|
|
8
|
+
import { startTrackerMcpServer } from './tracker/mcp-server.js';
|
|
9
|
+
import { sampleTickets, ticketCreatedEvent, type SampleName } from './tracker/samples.js';
|
|
10
|
+
import { memoryTracker } from './tracker/tickets.js';
|
|
11
|
+
import { createTicketWorker } from './worker.js';
|
|
12
|
+
|
|
13
|
+
// Local development in one process: the local tracker (an MCP server on an ephemeral port), the Mayura server, the
|
|
14
|
+
// webhook ingress and a worker, on SQLite, with an operator token and webhook secret kept in .data/dev-secrets.json across restarts.
|
|
15
|
+
// Production runs `npm run serve` and `npm run worker` as separate processes against your real tracker (see README).
|
|
16
|
+
const { operatorToken, webhookSecret, trackerToken } = await devSecrets(['operatorToken', 'webhookSecret', 'trackerToken']);
|
|
17
|
+
const tickets = memoryTracker(Object.values(sampleTickets));
|
|
18
|
+
const tracker = await startTrackerMcpServer({ tracker: tickets, port: 0, token: trackerToken });
|
|
19
|
+
const config = await loadConfig({ ...process.env, MAYURA_ENV: 'development', MAYURA_OPERATOR_TOKEN_SHA256: tokenDigest(operatorToken),
|
|
20
|
+
WEBHOOK_SECRET: webhookSecret, TRACKER_MCP_URL: tracker.url, TRACKER_MCP_TOKEN: trackerToken });
|
|
21
|
+
const services = await openServices(config);
|
|
22
|
+
const server = await startServer(config, services);
|
|
23
|
+
const { worker } = createTicketWorker(config, services); worker.start();
|
|
24
|
+
|
|
25
|
+
// `npm run send-sample` reads the URL and secret from here, so it needs no arguments. Development only.
|
|
26
|
+
const devFile = resolve('.data/dev-webhook.json');
|
|
27
|
+
await mkdir(dirname(devFile), { recursive: true });
|
|
28
|
+
await writeFile(devFile, `${JSON.stringify({ url: server.webhookUrl, secret: webhookSecret }, null, 2)}\n`, { mode: 0o600 });
|
|
29
|
+
|
|
30
|
+
// Demo data: three signed deliveries, as the tracker would send them. Fixed delivery ids mean a restart repeats the
|
|
31
|
+
// same deliveries, which the durable delivery record recognises: no second run starts.
|
|
32
|
+
const delivered: Record<string, unknown> = {};
|
|
33
|
+
for (const name of ['billing', 'docs', 'outage'] as const satisfies readonly SampleName[]) {
|
|
34
|
+
const { status, body } = await sendDelivery(server.webhookUrl, webhookSecret, { deliveryId: `dev-${sampleTickets[name].id}`, event: ticketCreatedEvent(name) });
|
|
35
|
+
delivered[name] = { ticket: sampleTickets[name].id, http: status, response: body };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log(JSON.stringify({
|
|
39
|
+
console: `${server.origin}/inspector`,
|
|
40
|
+
operatorToken,
|
|
41
|
+
webhookUrl: server.webhookUrl,
|
|
42
|
+
webhookSecret,
|
|
43
|
+
trackerMcp: tracker.url,
|
|
44
|
+
delivered,
|
|
45
|
+
sendSample: 'npm run send-sample -- outage (in another terminal; also: billing, docs, feature, --stale, --forged, --delivery <id>)',
|
|
46
|
+
next: 'Open the console, paste the operator token, open Workflows. T-1001 (outage) waits for approval to assign it to on-call.',
|
|
47
|
+
}, null, 2));
|
|
48
|
+
|
|
49
|
+
let stopping = false;
|
|
50
|
+
const stop = async (): Promise<void> => {
|
|
51
|
+
if (stopping) process.exit(1); stopping = true;
|
|
52
|
+
await worker.drain({ timeoutMs: 10_000 }); await server.close(); await services.close(); await tracker.close();
|
|
53
|
+
};
|
|
54
|
+
process.once('SIGINT', () => { void stop(); }); process.once('SIGTERM', () => { void stop(); });
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
|
|
3
|
+
import type { AddressInfo } from 'node:net';
|
|
4
|
+
import { MayuraError } from 'mayura/core';
|
|
5
|
+
import { StorageError } from 'mayura/storage-contracts';
|
|
6
|
+
import { createWebhookRuntime, defineWebhookTrigger } from 'mayura/workstream/webhooks';
|
|
7
|
+
import type { Config } from './config.js';
|
|
8
|
+
import { jsonSchema } from './model.js';
|
|
9
|
+
import type { Services } from './services.js';
|
|
10
|
+
import { webhookHeaders } from './signing.js';
|
|
11
|
+
import { ticketCreated } from './triage.js';
|
|
12
|
+
|
|
13
|
+
export const WEBHOOK_PATH = '/webhooks/tickets';
|
|
14
|
+
const maxBodyBytes = 65_536;
|
|
15
|
+
const maxInFlight = 32;
|
|
16
|
+
/** Deliveries signed more than five minutes before or after our clock are refused, so a captured request goes stale. */
|
|
17
|
+
const replayWindowMs = 300_000;
|
|
18
|
+
// Pins the payload schema into every stored delivery: a schema change is a new trigger version, never a silent reinterpretation.
|
|
19
|
+
const schemaDigest = createHash('sha256').update(JSON.stringify(jsonSchema(ticketCreated))).digest('hex');
|
|
20
|
+
|
|
21
|
+
export interface WebhookIngress { readonly url: string; isAccepting(): boolean; close(): Promise<void> }
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The webhook listener: its own small HTTP server, because the Mayura agent server serves only its own API.
|
|
25
|
+
* One route, `POST /webhooks/tickets`. Each request is bounded (size, time, concurrency) and handed, as raw bytes, to
|
|
26
|
+
* the Mayura webhook runtime, which verifies the HMAC signature and the replay window, validates the payload, and
|
|
27
|
+
* records the delivery durably before dispatching it exactly once. A repeated delivery id finds that record instead
|
|
28
|
+
* of starting anything. Responses carry a status and a fixed error word, never details.
|
|
29
|
+
*/
|
|
30
|
+
export async function startWebhookIngress(config: Config, services: Services): Promise<WebhookIngress> {
|
|
31
|
+
const secret = Buffer.from(config.webhook.secret, 'utf8');
|
|
32
|
+
const webhooks = createWebhookRuntime({
|
|
33
|
+
store: services.store, scope: config.scope, maxBodyBytes, maxClockSkewMs: replayWindowMs,
|
|
34
|
+
// Replace with a read from your secret manager to rotate without a restart.
|
|
35
|
+
resolveSecret: async () => new Uint8Array(secret),
|
|
36
|
+
});
|
|
37
|
+
const trigger = defineWebhookTrigger({
|
|
38
|
+
id: 'tickets.created', version: '1', secretId: 'tracker-webhook', schemaId: 'tickets.created.v1', schemaDigest, input: ticketCreated,
|
|
39
|
+
// Runs once per new delivery, after verification. `commandId` is stable for the delivery, so the intake run is
|
|
40
|
+
// idempotent on it too: even a dispatch retried after a crash finds the run it already started.
|
|
41
|
+
dispatch: async (event, { deliveryId, commandId }) => {
|
|
42
|
+
const run = await services.submissions.submit(services.workflows.intake, { idempotencyKey: `delivery:${commandId}`, input: { deliveryId, ticket: event.ticket } });
|
|
43
|
+
return { runId: run.id };
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
let accepting = true; let inFlight = 0;
|
|
48
|
+
const reply = (response: ServerResponse, status: number, body: Record<string, unknown>, headers: Record<string, string> = {}): void => {
|
|
49
|
+
response.writeHead(status, { 'content-type': 'application/json', 'cache-control': 'no-store', 'x-content-type-options': 'nosniff', ...headers });
|
|
50
|
+
response.end(JSON.stringify(body));
|
|
51
|
+
};
|
|
52
|
+
const log = (event: Record<string, unknown>): void => { process.stderr.write(`${JSON.stringify(event)}\n`); };
|
|
53
|
+
const header = (request: IncomingMessage, name: string): string | undefined => {
|
|
54
|
+
const value = request.headers[name]; return typeof value === 'string' ? value : undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
async function readBody(request: IncomingMessage): Promise<Uint8Array | undefined> {
|
|
58
|
+
const declared = Number(request.headers['content-length'] ?? 0);
|
|
59
|
+
if (!Number.isFinite(declared) || declared > maxBodyBytes) return undefined;
|
|
60
|
+
const chunks: Buffer[] = []; let size = 0;
|
|
61
|
+
for await (const chunk of request as AsyncIterable<Buffer>) {
|
|
62
|
+
size += chunk.length; if (size > maxBodyBytes) return undefined;
|
|
63
|
+
chunks.push(chunk);
|
|
64
|
+
}
|
|
65
|
+
return new Uint8Array(Buffer.concat(chunks));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function handle(request: IncomingMessage, response: ServerResponse): Promise<void> {
|
|
69
|
+
if ((request.url ?? '').split('?')[0] !== WEBHOOK_PATH) return reply(response, 404, { error: 'not_found' });
|
|
70
|
+
if (request.method !== 'POST') return reply(response, 405, { error: 'method_not_allowed' }, { allow: 'POST' });
|
|
71
|
+
if (!accepting || inFlight >= maxInFlight) return reply(response, 503, { error: 'unavailable' }, { 'retry-after': '5' });
|
|
72
|
+
if (!/^application\/json\s*(;|$)/iu.test(header(request, 'content-type') ?? '')) return reply(response, 415, { error: 'unsupported_media_type' });
|
|
73
|
+
const deliveryId = header(request, webhookHeaders.delivery); const timestamp = header(request, webhookHeaders.timestamp);
|
|
74
|
+
const signature = header(request, webhookHeaders.signature);
|
|
75
|
+
if (!signature) return reply(response, 401, { error: 'unauthorized' });
|
|
76
|
+
if (!deliveryId || !timestamp || !/^\d{1,16}$/u.test(timestamp)) return reply(response, 400, { error: 'bad_request' });
|
|
77
|
+
inFlight++;
|
|
78
|
+
try {
|
|
79
|
+
const body = await readBody(request);
|
|
80
|
+
if (!body) return reply(response, 413, { error: 'too_large' }, { connection: 'close' });
|
|
81
|
+
const delivery = await webhooks.receive(trigger, { deliveryId, timestampMs: Number(timestamp), signature, body });
|
|
82
|
+
if (delivery.status === 'succeeded') {
|
|
83
|
+
const { runId } = delivery.output as { readonly runId: string };
|
|
84
|
+
// The same answer for a new delivery and for a repeat of one already handled: the tracker can stop retrying.
|
|
85
|
+
return reply(response, 202, { status: 'accepted', runId });
|
|
86
|
+
}
|
|
87
|
+
if (delivery.status === 'outcome_unknown') {
|
|
88
|
+
// Dispatch failed part-way. It is never retried automatically; an operator reconciles it (see README).
|
|
89
|
+
log({ event: 'webhook-unconfirmed', deliveryId });
|
|
90
|
+
return reply(response, 500, { error: 'unconfirmed' });
|
|
91
|
+
}
|
|
92
|
+
// Another process is dispatching this delivery right now (or crashed doing so): ask the tracker to retry later.
|
|
93
|
+
return reply(response, 503, { error: 'in_progress' }, { 'retry-after': '5' });
|
|
94
|
+
} catch (error) {
|
|
95
|
+
const code = error instanceof MayuraError || error instanceof StorageError ? error.code : 'UNEXPECTED';
|
|
96
|
+
if (code === 'PERMISSION_DENIED') return reply(response, 401, { error: 'unauthorized' });
|
|
97
|
+
if (code === 'INVALID_INPUT') return reply(response, 400, { error: 'bad_request' });
|
|
98
|
+
// A delivery id reused with a different body (the store refuses it), or a concurrent copy of this delivery that
|
|
99
|
+
// another process is already handling. Either way this request must not start anything.
|
|
100
|
+
if (code === 'CONFLICT') return reply(response, 409, { error: 'conflict' });
|
|
101
|
+
if (code === 'LIMIT_EXCEEDED') return reply(response, 503, { error: 'unavailable' }, { 'retry-after': '5' });
|
|
102
|
+
log({ event: 'webhook-error', code });
|
|
103
|
+
return reply(response, code === 'STORAGE_UNAVAILABLE' ? 503 : 500, { error: 'internal' });
|
|
104
|
+
} finally { inFlight--; }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const server = createServer({ requestTimeout: 15_000, headersTimeout: 10_000, maxHeaderSize: 16_384 }, (request, response) => {
|
|
108
|
+
handle(request, response).catch(() => { if (!response.headersSent) reply(response, 500, { error: 'internal' }); else response.destroy(); });
|
|
109
|
+
});
|
|
110
|
+
server.maxConnections = 256;
|
|
111
|
+
await new Promise<void>((resolve, reject) => {
|
|
112
|
+
server.once('error', reject);
|
|
113
|
+
server.listen(config.webhook.port, config.webhook.bind, () => { server.off('error', reject); resolve(); });
|
|
114
|
+
});
|
|
115
|
+
if (config.webhook.secretGenerated) {
|
|
116
|
+
log({ event: 'webhook-secret-generated', note: 'WEBHOOK_SECRET is not set, so a random development secret is in use and no tracker can sign deliveries. Set WEBHOOK_SECRET, or use `npm run dev`.' });
|
|
117
|
+
}
|
|
118
|
+
const { port } = server.address() as AddressInfo;
|
|
119
|
+
const host = config.webhook.bind === '0.0.0.0' ? '127.0.0.1' : config.webhook.bind;
|
|
120
|
+
return {
|
|
121
|
+
url: `http://${host}:${port}${WEBHOOK_PATH}`,
|
|
122
|
+
isAccepting: () => accepting,
|
|
123
|
+
close: async () => {
|
|
124
|
+
accepting = false;
|
|
125
|
+
await new Promise<void>(resolve => { server.close(() => resolve()); server.closeIdleConnections(); });
|
|
126
|
+
webhooks.close();
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { McpCallToolRequest, McpClient } from 'mayura/adapter-mcp';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The MCP client transport `mayura/adapter-mcp` asks the application to supply: the MCP Streamable HTTP transport,
|
|
5
|
+
* reduced to what tool calls need. It performs the `initialize` handshake once (lazily, on the first call), keeps the
|
|
6
|
+
* server's session id if it issues one, and sends JSON-RPC requests as POSTs, accepting either a JSON body or a
|
|
7
|
+
* server-sent-event stream in reply. Everything is bounded: one timeout per request and a maximum response size.
|
|
8
|
+
*
|
|
9
|
+
* It does not implement server-initiated requests (sampling, elicitation), resumable streams or OAuth discovery. Use
|
|
10
|
+
* a bearer token your tracker's MCP server accepts, or replace this module with a full MCP client library.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const PROTOCOL_VERSION = '2025-06-18';
|
|
14
|
+
const acceptedVersions = new Set([PROTOCOL_VERSION, '2025-03-26']);
|
|
15
|
+
|
|
16
|
+
export interface McpHttpClientOptions {
|
|
17
|
+
/** The server's MCP endpoint, for example https://tracker.example.com/mcp. */
|
|
18
|
+
readonly url: string;
|
|
19
|
+
/** Sent as `Authorization: Bearer <token>`. */
|
|
20
|
+
readonly token?: string;
|
|
21
|
+
readonly timeoutMs?: number;
|
|
22
|
+
readonly maxResponseBytes?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface McpHttpClient extends McpClient {
|
|
25
|
+
listTools(options?: { readonly signal?: AbortSignal }): Promise<readonly { readonly name: string; readonly description?: string }[]>;
|
|
26
|
+
/** Ends the server-side session, if the server issued one. */
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Raised for transport and protocol failures. Messages never include server-supplied text. */
|
|
31
|
+
export class McpTransportError extends Error {}
|
|
32
|
+
|
|
33
|
+
interface Session { readonly protocolVersion: string; readonly sessionId?: string }
|
|
34
|
+
type Reply = { readonly status: number; readonly sessionId: string | null; readonly message: Record<string, unknown> | undefined };
|
|
35
|
+
|
|
36
|
+
export function mcpHttpClient(options: McpHttpClientOptions): McpHttpClient {
|
|
37
|
+
const endpoint = new URL(options.url);
|
|
38
|
+
if (endpoint.protocol !== 'https:' && endpoint.protocol !== 'http:') throw new McpTransportError('The MCP endpoint must be an http(s) URL.');
|
|
39
|
+
const timeoutMs = options.timeoutMs ?? 15_000; const maxBytes = options.maxResponseBytes ?? 1_048_576;
|
|
40
|
+
let nextId = 1; let session: Promise<Session> | undefined;
|
|
41
|
+
|
|
42
|
+
async function readBounded(response: Response): Promise<string> {
|
|
43
|
+
if (!response.body) return '';
|
|
44
|
+
const reader = response.body.getReader(); const chunks: Uint8Array[] = []; let size = 0;
|
|
45
|
+
for (;;) {
|
|
46
|
+
const { done, value } = await reader.read(); if (done) break;
|
|
47
|
+
size += value.byteLength;
|
|
48
|
+
if (size > maxBytes) { await reader.cancel(); throw new McpTransportError('The MCP response exceeded its size limit.'); }
|
|
49
|
+
chunks.push(value);
|
|
50
|
+
}
|
|
51
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(Buffer.concat(chunks));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** One JSON-RPC message per POST. A request's reply is the response with the same id, as JSON or inside an SSE stream. */
|
|
55
|
+
async function post(body: Record<string, unknown>, current: Session | undefined, signal: AbortSignal | undefined): Promise<Reply> {
|
|
56
|
+
const headers: Record<string, string> = { 'content-type': 'application/json', accept: 'application/json, text/event-stream' };
|
|
57
|
+
if (options.token) headers['authorization'] = `Bearer ${options.token}`;
|
|
58
|
+
if (current) headers['mcp-protocol-version'] = current.protocolVersion;
|
|
59
|
+
if (current?.sessionId) headers['mcp-session-id'] = current.sessionId;
|
|
60
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
61
|
+
let response: Response;
|
|
62
|
+
try { response = await fetch(endpoint, { method: 'POST', headers, body: JSON.stringify(body), redirect: 'error', signal: signal ? AbortSignal.any([signal, timeout]) : timeout }); }
|
|
63
|
+
catch { throw new McpTransportError('The MCP server could not be reached.'); }
|
|
64
|
+
const sessionId = response.headers.get('mcp-session-id');
|
|
65
|
+
if (body['id'] === undefined || response.status === 202 || !response.ok) { await response.body?.cancel(); return { status: response.status, sessionId, message: undefined }; }
|
|
66
|
+
const text = await readBounded(response);
|
|
67
|
+
const type = (response.headers.get('content-type') ?? '').split(';')[0]!.trim().toLowerCase();
|
|
68
|
+
const candidates: unknown[] = [];
|
|
69
|
+
try {
|
|
70
|
+
if (type === 'application/json') candidates.push(JSON.parse(text));
|
|
71
|
+
else if (type === 'text/event-stream') {
|
|
72
|
+
for (const event of text.split(/\r?\n\r?\n/u)) {
|
|
73
|
+
const data = event.split(/\r?\n/u).filter(line => line.startsWith('data:')).map(line => line.slice(5).replace(/^ /u, '')).join('\n');
|
|
74
|
+
if (data) candidates.push(JSON.parse(data));
|
|
75
|
+
}
|
|
76
|
+
} else throw new McpTransportError('The MCP server replied with an unsupported content type.');
|
|
77
|
+
} catch (error) { if (error instanceof McpTransportError) throw error; throw new McpTransportError('The MCP server replied with malformed JSON.'); }
|
|
78
|
+
const message = candidates.find((candidate): candidate is Record<string, unknown> =>
|
|
79
|
+
typeof candidate === 'object' && candidate !== null && !Array.isArray(candidate) && (candidate as Record<string, unknown>)['id'] === body['id']);
|
|
80
|
+
return { status: response.status, sessionId, message };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function outcome(reply: Reply): Record<string, unknown> {
|
|
84
|
+
if (reply.status < 200 || reply.status >= 300) throw new McpTransportError(`The MCP server refused the request (HTTP ${reply.status}).`);
|
|
85
|
+
const message = reply.message;
|
|
86
|
+
if (!message || message['jsonrpc'] !== '2.0') throw new McpTransportError('The MCP server sent no valid JSON-RPC response.');
|
|
87
|
+
if (message['error'] !== undefined) throw new McpTransportError('The MCP server returned a JSON-RPC error.');
|
|
88
|
+
const value = message['result'];
|
|
89
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) throw new McpTransportError('The MCP server returned an invalid result.');
|
|
90
|
+
return value as Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function initialize(signal: AbortSignal | undefined): Promise<Session> {
|
|
94
|
+
const reply = await post({ jsonrpc: '2.0', id: nextId++, method: 'initialize',
|
|
95
|
+
params: { protocolVersion: PROTOCOL_VERSION, capabilities: {}, clientInfo: { name: 'mayura-event-automation', version: '0.1.0' } } }, undefined, signal);
|
|
96
|
+
const protocolVersion = outcome(reply)['protocolVersion'];
|
|
97
|
+
if (typeof protocolVersion !== 'string' || !acceptedVersions.has(protocolVersion)) throw new McpTransportError('The MCP server speaks an unsupported protocol version.');
|
|
98
|
+
const sessionId = reply.sessionId !== null && /^[\x21-\x7e]{1,256}$/u.test(reply.sessionId) ? reply.sessionId : undefined;
|
|
99
|
+
const established: Session = { protocolVersion, ...(sessionId ? { sessionId } : {}) };
|
|
100
|
+
const acknowledged = await post({ jsonrpc: '2.0', method: 'notifications/initialized' }, established, signal);
|
|
101
|
+
if (acknowledged.status < 200 || acknowledged.status >= 300) throw new McpTransportError('The MCP server refused the initialized notification.');
|
|
102
|
+
return established;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function request(method: string, params: Record<string, unknown>, signal: AbortSignal | undefined): Promise<Record<string, unknown>> {
|
|
106
|
+
for (let attempt = 0; ; attempt++) {
|
|
107
|
+
const pending = session ??= initialize(signal);
|
|
108
|
+
let current: Session;
|
|
109
|
+
try { current = await pending; } catch (error) { if (session === pending) session = undefined; throw error; }
|
|
110
|
+
const reply = await post({ jsonrpc: '2.0', id: nextId++, method, params }, current, signal);
|
|
111
|
+
// 404 with a session means the server forgot it (for example after a restart); the request was not processed,
|
|
112
|
+
// so starting a new session and sending it once more cannot apply it twice.
|
|
113
|
+
if (reply.status === 404 && current.sessionId && attempt === 0) { if (session === pending) session = undefined; continue; }
|
|
114
|
+
return outcome(reply);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
async callTool(call: McpCallToolRequest): Promise<unknown> {
|
|
120
|
+
const value = await request('tools/call', { name: call.name, arguments: call.arguments }, call.signal);
|
|
121
|
+
// Hand the adapter the tool-result fields it accepts; protocol metadata such as `_meta` stays here.
|
|
122
|
+
return Object.fromEntries(['content', 'structuredContent', 'isError'].filter(key => key in value).map(key => [key, value[key]]));
|
|
123
|
+
},
|
|
124
|
+
async listTools(listOptions = {}) {
|
|
125
|
+
const value = await request('tools/list', {}, listOptions.signal);
|
|
126
|
+
const tools = value['tools'];
|
|
127
|
+
if (!Array.isArray(tools) || tools.length > 1_000) throw new McpTransportError('The MCP server returned an invalid tool list.');
|
|
128
|
+
return tools.flatMap(tool => typeof tool?.name === 'string'
|
|
129
|
+
? [{ name: tool.name as string, ...(typeof tool.description === 'string' ? { description: tool.description as string } : {}) }] : []);
|
|
130
|
+
},
|
|
131
|
+
async close() {
|
|
132
|
+
const current = session ? await session.catch(() => undefined) : undefined; session = undefined;
|
|
133
|
+
if (!current?.sessionId) return;
|
|
134
|
+
const headers: Record<string, string> = { 'mcp-session-id': current.sessionId, 'mcp-protocol-version': current.protocolVersion };
|
|
135
|
+
if (options.token) headers['authorization'] = `Bearer ${options.token}`;
|
|
136
|
+
await fetch(endpoint, { method: 'DELETE', headers, redirect: 'error', signal: AbortSignal.timeout(timeoutMs) }).then(response => response.body?.cancel(), () => undefined);
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -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,29 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { sendDelivery } from './signing.js';
|
|
6
|
+
import { sampleNames, ticketCreatedEvent, type SampleName } from './tracker/samples.js';
|
|
7
|
+
|
|
8
|
+
// Plays the tracker: signs one `ticket.created` delivery and posts it to the webhook ingress.
|
|
9
|
+
// npm run send-sample -- [outage|billing|docs|feature] [--delivery <id>] [--stale] [--forged]
|
|
10
|
+
// --delivery reuses a delivery id (a retry or a replay), --stale signs with a timestamp ten minutes old, and --forged
|
|
11
|
+
// signs with the wrong secret. The URL and secret come from WEBHOOK_URL and WEBHOOK_SECRET, or from the file
|
|
12
|
+
// `npm run dev` writes.
|
|
13
|
+
const { values, positionals } = parseArgs({ allowPositionals: true, options: {
|
|
14
|
+
delivery: { type: 'string' }, stale: { type: 'boolean', default: false }, forged: { type: 'boolean', default: false } } });
|
|
15
|
+
const name = (positionals[0] ?? 'outage') as SampleName;
|
|
16
|
+
if (!sampleNames.includes(name)) throw new Error(`Unknown sample "${name}". Choose one of: ${sampleNames.join(', ')}.`);
|
|
17
|
+
|
|
18
|
+
const target = z.object({ url: z.url({ protocol: /^https?$/u }), secret: z.string().min(32) });
|
|
19
|
+
const fromEnvironment = process.env['WEBHOOK_URL'] && process.env['WEBHOOK_SECRET']
|
|
20
|
+
? { url: process.env['WEBHOOK_URL'], secret: process.env['WEBHOOK_SECRET'] } : undefined;
|
|
21
|
+
let settings;
|
|
22
|
+
try { settings = target.parse(fromEnvironment ?? JSON.parse(await readFile('.data/dev-webhook.json', 'utf8'))); }
|
|
23
|
+
catch { throw new Error('Start `npm run dev` first, or set WEBHOOK_URL and WEBHOOK_SECRET.'); }
|
|
24
|
+
|
|
25
|
+
const deliveryId = values.delivery ?? `sample-${name}-${randomBytes(4).toString('hex')}`;
|
|
26
|
+
const secret = values.forged ? randomBytes(32).toString('hex') : settings.secret;
|
|
27
|
+
const timestampMs = Date.now() - (values.stale ? 600_000 : 0);
|
|
28
|
+
const { status, body } = await sendDelivery(settings.url, secret, { deliveryId, event: ticketCreatedEvent(name), timestampMs });
|
|
29
|
+
console.log(JSON.stringify({ deliveryId, status, response: body }, null, 2));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createAggregateSubmissionJournal } from 'mayura/storage-contracts';
|
|
2
|
+
import { listenAgentServer, listenProductionServer } from 'mayura/server-node';
|
|
3
|
+
import { createWorkflowCommandJournal, 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 { startWebhookIngress } from './ingress.js';
|
|
8
|
+
import type { Services } from './services.js';
|
|
9
|
+
|
|
10
|
+
export interface RunningServer { readonly origin: string; readonly webhookUrl: string; isAccepting(): boolean; close(): Promise<void> }
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The HTTP side, as one handle: the Mayura server (operator console at /inspector, operator API) and the webhook
|
|
14
|
+
* ingress on its own port. Verified deliveries start durable runs; the worker advances them. Nothing here calls the
|
|
15
|
+
* tracker.
|
|
16
|
+
*/
|
|
17
|
+
export async function startServer(config: Config, services: Services): Promise<RunningServer> {
|
|
18
|
+
const { store, workflows, runtimeOptions, fleet, triage } = services; const { scope } = config;
|
|
19
|
+
const runtime = createWorkflowLifecycleFleetRuntime({ ...runtimeOptions, verifyHuman: verifyApprover(scope.projectId) });
|
|
20
|
+
// Production operator adapters: journaled commands (a retried command id never applies twice), revision checks,
|
|
21
|
+
// views across every registered definition, pending approvals with their exact tool call, and the fleet hold.
|
|
22
|
+
const operator = createWorkflowOperatorTransports({ store, scope, journal: createWorkflowCommandJournal({ store, scope }), fleet,
|
|
23
|
+
targets: [lifecycleOperatorTarget({ runtime, store, scope, definitions: [...workflows.definitions], approvalCredential })] });
|
|
24
|
+
const settings = {
|
|
25
|
+
// The triage agent is registered so operators can see its definition in the console. It runs inside the durable
|
|
26
|
+
// intake workflow; no caller of this API holds `runs:submit`, so it cannot be started from here.
|
|
27
|
+
agents: [{ agent: triage.agent, permissions: { allow: [...triage.grants] }, limits: triage.limits }],
|
|
28
|
+
authenticate: authenticate(config, [triage.agent.id]),
|
|
29
|
+
submissionJournal: createAggregateSubmissionJournal(store),
|
|
30
|
+
inspector: true,
|
|
31
|
+
allowedOrigins: config.server.allowedOrigins,
|
|
32
|
+
...operator,
|
|
33
|
+
limits: { maxRequests: 256, maxRuns: 16, maxWorkflowOperations: 32, requestTimeoutMs: 30_000 },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
let api: { readonly origin: string; isAccepting(): boolean; close(): Promise<void> };
|
|
37
|
+
if (config.environment === 'production') {
|
|
38
|
+
const server = await listenProductionServer({ ...settings, publicOrigin: config.server.publicOrigin!, hostname: config.server.bind,
|
|
39
|
+
port: config.server.port, tls: { terminatedBy: 'proxy' },
|
|
40
|
+
readiness: async () => { await store.read('readiness', 'probe'); return true; } });
|
|
41
|
+
api = { origin: server.publicOrigin, isAccepting: () => server.isAccepting(), close: () => server.close() };
|
|
42
|
+
} else {
|
|
43
|
+
// Development: loopback only, plain HTTP.
|
|
44
|
+
const server = await listenAgentServer({ ...settings, port: config.server.port });
|
|
45
|
+
let accepting = true;
|
|
46
|
+
api = { origin: server.origin, isAccepting: () => accepting, close: async () => { accepting = false; await server.close(); } };
|
|
47
|
+
}
|
|
48
|
+
let ingress;
|
|
49
|
+
try { ingress = await startWebhookIngress(config, services); }
|
|
50
|
+
catch (error) { await api.close(); runtime.close(); throw error; }
|
|
51
|
+
const webhooks = ingress;
|
|
52
|
+
return {
|
|
53
|
+
origin: api.origin, webhookUrl: webhooks.url,
|
|
54
|
+
isAccepting: () => api.isAccepting() && webhooks.isAccepting(),
|
|
55
|
+
// Stop taking deliveries first, then the API.
|
|
56
|
+
close: async () => { await webhooks.close(); await api.close(); runtime.close(); },
|
|
57
|
+
};
|
|
58
|
+
}
|