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,160 @@
|
|
|
1
|
+
import { assertPositiveInteger, MayuraError } from '../../core/dist/index.js';
|
|
2
|
+
import { assertPipeline, Deadline, snapshotContext } from './pipeline.js';
|
|
3
|
+
/** Release only independently admitted text batches. Earlier releases cannot be retracted by later verdicts. */
|
|
4
|
+
export async function* releaseBatches(source, pipeline, supplied, options = {}) {
|
|
5
|
+
const maxChunksPerBatch = options.maxChunksPerBatch ?? 16;
|
|
6
|
+
const maxBatchBytes = options.maxBatchBytes ?? 65_536;
|
|
7
|
+
const maxBatches = options.maxBatches ?? 128;
|
|
8
|
+
const maxDurationMs = options.maxDurationMs ?? 30_000;
|
|
9
|
+
for (const [name, value] of Object.entries({ maxChunksPerBatch, maxBatchBytes, maxBatches, maxDurationMs }))
|
|
10
|
+
assertPositiveInteger(value, name);
|
|
11
|
+
if (maxChunksPerBatch > 256 || maxDurationMs > 2_147_483_647)
|
|
12
|
+
throw new MayuraError('INVALID_CONFIG', 'Batch limits exceed supported bounds.');
|
|
13
|
+
assertPipeline(pipeline);
|
|
14
|
+
const original = snapshotContext(supplied);
|
|
15
|
+
if (original.boundary !== 'output')
|
|
16
|
+
throw new MayuraError('INVALID_CONFIG', 'Batch release requires an output boundary context.');
|
|
17
|
+
const deadline = new Deadline(original.signal, maxDurationMs);
|
|
18
|
+
const context = snapshotContext(original, deadline.controller.signal);
|
|
19
|
+
let iterator;
|
|
20
|
+
try {
|
|
21
|
+
if (context.signal.aborted)
|
|
22
|
+
await deadline.run(() => undefined);
|
|
23
|
+
iterator = source[Symbol.asyncIterator]();
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
deadline.close();
|
|
27
|
+
if (original.signal.aborted)
|
|
28
|
+
throw new MayuraError('CANCELLED', 'The output stream was cancelled.');
|
|
29
|
+
throw new MayuraError('INVALID_OUTPUT', 'The output source could not be initialized.');
|
|
30
|
+
}
|
|
31
|
+
const encoder = new TextEncoder();
|
|
32
|
+
let chunks = [];
|
|
33
|
+
let bytes = 0;
|
|
34
|
+
let released = 0;
|
|
35
|
+
const admit = async () => {
|
|
36
|
+
if (released >= maxBatches)
|
|
37
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The output batch limit was reached.');
|
|
38
|
+
const candidate = chunks.join('');
|
|
39
|
+
chunks = [];
|
|
40
|
+
bytes = 0;
|
|
41
|
+
const outcome = await deadline.run(() => pipeline.process(candidate, context));
|
|
42
|
+
if (outcome.status !== 'succeeded')
|
|
43
|
+
throw new MayuraError(outcome.error.code, 'An output batch was withheld by its content boundary.');
|
|
44
|
+
released++;
|
|
45
|
+
return outcome.output;
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
for (;;) {
|
|
49
|
+
const next = await deadline.run(async () => {
|
|
50
|
+
try {
|
|
51
|
+
const entry = await iterator.next();
|
|
52
|
+
const done = entry.done;
|
|
53
|
+
if (done !== undefined && typeof done !== 'boolean')
|
|
54
|
+
throw new Error();
|
|
55
|
+
const value = done ? '' : entry.value;
|
|
56
|
+
if (typeof value !== 'string')
|
|
57
|
+
throw new Error();
|
|
58
|
+
return { done: done === true, value };
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
throw new MayuraError('INVALID_OUTPUT', 'The output source could not provide a valid batch.');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if (next.done)
|
|
65
|
+
break;
|
|
66
|
+
if (typeof next.value !== 'string')
|
|
67
|
+
throw new MayuraError('INVALID_OUTPUT', 'The output source must provide text chunks.');
|
|
68
|
+
const size = encoder.encode(next.value).length;
|
|
69
|
+
if (size > maxBatchBytes)
|
|
70
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'An output chunk exceeds the batch byte limit.');
|
|
71
|
+
if (chunks.length > 0 && bytes + size > maxBatchBytes)
|
|
72
|
+
yield await admit();
|
|
73
|
+
chunks.push(next.value);
|
|
74
|
+
bytes += size;
|
|
75
|
+
if (chunks.length >= maxChunksPerBatch)
|
|
76
|
+
yield await admit();
|
|
77
|
+
}
|
|
78
|
+
if (chunks.length > 0)
|
|
79
|
+
yield await admit();
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
deadline.close();
|
|
83
|
+
// Cleanup is cooperative; do not let an uncooperative iterator's return promise hang cancellation.
|
|
84
|
+
try {
|
|
85
|
+
void Promise.resolve(iterator.return?.()).catch(() => { });
|
|
86
|
+
}
|
|
87
|
+
catch { /* The content boundary is already closed. */ }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** Buffer one bounded transcript and release it only after a whole-output pipeline decision. */
|
|
91
|
+
export async function releaseBufferedOutput(source, pipeline, supplied, options = {}) {
|
|
92
|
+
const maxChunks = options.maxChunks ?? 4_096;
|
|
93
|
+
const maxBytes = options.maxBytes ?? 1_048_576;
|
|
94
|
+
const maxDurationMs = options.maxDurationMs ?? 30_000;
|
|
95
|
+
for (const [name, value] of Object.entries({ maxChunks, maxBytes, maxDurationMs }))
|
|
96
|
+
assertPositiveInteger(value, name);
|
|
97
|
+
if (maxChunks > 65_536 || maxBytes > 16 * 1_048_576 || maxDurationMs > 2_147_483_647) {
|
|
98
|
+
throw new MayuraError('INVALID_CONFIG', 'Buffered output limits exceed supported bounds.');
|
|
99
|
+
}
|
|
100
|
+
assertPipeline(pipeline);
|
|
101
|
+
const original = snapshotContext(supplied);
|
|
102
|
+
if (original.boundary !== 'output')
|
|
103
|
+
throw new MayuraError('INVALID_CONFIG', 'Buffered release requires an output boundary context.');
|
|
104
|
+
const deadline = new Deadline(original.signal, maxDurationMs);
|
|
105
|
+
const context = snapshotContext(original, deadline.controller.signal);
|
|
106
|
+
let iterator;
|
|
107
|
+
try {
|
|
108
|
+
if (context.signal.aborted)
|
|
109
|
+
await deadline.run(() => undefined);
|
|
110
|
+
try {
|
|
111
|
+
iterator = source[Symbol.asyncIterator]();
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
if (original.signal.aborted)
|
|
115
|
+
throw new MayuraError('CANCELLED', 'The output stream was cancelled.');
|
|
116
|
+
throw new MayuraError('INVALID_OUTPUT', 'The output source could not be initialized.');
|
|
117
|
+
}
|
|
118
|
+
const encoder = new TextEncoder();
|
|
119
|
+
const chunks = [];
|
|
120
|
+
let bytes = 0;
|
|
121
|
+
for (;;) {
|
|
122
|
+
const next = await deadline.run(async () => {
|
|
123
|
+
try {
|
|
124
|
+
const entry = await iterator.next();
|
|
125
|
+
const done = entry.done;
|
|
126
|
+
if (done !== undefined && typeof done !== 'boolean')
|
|
127
|
+
throw new Error();
|
|
128
|
+
const value = done ? '' : entry.value;
|
|
129
|
+
if (typeof value !== 'string')
|
|
130
|
+
throw new Error();
|
|
131
|
+
return { done: done === true, value };
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
throw new MayuraError('INVALID_OUTPUT', 'The output source could not provide valid text.');
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (next.done)
|
|
138
|
+
break;
|
|
139
|
+
if (chunks.length >= maxChunks)
|
|
140
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The buffered output chunk limit was reached.');
|
|
141
|
+
const size = encoder.encode(next.value).length;
|
|
142
|
+
if (size > maxBytes - bytes)
|
|
143
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The buffered output byte limit was reached.');
|
|
144
|
+
chunks.push(next.value);
|
|
145
|
+
bytes += size;
|
|
146
|
+
}
|
|
147
|
+
const outcome = await deadline.run(() => pipeline.process(chunks.join(''), context));
|
|
148
|
+
if (outcome.status !== 'succeeded')
|
|
149
|
+
throw new MayuraError(outcome.error.code, 'The complete output was withheld by its content boundary.');
|
|
150
|
+
return outcome.output;
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
deadline.close();
|
|
154
|
+
try {
|
|
155
|
+
void Promise.resolve(iterator?.return?.()).catch(() => { });
|
|
156
|
+
}
|
|
157
|
+
catch { /* The content boundary is already closed. */ }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=batches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batches.js","sourceRoot":"","sources":["../src/batches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAsC,MAAM,eAAe,CAAC;AAe9G,gHAAgH;AAChH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,cAAc,CACnC,MAA6B,EAAE,QAAkB,EAAE,QAAsB,EAAE,OAAO,GAAiB,EAAE;IAErG,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC;IAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC;IACtD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC;IAC7C,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC;IACtD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;QAAE,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAChJ,IAAI,iBAAiB,GAAG,GAAG,IAAI,aAAa,GAAG,aAAa;QAAE,MAAM,IAAI,WAAW,CAAC,gBAAgB,EAAE,uCAAuC,CAAC,CAAC;IAC/I,cAAc,CAAC,QAAQ,CAAC,CAAC;IACzB,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ;Q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AC,CAAC,CAAC;QACrF,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW;YAAE,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,2DAA2D,CAAC,CAAC;QAC3I,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC;YAAC,KAAK,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,6CAA6C,CAAC,CAAC;IAC7H,CAAC;AACH,CAAC","sourcesContent":["import { assertPositiveInteger, MayuraError, type GuardContext } from '@mayura/core';\nimport { assertPipeline, Deadline, snapshotContext, type GuardedContent, type Pipeline } from './pipeline.js';\n\nexport interface BatchOptions {\n readonly maxChunksPerBatch?: number;\n readonly maxBatchBytes?: number;\n readonly maxBatches?: number;\n readonly maxDurationMs?: number;\n}\n\nexport interface BufferedOutputOptions {\n readonly maxChunks?: number;\n readonly maxBytes?: number;\n readonly maxDurationMs?: number;\n}\n\n/** Release only independently admitted text batches. Earlier releases cannot be retracted by later verdicts. */\nexport async function* releaseBatches(\n source: AsyncIterable<string>, pipeline: Pipeline, supplied: GuardContext, options: BatchOptions = {},\n): AsyncIterable<GuardedContent> {\n const maxChunksPerBatch = options.maxChunksPerBatch ?? 16;\n const maxBatchBytes = options.maxBatchBytes ?? 65_536;\n const maxBatches = options.maxBatches ?? 128;\n const maxDurationMs = options.maxDurationMs ?? 30_000;\n for (const [name, value] of Object.entries({ maxChunksPerBatch, maxBatchBytes, maxBatches, maxDurationMs })) assertPositiveInteger(value, name);\n if (maxChunksPerBatch > 256 || maxDurationMs > 2_147_483_647) throw new MayuraError('INVALID_CONFIG', 'Batch limits exceed supported bounds.');\n assertPipeline(pipeline);\n const original = snapshotContext(supplied);\n if (original.boundary !== 'output') throw new MayuraError('INVALID_CONFIG', 'Batch release requires an output boundary context.');\n const deadline = new Deadline(original.signal, maxDurationMs);\n const context = snapshotContext(original, deadline.controller.signal);\n let iterator: AsyncIterator<string>;\n try {\n if (context.signal.aborted) await deadline.run(() => undefined);\n iterator = source[Symbol.asyncIterator]();\n }\n catch {\n deadline.close();\n if (original.signal.aborted) throw new MayuraError('CANCELLED', 'The output stream was cancelled.');\n throw new MayuraError('INVALID_OUTPUT', 'The output source could not be initialized.');\n }\n const encoder = new TextEncoder();\n let chunks: string[] = []; let bytes = 0; let released = 0;\n const admit = async (): Promise<GuardedContent> => {\n if (released >= maxBatches) throw new MayuraError('LIMIT_EXCEEDED', 'The output batch limit was reached.');\n const candidate = chunks.join(''); chunks = []; bytes = 0;\n const outcome = await deadline.run(() => pipeline.process(candidate, context));\n if (outcome.status !== 'succeeded') throw new MayuraError(outcome.error.code, 'An output batch was withheld by its content boundary.');\n released++;\n return outcome.output;\n };\n try {\n for (;;) {\n const next = await deadline.run(async () => {\n try {\n const entry = await iterator.next();\n const done = entry.done;\n if (done !== undefined && typeof done !== 'boolean') throw new Error();\n const value = done ? '' : entry.value;\n if (typeof value !== 'string') throw new Error();\n return { done: done === true, value };\n }\n catch { throw new MayuraError('INVALID_OUTPUT', 'The output source could not provide a valid batch.'); }\n });\n if (next.done) break;\n if (typeof next.value !== 'string') throw new MayuraError('INVALID_OUTPUT', 'The output source must provide text chunks.');\n const size = encoder.encode(next.value).length;\n if (size > maxBatchBytes) throw new MayuraError('LIMIT_EXCEEDED', 'An output chunk exceeds the batch byte limit.');\n if (chunks.length > 0 && bytes + size > maxBatchBytes) yield await admit();\n chunks.push(next.value); bytes += size;\n if (chunks.length >= maxChunksPerBatch) yield await admit();\n }\n if (chunks.length > 0) yield await admit();\n } finally {\n deadline.close();\n // Cleanup is cooperative; do not let an uncooperative iterator's return promise hang cancellation.\n try { void Promise.resolve(iterator.return?.()).catch(() => {}); } catch { /* The content boundary is already closed. */ }\n }\n}\n\n/** Buffer one bounded transcript and release it only after a whole-output pipeline decision. */\nexport async function releaseBufferedOutput(\n source: AsyncIterable<string>, pipeline: Pipeline, supplied: GuardContext, options: BufferedOutputOptions = {},\n): Promise<GuardedContent> {\n const maxChunks = options.maxChunks ?? 4_096;\n const maxBytes = options.maxBytes ?? 1_048_576;\n const maxDurationMs = options.maxDurationMs ?? 30_000;\n for (const [name, value] of Object.entries({ maxChunks, maxBytes, maxDurationMs })) assertPositiveInteger(value, name);\n if (maxChunks > 65_536 || maxBytes > 16 * 1_048_576 || maxDurationMs > 2_147_483_647) {\n throw new MayuraError('INVALID_CONFIG', 'Buffered output limits exceed supported bounds.');\n }\n assertPipeline(pipeline);\n const original = snapshotContext(supplied);\n if (original.boundary !== 'output') throw new MayuraError('INVALID_CONFIG', 'Buffered release requires an output boundary context.');\n const deadline = new Deadline(original.signal, maxDurationMs);\n const context = snapshotContext(original, deadline.controller.signal);\n let iterator: AsyncIterator<string> | undefined;\n try {\n if (context.signal.aborted) await deadline.run(() => undefined);\n try { iterator = source[Symbol.asyncIterator](); }\n catch {\n if (original.signal.aborted) throw new MayuraError('CANCELLED', 'The output stream was cancelled.');\n throw new MayuraError('INVALID_OUTPUT', 'The output source could not be initialized.');\n }\n const encoder = new TextEncoder(); const chunks: string[] = []; let bytes = 0;\n for (;;) {\n const next = await deadline.run(async () => {\n try {\n const entry = await iterator!.next();\n const done = entry.done;\n if (done !== undefined && typeof done !== 'boolean') throw new Error();\n const value = done ? '' : entry.value;\n if (typeof value !== 'string') throw new Error();\n return { done: done === true, value };\n } catch { throw new MayuraError('INVALID_OUTPUT', 'The output source could not provide valid text.'); }\n });\n if (next.done) break;\n if (chunks.length >= maxChunks) throw new MayuraError('LIMIT_EXCEEDED', 'The buffered output chunk limit was reached.');\n const size = encoder.encode(next.value).length;\n if (size > maxBytes - bytes) throw new MayuraError('LIMIT_EXCEEDED', 'The buffered output byte limit was reached.');\n chunks.push(next.value); bytes += size;\n }\n const outcome = await deadline.run(() => pipeline.process(chunks.join(''), context));\n if (outcome.status !== 'succeeded') throw new MayuraError(outcome.error.code, 'The complete output was withheld by its content boundary.');\n return outcome.output;\n } finally {\n deadline.close();\n try { void Promise.resolve(iterator?.return?.()).catch(() => {}); } catch { /* The content boundary is already closed. */ }\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type GuardContext, type JsonValue, type Outcome } from '../../core/dist/index.js';
|
|
2
|
+
import { type GuardedContent, type Pipeline } from './pipeline.js';
|
|
3
|
+
export type OutputDisclosurePart = {
|
|
4
|
+
readonly kind: 'text';
|
|
5
|
+
readonly text: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'tool_preview';
|
|
8
|
+
readonly toolId: string;
|
|
9
|
+
readonly preview: JsonValue;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'citation';
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly url: string;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'error';
|
|
16
|
+
readonly code: string;
|
|
17
|
+
readonly message?: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: 'event';
|
|
20
|
+
readonly event: JsonValue;
|
|
21
|
+
};
|
|
22
|
+
export interface OutputDisclosureOptions {
|
|
23
|
+
/** Exact HTTPS origins permitted for citations; query, fragment and credentials are always rejected. */
|
|
24
|
+
readonly allowedCitationOrigins?: readonly string[];
|
|
25
|
+
readonly maxParts?: number;
|
|
26
|
+
readonly maxInputBytes?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Converts rich output into a content-only candidate, withholding privileged preview/event/error details before guard evaluation. */
|
|
29
|
+
export declare function prepareOutputDisclosure(parts: readonly OutputDisclosurePart[], pipeline: Pipeline, supplied: GuardContext, options?: OutputDisclosureOptions): Promise<Outcome<GuardedContent>>;
|
|
30
|
+
//# sourceMappingURL=disclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dis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AE,OAAO,GAAE,uBAA4B,GACxH,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAwClC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsonValue, MayuraError } from '../../core/dist/index.js';
|
|
2
|
+
import { assertPipeline, snapshotContext } from './pipeline.js';
|
|
3
|
+
const errorCode = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
4
|
+
function fields(value, expected) {
|
|
5
|
+
if (!value || Array.isArray(value) || typeof value !== 'object')
|
|
6
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');
|
|
7
|
+
const names = Object.keys(value);
|
|
8
|
+
if (names.length !== expected.length || expected.some(key => !Object.hasOwn(value, key))) {
|
|
9
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
function bounded(value, maximum = 65_536) {
|
|
14
|
+
if (typeof value !== 'string' || value.length > maximum)
|
|
15
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure text is invalid.');
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function origins(values) {
|
|
19
|
+
if (!Array.isArray(values) || values.length > 64)
|
|
20
|
+
throw new MayuraError('INVALID_CONFIG', 'Citation origins must be a bounded array.');
|
|
21
|
+
const result = new Set();
|
|
22
|
+
for (const value of values) {
|
|
23
|
+
if (typeof value !== 'string' || value.length > 256)
|
|
24
|
+
throw new MayuraError('INVALID_CONFIG', 'Citation origin is invalid.');
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = new URL(value);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new MayuraError('INVALID_CONFIG', 'Citation origin is invalid.');
|
|
31
|
+
}
|
|
32
|
+
if (parsed.protocol !== 'https:' || parsed.username || parsed.password || parsed.pathname !== '/' || parsed.search || parsed.hash
|
|
33
|
+
|| parsed.origin !== value.replace(/\/$/u, ''))
|
|
34
|
+
throw new MayuraError('INVALID_CONFIG', 'Citation origins must be exact HTTPS origins.');
|
|
35
|
+
if (result.has(parsed.origin))
|
|
36
|
+
throw new MayuraError('INVALID_CONFIG', 'Citation origins must be unique.');
|
|
37
|
+
result.add(parsed.origin);
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/** Converts rich output into a content-only candidate, withholding privileged preview/event/error details before guard evaluation. */
|
|
42
|
+
export async function prepareOutputDisclosure(parts, pipeline, supplied, options = {}) {
|
|
43
|
+
const maxParts = options.maxParts ?? 256;
|
|
44
|
+
const maxInputBytes = options.maxInputBytes ?? 1_048_576;
|
|
45
|
+
if (!Number.isSafeInteger(maxParts) || maxParts < 1 || maxParts > 4_096
|
|
46
|
+
|| !Number.isSafeInteger(maxInputBytes) || maxInputBytes < 1 || maxInputBytes > 16 * 1_048_576) {
|
|
47
|
+
throw new MayuraError('INVALID_CONFIG', 'Output disclosure limits are invalid.');
|
|
48
|
+
}
|
|
49
|
+
assertPipeline(pipeline);
|
|
50
|
+
const context = snapshotContext(supplied);
|
|
51
|
+
if (context.boundary !== 'output')
|
|
52
|
+
throw new MayuraError('INVALID_CONFIG', 'Output disclosure requires an output boundary context.');
|
|
53
|
+
let copied;
|
|
54
|
+
try {
|
|
55
|
+
copied = jsonValue(parts, { maxBytes: maxInputBytes });
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure input exceeds its plain-JSON boundary.');
|
|
59
|
+
}
|
|
60
|
+
if (!Array.isArray(copied) || copied.length > maxParts)
|
|
61
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure parts exceed their limit.');
|
|
62
|
+
const allowed = origins(options.allowedCitationOrigins ?? []);
|
|
63
|
+
const rendered = [];
|
|
64
|
+
for (const item of copied) {
|
|
65
|
+
if (!item || Array.isArray(item) || typeof item !== 'object' || typeof item['kind'] !== 'string') {
|
|
66
|
+
throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');
|
|
67
|
+
}
|
|
68
|
+
switch (item['kind']) {
|
|
69
|
+
case 'text':
|
|
70
|
+
rendered.push(bounded(fields(item, ['kind', 'text'])['text']));
|
|
71
|
+
break;
|
|
72
|
+
case 'tool_preview':
|
|
73
|
+
fields(item, ['kind', 'toolId', 'preview']);
|
|
74
|
+
rendered.push('[tool preview withheld]');
|
|
75
|
+
break;
|
|
76
|
+
case 'event':
|
|
77
|
+
fields(item, ['kind', 'event']);
|
|
78
|
+
rendered.push('[event withheld]');
|
|
79
|
+
break;
|
|
80
|
+
case 'error': {
|
|
81
|
+
const value = fields(item, Object.hasOwn(item, 'message') ? ['kind', 'code', 'message'] : ['kind', 'code']);
|
|
82
|
+
if (Object.hasOwn(value, 'message'))
|
|
83
|
+
bounded(value['message']);
|
|
84
|
+
const code = bounded(value['code'], 64);
|
|
85
|
+
rendered.push(`[error:${errorCode.test(code) ? code : 'UNKNOWN'}]`);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 'citation': {
|
|
89
|
+
const value = fields(item, ['kind', 'label', 'url']);
|
|
90
|
+
const label = bounded(value['label'], 4_096);
|
|
91
|
+
const raw = bounded(value['url'], 2_048);
|
|
92
|
+
let url;
|
|
93
|
+
try {
|
|
94
|
+
url = new URL(raw);
|
|
95
|
+
}
|
|
96
|
+
catch { /* Withhold malformed citation destinations. */ }
|
|
97
|
+
if (!url || url.protocol !== 'https:' || url.username || url.password || url.search || url.hash || !allowed.has(url.origin)) {
|
|
98
|
+
rendered.push('[citation withheld]');
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
rendered.push(`${label} [${url.href}]`);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
default: throw new MayuraError('INVALID_INPUT', 'Output disclosure part kind is unsupported.');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return pipeline.process(rendered.join('\n'), context);
|
|
108
|
+
}
|
|
109
|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AS,GAAG,CAAC,CAAC;gBAAC,MAAM;YACtH,CAAC;YACD,KAAK,UAAU,EAAE,CAAC;gBAChB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;gBAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;gBAAC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC7I,IAAI,GAAoB,CAAC;gBACzB,IAAI,CAAC;oBAAC,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;gBAAC,CAAC;gBAAC,MAAM,CAAC,CAAC,+CAA+C,CAAC,CAAC;gBACrF,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC5H,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;gBACvC,CAAC;;oBAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;gBAC/C,MAAM;YACR,CAAC;YACD,SAAS,MAAM,IAAI,WAAW,CAAC,eAAe,EAAE,6CAA6C,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { jsonValue, MayuraError, type GuardContext, type JsonValue, type Outcome } from '@mayura/core';\nimport { assertPipeline, snapshotContext, type GuardedContent, type Pipeline } from './pipeline.js';\n\nexport type OutputDisclosurePart =\n | { readonly kind: 'text'; readonly text: string }\n | { readonly kind: 'tool_preview'; readonly toolId: string; readonly preview: JsonValue }\n | { readonly kind: 'citation'; readonly label: string; readonly url: string }\n | { readonly kind: 'error'; readonly code: string; readonly message?: string }\n | { readonly kind: 'event'; readonly event: JsonValue };\n\nexport interface OutputDisclosureOptions {\n /** Exact HTTPS origins permitted for citations; query, fragment and credentials are always rejected. */\n readonly allowedCitationOrigins?: readonly string[];\n readonly maxParts?: number;\n readonly maxInputBytes?: number;\n}\n\nconst errorCode = /^[A-Z][A-Z0-9_]{0,63}$/;\n\nfunction fields(value: JsonValue, expected: readonly string[]): Record<string, JsonValue> {\n if (!value || Array.isArray(value) || typeof value !== 'object') throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');\n const names = Object.keys(value);\n if (names.length !== expected.length || expected.some(key => !Object.hasOwn(value, key))) {\n throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');\n }\n return value;\n}\n\nfunction bounded(value: JsonValue | undefined, maximum = 65_536): string {\n if (typeof value !== 'string' || value.length > maximum) throw new MayuraError('INVALID_INPUT', 'Output disclosure text is invalid.');\n return value;\n}\n\nfunction origins(values: readonly string[]): ReadonlySet<string> {\n if (!Array.isArray(values) || values.length > 64) throw new MayuraError('INVALID_CONFIG', 'Citation origins must be a bounded array.');\n const result = new Set<string>();\n for (const value of values) {\n if (typeof value !== 'string' || value.length > 256) throw new MayuraError('INVALID_CONFIG', 'Citation origin is invalid.');\n let parsed: URL;\n try { parsed = new URL(value); } catch { throw new MayuraError('INVALID_CONFIG', 'Citation origin is invalid.'); }\n if (parsed.protocol !== 'https:' || parsed.username || parsed.password || parsed.pathname !== '/' || parsed.search || parsed.hash\n || parsed.origin !== value.replace(/\\/$/u, '')) throw new MayuraError('INVALID_CONFIG', 'Citation origins must be exact HTTPS origins.');\n if (result.has(parsed.origin)) throw new MayuraError('INVALID_CONFIG', 'Citation origins must be unique.');\n result.add(parsed.origin);\n }\n return result;\n}\n\n/** Converts rich output into a content-only candidate, withholding privileged preview/event/error details before guard evaluation. */\nexport async function prepareOutputDisclosure(\n parts: readonly OutputDisclosurePart[], pipeline: Pipeline, supplied: GuardContext, options: OutputDisclosureOptions = {},\n): Promise<Outcome<GuardedContent>> {\n const maxParts = options.maxParts ?? 256; const maxInputBytes = options.maxInputBytes ?? 1_048_576;\n if (!Number.isSafeInteger(maxParts) || maxParts < 1 || maxParts > 4_096\n || !Number.isSafeInteger(maxInputBytes) || maxInputBytes < 1 || maxInputBytes > 16 * 1_048_576) {\n throw new MayuraError('INVALID_CONFIG', 'Output disclosure limits are invalid.');\n }\n assertPipeline(pipeline);\n const context = snapshotContext(supplied);\n if (context.boundary !== 'output') throw new MayuraError('INVALID_CONFIG', 'Output disclosure requires an output boundary context.');\n let copied: JsonValue;\n try { copied = jsonValue(parts, { maxBytes: maxInputBytes }); }\n catch { throw new MayuraError('INVALID_INPUT', 'Output disclosure input exceeds its plain-JSON boundary.'); }\n if (!Array.isArray(copied) || copied.length > maxParts) throw new MayuraError('INVALID_INPUT', 'Output disclosure parts exceed their limit.');\n const allowed = origins(options.allowedCitationOrigins ?? []); const rendered: string[] = [];\n for (const item of copied) {\n if (!item || Array.isArray(item) || typeof item !== 'object' || typeof item['kind'] !== 'string') {\n throw new MayuraError('INVALID_INPUT', 'Output disclosure parts are malformed.');\n }\n switch (item['kind']) {\n case 'text': rendered.push(bounded(fields(item, ['kind', 'text'])['text'])); break;\n case 'tool_preview': fields(item, ['kind', 'toolId', 'preview']); rendered.push('[tool preview withheld]'); break;\n case 'event': fields(item, ['kind', 'event']); rendered.push('[event withheld]'); break;\n case 'error': {\n const value = fields(item, Object.hasOwn(item, 'message') ? ['kind', 'code', 'message'] : ['kind', 'code']);\n if (Object.hasOwn(value, 'message')) bounded(value['message']);\n const code = bounded(value['code'], 64); rendered.push(`[error:${errorCode.test(code) ? code : 'UNKNOWN'}]`); break;\n }\n case 'citation': {\n const value = fields(item, ['kind', 'label', 'url']); const label = bounded(value['label'], 4_096); const raw = bounded(value['url'], 2_048);\n let url: URL | undefined;\n try { url = new URL(raw); } catch { /* Withhold malformed citation destinations. */ }\n if (!url || url.protocol !== 'https:' || url.username || url.password || url.search || url.hash || !allowed.has(url.origin)) {\n rendered.push('[citation withheld]');\n } else rendered.push(`${label} [${url.href}]`);\n break;\n }\n default: throw new MayuraError('INVALID_INPUT', 'Output disclosure part kind is unsupported.');\n }\n }\n return pipeline.process(rendered.join('\\n'), context);\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Guard } from '../../core/dist/index.js';
|
|
2
|
+
import { type ContentProcessor } from './pipeline.js';
|
|
3
|
+
/** Preserve only content and assign user authority locally; untrusted role/tool metadata is discarded. */
|
|
4
|
+
export declare function normalizeUserMessage(): ContentProcessor;
|
|
5
|
+
export interface RedactPIIOptions {
|
|
6
|
+
readonly email?: boolean;
|
|
7
|
+
readonly phone?: boolean;
|
|
8
|
+
readonly emailReplacement?: string;
|
|
9
|
+
readonly phoneReplacement?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Heuristic string-value redaction, not complete PII detection or compliance certification. */
|
|
12
|
+
export declare function redactPII(options?: RedactPIIOptions): ContentProcessor;
|
|
13
|
+
export interface ProtectLiteralsOptions {
|
|
14
|
+
readonly literals: readonly string[];
|
|
15
|
+
readonly caseSensitive?: boolean;
|
|
16
|
+
readonly id?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Blocks configured literal substrings only; this is not a semantic prompt-injection detector. */
|
|
19
|
+
export declare function protectLiterals(options: ProtectLiteralsOptions): Guard;
|
|
20
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,KAAK,EAAkB,MAAM,cAAc,CAAC;AAClF,OAAO,EAAe,KAAK,gBAAgB,EAAwB,MAAM,eAAe,CAAC;AAEzF,0GAA0G;AAC1G,wBAAgB,oBAAoB,IAAI,gBAAgB,CAOvD;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,gBAAgB,CAqB1E;AAED,MAAM,WAAW,sBAAsB;IAAG,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE;AAExI,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,KAAK,CAmBtE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsonValue, MayuraError } from '../../core/dist/index.js';
|
|
2
|
+
import { boundedText } from './pipeline.js';
|
|
3
|
+
/** Preserve only content and assign user authority locally; untrusted role/tool metadata is discarded. */
|
|
4
|
+
export function normalizeUserMessage() {
|
|
5
|
+
return Object.freeze({ id: 'native.normalize-user-message', version: '1', process: (snapshot) => {
|
|
6
|
+
const input = snapshot.value;
|
|
7
|
+
if (typeof input === 'string')
|
|
8
|
+
return { role: 'user', content: input };
|
|
9
|
+
if (input && typeof input === 'object' && !Array.isArray(input) && Object.hasOwn(input, 'content'))
|
|
10
|
+
return { role: 'user', content: input['content'] };
|
|
11
|
+
throw new MayuraError('INVALID_INPUT', 'A user message must be text or a content envelope.');
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
14
|
+
/** Heuristic string-value redaction, not complete PII detection or compliance certification. */
|
|
15
|
+
export function redactPII(options = {}) {
|
|
16
|
+
const email = options.email ?? true;
|
|
17
|
+
const phone = options.phone ?? false;
|
|
18
|
+
if (typeof email !== 'boolean' || typeof phone !== 'boolean')
|
|
19
|
+
throw new MayuraError('INVALID_CONFIG', 'PII recognizers must be explicitly enabled or disabled.');
|
|
20
|
+
const emailReplacement = options.emailReplacement ?? '[EMAIL]';
|
|
21
|
+
const phoneReplacement = options.phoneReplacement ?? '[PHONE]';
|
|
22
|
+
boundedText(emailReplacement, 'emailReplacement', 128);
|
|
23
|
+
boundedText(phoneReplacement, 'phoneReplacement', 128);
|
|
24
|
+
const redactString = (value) => {
|
|
25
|
+
// Bounded spans avoid input-driven unbounded regex backtracking on punctuation-heavy text.
|
|
26
|
+
let result = email ? value.replace(/\b[A-Z0-9._%+-]{1,64}@[A-Z0-9.-]{1,253}\.[A-Z]{2,63}\b/gi, () => emailReplacement) : value;
|
|
27
|
+
if (phone)
|
|
28
|
+
result = result.replace(/(?<![\w])\+?\d[\d ()-]{6,48}\d(?![\w])/g, (match) => {
|
|
29
|
+
const digits = match.replace(/\D/g, '').length;
|
|
30
|
+
return digits >= 10 && digits <= 15 ? phoneReplacement : match;
|
|
31
|
+
});
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
const visit = (value) => {
|
|
35
|
+
if (typeof value === 'string')
|
|
36
|
+
return redactString(value);
|
|
37
|
+
if (Array.isArray(value))
|
|
38
|
+
return value.map(visit);
|
|
39
|
+
if (value && typeof value === 'object')
|
|
40
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, visit(child)]));
|
|
41
|
+
return value;
|
|
42
|
+
};
|
|
43
|
+
return Object.freeze({ id: 'native.redact-pii', version: '1', process: (snapshot) => visit(snapshot.value) });
|
|
44
|
+
}
|
|
45
|
+
/** Blocks configured literal substrings only; this is not a semantic prompt-injection detector. */
|
|
46
|
+
export function protectLiterals(options) {
|
|
47
|
+
if (!Array.isArray(options.literals) || options.literals.length === 0 || options.literals.length > 128)
|
|
48
|
+
throw new MayuraError('INVALID_CONFIG', 'One to 128 bounded protected literals are required.');
|
|
49
|
+
const caseSensitive = options.caseSensitive ?? true;
|
|
50
|
+
if (typeof caseSensitive !== 'boolean')
|
|
51
|
+
throw new MayuraError('INVALID_CONFIG', 'caseSensitive must be a boolean.');
|
|
52
|
+
const normalize = (value) => caseSensitive ? value : value.toLowerCase();
|
|
53
|
+
const literals = Object.freeze(options.literals.map((literal) => { boundedText(literal, 'protected literal', 4_096); return normalize(literal); }));
|
|
54
|
+
const id = options.id ?? 'native.protect-literals';
|
|
55
|
+
boundedText(id, 'guard.id', 128);
|
|
56
|
+
const matches = (value) => { const candidate = normalize(value); return literals.some((literal) => candidate.includes(literal)); };
|
|
57
|
+
const contains = (value) => {
|
|
58
|
+
if (typeof value === 'string')
|
|
59
|
+
return matches(value);
|
|
60
|
+
if (Array.isArray(value))
|
|
61
|
+
return value.some(contains);
|
|
62
|
+
if (value && typeof value === 'object')
|
|
63
|
+
return Object.entries(value).some(([key, child]) => matches(key) || contains(child));
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
return Object.freeze({ id, check: (value) => {
|
|
67
|
+
// Standalone use still validates its boundary rather than inspecting getters or exotic values.
|
|
68
|
+
const safe = jsonValue(value);
|
|
69
|
+
return { decision: contains(safe) ? 'block' : 'allow' };
|
|
70
|
+
} });
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA8B,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,WAAW,EAA+C,MAAM,eAAe,CAAC;AAEzF,0GAA0G;AAC1G,MAAM,UAAU,oBAAoB;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,+BAA+B,EAAE,OA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AAE;QAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;QACrD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7H,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,KAAgB,EAAE,EAAE;YACrD,+FAA+F;YAC/F,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9B,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAgB,CAAC,CAAC,CAAC,OAAgB,EAAE,CAAC;QAC5E,CAAC,EAAE,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { jsonValue, MayuraError, type Guard, type JsonValue } from '@mayura/core';\nimport { boundedText, type ContentProcessor, type ContentSnapshot } from './pipeline.js';\n\n/** Preserve only content and assign user authority locally; untrusted role/tool metadata is discarded. */\nexport function normalizeUserMessage(): ContentProcessor {\n return Object.freeze({ id: 'native.normalize-user-message', version: '1', process: (snapshot: ContentSnapshot) => {\n const input = snapshot.value;\n if (typeof input === 'string') return { role: 'user', content: input };\n if (input && typeof input === 'object' && !Array.isArray(input) && Object.hasOwn(input, 'content')) return { role: 'user', content: input['content']! };\n throw new MayuraError('INVALID_INPUT', 'A user message must be text or a content envelope.');\n } });\n}\n\nexport interface RedactPIIOptions {\n readonly email?: boolean;\n readonly phone?: boolean;\n readonly emailReplacement?: string;\n readonly phoneReplacement?: string;\n}\n\n/** Heuristic string-value redaction, not complete PII detection or compliance certification. */\nexport function redactPII(options: RedactPIIOptions = {}): ContentProcessor {\n const email = options.email ?? true; const phone = options.phone ?? false;\n if (typeof email !== 'boolean' || typeof phone !== 'boolean') throw new MayuraError('INVALID_CONFIG', 'PII recognizers must be explicitly enabled or disabled.');\n const emailReplacement = options.emailReplacement ?? '[EMAIL]'; const phoneReplacement = options.phoneReplacement ?? '[PHONE]';\n boundedText(emailReplacement, 'emailReplacement', 128); boundedText(phoneReplacement, 'phoneReplacement', 128);\n const redactString = (value: string): string => {\n // Bounded spans avoid input-driven unbounded regex backtracking on punctuation-heavy text.\n let result = email ? value.replace(/\\b[A-Z0-9._%+-]{1,64}@[A-Z0-9.-]{1,253}\\.[A-Z]{2,63}\\b/gi, () => emailReplacement) : value;\n if (phone) result = result.replace(/(?<![\\w])\\+?\\d[\\d ()-]{6,48}\\d(?![\\w])/g, (match) => {\n const digits = match.replace(/\\D/g, '').length;\n return digits >= 10 && digits <= 15 ? phoneReplacement : match;\n });\n return result;\n };\n const visit = (value: JsonValue): JsonValue => {\n if (typeof value === 'string') return redactString(value);\n if (Array.isArray(value)) return value.map(visit);\n if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, visit(child)]));\n return value;\n };\n return Object.freeze({ id: 'native.redact-pii', version: '1', process: (snapshot: ContentSnapshot) => visit(snapshot.value) });\n}\n\nexport interface ProtectLiteralsOptions { readonly literals: readonly string[]; readonly caseSensitive?: boolean; readonly id?: string }\n\n/** Blocks configured literal substrings only; this is not a semantic prompt-injection detector. */\nexport function protectLiterals(options: ProtectLiteralsOptions): Guard {\n if (!Array.isArray(options.literals) || options.literals.length === 0 || options.literals.length > 128) throw new MayuraError('INVALID_CONFIG', 'One to 128 bounded protected literals are required.');\n const caseSensitive = options.caseSensitive ?? true;\n if (typeof caseSensitive !== 'boolean') throw new MayuraError('INVALID_CONFIG', 'caseSensitive must be a boolean.');\n const normalize = (value: string): string => caseSensitive ? value : value.toLowerCase();\n const literals = Object.freeze(options.literals.map((literal) => { boundedText(literal, 'protected literal', 4_096); return normalize(literal); }));\n const id = options.id ?? 'native.protect-literals'; boundedText(id, 'guard.id', 128);\n const matches = (value: string): boolean => { const candidate = normalize(value); return literals.some((literal) => candidate.includes(literal)); };\n const contains = (value: JsonValue): boolean => {\n if (typeof value === 'string') return matches(value);\n if (Array.isArray(value)) return value.some(contains);\n if (value && typeof value === 'object') return Object.entries(value).some(([key, child]) => matches(key) || contains(child));\n return false;\n };\n return Object.freeze({ id, check: (value: JsonValue) => {\n // Standalone use still validates its boundary rather than inspecting getters or exotic values.\n const safe = jsonValue(value);\n return { decision: contains(safe) ? 'block' as const : 'allow' as const };\n } });\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createPipeline, type ContentSnapshot, type ContentProcessor, type GuardEvidence, type GuardedContent, type Pipeline, type PipelineOptions, type BlockEvent } from './pipeline.js';
|
|
2
|
+
export { normalizeUserMessage, redactPII, protectLiterals, type RedactPIIOptions, type ProtectLiteralsOptions } from './helpers.js';
|
|
3
|
+
export { releaseBatches, releaseBufferedOutput, type BatchOptions, type BufferedOutputOptions } from './batches.js';
|
|
4
|
+
export { prepareOutputDisclosure, type OutputDisclosureOptions, type OutputDisclosurePart } from './disclosure.js';
|
|
5
|
+
export { createAuxiliaryCheck, type AuxiliaryLimits, type AuxiliaryOptions, type AuxiliaryEvidence, type AuxiliaryResult, type AuxiliaryCheck } from './auxiliary.js';
|
|
6
|
+
export { detectAndTranslate, createModerationGuard, type LanguageSegment, type LanguageDocument, type LanguageDetection, type DetectAndTranslateOptions, type LanguageResult, type ModerationVerdict, type ModerationOptions, type ModerationGuard } from './auxiliary-helpers.js';
|
|
7
|
+
export { defineModerationGuard, type ManagedModerationOptions } from './managed.js';
|
|
8
|
+
export { pipelineGuard } from './agent-guard.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3L,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,KAAK,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAAE,KAAK,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtK,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnR,OAAO,EAAE,qBAAqB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createPipeline } from './pipeline.js';
|
|
2
|
+
export { normalizeUserMessage, redactPII, protectLiterals } from './helpers.js';
|
|
3
|
+
export { releaseBatches, releaseBufferedOutput } from './batches.js';
|
|
4
|
+
export { prepareOutputDisclosure } from './disclosure.js';
|
|
5
|
+
export { createAuxiliaryCheck } from './auxiliary.js';
|
|
6
|
+
export { detectAndTranslate, createModerationGuard } from './auxiliary-helpers.js';
|
|
7
|
+
export { defineModerationGuard } from './managed.js';
|
|
8
|
+
export { pipelineGuard } from './agent-guard.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8I,MAAM,eAAe,CAAC;AAC3L,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe,EAAsD,MAAM,cAAc,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAiD,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,uBAAuB,EAA2D,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAkH,MAAM,gBAAgB,CAAC;AACtK,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAkM,MAAM,wBAAwB,CAAC;AACnR,OAAO,EAAE,qBAAqB,EAAiC,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { createPipeline, type ContentSnapshot, type ContentProcessor, type GuardEvidence, type GuardedContent, type Pipeline, type PipelineOptions, type BlockEvent } from './pipeline.js';\nexport { normalizeUserMessage, redactPII, protectLiterals, type RedactPIIOptions, type ProtectLiteralsOptions } from './helpers.js';\nexport { releaseBatches, releaseBufferedOutput, type BatchOptions, type BufferedOutputOptions } from './batches.js';\nexport { prepareOutputDisclosure, type OutputDisclosureOptions, type OutputDisclosurePart } from './disclosure.js';\nexport { createAuxiliaryCheck, type AuxiliaryLimits, type AuxiliaryOptions, type AuxiliaryEvidence, type AuxiliaryResult, type AuxiliaryCheck } from './auxiliary.js';\nexport { detectAndTranslate, createModerationGuard, type LanguageSegment, type LanguageDocument, type LanguageDetection, type DetectAndTranslateOptions, type LanguageResult, type ModerationVerdict, type ModerationOptions, type ModerationGuard } from './auxiliary-helpers.js';\nexport { defineModerationGuard, type ManagedModerationOptions } from './managed.js';\nexport { pipelineGuard } from './agent-guard.js';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Guard, type ManagedGuardDefinition, type ModelAdapter } from '../../core/dist/index.js';
|
|
2
|
+
import type { AuxiliaryLimits } from './auxiliary.js';
|
|
3
|
+
/** Definition-only moderation policy. It can execute only through a qualified owning runtime. */
|
|
4
|
+
export interface ManagedModerationOptions {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
readonly model: ModelAdapter;
|
|
8
|
+
readonly instructions: string;
|
|
9
|
+
/** Required explicit choice; [] provides no local destination-screening guarantee. */
|
|
10
|
+
readonly egressGuards: readonly Guard[];
|
|
11
|
+
readonly limits?: AuxiliaryLimits;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Capture a fixed moderation policy without calling a model or allocating a budget. Local guards
|
|
15
|
+
* must capture the application's selected destination policy; no provider URL is inferred here.
|
|
16
|
+
*/
|
|
17
|
+
export declare function defineModerationGuard(value: ManagedModerationOptions): ManagedGuardDefinition;
|
|
18
|
+
//# sourceMappingURL=managed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed.d.ts","sourceRoot":"","sources":["../src/managed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,KAAK,EAAmC,KAAK,sBAAsB,EACpF,KAAK,YAAY,EAAe,MAAM,cAAc,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,iGAAiG;AACjG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sFAAsF;IACtF,QAAQ,CAAC,YAAY,EAAE,SAAS,KAAK,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;CACnC;AAoBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,GAAG,sBAAsB,CAyB7F"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { freezeJson, jsonValue, MayuraError } from '../../core/dist/index.js';
|
|
2
|
+
import { registerManagedGuardDefinition } from '../../core/dist/host.js';
|
|
3
|
+
const defaults = Object.freeze({ timeoutMs: 10_000, maxInputBytes: 65_536, maxOutputBytes: 65_536, maxOutputTokens: 1_024 });
|
|
4
|
+
const fields = ['id', 'version', 'model', 'instructions', 'egressGuards', 'limits'];
|
|
5
|
+
function nativeSchema(read) {
|
|
6
|
+
return Object.freeze({ '~standard': Object.freeze({ version: 1, vendor: 'mayura.managed-moderation', validate: (value) => {
|
|
7
|
+
try {
|
|
8
|
+
return { value: read(value) };
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return { issues: [{ message: 'Invalid managed moderation structure.' }] };
|
|
12
|
+
}
|
|
13
|
+
} }) });
|
|
14
|
+
}
|
|
15
|
+
const outputSchema = nativeSchema(value => {
|
|
16
|
+
const safe = jsonValue(value, { maxBytes: 65_536 });
|
|
17
|
+
if (!safe || typeof safe !== 'object' || Array.isArray(safe))
|
|
18
|
+
throw new Error();
|
|
19
|
+
const keys = Object.keys(safe);
|
|
20
|
+
const categories = safe['categories'];
|
|
21
|
+
const decision = safe['decision'];
|
|
22
|
+
if (keys.length !== 2 || !Object.hasOwn(safe, 'decision') || !Object.hasOwn(safe, 'categories') || (decision !== 'allow' && decision !== 'block')
|
|
23
|
+
|| !Array.isArray(categories) || categories.length > 32 || categories.some(category => typeof category !== 'string' || !/^[a-z0-9][a-z0-9._-]{0,63}$/.test(category))
|
|
24
|
+
|| new Set(categories).size !== categories.length)
|
|
25
|
+
throw new Error();
|
|
26
|
+
return Object.freeze({ decision, categories: Object.freeze(categories) });
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Capture a fixed moderation policy without calling a model or allocating a budget. Local guards
|
|
30
|
+
* must capture the application's selected destination policy; no provider URL is inferred here.
|
|
31
|
+
*/
|
|
32
|
+
export function defineModerationGuard(value) {
|
|
33
|
+
try {
|
|
34
|
+
if (!value || typeof value !== 'object' || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
35
|
+
throw new Error();
|
|
36
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
37
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
38
|
+
if (keys.some(key => typeof key !== 'string' || !fields.includes(key)))
|
|
39
|
+
throw new Error();
|
|
40
|
+
const config = Object.create(null);
|
|
41
|
+
for (const key of fields) {
|
|
42
|
+
const descriptor = descriptors[key];
|
|
43
|
+
if (key === 'limits' && !descriptor)
|
|
44
|
+
continue;
|
|
45
|
+
if (!descriptor || !descriptor.enumerable || !('value' in descriptor))
|
|
46
|
+
throw new Error();
|
|
47
|
+
config[key] = descriptor.value;
|
|
48
|
+
}
|
|
49
|
+
let overrides = {};
|
|
50
|
+
if (Object.hasOwn(config, 'limits')) {
|
|
51
|
+
const parsed = jsonValue(config['limits'], { maxBytes: 1_024 });
|
|
52
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed) || Object.keys(parsed).some(key => !Object.hasOwn(defaults, key)))
|
|
53
|
+
throw new Error();
|
|
54
|
+
overrides = parsed;
|
|
55
|
+
}
|
|
56
|
+
const limits = Object.freeze({ ...defaults, ...overrides });
|
|
57
|
+
// Match the explicitly configured boundary instead of imposing jsonValue's unrelated default.
|
|
58
|
+
const input = nativeSchema(candidate => freezeJson(jsonValue(candidate, { maxBytes: limits.maxInputBytes })));
|
|
59
|
+
return registerManagedGuardDefinition({ kind: 'moderation', id: config['id'], version: config['version'],
|
|
60
|
+
model: config['model'], instructions: config['instructions'], input, output: outputSchema,
|
|
61
|
+
egressGuards: config['egressGuards'], limits });
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new MayuraError('INVALID_CONFIG', 'Managed moderation requires an explicit model, policy, local screening list and finite limits.');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=managed.js.map
|