@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,1497 @@
1
+ import { DataContract, DataContractCatalog } from '@alneas/eaos-core/contracts/data-contracts';
2
+ export * from '@alneas/eaos-core/contracts/data-contracts';
3
+ export { assertDataContractBinding, assertJsonDocumentContracts, collectSchemaMigrations, createJsonDocumentAssertion, dataContractTables, resolveDataContracts } from '@alneas/eaos-core/contracts/data-contracts';
4
+
5
+ /**
6
+ * Hash-bound replacement of exact historical database migrations by equivalent baseline DDL.
7
+ *
8
+ * @see createDataContractBaseline for canonical integration usage.
9
+ */
10
+ interface DataContractBaseline {
11
+ /**
12
+ * Baseline discriminator; currently 1.
13
+ */
14
+ format: 1;
15
+ /**
16
+ * Canonical contract release whose fully applied history is replaced.
17
+ */
18
+ source: DataContract;
19
+ /**
20
+ * Newer release retaining schema but using one database-scoped baseline migration.
21
+ */
22
+ target: DataContract;
23
+ /**
24
+ * Ordered historical migration IDs, positions and checksums requiring exact ledger matches.
25
+ */
26
+ replaces: {
27
+ /**
28
+ * Original immutable migration ID replaced by the baseline.
29
+ */
30
+ id: string;
31
+ /**
32
+ * Original zero-based migration position.
33
+ */
34
+ position: number;
35
+ /**
36
+ * Canonical original migration definition digest.
37
+ */
38
+ checksum: string;
39
+ }[];
40
+ /**
41
+ * Canonical digest of format/source/target/replaces.
42
+ */
43
+ hash: string;
44
+ }
45
+ /**
46
+ * Builds a newer single-migration contract release and hashes the exact historical migrations it replaces.
47
+ *
48
+ * Final DDL comes from a schema compiler or an isolated database introspector, never concatenation.
49
+ * @param source - Valid source contract with nonempty database-scoped migration history.
50
+ * @param version - Valid semver strictly newer than source.version.
51
+ * @param sql - Compiler/introspector-generated complete baseline DDL covering exactly the original dialect set.
52
+ * @returns Source/target contract snapshots, replacement migration checksums and integrity hash.
53
+ * @throws Error for nonnewer version, tenant-scoped/empty history, changed dialect set or invalid source/target contracts.
54
+ *
55
+ * @remarks
56
+ * Read-only; the host must establish final DDL equivalence using a schema compiler or isolated introspector. SQL is not concatenated or executed here.
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * import { createDataContractBaseline, type DataContract } from '@alneas/eaos-server/lifecycle-engine';
61
+ * export function reviewBaseline(source: DataContract, version: string, sql: DataContract['migrations'][number]['sql']) { return createDataContractBaseline(source, version, sql); }
62
+ * ```
63
+ */
64
+ declare function createDataContractBaseline(source: DataContract, version: string, sql: DataContract['migrations'][number]['sql']): DataContractBaseline;
65
+ /**
66
+ * Replaces a completely applied exact contract history with its reviewed baseline ledger record without running DDL.
67
+ *
68
+ * Rebase only a completely applied exact history. This function never executes DDL.
69
+ * @param store - Durable cross-process exclusive lifecycle store.
70
+ * @param databaseId - Physical database ledger identity whose contract history is rebased.
71
+ * @param baseline - Unmodified baseline created by createDataContractBaseline.
72
+ * @param options - Expected ledger revision and optional all-instance quiesce callback, required when affected consumers are active.
73
+ * @returns Baseline hash, next revision, count of replaced records and ddlExecuted=false.
74
+ * @throws Rejects integrity mismatch, stale revision, partial/dirty history, incompatible installed consumer range, absent drain or propagated store/quiesce failures.
75
+ *
76
+ * @remarks
77
+ * Runs under the store lock, archives old migration history and disables affected live consumers. Host drain happens before the final atomic state write; external drain may have occurred even if that write fails. No schema or data migration is executed.
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * import { rebaseDataContractBaseline, type DataContractBaseline, type LifecycleStore } from '@alneas/eaos-server/lifecycle-engine';
82
+ * export function rebaseReviewed(store: LifecycleStore, databaseId: string, baseline: DataContractBaseline, options: Parameters<typeof rebaseDataContractBaseline>[3]) { return rebaseDataContractBaseline(store, databaseId, baseline, options); }
83
+ * ```
84
+ */
85
+ declare function rebaseDataContractBaseline(store: LifecycleStore, databaseId: string, baseline: DataContractBaseline, options: {
86
+ /**
87
+ * Exact current ledger revision reviewed by the caller; mismatch rejects before mutation.
88
+ */
89
+ expectedRevision: number;
90
+ /** Host drains all instances before disabling the affected live consumers. */
91
+ quiesce?: (input: {
92
+ /**
93
+ * Exact physical database identity whose live consumers must drain.
94
+ */
95
+ databaseId: string;
96
+ /**
97
+ * Distinct affected feature IDs consuming the rebased contract.
98
+ */
99
+ pluginIds: string[];
100
+ }) => Promise<void>;
101
+ }): Promise<{
102
+ baselineHash: string;
103
+ revision: number;
104
+ rebased: number;
105
+ ddlExecuted: false;
106
+ }>;
107
+
108
+ /**
109
+ * Installed server package version used as the default lifecycle compatibility version.
110
+ *
111
+ * @see PluginLifecycle for canonical integration usage.
112
+ */
113
+ declare const FRAMEWORK_VERSION: string;
114
+ /**
115
+ * Supported SQL dialects used to select reviewed migration statements.
116
+ *
117
+ * @see PluginLifecycle for canonical integration usage.
118
+ */
119
+ type Dialect = 'sqlite' | 'oracle' | 'postgres';
120
+
121
+ /**
122
+ * Opaque physical database placement and shared/dedicated tenant scope.
123
+ *
124
+ * @see PluginLifecycle for canonical integration usage.
125
+ */
126
+ interface BackendTarget {
127
+ /**
128
+ * Stable execution backend ID; lifecycle plans reject identity changes under an existing ID.
129
+ */
130
+ id: string;
131
+ /**
132
+ * Opaque physical database identity shared by aliases of the same database; never a DSN.
133
+ */
134
+ databaseId: string;
135
+ /**
136
+ * SQL dialect required by this database and migration history.
137
+ */
138
+ dialect: Dialect;
139
+ /**
140
+ * Shared permits tenant isolation within one database; dedicated binds one tenant.
141
+ */
142
+ mode: 'shared' | 'dedicated';
143
+ /**
144
+ * Required concrete tenant for dedicated mode and forbidden for shared mode.
145
+ */
146
+ tenantId?: string;
147
+ }
148
+ /**
149
+ * Immutable reviewed migration statements scoped to a physical database or one tenant.
150
+ *
151
+ * @see PluginLifecycle for canonical integration usage.
152
+ */
153
+ interface PluginMigration {
154
+ /**
155
+ * Stable unique migration ID whose applied definition must never be rewritten.
156
+ */
157
+ id: string;
158
+ /**
159
+ * Database runs once per physical database; tenant runs once per tenant.
160
+ */
161
+ scope: 'database' | 'tenant';
162
+ /**
163
+ * Dialect-to-ordered-statements map; the target dialect must have nonempty statements.
164
+ */
165
+ sql: Partial<Record<Dialect, string[]>>;
166
+ }
167
+ /**
168
+ * Trusted release definition with feature dependencies, schema requirements and immutable migrations.
169
+ *
170
+ * @see PluginLifecycle for canonical integration usage.
171
+ */
172
+ interface LifecyclePlugin {
173
+ /**
174
+ * Registered feature identifier, up to 128 letters/digits/underscore/hyphen characters starting alphanumeric.
175
+ */
176
+ id: string;
177
+ /**
178
+ * Valid semantic release version; changed contents require a version bump.
179
+ */
180
+ version: string;
181
+ /**
182
+ * Valid semver range for compatible framework versions.
183
+ */
184
+ framework: string;
185
+ /**
186
+ * Optional feature ID to semver range dependencies installed/enabled as a closure.
187
+ */
188
+ dependencies?: Record<string, string>;
189
+ /**
190
+ * Optional canonical data contract ranges; never installs or enables feature plugins.
191
+ *
192
+ * Storage dependencies do not install or enable a feature plugin.
193
+ */
194
+ schemaDependencies?: Record<string, string>;
195
+ /**
196
+ * Optional canonical releases supplied by a data package; duplicate IDs must agree exactly.
197
+ *
198
+ * Canonical contract releases supplied by the data package, not inline table copies.
199
+ */
200
+ schemaContracts?: DataContract[];
201
+ /**
202
+ * Append-only reviewed plugin migrations; contract-backed plugins must put DDL in data contracts instead.
203
+ *
204
+ * Immutable, reviewed migrations generated from the plugin's schema; never rewrite applied IDs.
205
+ */
206
+ migrations: PluginMigration[];
207
+ /**
208
+ * Optional nonsecret declarative host requirements; absence causes no infrastructure work.
209
+ *
210
+ * Declarative, host-defined resource requirements. No secrets. Absence means no infrastructure changes.
211
+ */
212
+ infrastructure?: Record<string, unknown>;
213
+ }
214
+ /**
215
+ * Lifecycle change to installation or tenant activation; disable/uninstall retain business data.
216
+ *
217
+ * @see PluginLifecycle for canonical integration usage.
218
+ */
219
+ type Operation = 'install' | 'update' | 'enable' | 'disable' | 'uninstall';
220
+ /**
221
+ * Concrete lifecycle operation scoped to one registered backend and verified tenant.
222
+ *
223
+ * @see PluginLifecycle for canonical integration usage.
224
+ */
225
+ interface LifecycleRequest {
226
+ /**
227
+ * Requested install/update/enable/disable/uninstall transition.
228
+ */
229
+ operation: Operation;
230
+ /**
231
+ * Registered plugin ID, or bundle ID for bundle planning.
232
+ */
233
+ pluginId: string;
234
+ /**
235
+ * Registered execution backend ID.
236
+ */
237
+ backendId: string;
238
+ /**
239
+ * Verified concrete tenant; must match dedicated backend scope.
240
+ */
241
+ tenantId: string;
242
+ }
243
+ /**
244
+ * Durable per-database/tenant migration progress and immutable definition checksum.
245
+ *
246
+ * @see PluginLifecycle for canonical integration usage.
247
+ */
248
+ interface MigrationRecord {
249
+ /**
250
+ * Physical database on which the migration executes.
251
+ */
252
+ databaseId: string;
253
+ /**
254
+ * Plugin or canonical data-contract migration identity.
255
+ */
256
+ pluginId: string;
257
+ /**
258
+ * Immutable migration definition ID.
259
+ */
260
+ migrationId: string;
261
+ /**
262
+ * Zero-based position in the append-only migration history.
263
+ */
264
+ position: number;
265
+ /**
266
+ * Concrete tenant for tenant-scoped work, or null for database scope.
267
+ */
268
+ tenantId: string | null;
269
+ /**
270
+ * Canonical definition digest used to detect rewritten applied SQL.
271
+ */
272
+ checksum: string;
273
+ /**
274
+ * Running/applied/failed progress; running and failed require reconciliation before planning further changes.
275
+ */
276
+ status: 'running' | 'applied' | 'failed';
277
+ }
278
+ /**
279
+ * Registered release snapshot and progress stored for one backend/plugin.
280
+ *
281
+ * @see PluginLifecycle for canonical integration usage.
282
+ */
283
+ interface Installation {
284
+ /**
285
+ * Copied trusted plugin release installed on this backend.
286
+ */
287
+ release: LifecyclePlugin;
288
+ /**
289
+ * Canonical digest of the release snapshot.
290
+ */
291
+ digest: string;
292
+ /**
293
+ * Installing/installed/failed progress; noninstalled records require reconciliation.
294
+ */
295
+ status: 'installing' | 'installed' | 'failed';
296
+ }
297
+ /**
298
+ * Durable platform tenant metadata independent of business schemas.
299
+ *
300
+ * @see PluginLifecycle for canonical integration usage.
301
+ */
302
+ interface LifecyclePlatformTenant {
303
+ /**
304
+ * Stable concrete tenant ID.
305
+ */
306
+ id: string;
307
+ /**
308
+ * Public tenant display name.
309
+ */
310
+ name: string;
311
+ /**
312
+ * Whether platform tenant admission is enabled; membership remains host-owned.
313
+ */
314
+ active: boolean;
315
+ /**
316
+ * Configured tenant lookup domains; domain mapping alone never proves membership.
317
+ */
318
+ domains: readonly string[];
319
+ /**
320
+ * Tenant creation timestamp.
321
+ */
322
+ createdAt: string;
323
+ /**
324
+ * Latest metadata update timestamp.
325
+ */
326
+ updatedAt: string;
327
+ }
328
+ /**
329
+ * Durable tenant-to-backend routing assignment with optimistic routing revision.
330
+ *
331
+ * @see PluginLifecycle for canonical integration usage.
332
+ */
333
+ interface LifecyclePlatformPlacement {
334
+ /**
335
+ * Verified tenant whose traffic is routed.
336
+ */
337
+ tenantId: string;
338
+ /**
339
+ * Opaque configured backend receiving traffic.
340
+ */
341
+ backendId: string;
342
+ /**
343
+ * Nonnegative revision used to track routing changes.
344
+ */
345
+ routingRevision: number;
346
+ /**
347
+ * Timestamp of the recorded routing switch.
348
+ */
349
+ changedAt: string;
350
+ }
351
+ /**
352
+ * Nonsecret descriptive metadata for an existing backend.
353
+ *
354
+ * @see PluginLifecycle for canonical integration usage.
355
+ */
356
+ interface LifecyclePlatformBackendMetadata {
357
+ /**
358
+ * Optional public display label.
359
+ */
360
+ label?: string;
361
+ /**
362
+ * Optional provider descriptor; never credentials or DSNs.
363
+ */
364
+ provider?: string;
365
+ /**
366
+ * Optional declared host capability names, not permission grants.
367
+ */
368
+ capabilities?: readonly string[];
369
+ }
370
+ /**
371
+ * Persisted migration progress including uncertainty, failure, reconciliation and rollback states.
372
+ *
373
+ * @see PluginLifecycle for canonical integration usage.
374
+ */
375
+ type LifecyclePlatformMigrationStatus = 'planned' | 'running' | 'verified' | 'cutover' | 'failed' | 'reconciling' | 'rolled-back';
376
+ /**
377
+ * Durable migration execution, verification and reconciliation evidence.
378
+ *
379
+ * @see PluginLifecycle for canonical integration usage.
380
+ */
381
+ interface LifecyclePlatformMigrationRecord {
382
+ /**
383
+ * Current progress; reconciling represents uncertain execution outcomes.
384
+ */
385
+ status: LifecyclePlatformMigrationStatus;
386
+ /**
387
+ * Optional identity claiming the host migration execution.
388
+ */
389
+ executionId?: string;
390
+ /**
391
+ * Optional host-reported verification matching the migration plan.
392
+ */
393
+ verification?: BackendMigrationVerificationReport;
394
+ /**
395
+ * Optional source-retaining cutover receipt.
396
+ */
397
+ cutover?: BackendMigrationCutover;
398
+ /**
399
+ * Optional failure message and occurrence timestamp; exclude secrets.
400
+ */
401
+ error?: {
402
+ /**
403
+ * Nonsecret failure description retained for operator reconciliation.
404
+ */
405
+ message: string;
406
+ /**
407
+ * Timestamp at which the error was recorded.
408
+ */
409
+ occurredAt: string;
410
+ };
411
+ /**
412
+ * Timestamp of the latest migration-state change.
413
+ */
414
+ updatedAt: string;
415
+ /**
416
+ * Optional original migration ID when this is a rollback execution.
417
+ */
418
+ rollbackOf?: string;
419
+ /**
420
+ * Optional reviewed reverse plan associated with this migration.
421
+ */
422
+ rollbackPlanId?: string;
423
+ }
424
+ /**
425
+ * Platform-owned tenant, backend and migration control maps stored with the lifecycle ledger.
426
+ *
427
+ * @see PluginLifecycle for canonical integration usage.
428
+ */
429
+ interface LifecyclePlatformState {
430
+ /**
431
+ * Tenant records indexed by tenant ID.
432
+ */
433
+ tenants: Record<string, LifecyclePlatformTenant>;
434
+ /**
435
+ * Current routing assignments indexed by tenant ID.
436
+ */
437
+ placements: Record<string, LifecyclePlatformPlacement>;
438
+ /**
439
+ * Nonsecret backend labels/provider capabilities indexed by backend ID.
440
+ */
441
+ backendMetadata: Record<string, LifecyclePlatformBackendMetadata>;
442
+ /**
443
+ * Reviewed backend migration plans indexed by migration ID.
444
+ */
445
+ migrationPlans: Record<string, BackendMigrationPlan>;
446
+ /**
447
+ * Execution/reconciliation records indexed by migration ID.
448
+ */
449
+ migrationRecords: Record<string, LifecyclePlatformMigrationRecord>;
450
+ }
451
+ /**
452
+ * Versioned durable control ledger for plugin readiness, schema history and platform placement.
453
+ *
454
+ * @see PluginLifecycle for canonical integration usage.
455
+ */
456
+ interface LifecycleState {
457
+ /**
458
+ * Optional archived exact histories replaced by reviewed baselines.
459
+ */
460
+ baselineHistory?: Record<string, {
461
+ /**
462
+ * Exact archived baseline integrity hash.
463
+ */
464
+ hash: string;
465
+ /**
466
+ * Original canonical contract release retained for historical evidence.
467
+ */
468
+ source: DataContract;
469
+ /**
470
+ * Archived exact applied migration receipts.
471
+ */
472
+ migrations: Record<string, MigrationRecord>;
473
+ }>;
474
+ /**
475
+ * Persistent ledger discriminator; currently 1.
476
+ */
477
+ format: 1;
478
+ /**
479
+ * Nonnegative safe integer incremented on persisted lifecycle changes.
480
+ */
481
+ revision: number;
482
+ /**
483
+ * Opaque backend target definitions indexed by backend ID.
484
+ */
485
+ backends: Record<string, BackendTarget>;
486
+ /**
487
+ * Release snapshots indexed by JSON [backendId, pluginId].
488
+ */
489
+ installations: Record<string, Installation>;
490
+ /**
491
+ * Requested tenant activation records indexed by JSON [backendId, tenantId, pluginId]; effective readiness is checked separately.
492
+ */
493
+ activations: Record<string, {
494
+ /**
495
+ * Registered execution backend owning this activation.
496
+ */
497
+ backendId: string;
498
+ /**
499
+ * Concrete verified tenant owning this activation.
500
+ */
501
+ tenantId: string;
502
+ /**
503
+ * Registered feature ID requested for activation.
504
+ */
505
+ pluginId: string;
506
+ /**
507
+ * Canonical release or infrastructure definition digest.
508
+ */
509
+ digest: string;
510
+ /**
511
+ * Requested activation flag; effective readiness also requires matching installed digests and dependencies.
512
+ */
513
+ enabled: boolean;
514
+ }>;
515
+ /**
516
+ * Progress indexed by JSON [databaseId, migrationIdentity, migrationId, tenantId-or-*].
517
+ */
518
+ migrations: Record<string, MigrationRecord>;
519
+ /**
520
+ * Infrastructure digests/progress indexed by JSON [backendId, pluginId].
521
+ */
522
+ infrastructure: Record<string, {
523
+ /**
524
+ * Canonical release or infrastructure definition digest.
525
+ */
526
+ digest: string;
527
+ /**
528
+ * Persisted installing/installed/failed or running/applied/failed progress, according to this ledger map.
529
+ */
530
+ status: 'running' | 'applied' | 'failed';
531
+ }>;
532
+ /**
533
+ * Tenant/control-plane metadata and backend migration evidence.
534
+ */
535
+ platform: LifecyclePlatformState;
536
+ /**
537
+ * Optional canonical contract installation records indexed by JSON [databaseId, contractId].
538
+ */
539
+ dataContracts?: Record<string, {
540
+ /**
541
+ * Canonical schema contract release bound by its stored digest.
542
+ */
543
+ contract: DataContract;
544
+ /**
545
+ * Canonical release or infrastructure definition digest.
546
+ */
547
+ digest: string;
548
+ /**
549
+ * Persisted installing/installed/failed or running/applied/failed progress, according to this ledger map.
550
+ */
551
+ status: 'installing' | 'installed' | 'failed';
552
+ }>;
553
+ }
554
+ /**
555
+ * Atomic lifecycle snapshot access made available inside the host's exclusive lock.
556
+ *
557
+ * @see PluginLifecycle for canonical integration usage.
558
+ */
559
+ interface LifecycleWriter {
560
+ /**
561
+ * Read the currently committed ledger snapshot; must not expose uncommitted writes.
562
+ * @returns The currently committed atomic ledger snapshot.
563
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
564
+
565
+ * @example
566
+ * ```typescript
567
+ * import type { LifecycleStore } from '@alneas/eaos-server/lifecycle-engine';
568
+ * export async function readLocked(store: LifecycleStore) {
569
+ * return store.withLock(async writer => writer.read());
570
+ * }
571
+ * ```
572
+ */
573
+ read(): Promise<LifecycleState>;
574
+ /**
575
+ * Atomically persist the complete next snapshot; resolve only after durable completion.
576
+ * @param state - Complete next ledger snapshot with updated revision and control metadata.
577
+ * @returns Resolves without a value after the complete snapshot is durably committed.
578
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
579
+
580
+ * @example
581
+ * ```typescript
582
+ * import type { LifecycleStore } from '@alneas/eaos-server/lifecycle-engine';
583
+ * export async function persistReviewedRevision(store: LifecycleStore) {
584
+ * await store.withLock(async writer => {
585
+ * const state = await writer.read();
586
+ * // Domain changes belong in the same reviewed writer callback.
587
+ * state.revision += 1;
588
+ * await writer.write(state);
589
+ * });
590
+ * }
591
+ * ```
592
+ */
593
+ write(state: LifecycleState): Promise<void>;
594
+ }
595
+ /**
596
+ * Durable lifecycle reads and cross-process exclusive writer coordination.
597
+ *
598
+ *
599
+ * withLock must exclude every other writer, across processes. Reads must observe atomic committed snapshots.
600
+ * @see PluginLifecycle for canonical integration usage.
601
+ */
602
+ interface LifecycleStore extends Pick<LifecycleWriter, 'read'> {
603
+ /**
604
+ * Exclude every competing writer across processes and hold the lock until the async callback settles; release on success or failure.
605
+ * @param fn - Async work invoked only while holding exclusive writer ownership; receives atomic read/write capabilities.
606
+ * @typeParam T - Result resolved by the exclusive-lock callback.
607
+ * @returns The callback result after its lock is released; the lock is also released on failure.
608
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
609
+
610
+ * @example
611
+ * ```typescript
612
+ * import type { LifecycleStore } from '@alneas/eaos-server/lifecycle-engine';
613
+ * export async function snapshot(store: LifecycleStore) {
614
+ * return store.withLock(async writer => writer.read());
615
+ * }
616
+ * ```
617
+ */
618
+ withLock<T>(fn: (writer: LifecycleWriter) => Promise<T>): Promise<T>;
619
+ }
620
+ /**
621
+ * Planned migration ledger identity and ordered SQL to execute on one physical target.
622
+ *
623
+ * @see PluginLifecycle for canonical integration usage.
624
+ */
625
+ interface MigrationStep {
626
+ /**
627
+ * Exact ledger map key for this migration and scope.
628
+ */
629
+ key: string;
630
+ /**
631
+ * Initial running migration receipt with immutable checksum.
632
+ */
633
+ record: MigrationRecord;
634
+ /**
635
+ * Reviewed target-dialect SQL executed in order by the host migrate adapter.
636
+ */
637
+ statements: string[];
638
+ }
639
+ /**
640
+ * Planned host infrastructure change bound to the release and backend digest.
641
+ *
642
+ * @see PluginLifecycle for canonical integration usage.
643
+ */
644
+ interface InfrastructureStep {
645
+ /**
646
+ * Infrastructure ledger key for backend/plugin.
647
+ */
648
+ key: string;
649
+ /**
650
+ * Canonical digest binding backend and plugin infrastructure configuration.
651
+ */
652
+ digest: string;
653
+ /**
654
+ * Trusted plugin release declaring infrastructure requirements.
655
+ */
656
+ plugin: LifecyclePlugin;
657
+ /**
658
+ * Exact target whose resources are previewed/applied.
659
+ */
660
+ backend: BackendTarget;
661
+ }
662
+ /**
663
+ * Reviewable hash-bound lifecycle transition generated against one ledger revision.
664
+ *
665
+ * @see PluginLifecycle for canonical integration usage.
666
+ */
667
+ interface LifecyclePlan {
668
+ /**
669
+ * Plan discriminator; currently 1.
670
+ */
671
+ format: 1;
672
+ /**
673
+ * Canonical SHA-256 hash of all plan body fields.
674
+ */
675
+ id: string;
676
+ /**
677
+ * Ledger revision observed during planning; apply rejects stale plans.
678
+ */
679
+ revision: number;
680
+ /**
681
+ * Framework compatibility version used to resolve the plan.
682
+ */
683
+ frameworkVersion: string;
684
+ /**
685
+ * Original scoped operation request.
686
+ */
687
+ request: LifecycleRequest;
688
+ /**
689
+ * Snapshot of the exact immutable backend identity.
690
+ */
691
+ backend: BackendTarget;
692
+ /**
693
+ * Optional dependency-resolved canonical data contracts and table ownership.
694
+ */
695
+ dataCatalog?: DataContractCatalog;
696
+ /**
697
+ * Dependency-ordered trusted feature releases involved in the transition.
698
+ */
699
+ plugins: LifecyclePlugin[];
700
+ /**
701
+ * Ordered migration steps not already applied with matching checksums.
702
+ */
703
+ migrations: MigrationStep[];
704
+ /**
705
+ * Planned host infrastructure changes requiring the configured executor.
706
+ */
707
+ infrastructure: InfrastructureStep[];
708
+ /**
709
+ * Activation map keys disabled before disruptive changes.
710
+ */
711
+ deactivate: string[];
712
+ /**
713
+ * Configured executor identity, or null when none exists.
714
+ */
715
+ infrastructureProvider: string | null;
716
+ /**
717
+ * Always true; lifecycle uninstall never drops business data.
718
+ */
719
+ retainData: true;
720
+ }
721
+ /**
722
+ * Host-provided trusted release catalogs, durable lifecycle storage and side-effect adapters.
723
+ *
724
+ * @see PluginLifecycle for canonical integration usage.
725
+ */
726
+ interface LifecycleProject {
727
+ /**
728
+ * Cross-process locked atomic durable lifecycle store.
729
+ */
730
+ store: LifecycleStore;
731
+ /**
732
+ * Trusted configured backend catalog; existing physical identities are immutable.
733
+ */
734
+ backends: BackendTarget[];
735
+ /**
736
+ * Trusted registered plugin releases; registration alone grants no tenant activation.
737
+ */
738
+ plugins: LifecyclePlugin[];
739
+ /**
740
+ * Optional canonical schema contract releases, also collected from plugin schemaContracts.
741
+ *
742
+ */
743
+ dataContracts?: readonly DataContract[];
744
+ /**
745
+ * Optional host aliases mapping bundle IDs to ordered registered feature IDs.
746
+ */
747
+ bundles?: Record<string, readonly string[]>;
748
+ /**
749
+ * Execute one reviewed migration step on the exact backend; reject failures so reconciliation state is recorded.
750
+ * @param step - Exact planned infrastructure step and target digest; do not reinterpret unreviewed settings.
751
+ * @param backend - Already-provisioned opaque backend declaration; never a connection string or credentials.
752
+ * @returns Resolves without a value after the reviewed host side effect completes.
753
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
754
+ */
755
+ migrate: (step: MigrationStep, backend: BackendTarget) => Promise<void>;
756
+ /**
757
+ * Optional all-instance admission stop and active-work drain; required before upgrades affecting enabled activations.
758
+ *
759
+ * Stop admission and drain existing work on ALL affected backend instances before upgrades.
760
+ * @param activations - Host operation input bound to the scope described by this member.
761
+ * @returns Resolves without a value after the reviewed host side effect completes.
762
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
763
+ */
764
+ quiesce?: (activations: LifecycleState['activations'][string][]) => Promise<void>;
765
+ /**
766
+ * Optional named host preview/apply capability; no credentials belong in declarative plugin settings.
767
+ */
768
+ infrastructure?: {
769
+ /**
770
+ * Stable nonsecret infrastructure-provider identity bound into reviewed plans.
771
+ */
772
+ identity: string;
773
+ /**
774
+ * Preview one exact infrastructure step; host must not claim application completion from preview.
775
+ * @param step - Exact reviewed infrastructure step for the configured backend.
776
+ * @returns Host preview information; no apply result is implied.
777
+ * @throws Rejects host adapter failures; effects may already have partially completed.
778
+
779
+ * @example
780
+ * ```typescript
781
+ * import type { LifecycleProject, InfrastructureStep } from '@alneas/eaos-server/lifecycle-engine';
782
+ * export async function previewInfrastructure(project: LifecycleProject, step: InfrastructureStep) {
783
+ * if (!project.infrastructure) throw new Error("Host infrastructure port required");
784
+ * return project.infrastructure.preview(step);
785
+ * }
786
+ * ```
787
+ */
788
+ preview(step: InfrastructureStep): Promise<unknown>;
789
+ /**
790
+ * Apply one reviewed infrastructure step; errors leave reconciliation state and may follow partial external success.
791
+ * @param step - Exact reviewed infrastructure step for the configured backend.
792
+ * @returns Resolves without a value after host application completes.
793
+ * @throws Rejects host adapter failures; effects may already have partially completed.
794
+
795
+ * @example
796
+ * ```typescript
797
+ * import type { LifecycleProject, InfrastructureStep } from '@alneas/eaos-server/lifecycle-engine';
798
+ * export async function applyInfrastructure(project: LifecycleProject, step: InfrastructureStep) {
799
+ * if (!project.infrastructure) throw new Error("Host infrastructure port required");
800
+ * await project.infrastructure.apply(step);
801
+ * }
802
+ * ```
803
+ */
804
+ apply(step: InfrastructureStep): Promise<void>;
805
+ };
806
+ }
807
+ /**
808
+ * One registered or historical plugin/backend pair with requested and effective tenant readiness.
809
+ *
810
+ * @see PluginLifecycle for canonical integration usage.
811
+ */
812
+ interface LifecycleInventoryEntry {
813
+ /**
814
+ * Registered or historically recorded plugin ID.
815
+ */
816
+ pluginId: string;
817
+ /**
818
+ * Backend associated with the entry, or null when no backend is known.
819
+ */
820
+ backendId: string | null;
821
+ /**
822
+ * Whether this backend remains in the trusted runtime catalog.
823
+ */
824
+ backendConfigured: boolean;
825
+ /**
826
+ * Current registered code version, or null for orphaned history.
827
+ */
828
+ registeredVersion: string | null;
829
+ /**
830
+ * Stored installation version, or null before installation.
831
+ */
832
+ installedVersion: string | null;
833
+ /**
834
+ * Stored progress or not-installed.
835
+ */
836
+ installationStatus: Installation['status'] | 'not-installed';
837
+ /**
838
+ * Whether stored digest matches registered code, or null without installation.
839
+ */
840
+ releaseMatches: boolean | null;
841
+ /**
842
+ * Tenant requestedEnabled flags and effective enabled readiness results.
843
+ */
844
+ tenants: {
845
+ /**
846
+ * Concrete tenant whose activation is inspected.
847
+ */
848
+ tenantId: string;
849
+ /**
850
+ * Stored requested activation flag without readiness guarantees.
851
+ */
852
+ requestedEnabled: boolean;
853
+ /**
854
+ * Effective lifecycle readiness for the registered release and dependency closure.
855
+ */
856
+ enabled: boolean;
857
+ }[];
858
+ }
859
+ /**
860
+ * Read-only revision-bound plugin inventory including code-only and orphaned entries.
861
+ *
862
+ * @see PluginLifecycle for canonical integration usage.
863
+ */
864
+ interface LifecycleInventory {
865
+ /**
866
+ * Inventory discriminator; currently 1.
867
+ */
868
+ format: 1;
869
+ /**
870
+ * Ledger snapshot revision inspected.
871
+ */
872
+ revision: number;
873
+ /**
874
+ * Framework compatibility version used for readiness.
875
+ */
876
+ frameworkVersion: string;
877
+ /**
878
+ * Deterministically ordered plugin/backend inventory entries, possibly empty.
879
+ */
880
+ plugins: LifecycleInventoryEntry[];
881
+ }
882
+ /**
883
+ * Reviewable ordered collection of member plans with projected sequential ledger revisions.
884
+ *
885
+ * @see PluginLifecycle for canonical integration usage.
886
+ */
887
+ interface LifecycleBundlePlan {
888
+ /**
889
+ * Bundle discriminator; currently 1.
890
+ */
891
+ format: 1;
892
+ /**
893
+ * Canonical digest of bundle identity, operation and member plans.
894
+ */
895
+ id: string;
896
+ /**
897
+ * Registered host bundle alias.
898
+ */
899
+ bundleId: string;
900
+ /**
901
+ * Transition applied to every bundle member.
902
+ */
903
+ operation: Operation;
904
+ /**
905
+ * Dependency-compatible member order; reversed for disable/uninstall.
906
+ */
907
+ plans: LifecyclePlan[];
908
+ }
909
+
910
+ /**
911
+ * Creates independent empty platform tenant, placement and migration maps.
912
+ * @returns A new mutable platform-state object.
913
+ *
914
+ * @example
915
+ * ```typescript
916
+ * import { emptyLifecyclePlatformState } from '@alneas/eaos-server/lifecycle-engine';
917
+ * const platform = emptyLifecyclePlatformState();
918
+ * ```
919
+ */
920
+ declare const emptyLifecyclePlatformState: () => LifecyclePlatformState;
921
+ /**
922
+ * Creates an independent empty version-1 ledger with revision zero and platform state.
923
+ * @returns A new mutable LifecycleState with empty maps; no persistence is performed.
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * import { emptyLifecycleState } from '@alneas/eaos-server/lifecycle-engine';
928
+ * const state = emptyLifecycleState();
929
+ * ```
930
+ */
931
+ declare const emptyLifecycleState: () => LifecycleState;
932
+ /**
933
+ * Clones a historical ledger snapshot and fills missing platform maps without rewriting storage.
934
+ *
935
+ * Add fields introduced after the original snapshot format without rewriting old control rows on read.
936
+ * @param input - Historical state snapshot to normalize.
937
+ * @returns A structured clone with a complete platform object; unrelated state validation remains the caller's responsibility.
938
+ * @throws Error for nonobject input or malformed platform/maps; structuredClone errors propagate.
939
+ *
940
+ * @example
941
+ * ```typescript
942
+ * import { emptyLifecycleState, normalizeLifecycleState } from '@alneas/eaos-server/lifecycle-engine';
943
+ * const state = normalizeLifecycleState(emptyLifecycleState());
944
+ * ```
945
+ */
946
+ declare function normalizeLifecycleState(input: LifecycleState): LifecycleState;
947
+ /**
948
+ * Serializes JSON-compatible lifecycle values with recursively sorted object keys.
949
+ * @param value - JSON-serializable primitives, arrays or plain/null-prototype objects; avoid cycles and nonfinite numbers.
950
+ * @returns Deterministic JSON text; array order is preserved.
951
+ * @throws Error for unsupported values/prototypes, JSON serialization failure or recursive cycles.
952
+ *
953
+ * @remarks
954
+ * Uses JSON.stringify primitive semantics, including null for nonfinite numbers. It does not accept undefined/function/symbol values or class instances. Cyclic graphs are unsupported.
955
+ *
956
+ * @example
957
+ * ```typescript
958
+ * import { canonical } from '@alneas/eaos-server/lifecycle-engine';
959
+ * const serialized = canonical({ b: [2, 1], a: true });
960
+ * ```
961
+ */
962
+ declare function canonical(value: unknown): string;
963
+ /**
964
+ * Computes a lowercase SHA-256 digest of the canonical lifecycle JSON representation.
965
+ * @param value - Supported canonical JSON lifecycle configuration.
966
+ * @returns A 64-character lowercase hexadecimal digest.
967
+ * @throws Propagates canonical serialization errors for unsupported values.
968
+ *
969
+ * @remarks
970
+ * Requires Node crypto; the digest proves content identity, not authorization or authenticity.
971
+ *
972
+ * @example
973
+ * ```typescript
974
+ * import { lifecycleDigest } from '@alneas/eaos-server/lifecycle-engine';
975
+ * const digest = lifecycleDigest({ pluginId: 'reports', version: '1.0.0' });
976
+ * ```
977
+ */
978
+ declare const lifecycleDigest: (value: unknown) => string;
979
+ /**
980
+ * Plans and applies checksum-bound plugin/schema changes against an exclusively locked host ledger.
981
+ *
982
+ * @remarks
983
+ * Server runtime uses Node crypto and semver. The host provides durable cross-process locking, tenant authorization, SQL migration execution and any infrastructure/quiesce adapters. Installation never implies tenant enablement; disable/uninstall retain data. Migration/infrastructure failures persist reconciliation state, and DDL is not rolled back automatically.
984
+ *
985
+ * @example
986
+ * ```typescript
987
+ * import { PluginLifecycle, type LifecycleProject } from '@alneas/eaos-server/lifecycle-engine';
988
+ * export function connectLifecycle(project: LifecycleProject) { return new PluginLifecycle(project); }
989
+ * ```
990
+ */
991
+ declare class PluginLifecycle {
992
+ private readonly project;
993
+ readonly frameworkVersion: string;
994
+ private readonly plugins;
995
+ private readonly backends;
996
+ private readonly contracts;
997
+ /**
998
+ * Validates and snapshots the registered plugin, backend, contract and bundle catalogs.
999
+ * @param project - Host lifecycle storage, trusted catalogs and execution adapters.
1000
+ * @param frameworkVersion - Valid semver framework version; defaults to the installed package version.
1001
+ * @throws Error for invalid/duplicate IDs, versions, migrations, conflicting schemas, unsupported backend configuration or unsatisfied contract dependencies.
1002
+ *
1003
+ * @example
1004
+ * ```typescript
1005
+ * import { PluginLifecycle, type LifecycleProject } from '@alneas/eaos-server/lifecycle-engine';
1006
+ * export function connectLifecycle(project: LifecycleProject) { return new PluginLifecycle(project); }
1007
+ * ```
1008
+ */
1009
+ constructor(project: LifecycleProject, frameworkVersion?: string);
1010
+ private bundle;
1011
+ /**
1012
+ * Plans registered bundle members sequentially against a projected ledger state.
1013
+ * @param request - Lifecycle request whose pluginId names a registered bundle.
1014
+ * @returns A checksum-bound ordered bundle plan with each member's projected revision.
1015
+ * @throws Rejects unknown bundle, invalid member request/state or propagated store failures.
1016
+ *
1017
+ * @remarks
1018
+ * Disable/uninstall reverse bundle order. Planning executes no migrations or writes; projected revisions mirror member apply ordering.
1019
+ *
1020
+ * @example
1021
+ * ```typescript
1022
+ * import { PluginLifecycle, type LifecycleRequest } from '@alneas/eaos-server/lifecycle-engine';
1023
+ * export function reviewBundle(lifecycle: PluginLifecycle, request: LifecycleRequest) { return lifecycle.planBundle(request); }
1024
+ * ```
1025
+ */
1026
+ planBundle(request: LifecycleRequest): Promise<LifecycleBundlePlan>;
1027
+ /**
1028
+ * Advance the read-only state used while constructing sequential bundle plans.
1029
+ * apply() performs these writes in the same order; mirroring them here keeps
1030
+ * each plan's revision and dependency closure valid when applyBundle() runs.
1031
+ */
1032
+ private projectBundleState;
1033
+ /**
1034
+ * Validates a reviewed bundle plan and applies its member plans in sequence.
1035
+ * @param bundlePlan - Unmodified checksum-bound bundle plan from planBundle.
1036
+ * @returns Resolves without a value after every member apply completes.
1037
+ * @throws Rejects modified/stale/misordered bundle plans, member apply failures and propagated host errors.
1038
+ *
1039
+ * @remarks
1040
+ * Members acquire their own ledger locks. There is no all-or-nothing bundle transaction; earlier members remain applied if a later member fails. Replan/reconcile before retrying uncertain outcomes.
1041
+ *
1042
+ * @example
1043
+ * ```typescript
1044
+ * import { PluginLifecycle, type LifecycleBundlePlan } from '@alneas/eaos-server/lifecycle-engine';
1045
+ * export function applyReviewedBundle(lifecycle: PluginLifecycle, plan: LifecycleBundlePlan) { return lifecycle.applyBundle(plan); }
1046
+ * ```
1047
+ */
1048
+ applyBundle(bundlePlan: LifecycleBundlePlan): Promise<void>;
1049
+ private release;
1050
+ private order;
1051
+ /**
1052
+ * Resolves the canonical schema dependency catalog for registered feature plugins.
1053
+ *
1054
+ * Read-only complete schema inventory for the selected trusted feature catalog.
1055
+ * @param pluginIds - Optional feature IDs; omitted includes all registered plugins, while an empty array selects none.
1056
+ * @returns A JSON-cloned dependency-resolved DataContractCatalog.
1057
+ * @throws Error for unknown/incompatible feature dependencies or invalid/conflicting contract requirements.
1058
+ *
1059
+ * @remarks
1060
+ * Read-only; schema dependencies never install or enable feature plugins.
1061
+ *
1062
+ * @example
1063
+ * ```typescript
1064
+ * import { PluginLifecycle } from '@alneas/eaos-server/lifecycle-engine';
1065
+ * export function schemas(lifecycle: PluginLifecycle) { return lifecycle.schemaCatalog(); }
1066
+ * ```
1067
+ */
1068
+ schemaCatalog(pluginIds?: readonly string[]): DataContractCatalog;
1069
+ private catalog;
1070
+ private contractReady;
1071
+ /** Contract ledger identities may retain a feature's historical name even
1072
+ * when that feature no longer consumes the contract. Match the actual
1073
+ * immutable migration, rather than only the current feature's catalog. */
1074
+ private isContractMigration;
1075
+ private target;
1076
+ /**
1077
+ * Creates a reviewable lifecycle plan from one current ledger snapshot without executing side effects.
1078
+ * @param request - Concrete operation, registered plugin/backend and verified tenant; see LifecycleRequest.
1079
+ * @returns A deterministic checksum-bound plan carrying the snapshot revision, dependency closure, migrations and retained-data policy.
1080
+ * @throws Rejects invalid request/state, incompatible or missing dependencies, changed applied migrations, dirty ledger, unsupported dialect, tenant mismatch or propagated store failures.
1081
+ *
1082
+ * @remarks
1083
+ * Planning is read-only but may become stale immediately. Backend physical identity is immutable. Updates require appended immutable migrations and compatible schema versions; installation and enablement are separate operations.
1084
+ *
1085
+ * @example
1086
+ * ```typescript
1087
+ * import { PluginLifecycle, type LifecycleRequest } from '@alneas/eaos-server/lifecycle-engine';
1088
+ * export function review(lifecycle: PluginLifecycle, request: LifecycleRequest) { return lifecycle.plan(request); }
1089
+ * ```
1090
+ */
1091
+ plan(request: LifecycleRequest): Promise<LifecyclePlan>;
1092
+ private makePlan;
1093
+ private dependsOn;
1094
+ private ready;
1095
+ /**
1096
+ * Checks that a tenant activation and its entire registered dependency closure match ready ledger releases.
1097
+ * @param backendId - Registered execution backend ID.
1098
+ * @param tenantId - Verified concrete tenant ID.
1099
+ * @param pluginId - Registered feature ID to check.
1100
+ * @returns True only when matching installation, migrations, infrastructure and activation digests are all ready; false for missing/incompatible readiness.
1101
+ * @throws Rejects malformed IDs/state, unknown or mismatched backend/tenant and store failures.
1102
+ *
1103
+ * @remarks
1104
+ * Read-only admission check; a later state change can revoke access. Host must still enforce current tenant/resource authorization.
1105
+ *
1106
+ * @example
1107
+ * ```typescript
1108
+ * import { PluginLifecycle } from '@alneas/eaos-server/lifecycle-engine';
1109
+ * export function admitted(lifecycle: PluginLifecycle, backendId: string, tenantId: string, pluginId: string) { return lifecycle.isEnabled(backendId, tenantId, pluginId); }
1110
+ * ```
1111
+ */
1112
+ isEnabled(backendId: string, tenantId: string, pluginId: string): Promise<boolean>;
1113
+ private enabledInState;
1114
+ /**
1115
+ * Reads inventory including registered uninstalled code and orphaned historical installations.
1116
+ *
1117
+ * One read-only control-state snapshot; includes orphaned installation records and registered, uninstalled code.
1118
+ * @param options - Optional backendId and tenantId filters; omitted returns all known inventory.
1119
+ * @returns A revision-bound inventory with effective enabled state distinct from requested activation.
1120
+ * @throws Rejects invalid filter IDs, unknown backend, corrupt installation/activation records, dedicated tenant mismatch or store failure.
1121
+ *
1122
+ * @remarks
1123
+ * Performs one ledger read without writes. Dedicated backends for another tenant are omitted unless explicitly requested, in which case the request rejects.
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * import { PluginLifecycle } from '@alneas/eaos-server/lifecycle-engine';
1128
+ * export function inventory(lifecycle: PluginLifecycle) { return lifecycle.list(); }
1129
+ * ```
1130
+ */
1131
+ list(options?: {
1132
+ /**
1133
+ * Optional exact backend filter; unknown backends reject.
1134
+ */
1135
+ backendId?: string;
1136
+ /**
1137
+ * Optional concrete tenant filter; dedicated backend scope must match.
1138
+ */
1139
+ tenantId?: string;
1140
+ }): Promise<LifecycleInventory>;
1141
+ /**
1142
+ * Runs a host callback only after the current plugin dependency closure passes lifecycle admission.
1143
+ * @typeParam T - Value resolved by the admitted callback.
1144
+ * @param backendId - Registered backend ID.
1145
+ * @param tenantId - Verified concrete tenant ID.
1146
+ * @param pluginId - Feature plugin ID.
1147
+ * @param callback - Async work invoked once after admission; must enforce tenant/resource authorization itself.
1148
+ * @returns The callback result without cloning.
1149
+ * @throws Rejects inactive plugin, lifecycle/store validation failure or callback rejection.
1150
+ *
1151
+ * @remarks
1152
+ * The admission check does not hold a lock or pin activation throughout callback execution. Host quiesce/drain and live authorization remain required.
1153
+ *
1154
+ * @example
1155
+ * ```typescript
1156
+ * import { PluginLifecycle } from '@alneas/eaos-server/lifecycle-engine';
1157
+ * export function runAdmitted<T>(lifecycle: PluginLifecycle, backendId: string, tenantId: string, pluginId: string, work: () => Promise<T>) { return lifecycle.run(backendId, tenantId, pluginId, work); }
1158
+ * ```
1159
+ */
1160
+ run<T>(backendId: string, tenantId: string, pluginId: string, callback: () => Promise<T>): Promise<T>;
1161
+ /**
1162
+ * Checks plan freshness and invokes host infrastructure previews without applying ledger changes.
1163
+ * @param plan - Unmodified lifecycle plan to preview.
1164
+ * @returns Preview results in infrastructure-step order, or an empty array when no infrastructure is needed.
1165
+ * @throws Rejects stale/modified plan, missing infrastructure adapter or propagated plan/preview errors.
1166
+ *
1167
+ * @remarks
1168
+ * Infrastructure previews run concurrently through Promise.all. Host preview adapters own any external read/preview effects; this method executes no migrations.
1169
+ *
1170
+ * @example
1171
+ * ```typescript
1172
+ * import { PluginLifecycle, type LifecyclePlan } from '@alneas/eaos-server/lifecycle-engine';
1173
+ * export function preview(lifecycle: PluginLifecycle, plan: LifecyclePlan) { return lifecycle.preview(plan); }
1174
+ * ```
1175
+ */
1176
+ preview(plan: LifecyclePlan): Promise<unknown[]>;
1177
+ /**
1178
+ * Revalidates and executes a reviewed lifecycle plan while holding the host's exclusive ledger lock.
1179
+ * @param plan - Unmodified plan bound to the current ledger revision and registered configuration.
1180
+ * @returns Resolves without a value after ledger updates and requested side effects complete.
1181
+ * @throws Rejects stale/modified plan, missing executors/quiesce, reconciliation conflicts or host store, migration, infrastructure or drain failures.
1182
+ *
1183
+ * @remarks
1184
+ * Before upgrade side effects, affected activations are disabled durably and all-instance quiesce is required. Infrastructure/migration running/applied/failed receipts are persisted separately. Errors can follow partial external success; no automatic rollback/retry occurs. Uninstall retains business data and migration history.
1185
+ *
1186
+ * @example
1187
+ * ```typescript
1188
+ * import { PluginLifecycle, type LifecyclePlan } from '@alneas/eaos-server/lifecycle-engine';
1189
+ * export function applyReviewed(lifecycle: PluginLifecycle, plan: LifecyclePlan) { return lifecycle.apply(plan); }
1190
+ * ```
1191
+ */
1192
+ apply(plan: LifecyclePlan): Promise<void>;
1193
+ }
1194
+
1195
+ /**
1196
+ * Explicit complete fleet or nonempty concrete tenant selection for a reviewed data move.
1197
+ *
1198
+ * @see planBackendMigration for canonical integration usage.
1199
+ */
1200
+ type BackendMigrationScope = {
1201
+ /**
1202
+ * Scope discriminator: all-tenants includes the fleet; tenants names a concrete bounded selection.
1203
+ */
1204
+ kind: 'all-tenants';
1205
+ } | {
1206
+ /**
1207
+ * Scope discriminator: all-tenants includes the fleet; tenants names a concrete bounded selection.
1208
+ */
1209
+ kind: 'tenants';
1210
+ /**
1211
+ * Nonempty distinct concrete tenant IDs; dedicated endpoint tenants must be included.
1212
+ */
1213
+ tenantIds: readonly string[];
1214
+ };
1215
+ /**
1216
+ * Operator-reviewed source/target database move with bounded scope and reason.
1217
+ *
1218
+ * @see planBackendMigration for canonical integration usage.
1219
+ */
1220
+ interface BackendMigrationRequest {
1221
+ /**
1222
+ * Nonblank stable migration identity, up to 256 characters.
1223
+ */
1224
+ migrationId: string;
1225
+ /**
1226
+ * Existing backend whose data remains retained.
1227
+ */
1228
+ source: BackendTarget;
1229
+ /**
1230
+ * Different backend and physical database identity.
1231
+ */
1232
+ target: BackendTarget;
1233
+ /**
1234
+ * All tenants or nonempty unique explicit tenant IDs; dedicated endpoints require their tenant in explicit scope.
1235
+ */
1236
+ scope: BackendMigrationScope;
1237
+ /**
1238
+ * Nonempty unique registered-style feature IDs covered by the move.
1239
+ */
1240
+ pluginIds: readonly string[];
1241
+ /**
1242
+ * Parseable request timestamp.
1243
+ */
1244
+ requestedAt: string;
1245
+ /**
1246
+ * Nonblank reviewed operator reason, at most 1024 characters.
1247
+ */
1248
+ reason: string;
1249
+ }
1250
+ /**
1251
+ * Deterministic five-phase non-destructive data migration plan.
1252
+ *
1253
+ * @see planBackendMigration for canonical integration usage.
1254
+ */
1255
+ interface BackendMigrationPlan {
1256
+ /**
1257
+ * Plan discriminator; currently 1.
1258
+ */
1259
+ format: 1;
1260
+ /**
1261
+ * Canonical digest of the normalized request and phase/safety flags.
1262
+ */
1263
+ id: string;
1264
+ /**
1265
+ * Cloned request with sorted plugin and explicit tenant IDs.
1266
+ */
1267
+ request: BackendMigrationRequest;
1268
+ /**
1269
+ * Ordered prepare/copy/verify/cutover/retain-source execution phases.
1270
+ */
1271
+ phases: readonly ['prepare', 'copy', 'verify', 'cutover', 'retain-source'];
1272
+ /**
1273
+ * Always true; the host must drain affected execution before switching.
1274
+ */
1275
+ requiresQuiesce: true;
1276
+ /**
1277
+ * Always true; source data must remain available.
1278
+ */
1279
+ retainSourceData: true;
1280
+ /**
1281
+ * Always false; dropping source data is outside this plan.
1282
+ */
1283
+ destructiveOperations: false;
1284
+ }
1285
+ /**
1286
+ * Host-reported match for one tenant/plugin copy at observed revisions.
1287
+ *
1288
+ * @see planBackendMigration for canonical integration usage.
1289
+ */
1290
+ interface BackendMigrationVerification {
1291
+ /**
1292
+ * Concrete verified tenant covered by the plan.
1293
+ */
1294
+ tenantId: string;
1295
+ /**
1296
+ * Planned feature whose records were compared.
1297
+ */
1298
+ pluginId: string;
1299
+ /**
1300
+ * Nonnegative safe revision observed at source.
1301
+ */
1302
+ sourceRevision: number;
1303
+ /**
1304
+ * Nonnegative safe revision observed at target; not required to numerically equal source.
1305
+ */
1306
+ targetRevision: number;
1307
+ /**
1308
+ * True only when the host comparison passed; validator does not perform the comparison.
1309
+ */
1310
+ matched: boolean;
1311
+ }
1312
+ /**
1313
+ * Host verification evidence bound to a reviewed source/target migration.
1314
+ *
1315
+ * @see planBackendMigration for canonical integration usage.
1316
+ */
1317
+ interface BackendMigrationVerificationReport {
1318
+ /**
1319
+ * Plan request migration identity.
1320
+ */
1321
+ migrationId: string;
1322
+ /**
1323
+ * Exact source backend identity.
1324
+ */
1325
+ sourceBackendId: string;
1326
+ /**
1327
+ * Exact target backend identity.
1328
+ */
1329
+ targetBackendId: string;
1330
+ /**
1331
+ * Parseable verification timestamp.
1332
+ */
1333
+ checkedAt: string;
1334
+ /**
1335
+ * Nonempty matched in-scope record reports; host must establish exhaustive coverage.
1336
+ */
1337
+ records: readonly BackendMigrationVerification[];
1338
+ /**
1339
+ * Host declaration that verification passed; must be true for acceptance.
1340
+ */
1341
+ passed: boolean;
1342
+ }
1343
+ /**
1344
+ * Host-reported routing switch retaining the original database for recovery.
1345
+ *
1346
+ * @see planBackendMigration for canonical integration usage.
1347
+ */
1348
+ interface BackendMigrationCutover {
1349
+ /**
1350
+ * Plan migration identity.
1351
+ */
1352
+ migrationId: string;
1353
+ /**
1354
+ * Exact reviewed target backend.
1355
+ */
1356
+ targetBackendId: string;
1357
+ /**
1358
+ * Nonnegative safe routing revision after cutover.
1359
+ */
1360
+ routingRevision: number;
1361
+ /**
1362
+ * Parseable routing-switch timestamp.
1363
+ */
1364
+ cutoverAt: string;
1365
+ /**
1366
+ * Must be true; destructive source cleanup is outside this contract.
1367
+ */
1368
+ sourceRetained: true;
1369
+ }
1370
+ /**
1371
+ * Host-owned migration phases operating on real adapters and retained source storage.
1372
+ *
1373
+ * @see planBackendMigration for canonical integration usage.
1374
+ */
1375
+ interface BackendMigrationExecutor {
1376
+ /**
1377
+ * Provision/adopt the reviewed target and establish quiescence without deleting source data.
1378
+ * @param plan - Reviewed unmodified backend migration plan; host must preserve quiescence and source data.
1379
+ * @returns Resolves without a value after target preparation and required quiescence.
1380
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
1381
+
1382
+ * @example
1383
+ * ```typescript
1384
+ * import type { BackendMigrationExecutor, BackendMigrationPlan } from '@alneas/eaos-server/lifecycle-engine';
1385
+ * export async function prepareReviewed(executor: BackendMigrationExecutor, plan: BackendMigrationPlan) {
1386
+ * // The host approves exact targets and serializes migration writers.
1387
+ * await executor.prepare(plan);
1388
+ * }
1389
+ * ```
1390
+ */
1391
+ prepare(plan: BackendMigrationPlan): Promise<void>;
1392
+ /**
1393
+ * Copy the scoped tenant/plugin data into the target and retain source state.
1394
+ * @param plan - Reviewed unmodified backend migration plan; host must preserve quiescence and source data.
1395
+ * @returns Resolves without a value after the scoped copy completes, with source retained.
1396
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
1397
+
1398
+ * @example
1399
+ * ```typescript
1400
+ * import type { BackendMigrationExecutor, BackendMigrationPlan } from '@alneas/eaos-server/lifecycle-engine';
1401
+ * export async function copyReviewed(executor: BackendMigrationExecutor, plan: BackendMigrationPlan) {
1402
+ * // The host approves exact targets and serializes migration writers.
1403
+ * await executor.copy(plan);
1404
+ * }
1405
+ * ```
1406
+ */
1407
+ copy(plan: BackendMigrationPlan): Promise<void>;
1408
+ /**
1409
+ * Produce nonempty exhaustive host match evidence for the plan's scope.
1410
+ * @param plan - Reviewed unmodified backend migration plan; host must preserve quiescence and source data.
1411
+ * @returns The host verification report; caller must check it against the reviewed plan.
1412
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
1413
+
1414
+ * @example
1415
+ * ```typescript
1416
+ * import type { BackendMigrationExecutor, BackendMigrationPlan } from '@alneas/eaos-server/lifecycle-engine';
1417
+ * export async function verifyReviewed(executor: BackendMigrationExecutor, plan: BackendMigrationPlan) {
1418
+ * // The host approves exact targets and serializes migration writers.
1419
+ * return executor.verify(plan);
1420
+ * }
1421
+ * ```
1422
+ */
1423
+ verify(plan: BackendMigrationPlan): Promise<BackendMigrationVerificationReport>;
1424
+ /**
1425
+ * Switch routing only after valid verification, retaining source and returning a cutover receipt.
1426
+ * @param plan - Reviewed unmodified backend migration plan; host must preserve quiescence and source data.
1427
+ * @param verification - Matching passed host verification report; establish complete copy coverage before cutover.
1428
+ * @returns A source-retaining routing cutover receipt after accepted verification.
1429
+ * @throws Host adapter or callback failures reject the returned Promise; side effects may already be partially complete.
1430
+
1431
+ * @example
1432
+ * ```typescript
1433
+ * import type { BackendMigrationExecutor, BackendMigrationPlan, BackendMigrationVerificationReport } from '@alneas/eaos-server/lifecycle-engine';
1434
+ * export async function cutoverReviewed(executor: BackendMigrationExecutor, plan: BackendMigrationPlan, verification: BackendMigrationVerificationReport) {
1435
+ * // Supply current, successful evidence for this exact reviewed plan.
1436
+ * return executor.cutover(plan, verification);
1437
+ * }
1438
+ * ```
1439
+ */
1440
+ cutover(plan: BackendMigrationPlan, verification: BackendMigrationVerificationReport): Promise<BackendMigrationCutover>;
1441
+ }
1442
+ /**
1443
+ * Creates a deterministic source-retaining migration plan without touching either database.
1444
+ *
1445
+ * Create a reviewable fleet/tenant data-migration plan without touching either backend.
1446
+ * @param request - Reviewed distinct physical source/target backends, concrete tenant scope, nonempty unique plugin IDs, timestamp and reason.
1447
+ * @returns A shallow-frozen plan with sorted cloned scopes/plugin IDs and five ordered phases.
1448
+ * @throws Error for malformed request, same source/target identity, invalid scope or dedicated-tenant mismatch.
1449
+ *
1450
+ * @remarks
1451
+ * Dedicated backend tenants must appear in explicit tenant scope. No executor, lock, provisioning, copy or cutover runs during planning; host must implement quiescence.
1452
+ *
1453
+ * @example
1454
+ * ```typescript
1455
+ * import { planBackendMigration } from '@alneas/eaos-server/lifecycle-engine/backend-migration';
1456
+ * const plan = planBackendMigration({ migrationId: 'move-1', source: { id: 'old', databaseId: 'db-old', dialect: 'sqlite', mode: 'shared' }, target: { id: 'new', databaseId: 'db-new', dialect: 'postgres', mode: 'shared' }, scope: { kind: 'tenants', tenantIds: ['sample'] }, pluginIds: ['reports'], requestedAt: '2026-01-01T00:00:00Z', reason: 'Reviewed backend move' });
1457
+ * ```
1458
+ */
1459
+ declare function planBackendMigration(request: BackendMigrationRequest): BackendMigrationPlan;
1460
+ /**
1461
+ * Checks that a reported migration verification matches its plan and contains only matched in-scope records.
1462
+ * @param plan - Reviewed backend migration plan.
1463
+ * @param report - Host report claiming passed verification for the plan's source and target.
1464
+ * @returns The original report when accepted; it is neither cloned nor independently measured.
1465
+ * @throws Error for mismatched identities, invalid timestamp/revisions, out-of-scope records or unpassed/unmatched evidence.
1466
+ *
1467
+ * @remarks
1468
+ * Validates nonempty records and nonnegative revisions, but does not prove exhaustive tenant/plugin coverage or equal source/target revision numbers. The host owns verification completeness and truth.
1469
+ *
1470
+ * @example
1471
+ * ```typescript
1472
+ * import { assertBackendMigrationVerification, type BackendMigrationPlan, type BackendMigrationVerificationReport } from '@alneas/eaos-server/lifecycle-engine/backend-migration';
1473
+ * export function inspectVerification(plan: BackendMigrationPlan, report: BackendMigrationVerificationReport) { return assertBackendMigrationVerification(plan, report); }
1474
+ * ```
1475
+ */
1476
+ declare function assertBackendMigrationVerification(plan: BackendMigrationPlan, report: BackendMigrationVerificationReport): BackendMigrationVerificationReport;
1477
+ /**
1478
+ * Validates matching verification and a source-retaining cutover receipt for the target backend.
1479
+ * @param plan - Reviewed backend migration plan.
1480
+ * @param report - Passed host verification matching the plan.
1481
+ * @param cutover - Host routing receipt with nonnegative routing revision and parseable cutover timestamp.
1482
+ * @returns The original cutover object; no routing mutation occurs.
1483
+ * @throws Error for invalid verification, mismatched target/migration, missing source-retention claim or invalid revision/time.
1484
+ *
1485
+ * @remarks
1486
+ * This is evidence shape validation, not independent copy verification or authority to switch a tenant.
1487
+ *
1488
+ * @example
1489
+ * ```typescript
1490
+ * import { assertBackendMigrationCutover, type BackendMigrationPlan, type BackendMigrationVerificationReport, type BackendMigrationCutover } from '@alneas/eaos-server/lifecycle-engine/backend-migration';
1491
+ * export function inspectCutover(plan: BackendMigrationPlan, report: BackendMigrationVerificationReport, receipt: BackendMigrationCutover) { return assertBackendMigrationCutover(plan, report, receipt); }
1492
+ * ```
1493
+ */
1494
+ declare function assertBackendMigrationCutover(plan: BackendMigrationPlan, report: BackendMigrationVerificationReport, cutover: BackendMigrationCutover): BackendMigrationCutover;
1495
+
1496
+ export { FRAMEWORK_VERSION, PluginLifecycle, assertBackendMigrationCutover, assertBackendMigrationVerification, canonical, createDataContractBaseline, emptyLifecyclePlatformState, emptyLifecycleState, lifecycleDigest, normalizeLifecycleState, planBackendMigration, rebaseDataContractBaseline };
1497
+ export type { BackendMigrationCutover, BackendMigrationExecutor, BackendMigrationPlan, BackendMigrationRequest, BackendMigrationScope, BackendMigrationVerification, BackendMigrationVerificationReport, BackendTarget, DataContractBaseline, Dialect, InfrastructureStep, Installation, LifecycleBundlePlan, LifecycleInventory, LifecycleInventoryEntry, LifecyclePlan, LifecyclePlatformBackendMetadata, LifecyclePlatformMigrationRecord, LifecyclePlatformMigrationStatus, LifecyclePlatformPlacement, LifecyclePlatformState, LifecyclePlatformTenant, LifecyclePlugin, LifecycleProject, LifecycleRequest, LifecycleState, LifecycleStore, LifecycleWriter, MigrationRecord, MigrationStep, Operation, PluginMigration };