mayura 1.2.0 → 1.2.2
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/README.md +2 -0
- package/docs/README.md +17 -4
- package/docs/cli/init.md +15 -3
- package/docs/concepts/workflows.md +60 -1
- package/docs/guides/choosing-a-starter.md +80 -0
- package/docs/guides/durable-workflows.md +1 -1
- package/docs/guides/framework-starters.md +5 -1
- package/docs/guides/hono.md +94 -0
- package/docs/guides/nextjs.md +94 -0
- package/docs/guides/nuxt.md +94 -0
- package/docs/guides/rag-deployment.md +48 -0
- package/docs/guides/rag-modal-pinecone-starter.md +63 -0
- package/docs/guides/rag-production.md +48 -0
- package/docs/guides/rag-quickstart.md +119 -0
- package/docs/guides/rag.md +23 -3
- package/docs/guides/react-router.md +94 -0
- package/docs/guides/release-readiness.md +78 -55
- package/docs/guides/sveltekit.md +94 -0
- package/docs/guides/tanstack-start.md +94 -0
- package/docs/guides/workflow-composition.md +1 -1
- package/docs/integrations/reranker-cohere.md +1 -0
- package/docs/integrations/reranker-jina.md +1 -0
- package/docs/integrations/reranker-voyage.md +1 -0
- package/docs/integrations/vector-chroma.md +1 -0
- package/docs/integrations/vector-libsql.md +1 -0
- package/docs/integrations/vector-pgvector.md +1 -0
- package/docs/integrations/vector-pinecone.md +4 -1
- package/docs/integrations/vector-qdrant.md +1 -0
- package/docs/integrations/vector-weaviate.md +1 -0
- package/docs/introduction.md +5 -0
- package/docs/project/whats-new.md +70 -2
- package/docs/quickstart.md +5 -3
- package/lib/adapter-code-docker/image/Dockerfile +1 -1
- package/lib/adapter-code-docker/package.json +1 -1
- package/lib/adapter-code-quickjs/package.json +1 -1
- package/lib/adapter-mcp/package.json +1 -1
- package/lib/ag-ui/package.json +1 -1
- package/lib/artifacts/package.json +1 -1
- package/lib/auth/package.json +1 -1
- package/lib/authz/package.json +1 -1
- package/lib/browser/package.json +1 -1
- package/lib/cli/dist/index.d.ts +1 -1
- package/lib/cli/dist/index.d.ts.map +1 -1
- package/lib/cli/dist/index.js +63 -20
- package/lib/cli/dist/index.js.map +1 -1
- package/lib/cli/dist/interactive.js +2 -2
- package/lib/cli/dist/interactive.js.map +1 -1
- package/lib/cli/dist/operations.d.ts +1 -0
- package/lib/cli/dist/operations.d.ts.map +1 -1
- package/lib/cli/dist/operations.js +13 -5
- package/lib/cli/dist/operations.js.map +1 -1
- package/lib/cli/package.json +1 -1
- package/lib/cli/src/index.ts +51 -12
- package/lib/cli/src/interactive.ts +2 -2
- package/lib/cli/src/operations.ts +9 -5
- package/lib/cli/starter-assets/manifest.json +1 -0
- package/lib/cli/starters/hono/package.json +2 -2
- package/lib/cli/starters/rag-modal-pinecone/README.md +60 -0
- package/lib/cli/starters/rag-modal-pinecone/dot-env.example +23 -0
- package/lib/cli/starters/{event-automation → rag-modal-pinecone}/dot-gitignore +2 -4
- package/lib/cli/starters/rag-modal-pinecone/fixtures/on-call.md +4 -0
- package/lib/cli/starters/rag-modal-pinecone/mayura.project.json +13 -0
- package/lib/cli/starters/rag-modal-pinecone/modal-app.py +110 -0
- package/lib/cli/starters/rag-modal-pinecone/package.json +28 -0
- package/lib/cli/starters/rag-modal-pinecone/src/application.ts +148 -0
- package/lib/cli/starters/rag-modal-pinecone/src/cli.ts +78 -0
- package/lib/cli/starters/rag-modal-pinecone/src/hosted.ts +137 -0
- package/lib/cli/starters/rag-modal-pinecone/test/modal_worker_test.py +53 -0
- package/lib/cli/starters/rag-modal-pinecone/test/pipeline.test.ts +137 -0
- package/lib/cli/starters/{cli-agent → rag-modal-pinecone}/tsconfig.json +0 -1
- package/lib/client/dist/index.d.ts.map +1 -1
- package/lib/client/dist/index.js +12 -4
- package/lib/client/dist/index.js.map +1 -1
- package/lib/client/dist/workflow-limits.d.ts +6 -0
- package/lib/client/dist/workflow-limits.d.ts.map +1 -0
- package/lib/client/dist/workflow-limits.js +15 -0
- package/lib/client/dist/workflow-limits.js.map +1 -0
- package/lib/client/dist/workflows.d.ts +3 -0
- package/lib/client/dist/workflows.d.ts.map +1 -1
- package/lib/client/dist/workflows.js +15 -7
- package/lib/client/dist/workflows.js.map +1 -1
- package/lib/client/package.json +1 -1
- package/lib/client/src/index.ts +7 -4
- package/lib/client/src/workflow-limits.ts +12 -0
- package/lib/client/src/workflows.ts +12 -6
- package/lib/client-react/package.json +1 -1
- package/lib/code-mode/package.json +1 -1
- package/lib/code-mode-workflows/package.json +1 -1
- package/lib/context/package.json +1 -1
- package/lib/core/dist/host.d.ts +1 -0
- package/lib/core/dist/host.d.ts.map +1 -1
- package/lib/core/dist/host.js +1 -0
- package/lib/core/dist/host.js.map +1 -1
- package/lib/core/dist/index.d.ts +1 -0
- package/lib/core/dist/index.d.ts.map +1 -1
- package/lib/core/dist/index.js +1 -0
- package/lib/core/dist/index.js.map +1 -1
- package/lib/core/dist/workflow-environment.d.ts +9 -0
- package/lib/core/dist/workflow-environment.d.ts.map +1 -0
- package/lib/core/dist/workflow-environment.js +15 -0
- package/lib/core/dist/workflow-environment.js.map +1 -0
- package/lib/core/dist/workflow-limits.d.ts +7 -0
- package/lib/core/dist/workflow-limits.d.ts.map +1 -0
- package/lib/core/dist/workflow-limits.js +17 -0
- package/lib/core/dist/workflow-limits.js.map +1 -0
- package/lib/core/package.json +1 -1
- package/lib/core/src/host.ts +1 -0
- package/lib/core/src/index.ts +1 -0
- package/lib/core/src/workflow-environment.ts +15 -0
- package/lib/core/src/workflow-limits.ts +16 -0
- package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
- package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
- package/lib/exporter-otlp/dist/signals.js +2 -2
- package/lib/exporter-otlp/dist/signals.js.map +1 -1
- package/lib/exporter-otlp/package.json +1 -1
- package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
- package/lib/exporter-otlp/src/signals.ts +2 -2
- package/lib/files/package.json +1 -1
- package/lib/guardrails/package.json +1 -1
- package/lib/helpers/package.json +1 -1
- package/lib/keys/package.json +1 -1
- package/lib/memory/package.json +1 -1
- package/lib/memory-remote/package.json +1 -1
- package/lib/observability/package.json +1 -1
- package/lib/provider-anthropic/package.json +1 -1
- package/lib/provider-openai/package.json +1 -1
- package/lib/rag/dist/bm25.d.ts +13 -0
- package/lib/rag/dist/bm25.d.ts.map +1 -0
- package/lib/rag/dist/bm25.js +76 -0
- package/lib/rag/dist/bm25.js.map +1 -0
- package/lib/rag/dist/document-lexical.d.ts +7 -0
- package/lib/rag/dist/document-lexical.d.ts.map +1 -0
- package/lib/rag/dist/document-lexical.js +33 -0
- package/lib/rag/dist/document-lexical.js.map +1 -0
- package/lib/rag/dist/evidence-window.d.ts +15 -0
- package/lib/rag/dist/evidence-window.d.ts.map +1 -0
- package/lib/rag/dist/evidence-window.js +52 -0
- package/lib/rag/dist/evidence-window.js.map +1 -0
- package/lib/rag/dist/retrieval.d.ts +6 -0
- package/lib/rag/dist/retrieval.d.ts.map +1 -1
- package/lib/rag/dist/retrieval.js +60 -6
- package/lib/rag/dist/retrieval.js.map +1 -1
- package/lib/rag/dist/vectors.d.ts +8 -0
- package/lib/rag/dist/vectors.d.ts.map +1 -1
- package/lib/rag/dist/vectors.js +121 -4
- package/lib/rag/dist/vectors.js.map +1 -1
- package/lib/rag/package.json +1 -1
- package/lib/rag/src/bm25.ts +35 -0
- package/lib/rag/src/document-lexical.ts +17 -0
- package/lib/rag/src/evidence-window.ts +41 -0
- package/lib/rag/src/retrieval.ts +56 -7
- package/lib/rag/src/vectors.ts +62 -4
- package/lib/runtime/package.json +1 -1
- package/lib/sandbox/package.json +1 -1
- package/lib/sdk/package.json +1 -1
- package/lib/server/dist/index.d.ts +2 -0
- package/lib/server/dist/index.d.ts.map +1 -1
- package/lib/server/dist/index.js +12 -4
- package/lib/server/dist/index.js.map +1 -1
- package/lib/server/dist/inspector-bundle.d.ts +1 -1
- package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
- package/lib/server/dist/inspector-bundle.js +4 -4
- package/lib/server/dist/inspector-bundle.js.map +1 -1
- package/lib/server/package.json +1 -1
- package/lib/server/src/index.ts +9 -4
- package/lib/server/src/inspector-bundle.ts +4 -4
- package/lib/server-node/package.json +1 -1
- package/lib/skills/package.json +1 -1
- package/lib/storage/package.json +1 -1
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +2 -0
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -1
- package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format2.d.ts +2 -0
- package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format2.js +8 -7
- package/lib/storage-contracts/dist/workflow-format2.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format3.js +9 -7
- package/lib/storage-contracts/dist/workflow-format3.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format4.d.ts +2 -0
- package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format4.js +9 -8
- package/lib/storage-contracts/dist/workflow-format4.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.d.ts +4 -0
- package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-format5.js +9 -8
- package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +2 -0
- package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -1
- package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +2 -0
- package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -1
- package/lib/storage-contracts/dist/workflow-tree-contracts.js +5 -3
- package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -1
- package/lib/storage-contracts/package.json +1 -1
- package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +2 -0
- package/lib/storage-contracts/src/workflow-format2.ts +10 -7
- package/lib/storage-contracts/src/workflow-format3.ts +9 -7
- package/lib/storage-contracts/src/workflow-format4.ts +11 -8
- package/lib/storage-contracts/src/workflow-format5.ts +13 -8
- package/lib/storage-contracts/src/workflow-graph-contracts.ts +2 -0
- package/lib/storage-contracts/src/workflow-tree-contracts.ts +7 -3
- package/lib/storage-postgres/package.json +1 -1
- package/lib/storage-sql/dist/scheduled-database.js +1 -1
- package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
- package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -1
- package/lib/storage-sql/dist/workflow-tree-database.js +37 -1
- package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -1
- package/lib/storage-sql/package.json +1 -1
- package/lib/storage-sql/src/scheduled-database.ts +1 -1
- package/lib/storage-sql/src/workflow-tree-database.ts +15 -1
- package/lib/storage-sqlite/package.json +1 -1
- package/lib/terminal/package.json +1 -1
- package/lib/testing/package.json +1 -1
- package/lib/threads/package.json +1 -1
- package/lib/tools/package.json +1 -1
- package/lib/voice/package.json +1 -1
- package/lib/workflows/dist/children-definition.d.ts +5 -1
- package/lib/workflows/dist/children-definition.d.ts.map +1 -1
- package/lib/workflows/dist/children-definition.js +6 -2
- package/lib/workflows/dist/children-definition.js.map +1 -1
- package/lib/workflows/dist/children-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/children-runtime.js +4 -3
- package/lib/workflows/dist/children-runtime.js.map +1 -1
- package/lib/workflows/dist/definition.d.ts +4 -0
- package/lib/workflows/dist/definition.d.ts.map +1 -1
- package/lib/workflows/dist/definition.js +6 -3
- package/lib/workflows/dist/definition.js.map +1 -1
- package/lib/workflows/dist/graph-definition.d.ts +5 -1
- package/lib/workflows/dist/graph-definition.d.ts.map +1 -1
- package/lib/workflows/dist/graph-definition.js +8 -4
- package/lib/workflows/dist/graph-definition.js.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.d.ts +5 -1
- package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-definition.js +5 -2
- package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
- package/lib/workflows/dist/lifecycle-runtime.js +4 -5
- package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
- package/lib/workflows/dist/node-batches.d.ts +9 -0
- package/lib/workflows/dist/node-batches.d.ts.map +1 -0
- package/lib/workflows/dist/node-batches.js +19 -0
- package/lib/workflows/dist/node-batches.js.map +1 -0
- package/lib/workflows/dist/operator-transports.d.ts +1 -0
- package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
- package/lib/workflows/dist/operator-transports.js +1 -0
- package/lib/workflows/dist/operator-transports.js.map +1 -1
- package/lib/workflows/dist/runtime.d.ts.map +1 -1
- package/lib/workflows/dist/runtime.js +6 -7
- package/lib/workflows/dist/runtime.js.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
- package/lib/workflows/dist/scheduled-helpers.js +3 -2
- package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
- package/lib/workflows/dist/scheduled.d.ts.map +1 -1
- package/lib/workflows/dist/scheduled.js +2 -1
- package/lib/workflows/dist/scheduled.js.map +1 -1
- package/lib/workflows/package.json +1 -1
- package/lib/workflows/src/children-definition.ts +10 -3
- package/lib/workflows/src/children-runtime.ts +3 -2
- package/lib/workflows/src/definition.ts +9 -2
- package/lib/workflows/src/graph-definition.ts +10 -3
- package/lib/workflows/src/lifecycle-definition.ts +10 -3
- package/lib/workflows/src/lifecycle-runtime.ts +4 -4
- package/lib/workflows/src/node-batches.ts +21 -0
- package/lib/workflows/src/operator-transports.ts +3 -1
- package/lib/workflows/src/runtime.ts +6 -6
- package/lib/workflows/src/scheduled-helpers.ts +3 -2
- package/lib/workflows/src/scheduled.ts +2 -1
- package/lib/workstream/package.json +1 -1
- package/llms-full.txt +1442 -281
- package/llms.txt +17 -3
- package/package.json +4 -4
- package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +0 -13
- package/lib/cli/starters/cli-agent/dot-gitignore +0 -10
- package/lib/cli/starters/event-automation/dot-dockerignore +0 -7
- package/lib/cli/starters/event-automation/dot-github/workflows/ci.yml +0 -13
- package/lib/cli/starters/event-automation/src/model.ts +0 -40
- package/lib/cli/starters/event-automation/tsconfig.json +0 -20
- package/lib/cli/starters/nextjs/Dockerfile +0 -12
- package/lib/cli/starters/nextjs/compose.yaml +0 -19
- package/lib/cli/starters/nextjs/dot-dockerignore +0 -11
- package/lib/cli/starters/nextjs/dot-env.example +0 -7
- package/lib/cli/starters/nextjs/scripts/setup.mjs +0 -9
- package/lib/cli/starters/nextjs/server/application.mjs +0 -74
- package/lib/cli/starters/nextjs/server/auth.mjs +0 -24
- package/lib/cli/starters/nextjs/server/worker.mjs +0 -11
- package/lib/cli/starters/nextjs/server/workflows.mjs +0 -23
- package/lib/cli/starters/nextjs/src/ChatApp.jsx +0 -57
- package/lib/cli/starters/nextjs/src/Notebook.jsx +0 -25
- package/lib/cli/starters/nextjs/src/components/mayura/approval.tsx +0 -142
- package/lib/cli/starters/nextjs/src/components/mayura/thread-history.tsx +0 -142
- package/lib/cli/starters/nextjs/src/components/mayura/thread-list.tsx +0 -9
- package/lib/cli/starters/nextjs/src/components/mayura/ui.css +0 -14
- package/lib/cli/starters/nextjs/src/connect.js +0 -21
- package/lib/cli/starters/nextjs/src/session.js +0 -138
- package/lib/cli/starters/nextjs/src/style.css +0 -11
- package/lib/cli/starters/nextjs/test/server.test.mjs +0 -95
- package/lib/cli/starters/nextjs/test/session.test.mjs +0 -16
- package/lib/cli/starters/nuxt/compose.yaml +0 -19
- package/lib/cli/starters/nuxt/dot-dockerignore +0 -11
- package/lib/cli/starters/nuxt/dot-env.example +0 -7
- package/lib/cli/starters/nuxt/dot-gitignore +0 -14
- package/lib/cli/starters/nuxt/scripts/setup.mjs +0 -9
- package/lib/cli/starters/nuxt/server/application.mjs +0 -74
- package/lib/cli/starters/nuxt/server/auth.mjs +0 -24
- package/lib/cli/starters/nuxt/server/worker.mjs +0 -11
- package/lib/cli/starters/nuxt/server/workflows.mjs +0 -23
- package/lib/cli/starters/nuxt/src/connect.js +0 -21
- package/lib/cli/starters/nuxt/src/session.js +0 -138
- package/lib/cli/starters/nuxt/src/style.css +0 -11
- package/lib/cli/starters/nuxt/test/server.test.mjs +0 -95
- package/lib/cli/starters/nuxt/test/session.test.mjs +0 -16
- package/lib/cli/starters/react-router/Dockerfile +0 -12
- package/lib/cli/starters/react-router/compose.yaml +0 -19
- package/lib/cli/starters/react-router/dot-dockerignore +0 -11
- package/lib/cli/starters/react-router/dot-env.example +0 -7
- package/lib/cli/starters/react-router/dot-gitignore +0 -14
- package/lib/cli/starters/react-router/scripts/setup.mjs +0 -9
- package/lib/cli/starters/react-router/server/application.mjs +0 -74
- package/lib/cli/starters/react-router/server/auth.mjs +0 -24
- package/lib/cli/starters/react-router/server/worker.mjs +0 -11
- package/lib/cli/starters/react-router/server/workflows.mjs +0 -23
- package/lib/cli/starters/react-router/src/ChatApp.jsx +0 -57
- package/lib/cli/starters/react-router/src/Notebook.jsx +0 -25
- package/lib/cli/starters/react-router/src/components/mayura/approval.tsx +0 -142
- package/lib/cli/starters/react-router/src/components/mayura/thread-history.tsx +0 -142
- package/lib/cli/starters/react-router/src/components/mayura/thread-list.tsx +0 -9
- package/lib/cli/starters/react-router/src/components/mayura/ui.css +0 -14
- package/lib/cli/starters/react-router/src/connect.js +0 -21
- package/lib/cli/starters/react-router/src/session.js +0 -138
- package/lib/cli/starters/react-router/src/style.css +0 -11
- package/lib/cli/starters/react-router/src/vite-env.d.ts +0 -1
- package/lib/cli/starters/react-router/test/server.test.mjs +0 -95
- package/lib/cli/starters/react-router/test/session.test.mjs +0 -16
- package/lib/cli/starters/research-team/dot-dockerignore +0 -7
- package/lib/cli/starters/research-team/dot-github/workflows/ci.yml +0 -13
- package/lib/cli/starters/research-team/dot-gitignore +0 -10
- package/lib/cli/starters/research-team/src/model.ts +0 -40
- package/lib/cli/starters/research-team/tsconfig.json +0 -20
- package/lib/cli/starters/support-agent/dot-dockerignore +0 -7
- package/lib/cli/starters/support-agent/dot-github/workflows/ci.yml +0 -13
- package/lib/cli/starters/support-agent/dot-gitignore +0 -10
- package/lib/cli/starters/support-agent/src/model.ts +0 -40
- package/lib/cli/starters/support-agent/tsconfig.json +0 -20
- package/lib/cli/starters/sveltekit/Dockerfile +0 -12
- package/lib/cli/starters/sveltekit/compose.yaml +0 -19
- package/lib/cli/starters/sveltekit/dot-dockerignore +0 -11
- package/lib/cli/starters/sveltekit/dot-env.example +0 -7
- package/lib/cli/starters/sveltekit/dot-gitignore +0 -14
- package/lib/cli/starters/sveltekit/scripts/setup.mjs +0 -9
- package/lib/cli/starters/sveltekit/server/application.mjs +0 -74
- package/lib/cli/starters/sveltekit/server/auth.mjs +0 -24
- package/lib/cli/starters/sveltekit/server/worker.mjs +0 -11
- package/lib/cli/starters/sveltekit/server/workflows.mjs +0 -23
- package/lib/cli/starters/sveltekit/src/connect.js +0 -21
- package/lib/cli/starters/sveltekit/src/session.js +0 -138
- package/lib/cli/starters/sveltekit/src/style.css +0 -11
- package/lib/cli/starters/sveltekit/src/view.js +0 -49
- package/lib/cli/starters/sveltekit/test/server.test.mjs +0 -95
- package/lib/cli/starters/sveltekit/test/session.test.mjs +0 -16
- package/lib/cli/starters/tanstack-start/Dockerfile +0 -12
- package/lib/cli/starters/tanstack-start/compose.yaml +0 -19
- package/lib/cli/starters/tanstack-start/dot-dockerignore +0 -11
- package/lib/cli/starters/tanstack-start/dot-env.example +0 -7
- package/lib/cli/starters/tanstack-start/dot-gitignore +0 -14
- package/lib/cli/starters/tanstack-start/scripts/setup.mjs +0 -9
- package/lib/cli/starters/tanstack-start/server/application.mjs +0 -74
- package/lib/cli/starters/tanstack-start/server/auth.mjs +0 -24
- package/lib/cli/starters/tanstack-start/server/worker.mjs +0 -11
- package/lib/cli/starters/tanstack-start/server/workflows.mjs +0 -23
- package/lib/cli/starters/tanstack-start/src/ChatApp.jsx +0 -57
- package/lib/cli/starters/tanstack-start/src/Notebook.jsx +0 -25
- package/lib/cli/starters/tanstack-start/src/components/mayura/approval.tsx +0 -142
- package/lib/cli/starters/tanstack-start/src/components/mayura/thread-history.tsx +0 -142
- package/lib/cli/starters/tanstack-start/src/components/mayura/thread-list.tsx +0 -9
- package/lib/cli/starters/tanstack-start/src/components/mayura/ui.css +0 -14
- package/lib/cli/starters/tanstack-start/src/connect.js +0 -21
- package/lib/cli/starters/tanstack-start/src/session.js +0 -138
- package/lib/cli/starters/tanstack-start/src/style.css +0 -11
- package/lib/cli/starters/tanstack-start/test/server.test.mjs +0 -95
- package/lib/cli/starters/tanstack-start/test/session.test.mjs +0 -16
- /package/lib/cli/{starters/hono/src/components/mayura/ui.css → starter-assets/011cacc77ada0de5b447674e9fc4374a247b9a46eb169722b12649753f24188f} +0 -0
- /package/lib/cli/{starters/hono/test/server.test.mjs → starter-assets/0c825d6a776673ec6274cfc29cd45b1a8c56dcb880c291a91075c77e1ef1e4f3} +0 -0
- /package/lib/cli/{starters/hono/server/auth.mjs → starter-assets/0dd570bfacc357d23be3340250090b9a4c6193a49cdd02e9b6789e7bee8433dd} +0 -0
- /package/lib/cli/{starters/hono/src/components/mayura/approval.tsx → starter-assets/11292bd14cdaf27a8f8317ba4ab768d706a726b2e26474b599f3db116674b4b3} +0 -0
- /package/lib/cli/{starters/nextjs/dot-gitignore → starter-assets/1873b02e070347f9a449e07084242982fa6af412c45aa764985d553975b64589} +0 -0
- /package/lib/cli/{starters/hono/src/style.css → starter-assets/2f3869e6d69134e43be713c4590bfe48896a5c54ece6ffc1a4f204cfcfe54218} +0 -0
- /package/lib/cli/{starters/hono/server/worker.mjs → starter-assets/350d77757f548369beff29d658cf1620752d4e23b4b732d99a1b403ca043137f} +0 -0
- /package/lib/cli/{starters/approval-workflow/src/model.ts → starter-assets/37294d24c04b71eaf6d6f0bd52fd4c1cc7a5d3cb63da9c7920ed1d44276da9cb} +0 -0
- /package/lib/cli/{starters/approval-workflow/tsconfig.json → starter-assets/4387d6537dd5924ae62326aa3d7d8cbad1e5abd930aecc9daa6fab1ac2f6ef24} +0 -0
- /package/lib/cli/{starters/hono/dot-dockerignore → starter-assets/4434be031b58cc6ee680b2860b2ad1fe4089af7ee866c13223dfb621dd042ff1} +0 -0
- /package/lib/cli/{starters/hono/src/ChatApp.jsx → starter-assets/46e199317648a076243d6c8e7ffedc48785a6ffc0f203b88c7c4a9479b34c5b9} +0 -0
- /package/lib/cli/{starters/hono/src/components/mayura/thread-history.tsx → starter-assets/4741fccbca2e0d2fc6f61d11af3cf7bcc5f0238b67bb46282287207abdc6c536} +0 -0
- /package/lib/cli/{starters/approval-workflow/dot-dockerignore → starter-assets/4be664708b0120da5d2b73c5a27968093da06b8728f88f2bda2a1ccbf40f6891} +0 -0
- /package/lib/cli/{starters/hono/server/workflows.mjs → starter-assets/4d11f729672df54969a851494877a3c5aee24bb8f8c68eacaaa22e715bf5ed69} +0 -0
- /package/lib/cli/{starters/hono/dot-env.example → starter-assets/4f141323062660c4dc5b563300d57bb4cdbdc7fe9bfba96e43d9c64bb274474e} +0 -0
- /package/lib/cli/{starters/hono/Dockerfile → starter-assets/5471b74c46258d1edb00eb8f60f4219c389a252f7e224f2692f8f3e71ae43e3e} +0 -0
- /package/lib/cli/{starters/hono/scripts/setup.mjs → starter-assets/56e2d6db9fe4b0449c979acd06947a5b776bcc645184b54b8d3654a48bd12c38} +0 -0
- /package/lib/cli/{starters/hono/src/Notebook.jsx → starter-assets/6138d1e2ca4469daf4f5545d140943f6e23b0c37f865051b266ec99695cf181a} +0 -0
- /package/lib/cli/{starters/hono/src/vite-env.d.ts → starter-assets/65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5} +0 -0
- /package/lib/cli/{starters/hono/server/application.mjs → starter-assets/757f43c27415654049ecf01b67d560c83d788108d1aebcf1f16a86d956bd7fb6} +0 -0
- /package/lib/cli/{starters/hono/src/components/mayura/thread-list.tsx → starter-assets/97601d0bf331df7bbde88f7ee269610bc8a1239f8eeb58fded6416e588a5b7dd} +0 -0
- /package/lib/cli/{starters/approval-workflow/dot-github/workflows/ci.yml → starter-assets/aa4182c76778ba2194ecbfde9a960c20181534fd1ab484df126278dbc6eb0186} +0 -0
- /package/lib/cli/{starters/hono/src/session.js → starter-assets/abcc6ebd29ba47a079befb6568054dec8f43d4c729187e4a3610af39789e77be} +0 -0
- /package/lib/cli/{starters/hono/compose.yaml → starter-assets/cc1df6f5ce0eebffc567ecea1d599eba97cd1b94ab01551085c0eb87a28e3a6c} +0 -0
- /package/lib/cli/{starters/hono/src/connect.js → starter-assets/cd3ddb959b277e7d495cc020a6f8146acfbcc9d05ececa3809e8aafcf84504d9} +0 -0
- /package/lib/cli/{starters/hono/test/session.test.mjs → starter-assets/dfe75fd07538427d80ba76767e037e929664c80ff5a41b7544496a789181bb73} +0 -0
- /package/lib/cli/{starters/approval-workflow/dot-gitignore → starter-assets/f3ef7285253ec9668732f535306beee602e91cb6e20f83d4799b3323399ce569} +0 -0
- /package/lib/cli/{starters/nuxt/src/view.js → starter-assets/ff840fe960683d377e78f731b5d4318adf6050384791fa20e4948d34192aa35d} +0 -0
|
@@ -133,7 +133,7 @@ export class ScheduledWorkflowDatabase {
|
|
|
133
133
|
// Lock every bounded owned job before touching any resource. Controls can safely visit them in any order afterwards.
|
|
134
134
|
const jobIds = await tx.lockRunJobs(scope,id);
|
|
135
135
|
const links = await tx.links(scope,id);
|
|
136
|
-
if (links.length >
|
|
136
|
+
if (links.length > owner.manifest.graph.length || links.length !== jobIds.length || links.some((link,index) => link.job_id !== jobIds[index])) failed();
|
|
137
137
|
const events: StoredEventInput[] = []; const clock = { value: owner.clockFloor }; const jobs: JobRecord[] = [];
|
|
138
138
|
const local = this.scheduler.inSession(tx,id,events,undefined,clock);
|
|
139
139
|
for (const link of links) {
|
|
@@ -424,7 +424,21 @@ export class WorkflowTreeDatabase {
|
|
|
424
424
|
const links=await tx.treeJobsOfRoot(scope,rootId);if(links.length){const jobIds=links.map(link=>link.job_id);const lockedJobs=await tx.lockSchedulerJobs(scope,jobIds);if(lockedJobs.length!==links.length)failed();await tx.lockSchedulerResources(scope,jobIds);}
|
|
425
425
|
let budget=root.budget;const recovered:JobRecord[]=[];const touched=new Set<string>();const memberEvents=new Map<string,StoredEventInput[]>();const now=await storageClock(tx);
|
|
426
426
|
for(const link of links){if(recovered.length>=raw.limit)break;const member=members.find(item=>item.aggregate_id===link.aggregate_id);const state=states.get(link.aggregate_id);const manifest=manifests.get(link.aggregate_id);const record=records.get(link.aggregate_id);const node=manifest?.graph.find(item=>item.id===link.node_id);const step=state?.steps[link.node_id];if(!member||!state||!manifest||!record||!node||node.kind!=='tool'||!step||step.kind!=='tool'||link.account_id!==member.account_id||storedInteger(link.cost_micros)!==node.costMicros)failed();const events=memberEvents.get(link.aggregate_id)??[];memberEvents.set(link.aggregate_id,events);const integrated=this.scheduler.inSession(tx,link.aggregate_id,events,link.job_id);const prior=await integrated.execute('read',{scope,jobId:link.job_id}) as JobRecord|undefined;if(!prior)failed();const review=step.approval as {digest:string;expiresAt:number;humanId:string|null}|null;if(node.approval&&prior.startedAtMs===null&&['ready','leased'].includes(prior.state)){if(!review||typeof review.expiresAt!=='number'||!Number.isSafeInteger(review.expiresAt)||review.humanId===null)failed();if(review.expiresAt<=now){const job=await integrated.execute('cancel',{scope,jobId:link.job_id,commandId:digest('mayura:workflow-tree-approval-expired:v1',{rootId,memberId:link.aggregate_id,nodeId:link.node_id,jobId:link.job_id,expiresAt:review.expiresAt})}) as JobRecord;recovered.push(job);touched.add(link.aggregate_id);budget=await this.budgets.inSession(tx).execute('cancelReservation',{scope,id:rootId,policyHash:raw.rootPolicyHash,accountId:link.account_id,reservationId:link.reservation_id}) as WorkflowTreeBudgetSnapshot;if(step.costReserved!==0){state.reservedMicros-=step.costReserved;step.costReserved=0;}step.status='blocked';state.status='blocked';events.push({type:'approval.expired',data:{nodeId:link.node_id}});continue;}}const results=await integrated.execute('recover',{scope,limit:1}) as JobRecord[];const job=results[0];if(!job)continue;recovered.push(job);touched.add(link.aggregate_id);if(prior.state==='started'){if(job.state!=='outcome_unknown')failed();const knownReceipt=prior.receipt!==null&&prior.receipt.execution!=='unknown';if(knownReceipt){if(step.receipt===null||!same(step.receipt,prior.receipt)||step.costReserved!==0)failed();step.status='blocked';state.status='blocked';events.push({type:'step.output_blocked',data:{nodeId:link.node_id,reason:'RECOVERY_OUTPUT_UNAVAILABLE'}});if(link.account_id!=='root')budget=await this.budgets.inSession(tx).execute('closeSubtree',{scope,id:rootId,policyHash:raw.rootPolicyHash,accountId:link.account_id}) as WorkflowTreeBudgetSnapshot;}else{budget=await this.budgets.inSession(tx).execute('markUnknown',{scope,id:rootId,policyHash:raw.rootPolicyHash,accountId:link.account_id,reservationId:link.reservation_id}) as WorkflowTreeBudgetSnapshot;step.status='unknown';state.status='outcome_unknown';}}else if(job.state==='cancelled'){budget=await this.budgets.inSession(tx).execute('cancelReservation',{scope,id:rootId,policyHash:raw.rootPolicyHash,accountId:link.account_id,reservationId:link.reservation_id}) as WorkflowTreeBudgetSnapshot;if(step.costReserved!==0){state.reservedMicros-=step.costReserved;step.costReserved=0;}step.status='skipped';state.status='blocked';}else if(job.state!=='ready')failed();}
|
|
427
|
-
|
|
427
|
+
// Join-only roots and joins following root-local tools need no child completion to advance.
|
|
428
|
+
// This is a data-only transition under the existing root lock, never a tool dispatch.
|
|
429
|
+
const rootState=states.get(rootId)!;
|
|
430
|
+
if(rootState.status==='running'||rootState.status==='waiting'){
|
|
431
|
+
const completed:string[]=[];let progress=true;
|
|
432
|
+
while(progress){progress=false;for(const node of rootOwner.manifest.graph){
|
|
433
|
+
const step=rootState.steps[node.id]!;
|
|
434
|
+
if(node.kind!=='join'||step.status!=='pending'||node.dependsOn.some(id=>rootState.steps[id]?.status!=='succeeded'))continue;
|
|
435
|
+
try{step.output=jsonValue(node.dependsOn.map(id=>rootState.steps[id]!.output),{maxBytes:rootOwner.policy.maxOutputBytes});step.status='succeeded';}
|
|
436
|
+
catch{step.output=null;step.status='blocked';rootState.status='blocked';}
|
|
437
|
+
completed.push(node.id);progress=rootState.status!=='blocked';if(!progress)break;
|
|
438
|
+
}if(rootState.status==='blocked')break;}
|
|
439
|
+
if(completed.length){touched.add(rootId);const events=memberEvents.get(rootId)??[];events.push({type:'workflow.joins_advanced',data:{nodes:completed}});memberEvents.set(rootId,events);}
|
|
440
|
+
}
|
|
441
|
+
if(recovered.length===0&&touched.size===0)return{root,members:[],jobs:[]};const updatedMembers:StoredRecord[]=[];for(const childId of [...touched].filter(id=>id!==rootId).sort()){const state=states.get(childId);if(!state)failed();state.budgetVersion=budget.version;const row=await tx.aggregate(scope,childId,false);if(!row)failed();const updated=await tx.writeAggregate(row,state as unknown as JsonObject,memberEvents.get(childId)??[],now);await tx.setOwnerVersion(scope,childId,updated.version);updatedMembers.push(aggregateRecord(updated));}
|
|
428
442
|
if(!touched.has(rootId)&&budget.version===root.budget.version)return{root,members:updatedMembers,jobs:recovered};const mutableRoot=states.get(rootId);if(!mutableRoot)failed();mutableRoot.budgetVersion=budget.version;const rootEvents=[...(memberEvents.get(rootId)??[])];if(budget.version!==root.budget.version)rootEvents.push({type:'workflow.budget_updated',data:{recovered:recovered.length}});const rootRow=await tx.aggregate(scope,rootId,false);if(!rootRow)failed();const updatedRoot=await tx.writeAggregate(rootRow,mutableRoot as unknown as JsonObject,rootEvents,now);await tx.setOwnerVersion(scope,rootId,updatedRoot.version);const current=await this.locked(tx,scope,rootId,raw.rootPolicyHash);if(!current)failed();return{root:current,members:updatedMembers,jobs:recovered};
|
|
429
443
|
});
|
|
430
444
|
}
|
package/lib/testing/package.json
CHANGED
package/lib/threads/package.json
CHANGED
package/lib/tools/package.json
CHANGED
package/lib/voice/package.json
CHANGED
|
@@ -12,6 +12,8 @@ export interface WorkflowTreeChildNode {
|
|
|
12
12
|
}
|
|
13
13
|
export type WorkflowTreeNode = WorkflowNode | WorkflowTreeChildNode;
|
|
14
14
|
export interface WorkflowTreeOptions<I extends Schema, O extends Schema> {
|
|
15
|
+
/** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
|
|
16
|
+
readonly maxNodes?: number | false;
|
|
15
17
|
readonly id: string;
|
|
16
18
|
readonly version: string;
|
|
17
19
|
readonly input: I;
|
|
@@ -21,6 +23,8 @@ export interface WorkflowTreeOptions<I extends Schema, O extends Schema> {
|
|
|
21
23
|
}
|
|
22
24
|
declare const workflowTreeBrand: unique symbol;
|
|
23
25
|
export interface WorkflowTreeDefinition<I extends Schema = Schema, O extends Schema = Schema> {
|
|
26
|
+
/** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */
|
|
27
|
+
readonly maxNodes?: number | false;
|
|
24
28
|
readonly [workflowTreeBrand]: true;
|
|
25
29
|
readonly format: 4;
|
|
26
30
|
readonly id: string;
|
|
@@ -34,7 +38,7 @@ export interface WorkflowTreeDefinition<I extends Schema = Schema, O extends Sch
|
|
|
34
38
|
export type AnyWorkflowTree = WorkflowTreeDefinition;
|
|
35
39
|
export type WorkflowTreeOutput<D extends AnyWorkflowTree> = InferOutput<D['output']>;
|
|
36
40
|
export declare function assertWorkflowTree(definition: AnyWorkflowTree): void;
|
|
37
|
-
export declare function treeManifest(definition: Pick<AnyWorkflowTree, 'id' | 'version' | 'nodes' | 'result'>): WorkflowTreeManifest;
|
|
41
|
+
export declare function treeManifest(definition: Pick<AnyWorkflowTree, 'id' | 'version' | 'nodes' | 'result' | 'maxNodes'>): WorkflowTreeManifest;
|
|
38
42
|
/** Define a finite root with required, one-level tool/join workflow children. */
|
|
39
43
|
export declare function defineWorkflowTree<I extends Schema, O extends Schema>(options: WorkflowTreeOptions<I, O>): WorkflowTreeDefinition<I, O>;
|
|
40
44
|
/** Leaf definitions remain genuine format-2 workflows, never structural or nested format-4 values. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children-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AC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAC/H,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5G,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACvE;AACD,MAAM,MAAM,eAAe,GAAG,sBAAsB,CAAC;AACrD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAGrF,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAEpE;AAeD,wBAAgB,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAC,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,QAAQ,GAAC,UAAU,CAAC,GAAG,oBAAoB,CAc/H;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,EAAC,CAAC,CAAC,CAuBpI;AAED,sGAAsG;AACtG,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC"}
|
|
@@ -10,6 +10,7 @@ export function assertWorkflowTree(definition) {
|
|
|
10
10
|
function manifestFor(definition) {
|
|
11
11
|
assertWorkflow(definition);
|
|
12
12
|
const manifest = workflowManifest({ id: definition.id, version: definition.version,
|
|
13
|
+
...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
|
|
13
14
|
graph: definition.nodes.map(node => node.kind === 'join'
|
|
14
15
|
? { kind: 'join', id: node.id, dependsOn: node.dependsOn }
|
|
15
16
|
: { kind: 'tool', id: node.id, dependsOn: node.dependsOn ?? [], tool: node.tool.id, toolVersion: node.tool.version,
|
|
@@ -22,6 +23,7 @@ function manifestFor(definition) {
|
|
|
22
23
|
export function treeManifest(definition) {
|
|
23
24
|
try {
|
|
24
25
|
return workflowTreeManifest({ format: 4, id: definition.id, version: definition.version,
|
|
26
|
+
...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),
|
|
25
27
|
graph: definition.nodes.map(node => node.kind === 'join'
|
|
26
28
|
? { kind: 'join', id: node.id, dependsOn: node.dependsOn }
|
|
27
29
|
: node.kind === 'tool'
|
|
@@ -66,8 +68,10 @@ export function defineWorkflowTree(options) {
|
|
|
66
68
|
const standard = schema['~standard'];
|
|
67
69
|
return Object.freeze({ '~standard': Object.freeze({ version: 1, vendor: standard.vendor, validate: standard.validate.bind(standard) }) });
|
|
68
70
|
};
|
|
69
|
-
const definition = Object.freeze({
|
|
70
|
-
|
|
71
|
+
const definition = Object.freeze({
|
|
72
|
+
...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }), format: 4, id: manifest.id, version: manifest.version,
|
|
73
|
+
digest: digest('mayura:workflow-tree:v1', manifest), input: snapshot(options.input), output: snapshot(options.output), nodes, result: manifest.result
|
|
74
|
+
});
|
|
71
75
|
definitions.add(definition);
|
|
72
76
|
return definition;
|
|
73
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children-definition.js","sourceRoot":"","sources":["../src/children-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAkD,MAAM,cAAc,CAAC;AACzG,OAAO,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,GAE1D,MAAM,2BAA2B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,QAAQ,CAAC,OAAO;QACzF,MAAM,EAAC,MAAM,CAAC,yBAAyB,EAAC,QAAQ,CAAC,EAAC,KAAK,EAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,MAAM,EAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM,EAAC,CAAgC,CAAC;IAChL,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAAC,OAAO,UAAU,CAAC;AACjD,CAAC","sourcesContent":["import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';\nimport { assertTool, type AnyTool } from '@mayura/tools';\nimport {\n workflowManifest, workflowResources, workflowTreeManifest,\n type WorkflowManifest, type WorkflowResourcePlan, type WorkflowTreeChildPolicy, type WorkflowTreeManifest,\n} from '@mayura/storage-contracts';\nimport {\n assertWorkflow, digest, type AnyWorkflow, type Binding, type WorkflowDefinition, type WorkflowNode,\n} from './definition.js';\n\nexport interface WorkflowTreeChildNode {\n readonly kind: 'child'; readonly id: string; readonly dependsOn?: readonly string[];\n readonly workflow: AnyWorkflow; readonly input: Binding;\n readonly policy: WorkflowTreeChildPolicy; readonly resources?: WorkflowResourcePlan;\n}\nexport type WorkflowTreeNode = WorkflowNode | WorkflowTreeChildNode;\nexport interface WorkflowTreeOptions<I extends Schema,O extends Schema> {\n readonly id: string; readonly version: string; readonly input: I; readonly output: O;\n readonly nodes: readonly WorkflowTreeNode[]; readonly result: Binding;\n}\ndeclare const workflowTreeBrand: unique symbol;\nexport interface WorkflowTreeDefinition<I extends Schema=Schema,O extends Schema=Schema> {\n readonly [workflowTreeBrand]: true; readonly format: 4; readonly id: string; readonly version: string; readonly digest: string;\n readonly input: Schema<InferInput<I>,InferOutput<I>>; readonly output: Schema<InferInput<O>,InferOutput<O>>;\n readonly nodes: readonly WorkflowTreeNode[]; readonly result: Binding;\n}\nexport type AnyWorkflowTree = WorkflowTreeDefinition;\nexport type WorkflowTreeOutput<D extends AnyWorkflowTree> = InferOutput<D['output']>;\nconst definitions = new WeakSet<object>();\n\nexport function assertWorkflowTree(definition: AnyWorkflowTree): void {\n if (!definitions.has(definition)) throw new MayuraError('INVALID_CONFIG','Use defineWorkflowTree from this package instance.');\n}\n\nfunction manifestFor(definition: AnyWorkflow): WorkflowManifest {\n assertWorkflow(definition);\n const manifest = workflowManifest({ id:definition.id,version:definition.version,\n graph:definition.nodes.map(node => node.kind === 'join'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : {kind:'tool',id:node.id,dependsOn:node.dependsOn ?? [],tool:node.tool.id,toolVersion:node.tool.version,\n effects:node.tool.effects,capabilities:node.tool.capabilities,costMicros:node.tool.costMicros,\n approval:node.approval ?? false,input:node.input}),result:definition.result });\n if (digest('mayura:workflow:v1',manifest) !== definition.digest) throw new MayuraError('INVALID_CONFIG','Child workflow metadata does not match its genuine definition.');\n return manifest;\n}\n\nexport function treeManifest(definition: Pick<AnyWorkflowTree,'id'|'version'|'nodes'|'result'>): WorkflowTreeManifest {\n try {\n return workflowTreeManifest({ format:4,id:definition.id,version:definition.version,\n graph:definition.nodes.map(node => node.kind === 'join'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : node.kind === 'tool'\n ? {kind:'tool',id:node.id,dependsOn:node.dependsOn ?? [],tool:node.tool.id,toolVersion:node.tool.version,\n effects:node.tool.effects,capabilities:node.tool.capabilities,costMicros:node.tool.costMicros,\n approval:node.approval ?? false,input:node.input}\n : {kind:'child',id:node.id,dependsOn:node.dependsOn ?? [],workflow:manifestFor(node.workflow),\n policy:node.policy,resources:workflowResources(node.resources ?? {},manifestFor(node.workflow)),input:node.input}),\n result:definition.result });\n } catch { throw new MayuraError('INVALID_CONFIG','Workflow tree metadata is invalid or exceeds its finite bounds.'); }\n}\n\n/** Define a finite root with required, one-level tool/join workflow children. */\nexport function defineWorkflowTree<I extends Schema,O extends Schema>(options: WorkflowTreeOptions<I,O>): WorkflowTreeDefinition<I,O> {\n if (!options || !Array.isArray(options.nodes)) throw new MayuraError('INVALID_CONFIG','Workflow tree options are required.');\n assertSchema(options.input); assertSchema(options.output);\n const tools = new Map<string,AnyTool>(); const children = new Map<string,AnyWorkflow>();\n for (const node of options.nodes) {\n if (node.kind === 'tool') { assertTool(node.tool); tools.set(node.id,node.tool); }\n else if (node.kind === 'child') { assertWorkflow(node.workflow); children.set(node.id,node.workflow); }\n else if (node.kind !== 'join') throw new MayuraError('INVALID_CONFIG','Unknown workflow-tree node kind.');\n }\n const manifest = treeManifest(options as unknown as Pick<AnyWorkflowTree,'id'|'version'|'nodes'|'result'>);\n const nodes = Object.freeze(manifest.graph.map(node => node.kind === 'tool'\n ? Object.freeze({...node,tool:tools.get(node.id)!})\n : node.kind === 'child'\n ? Object.freeze({...node,workflow:children.get(node.id)!})\n : node)) as readonly WorkflowTreeNode[];\n const snapshot = <S extends Schema>(schema:S): Schema<InferInput<S>,InferOutput<S>> => {\n const standard = schema['~standard'];\n return Object.freeze({'~standard':Object.freeze({version:1 as const,vendor:standard.vendor,validate:standard.validate.bind(standard)})}) as Schema<InferInput<S>,InferOutput<S>>;\n };\n const definition = Object.freeze({format:4 as const,id:manifest.id,version:manifest.version,\n digest:digest('mayura:workflow-tree:v1',manifest),input:snapshot(options.input),output:snapshot(options.output),nodes,result:manifest.result}) as WorkflowTreeDefinition<I,O>;\n definitions.add(definition); return definition;\n}\n\n/** Leaf definitions remain genuine format-2 workflows, never structural or nested format-4 values. */\nexport type WorkflowTreeLeaf = WorkflowDefinition;\n"]}
|
|
1
|
+
{"version":3,"file":"children-definition.js","sourceRoot":"","sources":["../src/children-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAkD,MAAM,cAAc,CAAC;AACzG,OAAO,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,GAE1D,MAAM,2BA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AAU,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM,EAAC,QAAQ,EAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC,EAAC,CAAyC,CAAC;IACnL,CAAC,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/B,GAAG,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAC,MAAM,EAAC,CAAU,EAAC,EAAE,EAAC,QAAQ,CAAC,EAAE,EAAC,OAAO,EAAC,QAAQ,CAAC,OAAO;QACrI,MAAM,EAAC,MAAM,CAAC,yBAAyB,EAAC,QAAQ,CAAC,EAAC,KAAK,EAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAC,MAAM,EAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM;KAAC,CAAgC,CAAC;IAChL,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAAC,OAAO,UAAU,CAAC;AACjD,CAAC","sourcesContent":["import { assertSchema, MayuraError, type InferInput, type InferOutput, type Schema } from '@mayura/core';\nimport { assertTool, type AnyTool } from '@mayura/tools';\nimport {\n workflowManifest, workflowResources, workflowTreeManifest,\n type WorkflowManifest, type WorkflowResourcePlan, type WorkflowTreeChildPolicy, type WorkflowTreeManifest,\n} from '@mayura/storage-contracts';\nimport {\n assertWorkflow, digest, type AnyWorkflow, type Binding, type WorkflowDefinition, type WorkflowNode,\n} from './definition.js';\n\nexport interface WorkflowTreeChildNode {\n readonly kind: 'child'; readonly id: string; readonly dependsOn?: readonly string[];\n readonly workflow: AnyWorkflow; readonly input: Binding;\n readonly policy: WorkflowTreeChildPolicy; readonly resources?: WorkflowResourcePlan;\n}\nexport type WorkflowTreeNode = WorkflowNode | WorkflowTreeChildNode;\nexport interface WorkflowTreeOptions<I extends Schema,O extends Schema> {\n /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */\n readonly maxNodes?: number | false;\n readonly id: string; readonly version: string; readonly input: I; readonly output: O;\n readonly nodes: readonly WorkflowTreeNode[]; readonly result: Binding;\n}\ndeclare const workflowTreeBrand: unique symbol;\nexport interface WorkflowTreeDefinition<I extends Schema=Schema,O extends Schema=Schema> {\n /** Per-graph bound: defaults to 128; finite maximum 512; false disables node-count admission. */\n readonly maxNodes?: number | false;\n readonly [workflowTreeBrand]: true; readonly format: 4; readonly id: string; readonly version: string; readonly digest: string;\n readonly input: Schema<InferInput<I>,InferOutput<I>>; readonly output: Schema<InferInput<O>,InferOutput<O>>;\n readonly nodes: readonly WorkflowTreeNode[]; readonly result: Binding;\n}\nexport type AnyWorkflowTree = WorkflowTreeDefinition;\nexport type WorkflowTreeOutput<D extends AnyWorkflowTree> = InferOutput<D['output']>;\nconst definitions = new WeakSet<object>();\n\nexport function assertWorkflowTree(definition: AnyWorkflowTree): void {\n if (!definitions.has(definition)) throw new MayuraError('INVALID_CONFIG','Use defineWorkflowTree from this package instance.');\n}\n\nfunction manifestFor(definition: AnyWorkflow): WorkflowManifest {\n assertWorkflow(definition);\n const manifest = workflowManifest({ id:definition.id,version:definition.version,\n ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),\n graph:definition.nodes.map(node => node.kind === 'join'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : {kind:'tool',id:node.id,dependsOn:node.dependsOn ?? [],tool:node.tool.id,toolVersion:node.tool.version,\n effects:node.tool.effects,capabilities:node.tool.capabilities,costMicros:node.tool.costMicros,\n approval:node.approval ?? false,input:node.input}),result:definition.result });\n if (digest('mayura:workflow:v1',manifest) !== definition.digest) throw new MayuraError('INVALID_CONFIG','Child workflow metadata does not match its genuine definition.');\n return manifest;\n}\n\nexport function treeManifest(definition: Pick<AnyWorkflowTree,'id'|'version'|'nodes'|'result'|'maxNodes'>): WorkflowTreeManifest {\n try {\n return workflowTreeManifest({ format:4,id:definition.id,version:definition.version,\n ...(definition.maxNodes === undefined ? {} : { maxNodes: definition.maxNodes }),\n graph:definition.nodes.map(node => node.kind === 'join'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : node.kind === 'tool'\n ? {kind:'tool',id:node.id,dependsOn:node.dependsOn ?? [],tool:node.tool.id,toolVersion:node.tool.version,\n effects:node.tool.effects,capabilities:node.tool.capabilities,costMicros:node.tool.costMicros,\n approval:node.approval ?? false,input:node.input}\n : {kind:'child',id:node.id,dependsOn:node.dependsOn ?? [],workflow:manifestFor(node.workflow),\n policy:node.policy,resources:workflowResources(node.resources ?? {},manifestFor(node.workflow)),input:node.input}),\n result:definition.result });\n } catch { throw new MayuraError('INVALID_CONFIG','Workflow tree metadata is invalid or exceeds its finite bounds.'); }\n}\n\n/** Define a finite root with required, one-level tool/join workflow children. */\nexport function defineWorkflowTree<I extends Schema,O extends Schema>(options: WorkflowTreeOptions<I,O>): WorkflowTreeDefinition<I,O> {\n if (!options || !Array.isArray(options.nodes)) throw new MayuraError('INVALID_CONFIG','Workflow tree options are required.');\n assertSchema(options.input); assertSchema(options.output);\n const tools = new Map<string,AnyTool>(); const children = new Map<string,AnyWorkflow>();\n for (const node of options.nodes) {\n if (node.kind === 'tool') { assertTool(node.tool); tools.set(node.id,node.tool); }\n else if (node.kind === 'child') { assertWorkflow(node.workflow); children.set(node.id,node.workflow); }\n else if (node.kind !== 'join') throw new MayuraError('INVALID_CONFIG','Unknown workflow-tree node kind.');\n }\n const manifest = treeManifest(options as unknown as Pick<AnyWorkflowTree,'id'|'version'|'nodes'|'result'|'maxNodes'>);\n const nodes = Object.freeze(manifest.graph.map(node => node.kind === 'tool'\n ? Object.freeze({...node,tool:tools.get(node.id)!})\n : node.kind === 'child'\n ? Object.freeze({...node,workflow:children.get(node.id)!})\n : node)) as readonly WorkflowTreeNode[];\n const snapshot = <S extends Schema>(schema:S): Schema<InferInput<S>,InferOutput<S>> => {\n const standard = schema['~standard'];\n return Object.freeze({'~standard':Object.freeze({version:1 as const,vendor:standard.vendor,validate:standard.validate.bind(standard)})}) as Schema<InferInput<S>,InferOutput<S>>;\n };\n const definition = Object.freeze({\n ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }),format:4 as const,id:manifest.id,version:manifest.version,\n digest:digest('mayura:workflow-tree:v1',manifest),input:snapshot(options.input),output:snapshot(options.output),nodes,result:manifest.result}) as WorkflowTreeDefinition<I,O>;\n definitions.add(definition); return definition;\n}\n\n/** Leaf definitions remain genuine format-2 workflows, never structural or nested format-4 values. */\nexport type WorkflowTreeLeaf = WorkflowDefinition;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"children-runtime.d.ts","sourceRoot":"","sources":["../src/children-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"children-runtime.d.ts","sourceRoot":"","sources":["../src/children-runtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAsG,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE9M,OAAO,EAA2B,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC1G,OAAO,EAC2D,iBAAiB,EAClD,KAAK,0BAA0B,EAAE,KAAK,wBAAwB,IAAI,kBAAkB,EACpH,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACkB,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC7H,OAAO,EAAoC,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC/H,OAAO,KAAK,EAAE,a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,GAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvK,MAAM,CAAC,EAAE,EAAC,MAAM,GAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChD,yHAAyH;IACzH,KAAK,CAAC,EAAE,EAAC,MAAM,GAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/C,sFAAsF;IACtF,MAAM,CAAC,EAAE,EAAC,MAAM,GAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChD;;;OAGG;IACH,OAAO,CAAC,SAAS,EAAC,iBAAiB,CAAC,eAAe,EAAC,eAAe,CAAC,EAAC,OAAO,EAAC,gBAAgB,GAAE,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACtJ,cAAc,CAAC,EAAE,EAAC,MAAM,GAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxD,MAAM,CAAC,EAAE,EAAC,MAAM,EAAC,KAAK,CAAC,EAAC,MAAM,GAAE,UAAU,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjF,KAAK,IAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,8GAA8G;IAC9G,KAAK,CAAC,OAAO,CAAC,EAAC,oBAAoB,GAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACnE;AAYD,mFAAmF;AACnF,wBAAgB,yBAAyB,CAAC,OAAO,EAAC,0BAA0B,GAAE,mBAAmB,CAqHhG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { workflowAuthorization } from './authorization.js';
|
|
2
|
+
import { workflowNodeLimit } from '../../core/dist/index.js';
|
|
2
3
|
import { Budget, MayuraError, assertPositiveInteger, freezeJson, jsonValue, validate } from '../../core/dist/index.js';
|
|
3
4
|
import { invokeTool } from '../../tools/dist/index.js';
|
|
4
5
|
import { createWorkflowDrainGate } from './drain.js';
|
|
@@ -264,7 +265,7 @@ export function createWorkflowTreeRuntime(options) {
|
|
|
264
265
|
const checkedSnapshot = async (record) => { await auth.execute(definition.digest, id); return publicSnapshot(record); };
|
|
265
266
|
const rootNodes = definition.nodes.filter((node) => node.kind === 'tool');
|
|
266
267
|
const childNodes = definition.nodes.filter(node => node.kind === 'child');
|
|
267
|
-
for (let wave = 0; wave <
|
|
268
|
+
for (let wave = 0; wave < definition.nodes.length * 2 + 8; wave++) {
|
|
268
269
|
open();
|
|
269
270
|
await auth.execute(definition.digest, id);
|
|
270
271
|
let root = await inspectStored(id);
|
|
@@ -286,7 +287,7 @@ export function createWorkflowTreeRuntime(options) {
|
|
|
286
287
|
let dispatched = false;
|
|
287
288
|
try {
|
|
288
289
|
const recovery = await call(() => api.recoverExpired({ ...access(id), limit: 128 }));
|
|
289
|
-
if (recovery.jobs.length) {
|
|
290
|
+
if (recovery.jobs.length || recovery.root.record.version !== root.record.version) {
|
|
290
291
|
root = recovery.root;
|
|
291
292
|
rootState = workflowTreeState(root.record);
|
|
292
293
|
progress = true;
|
|
@@ -636,7 +637,7 @@ export function createWorkflowTreeRuntime(options) {
|
|
|
636
637
|
if (entry.target)
|
|
637
638
|
carried[entry.target] = entry.action === 'keep' || entry.action === 'accept' ? state.steps[entry.source] : fresh.steps[entry.target];
|
|
638
639
|
const steps = Object.fromEntries(manifest.graph.map(node => [node.id, carried[node.id]]));
|
|
639
|
-
const next = { ...state, definition: migration.to.digest, steps, reservedMicros: Object.values(steps).reduce((sum, step) => sum + step.costReserved, 0) };
|
|
640
|
+
const next = { ...state, maxNodes: migration.to.maxNodes === false ? false : workflowNodeLimit(migration.to.maxNodes), definition: migration.to.digest, steps, reservedMicros: Object.values(steps).reduce((sum, step) => sum + step.costReserved, 0) };
|
|
640
641
|
const migrated = await call(() => controls.migrateRoot({ ...access(id), expectedVersion: root.record.version, commandId, manifest, resources: {}, state: jsonValue(next), migrationId: migration.id, actorId }));
|
|
641
642
|
matchRoot(migration.to, migrated);
|
|
642
643
|
return freezeJson(jsonValue({ plan, snapshot: publicSnapshot(migrated) }));
|