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,139 @@
|
|
|
1
|
+
// `mayura dev`: build the project, run it, and rebuild and restart when a source file changes. It loads `.env` for
|
|
2
|
+
// the child processes without printing any value; real environment variables win over the file.
|
|
3
|
+
import { spawn, type ChildProcess } from 'node:child_process';
|
|
4
|
+
import { existsSync, readdirSync, readFileSync, statSync, watch, type FSWatcher } from 'node:fs';
|
|
5
|
+
import { delimiter, join, relative, sep } from 'node:path';
|
|
6
|
+
import { parseEnv } from 'node:util';
|
|
7
|
+
import { MayuraError } from '@mayura/core';
|
|
8
|
+
import type { Paint } from './output.js';
|
|
9
|
+
|
|
10
|
+
export interface DevOptions {
|
|
11
|
+
readonly directory: string;
|
|
12
|
+
/** The CLI entry used to run `migrate`, `serve` and `worker` for an application without a dev entry. */
|
|
13
|
+
readonly bin: string;
|
|
14
|
+
readonly entry?: string; readonly app?: string; readonly watch: boolean;
|
|
15
|
+
readonly signal: AbortSignal; readonly p: Paint; readonly print: (line: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Paths that change because the project runs or builds, not because someone edited it. */
|
|
19
|
+
const ignored = /(^|[\\/])(node_modules|dist|\.data|\.git|\.mayura-local|coverage)([\\/]|$)|\.(sqlite(-shm|-wal)?|tsbuildinfo|log)$/u;
|
|
20
|
+
|
|
21
|
+
/** Modification time and size of every file a person might edit, to tell real edits from other file-system events. */
|
|
22
|
+
function snapshot(directory: string, limit = 50_000): Map<string, string> {
|
|
23
|
+
const files = new Map<string, string>(); const pending = [''];
|
|
24
|
+
while (pending.length > 0 && files.size < limit) {
|
|
25
|
+
const folder = pending.pop()!;
|
|
26
|
+
let entries: import('node:fs').Dirent[]; try { entries = readdirSync(join(directory, folder), { withFileTypes: true }); } catch { continue; }
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
const path = folder ? join(folder, entry.name) : entry.name; if (ignored.test(path)) continue;
|
|
29
|
+
if (entry.isDirectory()) pending.push(path); else if (entry.isFile()) files.set(path, stamp(join(directory, path)) ?? '');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return files;
|
|
33
|
+
}
|
|
34
|
+
const stamp = (path: string): string | undefined => { try { const details = statSync(path); return `${details.mtimeMs}:${details.size}`; } catch { return undefined; } };
|
|
35
|
+
|
|
36
|
+
/** `.env` in the project, parsed; returns names only for display. Values are passed to children, never printed. */
|
|
37
|
+
export function dotEnv(directory: string): { readonly values: Record<string, string>; readonly names: readonly string[] } {
|
|
38
|
+
const file = join(directory, '.env'); if (!existsSync(file)) return { values: {}, names: [] };
|
|
39
|
+
let values: Record<string, string>;
|
|
40
|
+
try { values = parseEnv(readFileSync(file, 'utf8')) as Record<string, string>; }
|
|
41
|
+
catch { throw new MayuraError('INVALID_CONFIG', 'The project .env file could not be read.'); }
|
|
42
|
+
return { values, names: Object.keys(values).sort() };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function runDev(options: DevOptions): Promise<{ readonly status: 'stopped' }> {
|
|
46
|
+
const { directory, p, print, signal } = options;
|
|
47
|
+
const manifestPath = join(directory, 'package.json');
|
|
48
|
+
if (!existsSync(manifestPath)) throw new MayuraError('INVALID_CONFIG', 'Run mayura dev in a project directory (one with a package.json).');
|
|
49
|
+
let manifest: { name?: unknown; scripts?: Record<string, unknown> };
|
|
50
|
+
try { manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as typeof manifest; } catch { throw new MayuraError('INVALID_CONFIG', 'The project package.json is not valid JSON.'); }
|
|
51
|
+
const script = manifest.scripts?.['build'];
|
|
52
|
+
const buildCommand = typeof script === 'string' ? script : existsSync(join(directory, 'tsconfig.json')) ? 'tsc -p tsconfig.json' : undefined;
|
|
53
|
+
// Read .env again for every build and start, so editing it takes effect on the next restart. Real environment
|
|
54
|
+
// variables win over the file, as with `node --env-file`.
|
|
55
|
+
let loaded = '';
|
|
56
|
+
const environmentNow = (): NodeJS.ProcessEnv => {
|
|
57
|
+
const file = dotEnv(directory); const names = file.names.join(', ');
|
|
58
|
+
if (names !== loaded) { loaded = names; if (names) print(p.dim(` loaded .env: ${names}`)); }
|
|
59
|
+
const env: NodeJS.ProcessEnv = { ...file.values, ...process.env,
|
|
60
|
+
PATH: [join(directory, 'node_modules', '.bin'), process.env['PATH'] ?? process.env['Path'] ?? ''].join(delimiter) };
|
|
61
|
+
if (process.platform === 'win32') delete env['Path'];
|
|
62
|
+
return env;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
print(`${p.bold('mayura dev')} ${p.dim(typeof manifest.name === 'string' ? manifest.name : '')}`);
|
|
66
|
+
|
|
67
|
+
const build = async (): Promise<boolean> => {
|
|
68
|
+
if (!buildCommand) return true;
|
|
69
|
+
const started = Date.now(); let output = '';
|
|
70
|
+
const child = spawn(buildCommand, { cwd: directory, env: environmentNow(), shell: true, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
71
|
+
child.stdout.on('data', chunk => { output += String(chunk); }); child.stderr.on('data', chunk => { output += String(chunk); });
|
|
72
|
+
const code = await new Promise<number | null>(resolve => { child.on('close', resolve); child.on('error', () => resolve(1)); });
|
|
73
|
+
if (code === 0) { print(`${p.green('✔')} built ${p.dim(`in ${((Date.now() - started) / 1_000).toFixed(1)}s`)}`); return true; }
|
|
74
|
+
print(`${p.red('✖ build failed')} ${p.dim(`(${buildCommand})`)}`); print(output.trimEnd().split(/\r?\n/u).slice(-40).join('\n'));
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
let children: ChildProcess[] = []; let env: NodeJS.ProcessEnv = {};
|
|
79
|
+
const launch = (args: readonly string[]): ChildProcess => spawn(process.execPath, args, { cwd: directory, env, stdio: 'inherit', windowsHide: true });
|
|
80
|
+
const start = async (): Promise<void> => {
|
|
81
|
+
env = environmentNow();
|
|
82
|
+
const entry = options.entry ?? (existsSync(join(directory, 'dist', 'src', 'dev.js')) ? 'dist/src/dev.js' : undefined);
|
|
83
|
+
if (entry) { print(p.green(`● running ${entry}`)); children = [launch([entry])]; return; }
|
|
84
|
+
const app = options.app ?? 'dist/src/app.js';
|
|
85
|
+
if (!existsSync(join(directory, app))) { print(p.red(`✖ Nothing to run: add dist/src/dev.js, or pass --app <module> or --entry <file>.`)); return; }
|
|
86
|
+
// An application without a dev entry runs as in production: migrate once, then a server and a worker.
|
|
87
|
+
const migrate = launch([options.bin, 'migrate', '--app', app]);
|
|
88
|
+
const migrated = await new Promise<number | null>(resolve => migrate.on('close', resolve));
|
|
89
|
+
if (migrated !== 0) { print(p.red('✖ migrate failed; fix it and save a file to try again.')); return; }
|
|
90
|
+
print(p.green(`● running ${app}: server and worker`));
|
|
91
|
+
children = [launch([options.bin, 'serve', '--app', app]), launch([options.bin, 'worker', '--app', app])];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Stop the running children. For a restart, ask them to stop (gracefully where the platform can; Windows ends the
|
|
95
|
+
* process). On Ctrl+C the terminal has already interrupted them, and a second interrupt would skip their drain, so
|
|
96
|
+
* only wait. Either way a child that has not exited after ten seconds is killed.
|
|
97
|
+
*/
|
|
98
|
+
const stop = async (interrupt: boolean): Promise<void> => {
|
|
99
|
+
const running = children.filter(child => child.exitCode === null && child.signalCode === null); children = [];
|
|
100
|
+
await Promise.all(running.map(child => new Promise<void>(resolve => {
|
|
101
|
+
const timer = setTimeout(() => { child.kill('SIGKILL'); }, 10_000);
|
|
102
|
+
child.once('close', () => { clearTimeout(timer); resolve(); });
|
|
103
|
+
if (interrupt) child.kill(process.platform === 'win32' ? undefined : 'SIGINT');
|
|
104
|
+
})));
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
if (await build()) await start();
|
|
108
|
+
if (!options.watch) {
|
|
109
|
+
await Promise.all(children.map(child => new Promise(resolve => child.once('close', resolve))));
|
|
110
|
+
return { status: 'stopped' };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
print(p.dim(' watching for changes · Ctrl+C to stop'));
|
|
114
|
+
let timer: ReturnType<typeof setTimeout> | undefined; let busy = Promise.resolve(); const changed = new Set<string>();
|
|
115
|
+
// Windows also reports reads (last-access times) as changes, and the build reads every source file; act only when a
|
|
116
|
+
// file's modification time or size moved, or it appeared or went away.
|
|
117
|
+
const seen = snapshot(directory);
|
|
118
|
+
const onChange = (path: string): void => {
|
|
119
|
+
if (ignored.test(path)) return;
|
|
120
|
+
const now = stamp(join(directory, path)); if (now === seen.get(path) || (now === undefined && !seen.has(path))) return;
|
|
121
|
+
if (now === undefined) seen.delete(path); else seen.set(path, now);
|
|
122
|
+
changed.add(path); clearTimeout(timer);
|
|
123
|
+
timer = setTimeout(() => {
|
|
124
|
+
const files = [...changed].map(item => item.split(sep).join('/')); changed.clear();
|
|
125
|
+
busy = busy.then(async () => {
|
|
126
|
+
if (signal.aborted) return;
|
|
127
|
+
print(`${p.yellow('~')} ${files.slice(0, 3).join(', ')}${files.length > 3 ? p.dim(` and ${files.length - 3} more`) : ''} changed`);
|
|
128
|
+
// A failed build leaves the last good version running.
|
|
129
|
+
if (await build()) { await stop(true); if (!signal.aborted) await start(); }
|
|
130
|
+
});
|
|
131
|
+
}, 200);
|
|
132
|
+
};
|
|
133
|
+
let watcher: FSWatcher;
|
|
134
|
+
try { watcher = watch(directory, { recursive: true }, (_event, file) => { if (file) onChange(relative(directory, join(directory, String(file)))); }); }
|
|
135
|
+
catch { throw new MayuraError('UNSUPPORTED_PROFILE', 'This platform cannot watch the project directory; run with --no-watch.'); }
|
|
136
|
+
await new Promise<void>(resolve => { if (signal.aborted) resolve(); else signal.addEventListener('abort', () => resolve(), { once: true }); });
|
|
137
|
+
watcher.close(); clearTimeout(timer); await busy; await stop(false);
|
|
138
|
+
return { status: 'stopped' };
|
|
139
|
+
}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { lstat, mkdir, readdir, readFile, realpath, rename, stat, unlink, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { basename, isAbsolute, parse, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { MayuraError, freezeJson, jsonValue, type JsonObject } from '@mayura/core';
|
|
7
|
+
|
|
8
|
+
export { approveWorkflow, cancelRun, cancelWorkflow, inspectHumanRequest, inspectHumanRequests, inspectRun, inspectServerHealth, inspectServerTools, inspectWorkflow, inspectWorkflows,
|
|
9
|
+
holdWorkflowFleet, inspectWorkflowFleet, pauseWorkflow, releaseWorkflowFleet, respondHumanRequest, resumeWorkflow, signalWorkflow, sweepWorkflowFleet, waitForRun,
|
|
10
|
+
type OperationalFleetHold, type OperationalFleetSweep, type OperationalFleetSweepOutcome,
|
|
11
|
+
type OperationalClientOptions, type OperationalHealth, type OperationalHealthCheck, type OperationalHumanRequest,
|
|
12
|
+
type OperationalHumanRequestPage, type OperationalRun, type OperationalRunReceipt, type OperationalTool, type OperationalToolPage,
|
|
13
|
+
type OperationalWorkflow, type OperationalWorkflowFormat, type OperationalWorkflowNode, type OperationalWorkflowNodeKind,
|
|
14
|
+
type OperationalWorkflowIndexEntry, type OperationalWorkflowIndexPage, type OperationalWorkflowStatus,
|
|
15
|
+
type OperationalWorkflowStep, type OperationalWorkflowStepStatus } from './operations.js';
|
|
16
|
+
|
|
17
|
+
export const TEMPLATE_NAMES = Object.freeze([
|
|
18
|
+
'typed-tool-runner', 'basic-agent', 'durable-approval', 'parallel-research',
|
|
19
|
+
'native-memory', 'guarded-streaming-app', 'code-mode-workflow', 'capability-policy',
|
|
20
|
+
] as const);
|
|
21
|
+
export type TemplateName = typeof TEMPLATE_NAMES[number];
|
|
22
|
+
|
|
23
|
+
const descriptions: Readonly<Record<TemplateName, string>> = Object.freeze({
|
|
24
|
+
'typed-tool-runner': 'Typed tool execution through the normal agent admission path.',
|
|
25
|
+
'basic-agent': 'Credential-free structured agent with a deterministic model fixture.',
|
|
26
|
+
'durable-approval': 'SQLite-backed workflow with exact human approval and restart.',
|
|
27
|
+
'parallel-research': 'Two required child agents dispatched and joined in parallel.',
|
|
28
|
+
'native-memory': 'Scoped native memory with provenance, correction and deletion.',
|
|
29
|
+
'guarded-streaming-app': 'Authenticated local server, guarded output and browser client.',
|
|
30
|
+
'code-mode-workflow': 'Approval-required durable Code Mode workflow using QuickJS.',
|
|
31
|
+
'capability-policy': 'Explicit capability grant and denial behavior.',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** What a template's project installs: `mayura`, and the optional peers the parts it uses need. */
|
|
35
|
+
const dependencies: Readonly<Record<TemplateName, readonly string[]>> = Object.freeze({
|
|
36
|
+
'typed-tool-runner': ['mayura', 'zod'],
|
|
37
|
+
'basic-agent': ['mayura', 'zod'],
|
|
38
|
+
'durable-approval': ['better-sqlite3', 'mayura', 'zod'],
|
|
39
|
+
'parallel-research': ['mayura', 'zod'],
|
|
40
|
+
'native-memory': ['better-sqlite3', 'mayura'],
|
|
41
|
+
'guarded-streaming-app': ['mayura'],
|
|
42
|
+
'code-mode-workflow': ['@jitl/quickjs-wasmfile-release-sync', 'better-sqlite3', 'mayura', 'quickjs-emscripten-core'],
|
|
43
|
+
'capability-policy': ['mayura', 'zod'],
|
|
44
|
+
});
|
|
45
|
+
/** Versions of the third-party packages generated projects install; kept equal to the workspace's (tested). */
|
|
46
|
+
export const PEER_VERSIONS: Readonly<Record<string, string>> = Object.freeze({
|
|
47
|
+
zod: '4.6.5', 'better-sqlite3': '13.0.3', pg: '8.23.0', '@jitl/quickjs-wasmfile-release-sync': '0.32.0', 'quickjs-emscripten-core': '0.32.0',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/** Complete multi-file projects: offline by default, one environment switch to a real provider or PostgreSQL. */
|
|
51
|
+
export const STARTER_NAMES = Object.freeze(['approval-workflow', 'support-agent', 'research-team', 'event-automation'] as const);
|
|
52
|
+
export type StarterName = typeof STARTER_NAMES[number];
|
|
53
|
+
|
|
54
|
+
const starterDescriptions: Readonly<Record<StarterName, string>> = Object.freeze({
|
|
55
|
+
'approval-workflow': 'Durable refund approvals: triage agent, human approval, separate server and worker, operator console and a reviewed v1 to v2 migration.',
|
|
56
|
+
'support-agent': 'Customer support chat: a streaming agent with order tools scoped to the signed-in customer, per-customer native memory, PII redaction, a React chat UI and the operator console.',
|
|
57
|
+
'research-team': 'Multi-agent research: a planner, parallel researchers over a source library and a writer as one durable workflow under a shared budget, with cited reports stored as content-addressed artifacts and optional OpenTelemetry traces.',
|
|
58
|
+
'event-automation': 'Signed webhooks start durable workflows in which a triage agent acts through MCP tools under explicit capability grants; forged, stale and replayed deliveries are refused.',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const id = /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/u;
|
|
62
|
+
const digest = (value: string): string => createHash('sha256').update(value, 'utf8').digest('hex');
|
|
63
|
+
const inside = (parent: string, child: string): boolean => { const path = relative(parent, child); return path !== '..' && !path.startsWith(`..${sep}`) && !isAbsolute(path); };
|
|
64
|
+
const templateRoot = fileURLToPath(new URL('../templates/', import.meta.url));
|
|
65
|
+
const starterRoot = fileURLToPath(new URL('../starters/', import.meta.url));
|
|
66
|
+
// Bounds for one starter: text files only, so a plan can always show what it writes.
|
|
67
|
+
const starterLimits = Object.freeze({ files: 256, fileBytes: 262_144, totalBytes: 4_194_304 });
|
|
68
|
+
// Build output, installs and local state never leave the repository copy of a starter.
|
|
69
|
+
const starterSkipped = new Set(['node_modules', 'dist', '.data', 'coverage']);
|
|
70
|
+
|
|
71
|
+
export interface ProjectToolRecord {
|
|
72
|
+
readonly id: string; readonly version: string; readonly effects: 'none' | 'read' | 'write' | 'host'; readonly capabilities: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
export interface ProjectDefinitionRecord {
|
|
75
|
+
readonly kind: 'agent' | 'workflow'; readonly id: string; readonly version: string; readonly source: string;
|
|
76
|
+
}
|
|
77
|
+
export interface MayuraProject {
|
|
78
|
+
/** The template or starter the project was created from. */
|
|
79
|
+
readonly format: 'mayura.project.v1'; readonly name: string; readonly template: TemplateName | StarterName;
|
|
80
|
+
readonly definitions: readonly ProjectDefinitionRecord[]; readonly tools: readonly ProjectToolRecord[];
|
|
81
|
+
}
|
|
82
|
+
export interface InitChange {
|
|
83
|
+
readonly path: string; readonly operation: 'create' | 'replace' | 'unchanged';
|
|
84
|
+
readonly beforeDigest?: string; readonly afterDigest: string; readonly diff?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface InitPlan {
|
|
87
|
+
readonly format: 'mayura.init-plan.v1'; readonly template: TemplateName; readonly directory: string;
|
|
88
|
+
readonly digest: string; readonly changes: readonly InitChange[];
|
|
89
|
+
}
|
|
90
|
+
export interface StarterInitPlan {
|
|
91
|
+
readonly format: 'mayura.init-plan.v1'; readonly starter: StarterName; readonly directory: string;
|
|
92
|
+
readonly digest: string; readonly changes: readonly InitChange[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface PlanState { readonly files: ReadonlyMap<string, string>; readonly before: ReadonlyMap<string, string | undefined> }
|
|
96
|
+
const plans = new WeakMap<InitPlan | StarterInitPlan, PlanState>();
|
|
97
|
+
|
|
98
|
+
function projectName(directory: string): string {
|
|
99
|
+
const name = directory.replaceAll('\\', '/').split('/').filter(Boolean).at(-1)?.toLowerCase().replace(/[^a-z0-9-]+/g, '-') ?? '';
|
|
100
|
+
return /^[a-z0-9][a-z0-9-]{0,63}$/u.test(name) ? name : 'mayura-agent';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** This CLI's own version: generated projects pin every Mayura package to exactly it. */
|
|
104
|
+
const cliVersion = (): string => (JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8')) as { version: string }).version;
|
|
105
|
+
|
|
106
|
+
function packageManifest(name: string, template: TemplateName): string {
|
|
107
|
+
const versions: Record<string, string> = {}; const mayura = cliVersion();
|
|
108
|
+
for (const dependency of dependencies[template]) versions[dependency] = dependency === 'mayura' ? mayura : PEER_VERSIONS[dependency]!;
|
|
109
|
+
return `${JSON.stringify({ name, version: '0.1.0', private: true, type: 'module', scripts: {
|
|
110
|
+
build: 'tsc -p tsconfig.json', typecheck: 'tsc -p tsconfig.json --noEmit', start: 'node dist/index.js', test: 'node --test',
|
|
111
|
+
}, dependencies: versions, devDependencies: { typescript: '7.0.2', '@types/node': '24.13.6' } }, null, 2)}\n`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function projectManifest(name: string, template: TemplateName): string {
|
|
115
|
+
const kind = ['durable-approval', 'code-mode-workflow'].includes(template) ? 'workflow' : 'agent';
|
|
116
|
+
const value: MayuraProject = { format: 'mayura.project.v1', name, template, definitions: [{ kind: kind as 'agent' | 'workflow',
|
|
117
|
+
id: `starter.${template}`, version: '1.0.0', source: 'src/index.ts' }], tools: [] };
|
|
118
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function diff(path: string, before: string, after: string): string {
|
|
122
|
+
const oldLines = before.slice(0, 32_768).split(/\r?\n/u).slice(0, 200); const newLines = after.slice(0, 32_768).split(/\r?\n/u).slice(0, 200);
|
|
123
|
+
return [`--- ${path}`, `+++ ${path}`, ...oldLines.map(line => `-${line}`), ...newLines.map(line => `+${line}`)].join('\n');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The target with its nearest existing ancestor resolved to its real path. Links above the project (for example the
|
|
128
|
+
* macOS system links /var and /tmp) resolve here, so the plan names the directory that will actually be written; a
|
|
129
|
+
* target that is itself a link, or an existing non-directory, is refused.
|
|
130
|
+
*/
|
|
131
|
+
async function canonicalTarget(path: string): Promise<string> {
|
|
132
|
+
const missing: string[] = []; let candidate = path;
|
|
133
|
+
while (true) {
|
|
134
|
+
let details;
|
|
135
|
+
try { details = await lstat(candidate); }
|
|
136
|
+
catch (error) {
|
|
137
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
138
|
+
const parent = resolve(candidate, '..');
|
|
139
|
+
if (parent === candidate) throw new MayuraError('CONFLICT', 'Initializer could not establish a safe target ancestry.');
|
|
140
|
+
missing.unshift(basename(candidate)); candidate = parent; continue;
|
|
141
|
+
}
|
|
142
|
+
if (candidate === path && details.isSymbolicLink()) throw new MayuraError('CONFLICT', 'Initializer target cannot be a link.');
|
|
143
|
+
const real = await realpath(candidate);
|
|
144
|
+
if (!(await stat(real)).isDirectory()) throw new MayuraError('CONFLICT', 'Initializer target cannot traverse a link or non-directory path.');
|
|
145
|
+
return resolve(real, ...missing);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function assertSafeDirectory(path: string): Promise<void> {
|
|
150
|
+
let candidate = path;
|
|
151
|
+
while (true) {
|
|
152
|
+
try {
|
|
153
|
+
const details = await lstat(candidate);
|
|
154
|
+
if (!details.isDirectory() || details.isSymbolicLink() || resolve(await realpath(candidate)) !== resolve(candidate)) {
|
|
155
|
+
throw new MayuraError('CONFLICT', 'Initializer target cannot traverse a link or non-directory path.');
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error;
|
|
160
|
+
const parent = resolve(candidate, '..');
|
|
161
|
+
if (parent === candidate) throw new MayuraError('CONFLICT', 'Initializer could not establish a safe target ancestry.');
|
|
162
|
+
candidate = parent;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function existingFile(path: string): Promise<string | undefined> {
|
|
168
|
+
try {
|
|
169
|
+
const details = await lstat(path);
|
|
170
|
+
if (!details.isFile() || details.isSymbolicLink() || details.size > 1_048_576) throw new MayuraError('CONFLICT', 'Initializer target contains an unsupported file type or size.');
|
|
171
|
+
return await readFile(path, 'utf8');
|
|
172
|
+
} catch (error) {
|
|
173
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Produces a complete, content-bound write plan without mutating the target. */
|
|
179
|
+
export async function planProject(template: TemplateName, directory: string): Promise<InitPlan> {
|
|
180
|
+
if (!TEMPLATE_NAMES.includes(template) || !isAbsolute(directory) || resolve(directory) === parse(resolve(directory)).root) {
|
|
181
|
+
throw new MayuraError('INVALID_CONFIG', 'Initializer requires a known template and a non-root absolute directory.');
|
|
182
|
+
}
|
|
183
|
+
const target = await canonicalTarget(resolve(directory)); const name = projectName(target);
|
|
184
|
+
await assertSafeDirectory(target);
|
|
185
|
+
const source = await readFile(resolve(templateRoot, `${template}.ts`), 'utf8');
|
|
186
|
+
const readme = `# ${name}\n\n${descriptions[template]}\n\nRun \`npm install\`, \`npm run build\`, then \`npm start\`. Review all capabilities and external prerequisites in \`src/index.ts\` before use.\n`;
|
|
187
|
+
const files = new Map<string, string>([
|
|
188
|
+
['package.json', packageManifest(name, template)], ['tsconfig.json', `${JSON.stringify({ compilerOptions: {
|
|
189
|
+
target: 'ES2023', module: 'NodeNext', moduleResolution: 'NodeNext', lib: ['ES2023', 'DOM', 'DOM.Iterable'], strict: true,
|
|
190
|
+
noUncheckedIndexedAccess: true, exactOptionalPropertyTypes: true, noUnusedLocals: true, noUnusedParameters: true,
|
|
191
|
+
verbatimModuleSyntax: true, skipLibCheck: false, outDir: 'dist', rootDir: 'src', types: ['node'],
|
|
192
|
+
}, include: ['src/**/*.ts'] }, null, 2)}\n`],
|
|
193
|
+
['mayura.project.json', projectManifest(name, template)], ['README.md', readme], ['src/index.ts', source],
|
|
194
|
+
]);
|
|
195
|
+
const { changes, before } = await planChanges(target, files);
|
|
196
|
+
const planDigest = digest(JSON.stringify({ template, directory: target, changes }));
|
|
197
|
+
const plan = Object.freeze({ format: 'mayura.init-plan.v1' as const, template, directory: target, digest: planDigest, changes: Object.freeze(changes) });
|
|
198
|
+
plans.set(plan, { files, before }); return plan;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Existing directories between the target and a planned file must be real directories, never links. */
|
|
202
|
+
async function assertPlainParents(target: string, relativePath: string): Promise<void> {
|
|
203
|
+
const segments = relativePath.split('/').slice(0, -1);
|
|
204
|
+
for (let index = 1; index <= segments.length; index++) {
|
|
205
|
+
const path = resolve(target, ...segments.slice(0, index));
|
|
206
|
+
let details; try { details = await lstat(path); } catch (error) { if ((error as NodeJS.ErrnoException).code === 'ENOENT') return; throw error; }
|
|
207
|
+
if (!details.isDirectory() || details.isSymbolicLink()) throw new MayuraError('CONFLICT', 'Initializer target directories cannot be links.');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function planChanges(target: string, files: ReadonlyMap<string, string>): Promise<{ changes: InitChange[]; before: Map<string, string | undefined> }> {
|
|
212
|
+
const before = new Map<string, string | undefined>(); const changes: InitChange[] = [];
|
|
213
|
+
for (const [relativePath, content] of files) {
|
|
214
|
+
await assertPlainParents(target, relativePath);
|
|
215
|
+
const prior = await existingFile(resolve(target, relativePath)); before.set(relativePath, prior);
|
|
216
|
+
const operation = prior === undefined ? 'create' : prior === content ? 'unchanged' : 'replace';
|
|
217
|
+
changes.push(Object.freeze({ path: relativePath, operation, ...(prior === undefined ? {} : { beforeDigest: digest(prior) }),
|
|
218
|
+
afterDigest: digest(content), ...(operation === 'replace' ? { diff: diff(relativePath, prior!, content) } : {}) }));
|
|
219
|
+
}
|
|
220
|
+
return { changes, before };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Starter files that npm would drop or rename when packing (.gitignore, .github) are stored with a `dot-` prefix.
|
|
224
|
+
const starterPath = (segments: readonly string[]): string => segments.map(segment => segment.startsWith('dot-') ? `.${segment.slice(4)}` : segment).join('/');
|
|
225
|
+
|
|
226
|
+
async function collectStarter(name: StarterName): Promise<Map<string, string>> {
|
|
227
|
+
const root = resolve(starterRoot, name); const files = new Map<string, string>(); let total = 0;
|
|
228
|
+
const walk = async (segments: readonly string[]): Promise<void> => {
|
|
229
|
+
const entries = await readdir(resolve(root, ...segments), { withFileTypes: true });
|
|
230
|
+
for (const entry of entries.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0)) {
|
|
231
|
+
if (starterSkipped.has(entry.name) || entry.name.startsWith('.') || entry.name.endsWith('.tsbuildinfo')) continue;
|
|
232
|
+
if (!/^[A-Za-z0-9_][A-Za-z0-9._-]{0,99}$/u.test(entry.name)) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter contains an unsupported file name.');
|
|
233
|
+
const next = [...segments, entry.name];
|
|
234
|
+
if (entry.isDirectory()) { await walk(next); continue; }
|
|
235
|
+
const path = resolve(root, ...next); const details = await lstat(path);
|
|
236
|
+
if (!details.isFile() || details.isSymbolicLink() || details.size > starterLimits.fileBytes) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter contains an unsupported file type or size.');
|
|
237
|
+
total += details.size;
|
|
238
|
+
if (files.size >= starterLimits.files || total > starterLimits.totalBytes) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter exceeds its file bounds.');
|
|
239
|
+
let content: string;
|
|
240
|
+
try { content = new TextDecoder('utf-8', { fatal: true }).decode(await readFile(path)); } catch { throw new MayuraError('INTEGRITY_VIOLATION', 'Starter files must be UTF-8 text.'); }
|
|
241
|
+
files.set(starterPath(next), content);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
await walk([]); return files;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** The repository copy links Mayura packages with `workspace:*`; a generated project pins this CLI's exact release. */
|
|
248
|
+
async function starterManifest(content: string, name: string): Promise<string> {
|
|
249
|
+
const { version } = JSON.parse(await readFile(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8')) as { version: string };
|
|
250
|
+
const manifest = JSON.parse(content) as Record<string, unknown>; manifest['name'] = name;
|
|
251
|
+
for (const field of ['dependencies', 'devDependencies']) {
|
|
252
|
+
const entries = manifest[field] as Record<string, string> | undefined;
|
|
253
|
+
for (const [dependency, range] of Object.entries(entries ?? {})) {
|
|
254
|
+
if (range === 'workspace:*' && dependency === 'mayura') entries![dependency] = version;
|
|
255
|
+
else if (range.startsWith('workspace:')) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter manifests may link only mayura to the workspace.');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Produces a complete, content-bound write plan for a multi-file starter without mutating the target. */
|
|
262
|
+
export async function planStarter(starter: StarterName, directory: string): Promise<StarterInitPlan> {
|
|
263
|
+
if (!STARTER_NAMES.includes(starter) || !isAbsolute(directory) || resolve(directory) === parse(resolve(directory)).root) {
|
|
264
|
+
throw new MayuraError('INVALID_CONFIG', 'Initializer requires a known starter and a non-root absolute directory.');
|
|
265
|
+
}
|
|
266
|
+
const target = await canonicalTarget(resolve(directory)); const name = projectName(target);
|
|
267
|
+
await assertSafeDirectory(target);
|
|
268
|
+
const files = await collectStarter(starter);
|
|
269
|
+
const manifest = files.get('package.json'); const project = files.get('mayura.project.json');
|
|
270
|
+
if (manifest === undefined || project === undefined) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter is missing its package or project manifest.');
|
|
271
|
+
files.set('package.json', await starterManifest(manifest, name));
|
|
272
|
+
const catalog = validateProject(JSON.parse(project)); if (catalog.template !== starter) throw new MayuraError('INTEGRITY_VIOLATION', 'Starter project manifest names another starter.');
|
|
273
|
+
files.set('mayura.project.json', `${JSON.stringify({ ...catalog, name }, null, 2)}\n`);
|
|
274
|
+
const { changes, before } = await planChanges(target, files);
|
|
275
|
+
const planDigest = digest(JSON.stringify({ starter, directory: target, changes }));
|
|
276
|
+
const plan = Object.freeze({ format: 'mayura.init-plan.v1' as const, starter, directory: target, digest: planDigest, changes: Object.freeze(changes) });
|
|
277
|
+
plans.set(plan, { files, before }); return plan;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface ApplyInitOptions { readonly confirmation?: string }
|
|
281
|
+
|
|
282
|
+
/** Applies one genuine fresh plan. Replacements require its displayed digest as confirmation. */
|
|
283
|
+
export async function applyProjectPlan(plan: InitPlan | StarterInitPlan, options: ApplyInitOptions = {}): Promise<void> {
|
|
284
|
+
const state = plans.get(plan); if (!state) throw new MayuraError('INVALID_CONFIG', 'Use a genuine initialization plan from this process.');
|
|
285
|
+
plans.delete(plan);
|
|
286
|
+
const replacements = plan.changes.filter(change => change.operation === 'replace');
|
|
287
|
+
if (replacements.length > 0 && options.confirmation !== plan.digest) {
|
|
288
|
+
throw new MayuraError('PERMISSION_DENIED', 'Replacing initialized files requires the displayed plan digest.');
|
|
289
|
+
}
|
|
290
|
+
await mkdir(plan.directory, { recursive: true }); const canonical = await realpath(plan.directory);
|
|
291
|
+
if (canonical !== plan.directory && resolve(canonical) !== resolve(plan.directory)) throw new MayuraError('CONFLICT', 'Initializer target resolves through an unexpected path.');
|
|
292
|
+
const root = await lstat(canonical); if (!root.isDirectory() || root.isSymbolicLink()) throw new MayuraError('CONFLICT', 'Initializer target directories cannot be links.');
|
|
293
|
+
// Create each parent directory one level at a time, parents first, refusing any that is (or became) a link.
|
|
294
|
+
const parents = new Set<string>();
|
|
295
|
+
for (const change of plan.changes) { const segments = change.path.split('/'); for (let index = 1; index < segments.length; index++) parents.add(segments.slice(0, index).join('/')); }
|
|
296
|
+
for (const parent of [...parents].sort((left, right) => left.split('/').length - right.split('/').length)) {
|
|
297
|
+
const path = resolve(canonical, parent); if (!inside(canonical, path)) throw new MayuraError('INTEGRITY_VIOLATION', 'Initializer path escaped its target.');
|
|
298
|
+
await mkdir(path).catch((error: NodeJS.ErrnoException) => { if (error.code !== 'EEXIST') throw error; });
|
|
299
|
+
const details = await lstat(path); if (!details.isDirectory() || details.isSymbolicLink()) throw new MayuraError('CONFLICT', 'Initializer target directories cannot be links.');
|
|
300
|
+
}
|
|
301
|
+
// Complete the stale-plan check before the first write.
|
|
302
|
+
for (const change of plan.changes) {
|
|
303
|
+
const path = resolve(canonical, change.path); if (!inside(canonical, path)) throw new MayuraError('INTEGRITY_VIOLATION', 'Initializer path escaped its target.');
|
|
304
|
+
const current = await existingFile(path); const expected = state.before.get(change.path);
|
|
305
|
+
if (current !== expected) throw new MayuraError('CONFLICT', 'Initializer target changed after planning. Generate a new visible plan.');
|
|
306
|
+
}
|
|
307
|
+
const backups: Array<Readonly<{ path: string; backup?: string }>> = []; const temporary: string[] = [];
|
|
308
|
+
try {
|
|
309
|
+
for (const change of plan.changes) {
|
|
310
|
+
if (change.operation === 'unchanged') continue;
|
|
311
|
+
const path = resolve(canonical, change.path); const content = state.files.get(change.path)!;
|
|
312
|
+
const stage = `${path}.mayura-stage-${randomUUID()}`; temporary.push(stage);
|
|
313
|
+
await writeFile(stage, content, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
|
|
314
|
+
if (change.operation === 'replace') {
|
|
315
|
+
const backup = `${path}.mayura-backup-${randomUUID()}`; await rename(path, backup); backups.push({ path, backup });
|
|
316
|
+
} else backups.push({ path });
|
|
317
|
+
await rename(stage, path); temporary.splice(temporary.indexOf(stage), 1);
|
|
318
|
+
}
|
|
319
|
+
} catch (error) {
|
|
320
|
+
for (const entry of backups.reverse()) {
|
|
321
|
+
await unlink(entry.path).catch(() => undefined);
|
|
322
|
+
if (entry.backup !== undefined) await rename(entry.backup, entry.path).catch(() => undefined);
|
|
323
|
+
}
|
|
324
|
+
for (const path of temporary) await unlink(path).catch(() => undefined);
|
|
325
|
+
throw error;
|
|
326
|
+
}
|
|
327
|
+
for (const entry of backups) if (entry.backup !== undefined) await unlink(entry.backup);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function record(value: unknown): JsonObject {
|
|
331
|
+
const snapshot = freezeJson(jsonValue(value, { maxBytes: 262_144, maxDepth: 16, maxNodes: 10_000 }));
|
|
332
|
+
if (!snapshot || typeof snapshot !== 'object' || Array.isArray(snapshot)) throw new MayuraError('INVALID_CONFIG', 'Project configuration must be a bounded JSON object.');
|
|
333
|
+
return snapshot;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** Validates the non-executable project catalog used by inspect and future admin commands. */
|
|
337
|
+
export function validateProject(value: unknown): MayuraProject {
|
|
338
|
+
const root = record(value); const keys = Object.keys(root).sort();
|
|
339
|
+
if (JSON.stringify(keys) !== JSON.stringify(['definitions', 'format', 'name', 'template', 'tools']) || root['format'] !== 'mayura.project.v1'
|
|
340
|
+
|| typeof root['name'] !== 'string' || !/^[a-z0-9][a-z0-9-]{0,63}$/u.test(root['name'])
|
|
341
|
+
|| typeof root['template'] !== 'string' || !(TEMPLATE_NAMES.includes(root['template'] as TemplateName) || STARTER_NAMES.includes(root['template'] as StarterName))
|
|
342
|
+
|| !Array.isArray(root['definitions']) || root['definitions'].length > 256 || !Array.isArray(root['tools']) || root['tools'].length > 1_024) {
|
|
343
|
+
throw new MayuraError('INVALID_CONFIG', 'Project configuration shape is invalid.');
|
|
344
|
+
}
|
|
345
|
+
const identities = new Set<string>();
|
|
346
|
+
const definitions = root['definitions'].map(raw => {
|
|
347
|
+
const item = record(raw); if (Object.keys(item).sort().join(',') !== 'id,kind,source,version' || !['agent', 'workflow'].includes(String(item['kind']))
|
|
348
|
+
|| typeof item['id'] !== 'string' || !id.test(item['id']) || typeof item['version'] !== 'string' || !id.test(item['version'])
|
|
349
|
+
|| typeof item['source'] !== 'string' || !/^src\/[A-Za-z0-9_./-]+\.ts$/u.test(item['source']) || item['source'].includes('..')) {
|
|
350
|
+
throw new MayuraError('INVALID_CONFIG', 'Project definition record is invalid.');
|
|
351
|
+
}
|
|
352
|
+
const key = `${item['kind']}:${item['id']}:${item['version']}`; if (identities.has(key)) throw new MayuraError('CONFLICT', 'Project definition identity is duplicated.');
|
|
353
|
+
identities.add(key); return item as unknown as ProjectDefinitionRecord;
|
|
354
|
+
});
|
|
355
|
+
const tools = root['tools'].map(raw => {
|
|
356
|
+
const item = record(raw); if (Object.keys(item).sort().join(',') !== 'capabilities,effects,id,version' || typeof item['id'] !== 'string' || !id.test(item['id'])
|
|
357
|
+
|| typeof item['version'] !== 'string' || !id.test(item['version']) || !['none', 'read', 'write', 'host'].includes(String(item['effects']))
|
|
358
|
+
|| !Array.isArray(item['capabilities']) || item['capabilities'].length > 256
|
|
359
|
+
|| item['capabilities'].some(capability => typeof capability !== 'string' || !id.test(capability))) {
|
|
360
|
+
throw new MayuraError('INVALID_CONFIG', 'Project tool record is invalid.');
|
|
361
|
+
}
|
|
362
|
+
return item as unknown as ProjectToolRecord;
|
|
363
|
+
});
|
|
364
|
+
return Object.freeze({ format: 'mayura.project.v1', name: root['name'] as string, template: root['template'] as TemplateName | StarterName,
|
|
365
|
+
definitions: Object.freeze(definitions), tools: Object.freeze(tools) });
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export async function readProject(path: string): Promise<MayuraProject> {
|
|
369
|
+
if (!isAbsolute(path)) throw new MayuraError('INVALID_CONFIG', 'Project configuration path must be absolute.');
|
|
370
|
+
let parsed: unknown; try {
|
|
371
|
+
const details = await lstat(path);
|
|
372
|
+
if (!details.isFile() || details.isSymbolicLink() || details.size > 262_144) throw new Error();
|
|
373
|
+
parsed = JSON.parse(await readFile(path, 'utf8'));
|
|
374
|
+
}
|
|
375
|
+
catch { throw new MayuraError('INVALID_CONFIG', 'Project configuration is not readable bounded JSON.'); }
|
|
376
|
+
return validateProject(parsed);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export function templates(): readonly Readonly<{ name: TemplateName; description: string; dependencies: readonly string[] }>[] {
|
|
380
|
+
return Object.freeze(TEMPLATE_NAMES.map(name => Object.freeze({ name, description: descriptions[name], dependencies: dependencies[name] })));
|
|
381
|
+
}
|
|
382
|
+
export function starters(): readonly Readonly<{ name: StarterName; description: string }>[] {
|
|
383
|
+
return Object.freeze(STARTER_NAMES.map(name => Object.freeze({ name, description: starterDescriptions[name] })));
|
|
384
|
+
}
|
|
385
|
+
export { defineMayuraApplication, loadApplication, migrateApplication, runWorkerApplication, serveApplication, type MayuraApplication, type MayuraLifecycleEvent,
|
|
386
|
+
type MayuraServerHandle, type MayuraWorkerHandle } from './application.js';
|