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,366 @@
|
|
|
1
|
+
import { MayuraError, assertPositiveInteger } from './errors.js';
|
|
2
|
+
|
|
3
|
+
export interface Reservation {
|
|
4
|
+
/** Settle only confirmed cost. Unknown cost deliberately retains the complete reservation. */
|
|
5
|
+
settle(actualMicros: number): void;
|
|
6
|
+
/** Atomically charge confirmed usage, retain an unresolved bound and release unused capacity. */
|
|
7
|
+
settleUsage(knownCostMicros: number, unknownCostMicros: number): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** One fixed-cost future execution; IDs remain unique throughout their shared ledger's lifetime. */
|
|
11
|
+
export interface BundleOperation {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly maxCostMicros: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Genuine receiver-bound authority for one held execution, not an executor or a transferable ID. */
|
|
17
|
+
export interface BudgetTicket {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly maxCostMicros: number;
|
|
20
|
+
/** Consume one held call exactly once. Monetary settlement remains independently required. */
|
|
21
|
+
start(): Reservation;
|
|
22
|
+
/** Release only never-started capacity, including after account closure; repeated cancellation is harmless. */
|
|
23
|
+
cancel(): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Atomically admitted future calls. Closure cancels held tickets, never already-started usage. */
|
|
27
|
+
export interface BudgetBundle {
|
|
28
|
+
readonly tickets: readonly BudgetTicket[];
|
|
29
|
+
close(): void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Child limits are ceilings on shared funds, not prepaid allocations or guaranteed earmarks. */
|
|
33
|
+
export interface BudgetForkOptions {
|
|
34
|
+
/** Unique within the entire ledger; root is reserved and closed identities cannot be reused. */
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly maxCostMicros: number;
|
|
37
|
+
readonly maxCalls: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Correlate account usage without exposing an authority-bearing parent/root account reference. */
|
|
41
|
+
export interface BudgetIdentity {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly parentId?: string;
|
|
44
|
+
/** Root identity is included; the root has depth zero. */
|
|
45
|
+
readonly lineage: readonly string[];
|
|
46
|
+
readonly depth: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface BudgetSnapshot {
|
|
50
|
+
readonly spentMicros: number | string;
|
|
51
|
+
readonly reservedMicros: number;
|
|
52
|
+
readonly calls: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface Ledger {
|
|
56
|
+
readonly ids: Set<string>;
|
|
57
|
+
readonly ticketIds: Set<string>;
|
|
58
|
+
/** Only named bundle tickets count here: held plus started but not yet validly settled. */
|
|
59
|
+
outstandingTickets: number;
|
|
60
|
+
blocked: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface Account {
|
|
63
|
+
readonly ledger: Ledger;
|
|
64
|
+
readonly ancestors: readonly Account[];
|
|
65
|
+
readonly identity: BudgetIdentity;
|
|
66
|
+
readonly maxCostMicros: number;
|
|
67
|
+
readonly maxCalls: number;
|
|
68
|
+
reserved: bigint;
|
|
69
|
+
spent: bigint;
|
|
70
|
+
calls: number;
|
|
71
|
+
heldCalls: number;
|
|
72
|
+
closed: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface TicketState {
|
|
76
|
+
readonly account: Account;
|
|
77
|
+
readonly path: readonly Account[];
|
|
78
|
+
readonly maxCostMicros: number;
|
|
79
|
+
readonly bound: bigint;
|
|
80
|
+
status: 'held' | 'started' | 'cancelled' | 'settled' | 'unknown';
|
|
81
|
+
}
|
|
82
|
+
interface BundleState { readonly tickets: readonly TicketState[]; closed: boolean }
|
|
83
|
+
|
|
84
|
+
const maximumAccounts = 1_024;
|
|
85
|
+
const maximumDepth = 32;
|
|
86
|
+
const maximumBundleOperations = 128;
|
|
87
|
+
const maximumOutstandingTickets = 1_024;
|
|
88
|
+
const maximumTicketIds = 16_384;
|
|
89
|
+
const safeInteger = BigInt(Number.MAX_SAFE_INTEGER);
|
|
90
|
+
// Runtime-private state prevents JavaScript writes to TypeScript-only private/readonly fields.
|
|
91
|
+
const accounts = new WeakMap<Budget, Account>();
|
|
92
|
+
const tickets = new WeakMap<BudgetTicket, TicketState>();
|
|
93
|
+
const bundles = new WeakMap<BudgetBundle, BundleState>();
|
|
94
|
+
|
|
95
|
+
function costLimit(value: number): void {
|
|
96
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new MayuraError('INVALID_CONFIG', 'maxCostMicros must be a non-negative safe integer.');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Reject structural lookalikes, inherited prototypes, and proxy wrappers around real accounts. */
|
|
100
|
+
export function assertBudget(value: unknown): asserts value is Budget {
|
|
101
|
+
if (typeof value !== 'object' || value === null || !accounts.has(value as Budget)) {
|
|
102
|
+
throw new MayuraError('INVALID_CONFIG', 'A genuine shared execution Budget is required.');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Trusted-host ownership check; a common ledger or copied identity does not convey this account's authority. */
|
|
107
|
+
export function assertBudgetTicket(value: unknown, owner: Budget): asserts value is BudgetTicket {
|
|
108
|
+
assertBudget(owner);
|
|
109
|
+
const ticket = typeof value === 'object' && value !== null ? tickets.get(value as BudgetTicket) : undefined;
|
|
110
|
+
if (!ticket || ticket.account !== accounts.get(owner)) {
|
|
111
|
+
throw new MayuraError('INVALID_CONFIG', 'A genuine execution ticket owned by the exact account is required.');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function accountFor(value: Budget): Account {
|
|
116
|
+
assertBudget(value);
|
|
117
|
+
return accounts.get(value)!;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function pathFor(account: Account): readonly Account[] { return [...account.ancestors, account]; }
|
|
121
|
+
|
|
122
|
+
function assertOpen(account: Account, path: readonly Account[]): void {
|
|
123
|
+
if (account.ledger.blocked || path.some(ancestor => ancestor.closed)) {
|
|
124
|
+
throw new MayuraError('BUDGET_EXCEEDED', 'Execution budget admissions are closed; no new call was dispatched.');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Snapshot child configuration without invoking accessor properties or reflecting thrown text. */
|
|
129
|
+
function forkOptions(value: BudgetForkOptions): BudgetForkOptions {
|
|
130
|
+
let id: unknown; let maxCostMicros: unknown; let maxCalls: unknown;
|
|
131
|
+
try {
|
|
132
|
+
if (!value || typeof value !== 'object' || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new Error();
|
|
133
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
134
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
135
|
+
if (keys.length !== 3 || keys.some(key => !['id', 'maxCostMicros', 'maxCalls'].includes(key as string))) throw new Error();
|
|
136
|
+
for (const key of ['id', 'maxCostMicros', 'maxCalls'] as const) if (!descriptors[key] || !('value' in descriptors[key])) throw new Error();
|
|
137
|
+
id = descriptors['id']!.value; maxCostMicros = descriptors['maxCostMicros']!.value; maxCalls = descriptors['maxCalls']!.value;
|
|
138
|
+
} catch { throw new MayuraError('INVALID_CONFIG', 'Child budget configuration must contain plain data fields.'); }
|
|
139
|
+
if (typeof id !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(id)) {
|
|
140
|
+
throw new MayuraError('INVALID_CONFIG', 'Child budget ID must be a bounded stable identifier.');
|
|
141
|
+
}
|
|
142
|
+
costLimit(maxCostMicros as number); assertPositiveInteger(maxCalls as number, 'maxCalls');
|
|
143
|
+
return { id, maxCostMicros: maxCostMicros as number, maxCalls: maxCalls as number };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Snapshot every supplied descriptor before checking mutable ledger state; never execute getters or iterators. */
|
|
147
|
+
function bundleOperations(value: readonly BundleOperation[]): readonly BundleOperation[] {
|
|
148
|
+
const excessiveLength = Symbol('bundle-length');
|
|
149
|
+
try {
|
|
150
|
+
if (!Array.isArray(value)) throw new Error();
|
|
151
|
+
const length = Object.getOwnPropertyDescriptor(value, 'length');
|
|
152
|
+
if (!length || !('value' in length) || !Number.isSafeInteger(length.value) || length.value < 1) throw new Error();
|
|
153
|
+
if (length.value > maximumBundleOperations) throw excessiveLength;
|
|
154
|
+
const size = length.value as number;
|
|
155
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
156
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
157
|
+
if (keys.length !== size + 1 || keys.some(key => key !== 'length'
|
|
158
|
+
&& (typeof key !== 'string' || !/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= size))) throw new Error();
|
|
159
|
+
const result: BundleOperation[] = [];
|
|
160
|
+
for (let index = 0; index < size; index++) {
|
|
161
|
+
const descriptor = descriptors[String(index)];
|
|
162
|
+
if (!descriptor || !('value' in descriptor)) throw new Error();
|
|
163
|
+
const operation = descriptor.value as unknown;
|
|
164
|
+
if (!operation || typeof operation !== 'object' || ![Object.prototype, null].includes(Object.getPrototypeOf(operation))) throw new Error();
|
|
165
|
+
const fields = Object.getOwnPropertyDescriptors(operation);
|
|
166
|
+
const fieldKeys = Reflect.ownKeys(fields);
|
|
167
|
+
if (fieldKeys.length !== 2 || fieldKeys.some(key => key !== 'id' && key !== 'maxCostMicros')
|
|
168
|
+
|| !fields['id'] || !('value' in fields['id']) || !fields['maxCostMicros'] || !('value' in fields['maxCostMicros'])) throw new Error();
|
|
169
|
+
const id: unknown = fields['id'].value; const maxCostMicros: unknown = fields['maxCostMicros'].value;
|
|
170
|
+
if (typeof id !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/.test(id)
|
|
171
|
+
|| typeof maxCostMicros !== 'number' || !Number.isSafeInteger(maxCostMicros) || maxCostMicros < 0) throw new Error();
|
|
172
|
+
result.push({ id, maxCostMicros });
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
} catch (error) {
|
|
176
|
+
if (error === excessiveLength) throw new MayuraError('LIMIT_EXCEEDED', 'The execution bundle operation limit was reached.');
|
|
177
|
+
throw new MayuraError('INVALID_CONFIG', 'Bundle operations must be a bounded list of plain execution identities and cost bounds.');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Existing settlement semantics, shared by ordinary reservations and consumed bundle tickets. */
|
|
182
|
+
function reservationFor(account: Account, path: readonly Account[], maxMicros: number, ticket?: TicketState): Reservation {
|
|
183
|
+
const bound = BigInt(maxMicros); let settled = false;
|
|
184
|
+
const settleUsage = (knownCostMicros: number, unknownCostMicros: number): void => {
|
|
185
|
+
if (settled) throw new MayuraError('CONFLICT', 'Reservation is already settled.');
|
|
186
|
+
if (!Number.isSafeInteger(knownCostMicros) || knownCostMicros < 0
|
|
187
|
+
|| !Number.isSafeInteger(unknownCostMicros) || unknownCostMicros < 0) {
|
|
188
|
+
throw new MayuraError('BUDGET_EXCEEDED', 'Reported cost is invalid; reservation retained.');
|
|
189
|
+
}
|
|
190
|
+
settled = true;
|
|
191
|
+
const known = BigInt(knownCostMicros); const unknown = BigInt(unknownCostMicros);
|
|
192
|
+
// Closing, cancellation, or another reservation's overrun never discards known late usage.
|
|
193
|
+
for (const ancestor of path) { ancestor.reserved -= bound; ancestor.reserved += unknown; ancestor.spent += known; }
|
|
194
|
+
if (ticket) {
|
|
195
|
+
ticket.status = unknownCostMicros === 0 ? 'settled' : 'unknown';
|
|
196
|
+
if (unknownCostMicros === 0) account.ledger.outstandingTickets--;
|
|
197
|
+
}
|
|
198
|
+
if (known + unknown > bound) {
|
|
199
|
+
account.ledger.blocked = true;
|
|
200
|
+
throw new MayuraError('BUDGET_EXCEEDED', 'Reported usage exceeded its bound; known and unresolved usage were retained.');
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
settle: (actualMicros: number): void => { settleUsage(actualMicros, 0); },
|
|
205
|
+
settleUsage,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function ticketFor(value: BudgetTicket): TicketState {
|
|
210
|
+
const ticket = tickets.get(value);
|
|
211
|
+
if (!ticket) throw new MayuraError('INVALID_CONFIG', 'A genuine execution ticket receiver is required.');
|
|
212
|
+
return ticket;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Private cleanup deliberately ignores closure and overruns: undispatched holds are still releasable. */
|
|
216
|
+
function cancelHeld(ticket: TicketState): void {
|
|
217
|
+
ticket.status = 'cancelled';
|
|
218
|
+
for (const ancestor of ticket.path) { ancestor.heldCalls--; ancestor.reserved -= ticket.bound; }
|
|
219
|
+
ticket.account.ledger.outstandingTickets--;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function startTicket(this: BudgetTicket): Reservation {
|
|
223
|
+
const ticket = ticketFor(this);
|
|
224
|
+
if (ticket.status !== 'held') throw new MayuraError('CONFLICT', 'Execution ticket is no longer held.');
|
|
225
|
+
assertOpen(ticket.account, ticket.path);
|
|
226
|
+
// Every admission already counts these held slots; converting one cannot increase total capacity use.
|
|
227
|
+
ticket.status = 'started';
|
|
228
|
+
for (const ancestor of ticket.path) { ancestor.heldCalls--; ancestor.calls++; }
|
|
229
|
+
return reservationFor(ticket.account, ticket.path, ticket.maxCostMicros, ticket);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function cancelTicket(this: BudgetTicket): void {
|
|
233
|
+
const ticket = ticketFor(this);
|
|
234
|
+
if (ticket.status === 'cancelled') return;
|
|
235
|
+
if (ticket.status !== 'held') throw new MayuraError('CONFLICT', 'Started execution tickets cannot be cancelled.');
|
|
236
|
+
cancelHeld(ticket);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function closeBundle(this: BudgetBundle): void {
|
|
240
|
+
const bundle = bundles.get(this);
|
|
241
|
+
if (!bundle) throw new MayuraError('INVALID_CONFIG', 'A genuine execution bundle receiver is required.');
|
|
242
|
+
if (bundle.closed) return;
|
|
243
|
+
for (const ticket of bundle.tickets) if (ticket.status === 'held') cancelHeld(ticket);
|
|
244
|
+
bundle.closed = true;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Process-local shared synchronous ledger. Reserve before awaits so children cannot spend
|
|
249
|
+
* the same remaining funds. Ancestor totals include descendants and must not be added together.
|
|
250
|
+
* Every admitted execution counts once at each ancestor, even when its monetary bound is zero.
|
|
251
|
+
* Accounts are final, frozen authority handles; they are not a sandbox for arbitrary local code.
|
|
252
|
+
*/
|
|
253
|
+
export class Budget {
|
|
254
|
+
constructor(readonly maxCostMicros: number, readonly maxCalls: number) {
|
|
255
|
+
if (new.target !== Budget) throw new MayuraError('INVALID_CONFIG', 'Budget accounts cannot be subclassed.');
|
|
256
|
+
costLimit(maxCostMicros); assertPositiveInteger(maxCalls, 'maxCalls');
|
|
257
|
+
accounts.set(this, {
|
|
258
|
+
ledger: { ids: new Set(['root']), ticketIds: new Set(), outstandingTickets: 0, blocked: false }, ancestors: Object.freeze([]),
|
|
259
|
+
identity: Object.freeze({ id: 'root', lineage: Object.freeze(['root']), depth: 0 }),
|
|
260
|
+
maxCostMicros, maxCalls, reserved: 0n, spent: 0n, calls: 0, heldCalls: 0, closed: false,
|
|
261
|
+
});
|
|
262
|
+
Object.freeze(this);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Frozen correlation metadata; contains no reference through which a child could spend as its parent. */
|
|
266
|
+
get identity(): BudgetIdentity { return accountFor(this).identity; }
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Create a child ceiling without consuming funds or calls. Children compete for remaining
|
|
270
|
+
* ancestor capacity at reserve time. At most 1,024 lifetime accounts and depth 32 per ledger.
|
|
271
|
+
*/
|
|
272
|
+
fork(options: BudgetForkOptions): Budget {
|
|
273
|
+
const parent = accountFor(this); const path = pathFor(parent);
|
|
274
|
+
const config = forkOptions(options);
|
|
275
|
+
assertOpen(parent, path);
|
|
276
|
+
if (config.maxCostMicros > parent.maxCostMicros || config.maxCalls > parent.maxCalls) {
|
|
277
|
+
throw new MayuraError('INVALID_CONFIG', 'Child ceilings cannot exceed their parent ceilings.');
|
|
278
|
+
}
|
|
279
|
+
if (parent.ledger.ids.has(config.id)) throw new MayuraError('CONFLICT', 'The budget account identity is already in use.');
|
|
280
|
+
if (parent.identity.depth >= maximumDepth || parent.ledger.ids.size >= maximumAccounts) {
|
|
281
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The budget account count or ancestry depth limit was reached.');
|
|
282
|
+
}
|
|
283
|
+
const child = new Budget(config.maxCostMicros, config.maxCalls);
|
|
284
|
+
const identity: BudgetIdentity = Object.freeze({ id: config.id, parentId: parent.identity.id,
|
|
285
|
+
lineage: Object.freeze([...parent.identity.lineage, config.id]), depth: parent.identity.depth + 1,
|
|
286
|
+
});
|
|
287
|
+
accounts.set(child, { ledger: parent.ledger, ancestors: Object.freeze(path), identity,
|
|
288
|
+
maxCostMicros: config.maxCostMicros, maxCalls: config.maxCalls, reserved: 0n, spent: 0n, calls: 0, heldCalls: 0, closed: false,
|
|
289
|
+
});
|
|
290
|
+
parent.ledger.ids.add(config.id);
|
|
291
|
+
return child;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** Atomically reserve every ancestor before dispatch; rejected admission changes no counter. */
|
|
295
|
+
reserve(maxMicros: number): Reservation {
|
|
296
|
+
const account = accountFor(this); const path = Object.freeze(pathFor(account));
|
|
297
|
+
if (!Number.isSafeInteger(maxMicros) || maxMicros < 0) throw new MayuraError('INVALID_CONFIG', 'A non-negative safe-integer cost bound is required.');
|
|
298
|
+
assertOpen(account, path);
|
|
299
|
+
const bound = BigInt(maxMicros);
|
|
300
|
+
if (path.some(ancestor => ancestor.heldCalls >= ancestor.maxCalls - ancestor.calls || bound > BigInt(ancestor.maxCostMicros) - ancestor.spent - ancestor.reserved)) {
|
|
301
|
+
throw new MayuraError('BUDGET_EXCEEDED', 'Execution budget exhausted; no new call was dispatched.');
|
|
302
|
+
}
|
|
303
|
+
// No callback or await can interleave ancestor validation and commit.
|
|
304
|
+
for (const ancestor of path) { ancestor.calls++; ancestor.reserved += bound; }
|
|
305
|
+
return reservationFor(account, path, maxMicros);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Atomically protect 1–128 future calls and their money on this account and every ancestor.
|
|
310
|
+
* Each ledger permits 1,024 held/unsettled bundle tickets and 16,384 lifetime ticket identities.
|
|
311
|
+
* Held calls do not count as consumed calls until start; failed admission never burns identities.
|
|
312
|
+
* IDs use 1–256 ASCII letters/digits plus internal '.', '_', ':', '/', or '-'.
|
|
313
|
+
*/
|
|
314
|
+
reserveBundle(operations: readonly BundleOperation[]): BudgetBundle {
|
|
315
|
+
const account = accountFor(this); const path = Object.freeze(pathFor(account));
|
|
316
|
+
const config = bundleOperations(operations);
|
|
317
|
+
const identities = new Set(config.map(operation => operation.id));
|
|
318
|
+
const bound = config.reduce((total, operation) => total + BigInt(operation.maxCostMicros), 0n);
|
|
319
|
+
// Reflection above can invoke a trusted Proxy trap that reenters this account. Therefore all
|
|
320
|
+
// mutable ledger predicates are evaluated only after the complete descriptor snapshot.
|
|
321
|
+
assertOpen(account, path);
|
|
322
|
+
if (identities.size !== config.length || config.some(operation => account.ledger.ticketIds.has(operation.id))) {
|
|
323
|
+
throw new MayuraError('CONFLICT', 'An execution ticket identity is already in use.');
|
|
324
|
+
}
|
|
325
|
+
if (account.ledger.outstandingTickets + config.length > maximumOutstandingTickets
|
|
326
|
+
|| account.ledger.ticketIds.size + config.length > maximumTicketIds) {
|
|
327
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The execution ticket count or lifetime identity limit was reached.');
|
|
328
|
+
}
|
|
329
|
+
if (path.some(ancestor => config.length > ancestor.maxCalls - ancestor.calls - ancestor.heldCalls
|
|
330
|
+
|| bound > BigInt(ancestor.maxCostMicros) - ancestor.spent - ancestor.reserved)) {
|
|
331
|
+
throw new MayuraError('BUDGET_EXCEEDED', 'Execution budget exhausted; no future call was admitted.');
|
|
332
|
+
}
|
|
333
|
+
const states: TicketState[] = [];
|
|
334
|
+
const handles = config.map(operation => {
|
|
335
|
+
const state: TicketState = { account, path, maxCostMicros: operation.maxCostMicros, bound: BigInt(operation.maxCostMicros), status: 'held' };
|
|
336
|
+
const handle: BudgetTicket = Object.freeze({ id: operation.id, maxCostMicros: operation.maxCostMicros, start: startTicket, cancel: cancelTicket });
|
|
337
|
+
states.push(state); tickets.set(handle, state); return handle;
|
|
338
|
+
});
|
|
339
|
+
const bundle: BudgetBundle = Object.freeze({ tickets: Object.freeze(handles), close: closeBundle });
|
|
340
|
+
bundles.set(bundle, { tickets: Object.freeze(states), closed: false });
|
|
341
|
+
for (const ancestor of path) { ancestor.reserved += bound; ancestor.heldCalls += config.length; }
|
|
342
|
+
for (const operation of config) account.ledger.ticketIds.add(operation.id);
|
|
343
|
+
account.ledger.outstandingTickets += config.length;
|
|
344
|
+
return bundle;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** Frozen future-call capacity, including descendants; additive to the unchanged usage snapshot. */
|
|
348
|
+
capacitySnapshot(): Readonly<{ heldCalls: number }> {
|
|
349
|
+
return Object.freeze({ heldCalls: accountFor(this).heldCalls });
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/** Stop new reserves/forks/starts throughout this subtree; explicit cleanup and late settlement remain valid. */
|
|
353
|
+
close(): void { accountFor(this).closed = true; }
|
|
354
|
+
|
|
355
|
+
/** Very large provider overruns use an exact decimal string instead of a lossy JSON number. */
|
|
356
|
+
snapshot(): Readonly<BudgetSnapshot> {
|
|
357
|
+
const account = accountFor(this);
|
|
358
|
+
const spentMicros = account.spent <= safeInteger ? Number(account.spent) : account.spent.toString();
|
|
359
|
+
// Reservations remain bounded by the originally configured safe-integer ceiling, even after overruns.
|
|
360
|
+
return Object.freeze({ spentMicros, reservedMicros: Number(account.reserved), calls: account.calls });
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Protect the owned method table as well as instances; this does not modify host/built-in prototypes.
|
|
365
|
+
Object.freeze(Budget.prototype);
|
|
366
|
+
Object.freeze(Budget);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { PublicError } from './errors.js';
|
|
2
|
+
import { MayuraError } from './errors.js';
|
|
3
|
+
import type { JsonValue, JsonObject } from './json.js';
|
|
4
|
+
|
|
5
|
+
export interface Scope { readonly principalId: string; readonly projectId: string }
|
|
6
|
+
export type Effect = 'none' | 'read' | 'write' | 'host';
|
|
7
|
+
export interface Permissions { readonly allow: readonly string[] }
|
|
8
|
+
export interface ExecutionContext {
|
|
9
|
+
readonly runId: string;
|
|
10
|
+
readonly callId: string;
|
|
11
|
+
readonly scope: Scope;
|
|
12
|
+
readonly signal: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
export interface ExecutionReceipt {
|
|
15
|
+
readonly callId: string;
|
|
16
|
+
readonly toolId: string;
|
|
17
|
+
readonly execution: 'not_started' | 'succeeded' | 'failed' | 'unknown';
|
|
18
|
+
readonly disclosure: 'released' | 'withheld';
|
|
19
|
+
}
|
|
20
|
+
/** Confirmed and unresolved cost within one pre-admitted execution bound. */
|
|
21
|
+
export interface ExecutionSettlement {
|
|
22
|
+
readonly knownCostMicros: number;
|
|
23
|
+
readonly unknownCostMicros: number;
|
|
24
|
+
}
|
|
25
|
+
/** Run-qualified evidence: call identifiers alone are not unique across descendants. */
|
|
26
|
+
export interface ExecutionEvidence {
|
|
27
|
+
readonly runId: string;
|
|
28
|
+
readonly receipt: ExecutionReceipt;
|
|
29
|
+
}
|
|
30
|
+
export type Outcome<T> =
|
|
31
|
+
| { readonly status: 'succeeded'; readonly output: T; readonly receipt?: ExecutionReceipt; readonly evidence?: readonly ExecutionEvidence[] }
|
|
32
|
+
| { readonly status: 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown'; readonly error: PublicError; readonly receipt?: ExecutionReceipt; readonly evidence?: readonly ExecutionEvidence[] };
|
|
33
|
+
export interface RunEvent {
|
|
34
|
+
readonly runId: string;
|
|
35
|
+
readonly sequence: number;
|
|
36
|
+
readonly timestamp: string;
|
|
37
|
+
readonly type: 'run.started' | 'model.started' | 'model.completed' | 'tool.started' | 'tool.completed'
|
|
38
|
+
| 'hook.started' | 'hook.completed' | 'step.started' | 'step.completed' | 'delegate.started' | 'delegate.completed'
|
|
39
|
+
| 'run.completed' | 'events.gap' | 'output.delta' | 'output.withheld';
|
|
40
|
+
readonly metadata: Readonly<Record<string, string | number | boolean>>;
|
|
41
|
+
}
|
|
42
|
+
export interface RunHandle<T> {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly profile: 'ephemeral';
|
|
45
|
+
result(): Promise<Outcome<T>>;
|
|
46
|
+
observe(options?: { readonly after?: number; readonly signal?: AbortSignal }): AsyncIterable<RunEvent>;
|
|
47
|
+
cancel(): void;
|
|
48
|
+
}
|
|
49
|
+
export interface GuardContext extends ExecutionContext { readonly boundary: 'input' | 'output' }
|
|
50
|
+
/**
|
|
51
|
+
* A guard allows content, blocks it, or rewrites it (for example to redact personal data). A rewritten value replaces
|
|
52
|
+
* the content for the guards after it and is validated again against the boundary's schema before anything uses it.
|
|
53
|
+
*/
|
|
54
|
+
export type GuardVerdict = { readonly decision: 'allow' } | { readonly decision: 'block'; readonly reason?: string }
|
|
55
|
+
| { readonly decision: 'rewrite'; readonly value: JsonValue };
|
|
56
|
+
export interface Guard {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
check(value: JsonValue, context: GuardContext): Promise<GuardVerdict> | GuardVerdict;
|
|
59
|
+
}
|
|
60
|
+
export interface ModelTool {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly description: string;
|
|
63
|
+
readonly inputJsonSchema?: JsonObject;
|
|
64
|
+
}
|
|
65
|
+
export type ModelMessage =
|
|
66
|
+
| { readonly role: 'user'; readonly content: JsonValue }
|
|
67
|
+
| { readonly role: 'assistant'; readonly calls: readonly ModelToolCall[] }
|
|
68
|
+
| { readonly role: 'tool'; readonly callId: string; readonly toolId: string; readonly result: JsonValue };
|
|
69
|
+
export interface ModelToolCall { readonly id: string; readonly toolId: string; readonly input: JsonValue }
|
|
70
|
+
export interface ModelRequest {
|
|
71
|
+
readonly instructions: string;
|
|
72
|
+
readonly messages: readonly ModelMessage[];
|
|
73
|
+
readonly tools: readonly ModelTool[];
|
|
74
|
+
readonly signal: AbortSignal;
|
|
75
|
+
readonly maxOutputTokens: number;
|
|
76
|
+
/** Opaque bounded provider protocol state; private to this run and never a public output. */
|
|
77
|
+
readonly continuation?: JsonValue;
|
|
78
|
+
}
|
|
79
|
+
export interface ModelUsage { readonly costMicros: number }
|
|
80
|
+
/** A failed provider invocation may still have confirmed billable usage. No raw failure text is accepted. */
|
|
81
|
+
export class ModelInvocationError extends MayuraError {
|
|
82
|
+
constructor(readonly costMicros: number) {
|
|
83
|
+
super('MODEL_FAILED', 'The model invocation failed after reporting known usage.');
|
|
84
|
+
if (!Number.isSafeInteger(costMicros) || costMicros < 0) throw new MayuraError('INVALID_CONFIG', 'Known model usage must be a nonnegative safe integer.');
|
|
85
|
+
Object.freeze(this);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export type ModelResponse =
|
|
89
|
+
| { readonly type: 'final'; readonly output: JsonValue; readonly usage: ModelUsage; readonly continuation?: JsonValue }
|
|
90
|
+
| { readonly type: 'tool_calls'; readonly calls: readonly ModelToolCall[]; readonly usage: ModelUsage; readonly continuation?: JsonValue };
|
|
91
|
+
/** Model adapters are trusted code; declared bounds are enforced/accounted, not a provider billing guarantee. */
|
|
92
|
+
/**
|
|
93
|
+
* One event of a streamed model call: fragments of the final output's raw text as the provider produces them, then
|
|
94
|
+
* exactly one complete response. The complete response is validated and accounted exactly as `generate` would return
|
|
95
|
+
* it; fragments are provisional and never authoritative. Tool-call argument fragments and reasoning are never emitted.
|
|
96
|
+
*/
|
|
97
|
+
export type ModelStreamEvent =
|
|
98
|
+
| { readonly type: 'output.delta'; readonly text: string }
|
|
99
|
+
| { readonly type: 'response'; readonly response: ModelResponse };
|
|
100
|
+
export interface ModelAdapter {
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly capabilities: { readonly tools: boolean; readonly structuredOutput: boolean };
|
|
103
|
+
readonly maxCostMicros: number;
|
|
104
|
+
generate(request: ModelRequest): Promise<ModelResponse>;
|
|
105
|
+
/** Optional streamed form of `generate`, used only for agents that opt into streaming. */
|
|
106
|
+
stream?(request: ModelRequest): AsyncIterable<ModelStreamEvent>;
|
|
107
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Stable public errors deliberately exclude raw adapter exceptions and rejected values. */
|
|
2
|
+
export type ErrorCode =
|
|
3
|
+
| 'INVALID_CONFIG' | 'INVALID_INPUT' | 'INVALID_OUTPUT' | 'INVALID_JSON'
|
|
4
|
+
| 'PERMISSION_DENIED' | 'BUDGET_EXCEEDED' | 'LIMIT_EXCEEDED'
|
|
5
|
+
| 'CANCELLED' | 'TIMEOUT' | 'TOOL_FAILED' | 'MODEL_FAILED'
|
|
6
|
+
| 'GUARD_BLOCKED' | 'GUARD_UNAVAILABLE' | 'OUTCOME_UNKNOWN'
|
|
7
|
+
| 'UNSUPPORTED_PROFILE' | 'NOT_FOUND' | 'CONFLICT' | 'STORAGE_UNAVAILABLE'
|
|
8
|
+
| 'INTEGRITY_VIOLATION';
|
|
9
|
+
|
|
10
|
+
export interface PublicError {
|
|
11
|
+
readonly code: ErrorCode;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A safe, stable boundary error. Never populate message with secrets or raw provider output. */
|
|
16
|
+
export class MayuraError extends Error {
|
|
17
|
+
override readonly name = 'MayuraError';
|
|
18
|
+
constructor(readonly code: ErrorCode, message: string) { super(message); }
|
|
19
|
+
toJSON(): PublicError { return { code: this.code, message: this.message }; }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Adapter exceptions are untrusted: replace unknown messages rather than reflecting them. */
|
|
23
|
+
export function publicError(error: unknown, fallback: ErrorCode = 'TOOL_FAILED'): PublicError {
|
|
24
|
+
return error instanceof MayuraError
|
|
25
|
+
? error.toJSON()
|
|
26
|
+
: { code: fallback, message: 'The operation failed. Inspect authorized local diagnostics.' };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function assertPositiveInteger(value: number, name: string): void {
|
|
30
|
+
if (!Number.isSafeInteger(value) || value <= 0) {
|
|
31
|
+
throw new MayuraError('INVALID_CONFIG', `${name} must be a positive safe integer.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { MayuraError } from './errors.js';
|
|
2
|
+
import type { ModelResponse, ModelStreamEvent } from './contracts.js';
|
|
3
|
+
|
|
4
|
+
export interface ServerSentEvent {
|
|
5
|
+
/** The `event:` field, or `message` when absent. */
|
|
6
|
+
readonly event: string;
|
|
7
|
+
/** The joined `data:` lines, unparsed. */
|
|
8
|
+
readonly data: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ServerSentEventLimits {
|
|
11
|
+
/** Most bytes read from the whole stream. */
|
|
12
|
+
readonly maxBytes: number;
|
|
13
|
+
/** Most bytes in one event frame. */
|
|
14
|
+
readonly maxEventBytes: number;
|
|
15
|
+
readonly signal: AbortSignal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const failure = (): MayuraError => new MayuraError('MODEL_FAILED', 'The model provider returned an unavailable, refused or invalid response.');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Bounded Server-Sent Events decoding for trusted provider adapters. It checks the content type, decodes strict UTF-8
|
|
22
|
+
* across chunk boundaries, splits LF or CRLF frames, ignores comments and ids, and enforces the byte bounds and the
|
|
23
|
+
* abort signal while reading. Raw provider bytes and error text are never surfaced; any violation is one generic error.
|
|
24
|
+
*/
|
|
25
|
+
export async function* readServerSentEvents(response: Response, limits: ServerSentEventLimits): AsyncIterable<ServerSentEvent> {
|
|
26
|
+
if (!Number.isSafeInteger(limits.maxBytes) || limits.maxBytes < 1 || !Number.isSafeInteger(limits.maxEventBytes) || limits.maxEventBytes < 1) {
|
|
27
|
+
throw new MayuraError('INVALID_CONFIG', 'Event stream bounds must be positive integers.');
|
|
28
|
+
}
|
|
29
|
+
if (!response.ok || response.redirected || !response.body || !/^text\/event-stream(?:\s*;|$)/iu.test(response.headers.get('content-type') ?? '')) {
|
|
30
|
+
void response.body?.cancel().catch(() => undefined);
|
|
31
|
+
throw failure();
|
|
32
|
+
}
|
|
33
|
+
const reader = response.body.getReader(); const decoder = new TextDecoder('utf-8', { fatal: true }); const encoder = new TextEncoder();
|
|
34
|
+
let pending = ''; let total = 0;
|
|
35
|
+
const read = (): Promise<ReadableStreamReadResult<Uint8Array>> => {
|
|
36
|
+
if (limits.signal.aborted) return Promise.reject(new MayuraError('CANCELLED', 'Provider request was cancelled.'));
|
|
37
|
+
let abort: (() => void) | undefined;
|
|
38
|
+
return Promise.race([reader.read(), new Promise<never>((_, reject) => {
|
|
39
|
+
abort = () => reject(new MayuraError('CANCELLED', 'Provider request was cancelled.'));
|
|
40
|
+
limits.signal.addEventListener('abort', abort, { once: true });
|
|
41
|
+
})]).finally(() => { if (abort) limits.signal.removeEventListener('abort', abort); });
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
while (true) {
|
|
45
|
+
const next = await read();
|
|
46
|
+
if (!next.done) {
|
|
47
|
+
total += next.value.byteLength; if (total > limits.maxBytes) throw failure();
|
|
48
|
+
}
|
|
49
|
+
try { pending += next.done ? decoder.decode() : decoder.decode(next.value, { stream: true }); } catch { throw failure(); }
|
|
50
|
+
while (true) {
|
|
51
|
+
const boundary = /\r?\n\r?\n/u.exec(pending); if (!boundary) break;
|
|
52
|
+
const frame = pending.slice(0, boundary.index); pending = pending.slice(boundary.index + boundary[0].length);
|
|
53
|
+
if (encoder.encode(frame).byteLength > limits.maxEventBytes) throw failure();
|
|
54
|
+
let event = 'message'; const data: string[] = [];
|
|
55
|
+
for (const line of frame.split(/\r?\n/u)) {
|
|
56
|
+
if (!line || line.startsWith(':')) continue;
|
|
57
|
+
const colon = line.indexOf(':'); const field = colon < 0 ? line : line.slice(0, colon); const value = colon < 0 ? '' : line.slice(colon + 1).replace(/^ /u, '');
|
|
58
|
+
if (field === 'event') event = value; else if (field === 'data') data.push(value);
|
|
59
|
+
}
|
|
60
|
+
if (data.length > 0) yield Object.freeze({ event, data: data.join('\n') });
|
|
61
|
+
}
|
|
62
|
+
if (encoder.encode(pending).byteLength > limits.maxEventBytes) throw failure();
|
|
63
|
+
if (next.done) { if (pending.trim()) throw failure(); return; }
|
|
64
|
+
}
|
|
65
|
+
} finally { void reader.cancel().catch(() => undefined); reader.releaseLock(); }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Present a provider call that reports final-output text as it arrives as a model stream: each delta as it comes,
|
|
70
|
+
* then the complete response. If the consumer stops reading early, the call's signal aborts so the request stops.
|
|
71
|
+
*/
|
|
72
|
+
export async function* streamModelCall(call: (onDelta: (text: string) => void, signal: AbortSignal) => Promise<ModelResponse>): AsyncIterable<ModelStreamEvent> {
|
|
73
|
+
const queue: string[] = []; let wake: (() => void) | undefined; let done = false; let result: ModelResponse | undefined; let failed = false; let failure: unknown;
|
|
74
|
+
const local = new AbortController();
|
|
75
|
+
void call(text => { queue.push(text); wake?.(); }, local.signal)
|
|
76
|
+
.then(value => { result = value; }, error => { failed = true; failure = error; })
|
|
77
|
+
.finally(() => { done = true; wake?.(); });
|
|
78
|
+
try {
|
|
79
|
+
while (true) {
|
|
80
|
+
while (queue.length > 0) yield { type: 'output.delta', text: queue.shift()! };
|
|
81
|
+
if (done) break;
|
|
82
|
+
await new Promise<void>(resolve => { wake = resolve; }); wake = undefined;
|
|
83
|
+
}
|
|
84
|
+
if (failed) throw failure;
|
|
85
|
+
yield { type: 'response', response: result! };
|
|
86
|
+
} finally { if (!done) local.abort(); }
|
|
87
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Explicit trusted-host integration APIs; never pass these capabilities into model or guard contexts. */
|
|
2
|
+
export { assertBudgetTicket } from './budget.js';
|
|
3
|
+
export { snapshotLocalGuards } from './local-guards.js';
|
|
4
|
+
export { registerManagedGuardDefinition, readManagedGuardDefinition, type ManagedGuardDescriptor, type ManagedGuardLimits } from './managed-guards.js';
|
|
5
|
+
export { evaluateLifecycleControl, evaluateLifecycleObserver, lifecycleHookTimeout, frozenView, snapshotHookOptions } from './lifecycle.js';
|
|
6
|
+
export { readServerSentEvents, streamModelCall, type ServerSentEvent, type ServerSentEventLimits } from './event-stream.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './errors.js';
|
|
2
|
+
export * from './json.js';
|
|
3
|
+
export * from './schema.js';
|
|
4
|
+
export * from './contracts.js';
|
|
5
|
+
export * from './budget.js';
|
|
6
|
+
export type { ManagedGuardDefinition, ManagedModerationVerdict } from './managed-guards.js';
|
|
7
|
+
export { LIFECYCLE_STAGES, type LifecycleStage, type LifecycleDecision, type LifecycleHookContext, type LifecycleControl, type LifecycleObserver } from './lifecycle.js';
|