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,105 @@
|
|
|
1
|
+
import { MayuraError, freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';
|
|
2
|
+
|
|
3
|
+
const DIGEST = /^sha256:[0-9a-f]{64}$/u;
|
|
4
|
+
const EVENT_ID = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/u;
|
|
5
|
+
|
|
6
|
+
function assertSignal(signal: AbortSignal): void {
|
|
7
|
+
if (!(signal instanceof AbortSignal)) throw new MayuraError('INVALID_CONFIG', 'An AbortSignal is required.');
|
|
8
|
+
if (signal.aborted) throw new MayuraError('CANCELLED', 'The operation was cancelled.');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ArtifactStage<R> {
|
|
12
|
+
write(chunk: Uint8Array): void | Promise<void>;
|
|
13
|
+
commit(): R | Promise<R>;
|
|
14
|
+
discard(): void | Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ArtifactTransferOptions {
|
|
18
|
+
readonly signal: AbortSignal;
|
|
19
|
+
readonly expectedDigest: string;
|
|
20
|
+
readonly maxBytes: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Stages bounded bytes, verifies SHA-256, and only then makes the destination visible. */
|
|
24
|
+
export async function transferArtifact<R>(
|
|
25
|
+
source: AsyncIterable<Uint8Array>,
|
|
26
|
+
stage: ArtifactStage<R>,
|
|
27
|
+
options: ArtifactTransferOptions,
|
|
28
|
+
): Promise<Readonly<{ result: R; bytes: number; digest: string }>> {
|
|
29
|
+
assertSignal(options.signal);
|
|
30
|
+
if (!DIGEST.test(options.expectedDigest) || !Number.isSafeInteger(options.maxBytes)
|
|
31
|
+
|| options.maxBytes <= 0 || options.maxBytes > 67_108_864) {
|
|
32
|
+
throw new MayuraError('INVALID_CONFIG', 'Artifact transfer requires a bounded size and SHA-256 digest.');
|
|
33
|
+
}
|
|
34
|
+
let total = 0; const chunks: Uint8Array[] = [];
|
|
35
|
+
try {
|
|
36
|
+
for await (const raw of source) {
|
|
37
|
+
assertSignal(options.signal);
|
|
38
|
+
if (!(raw instanceof Uint8Array) || (typeof SharedArrayBuffer !== 'undefined' && raw.buffer instanceof SharedArrayBuffer)) {
|
|
39
|
+
throw new MayuraError('INVALID_OUTPUT', 'Artifact source returned an invalid byte chunk.');
|
|
40
|
+
}
|
|
41
|
+
const chunk = new Uint8Array(raw);
|
|
42
|
+
total += chunk.byteLength;
|
|
43
|
+
if (!Number.isSafeInteger(total) || total > options.maxBytes) throw new MayuraError('LIMIT_EXCEEDED', 'Artifact exceeded its transfer limit.');
|
|
44
|
+
chunks.push(chunk); await stage.write(chunk);
|
|
45
|
+
}
|
|
46
|
+
const content = new Uint8Array(total); let offset = 0;
|
|
47
|
+
for (const chunk of chunks) { content.set(chunk, offset); offset += chunk.byteLength; }
|
|
48
|
+
const hash = new Uint8Array(await crypto.subtle.digest('SHA-256', content));
|
|
49
|
+
const digest = `sha256:${[...hash].map(byte => byte.toString(16).padStart(2, '0')).join('')}`;
|
|
50
|
+
if (digest !== options.expectedDigest) throw new MayuraError('INTEGRITY_VIOLATION', 'Artifact digest did not match.');
|
|
51
|
+
assertSignal(options.signal);
|
|
52
|
+
const result = await stage.commit();
|
|
53
|
+
return Object.freeze({ result, bytes: total, digest });
|
|
54
|
+
} catch (error) {
|
|
55
|
+
try { await stage.discard(); } catch { /* Preserve the primary transfer failure. */ }
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
61
|
+
|
|
62
|
+
export interface RedactedLoggerOptions {
|
|
63
|
+
readonly allowedFields: readonly string[];
|
|
64
|
+
readonly redactedFields?: readonly string[];
|
|
65
|
+
readonly clock?: () => number;
|
|
66
|
+
readonly maxBytes?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface RedactedLogger {
|
|
70
|
+
log(level: LogLevel, event: string, fields?: Readonly<Record<string, unknown>>): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Emits allowlisted bounded JSON; configured sensitive fields become fixed markers. */
|
|
74
|
+
export function createRedactedLogger(
|
|
75
|
+
sink: (entry: JsonObject) => void | Promise<void>,
|
|
76
|
+
options: RedactedLoggerOptions,
|
|
77
|
+
): RedactedLogger {
|
|
78
|
+
if (!Array.isArray(options.allowedFields) || options.allowedFields.length > 128) {
|
|
79
|
+
throw new MayuraError('INVALID_CONFIG', 'Logger field allowlist is invalid.');
|
|
80
|
+
}
|
|
81
|
+
const allowed = new Set(options.allowedFields); const redacted = new Set(options.redactedFields ?? []);
|
|
82
|
+
if ([...allowed, ...redacted].some(key => !EVENT_ID.test(key)) || [...redacted].some(key => !allowed.has(key))) {
|
|
83
|
+
throw new MayuraError('INVALID_CONFIG', 'Logger fields must be bounded allowlisted identifiers.');
|
|
84
|
+
}
|
|
85
|
+
const clock = options.clock ?? Date.now; const maxBytes = options.maxBytes ?? 16_384;
|
|
86
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes <= 0 || maxBytes > 1_048_576) throw new MayuraError('INVALID_CONFIG', 'Logger byte limit is invalid.');
|
|
87
|
+
return Object.freeze({
|
|
88
|
+
async log(level: LogLevel, event: string, fields: Readonly<Record<string, unknown>> = {}): Promise<void> {
|
|
89
|
+
if (!['debug', 'info', 'warn', 'error'].includes(level) || !EVENT_ID.test(event)) {
|
|
90
|
+
throw new MayuraError('INVALID_INPUT', 'Log identity is invalid.');
|
|
91
|
+
}
|
|
92
|
+
const snapshot = jsonValue(fields, { maxBytes, maxDepth: 16, maxNodes: 2_048 });
|
|
93
|
+
if (snapshot === null || Array.isArray(snapshot) || typeof snapshot !== 'object') throw new MayuraError('INVALID_INPUT', 'Log fields must be a JSON object.');
|
|
94
|
+
const safe: JsonObject = {};
|
|
95
|
+
for (const [key, value] of Object.entries(snapshot)) {
|
|
96
|
+
if (!allowed.has(key)) continue;
|
|
97
|
+
safe[key] = redacted.has(key) ? '[REDACTED]' : value;
|
|
98
|
+
}
|
|
99
|
+
const timestamp = clock();
|
|
100
|
+
if (!Number.isSafeInteger(timestamp) || timestamp < 0) throw new MayuraError('INVALID_CONFIG', 'Logger clock returned an invalid timestamp.');
|
|
101
|
+
const entry: JsonObject = { timestamp, level, event, fields: safe as JsonValue };
|
|
102
|
+
await sink(freezeJson(jsonValue(entry, { maxBytes, maxDepth: 16, maxNodes: 2_048 })) as JsonObject);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { JsonObject, LifecycleControl, LifecycleObserver, Permissions, Scope } from '../../core/dist/index.js';
|
|
2
|
+
import type { AggregateStore } from '../../storage-contracts/dist/index.js';
|
|
3
|
+
export type MemorySensitivity = 'public' | 'internal' | 'confidential' | 'restricted';
|
|
4
|
+
export type MemoryCategory = 'fact' | 'preference' | 'decision' | 'procedure' | 'episode';
|
|
5
|
+
/** Caller-supplied evidence identity, never a claim that the framework fetched or verified a source. */
|
|
6
|
+
export interface MemoryProvenance {
|
|
7
|
+
readonly sourceId: string;
|
|
8
|
+
readonly reference: string;
|
|
9
|
+
readonly revision: string;
|
|
10
|
+
readonly sha256: string;
|
|
11
|
+
readonly author: string;
|
|
12
|
+
readonly observedAt: string;
|
|
13
|
+
readonly origin: 'observed' | 'inferred';
|
|
14
|
+
readonly confidence: number;
|
|
15
|
+
}
|
|
16
|
+
export interface MemoryValidity {
|
|
17
|
+
readonly from: string;
|
|
18
|
+
readonly until: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface MemoryInput {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly content: string;
|
|
23
|
+
readonly provenance: MemoryProvenance;
|
|
24
|
+
readonly category?: MemoryCategory;
|
|
25
|
+
readonly metadata?: JsonObject;
|
|
26
|
+
readonly sensitivity?: MemorySensitivity;
|
|
27
|
+
readonly validity?: MemoryValidity;
|
|
28
|
+
}
|
|
29
|
+
export interface CorrectMemoryInput extends MemoryInput {
|
|
30
|
+
readonly expectedVersion: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ForgetMemoryInput {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly expectedVersion: number;
|
|
35
|
+
}
|
|
36
|
+
interface MemoryIdentity {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly version: number;
|
|
39
|
+
readonly scope: Scope;
|
|
40
|
+
readonly sensitivity: MemorySensitivity;
|
|
41
|
+
readonly createdAt: string;
|
|
42
|
+
readonly updatedAt: string;
|
|
43
|
+
}
|
|
44
|
+
export interface MemoryRecord extends MemoryIdentity {
|
|
45
|
+
readonly status: 'active';
|
|
46
|
+
readonly category: MemoryCategory;
|
|
47
|
+
readonly content: string;
|
|
48
|
+
readonly contentSha256: string;
|
|
49
|
+
readonly metadata: JsonObject;
|
|
50
|
+
readonly provenance: MemoryProvenance;
|
|
51
|
+
readonly validity: MemoryValidity;
|
|
52
|
+
}
|
|
53
|
+
/** Minimal permanent deletion marker. It intentionally contains no prior content or provenance. */
|
|
54
|
+
export interface MemoryTombstone extends MemoryIdentity {
|
|
55
|
+
readonly status: 'deleted';
|
|
56
|
+
readonly deletedAt: string;
|
|
57
|
+
}
|
|
58
|
+
/** A record replaced by a newer one (native profile). Its content stays for history but is never returned by search. */
|
|
59
|
+
export interface MemorySupersededRecord extends Omit<MemoryRecord, 'status'> {
|
|
60
|
+
readonly status: 'superseded';
|
|
61
|
+
readonly supersededBy: string;
|
|
62
|
+
}
|
|
63
|
+
export type MemoryEntry = MemoryRecord | MemorySupersededRecord | MemoryTombstone;
|
|
64
|
+
export interface MemoryStoreOptions {
|
|
65
|
+
readonly store: AggregateStore;
|
|
66
|
+
readonly scope: Scope;
|
|
67
|
+
readonly permissions: Permissions;
|
|
68
|
+
readonly allowedSensitivities?: readonly MemorySensitivity[];
|
|
69
|
+
/** Fail-closed lifecycle hooks around every write. */
|
|
70
|
+
readonly hooks?: MemoryHooks;
|
|
71
|
+
}
|
|
72
|
+
export type MemoryWriteOperation = 'add' | 'correct' | 'forget' | 'supersede' | 'relate' | 'unrelate' | 'publish' | 'remove';
|
|
73
|
+
/** Validated write intent. `candidate` is present for writes that carry content (add, correct, publish). */
|
|
74
|
+
export interface BeforeMemoryWriteEvent {
|
|
75
|
+
readonly operation: MemoryWriteOperation;
|
|
76
|
+
readonly scope: Scope;
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly expectedVersion?: number;
|
|
79
|
+
readonly candidate?: {
|
|
80
|
+
readonly content: string;
|
|
81
|
+
readonly category: MemoryCategory;
|
|
82
|
+
readonly sensitivity: MemorySensitivity;
|
|
83
|
+
readonly provenance: MemoryProvenance;
|
|
84
|
+
readonly validity: MemoryValidity;
|
|
85
|
+
readonly metadata: JsonObject;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Metadata-only confirmation of a committed write. */
|
|
89
|
+
export interface AfterMemoryWriteEvent {
|
|
90
|
+
readonly operation: MemoryWriteOperation;
|
|
91
|
+
readonly scope: Scope;
|
|
92
|
+
readonly id: string;
|
|
93
|
+
readonly version?: number;
|
|
94
|
+
readonly status: 'active' | 'superseded' | 'deleted';
|
|
95
|
+
}
|
|
96
|
+
export interface MemoryHooks {
|
|
97
|
+
/** Runs after permission and validation checks and before any storage access; a block writes nothing. */
|
|
98
|
+
readonly beforeMemoryWrite?: LifecycleControl<BeforeMemoryWriteEvent, 'beforeMemoryWrite'>;
|
|
99
|
+
/** Runs after the write commits; a failure rejects the call with a message stating the write committed. */
|
|
100
|
+
readonly afterMemoryWrite?: LifecycleObserver<AfterMemoryWriteEvent, 'afterMemoryWrite'>;
|
|
101
|
+
/** Per-callback deadline in milliseconds (default 5000, maximum 30000). */
|
|
102
|
+
readonly timeoutMs?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface MemoryListOptions {
|
|
105
|
+
readonly limit?: number;
|
|
106
|
+
readonly cursor?: string;
|
|
107
|
+
readonly includeDeleted?: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface MemoryPage {
|
|
110
|
+
readonly records: readonly MemoryEntry[];
|
|
111
|
+
readonly revision: number;
|
|
112
|
+
readonly nextCursor?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface MemorySearchHit {
|
|
115
|
+
readonly record: MemoryRecord;
|
|
116
|
+
readonly score: number;
|
|
117
|
+
readonly matchedTerms: readonly string[];
|
|
118
|
+
}
|
|
119
|
+
export interface MemorySearchResult {
|
|
120
|
+
readonly mode: 'lexical';
|
|
121
|
+
readonly revision: number;
|
|
122
|
+
readonly hits: readonly MemorySearchHit[];
|
|
123
|
+
}
|
|
124
|
+
export interface MemoryExport {
|
|
125
|
+
readonly format: 'mayura.memory.export.v1';
|
|
126
|
+
readonly scope: Scope;
|
|
127
|
+
readonly revision: number;
|
|
128
|
+
readonly exportedAt: string;
|
|
129
|
+
readonly records: readonly MemoryEntry[];
|
|
130
|
+
}
|
|
131
|
+
/** Experimental bounded native records. No embedding, semantic-index or provider capability is implied. */
|
|
132
|
+
export interface MemoryStore {
|
|
133
|
+
add(input: MemoryInput): Promise<MemoryRecord>;
|
|
134
|
+
correct(input: CorrectMemoryInput): Promise<MemoryRecord>;
|
|
135
|
+
forget(input: ForgetMemoryInput): Promise<MemoryTombstone>;
|
|
136
|
+
get(id: string, options?: {
|
|
137
|
+
readonly includeDeleted?: boolean;
|
|
138
|
+
}): Promise<MemoryEntry | undefined>;
|
|
139
|
+
list(options?: MemoryListOptions): Promise<MemoryPage>;
|
|
140
|
+
search(query: string, options?: {
|
|
141
|
+
readonly limit?: number;
|
|
142
|
+
}): Promise<MemorySearchResult>;
|
|
143
|
+
exportSnapshot(): Promise<MemoryExport>;
|
|
144
|
+
}
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"","sourcesContent":["import type { JsonObject, LifecycleControl, LifecycleObserver, Permissions, Scope } from '@mayura/core';\nimport type { AggregateStore } from '@mayura/storage-contracts';\n\nexport type MemorySensitivity = 'public' | 'internal' | 'confidential' | 'restricted';\nexport type MemoryCategory = 'fact' | 'preference' | 'decision' | 'procedure' | 'episode';\n\n/** Caller-supplied evidence identity, never a claim that the framework fetched or verified a source. */\nexport interface MemoryProvenance {\n readonly sourceId: string;\n readonly reference: string;\n readonly revision: string;\n readonly sha256: string;\n readonly author: string;\n readonly observedAt: string;\n readonly origin: 'observed' | 'inferred';\n readonly confidence: number;\n}\nexport interface MemoryValidity { readonly from: string; readonly until: string | null }\n\nexport interface MemoryInput {\n readonly id: string;\n readonly content: string;\n readonly provenance: MemoryProvenance;\n readonly category?: MemoryCategory;\n readonly metadata?: JsonObject;\n readonly sensitivity?: MemorySensitivity;\n readonly validity?: MemoryValidity;\n}\nexport interface CorrectMemoryInput extends MemoryInput { readonly expectedVersion: number }\nexport interface ForgetMemoryInput { readonly id: string; readonly expectedVersion: number }\n\ninterface MemoryIdentity {\n readonly id: string;\n readonly version: number;\n readonly scope: Scope;\n readonly sensitivity: MemorySensitivity;\n readonly createdAt: string;\n readonly updatedAt: string;\n}\nexport interface MemoryRecord extends MemoryIdentity {\n readonly status: 'active';\n readonly category: MemoryCategory;\n readonly content: string;\n readonly contentSha256: string;\n readonly metadata: JsonObject;\n readonly provenance: MemoryProvenance;\n readonly validity: MemoryValidity;\n}\n/** Minimal permanent deletion marker. It intentionally contains no prior content or provenance. */\nexport interface MemoryTombstone extends MemoryIdentity { readonly status: 'deleted'; readonly deletedAt: string }\n/** A record replaced by a newer one (native profile). Its content stays for history but is never returned by search. */\nexport interface MemorySupersededRecord extends Omit<MemoryRecord, 'status'> { readonly status: 'superseded'; readonly supersededBy: string }\nexport type MemoryEntry = MemoryRecord | MemorySupersededRecord | MemoryTombstone;\n\nexport interface MemoryStoreOptions {\n readonly store: AggregateStore;\n readonly scope: Scope;\n readonly permissions: Permissions;\n readonly allowedSensitivities?: readonly MemorySensitivity[];\n /** Fail-closed lifecycle hooks around every write. */\n readonly hooks?: MemoryHooks;\n}\nexport type MemoryWriteOperation = 'add' | 'correct' | 'forget' | 'supersede' | 'relate' | 'unrelate' | 'publish' | 'remove';\n/** Validated write intent. `candidate` is present for writes that carry content (add, correct, publish). */\nexport interface BeforeMemoryWriteEvent {\n readonly operation: MemoryWriteOperation;\n readonly scope: Scope;\n readonly id: string;\n readonly expectedVersion?: number;\n readonly candidate?: {\n readonly content: string;\n readonly category: MemoryCategory;\n readonly sensitivity: MemorySensitivity;\n readonly provenance: MemoryProvenance;\n readonly validity: MemoryValidity;\n readonly metadata: JsonObject;\n };\n}\n/** Metadata-only confirmation of a committed write. */\nexport interface AfterMemoryWriteEvent {\n readonly operation: MemoryWriteOperation;\n readonly scope: Scope;\n readonly id: string;\n readonly version?: number;\n readonly status: 'active' | 'superseded' | 'deleted';\n}\nexport interface MemoryHooks {\n /** Runs after permission and validation checks and before any storage access; a block writes nothing. */\n readonly beforeMemoryWrite?: LifecycleControl<BeforeMemoryWriteEvent, 'beforeMemoryWrite'>;\n /** Runs after the write commits; a failure rejects the call with a message stating the write committed. */\n readonly afterMemoryWrite?: LifecycleObserver<AfterMemoryWriteEvent, 'afterMemoryWrite'>;\n /** Per-callback deadline in milliseconds (default 5000, maximum 30000). */\n readonly timeoutMs?: number;\n}\nexport interface MemoryListOptions { readonly limit?: number; readonly cursor?: string; readonly includeDeleted?: boolean }\nexport interface MemoryPage { readonly records: readonly MemoryEntry[]; readonly revision: number; readonly nextCursor?: string }\nexport interface MemorySearchHit { readonly record: MemoryRecord; readonly score: number; readonly matchedTerms: readonly string[] }\nexport interface MemorySearchResult { readonly mode: 'lexical'; readonly revision: number; readonly hits: readonly MemorySearchHit[] }\nexport interface MemoryExport {\n readonly format: 'mayura.memory.export.v1'; readonly scope: Scope; readonly revision: number;\n readonly exportedAt: string; readonly records: readonly MemoryEntry[];\n}\n\n/** Experimental bounded native records. No embedding, semantic-index or provider capability is implied. */\nexport interface MemoryStore {\n add(input: MemoryInput): Promise<MemoryRecord>;\n correct(input: CorrectMemoryInput): Promise<MemoryRecord>;\n forget(input: ForgetMemoryInput): Promise<MemoryTombstone>;\n get(id: string, options?: { readonly includeDeleted?: boolean }): Promise<MemoryEntry | undefined>;\n list(options?: MemoryListOptions): Promise<MemoryPage>;\n search(query: string, options?: { readonly limit?: number }): Promise<MemorySearchResult>;\n exportSnapshot(): Promise<MemoryExport>;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MemoryStore, MemoryStoreOptions } from './contracts.js';
|
|
2
|
+
export * from './contracts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a bounded native canonical memory service over caller-owned initialized storage.
|
|
5
|
+
* Scope/permissions must come from a trusted identity boundary. No external requests are made.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMemoryStore(options: MemoryStoreOptions): MemoryStore;
|
|
8
|
+
export { createNativeMemory, type NativeMemory, type NativeMemoryOptions, type NativeMemoryEntry, type MemoryEdge, type MemoryEdgeInput, type MemoryEdgeTombstone, type MemorySubgraph, type MemoryIndexReport, type SemanticSearchResult, type MemoryExportPage, type MemoryImportReport } from './native.js';
|
|
9
|
+
export { hashingEmbedder, type MemoryEmbedder } from './vectors.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA4G,WAAW,EAAE,kBAAkB,EAAyC,MAAM,gBAAgB,CAAC;AAGvN,cAAc,gBAAgB,CAAC;AA0D/B;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAyK1E;AACD,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EACrI,KAAK,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACxK,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { MayuraError, jsonValue } from '../../core/dist/index.js';
|
|
2
|
+
import { evaluateLifecycleControl, evaluateLifecycleObserver, snapshotHookOptions } from '../../core/dist/host.js';
|
|
3
|
+
import { StorageError } from '../../storage-contracts/dist/index.js';
|
|
4
|
+
import { MAX_AGGREGATE_BYTES, MAX_RECORDS, SENSITIVITIES, activeRecord, allowedKeys, exactKeys, immutable, integer, memoryId, object, parseEntry, sensitivity, sha256, text } from './validation.js';
|
|
5
|
+
export * from './contracts.js';
|
|
6
|
+
const aggregateId = 'mayura.native-memory.v1';
|
|
7
|
+
const definitionHash = 'mayura.native-memory.v1';
|
|
8
|
+
const inputFields = ['id', 'category', 'content', 'metadata', 'sensitivity', 'provenance', 'validity'];
|
|
9
|
+
/** Never reflect arbitrary custom-adapter messages, including framework-shaped exceptions. */
|
|
10
|
+
async function adapter(operation) {
|
|
11
|
+
try {
|
|
12
|
+
return await operation();
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
let conflict = false;
|
|
16
|
+
try {
|
|
17
|
+
if (error instanceof StorageError || error instanceof MayuraError) {
|
|
18
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'code');
|
|
19
|
+
conflict = descriptor !== undefined && 'value' in descriptor && descriptor.value === 'CONFLICT';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch { /* Untrusted exception proxies/accessors cannot control the public error channel. */ }
|
|
23
|
+
if (conflict)
|
|
24
|
+
throw new StorageError('CONFLICT', 'Memory storage version changed.');
|
|
25
|
+
throw new MayuraError('STORAGE_UNAVAILABLE', 'Memory storage is unavailable. Check protected local diagnostics.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function pageLimit(value) {
|
|
29
|
+
const limit = value === undefined ? 20 : integer(value, 'Page limit');
|
|
30
|
+
if (limit > 50)
|
|
31
|
+
throw new MayuraError('INVALID_INPUT', 'Memory pages are limited to 50 records.');
|
|
32
|
+
return limit;
|
|
33
|
+
}
|
|
34
|
+
/** Snapshot hook options once as own data properties. */
|
|
35
|
+
function memoryWriteHooks(value) {
|
|
36
|
+
const { handlers, timeoutMs } = snapshotHookOptions(value, ['beforeMemoryWrite', 'afterMemoryWrite'], 'Memory hooks require callable beforeMemoryWrite/afterMemoryWrite handlers and a bounded timeout.');
|
|
37
|
+
const before = handlers.beforeMemoryWrite;
|
|
38
|
+
const after = handlers.afterMemoryWrite;
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
before: async (event) => { if (before)
|
|
41
|
+
await evaluateLifecycleControl({ stage: 'beforeMemoryWrite', handler: before, event: structuredClone(event), timeoutMs }); },
|
|
42
|
+
after: async (event) => {
|
|
43
|
+
if (!after)
|
|
44
|
+
return;
|
|
45
|
+
try {
|
|
46
|
+
await evaluateLifecycleObserver({ stage: 'afterMemoryWrite', handler: after, event: structuredClone(event), timeoutMs });
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new MayuraError('GUARD_UNAVAILABLE', 'The memory write committed, but a required after-write hook failed.');
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function candidateView(record) {
|
|
55
|
+
return { content: record.content, category: record.category, sensitivity: record.sensitivity, provenance: record.provenance, validity: record.validity, metadata: record.metadata };
|
|
56
|
+
}
|
|
57
|
+
function committed(operation, entry) {
|
|
58
|
+
return { operation, scope: entry.scope, id: entry.id, version: entry.version, status: entry.status };
|
|
59
|
+
}
|
|
60
|
+
function nextVersion(version) {
|
|
61
|
+
if (version === Number.MAX_SAFE_INTEGER)
|
|
62
|
+
throw new MayuraError('CONFLICT', 'Memory version exhausted.');
|
|
63
|
+
return version + 1;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Creates a bounded native canonical memory service over caller-owned initialized storage.
|
|
67
|
+
* Scope/permissions must come from a trusted identity boundary. No external requests are made.
|
|
68
|
+
*/
|
|
69
|
+
export function createMemoryStore(options) {
|
|
70
|
+
if (!options || typeof options !== 'object' || !options.store || !['read', 'create', 'update'].every(method => typeof options.store[method] === 'function'))
|
|
71
|
+
throw new MayuraError('INVALID_CONFIG', 'Memory requires a storage adapter and verified scope.');
|
|
72
|
+
let scope;
|
|
73
|
+
try {
|
|
74
|
+
scope = Object.freeze({ principalId: text(options.scope?.principalId, 'Principal ID', 128), projectId: text(options.scope?.projectId, 'Project ID', 128) });
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
throw new MayuraError('INVALID_CONFIG', 'Memory requires bounded principal and project identifiers.');
|
|
78
|
+
}
|
|
79
|
+
if (!Array.isArray(options.permissions?.allow) || options.permissions.allow.length > 4096)
|
|
80
|
+
throw new MayuraError('INVALID_CONFIG', 'Memory permissions require a bounded grant list.');
|
|
81
|
+
const grants = new Set(options.permissions.allow.map(grant => text(grant, 'Grant', 384)));
|
|
82
|
+
const profile = options.allowedSensitivities ?? ['public', 'internal'];
|
|
83
|
+
if (!Array.isArray(profile) || profile.length > SENSITIVITIES.length || new Set(profile).size !== profile.length)
|
|
84
|
+
throw new MayuraError('INVALID_CONFIG', 'Memory sensitivity profile is invalid.');
|
|
85
|
+
const sensitivities = new Set(profile.map(value => sensitivity(value)));
|
|
86
|
+
const { store } = options;
|
|
87
|
+
const hooks = memoryWriteHooks(options.hooks);
|
|
88
|
+
const scopeKey = sha256(`mayura:memory-scope:v1\n${JSON.stringify([scope.principalId, scope.projectId])}`);
|
|
89
|
+
const profileHash = sha256(`mayura:memory-profile:v1\n${JSON.stringify([...sensitivities].sort())}`);
|
|
90
|
+
const permission = (grant) => { if (!grants.has(grant))
|
|
91
|
+
throw new MayuraError('PERMISSION_DENIED', 'The memory operation requires a capability that was not granted.'); };
|
|
92
|
+
const admitted = (record) => sensitivities.has(record.sensitivity);
|
|
93
|
+
const authorizeRecord = (record) => { if (!admitted(record))
|
|
94
|
+
throw new MayuraError('PERMISSION_DENIED', 'The memory record exceeds the permitted sensitivity profile.'); };
|
|
95
|
+
const empty = () => ({ format: 1, scope: { ...scope }, records: {} });
|
|
96
|
+
const serialize = (state) => {
|
|
97
|
+
try {
|
|
98
|
+
return jsonValue(state, { maxBytes: MAX_AGGREGATE_BYTES, maxNodes: 100_000 });
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'The experimental memory scope exceeded its bounded storage capacity.');
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const parse = (record) => {
|
|
105
|
+
try {
|
|
106
|
+
if (record.scope !== scopeKey || record.id !== aggregateId || record.definitionHash !== definitionHash)
|
|
107
|
+
throw new Error();
|
|
108
|
+
const state = object(record.state, MAX_AGGREGATE_BYTES, 32, 100_000);
|
|
109
|
+
exactKeys(state, ['format', 'scope', 'records']);
|
|
110
|
+
const owner = object(state['scope'], 512, 2);
|
|
111
|
+
exactKeys(owner, ['principalId', 'projectId']);
|
|
112
|
+
if (state['format'] !== 1 || owner['principalId'] !== scope.principalId || owner['projectId'] !== scope.projectId)
|
|
113
|
+
throw new Error();
|
|
114
|
+
const values = object(state['records'], MAX_AGGREGATE_BYTES, 31, 100_000);
|
|
115
|
+
if (Object.keys(values).length > MAX_RECORDS)
|
|
116
|
+
throw new Error();
|
|
117
|
+
const records = {};
|
|
118
|
+
for (const [id, raw] of Object.entries(values)) {
|
|
119
|
+
const entry = parseEntry(raw, scope);
|
|
120
|
+
if (entry.id !== id)
|
|
121
|
+
throw new Error();
|
|
122
|
+
records[id] = entry;
|
|
123
|
+
}
|
|
124
|
+
return { format: 1, scope: { ...scope }, records };
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
throw new MayuraError('CONFLICT', 'Stored memory failed its scope, version or integrity checks.');
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const read = async () => {
|
|
131
|
+
const record = await adapter(() => store.read(scopeKey, aggregateId));
|
|
132
|
+
return record ? { record, state: parse(record) } : { state: empty() };
|
|
133
|
+
};
|
|
134
|
+
const mutate = async (allowCreate, operation, transform) => {
|
|
135
|
+
for (let attempt = 0; attempt < 32; attempt++) {
|
|
136
|
+
let { record, state } = await read();
|
|
137
|
+
if (!record) {
|
|
138
|
+
if (!allowCreate)
|
|
139
|
+
throw new MayuraError('NOT_FOUND', 'Memory record was not found in this scope.');
|
|
140
|
+
record = await adapter(async () => {
|
|
141
|
+
const created = await store.create({ scope: scopeKey, id: aggregateId, idempotencyKey: aggregateId, definitionHash, state: serialize(empty()), events: [] });
|
|
142
|
+
if (!created || typeof created !== 'object')
|
|
143
|
+
throw new Error();
|
|
144
|
+
return created.record;
|
|
145
|
+
});
|
|
146
|
+
state = parse(record);
|
|
147
|
+
}
|
|
148
|
+
const result = transform(state);
|
|
149
|
+
const persisted = serialize(state);
|
|
150
|
+
try {
|
|
151
|
+
const expectedVersion = record.version;
|
|
152
|
+
const updated = await adapter(async () => {
|
|
153
|
+
const response = await store.update({ scope: scopeKey, id: aggregateId, expectedVersion, state: persisted, events: [{ type: operation, data: { memoryId: result.id, version: result.version } }] });
|
|
154
|
+
if (!response || response.version !== expectedVersion + 1)
|
|
155
|
+
throw new Error();
|
|
156
|
+
return response;
|
|
157
|
+
});
|
|
158
|
+
parse(updated);
|
|
159
|
+
return immutable(result);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (!(error instanceof StorageError) || error.code !== 'CONFLICT')
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
throw new MayuraError('CONFLICT', 'Memory contention exceeded the bounded retry limit.');
|
|
167
|
+
};
|
|
168
|
+
const currentActive = (state, id, expectedVersion) => {
|
|
169
|
+
const current = state.records[id];
|
|
170
|
+
if (!current)
|
|
171
|
+
throw new MayuraError('NOT_FOUND', 'Memory record was not found in this scope.');
|
|
172
|
+
authorizeRecord(current);
|
|
173
|
+
if (current.status !== 'active' || current.version !== expectedVersion)
|
|
174
|
+
throw new MayuraError('CONFLICT', 'Memory was changed or deleted; refresh its current version.');
|
|
175
|
+
return current;
|
|
176
|
+
};
|
|
177
|
+
const filtered = (state, includeDeleted) => Object.values(state.records)
|
|
178
|
+
.filter(entry => admitted(entry) && (includeDeleted || entry.status === 'active'))
|
|
179
|
+
.sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
180
|
+
return Object.freeze({
|
|
181
|
+
add: async (input) => {
|
|
182
|
+
permission('memory:write');
|
|
183
|
+
const source = object(input);
|
|
184
|
+
allowedKeys(source, inputFields);
|
|
185
|
+
const now = new Date().toISOString();
|
|
186
|
+
const candidate = activeRecord(source, scope, 1, now, now);
|
|
187
|
+
authorizeRecord(candidate);
|
|
188
|
+
await hooks.before({ operation: 'add', scope, id: candidate.id, candidate: candidateView(candidate) });
|
|
189
|
+
const added = await mutate(true, 'memory.added', state => {
|
|
190
|
+
if (state.records[candidate.id])
|
|
191
|
+
throw new MayuraError('CONFLICT', 'Memory ID already exists or is retained by a tombstone.');
|
|
192
|
+
if (Object.keys(state.records).length >= MAX_RECORDS)
|
|
193
|
+
throw new MayuraError('LIMIT_EXCEEDED', 'Experimental memory scopes support at most 128 lifetime record IDs.');
|
|
194
|
+
state.records[candidate.id] = candidate;
|
|
195
|
+
return candidate;
|
|
196
|
+
});
|
|
197
|
+
await hooks.after(committed('add', added));
|
|
198
|
+
return added;
|
|
199
|
+
},
|
|
200
|
+
correct: async (input) => {
|
|
201
|
+
permission('memory:write');
|
|
202
|
+
const source = object(input);
|
|
203
|
+
allowedKeys(source, [...inputFields, 'expectedVersion']);
|
|
204
|
+
const id = memoryId(source['id']);
|
|
205
|
+
const expectedVersion = integer(source['expectedVersion'], 'Expected memory version');
|
|
206
|
+
// Validate the replacement before reading/mutating persistent state.
|
|
207
|
+
const provisional = activeRecord(source, scope, 1, new Date().toISOString(), new Date().toISOString());
|
|
208
|
+
authorizeRecord(provisional);
|
|
209
|
+
await hooks.before({ operation: 'correct', scope, id, expectedVersion, candidate: candidateView(provisional) });
|
|
210
|
+
const corrected = await mutate(false, 'memory.corrected', state => {
|
|
211
|
+
const current = currentActive(state, id, expectedVersion);
|
|
212
|
+
const updatedAt = new Date(Math.max(Date.now(), Date.parse(current.updatedAt))).toISOString();
|
|
213
|
+
const next = activeRecord(source, scope, nextVersion(current.version), current.createdAt, updatedAt);
|
|
214
|
+
state.records[id] = next;
|
|
215
|
+
return next;
|
|
216
|
+
});
|
|
217
|
+
await hooks.after(committed('correct', corrected));
|
|
218
|
+
return corrected;
|
|
219
|
+
},
|
|
220
|
+
forget: async (input) => {
|
|
221
|
+
permission('memory:delete');
|
|
222
|
+
const command = object(input, 1_024, 2);
|
|
223
|
+
exactKeys(command, ['id', 'expectedVersion']);
|
|
224
|
+
const id = memoryId(command['id']);
|
|
225
|
+
const expectedVersion = integer(command['expectedVersion'], 'Expected memory version');
|
|
226
|
+
await hooks.before({ operation: 'forget', scope, id, expectedVersion });
|
|
227
|
+
const forgotten = await mutate(false, 'memory.forgotten', state => {
|
|
228
|
+
const current = currentActive(state, id, expectedVersion);
|
|
229
|
+
const deletedAt = new Date(Math.max(Date.now(), Date.parse(current.updatedAt))).toISOString();
|
|
230
|
+
const tombstone = { id, version: nextVersion(current.version), status: 'deleted', scope: { ...scope }, sensitivity: current.sensitivity, createdAt: current.createdAt, updatedAt: deletedAt, deletedAt };
|
|
231
|
+
state.records[id] = tombstone;
|
|
232
|
+
return tombstone;
|
|
233
|
+
});
|
|
234
|
+
await hooks.after(committed('forget', forgotten));
|
|
235
|
+
return forgotten;
|
|
236
|
+
},
|
|
237
|
+
get: async (id, query = {}) => {
|
|
238
|
+
permission('memory:read');
|
|
239
|
+
memoryId(id);
|
|
240
|
+
const request = object(query, 256, 2);
|
|
241
|
+
allowedKeys(request, ['includeDeleted']);
|
|
242
|
+
const includeDeleted = request['includeDeleted'] ?? false;
|
|
243
|
+
if (typeof includeDeleted !== 'boolean')
|
|
244
|
+
throw new MayuraError('INVALID_INPUT', 'includeDeleted must be boolean.');
|
|
245
|
+
const { state } = await read();
|
|
246
|
+
const entry = state.records[id];
|
|
247
|
+
return entry && admitted(entry) && (includeDeleted || entry.status === 'active') ? immutable(entry) : undefined;
|
|
248
|
+
},
|
|
249
|
+
list: async (query = {}) => {
|
|
250
|
+
permission('memory:read');
|
|
251
|
+
const request = object(query, 2_048, 2);
|
|
252
|
+
allowedKeys(request, ['limit', 'cursor', 'includeDeleted']);
|
|
253
|
+
const limit = pageLimit(request['limit']);
|
|
254
|
+
const includeDeleted = request['includeDeleted'] ?? false;
|
|
255
|
+
const requestCursor = request['cursor'];
|
|
256
|
+
if (typeof includeDeleted !== 'boolean')
|
|
257
|
+
throw new MayuraError('INVALID_INPUT', 'includeDeleted must be boolean.');
|
|
258
|
+
const { record, state } = await read();
|
|
259
|
+
const revision = record?.version ?? 0;
|
|
260
|
+
let after = '';
|
|
261
|
+
if (requestCursor !== undefined) {
|
|
262
|
+
try {
|
|
263
|
+
if (typeof requestCursor !== 'string' || requestCursor.length > 1_024 || !/^[A-Za-z0-9_-]+$/.test(requestCursor))
|
|
264
|
+
throw new Error();
|
|
265
|
+
const value = object(JSON.parse(Buffer.from(requestCursor, 'base64url').toString('utf8')), 1_024, 2);
|
|
266
|
+
exactKeys(value, ['format', 'scope', 'profile', 'revision', 'after', 'includeDeleted']);
|
|
267
|
+
if (value['format'] !== 1 || value['scope'] !== scopeKey || value['profile'] !== profileHash || value['revision'] !== revision || value['includeDeleted'] !== includeDeleted)
|
|
268
|
+
throw new Error();
|
|
269
|
+
after = memoryId(value['after']);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
throw new MayuraError('CONFLICT', 'Memory cursor is invalid or its scoped snapshot has changed.');
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const candidates = filtered(state, includeDeleted).filter(entry => entry.id > after);
|
|
276
|
+
const records = candidates.slice(0, limit);
|
|
277
|
+
const last = records.at(-1);
|
|
278
|
+
const nextCursor = last && candidates.length > records.length
|
|
279
|
+
? Buffer.from(JSON.stringify({ format: 1, scope: scopeKey, profile: profileHash, revision, after: last.id, includeDeleted })).toString('base64url') : undefined;
|
|
280
|
+
return immutable({ records, revision, ...(nextCursor ? { nextCursor } : {}) });
|
|
281
|
+
},
|
|
282
|
+
search: async (query, searchOptions = {}) => {
|
|
283
|
+
permission('memory:read');
|
|
284
|
+
text(query, 'Search query', 512);
|
|
285
|
+
const request = object(searchOptions, 128, 2);
|
|
286
|
+
allowedKeys(request, ['limit']);
|
|
287
|
+
const limit = pageLimit(request['limit']);
|
|
288
|
+
const terms = [...new Set(query.toLowerCase().match(/[\p{L}\p{N}_-]+/gu) ?? [])];
|
|
289
|
+
if (terms.length === 0 || terms.length > 16)
|
|
290
|
+
throw new MayuraError('INVALID_INPUT', 'Lexical search requires 1–16 query terms.');
|
|
291
|
+
const { record, state } = await read();
|
|
292
|
+
const now = Date.now();
|
|
293
|
+
const hits = filtered(state, false).flatMap(entry => {
|
|
294
|
+
if (entry.status !== 'active' || Date.parse(entry.validity.from) > now || (entry.validity.until !== null && Date.parse(entry.validity.until) <= now))
|
|
295
|
+
return [];
|
|
296
|
+
const tokens = entry.content.toLowerCase().match(/[\p{L}\p{N}_-]+/gu) ?? [];
|
|
297
|
+
const counts = new Map();
|
|
298
|
+
for (const token of tokens)
|
|
299
|
+
counts.set(token, (counts.get(token) ?? 0) + 1);
|
|
300
|
+
if (!terms.every(term => counts.has(term)))
|
|
301
|
+
return [];
|
|
302
|
+
return [{ record: entry, score: terms.reduce((score, term) => score + counts.get(term), 0), matchedTerms: terms }];
|
|
303
|
+
}).sort((a, b) => b.score - a.score || (a.record.id < b.record.id ? -1 : a.record.id > b.record.id ? 1 : 0)).slice(0, limit);
|
|
304
|
+
return immutable({ mode: 'lexical', revision: record?.version ?? 0, hits });
|
|
305
|
+
},
|
|
306
|
+
exportSnapshot: async () => {
|
|
307
|
+
permission('memory:read');
|
|
308
|
+
permission('memory:export');
|
|
309
|
+
const { record, state } = await read();
|
|
310
|
+
return immutable({ format: 'mayura.memory.export.v1', scope: { ...scope }, revision: record?.version ?? 0, exportedAt: new Date().toISOString(), records: filtered(state, true) });
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
export { createNativeMemory } from './native.js';
|
|
315
|
+
export { hashingEmbedder } from './vectors.js';
|
|
316
|
+
//# sourceMappingURL=index.js.map
|