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,577 @@
|
|
|
1
|
+
import { assertPositiveInteger, freezeJson, jsonValue, MayuraError, ModelInvocationError } from '../../core/dist/index.js';
|
|
2
|
+
import { readServerSentEvents, streamModelCall } from '../../core/dist/host.js';
|
|
3
|
+
class ProviderFailure extends MayuraError {
|
|
4
|
+
constructor(message = 'The model provider returned an unavailable, refused or invalid response.') { super('MODEL_FAILED', message); }
|
|
5
|
+
}
|
|
6
|
+
const failed = (message) => { throw new ProviderFailure(message); };
|
|
7
|
+
function object(value) {
|
|
8
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
9
|
+
return failed();
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
function integer(value) {
|
|
13
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0)
|
|
14
|
+
return failed();
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function strictSchema(schema) {
|
|
18
|
+
const copy = jsonValue(schema);
|
|
19
|
+
if (copy['type'] !== 'object')
|
|
20
|
+
throw new MayuraError('INVALID_CONFIG', 'Provider schemas require a root JSON object.');
|
|
21
|
+
const visit = (item) => {
|
|
22
|
+
if (item['type'] === 'object' || (Array.isArray(item['type']) && item['type'].includes('object'))) {
|
|
23
|
+
const properties = object(item['properties']);
|
|
24
|
+
const required = item['required'];
|
|
25
|
+
if (item['additionalProperties'] !== false || !Array.isArray(required) || required.some(key => typeof key !== 'string') || new Set(required).size !== required.length || Object.keys(properties).length !== required.length || Object.keys(properties).some(key => !required.includes(key))) {
|
|
26
|
+
throw new MayuraError('INVALID_CONFIG', 'Strict object schemas must require every property and prohibit additional properties.');
|
|
27
|
+
}
|
|
28
|
+
for (const child of Object.values(properties))
|
|
29
|
+
visit(object(child));
|
|
30
|
+
}
|
|
31
|
+
if (item['items'] !== undefined)
|
|
32
|
+
visit(object(item['items']));
|
|
33
|
+
for (const key of ['anyOf', 'allOf', 'oneOf'])
|
|
34
|
+
if (Array.isArray(item[key]))
|
|
35
|
+
for (const child of item[key])
|
|
36
|
+
visit(object(child));
|
|
37
|
+
for (const key of ['$defs', 'definitions'])
|
|
38
|
+
if (item[key] !== undefined)
|
|
39
|
+
for (const child of Object.values(object(item[key])))
|
|
40
|
+
visit(object(child));
|
|
41
|
+
};
|
|
42
|
+
visit(copy);
|
|
43
|
+
return freezeJson(copy);
|
|
44
|
+
}
|
|
45
|
+
async function abortable(operation, signal) {
|
|
46
|
+
if (signal.aborted) {
|
|
47
|
+
void operation.catch(() => undefined);
|
|
48
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled.');
|
|
49
|
+
}
|
|
50
|
+
let abort;
|
|
51
|
+
try {
|
|
52
|
+
return await Promise.race([operation, new Promise((_, reject) => {
|
|
53
|
+
abort = () => reject(new MayuraError('CANCELLED', 'Provider request was cancelled.'));
|
|
54
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
55
|
+
if (signal.aborted)
|
|
56
|
+
abort();
|
|
57
|
+
})]);
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
if (abort)
|
|
61
|
+
signal.removeEventListener('abort', abort);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function responseBody(response, limit, signal) {
|
|
65
|
+
if (!response.ok || response.redirected || !response.body) {
|
|
66
|
+
// Rejected responses still own a stream; release it without reading or exposing its contents.
|
|
67
|
+
void response.body?.cancel().catch(() => undefined);
|
|
68
|
+
if (!response.redirected && [401, 403].includes(response.status)) {
|
|
69
|
+
return failed('Model provider authentication or model authorization failed. Verify the configured credential and model access.');
|
|
70
|
+
}
|
|
71
|
+
if (!response.redirected && response.status === 429) {
|
|
72
|
+
return failed('The model provider rate limit was reached. Retry only under the application retry and budget policy.');
|
|
73
|
+
}
|
|
74
|
+
return failed();
|
|
75
|
+
}
|
|
76
|
+
const length = response.headers.get('content-length');
|
|
77
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > limit)) {
|
|
78
|
+
void response.body.cancel().catch(() => undefined);
|
|
79
|
+
return failed();
|
|
80
|
+
}
|
|
81
|
+
const reader = response.body.getReader();
|
|
82
|
+
const chunks = [];
|
|
83
|
+
let size = 0;
|
|
84
|
+
try {
|
|
85
|
+
while (true) {
|
|
86
|
+
const item = await abortable(reader.read(), signal);
|
|
87
|
+
if (item.done)
|
|
88
|
+
break;
|
|
89
|
+
size += item.value.byteLength;
|
|
90
|
+
if (size > limit)
|
|
91
|
+
return failed();
|
|
92
|
+
chunks.push(item.value);
|
|
93
|
+
}
|
|
94
|
+
const buffer = new Uint8Array(size);
|
|
95
|
+
let offset = 0;
|
|
96
|
+
for (const chunk of chunks) {
|
|
97
|
+
buffer.set(chunk, offset);
|
|
98
|
+
offset += chunk.byteLength;
|
|
99
|
+
}
|
|
100
|
+
return object(jsonValue(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(buffer)), { maxBytes: limit }));
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
void reader.cancel().catch(() => undefined);
|
|
104
|
+
reader.releaseLock();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function messagesToInput(messages, hasContinuation, aliases) {
|
|
108
|
+
const result = [];
|
|
109
|
+
for (const message of messages) {
|
|
110
|
+
if (message.role === 'user')
|
|
111
|
+
result.push({ role: 'user', content: JSON.stringify(message.content) });
|
|
112
|
+
else if (message.role === 'tool')
|
|
113
|
+
result.push({ type: 'function_call_output', call_id: message.callId, output: JSON.stringify(message.result) });
|
|
114
|
+
else if (!hasContinuation)
|
|
115
|
+
for (const call of message.calls) {
|
|
116
|
+
const name = aliases.get(call.toolId);
|
|
117
|
+
if (!name)
|
|
118
|
+
return failed();
|
|
119
|
+
result.push({ type: 'function_call', call_id: call.id, name, arguments: JSON.stringify(call.input) });
|
|
120
|
+
}
|
|
121
|
+
// Continuation already includes the provider's original function calls and reasoning items.
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
/** Explicit, stateless-per-call Responses adapter. No credential discovery, retries or public raw deltas. */
|
|
126
|
+
export function openAIResponses(options) {
|
|
127
|
+
if (typeof options.apiKey !== 'string' || !options.apiKey.trim() || /[\r\n]/.test(options.apiKey) || options.apiKey.length > 4096 || typeof options.model !== 'string' || !options.model.trim() || options.model.length > 128)
|
|
128
|
+
throw new MayuraError('INVALID_CONFIG', 'A model ID and bounded API key are required.');
|
|
129
|
+
const apiKey = options.apiKey;
|
|
130
|
+
const model = options.model;
|
|
131
|
+
const outputSchema = strictSchema(options.outputJsonSchema);
|
|
132
|
+
const priceInput = options.pricing.inputMicrosPerMillionTokens;
|
|
133
|
+
const priceOutput = options.pricing.outputMicrosPerMillionTokens;
|
|
134
|
+
for (const amount of [options.maxCostMicros, priceInput, priceOutput])
|
|
135
|
+
if (!Number.isSafeInteger(amount) || amount < 0)
|
|
136
|
+
throw new MayuraError('INVALID_CONFIG', 'Configured costs must be non-negative safe integers.');
|
|
137
|
+
const maxRequestBytes = options.maxRequestBytes ?? 1_048_576;
|
|
138
|
+
const maxResponseBytes = options.maxResponseBytes ?? 1_048_576;
|
|
139
|
+
const timeoutMs = options.timeoutMs ?? 30_000;
|
|
140
|
+
assertPositiveInteger(maxRequestBytes, 'maxRequestBytes');
|
|
141
|
+
assertPositiveInteger(maxResponseBytes, 'maxResponseBytes');
|
|
142
|
+
assertPositiveInteger(timeoutMs, 'timeoutMs');
|
|
143
|
+
if (timeoutMs > 2_147_483_647)
|
|
144
|
+
throw new MayuraError('INVALID_CONFIG', 'Provider timeout exceeds the supported timer range.');
|
|
145
|
+
const transport = options.fetch ?? globalThis.fetch;
|
|
146
|
+
if (typeof transport !== 'function')
|
|
147
|
+
throw new MayuraError('INVALID_CONFIG', 'A fetch-compatible transport is required.');
|
|
148
|
+
/** One Responses call. With `onDelta` it streams, reporting final-output text as it arrives; the parsing is shared. */
|
|
149
|
+
const call = async (request, onDelta, consumer) => {
|
|
150
|
+
const controller = new AbortController();
|
|
151
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
152
|
+
let knownCost;
|
|
153
|
+
try {
|
|
154
|
+
const signal = AbortSignal.any([request.signal, controller.signal, ...(consumer ? [consumer] : [])]);
|
|
155
|
+
if (signal.aborted)
|
|
156
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled.');
|
|
157
|
+
assertPositiveInteger(request.maxOutputTokens, 'maxOutputTokens');
|
|
158
|
+
const aliases = new Map(request.tools.map((tool, index) => [tool.id, `tool_${index}`]));
|
|
159
|
+
const ids = new Map([...aliases].map(([id, name]) => [name, id]));
|
|
160
|
+
if (aliases.size !== request.tools.length || request.tools.length > 128)
|
|
161
|
+
return failed();
|
|
162
|
+
let history = [];
|
|
163
|
+
let consumed = 0;
|
|
164
|
+
if (request.continuation !== undefined) {
|
|
165
|
+
const previous = object(jsonValue(request.continuation, { maxBytes: maxRequestBytes }));
|
|
166
|
+
if (previous['provider'] !== 'openai.responses.v1' || previous['model'] !== model || !Array.isArray(previous['history']))
|
|
167
|
+
return failed();
|
|
168
|
+
consumed = integer(previous['consumed']);
|
|
169
|
+
if (consumed > request.messages.length)
|
|
170
|
+
return failed();
|
|
171
|
+
history = previous['history'];
|
|
172
|
+
}
|
|
173
|
+
const additions = messagesToInput(request.messages.slice(consumed), request.continuation !== undefined, aliases);
|
|
174
|
+
const input = [...history, ...additions];
|
|
175
|
+
const tools = request.tools.map(tool => {
|
|
176
|
+
if (!tool.inputJsonSchema)
|
|
177
|
+
throw new MayuraError('INVALID_CONFIG', 'Every provider-exposed tool requires an explicit portable JSON Schema.');
|
|
178
|
+
return { type: 'function', name: aliases.get(tool.id), description: tool.description, parameters: strictSchema(tool.inputJsonSchema), strict: true };
|
|
179
|
+
});
|
|
180
|
+
const body = JSON.stringify(jsonValue({ model, instructions: request.instructions, input, tools,
|
|
181
|
+
store: false, stream: onDelta !== undefined, include: ['reasoning.encrypted_content'], parallel_tool_calls: true,
|
|
182
|
+
max_output_tokens: request.maxOutputTokens,
|
|
183
|
+
text: { format: { type: 'json_schema', name: 'mayura_output', schema: outputSchema, strict: true } },
|
|
184
|
+
}, { maxBytes: maxRequestBytes }));
|
|
185
|
+
const response = await abortable(transport('https://api.openai.com/v1/responses', {
|
|
186
|
+
method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
187
|
+
body, signal, redirect: 'error',
|
|
188
|
+
}), signal);
|
|
189
|
+
const payload = onDelta ? await completedStream(response, signal, onDelta) : await responseBody(response, maxResponseBytes, signal);
|
|
190
|
+
const usage = object(payload['usage']);
|
|
191
|
+
const inputTokens = integer(usage['input_tokens']);
|
|
192
|
+
const outputTokens = integer(usage['output_tokens']);
|
|
193
|
+
const numerator = BigInt(inputTokens) * BigInt(priceInput) + BigInt(outputTokens) * BigInt(priceOutput);
|
|
194
|
+
const computedCost = (numerator + 999999n) / 1000000n;
|
|
195
|
+
if (computedCost > BigInt(Number.MAX_SAFE_INTEGER))
|
|
196
|
+
return failed();
|
|
197
|
+
knownCost = Number(computedCost);
|
|
198
|
+
if (payload['status'] !== 'completed' || !Array.isArray(payload['output']) || payload['output'].length > 256)
|
|
199
|
+
return failed();
|
|
200
|
+
const calls = [];
|
|
201
|
+
const callIds = new Set();
|
|
202
|
+
const text = [];
|
|
203
|
+
for (const rawItem of payload['output']) {
|
|
204
|
+
const item = object(rawItem);
|
|
205
|
+
// A completed envelope cannot legitimize a partial individual output item.
|
|
206
|
+
if (item['status'] !== undefined && item['status'] !== 'completed')
|
|
207
|
+
return failed();
|
|
208
|
+
if (item['type'] === 'reasoning')
|
|
209
|
+
continue;
|
|
210
|
+
if (item['type'] === 'function_call') {
|
|
211
|
+
const callId = item['call_id'];
|
|
212
|
+
const name = item['name'];
|
|
213
|
+
const args = item['arguments'];
|
|
214
|
+
if (typeof callId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/.test(callId) || callIds.has(callId) || typeof name !== 'string' || !ids.has(name) || typeof args !== 'string')
|
|
215
|
+
return failed();
|
|
216
|
+
callIds.add(callId);
|
|
217
|
+
calls.push({ id: callId, toolId: ids.get(name), input: jsonValue(JSON.parse(args)) });
|
|
218
|
+
}
|
|
219
|
+
else if (item['type'] === 'message') {
|
|
220
|
+
if (item['role'] !== 'assistant' || !Array.isArray(item['content']))
|
|
221
|
+
return failed();
|
|
222
|
+
for (const rawContent of item['content']) {
|
|
223
|
+
const content = object(rawContent);
|
|
224
|
+
if (content['type'] !== 'output_text' || typeof content['text'] !== 'string')
|
|
225
|
+
return failed();
|
|
226
|
+
text.push(content['text']);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else
|
|
230
|
+
return failed();
|
|
231
|
+
}
|
|
232
|
+
const accounting = { costMicros: Number(computedCost) };
|
|
233
|
+
if (calls.length > 0) {
|
|
234
|
+
const continuation = jsonValue({ provider: 'openai.responses.v1', model, consumed: request.messages.length, history: [...input, ...payload['output']] }, { maxBytes: maxRequestBytes });
|
|
235
|
+
return { type: 'tool_calls', calls, usage: accounting, continuation };
|
|
236
|
+
}
|
|
237
|
+
if (text.length === 0)
|
|
238
|
+
return failed();
|
|
239
|
+
return { type: 'final', output: jsonValue(JSON.parse(text.join('')), { maxBytes: maxResponseBytes }), usage: accounting };
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
// HTTP status/body, credentials, model output and arbitrary transport exceptions are private.
|
|
243
|
+
if (knownCost !== undefined)
|
|
244
|
+
throw new ModelInvocationError(knownCost);
|
|
245
|
+
if (request.signal.aborted || controller.signal.aborted || consumer?.aborted)
|
|
246
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled or timed out.');
|
|
247
|
+
if (error instanceof ProviderFailure)
|
|
248
|
+
throw error;
|
|
249
|
+
return failed();
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
clearTimeout(timer);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Read a Responses event stream: output text deltas are reported as they arrive (function-call argument deltas and
|
|
257
|
+
* reasoning are not), and the `response.completed` event carries the same complete response a non-streamed call
|
|
258
|
+
* returns, which the shared code then parses and accounts.
|
|
259
|
+
*/
|
|
260
|
+
const completedStream = async (response, signal, onDelta) => {
|
|
261
|
+
let completed;
|
|
262
|
+
for await (const event of readServerSentEvents(response, { maxBytes: maxResponseBytes * 4, maxEventBytes: maxResponseBytes, signal })) {
|
|
263
|
+
if (completed)
|
|
264
|
+
continue; // nothing after completion is reported
|
|
265
|
+
const data = object(jsonValue(JSON.parse(event.data), { maxBytes: maxResponseBytes }));
|
|
266
|
+
const type = data['type'];
|
|
267
|
+
if (type === 'response.output_text.delta') {
|
|
268
|
+
if (typeof data['delta'] !== 'string')
|
|
269
|
+
return failed();
|
|
270
|
+
onDelta(data['delta']);
|
|
271
|
+
}
|
|
272
|
+
else if (type === 'response.completed')
|
|
273
|
+
completed = object(data['response']);
|
|
274
|
+
else if (type === 'response.failed' || type === 'response.incomplete' || type === 'error')
|
|
275
|
+
return failed();
|
|
276
|
+
}
|
|
277
|
+
return completed ?? failed();
|
|
278
|
+
};
|
|
279
|
+
return Object.freeze({
|
|
280
|
+
id: 'openai.responses', capabilities: Object.freeze({ tools: true, structuredOutput: true }), maxCostMicros: options.maxCostMicros,
|
|
281
|
+
generate: (request) => call(request),
|
|
282
|
+
stream: (request) => streamModelCall((onDelta, consumer) => call(request, onDelta, consumer)),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function compatibleMessages(messages, aliases) {
|
|
286
|
+
return messages.map(message => {
|
|
287
|
+
if (message.role === 'user')
|
|
288
|
+
return { role: 'user', content: JSON.stringify(message.content) };
|
|
289
|
+
if (message.role === 'tool')
|
|
290
|
+
return { role: 'tool', tool_call_id: message.callId, content: JSON.stringify(message.result) };
|
|
291
|
+
return { role: 'assistant', content: null, tool_calls: message.calls.map(call => {
|
|
292
|
+
const name = aliases.get(call.toolId);
|
|
293
|
+
if (!name)
|
|
294
|
+
return failed();
|
|
295
|
+
return { id: call.id, type: 'function', function: { name, arguments: JSON.stringify(call.input) } };
|
|
296
|
+
}) };
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/** Loopback-only Chat Completions adapter for explicitly selected compatible local model servers. */
|
|
300
|
+
export function openAICompatibleChat(options) {
|
|
301
|
+
let endpoint;
|
|
302
|
+
try {
|
|
303
|
+
endpoint = new URL(options.endpoint);
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
throw new MayuraError('INVALID_CONFIG', 'A valid loopback Chat Completions endpoint is required.');
|
|
307
|
+
}
|
|
308
|
+
const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(endpoint.hostname);
|
|
309
|
+
const remote = options.remote;
|
|
310
|
+
if (remote === undefined) {
|
|
311
|
+
if (endpoint.protocol !== 'http:' || !loopback || endpoint.username || endpoint.password || endpoint.pathname !== '/v1/chat/completions' || endpoint.search || endpoint.hash) {
|
|
312
|
+
throw new MayuraError('INVALID_CONFIG', 'Compatible local models require an exact loopback HTTP endpoint; set `remote` to use a remote provider.');
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
// A remote destination is an explicit data-egress decision: HTTPS only, the exact API path, and no other query
|
|
317
|
+
// than Azure's `api-version`, so configuration cannot smuggle a different target or credentials into the URL.
|
|
318
|
+
const query = [...endpoint.searchParams.keys()];
|
|
319
|
+
if (!remote || typeof remote.id !== 'string' || !/^[a-z0-9][a-z0-9-]{0,39}$/u.test(remote.id) || (remote.auth !== undefined && remote.auth !== 'bearer' && remote.auth !== 'api-key')
|
|
320
|
+
|| endpoint.protocol !== 'https:' || loopback || endpoint.username || endpoint.password || endpoint.hash || !endpoint.pathname.endsWith('/chat/completions')
|
|
321
|
+
|| query.some(key => key !== 'api-version') || query.length > 1 || (query.length === 1 && !/^[0-9A-Za-z.-]{1,32}$/u.test(endpoint.searchParams.get('api-version')))) {
|
|
322
|
+
throw new MayuraError('INVALID_CONFIG', 'Remote compatible providers need an id, an HTTPS `/chat/completions` endpoint and at most an api-version query.');
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (options.apiKey !== undefined && (typeof options.apiKey !== 'string' || !options.apiKey || /[\r\n]/u.test(options.apiKey) || options.apiKey.length > 4_096)) {
|
|
326
|
+
throw new MayuraError('INVALID_CONFIG', 'Compatible provider credentials must be bounded header values.');
|
|
327
|
+
}
|
|
328
|
+
if (options.token !== undefined && (typeof options.token !== 'function' || options.apiKey !== undefined)) {
|
|
329
|
+
throw new MayuraError('INVALID_CONFIG', 'Give either an apiKey or a token source, not both.');
|
|
330
|
+
}
|
|
331
|
+
if (remote !== undefined && options.apiKey === undefined && options.token === undefined) {
|
|
332
|
+
throw new MayuraError('INVALID_CONFIG', 'Remote compatible providers require an apiKey or a token source.');
|
|
333
|
+
}
|
|
334
|
+
if (typeof options.model !== 'string' || !options.model.trim() || options.model.length > 128)
|
|
335
|
+
throw new MayuraError('INVALID_CONFIG', 'A bounded local model ID is required.');
|
|
336
|
+
const url = endpoint.href;
|
|
337
|
+
const apiKey = options.apiKey;
|
|
338
|
+
const tokenSource = options.token;
|
|
339
|
+
const model = options.model;
|
|
340
|
+
const outputSchema = strictSchema(options.outputJsonSchema);
|
|
341
|
+
const authHeader = remote?.auth === 'api-key' ? 'api-key' : 'Authorization';
|
|
342
|
+
const credential = async () => {
|
|
343
|
+
const value = tokenSource ? await tokenSource() : apiKey;
|
|
344
|
+
if (value !== undefined && (typeof value !== 'string' || !value || /[\r\n]/u.test(value) || value.length > 8_192))
|
|
345
|
+
return failed();
|
|
346
|
+
return value === undefined ? undefined : authHeader === 'api-key' ? value : `Bearer ${value}`;
|
|
347
|
+
};
|
|
348
|
+
const inputPrice = options.pricing.inputMicrosPerMillionTokens;
|
|
349
|
+
const outputPrice = options.pricing.outputMicrosPerMillionTokens;
|
|
350
|
+
for (const amount of [options.maxCostMicros, inputPrice, outputPrice])
|
|
351
|
+
if (!Number.isSafeInteger(amount) || amount < 0)
|
|
352
|
+
throw new MayuraError('INVALID_CONFIG', 'Configured costs must be non-negative safe integers.');
|
|
353
|
+
const maxRequestBytes = options.maxRequestBytes ?? 1_048_576;
|
|
354
|
+
const maxResponseBytes = options.maxResponseBytes ?? 1_048_576;
|
|
355
|
+
const timeoutMs = options.timeoutMs ?? 30_000;
|
|
356
|
+
assertPositiveInteger(maxRequestBytes, 'maxRequestBytes');
|
|
357
|
+
assertPositiveInteger(maxResponseBytes, 'maxResponseBytes');
|
|
358
|
+
assertPositiveInteger(timeoutMs, 'timeoutMs');
|
|
359
|
+
if (timeoutMs > 2_147_483_647)
|
|
360
|
+
throw new MayuraError('INVALID_CONFIG', 'Provider timeout exceeds the supported timer range.');
|
|
361
|
+
const transport = options.fetch ?? globalThis.fetch;
|
|
362
|
+
if (typeof transport !== 'function')
|
|
363
|
+
throw new MayuraError('INVALID_CONFIG', 'A fetch-compatible transport is required.');
|
|
364
|
+
/** One Chat Completions call. With `onDelta` it streams, reporting content as it arrives; parsing is shared. */
|
|
365
|
+
const call = async (request, onDelta, consumer) => {
|
|
366
|
+
const controller = new AbortController();
|
|
367
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
368
|
+
let knownCost;
|
|
369
|
+
try {
|
|
370
|
+
const signal = AbortSignal.any([request.signal, controller.signal, ...(consumer ? [consumer] : [])]);
|
|
371
|
+
if (signal.aborted)
|
|
372
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled.');
|
|
373
|
+
if (request.continuation !== undefined)
|
|
374
|
+
return failed();
|
|
375
|
+
assertPositiveInteger(request.maxOutputTokens, 'maxOutputTokens');
|
|
376
|
+
const aliases = new Map(request.tools.map((tool, index) => [tool.id, `tool_${index}`]));
|
|
377
|
+
const ids = new Map([...aliases].map(([toolId, alias]) => [alias, toolId]));
|
|
378
|
+
if (aliases.size !== request.tools.length || aliases.size > 128)
|
|
379
|
+
return failed();
|
|
380
|
+
const tools = request.tools.map(tool => {
|
|
381
|
+
if (!tool.inputJsonSchema)
|
|
382
|
+
throw new MayuraError('INVALID_CONFIG', 'Every provider-exposed tool requires an explicit portable JSON Schema.');
|
|
383
|
+
return { type: 'function', function: { name: aliases.get(tool.id), description: tool.description, parameters: strictSchema(tool.inputJsonSchema) } };
|
|
384
|
+
});
|
|
385
|
+
const body = JSON.stringify(jsonValue({ model, stream: onDelta !== undefined, ...(onDelta ? { stream_options: { include_usage: true } } : {}), messages: [{ role: 'system', content: request.instructions }, ...compatibleMessages(request.messages, aliases)],
|
|
386
|
+
tools, parallel_tool_calls: true, max_tokens: request.maxOutputTokens,
|
|
387
|
+
response_format: { type: 'json_schema', json_schema: { name: 'mayura_output', strict: true, schema: outputSchema } },
|
|
388
|
+
}, { maxBytes: maxRequestBytes }));
|
|
389
|
+
const headers = { 'Content-Type': 'application/json' };
|
|
390
|
+
const authorization = await credential();
|
|
391
|
+
if (authorization !== undefined)
|
|
392
|
+
headers[authHeader] = authorization;
|
|
393
|
+
const response = await abortable(transport(url, { method: 'POST', headers, body, signal, redirect: 'error' }), signal);
|
|
394
|
+
const payload = onDelta ? await assembledCompletion(response, signal, onDelta) : await responseBody(response, maxResponseBytes, signal);
|
|
395
|
+
const usage = object(payload['usage']);
|
|
396
|
+
const inputTokens = integer(usage['prompt_tokens']);
|
|
397
|
+
const outputTokens = integer(usage['completion_tokens']);
|
|
398
|
+
const cost = (BigInt(inputTokens) * BigInt(inputPrice) + BigInt(outputTokens) * BigInt(outputPrice) + 999999n) / 1000000n;
|
|
399
|
+
if (cost > BigInt(Number.MAX_SAFE_INTEGER))
|
|
400
|
+
return failed();
|
|
401
|
+
knownCost = Number(cost);
|
|
402
|
+
if (!Array.isArray(payload['choices']) || payload['choices'].length !== 1)
|
|
403
|
+
return failed();
|
|
404
|
+
const choice = object(payload['choices'][0]);
|
|
405
|
+
const message = object(choice['message']);
|
|
406
|
+
if (message['role'] !== 'assistant')
|
|
407
|
+
return failed();
|
|
408
|
+
if (choice['finish_reason'] === 'tool_calls') {
|
|
409
|
+
if (!Array.isArray(message['tool_calls']) || message['tool_calls'].length < 1 || message['tool_calls'].length > 128)
|
|
410
|
+
return failed();
|
|
411
|
+
const seen = new Set();
|
|
412
|
+
const calls = message['tool_calls'].map(raw => {
|
|
413
|
+
const call = object(raw);
|
|
414
|
+
const fn = object(call['function']);
|
|
415
|
+
const callId = call['id'];
|
|
416
|
+
const alias = fn['name'];
|
|
417
|
+
if (call['type'] !== 'function' || typeof callId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/u.test(callId)
|
|
418
|
+
|| seen.has(callId) || typeof alias !== 'string' || !ids.has(alias) || typeof fn['arguments'] !== 'string')
|
|
419
|
+
return failed();
|
|
420
|
+
seen.add(callId);
|
|
421
|
+
return { id: callId, toolId: ids.get(alias), input: jsonValue(JSON.parse(fn['arguments'])) };
|
|
422
|
+
});
|
|
423
|
+
return { type: 'tool_calls', calls, usage: { costMicros: knownCost } };
|
|
424
|
+
}
|
|
425
|
+
if (choice['finish_reason'] !== 'stop' || typeof message['content'] !== 'string')
|
|
426
|
+
return failed();
|
|
427
|
+
return { type: 'final', output: jsonValue(JSON.parse(message['content']), { maxBytes: maxResponseBytes }), usage: { costMicros: knownCost } };
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
if (knownCost !== undefined)
|
|
431
|
+
throw new ModelInvocationError(knownCost);
|
|
432
|
+
if (request.signal.aborted || controller.signal.aborted || consumer?.aborted)
|
|
433
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled or timed out.');
|
|
434
|
+
if (error instanceof ProviderFailure)
|
|
435
|
+
throw error;
|
|
436
|
+
return failed();
|
|
437
|
+
}
|
|
438
|
+
finally {
|
|
439
|
+
clearTimeout(timer);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Rebuild the non-streamed completion from Chat Completions chunks: content deltas are reported as they arrive,
|
|
444
|
+
* tool-call fragments are only assembled by index, and usage must arrive in a final chunk (`include_usage`).
|
|
445
|
+
*/
|
|
446
|
+
const assembledCompletion = async (response, signal, onDelta) => {
|
|
447
|
+
let content = '';
|
|
448
|
+
let finish = null;
|
|
449
|
+
let usage;
|
|
450
|
+
let finished = false;
|
|
451
|
+
const calls = [];
|
|
452
|
+
for await (const event of readServerSentEvents(response, { maxBytes: maxResponseBytes * 4, maxEventBytes: maxResponseBytes, signal })) {
|
|
453
|
+
if (finished)
|
|
454
|
+
return failed();
|
|
455
|
+
if (event.data.trim() === '[DONE]') {
|
|
456
|
+
finished = true;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
const chunk = object(jsonValue(JSON.parse(event.data), { maxBytes: maxResponseBytes }));
|
|
460
|
+
if (chunk['usage'] !== undefined && chunk['usage'] !== null)
|
|
461
|
+
usage = chunk['usage'];
|
|
462
|
+
const choices = chunk['choices'];
|
|
463
|
+
if (!Array.isArray(choices) || choices.length > 1)
|
|
464
|
+
return failed();
|
|
465
|
+
if (choices.length === 0)
|
|
466
|
+
continue;
|
|
467
|
+
const choice = object(choices[0]);
|
|
468
|
+
if (choice['finish_reason'] !== undefined && choice['finish_reason'] !== null)
|
|
469
|
+
finish = choice['finish_reason'];
|
|
470
|
+
if (choice['delta'] === undefined || choice['delta'] === null)
|
|
471
|
+
continue;
|
|
472
|
+
const delta = object(choice['delta']);
|
|
473
|
+
if (typeof delta['content'] === 'string' && delta['content']) {
|
|
474
|
+
content += delta['content'];
|
|
475
|
+
onDelta(delta['content']);
|
|
476
|
+
}
|
|
477
|
+
if (delta['tool_calls'] !== undefined && delta['tool_calls'] !== null) {
|
|
478
|
+
if (!Array.isArray(delta['tool_calls']))
|
|
479
|
+
return failed();
|
|
480
|
+
for (const raw of delta['tool_calls']) {
|
|
481
|
+
const fragment = object(raw);
|
|
482
|
+
const index = integer(fragment['index']);
|
|
483
|
+
if (index > calls.length || index >= 128)
|
|
484
|
+
return failed();
|
|
485
|
+
const entry = calls[index] ?? (calls[index] = { name: '', arguments: '' });
|
|
486
|
+
if (fragment['id'] !== undefined && fragment['id'] !== null)
|
|
487
|
+
entry.id = fragment['id'];
|
|
488
|
+
const fn = fragment['function'] === undefined || fragment['function'] === null ? {} : object(fragment['function']);
|
|
489
|
+
if (typeof fn['name'] === 'string')
|
|
490
|
+
entry.name += fn['name'];
|
|
491
|
+
if (typeof fn['arguments'] === 'string')
|
|
492
|
+
entry.arguments += fn['arguments'];
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (!finished || usage === undefined)
|
|
497
|
+
return failed();
|
|
498
|
+
const message = { role: 'assistant', content: calls.length > 0 && !content ? null : content,
|
|
499
|
+
...(calls.length > 0 ? { tool_calls: calls.map(entry => ({ type: 'function', id: entry.id ?? null, function: { name: entry.name, arguments: entry.arguments } })) } : {}) };
|
|
500
|
+
return { choices: [{ message, finish_reason: finish }], usage };
|
|
501
|
+
};
|
|
502
|
+
return Object.freeze({ id: remote ? `openai-compatible.${remote.id}` : 'openai-compatible.chat', capabilities: Object.freeze({ tools: true, structuredOutput: true }), maxCostMicros: options.maxCostMicros,
|
|
503
|
+
generate: (request) => call(request),
|
|
504
|
+
stream: (request) => streamModelCall((onDelta, consumer) => call(request, onDelta, consumer)),
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Hosted embedding adapter for native memory (`createNativeMemory({ embedder })`). It declares `location: 'hosted'`,
|
|
509
|
+
* so native memory sends it only the configured `embedSensitivities` and requires the `memory:index` grant.
|
|
510
|
+
*/
|
|
511
|
+
export function openAIEmbeddings(options) {
|
|
512
|
+
if (typeof options.apiKey !== 'string' || !options.apiKey.trim() || /[\r\n]/.test(options.apiKey) || options.apiKey.length > 4096
|
|
513
|
+
|| typeof options.model !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(options.model))
|
|
514
|
+
throw new MayuraError('INVALID_CONFIG', 'A model ID and bounded API key are required.');
|
|
515
|
+
const dimensions = options.dimensions;
|
|
516
|
+
const maxBatch = options.maxBatch ?? 128;
|
|
517
|
+
const maxResponseBytes = options.maxResponseBytes ?? 16_777_216;
|
|
518
|
+
const timeoutMs = options.timeoutMs ?? 30_000;
|
|
519
|
+
if (!Number.isSafeInteger(dimensions) || dimensions < 1 || dimensions > 4_096 || !Number.isSafeInteger(maxBatch) || maxBatch < 1 || maxBatch > 2_048) {
|
|
520
|
+
throw new MayuraError('INVALID_CONFIG', 'Embedding dimensions must be 1–4096 and batches 1–2048.');
|
|
521
|
+
}
|
|
522
|
+
assertPositiveInteger(maxResponseBytes, 'maxResponseBytes');
|
|
523
|
+
assertPositiveInteger(timeoutMs, 'timeoutMs');
|
|
524
|
+
const transport = options.fetch ?? globalThis.fetch;
|
|
525
|
+
if (typeof transport !== 'function')
|
|
526
|
+
throw new MayuraError('INVALID_CONFIG', 'A fetch-compatible transport is required.');
|
|
527
|
+
const apiKey = options.apiKey;
|
|
528
|
+
const model = options.model;
|
|
529
|
+
return Object.freeze({
|
|
530
|
+
id: `openai.${model}.${dimensions}`, dimensions, maxBatch, location: 'hosted',
|
|
531
|
+
async embed(texts, requestSignal) {
|
|
532
|
+
if (!Array.isArray(texts) || texts.length === 0 || texts.length > maxBatch || texts.some(text => typeof text !== 'string' || text.length === 0 || text.length > 32_768)) {
|
|
533
|
+
throw new MayuraError('INVALID_INPUT', 'Embedding input must be 1–maxBatch nonempty bounded strings.');
|
|
534
|
+
}
|
|
535
|
+
const controller = new AbortController();
|
|
536
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
537
|
+
try {
|
|
538
|
+
const signal = AbortSignal.any([requestSignal, controller.signal]);
|
|
539
|
+
if (signal.aborted)
|
|
540
|
+
throw new MayuraError('CANCELLED', 'Provider request was cancelled.');
|
|
541
|
+
const response = await abortable(transport('https://api.openai.com/v1/embeddings', {
|
|
542
|
+
method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
|
|
543
|
+
body: JSON.stringify({ model, input: texts, dimensions, encoding_format: 'float' }), signal, redirect: 'error',
|
|
544
|
+
}), signal);
|
|
545
|
+
const payload = await responseBody(response, maxResponseBytes, signal);
|
|
546
|
+
const data = payload['data'];
|
|
547
|
+
if (!Array.isArray(data) || data.length !== texts.length)
|
|
548
|
+
return failed();
|
|
549
|
+
const vectors = new Array(texts.length);
|
|
550
|
+
for (const entry of data) {
|
|
551
|
+
const item = object(entry);
|
|
552
|
+
const index = integer(item['index']);
|
|
553
|
+
const embedding = item['embedding'];
|
|
554
|
+
if (index >= texts.length || vectors[index] !== undefined || !Array.isArray(embedding) || embedding.length !== dimensions
|
|
555
|
+
|| embedding.some(value => typeof value !== 'number' || !Number.isFinite(value)))
|
|
556
|
+
return failed();
|
|
557
|
+
vectors[index] = embedding;
|
|
558
|
+
}
|
|
559
|
+
const usage = object(payload['usage']);
|
|
560
|
+
try {
|
|
561
|
+
options.onUsage?.({ inputTokens: integer(usage['prompt_tokens']) });
|
|
562
|
+
}
|
|
563
|
+
catch { /* Accounting callbacks cannot change the result. */ }
|
|
564
|
+
return vectors;
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
if (error instanceof MayuraError)
|
|
568
|
+
throw error;
|
|
569
|
+
throw new ProviderFailure();
|
|
570
|
+
}
|
|
571
|
+
finally {
|
|
572
|
+
clearTimeout(timer);
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
//# sourceMappingURL=index.js.map
|