@alneas/eaos-server 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +21 -0
  3. package/README.ja.md +49 -0
  4. package/README.md +46 -2
  5. package/dist/agentic/agent-jobs.d.ts +333 -0
  6. package/dist/agentic/agent-jobs.js +15 -0
  7. package/dist/agentic/agent-jobs.js.map +1 -0
  8. package/dist/agentic/agent-node.d.ts +40 -0
  9. package/dist/agentic/agent-node.js +7 -0
  10. package/dist/agentic/agent-node.js.map +1 -0
  11. package/dist/agentic/agent-runner.d.ts +33 -0
  12. package/dist/agentic/agent-runner.js +7 -0
  13. package/dist/agentic/agent-runner.js.map +1 -0
  14. package/dist/agentic/ai-broker.d.ts +169 -0
  15. package/dist/agentic/ai-broker.js +8 -0
  16. package/dist/agentic/ai-broker.js.map +1 -0
  17. package/dist/agentic/atomic-checkpointer.d.ts +137 -0
  18. package/dist/agentic/atomic-checkpointer.js +9 -0
  19. package/dist/agentic/atomic-checkpointer.js.map +1 -0
  20. package/dist/agentic/autonomous-worker.d.ts +122 -0
  21. package/dist/agentic/autonomous-worker.js +10 -0
  22. package/dist/agentic/autonomous-worker.js.map +1 -0
  23. package/dist/agentic/event-bridge.d.ts +350 -0
  24. package/dist/agentic/event-bridge.js +9 -0
  25. package/dist/agentic/event-bridge.js.map +1 -0
  26. package/dist/agentic/executor.d.ts +91 -0
  27. package/dist/agentic/executor.js +12 -0
  28. package/dist/agentic/executor.js.map +1 -0
  29. package/dist/agentic/graph-projection.d.ts +119 -0
  30. package/dist/agentic/graph-projection.js +7 -0
  31. package/dist/agentic/graph-projection.js.map +1 -0
  32. package/dist/agentic/graph.d.ts +524 -0
  33. package/dist/agentic/graph.js +7 -0
  34. package/dist/agentic/graph.js.map +1 -0
  35. package/dist/agentic/index.d.ts +28 -0
  36. package/dist/agentic/index.js +87 -0
  37. package/dist/agentic/index.js.map +1 -0
  38. package/dist/agentic/local-runner.d.ts +106 -0
  39. package/dist/agentic/local-runner.js +7 -0
  40. package/dist/agentic/local-runner.js.map +1 -0
  41. package/dist/agentic/remote-executor.d.ts +67 -0
  42. package/dist/agentic/remote-executor.js +8 -0
  43. package/dist/agentic/remote-executor.js.map +1 -0
  44. package/dist/agentic/types.d.ts +157 -0
  45. package/dist/agentic/types.js +7 -0
  46. package/dist/agentic/types.js.map +1 -0
  47. package/dist/agentic/workflow-catalog.d.ts +152 -0
  48. package/dist/agentic/workflow-catalog.js +7 -0
  49. package/dist/agentic/workflow-catalog.js.map +1 -0
  50. package/dist/agentic/workflow-compiler.d.ts +44 -0
  51. package/dist/agentic/workflow-compiler.js +8 -0
  52. package/dist/agentic/workflow-compiler.js.map +1 -0
  53. package/dist/agentic/workflow-coordinator.d.ts +170 -0
  54. package/dist/agentic/workflow-coordinator.js +8 -0
  55. package/dist/agentic/workflow-coordinator.js.map +1 -0
  56. package/dist/agentic/workflow-manager.d.ts +91 -0
  57. package/dist/agentic/workflow-manager.js +7 -0
  58. package/dist/agentic/workflow-manager.js.map +1 -0
  59. package/dist/agentic/workflow-registry.d.ts +334 -0
  60. package/dist/agentic/workflow-registry.js +7 -0
  61. package/dist/agentic/workflow-registry.js.map +1 -0
  62. package/dist/artifacts-CteHmCMI.d.ts +614 -0
  63. package/dist/auth-hooks/api-key.d.ts +75 -0
  64. package/dist/auth-hooks/api-key.js +7 -0
  65. package/dist/auth-hooks/api-key.js.map +1 -0
  66. package/dist/auth-hooks/index.d.ts +80 -0
  67. package/dist/auth-hooks/index.js +28 -0
  68. package/dist/auth-hooks/index.js.map +1 -0
  69. package/dist/browser-auth/account-memberships.d.ts +213 -0
  70. package/dist/browser-auth/account-memberships.js +13 -0
  71. package/dist/browser-auth/account-memberships.js.map +1 -0
  72. package/dist/browser-auth/index.d.ts +8 -0
  73. package/dist/browser-auth/index.js +59 -0
  74. package/dist/browser-auth/index.js.map +1 -0
  75. package/dist/browser-auth/kratos-session.d.ts +37 -0
  76. package/dist/browser-auth/kratos-session.js +7 -0
  77. package/dist/browser-auth/kratos-session.js.map +1 -0
  78. package/dist/browser-auth/platform-session.d.ts +120 -0
  79. package/dist/browser-auth/platform-session.js +7 -0
  80. package/dist/browser-auth/platform-session.js.map +1 -0
  81. package/dist/browser-auth/public-memberships.d.ts +22 -0
  82. package/dist/browser-auth/public-memberships.js +7 -0
  83. package/dist/browser-auth/public-memberships.js.map +1 -0
  84. package/dist/cache/index.d.ts +181 -0
  85. package/dist/cache/index.js +197 -0
  86. package/dist/cache/index.js.map +1 -0
  87. package/dist/chunk-32746UQZ.js +131 -0
  88. package/dist/chunk-32746UQZ.js.map +1 -0
  89. package/dist/chunk-3NLSWP2Y.js +223 -0
  90. package/dist/chunk-3NLSWP2Y.js.map +1 -0
  91. package/dist/chunk-3P4XTTQH.js +346 -0
  92. package/dist/chunk-3P4XTTQH.js.map +1 -0
  93. package/dist/chunk-3VITSHN3.js +15 -0
  94. package/dist/chunk-3VITSHN3.js.map +1 -0
  95. package/dist/chunk-46UWPEW2.js +226 -0
  96. package/dist/chunk-46UWPEW2.js.map +1 -0
  97. package/dist/chunk-4BARRLJR.js +180 -0
  98. package/dist/chunk-4BARRLJR.js.map +1 -0
  99. package/dist/chunk-4VORUFKR.js +45 -0
  100. package/dist/chunk-4VORUFKR.js.map +1 -0
  101. package/dist/chunk-55D4ERWO.js +1 -0
  102. package/dist/chunk-55D4ERWO.js.map +1 -0
  103. package/dist/chunk-5TBBZIND.js +18 -0
  104. package/dist/chunk-5TBBZIND.js.map +1 -0
  105. package/dist/chunk-5WOZWPZA.js +211 -0
  106. package/dist/chunk-5WOZWPZA.js.map +1 -0
  107. package/dist/chunk-6CBVZ6CT.js +168 -0
  108. package/dist/chunk-6CBVZ6CT.js.map +1 -0
  109. package/dist/chunk-6XZXYNJR.js +74 -0
  110. package/dist/chunk-6XZXYNJR.js.map +1 -0
  111. package/dist/chunk-753HWDSC.js +222 -0
  112. package/dist/chunk-753HWDSC.js.map +1 -0
  113. package/dist/chunk-7AHSS7SO.js +81 -0
  114. package/dist/chunk-7AHSS7SO.js.map +1 -0
  115. package/dist/chunk-7FTJN4SA.js +1 -0
  116. package/dist/chunk-7FTJN4SA.js.map +1 -0
  117. package/dist/chunk-AVDMLTPF.js +24 -0
  118. package/dist/chunk-AVDMLTPF.js.map +1 -0
  119. package/dist/chunk-BKAHUEIT.js +95 -0
  120. package/dist/chunk-BKAHUEIT.js.map +1 -0
  121. package/dist/chunk-CJ7OFEF7.js +134 -0
  122. package/dist/chunk-CJ7OFEF7.js.map +1 -0
  123. package/dist/chunk-EJKWDZIU.js +111 -0
  124. package/dist/chunk-EJKWDZIU.js.map +1 -0
  125. package/dist/chunk-F2J6IQ6I.js +247 -0
  126. package/dist/chunk-F2J6IQ6I.js.map +1 -0
  127. package/dist/chunk-F3O7CELI.js +23 -0
  128. package/dist/chunk-F3O7CELI.js.map +1 -0
  129. package/dist/chunk-F4IITPGX.js +221 -0
  130. package/dist/chunk-F4IITPGX.js.map +1 -0
  131. package/dist/chunk-FD6VC2NA.js +66 -0
  132. package/dist/chunk-FD6VC2NA.js.map +1 -0
  133. package/dist/chunk-FRRRWAHO.js +14 -0
  134. package/dist/chunk-FRRRWAHO.js.map +1 -0
  135. package/dist/chunk-HCKAGLLB.js +17 -0
  136. package/dist/chunk-HCKAGLLB.js.map +1 -0
  137. package/dist/chunk-HVC7FG6B.js +191 -0
  138. package/dist/chunk-HVC7FG6B.js.map +1 -0
  139. package/dist/chunk-HXFVOR7Z.js +496 -0
  140. package/dist/chunk-HXFVOR7Z.js.map +1 -0
  141. package/dist/chunk-IJWYS2PF.js +122 -0
  142. package/dist/chunk-IJWYS2PF.js.map +1 -0
  143. package/dist/chunk-INCHXAFK.js +1395 -0
  144. package/dist/chunk-INCHXAFK.js.map +1 -0
  145. package/dist/chunk-JT6BRGQM.js +1 -0
  146. package/dist/chunk-JT6BRGQM.js.map +1 -0
  147. package/dist/chunk-L6PMAEMB.js +115 -0
  148. package/dist/chunk-L6PMAEMB.js.map +1 -0
  149. package/dist/chunk-LOUGW6MU.js +126 -0
  150. package/dist/chunk-LOUGW6MU.js.map +1 -0
  151. package/dist/chunk-LYPZPE53.js +129 -0
  152. package/dist/chunk-LYPZPE53.js.map +1 -0
  153. package/dist/chunk-NNCCN7JP.js +186 -0
  154. package/dist/chunk-NNCCN7JP.js.map +1 -0
  155. package/dist/chunk-PBC3MZUL.js +212 -0
  156. package/dist/chunk-PBC3MZUL.js.map +1 -0
  157. package/dist/chunk-R4ADP2DC.js +20 -0
  158. package/dist/chunk-R4ADP2DC.js.map +1 -0
  159. package/dist/chunk-RHN4Y6VS.js +44 -0
  160. package/dist/chunk-RHN4Y6VS.js.map +1 -0
  161. package/dist/chunk-SDJNYPYK.js +770 -0
  162. package/dist/chunk-SDJNYPYK.js.map +1 -0
  163. package/dist/chunk-UGNTCOVR.js +28 -0
  164. package/dist/chunk-UGNTCOVR.js.map +1 -0
  165. package/dist/chunk-VC2PCK2S.js +31 -0
  166. package/dist/chunk-VC2PCK2S.js.map +1 -0
  167. package/dist/chunk-VF5YDZJC.js +305 -0
  168. package/dist/chunk-VF5YDZJC.js.map +1 -0
  169. package/dist/chunk-VISRDVTK.js +675 -0
  170. package/dist/chunk-VISRDVTK.js.map +1 -0
  171. package/dist/chunk-W6O3LVBY.js +102 -0
  172. package/dist/chunk-W6O3LVBY.js.map +1 -0
  173. package/dist/chunk-WFEAKJLR.js +47 -0
  174. package/dist/chunk-WFEAKJLR.js.map +1 -0
  175. package/dist/chunk-XIEY2OF4.js +67 -0
  176. package/dist/chunk-XIEY2OF4.js.map +1 -0
  177. package/dist/chunk-XITLHDG3.js +37 -0
  178. package/dist/chunk-XITLHDG3.js.map +1 -0
  179. package/dist/chunk-XMWPYZWZ.js +61 -0
  180. package/dist/chunk-XMWPYZWZ.js.map +1 -0
  181. package/dist/chunk-XUP6CNOM.js +34 -0
  182. package/dist/chunk-XUP6CNOM.js.map +1 -0
  183. package/dist/chunk-YABTQZDJ.js +25 -0
  184. package/dist/chunk-YABTQZDJ.js.map +1 -0
  185. package/dist/chunk-YMHVRBUU.js +199 -0
  186. package/dist/chunk-YMHVRBUU.js.map +1 -0
  187. package/dist/chunk-YMJ7BRKU.js +510 -0
  188. package/dist/chunk-YMJ7BRKU.js.map +1 -0
  189. package/dist/chunk-ZC3XWU7B.js +28 -0
  190. package/dist/chunk-ZC3XWU7B.js.map +1 -0
  191. package/dist/chunk-ZHMTD5KV.js +90 -0
  192. package/dist/chunk-ZHMTD5KV.js.map +1 -0
  193. package/dist/chunk-ZWZDLOE7.js +160 -0
  194. package/dist/chunk-ZWZDLOE7.js.map +1 -0
  195. package/dist/db-package/db/local-first-sqlite-adapter.d.ts +432 -0
  196. package/dist/db-package/db/local-first-sqlite-adapter.js +7 -0
  197. package/dist/db-package/db/local-first-sqlite-adapter.js.map +1 -0
  198. package/dist/db-package/index.d.ts +7 -0
  199. package/dist/db-package/index.js +16 -0
  200. package/dist/db-package/index.js.map +1 -0
  201. package/dist/db-package/migration/aggregator.d.ts +86 -0
  202. package/dist/db-package/migration/aggregator.js +7 -0
  203. package/dist/db-package/migration/aggregator.js.map +1 -0
  204. package/dist/db-package/migration/index.d.ts +3 -0
  205. package/dist/db-package/migration/index.js +8 -0
  206. package/dist/db-package/migration/index.js.map +1 -0
  207. package/dist/engine.d.ts +205 -0
  208. package/dist/engine.js +20 -0
  209. package/dist/engine.js.map +1 -0
  210. package/dist/entitlements/index.d.ts +313 -0
  211. package/dist/entitlements/index.js +23 -0
  212. package/dist/entitlements/index.js.map +1 -0
  213. package/dist/execution/chat.d.ts +7 -0
  214. package/dist/execution/chat.js +7 -0
  215. package/dist/execution/chat.js.map +1 -0
  216. package/dist/execution/index.d.ts +342 -0
  217. package/dist/execution/index.js +66 -0
  218. package/dist/execution/index.js.map +1 -0
  219. package/dist/execution/tool-agent.d.ts +7 -0
  220. package/dist/execution/tool-agent.js +8 -0
  221. package/dist/execution/tool-agent.js.map +1 -0
  222. package/dist/extensions/index.d.ts +172 -0
  223. package/dist/extensions/index.js +95 -0
  224. package/dist/extensions/index.js.map +1 -0
  225. package/dist/health/index.d.ts +35 -0
  226. package/dist/health/index.js +7 -0
  227. package/dist/health/index.js.map +1 -0
  228. package/dist/index.d.ts +43 -0
  229. package/dist/index.js +161 -0
  230. package/dist/index.js.map +1 -0
  231. package/dist/lifecycle/index.d.ts +133 -0
  232. package/dist/lifecycle/index.js +13 -0
  233. package/dist/lifecycle/index.js.map +1 -0
  234. package/dist/lifecycle-engine/backend-migration.d.ts +2 -0
  235. package/dist/lifecycle-engine/backend-migration.js +11 -0
  236. package/dist/lifecycle-engine/backend-migration.js.map +1 -0
  237. package/dist/lifecycle-engine/baseline.d.ts +2 -0
  238. package/dist/lifecycle-engine/baseline.js +9 -0
  239. package/dist/lifecycle-engine/baseline.js.map +1 -0
  240. package/dist/lifecycle-engine/index.d.ts +1497 -0
  241. package/dist/lifecycle-engine/index.js +41 -0
  242. package/dist/lifecycle-engine/index.js.map +1 -0
  243. package/dist/lifecycle-engine/platform/artifacts.d.ts +4 -0
  244. package/dist/lifecycle-engine/platform/artifacts.js +7 -0
  245. package/dist/lifecycle-engine/platform/artifacts.js.map +1 -0
  246. package/dist/lifecycle-engine/platform/control-plane.d.ts +12 -0
  247. package/dist/lifecycle-engine/platform/control-plane.js +2 -0
  248. package/dist/lifecycle-engine/platform/control-plane.js.map +1 -0
  249. package/dist/lifecycle-engine/platform/database-router.d.ts +118 -0
  250. package/dist/lifecycle-engine/platform/database-router.js +7 -0
  251. package/dist/lifecycle-engine/platform/database-router.js.map +1 -0
  252. package/dist/lifecycle-engine/platform/deployment-placements.d.ts +464 -0
  253. package/dist/lifecycle-engine/platform/deployment-placements.js +16 -0
  254. package/dist/lifecycle-engine/platform/deployment-placements.js.map +1 -0
  255. package/dist/lifecycle-engine/platform/deployment.d.ts +4 -0
  256. package/dist/lifecycle-engine/platform/deployment.js +17 -0
  257. package/dist/lifecycle-engine/platform/deployment.js.map +1 -0
  258. package/dist/lifecycle-engine/platform/index.d.ts +737 -0
  259. package/dist/lifecycle-engine/platform/index.js +60 -0
  260. package/dist/lifecycle-engine/platform/index.js.map +1 -0
  261. package/dist/lifecycle-engine/platform/runtime.d.ts +80 -0
  262. package/dist/lifecycle-engine/platform/runtime.js +11 -0
  263. package/dist/lifecycle-engine/platform/runtime.js.map +1 -0
  264. package/dist/lifecycle-engine/platform/site-publication.d.ts +102 -0
  265. package/dist/lifecycle-engine/platform/site-publication.js +7 -0
  266. package/dist/lifecycle-engine/platform/site-publication.js.map +1 -0
  267. package/dist/lifecycle-engine/platform/user-directory.d.ts +139 -0
  268. package/dist/lifecycle-engine/platform/user-directory.js +13 -0
  269. package/dist/lifecycle-engine/platform/user-directory.js.map +1 -0
  270. package/dist/mcp.d.ts +92 -0
  271. package/dist/mcp.js +10 -0
  272. package/dist/mcp.js.map +1 -0
  273. package/dist/middleware/auth.d.ts +118 -0
  274. package/dist/middleware/auth.js +7 -0
  275. package/dist/middleware/auth.js.map +1 -0
  276. package/dist/middleware/error-handler.d.ts +35 -0
  277. package/dist/middleware/error-handler.js +7 -0
  278. package/dist/middleware/error-handler.js.map +1 -0
  279. package/dist/middleware/module-guard.d.ts +33 -0
  280. package/dist/middleware/module-guard.js +7 -0
  281. package/dist/middleware/module-guard.js.map +1 -0
  282. package/dist/platform-admin/index.d.ts +37 -0
  283. package/dist/platform-admin/index.js +11 -0
  284. package/dist/platform-admin/index.js.map +1 -0
  285. package/dist/platform-admin/store.d.ts +346 -0
  286. package/dist/platform-admin/store.js +7 -0
  287. package/dist/platform-admin/store.js.map +1 -0
  288. package/dist/plugin-data/annotations.d.ts +6 -0
  289. package/dist/plugin-data/annotations.js +12 -0
  290. package/dist/plugin-data/annotations.js.map +1 -0
  291. package/dist/plugin-data/atomic-context.d.ts +41 -0
  292. package/dist/plugin-data/atomic-context.js +9 -0
  293. package/dist/plugin-data/atomic-context.js.map +1 -0
  294. package/dist/plugin-data/atomic.d.ts +6 -0
  295. package/dist/plugin-data/atomic.js +26 -0
  296. package/dist/plugin-data/atomic.js.map +1 -0
  297. package/dist/plugin-data/audit.d.ts +6 -0
  298. package/dist/plugin-data/audit.js +12 -0
  299. package/dist/plugin-data/audit.js.map +1 -0
  300. package/dist/plugin-data/commands.d.ts +6 -0
  301. package/dist/plugin-data/commands.js +8 -0
  302. package/dist/plugin-data/commands.js.map +1 -0
  303. package/dist/plugin-data/composite.d.ts +6 -0
  304. package/dist/plugin-data/composite.js +8 -0
  305. package/dist/plugin-data/composite.js.map +1 -0
  306. package/dist/plugin-data/delivery.d.ts +6 -0
  307. package/dist/plugin-data/delivery.js +16 -0
  308. package/dist/plugin-data/delivery.js.map +1 -0
  309. package/dist/plugin-data/index.d.ts +2798 -0
  310. package/dist/plugin-data/index.js +102 -0
  311. package/dist/plugin-data/index.js.map +1 -0
  312. package/dist/plugin-data/json-documents.d.ts +6 -0
  313. package/dist/plugin-data/json-documents.js +16 -0
  314. package/dist/plugin-data/json-documents.js.map +1 -0
  315. package/dist/plugin-data/outbox.d.ts +6 -0
  316. package/dist/plugin-data/outbox.js +16 -0
  317. package/dist/plugin-data/outbox.js.map +1 -0
  318. package/dist/plugin-data/scoped-records.d.ts +6 -0
  319. package/dist/plugin-data/scoped-records.js +10 -0
  320. package/dist/plugin-data/scoped-records.js.map +1 -0
  321. package/dist/plugin-sdk.d.ts +41 -0
  322. package/dist/plugin-sdk.js +10 -0
  323. package/dist/plugin-sdk.js.map +1 -0
  324. package/dist/sql-lifecycle/index.d.ts +138 -0
  325. package/dist/sql-lifecycle/index.js +167 -0
  326. package/dist/sql-lifecycle/index.js.map +1 -0
  327. package/dist/storage/index.d.ts +2 -0
  328. package/dist/storage/index.js +13 -0
  329. package/dist/storage/index.js.map +1 -0
  330. package/dist/storage/s3-compatible.d.ts +139 -0
  331. package/dist/storage/s3-compatible.js +11 -0
  332. package/dist/storage/s3-compatible.js.map +1 -0
  333. package/dist/tenant.d.ts +108 -0
  334. package/dist/tenant.js +9 -0
  335. package/dist/tenant.js.map +1 -0
  336. package/dist/workspace-context.d.ts +119 -0
  337. package/dist/workspace-context.js +9 -0
  338. package/dist/workspace-context.js.map +1 -0
  339. package/docs/api.md +30560 -0
  340. package/docs/db/README.md +49 -0
  341. package/docs/db/docs/api.md +1613 -0
  342. package/docs/db/docs/guide.md +47 -0
  343. package/docs/entitlements.md +60 -0
  344. package/docs/guide.md +92 -0
  345. package/docs/index.md +57 -0
  346. package/docs/ja/db/README.md +46 -0
  347. package/docs/ja/db/docs/guide.md +53 -0
  348. package/docs/ja/guide.md +46 -0
  349. package/docs/ja/lifecycle/README.md +46 -0
  350. package/docs/ja/lifecycle/docs/guide.md +45 -0
  351. package/docs/ja/storage/README.md +46 -0
  352. package/docs/ja/storage/docs/guide.md +43 -0
  353. package/docs/lifecycle/README.md +49 -0
  354. package/docs/lifecycle/docs/api.md +3770 -0
  355. package/docs/lifecycle/docs/baseline.md +50 -0
  356. package/docs/lifecycle/docs/guide.md +47 -0
  357. package/docs/storage/README.md +49 -0
  358. package/docs/storage/docs/api.md +470 -0
  359. package/docs/storage/docs/guide.md +47 -0
  360. package/package.json +354 -4
@@ -0,0 +1,170 @@
1
+ import { WorkflowInstanceRecord } from '@alneas/eaos-core';
2
+ import { AgentGraphEngine, AgentGraphState } from './graph.js';
3
+ import { ServerWorkflowManager, ServerWorkflowOptions } from './workflow-manager.js';
4
+ import { ServerApprovalCallbackPayload } from './types.js';
5
+ import '@langchain/langgraph';
6
+
7
+ /**
8
+ * Durable business-instance record with host compare-and-swap revision.
9
+ * @see DurableWorkflowCoordinator.
10
+ */
11
+ interface StoredWorkflowInstance {
12
+ /** Workflow instance ID, aligned with graph sessionId. */
13
+ id: string;
14
+ /** Host CAS revision, starting at one for coordinator-created records. */
15
+ revision: number;
16
+ /** Domain workflow instance metadata; graph payload remains in its checkpointer. */
17
+ value: WorkflowInstanceRecord;
18
+ }
19
+ /** Host-owned durable store for the companion workflow instance record.
20
+ * @see DurableWorkflowCoordinator for usage.
21
+ */
22
+ interface WorkflowInstanceStore {
23
+ /**
24
+ * Reads an authorized tenant's companion instance.
25
+ * @param tenantId - Verified owning tenant.
26
+ * @param instanceId - Workflow session/instance ID.
27
+ * @returns Stored record, or null if absent.
28
+ * @throws Persistence failures propagate.
29
+
30
+ * @example
31
+ * ```typescript
32
+ * import type { WorkflowInstanceStore } from "@alneas/eaos-server";
33
+ * export async function readTenantInstance(
34
+ * store: WorkflowInstanceStore, verifiedTenantId: string, instanceId: string,
35
+ * ) {
36
+ * const record = await store.read(verifiedTenantId, instanceId);
37
+ * return record?.value.status; // A missing instance yields undefined here.
38
+ * }
39
+ * ```
40
+ */
41
+ read(tenantId: string, instanceId: string): Promise<StoredWorkflowInstance | null>;
42
+ /**
43
+ * Atomically inserts a new companion instance, rejecting duplicates.
44
+ * @param tenantId - Verified owning tenant.
45
+ * @param record - Initial revision-one queued record.
46
+ * @returns No value; resolves when durable creation completes.
47
+ * @throws Duplicate/conflicting identity or persistence failure must reject.
48
+
49
+ * @example
50
+ * ```typescript
51
+ * import type { WorkflowInstanceStore } from "@alneas/eaos-server";
52
+ * export async function createQueuedInstance(
53
+ * store: WorkflowInstanceStore, verifiedTenantId: string,
54
+ * initialRecord: Parameters<WorkflowInstanceStore["create"]>[1],
55
+ * ) {
56
+ * // Supply an aligned, admitted revision-one queued record.
57
+ * await store.create(verifiedTenantId, initialRecord);
58
+ * }
59
+ * ```
60
+ */
61
+ create(tenantId: string, record: StoredWorkflowInstance): Promise<void>;
62
+ /**
63
+ * Atomically replaces a companion record only if its revision matches.
64
+ * @param tenantId - Verified owning tenant.
65
+ * @param record - Replacement with incremented revision.
66
+ * @param expectedRevision - Previously read revision required for CAS.
67
+ * @returns True on replacement, false on stale revision.
68
+ * @throws Persistence failures propagate.
69
+
70
+ * @example
71
+ * ```typescript
72
+ * import type { WorkflowInstanceStore } from "@alneas/eaos-server";
73
+ * export async function replaceTenantInstance(
74
+ * store: WorkflowInstanceStore, verifiedTenantId: string,
75
+ * nextRecord: Parameters<WorkflowInstanceStore["replace"]>[1], previouslyReadRevision: number,
76
+ * ) {
77
+ * // nextRecord has the incremented revision; false means another writer won.
78
+ * return await store.replace(verifiedTenantId, nextRecord, previouslyReadRevision);
79
+ * }
80
+ * ```
81
+ */
82
+ replace(tenantId: string, record: StoredWorkflowInstance, expectedRevision: number): Promise<boolean>;
83
+ }
84
+ /**
85
+ * Workflow notification/approval callbacks plus durable companion-instance storage.
86
+ * @see DurableWorkflowCoordinator.
87
+ */
88
+ interface DurableWorkflowCoordinatorOptions extends ServerWorkflowOptions {
89
+ /** Host-authorized tenant-scoped store with atomic create and revision checks. */
90
+ store: WorkflowInstanceStore;
91
+ }
92
+ /**
93
+ * Keeps the business workflow instance synchronized with the LangGraph
94
+ * checkpoint without making either one the other's database implementation.
95
+ * @remarks Checkpoint and companion record updates are separate operations; failures can leave them temporarily divergent. The host owns writer serialization, tenant authorization, durable stores, and reconciliation rather than blind retry after partial outcomes.
96
+ * @example
97
+ * ```typescript
98
+ * import { DurableWorkflowCoordinator } from "@alneas/eaos-server/agentic/workflow-coordinator";
99
+ * import type { DurableWorkflowCoordinatorOptions } from "@alneas/eaos-server/agentic/workflow-coordinator";
100
+ * export function coordinator(options: DurableWorkflowCoordinatorOptions) { return new DurableWorkflowCoordinator(options); }
101
+ * ```
102
+ */
103
+ declare class DurableWorkflowCoordinator extends ServerWorkflowManager {
104
+ private readonly store;
105
+ /**
106
+ * Captures workflow callbacks and required durable instance store.
107
+ * @param options - Host store, approval notification, and live resume authorization.
108
+ * @throws If store is missing.
109
+ */
110
+ constructor(options: DurableWorkflowCoordinatorOptions);
111
+ /**
112
+ * Creates a queued companion instance then runs and persists its graph outcome.
113
+ * @param graph - Configured graph with appropriate checkpoint persistence.
114
+ * @param record - Host-admitted instance metadata; instanceId and tenantId must match initialState.
115
+ * @param initialState - Verified workflow identity and starting state.
116
+ * @returns Graph state after execution and companion CAS persistence.
117
+ * @throws Rejects alignment mismatch, existing instance, graph/callback/clone/store failures, or companion revision conflict.
118
+ * @remarks The queued record can exist even if graph execution later fails; no cross-store rollback occurs. Atomic duplicate prevention belongs to store.create.
119
+ * @example
120
+ * ```typescript
121
+ * import { DurableWorkflowCoordinator } from "@alneas/eaos-server/agentic/workflow-coordinator";
122
+ * import type { AgentGraphEngine, AgentGraphState } from "@alneas/eaos-server/agentic/graph";
123
+ * import type { WorkflowInstanceRecord } from "@alneas/eaos-core";
124
+ * export async function start(coordinator: DurableWorkflowCoordinator, graph: AgentGraphEngine, record: WorkflowInstanceRecord, state: AgentGraphState) { return coordinator.start(graph, record, state); }
125
+ * ```
126
+ */
127
+ start(graph: AgentGraphEngine, record: WorkflowInstanceRecord, initialState: AgentGraphState): Promise<AgentGraphState>;
128
+ /**
129
+ * Runs an existing graph instance and CAS-updates its companion status.
130
+ * @param graph - Graph whose session already has a companion record.
131
+ * @param initialState - Verified state aligned with that record.
132
+ * @returns Graph result after companion persistence; status prioritizes pending approval, error, completion, then running.
133
+ * @throws Graph/store/clock failures, missing companion, or changed revision; graph checkpoints may already have advanced.
134
+ * @example
135
+ * ```typescript
136
+ * import { DurableWorkflowCoordinator } from "@alneas/eaos-server/agentic/workflow-coordinator";
137
+ * import type { AgentGraphEngine, AgentGraphState } from "@alneas/eaos-server/agentic/graph";
138
+ * export async function run(coordinator: DurableWorkflowCoordinator, graph: AgentGraphEngine, state: AgentGraphState) { return coordinator.runWorkflow(graph, state); }
139
+ * ```
140
+ */
141
+ runWorkflow(graph: AgentGraphEngine, initialState: AgentGraphState): Promise<AgentGraphState>;
142
+ /**
143
+ * Resumes a verified graph approval then persists its resulting companion state.
144
+ * @param graph - Graph owning the pending checkpoint.
145
+ * @param payload - Host-authenticated approver decision and optional binding checks.
146
+ * @returns Resume outcome; companion persistence failure becomes resumed:false error data even when graph resume already succeeded.
147
+ * @throws Underlying graph/store failures outside normalized resume/persistence handling may reject.
148
+ * @remarks A false result does not prove no side effects occurred; reconcile graph and companion state before retrying.
149
+ * @example
150
+ * ```typescript
151
+ * import { DurableWorkflowCoordinator } from "@alneas/eaos-server/agentic/workflow-coordinator";
152
+ * import type { AgentGraphEngine } from "@alneas/eaos-server/agentic/graph";
153
+ * import type { ServerApprovalCallbackPayload } from "@alneas/eaos-server/agentic/types";
154
+ * export async function approve(coordinator: DurableWorkflowCoordinator, graph: AgentGraphEngine, payload: ServerApprovalCallbackPayload) { return coordinator.handleApproval(graph, payload); }
155
+ * ```
156
+ */
157
+ handleApproval(graph: AgentGraphEngine, payload: ServerApprovalCallbackPayload): Promise<{
158
+ /** True only when graph resumption and companion-instance persistence complete; false may also mean companion persistence failed after the graph advanced. */
159
+ resumed: boolean;
160
+ /** Optional resumed graph state returned when companion persistence succeeds; omitted when companion persistence is normalized into failure data. */
161
+ state?: AgentGraphState;
162
+ /** Optional graph resume or companion persistence failure detail; reconcile both stores before retrying because graph effects may already have completed. */
163
+ error?: string;
164
+ }>;
165
+ private runAndPersist;
166
+ private persist;
167
+ }
168
+
169
+ export { DurableWorkflowCoordinator };
170
+ export type { DurableWorkflowCoordinatorOptions, StoredWorkflowInstance, WorkflowInstanceStore };
@@ -0,0 +1,8 @@
1
+ import {
2
+ DurableWorkflowCoordinator
3
+ } from "../chunk-EJKWDZIU.js";
4
+ import "../chunk-FD6VC2NA.js";
5
+ export {
6
+ DurableWorkflowCoordinator
7
+ };
8
+ //# sourceMappingURL=workflow-coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,91 @@
1
+ import { AgentGraphState, AgentGraphEngine } from './graph.js';
2
+ import { ServerApprovalCallbackPayload } from './types.js';
3
+ import '@langchain/langgraph';
4
+ import '@alneas/eaos-core';
5
+
6
+ /**
7
+ * Host notification and approval authority callbacks used by {@link ServerWorkflowManager}.
8
+ */
9
+ interface ServerWorkflowOptions {
10
+ /** Called after runStep returns pendingApproval; receives the returned state. Notification failures are warned and do not fail runWorkflow. */
11
+ onApprovalRequired?: (state: AgentGraphState) => Promise<void>;
12
+ /** Live host approval check receiving workflow state and verified approver/decision; must resolve true to permit resume. Errors are delegated to graph resume handling. */
13
+ authorizeResume?: (state: AgentGraphState, input: {
14
+ /**
15
+ * Host-authenticated approver identifier attached to the pending decision.
16
+ */
17
+ approverId: string;
18
+ /**
19
+ * Host-verified approver role to recheck against current resource/approval policy.
20
+ */
21
+ approverRole: string;
22
+ /**
23
+ * True requests continuation; false requests rejection, and a supplied authorizer also checks that decision.
24
+ */
25
+ approved: boolean;
26
+ }) => Promise<boolean>;
27
+ }
28
+ /**
29
+ * Coordinates graph execution and host approval notifications without choosing a notification transport.
30
+ * @remarks Checkpoint persistence and approval binding are delegated to AgentGraphEngine; the host authenticates approval callbacks. No webhook listener, retry queue, or delivery guarantee is installed.
31
+ * @example
32
+ * ```typescript
33
+ * import { ServerWorkflowManager, type ServerWorkflowOptions } from "@alneas/eaos-server/agentic/workflow-manager";
34
+ * export function workflowManager(options: ServerWorkflowOptions) {
35
+ * return new ServerWorkflowManager(options);
36
+ * }
37
+ * ```
38
+ */
39
+ declare class ServerWorkflowManager {
40
+ private onApprovalRequired?;
41
+ private authorizeResume?;
42
+ /**
43
+ * Captures optional host approval notification and authorization callbacks.
44
+ * @param options - Host callbacks; omitted options perform no external notification and supply no resume authorizer.
45
+ */
46
+ constructor(options?: ServerWorkflowOptions);
47
+ /**
48
+ * Runs the graph and notifies the host if execution pauses for approval.
49
+ * @param graph - Configured graph with appropriate durable checkpointer/admission.
50
+ * @param initialState - Verified workflow identity and starting state.
51
+ * @returns Graph state after runStep, including any pending approval; notification failures do not change it.
52
+ * @throws Rejects graph execution failures; notification errors are caught and warned.
53
+ * @example
54
+ * ```typescript
55
+ * import { ServerWorkflowManager } from "@alneas/eaos-server/agentic/workflow-manager";
56
+ * import type { AgentGraphEngine, AgentGraphState } from "@alneas/eaos-server/agentic/graph";
57
+ * export async function run(graph: AgentGraphEngine, initialState: AgentGraphState) {
58
+ * return new ServerWorkflowManager().runWorkflow(graph, initialState);
59
+ * }
60
+ * ```
61
+ */
62
+ runWorkflow(graph: AgentGraphEngine, initialState: AgentGraphState): Promise<AgentGraphState>;
63
+ /**
64
+ * Delegates an authenticated approval decision to graph checkpoint/binding verification and resume.
65
+ * @param graph - Graph owning the pending task checkpoint.
66
+ * @param payload - Verified approver decision with optional approval/hash bindings; taskId selects the graph session.
67
+ * @returns Resume outcome, optional updated state, or failure data from resumeAfterApproval.
68
+ * @throws Propagates graph/checkpointer errors not normalized by resumeAfterApproval.
69
+ * @remarks The host verifies caller identity and role before constructing payload. This wrapper does not send a second approval notification after resume.
70
+ * @example
71
+ * ```typescript
72
+ * import { ServerWorkflowManager, type ServerWorkflowOptions } from "@alneas/eaos-server/agentic/workflow-manager";
73
+ * import type { AgentGraphEngine } from "@alneas/eaos-server/agentic/graph";
74
+ * import type { ServerApprovalCallbackPayload } from "@alneas/eaos-server/agentic/types";
75
+ * export async function approve(graph: AgentGraphEngine, options: ServerWorkflowOptions, payload: ServerApprovalCallbackPayload) {
76
+ * return new ServerWorkflowManager(options).handleApproval(graph, payload);
77
+ * }
78
+ * ```
79
+ */
80
+ handleApproval(graph: AgentGraphEngine, payload: ServerApprovalCallbackPayload): Promise<{
81
+ /** Whether graph approval verification/resumption produced a saved state; false can follow partial effects and is not proof that nothing ran. */
82
+ resumed: boolean;
83
+ /** Optional graph checkpoint state returned after successful resumption; absent on the normalized failure paths. */
84
+ state?: AgentGraphState;
85
+ /** Optional normalized checkpoint, approval, authorization or invocation failure detail when resumed is false; other errors can still reject the Promise. */
86
+ error?: string;
87
+ }>;
88
+ }
89
+
90
+ export { ServerWorkflowManager };
91
+ export type { ServerWorkflowOptions };
@@ -0,0 +1,7 @@
1
+ import {
2
+ ServerWorkflowManager
3
+ } from "../chunk-FD6VC2NA.js";
4
+ export {
5
+ ServerWorkflowManager
6
+ };
7
+ //# sourceMappingURL=workflow-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,334 @@
1
+ import { WorkflowDefinitionLifecycle, WorkflowDefinition } from '@alneas/eaos-core';
2
+
3
+ /**
4
+ * Versioned workflow definition with lifecycle, integrity hash, revision, and actor/timestamp metadata.
5
+ * @see InMemoryWorkflowDefinitionRegistry.
6
+ */
7
+ interface WorkflowDefinitionRecord {
8
+ /** Workflow identifier copied from the validated definition. */
9
+ workflowId: string;
10
+ /** Immutable version key within a workflow after draft. */
11
+ version: string;
12
+ /** Current draft/validated/approved/published/retired lifecycle phase. */
13
+ status: WorkflowDefinitionLifecycle;
14
+ /** Validated serializable definition; returned records are cloned by this registry. */
15
+ definition: WorkflowDefinition;
16
+ /** Canonical SHA-256 definition hash calculated on saveDraft. */
17
+ definitionHash: string;
18
+ /** Record revision starting at one and incrementing on each saved transition. */
19
+ revision: number;
20
+ /** Creation timestamp from the registry clock. */
21
+ createdAt: string;
22
+ /** Latest transition timestamp from the registry clock. */
23
+ updatedAt: string;
24
+ /** Optional first author label. */
25
+ createdBy?: string;
26
+ /** Optional latest actor label. */
27
+ updatedBy?: string;
28
+ /** Optional approval timestamp. */
29
+ approvedAt?: string;
30
+ /** Optional approver label. */
31
+ approvedBy?: string;
32
+ /** Optional publication timestamp. */
33
+ publishedAt?: string;
34
+ /** Optional publisher label. */
35
+ publishedBy?: string;
36
+ /** Optional retirement timestamp. */
37
+ retiredAt?: string;
38
+ /** Optional retiring actor label. */
39
+ retiredBy?: string;
40
+ }
41
+ /**
42
+ * Workflow authoring lifecycle contract; durable hosts must supply authorization and consistent persistence.
43
+ * @see InMemoryWorkflowDefinitionRegistry for transition semantics.
44
+ */
45
+ interface WorkflowDefinitionRegistry {
46
+ /**
47
+ * Validates and inserts or replaces a draft version, incrementing its revision.
48
+ * @param definition - Unknown workflow definition validated by core validation.
49
+ * @param actorId - Optional author label recorded as creator/updater; not authenticated here.
50
+ * @returns A cloned draft record with canonical definition hash.
51
+ * @throws Invalid definition, non-draft existing version, clock/hash/clone failure.
52
+
53
+ * @example
54
+ * ```typescript
55
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
56
+ * export function saveReviewedDraft(
57
+ * registry: WorkflowDefinitionRegistry,
58
+ * definition: Parameters<WorkflowDefinitionRegistry["saveDraft"]>[0], authenticatedActorId: string,
59
+ * ) {
60
+ * // Supply a real host workflow definition with its registered node types.
61
+ * return registry.saveDraft(definition, authenticatedActorId);
62
+ * }
63
+ * ```
64
+ */
65
+ saveDraft(definition: unknown, actorId?: string): WorkflowDefinitionRecord;
66
+ /**
67
+ * Transitions an existing draft to validated after core and optional host checks.
68
+ * @param workflowId - Exact workflow identifier.
69
+ * @param version - Exact stored version.
70
+ * @param actorId - Optional updater label.
71
+ * @returns A cloned validated record with incremented revision.
72
+ * @throws Missing version, nondraft status, validation/callback/clock failure.
73
+
74
+ * @example
75
+ * ```typescript
76
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
77
+ * export function validateStoredDraft(
78
+ * registry: WorkflowDefinitionRegistry, workflowId: string, version: string, actorId: string,
79
+ * ) {
80
+ * const record = registry.validate(workflowId, version, actorId);
81
+ * return record.status; // Host/Core validation must succeed before transition.
82
+ * }
83
+ * ```
84
+ */
85
+ validate(workflowId: string, version: string, actorId?: string): WorkflowDefinitionRecord;
86
+ /**
87
+ * Transitions a validated version to approved and records approver metadata.
88
+ * @param workflowId - Exact workflow identifier.
89
+ * @param version - Exact stored version.
90
+ * @param actorId - Nonblank verified host approver label; no role check occurs here.
91
+ * @returns A cloned approved record.
92
+ * @throws Blank actor, missing version, nonvalidated status, or clock failure.
93
+
94
+ * @example
95
+ * ```typescript
96
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
97
+ * export function approveValidatedWorkflow(
98
+ * registry: WorkflowDefinitionRegistry, workflowId: string, version: string, authorizedApproverId: string,
99
+ * ) {
100
+ * // The host checks reviewer authority before requesting this lifecycle change.
101
+ * return registry.approve(workflowId, version, authorizedApproverId);
102
+ * }
103
+ * ```
104
+ */
105
+ approve(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
106
+ /**
107
+ * Publishes an approved version and retires any currently published version of the same workflow.
108
+ * @param workflowId - Exact workflow identifier.
109
+ * @param version - Approved version to publish.
110
+ * @param actorId - Nonblank verified host publisher label.
111
+ * @returns A cloned published record; previous published records become retired.
112
+ * @throws Blank actor, missing version, nonapproved status, or clock/clone failure; earlier retirement updates can already have occurred.
113
+
114
+ * @example
115
+ * ```typescript
116
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
117
+ * export function publishApprovedWorkflow(
118
+ * registry: WorkflowDefinitionRegistry, workflowId: string, version: string, authorizedPublisherId: string,
119
+ * ) {
120
+ * return registry.publish(workflowId, version, authorizedPublisherId);
121
+ * // Host execution can select the resulting published record explicitly.
122
+ * }
123
+ * ```
124
+ */
125
+ publish(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
126
+ /**
127
+ * Transitions a published version to retired and records retirement metadata.
128
+ * @param workflowId - Exact workflow identifier.
129
+ * @param version - Currently published version.
130
+ * @param actorId - Nonblank verified host operator label.
131
+ * @returns A cloned retired record.
132
+ * @throws Blank actor, missing version, nonpublished status, or clock failure.
133
+
134
+ * @example
135
+ * ```typescript
136
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
137
+ * export function retirePublishedWorkflow(
138
+ * registry: WorkflowDefinitionRegistry, workflowId: string, version: string, authorizedActorId: string,
139
+ * ) {
140
+ * return registry.retire(workflowId, version, authorizedActorId);
141
+ * }
142
+ * ```
143
+ */
144
+ retire(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
145
+ /**
146
+ * Reads one workflow version without mutating lifecycle state.
147
+ * @param workflowId - Exact workflow identifier.
148
+ * @param version - Exact stored version.
149
+ * @returns A cloned record, or undefined when absent.
150
+
151
+ * @example
152
+ * ```typescript
153
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
154
+ * export function inspectWorkflowVersion(
155
+ * registry: WorkflowDefinitionRegistry, workflowId: string, version: string,
156
+ * ) {
157
+ * return registry.get(workflowId, version); // Undefined when this version is absent.
158
+ * }
159
+ * ```
160
+ */
161
+ get(workflowId: string, version: string): WorkflowDefinitionRecord | undefined;
162
+ /**
163
+ * Finds the currently published version of one workflow.
164
+ * @param workflowId - Exact workflow identifier.
165
+ * @returns A cloned published record, or undefined when none exists.
166
+
167
+ * @example
168
+ * ```typescript
169
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
170
+ * export function inspectPublishedWorkflow(registry: WorkflowDefinitionRegistry, workflowId: string) {
171
+ * return registry.getPublished(workflowId); // Undefined when no version is published.
172
+ * }
173
+ * ```
174
+ */
175
+ getPublished(workflowId: string): WorkflowDefinitionRecord | undefined;
176
+ /**
177
+ * Lists records in insertion order with optional workflow filtering.
178
+ * @param workflowId - Exact workflow identifier to filter, or omit for all workflows.
179
+ * @returns Independent cloned records, or an empty array.
180
+
181
+ * @example
182
+ * ```typescript
183
+ * import type { WorkflowDefinitionRegistry } from "@alneas/eaos-server";
184
+ * export function listWorkflowVersions(registry: WorkflowDefinitionRegistry, workflowId: string) {
185
+ * return registry.list(workflowId).map(record => ({ version: record.version, status: record.status }));
186
+ * }
187
+ * ```
188
+ */
189
+ list(workflowId?: string): readonly WorkflowDefinitionRecord[];
190
+ }
191
+ /**
192
+ * Stores versioned workflow drafts and validated/approved/published/retired records in process memory.
193
+ * @remarks Reference registry for tests/local authoring; it performs no actor authentication, role authorization, durable storage, or cross-process coordination. Transitions increment record revision and preserve definitions after draft.
194
+ * @example
195
+ * ```typescript
196
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
197
+ * const registry = new InMemoryWorkflowDefinitionRegistry();
198
+ * console.log(registry.list()); // []
199
+ * ```
200
+ */
201
+ declare class InMemoryWorkflowDefinitionRegistry implements WorkflowDefinitionRegistry {
202
+ private readonly records;
203
+ private readonly now;
204
+ private readonly validateDefinition?;
205
+ /**
206
+ * Captures authoring clock and optional semantic validation callback.
207
+ * @param options - now returns a timestamp string and defaults to current ISO time; validate synchronously checks a structurally valid draft during validate and may throw.
208
+ */
209
+ constructor(options?: {
210
+ /**
211
+ * Optional timestamp-string clock used when creating/updating registry records; defaults to current ISO time.
212
+ * @returns Timestamp text recorded without additional format validation by this registry.
213
+ * @see {@link InMemoryWorkflowDefinitionRegistry.saveDraft}
214
+ */
215
+ now?: () => string;
216
+ /**
217
+ * Optional synchronous host semantic validator called after Core structural validation during a draft-to-validated transition.
218
+ * @param definition - Structurally valid stored workflow definition presented for host semantic checks.
219
+ * @returns No value when accepted; throw to reject validation before the status update.
220
+ * @remarks The callback receives the stored definition reference, so it should inspect without mutating it; this registry supplies no actor authentication or cross-process coordination.
221
+ * @see {@link InMemoryWorkflowDefinitionRegistry.validate}
222
+ */
223
+ validate?: (definition: WorkflowDefinition) => void;
224
+ });
225
+ /**
226
+ * Validates and inserts or replaces a draft version, incrementing its revision.
227
+ * @param input - Unknown workflow definition validated by core validation.
228
+ * @param actorId - Optional author label recorded as creator/updater; not authenticated here.
229
+ * @returns A cloned draft record with canonical definition hash.
230
+ * @throws Invalid definition, non-draft existing version, clock/hash/clone failure.
231
+ * @example
232
+ * ```typescript
233
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
234
+ * export function draft(input: unknown) { return new InMemoryWorkflowDefinitionRegistry().saveDraft(input); }
235
+ * ```
236
+ */
237
+ saveDraft(input: unknown, actorId?: string): WorkflowDefinitionRecord;
238
+ /**
239
+ * Transitions an existing draft to validated after core and optional host checks.
240
+ * @param workflowId - Exact workflow identifier.
241
+ * @param version - Exact stored version.
242
+ * @param actorId - Optional updater label.
243
+ * @returns A cloned validated record with incremented revision.
244
+ * @throws Missing version, nondraft status, validation/callback/clock failure.
245
+ * @example
246
+ * ```typescript
247
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
248
+ * export function validate(registry: InMemoryWorkflowDefinitionRegistry, workflowId: string, version: string) { return registry.validate(workflowId, version); }
249
+ * ```
250
+ */
251
+ validate(workflowId: string, version: string, actorId?: string): WorkflowDefinitionRecord;
252
+ /**
253
+ * Transitions a validated version to approved and records approver metadata.
254
+ * @param workflowId - Exact workflow identifier.
255
+ * @param version - Exact stored version.
256
+ * @param actorId - Nonblank verified host approver label; no role check occurs here.
257
+ * @returns A cloned approved record.
258
+ * @throws Blank actor, missing version, nonvalidated status, or clock failure.
259
+ * @example
260
+ * ```typescript
261
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
262
+ * export function approve(registry: InMemoryWorkflowDefinitionRegistry, workflowId: string, version: string, actorId: string) { return registry.approve(workflowId, version, actorId); }
263
+ * ```
264
+ */
265
+ approve(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
266
+ /**
267
+ * Publishes an approved version and retires any currently published version of the same workflow.
268
+ * @param workflowId - Exact workflow identifier.
269
+ * @param version - Approved version to publish.
270
+ * @param actorId - Nonblank verified host publisher label.
271
+ * @returns A cloned published record; previous published records become retired.
272
+ * @throws Blank actor, missing version, nonapproved status, or clock/clone failure; earlier retirement updates can already have occurred.
273
+ * @example
274
+ * ```typescript
275
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
276
+ * export function publish(registry: InMemoryWorkflowDefinitionRegistry, workflowId: string, version: string, actorId: string) { return registry.publish(workflowId, version, actorId); }
277
+ * ```
278
+ */
279
+ publish(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
280
+ /**
281
+ * Transitions a published version to retired and records retirement metadata.
282
+ * @param workflowId - Exact workflow identifier.
283
+ * @param version - Currently published version.
284
+ * @param actorId - Nonblank verified host operator label.
285
+ * @returns A cloned retired record.
286
+ * @throws Blank actor, missing version, nonpublished status, or clock failure.
287
+ * @example
288
+ * ```typescript
289
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
290
+ * export function retire(registry: InMemoryWorkflowDefinitionRegistry, workflowId: string, version: string, actorId: string) { return registry.retire(workflowId, version, actorId); }
291
+ * ```
292
+ */
293
+ retire(workflowId: string, version: string, actorId: string): WorkflowDefinitionRecord;
294
+ /**
295
+ * Reads one workflow version without mutating lifecycle state.
296
+ * @param workflowId - Exact workflow identifier.
297
+ * @param version - Exact stored version.
298
+ * @returns A cloned record, or undefined when absent.
299
+ * @example
300
+ * ```typescript
301
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
302
+ * console.log(new InMemoryWorkflowDefinitionRegistry().get("example", "1.0.0")); // undefined
303
+ * ```
304
+ */
305
+ get(workflowId: string, version: string): WorkflowDefinitionRecord | undefined;
306
+ /**
307
+ * Finds the currently published version of one workflow.
308
+ * @param workflowId - Exact workflow identifier.
309
+ * @returns A cloned published record, or undefined when none exists.
310
+ * @example
311
+ * ```typescript
312
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
313
+ * console.log(new InMemoryWorkflowDefinitionRegistry().getPublished("example")); // undefined
314
+ * ```
315
+ */
316
+ getPublished(workflowId: string): WorkflowDefinitionRecord | undefined;
317
+ /**
318
+ * Lists records in insertion order with optional workflow filtering.
319
+ * @param workflowId - Exact workflow identifier to filter, or omit for all workflows.
320
+ * @returns Independent cloned records, or an empty array.
321
+ * @example
322
+ * ```typescript
323
+ * import { InMemoryWorkflowDefinitionRegistry } from "@alneas/eaos-server/agentic/workflow-registry";
324
+ * console.log(new InMemoryWorkflowDefinitionRegistry().list()); // []
325
+ * ```
326
+ */
327
+ list(workflowId?: string): readonly WorkflowDefinitionRecord[];
328
+ private require;
329
+ private update;
330
+ private key;
331
+ }
332
+
333
+ export { InMemoryWorkflowDefinitionRegistry };
334
+ export type { WorkflowDefinitionRecord, WorkflowDefinitionRegistry };
@@ -0,0 +1,7 @@
1
+ import {
2
+ InMemoryWorkflowDefinitionRegistry
3
+ } from "../chunk-HVC7FG6B.js";
4
+ export {
5
+ InMemoryWorkflowDefinitionRegistry
6
+ };
7
+ //# sourceMappingURL=workflow-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}