@alneas/eaos-server 0.0.0-stage → 0.1.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 (350) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.ja.md +39 -0
  4. package/README.md +40 -2
  5. package/dist/agentic/agent-jobs.d.ts +329 -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 +95 -0
  21. package/dist/agentic/autonomous-worker.js +9 -0
  22. package/dist/agentic/autonomous-worker.js.map +1 -0
  23. package/dist/agentic/event-bridge.d.ts +344 -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 +24 -0
  36. package/dist/agentic/index.js +86 -0
  37. package/dist/agentic/index.js.map +1 -0
  38. package/dist/agentic/local-runner.d.ts +102 -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-4VORUFKR.js +45 -0
  98. package/dist/chunk-4VORUFKR.js.map +1 -0
  99. package/dist/chunk-55D4ERWO.js +1 -0
  100. package/dist/chunk-55D4ERWO.js.map +1 -0
  101. package/dist/chunk-5TBBZIND.js +18 -0
  102. package/dist/chunk-5TBBZIND.js.map +1 -0
  103. package/dist/chunk-5WOZWPZA.js +211 -0
  104. package/dist/chunk-5WOZWPZA.js.map +1 -0
  105. package/dist/chunk-6CBVZ6CT.js +168 -0
  106. package/dist/chunk-6CBVZ6CT.js.map +1 -0
  107. package/dist/chunk-6KV5CJBW.js +221 -0
  108. package/dist/chunk-6KV5CJBW.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-DHQGNP4T.js +770 -0
  124. package/dist/chunk-DHQGNP4T.js.map +1 -0
  125. package/dist/chunk-EJKWDZIU.js +111 -0
  126. package/dist/chunk-EJKWDZIU.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-FD6VC2NA.js +66 -0
  130. package/dist/chunk-FD6VC2NA.js.map +1 -0
  131. package/dist/chunk-FRRRWAHO.js +14 -0
  132. package/dist/chunk-FRRRWAHO.js.map +1 -0
  133. package/dist/chunk-HCKAGLLB.js +17 -0
  134. package/dist/chunk-HCKAGLLB.js.map +1 -0
  135. package/dist/chunk-HVC7FG6B.js +191 -0
  136. package/dist/chunk-HVC7FG6B.js.map +1 -0
  137. package/dist/chunk-HXFVOR7Z.js +496 -0
  138. package/dist/chunk-HXFVOR7Z.js.map +1 -0
  139. package/dist/chunk-IJWYS2PF.js +122 -0
  140. package/dist/chunk-IJWYS2PF.js.map +1 -0
  141. package/dist/chunk-INCHXAFK.js +1395 -0
  142. package/dist/chunk-INCHXAFK.js.map +1 -0
  143. package/dist/chunk-JT6BRGQM.js +1 -0
  144. package/dist/chunk-JT6BRGQM.js.map +1 -0
  145. package/dist/chunk-L6PMAEMB.js +115 -0
  146. package/dist/chunk-L6PMAEMB.js.map +1 -0
  147. package/dist/chunk-LOUGW6MU.js +126 -0
  148. package/dist/chunk-LOUGW6MU.js.map +1 -0
  149. package/dist/chunk-LYPZPE53.js +129 -0
  150. package/dist/chunk-LYPZPE53.js.map +1 -0
  151. package/dist/chunk-NNCCN7JP.js +186 -0
  152. package/dist/chunk-NNCCN7JP.js.map +1 -0
  153. package/dist/chunk-PBC3MZUL.js +212 -0
  154. package/dist/chunk-PBC3MZUL.js.map +1 -0
  155. package/dist/chunk-R4ADP2DC.js +20 -0
  156. package/dist/chunk-R4ADP2DC.js.map +1 -0
  157. package/dist/chunk-RHN4Y6VS.js +44 -0
  158. package/dist/chunk-RHN4Y6VS.js.map +1 -0
  159. package/dist/chunk-THYUY5ZZ.js +204 -0
  160. package/dist/chunk-THYUY5ZZ.js.map +1 -0
  161. package/dist/chunk-UGNTCOVR.js +28 -0
  162. package/dist/chunk-UGNTCOVR.js.map +1 -0
  163. package/dist/chunk-VC2PCK2S.js +31 -0
  164. package/dist/chunk-VC2PCK2S.js.map +1 -0
  165. package/dist/chunk-VF5YDZJC.js +305 -0
  166. package/dist/chunk-VF5YDZJC.js.map +1 -0
  167. package/dist/chunk-VISRDVTK.js +675 -0
  168. package/dist/chunk-VISRDVTK.js.map +1 -0
  169. package/dist/chunk-W6O3LVBY.js +102 -0
  170. package/dist/chunk-W6O3LVBY.js.map +1 -0
  171. package/dist/chunk-WFEAKJLR.js +47 -0
  172. package/dist/chunk-WFEAKJLR.js.map +1 -0
  173. package/dist/chunk-XIEY2OF4.js +67 -0
  174. package/dist/chunk-XIEY2OF4.js.map +1 -0
  175. package/dist/chunk-XITLHDG3.js +37 -0
  176. package/dist/chunk-XITLHDG3.js.map +1 -0
  177. package/dist/chunk-XMWPYZWZ.js +61 -0
  178. package/dist/chunk-XMWPYZWZ.js.map +1 -0
  179. package/dist/chunk-XUP6CNOM.js +34 -0
  180. package/dist/chunk-XUP6CNOM.js.map +1 -0
  181. package/dist/chunk-YABTQZDJ.js +25 -0
  182. package/dist/chunk-YABTQZDJ.js.map +1 -0
  183. package/dist/chunk-YMJ7BRKU.js +510 -0
  184. package/dist/chunk-YMJ7BRKU.js.map +1 -0
  185. package/dist/chunk-ZC3XWU7B.js +28 -0
  186. package/dist/chunk-ZC3XWU7B.js.map +1 -0
  187. package/dist/chunk-ZHMTD5KV.js +90 -0
  188. package/dist/chunk-ZHMTD5KV.js.map +1 -0
  189. package/dist/chunk-ZWZDLOE7.js +160 -0
  190. package/dist/chunk-ZWZDLOE7.js.map +1 -0
  191. package/dist/db-package/db/local-first-sqlite-adapter.d.ts +432 -0
  192. package/dist/db-package/db/local-first-sqlite-adapter.js +7 -0
  193. package/dist/db-package/db/local-first-sqlite-adapter.js.map +1 -0
  194. package/dist/db-package/index.d.ts +7 -0
  195. package/dist/db-package/index.js +16 -0
  196. package/dist/db-package/index.js.map +1 -0
  197. package/dist/db-package/migration/aggregator.d.ts +86 -0
  198. package/dist/db-package/migration/aggregator.js +7 -0
  199. package/dist/db-package/migration/aggregator.js.map +1 -0
  200. package/dist/db-package/migration/index.d.ts +3 -0
  201. package/dist/db-package/migration/index.js +8 -0
  202. package/dist/db-package/migration/index.js.map +1 -0
  203. package/dist/engine.d.ts +205 -0
  204. package/dist/engine.js +20 -0
  205. package/dist/engine.js.map +1 -0
  206. package/dist/entitlements/index.d.ts +313 -0
  207. package/dist/entitlements/index.js +23 -0
  208. package/dist/entitlements/index.js.map +1 -0
  209. package/dist/execution/index.d.ts +50 -0
  210. package/dist/execution/index.js +57 -0
  211. package/dist/execution/index.js.map +1 -0
  212. package/dist/extensions/index.d.ts +172 -0
  213. package/dist/extensions/index.js +95 -0
  214. package/dist/extensions/index.js.map +1 -0
  215. package/dist/health/index.d.ts +35 -0
  216. package/dist/health/index.js +7 -0
  217. package/dist/health/index.js.map +1 -0
  218. package/dist/index.d.ts +39 -0
  219. package/dist/index.js +160 -0
  220. package/dist/index.js.map +1 -0
  221. package/dist/lifecycle/index.d.ts +133 -0
  222. package/dist/lifecycle/index.js +13 -0
  223. package/dist/lifecycle/index.js.map +1 -0
  224. package/dist/lifecycle-engine/backend-migration.d.ts +2 -0
  225. package/dist/lifecycle-engine/backend-migration.js +11 -0
  226. package/dist/lifecycle-engine/backend-migration.js.map +1 -0
  227. package/dist/lifecycle-engine/baseline.d.ts +2 -0
  228. package/dist/lifecycle-engine/baseline.js +9 -0
  229. package/dist/lifecycle-engine/baseline.js.map +1 -0
  230. package/dist/lifecycle-engine/index.d.ts +1497 -0
  231. package/dist/lifecycle-engine/index.js +41 -0
  232. package/dist/lifecycle-engine/index.js.map +1 -0
  233. package/dist/lifecycle-engine/platform/artifacts.d.ts +4 -0
  234. package/dist/lifecycle-engine/platform/artifacts.js +7 -0
  235. package/dist/lifecycle-engine/platform/artifacts.js.map +1 -0
  236. package/dist/lifecycle-engine/platform/control-plane.d.ts +12 -0
  237. package/dist/lifecycle-engine/platform/control-plane.js +2 -0
  238. package/dist/lifecycle-engine/platform/control-plane.js.map +1 -0
  239. package/dist/lifecycle-engine/platform/database-router.d.ts +118 -0
  240. package/dist/lifecycle-engine/platform/database-router.js +7 -0
  241. package/dist/lifecycle-engine/platform/database-router.js.map +1 -0
  242. package/dist/lifecycle-engine/platform/deployment-placements.d.ts +464 -0
  243. package/dist/lifecycle-engine/platform/deployment-placements.js +16 -0
  244. package/dist/lifecycle-engine/platform/deployment-placements.js.map +1 -0
  245. package/dist/lifecycle-engine/platform/deployment.d.ts +4 -0
  246. package/dist/lifecycle-engine/platform/deployment.js +17 -0
  247. package/dist/lifecycle-engine/platform/deployment.js.map +1 -0
  248. package/dist/lifecycle-engine/platform/index.d.ts +737 -0
  249. package/dist/lifecycle-engine/platform/index.js +60 -0
  250. package/dist/lifecycle-engine/platform/index.js.map +1 -0
  251. package/dist/lifecycle-engine/platform/runtime.d.ts +80 -0
  252. package/dist/lifecycle-engine/platform/runtime.js +11 -0
  253. package/dist/lifecycle-engine/platform/runtime.js.map +1 -0
  254. package/dist/lifecycle-engine/platform/site-publication.d.ts +102 -0
  255. package/dist/lifecycle-engine/platform/site-publication.js +7 -0
  256. package/dist/lifecycle-engine/platform/site-publication.js.map +1 -0
  257. package/dist/lifecycle-engine/platform/user-directory.d.ts +139 -0
  258. package/dist/lifecycle-engine/platform/user-directory.js +13 -0
  259. package/dist/lifecycle-engine/platform/user-directory.js.map +1 -0
  260. package/dist/mcp.d.ts +92 -0
  261. package/dist/mcp.js +10 -0
  262. package/dist/mcp.js.map +1 -0
  263. package/dist/middleware/auth.d.ts +118 -0
  264. package/dist/middleware/auth.js +7 -0
  265. package/dist/middleware/auth.js.map +1 -0
  266. package/dist/middleware/error-handler.d.ts +35 -0
  267. package/dist/middleware/error-handler.js +7 -0
  268. package/dist/middleware/error-handler.js.map +1 -0
  269. package/dist/middleware/module-guard.d.ts +33 -0
  270. package/dist/middleware/module-guard.js +7 -0
  271. package/dist/middleware/module-guard.js.map +1 -0
  272. package/dist/platform-admin/index.d.ts +37 -0
  273. package/dist/platform-admin/index.js +11 -0
  274. package/dist/platform-admin/index.js.map +1 -0
  275. package/dist/platform-admin/store.d.ts +346 -0
  276. package/dist/platform-admin/store.js +7 -0
  277. package/dist/platform-admin/store.js.map +1 -0
  278. package/dist/plugin-data/annotations.d.ts +6 -0
  279. package/dist/plugin-data/annotations.js +12 -0
  280. package/dist/plugin-data/annotations.js.map +1 -0
  281. package/dist/plugin-data/atomic-context.d.ts +41 -0
  282. package/dist/plugin-data/atomic-context.js +9 -0
  283. package/dist/plugin-data/atomic-context.js.map +1 -0
  284. package/dist/plugin-data/atomic.d.ts +6 -0
  285. package/dist/plugin-data/atomic.js +26 -0
  286. package/dist/plugin-data/atomic.js.map +1 -0
  287. package/dist/plugin-data/audit.d.ts +6 -0
  288. package/dist/plugin-data/audit.js +12 -0
  289. package/dist/plugin-data/audit.js.map +1 -0
  290. package/dist/plugin-data/commands.d.ts +6 -0
  291. package/dist/plugin-data/commands.js +8 -0
  292. package/dist/plugin-data/commands.js.map +1 -0
  293. package/dist/plugin-data/composite.d.ts +6 -0
  294. package/dist/plugin-data/composite.js +8 -0
  295. package/dist/plugin-data/composite.js.map +1 -0
  296. package/dist/plugin-data/delivery.d.ts +6 -0
  297. package/dist/plugin-data/delivery.js +16 -0
  298. package/dist/plugin-data/delivery.js.map +1 -0
  299. package/dist/plugin-data/index.d.ts +2798 -0
  300. package/dist/plugin-data/index.js +102 -0
  301. package/dist/plugin-data/index.js.map +1 -0
  302. package/dist/plugin-data/json-documents.d.ts +6 -0
  303. package/dist/plugin-data/json-documents.js +16 -0
  304. package/dist/plugin-data/json-documents.js.map +1 -0
  305. package/dist/plugin-data/outbox.d.ts +6 -0
  306. package/dist/plugin-data/outbox.js +16 -0
  307. package/dist/plugin-data/outbox.js.map +1 -0
  308. package/dist/plugin-data/scoped-records.d.ts +6 -0
  309. package/dist/plugin-data/scoped-records.js +10 -0
  310. package/dist/plugin-data/scoped-records.js.map +1 -0
  311. package/dist/plugin-sdk.d.ts +41 -0
  312. package/dist/plugin-sdk.js +10 -0
  313. package/dist/plugin-sdk.js.map +1 -0
  314. package/dist/sql-lifecycle/index.d.ts +138 -0
  315. package/dist/sql-lifecycle/index.js +167 -0
  316. package/dist/sql-lifecycle/index.js.map +1 -0
  317. package/dist/storage/index.d.ts +2 -0
  318. package/dist/storage/index.js +13 -0
  319. package/dist/storage/index.js.map +1 -0
  320. package/dist/storage/s3-compatible.d.ts +139 -0
  321. package/dist/storage/s3-compatible.js +11 -0
  322. package/dist/storage/s3-compatible.js.map +1 -0
  323. package/dist/tenant.d.ts +108 -0
  324. package/dist/tenant.js +9 -0
  325. package/dist/tenant.js.map +1 -0
  326. package/dist/workspace-context.d.ts +119 -0
  327. package/dist/workspace-context.js +9 -0
  328. package/dist/workspace-context.js.map +1 -0
  329. package/docs/api.md +29753 -0
  330. package/docs/db/README.md +49 -0
  331. package/docs/db/docs/api.md +1613 -0
  332. package/docs/db/docs/guide.md +47 -0
  333. package/docs/entitlements.md +60 -0
  334. package/docs/guide.md +48 -0
  335. package/docs/index.md +53 -0
  336. package/docs/ja/db/README.md +46 -0
  337. package/docs/ja/db/docs/guide.md +53 -0
  338. package/docs/ja/guide.md +46 -0
  339. package/docs/ja/lifecycle/README.md +46 -0
  340. package/docs/ja/lifecycle/docs/guide.md +45 -0
  341. package/docs/ja/storage/README.md +46 -0
  342. package/docs/ja/storage/docs/guide.md +43 -0
  343. package/docs/lifecycle/README.md +49 -0
  344. package/docs/lifecycle/docs/api.md +3770 -0
  345. package/docs/lifecycle/docs/baseline.md +50 -0
  346. package/docs/lifecycle/docs/guide.md +47 -0
  347. package/docs/storage/README.md +49 -0
  348. package/docs/storage/docs/api.md +470 -0
  349. package/docs/storage/docs/guide.md +47 -0
  350. package/package.json +345 -4
@@ -0,0 +1,344 @@
1
+ import { DomainEventBus } from '@alneas/eaos-core';
2
+ import { ServerAutonomousWorker } from './autonomous-worker.js';
3
+ import { ServerAgentTaskRequest, ServerAgentTaskResult } from './types.js';
4
+
5
+ /**
6
+ * Maps one domain event name to a verified host task specification.
7
+ * @see EventAgentBridge.registerRule.
8
+ */
9
+ interface EventAgentRule {
10
+ /** Exact domain event name to subscribe to. */
11
+ eventName: string;
12
+ /** Filter or build task request from domain event payload. Return null to skip. */
13
+ createTask: (payload: unknown) => Omit<ServerAgentTaskRequest, 'id'> | null;
14
+ }
15
+ /**
16
+ * Host error/audit notification for event conversion, queueing, execution, result, or approval delivery.
17
+ * @see EventAgentBridgeOptions.onError.
18
+ */
19
+ interface EventAgentBridgeError {
20
+ /** Domain event associated with the failure. */
21
+ eventName: string;
22
+ /** Optional generated task identifier, absent before task creation. */
23
+ taskId?: string;
24
+ /** Stage where the failure was observed. */
25
+ phase: 'createTask' | 'queue' | 'runTask' | 'result' | 'notification';
26
+ /** Original failure value, which may not be an Error. */
27
+ error: unknown;
28
+ /** Optional normalized task result associated with the failure. */
29
+ result?: ServerAgentTaskResult;
30
+ }
31
+ /**
32
+ * Event, generated task, and pending result delivered to the host approval sink.
33
+ * @see EventAgentBridgeOptions.onPendingApproval.
34
+ */
35
+ interface EventAgentPendingApproval {
36
+ /** Originating domain event name. */
37
+ eventName: string;
38
+ /** Original event payload (cloned when durable queue mode is used). */
39
+ payload: unknown;
40
+ /** Generated verified task whose runtime requested approval. */
41
+ task: ServerAgentTaskRequest;
42
+ /** PENDING_APPROVAL result; the host must persist/deliver the approval request. */
43
+ result: ServerAgentTaskResult;
44
+ }
45
+ /**
46
+ * In-process backpressure, host notifications, and optional durable delivery for {@link EventAgentBridge}.
47
+ */
48
+ interface EventAgentBridgeOptions {
49
+ /** In-process worker concurrency, safe integer 1–1024. Defaults to 1; durable run passes use this as their claim ceiling but are not globally serialized. */
50
+ maxConcurrent?: number;
51
+ /** In-process waiting queue ceiling while workers are fully occupied, safe integer 0–1000000. Defaults to 100. */
52
+ maxQueueSize?: number;
53
+ /** Host-owned notification/audit sink for approval requests. */
54
+ onPendingApproval?: (pending: EventAgentPendingApproval) => Promise<void> | void;
55
+ /** Host error/audit sink; returned Promise rejection is logged. Keep the callback itself nonthrowing because synchronous errors can escape reporting. */
56
+ onError?: (error: EventAgentBridgeError) => Promise<void> | void;
57
+ /** Optional host-owned durable queue. When set, events are persisted until runDurableOnce drains them. */
58
+ taskStore?: EventAgentTaskStore;
59
+ }
60
+ /**
61
+ * Domain event and generated task stored as one event queue item.
62
+ * @see EventAgentTaskStore.
63
+ */
64
+ interface QueuedEventTask {
65
+ /** Originating subscribed event name. */
66
+ eventName: string;
67
+ /** Associated event payload; durable enqueue receives a structured clone. */
68
+ payload: unknown;
69
+ /** Generated task with ID and execution idempotency context. */
70
+ task: ServerAgentTaskRequest;
71
+ }
72
+ /** Host-owned durable queue for event-triggered agent work.
73
+ * @see EventAgentBridge.withDurableTaskStore for usage.
74
+ */
75
+ interface EventAgentTaskStore {
76
+ /**
77
+ * Persists accepted event work before a scheduler drains it.
78
+ * @param task - Verified generated task and cloneable event payload.
79
+ * @returns No value; resolves after host persistence.
80
+ * @throws Queue failures propagate to bridge error reporting.
81
+
82
+ * @example
83
+ * ```typescript
84
+ * import type { EventAgentTaskStore } from "@alneas/eaos-server";
85
+ * export async function enqueueAdmittedEventTask(
86
+ * store: EventAgentTaskStore, task: Parameters<EventAgentTaskStore["enqueue"]>[0],
87
+ * ) {
88
+ * // Host admission and the event-to-task mapping run before queue insertion.
89
+ * await store.enqueue(task);
90
+ * }
91
+ * ```
92
+ */
93
+ enqueue(task: QueuedEventTask): Promise<void>;
94
+ /**
95
+ * Exclusively claims work for one drain pass.
96
+ * @param limit - Requested maximum item count.
97
+ * @returns Claimed queue items, or an empty array.
98
+ * @throws Queue failures reject the drain pass.
99
+
100
+ * @example
101
+ * ```typescript
102
+ * import type { EventAgentTaskStore } from "@alneas/eaos-server";
103
+ * export async function claimEventTasks(store: EventAgentTaskStore) {
104
+ * const tasks = await store.claim(10);
105
+ * return tasks; // Empty when no eligible tasks are available.
106
+ * }
107
+ * ```
108
+ */
109
+ claim(limit: number): Promise<readonly QueuedEventTask[]>;
110
+ /**
111
+ * Persists the normalized result for a claimed task.
112
+ * @param taskId - Claimed task identifier.
113
+ * @param result - Runtime outcome, including failed/pending statuses.
114
+ * @returns No value; resolves after persistence.
115
+ * @throws Completion failure causes the bridge to call fail.
116
+
117
+ * @example
118
+ * ```typescript
119
+ * import type { EventAgentTaskStore } from "@alneas/eaos-server";
120
+ * export async function completeEventTask(
121
+ * store: EventAgentTaskStore, claimedTaskId: string,
122
+ * result: Parameters<EventAgentTaskStore["complete"]>[1],
123
+ * ) {
124
+ * await store.complete(claimedTaskId, result);
125
+ * // The host decides persistence and result retention for this queue.
126
+ * }
127
+ * ```
128
+ */
129
+ complete(taskId: string, result: ServerAgentTaskResult): Promise<void>;
130
+ /**
131
+ * Records or handles a claimed execution/persistence failure.
132
+ * @param taskId - Claimed task identifier.
133
+ * @param error - Underlying execution or completion failure.
134
+ * @returns No value; completion/retry semantics belong to the host store.
135
+ * @throws Failures reject the drain pass.
136
+
137
+ * @example
138
+ * ```typescript
139
+ * import type { EventAgentTaskStore } from "@alneas/eaos-server";
140
+ * export async function recordEventTaskFailure(
141
+ * store: EventAgentTaskStore, claimedTaskId: string, observedError: unknown,
142
+ * ) {
143
+ * await store.fail(claimedTaskId, observedError);
144
+ * // Failure/retry policy belongs to the host store; this does not retry execution.
145
+ * }
146
+ * ```
147
+ */
148
+ fail(taskId: string, error: unknown): Promise<void>;
149
+ }
150
+ /**
151
+ * Small process-local TaskStore for development, tests and a single short-
152
+ * lived host. It deliberately has no lease recovery or persistence and must
153
+ * not be used as the production workflow/checkpoint store.
154
+ * @remarks Duplicate IDs compare JSON serialization exactly. Completed history/results are retained without the active-task capacity limit. No retry, lease recovery, or durable failure history exists.
155
+ * @example
156
+ * ```typescript
157
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
158
+ * const store = new InMemoryEventAgentTaskStore();
159
+ * console.log(await store.claim(1)); // []
160
+ * ```
161
+ */
162
+ declare class InMemoryEventAgentTaskStore implements EventAgentTaskStore {
163
+ private readonly pending;
164
+ private readonly claimed;
165
+ private readonly completed;
166
+ private readonly results;
167
+ private readonly maxTasks;
168
+ /**
169
+ * Creates an empty local queue with an active pending/claimed capacity limit.
170
+ * @param options - maxTasks defaults to 10000 and must be a safe integer 1–1000000.
171
+ * @throws Invalid capacity.
172
+ */
173
+ constructor(options?: {
174
+ /**
175
+ * Maximum pending plus claimed tasks retained at once; defaults to 10000 and must be a safe integer from 1 to 1000000. Completed history/results are outside this limit.
176
+ */
177
+ maxTasks?: number;
178
+ });
179
+ /**
180
+ * Clones a queued task unless its ID is already identically retained.
181
+ * @param task - Nonempty task ID and event name with structured-cloneable payload/task.
182
+ * @returns No value; resolves after local insertion or matching duplicate detection.
183
+ * @throws Missing identifiers, conflicting duplicate, active capacity exhaustion, or clone/JSON failure.
184
+ * @example
185
+ * ```typescript
186
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
187
+ * import type { QueuedEventTask } from "@alneas/eaos-server/agentic/event-bridge";
188
+ * export async function enqueue(store: InMemoryEventAgentTaskStore, task: QueuedEventTask) { await store.enqueue(task); }
189
+ * ```
190
+ */
191
+ enqueue(task: QueuedEventTask): Promise<void>;
192
+ /**
193
+ * Moves pending items into the claimed map in insertion order.
194
+ * @param limit - Positive safe-integer maximum item count.
195
+ * @returns Cloned claimed items, or an empty array.
196
+ * @throws Invalid limit or clone failure; an item may already have moved before clone failure.
197
+ * @example
198
+ * ```typescript
199
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
200
+ * const store = new InMemoryEventAgentTaskStore();
201
+ * console.log(await store.claim(1)); // []
202
+ * ```
203
+ */
204
+ claim(limit: number): Promise<readonly QueuedEventTask[]>;
205
+ /**
206
+ * Moves a claimed task into retained completion history and clones its result.
207
+ * @param taskId - Current claimed task identifier.
208
+ * @param result - Normalized runtime outcome, including FAILED or PENDING_APPROVAL data.
209
+ * @returns No value; completes after retaining history and result.
210
+ * @throws Unknown/already completed task or clone failure; history can already have changed.
211
+ * @example
212
+ * ```typescript
213
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
214
+ * import type { ServerAgentTaskResult } from "@alneas/eaos-server/agentic/types";
215
+ * export async function complete(store: InMemoryEventAgentTaskStore, taskId: string, result: ServerAgentTaskResult) { await store.complete(taskId, result); }
216
+ * ```
217
+ */
218
+ complete(taskId: string, result: ServerAgentTaskResult): Promise<void>;
219
+ /**
220
+ * Removes a claimed task without retaining failure history or rescheduling it.
221
+ * @param taskId - Current claimed task identifier.
222
+ * @param _error - Failure value accepted for interface compatibility and ignored.
223
+ * @returns No value; resolves after removal.
224
+ * @throws Unknown/already failed task.
225
+ * @example
226
+ * ```typescript
227
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
228
+ * export async function fail(store: InMemoryEventAgentTaskStore, taskId: string, error: unknown) { await store.fail(taskId, error); }
229
+ * ```
230
+ */
231
+ fail(taskId: string, _error: unknown): Promise<void>;
232
+ /**
233
+ * Inspects a cloned retained completion result for local tests/development.
234
+ * @param taskId - Previously completed task identifier.
235
+ * @returns Cloned result, or undefined if no completion result exists.
236
+ * @throws If a retained result cannot be cloned.
237
+ * @example
238
+ * ```typescript
239
+ * import { InMemoryEventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
240
+ * console.log(new InMemoryEventAgentTaskStore().getResult("missing")); // undefined
241
+ * ```
242
+ */
243
+ getResult(taskId: string): ServerAgentTaskResult | undefined;
244
+ }
245
+ /**
246
+ * Converts subscribed domain events into bounded local execution or host-persisted agent work.
247
+ * @remarks Without taskStore, accepted work is process-local and can be lost on restart. With taskStore, the host explicitly calls runDurableOnce; event subscription callbacks still do not await durable persistence from the publisher's perspective. Authorize identity in createTask before creating specifications. Generated task IDs/idempotency defaults are per emission, so repeated events are not automatically deduplicated. Dispose every registerRule callback to release subscriptions; no global destroy is provided.
248
+ * @example
249
+ * ```typescript
250
+ * import { EventAgentBridge } from "@alneas/eaos-server/agentic/event-bridge";
251
+ * import type { DomainEventBus } from "@alneas/eaos-core";
252
+ * import type { ServerAutonomousWorker } from "@alneas/eaos-server/agentic/autonomous-worker";
253
+ * export function bridge(eventBus: DomainEventBus, worker: ServerAutonomousWorker) { return new EventAgentBridge(eventBus, worker); }
254
+ * ```
255
+ */
256
+ declare class EventAgentBridge {
257
+ private eventBus;
258
+ private worker;
259
+ private rules;
260
+ private subscriptions;
261
+ private queue;
262
+ private activeCount;
263
+ private readonly maxConcurrent;
264
+ private readonly maxQueueSize;
265
+ private readonly onPendingApproval?;
266
+ private readonly onError?;
267
+ private taskStore?;
268
+ private taskCounter;
269
+ /**
270
+ * Captures an event bus and worker and validates local backpressure limits.
271
+ * @param eventBus - Host domain bus; subscriptions begin only on registerRule.
272
+ * @param worker - Host worker performing gatekeeper/runtime execution.
273
+ * @param options - Queue limits, notification/error callbacks, and optional durable store.
274
+ * @throws Invalid limits or malformed durable store.
275
+ */
276
+ constructor(eventBus: DomainEventBus, worker: ServerAutonomousWorker, options?: EventAgentBridgeOptions);
277
+ /**
278
+ * Persisted event work is deliberately drained by the host scheduler. The
279
+ * bridge never treats its in-memory queue as a durable workflow checkpoint.
280
+ * @param store - Host durable queue with enqueue/claim/complete/fail functions.
281
+ * @returns This bridge after replacing its store reference.
282
+ * @throws Missing/malformed store functions.
283
+ * @remarks Existing local queued work is not migrated by changing this store.
284
+ * @example
285
+ * ```typescript
286
+ * import { EventAgentBridge } from "@alneas/eaos-server/agentic/event-bridge";
287
+ * import type { EventAgentTaskStore } from "@alneas/eaos-server/agentic/event-bridge";
288
+ * export function persist(bridge: EventAgentBridge, store: EventAgentTaskStore) { return bridge.withDurableTaskStore(store); }
289
+ * ```
290
+ */
291
+ withDurableTaskStore(store: EventAgentTaskStore): this;
292
+ /**
293
+ * Claims one bounded durable batch and processes it sequentially.
294
+ * @param limit - Safe integer 1–maxConcurrent; defaults to maxConcurrent.
295
+ * @returns Claim/completion/failure persistence counts; a worker FAILED result counts completed if stored successfully.
296
+ * @throws Missing store, invalid limit, claim/fail persistence errors, or synchronous error-sink errors.
297
+ * @remarks Calls are not globally serialized. Notification failures are reported after result persistence. No periodic scheduler or automatic retry is installed.
298
+ * @example
299
+ * ```typescript
300
+ * import { EventAgentBridge } from "@alneas/eaos-server/agentic/event-bridge";
301
+ * export async function drain(bridge: EventAgentBridge) { return bridge.runDurableOnce(); }
302
+ * ```
303
+ */
304
+ runDurableOnce(limit?: number): Promise<{
305
+ /** Number of queued tasks returned by the host claim for this pass, including tasks later recorded as completed or failed. */
306
+ claimed: number;
307
+ /** Number of task results successfully passed to store.complete; a returned worker FAILED or PENDING_APPROVAL status still counts when its result is stored. */
308
+ completed: number;
309
+ /** Number of worker throws or store.complete failures handled through store.fail; this counts persistence/execution handling failures rather than every returned worker FAILED status. */
310
+ failed: number;
311
+ }>;
312
+ /**
313
+ * Subscribes a task-conversion rule and returns its individual unsubscribe callback.
314
+ * @param rule - Exact event name and synchronous createTask callback; callback receives payload and returns verified task fields or null to skip.
315
+ * @returns A no-argument callback returning no value; removes this rule and unsubscribes the bus handler when no rules remain.
316
+ * @throws Event bus subscription/unsubscription errors can propagate. Event conversion errors are reported through onError.
317
+ * @remarks The rule is retained by reference; do not mutate its eventName after registration. Already accepted tasks keep running after unsubscribe.
318
+ * @example
319
+ * ```typescript
320
+ * import { EventAgentBridge } from "@alneas/eaos-server/agentic/event-bridge";
321
+ * import type { EventAgentRule } from "@alneas/eaos-server/agentic/event-bridge";
322
+ * export function listen(bridge: EventAgentBridge, rule: EventAgentRule) { return bridge.registerRule(rule); }
323
+ * ```
324
+ */
325
+ registerRule(rule: EventAgentRule): () => void;
326
+ /**
327
+ * Waits until the bridge's local active count and waiting queue are empty.
328
+ * @returns No value; resolves when local work is idle. It does not wait for durable queue persistence/draining or asynchronous error sinks.
329
+ * @remarks Polls with zero-delay timers and has no timeout/cancellation; continuously arriving work can delay completion indefinitely.
330
+ * @example
331
+ * ```typescript
332
+ * import { EventAgentBridge } from "@alneas/eaos-server/agentic/event-bridge";
333
+ * export async function idle(bridge: EventAgentBridge) { await bridge.whenIdle(); }
334
+ * ```
335
+ */
336
+ whenIdle(): Promise<void>;
337
+ private handleEvent;
338
+ private drain;
339
+ private execute;
340
+ private reportError;
341
+ }
342
+
343
+ export { EventAgentBridge, InMemoryEventAgentTaskStore };
344
+ export type { EventAgentBridgeError, EventAgentBridgeOptions, EventAgentPendingApproval, EventAgentRule, EventAgentTaskStore, QueuedEventTask };
@@ -0,0 +1,9 @@
1
+ import {
2
+ EventAgentBridge,
3
+ InMemoryEventAgentTaskStore
4
+ } from "../chunk-3P4XTTQH.js";
5
+ export {
6
+ EventAgentBridge,
7
+ InMemoryEventAgentTaskStore
8
+ };
9
+ //# sourceMappingURL=event-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,91 @@
1
+ import { AgentRuntimeResourcePolicy } from '@alneas/eaos-core';
2
+ import { ServerAgentTaskRequest, ServerAgentExecutor } from './types.js';
3
+
4
+ /**
5
+ * Chooses Linux systemd-run, direct spawning, or automatic platform selection.
6
+ * @see createCommandAgentExecutor.
7
+ */
8
+ type CommandAgentSandboxMode = 'auto' | 'systemd' | 'direct';
9
+ /**
10
+ * Host sandbox selection for {@link createCommandAgentExecutor}.
11
+ */
12
+ interface CommandAgentSandboxOptions {
13
+ /** auto uses transient systemd on Linux and direct execution on local development hosts. */
14
+ mode?: CommandAgentSandboxMode;
15
+ /** Resource policy is framework-owned by default; consumers may only tighten it in a host adapter. */
16
+ policy?: AgentRuntimeResourcePolicy;
17
+ }
18
+ /**
19
+ * Trusted executable, argument/environment builders, and limits for {@link createCommandAgentExecutor}.
20
+ */
21
+ interface CommandAgentExecutorOptions {
22
+ /** Host-configured executable. It is never taken from a task request. */
23
+ command: string;
24
+ /** Called once per task with a structured clone; must return string arguments. Arguments are passed without a shell, and callback errors reject execution. */
25
+ buildArgs: (request: ServerAgentTaskRequest) => readonly string[];
26
+ /** Process working directory; omitted uses the host process directory. Under systemd this directory is also explicitly writable. */
27
+ cwd?: string;
28
+ /** Per-task environment callback receiving a clone; its entries override framework EAOS variables. Defaults to no additional variables. */
29
+ env?: (request: ServerAgentTaskRequest) => Record<string, string | undefined>;
30
+ /** Inherit host process environment before framework/custom variables. @defaultValue false */
31
+ includeProcessEnv?: boolean;
32
+ /** Default task timeout in milliseconds, safe integer 1–3600000; task.timeoutMs overrides it. @defaultValue 60000 */
33
+ timeoutMs?: number;
34
+ /** Combined stdout/stderr string-length ceiling, safe integer 1–10000000. @defaultValue 1000000 */
35
+ maxOutputChars?: number;
36
+ /** Sandbox selection; defaults to auto and a validated task/framework policy. Direct mode does not apply systemd resource/filesystem restrictions. */
37
+ sandbox?: CommandAgentSandboxOptions;
38
+ }
39
+ /**
40
+ * Validates that resource-policy fields retain or tighten the current framework baseline.
41
+ * @param policy - Runtime resource policy with AI placement, read-only root, private-only network, and bounded resources.
42
+ * @returns A structured clone of the accepted policy.
43
+ * @throws For weaker/invalid fields; malformed nested fields can also throw property-access errors.
44
+ * @remarks Validation does not itself apply operating-system isolation, concurrency, or network controls.
45
+ * @example
46
+ * ```typescript
47
+ * import { defaultRuntimePlacementPolicy } from "@alneas/eaos-core";
48
+ * import { validateAgentRuntimePolicy } from "@alneas/eaos-server/agentic/executor";
49
+ * const policy = validateAgentRuntimePolicy(defaultRuntimePlacementPolicy().ai.agentRuntime);
50
+ * console.log(policy.placement); // "ai"
51
+ * ```
52
+ */
53
+ declare function validateAgentRuntimePolicy(policy: AgentRuntimeResourcePolicy): AgentRuntimeResourcePolicy;
54
+ /**
55
+ * Builds systemd-run arguments for transient process resource and filesystem restrictions.
56
+ * @param command - Trusted executable passed after the systemd option terminator.
57
+ * @param args - Executable arguments, passed unchanged without a shell.
58
+ * @param policy - Already validated resource policy; this helper does not validate it.
59
+ * @param cwd - Working directory, resolved absolutely; absent/empty uses process.cwd().
60
+ * @param unit - Host-selected transient unit name, used for later stop requests.
61
+ * @returns A new argument array, using --user for a nonroot host user and rounding runtime milliseconds upward to at least one second.
62
+ * @remarks Requires a host with systemd-run and appropriate service-manager permissions when executed. This array does not implement network allowlisting, workspace capacity, or a concurrency scheduler; those policy fields require host enforcement.
63
+ * @example
64
+ * ```typescript
65
+ * import { defaultRuntimePlacementPolicy } from "@alneas/eaos-core";
66
+ * import { buildSystemdRunArgs } from "@alneas/eaos-server/agentic/executor";
67
+ * const args = buildSystemdRunArgs("agent-runtime", ["--version"], defaultRuntimePlacementPolicy().ai.agentRuntime, undefined, "example-agent");
68
+ * console.log(args.includes("--wait")); // true
69
+ * ```
70
+ */
71
+ declare function buildSystemdRunArgs(command: string, args: readonly string[], policy: AgentRuntimeResourcePolicy, cwd: string | undefined, unit: string): string[];
72
+ /**
73
+ * Creates a shell-free executor for OpenCode, Codex, Goose or another trusted
74
+ * CLI. Authorization and approval happen before this adapter is called.
75
+ * @param options - Trusted executable, argument/environment callbacks, output/timeout limits, and sandbox settings.
76
+ * @returns A per-task async executor resolving stdout on exit code zero, including an empty string when no output was produced.
77
+ * @throws Synchronously for invalid factory settings. Execution rejects callback/clone/policy errors and ServerAgentExecutionError for spawn, timeout, output-limit, or nonzero-exit failures.
78
+ * @remarks Requires Node child_process. auto selects systemd on Linux and direct execution elsewhere. No task concurrency limit is enforced here. stdin is ignored, stdout/stderr are bounded together, and stderr is excluded from successful output. On timeout/output/spawn failure the timer is cleared, SIGTERM is sent, and systemd stop is requested when managed; termination is not awaited and descendants may outlive direct-mode failure. Idempotency is only propagated through environment variables; host/runtime code must enforce safe retries.
79
+ * @example
80
+ * ```typescript
81
+ * import { createCommandAgentExecutor, type CommandAgentExecutorOptions } from "@alneas/eaos-server/agentic/executor";
82
+ * export function hostExecutor(configuration: CommandAgentExecutorOptions) {
83
+ * // The host provisions the executable and performs admission/approval first.
84
+ * return createCommandAgentExecutor(configuration);
85
+ * }
86
+ * ```
87
+ */
88
+ declare function createCommandAgentExecutor(options: CommandAgentExecutorOptions): ServerAgentExecutor;
89
+
90
+ export { buildSystemdRunArgs, createCommandAgentExecutor, validateAgentRuntimePolicy };
91
+ export type { CommandAgentExecutorOptions, CommandAgentSandboxMode, CommandAgentSandboxOptions };
@@ -0,0 +1,12 @@
1
+ import {
2
+ buildSystemdRunArgs,
3
+ createCommandAgentExecutor,
4
+ validateAgentRuntimePolicy
5
+ } from "../chunk-32746UQZ.js";
6
+ import "../chunk-YABTQZDJ.js";
7
+ export {
8
+ buildSystemdRunArgs,
9
+ createCommandAgentExecutor,
10
+ validateAgentRuntimePolicy
11
+ };
12
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,119 @@
1
+ import { GraphProjectionAdapter, GraphProjectionCursor, WorkflowEventEnvelope } from '@alneas/eaos-core';
2
+
3
+ /**
4
+ * Host persistence for per-projection, per-tenant progress and failure state.
5
+ * @see GraphProjectionCoordinator.
6
+ */
7
+ interface ProjectionCursorStore {
8
+ /**
9
+ * Reads current projection progress for a tenant.
10
+ * @param projectionId - Host projection identifier.
11
+ * @param tenantId - Verified event/snapshot tenant.
12
+ * @returns Stored cursor, or null when absent.
13
+ * @throws Store errors propagate to the coordinator.
14
+
15
+ * @example
16
+ * ```typescript
17
+ * import type { ProjectionCursorStore } from "@alneas/eaos-server";
18
+ * export async function inspectTenantProjection(
19
+ * store: ProjectionCursorStore, projectionId: string, verifiedTenantId: string,
20
+ * ) {
21
+ * const cursor = await store.get(projectionId, verifiedTenantId);
22
+ * return cursor?.status; // Null means no cursor was stored.
23
+ * }
24
+ * ```
25
+ */
26
+ get(projectionId: string, tenantId: string): Promise<GraphProjectionCursor | null>;
27
+ /**
28
+ * Persists replacement projection progress.
29
+ * @param cursor - Full progress/failure cursor to store.
30
+ * @returns No value; resolves after persistence.
31
+ * @throws Store errors propagate; the projection adapter may already have applied changes.
32
+
33
+ * @example
34
+ * ```typescript
35
+ * import type { ProjectionCursorStore } from "@alneas/eaos-server";
36
+ * export async function saveProjectionProgress(
37
+ * store: ProjectionCursorStore, cursor: Parameters<ProjectionCursorStore["put"]>[0],
38
+ * ) {
39
+ * // The host aligns this tenant cursor with committed projection work.
40
+ * await store.put(cursor);
41
+ * }
42
+ * ```
43
+ */
44
+ put(cursor: GraphProjectionCursor): Promise<void>;
45
+ }
46
+ /**
47
+ * Host projection adapter, cursor persistence, and clock for {@link GraphProjectionCoordinator}.
48
+ */
49
+ interface GraphProjectionCoordinatorOptions {
50
+ /** Nonblank projection identifier; retained exactly without trimming. */
51
+ projectionId: string;
52
+ /** Host relationship-model adapter; must define idempotency and transaction policy. */
53
+ adapter: GraphProjectionAdapter;
54
+ /** Host cursor persistence, separate from adapter transactions unless the host coordinates them. */
55
+ cursorStore: ProjectionCursorStore;
56
+ /** Clock for ISO progress timestamps; defaults to a fresh Date. */
57
+ now?: () => Date;
58
+ }
59
+ /**
60
+ * Applies domain events to an ADB Graph/PGQL or other relationship read model.
61
+ *
62
+ * The coordinator is intentionally independent of Oracle. The host supplies
63
+ * the adapter and cursor store, so credentials, graph schema and transaction
64
+ * policy never enter core/server.
65
+ * @remarks Calls are not serialized by this class. The host must coordinate writers/rebuilds, authorize tenant data, and make adapter replay safe. Adapter changes and cursor writes are separate operations; a cursor failure can leave projection data applied but unacknowledged.
66
+ * @example
67
+ * ```typescript
68
+ * import { GraphProjectionCoordinator, type GraphProjectionCoordinatorOptions } from "@alneas/eaos-server/agentic/graph-projection";
69
+ * export function projection(options: GraphProjectionCoordinatorOptions) {
70
+ * return new GraphProjectionCoordinator(options);
71
+ * }
72
+ * ```
73
+ */
74
+ declare class GraphProjectionCoordinator {
75
+ private readonly now;
76
+ private readonly options;
77
+ /**
78
+ * Captures a host projection identity, adapter, cursor store, and optional clock.
79
+ * @param options - Host projection dependencies.
80
+ * @throws If projectionId is blank or adapter/cursorStore is absent.
81
+ */
82
+ constructor(options: GraphProjectionCoordinatorOptions);
83
+ /**
84
+ * Applies one event and records projection progress, skipping recognized duplicate/stale events.
85
+ * @param event - Trusted workflow event envelope; the adapter receives a structured clone.
86
+ * @returns No value; resolves after application and cursor persistence or immediately for the last event ID or a nonincreasing revision of the last aggregate.
87
+ * @throws Rejects rebuilding state, cursor/clock/clone failures, or adapter failures. Adapter failure attempts a failed cursor write, which can itself replace the original error.
88
+ * @remarks A revision gap for the last aggregate increments lagCount and records lagging but still applies the event. Deduplication covers only the last event/aggregate cursor, not full history. Failure may occur after adapter side effects; no rollback or retry occurs here.
89
+ * @example
90
+ * ```typescript
91
+ * import { GraphProjectionCoordinator, type GraphProjectionCoordinatorOptions } from "@alneas/eaos-server/agentic/graph-projection";
92
+ * import type { WorkflowEventEnvelope } from "@alneas/eaos-core";
93
+ * export async function apply(options: GraphProjectionCoordinatorOptions, event: WorkflowEventEnvelope) {
94
+ * await new GraphProjectionCoordinator(options).apply(event);
95
+ * }
96
+ * ```
97
+ */
98
+ apply(event: Readonly<WorkflowEventEnvelope>): Promise<void>;
99
+ /**
100
+ * Marks a tenant projection rebuilding, delegates snapshot replacement, then records healthy or failed state.
101
+ * @param tenantId - Verified tenant whose relationship model is rebuilt.
102
+ * @param sourceRevision - Host source revision copied to the rebuilt cursor; not validated by this coordinator.
103
+ * @param snapshot - Host-authorized snapshot cloned before passing to the adapter.
104
+ * @returns No value; resolves after adapter rebuild and healthy cursor persistence.
105
+ * @throws Rejects clock, cursor, clone, or adapter failures; a failed-status write can replace an earlier failure.
106
+ * @remarks No cancellation or exclusive lock is acquired. The host must serialize rebuild/application and determine recovery after partial adapter or cursor failure.
107
+ * @example
108
+ * ```typescript
109
+ * import { GraphProjectionCoordinator, type GraphProjectionCoordinatorOptions } from "@alneas/eaos-server/agentic/graph-projection";
110
+ * export async function rebuild(options: GraphProjectionCoordinatorOptions, tenantId: string, revision: number, snapshot: unknown) {
111
+ * await new GraphProjectionCoordinator(options).rebuild(tenantId, revision, snapshot);
112
+ * }
113
+ * ```
114
+ */
115
+ rebuild(tenantId: string, sourceRevision: number, snapshot: unknown): Promise<void>;
116
+ }
117
+
118
+ export { GraphProjectionCoordinator };
119
+ export type { GraphProjectionCoordinatorOptions, ProjectionCursorStore };
@@ -0,0 +1,7 @@
1
+ import {
2
+ GraphProjectionCoordinator
3
+ } from "../chunk-W6O3LVBY.js";
4
+ export {
5
+ GraphProjectionCoordinator
6
+ };
7
+ //# sourceMappingURL=graph-projection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}