@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,60 @@
1
+ import {
2
+ platformDatabaseTargets,
3
+ resolvePlatformDatabaseTarget,
4
+ validatePlatformRuntime
5
+ } from "../../chunk-RHN4Y6VS.js";
6
+ import {
7
+ parseSitePublicationPolicy
8
+ } from "../../chunk-5TBBZIND.js";
9
+ import {
10
+ initialPersonName,
11
+ parseAccountMemberships,
12
+ personKinds,
13
+ selectAccountTenant
14
+ } from "../../chunk-XITLHDG3.js";
15
+ import {
16
+ validatePlatformPackages
17
+ } from "../../chunk-HCKAGLLB.js";
18
+ import "../../chunk-55D4ERWO.js";
19
+ import {
20
+ TenantDatabaseRouter
21
+ } from "../../chunk-LOUGW6MU.js";
22
+ import {
23
+ deploymentExecutionTarget,
24
+ deploymentPlacementHash,
25
+ resolveDeploymentPlacements,
26
+ summarizePlacedDeployment,
27
+ validateDeploymentPlacements
28
+ } from "../../chunk-ZWZDLOE7.js";
29
+ import {
30
+ deploymentActions,
31
+ deploymentComponentKinds,
32
+ summarizeDeployment,
33
+ validateDeploymentPlugins,
34
+ validateDeploymentReceipt,
35
+ validateDeploymentTarget
36
+ } from "../../chunk-6CBVZ6CT.js";
37
+ export {
38
+ TenantDatabaseRouter,
39
+ deploymentActions,
40
+ deploymentComponentKinds,
41
+ deploymentExecutionTarget,
42
+ deploymentPlacementHash,
43
+ initialPersonName,
44
+ parseAccountMemberships,
45
+ parseSitePublicationPolicy,
46
+ personKinds,
47
+ platformDatabaseTargets,
48
+ resolveDeploymentPlacements,
49
+ resolvePlatformDatabaseTarget,
50
+ selectAccountTenant,
51
+ summarizeDeployment,
52
+ summarizePlacedDeployment,
53
+ validateDeploymentPlacements,
54
+ validateDeploymentPlugins,
55
+ validateDeploymentReceipt,
56
+ validateDeploymentTarget,
57
+ validatePlatformPackages,
58
+ validatePlatformRuntime
59
+ };
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,80 @@
1
+ import { BackendTarget } from '../index.js';
2
+ import { PlatformPackage } from './artifacts.js';
3
+ import '@alneas/eaos-core/contracts/data-contracts';
4
+ import '@alneas/eaos-core/plugin-sdk';
5
+
6
+ /**
7
+ * Nonsecret target catalog for routing databases within one shared execution host.
8
+ *
9
+ *
10
+ * Database placement inside one shared execution host. Targets reuse lifecycle identities.
11
+ * @see validatePlatformRuntime for canonical integration usage.
12
+ */
13
+ interface PlatformRuntimeConfig {
14
+ /**
15
+ * Default target used for tenants without an explicit placement.
16
+ */
17
+ backend: BackendTarget;
18
+ /**
19
+ * Optional additional target definitions with distinct IDs.
20
+ */
21
+ databaseTargets?: BackendTarget[];
22
+ /**
23
+ * Optional verified tenant ID to configured target-ID map; dedicated additional targets require explicit entries.
24
+ */
25
+ tenantPlacements?: Record<string, string>;
26
+ }
27
+ /**
28
+ * Lists the default and additional configured database targets in declaration order.
29
+ * @param runtime - Platform runtime configuration; validate it before use.
30
+ * @returns A new array containing runtime.backend followed by databaseTargets; target objects are shared.
31
+ *
32
+ * @remarks
33
+ * Does not validate or deduplicate targets and performs no discovery or connection.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { platformDatabaseTargets } from '@alneas/eaos-server/platform/runtime';
38
+ * const targets = platformDatabaseTargets({ backend: { id: 'main', databaseId: 'db-main', dialect: 'sqlite', mode: 'shared' } });
39
+ * ```
40
+ */
41
+ declare function platformDatabaseTargets(runtime: PlatformRuntimeConfig): BackendTarget[];
42
+ /**
43
+ * Validates explicit database placements and verifies that registered package tenants resolve to permitted targets.
44
+ * @param value - Untrusted runtime declaration, or undefined when no runtime is configured.
45
+ * @param packages - Validated package registrations whose tenant scopes must resolve; defaults to none.
46
+ * @returns The original runtime object when accepted, or undefined for absent configuration.
47
+ * @throws Error for malformed/duplicate targets, shared/dedicated scope mismatch, missing explicit placements or unresolved package tenants.
48
+ *
49
+ * @remarks
50
+ * Dedicated targets require unique physical database IDs and explicit placements unless they are the default backend. This checks nonsecret declarations only; host pools, provisioning and membership remain external.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * import { validatePlatformRuntime } from '@alneas/eaos-server/platform/runtime';
55
+ * const runtime = validatePlatformRuntime({ backend: { id: 'main', databaseId: 'db-main', dialect: 'sqlite', mode: 'shared' } });
56
+ * ```
57
+ */
58
+ declare function validatePlatformRuntime(value: unknown, packages?: PlatformPackage[]): PlatformRuntimeConfig | undefined;
59
+ /**
60
+ * Resolves a verified tenant to its explicit placement or the configured default backend.
61
+ *
62
+ * Tenant comes from verified host membership, never raw request input. No implicit migration/fallback.
63
+ * @param runtime - Previously validated runtime configuration.
64
+ * @param tenantId - Verified concrete tenant from host membership, never raw request input.
65
+ * @returns The configured target object without cloning.
66
+ * @throws Error for missing/wildcard tenant or unavailable/mismatched target.
67
+ *
68
+ * @remarks
69
+ * Unmapped tenants use the configured default; a missing or dedicated-mismatched selected target fails rather than trying another database. No migration or database operation occurs.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * import { resolvePlatformDatabaseTarget } from '@alneas/eaos-server/platform/runtime';
74
+ * const target = resolvePlatformDatabaseTarget({ backend: { id: 'main', databaseId: 'db-main', dialect: 'sqlite', mode: 'shared' } }, 'sample');
75
+ * ```
76
+ */
77
+ declare function resolvePlatformDatabaseTarget(runtime: PlatformRuntimeConfig, tenantId: string): BackendTarget;
78
+
79
+ export { platformDatabaseTargets, resolvePlatformDatabaseTarget, validatePlatformRuntime };
80
+ export type { PlatformRuntimeConfig };
@@ -0,0 +1,11 @@
1
+ import {
2
+ platformDatabaseTargets,
3
+ resolvePlatformDatabaseTarget,
4
+ validatePlatformRuntime
5
+ } from "../../chunk-RHN4Y6VS.js";
6
+ export {
7
+ platformDatabaseTargets,
8
+ resolvePlatformDatabaseTarget,
9
+ validatePlatformRuntime
10
+ };
11
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Host-owned nonsecret publication mode and approval/trigger requirements; secret fields name bindings rather than contain secrets.
3
+ *
4
+ *
5
+ * Host-owned policy; secrets and executable commands are never configuration values.
6
+ * @see parseSitePublicationPolicy for canonical integration usage.
7
+ */
8
+ type SitePublicationPolicy = {
9
+ /**
10
+ * Whether host workflow must obtain approval before publication; parsing does not grant approval.
11
+ */
12
+ requireApproval: boolean;
13
+ /**
14
+ * Operator initiation or CMS-published event; manual mode permits only operator.
15
+ */
16
+ trigger: 'operator' | 'cms-published';
17
+ } & ({
18
+ /**
19
+ * Publication integration discriminator selecting its required nonsecret fields.
20
+ */
21
+ mode: 'pages-git';
22
+ /**
23
+ * Cloudflare account identifier, exactly 32 lowercase hexadecimal characters; not an access token.
24
+ */
25
+ accountId: string;
26
+ /**
27
+ * Registered Pages project slug, at most 63 lowercase letters/digits/hyphens.
28
+ */
29
+ project: string;
30
+ /**
31
+ * Reviewed Git branch reference without traversal or trailing slash.
32
+ */
33
+ branch: string;
34
+ /**
35
+ * Uppercase host secret-binding name for the deploy hook; never the hook value.
36
+ */
37
+ deployHookSecret: string;
38
+ } | {
39
+ /**
40
+ * Publication integration discriminator selecting its required nonsecret fields.
41
+ */
42
+ mode: 'github-actions';
43
+ /**
44
+ * Reviewed GitHub owner/repository reference.
45
+ */
46
+ repository: string;
47
+ /**
48
+ * Reviewed workflow basename ending .yml or .yaml.
49
+ */
50
+ workflow: string;
51
+ /**
52
+ * Reviewed Git ref without traversal or trailing slash.
53
+ */
54
+ ref: string;
55
+ /**
56
+ * Uppercase host secret-binding name for the provider token; never the token value.
57
+ */
58
+ tokenSecret: string;
59
+ } | {
60
+ /**
61
+ * Publication integration discriminator selecting its required nonsecret fields.
62
+ */
63
+ mode: 'artifact';
64
+ /**
65
+ * Registered artifact publication adapter ID, up to 100 letters/digits/underscore/hyphen characters.
66
+ */
67
+ provider: string;
68
+ /**
69
+ * Registered nonsecret artifact publication target ID.
70
+ */
71
+ target: string;
72
+ } | {
73
+ /**
74
+ * Publication integration discriminator selecting its required nonsecret fields.
75
+ */
76
+ mode: 'manual';
77
+ });
78
+ /**
79
+ * Supported publication integration: Pages Git, GitHub Actions, artifact adapter or manual operator flow.
80
+ *
81
+ * @see parseSitePublicationPolicy for canonical integration usage.
82
+ */
83
+ type SitePublicationMode = SitePublicationPolicy['mode'];
84
+ /**
85
+ * Validates and clones a nonsecret host publication policy for one supported publication mode.
86
+ * @param value - Untrusted plain policy declaration with explicit mode, approval flag and trigger plus mode-specific references.
87
+ * @returns A structured clone narrowed to SitePublicationPolicy.
88
+ * @throws Error for unknown/extra fields, malformed provider references, invalid secret-reference names or unsupported trigger/mode combinations.
89
+ *
90
+ * @remarks
91
+ * Secret fields contain uppercase environment/binding names, never actual secret values. Manual publication requires operator trigger. Parsing does not execute publication, grant approval or contact a provider.
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { parseSitePublicationPolicy } from '@alneas/eaos-server/platform/site-publication';
96
+ * const policy = parseSitePublicationPolicy({ mode: 'manual', requireApproval: true, trigger: 'operator' });
97
+ * ```
98
+ */
99
+ declare function parseSitePublicationPolicy(value: unknown): SitePublicationPolicy;
100
+
101
+ export { parseSitePublicationPolicy };
102
+ export type { SitePublicationMode, SitePublicationPolicy };
@@ -0,0 +1,7 @@
1
+ import {
2
+ parseSitePublicationPolicy
3
+ } from "../../chunk-5TBBZIND.js";
4
+ export {
5
+ parseSitePublicationPolicy
6
+ };
7
+ //# sourceMappingURL=site-publication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Host-verified tenant membership used for authorization, separate from business person records.
3
+ *
4
+ *
5
+ * Account membership is authorization data; business people do not grant access.
6
+ * @see parseAccountMemberships for canonical integration usage.
7
+ */
8
+ interface AccountMembership {
9
+ /**
10
+ * Concrete tenant ID, at most 50 supported identifier characters.
11
+ */
12
+ tenantId: string;
13
+ /**
14
+ * Tenant-scoped role, at most 50 characters; platform-global role names are forbidden.
15
+ */
16
+ role: string;
17
+ /**
18
+ * Whether the membership currently grants tenant admission.
19
+ */
20
+ active: boolean;
21
+ }
22
+ /**
23
+ * Validated tenant memberships with optional explicit active default selection.
24
+ *
25
+ * @see parseAccountMemberships for canonical integration usage.
26
+ */
27
+ interface AccountMemberships {
28
+ /**
29
+ * At most 1000 distinct tenant grants; empty means no tenant access.
30
+ */
31
+ memberships: readonly AccountMembership[];
32
+ /**
33
+ * Optional tenant among active memberships; omitted requires selection when multiple are active.
34
+ */
35
+ defaultTenantId?: string;
36
+ }
37
+ /**
38
+ * Supported business directory person categories; categories never grant account membership.
39
+ *
40
+ * @see parseAccountMemberships for canonical integration usage.
41
+ */
42
+ declare const personKinds: readonly ["employee", "contractor", "partner_contact", "customer_contact", "other"];
43
+ /**
44
+ * One supported business relationship category from personKinds.
45
+ *
46
+ * @see parseAccountMemberships for canonical integration usage.
47
+ */
48
+ type PersonKind = typeof personKinds[number];
49
+ /**
50
+ * Tenant-scoped business contact/person metadata that never grants authenticated membership.
51
+ *
52
+ * @see parseAccountMemberships for canonical integration usage.
53
+ */
54
+ interface DirectoryPerson {
55
+ /**
56
+ * Business person record ID.
57
+ */
58
+ id: string;
59
+ /**
60
+ * Tenant owning this directory record.
61
+ */
62
+ tenantId: string;
63
+ /**
64
+ * Optional link to a host identity; linkage alone grants no access.
65
+ */
66
+ identityId?: string;
67
+ /**
68
+ * Stored display/legal name from explicit or verified creation inputs.
69
+ */
70
+ name: string;
71
+ /**
72
+ * Optional contact address; never used to manufacture a name.
73
+ */
74
+ email?: string;
75
+ /**
76
+ * Optional organization display text.
77
+ */
78
+ organizationName?: string;
79
+ /**
80
+ * Business relationship categories, independent of account roles.
81
+ */
82
+ kinds: readonly PersonKind[];
83
+ /**
84
+ * Business directory status, independent of login authorization.
85
+ */
86
+ active: boolean;
87
+ }
88
+ /**
89
+ * Normalizes bounded tenant memberships while rejecting duplicate tenant grants and platform-wide roles.
90
+ *
91
+ * Fail closed on malformed/duplicate membership data; provider metadata is host-owned.
92
+ * @param value - Host-owned verified provider metadata with at most 1000 membership entries and optional active defaultTenantId.
93
+ * @returns New membership records and an optional default tenant; unknown metadata fields are omitted.
94
+ * @throws Error for malformed IDs/roles, duplicate tenants, nonboolean active flags, forbidden global roles or a default outside active memberships.
95
+ *
96
+ * @remarks
97
+ * Tenant roles do not grant platform administration. Parsing validates shape, not metadata authenticity; business directory people never establish access.
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * import { parseAccountMemberships } from '@alneas/eaos-server/platform/user-directory';
102
+ * const account = parseAccountMemberships({ memberships: [{ tenantId: 'sample', role: 'member', active: true }], defaultTenantId: 'sample' });
103
+ * ```
104
+ */
105
+ declare function parseAccountMemberships(value: unknown): AccountMemberships;
106
+ /**
107
+ * Selects an account's declared default or its only active membership without choosing among multiple active tenants.
108
+ * @param account - Previously parsed AccountMemberships; this helper does not revalidate the default.
109
+ * @returns The default tenant, the sole active tenant, or undefined when explicit selection is needed/no active membership exists.
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * import { parseAccountMemberships, selectAccountTenant } from '@alneas/eaos-server/platform/user-directory';
114
+ * const tenantId = selectAccountTenant(parseAccountMemberships({ memberships: [{ tenantId: 'sample', role: 'member', active: true }] }));
115
+ * ```
116
+ */
117
+ declare function selectAccountTenant(account: AccountMemberships): string | undefined;
118
+ /**
119
+ * Chooses a trimmed explicit name or verified display name for initial person creation.
120
+ *
121
+ * Only at initial creation: require a real name, never manufacture one from email.
122
+ * @param explicitName - User-supplied name; nonstring/blank values fall back to verified display name.
123
+ * @param verifiedDisplayName - Trusted provider display name; email addresses are not synthesized into names.
124
+ * @returns The chosen trimmed nonblank name, at most 200 characters.
125
+ * @throws Error when both names are blank/nonstring or the chosen name exceeds 200 characters.
126
+ *
127
+ * @remarks
128
+ * Use only at initial registration; this helper does not update existing profiles or validate legal identity.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { initialPersonName } from '@alneas/eaos-server/platform/user-directory';
133
+ * const name = initialPersonName('Sample Person', undefined);
134
+ * ```
135
+ */
136
+ declare function initialPersonName(explicitName: unknown, verifiedDisplayName: unknown): string;
137
+
138
+ export { initialPersonName, parseAccountMemberships, personKinds, selectAccountTenant };
139
+ export type { AccountMembership, AccountMemberships, DirectoryPerson, PersonKind };
@@ -0,0 +1,13 @@
1
+ import {
2
+ initialPersonName,
3
+ parseAccountMemberships,
4
+ personKinds,
5
+ selectAccountTenant
6
+ } from "../../chunk-XITLHDG3.js";
7
+ export {
8
+ initialPersonName,
9
+ parseAccountMemberships,
10
+ personKinds,
11
+ selectAccountTenant
12
+ };
13
+ //# sourceMappingURL=user-directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ import { Context, Hono } from 'hono';
2
+ import { PluginEntitlementRuntime } from './entitlements/index.js';
3
+ import { AIExecutionContext, AIHostAdapters, PluginRegistry, McpGatekeeper } from '@alneas/eaos-core';
4
+ import 'hono/types';
5
+ import './plugin-data/index.js';
6
+ import '@alneas/eaos-core/plugin-sdk';
7
+ import '@alneas/eaos-server/lifecycle-engine';
8
+
9
+ /**
10
+ * Host-verified identity, roles, and enabled plugins used for MCP discovery and execution.
11
+ * @see createMcpRouter.
12
+ */
13
+ interface McpPrincipal {
14
+ /** Nonblank authenticated user identifier. */
15
+ userId: string;
16
+ /** Nonblank authorized tenant identifier. */
17
+ tenantId: string;
18
+ /** Verified role strings passed to the gatekeeper; an empty array is permitted. */
19
+ roles: string[];
20
+ /** Exact installed plugin IDs, resolved from the server's current tenant configuration. */
21
+ enabledPluginIds: string[];
22
+ }
23
+ /**
24
+ * Shared registry and policy/audit service used by {@link createMcpRouter}.
25
+ */
26
+ interface McpRuntime {
27
+ /** Registry supplying trusted manifests and executable tool handlers. Duplicate tool names fail discovery/execution. */
28
+ registry: PluginRegistry;
29
+ /** Current permission/approval policy and audit sink consulted for tool discovery and calls. */
30
+ gatekeeper: McpGatekeeper;
31
+ }
32
+ /**
33
+ * Live host authorization, resource injection, and bounded SSE-session settings for {@link createMcpRouter}.
34
+ */
35
+ interface McpRouterOptions {
36
+ /** Runtime for declared commercial/usage entitlements; required by plugins whose rules need external entitlement checks. */
37
+ entitlements?: PluginEntitlementRuntime;
38
+ /** Additional current lifecycle gate; called on discovery and immediately before execution. */
39
+ isPluginEnabled?: (principal: McpPrincipal, pluginId: string) => Promise<boolean>;
40
+ /** Must verify authentication, tenant membership and enabled plugins on every request. */
41
+ resolvePrincipal: (context: Context) => Promise<McpPrincipal | null>;
42
+ /** Optional binding for a tenant-dedicated backend. */
43
+ tenantId?: string;
44
+ /** Inject already tenant-scoped resources; never pass an unrestricted administrative DB. */
45
+ createToolContext?: (principal: McpPrincipal, pluginId: string) => Promise<Record<string, unknown>>;
46
+ /** Resolve provider-neutral AI adapters after live authorization; the result is injected into the verified tool context. */
47
+ resolveAIHostAdapters?: (input: {
48
+ /**
49
+ * Verified current request principal after membership and enabled-plugin resolution.
50
+ */
51
+ principal: McpPrincipal;
52
+ /**
53
+ * Owning plugin whose admitted tool needs host AI adapters.
54
+ */
55
+ pluginId: string;
56
+ /**
57
+ * Exact registered MCP tool name being executed.
58
+ */
59
+ toolName: string;
60
+ /**
61
+ * Verified AI execution identity, operation mcp:toolName, and generated trace ID; no client scope overrides are accepted here.
62
+ */
63
+ context: AIExecutionContext;
64
+ }) => Promise<AIHostAdapters | undefined>;
65
+ /** Operational errors only; request bodies/credentials are not passed. */
66
+ onError?: (error: unknown) => void;
67
+ /** Maximum SSE session age and inactivity in milliseconds; finite values are floored and clamped to at least 1000. Defaults to 1800000 for absent/nonfinite input. */
68
+ sseSessionTtlMs?: number;
69
+ /** Per-router SSE session capacity; finite values are floored and clamped to at least 1. Defaults to 1000 for absent/nonfinite input. */
70
+ maxSseSessions?: number;
71
+ }
72
+ /**
73
+ * Creates authenticated MCP tool discovery/execution routes and an SSE JSON-RPC transport.
74
+ * @param runtime - Trusted plugin/tool registry and gatekeeper with audit behavior.
75
+ * @param options - Host principal verification, current lifecycle/entitlement checks, scoped dependencies, AI adapters, and SSE limits.
76
+ * @returns A Hono router exposing GET /tools, POST /execute, GET /sse, and POST /message; no network listener is started.
77
+ * @throws Router construction can propagate validator setup errors. Request-time callback, schema compilation, tool, or audit errors are passed to onError and normally rendered as a generic 500; a throwing onError can itself fail error handling.
78
+ * @remarks Every request resolves current identity and enabled plugins. Tool discovery hides unavailable tools; calls validate arguments, recheck lifecycle before execution, and perform entitlement admission. Human-approval requirements return pending data without executing the handler; no client approval flag bypasses this. Request bodies are limited to 1 MiB. Host callbacks must supply tenant-scoped resources and enforce real membership and lifecycle checks; the router does not open databases or persist results. SSE session state is process-local, owner-bound, capacity-limited, and removed on stream cancellation or lazy expiry checks. Expiry removes the mapping without explicitly closing the existing stream; no heartbeat or cross-process session sharing is provided. Tool failures may occur after side effects, so retry/idempotency remains host-owned.
79
+ * @example
80
+ * ```typescript
81
+ * import { createMcpRouter, type McpRuntime, type McpRouterOptions } from "@alneas/eaos-server/mcp";
82
+ * export function mcpRoutes(runtime: McpRuntime, options: McpRouterOptions) {
83
+ * // options.resolvePrincipal must verify live identity, membership, and enabled plugins.
84
+ * // Supply only tenant-scoped resources through createToolContext.
85
+ * return createMcpRouter(runtime, options);
86
+ * }
87
+ * ```
88
+ */
89
+ declare function createMcpRouter(runtime: McpRuntime, options: McpRouterOptions): Hono;
90
+
91
+ export { createMcpRouter };
92
+ export type { McpPrincipal, McpRouterOptions, McpRuntime };
package/dist/mcp.js ADDED
@@ -0,0 +1,10 @@
1
+ import {
2
+ createMcpRouter
3
+ } from "./chunk-VF5YDZJC.js";
4
+ import "./chunk-46UWPEW2.js";
5
+ import "./chunk-INCHXAFK.js";
6
+ import "./chunk-3VITSHN3.js";
7
+ export {
8
+ createMcpRouter
9
+ };
10
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,118 @@
1
+ import * as hono from 'hono';
2
+ import { EaosUser, EaosEnv } from '@alneas/eaos-core';
3
+
4
+ /**
5
+ * Host authentication adapters used by {@link createAuthMiddleware}.
6
+ * @remarks Results must come from verified credentials and trusted membership data; this middleware does not independently validate claims.
7
+ */
8
+ interface AuthSessionVerifier {
9
+ /**
10
+ * Verifies a session before the optional API key fallback.
11
+ * @param authHeader - Raw Authorization header, or undefined if absent.
12
+ * @param cookieHeader - Raw Cookie header, or undefined if absent.
13
+ * @returns Session validity and trusted optional identity claims. pendingApproval takes priority over valid and produces 403.
14
+ * @throws Rejections propagate through request handling.
15
+
16
+ * @example
17
+ * ```typescript
18
+ * import type { AuthSessionVerifier } from "@alneas/eaos-server";
19
+ * export async function inspectSession(verifier: AuthSessionVerifier, request: Request) {
20
+ * // The host verifier checks real credentials; a header alone is not trusted.
21
+ * const result = await verifier.verifySession(
22
+ * request.headers.get("Authorization") ?? undefined,
23
+ * request.headers.get("Cookie") ?? undefined,
24
+ * );
25
+ * return { valid: result.valid, pendingApproval: result.pendingApproval === true };
26
+ * }
27
+ * ```
28
+ */
29
+ verifySession(authHeader?: string, cookieHeader?: string): Promise<{
30
+ /** True only after successful trusted credential verification. */
31
+ valid: boolean;
32
+ /** Optional authenticated user ID copied to Hono context. */
33
+ userId?: string;
34
+ /** Optional verified email used when synthesizing a user object. */
35
+ email?: string;
36
+ /** Optional verified tenant claim; session middleware can continue without it, so downstream tenant admission remains required. */
37
+ tenantId?: string;
38
+ /** Trusted platform authority enabling X-Tenant-Id selection and synthesized super_admin role. */
39
+ isSuperAdmin?: boolean;
40
+ /** When truthy, produces a 403 before session validity or API-key fallback is considered. */
41
+ pendingApproval?: boolean;
42
+ /** Optional approval reference included in a pending response. */
43
+ pendingId?: string;
44
+ /** Optional trusted user object copied unchanged; if omitted with userId, middleware synthesizes one. */
45
+ user?: EaosUser;
46
+ }>;
47
+ /**
48
+ * Verifies a nonempty credential after session verification fails.
49
+ * @param token - Authorization value with a leading Bearer prefix removed case-insensitively.
50
+ * @returns Validity and trusted identity claims; a valid result also needs tenantId to grant access.
51
+ * @throws Adapter errors propagate through request handling.
52
+
53
+ * @example
54
+ * ```typescript
55
+ * import type { AuthSessionVerifier } from "@alneas/eaos-server";
56
+ * export async function inspectApiKey(verifier: AuthSessionVerifier, token: string) {
57
+ * if (!verifier.verifyApiKey) throw new Error("Host API-key verification is unavailable");
58
+ * // Supply the actual credential without logging or persisting it here.
59
+ * const result = await verifier.verifyApiKey(token);
60
+ * return result.valid && !!result.tenantId;
61
+ * }
62
+ * ```
63
+ */
64
+ verifyApiKey?(token: string): Promise<{
65
+ /** True for a verified API key; tenantId is additionally required to continue. */
66
+ valid: boolean;
67
+ /** Required tenant claim for a successful middleware API-key fallback. */
68
+ tenantId?: string;
69
+ /** Optional authenticated key owner copied to userId; no user object is synthesized for this path. */
70
+ userId?: string;
71
+ }> | {
72
+ /**
73
+ * True only when the host has verified the presented API key; middleware also requires a truthy tenantId before continuing.
74
+ */
75
+ valid: boolean;
76
+ /**
77
+ * Trusted tenant claim required for successful API-key fallback; middleware does not verify tenant membership independently.
78
+ */
79
+ tenantId?: string;
80
+ /**
81
+ * Optional verified key-owner identity copied to request context; this fallback does not synthesize an EaosUser object.
82
+ */
83
+ userId?: string;
84
+ };
85
+ }
86
+ /**
87
+ * Authentication configuration for {@link createAuthMiddleware}.
88
+ */
89
+ interface AuthMiddlewareOptions {
90
+ /** Host verifier; omission allows all requests through without establishing identity. */
91
+ verifier?: AuthSessionVerifier;
92
+ /** Case-sensitive path prefixes exempt from verification; defaults to /health, /metrics, and /api/health. An empty array disables these exemptions. */
93
+ skipPaths?: string[];
94
+ }
95
+ /**
96
+ * Resolves trusted session or API key claims into Hono context and rejects invalid credentials.
97
+ * @param options - Host verifier and excluded path prefixes; see {@link AuthMiddlewareOptions}.
98
+ * @returns Middleware that continues exempt or authenticated requests, returns 403 for pending approval, and otherwise returns 401.
99
+ * @throws Request execution propagates verifier and downstream middleware errors.
100
+ * @remarks Requests with both userId and tenantId already in context bypass verification. Omitting a verifier also bypasses authentication. Only session results marked isSuperAdmin may select X-Tenant-Id; the host remains responsible for tenant existence and authorization. A synthesized user gets super_admin or user roles; API key fallback sets no user object.
101
+ * @example
102
+ * ```typescript
103
+ * import { Hono } from "hono";
104
+ * import type { EaosEnv } from "@alneas/eaos-core";
105
+ * import { createAuthMiddleware, type AuthSessionVerifier } from "@alneas/eaos-server/middleware/auth";
106
+ * export function authenticatedApp(verifier: AuthSessionVerifier) {
107
+ * // Supply a host adapter that actually validates sessions and tenant claims.
108
+ * const app = new Hono<EaosEnv>();
109
+ * app.use("*", createAuthMiddleware({ verifier, skipPaths: [] }));
110
+ * app.get("/identity", c => c.json({ userId: c.get("userId") }));
111
+ * return app;
112
+ * }
113
+ * ```
114
+ */
115
+ declare function createAuthMiddleware(options?: AuthMiddlewareOptions): hono.MiddlewareHandler<EaosEnv, string, {}, Response>;
116
+
117
+ export { createAuthMiddleware };
118
+ export type { AuthMiddlewareOptions, AuthSessionVerifier };
@@ -0,0 +1,7 @@
1
+ import {
2
+ createAuthMiddleware
3
+ } from "../chunk-XIEY2OF4.js";
4
+ export {
5
+ createAuthMiddleware
6
+ };
7
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}