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,307 @@
|
|
|
1
|
+
import { ClientError, type ClientJson, type MayuraClient } from './index.js';
|
|
2
|
+
|
|
3
|
+
export type WorkflowViewFormat = 2 | 3 | 4 | 5;
|
|
4
|
+
export type WorkflowViewNodeKind = 'tool' | 'join' | 'wait' | 'child' | 'human' | 'timer';
|
|
5
|
+
export type WorkflowViewRunStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';
|
|
6
|
+
export type WorkflowViewStepStatus = 'pending' | 'waiting' | 'approved' | 'dispatching' | 'succeeded' | 'failed' | 'blocked' | 'unknown' | 'skipped' | 'timed_out';
|
|
7
|
+
export interface WorkflowViewNode { readonly id: string; readonly kind: WorkflowViewNodeKind; readonly dependsOn: readonly string[] }
|
|
8
|
+
/** A tool step waiting for approval. Approve with `digest` before `expiresAtMs`; `subject` is the exact, verified tool call when the host can show it. */
|
|
9
|
+
export interface WorkflowViewApproval {
|
|
10
|
+
readonly digest: string; readonly expiresAtMs: number;
|
|
11
|
+
readonly subject?: { readonly toolId: string; readonly toolVersion: string; readonly input: ClientJson };
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowViewStep {
|
|
14
|
+
readonly id: string; readonly kind: WorkflowViewNodeKind; readonly status: WorkflowViewStepStatus; readonly childRunId?: string;
|
|
15
|
+
readonly approval?: WorkflowViewApproval;
|
|
16
|
+
}
|
|
17
|
+
export interface WorkflowViewInput {
|
|
18
|
+
readonly format: WorkflowViewFormat; readonly definitionId: string; readonly definitionVersion: string;
|
|
19
|
+
readonly runId: string; readonly revision: number; readonly status: WorkflowViewRunStatus;
|
|
20
|
+
readonly nodes: readonly WorkflowViewNode[]; readonly steps: readonly WorkflowViewStep[];
|
|
21
|
+
}
|
|
22
|
+
export interface WorkflowGraphNode {
|
|
23
|
+
readonly id: string; readonly kind: WorkflowViewNodeKind; readonly status: WorkflowViewStepStatus; readonly depth: number;
|
|
24
|
+
readonly ready: boolean; readonly childRunId: string | null;
|
|
25
|
+
/** The pending approval of a waiting tool step, or null. */
|
|
26
|
+
readonly approval: WorkflowViewApproval | null;
|
|
27
|
+
}
|
|
28
|
+
const toolIdentifier = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
29
|
+
/** Exact frozen shape of a pending approval (the same rules the client applies to a fetched view). */
|
|
30
|
+
function pendingApproval(value: unknown): value is WorkflowViewApproval {
|
|
31
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || !Object.isFrozen(value)) return false;
|
|
32
|
+
const approval = value as Record<string, unknown>; const subject = approval['subject'] as Record<string, unknown> | undefined;
|
|
33
|
+
return Object.keys(approval).every(key => ['digest', 'expiresAtMs', 'subject'].includes(key)) && typeof approval['digest'] === 'string'
|
|
34
|
+
&& /^[a-f0-9]{64}$/.test(approval['digest']) && typeof approval['expiresAtMs'] === 'number' && Number.isSafeInteger(approval['expiresAtMs']) && approval['expiresAtMs'] > 0
|
|
35
|
+
&& (subject === undefined || (!!subject && typeof subject === 'object' && !Array.isArray(subject) && Object.isFrozen(subject) && Object.keys(subject).length === 3
|
|
36
|
+
&& Object.hasOwn(subject, 'input') && typeof subject['toolId'] === 'string' && toolIdentifier.test(subject['toolId'])
|
|
37
|
+
&& typeof subject['toolVersion'] === 'string' && toolIdentifier.test(subject['toolVersion'])));
|
|
38
|
+
}
|
|
39
|
+
export interface WorkflowGraphEdge { readonly from: string; readonly to: string }
|
|
40
|
+
export interface WorkflowGraphProjection {
|
|
41
|
+
readonly format: WorkflowViewFormat; readonly definitionId: string; readonly definitionVersion: string;
|
|
42
|
+
readonly runId: string; readonly revision: number; readonly status: WorkflowViewRunStatus;
|
|
43
|
+
readonly nodes: readonly WorkflowGraphNode[]; readonly edges: readonly WorkflowGraphEdge[];
|
|
44
|
+
readonly progress: { readonly total: number; readonly terminal: number; readonly succeeded: number; readonly active: number; readonly waiting: number; readonly failed: number };
|
|
45
|
+
}
|
|
46
|
+
export type WorkflowCommandStatus = 'idle' | 'submitting' | 'succeeded' | 'conflict' | 'failed' | 'disposed';
|
|
47
|
+
export type WorkflowCommandAction = 'cancel' | 'approve' | 'signal' | 'resume' | 'pause';
|
|
48
|
+
export interface WorkflowCommandState {
|
|
49
|
+
readonly stateRevision: number; readonly status: WorkflowCommandStatus; readonly runId: string;
|
|
50
|
+
readonly workflowRevision: number; readonly workflowStatus: WorkflowViewRunStatus; readonly action: WorkflowCommandAction | null;
|
|
51
|
+
readonly nodeId: string | null; readonly errorCode: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkflowApprovalIntent { readonly nodeId: string; readonly approvalDigest: string; readonly childRunId?: string }
|
|
54
|
+
export interface WorkflowSignalIntent { readonly signalId: string; readonly signalName: string; readonly value: ClientJson }
|
|
55
|
+
export interface WorkflowCommandControllerOptions {
|
|
56
|
+
readonly client: Pick<MayuraClient, 'cancelWorkflow' | 'approveWorkflow'> & Partial<Pick<MayuraClient, 'signalWorkflow' | 'resumeWorkflow' | 'pauseWorkflow'>>;
|
|
57
|
+
readonly workflow: WorkflowViewInput; readonly maxSubscribers?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface WorkflowCommandController {
|
|
60
|
+
getSnapshot(): WorkflowCommandState;
|
|
61
|
+
subscribe(listener: () => void): () => void;
|
|
62
|
+
cancel(options: { readonly commandId: string; readonly signal?: AbortSignal }): Promise<WorkflowViewInput>;
|
|
63
|
+
approve(command: WorkflowApprovalIntent, options: { readonly commandId: string; readonly signal?: AbortSignal }): Promise<WorkflowViewInput>;
|
|
64
|
+
signal(command: WorkflowSignalIntent, options: { readonly commandId: string; readonly signal?: AbortSignal }): Promise<WorkflowViewInput>;
|
|
65
|
+
resume(options: { readonly commandId: string; readonly signal?: AbortSignal }): Promise<WorkflowViewInput>;
|
|
66
|
+
/** Request a quiescent operator pause; the server may conflict while an effect is claimed or in flight. */
|
|
67
|
+
pause(options: { readonly commandId: string; readonly signal?: AbortSignal }): Promise<WorkflowViewInput>;
|
|
68
|
+
reset(): WorkflowCommandState;
|
|
69
|
+
dispose(): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const identifier = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;
|
|
73
|
+
const version = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
74
|
+
const digest = /^[a-f0-9]{64}$/;
|
|
75
|
+
const runStatuses = new Set<WorkflowViewRunStatus>(['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown']);
|
|
76
|
+
const stepStatuses = new Set<WorkflowViewStepStatus>(['pending', 'waiting', 'approved', 'dispatching', 'succeeded', 'failed', 'blocked', 'unknown', 'skipped', 'timed_out']);
|
|
77
|
+
const humanStatuses = new Set<WorkflowViewStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped']);
|
|
78
|
+
const timerStatuses = new Set<WorkflowViewStepStatus>(['pending', 'waiting', 'succeeded', 'skipped']);
|
|
79
|
+
const terminal = new Set<WorkflowViewStepStatus>(['succeeded', 'failed', 'blocked', 'unknown', 'skipped', 'timed_out']);
|
|
80
|
+
const failed = new Set<WorkflowViewStepStatus>(['failed', 'blocked', 'unknown', 'timed_out']);
|
|
81
|
+
const kinds: Readonly<Record<WorkflowViewFormat, ReadonlySet<WorkflowViewNodeKind>>> = Object.freeze({
|
|
82
|
+
2: new Set<WorkflowViewNodeKind>(['tool', 'join']), 3: new Set<WorkflowViewNodeKind>(['tool', 'join', 'wait']),
|
|
83
|
+
4: new Set<WorkflowViewNodeKind>(['tool', 'join', 'child']), 5: new Set<WorkflowViewNodeKind>(['tool', 'join', 'human', 'timer']),
|
|
84
|
+
});
|
|
85
|
+
function invalid(): never { throw new ClientError('INVALID_WORKFLOW_VIEW'); }
|
|
86
|
+
function fields(value: object, names: readonly string[]): Record<string, PropertyDescriptor> {
|
|
87
|
+
const descriptors = Object.getOwnPropertyDescriptors(value); const keys = Reflect.ownKeys(descriptors);
|
|
88
|
+
if (keys.length !== names.length || keys.some(key => typeof key !== 'string' || !names.includes(key) || !('value' in descriptors[key]!))) return invalid();
|
|
89
|
+
return descriptors;
|
|
90
|
+
}
|
|
91
|
+
function frozenArray(value: unknown, maximum: number): readonly unknown[] {
|
|
92
|
+
if (!Array.isArray(value) || !Object.isFrozen(value) || value.length < 1 || value.length > maximum) return invalid();
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Validate one matched durable manifest/snapshot view and derive a bounded, content-free DAG projection. */
|
|
97
|
+
export function createWorkflowGraphProjection(input: WorkflowViewInput): WorkflowGraphProjection {
|
|
98
|
+
if (!input || typeof input !== 'object' || !Object.isFrozen(input)) return invalid();
|
|
99
|
+
const root = fields(input, ['format', 'definitionId', 'definitionVersion', 'runId', 'revision', 'status', 'nodes', 'steps']);
|
|
100
|
+
const format = root['format']!.value as WorkflowViewFormat; const definitionId = root['definitionId']!.value as string;
|
|
101
|
+
const definitionVersion = root['definitionVersion']!.value as string; const runId = root['runId']!.value as string;
|
|
102
|
+
const revision = root['revision']!.value as number; const status = root['status']!.value as WorkflowViewRunStatus;
|
|
103
|
+
if (![2, 3, 4, 5].includes(format) || typeof definitionId !== 'string' || !identifier.test(definitionId)
|
|
104
|
+
|| typeof definitionVersion !== 'string' || !version.test(definitionVersion) || typeof runId !== 'string' || !digest.test(runId)
|
|
105
|
+
|| !Number.isSafeInteger(revision) || revision < 1 || typeof status !== 'string' || !runStatuses.has(status)) return invalid();
|
|
106
|
+
const rawNodes = frozenArray(root['nodes']!.value, 128); const rawSteps = frozenArray(root['steps']!.value, 128);
|
|
107
|
+
if (rawNodes.length !== rawSteps.length) return invalid();
|
|
108
|
+
const nodes = new Map<string, { id: string; kind: WorkflowViewNodeKind; dependsOn: readonly string[]; index: number }>(); let edgeCount = 0;
|
|
109
|
+
for (const [index, raw] of rawNodes.entries()) {
|
|
110
|
+
if (!raw || typeof raw !== 'object' || !Object.isFrozen(raw)) return invalid(); const item = fields(raw, ['id', 'kind', 'dependsOn']);
|
|
111
|
+
const id = item['id']!.value as string; const kind = item['kind']!.value as WorkflowViewNodeKind; const dependencies = item['dependsOn']!.value;
|
|
112
|
+
if (typeof id !== 'string' || !identifier.test(id) || nodes.has(id) || typeof kind !== 'string' || !kinds[format].has(kind)) return invalid();
|
|
113
|
+
const list = frozenArrayAllowEmpty(dependencies, 127); if (new Set(list).size !== list.length || list.some(value => typeof value !== 'string' || !identifier.test(value))) return invalid();
|
|
114
|
+
edgeCount += list.length; if (edgeCount > 512) return invalid(); nodes.set(id, { id, kind, dependsOn: list as readonly string[], index });
|
|
115
|
+
}
|
|
116
|
+
for (const node of nodes.values()) if (node.dependsOn.some(dependency => dependency === node.id || !nodes.has(dependency))) return invalid();
|
|
117
|
+
const steps = new Map<string, { id: string; kind: WorkflowViewNodeKind; status: WorkflowViewStepStatus; childRunId: string | null; approval: WorkflowViewApproval | null }>();
|
|
118
|
+
for (const raw of rawSteps) {
|
|
119
|
+
if (!raw || typeof raw !== 'object' || !Object.isFrozen(raw)) return invalid(); const descriptors = Object.getOwnPropertyDescriptors(raw);
|
|
120
|
+
const names = Reflect.ownKeys(descriptors); const allowed = ['id', 'kind', 'status', 'childRunId', 'approval'];
|
|
121
|
+
if (names.some(key => typeof key !== 'string' || !allowed.includes(key) || !('value' in descriptors[key]!)) || !['id', 'kind', 'status'].every(key => descriptors[key])) return invalid();
|
|
122
|
+
const id = descriptors['id']!.value as string; const kind = descriptors['kind']!.value as WorkflowViewNodeKind; const stepStatus = descriptors['status']!.value as WorkflowViewStepStatus;
|
|
123
|
+
const hasChildRunId = descriptors['childRunId'] !== undefined; const childRunId = descriptors['childRunId']?.value as string | undefined; const node = nodes.get(id);
|
|
124
|
+
const approval = descriptors['approval']?.value as WorkflowViewApproval | undefined;
|
|
125
|
+
if (!node || steps.has(id) || kind !== node.kind || typeof stepStatus !== 'string' || !stepStatuses.has(stepStatus)
|
|
126
|
+
|| (kind === 'human' && !humanStatuses.has(stepStatus)) || (kind === 'timer' && !timerStatuses.has(stepStatus))
|
|
127
|
+
|| (stepStatus === 'timed_out' && kind !== 'human')
|
|
128
|
+
|| (hasChildRunId && (kind !== 'child' || typeof childRunId !== 'string' || !digest.test(childRunId)))
|
|
129
|
+
|| (descriptors['approval'] !== undefined && (kind !== 'tool' || stepStatus !== 'waiting' || !pendingApproval(approval)))) return invalid();
|
|
130
|
+
steps.set(id, { id, kind, status: stepStatus, childRunId: childRunId ?? null, approval: approval ?? null });
|
|
131
|
+
}
|
|
132
|
+
if (steps.size !== nodes.size) return invalid();
|
|
133
|
+
const remaining = new Map([...nodes].map(([id, node]) => [id, node.dependsOn.length])); const depths = new Map<string, number>();
|
|
134
|
+
const dependents = new Map<string, string[]>(); for (const node of nodes.values()) for (const dependency of node.dependsOn) {
|
|
135
|
+
const list = dependents.get(dependency) ?? []; list.push(node.id); dependents.set(dependency, list);
|
|
136
|
+
}
|
|
137
|
+
const queue = [...nodes.values()].filter(node => node.dependsOn.length === 0).sort((a, b) => a.index - b.index).map(node => node.id);
|
|
138
|
+
for (let cursor = 0; cursor < queue.length; cursor++) { const id = queue[cursor]!; const node = nodes.get(id)!;
|
|
139
|
+
depths.set(id, node.dependsOn.length === 0 ? 0 : Math.max(...node.dependsOn.map(dependency => depths.get(dependency)!)) + 1);
|
|
140
|
+
for (const dependent of dependents.get(id) ?? []) { const count = remaining.get(dependent)! - 1; remaining.set(dependent, count); if (count === 0) queue.push(dependent); }
|
|
141
|
+
}
|
|
142
|
+
if (depths.size !== nodes.size) return invalid();
|
|
143
|
+
const projected = [...nodes.values()].sort((a, b) => a.index - b.index).map(node => { const step = steps.get(node.id)!;
|
|
144
|
+
return Object.freeze({ id: node.id, kind: node.kind, status: step.status, depth: depths.get(node.id)!,
|
|
145
|
+
ready: step.status === 'pending' && node.dependsOn.every(dependency => steps.get(dependency)!.status === 'succeeded'), childRunId: step.childRunId, approval: step.approval }); });
|
|
146
|
+
const edges = [...nodes.values()].flatMap(node => node.dependsOn.map(from => Object.freeze({ from, to: node.id })));
|
|
147
|
+
const statuses = [...steps.values()].map(step => step.status); const progress = Object.freeze({ total: statuses.length,
|
|
148
|
+
terminal: statuses.filter(value => terminal.has(value)).length, succeeded: statuses.filter(value => value === 'succeeded').length,
|
|
149
|
+
active: statuses.filter(value => ['approved', 'dispatching'].includes(value)).length, waiting: statuses.filter(value => value === 'waiting').length,
|
|
150
|
+
failed: statuses.filter(value => failed.has(value)).length });
|
|
151
|
+
return Object.freeze({ format, definitionId, definitionVersion, runId, revision, status,
|
|
152
|
+
nodes: Object.freeze(projected), edges: Object.freeze(edges), progress });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function frozenArrayAllowEmpty(value: unknown, maximum: number): readonly unknown[] {
|
|
156
|
+
if (!Array.isArray(value) || !Object.isFrozen(value) || value.length > maximum) return invalid();
|
|
157
|
+
return value;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const commandId = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
161
|
+
const signalIdentifier = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
162
|
+
const encoder = new TextEncoder();
|
|
163
|
+
function workflowCommandState(state: WorkflowCommandState): WorkflowCommandState { return Object.freeze({ ...state }); }
|
|
164
|
+
function safeWorkflowCommandError(error: unknown): ClientError {
|
|
165
|
+
const allowed = new Set(['ABORTED', 'TRANSPORT_FAILED', 'REDIRECT_DENIED', 'HTTP_ERROR', 'INVALID_RESPONSE', 'INVALID_JSON', 'RESPONSE_LIMIT', 'INVALID_REQUEST']);
|
|
166
|
+
return error instanceof ClientError && allowed.has(error.code) ? error : new ClientError('WORKFLOW_COMMAND_FAILED');
|
|
167
|
+
}
|
|
168
|
+
function approvalIntent(value: unknown, projection: WorkflowGraphProjection): WorkflowApprovalIntent {
|
|
169
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || ![null, Object.prototype].includes(Object.getPrototypeOf(value)))
|
|
170
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
171
|
+
const fields = Object.getOwnPropertyDescriptors(value); const keys = Reflect.ownKeys(fields);
|
|
172
|
+
if (keys.some(key => typeof key !== 'string' || !['nodeId', 'approvalDigest', 'childRunId'].includes(key) || !('value' in fields[key]!))
|
|
173
|
+
|| !fields['nodeId'] || !fields['approvalDigest']) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
174
|
+
const nodeId = fields['nodeId'].value; const approvalDigest = fields['approvalDigest'].value; const childRunId = fields['childRunId']?.value;
|
|
175
|
+
const node = projection.nodes.find(candidate => candidate.id === nodeId);
|
|
176
|
+
if (typeof nodeId !== 'string' || !identifier.test(nodeId) || typeof approvalDigest !== 'string' || !digest.test(approvalDigest)
|
|
177
|
+
|| (childRunId !== undefined && (typeof childRunId !== 'string' || !digest.test(childRunId)))
|
|
178
|
+
|| !node || node.status !== 'waiting' || node.childRunId !== (childRunId ?? null)) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
179
|
+
return Object.freeze({ nodeId, approvalDigest, ...(childRunId === undefined ? {} : { childRunId }) });
|
|
180
|
+
}
|
|
181
|
+
function workflowSignalIntent(value: unknown): WorkflowSignalIntent {
|
|
182
|
+
if (!value || typeof value !== 'object' || Array.isArray(value) || ![null, Object.prototype].includes(Object.getPrototypeOf(value)))
|
|
183
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
184
|
+
const fields = Object.getOwnPropertyDescriptors(value); const keys = Reflect.ownKeys(fields);
|
|
185
|
+
if (keys.length !== 3 || keys.some(key => typeof key !== 'string' || !['signalId', 'signalName', 'value'].includes(key) || !('value' in fields[key]!)))
|
|
186
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
187
|
+
const signalId = fields['signalId']?.value; const signalName = fields['signalName']?.value;
|
|
188
|
+
if (typeof signalId !== 'string' || !signalIdentifier.test(signalId) || typeof signalName !== 'string' || !signalIdentifier.test(signalName))
|
|
189
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
190
|
+
let nodes = 0; const seen = new Set<object>();
|
|
191
|
+
const copy = (item: unknown, depth: number): ClientJson => {
|
|
192
|
+
if (++nodes > 1_024 || depth > 16) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
193
|
+
if (item === null || typeof item === 'boolean' || typeof item === 'string') return item;
|
|
194
|
+
if (typeof item === 'number' && Number.isFinite(item) && (!Number.isInteger(item) || Number.isSafeInteger(item))) return item;
|
|
195
|
+
if (typeof item !== 'object' || seen.has(item) || (!Array.isArray(item) && ![null, Object.prototype].includes(Object.getPrototypeOf(item))))
|
|
196
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
197
|
+
seen.add(item); const descriptors = Object.getOwnPropertyDescriptors(item); let result: ClientJson;
|
|
198
|
+
if (Array.isArray(item)) {
|
|
199
|
+
if (Reflect.ownKeys(descriptors).length !== item.length + 1 || !descriptors['length']) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
200
|
+
const entries: ClientJson[] = [];
|
|
201
|
+
for (let index = 0; index < item.length; index++) { const descriptor = descriptors[String(index)];
|
|
202
|
+
if (!descriptor || !('value' in descriptor)) throw new ClientError('INVALID_WORKFLOW_COMMAND'); entries.push(copy(descriptor.value, depth + 1)); }
|
|
203
|
+
result = Object.freeze(entries);
|
|
204
|
+
} else {
|
|
205
|
+
const entries: Record<string, ClientJson> = {};
|
|
206
|
+
for (const key of Reflect.ownKeys(descriptors)) { const descriptor = descriptors[key as keyof typeof descriptors];
|
|
207
|
+
if (typeof key !== 'string' || ['__proto__', 'constructor', 'prototype'].includes(key) || !descriptor || !('value' in descriptor) || !descriptor.enumerable)
|
|
208
|
+
throw new ClientError('INVALID_WORKFLOW_COMMAND'); entries[key] = copy(descriptor.value, depth + 1); }
|
|
209
|
+
result = Object.freeze(entries);
|
|
210
|
+
}
|
|
211
|
+
seen.delete(item); return result;
|
|
212
|
+
};
|
|
213
|
+
const captured = copy(fields['value']!.value, 0);
|
|
214
|
+
if (encoder.encode(JSON.stringify(captured)).byteLength > 4_096) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
215
|
+
return Object.freeze({ signalId, signalName, value: captured });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Caller-owned, inert single-flight command state for one exact durable workflow revision. */
|
|
219
|
+
export function createWorkflowCommandController(options: WorkflowCommandControllerOptions): WorkflowCommandController {
|
|
220
|
+
if (!options || !options.client || typeof options.client.cancelWorkflow !== 'function' || typeof options.client.approveWorkflow !== 'function')
|
|
221
|
+
throw new ClientError('INVALID_WORKFLOW_CONTROLLER');
|
|
222
|
+
let projection: WorkflowGraphProjection;
|
|
223
|
+
try { projection = createWorkflowGraphProjection(options.workflow); } catch { throw new ClientError('INVALID_WORKFLOW_CONTROLLER'); }
|
|
224
|
+
const maxSubscribers = options.maxSubscribers ?? 64;
|
|
225
|
+
if (!Number.isSafeInteger(maxSubscribers) || maxSubscribers < 1 || maxSubscribers > 256) throw new ClientError('INVALID_WORKFLOW_CONTROLLER');
|
|
226
|
+
const client = options.client; const workflow = options.workflow; const listeners = new Set<() => void>(); let active: AbortController | null = null; let disposed = false;
|
|
227
|
+
let state = workflowCommandState({ stateRevision: 0, status: 'idle', runId: workflow.runId, workflowRevision: workflow.revision,
|
|
228
|
+
workflowStatus: workflow.status, action: null, nodeId: null, errorCode: null });
|
|
229
|
+
const publish = (change: Omit<Partial<WorkflowCommandState>, 'stateRevision' | 'runId'>): WorkflowCommandState => {
|
|
230
|
+
state = workflowCommandState({ ...state, ...change, stateRevision: state.stateRevision + 1 });
|
|
231
|
+
for (const listener of [...listeners]) { try { listener(); } catch { /* Presentation listeners cannot alter command state. */ } }
|
|
232
|
+
return state;
|
|
233
|
+
};
|
|
234
|
+
const execute = async (action: WorkflowCommandAction, nodeId: string | null, settings: { readonly commandId: string; readonly signal?: AbortSignal },
|
|
235
|
+
invoke: (signal: AbortSignal) => Promise<WorkflowViewInput>): Promise<WorkflowViewInput> => {
|
|
236
|
+
if (disposed) throw new ClientError('WORKFLOW_CONTROLLER_DISPOSED');
|
|
237
|
+
if (active) throw new ClientError('WORKFLOW_CONTROLLER_BUSY');
|
|
238
|
+
if (state.status === 'succeeded') throw new ClientError('WORKFLOW_CONTROLLER_STALE');
|
|
239
|
+
if (state.status !== 'idle') throw new ClientError('WORKFLOW_CONTROLLER_NOT_READY');
|
|
240
|
+
if (!settings || typeof settings.commandId !== 'string' || !commandId.test(settings.commandId)) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
241
|
+
const controller = new AbortController(); const abort = (): void => controller.abort(); active = controller;
|
|
242
|
+
settings.signal?.addEventListener('abort', abort, { once: true }); if (settings.signal?.aborted) abort();
|
|
243
|
+
publish({ status: 'submitting', action, nodeId, errorCode: null });
|
|
244
|
+
try {
|
|
245
|
+
if (controller.signal.aborted) throw new ClientError('ABORTED');
|
|
246
|
+
const result = await invoke(controller.signal);
|
|
247
|
+
if (disposed || controller.signal.aborted) throw new ClientError('ABORTED');
|
|
248
|
+
let next: WorkflowGraphProjection;
|
|
249
|
+
try { next = createWorkflowGraphProjection(result); } catch { throw new ClientError('INVALID_RESPONSE'); }
|
|
250
|
+
if (next.runId !== projection.runId || next.definitionId !== projection.definitionId || next.definitionVersion !== projection.definitionVersion
|
|
251
|
+
|| next.revision < projection.revision) throw new ClientError('INVALID_RESPONSE');
|
|
252
|
+
publish({ status: 'succeeded', workflowRevision: next.revision, workflowStatus: next.status, errorCode: null }); return result;
|
|
253
|
+
} catch (error) {
|
|
254
|
+
const safe = safeWorkflowCommandError(error);
|
|
255
|
+
if (!disposed) {
|
|
256
|
+
const conflict = safe.code === 'HTTP_ERROR' && (safe.status === 409 || safe.status === 412);
|
|
257
|
+
publish({ status: conflict ? 'conflict' : 'failed', errorCode: conflict ? 'WORKFLOW_COMMAND_CONFLICT' : safe.code });
|
|
258
|
+
}
|
|
259
|
+
throw safe;
|
|
260
|
+
} finally { settings.signal?.removeEventListener('abort', abort); if (active === controller) active = null; }
|
|
261
|
+
};
|
|
262
|
+
return Object.freeze<WorkflowCommandController>({
|
|
263
|
+
getSnapshot: () => state,
|
|
264
|
+
subscribe: listener => {
|
|
265
|
+
if (disposed) throw new ClientError('WORKFLOW_CONTROLLER_DISPOSED');
|
|
266
|
+
if (typeof listener !== 'function') throw new ClientError('INVALID_WORKFLOW_CONTROLLER');
|
|
267
|
+
if (listeners.size >= maxSubscribers) throw new ClientError('WORKFLOW_SUBSCRIBER_LIMIT');
|
|
268
|
+
listeners.add(listener); let subscribed = true; return () => { if (subscribed) { subscribed = false; listeners.delete(listener); } };
|
|
269
|
+
},
|
|
270
|
+
cancel: settings => {
|
|
271
|
+
if (['succeeded', 'failed', 'cancelled', 'outcome_unknown'].includes(workflow.status)) return Promise.reject(new ClientError('INVALID_WORKFLOW_COMMAND'));
|
|
272
|
+
return execute('cancel', null, settings, signal => client.cancelWorkflow(workflow.runId, workflow.revision, { commandId: settings.commandId, signal }));
|
|
273
|
+
},
|
|
274
|
+
approve: async (command, settings) => {
|
|
275
|
+
const captured = approvalIntent(command, projection);
|
|
276
|
+
return await execute('approve', captured.nodeId, settings, signal => client.approveWorkflow(workflow.runId, { revision: workflow.revision, ...captured },
|
|
277
|
+
{ commandId: settings.commandId, signal }));
|
|
278
|
+
},
|
|
279
|
+
signal: async (command, settings) => {
|
|
280
|
+
if (typeof client.signalWorkflow !== 'function') throw new ClientError('INVALID_WORKFLOW_CONTROLLER');
|
|
281
|
+
if (['succeeded', 'failed', 'cancelled', 'outcome_unknown'].includes(workflow.status)) throw new ClientError('INVALID_WORKFLOW_COMMAND');
|
|
282
|
+
const captured = workflowSignalIntent(command);
|
|
283
|
+
return await execute('signal', null, settings, signal => client.signalWorkflow!(workflow.runId,
|
|
284
|
+
{ revision: workflow.revision, ...captured }, { commandId: settings.commandId, signal }));
|
|
285
|
+
},
|
|
286
|
+
resume: settings => {
|
|
287
|
+
if (typeof client.resumeWorkflow !== 'function') return Promise.reject(new ClientError('INVALID_WORKFLOW_CONTROLLER'));
|
|
288
|
+
if (!['running', 'waiting', 'paused'].includes(workflow.status)) return Promise.reject(new ClientError('INVALID_WORKFLOW_COMMAND'));
|
|
289
|
+
return execute('resume', null, settings, signal => client.resumeWorkflow!(workflow.runId, workflow.revision,
|
|
290
|
+
{ commandId: settings.commandId, signal }));
|
|
291
|
+
},
|
|
292
|
+
pause: settings => {
|
|
293
|
+
if (typeof client.pauseWorkflow !== 'function') return Promise.reject(new ClientError('INVALID_WORKFLOW_CONTROLLER'));
|
|
294
|
+
if (!['running', 'waiting'].includes(workflow.status)) return Promise.reject(new ClientError('INVALID_WORKFLOW_COMMAND'));
|
|
295
|
+
return execute('pause', null, settings, signal => client.pauseWorkflow!(workflow.runId, workflow.revision,
|
|
296
|
+
{ commandId: settings.commandId, signal }));
|
|
297
|
+
},
|
|
298
|
+
reset: () => {
|
|
299
|
+
if (disposed) throw new ClientError('WORKFLOW_CONTROLLER_DISPOSED'); if (active) throw new ClientError('WORKFLOW_CONTROLLER_BUSY');
|
|
300
|
+
if (state.status === 'succeeded') throw new ClientError('WORKFLOW_CONTROLLER_STALE');
|
|
301
|
+
return publish({ status: 'idle', action: null, nodeId: null, errorCode: null });
|
|
302
|
+
},
|
|
303
|
+
dispose: () => {
|
|
304
|
+
if (disposed) return; disposed = true; active?.abort(); publish({ status: 'disposed', action: null, nodeId: null, errorCode: null }); listeners.clear();
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type RemoteHumanRequest } from '../../client/dist/index.js';
|
|
3
|
+
import { type HumanResponseCommandState, type HumanResponseFormDefinition, type HumanResponseSubmission } from '../../client/dist/forms.js';
|
|
4
|
+
import type { HeadlessRunStore } from '../../client/dist/headless.js';
|
|
5
|
+
import type { WorkflowCommandState, WorkflowViewInput } from '../../client/dist/workflows.js';
|
|
6
|
+
export interface MayuraRunSummaryProps {
|
|
7
|
+
readonly store: HeadlessRunStore;
|
|
8
|
+
readonly label?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MayuraWorkflowGraphProps {
|
|
11
|
+
readonly input: WorkflowViewInput;
|
|
12
|
+
readonly label?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface MayuraHumanRequestCardProps {
|
|
15
|
+
readonly request: RemoteHumanRequest;
|
|
16
|
+
readonly nowMs: number;
|
|
17
|
+
readonly label?: string;
|
|
18
|
+
readonly onRespond?: (request: {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly digest: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface MayuraHumanResponseFormProps {
|
|
24
|
+
readonly request: RemoteHumanRequest;
|
|
25
|
+
readonly definition: HumanResponseFormDefinition;
|
|
26
|
+
readonly nowMs: number;
|
|
27
|
+
readonly label?: string;
|
|
28
|
+
readonly submitText?: string;
|
|
29
|
+
readonly commandState?: HumanResponseCommandState;
|
|
30
|
+
readonly onSubmit: (submission: HumanResponseSubmission) => void;
|
|
31
|
+
}
|
|
32
|
+
/** Accessible run summary over one caller-owned store. Rendering starts no remote operation. */
|
|
33
|
+
export declare function MayuraRunSummary({ store, label: suppliedLabel }: MayuraRunSummaryProps): ReactElement;
|
|
34
|
+
/** Accessible ordered representation of a validated durable DAG; it performs no layout or command. */
|
|
35
|
+
export declare function MayuraWorkflowGraph({ input, label: suppliedLabel }: MayuraWorkflowGraphProps): ReactElement;
|
|
36
|
+
/** Text-only request presentation. The optional callback is invoked only by the explicit button event. */
|
|
37
|
+
export declare function MayuraHumanRequestCard({ request, nowMs, label: suppliedLabel, onRespond }: MayuraHumanRequestCardProps): ReactElement;
|
|
38
|
+
export interface MayuraWorkflowPauseControlProps {
|
|
39
|
+
readonly workflow: WorkflowViewInput;
|
|
40
|
+
readonly commandState?: WorkflowCommandState;
|
|
41
|
+
readonly label?: string;
|
|
42
|
+
/** Distinguishes otherwise identical buttons for assistive technology, e.g. "run 7d2ddd96" gives "Pause workflow for run 7d2ddd96". */
|
|
43
|
+
readonly subject?: string;
|
|
44
|
+
readonly onPause?: (target: {
|
|
45
|
+
readonly runId: string;
|
|
46
|
+
readonly revision: number;
|
|
47
|
+
}) => void;
|
|
48
|
+
readonly onResume?: (target: {
|
|
49
|
+
readonly runId: string;
|
|
50
|
+
readonly revision: number;
|
|
51
|
+
}) => void;
|
|
52
|
+
}
|
|
53
|
+
/** Explicit per-run pause/resume intent. Mounting performs no request; the application routes each event to its command controller. */
|
|
54
|
+
export declare function MayuraWorkflowPauseControl({ workflow, commandState, label: suppliedLabel, subject, onPause, onResume }: MayuraWorkflowPauseControlProps): ReactElement;
|
|
55
|
+
export interface MayuraFleetHoldControlProps {
|
|
56
|
+
readonly fleet: {
|
|
57
|
+
readonly held: boolean;
|
|
58
|
+
readonly generation: number;
|
|
59
|
+
readonly changedAtMs: number | null;
|
|
60
|
+
};
|
|
61
|
+
readonly status?: 'idle' | 'submitting' | 'succeeded' | 'conflict' | 'failed';
|
|
62
|
+
readonly label?: string;
|
|
63
|
+
readonly onHold?: () => void;
|
|
64
|
+
readonly onRelease?: () => void;
|
|
65
|
+
}
|
|
66
|
+
/** Fleet hold/release intent with a two-step confirmation before holding every run in the scope. */
|
|
67
|
+
export declare function MayuraFleetHoldControl({ fleet, status, label: suppliedLabel, onHold, onRelease }: MayuraFleetHoldControlProps): ReactElement;
|
|
68
|
+
/** Schema-bound uncontrolled form. Validation and the application callback run only on an explicit submit event. */
|
|
69
|
+
export declare function MayuraHumanResponseForm({ request, definition, nowMs, label: suppliedLabel, submitText, commandState, onSubmit }: MayuraHumanResponseFormProps): ReactElement;
|
|
70
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2E,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACnH,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAyB,KAAK,yBAAyB,EAA2B,KAAK,2BAA2B,EACvH,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGxF,MAAM,WAAW,qBAAqB;IAAG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AACpG,MAAM,WAAW,wBAAwB;IAAG,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AACxG,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACtF,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC1F;AACD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAC/G,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzG,QAAQ,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,uBAAuB,KAAK,IAAI,CAAC;CAClE;AAOD,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,qBAAqB,GAAG,YAAY,CAUrG;AAED,sGAAsG;AACtG,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,wBAAwB,GAAG,YAAY,CAa3G;AAED,0GAA0G;AAC1G,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,2BAA2B,GAAG,YAAY,CASrI;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAC5G,uIAAuI;IACvI,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC7F;AACD,uIAAuI;AACvI,wBAAgB,0BAA0B,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,+BAA+B,GAAG,YAAY,CA2BtK;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC7G,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACvG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/D;AACD,oGAAoG;AACpG,wBAAgB,sBAAsB,CAAC,EAAE,KAAK,EAAE,MAAe,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,2BAA2B,GAAG,YAAY,CA0BrJ;AAgBD,oHAAoH;AACpH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,4BAA4B,GAAG,YAAY,CA8B5K"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { createElement, useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { ClientError } from '../../client/dist/index.js';
|
|
3
|
+
import { validateHumanResponse } from '../../client/dist/forms.js';
|
|
4
|
+
import { MayuraReactError, useMayuraHumanRequest, useMayuraRun, useMayuraRunActivity, useMayuraWorkflowGraph } from './index.js';
|
|
5
|
+
function label(value, fallback) {
|
|
6
|
+
const selected = value ?? fallback;
|
|
7
|
+
if (typeof selected !== 'string' || selected.length < 1 || selected.length > 128 || selected.includes('\0'))
|
|
8
|
+
throw new MayuraReactError('INVALID_COMPONENT_PROPS');
|
|
9
|
+
return selected;
|
|
10
|
+
}
|
|
11
|
+
/** Accessible run summary over one caller-owned store. Rendering starts no remote operation. */
|
|
12
|
+
export function MayuraRunSummary({ store, label: suppliedLabel }) {
|
|
13
|
+
const state = useMayuraRun(store);
|
|
14
|
+
const activity = useMayuraRunActivity(state);
|
|
15
|
+
const accessibleLabel = label(suppliedLabel, 'Run status');
|
|
16
|
+
const status = state.snapshot?.status ?? state.connection;
|
|
17
|
+
const items = activity.items.length === 0
|
|
18
|
+
? createElement('p', { 'data-mayura-empty': true }, 'No activity recorded')
|
|
19
|
+
: createElement('ol', { 'aria-label': 'Run activity' }, activity.items.map(item => createElement('li', {
|
|
20
|
+
key: item.id, 'data-kind': item.kind, 'data-status': item.status,
|
|
21
|
+
}, `${item.label}: ${item.status}`)));
|
|
22
|
+
return createElement('section', { 'aria-label': accessibleLabel, 'data-mayura-component': 'run-summary' }, createElement('p', { role: 'status', 'aria-live': 'polite' }, `Run ${status}`), items);
|
|
23
|
+
}
|
|
24
|
+
/** Accessible ordered representation of a validated durable DAG; it performs no layout or command. */
|
|
25
|
+
export function MayuraWorkflowGraph({ input, label: suppliedLabel }) {
|
|
26
|
+
const graph = useMayuraWorkflowGraph(input);
|
|
27
|
+
const accessibleLabel = label(suppliedLabel, 'Workflow progress');
|
|
28
|
+
const dependencies = new Map();
|
|
29
|
+
for (const edge of graph.edges) {
|
|
30
|
+
const list = dependencies.get(edge.to) ?? [];
|
|
31
|
+
list.push(edge.from);
|
|
32
|
+
dependencies.set(edge.to, list);
|
|
33
|
+
}
|
|
34
|
+
return createElement('section', { 'aria-label': accessibleLabel, 'data-mayura-component': 'workflow-graph' }, createElement('p', { role: 'status', 'aria-live': 'polite' }, `${graph.progress.terminal} of ${graph.progress.total} steps terminal`), createElement('ol', { 'aria-label': 'Workflow steps' }, graph.nodes.map(node => {
|
|
35
|
+
const parents = dependencies.get(node.id) ?? [];
|
|
36
|
+
return createElement('li', { key: node.id, 'data-kind': node.kind, 'data-status': node.status, 'data-depth': node.depth }, createElement('span', null, `${node.id}: ${node.status}`), parents.length > 0 ? createElement('span', null, `; depends on ${parents.join(', ')}`) : null, node.childRunId !== null ? createElement('span', null, '; required child attached') : null);
|
|
37
|
+
})));
|
|
38
|
+
}
|
|
39
|
+
/** Text-only request presentation. The optional callback is invoked only by the explicit button event. */
|
|
40
|
+
export function MayuraHumanRequestCard({ request, nowMs, label: suppliedLabel, onRespond }) {
|
|
41
|
+
const view = useMayuraHumanRequest(request, nowMs);
|
|
42
|
+
const accessibleLabel = label(suppliedLabel, 'Human request');
|
|
43
|
+
const respond = useCallback(() => { onRespond?.(Object.freeze({ id: request.id, digest: request.digest })); }, [onRespond, request.id, request.digest]);
|
|
44
|
+
const action = view.canRespond && onRespond !== undefined
|
|
45
|
+
? createElement('button', { type: 'button', onClick: respond }, view.actionText)
|
|
46
|
+
: null;
|
|
47
|
+
return createElement('article', { 'aria-label': accessibleLabel, 'data-mayura-component': 'human-request' }, createElement('p', { 'data-mayura-prompt': true }, view.prompt), createElement('p', { role: 'status', 'aria-live': 'polite' }, view.statusText), action);
|
|
48
|
+
}
|
|
49
|
+
/** Explicit per-run pause/resume intent. Mounting performs no request; the application routes each event to its command controller. */
|
|
50
|
+
export function MayuraWorkflowPauseControl({ workflow, commandState, label: suppliedLabel, subject, onPause, onResume }) {
|
|
51
|
+
const accessibleLabel = label(suppliedLabel, 'Workflow pause control');
|
|
52
|
+
const subjectText = subject === undefined ? undefined : label(subject, 'workflow');
|
|
53
|
+
if (commandState !== undefined && (!Object.isFrozen(commandState) || commandState.runId !== workflow.runId))
|
|
54
|
+
throw new MayuraReactError('INVALID_COMPONENT_PROPS');
|
|
55
|
+
// Feedback describes one revision; once the view has moved on (another operator, a fleet sweep) it is stale and hidden.
|
|
56
|
+
const current = commandState !== undefined && (commandState.status === 'submitting' || commandState.workflowRevision === workflow.revision);
|
|
57
|
+
const status = current ? commandState.status : 'idle';
|
|
58
|
+
const busy = status === 'submitting' || status === 'disposed';
|
|
59
|
+
const pausable = ['running', 'waiting'].includes(workflow.status) && onPause !== undefined;
|
|
60
|
+
const resumable = workflow.status === 'paused' && onResume !== undefined;
|
|
61
|
+
const target = Object.freeze({ runId: workflow.runId, revision: workflow.revision });
|
|
62
|
+
const act = useCallback(() => {
|
|
63
|
+
// aria-disabled keeps focus on the control while a command is in flight; the handler itself enforces the lock.
|
|
64
|
+
if (busy)
|
|
65
|
+
return;
|
|
66
|
+
if (pausable)
|
|
67
|
+
onPause(target);
|
|
68
|
+
else if (resumable)
|
|
69
|
+
onResume(target);
|
|
70
|
+
}, [busy, pausable, resumable, onPause, onResume, target.runId, target.revision]);
|
|
71
|
+
const action = current ? commandState.action : null;
|
|
72
|
+
const feedback = status === 'submitting' ? (action === 'pause' ? 'Pausing workflow' : action === 'resume' ? 'Resuming workflow' : 'Command in progress')
|
|
73
|
+
: status === 'succeeded' ? (action === 'pause' ? 'Pause applied' : action === 'resume' ? 'Resume requested' : 'Command applied')
|
|
74
|
+
: status === 'conflict' ? 'Workflow changed or has an effect in flight; refresh before retrying'
|
|
75
|
+
: status === 'failed' ? 'Command outcome unknown; refresh before retrying'
|
|
76
|
+
: status === 'disposed' ? 'Command controller closed' : null;
|
|
77
|
+
return createElement('section', { 'aria-label': accessibleLabel, 'data-mayura-component': 'workflow-pause-control', 'aria-busy': status === 'submitting' }, createElement('p', { role: 'status', 'aria-live': 'polite', 'data-workflow-status': workflow.status, 'data-command-status': status }, feedback === null ? `Workflow ${workflow.status}` : `Workflow ${workflow.status}. ${feedback}`), pausable || resumable ? createElement('button', { key: 'action', type: 'button', onClick: act, 'aria-disabled': busy,
|
|
78
|
+
'data-action': pausable ? 'pause' : 'resume',
|
|
79
|
+
...(subjectText === undefined ? {} : { 'aria-label': `${pausable ? 'Pause workflow' : 'Resume workflow'} for ${subjectText}` }) }, pausable ? 'Pause workflow' : 'Resume workflow') : null);
|
|
80
|
+
}
|
|
81
|
+
/** Fleet hold/release intent with a two-step confirmation before holding every run in the scope. */
|
|
82
|
+
export function MayuraFleetHoldControl({ fleet, status = 'idle', label: suppliedLabel, onHold, onRelease }) {
|
|
83
|
+
const accessibleLabel = label(suppliedLabel, 'Fleet hold control');
|
|
84
|
+
const [confirming, setConfirming] = useState(false);
|
|
85
|
+
const primary = useRef(null);
|
|
86
|
+
const wasConfirming = useRef(false);
|
|
87
|
+
// Return focus to the primary action when the confirmation closes, so keyboard users are not dropped to the page body.
|
|
88
|
+
useEffect(() => { if (wasConfirming.current && !confirming)
|
|
89
|
+
primary.current?.focus(); wasConfirming.current = confirming; }, [confirming]);
|
|
90
|
+
if (!fleet || typeof fleet.held !== 'boolean' || !Number.isSafeInteger(fleet.generation) || fleet.generation < 0
|
|
91
|
+
|| !['idle', 'submitting', 'succeeded', 'conflict', 'failed'].includes(status))
|
|
92
|
+
throw new MayuraReactError('INVALID_COMPONENT_PROPS');
|
|
93
|
+
const busy = status === 'submitting';
|
|
94
|
+
const request = useCallback(() => { if (!busy)
|
|
95
|
+
setConfirming(true); }, [busy]);
|
|
96
|
+
const cancel = useCallback(() => { setConfirming(false); }, []);
|
|
97
|
+
const confirm = useCallback(() => { if (busy)
|
|
98
|
+
return; setConfirming(false); onHold?.(); }, [busy, onHold]);
|
|
99
|
+
const release = useCallback(() => { if (!busy)
|
|
100
|
+
onRelease?.(); }, [busy, onRelease]);
|
|
101
|
+
const summary = fleet.held ? `Fleet held (generation ${fleet.generation}); hosts and coordinators drive no runs` : 'Fleet running';
|
|
102
|
+
const feedback = status === 'submitting' ? 'Updating fleet hold' : status === 'conflict' ? 'Fleet state changed; refresh before retrying'
|
|
103
|
+
: status === 'failed' ? 'Fleet command outcome unknown; refresh before retrying' : null;
|
|
104
|
+
const actions = fleet.held
|
|
105
|
+
? (onRelease === undefined ? null : createElement('button', { key: 'primary', ref: primary, type: 'button', onClick: release, 'aria-disabled': busy }, 'Release fleet hold'))
|
|
106
|
+
: onHold === undefined ? null : confirming
|
|
107
|
+
? createElement('div', { key: 'confirm', role: 'group', 'aria-label': 'Confirm fleet hold' }, createElement('p', { id: 'mayura-fleet-hold-warning' }, 'Holding stops every host and coordinator in this scope from driving runs.'), createElement('button', { type: 'button', onClick: confirm, 'aria-disabled': busy, 'aria-describedby': 'mayura-fleet-hold-warning', autoFocus: true }, 'Confirm hold'), createElement('button', { type: 'button', onClick: cancel }, 'Cancel'))
|
|
108
|
+
: createElement('button', { key: 'primary', ref: primary, type: 'button', onClick: request, 'aria-disabled': busy }, 'Hold fleet');
|
|
109
|
+
return createElement('section', { 'aria-label': accessibleLabel, 'data-mayura-component': 'fleet-hold-control', 'aria-busy': busy }, createElement('p', { role: 'status', 'aria-live': 'polite', 'data-fleet-held': fleet.held, 'data-command-status': status }, feedback === null ? summary : `${summary}. ${feedback}`), actions);
|
|
110
|
+
}
|
|
111
|
+
function fieldControl(field) {
|
|
112
|
+
const common = { name: field.name, required: field.required, 'aria-label': field.label };
|
|
113
|
+
if (field.kind === 'textarea')
|
|
114
|
+
return createElement('textarea', { ...common, minLength: field.minLength, maxLength: field.maxLength });
|
|
115
|
+
if (field.kind === 'text')
|
|
116
|
+
return createElement('input', { ...common, type: 'text', minLength: field.minLength, maxLength: field.maxLength });
|
|
117
|
+
if (field.kind === 'number' || field.kind === 'integer')
|
|
118
|
+
return createElement('input', {
|
|
119
|
+
...common, type: 'number', min: field.minimum, max: field.maximum, step: field.kind === 'integer' ? 1 : 'any',
|
|
120
|
+
});
|
|
121
|
+
if (field.kind === 'boolean')
|
|
122
|
+
return createElement('input', { ...common, type: 'checkbox' });
|
|
123
|
+
if (field.kind !== 'select')
|
|
124
|
+
throw new MayuraReactError('INVALID_COMPONENT_PROPS');
|
|
125
|
+
return createElement('select', common, createElement('option', { value: '' }, 'Select an option'), field.options.map(option => createElement('option', { key: option.value, value: option.value }, option.label)));
|
|
126
|
+
}
|
|
127
|
+
/** Schema-bound uncontrolled form. Validation and the application callback run only on an explicit submit event. */
|
|
128
|
+
export function MayuraHumanResponseForm({ request, definition, nowMs, label: suppliedLabel, submitText, commandState, onSubmit }) {
|
|
129
|
+
const view = useMayuraHumanRequest(request, nowMs);
|
|
130
|
+
const accessibleLabel = label(suppliedLabel, 'Human response');
|
|
131
|
+
const actionText = label(submitText, 'Submit response');
|
|
132
|
+
const [errorCode, setErrorCode] = useState(null);
|
|
133
|
+
if (commandState !== undefined && (!Object.isFrozen(commandState) || commandState.requestId !== request.id || commandState.requestDigest !== request.digest))
|
|
134
|
+
throw new MayuraReactError('INVALID_COMPONENT_PROPS');
|
|
135
|
+
const commandStatus = commandState?.status ?? 'idle';
|
|
136
|
+
const locked = ['submitting', 'succeeded', 'conflict', 'disposed'].includes(commandStatus);
|
|
137
|
+
const submit = useCallback((event) => {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
if (!view.canRespond || locked) {
|
|
140
|
+
setErrorCode('INVALID_FORM_VALUE');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const data = new FormData(event.currentTarget);
|
|
144
|
+
const draft = Object.create(null);
|
|
145
|
+
for (const field of definition.fields) {
|
|
146
|
+
if (field.kind === 'boolean') {
|
|
147
|
+
draft[field.name] = data.has(field.name);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const value = data.get(field.name);
|
|
151
|
+
if (typeof value === 'string')
|
|
152
|
+
draft[field.name] = value;
|
|
153
|
+
}
|
|
154
|
+
let submission;
|
|
155
|
+
try {
|
|
156
|
+
submission = validateHumanResponse(request, definition, Object.freeze(draft));
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
if (error instanceof ClientError) {
|
|
160
|
+
setErrorCode(error.code);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
setErrorCode(null);
|
|
166
|
+
onSubmit(submission);
|
|
167
|
+
}, [definition, locked, onSubmit, request, view.canRespond]);
|
|
168
|
+
const feedback = commandStatus === 'submitting' ? 'Submitting response' : commandStatus === 'succeeded' ? 'Response submitted'
|
|
169
|
+
: commandStatus === 'conflict' ? 'Request changed; refresh required' : commandStatus === 'failed' ? 'Response submission failed'
|
|
170
|
+
: commandStatus === 'disposed' ? 'Response controller disposed' : null;
|
|
171
|
+
return createElement('form', { 'aria-label': accessibleLabel, 'data-mayura-component': 'human-response-form', onSubmit: submit }, createElement('p', { 'data-mayura-prompt': true }, view.prompt), createElement('fieldset', { disabled: !view.canRespond || locked }, createElement('legend', null, accessibleLabel), definition.fields.map(field => createElement('label', { key: field.name }, field.label, fieldControl(field))), view.canRespond && !locked ? createElement('button', { type: 'submit' }, actionText) : null), feedback === null ? null : createElement('p', { role: 'status', 'aria-live': 'polite', 'data-command-status': commandStatus }, feedback), errorCode === null ? null : createElement('p', { role: 'alert', 'data-error-code': errorCode }, 'Response values are invalid'));
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=components.js.map
|