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.
Files changed (409) hide show
  1. package/README.md +2 -0
  2. package/docs/README.md +17 -4
  3. package/docs/cli/init.md +15 -3
  4. package/docs/concepts/workflows.md +60 -1
  5. package/docs/guides/choosing-a-starter.md +80 -0
  6. package/docs/guides/durable-workflows.md +1 -1
  7. package/docs/guides/framework-starters.md +5 -1
  8. package/docs/guides/hono.md +94 -0
  9. package/docs/guides/nextjs.md +94 -0
  10. package/docs/guides/nuxt.md +94 -0
  11. package/docs/guides/rag-deployment.md +48 -0
  12. package/docs/guides/rag-modal-pinecone-starter.md +63 -0
  13. package/docs/guides/rag-production.md +48 -0
  14. package/docs/guides/rag-quickstart.md +119 -0
  15. package/docs/guides/rag.md +23 -3
  16. package/docs/guides/react-router.md +94 -0
  17. package/docs/guides/release-readiness.md +78 -55
  18. package/docs/guides/sveltekit.md +94 -0
  19. package/docs/guides/tanstack-start.md +94 -0
  20. package/docs/guides/workflow-composition.md +1 -1
  21. package/docs/integrations/reranker-cohere.md +1 -0
  22. package/docs/integrations/reranker-jina.md +1 -0
  23. package/docs/integrations/reranker-voyage.md +1 -0
  24. package/docs/integrations/vector-chroma.md +1 -0
  25. package/docs/integrations/vector-libsql.md +1 -0
  26. package/docs/integrations/vector-pgvector.md +1 -0
  27. package/docs/integrations/vector-pinecone.md +4 -1
  28. package/docs/integrations/vector-qdrant.md +1 -0
  29. package/docs/integrations/vector-weaviate.md +1 -0
  30. package/docs/introduction.md +5 -0
  31. package/docs/project/whats-new.md +70 -2
  32. package/docs/quickstart.md +5 -3
  33. package/lib/adapter-code-docker/image/Dockerfile +1 -1
  34. package/lib/adapter-code-docker/package.json +1 -1
  35. package/lib/adapter-code-quickjs/package.json +1 -1
  36. package/lib/adapter-mcp/package.json +1 -1
  37. package/lib/ag-ui/package.json +1 -1
  38. package/lib/artifacts/package.json +1 -1
  39. package/lib/auth/package.json +1 -1
  40. package/lib/authz/package.json +1 -1
  41. package/lib/browser/package.json +1 -1
  42. package/lib/cli/dist/index.d.ts +1 -1
  43. package/lib/cli/dist/index.d.ts.map +1 -1
  44. package/lib/cli/dist/index.js +63 -20
  45. package/lib/cli/dist/index.js.map +1 -1
  46. package/lib/cli/dist/interactive.js +2 -2
  47. package/lib/cli/dist/interactive.js.map +1 -1
  48. package/lib/cli/dist/operations.d.ts +1 -0
  49. package/lib/cli/dist/operations.d.ts.map +1 -1
  50. package/lib/cli/dist/operations.js +13 -5
  51. package/lib/cli/dist/operations.js.map +1 -1
  52. package/lib/cli/package.json +1 -1
  53. package/lib/cli/src/index.ts +51 -12
  54. package/lib/cli/src/interactive.ts +2 -2
  55. package/lib/cli/src/operations.ts +9 -5
  56. package/lib/cli/starter-assets/manifest.json +1 -0
  57. package/lib/cli/starters/hono/package.json +2 -2
  58. package/lib/cli/starters/rag-modal-pinecone/README.md +60 -0
  59. package/lib/cli/starters/rag-modal-pinecone/dot-env.example +23 -0
  60. package/lib/cli/starters/{event-automation → rag-modal-pinecone}/dot-gitignore +2 -4
  61. package/lib/cli/starters/rag-modal-pinecone/fixtures/on-call.md +4 -0
  62. package/lib/cli/starters/rag-modal-pinecone/mayura.project.json +13 -0
  63. package/lib/cli/starters/rag-modal-pinecone/modal-app.py +110 -0
  64. package/lib/cli/starters/rag-modal-pinecone/package.json +28 -0
  65. package/lib/cli/starters/rag-modal-pinecone/src/application.ts +148 -0
  66. package/lib/cli/starters/rag-modal-pinecone/src/cli.ts +78 -0
  67. package/lib/cli/starters/rag-modal-pinecone/src/hosted.ts +137 -0
  68. package/lib/cli/starters/rag-modal-pinecone/test/modal_worker_test.py +53 -0
  69. package/lib/cli/starters/rag-modal-pinecone/test/pipeline.test.ts +137 -0
  70. package/lib/cli/starters/{cli-agent → rag-modal-pinecone}/tsconfig.json +0 -1
  71. package/lib/client/dist/index.d.ts.map +1 -1
  72. package/lib/client/dist/index.js +12 -4
  73. package/lib/client/dist/index.js.map +1 -1
  74. package/lib/client/dist/workflow-limits.d.ts +6 -0
  75. package/lib/client/dist/workflow-limits.d.ts.map +1 -0
  76. package/lib/client/dist/workflow-limits.js +15 -0
  77. package/lib/client/dist/workflow-limits.js.map +1 -0
  78. package/lib/client/dist/workflows.d.ts +3 -0
  79. package/lib/client/dist/workflows.d.ts.map +1 -1
  80. package/lib/client/dist/workflows.js +15 -7
  81. package/lib/client/dist/workflows.js.map +1 -1
  82. package/lib/client/package.json +1 -1
  83. package/lib/client/src/index.ts +7 -4
  84. package/lib/client/src/workflow-limits.ts +12 -0
  85. package/lib/client/src/workflows.ts +12 -6
  86. package/lib/client-react/package.json +1 -1
  87. package/lib/code-mode/package.json +1 -1
  88. package/lib/code-mode-workflows/package.json +1 -1
  89. package/lib/context/package.json +1 -1
  90. package/lib/core/dist/host.d.ts +1 -0
  91. package/lib/core/dist/host.d.ts.map +1 -1
  92. package/lib/core/dist/host.js +1 -0
  93. package/lib/core/dist/host.js.map +1 -1
  94. package/lib/core/dist/index.d.ts +1 -0
  95. package/lib/core/dist/index.d.ts.map +1 -1
  96. package/lib/core/dist/index.js +1 -0
  97. package/lib/core/dist/index.js.map +1 -1
  98. package/lib/core/dist/workflow-environment.d.ts +9 -0
  99. package/lib/core/dist/workflow-environment.d.ts.map +1 -0
  100. package/lib/core/dist/workflow-environment.js +15 -0
  101. package/lib/core/dist/workflow-environment.js.map +1 -0
  102. package/lib/core/dist/workflow-limits.d.ts +7 -0
  103. package/lib/core/dist/workflow-limits.d.ts.map +1 -0
  104. package/lib/core/dist/workflow-limits.js +17 -0
  105. package/lib/core/dist/workflow-limits.js.map +1 -0
  106. package/lib/core/package.json +1 -1
  107. package/lib/core/src/host.ts +1 -0
  108. package/lib/core/src/index.ts +1 -0
  109. package/lib/core/src/workflow-environment.ts +15 -0
  110. package/lib/core/src/workflow-limits.ts +16 -0
  111. package/lib/exporter-otlp/dist/otlp-http-json.js +1 -1
  112. package/lib/exporter-otlp/dist/otlp-http-json.js.map +1 -1
  113. package/lib/exporter-otlp/dist/signals.js +2 -2
  114. package/lib/exporter-otlp/dist/signals.js.map +1 -1
  115. package/lib/exporter-otlp/package.json +1 -1
  116. package/lib/exporter-otlp/src/otlp-http-json.ts +1 -1
  117. package/lib/exporter-otlp/src/signals.ts +2 -2
  118. package/lib/files/package.json +1 -1
  119. package/lib/guardrails/package.json +1 -1
  120. package/lib/helpers/package.json +1 -1
  121. package/lib/keys/package.json +1 -1
  122. package/lib/memory/package.json +1 -1
  123. package/lib/memory-remote/package.json +1 -1
  124. package/lib/observability/package.json +1 -1
  125. package/lib/provider-anthropic/package.json +1 -1
  126. package/lib/provider-openai/package.json +1 -1
  127. package/lib/rag/dist/bm25.d.ts +13 -0
  128. package/lib/rag/dist/bm25.d.ts.map +1 -0
  129. package/lib/rag/dist/bm25.js +76 -0
  130. package/lib/rag/dist/bm25.js.map +1 -0
  131. package/lib/rag/dist/document-lexical.d.ts +7 -0
  132. package/lib/rag/dist/document-lexical.d.ts.map +1 -0
  133. package/lib/rag/dist/document-lexical.js +33 -0
  134. package/lib/rag/dist/document-lexical.js.map +1 -0
  135. package/lib/rag/dist/evidence-window.d.ts +15 -0
  136. package/lib/rag/dist/evidence-window.d.ts.map +1 -0
  137. package/lib/rag/dist/evidence-window.js +52 -0
  138. package/lib/rag/dist/evidence-window.js.map +1 -0
  139. package/lib/rag/dist/retrieval.d.ts +6 -0
  140. package/lib/rag/dist/retrieval.d.ts.map +1 -1
  141. package/lib/rag/dist/retrieval.js +60 -6
  142. package/lib/rag/dist/retrieval.js.map +1 -1
  143. package/lib/rag/dist/vectors.d.ts +8 -0
  144. package/lib/rag/dist/vectors.d.ts.map +1 -1
  145. package/lib/rag/dist/vectors.js +121 -4
  146. package/lib/rag/dist/vectors.js.map +1 -1
  147. package/lib/rag/package.json +1 -1
  148. package/lib/rag/src/bm25.ts +35 -0
  149. package/lib/rag/src/document-lexical.ts +17 -0
  150. package/lib/rag/src/evidence-window.ts +41 -0
  151. package/lib/rag/src/retrieval.ts +56 -7
  152. package/lib/rag/src/vectors.ts +62 -4
  153. package/lib/runtime/package.json +1 -1
  154. package/lib/sandbox/package.json +1 -1
  155. package/lib/sdk/package.json +1 -1
  156. package/lib/server/dist/index.d.ts +2 -0
  157. package/lib/server/dist/index.d.ts.map +1 -1
  158. package/lib/server/dist/index.js +12 -4
  159. package/lib/server/dist/index.js.map +1 -1
  160. package/lib/server/dist/inspector-bundle.d.ts +1 -1
  161. package/lib/server/dist/inspector-bundle.d.ts.map +1 -1
  162. package/lib/server/dist/inspector-bundle.js +4 -4
  163. package/lib/server/dist/inspector-bundle.js.map +1 -1
  164. package/lib/server/package.json +1 -1
  165. package/lib/server/src/index.ts +9 -4
  166. package/lib/server/src/inspector-bundle.ts +4 -4
  167. package/lib/server-node/package.json +1 -1
  168. package/lib/skills/package.json +1 -1
  169. package/lib/storage/package.json +1 -1
  170. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts +2 -0
  171. package/lib/storage-contracts/dist/scheduled-workflow-contracts.d.ts.map +1 -1
  172. package/lib/storage-contracts/dist/scheduled-workflow-contracts.js.map +1 -1
  173. package/lib/storage-contracts/dist/workflow-format2.d.ts +2 -0
  174. package/lib/storage-contracts/dist/workflow-format2.d.ts.map +1 -1
  175. package/lib/storage-contracts/dist/workflow-format2.js +8 -7
  176. package/lib/storage-contracts/dist/workflow-format2.js.map +1 -1
  177. package/lib/storage-contracts/dist/workflow-format3.d.ts.map +1 -1
  178. package/lib/storage-contracts/dist/workflow-format3.js +9 -7
  179. package/lib/storage-contracts/dist/workflow-format3.js.map +1 -1
  180. package/lib/storage-contracts/dist/workflow-format4.d.ts +2 -0
  181. package/lib/storage-contracts/dist/workflow-format4.d.ts.map +1 -1
  182. package/lib/storage-contracts/dist/workflow-format4.js +9 -8
  183. package/lib/storage-contracts/dist/workflow-format4.js.map +1 -1
  184. package/lib/storage-contracts/dist/workflow-format5.d.ts +4 -0
  185. package/lib/storage-contracts/dist/workflow-format5.d.ts.map +1 -1
  186. package/lib/storage-contracts/dist/workflow-format5.js +9 -8
  187. package/lib/storage-contracts/dist/workflow-format5.js.map +1 -1
  188. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts +2 -0
  189. package/lib/storage-contracts/dist/workflow-graph-contracts.d.ts.map +1 -1
  190. package/lib/storage-contracts/dist/workflow-graph-contracts.js.map +1 -1
  191. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts +2 -0
  192. package/lib/storage-contracts/dist/workflow-tree-contracts.d.ts.map +1 -1
  193. package/lib/storage-contracts/dist/workflow-tree-contracts.js +5 -3
  194. package/lib/storage-contracts/dist/workflow-tree-contracts.js.map +1 -1
  195. package/lib/storage-contracts/package.json +1 -1
  196. package/lib/storage-contracts/src/scheduled-workflow-contracts.ts +2 -0
  197. package/lib/storage-contracts/src/workflow-format2.ts +10 -7
  198. package/lib/storage-contracts/src/workflow-format3.ts +9 -7
  199. package/lib/storage-contracts/src/workflow-format4.ts +11 -8
  200. package/lib/storage-contracts/src/workflow-format5.ts +13 -8
  201. package/lib/storage-contracts/src/workflow-graph-contracts.ts +2 -0
  202. package/lib/storage-contracts/src/workflow-tree-contracts.ts +7 -3
  203. package/lib/storage-postgres/package.json +1 -1
  204. package/lib/storage-sql/dist/scheduled-database.js +1 -1
  205. package/lib/storage-sql/dist/scheduled-database.js.map +1 -1
  206. package/lib/storage-sql/dist/workflow-tree-database.d.ts.map +1 -1
  207. package/lib/storage-sql/dist/workflow-tree-database.js +37 -1
  208. package/lib/storage-sql/dist/workflow-tree-database.js.map +1 -1
  209. package/lib/storage-sql/package.json +1 -1
  210. package/lib/storage-sql/src/scheduled-database.ts +1 -1
  211. package/lib/storage-sql/src/workflow-tree-database.ts +15 -1
  212. package/lib/storage-sqlite/package.json +1 -1
  213. package/lib/terminal/package.json +1 -1
  214. package/lib/testing/package.json +1 -1
  215. package/lib/threads/package.json +1 -1
  216. package/lib/tools/package.json +1 -1
  217. package/lib/voice/package.json +1 -1
  218. package/lib/workflows/dist/children-definition.d.ts +5 -1
  219. package/lib/workflows/dist/children-definition.d.ts.map +1 -1
  220. package/lib/workflows/dist/children-definition.js +6 -2
  221. package/lib/workflows/dist/children-definition.js.map +1 -1
  222. package/lib/workflows/dist/children-runtime.d.ts.map +1 -1
  223. package/lib/workflows/dist/children-runtime.js +4 -3
  224. package/lib/workflows/dist/children-runtime.js.map +1 -1
  225. package/lib/workflows/dist/definition.d.ts +4 -0
  226. package/lib/workflows/dist/definition.d.ts.map +1 -1
  227. package/lib/workflows/dist/definition.js +6 -3
  228. package/lib/workflows/dist/definition.js.map +1 -1
  229. package/lib/workflows/dist/graph-definition.d.ts +5 -1
  230. package/lib/workflows/dist/graph-definition.d.ts.map +1 -1
  231. package/lib/workflows/dist/graph-definition.js +8 -4
  232. package/lib/workflows/dist/graph-definition.js.map +1 -1
  233. package/lib/workflows/dist/lifecycle-definition.d.ts +5 -1
  234. package/lib/workflows/dist/lifecycle-definition.d.ts.map +1 -1
  235. package/lib/workflows/dist/lifecycle-definition.js +5 -2
  236. package/lib/workflows/dist/lifecycle-definition.js.map +1 -1
  237. package/lib/workflows/dist/lifecycle-runtime.d.ts.map +1 -1
  238. package/lib/workflows/dist/lifecycle-runtime.js +4 -5
  239. package/lib/workflows/dist/lifecycle-runtime.js.map +1 -1
  240. package/lib/workflows/dist/node-batches.d.ts +9 -0
  241. package/lib/workflows/dist/node-batches.d.ts.map +1 -0
  242. package/lib/workflows/dist/node-batches.js +19 -0
  243. package/lib/workflows/dist/node-batches.js.map +1 -0
  244. package/lib/workflows/dist/operator-transports.d.ts +1 -0
  245. package/lib/workflows/dist/operator-transports.d.ts.map +1 -1
  246. package/lib/workflows/dist/operator-transports.js +1 -0
  247. package/lib/workflows/dist/operator-transports.js.map +1 -1
  248. package/lib/workflows/dist/runtime.d.ts.map +1 -1
  249. package/lib/workflows/dist/runtime.js +6 -7
  250. package/lib/workflows/dist/runtime.js.map +1 -1
  251. package/lib/workflows/dist/scheduled-helpers.d.ts.map +1 -1
  252. package/lib/workflows/dist/scheduled-helpers.js +3 -2
  253. package/lib/workflows/dist/scheduled-helpers.js.map +1 -1
  254. package/lib/workflows/dist/scheduled.d.ts.map +1 -1
  255. package/lib/workflows/dist/scheduled.js +2 -1
  256. package/lib/workflows/dist/scheduled.js.map +1 -1
  257. package/lib/workflows/package.json +1 -1
  258. package/lib/workflows/src/children-definition.ts +10 -3
  259. package/lib/workflows/src/children-runtime.ts +3 -2
  260. package/lib/workflows/src/definition.ts +9 -2
  261. package/lib/workflows/src/graph-definition.ts +10 -3
  262. package/lib/workflows/src/lifecycle-definition.ts +10 -3
  263. package/lib/workflows/src/lifecycle-runtime.ts +4 -4
  264. package/lib/workflows/src/node-batches.ts +21 -0
  265. package/lib/workflows/src/operator-transports.ts +3 -1
  266. package/lib/workflows/src/runtime.ts +6 -6
  267. package/lib/workflows/src/scheduled-helpers.ts +3 -2
  268. package/lib/workflows/src/scheduled.ts +2 -1
  269. package/lib/workstream/package.json +1 -1
  270. package/llms-full.txt +1442 -281
  271. package/llms.txt +17 -3
  272. package/package.json +4 -4
  273. package/lib/cli/starters/cli-agent/dot-github/workflows/ci.yml +0 -13
  274. package/lib/cli/starters/cli-agent/dot-gitignore +0 -10
  275. package/lib/cli/starters/event-automation/dot-dockerignore +0 -7
  276. package/lib/cli/starters/event-automation/dot-github/workflows/ci.yml +0 -13
  277. package/lib/cli/starters/event-automation/src/model.ts +0 -40
  278. package/lib/cli/starters/event-automation/tsconfig.json +0 -20
  279. package/lib/cli/starters/nextjs/Dockerfile +0 -12
  280. package/lib/cli/starters/nextjs/compose.yaml +0 -19
  281. package/lib/cli/starters/nextjs/dot-dockerignore +0 -11
  282. package/lib/cli/starters/nextjs/dot-env.example +0 -7
  283. package/lib/cli/starters/nextjs/scripts/setup.mjs +0 -9
  284. package/lib/cli/starters/nextjs/server/application.mjs +0 -74
  285. package/lib/cli/starters/nextjs/server/auth.mjs +0 -24
  286. package/lib/cli/starters/nextjs/server/worker.mjs +0 -11
  287. package/lib/cli/starters/nextjs/server/workflows.mjs +0 -23
  288. package/lib/cli/starters/nextjs/src/ChatApp.jsx +0 -57
  289. package/lib/cli/starters/nextjs/src/Notebook.jsx +0 -25
  290. package/lib/cli/starters/nextjs/src/components/mayura/approval.tsx +0 -142
  291. package/lib/cli/starters/nextjs/src/components/mayura/thread-history.tsx +0 -142
  292. package/lib/cli/starters/nextjs/src/components/mayura/thread-list.tsx +0 -9
  293. package/lib/cli/starters/nextjs/src/components/mayura/ui.css +0 -14
  294. package/lib/cli/starters/nextjs/src/connect.js +0 -21
  295. package/lib/cli/starters/nextjs/src/session.js +0 -138
  296. package/lib/cli/starters/nextjs/src/style.css +0 -11
  297. package/lib/cli/starters/nextjs/test/server.test.mjs +0 -95
  298. package/lib/cli/starters/nextjs/test/session.test.mjs +0 -16
  299. package/lib/cli/starters/nuxt/compose.yaml +0 -19
  300. package/lib/cli/starters/nuxt/dot-dockerignore +0 -11
  301. package/lib/cli/starters/nuxt/dot-env.example +0 -7
  302. package/lib/cli/starters/nuxt/dot-gitignore +0 -14
  303. package/lib/cli/starters/nuxt/scripts/setup.mjs +0 -9
  304. package/lib/cli/starters/nuxt/server/application.mjs +0 -74
  305. package/lib/cli/starters/nuxt/server/auth.mjs +0 -24
  306. package/lib/cli/starters/nuxt/server/worker.mjs +0 -11
  307. package/lib/cli/starters/nuxt/server/workflows.mjs +0 -23
  308. package/lib/cli/starters/nuxt/src/connect.js +0 -21
  309. package/lib/cli/starters/nuxt/src/session.js +0 -138
  310. package/lib/cli/starters/nuxt/src/style.css +0 -11
  311. package/lib/cli/starters/nuxt/test/server.test.mjs +0 -95
  312. package/lib/cli/starters/nuxt/test/session.test.mjs +0 -16
  313. package/lib/cli/starters/react-router/Dockerfile +0 -12
  314. package/lib/cli/starters/react-router/compose.yaml +0 -19
  315. package/lib/cli/starters/react-router/dot-dockerignore +0 -11
  316. package/lib/cli/starters/react-router/dot-env.example +0 -7
  317. package/lib/cli/starters/react-router/dot-gitignore +0 -14
  318. package/lib/cli/starters/react-router/scripts/setup.mjs +0 -9
  319. package/lib/cli/starters/react-router/server/application.mjs +0 -74
  320. package/lib/cli/starters/react-router/server/auth.mjs +0 -24
  321. package/lib/cli/starters/react-router/server/worker.mjs +0 -11
  322. package/lib/cli/starters/react-router/server/workflows.mjs +0 -23
  323. package/lib/cli/starters/react-router/src/ChatApp.jsx +0 -57
  324. package/lib/cli/starters/react-router/src/Notebook.jsx +0 -25
  325. package/lib/cli/starters/react-router/src/components/mayura/approval.tsx +0 -142
  326. package/lib/cli/starters/react-router/src/components/mayura/thread-history.tsx +0 -142
  327. package/lib/cli/starters/react-router/src/components/mayura/thread-list.tsx +0 -9
  328. package/lib/cli/starters/react-router/src/components/mayura/ui.css +0 -14
  329. package/lib/cli/starters/react-router/src/connect.js +0 -21
  330. package/lib/cli/starters/react-router/src/session.js +0 -138
  331. package/lib/cli/starters/react-router/src/style.css +0 -11
  332. package/lib/cli/starters/react-router/src/vite-env.d.ts +0 -1
  333. package/lib/cli/starters/react-router/test/server.test.mjs +0 -95
  334. package/lib/cli/starters/react-router/test/session.test.mjs +0 -16
  335. package/lib/cli/starters/research-team/dot-dockerignore +0 -7
  336. package/lib/cli/starters/research-team/dot-github/workflows/ci.yml +0 -13
  337. package/lib/cli/starters/research-team/dot-gitignore +0 -10
  338. package/lib/cli/starters/research-team/src/model.ts +0 -40
  339. package/lib/cli/starters/research-team/tsconfig.json +0 -20
  340. package/lib/cli/starters/support-agent/dot-dockerignore +0 -7
  341. package/lib/cli/starters/support-agent/dot-github/workflows/ci.yml +0 -13
  342. package/lib/cli/starters/support-agent/dot-gitignore +0 -10
  343. package/lib/cli/starters/support-agent/src/model.ts +0 -40
  344. package/lib/cli/starters/support-agent/tsconfig.json +0 -20
  345. package/lib/cli/starters/sveltekit/Dockerfile +0 -12
  346. package/lib/cli/starters/sveltekit/compose.yaml +0 -19
  347. package/lib/cli/starters/sveltekit/dot-dockerignore +0 -11
  348. package/lib/cli/starters/sveltekit/dot-env.example +0 -7
  349. package/lib/cli/starters/sveltekit/dot-gitignore +0 -14
  350. package/lib/cli/starters/sveltekit/scripts/setup.mjs +0 -9
  351. package/lib/cli/starters/sveltekit/server/application.mjs +0 -74
  352. package/lib/cli/starters/sveltekit/server/auth.mjs +0 -24
  353. package/lib/cli/starters/sveltekit/server/worker.mjs +0 -11
  354. package/lib/cli/starters/sveltekit/server/workflows.mjs +0 -23
  355. package/lib/cli/starters/sveltekit/src/connect.js +0 -21
  356. package/lib/cli/starters/sveltekit/src/session.js +0 -138
  357. package/lib/cli/starters/sveltekit/src/style.css +0 -11
  358. package/lib/cli/starters/sveltekit/src/view.js +0 -49
  359. package/lib/cli/starters/sveltekit/test/server.test.mjs +0 -95
  360. package/lib/cli/starters/sveltekit/test/session.test.mjs +0 -16
  361. package/lib/cli/starters/tanstack-start/Dockerfile +0 -12
  362. package/lib/cli/starters/tanstack-start/compose.yaml +0 -19
  363. package/lib/cli/starters/tanstack-start/dot-dockerignore +0 -11
  364. package/lib/cli/starters/tanstack-start/dot-env.example +0 -7
  365. package/lib/cli/starters/tanstack-start/dot-gitignore +0 -14
  366. package/lib/cli/starters/tanstack-start/scripts/setup.mjs +0 -9
  367. package/lib/cli/starters/tanstack-start/server/application.mjs +0 -74
  368. package/lib/cli/starters/tanstack-start/server/auth.mjs +0 -24
  369. package/lib/cli/starters/tanstack-start/server/worker.mjs +0 -11
  370. package/lib/cli/starters/tanstack-start/server/workflows.mjs +0 -23
  371. package/lib/cli/starters/tanstack-start/src/ChatApp.jsx +0 -57
  372. package/lib/cli/starters/tanstack-start/src/Notebook.jsx +0 -25
  373. package/lib/cli/starters/tanstack-start/src/components/mayura/approval.tsx +0 -142
  374. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-history.tsx +0 -142
  375. package/lib/cli/starters/tanstack-start/src/components/mayura/thread-list.tsx +0 -9
  376. package/lib/cli/starters/tanstack-start/src/components/mayura/ui.css +0 -14
  377. package/lib/cli/starters/tanstack-start/src/connect.js +0 -21
  378. package/lib/cli/starters/tanstack-start/src/session.js +0 -138
  379. package/lib/cli/starters/tanstack-start/src/style.css +0 -11
  380. package/lib/cli/starters/tanstack-start/test/server.test.mjs +0 -95
  381. package/lib/cli/starters/tanstack-start/test/session.test.mjs +0 -16
  382. /package/lib/cli/{starters/hono/src/components/mayura/ui.css → starter-assets/011cacc77ada0de5b447674e9fc4374a247b9a46eb169722b12649753f24188f} +0 -0
  383. /package/lib/cli/{starters/hono/test/server.test.mjs → starter-assets/0c825d6a776673ec6274cfc29cd45b1a8c56dcb880c291a91075c77e1ef1e4f3} +0 -0
  384. /package/lib/cli/{starters/hono/server/auth.mjs → starter-assets/0dd570bfacc357d23be3340250090b9a4c6193a49cdd02e9b6789e7bee8433dd} +0 -0
  385. /package/lib/cli/{starters/hono/src/components/mayura/approval.tsx → starter-assets/11292bd14cdaf27a8f8317ba4ab768d706a726b2e26474b599f3db116674b4b3} +0 -0
  386. /package/lib/cli/{starters/nextjs/dot-gitignore → starter-assets/1873b02e070347f9a449e07084242982fa6af412c45aa764985d553975b64589} +0 -0
  387. /package/lib/cli/{starters/hono/src/style.css → starter-assets/2f3869e6d69134e43be713c4590bfe48896a5c54ece6ffc1a4f204cfcfe54218} +0 -0
  388. /package/lib/cli/{starters/hono/server/worker.mjs → starter-assets/350d77757f548369beff29d658cf1620752d4e23b4b732d99a1b403ca043137f} +0 -0
  389. /package/lib/cli/{starters/approval-workflow/src/model.ts → starter-assets/37294d24c04b71eaf6d6f0bd52fd4c1cc7a5d3cb63da9c7920ed1d44276da9cb} +0 -0
  390. /package/lib/cli/{starters/approval-workflow/tsconfig.json → starter-assets/4387d6537dd5924ae62326aa3d7d8cbad1e5abd930aecc9daa6fab1ac2f6ef24} +0 -0
  391. /package/lib/cli/{starters/hono/dot-dockerignore → starter-assets/4434be031b58cc6ee680b2860b2ad1fe4089af7ee866c13223dfb621dd042ff1} +0 -0
  392. /package/lib/cli/{starters/hono/src/ChatApp.jsx → starter-assets/46e199317648a076243d6c8e7ffedc48785a6ffc0f203b88c7c4a9479b34c5b9} +0 -0
  393. /package/lib/cli/{starters/hono/src/components/mayura/thread-history.tsx → starter-assets/4741fccbca2e0d2fc6f61d11af3cf7bcc5f0238b67bb46282287207abdc6c536} +0 -0
  394. /package/lib/cli/{starters/approval-workflow/dot-dockerignore → starter-assets/4be664708b0120da5d2b73c5a27968093da06b8728f88f2bda2a1ccbf40f6891} +0 -0
  395. /package/lib/cli/{starters/hono/server/workflows.mjs → starter-assets/4d11f729672df54969a851494877a3c5aee24bb8f8c68eacaaa22e715bf5ed69} +0 -0
  396. /package/lib/cli/{starters/hono/dot-env.example → starter-assets/4f141323062660c4dc5b563300d57bb4cdbdc7fe9bfba96e43d9c64bb274474e} +0 -0
  397. /package/lib/cli/{starters/hono/Dockerfile → starter-assets/5471b74c46258d1edb00eb8f60f4219c389a252f7e224f2692f8f3e71ae43e3e} +0 -0
  398. /package/lib/cli/{starters/hono/scripts/setup.mjs → starter-assets/56e2d6db9fe4b0449c979acd06947a5b776bcc645184b54b8d3654a48bd12c38} +0 -0
  399. /package/lib/cli/{starters/hono/src/Notebook.jsx → starter-assets/6138d1e2ca4469daf4f5545d140943f6e23b0c37f865051b266ec99695cf181a} +0 -0
  400. /package/lib/cli/{starters/hono/src/vite-env.d.ts → starter-assets/65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5} +0 -0
  401. /package/lib/cli/{starters/hono/server/application.mjs → starter-assets/757f43c27415654049ecf01b67d560c83d788108d1aebcf1f16a86d956bd7fb6} +0 -0
  402. /package/lib/cli/{starters/hono/src/components/mayura/thread-list.tsx → starter-assets/97601d0bf331df7bbde88f7ee269610bc8a1239f8eeb58fded6416e588a5b7dd} +0 -0
  403. /package/lib/cli/{starters/approval-workflow/dot-github/workflows/ci.yml → starter-assets/aa4182c76778ba2194ecbfde9a960c20181534fd1ab484df126278dbc6eb0186} +0 -0
  404. /package/lib/cli/{starters/hono/src/session.js → starter-assets/abcc6ebd29ba47a079befb6568054dec8f43d4c729187e4a3610af39789e77be} +0 -0
  405. /package/lib/cli/{starters/hono/compose.yaml → starter-assets/cc1df6f5ce0eebffc567ecea1d599eba97cd1b94ab01551085c0eb87a28e3a6c} +0 -0
  406. /package/lib/cli/{starters/hono/src/connect.js → starter-assets/cd3ddb959b277e7d495cc020a6f8146acfbcc9d05ececa3809e8aafcf84504d9} +0 -0
  407. /package/lib/cli/{starters/hono/test/session.test.mjs → starter-assets/dfe75fd07538427d80ba76767e037e929664c80ff5a41b7544496a789181bb73} +0 -0
  408. /package/lib/cli/{starters/approval-workflow/dot-gitignore → starter-assets/f3ef7285253ec9668732f535306beee602e91cb6e20f83d4799b3323399ce569} +0 -0
  409. /package/lib/cli/{starters/nuxt/src/view.js → starter-assets/ff840fe960683d377e78f731b5d4318adf6050384791fa20e4948d34192aa35d} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-format5.js","sourceRoot":"","sources":["../src/workflow-format5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAA4D,MAAM,uBAAuB,CAAC;AAqHlI,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AACrE,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,UAAU,GAAG,IAAI,GAAG,CAA6B,CAAC,aAAa,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACxG,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,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CAAC,eAAe,CAAC,CAAC,CAAC;gBAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YAClH,CAAC;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,MAAM;gBAAE,OAAO,EAAE,CAAC;YAC9C,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAE,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,OAAO,EAAE,CAAC;IAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';\nimport { StorageError, type StoredRecord } from './contracts.js';\nimport type { WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';\nimport { workflowManifest, workflowState, type WorkflowFormat2Step, type WorkflowFormat2StepStatus } from './workflow-format2.js';\n\nexport type WorkflowLifecycleHumanKind = 'information' | 'correction' | 'plan_selection';\n\nexport interface WorkflowLifecycleHumanNodeManifest {\n readonly kind: 'human';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly requestKind: WorkflowLifecycleHumanKind;\n readonly schemaId: string;\n readonly schemaDigest: string;\n readonly prompt: string;\n readonly context: WorkflowBinding | null;\n readonly subjectDigest: WorkflowBinding | null;\n readonly deadlineAtMs: WorkflowBinding | null;\n readonly when?: WorkflowBinding;\n}\n\nexport interface WorkflowLifecycleTimerNodeManifest {\n readonly kind: 'timer';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly fireAtMs: WorkflowBinding;\n readonly when?: WorkflowBinding;\n}\n\n/**\n * Waits for one named signal delivered from outside the run. `name` is what a sender addresses (unique among the\n * definition's signal nodes); `deadlineAtMs`, when set, times the step out if no signal arrived by then. The payload\n * validator is code, like a tool's validators, and is not part of this material.\n */\nexport interface WorkflowLifecycleSignalNodeManifest {\n readonly kind: 'signal';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly name: string;\n readonly deadlineAtMs: WorkflowBinding | null;\n readonly when?: WorkflowBinding;\n}\n\n/**\n * Any lifecycle node may carry `when`: a binding over the input or a dependency's output. The node runs only when it\n * resolves to a value other than `null` or `false`; otherwise it is `bypassed` without being admitted or charged.\n * The key is present only when declared, so definitions without it keep their digest.\n */\nexport type WorkflowLifecycleManifestNode = (WorkflowManifestNode & { readonly when?: WorkflowBinding })\n | WorkflowLifecycleHumanNodeManifest\n | WorkflowLifecycleTimerNodeManifest\n | WorkflowLifecycleSignalNodeManifest;\n\n/** Immutable data-only definition material for explicit lifecycle suspension nodes. */\nexport interface WorkflowLifecycleManifest {\n readonly format: 5;\n readonly id: string;\n readonly version: string;\n readonly graph: readonly WorkflowLifecycleManifestNode[];\n readonly result: WorkflowBinding;\n}\n\nexport type WorkflowLifecycleStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';\nexport type WorkflowLifecycleHumanStepStatus = 'pending' | 'waiting' | 'succeeded' | 'timed_out' | 'skipped' | 'bypassed';\nexport type WorkflowLifecycleTimerStepStatus = 'pending' | 'waiting' | 'succeeded' | 'skipped' | 'bypassed';\nexport type WorkflowLifecycleSignalStepStatus = 'pending' | 'waiting' | 'succeeded' | 'timed_out' | 'skipped' | 'bypassed';\n/** `bypassed`: the step's `when` condition did not hold, so it never started. Dependents treat it like success with output `null`. */\nexport type WorkflowLifecycleToolStepStatus = WorkflowFormat2StepStatus | 'bypassed';\nexport type WorkflowLifecycleToolStep = Omit<WorkflowFormat2Step, 'status'> & { status: WorkflowLifecycleToolStepStatus };\n\nexport interface WorkflowLifecycleHumanStep {\n readonly kind: 'human';\n status: WorkflowLifecycleHumanStepStatus;\n readonly callId: string;\n output: JsonValue;\n requestDigest: string | null;\n responseDigest: string | null;\n actorId: string | null;\n deadlineAtMs: number | null;\n}\n\nexport interface WorkflowLifecycleTimerStep {\n readonly kind: 'timer';\n status: WorkflowLifecycleTimerStepStatus;\n readonly callId: string;\n output: JsonValue;\n fireAtMs: number | null;\n firedAtMs: number | null;\n}\n\n/**\n * A signal step. A signal delivered before the step starts is kept on the `pending` step (`signalId` set) and\n * completes it as soon as it starts, provided it arrived before the deadline. `output` is the validated payload.\n */\nexport interface WorkflowLifecycleSignalStep {\n readonly kind: 'signal';\n status: WorkflowLifecycleSignalStepStatus;\n readonly callId: string;\n output: JsonValue;\n signalId: string | null;\n payloadDigest: string | null;\n receivedAtMs: number | null;\n deadlineAtMs: number | null;\n}\n\nexport type WorkflowLifecycleStep = WorkflowLifecycleToolStep | WorkflowLifecycleHumanStep | WorkflowLifecycleTimerStep | WorkflowLifecycleSignalStep;\n\nexport interface WorkflowLifecycleState {\n readonly format: 5;\n readonly definition: string;\n readonly policy: string;\n readonly input: JsonValue;\n status: WorkflowLifecycleStatus;\n readonly steps: Record<string, WorkflowLifecycleStep>;\n readonly maxCostMicros: number;\n spentMicros: number;\n reservedMicros: number;\n output: JsonValue;\n}\n\nconst forbidden = new Set(['constructor', 'prototype', '__proto__']);\nconst idPattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;\nconst schemaIdPattern = /^[A-Za-z][A-Za-z0-9._/-]{0,127}$/;\nconst hashPattern = /^[a-f0-9]{64}$/;\nconst humanKinds = new Set<WorkflowLifecycleHumanKind>(['information', 'correction', 'plan_selection']);\nconst lifecycleStatuses = new Set<WorkflowLifecycleStatus>(['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown']);\nconst humanStepStatuses = new Set<WorkflowLifecycleHumanStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped', 'bypassed']);\nconst timerStepStatuses = new Set<WorkflowLifecycleTimerStepStatus>(['pending', 'waiting', 'succeeded', 'skipped', 'bypassed']);\nconst signalStepStatuses = new Set<WorkflowLifecycleSignalStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped', 'bypassed']);\n/** Signal names and ids: what the operator API accepts for `signalName` and `signalId`. */\nconst signalPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;\n/** Statuses a dependent step may build on. */\nconst satisfied = new Set(['succeeded', 'bypassed']);\n\nfunction invalid(): never {\n throw new StorageError('INVALID_INPUT', 'Invalid bounded workflow lifecycle metadata.');\n}\n\nfunction corrupt(): never {\n throw new StorageError('CONFLICT', 'Stored workflow lifecycle state failed integrity validation.');\n}\n\nfunction object(value: JsonValue | undefined): JsonObject {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) invalid();\n return value;\n}\n\nfunction fields(value: JsonObject, names: readonly string[]): void {\n if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value, name))) invalid();\n}\n\nfunction integer(value: unknown, minimum = 0): number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum) invalid();\n return value;\n}\n\nfunction hash(value: unknown): string {\n if (typeof value !== 'string' || !hashPattern.test(value)) invalid();\n return value;\n}\n\nfunction identity(value: unknown, maximum = 256): string {\n if (typeof value !== 'string' || value.length < 1 || value.length > maximum || value.includes('\\0')) invalid();\n return value;\n}\n\nfunction canonical(value: JsonValue): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value);\n if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;\n return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key]!)}`).join(',')}}`;\n}\n\nfunction binding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = object(value);\n if (candidate['kind'] === 'literal') fields(candidate, ['kind', 'value']);\n else if (candidate['kind'] === 'input' || candidate['kind'] === 'step') {\n fields(candidate, candidate['kind'] === 'input' ? ['kind', 'path'] : ['kind', 'stepId', 'path']);\n if (!Array.isArray(candidate['path']) || candidate['path'].length > 32\n || candidate['path'].some(segment => typeof segment !== 'string' || forbidden.has(segment))) invalid();\n if (candidate['kind'] === 'step') {\n if (typeof candidate['stepId'] !== 'string' || !ids.has(candidate['stepId'])\n || !dependencies.includes(candidate['stepId'])) invalid();\n }\n } else invalid();\n return candidate as unknown as WorkflowBinding;\n}\n\nfunction temporalBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = binding(value, ids, dependencies);\n if (candidate.kind === 'literal' && (typeof candidate.value !== 'number'\n || !Number.isSafeInteger(candidate.value) || candidate.value < 0)) invalid();\n return candidate;\n}\n\nfunction digestBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = binding(value, ids, dependencies);\n if (candidate.kind === 'literal' && (typeof candidate.value !== 'string' || !hashPattern.test(candidate.value))) invalid();\n return candidate;\n}\n\n/**\n * Strict format-5 decoder. It deliberately reuses the immutable format-2 graph\n * projection for common tool/join validation while retaining lifecycle nodes.\n */\nexport function workflowLifecycleManifest(value: unknown): WorkflowLifecycleManifest {\n try {\n const manifest = object(jsonValue(value));\n fields(manifest, ['format', 'id', 'version', 'graph', 'result']);\n if (manifest['format'] !== 5 || !Array.isArray(manifest['graph'])) invalid();\n const graph = manifest['graph'];\n if (graph.length < 1 || graph.length > 128) invalid();\n\n const projected = graph.map(raw => {\n const node = object(raw);\n if (node['kind'] === 'tool' || node['kind'] === 'join') {\n if (!Object.hasOwn(node, 'when')) return node;\n const { when: _when, ...rest } = node; return rest;\n }\n if (node['kind'] !== 'human' && node['kind'] !== 'timer' && node['kind'] !== 'signal') invalid();\n return { kind: 'join', id: node['id'], dependsOn: node['dependsOn'] };\n });\n const common = workflowManifest({ id: manifest['id'], version: manifest['version'], graph: projected, result: manifest['result'] });\n const ids = new Set(common.graph.map(node => node.id));\n let humans = 0; let timers = 0; const signals = new Set<string>();\n\n for (const raw of graph) {\n const node = object(raw);\n const id = typeof node['id'] === 'string' && idPattern.test(node['id']) ? node['id'] : invalid();\n const projectedNode = common.graph.find(item => item.id === id)!;\n const dependencies = projectedNode.dependsOn;\n const conditional = Object.hasOwn(node, 'when');\n if (conditional) binding(node['when'], ids, dependencies);\n if (node['kind'] === 'tool' || node['kind'] === 'join') continue;\n const optional = conditional ? ['when'] : [];\n if (node['kind'] === 'timer') {\n timers += 1;\n fields(node, ['kind', 'id', 'dependsOn', 'fireAtMs', ...optional]);\n temporalBinding(node['fireAtMs'], ids, dependencies);\n continue;\n }\n if (node['kind'] === 'signal') {\n fields(node, ['kind', 'id', 'dependsOn', 'name', 'deadlineAtMs', ...optional]);\n if (typeof node['name'] !== 'string' || !signalPattern.test(node['name']) || signals.has(node['name'])) invalid();\n signals.add(node['name']);\n if (node['deadlineAtMs'] !== null) temporalBinding(node['deadlineAtMs'], ids, dependencies);\n continue;\n }\n humans += 1;\n fields(node, ['kind', 'id', 'dependsOn', 'requestKind', 'schemaId', 'schemaDigest', 'prompt', 'context', 'subjectDigest', 'deadlineAtMs', ...optional]);\n if (!humanKinds.has(node['requestKind'] as WorkflowLifecycleHumanKind)\n || typeof node['schemaId'] !== 'string' || !schemaIdPattern.test(node['schemaId'])\n || typeof node['schemaDigest'] !== 'string' || !hashPattern.test(node['schemaDigest'])\n || typeof node['prompt'] !== 'string' || node['prompt'].length < 1\n || new TextEncoder().encode(node['prompt']).byteLength > 1_024) invalid();\n if ((node['requestKind'] === 'correction') !== (node['subjectDigest'] !== null)) invalid();\n if (node['context'] !== null) binding(node['context'], ids, dependencies);\n if (node['subjectDigest'] !== null) digestBinding(node['subjectDigest'], ids, dependencies);\n if (node['deadlineAtMs'] !== null) temporalBinding(node['deadlineAtMs'], ids, dependencies);\n }\n if (humans > 32 || timers > 64 || signals.size > 64) invalid();\n return freezeJson(manifest) as unknown as WorkflowLifecycleManifest;\n } catch {\n return invalid();\n }\n}\n\n/** Construct a detached initial state without activating any suspension or effect. */\nexport function initialWorkflowLifecycleState(\n definition: WorkflowLifecycleManifest,\n input: JsonValue,\n definitionHash: string,\n policyHash: string,\n maxCostMicros: number,\n): WorkflowLifecycleState {\n try {\n const manifest = workflowLifecycleManifest(definition);\n hash(definitionHash); hash(policyHash); integer(maxCostMicros);\n return jsonValue({\n format: 5, definition: definitionHash, policy: policyHash, input, status: 'running',\n steps: Object.fromEntries(manifest.graph.map(node => [node.id,\n node.kind === 'human'\n ? { kind: 'human', status: 'pending', callId: `step:${node.id}`, output: null,\n requestDigest: null, responseDigest: null, actorId: null, deadlineAtMs: null }\n : node.kind === 'timer'\n ? { kind: 'timer', status: 'pending', callId: `step:${node.id}`, output: null,\n fireAtMs: null, firedAtMs: null }\n : node.kind === 'signal'\n ? { kind: 'signal', status: 'pending', callId: `step:${node.id}`, output: null,\n signalId: null, payloadDigest: null, receivedAtMs: null, deadlineAtMs: null }\n : { kind: node.kind, status: 'pending', callId: `step:${node.id}`, output: null,\n receipt: null, approval: null, costReserved: 0, candidateHash: null },\n ])),\n maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,\n }) as unknown as WorkflowLifecycleState;\n } catch { return invalid(); }\n}\n\n/** Strictly decode a mutable format-5 state copy suitable for a checked transition. */\nexport function workflowLifecycleState(record: Pick<StoredRecord, 'id' | 'state'>): WorkflowLifecycleState {\n try {\n const idDescriptor = Object.getOwnPropertyDescriptor(record, 'id');\n const stateDescriptor = Object.getOwnPropertyDescriptor(record, 'state');\n if (!idDescriptor || !('value' in idDescriptor) || !stateDescriptor || !('value' in stateDescriptor)) invalid();\n const runId = identity(idDescriptor.value, 512);\n const state = object(jsonValue(stateDescriptor.value));\n fields(state, ['format', 'definition', 'policy', 'input', 'status', 'steps', 'maxCostMicros', 'spentMicros', 'reservedMicros', 'output']);\n if (state['format'] !== 5 || !lifecycleStatuses.has(state['status'] as WorkflowLifecycleStatus)) invalid();\n const definitionHash = hash(state['definition']); const policyHash = hash(state['policy']);\n const input = jsonValue(state['input']);\n const maxCostMicros = integer(state['maxCostMicros']); const spentMicros = integer(state['spentMicros']); const reservedMicros = integer(state['reservedMicros']);\n if (spentMicros > maxCostMicros - reservedMicros) invalid();\n const steps = object(state['steps']); const entries = Object.entries(steps);\n if (entries.length < 1 || entries.length > 128) invalid();\n const common: Record<string, JsonValue> = {}; let computedReserved = 0; let waiting = 0;\n for (const [id, raw] of entries) {\n if (!idPattern.test(id) || forbidden.has(id)) invalid();\n const step = object(raw);\n if (step['callId'] !== `step:${id}`) invalid();\n if (step['kind'] === 'tool' || step['kind'] === 'join') {\n if (step['status'] === 'bypassed') {\n if (step['output'] !== null || step['receipt'] !== null || step['approval'] !== null || step['costReserved'] !== 0 || step['candidateHash'] !== null) invalid();\n common[id] = { ...step, status: 'skipped' }; continue;\n }\n common[id] = step; computedReserved += integer(step['costReserved']);\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n if (step['kind'] === 'human') {\n fields(step, ['kind', 'status', 'callId', 'output', 'requestDigest', 'responseDigest', 'actorId', 'deadlineAtMs']);\n if (!humanStepStatuses.has(step['status'] as WorkflowLifecycleHumanStepStatus)) invalid();\n if (step['requestDigest'] !== null) hash(step['requestDigest']);\n if (step['responseDigest'] !== null) hash(step['responseDigest']);\n if (step['actorId'] !== null) identity(step['actorId']);\n if (step['deadlineAtMs'] !== null) integer(step['deadlineAtMs']);\n if (step['status'] === 'pending' && [step['requestDigest'], step['responseDigest'], step['actorId'], step['deadlineAtMs'], step['output']].some(value => value !== null)) invalid();\n if (step['status'] === 'waiting' && (step['requestDigest'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();\n if (step['status'] === 'succeeded' && (step['requestDigest'] === null || step['responseDigest'] === null || step['actorId'] === null)) invalid();\n if (step['status'] === 'timed_out' && (step['requestDigest'] === null || step['deadlineAtMs'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();\n if ((step['status'] === 'skipped' || step['status'] === 'bypassed') && (step['requestDigest'] !== null || step['responseDigest'] !== null || step['actorId'] !== null || step['deadlineAtMs'] !== null || step['output'] !== null)) invalid();\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n if (step['kind'] === 'timer') {\n fields(step, ['kind', 'status', 'callId', 'output', 'fireAtMs', 'firedAtMs']);\n if (!timerStepStatuses.has(step['status'] as WorkflowLifecycleTimerStepStatus)) invalid();\n if (step['fireAtMs'] !== null) integer(step['fireAtMs']);\n if (step['firedAtMs'] !== null) integer(step['firedAtMs']);\n if (step['status'] === 'pending' || step['status'] === 'skipped' || step['status'] === 'bypassed') {\n if (step['fireAtMs'] !== null || step['firedAtMs'] !== null || step['output'] !== null) invalid();\n } else if (step['status'] === 'waiting') {\n if (step['fireAtMs'] === null || step['firedAtMs'] !== null || step['output'] !== null) invalid();\n waiting += 1;\n } else {\n if (step['fireAtMs'] === null || step['firedAtMs'] === null || Number(step['firedAtMs']) < Number(step['fireAtMs'])\n || canonical(step['output']!) !== canonical(jsonValue({ fireAtMs: step['fireAtMs'], firedAtMs: step['firedAtMs'] }))) invalid();\n }\n continue;\n }\n if (step['kind'] === 'signal') {\n fields(step, ['kind', 'status', 'callId', 'output', 'signalId', 'payloadDigest', 'receivedAtMs', 'deadlineAtMs']);\n if (!signalStepStatuses.has(step['status'] as WorkflowLifecycleSignalStepStatus)) invalid();\n if (step['signalId'] !== null && (typeof step['signalId'] !== 'string' || !signalPattern.test(step['signalId']))) invalid();\n if (step['payloadDigest'] !== null) hash(step['payloadDigest']);\n if (step['receivedAtMs'] !== null) integer(step['receivedAtMs']);\n if (step['deadlineAtMs'] !== null) integer(step['deadlineAtMs']);\n // A signal is recorded completely or not at all.\n const received = step['signalId'] !== null;\n if ([step['payloadDigest'], step['receivedAtMs']].some(value => (value !== null) !== received) || (!received && step['output'] !== null)) invalid();\n if (step['status'] === 'pending' && step['deadlineAtMs'] !== null) invalid();\n if (step['status'] === 'succeeded' && !received) invalid();\n if (step['status'] === 'waiting' && received) invalid();\n if (step['status'] === 'timed_out' && (received || step['deadlineAtMs'] === null)) invalid();\n if ((step['status'] === 'skipped' || step['status'] === 'bypassed') && (received || step['deadlineAtMs'] !== null)) invalid();\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n invalid();\n }\n if (computedReserved !== reservedMicros) invalid();\n if (Object.keys(common).length > 0) workflowState({ id: runId, state: {\n format: 2, definition: definitionHash, policy: policyHash, input, status: 'running',\n steps: common, maxCostMicros, spentMicros, reservedMicros, output: null,\n } });\n if (state['status'] === 'waiting' && waiting === 0) invalid();\n if (!['running', 'waiting', 'paused'].includes(state['status'] as string) && waiting > 0) invalid();\n if (state['status'] === 'succeeded' && entries.some(([, raw]) => !satisfied.has(object(raw)['status'] as string))) invalid();\n if (state['status'] !== 'succeeded' && state['output'] !== null) invalid();\n return state as unknown as WorkflowLifecycleState;\n } catch { return corrupt(); }\n}\n\n/** Cross-check state node identities, kinds and successful dependency evidence. */\nexport function assertWorkflowLifecycleStateMatchesManifest(\n state: WorkflowLifecycleState,\n definition: WorkflowLifecycleManifest,\n): void {\n try {\n const manifest = workflowLifecycleManifest(definition);\n const value = object(jsonValue(state)); const steps = object(value['steps']);\n if (Object.keys(steps).length !== manifest.graph.length) invalid();\n for (const node of manifest.graph) {\n const step = object(steps[node.id]);\n if (step['kind'] !== node.kind) invalid();\n // A step is bypassed only when it declares a condition, and only after its dependencies were satisfied.\n if (step['status'] === 'bypassed' && !Object.hasOwn(node, 'when')) invalid();\n if (satisfied.has(step['status'] as string) && node.dependsOn.some(id => !satisfied.has(object(steps[id])['status'] as string))) invalid();\n if (node.kind === 'tool') {\n if (step['receipt'] !== null && object(step['receipt'])['toolId'] !== node.tool) invalid();\n if (integer(step['costReserved']) > node.costMicros) invalid();\n }\n if ((node.kind === 'human' || node.kind === 'signal') && step['deadlineAtMs'] !== null && node.deadlineAtMs === null) invalid();\n }\n } catch { return corrupt(); }\n}\n\n/** Return detached outputs only for successfully completed nodes; a bypassed node's output is `null`. */\nexport function workflowLifecycleOutputs(state: WorkflowLifecycleState): Record<string, JsonValue> {\n try {\n const steps = object(object(jsonValue(state))['steps']);\n return Object.fromEntries(Object.entries(steps).filter(([, raw]) => satisfied.has(object(raw)['status'] as string))\n .map(([id, raw]) => {\n const step = object(raw);\n if (step['status'] === 'bypassed') return [id, null];\n if (step['kind'] === 'tool') {\n const evidence = object(step['receipt']);\n if (evidence['execution'] !== 'succeeded' || evidence['disclosure'] !== 'released'\n || step['candidateHash'] === null || integer(step['costReserved']) !== 0) invalid();\n } else if (step['kind'] === 'human') {\n hash(step['requestDigest']); hash(step['responseDigest']); identity(step['actorId']);\n } else if (step['kind'] === 'timer') {\n const fireAtMs = integer(step['fireAtMs']); const firedAtMs = integer(step['firedAtMs']);\n if (firedAtMs < fireAtMs || canonical(step['output']!) !== canonical(jsonValue({ fireAtMs, firedAtMs }))) invalid();\n } else if (step['kind'] === 'signal') {\n if (typeof step['signalId'] !== 'string') invalid(); hash(step['payloadDigest']); integer(step['receivedAtMs']);\n } else if (step['kind'] !== 'join') invalid();\n return [id, step['output']!];\n }));\n } catch { return corrupt(); }\n}\n"]}
1
+ {"version":3,"file":"workflow-format5.js","sourceRoot":"","sources":["../src/workflow-format5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAmC,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAA4D,MAAM,uBAAuB,CAAC;AAyHlI,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AACrE,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,MAAM,eAAe,GAAG,kCAAkC,CAAC;AAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,UAAU,GAAG,IAAI,GAAG,CAA6B,CAAC,aAAa,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACxG,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAA0B,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EA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,CAAC;IAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { workflowNodeLimit } from '@mayura/core';\nimport { freezeJson, jsonValue, type JsonObject, type JsonValue } from '@mayura/core';\nimport { StorageError, type StoredRecord } from './contracts.js';\nimport type { WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';\nimport { workflowManifest, workflowState, type WorkflowFormat2Step, type WorkflowFormat2StepStatus } from './workflow-format2.js';\n\nexport type WorkflowLifecycleHumanKind = 'information' | 'correction' | 'plan_selection';\n\nexport interface WorkflowLifecycleHumanNodeManifest {\n readonly kind: 'human';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly requestKind: WorkflowLifecycleHumanKind;\n readonly schemaId: string;\n readonly schemaDigest: string;\n readonly prompt: string;\n readonly context: WorkflowBinding | null;\n readonly subjectDigest: WorkflowBinding | null;\n readonly deadlineAtMs: WorkflowBinding | null;\n readonly when?: WorkflowBinding;\n}\n\nexport interface WorkflowLifecycleTimerNodeManifest {\n readonly kind: 'timer';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly fireAtMs: WorkflowBinding;\n readonly when?: WorkflowBinding;\n}\n\n/**\n * Waits for one named signal delivered from outside the run. `name` is what a sender addresses (unique among the\n * definition's signal nodes); `deadlineAtMs`, when set, times the step out if no signal arrived by then. The payload\n * validator is code, like a tool's validators, and is not part of this material.\n */\nexport interface WorkflowLifecycleSignalNodeManifest {\n readonly kind: 'signal';\n readonly id: string;\n readonly dependsOn: readonly string[];\n readonly name: string;\n readonly deadlineAtMs: WorkflowBinding | null;\n readonly when?: WorkflowBinding;\n}\n\n/**\n * Any lifecycle node may carry `when`: a binding over the input or a dependency's output. The node runs only when it\n * resolves to a value other than `null` or `false`; otherwise it is `bypassed` without being admitted or charged.\n * The key is present only when declared, so definitions without it keep their digest.\n */\nexport type WorkflowLifecycleManifestNode = (WorkflowManifestNode & { readonly when?: WorkflowBinding })\n | WorkflowLifecycleHumanNodeManifest\n | WorkflowLifecycleTimerNodeManifest\n | WorkflowLifecycleSignalNodeManifest;\n\n/** Immutable data-only definition material for explicit lifecycle suspension nodes. */\nexport interface WorkflowLifecycleManifest {\n /** Explicit graph bound; omitted records retain the 128-node default. */\n readonly maxNodes?: number | false;\n readonly format: 5;\n readonly id: string;\n readonly version: string;\n readonly graph: readonly WorkflowLifecycleManifestNode[];\n readonly result: WorkflowBinding;\n}\n\nexport type WorkflowLifecycleStatus = 'running' | 'waiting' | 'paused' | 'succeeded' | 'failed' | 'blocked' | 'cancelled' | 'outcome_unknown';\nexport type WorkflowLifecycleHumanStepStatus = 'pending' | 'waiting' | 'succeeded' | 'timed_out' | 'skipped' | 'bypassed';\nexport type WorkflowLifecycleTimerStepStatus = 'pending' | 'waiting' | 'succeeded' | 'skipped' | 'bypassed';\nexport type WorkflowLifecycleSignalStepStatus = 'pending' | 'waiting' | 'succeeded' | 'timed_out' | 'skipped' | 'bypassed';\n/** `bypassed`: the step's `when` condition did not hold, so it never started. Dependents treat it like success with output `null`. */\nexport type WorkflowLifecycleToolStepStatus = WorkflowFormat2StepStatus | 'bypassed';\nexport type WorkflowLifecycleToolStep = Omit<WorkflowFormat2Step, 'status'> & { status: WorkflowLifecycleToolStepStatus };\n\nexport interface WorkflowLifecycleHumanStep {\n readonly kind: 'human';\n status: WorkflowLifecycleHumanStepStatus;\n readonly callId: string;\n output: JsonValue;\n requestDigest: string | null;\n responseDigest: string | null;\n actorId: string | null;\n deadlineAtMs: number | null;\n}\n\nexport interface WorkflowLifecycleTimerStep {\n readonly kind: 'timer';\n status: WorkflowLifecycleTimerStepStatus;\n readonly callId: string;\n output: JsonValue;\n fireAtMs: number | null;\n firedAtMs: number | null;\n}\n\n/**\n * A signal step. A signal delivered before the step starts is kept on the `pending` step (`signalId` set) and\n * completes it as soon as it starts, provided it arrived before the deadline. `output` is the validated payload.\n */\nexport interface WorkflowLifecycleSignalStep {\n readonly kind: 'signal';\n status: WorkflowLifecycleSignalStepStatus;\n readonly callId: string;\n output: JsonValue;\n signalId: string | null;\n payloadDigest: string | null;\n receivedAtMs: number | null;\n deadlineAtMs: number | null;\n}\n\nexport type WorkflowLifecycleStep = WorkflowLifecycleToolStep | WorkflowLifecycleHumanStep | WorkflowLifecycleTimerStep | WorkflowLifecycleSignalStep;\n\nexport interface WorkflowLifecycleState {\n /** Explicit graph bound; omitted records retain the 128-node default. */\n readonly maxNodes?: number | false;\n readonly format: 5;\n readonly definition: string;\n readonly policy: string;\n readonly input: JsonValue;\n status: WorkflowLifecycleStatus;\n readonly steps: Record<string, WorkflowLifecycleStep>;\n readonly maxCostMicros: number;\n spentMicros: number;\n reservedMicros: number;\n output: JsonValue;\n}\n\nconst forbidden = new Set(['constructor', 'prototype', '__proto__']);\nconst idPattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;\nconst schemaIdPattern = /^[A-Za-z][A-Za-z0-9._/-]{0,127}$/;\nconst hashPattern = /^[a-f0-9]{64}$/;\nconst humanKinds = new Set<WorkflowLifecycleHumanKind>(['information', 'correction', 'plan_selection']);\nconst lifecycleStatuses = new Set<WorkflowLifecycleStatus>(['running', 'waiting', 'paused', 'succeeded', 'failed', 'blocked', 'cancelled', 'outcome_unknown']);\nconst humanStepStatuses = new Set<WorkflowLifecycleHumanStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped', 'bypassed']);\nconst timerStepStatuses = new Set<WorkflowLifecycleTimerStepStatus>(['pending', 'waiting', 'succeeded', 'skipped', 'bypassed']);\nconst signalStepStatuses = new Set<WorkflowLifecycleSignalStepStatus>(['pending', 'waiting', 'succeeded', 'timed_out', 'skipped', 'bypassed']);\n/** Signal names and ids: what the operator API accepts for `signalName` and `signalId`. */\nconst signalPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;\n/** Statuses a dependent step may build on. */\nconst satisfied = new Set(['succeeded', 'bypassed']);\n\nfunction invalid(): never {\n throw new StorageError('INVALID_INPUT', 'Invalid bounded workflow lifecycle metadata.');\n}\n\nfunction corrupt(): never {\n throw new StorageError('CONFLICT', 'Stored workflow lifecycle state failed integrity validation.');\n}\n\nfunction object(value: JsonValue | undefined): JsonObject {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) invalid();\n return value;\n}\n\nfunction fields(value: JsonObject, names: readonly string[]): void {\n if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value, name))) invalid();\n}\n\nfunction integer(value: unknown, minimum = 0): number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum) invalid();\n return value;\n}\n\nfunction hash(value: unknown): string {\n if (typeof value !== 'string' || !hashPattern.test(value)) invalid();\n return value;\n}\n\nfunction identity(value: unknown, maximum = 256): string {\n if (typeof value !== 'string' || value.length < 1 || value.length > maximum || value.includes('\\0')) invalid();\n return value;\n}\n\nfunction canonical(value: JsonValue): string {\n if (value === null || typeof value !== 'object') return JSON.stringify(value);\n if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;\n return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key]!)}`).join(',')}}`;\n}\n\nfunction binding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = object(value);\n if (candidate['kind'] === 'literal') fields(candidate, ['kind', 'value']);\n else if (candidate['kind'] === 'input' || candidate['kind'] === 'step') {\n fields(candidate, candidate['kind'] === 'input' ? ['kind', 'path'] : ['kind', 'stepId', 'path']);\n if (!Array.isArray(candidate['path']) || candidate['path'].length > 32\n || candidate['path'].some(segment => typeof segment !== 'string' || forbidden.has(segment))) invalid();\n if (candidate['kind'] === 'step') {\n if (typeof candidate['stepId'] !== 'string' || !ids.has(candidate['stepId'])\n || !dependencies.includes(candidate['stepId'])) invalid();\n }\n } else invalid();\n return candidate as unknown as WorkflowBinding;\n}\n\nfunction temporalBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = binding(value, ids, dependencies);\n if (candidate.kind === 'literal' && (typeof candidate.value !== 'number'\n || !Number.isSafeInteger(candidate.value) || candidate.value < 0)) invalid();\n return candidate;\n}\n\nfunction digestBinding(value: JsonValue | undefined, ids: ReadonlySet<string>, dependencies: readonly string[]): WorkflowBinding {\n const candidate = binding(value, ids, dependencies);\n if (candidate.kind === 'literal' && (typeof candidate.value !== 'string' || !hashPattern.test(candidate.value))) invalid();\n return candidate;\n}\n\n/**\n * Strict format-5 decoder. It deliberately reuses the immutable format-2 graph\n * projection for common tool/join validation while retaining lifecycle nodes.\n */\nexport function workflowLifecycleManifest(value: unknown): WorkflowLifecycleManifest {\n try {\n const manifest = object(jsonValue(value));\n fields(manifest, [...['format', 'id', 'version', 'graph', 'result'], ...(Object.hasOwn(manifest, 'maxNodes') ? ['maxNodes'] : [])]);\n if (manifest['format'] !== 5 || !Array.isArray(manifest['graph'])) invalid();\n const graph = manifest['graph'];\n if (graph.length < 1 || graph.length > workflowNodeLimit(manifest['maxNodes'])) invalid();\n\n const projected = graph.map(raw => {\n const node = object(raw);\n if (node['kind'] === 'tool' || node['kind'] === 'join') {\n if (!Object.hasOwn(node, 'when')) return node;\n const { when: _when, ...rest } = node; return rest;\n }\n if (node['kind'] !== 'human' && node['kind'] !== 'timer' && node['kind'] !== 'signal') invalid();\n return { kind: 'join', id: node['id'], dependsOn: node['dependsOn'] };\n });\n const common = workflowManifest({ id: manifest['id'], version: manifest['version'], ...(manifest['maxNodes'] === undefined ? {} : { maxNodes: manifest['maxNodes'] }), graph: projected, result: manifest['result'] });\n const ids = new Set(common.graph.map(node => node.id));\n let humans = 0; let timers = 0; const signals = new Set<string>();\n\n for (const raw of graph) {\n const node = object(raw);\n const id = typeof node['id'] === 'string' && idPattern.test(node['id']) ? node['id'] : invalid();\n const projectedNode = common.graph.find(item => item.id === id)!;\n const dependencies = projectedNode.dependsOn;\n const conditional = Object.hasOwn(node, 'when');\n if (conditional) binding(node['when'], ids, dependencies);\n if (node['kind'] === 'tool' || node['kind'] === 'join') continue;\n const optional = conditional ? ['when'] : [];\n if (node['kind'] === 'timer') {\n timers += 1;\n fields(node, ['kind', 'id', 'dependsOn', 'fireAtMs', ...optional]);\n temporalBinding(node['fireAtMs'], ids, dependencies);\n continue;\n }\n if (node['kind'] === 'signal') {\n fields(node, ['kind', 'id', 'dependsOn', 'name', 'deadlineAtMs', ...optional]);\n if (typeof node['name'] !== 'string' || !signalPattern.test(node['name']) || signals.has(node['name'])) invalid();\n signals.add(node['name']);\n if (node['deadlineAtMs'] !== null) temporalBinding(node['deadlineAtMs'], ids, dependencies);\n continue;\n }\n humans += 1;\n fields(node, ['kind', 'id', 'dependsOn', 'requestKind', 'schemaId', 'schemaDigest', 'prompt', 'context', 'subjectDigest', 'deadlineAtMs', ...optional]);\n if (!humanKinds.has(node['requestKind'] as WorkflowLifecycleHumanKind)\n || typeof node['schemaId'] !== 'string' || !schemaIdPattern.test(node['schemaId'])\n || typeof node['schemaDigest'] !== 'string' || !hashPattern.test(node['schemaDigest'])\n || typeof node['prompt'] !== 'string' || node['prompt'].length < 1\n || new TextEncoder().encode(node['prompt']).byteLength > 1_024) invalid();\n if ((node['requestKind'] === 'correction') !== (node['subjectDigest'] !== null)) invalid();\n if (node['context'] !== null) binding(node['context'], ids, dependencies);\n if (node['subjectDigest'] !== null) digestBinding(node['subjectDigest'], ids, dependencies);\n if (node['deadlineAtMs'] !== null) temporalBinding(node['deadlineAtMs'], ids, dependencies);\n }\n if (humans > 32 || timers > 64 || signals.size > 64) invalid();\n return freezeJson(manifest) as unknown as WorkflowLifecycleManifest;\n } catch {\n return invalid();\n }\n}\n\n/** Construct a detached initial state without activating any suspension or effect. */\nexport function initialWorkflowLifecycleState(\n definition: WorkflowLifecycleManifest,\n input: JsonValue,\n definitionHash: string,\n policyHash: string,\n maxCostMicros: number,\n): WorkflowLifecycleState {\n try {\n const manifest = workflowLifecycleManifest(definition);\n hash(definitionHash); hash(policyHash); integer(maxCostMicros);\n return jsonValue({\n format: 5, ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }), definition: definitionHash, policy: policyHash, input, status: 'running',\n steps: Object.fromEntries(manifest.graph.map(node => [node.id,\n node.kind === 'human'\n ? { kind: 'human', status: 'pending', callId: `step:${node.id}`, output: null,\n requestDigest: null, responseDigest: null, actorId: null, deadlineAtMs: null }\n : node.kind === 'timer'\n ? { kind: 'timer', status: 'pending', callId: `step:${node.id}`, output: null,\n fireAtMs: null, firedAtMs: null }\n : node.kind === 'signal'\n ? { kind: 'signal', status: 'pending', callId: `step:${node.id}`, output: null,\n signalId: null, payloadDigest: null, receivedAtMs: null, deadlineAtMs: null }\n : { kind: node.kind, status: 'pending', callId: `step:${node.id}`, output: null,\n receipt: null, approval: null, costReserved: 0, candidateHash: null },\n ])),\n maxCostMicros, spentMicros: 0, reservedMicros: 0, output: null,\n }) as unknown as WorkflowLifecycleState;\n } catch { return invalid(); }\n}\n\n/** Strictly decode a mutable format-5 state copy suitable for a checked transition. */\nexport function workflowLifecycleState(record: Pick<StoredRecord, 'id' | 'state'>): WorkflowLifecycleState {\n try {\n const idDescriptor = Object.getOwnPropertyDescriptor(record, 'id');\n const stateDescriptor = Object.getOwnPropertyDescriptor(record, 'state');\n if (!idDescriptor || !('value' in idDescriptor) || !stateDescriptor || !('value' in stateDescriptor)) invalid();\n const runId = identity(idDescriptor.value, 512);\n const state = object(jsonValue(stateDescriptor.value));\n fields(state, [...['format', 'definition', 'policy', 'input', 'status', 'steps', 'maxCostMicros', 'spentMicros', 'reservedMicros', 'output'], ...(Object.hasOwn(state, 'maxNodes') ? ['maxNodes'] : [])]);\n if (state['format'] !== 5 || !lifecycleStatuses.has(state['status'] as WorkflowLifecycleStatus)) invalid();\n const definitionHash = hash(state['definition']); const policyHash = hash(state['policy']);\n const input = jsonValue(state['input']);\n const maxCostMicros = integer(state['maxCostMicros']); const spentMicros = integer(state['spentMicros']); const reservedMicros = integer(state['reservedMicros']);\n if (spentMicros > maxCostMicros - reservedMicros) invalid();\n const steps = object(state['steps']); const entries = Object.entries(steps);\n if (entries.length < 1 || entries.length > workflowNodeLimit(state['maxNodes'])) invalid();\n const common: Record<string, JsonValue> = {}; let computedReserved = 0; let waiting = 0;\n for (const [id, raw] of entries) {\n if (!idPattern.test(id) || forbidden.has(id)) invalid();\n const step = object(raw);\n if (step['callId'] !== `step:${id}`) invalid();\n if (step['kind'] === 'tool' || step['kind'] === 'join') {\n if (step['status'] === 'bypassed') {\n if (step['output'] !== null || step['receipt'] !== null || step['approval'] !== null || step['costReserved'] !== 0 || step['candidateHash'] !== null) invalid();\n common[id] = { ...step, status: 'skipped' }; continue;\n }\n common[id] = step; computedReserved += integer(step['costReserved']);\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n if (step['kind'] === 'human') {\n fields(step, ['kind', 'status', 'callId', 'output', 'requestDigest', 'responseDigest', 'actorId', 'deadlineAtMs']);\n if (!humanStepStatuses.has(step['status'] as WorkflowLifecycleHumanStepStatus)) invalid();\n if (step['requestDigest'] !== null) hash(step['requestDigest']);\n if (step['responseDigest'] !== null) hash(step['responseDigest']);\n if (step['actorId'] !== null) identity(step['actorId']);\n if (step['deadlineAtMs'] !== null) integer(step['deadlineAtMs']);\n if (step['status'] === 'pending' && [step['requestDigest'], step['responseDigest'], step['actorId'], step['deadlineAtMs'], step['output']].some(value => value !== null)) invalid();\n if (step['status'] === 'waiting' && (step['requestDigest'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();\n if (step['status'] === 'succeeded' && (step['requestDigest'] === null || step['responseDigest'] === null || step['actorId'] === null)) invalid();\n if (step['status'] === 'timed_out' && (step['requestDigest'] === null || step['deadlineAtMs'] === null || step['responseDigest'] !== null || step['actorId'] !== null || step['output'] !== null)) invalid();\n if ((step['status'] === 'skipped' || step['status'] === 'bypassed') && (step['requestDigest'] !== null || step['responseDigest'] !== null || step['actorId'] !== null || step['deadlineAtMs'] !== null || step['output'] !== null)) invalid();\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n if (step['kind'] === 'timer') {\n fields(step, ['kind', 'status', 'callId', 'output', 'fireAtMs', 'firedAtMs']);\n if (!timerStepStatuses.has(step['status'] as WorkflowLifecycleTimerStepStatus)) invalid();\n if (step['fireAtMs'] !== null) integer(step['fireAtMs']);\n if (step['firedAtMs'] !== null) integer(step['firedAtMs']);\n if (step['status'] === 'pending' || step['status'] === 'skipped' || step['status'] === 'bypassed') {\n if (step['fireAtMs'] !== null || step['firedAtMs'] !== null || step['output'] !== null) invalid();\n } else if (step['status'] === 'waiting') {\n if (step['fireAtMs'] === null || step['firedAtMs'] !== null || step['output'] !== null) invalid();\n waiting += 1;\n } else {\n if (step['fireAtMs'] === null || step['firedAtMs'] === null || Number(step['firedAtMs']) < Number(step['fireAtMs'])\n || canonical(step['output']!) !== canonical(jsonValue({ fireAtMs: step['fireAtMs'], firedAtMs: step['firedAtMs'] }))) invalid();\n }\n continue;\n }\n if (step['kind'] === 'signal') {\n fields(step, ['kind', 'status', 'callId', 'output', 'signalId', 'payloadDigest', 'receivedAtMs', 'deadlineAtMs']);\n if (!signalStepStatuses.has(step['status'] as WorkflowLifecycleSignalStepStatus)) invalid();\n if (step['signalId'] !== null && (typeof step['signalId'] !== 'string' || !signalPattern.test(step['signalId']))) invalid();\n if (step['payloadDigest'] !== null) hash(step['payloadDigest']);\n if (step['receivedAtMs'] !== null) integer(step['receivedAtMs']);\n if (step['deadlineAtMs'] !== null) integer(step['deadlineAtMs']);\n // A signal is recorded completely or not at all.\n const received = step['signalId'] !== null;\n if ([step['payloadDigest'], step['receivedAtMs']].some(value => (value !== null) !== received) || (!received && step['output'] !== null)) invalid();\n if (step['status'] === 'pending' && step['deadlineAtMs'] !== null) invalid();\n if (step['status'] === 'succeeded' && !received) invalid();\n if (step['status'] === 'waiting' && received) invalid();\n if (step['status'] === 'timed_out' && (received || step['deadlineAtMs'] === null)) invalid();\n if ((step['status'] === 'skipped' || step['status'] === 'bypassed') && (received || step['deadlineAtMs'] !== null)) invalid();\n if (step['status'] === 'waiting') waiting += 1;\n continue;\n }\n invalid();\n }\n if (computedReserved !== reservedMicros) invalid();\n if (Object.keys(common).length > 0) workflowState({ id: runId, state: {\n format: 2, ...(state['maxNodes'] === undefined ? {} : { maxNodes: state['maxNodes'] }), definition: definitionHash, policy: policyHash, input, status: 'running',\n steps: common, maxCostMicros, spentMicros, reservedMicros, output: null,\n } });\n if (state['status'] === 'waiting' && waiting === 0) invalid();\n if (!['running', 'waiting', 'paused'].includes(state['status'] as string) && waiting > 0) invalid();\n if (state['status'] === 'succeeded' && entries.some(([, raw]) => !satisfied.has(object(raw)['status'] as string))) invalid();\n if (state['status'] !== 'succeeded' && state['output'] !== null) invalid();\n return state as unknown as WorkflowLifecycleState;\n } catch { return corrupt(); }\n}\n\n/** Cross-check state node identities, kinds and successful dependency evidence. */\nexport function assertWorkflowLifecycleStateMatchesManifest(\n state: WorkflowLifecycleState,\n definition: WorkflowLifecycleManifest,\n): void {\n try {\n const manifest = workflowLifecycleManifest(definition);\n const value = object(jsonValue(state)); const steps = object(value['steps']);\n if (workflowNodeLimit(state.maxNodes) !== workflowNodeLimit(manifest.maxNodes) || Object.keys(steps).length !== manifest.graph.length) invalid();\n for (const node of manifest.graph) {\n const step = object(steps[node.id]);\n if (step['kind'] !== node.kind) invalid();\n // A step is bypassed only when it declares a condition, and only after its dependencies were satisfied.\n if (step['status'] === 'bypassed' && !Object.hasOwn(node, 'when')) invalid();\n if (satisfied.has(step['status'] as string) && node.dependsOn.some(id => !satisfied.has(object(steps[id])['status'] as string))) invalid();\n if (node.kind === 'tool') {\n if (step['receipt'] !== null && object(step['receipt'])['toolId'] !== node.tool) invalid();\n if (integer(step['costReserved']) > node.costMicros) invalid();\n }\n if ((node.kind === 'human' || node.kind === 'signal') && step['deadlineAtMs'] !== null && node.deadlineAtMs === null) invalid();\n }\n } catch { return corrupt(); }\n}\n\n/** Return detached outputs only for successfully completed nodes; a bypassed node's output is `null`. */\nexport function workflowLifecycleOutputs(state: WorkflowLifecycleState): Record<string, JsonValue> {\n try {\n const steps = object(object(jsonValue(state))['steps']);\n return Object.fromEntries(Object.entries(steps).filter(([, raw]) => satisfied.has(object(raw)['status'] as string))\n .map(([id, raw]) => {\n const step = object(raw);\n if (step['status'] === 'bypassed') return [id, null];\n if (step['kind'] === 'tool') {\n const evidence = object(step['receipt']);\n if (evidence['execution'] !== 'succeeded' || evidence['disclosure'] !== 'released'\n || step['candidateHash'] === null || integer(step['costReserved']) !== 0) invalid();\n } else if (step['kind'] === 'human') {\n hash(step['requestDigest']); hash(step['responseDigest']); identity(step['actorId']);\n } else if (step['kind'] === 'timer') {\n const fireAtMs = integer(step['fireAtMs']); const firedAtMs = integer(step['firedAtMs']);\n if (firedAtMs < fireAtMs || canonical(step['output']!) !== canonical(jsonValue({ fireAtMs, firedAtMs }))) invalid();\n } else if (step['kind'] === 'signal') {\n if (typeof step['signalId'] !== 'string') invalid(); hash(step['payloadDigest']); integer(step['receivedAtMs']);\n } else if (step['kind'] !== 'join') invalid();\n return [id, step['output']!];\n }));\n } catch { return corrupt(); }\n}\n"]}
@@ -18,6 +18,8 @@ export type WorkflowGraphManifestNode = WorkflowManifestNode | {
18
18
  };
19
19
  /** The explicit format and v2 hash domain keep legacy definitions byte-compatible. */
20
20
  export interface WorkflowGraphManifest {
21
+ /** Explicit graph bound; omitted records retain the 128-node default. */
22
+ readonly maxNodes?: number | false;
21
23
  readonly format: 3;
22
24
  readonly id: string;
23
25
  readonly version: string;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-graph-contracts.d.ts","sourceRoot":"","sources":["../src/workflow-graph-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC/F,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mCAAm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E"}
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-graph-contracts.js","sourceRoot":"","sources":["../src/workflow-graph-contracts.ts"],"names":[],"mappings":"","sourcesContent":["import type { JsonValue } from '@mayura/core';\nimport type { ExecutionRef, ExecutionWaitAggregateStore } from './execution-wait-contracts.js';\nimport type { ScheduledEnrollment, ScheduledMigrate, ScheduledWorkflowSnapshot, ScheduledWorkflowStore, WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';\nimport type { WorkflowFormat2State, WorkflowFormat2Step } from './workflow-format2.js';\n\n/** References are fixed before parent creation; step outputs cannot introduce future back-edges. */\nexport type WorkflowGraphTargetBinding =\n | { readonly kind: 'literal'; readonly value: readonly ExecutionRef[] }\n | { readonly kind: 'input'; readonly path: readonly string[] };\nexport type WorkflowGraphManifestNode = WorkflowManifestNode | {\n readonly kind: 'wait'; readonly id: string; readonly dependsOn: readonly string[];\n readonly targets: WorkflowGraphTargetBinding;\n};\n/** The explicit format and v2 hash domain keep legacy definitions byte-compatible. */\nexport interface WorkflowGraphManifest {\n readonly format: 3; readonly id: string; readonly version: string;\n readonly graph: readonly WorkflowGraphManifestNode[]; readonly result: WorkflowBinding;\n}\nexport interface WorkflowGraphFormat3Step extends Omit<WorkflowFormat2Step, 'kind'> { kind: 'tool' | 'join' | 'wait' }\nexport interface WorkflowGraphFormat3State extends Omit<WorkflowFormat2State, 'format' | 'steps'> {\n format: 3; steps: Record<string, WorkflowGraphFormat3Step>;\n}\nexport interface WorkflowGraphStoreSnapshot extends Omit<ScheduledWorkflowSnapshot, 'profile'> { readonly profile: 'scheduled-v2' }\nexport interface WorkflowGraphEnrollment extends Omit<ScheduledEnrollment, 'manifest'> { readonly manifest: WorkflowGraphManifest }\n\n/** Only the profile-specific manifest/result change; finite command identities retain their existing semantics. */\ntype GraphResponse<T> = T extends ScheduledWorkflowSnapshot ? WorkflowGraphStoreSnapshot\n : T extends { readonly snapshot: ScheduledWorkflowSnapshot } ? Omit<T, 'snapshot'> & { readonly snapshot: WorkflowGraphStoreSnapshot }\n : T;\ntype GraphControlStore = {\n [K in Exclude<keyof ScheduledWorkflowStore, 'submit' | 'attach' | 'pause' | 'resume' | 'migrate'>]:\n (...args: Parameters<ScheduledWorkflowStore[K]>) => Promise<GraphResponse<Awaited<ReturnType<ScheduledWorkflowStore[K]>>>>;\n};\n/** New optional capability: never widens or silently changes custom scheduled-v1 adapters. */\nexport interface WorkflowGraphStore extends GraphControlStore {\n submit(command: WorkflowGraphEnrollment & { readonly input: JsonValue; readonly idempotencyKey: string }): Promise<{ readonly snapshot: WorkflowGraphStoreSnapshot; readonly created: boolean }>;\n /** Optional quiescent operator pause; refused while any job is leased or started. Custom adapters may omit it. */\n pause?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;\n /** Optional scheduling-only resume; unresolved waits and approvals remain unresolved. */\n resume?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;\n /** Optional reviewed in-place migration of a paused graph run; see `ScheduledWorkflowStore.migrate`. */\n migrate?(command: ScheduledMigrate): Promise<WorkflowGraphStoreSnapshot>;\n}\nexport interface WorkflowGraphAggregateStore extends ExecutionWaitAggregateStore { readonly workflowGraphs: WorkflowGraphStore }\n"]}
1
+ {"version":3,"file":"workflow-graph-contracts.js","sourceRoot":"","sources":["../src/workflow-graph-contracts.ts"],"names":[],"mappings":"","sourcesContent":["import type { JsonValue } from '@mayura/core';\nimport type { ExecutionRef, ExecutionWaitAggregateStore } from './execution-wait-contracts.js';\nimport type { ScheduledEnrollment, ScheduledMigrate, ScheduledWorkflowSnapshot, ScheduledWorkflowStore, WorkflowBinding, WorkflowManifestNode } from './scheduled-workflow-contracts.js';\nimport type { WorkflowFormat2State, WorkflowFormat2Step } from './workflow-format2.js';\n\n/** References are fixed before parent creation; step outputs cannot introduce future back-edges. */\nexport type WorkflowGraphTargetBinding =\n | { readonly kind: 'literal'; readonly value: readonly ExecutionRef[] }\n | { readonly kind: 'input'; readonly path: readonly string[] };\nexport type WorkflowGraphManifestNode = WorkflowManifestNode | {\n readonly kind: 'wait'; readonly id: string; readonly dependsOn: readonly string[];\n readonly targets: WorkflowGraphTargetBinding;\n};\n/** The explicit format and v2 hash domain keep legacy definitions byte-compatible. */\nexport interface WorkflowGraphManifest {\n /** Explicit graph bound; omitted records retain the 128-node default. */\n readonly maxNodes?: number | false;\n readonly format: 3; readonly id: string; readonly version: string;\n readonly graph: readonly WorkflowGraphManifestNode[]; readonly result: WorkflowBinding;\n}\nexport interface WorkflowGraphFormat3Step extends Omit<WorkflowFormat2Step, 'kind'> { kind: 'tool' | 'join' | 'wait' }\nexport interface WorkflowGraphFormat3State extends Omit<WorkflowFormat2State, 'format' | 'steps'> {\n format: 3; steps: Record<string, WorkflowGraphFormat3Step>;\n}\nexport interface WorkflowGraphStoreSnapshot extends Omit<ScheduledWorkflowSnapshot, 'profile'> { readonly profile: 'scheduled-v2' }\nexport interface WorkflowGraphEnrollment extends Omit<ScheduledEnrollment, 'manifest'> { readonly manifest: WorkflowGraphManifest }\n\n/** Only the profile-specific manifest/result change; finite command identities retain their existing semantics. */\ntype GraphResponse<T> = T extends ScheduledWorkflowSnapshot ? WorkflowGraphStoreSnapshot\n : T extends { readonly snapshot: ScheduledWorkflowSnapshot } ? Omit<T, 'snapshot'> & { readonly snapshot: WorkflowGraphStoreSnapshot }\n : T;\ntype GraphControlStore = {\n [K in Exclude<keyof ScheduledWorkflowStore, 'submit' | 'attach' | 'pause' | 'resume' | 'migrate'>]:\n (...args: Parameters<ScheduledWorkflowStore[K]>) => Promise<GraphResponse<Awaited<ReturnType<ScheduledWorkflowStore[K]>>>>;\n};\n/** New optional capability: never widens or silently changes custom scheduled-v1 adapters. */\nexport interface WorkflowGraphStore extends GraphControlStore {\n submit(command: WorkflowGraphEnrollment & { readonly input: JsonValue; readonly idempotencyKey: string }): Promise<{ readonly snapshot: WorkflowGraphStoreSnapshot; readonly created: boolean }>;\n /** Optional quiescent operator pause; refused while any job is leased or started. Custom adapters may omit it. */\n pause?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;\n /** Optional scheduling-only resume; unresolved waits and approvals remain unresolved. */\n resume?(command: Parameters<ScheduledWorkflowStore['cancel']>[0]): Promise<WorkflowGraphStoreSnapshot>;\n /** Optional reviewed in-place migration of a paused graph run; see `ScheduledWorkflowStore.migrate`. */\n migrate?(command: ScheduledMigrate): Promise<WorkflowGraphStoreSnapshot>;\n}\nexport interface WorkflowGraphAggregateStore extends ExecutionWaitAggregateStore { readonly workflowGraphs: WorkflowGraphStore }\n"]}
@@ -22,6 +22,8 @@ export interface WorkflowTreeChildManifestNode {
22
22
  }
23
23
  export type WorkflowTreeManifestNode = WorkflowManifestNode | WorkflowTreeChildManifestNode;
24
24
  export interface WorkflowTreeManifest {
25
+ /** Explicit graph bound; omitted records retain the 128-node default. */
26
+ readonly maxNodes?: number | false;
25
27
  readonly format: 4;
26
28
  readonly id: string;
27
29
  readonly version: string;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-tree-contracts.d.ts","sourceRoot":"","sources":["../src/workflow-tree-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEvI,OAAO,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAyB,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,+BA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,CAAC,CAAC,OAAO,EAAC,uBAAuB,GAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChF,cAAc,CAAC,OAAO,EAAC;QAAC,QAAQ,CAAC,KAAK,EAAC,MAAM,CAAC;QAAA,QAAQ,CAAC,MAAM,EAAC,MAAM,CAAC;QAAA,QAAQ,CAAC,cAAc,EAAC,MAAM,CAAC;QAAA,QAAQ,CAAC,KAAK,EAAC,MAAM,CAAA;KAAC,GAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACjK;AACD,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAAE,QAAQ,CAAC,aAAa,EAAC,iBAAiB,CAAA;CAAC;AAC7G,MAAM,MAAM,kBAAkB,GAAC,MAAM,iBAAiB,CAAC;AA6BvD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAyBzE;AAED,0GAA0G;AAC1G,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,CAW7E;AAED,mGAAmG;AACnG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,oBAAoB,GAAG,oBAAoB,CAUhH"}
@@ -1,3 +1,4 @@
1
+ import { workflowNodeLimit } from '../../core/dist/index.js';
1
2
  import { freezeJson, jsonValue } from '../../core/dist/index.js';
2
3
  import { StorageError } from './contracts.js';
3
4
  import { workflowManifest, workflowResources } from './workflow-format2.js';
@@ -64,12 +65,12 @@ export function workflowTreeManifest(value) {
64
65
  if (value !== null && typeof value === 'object' && owned.has(value))
65
66
  return value;
66
67
  const copy = object(jsonValue(value, { maxBytes: 1_048_576, maxNodes: 30_000, maxDepth: 24 }));
67
- fields(copy, ['format', 'id', 'version', 'graph', 'result']);
68
+ fields(copy, ['format', 'id', 'version', 'graph', 'result', ...(Object.hasOwn(copy, 'maxNodes') ? ['maxNodes'] : [])]);
68
69
  if (copy['format'] !== 4)
69
70
  invalid();
70
71
  id(copy['id']);
71
72
  text(copy['version'], 128);
72
- const graph = list(copy['graph'], 128).map(object);
73
+ const graph = list(copy['graph'], workflowNodeLimit(copy['maxNodes'])).map(object);
73
74
  if (!graph.length)
74
75
  invalid();
75
76
  const ids = new Set(graph.map(node => id(node['id'])));
@@ -100,7 +101,7 @@ export function workflowTreeManifest(value) {
100
101
  }
101
102
  if (children > 16 || totalNodes > 256 || totalTools > 128)
102
103
  invalid();
103
- workflowManifest({ id: copy['id'], version: copy['version'], graph: projection, result: copy['result'] });
104
+ workflowManifest({ id: copy['id'], version: copy['version'], ...(copy['maxNodes'] === undefined ? {} : { maxNodes: copy['maxNodes'] }), graph: projection, result: copy['result'] });
104
105
  const result = freezeJson(copy);
105
106
  owned.add(result);
106
107
  return result;
@@ -139,6 +140,7 @@ export function workflowTreeRootResources(value, definition) {
139
140
  try {
140
141
  const manifest = workflowTreeManifest(definition);
141
142
  const projection = { id: manifest.id, version: manifest.version,
143
+ ...(manifest.maxNodes === undefined ? {} : { maxNodes: manifest.maxNodes }),
142
144
  graph: manifest.graph.map(node => node.kind === 'child'
143
145
  ? { kind: 'join', id: node.id, dependsOn: node.dependsOn }
144
146
  : node), result: manifest.result };
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-tree-contracts.js","sourceRoot":"","sources":["../src/workflow-tree-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAA0D,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,YAAY,EAA0C,MAAM,gBAAgB,CAAC;AAGtF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAqD,MAAM,+BAA+B,CAAC;AA2BzH,2FAA2F;AAC3F,MAAM,UAAU,0BAA0B,CAAC,GAAW,EAAC,OAAyB;IAC9E,IAAG,CAAC;QACF,MAAM,QAAQ,GAAC,SAAS,CAAC,GAAG,EAAC,EAAC,QAAQ,EAAC,SAAS,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AAI,CAAC,SAAS,EAAC;gBACnD,CAAC,CAAC,IAAI,CAAC,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM,EAAC,CAAC;QACpC,OAAO,iBAAiB,CAAC,KAAK,EAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,OAAO,EAAE,CAAC;IAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { freezeJson, jsonValue, type ExecutionReceipt, type JsonObject, type JsonValue } from '@mayura/core';\nimport { StorageError, type AggregateStore, type StoredRecord } from './contracts.js';\nimport type { Scope } from '@mayura/core';\nimport type { WorkflowBinding, WorkflowManifest, WorkflowManifestNode, WorkflowResourcePlan } from './scheduled-workflow-contracts.js';\nimport { workflowManifest, workflowResources } from './workflow-format2.js';\nimport type { Claim, EvidenceDisposition, JobRecord } from './scheduler-contracts.js';\nimport { durableBudgetSnapshot, type DurableBudgetKey, type DurableBudgetSnapshot } from './durable-budget-contracts.js';\n\nexport interface WorkflowTreeChildPolicy {\n readonly permissions: readonly string[];\n readonly maxCostMicros: number;\n readonly maxCalls: number;\n readonly maxOutputBytes: number;\n readonly approvalTtlMs: number;\n}\nexport interface WorkflowTreeChildManifestNode {\n readonly kind: 'child'; readonly id: string; readonly dependsOn: readonly string[];\n readonly workflow: WorkflowManifest; readonly policy: WorkflowTreeChildPolicy;\n readonly resources: WorkflowResourcePlan; readonly input: WorkflowBinding;\n}\nexport type WorkflowTreeManifestNode = WorkflowManifestNode | WorkflowTreeChildManifestNode;\nexport interface WorkflowTreeManifest {\n readonly format: 4; readonly id: string; readonly version: string;\n readonly graph: readonly WorkflowTreeManifestNode[]; readonly result: WorkflowBinding;\n}\nexport interface WorkflowTreePolicyManifest {\n readonly scope: Scope; readonly permissions: readonly string[]; readonly policyVersion: string;\n readonly maxCostMicros: number; readonly maxCalls: number;\n readonly maxOutputBytes: number; readonly approvalTtlMs: number;\n}\n\nexport type WorkflowTreeBudgetSnapshot = Omit<DurableBudgetSnapshot,'owner'> & {readonly owner:'workflow-tree-v1'};\n\n/** Decode the scheduler-owned ledger without weakening the standalone host-v1 contract. */\nexport function workflowTreeBudgetSnapshot(raw:unknown,context?:DurableBudgetKey):WorkflowTreeBudgetSnapshot{\n try{\n const captured=jsonValue(raw,{maxBytes:1_048_576,maxNodes:30_000,maxDepth:24});\n if(!captured||typeof captured!=='object'||Array.isArray(captured)||captured['owner']!=='workflow-tree-v1')throw new Error();\n const host=durableBudgetSnapshot({...captured,owner:'host-v1'},context);\n return freezeJson(jsonValue({...host,owner:'workflow-tree-v1'})) as unknown as WorkflowTreeBudgetSnapshot;\n }catch{throw new StorageError('STORAGE_UNAVAILABLE','Workflow-tree budget metadata failed integrity validation.');}\n}\nexport interface WorkflowTreeRootSubmission {readonly manifest:WorkflowTreeManifest;readonly policy:WorkflowTreePolicyManifest;readonly resources:WorkflowResourcePlan;readonly input:JsonValue;readonly idempotencyKey:string}\nexport interface WorkflowTreeRootSnapshot {readonly record:StoredRecord;readonly profile:'scheduled-v3';readonly rootId:string;readonly accountId:'root';readonly manifestHash:string;readonly policyHash:string;readonly resourceHash:string;readonly budget:WorkflowTreeBudgetSnapshot}\nexport interface WorkflowTreeChildAdmission {readonly root:WorkflowTreeRootSnapshot;readonly child:StoredRecord;readonly childId:string;readonly accountId:string;readonly definitionHash:string;readonly policyHash:string;readonly resourceHash:string;readonly inputHash:string;readonly created:boolean}\nexport interface WorkflowTreePreparedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord;readonly created:boolean}\nexport interface WorkflowTreeClaimedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord;readonly claim:Claim}\nexport interface WorkflowTreeRenewedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly claim:Claim}\nexport interface WorkflowTreeStartedTool {readonly status:'started'|'already_started';readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeReceiptResult {readonly disposition:EvidenceDisposition;readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeCompletedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeMemberResult {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord}\nexport interface WorkflowTreeRootPreparedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord;readonly created:boolean}\nexport interface WorkflowTreeRootClaimedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord;readonly claim:Claim}\nexport interface WorkflowTreeRootRenewedTool {readonly root:WorkflowTreeRootSnapshot;readonly claim:Claim}\nexport interface WorkflowTreeRootStartedTool {readonly status:'started'|'already_started';readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeRootReceiptResult {readonly disposition:EvidenceDisposition;readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeRootCompletedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeCancellationResult {readonly root:WorkflowTreeRootSnapshot;readonly members:readonly StoredRecord[];readonly jobs:readonly JobRecord[]}\nexport interface WorkflowTreeChildCancellationResult {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly jobs:readonly JobRecord[]}\nexport interface WorkflowTreeRecoveryResult {readonly root:WorkflowTreeRootSnapshot;readonly members:readonly StoredRecord[];readonly jobs:readonly JobRecord[]}\n\nexport interface WorkflowTreeMigrateRoot {\n readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly commandId:string;\n readonly manifest:WorkflowTreeManifest;readonly resources:WorkflowResourcePlan;readonly state:JsonObject;readonly migrationId:string;readonly actorId:string;\n}\n/** Explicit optional format-4 persistence capability. Every mutation is finite and root-fenced. */\nexport interface WorkflowTreeStore {\n initialize():Promise<void>;\n submit(command:WorkflowTreeRootSubmission):Promise<{readonly snapshot:WorkflowTreeRootSnapshot;readonly created:boolean}>;\n inspect(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string}):Promise<WorkflowTreeRootSnapshot|undefined>;\n requestRootApproval(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeRootSnapshot>;\n approveRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly digest:string;readonly humanId:string}):Promise<WorkflowTreeRootSnapshot>;\n prepareRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeRootPreparedTool>;\n claimPreparedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly workerId:string;readonly leaseMs:number}):Promise<WorkflowTreeRootClaimedTool|undefined>;\n renewClaimedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly leaseMs:number}):Promise<WorkflowTreeRootRenewedTool>;\n startClaimedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly claim:Claim;readonly input:JsonValue}):Promise<WorkflowTreeRootStartedTool>;\n recordRootToolReceipt(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly fence:number;readonly evidenceId:string;readonly receipt:ExecutionReceipt}):Promise<WorkflowTreeRootReceiptResult>;\n completeRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly commandId:string;readonly evidenceId:string;readonly outcome:'succeeded'|'failed'|'blocked';readonly output:JsonValue|null}):Promise<WorkflowTreeRootCompletedTool>;\n inspectChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string}):Promise<WorkflowTreeMemberResult>;\n admitChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly parentId:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeChildAdmission>;\n requestChildApproval(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeMemberResult>;\n approveChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly digest:string;readonly humanId:string}):Promise<WorkflowTreeMemberResult>;\n prepareChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreePreparedTool>;\n claimPreparedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly workerId:string;readonly leaseMs:number}):Promise<WorkflowTreeClaimedTool|undefined>;\n renewClaimedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly leaseMs:number}):Promise<WorkflowTreeRenewedTool>;\n startClaimedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly claim:Claim;readonly input:JsonValue}):Promise<WorkflowTreeStartedTool>;\n recordChildToolReceipt(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly fence:number;readonly evidenceId:string;readonly receipt:ExecutionReceipt}):Promise<WorkflowTreeReceiptResult>;\n completeChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly commandId:string;readonly evidenceId:string;readonly outcome:'succeeded'|'failed'|'blocked';readonly output:JsonValue|null}):Promise<WorkflowTreeCompletedTool>;\n finalizeChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly expectedVersion:number;readonly output:JsonValue}):Promise<WorkflowTreeMemberResult>;\n joinChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n finalizeRoot(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly output:JsonValue}):Promise<WorkflowTreeRootSnapshot>;\n cancelChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly expectedVersion:number;readonly commandId:string}):Promise<WorkflowTreeChildCancellationResult>;\n cancelRoot(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly commandId:string}):Promise<WorkflowTreeCancellationResult>;\n /** Optional tree-wide quiescent pause; refused while any root or child job is leased or started. Custom adapters may omit it. */\n pauseRoot?(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n /** Optional scheduling-only resume; unresolved approvals and child waits remain unresolved. */\n resumeRoot?(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n /**\n * Optional reviewed migration of a paused root to a new tree definition under the same policy. `state` is the complete\n * migrated root state; storage re-verifies it: steps with jobs or admitted children must be carried unchanged.\n */\n migrateRoot?(command:WorkflowTreeMigrateRoot):Promise<WorkflowTreeRootSnapshot>;\n recoverExpired(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly limit:number}):Promise<WorkflowTreeRecoveryResult>;\n}\nexport interface WorkflowTreeAggregateStore extends AggregateStore {readonly workflowTrees:WorkflowTreeStore}\nexport type WorkflowTreeMethod=keyof WorkflowTreeStore;\n\nconst forbidden = new Set(['constructor','prototype','__proto__']);\nconst idPattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;\nconst textEncoder = new TextEncoder();\nconst owned = new WeakSet<object>();\nfunction invalid(): never { throw new StorageError('INVALID_INPUT','Invalid bounded workflow-tree metadata.'); }\nfunction object(value: JsonValue | undefined): JsonObject { if (!value || typeof value !== 'object' || Array.isArray(value)) invalid(); return value; }\nfunction fields(value: JsonObject,names: readonly string[]): void { if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value,name))) invalid(); }\nfunction id(value: unknown): string { if (typeof value !== 'string' || !idPattern.test(value) || forbidden.has(value)) invalid(); return value; }\nfunction text(value: unknown, maximum: number): string {\n if (typeof value !== 'string' || !value.length || value.includes('\\0') || /[\\uD800-\\uDFFF]/u.test(value) || textEncoder.encode(value).length > maximum) invalid();\n return value;\n}\nfunction integer(value: unknown,minimum=0,maximum=Number.MAX_SAFE_INTEGER): number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum || value > maximum) invalid(); return value;\n}\nfunction list(value: JsonValue | undefined,maximum: number): JsonValue[] { if (!Array.isArray(value) || value.length > maximum) invalid(); return value; }\nfunction policy(value: JsonValue | undefined, leaf: WorkflowManifest): WorkflowTreeChildPolicy {\n const item = object(value); fields(item,['permissions','maxCostMicros','maxCalls','maxOutputBytes','approvalTtlMs']);\n const permissions = list(item['permissions'],4_096).map(grant => text(grant,256));\n if (new Set(permissions).size !== permissions.length) invalid(); permissions.sort(); item['permissions'] = permissions;\n const maximum = integer(item['maxCostMicros']); const calls = integer(item['maxCalls'],1,128);\n integer(item['maxOutputBytes'],1,65_536); integer(item['approvalTtlMs'],1);\n const tools = leaf.graph.filter(node => node.kind === 'tool');\n if (tools.length > calls || tools.reduce((total,node) => total + BigInt(node.costMicros),0n) > BigInt(maximum)) invalid();\n return item as unknown as WorkflowTreeChildPolicy;\n}\n\n/**\n * Decode the complete one-level execution plan. Child leaves are legacy\n * tool/join manifests, so recursive trees cannot enter the persistence layer.\n */\nexport function workflowTreeManifest(value: unknown): WorkflowTreeManifest {\n try {\n if (value !== null && typeof value === 'object' && owned.has(value)) return value as WorkflowTreeManifest;\n const copy = object(jsonValue(value,{maxBytes:1_048_576,maxNodes:30_000,maxDepth:24}));\n fields(copy,['format','id','version','graph','result']);\n if (copy['format'] !== 4) invalid(); id(copy['id']); text(copy['version'],128);\n const graph = list(copy['graph'],128).map(object); if (!graph.length) invalid();\n const ids = new Set(graph.map(node => id(node['id']))); if (ids.size !== graph.length) invalid();\n let children = 0; let totalNodes = graph.length; let totalTools = 0;\n const projection: WorkflowManifestNode[] = [];\n for (const node of graph) {\n if (node['kind'] !== 'child') { projection.push(node as unknown as WorkflowManifestNode); if (node['kind'] === 'tool') totalTools++; continue; }\n children++; fields(node,['kind','id','dependsOn','workflow','policy','resources','input']);\n const leaf = workflowManifest(node['workflow']); node['workflow'] = leaf as unknown as JsonValue;\n node['policy'] = policy(node['policy'],leaf) as unknown as JsonValue;\n node['resources'] = workflowResources(node['resources'],leaf) as unknown as JsonValue;\n totalNodes += leaf.graph.length; totalTools += leaf.graph.filter(item => item.kind === 'tool').length;\n projection.push({ kind:'tool', id:node['id'] as string, dependsOn:node['dependsOn'] as string[],\n tool:`workflow/${leaf.id}`, toolVersion:leaf.version, effects:'none', capabilities:[], costMicros:0,\n approval:false, input:node['input'] as unknown as WorkflowBinding });\n }\n if (children > 16 || totalNodes > 256 || totalTools > 128) invalid();\n workflowManifest({ id:copy['id'],version:copy['version'],graph:projection,result:copy['result'] });\n const result = freezeJson(copy) as unknown as WorkflowTreeManifest; owned.add(result); return result;\n } catch { return invalid(); }\n}\n\n/** Format-4 root authority adds an explicit shared call ceiling without widening legacy policy hashes. */\nexport function workflowTreePolicy(value: unknown): WorkflowTreePolicyManifest {\n try {\n const copy = object(jsonValue(value,{maxBytes:1_048_576}));\n fields(copy,['scope','permissions','policyVersion','maxCostMicros','maxCalls','maxOutputBytes','approvalTtlMs']);\n const scope = object(copy['scope']); fields(scope,['principalId','projectId']); text(scope['principalId'],128); text(scope['projectId'],128);\n text(copy['policyVersion'],128); integer(copy['maxCostMicros']); integer(copy['maxCalls'],1,128);\n integer(copy['maxOutputBytes'],1,65_536); integer(copy['approvalTtlMs'],1);\n const permissions = list(copy['permissions'],4_096).map(grant => text(grant,256));\n if (new Set(permissions).size !== permissions.length) invalid(); permissions.sort(); copy['permissions'] = permissions;\n return freezeJson(copy) as unknown as WorkflowTreePolicyManifest;\n } catch { return invalid(); }\n}\n\n/** Root resources apply only to root tool nodes; child plans retain their own pinned resources. */\nexport function workflowTreeRootResources(value: unknown, definition: WorkflowTreeManifest): WorkflowResourcePlan {\n try {\n const manifest = workflowTreeManifest(definition);\n const projection: WorkflowManifest = {id:manifest.id,version:manifest.version,\n graph:manifest.graph.map(node => node.kind === 'child'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : node),result:manifest.result};\n return workflowResources(value,projection);\n } catch { return invalid(); }\n}\n"]}
1
+ {"version":3,"file":"workflow-tree-contracts.js","sourceRoot":"","sources":["../src/workflow-tree-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAA0D,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,YAAY,EAA0C,MAAM,gBAAgB,CAAC;AAGtF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAqD,MAAM,+BAA+B,CAAC;AA6BzH,2FAA2F;AAC3F,MAAM,UAAU,0BAA0B,CAAC,GAAW,EAAC,OAAyB;IAC9E,IAAG,CAA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c,EAAE,UAAgC;IACxF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,UAAU,GAAqB,EAAC,EAAE,EAAC,QAAQ,CAAC,EAAE,EAAC,OAAO,EAAC,QAAQ,CAAC,OAAO;YAC3E,GAAG,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAC,QAAQ,CAAC,QAAQ,EAAC,CAAC;YACxE,KAAK,EAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO;gBACpD,CAAC,CAAC,EAAC,IAAI,EAAC,MAAM,EAAC,EAAE,EAAC,IAAI,CAAC,EAAE,EAAC,SAAS,EAAC,IAAI,CAAC,SAAS,EAAC;gBACnD,CAAC,CAAC,IAAI,CAAC,EAAC,MAAM,EAAC,QAAQ,CAAC,MAAM,EAAC,CAAC;QACpC,OAAO,iBAAiB,CAAC,KAAK,EAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,OAAO,EAAE,CAAC;IAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { workflowNodeLimit } from '@mayura/core';\nimport { freezeJson, jsonValue, type ExecutionReceipt, type JsonObject, type JsonValue } from '@mayura/core';\nimport { StorageError, type AggregateStore, type StoredRecord } from './contracts.js';\nimport type { Scope } from '@mayura/core';\nimport type { WorkflowBinding, WorkflowManifest, WorkflowManifestNode, WorkflowResourcePlan } from './scheduled-workflow-contracts.js';\nimport { workflowManifest, workflowResources } from './workflow-format2.js';\nimport type { Claim, EvidenceDisposition, JobRecord } from './scheduler-contracts.js';\nimport { durableBudgetSnapshot, type DurableBudgetKey, type DurableBudgetSnapshot } from './durable-budget-contracts.js';\n\nexport interface WorkflowTreeChildPolicy {\n readonly permissions: readonly string[];\n readonly maxCostMicros: number;\n readonly maxCalls: number;\n readonly maxOutputBytes: number;\n readonly approvalTtlMs: number;\n}\nexport interface WorkflowTreeChildManifestNode {\n readonly kind: 'child'; readonly id: string; readonly dependsOn: readonly string[];\n readonly workflow: WorkflowManifest; readonly policy: WorkflowTreeChildPolicy;\n readonly resources: WorkflowResourcePlan; readonly input: WorkflowBinding;\n}\nexport type WorkflowTreeManifestNode = WorkflowManifestNode | WorkflowTreeChildManifestNode;\nexport interface WorkflowTreeManifest {\n /** Explicit graph bound; omitted records retain the 128-node default. */\n readonly maxNodes?: number | false;\n readonly format: 4; readonly id: string; readonly version: string;\n readonly graph: readonly WorkflowTreeManifestNode[]; readonly result: WorkflowBinding;\n}\nexport interface WorkflowTreePolicyManifest {\n readonly scope: Scope; readonly permissions: readonly string[]; readonly policyVersion: string;\n readonly maxCostMicros: number; readonly maxCalls: number;\n readonly maxOutputBytes: number; readonly approvalTtlMs: number;\n}\n\nexport type WorkflowTreeBudgetSnapshot = Omit<DurableBudgetSnapshot,'owner'> & {readonly owner:'workflow-tree-v1'};\n\n/** Decode the scheduler-owned ledger without weakening the standalone host-v1 contract. */\nexport function workflowTreeBudgetSnapshot(raw:unknown,context?:DurableBudgetKey):WorkflowTreeBudgetSnapshot{\n try{\n const captured=jsonValue(raw,{maxBytes:1_048_576,maxNodes:30_000,maxDepth:24});\n if(!captured||typeof captured!=='object'||Array.isArray(captured)||captured['owner']!=='workflow-tree-v1')throw new Error();\n const host=durableBudgetSnapshot({...captured,owner:'host-v1'},context);\n return freezeJson(jsonValue({...host,owner:'workflow-tree-v1'})) as unknown as WorkflowTreeBudgetSnapshot;\n }catch{throw new StorageError('STORAGE_UNAVAILABLE','Workflow-tree budget metadata failed integrity validation.');}\n}\nexport interface WorkflowTreeRootSubmission {readonly manifest:WorkflowTreeManifest;readonly policy:WorkflowTreePolicyManifest;readonly resources:WorkflowResourcePlan;readonly input:JsonValue;readonly idempotencyKey:string}\nexport interface WorkflowTreeRootSnapshot {readonly record:StoredRecord;readonly profile:'scheduled-v3';readonly rootId:string;readonly accountId:'root';readonly manifestHash:string;readonly policyHash:string;readonly resourceHash:string;readonly budget:WorkflowTreeBudgetSnapshot}\nexport interface WorkflowTreeChildAdmission {readonly root:WorkflowTreeRootSnapshot;readonly child:StoredRecord;readonly childId:string;readonly accountId:string;readonly definitionHash:string;readonly policyHash:string;readonly resourceHash:string;readonly inputHash:string;readonly created:boolean}\nexport interface WorkflowTreePreparedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord;readonly created:boolean}\nexport interface WorkflowTreeClaimedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord;readonly claim:Claim}\nexport interface WorkflowTreeRenewedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly claim:Claim}\nexport interface WorkflowTreeStartedTool {readonly status:'started'|'already_started';readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeReceiptResult {readonly disposition:EvidenceDisposition;readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeCompletedTool {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly job:JobRecord}\nexport interface WorkflowTreeMemberResult {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord}\nexport interface WorkflowTreeRootPreparedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord;readonly created:boolean}\nexport interface WorkflowTreeRootClaimedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord;readonly claim:Claim}\nexport interface WorkflowTreeRootRenewedTool {readonly root:WorkflowTreeRootSnapshot;readonly claim:Claim}\nexport interface WorkflowTreeRootStartedTool {readonly status:'started'|'already_started';readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeRootReceiptResult {readonly disposition:EvidenceDisposition;readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeRootCompletedTool {readonly root:WorkflowTreeRootSnapshot;readonly job:JobRecord}\nexport interface WorkflowTreeCancellationResult {readonly root:WorkflowTreeRootSnapshot;readonly members:readonly StoredRecord[];readonly jobs:readonly JobRecord[]}\nexport interface WorkflowTreeChildCancellationResult {readonly root:WorkflowTreeRootSnapshot;readonly member:StoredRecord;readonly jobs:readonly JobRecord[]}\nexport interface WorkflowTreeRecoveryResult {readonly root:WorkflowTreeRootSnapshot;readonly members:readonly StoredRecord[];readonly jobs:readonly JobRecord[]}\n\nexport interface WorkflowTreeMigrateRoot {\n readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly commandId:string;\n readonly manifest:WorkflowTreeManifest;readonly resources:WorkflowResourcePlan;readonly state:JsonObject;readonly migrationId:string;readonly actorId:string;\n}\n/** Explicit optional format-4 persistence capability. Every mutation is finite and root-fenced. */\nexport interface WorkflowTreeStore {\n initialize():Promise<void>;\n submit(command:WorkflowTreeRootSubmission):Promise<{readonly snapshot:WorkflowTreeRootSnapshot;readonly created:boolean}>;\n inspect(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string}):Promise<WorkflowTreeRootSnapshot|undefined>;\n requestRootApproval(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeRootSnapshot>;\n approveRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly digest:string;readonly humanId:string}):Promise<WorkflowTreeRootSnapshot>;\n prepareRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeRootPreparedTool>;\n claimPreparedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly workerId:string;readonly leaseMs:number}):Promise<WorkflowTreeRootClaimedTool|undefined>;\n renewClaimedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly leaseMs:number}):Promise<WorkflowTreeRootRenewedTool>;\n startClaimedRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly claim:Claim;readonly input:JsonValue}):Promise<WorkflowTreeRootStartedTool>;\n recordRootToolReceipt(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly fence:number;readonly evidenceId:string;readonly receipt:ExecutionReceipt}):Promise<WorkflowTreeRootReceiptResult>;\n completeRootTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly commandId:string;readonly evidenceId:string;readonly outcome:'succeeded'|'failed'|'blocked';readonly output:JsonValue|null}):Promise<WorkflowTreeRootCompletedTool>;\n inspectChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string}):Promise<WorkflowTreeMemberResult>;\n admitChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly parentId:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeChildAdmission>;\n requestChildApproval(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreeMemberResult>;\n approveChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly digest:string;readonly humanId:string}):Promise<WorkflowTreeMemberResult>;\n prepareChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly input:JsonValue}):Promise<WorkflowTreePreparedTool>;\n claimPreparedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly workerId:string;readonly leaseMs:number}):Promise<WorkflowTreeClaimedTool|undefined>;\n renewClaimedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly leaseMs:number}):Promise<WorkflowTreeRenewedTool>;\n startClaimedChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number;readonly claim:Claim;readonly input:JsonValue}):Promise<WorkflowTreeStartedTool>;\n recordChildToolReceipt(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly fence:number;readonly evidenceId:string;readonly receipt:ExecutionReceipt}):Promise<WorkflowTreeReceiptResult>;\n completeChildTool(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly nodeId:string;readonly claim:Claim;readonly commandId:string;readonly evidenceId:string;readonly outcome:'succeeded'|'failed'|'blocked';readonly output:JsonValue|null}):Promise<WorkflowTreeCompletedTool>;\n finalizeChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly expectedVersion:number;readonly output:JsonValue}):Promise<WorkflowTreeMemberResult>;\n joinChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly nodeId:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n finalizeRoot(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly output:JsonValue}):Promise<WorkflowTreeRootSnapshot>;\n cancelChild(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly childId:string;readonly childPolicyHash:string;readonly expectedVersion:number;readonly commandId:string}):Promise<WorkflowTreeChildCancellationResult>;\n cancelRoot(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number;readonly commandId:string}):Promise<WorkflowTreeCancellationResult>;\n /** Optional tree-wide quiescent pause; refused while any root or child job is leased or started. Custom adapters may omit it. */\n pauseRoot?(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n /** Optional scheduling-only resume; unresolved approvals and child waits remain unresolved. */\n resumeRoot?(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly expectedVersion:number}):Promise<WorkflowTreeRootSnapshot>;\n /**\n * Optional reviewed migration of a paused root to a new tree definition under the same policy. `state` is the complete\n * migrated root state; storage re-verifies it: steps with jobs or admitted children must be carried unchanged.\n */\n migrateRoot?(command:WorkflowTreeMigrateRoot):Promise<WorkflowTreeRootSnapshot>;\n recoverExpired(command:{readonly scope:string;readonly rootId:string;readonly rootPolicyHash:string;readonly limit:number}):Promise<WorkflowTreeRecoveryResult>;\n}\nexport interface WorkflowTreeAggregateStore extends AggregateStore {readonly workflowTrees:WorkflowTreeStore}\nexport type WorkflowTreeMethod=keyof WorkflowTreeStore;\n\nconst forbidden = new Set(['constructor','prototype','__proto__']);\nconst idPattern = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;\nconst textEncoder = new TextEncoder();\nconst owned = new WeakSet<object>();\nfunction invalid(): never { throw new StorageError('INVALID_INPUT','Invalid bounded workflow-tree metadata.'); }\nfunction object(value: JsonValue | undefined): JsonObject { if (!value || typeof value !== 'object' || Array.isArray(value)) invalid(); return value; }\nfunction fields(value: JsonObject,names: readonly string[]): void { if (Object.keys(value).length !== names.length || names.some(name => !Object.hasOwn(value,name))) invalid(); }\nfunction id(value: unknown): string { if (typeof value !== 'string' || !idPattern.test(value) || forbidden.has(value)) invalid(); return value; }\nfunction text(value: unknown, maximum: number): string {\n if (typeof value !== 'string' || !value.length || value.includes('\\0') || /[\\uD800-\\uDFFF]/u.test(value) || textEncoder.encode(value).length > maximum) invalid();\n return value;\n}\nfunction integer(value: unknown,minimum=0,maximum=Number.MAX_SAFE_INTEGER): number {\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < minimum || value > maximum) invalid(); return value;\n}\nfunction list(value: JsonValue | undefined,maximum: number): JsonValue[] { if (!Array.isArray(value) || value.length > maximum) invalid(); return value; }\nfunction policy(value: JsonValue | undefined, leaf: WorkflowManifest): WorkflowTreeChildPolicy {\n const item = object(value); fields(item,['permissions','maxCostMicros','maxCalls','maxOutputBytes','approvalTtlMs']);\n const permissions = list(item['permissions'],4_096).map(grant => text(grant,256));\n if (new Set(permissions).size !== permissions.length) invalid(); permissions.sort(); item['permissions'] = permissions;\n const maximum = integer(item['maxCostMicros']); const calls = integer(item['maxCalls'],1,128);\n integer(item['maxOutputBytes'],1,65_536); integer(item['approvalTtlMs'],1);\n const tools = leaf.graph.filter(node => node.kind === 'tool');\n if (tools.length > calls || tools.reduce((total,node) => total + BigInt(node.costMicros),0n) > BigInt(maximum)) invalid();\n return item as unknown as WorkflowTreeChildPolicy;\n}\n\n/**\n * Decode the complete one-level execution plan. Child leaves are legacy\n * tool/join manifests, so recursive trees cannot enter the persistence layer.\n */\nexport function workflowTreeManifest(value: unknown): WorkflowTreeManifest {\n try {\n if (value !== null && typeof value === 'object' && owned.has(value)) return value as WorkflowTreeManifest;\n const copy = object(jsonValue(value,{maxBytes:1_048_576,maxNodes:30_000,maxDepth:24}));\n fields(copy,['format','id','version','graph','result',...(Object.hasOwn(copy,'maxNodes')?['maxNodes']:[])]);\n if (copy['format'] !== 4) invalid(); id(copy['id']); text(copy['version'],128);\n const graph = list(copy['graph'],workflowNodeLimit(copy['maxNodes'])).map(object); if (!graph.length) invalid();\n const ids = new Set(graph.map(node => id(node['id']))); if (ids.size !== graph.length) invalid();\n let children = 0; let totalNodes = graph.length; let totalTools = 0;\n const projection: WorkflowManifestNode[] = [];\n for (const node of graph) {\n if (node['kind'] !== 'child') { projection.push(node as unknown as WorkflowManifestNode); if (node['kind'] === 'tool') totalTools++; continue; }\n children++; fields(node,['kind','id','dependsOn','workflow','policy','resources','input']);\n const leaf = workflowManifest(node['workflow']); node['workflow'] = leaf as unknown as JsonValue;\n node['policy'] = policy(node['policy'],leaf) as unknown as JsonValue;\n node['resources'] = workflowResources(node['resources'],leaf) as unknown as JsonValue;\n totalNodes += leaf.graph.length; totalTools += leaf.graph.filter(item => item.kind === 'tool').length;\n projection.push({ kind:'tool', id:node['id'] as string, dependsOn:node['dependsOn'] as string[],\n tool:`workflow/${leaf.id}`, toolVersion:leaf.version, effects:'none', capabilities:[], costMicros:0,\n approval:false, input:node['input'] as unknown as WorkflowBinding });\n }\n if (children > 16 || totalNodes > 256 || totalTools > 128) invalid();\n workflowManifest({ id:copy['id'],version:copy['version'],...(copy['maxNodes']===undefined?{}:{maxNodes:copy['maxNodes']}),graph:projection,result:copy['result'] });\n const result = freezeJson(copy) as unknown as WorkflowTreeManifest; owned.add(result); return result;\n } catch { return invalid(); }\n}\n\n/** Format-4 root authority adds an explicit shared call ceiling without widening legacy policy hashes. */\nexport function workflowTreePolicy(value: unknown): WorkflowTreePolicyManifest {\n try {\n const copy = object(jsonValue(value,{maxBytes:1_048_576}));\n fields(copy,['scope','permissions','policyVersion','maxCostMicros','maxCalls','maxOutputBytes','approvalTtlMs']);\n const scope = object(copy['scope']); fields(scope,['principalId','projectId']); text(scope['principalId'],128); text(scope['projectId'],128);\n text(copy['policyVersion'],128); integer(copy['maxCostMicros']); integer(copy['maxCalls'],1,128);\n integer(copy['maxOutputBytes'],1,65_536); integer(copy['approvalTtlMs'],1);\n const permissions = list(copy['permissions'],4_096).map(grant => text(grant,256));\n if (new Set(permissions).size !== permissions.length) invalid(); permissions.sort(); copy['permissions'] = permissions;\n return freezeJson(copy) as unknown as WorkflowTreePolicyManifest;\n } catch { return invalid(); }\n}\n\n/** Root resources apply only to root tool nodes; child plans retain their own pinned resources. */\nexport function workflowTreeRootResources(value: unknown, definition: WorkflowTreeManifest): WorkflowResourcePlan {\n try {\n const manifest = workflowTreeManifest(definition);\n const projection: WorkflowManifest = {id:manifest.id,version:manifest.version,\n ...(manifest.maxNodes === undefined ? {} : {maxNodes:manifest.maxNodes}),\n graph:manifest.graph.map(node => node.kind === 'child'\n ? {kind:'join',id:node.id,dependsOn:node.dependsOn}\n : node),result:manifest.result};\n return workflowResources(value,projection);\n } catch { return invalid(); }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "private": true
5
5
  }
@@ -14,6 +14,8 @@ export type WorkflowManifestNode =
14
14
  readonly approval: boolean; readonly input: WorkflowBinding };
15
15
  /** Data-only material reproducing the existing mayura:workflow:v1 definition digest. */
16
16
  export interface WorkflowManifest {
17
+ /** Explicit graph bound; omitted records retain the 128-node default. */
18
+ readonly maxNodes?: number | false;
17
19
  readonly id: string; readonly version: string; readonly graph: readonly WorkflowManifestNode[];
18
20
  readonly result: WorkflowBinding;
19
21
  }