@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,139 @@
1
+ import { R2StorageConfig, S3StorageConfig, StorageAdapter } from '@alneas/appkit-core/storage';
2
+
3
+ /**
4
+ * Server-held signing credentials; never expose these through browser configuration.
5
+ * @see createS3CompatibleStorage for host setup.
6
+ */
7
+ interface StorageCredentials {
8
+ /** Nonempty access key identifier for the selected provider. */
9
+ accessKeyId: string;
10
+ /** Nonempty secret used for request signing. */
11
+ secretAccessKey: string;
12
+ }
13
+ type Credentials = StorageCredentials | (() => StorageCredentials | Promise<StorageCredentials>);
14
+ type Common = {
15
+ /** Server-held credentials or a callback invoked once when constructing the adapter; callback errors reject creation. */
16
+ credentials: Credentials;
17
+ /** Signed URL lifetime ceiling in whole seconds, from 1 to 604800. @defaultValue 300 */
18
+ maxUrlLifetimeSeconds?: number;
19
+ };
20
+ /**
21
+ * Selects R2 or S3 transport settings with host-held credentials and a signed URL ceiling.
22
+ * @remarks R2 requires a 32-hex-character accountId; S3 requires region. Both require a valid bucket name. Optional endpoints must be HTTPS URLs without credentials, query, or fragment. Provider-specific fields follow app-core storage configuration; public URLs are not configured by this factory.
23
+ * @see createS3CompatibleStorage for a complete setup example.
24
+ */
25
+ type S3CompatibleStorageConfig = Common & (({
26
+ /**
27
+ * Select Cloudflare R2 transport; accountId must be 32 hexadecimal characters and bucket/credentials must be configured.
28
+ */
29
+ provider: 'r2';
30
+ } & Omit<R2StorageConfig, 'accessKeyId' | 'secretAccessKey' | 'publicUrl' | 'defaultExpiresIn'>) | ({
31
+ /**
32
+ * Select S3-compatible transport; a nonempty region and valid bucket/credentials are required, with optional HTTPS endpoint.
33
+ */
34
+ provider: 's3';
35
+ } & Omit<S3StorageConfig, 'accessKeyId' | 'secretAccessKey' | 'defaultExpiresIn'>));
36
+ /**
37
+ * Creates an unscoped private-upload, signed-URL storage adapter for R2 or S3.
38
+ * @param config - Provider configuration, credentials, and URL ceiling; see {@link S3CompatibleStorageConfig}.
39
+ * @returns A frozen app-core adapter whose uploads reject public=true and whose URLs always use signatures within the configured ceiling.
40
+ * @throws Rejects invalid provider, lifetime, bucket, account/region, endpoint, or empty credentials, and propagates credential callback/import/adapter construction errors. Subsequent operations propagate transport errors.
41
+ * @remarks Server-only: transport/signing stay in app-core and the host supplies secrets. Credentials are resolved once at construction. Signed access also works during a public-bucket migration but cannot close existing public URLs. Keep this unscoped adapter host-owned; give plugins createTenantS3CompatibleStorage. Constructing an adapter does not verify remote credentials or create a bucket.
42
+ * @example
43
+ * ```typescript
44
+ * import { createS3CompatibleStorage, readS3CompatibleStorageConfig } from "@alneas/eaos-server/storage/s3-compatible";
45
+ * // The host provisions a private bucket and supplies the documented storage environment.
46
+ * const config = readS3CompatibleStorageConfig();
47
+ * if (!config) throw new Error("Storage is not configured");
48
+ * const storage = await createS3CompatibleStorage(config);
49
+ * // Retain storage in trusted server code; authorize requests before performing operations.
50
+ * ```
51
+ */
52
+ declare function createS3CompatibleStorage(config: S3CompatibleStorageConfig): Promise<StorageAdapter>;
53
+ /**
54
+ * Creates provider-backed storage isolated to a verified tenant/plugin scope.
55
+ * @param config - Host provider configuration and credentials.
56
+ * @param options - Trusted scope and live authorization; an omitted scope URL ceiling inherits config.maxUrlLifetimeSeconds, then 300.
57
+ * @returns A frozen scoped adapter; see {@link createTenantStorage} for relative key and operation policy.
58
+ * @throws Rejects provider construction failures and invalid scope settings; operations propagate authorization, policy, and transport errors.
59
+ * @remarks The provider ceiling also applies, so a larger scope ceiling cannot increase it. The host owns bucket provisioning and verified identity resolution.
60
+ * @example
61
+ * ```typescript
62
+ * import { createTenantS3CompatibleStorage, type S3CompatibleStorageConfig } from "@alneas/eaos-server/storage/s3-compatible";
63
+ * import type { TenantStorageOptions } from "@alneas/eaos-server/storage";
64
+ * export async function scopedStorage(config: S3CompatibleStorageConfig, trustedOptions: TenantStorageOptions) {
65
+ * return createTenantS3CompatibleStorage(config, trustedOptions);
66
+ * }
67
+ * ```
68
+ */
69
+ declare function createTenantS3CompatibleStorage(config: S3CompatibleStorageConfig, options: TenantStorageOptions): Promise<StorageAdapter>;
70
+ /**
71
+ * Reads trimmed S3 or R2 configuration from a host environment map.
72
+ * @param env - Environment values; defaults to process.env. EAOS_STORAGE_PROVIDER selects s3/r2 case-insensitively. R2 uses R2_ACCOUNT_ID, R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, and optional R2_ENDPOINT. S3 uses S3_BUCKET, S3_REGION, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, optional S3_ENDPOINT, and S3_FORCE_PATH_STYLE (true or 1). EAOS_STORAGE_MAX_URL_SECONDS is converted with Number.
73
+ * @returns Configuration, or null when the provider is absent/blank. This read does not fully validate values; creation validates provider settings.
74
+ * @throws If a selected provider lacks required nonblank values, or the provider is unsupported.
75
+ * @remarks Returned configuration contains secrets and belongs exclusively in trusted server code.
76
+ * @example
77
+ * ```typescript
78
+ * import { readS3CompatibleStorageConfig } from "@alneas/eaos-server/storage/s3-compatible";
79
+ * const config = readS3CompatibleStorageConfig();
80
+ * console.log(config ? "Storage configured" : "Storage disabled");
81
+ * ```
82
+ */
83
+ declare function readS3CompatibleStorageConfig(env?: Record<string, string | undefined>): S3CompatibleStorageConfig | null;
84
+
85
+ /**
86
+ * Operation names passed to the host authorization callback before scoped storage access.
87
+ * @see createTenantStorage for a complete usage example.
88
+ */
89
+ type StorageOperation = 'upload' | 'download' | 'delete' | 'exists' | 'head' | 'list' | 'getUrl' | 'copy' | 'move';
90
+ /**
91
+ * Trusted tenant/plugin scope and per-operation authorization for {@link createTenantStorage}.
92
+ */
93
+ interface TenantStorageOptions {
94
+ /** Trusted tenant ID: 1–128 ASCII letters, digits, underscores, or hyphens, starting alphanumeric. It must come from verified server identity/configuration, never request body keys. */
95
+ tenantId: string;
96
+ /** Trusted plugin ID: 1–128 ASCII letters, digits, underscores, or hyphens, starting with a letter or digit. */
97
+ pluginId: string;
98
+ /** Invoked before each operation with trusted scope, operation, and frozen relative keys (list receives its prefix); only exactly true allows access. Errors propagate. */
99
+ authorize: (request: {
100
+ /**
101
+ * Trusted tenant scope captured at adapter construction, independent of caller object keys.
102
+ */
103
+ tenantId: string;
104
+ /**
105
+ * Trusted plugin scope captured at adapter construction.
106
+ */
107
+ pluginId: string;
108
+ /**
109
+ * Storage operation about to be delegated to the provider.
110
+ */
111
+ operation: StorageOperation;
112
+ /**
113
+ * Frozen relative-key array; copy/move supplies source then destination, and list supplies its requested prefix.
114
+ */
115
+ keys: readonly string[];
116
+ }) => boolean | Promise<boolean>;
117
+ /** Signed URLs remain usable until expiry; default ceiling 300 seconds. */
118
+ maxUrlLifetimeSeconds?: number;
119
+ }
120
+ /**
121
+ * Wraps a storage adapter with tenant/plugin key isolation and per-operation authorization.
122
+ * @param adapter - Host-owned transport/signing adapter; optional copy and move are exposed only when supported.
123
+ * @param options - Trusted scope, authorization callback, and signed URL ceiling; see {@link TenantStorageOptions}.
124
+ * @returns A frozen adapter using relative keys while storing under tenants/{tenantId}/plugins/{pluginId}/; returned object keys and list cursors are scope-relative.
125
+ * @throws Throws synchronously for invalid scope IDs or URL lifetime. Operations reject for invalid relative keys, denied access, public uploads, unsigned or overlong URLs, invalid cursors/delimiters, out-of-scope provider results, or propagated adapter/authorization errors.
126
+ * @remarks Keys cannot be absolute or contain traversal, empty segments, backslashes, percent escapes, control characters, query strings, or fragments. List permits an empty prefix and slash delimiter only. URLs default to a 300-second ceiling and remain usable until expiry after authorization changes. This wrapper supplies no persistence, locking, revocation, or transaction mechanism beyond the underlying adapter. The host must retain ownership of the unscoped adapter.
127
+ * @example
128
+ * ```typescript
129
+ * import { createTenantStorage, type StorageAdapter, type TenantStorageOptions } from "@alneas/eaos-server/storage";
130
+ * export function pluginStorage(adapter: StorageAdapter, trustedOptions: TenantStorageOptions) {
131
+ * // Resolve scope and authorization from verified host identity, never request body IDs.
132
+ * return createTenantStorage(adapter, trustedOptions);
133
+ * }
134
+ * ```
135
+ */
136
+ declare function createTenantStorage(adapter: StorageAdapter, options: TenantStorageOptions): StorageAdapter;
137
+
138
+ export { createTenantStorage as c, createS3CompatibleStorage, createTenantS3CompatibleStorage, readS3CompatibleStorageConfig };
139
+ export type { StorageOperation as S, S3CompatibleStorageConfig, StorageCredentials, TenantStorageOptions as T };
@@ -0,0 +1,11 @@
1
+ import {
2
+ createS3CompatibleStorage,
3
+ createTenantS3CompatibleStorage,
4
+ readS3CompatibleStorageConfig
5
+ } from "../chunk-NNCCN7JP.js";
6
+ export {
7
+ createS3CompatibleStorage,
8
+ createTenantS3CompatibleStorage,
9
+ readS3CompatibleStorageConfig
10
+ };
11
+ //# sourceMappingURL=s3-compatible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Routing hints used by {@link TenantResolver}; they do not authenticate a tenant.
3
+ * @see TenantResolver for a complete usage example.
4
+ */
5
+ interface TenantResolverOptions {
6
+ /** Fallback when no explicit ID or host mapping matches. @defaultValue "default" */
7
+ defaultTenantId?: string;
8
+ /** Routing-only email domain mappings. Never use email-derived results as an authenticated tenant claim. */
9
+ domainTenantMap?: Record<string, string>;
10
+ /** Trusted, exact hostname mappings (e.g. { "demo.example.com": "tenant-demo" }). */
11
+ hostTenantMap?: Record<string, string>;
12
+ }
13
+ /**
14
+ * Selects a tenant routing ID from an explicit trusted ID, configured host, or fallback.
15
+ * @remarks This resolver performs no authentication or membership check. Host headers and explicit IDs must be validated by the host before being used for authorization. Email mappings are exposed only by resolveFromEmail.
16
+ * @example
17
+ * ```typescript
18
+ * import { TenantResolver } from "@alneas/eaos-server/tenant";
19
+ * const resolver = new TenantResolver({ hostTenantMap: { "workspace.example.com": "workspace" } });
20
+ * const tenantId = resolver.resolve({ host: "workspace.example.com:443" });
21
+ * console.log(tenantId); // "workspace"
22
+ * ```
23
+ */
24
+ declare class TenantResolver {
25
+ private defaultTenantId;
26
+ private domainTenantMap;
27
+ private hostTenantMap;
28
+ /**
29
+ * Copies routing mappings, normalizing their keys to lower case.
30
+ * @param options - Routing mappings and fallback; omitted options use empty mappings and "default".
31
+ */
32
+ constructor(options?: TenantResolverOptions);
33
+ /**
34
+ * Looks up the lower-case domain following the first @ in an email routing hint.
35
+ * @param email - Email hint; missing, empty, or missing @ returns null. No address validation is performed.
36
+ * @returns The configured routing ID, or null when no domain matches.
37
+ * @example
38
+ * ```typescript
39
+ * import { TenantResolver } from "@alneas/eaos-server/tenant";
40
+ * const resolver = new TenantResolver({ domainTenantMap: { "example.com": "workspace" } });
41
+ * console.log(resolver.resolveFromEmail("person@example.com"));
42
+ * ```
43
+ */
44
+ resolveFromEmail(email: string | null | undefined): string | null;
45
+ /**
46
+ * Looks up a configured hostname after removing text following the first colon and lower-casing.
47
+ * @param host - Host routing hint, optionally including a port; missing or empty values return null. IPv6 host parsing is not provided.
48
+ * @returns The exact configured host mapping, or null.
49
+ * @example
50
+ * ```typescript
51
+ * import { TenantResolver } from "@alneas/eaos-server/tenant";
52
+ * const resolver = new TenantResolver({ hostTenantMap: { "workspace.example.com": "workspace" } });
53
+ * console.log(resolver.resolveFromHost("workspace.example.com:443"));
54
+ * ```
55
+ */
56
+ resolveFromHost(host: string | null | undefined): string | null;
57
+ /**
58
+ * Selects a truthy explicit ID, then a host mapping, then the configured fallback.
59
+ * @param input - Routing hints: explicitTenantId takes precedence over host; email is intentionally ignored. The host must establish whether an explicit ID is trusted.
60
+ * @returns The selected routing ID, without validating tenant existence or membership.
61
+ * @see TenantResolver for a complete usage example.
62
+ * @example
63
+ * ```typescript
64
+ * import { TenantResolver } from "@alneas/eaos-server/tenant";
65
+ * const resolver = new TenantResolver();
66
+ * console.log(resolver.resolve({ explicitTenantId: "workspace" }));
67
+ * ```
68
+ */
69
+ resolve(input: {
70
+ /**
71
+ * Optional host routing hint, including a possible port; checked only after a falsy/absent explicitTenantId against configured exact host mappings.
72
+ */
73
+ host?: string | null;
74
+ /**
75
+ * Optional compatibility routing hint intentionally ignored by resolve; an email domain is not an authenticated tenant claim.
76
+ */
77
+ email?: string | null;
78
+ /**
79
+ * Optional trusted tenant routing selection; any truthy value takes precedence without tenant-existence or membership validation.
80
+ */
81
+ explicitTenantId?: string | null;
82
+ }): string;
83
+ /**
84
+ * Reads the fallback ID captured at construction.
85
+ * @returns The configured fallback, or "default" when none was supplied.
86
+ * @example
87
+ * ```typescript
88
+ * import { TenantResolver } from "@alneas/eaos-server/tenant";
89
+ * console.log(new TenantResolver().getDefaultTenantId());
90
+ * ```
91
+ */
92
+ getDefaultTenantId(): string;
93
+ }
94
+ /**
95
+ * Creates a resolver for host-owned tenant routing hints.
96
+ * @param options - Routing mappings and fallback; see {@link TenantResolverOptions}.
97
+ * @returns A new independent resolver with copied mappings.
98
+ * @example
99
+ * ```typescript
100
+ * import { createTenantResolver } from "@alneas/eaos-server/tenant";
101
+ * const resolver = createTenantResolver({ defaultTenantId: "workspace" });
102
+ * console.log(resolver.resolve({}));
103
+ * ```
104
+ */
105
+ declare function createTenantResolver(options?: TenantResolverOptions): TenantResolver;
106
+
107
+ export { TenantResolver, createTenantResolver };
108
+ export type { TenantResolverOptions };
package/dist/tenant.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ TenantResolver,
3
+ createTenantResolver
4
+ } from "./chunk-BKAHUEIT.js";
5
+ export {
6
+ TenantResolver,
7
+ createTenantResolver
8
+ };
9
+ //# sourceMappingURL=tenant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,119 @@
1
+ /** Identity is supplied exclusively by the host's verified authentication middleware.
2
+ * @see createWorkspaceContextResolver for host setup and usage.
3
+ */
4
+ interface WorkspaceIdentity {
5
+ /** User ID established by verified host authentication. */
6
+ userId: string;
7
+ /** Verified optional email; resolved contexts normalize absence to null. */
8
+ email?: string | null;
9
+ /** Trusted platform authority; tenant roles cannot grant this privilege. Defaults to false. */
10
+ isSuperAdmin?: boolean;
11
+ }
12
+ /**
13
+ * Host reads used by {@link createWorkspaceContextResolver}; filter inactive rows and apply schema policy in the adapter.
14
+ */
15
+ interface WorkspaceContextStore {
16
+ /**
17
+ * Loads the selected active tenant.
18
+ * @param tenantId - Selected tenant ID from trusted routing.
19
+ * @returns Active tenant display data, or undefined if unavailable.
20
+ * @throws Persistence failures are wrapped as WorkspaceContextError with status 503.
21
+
22
+ * @example
23
+ * ```typescript
24
+ * import type { WorkspaceContextStore } from "@alneas/eaos-server";
25
+ * export async function readSelectedTenant(store: WorkspaceContextStore, trustedTenantId: string) {
26
+ * // Host storage filters inactive tenants and enforces its schema/access policy.
27
+ * const tenant = await store.readTenant(trustedTenantId);
28
+ * return tenant?.tenantName;
29
+ * }
30
+ * ```
31
+ */
32
+ readTenant(tenantId: string): Promise<{
33
+ /** Display name of the selected active tenant; the context resolver falls back to tenantId when this value is empty. */
34
+ tenantName: string;
35
+ /** Optional tenant industry classification; the context resolver substitutes generic when absent or empty. */
36
+ industryType?: string;
37
+ } | undefined>;
38
+ /**
39
+ * Loads the active membership for this tenant/user pair.
40
+ * @param tenantId - Selected active tenant ID.
41
+ * @param userId - Authenticated user ID.
42
+ * @returns Membership role, or undefined if absent; tenant roles never establish platform authority.
43
+ * @throws Persistence failures are wrapped as WorkspaceContextError with status 503.
44
+
45
+ * @example
46
+ * ```typescript
47
+ * import type { WorkspaceContextStore } from "@alneas/eaos-server";
48
+ * export async function readVerifiedMembership(
49
+ * store: WorkspaceContextStore, trustedTenantId: string, authenticatedUserId: string,
50
+ * ) {
51
+ * const membership = await store.readMembership(trustedTenantId, authenticatedUserId);
52
+ * return membership?.role; // Absence must not grant tenant access.
53
+ * }
54
+ * ```
55
+ */
56
+ readMembership(tenantId: string, userId: string): Promise<{
57
+ /** Role from the active tenant/user membership; the resolver trims it and normalizes blank or super_admin/superadmin values to member rather than granting platform authority. */
58
+ role: string;
59
+ } | undefined>;
60
+ }
61
+ /**
62
+ * Resolved user identity and authorized tenant context returned by {@link createWorkspaceContextResolver}.
63
+ */
64
+ interface WorkspaceContext {
65
+ /** Authenticated user ID. */
66
+ userId: string;
67
+ /** Authorized selected tenant ID. */
68
+ tenantId: string;
69
+ /** Verified email, or null when absent. */
70
+ email: string | null;
71
+ /** Tenant display name, falling back to tenantId for an empty stored name. */
72
+ tenantName: string;
73
+ /** Tenant industry, falling back to "generic" for an empty stored value. */
74
+ industryType: string;
75
+ /** Trimmed membership role, member for unsafe/blank roles, or admin for a platform administrator without membership. */
76
+ role: string;
77
+ /** Platform administrators receive SUPER_ADMIN, super_admin, admin; other users receive USER and their normalized role. */
78
+ roles: string[];
79
+ /** True only when the verified identity explicitly has platform authority. */
80
+ isSuperAdmin: boolean;
81
+ }
82
+ /**
83
+ * Reports an authentication, membership, or host-store failure using an HTTP-compatible status.
84
+ * @see createWorkspaceContextResolver for the resolver that rejects with this error.
85
+ * @example
86
+ * ```typescript
87
+ * import { WorkspaceContextError } from "@alneas/eaos-server/workspace-context";
88
+ * const error = new WorkspaceContextError(403, "Tenant membership required");
89
+ * console.log(error.status); // 403
90
+ * ```
91
+ */
92
+ declare class WorkspaceContextError extends Error {
93
+ readonly status: 401 | 403 | 503;
94
+ /**
95
+ * Creates an error with a stable status and caller-supplied message.
96
+ * @param status - 401 for missing identity, 403 for denied tenant access, or 503 for unavailable context data. This public readonly property is available for HTTP error mapping.
97
+ * @param message - Human-readable failure description.
98
+ */
99
+ constructor(status: 401 | 403 | 503, message: string);
100
+ }
101
+ /**
102
+ * Builds a resolver that requires an existing tenant and membership or verified platform authority.
103
+ * @param store - Host-owned active tenant and membership reads; see {@link WorkspaceContextStore}.
104
+ * @returns An async resolver accepting verified identity and a selected tenant ID, resolving a fresh context. Missing email becomes null, tenantName falls back to tenant ID, and industryType falls back to "generic".
105
+ * @throws The returned resolver rejects with WorkspaceContextError: 401 for empty userId, 403 for missing/unavailable tenant or denied membership, and 503 for other store failures.
106
+ * @remarks The host supplies verified identity, schema, active-row filtering, and credentials. Reads are sequential and not wrapped in a transaction here. Platform administrators may select existing tenants without membership; membership role strings cannot grant platform authority. Blank or super_admin/superadmin membership roles normalize to member. This function writes no persistent data.
107
+ * @example
108
+ * ```typescript
109
+ * import { createWorkspaceContextResolver, type WorkspaceContextStore, type WorkspaceIdentity } from "@alneas/eaos-server/workspace-context";
110
+ * export async function selectedWorkspace(store: WorkspaceContextStore, identity: WorkspaceIdentity, tenantId: string) {
111
+ * // The host implements active-row reads and authenticates identity before this call.
112
+ * return createWorkspaceContextResolver(store)(identity, tenantId);
113
+ * }
114
+ * ```
115
+ */
116
+ declare function createWorkspaceContextResolver(store: WorkspaceContextStore): (identity: WorkspaceIdentity, tenantId: string | undefined) => Promise<WorkspaceContext>;
117
+
118
+ export { WorkspaceContextError, createWorkspaceContextResolver };
119
+ export type { WorkspaceContext, WorkspaceContextStore, WorkspaceIdentity };
@@ -0,0 +1,9 @@
1
+ import {
2
+ WorkspaceContextError,
3
+ createWorkspaceContextResolver
4
+ } from "./chunk-WFEAKJLR.js";
5
+ export {
6
+ WorkspaceContextError,
7
+ createWorkspaceContextResolver
8
+ };
9
+ //# sourceMappingURL=workspace-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}