@aeolus-fleet/core 0.0.0 → 0.19.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 (610) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +98 -1
  3. package/dist/adapters/cli/fleet-init.d.ts +14 -0
  4. package/dist/adapters/cli/fleet-init.js +68 -0
  5. package/dist/adapters/cli/fleet-init.js.map +1 -0
  6. package/dist/adapters/cli/io.d.ts +35 -0
  7. package/dist/adapters/cli/io.js +21 -0
  8. package/dist/adapters/cli/io.js.map +1 -0
  9. package/dist/adapters/cli/migrate.d.ts +11 -0
  10. package/dist/adapters/cli/migrate.js +12 -0
  11. package/dist/adapters/cli/migrate.js.map +1 -0
  12. package/dist/adapters/cli/operator-reset-password.d.ts +12 -0
  13. package/dist/adapters/cli/operator-reset-password.js +49 -0
  14. package/dist/adapters/cli/operator-reset-password.js.map +1 -0
  15. package/dist/adapters/cli/run.d.ts +14 -0
  16. package/dist/adapters/cli/run.js +40 -0
  17. package/dist/adapters/cli/run.js.map +1 -0
  18. package/dist/adapters/cli/terminal.d.ts +20 -0
  19. package/dist/adapters/cli/terminal.js +68 -0
  20. package/dist/adapters/cli/terminal.js.map +1 -0
  21. package/dist/adapters/crypto/passwords.d.ts +2 -0
  22. package/dist/adapters/crypto/passwords.js +59 -0
  23. package/dist/adapters/crypto/passwords.js.map +1 -0
  24. package/dist/adapters/crypto/secrets.d.ts +5 -0
  25. package/dist/adapters/crypto/secrets.js +10 -0
  26. package/dist/adapters/crypto/secrets.js.map +1 -0
  27. package/dist/adapters/http/device-label.d.ts +9 -0
  28. package/dist/adapters/http/device-label.js +39 -0
  29. package/dist/adapters/http/device-label.js.map +1 -0
  30. package/dist/adapters/http/rate-limiter.d.ts +21 -0
  31. package/dist/adapters/http/rate-limiter.js +44 -0
  32. package/dist/adapters/http/rate-limiter.js.map +1 -0
  33. package/dist/adapters/http/request-credentials.d.ts +23 -0
  34. package/dist/adapters/http/request-credentials.js +45 -0
  35. package/dist/adapters/http/request-credentials.js.map +1 -0
  36. package/dist/adapters/http/server.d.ts +47 -0
  37. package/dist/adapters/http/server.js +216 -0
  38. package/dist/adapters/http/server.js.map +1 -0
  39. package/dist/adapters/http/version.d.ts +9 -0
  40. package/dist/adapters/http/version.js +23 -0
  41. package/dist/adapters/http/version.js.map +1 -0
  42. package/dist/adapters/mcp/mcp-endpoint.d.ts +8 -0
  43. package/dist/adapters/mcp/mcp-endpoint.js +127 -0
  44. package/dist/adapters/mcp/mcp-endpoint.js.map +1 -0
  45. package/dist/adapters/prisma/client.d.ts +10 -0
  46. package/dist/adapters/prisma/client.js +20 -0
  47. package/dist/adapters/prisma/client.js.map +1 -0
  48. package/dist/adapters/prisma/delivery-notices.d.ts +34 -0
  49. package/dist/adapters/prisma/delivery-notices.js +113 -0
  50. package/dist/adapters/prisma/delivery-notices.js.map +1 -0
  51. package/dist/adapters/prisma/event-log.d.ts +11 -0
  52. package/dist/adapters/prisma/event-log.js +61 -0
  53. package/dist/adapters/prisma/event-log.js.map +1 -0
  54. package/dist/adapters/prisma/failure-log.d.ts +22 -0
  55. package/dist/adapters/prisma/failure-log.js +70 -0
  56. package/dist/adapters/prisma/failure-log.js.map +1 -0
  57. package/dist/adapters/prisma/fleet-counter.d.ts +3 -0
  58. package/dist/adapters/prisma/fleet-counter.js +6 -0
  59. package/dist/adapters/prisma/fleet-counter.js.map +1 -0
  60. package/dist/adapters/prisma/fleet-event-wakeups.d.ts +33 -0
  61. package/dist/adapters/prisma/fleet-event-wakeups.js +86 -0
  62. package/dist/adapters/prisma/fleet-event-wakeups.js.map +1 -0
  63. package/dist/adapters/prisma/generated/browser.d.ts +127 -0
  64. package/dist/adapters/prisma/generated/browser.js +18 -0
  65. package/dist/adapters/prisma/generated/browser.js.map +1 -0
  66. package/dist/adapters/prisma/generated/client.d.ts +146 -0
  67. package/dist/adapters/prisma/generated/client.js +38 -0
  68. package/dist/adapters/prisma/generated/client.js.map +1 -0
  69. package/dist/adapters/prisma/generated/commonInputTypes.d.ts +879 -0
  70. package/dist/adapters/prisma/generated/commonInputTypes.js +11 -0
  71. package/dist/adapters/prisma/generated/commonInputTypes.js.map +1 -0
  72. package/dist/adapters/prisma/generated/enums.d.ts +75 -0
  73. package/dist/adapters/prisma/generated/enums.js +73 -0
  74. package/dist/adapters/prisma/generated/enums.js.map +1 -0
  75. package/dist/adapters/prisma/generated/internal/class.d.ts +308 -0
  76. package/dist/adapters/prisma/generated/internal/class.js +52 -0
  77. package/dist/adapters/prisma/generated/internal/class.js.map +1 -0
  78. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +2131 -0
  79. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +295 -0
  80. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -0
  81. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +273 -0
  82. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +265 -0
  83. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -0
  84. package/dist/adapters/prisma/generated/models/ConsoleSession.d.ts +2137 -0
  85. package/dist/adapters/prisma/generated/models/ConsoleSession.js +2 -0
  86. package/dist/adapters/prisma/generated/models/ConsoleSession.js.map +1 -0
  87. package/dist/adapters/prisma/generated/models/Credential.d.ts +1360 -0
  88. package/dist/adapters/prisma/generated/models/Credential.js +2 -0
  89. package/dist/adapters/prisma/generated/models/Credential.js.map +1 -0
  90. package/dist/adapters/prisma/generated/models/CrewRequest.d.ts +1558 -0
  91. package/dist/adapters/prisma/generated/models/CrewRequest.js +2 -0
  92. package/dist/adapters/prisma/generated/models/CrewRequest.js.map +1 -0
  93. package/dist/adapters/prisma/generated/models/Delivery.d.ts +2211 -0
  94. package/dist/adapters/prisma/generated/models/Delivery.js +2 -0
  95. package/dist/adapters/prisma/generated/models/Delivery.js.map +1 -0
  96. package/dist/adapters/prisma/generated/models/Event.d.ts +1991 -0
  97. package/dist/adapters/prisma/generated/models/Event.js +2 -0
  98. package/dist/adapters/prisma/generated/models/Event.js.map +1 -0
  99. package/dist/adapters/prisma/generated/models/Fleet.d.ts +3032 -0
  100. package/dist/adapters/prisma/generated/models/Fleet.js +2 -0
  101. package/dist/adapters/prisma/generated/models/Fleet.js.map +1 -0
  102. package/dist/adapters/prisma/generated/models/Guide.d.ts +943 -0
  103. package/dist/adapters/prisma/generated/models/Guide.js +2 -0
  104. package/dist/adapters/prisma/generated/models/Guide.js.map +1 -0
  105. package/dist/adapters/prisma/generated/models/GuideProgress.d.ts +1323 -0
  106. package/dist/adapters/prisma/generated/models/GuideProgress.js +2 -0
  107. package/dist/adapters/prisma/generated/models/GuideProgress.js.map +1 -0
  108. package/dist/adapters/prisma/generated/models/InstallationRequest.d.ts +1036 -0
  109. package/dist/adapters/prisma/generated/models/InstallationRequest.js +2 -0
  110. package/dist/adapters/prisma/generated/models/InstallationRequest.js.map +1 -0
  111. package/dist/adapters/prisma/generated/models/InstallationSettings.d.ts +1027 -0
  112. package/dist/adapters/prisma/generated/models/InstallationSettings.js +2 -0
  113. package/dist/adapters/prisma/generated/models/InstallationSettings.js.map +1 -0
  114. package/dist/adapters/prisma/generated/models/Lease.d.ts +2076 -0
  115. package/dist/adapters/prisma/generated/models/Lease.js +2 -0
  116. package/dist/adapters/prisma/generated/models/Lease.js.map +1 -0
  117. package/dist/adapters/prisma/generated/models/Message.d.ts +2869 -0
  118. package/dist/adapters/prisma/generated/models/Message.js +2 -0
  119. package/dist/adapters/prisma/generated/models/Message.js.map +1 -0
  120. package/dist/adapters/prisma/generated/models/Notice.d.ts +1068 -0
  121. package/dist/adapters/prisma/generated/models/Notice.js +2 -0
  122. package/dist/adapters/prisma/generated/models/Notice.js.map +1 -0
  123. package/dist/adapters/prisma/generated/models/NoticeDismissal.d.ts +1245 -0
  124. package/dist/adapters/prisma/generated/models/NoticeDismissal.js +2 -0
  125. package/dist/adapters/prisma/generated/models/NoticeDismissal.js.map +1 -0
  126. package/dist/adapters/prisma/generated/models/Operator.d.ts +1173 -0
  127. package/dist/adapters/prisma/generated/models/Operator.js +2 -0
  128. package/dist/adapters/prisma/generated/models/Operator.js.map +1 -0
  129. package/dist/adapters/prisma/generated/models/Ship.d.ts +3320 -0
  130. package/dist/adapters/prisma/generated/models/Ship.js +2 -0
  131. package/dist/adapters/prisma/generated/models/Ship.js.map +1 -0
  132. package/dist/adapters/prisma/generated/models/SignInTicket.d.ts +1222 -0
  133. package/dist/adapters/prisma/generated/models/SignInTicket.js +2 -0
  134. package/dist/adapters/prisma/generated/models/SignInTicket.js.map +1 -0
  135. package/dist/adapters/prisma/generated/models.d.ts +18 -0
  136. package/dist/adapters/prisma/generated/models.js +2 -0
  137. package/dist/adapters/prisma/generated/models.js.map +1 -0
  138. package/dist/adapters/prisma/history.d.ts +3 -0
  139. package/dist/adapters/prisma/history.js +289 -0
  140. package/dist/adapters/prisma/history.js.map +1 -0
  141. package/dist/adapters/prisma/identity.d.ts +10 -0
  142. package/dist/adapters/prisma/identity.js +213 -0
  143. package/dist/adapters/prisma/identity.js.map +1 -0
  144. package/dist/adapters/prisma/installation.d.ts +13 -0
  145. package/dist/adapters/prisma/installation.js +155 -0
  146. package/dist/adapters/prisma/installation.js.map +1 -0
  147. package/dist/adapters/prisma/messaging.d.ts +4 -0
  148. package/dist/adapters/prisma/messaging.js +156 -0
  149. package/dist/adapters/prisma/messaging.js.map +1 -0
  150. package/dist/adapters/prisma/migrate.d.ts +5 -0
  151. package/dist/adapters/prisma/migrate.js +40 -0
  152. package/dist/adapters/prisma/migrate.js.map +1 -0
  153. package/dist/adapters/prisma/receiver-wakeups.d.ts +26 -0
  154. package/dist/adapters/prisma/receiver-wakeups.js +79 -0
  155. package/dist/adapters/prisma/receiver-wakeups.js.map +1 -0
  156. package/dist/adapters/prisma/registry.d.ts +8 -0
  157. package/dist/adapters/prisma/registry.js +427 -0
  158. package/dist/adapters/prisma/registry.js.map +1 -0
  159. package/dist/adapters/prisma/rows.d.ts +58 -0
  160. package/dist/adapters/prisma/rows.js +408 -0
  161. package/dist/adapters/prisma/rows.js.map +1 -0
  162. package/dist/adapters/prisma/unit-of-work.d.ts +36 -0
  163. package/dist/adapters/prisma/unit-of-work.js +66 -0
  164. package/dist/adapters/prisma/unit-of-work.js.map +1 -0
  165. package/dist/adapters/rest/openapi.d.ts +12 -0
  166. package/dist/adapters/rest/openapi.js +62 -0
  167. package/dist/adapters/rest/openapi.js.map +1 -0
  168. package/dist/adapters/rest/rest-api.d.ts +8 -0
  169. package/dist/adapters/rest/rest-api.js +61 -0
  170. package/dist/adapters/rest/rest-api.js.map +1 -0
  171. package/dist/adapters/trpc/console.d.ts +150 -0
  172. package/dist/adapters/trpc/console.js +102 -0
  173. package/dist/adapters/trpc/console.js.map +1 -0
  174. package/dist/adapters/trpc/context.d.ts +201 -0
  175. package/dist/adapters/trpc/context.js +2 -0
  176. package/dist/adapters/trpc/context.js.map +1 -0
  177. package/dist/adapters/trpc/fleet.d.ts +637 -0
  178. package/dist/adapters/trpc/fleet.js +437 -0
  179. package/dist/adapters/trpc/fleet.js.map +1 -0
  180. package/dist/adapters/trpc/installation.d.ts +414 -0
  181. package/dist/adapters/trpc/installation.js +138 -0
  182. package/dist/adapters/trpc/installation.js.map +1 -0
  183. package/dist/adapters/trpc/router.d.ts +1263 -0
  184. package/dist/adapters/trpc/router.js +15 -0
  185. package/dist/adapters/trpc/router.js.map +1 -0
  186. package/dist/adapters/trpc/ship-contract.d.ts +107 -0
  187. package/dist/adapters/trpc/ship-contract.js +165 -0
  188. package/dist/adapters/trpc/ship-contract.js.map +1 -0
  189. package/dist/adapters/trpc/ship-protocol.d.ts +9 -0
  190. package/dist/adapters/trpc/ship-protocol.js +25 -0
  191. package/dist/adapters/trpc/ship-protocol.js.map +1 -0
  192. package/dist/adapters/trpc/ship.d.ts +209 -0
  193. package/dist/adapters/trpc/ship.js +214 -0
  194. package/dist/adapters/trpc/ship.js.map +1 -0
  195. package/dist/adapters/trpc/starting-prompt-text.d.ts +7 -0
  196. package/dist/adapters/trpc/starting-prompt-text.js +60 -0
  197. package/dist/adapters/trpc/starting-prompt-text.js.map +1 -0
  198. package/dist/adapters/trpc/system.d.ts +29 -0
  199. package/dist/adapters/trpc/system.js +15 -0
  200. package/dist/adapters/trpc/system.js.map +1 -0
  201. package/dist/adapters/trpc/trpc.d.ts +131 -0
  202. package/dist/adapters/trpc/trpc.js +350 -0
  203. package/dist/adapters/trpc/trpc.js.map +1 -0
  204. package/dist/app.d.ts +31 -0
  205. package/dist/app.js +80 -0
  206. package/dist/app.js.map +1 -0
  207. package/dist/bin/aeolus-core.d.ts +2 -0
  208. package/dist/bin/aeolus-core.js +45 -0
  209. package/dist/bin/aeolus-core.js.map +1 -0
  210. package/dist/config.d.ts +35 -0
  211. package/dist/config.js +74 -0
  212. package/dist/config.js.map +1 -0
  213. package/dist/domain/identity/authenticate.d.ts +46 -0
  214. package/dist/domain/identity/authenticate.js +18 -0
  215. package/dist/domain/identity/authenticate.js.map +1 -0
  216. package/dist/domain/identity/console-session.d.ts +54 -0
  217. package/dist/domain/identity/console-session.js +29 -0
  218. package/dist/domain/identity/console-session.js.map +1 -0
  219. package/dist/domain/identity/credential.d.ts +76 -0
  220. package/dist/domain/identity/credential.js +63 -0
  221. package/dist/domain/identity/credential.js.map +1 -0
  222. package/dist/domain/identity/dismiss-notice.d.ts +19 -0
  223. package/dist/domain/identity/dismiss-notice.js +23 -0
  224. package/dist/domain/identity/dismiss-notice.js.map +1 -0
  225. package/dist/domain/identity/get-guide.d.ts +7 -0
  226. package/dist/domain/identity/get-guide.js +5 -0
  227. package/dist/domain/identity/get-guide.js.map +1 -0
  228. package/dist/domain/identity/get-notices.d.ts +7 -0
  229. package/dist/domain/identity/get-notices.js +5 -0
  230. package/dist/domain/identity/get-notices.js.map +1 -0
  231. package/dist/domain/identity/guide.d.ts +24 -0
  232. package/dist/domain/identity/guide.js +3 -0
  233. package/dist/domain/identity/guide.js.map +1 -0
  234. package/dist/domain/identity/issue-sign-in-ticket.d.ts +38 -0
  235. package/dist/domain/identity/issue-sign-in-ticket.js +39 -0
  236. package/dist/domain/identity/issue-sign-in-ticket.js.map +1 -0
  237. package/dist/domain/identity/notice.d.ts +16 -0
  238. package/dist/domain/identity/notice.js +12 -0
  239. package/dist/domain/identity/notice.js.map +1 -0
  240. package/dist/domain/identity/operator-account.d.ts +28 -0
  241. package/dist/domain/identity/operator-account.js +21 -0
  242. package/dist/domain/identity/operator-account.js.map +1 -0
  243. package/dist/domain/identity/ports.d.ts +193 -0
  244. package/dist/domain/identity/ports.js +2 -0
  245. package/dist/domain/identity/ports.js.map +1 -0
  246. package/dist/domain/identity/public.d.ts +3 -0
  247. package/dist/domain/identity/public.js +5 -0
  248. package/dist/domain/identity/public.js.map +1 -0
  249. package/dist/domain/identity/read-account.d.ts +35 -0
  250. package/dist/domain/identity/read-account.js +27 -0
  251. package/dist/domain/identity/read-account.js.map +1 -0
  252. package/dist/domain/identity/read-guide.d.ts +18 -0
  253. package/dist/domain/identity/read-guide.js +21 -0
  254. package/dist/domain/identity/read-guide.js.map +1 -0
  255. package/dist/domain/identity/read-notices.d.ts +13 -0
  256. package/dist/domain/identity/read-notices.js +17 -0
  257. package/dist/domain/identity/read-notices.js.map +1 -0
  258. package/dist/domain/identity/record-guide-progress.d.ts +19 -0
  259. package/dist/domain/identity/record-guide-progress.js +24 -0
  260. package/dist/domain/identity/record-guide-progress.js.map +1 -0
  261. package/dist/domain/identity/redeem-sign-in-ticket.d.ts +34 -0
  262. package/dist/domain/identity/redeem-sign-in-ticket.js +25 -0
  263. package/dist/domain/identity/redeem-sign-in-ticket.js.map +1 -0
  264. package/dist/domain/identity/reset-operator-password.d.ts +34 -0
  265. package/dist/domain/identity/reset-operator-password.js +55 -0
  266. package/dist/domain/identity/reset-operator-password.js.map +1 -0
  267. package/dist/domain/identity/set-guide.d.ts +13 -0
  268. package/dist/domain/identity/set-guide.js +12 -0
  269. package/dist/domain/identity/set-guide.js.map +1 -0
  270. package/dist/domain/identity/set-notices.d.ts +13 -0
  271. package/dist/domain/identity/set-notices.js +12 -0
  272. package/dist/domain/identity/set-notices.js.map +1 -0
  273. package/dist/domain/identity/set-theme.d.ts +21 -0
  274. package/dist/domain/identity/set-theme.js +19 -0
  275. package/dist/domain/identity/set-theme.js.map +1 -0
  276. package/dist/domain/identity/sign-in-ticket.d.ts +21 -0
  277. package/dist/domain/identity/sign-in-ticket.js +5 -0
  278. package/dist/domain/identity/sign-in-ticket.js.map +1 -0
  279. package/dist/domain/identity/sign-in.d.ts +51 -0
  280. package/dist/domain/identity/sign-in.js +43 -0
  281. package/dist/domain/identity/sign-in.js.map +1 -0
  282. package/dist/domain/identity/sign-out.d.ts +20 -0
  283. package/dist/domain/identity/sign-out.js +32 -0
  284. package/dist/domain/identity/sign-out.js.map +1 -0
  285. package/dist/domain/identity/start-console-session.d.ts +27 -0
  286. package/dist/domain/identity/start-console-session.js +54 -0
  287. package/dist/domain/identity/start-console-session.js.map +1 -0
  288. package/dist/domain/identity/start-viewer-session.d.ts +29 -0
  289. package/dist/domain/identity/start-viewer-session.js +42 -0
  290. package/dist/domain/identity/start-viewer-session.js.map +1 -0
  291. package/dist/domain/messaging/acknowledge-delivery.d.ts +30 -0
  292. package/dist/domain/messaging/acknowledge-delivery.js +31 -0
  293. package/dist/domain/messaging/acknowledge-delivery.js.map +1 -0
  294. package/dist/domain/messaging/answer-ping.d.ts +33 -0
  295. package/dist/domain/messaging/answer-ping.js +37 -0
  296. package/dist/domain/messaging/answer-ping.js.map +1 -0
  297. package/dist/domain/messaging/check-inbox.d.ts +33 -0
  298. package/dist/domain/messaging/check-inbox.js +61 -0
  299. package/dist/domain/messaging/check-inbox.js.map +1 -0
  300. package/dist/domain/messaging/content-type.d.ts +9 -0
  301. package/dist/domain/messaging/content-type.js +18 -0
  302. package/dist/domain/messaging/content-type.js.map +1 -0
  303. package/dist/domain/messaging/daily-message-limit.d.ts +19 -0
  304. package/dist/domain/messaging/daily-message-limit.js +24 -0
  305. package/dist/domain/messaging/daily-message-limit.js.map +1 -0
  306. package/dist/domain/messaging/delivery.d.ts +116 -0
  307. package/dist/domain/messaging/delivery.js +201 -0
  308. package/dist/domain/messaging/delivery.js.map +1 -0
  309. package/dist/domain/messaging/dismiss-delivery.d.ts +28 -0
  310. package/dist/domain/messaging/dismiss-delivery.js +29 -0
  311. package/dist/domain/messaging/dismiss-delivery.js.map +1 -0
  312. package/dist/domain/messaging/inbox-wait.d.ts +8 -0
  313. package/dist/domain/messaging/inbox-wait.js +19 -0
  314. package/dist/domain/messaging/inbox-wait.js.map +1 -0
  315. package/dist/domain/messaging/mark-done.d.ts +45 -0
  316. package/dist/domain/messaging/mark-done.js +49 -0
  317. package/dist/domain/messaging/mark-done.js.map +1 -0
  318. package/dist/domain/messaging/mark-read.d.ts +27 -0
  319. package/dist/domain/messaging/mark-read.js +34 -0
  320. package/dist/domain/messaging/mark-read.js.map +1 -0
  321. package/dist/domain/messaging/message.d.ts +104 -0
  322. package/dist/domain/messaging/message.js +84 -0
  323. package/dist/domain/messaging/message.js.map +1 -0
  324. package/dist/domain/messaging/payload.d.ts +9 -0
  325. package/dist/domain/messaging/payload.js +16 -0
  326. package/dist/domain/messaging/payload.js.map +1 -0
  327. package/dist/domain/messaging/ping-ship.d.ts +38 -0
  328. package/dist/domain/messaging/ping-ship.js +42 -0
  329. package/dist/domain/messaging/ping-ship.js.map +1 -0
  330. package/dist/domain/messaging/ports.d.ts +116 -0
  331. package/dist/domain/messaging/ports.js +2 -0
  332. package/dist/domain/messaging/ports.js.map +1 -0
  333. package/dist/domain/messaging/receive-deliveries.d.ts +68 -0
  334. package/dist/domain/messaging/receive-deliveries.js +119 -0
  335. package/dist/domain/messaging/receive-deliveries.js.map +1 -0
  336. package/dist/domain/messaging/receive-max.d.ts +8 -0
  337. package/dist/domain/messaging/receive-max.js +17 -0
  338. package/dist/domain/messaging/receive-max.js.map +1 -0
  339. package/dist/domain/messaging/reply-to-message.d.ts +35 -0
  340. package/dist/domain/messaging/reply-to-message.js +49 -0
  341. package/dist/domain/messaging/reply-to-message.js.map +1 -0
  342. package/dist/domain/messaging/resend-delivery.d.ts +48 -0
  343. package/dist/domain/messaging/resend-delivery.js +97 -0
  344. package/dist/domain/messaging/resend-delivery.js.map +1 -0
  345. package/dist/domain/messaging/send-message.d.ts +88 -0
  346. package/dist/domain/messaging/send-message.js +115 -0
  347. package/dist/domain/messaging/send-message.js.map +1 -0
  348. package/dist/domain/messaging/send-request.d.ts +16 -0
  349. package/dist/domain/messaging/send-request.js +18 -0
  350. package/dist/domain/messaging/send-request.js.map +1 -0
  351. package/dist/domain/registry/applied-limits.d.ts +15 -0
  352. package/dist/domain/registry/applied-limits.js +15 -0
  353. package/dist/domain/registry/applied-limits.js.map +1 -0
  354. package/dist/domain/registry/assign-crew.d.ts +31 -0
  355. package/dist/domain/registry/assign-crew.js +35 -0
  356. package/dist/domain/registry/assign-crew.js.map +1 -0
  357. package/dist/domain/registry/claim-ship.d.ts +49 -0
  358. package/dist/domain/registry/claim-ship.js +59 -0
  359. package/dist/domain/registry/claim-ship.js.map +1 -0
  360. package/dist/domain/registry/commission-ship.d.ts +54 -0
  361. package/dist/domain/registry/commission-ship.js +70 -0
  362. package/dist/domain/registry/commission-ship.js.map +1 -0
  363. package/dist/domain/registry/confirm-crew-release.d.ts +28 -0
  364. package/dist/domain/registry/confirm-crew-release.js +28 -0
  365. package/dist/domain/registry/confirm-crew-release.js.map +1 -0
  366. package/dist/domain/registry/create-fleet.d.ts +39 -0
  367. package/dist/domain/registry/create-fleet.js +56 -0
  368. package/dist/domain/registry/create-fleet.js.map +1 -0
  369. package/dist/domain/registry/crew-request.d.ts +148 -0
  370. package/dist/domain/registry/crew-request.js +175 -0
  371. package/dist/domain/registry/crew-request.js.map +1 -0
  372. package/dist/domain/registry/delete-fleet.d.ts +46 -0
  373. package/dist/domain/registry/delete-fleet.js +34 -0
  374. package/dist/domain/registry/delete-fleet.js.map +1 -0
  375. package/dist/domain/registry/deregister.d.ts +32 -0
  376. package/dist/domain/registry/deregister.js +38 -0
  377. package/dist/domain/registry/deregister.js.map +1 -0
  378. package/dist/domain/registry/explain-crew-request.d.ts +30 -0
  379. package/dist/domain/registry/explain-crew-request.js +31 -0
  380. package/dist/domain/registry/explain-crew-request.js.map +1 -0
  381. package/dist/domain/registry/fleet.d.ts +12 -0
  382. package/dist/domain/registry/fleet.js +12 -0
  383. package/dist/domain/registry/fleet.js.map +1 -0
  384. package/dist/domain/registry/found-fleet.d.ts +32 -0
  385. package/dist/domain/registry/found-fleet.js +43 -0
  386. package/dist/domain/registry/found-fleet.js.map +1 -0
  387. package/dist/domain/registry/get-fleet-limits.d.ts +17 -0
  388. package/dist/domain/registry/get-fleet-limits.js +14 -0
  389. package/dist/domain/registry/get-fleet-limits.js.map +1 -0
  390. package/dist/domain/registry/get-installation-fleet.d.ts +15 -0
  391. package/dist/domain/registry/get-installation-fleet.js +12 -0
  392. package/dist/domain/registry/get-installation-fleet.js.map +1 -0
  393. package/dist/domain/registry/get-installation-settings.d.ts +7 -0
  394. package/dist/domain/registry/get-installation-settings.js +5 -0
  395. package/dist/domain/registry/get-installation-settings.js.map +1 -0
  396. package/dist/domain/registry/get-ship.d.ts +34 -0
  397. package/dist/domain/registry/get-ship.js +36 -0
  398. package/dist/domain/registry/get-ship.js.map +1 -0
  399. package/dist/domain/registry/get-starting-prompt.d.ts +24 -0
  400. package/dist/domain/registry/get-starting-prompt.js +46 -0
  401. package/dist/domain/registry/get-starting-prompt.js.map +1 -0
  402. package/dist/domain/registry/initialise-fleet.d.ts +28 -0
  403. package/dist/domain/registry/initialise-fleet.js +39 -0
  404. package/dist/domain/registry/initialise-fleet.js.map +1 -0
  405. package/dist/domain/registry/installation-fleet.d.ts +36 -0
  406. package/dist/domain/registry/installation-fleet.js +22 -0
  407. package/dist/domain/registry/installation-fleet.js.map +1 -0
  408. package/dist/domain/registry/installation-request.d.ts +23 -0
  409. package/dist/domain/registry/installation-request.js +5 -0
  410. package/dist/domain/registry/installation-request.js.map +1 -0
  411. package/dist/domain/registry/lease.d.ts +51 -0
  412. package/dist/domain/registry/lease.js +39 -0
  413. package/dist/domain/registry/lease.js.map +1 -0
  414. package/dist/domain/registry/leases.d.ts +66 -0
  415. package/dist/domain/registry/leases.js +80 -0
  416. package/dist/domain/registry/leases.js.map +1 -0
  417. package/dist/domain/registry/limits.d.ts +50 -0
  418. package/dist/domain/registry/limits.js +24 -0
  419. package/dist/domain/registry/limits.js.map +1 -0
  420. package/dist/domain/registry/list-fleet.d.ts +70 -0
  421. package/dist/domain/registry/list-fleet.js +47 -0
  422. package/dist/domain/registry/list-fleet.js.map +1 -0
  423. package/dist/domain/registry/list-fleets.d.ts +11 -0
  424. package/dist/domain/registry/list-fleets.js +9 -0
  425. package/dist/domain/registry/list-fleets.js.map +1 -0
  426. package/dist/domain/registry/list-installation-fleets.d.ts +15 -0
  427. package/dist/domain/registry/list-installation-fleets.js +15 -0
  428. package/dist/domain/registry/list-installation-fleets.js.map +1 -0
  429. package/dist/domain/registry/ping-status.d.ts +17 -0
  430. package/dist/domain/registry/ping-status.js +28 -0
  431. package/dist/domain/registry/ping-status.js.map +1 -0
  432. package/dist/domain/registry/pingable-ship.d.ts +22 -0
  433. package/dist/domain/registry/pingable-ship.js +21 -0
  434. package/dist/domain/registry/pingable-ship.js.map +1 -0
  435. package/dist/domain/registry/ports.d.ts +318 -0
  436. package/dist/domain/registry/ports.js +2 -0
  437. package/dist/domain/registry/ports.js.map +1 -0
  438. package/dist/domain/registry/public.d.ts +8 -0
  439. package/dist/domain/registry/public.js +10 -0
  440. package/dist/domain/registry/public.js.map +1 -0
  441. package/dist/domain/registry/read-assigned-crew-requests.d.ts +14 -0
  442. package/dist/domain/registry/read-assigned-crew-requests.js +15 -0
  443. package/dist/domain/registry/read-assigned-crew-requests.js.map +1 -0
  444. package/dist/domain/registry/recrew-ship.d.ts +33 -0
  445. package/dist/domain/registry/recrew-ship.js +34 -0
  446. package/dist/domain/registry/recrew-ship.js.map +1 -0
  447. package/dist/domain/registry/release-ship.d.ts +38 -0
  448. package/dist/domain/registry/release-ship.js +47 -0
  449. package/dist/domain/registry/release-ship.js.map +1 -0
  450. package/dist/domain/registry/remove-crew-request.d.ts +28 -0
  451. package/dist/domain/registry/remove-crew-request.js +36 -0
  452. package/dist/domain/registry/remove-crew-request.js.map +1 -0
  453. package/dist/domain/registry/rename-ship.d.ts +30 -0
  454. package/dist/domain/registry/rename-ship.js +39 -0
  455. package/dist/domain/registry/rename-ship.js.map +1 -0
  456. package/dist/domain/registry/report-crew-status.d.ts +29 -0
  457. package/dist/domain/registry/report-crew-status.js +30 -0
  458. package/dist/domain/registry/report-crew-status.js.map +1 -0
  459. package/dist/domain/registry/report-details.d.ts +18 -0
  460. package/dist/domain/registry/report-details.js +41 -0
  461. package/dist/domain/registry/report-details.js.map +1 -0
  462. package/dist/domain/registry/report-log.d.ts +21 -0
  463. package/dist/domain/registry/report-log.js +16 -0
  464. package/dist/domain/registry/report-log.js.map +1 -0
  465. package/dist/domain/registry/report.d.ts +30 -0
  466. package/dist/domain/registry/report.js +30 -0
  467. package/dist/domain/registry/report.js.map +1 -0
  468. package/dist/domain/registry/request-crew.d.ts +32 -0
  469. package/dist/domain/registry/request-crew.js +29 -0
  470. package/dist/domain/registry/request-crew.js.map +1 -0
  471. package/dist/domain/registry/resolve-selector.d.ts +25 -0
  472. package/dist/domain/registry/resolve-selector.js +32 -0
  473. package/dist/domain/registry/resolve-selector.js.map +1 -0
  474. package/dist/domain/registry/retire-ship.d.ts +42 -0
  475. package/dist/domain/registry/retire-ship.js +68 -0
  476. package/dist/domain/registry/retire-ship.js.map +1 -0
  477. package/dist/domain/registry/set-fleet-limits.d.ts +30 -0
  478. package/dist/domain/registry/set-fleet-limits.js +54 -0
  479. package/dist/domain/registry/set-fleet-limits.js.map +1 -0
  480. package/dist/domain/registry/set-installation-settings.d.ts +18 -0
  481. package/dist/domain/registry/set-installation-settings.js +31 -0
  482. package/dist/domain/registry/set-installation-settings.js.map +1 -0
  483. package/dist/domain/registry/ship-handle.d.ts +5 -0
  484. package/dist/domain/registry/ship-handle.js +20 -0
  485. package/dist/domain/registry/ship-handle.js.map +1 -0
  486. package/dist/domain/registry/ship-note.d.ts +7 -0
  487. package/dist/domain/registry/ship-note.js +15 -0
  488. package/dist/domain/registry/ship-note.js.map +1 -0
  489. package/dist/domain/registry/ship-report.d.ts +42 -0
  490. package/dist/domain/registry/ship-report.js +93 -0
  491. package/dist/domain/registry/ship-report.js.map +1 -0
  492. package/dist/domain/registry/ship.d.ts +190 -0
  493. package/dist/domain/registry/ship.js +334 -0
  494. package/dist/domain/registry/ship.js.map +1 -0
  495. package/dist/domain/registry/ships.d.ts +25 -0
  496. package/dist/domain/registry/ships.js +22 -0
  497. package/dist/domain/registry/ships.js.map +1 -0
  498. package/dist/domain/registry/starting-prompt.d.ts +32 -0
  499. package/dist/domain/registry/starting-prompt.js +22 -0
  500. package/dist/domain/registry/starting-prompt.js.map +1 -0
  501. package/dist/domain/registry/whoami.d.ts +20 -0
  502. package/dist/domain/registry/whoami.js +15 -0
  503. package/dist/domain/registry/whoami.js.map +1 -0
  504. package/dist/domain/shared/caller.d.ts +25 -0
  505. package/dist/domain/shared/caller.js +8 -0
  506. package/dist/domain/shared/caller.js.map +1 -0
  507. package/dist/domain/shared/clock.d.ts +4 -0
  508. package/dist/domain/shared/clock.js +2 -0
  509. package/dist/domain/shared/clock.js.map +1 -0
  510. package/dist/domain/shared/errors.d.ts +13 -0
  511. package/dist/domain/shared/errors.js +6 -0
  512. package/dist/domain/shared/errors.js.map +1 -0
  513. package/dist/domain/shared/events.d.ts +75 -0
  514. package/dist/domain/shared/events.js +9 -0
  515. package/dist/domain/shared/events.js.map +1 -0
  516. package/dist/domain/shared/follow-fleet.d.ts +32 -0
  517. package/dist/domain/shared/follow-fleet.js +65 -0
  518. package/dist/domain/shared/follow-fleet.js.map +1 -0
  519. package/dist/domain/shared/history.d.ts +124 -0
  520. package/dist/domain/shared/history.js +16 -0
  521. package/dist/domain/shared/history.js.map +1 -0
  522. package/dist/domain/shared/idempotency-key.d.ts +8 -0
  523. package/dist/domain/shared/idempotency-key.js +14 -0
  524. package/dist/domain/shared/idempotency-key.js.map +1 -0
  525. package/dist/domain/shared/notifier.d.ts +17 -0
  526. package/dist/domain/shared/notifier.js +2 -0
  527. package/dist/domain/shared/notifier.js.map +1 -0
  528. package/dist/domain/shared/ping.d.ts +18 -0
  529. package/dist/domain/shared/ping.js +8 -0
  530. package/dist/domain/shared/ping.js.map +1 -0
  531. package/dist/domain/shared/read-fleet-events.d.ts +29 -0
  532. package/dist/domain/shared/read-fleet-events.js +25 -0
  533. package/dist/domain/shared/read-fleet-events.js.map +1 -0
  534. package/dist/domain/shared/read-fleet-limits.d.ts +39 -0
  535. package/dist/domain/shared/read-fleet-limits.js +24 -0
  536. package/dist/domain/shared/read-fleet-limits.js.map +1 -0
  537. package/dist/domain/shared/read-inbox.d.ts +20 -0
  538. package/dist/domain/shared/read-inbox.js +16 -0
  539. package/dist/domain/shared/read-inbox.js.map +1 -0
  540. package/dist/domain/shared/read-message.d.ts +21 -0
  541. package/dist/domain/shared/read-message.js +18 -0
  542. package/dist/domain/shared/read-message.js.map +1 -0
  543. package/dist/domain/shared/read-needs-attention.d.ts +12 -0
  544. package/dist/domain/shared/read-needs-attention.js +10 -0
  545. package/dist/domain/shared/read-needs-attention.js.map +1 -0
  546. package/dist/domain/shared/read-ship-messages.d.ts +28 -0
  547. package/dist/domain/shared/read-ship-messages.js +30 -0
  548. package/dist/domain/shared/read-ship-messages.js.map +1 -0
  549. package/dist/domain/shared/read-ship-timeline.d.ts +18 -0
  550. package/dist/domain/shared/read-ship-timeline.js +16 -0
  551. package/dist/domain/shared/read-ship-timeline.js.map +1 -0
  552. package/dist/domain/shared/result.d.ts +16 -0
  553. package/dist/domain/shared/result.js +7 -0
  554. package/dist/domain/shared/result.js.map +1 -0
  555. package/dist/domain/shared/secrets.d.ts +26 -0
  556. package/dist/domain/shared/secrets.js +2 -0
  557. package/dist/domain/shared/secrets.js.map +1 -0
  558. package/dist/domain/shared/selector.d.ts +29 -0
  559. package/dist/domain/shared/selector.js +2 -0
  560. package/dist/domain/shared/selector.js.map +1 -0
  561. package/dist/domain/shared/unit-of-work.d.ts +13 -0
  562. package/dist/domain/shared/unit-of-work.js +2 -0
  563. package/dist/domain/shared/unit-of-work.js.map +1 -0
  564. package/dist/domain/shared/utc-day.d.ts +4 -0
  565. package/dist/domain/shared/utc-day.js +9 -0
  566. package/dist/domain/shared/utc-day.js.map +1 -0
  567. package/dist/index.d.ts +1 -0
  568. package/dist/index.js +2 -0
  569. package/dist/index.js.map +1 -0
  570. package/dist/start.d.ts +6 -0
  571. package/dist/start.js +29 -0
  572. package/dist/start.js.map +1 -0
  573. package/dist/wiring.d.ts +158 -0
  574. package/dist/wiring.js +185 -0
  575. package/dist/wiring.js.map +1 -0
  576. package/package.json +58 -3
  577. package/prisma.config.ts +18 -0
  578. package/src/adapters/prisma/migrations/20260929124818_init/migration.sql +201 -0
  579. package/src/adapters/prisma/migrations/20260929160000_fleet_argo_console_session/migration.sql +130 -0
  580. package/src/adapters/prisma/migrations/20260929220017_operator_login/migration.sql +27 -0
  581. package/src/adapters/prisma/migrations/20260930090000_crew_token/migration.sql +5 -0
  582. package/src/adapters/prisma/migrations/20260930120000_send/migration.sql +30 -0
  583. package/src/adapters/prisma/migrations/20260930150000_receive/migration.sql +24 -0
  584. package/src/adapters/prisma/migrations/20261001010000_event_seq/migration.sql +34 -0
  585. package/src/adapters/prisma/migrations/20261001020000_console_session_end_reason/migration.sql +14 -0
  586. package/src/adapters/prisma/migrations/20261001030000_account_theme_session_device/migration.sql +8 -0
  587. package/src/adapters/prisma/migrations/20261001040000_lease_last_seen/migration.sql +2 -0
  588. package/src/adapters/prisma/migrations/20261002190000_lease_report/migration.sql +7 -0
  589. package/src/adapters/prisma/migrations/20261003140000_commission_key/migration.sql +7 -0
  590. package/src/adapters/prisma/migrations/20261003200000_message_model/migration.sql +5 -0
  591. package/src/adapters/prisma/migrations/20261003201000_lease_harness/migration.sql +2 -0
  592. package/src/adapters/prisma/migrations/20261004120000_operator_without_password/migration.sql +2 -0
  593. package/src/adapters/prisma/migrations/20261004121000_installation_requests/migration.sql +21 -0
  594. package/src/adapters/prisma/migrations/20261004122000_events_deleted_with_their_fleet/migration.sql +11 -0
  595. package/src/adapters/prisma/migrations/20261004130000_sign_in_tickets/migration.sql +16 -0
  596. package/src/adapters/prisma/migrations/20261004140000_fleet_limits/migration.sql +6 -0
  597. package/src/adapters/prisma/migrations/20261004141000_installation_settings/migration.sql +12 -0
  598. package/src/adapters/prisma/migrations/20261005090000_viewer_ship/migration.sql +2 -0
  599. package/src/adapters/prisma/migrations/20261005100000_viewer_sessions/migration.sql +20 -0
  600. package/src/adapters/prisma/migrations/20261005110000_notices/migration.sql +37 -0
  601. package/src/adapters/prisma/migrations/20261005120000_guide/migration.sql +34 -0
  602. package/src/adapters/prisma/migrations/20261006100000_fleet_crew_scope/migration.sql +8 -0
  603. package/src/adapters/prisma/migrations/20261006140000_lease_report_details/migration.sql +3 -0
  604. package/src/adapters/prisma/migrations/20261006160000_crew_requests/migration.sql +20 -0
  605. package/src/adapters/prisma/migrations/20261006180000_crew_scopes/migration.sql +9 -0
  606. package/src/adapters/prisma/migrations/20261006190000_crew_assignment/migration.sql +13 -0
  607. package/src/adapters/prisma/migrations/20261006200000_crew_request_reason/migration.sql +3 -0
  608. package/src/adapters/prisma/migrations/20261007020000_broad_crewing_scope_retired/migration.sql +8 -0
  609. package/src/adapters/prisma/migrations/migration_lock.toml +3 -0
  610. package/src/adapters/prisma/schema.prisma +558 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1 +1,98 @@
1
- # @aeolus-fleet/core: placeholder, the real package is published from 0.18.0.
1
+ # @aeolus-fleet/core
2
+
3
+ The [Aeolus](https://github.com/ThomasHendrickx/aeolus-fleet) server: one tRPC API and the fleet domain on Postgres, with its migrations.
4
+
5
+ Pre-v1: the API changes without notice until the v1 acceptance test passes.
6
+
7
+ ## Running from npm
8
+
9
+ ```sh
10
+ npm install @aeolus-fleet/core @aeolus-fleet/console
11
+ export DATABASE_URL=postgresql://... PUBLIC_URL=https://fleet.example.com
12
+ npx aeolus-core migrate
13
+ npx aeolus-core fleet:init --name "my fleet" # once: asks for the operator email and password
14
+ npx aeolus-core start
15
+ ```
16
+
17
+ | Command | Does |
18
+ | --- | --- |
19
+ | `aeolus-core start` | Migrates the database, then serves the fleet until `SIGINT` or `SIGTERM` |
20
+ | `aeolus-core migrate` | Applies the migrations the package ships, with Prisma Migrate, and nothing else. Needs `DATABASE_URL` alone |
21
+ | `aeolus-core fleet:init --name "<fleet name>"` | See Server commands below |
22
+ | `aeolus-core operator:reset-password` | See Server commands below |
23
+
24
+ Prisma Migrate holds a Postgres advisory lock while it migrates, so two processes starting at once never migrate at once: the second waits, then finds nothing left to apply. It never asks Prisma's servers for a newer version.
25
+
26
+ On `SIGINT` or `SIGTERM` the server stops taking requests, and every receive waiting on an empty inbox answers with no deliveries at once. Idle connections close at once, and a connection whose request ends during the stop closes with its answer, so nothing holds the stop up.
27
+
28
+ ## Configuration
29
+
30
+ Environment variables, validated at startup (see `.env.example`):
31
+
32
+ | Variable | Default | Meaning |
33
+ | --- | --- | --- |
34
+ | `DATABASE_URL` | required | Postgres 16 or newer, with a direct connection |
35
+ | `PUBLIC_URL` | required | Where ships reach the fleet (`http://` or `https://`): every starting prompt carries the fleet MCP URL under it, `<PUBLIC_URL>/mcp` |
36
+ | `HOST` | `127.0.0.1` | Interface to listen on |
37
+ | `PORT` | `4000` | Port to listen on |
38
+ | `LOG_LEVEL` | `info` | `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent` |
39
+ | `TRUST_PROXY` | `false` | `true` behind a reverse proxy, so the sign-in and failed-register rate limits count per client address from `X-Forwarded-For`; without it every client behind the proxy shares one budget |
40
+ | `COOKIE_DOMAIN` | unset | The domain the console session cookie is set for, such as `fleet.example.com`, so a console on another host under it receives the cookie. Every host under it does, so pick the narrowest domain the console and the server share. Unset: the server's host only |
41
+ | `INSTALLATION_TOKEN` | unset | The token a hosting service presents to the installation procedures (at least 32 characters; see docs/architecture.md, "Installation"). Unset: they are off, as a self-hosted server needs |
42
+ | `CONSOLE_ORIGIN` | `PUBLIC_URL`'s origin | The console's origin, such as `https://console.fleet.example.com`: the only origin a state-changing console call (sign-in, sign-out, a change made with the session cookie) is taken from, and the one origin allowed to call with credentials from another host (CORS). The default fits web and server behind one host. In development the console runs on `http://localhost:3000` (see `.env.example`) |
43
+
44
+ The browser calls the server's `/trpc` itself, at the address the web app runs with (`AEOLUS_SERVER_URL`, see the web README), so the console may run on another host: set `COOKIE_DOMAIN` and `CONSOLE_ORIGIN` for it. Another service the operator uses beside the console (served by its own server, under the configured cookie domain) checks a console session with `GET /trpc/console.session`, forwarding the browser's `Cookie` header: it answers `{ "fleetId": "flt_...", "expiresAt": "...", "kind": "operator" | "viewer", "scopes": [...] }`, or `UNAUTHORIZED` without a signed-in session; a viewer's scopes are `fleet:read` only, so serve it reads only. Only the cookie counts, never a crew token, and the call moves the session's expiry like any console call. A client that is no browser follows the fleet with `fleet.follow` (`fleet:read`; also `/api/v1/fleet/follow` and the MCP tool `fleet_follow`): `{ "afterSeq": n, "max": 1 to 100, "waitSeconds": 0 to 25 }`, all optional, answers `{ "events": [...], "lastSeq": n }`, the events after `afterSeq` oldest first, in the live stream's shape (never their details). Passing the answered `lastSeq` as the next `afterSeq` misses nothing across reconnects; without `afterSeq` it answers no events and the current `lastSeq`; with `waitSeconds` it waits while none has come and answers as soon as one commits. The console follows the fleet live through the `fleet.events` subscription, over a WebSocket opened on the same `/trpc` path, so a proxy in front must pass the upgrade on (Caddy does by itself). The upgrade carries the session cookie and is refused from any origin but `CONSOLE_ORIGIN`, as a state-changing call is. The ship page reads `fleet.ship`, `fleet.shipTimeline`, `fleet.shipMessages` (`{ "shipId": "shp_..." }`) and `fleet.message` (`{ "messageId": "msg_..." }`), each with `fleet:read`, which includes message payloads; a ship or message of another fleet is `NOT_FOUND`. A timeline and a message list hold the newest 200. A console call refused because the operator signed in somewhere else carries `refusal: "SIGNED_IN_ELSEWHERE"` in its error data, and a rate-limited sign-in carries `retryAt`, when the client may try again.
45
+
46
+ ## Server commands
47
+
48
+ Run on the server, against the configured database, once it is migrated:
49
+
50
+ | Command | Does |
51
+ | --- | --- |
52
+ | `aeolus-core fleet:init --name "<fleet name>"` | Asks for the operator email and password (twice, not shown), then creates the fleet, its operator ship `argo` and the operator account. Refuses when a fleet already exists |
53
+ | `aeolus-core operator:reset-password` | Asks for a new operator password (twice, not shown) and sets it. The old one stops working and every console session ends. An operator a hosting installation created has no password and is refused: they sign in only through the hosting service |
54
+
55
+ Both commands read their answers a line at a time from standard input, so a script can pipe them in. Like the API, they refuse any answer holding the character U+0000, naming what holds it, and change nothing. In this repository they run as `npm run fleet:init -w @aeolus-fleet/core -- --name "<fleet name>"` and `npm run operator:reset-password -w @aeolus-fleet/core`, and `npm run db:migrate -w @aeolus-fleet/core` migrates.
56
+
57
+ The operator signs in to the console with that email and password; the session crews `argo`, which has no secret. The password is stored as an Argon2id hash. The console keeps only a session cookie (httpOnly, Secure, SameSite=Strict), valid 30 days after its last use. A wrong email and a wrong password get the same answer.
58
+
59
+ ## Ships
60
+
61
+ The operator gets a ship's starting prompt from `fleet.commission`, or later from `fleet.getStartingPrompt`. It carries identity only: the fleet MCP URL (`<PUBLIC_URL>/mcp`) and the one-line command that adds it to Claude Code, the ship id and secret, how to pick the location, and `Call register.` What the ship works on, the operator adds after it.
62
+
63
+ A session crews an agent ship with `ship.register`: the ship id and secret from its starting prompt, and where it runs (`DEVICE`, `CLOUD`, `SERVER`, or `OTHER` with a description). It gets a crew token (`aeolus_ct_v1_...`) back once, and every later call carries it as `Authorization: Bearer <crew token>`; the secret works only for `register`. A second `register` fails while a session crews the ship. Failed `register` attempts (a wrong ship id or secret) are rate-limited per client address; a successful claim never counts, so one address can start many sessions. `ship.whoami` answers the caller's ship: id, fleet, name and type.
64
+
65
+ `ship.send` sends a message from the calling ship (a crew token, or the console session as `argo`); it needs the `messages:send` scope. It takes a selector (`{ "kind": "ship", "shipId": "shp_..." }`, `{ "kind": "ship", "name": "scout" }` or `{ "kind": "type", "type": "reviewer" }`), a payload (text of at most 64 KB in UTF-8, never parsed), optionally its content type (any well-formed media type, such as `text/plain` or `application/json; charset=utf-8`, passed on untouched; `text/plain` when left out), the sender's own idempotency key (1 to 256 characters) and, for a reply, `inReplyTo` (a message id of the fleet). A name is resolved to the ship's id when the message is sent; a retired or unknown ship, or a type without an active ship, is refused. It answers `{ "messageId": "msg_..." }` only once the message and its delivery are stored. A repeat of the key with the same request (selector as sent, payload, content type, `inReplyTo`; no content type is the same as `text/plain`) answers with the original id; the same key with another request is refused (`CONFLICT`). When the send commits, Postgres `NOTIFY` announces the delivery on the channel `aeolus_delivery_pending`.
66
+
67
+ `ship.receive` and `ship.ack` take the crew token only (the console session is refused) and need the `messages:receive` scope. `ship.receive` takes `{ "max": 1 to 10 }`, one when left out, and answers `{ "deliveries": [...] }`: the crew's own unacknowledged deliveries in flight first, then the oldest pending ones for its ship or its type. Each comes with its message and its sender (`deliveryId`, `messageId`, `senderShipId`, `senderName`, `senderType`, `recipient`, `payload`, `contentType`, `inReplyTo`, `sentAt`, `attempts`; the sender's name and type as they are at the receive, so a renamed sender goes by its new name) and stays in flight until acknowledged or the lease ends; the crew's next receive returns it again, counted as another claim, so a lost reply loses nothing. The fifth claim of a delivery never acknowledged makes it undeliverable instead. With nothing there, a receive waits about 25 seconds and answers with no deliveries; a delivery for its ship or type wakes it at once. `ship.ack` takes `{ "deliveryId": "dlv_..." }` and answers `{}`: only the ship holding the delivery in flight acknowledges it, and acknowledging it again is OK. `ship.pong` takes the crew token and the same scope, takes `{ "deliveryId": "dlv_..." }` of a ping the ship holds in flight and answers `{}`: it acknowledges the ping, with `answer: pong` in `DeliveryAcknowledged`, and marks the lease last seen, in one transaction; again is OK and changes nothing, and a delivery that is not a ping is refused (`CONFLICT`). `ship.report` takes the crew token and no scope: `{ "state": "working" | "blocked" | "idle", "note"?: "..." }` (one line, at most 200 characters, trimmed), answers `{}`. The report is kept with the crew's lease, so the ship's next crew starts with none, and `fleet.list` and `fleet.ship` show it (`report: { state, note, reportedAt }` or null); `ShipReported` is written only when the state or the note changes, so reporting the same again is a check-in. `ship.inbox` takes the crew token and the same scope, takes `{ "waitSeconds": 0 to 25 }`, none when left out, and answers `{ "waiting": n }`: how many deliveries the crew's next receive would hand it, its own in flight included. It claims nothing. While none waits it waits up to `waitSeconds`, woken like a receive. A mutation only so REST takes its body; it changes nothing.
68
+
69
+ A lease ends cleanly in two ways. The operator releases a crewed ship with `fleet.release` (`{ "shipId": "shp_..." }`, scope `fleet:manage`); `argo` is never released, and a ship awaiting crew gets a new starting prompt instead (`CONFLICT`). A crew ends its own lease with `ship.deregister`, which takes the crew token only and no scope. Both work in one transaction: the secret is invalidated, the lease and its crew token end, and the deliveries the lease held in flight return to pending, to the ship's inbox or its type's queue, their attempts kept, each announced on `aeolus_delivery_pending` as a send is, so a waiting receive of another ship of the type takes a returned type delivery at once. Both answer `{}`. The old crew token then fails on every call, refused as `LEASE_ENDED` with `This ship was released; this session no longer crews it.` (the `UNAUTHORIZED` code at `/trpc`, which knows only tRPC's codes), and the old secret fails on `register`; the next crew needs a new starting prompt. A receive of that crew still waiting hands out nothing: it answers empty at the end of its wait, or `LEASE_ENDED` if a delivery wakes it first.
70
+
71
+ `fleet.ping` (`{ "shipId": "shp_..." }`, `fleet:manage`) sends a crewed ship a ping: a message from argo with the content type `application/vnd.aeolus.ping` and the payload `Ping from argo: answer with pong(deliveryId).`, delivered like any other. It answers `{ "messageId": "msg_...", "sentAt": "...", "isNew": true }`. Pings never stack: while the ship's last ping is pending or in flight, it answers with that one (`isNew: false`) and stores nothing. It refuses argo (`FORBIDDEN`), a retired ship and a ship awaiting crew (`CONFLICT`). `ship.send` refuses the ping content type for every caller (`FORBIDDEN`): only `fleet.ping` sends a ping.
72
+
73
+ `fleet.rename` (`{ "shipId": "shp_...", "name": "lookout" }`, `fleet:manage`) gives any ship but argo (`FORBIDDEN`) or a retired one (`CONFLICT`) a new name, checked as at commissioning and unique among active ships (`CONFLICT` when taken), with `ShipRenamed`. Its id, history and session stay; a sender addressing the old name no longer reaches it. It answers `{}`.
74
+
75
+ The operator retires a ship for good with `fleet.retire` (`{ "shipId": "shp_..." }`, scope `fleet:manage`), crewed or not, never `argo` (`FORBIDDEN`), never twice (`CONFLICT`). In one transaction it locks the ship, invalidates its secret, ends a crewed ship's lease as a release does, abandons the deliveries pending to the ship itself (one `DeliveryAbandoned` each, with `ShipRetired`) and retires it: it is never claimed or addressed again and its name is free. Deliveries to its type stay for the other ships of the type, and an undeliverable one stays for the operator. A send racing it either commits first and is abandoned, or comes after and is refused. It answers `{ "abandonedDeliveries": n }`. `fleet.recrew` (`{ "shipId": "shp_..." }`, `fleet:manage`) gives a crewed ship whose session is gone a new crew: a release and a new starting prompt in one transaction, answering the prompt and crew line once, as `fleet.getStartingPrompt` does. `fleet.ship` counts `inFlightDeliveries` (what a release returns) and `openDeliveries` (what a retire abandons).
76
+
77
+ Needs attention: `fleet.needsAttention` (`fleet:read`) lists every undeliverable delivery of the fleet, oldest first by when it became undeliverable, each with its claims, `since` and its whole message. `fleet.dismiss` (`{ "deliveryId": "dlv_..." }`, `fleet:manage`) sets one to dismissed with `DeliveryDismissed`, and answers `{}`; again is OK. `fleet.resend` (`{ "deliveryId": "dlv_..." }`, `fleet:manage`) sends it again: a new message from the original sender, to the same ship or type, with the same payload, content type and `inReplyTo`, naming the original (`resend_of`), and dismisses the original, in one transaction. It answers `{ "messageId": "msg_..." }`; a second resend of the delivery answers the same. Any delivery not undeliverable is refused (`CONFLICT`); a selector that no longer resolves is refused as a send would be, and the original stays undeliverable.
78
+
79
+ The operator inbox: `fleet.inbox` (`{ "filter": "open" | "done" | "all" }`, `fleet:read`) lists the messages addressed to the caller itself (argo's, for the console; argo's too for a viewer session, decision 0022), newest first, each with its delivery's state, `readAt`, `doneAt`, `repliedWith` and its whole message. Only argo's console session calls the rest; any other ship is refused (`FORBIDDEN`), and a delivery not in argo's inbox is `NOT_FOUND`. `fleet.markRead` (`{ "deliveryId", "isRead" }`, `messages:receive`) marks it read (keeping the first read) or unread; read is not done, and no event is written. `fleet.markDone` (`{ "deliveryId" }`, `messages:receive`) claims and acknowledges it at once under the console session's lease; again is OK. `fleet.reply` (`{ "deliveryId", "payload", "idempotencyKey" }`, `messages:send` and `messages:receive`) sends the payload as `text/plain` from argo to the message's sender with `inReplyTo`, and marks the message done in one transaction; it answers `{ "messageId" }`, and a repeat of the key answers the same reply.
80
+
81
+ A ship reaches the same calls without installing anything, as REST under `/api/v1` or as MCP tools at `/mcp`. Both map onto the ship procedures above and hold no logic of their own; neither reads the console session cookie, so a call without a valid crew token is told to use the crew token alone, and failed `register` attempts count against one limit per client address whichever door they come through. A failure in either door, inside a procedure or not, answers only `Internal error` and the request's id. The MCP server sends the ship protocol (`adapters/trpc/ship-protocol.ts`) as its instructions when a client connects, and the OpenAPI spec's description opens with the same text: register once, at the start, and keep the crew token; then receive, ack each delivery and act only if the ack succeeded, and answer by `senderName` with `inReplyTo`; keep receiving while waiting for an answer; deregister only when the session ends for good; end the turn when the work is done and no answer is expected; and once a call answers `LEASE_ENDED`, stop calling the fleet. Each call's description states only that call's own rules, such as `inReplyTo` taking the message id and a new idempotency key for every message; no rule is stated in both.
82
+
83
+ - **REST**: `POST /api/v1/ship/register`, `GET /api/v1/ship/whoami`, and `POST /api/v1/ship/send`, `/receive`, `/ack`, `/inbox` and `/deregister`, each with a JSON body where it takes input and the crew token as `Authorization: Bearer`. A refusal answers with its code's HTTP status and `{ "code": "CONFLICT", "message": "..." }`. The OpenAPI 3.1 spec is at `/api/v1/openapi.json`, and as a readable page at `/api/v1/docs`.
84
+ - **MCP**: a remote MCP server over streamable HTTP, one tool per call. The connection carries no ship, so many conversations can share it (ADR 0015): every tool but `register` takes the crew token as its `crewToken` argument. A refusal is a tool error reading `CODE: message`. To add it to Claude Code, for every session on the machine: `claude mcp add --transport http --scope user aeolus <PUBLIC_URL>/mcp`.
85
+
86
+ The server listens on `aeolus_delivery_pending` over a connection of its own (named `aeolus-delivery-listener` in Postgres), which needs a direct database connection, not a transaction pooler. After a lost connection it listens again, with a delay that doubles up to 30 seconds, and every waiting receive then looks again, since notices sent meanwhile are gone.
87
+
88
+ No text input to any procedure may hold the character U+0000, which Postgres cannot store: it is refused as `BAD_REQUEST`, naming the field. A refusal answers its own code and message. A server failure answers only `Internal error` and the request's id (`data.requestId`); the server log holds the whole error, stack included, under the same id (`reqId`). No answer ever carries a stack trace.
89
+
90
+ A database error is logged by its codes only, under `database`: Prisma's code, Postgres's SQLSTATE and the driver adapter's kind, never its message or stack, since Postgres quotes values from the request in its words. The same holds for the health check, the delivery listener and the server commands.
91
+
92
+ A request Fastify refuses before any procedure runs answers in the same `{ "code", "message" }` shape: a body that is not JSON `400 BAD_REQUEST`, a body over 1 MiB `413 PAYLOAD_TOO_LARGE`, a body of another content type `415 UNSUPPORTED_MEDIA_TYPE`, and a path or method nothing serves `404 NOT_FOUND`.
93
+
94
+ The operator's account: `console.account` answers `kind: "operator"` with the signed-in operator's email, theme and this console session (`{ "device": "Mac · Chrome", "since": "..." }`; the device is worded from the sign-in's User-Agent and is also argo's lease location), or `kind: "viewer"` with the session alone for a viewer session (decision 0022). `console.setTheme` (`{ "theme": "light" | "dark" | "system" }`) stores the theme on the account, so it follows the operator to any browser; no event. Both answer only a console session (`FORBIDDEN` otherwise), and `console.setTheme` refuses a viewer session.
95
+
96
+ Last seen: every call a crew token or the console session authenticates marks its lease seen (`leases.last_seen_at`), in the statement that looks the caller up. `fleet.list` and `fleet.ship` answer `lastSeenAt` for a crewed ship (its claim until it calls again), for the viewer ship the last use of its most recent viewer session, and null otherwise. Observation only (ADR 0016): no heartbeat, nothing ends a lease because a ship went quiet. With the aeolus plugin, the watcher's inbox check keeps it fresh about every 25 s.
97
+
98
+ `GET /api/version` answers the versions this process runs, `{ "server": "0.7.0", "common": "0.7.0", "migration": "<latest applied migration>" }` (`migration: null` when the database cannot say). No authentication, no fleet data. The web app's `/version` combines it with its own.
@@ -0,0 +1,14 @@
1
+ import type { InitialiseFleet } from '../../domain/registry/initialise-fleet.js';
2
+ import type { ListFleets } from '../../domain/registry/list-fleets.js';
3
+ import { type CommandIo, type ExitCode } from './io.js';
4
+ /**
5
+ * `fleet:init --name <name>`: asks for the operator's email and password, then
6
+ * creates the fleet, its operator ship argo and the operator account the
7
+ * console signs in with. Refuses when a fleet already exists, before asking
8
+ * anything; the use case checks again under its lock, for two runs at once.
9
+ */
10
+ export declare function fleetInit(args: string[], deps: {
11
+ initialiseFleet: InitialiseFleet;
12
+ listFleets: ListFleets;
13
+ io: CommandIo;
14
+ }): Promise<ExitCode>;
@@ -0,0 +1,68 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { askNewPassword, nulRefusal } from './io.js';
3
+ const NOTHING_CREATED = 'Nothing was created.';
4
+ const USAGE = 'Usage: aeolus-core fleet:init --name "<fleet name>"';
5
+ /**
6
+ * `fleet:init --name <name>`: asks for the operator's email and password, then
7
+ * creates the fleet, its operator ship argo and the operator account the
8
+ * console signs in with. Refuses when a fleet already exists, before asking
9
+ * anything; the use case checks again under its lock, for two runs at once.
10
+ */
11
+ export async function fleetInit(args, deps) {
12
+ const { io } = deps;
13
+ let name;
14
+ try {
15
+ ({ name } = parseArgs({ args, options: { name: { type: 'string' } }, strict: true }).values);
16
+ }
17
+ catch (error) {
18
+ io.err(`${error instanceof Error ? error.message : String(error)}\n${USAGE}`);
19
+ return 2;
20
+ }
21
+ if (name === undefined) {
22
+ io.err(`fleet:init needs the fleet's name.\n${USAGE}`);
23
+ return 2;
24
+ }
25
+ const nameRefusal = nulRefusal([{ name: 'fleet name', text: name }], NOTHING_CREATED);
26
+ if (nameRefusal !== undefined) {
27
+ io.err(nameRefusal);
28
+ return 1;
29
+ }
30
+ if ((await deps.listFleets()).length > 0) {
31
+ io.err(`A fleet already exists: a fleet is initialised only once. ${NOTHING_CREATED}`);
32
+ return 1;
33
+ }
34
+ const email = await io.ask('Operator email: ');
35
+ const password = email === undefined ? { kind: 'ended' } : await askNewPassword(io, 'Operator password: ');
36
+ if (email === undefined || password.kind === 'ended') {
37
+ io.err('fleet:init needs the operator email and the password twice. Nothing was created.');
38
+ return 2;
39
+ }
40
+ if (password.kind === 'differ') {
41
+ io.err('The two passwords differ. Nothing was created.');
42
+ return 1;
43
+ }
44
+ const answerRefusal = nulRefusal([
45
+ { name: 'operator email', text: email },
46
+ { name: 'operator password', text: password.password },
47
+ ], NOTHING_CREATED);
48
+ if (answerRefusal !== undefined) {
49
+ io.err(answerRefusal);
50
+ return 1;
51
+ }
52
+ const initialised = await deps.initialiseFleet({ name, email, password: password.password });
53
+ if (!initialised.isOk) {
54
+ io.err(initialised.error.message);
55
+ return 1;
56
+ }
57
+ const { fleetId, operatorShipId, operatorId } = initialised.value;
58
+ io.out([
59
+ `Fleet initialised: ${fleetId}`,
60
+ `Operator ship argo: ${operatorShipId}`,
61
+ `Operator account: ${operatorId}`,
62
+ '',
63
+ 'Sign in to the console with the operator email and password: that crews argo.',
64
+ 'If the password is lost, run aeolus-core operator:reset-password on the server.',
65
+ ].join('\n'));
66
+ return 0;
67
+ }
68
+ //# sourceMappingURL=fleet-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fleet-init.js","sourceRoot":"","sources":["../../../src/adapters/cli/fleet-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAiC,MAAM,SAAS,CAAC;AAEpF,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,MAAM,KAAK,GAAG,qDAAqD,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAc,EACd,IAAiF;IAEjF,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAEpB,IAAI,IAAwB,CAAC;IAC7B,IAAI,CAAC;QACH,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,EAAE,CAAC,GAAG,CAAC,uCAAuC,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;IACtF,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzC,EAAE,CAAC,GAAG,CAAC,6DAA6D,eAAe,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAgB,EAAE,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC;IACpH,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACrD,EAAE,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;QAC3F,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/B,EAAE,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QACzD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,aAAa,GAAG,UAAU,CAC9B;QACE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE;QACvC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;KACvD,EACD,eAAe,CAChB,CAAC;IACF,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7F,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC;IAClE,EAAE,CAAC,GAAG,CACJ;QACE,sBAAsB,OAAO,EAAE;QAC/B,uBAAuB,cAAc,EAAE;QACvC,qBAAqB,UAAU,EAAE;QACjC,EAAE;QACF,+EAA+E;QAC/E,iFAAiF;KAClF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Where a server command talks to the operator: standard output for results
3
+ * and questions, standard error for problems, standard input for answers.
4
+ */
5
+ export interface CommandIo {
6
+ out(text: string): void;
7
+ err(text: string): void;
8
+ /** Asks and waits for one line. Undefined when the input ends first. A hidden answer is not shown as it is typed. */
9
+ ask(question: string, options?: {
10
+ isHidden?: boolean;
11
+ }): Promise<string | undefined>;
12
+ }
13
+ /** Exit codes: 0 done, 1 refused by the domain or the installation, 2 wrong usage. */
14
+ export type ExitCode = 0 | 1 | 2;
15
+ export type NewPassword = {
16
+ kind: 'given';
17
+ password: string;
18
+ } | {
19
+ kind: 'differ';
20
+ } | {
21
+ kind: 'ended';
22
+ };
23
+ /**
24
+ * Asks for a new password twice, without showing it. `differ` when the two
25
+ * answers differ, `ended` when the input ends first.
26
+ */
27
+ export declare function askNewPassword(io: CommandIo, question: string): Promise<NewPassword>;
28
+ /**
29
+ * Postgres text can never store the character U+0000, so a command refuses
30
+ * it as the API does, naming what holds it. Undefined when no text does.
31
+ */
32
+ export declare function nulRefusal(texts: readonly {
33
+ name: string;
34
+ text: string;
35
+ }[], outcome: string): string | undefined;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Asks for a new password twice, without showing it. `differ` when the two
3
+ * answers differ, `ended` when the input ends first.
4
+ */
5
+ export async function askNewPassword(io, question) {
6
+ const password = await io.ask(question, { isHidden: true });
7
+ const repeated = await io.ask('Repeat the password: ', { isHidden: true });
8
+ if (password === undefined || repeated === undefined) {
9
+ return { kind: 'ended' };
10
+ }
11
+ return password === repeated ? { kind: 'given', password } : { kind: 'differ' };
12
+ }
13
+ /**
14
+ * Postgres text can never store the character U+0000, so a command refuses
15
+ * it as the API does, naming what holds it. Undefined when no text does.
16
+ */
17
+ export function nulRefusal(texts, outcome) {
18
+ const holding = texts.find(({ text }) => text.includes('\u0000'));
19
+ return holding && `The ${holding.name} cannot hold the character U+0000 (NUL). ${outcome}`;
20
+ }
21
+ //# sourceMappingURL=io.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/adapters/cli/io.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAa,EAAE,QAAgB;IAClE,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACrD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAgD,EAAE,OAAe;IAC1F,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClE,OAAO,OAAO,IAAI,OAAO,OAAO,CAAC,IAAI,4CAA4C,OAAO,EAAE,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { CommandIo, ExitCode } from './io.js';
2
+ /**
3
+ * `aeolus-core migrate`: applies the migrations this package ships. Needs
4
+ * DATABASE_URL alone. `start` migrates too; this runs it on its own, such as
5
+ * before a start in a deploy.
6
+ */
7
+ export declare function migrate(deps: {
8
+ environment: Record<string, string | undefined>;
9
+ migrateDatabase: (databaseUrl: string) => Promise<void>;
10
+ io: CommandIo;
11
+ }): Promise<ExitCode>;
@@ -0,0 +1,12 @@
1
+ import { loadDatabaseUrl } from '../../config.js';
2
+ /**
3
+ * `aeolus-core migrate`: applies the migrations this package ships. Needs
4
+ * DATABASE_URL alone. `start` migrates too; this runs it on its own, such as
5
+ * before a start in a deploy.
6
+ */
7
+ export async function migrate(deps) {
8
+ await deps.migrateDatabase(loadDatabaseUrl(deps.environment));
9
+ deps.io.out('The database is migrated.');
10
+ return 0;
11
+ }
12
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/adapters/cli/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAI7B;IACC,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ResetOperatorPassword } from '../../domain/identity/reset-operator-password.js';
2
+ import type { ListFleets } from '../../domain/registry/list-fleets.js';
3
+ import { type CommandIo, type ExitCode } from './io.js';
4
+ /**
5
+ * `operator:reset-password`: asks for a new operator password, sets it, and
6
+ * ends every console session. v1 hosts one fleet, so it acts on that one.
7
+ */
8
+ export declare function operatorResetPassword(args: string[], deps: {
9
+ listFleets: ListFleets;
10
+ resetOperatorPassword: ResetOperatorPassword;
11
+ io: CommandIo;
12
+ }): Promise<ExitCode>;
@@ -0,0 +1,49 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { askNewPassword, nulRefusal } from './io.js';
3
+ const USAGE = 'Usage: aeolus-core operator:reset-password';
4
+ /**
5
+ * `operator:reset-password`: asks for a new operator password, sets it, and
6
+ * ends every console session. v1 hosts one fleet, so it acts on that one.
7
+ */
8
+ export async function operatorResetPassword(args, deps) {
9
+ const { io } = deps;
10
+ try {
11
+ parseArgs({ args, options: {}, strict: true });
12
+ }
13
+ catch (error) {
14
+ io.err(`${error instanceof Error ? error.message : String(error)}\n${USAGE}`);
15
+ return 2;
16
+ }
17
+ const fleets = await deps.listFleets();
18
+ const [fleet] = fleets;
19
+ if (!fleet) {
20
+ io.err('There is no fleet yet. Run fleet:init first.');
21
+ return 1;
22
+ }
23
+ if (fleets.length > 1) {
24
+ io.err(`This installation hosts ${String(fleets.length)} fleets; operator:reset-password handles one.`);
25
+ return 1;
26
+ }
27
+ const password = await askNewPassword(io, 'New operator password: ');
28
+ if (password.kind === 'ended') {
29
+ io.err('operator:reset-password needs the new password twice. Nothing was changed.');
30
+ return 2;
31
+ }
32
+ if (password.kind === 'differ') {
33
+ io.err('The two passwords differ. Nothing was changed.');
34
+ return 1;
35
+ }
36
+ const refusal = nulRefusal([{ name: 'operator password', text: password.password }], 'Nothing was changed.');
37
+ if (refusal !== undefined) {
38
+ io.err(refusal);
39
+ return 1;
40
+ }
41
+ const reset = await deps.resetOperatorPassword({ fleetId: fleet.id, password: password.password });
42
+ if (!reset.isOk) {
43
+ io.err(reset.error.message);
44
+ return 1;
45
+ }
46
+ io.out(`The operator password for fleet ${fleet.id} is reset. Every console session has ended: sign in with the new password.`);
47
+ return 0;
48
+ }
49
+ //# sourceMappingURL=operator-reset-password.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-reset-password.js","sourceRoot":"","sources":["../../../src/adapters/cli/operator-reset-password.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAiC,MAAM,SAAS,CAAC;AAEpF,MAAM,KAAK,GAAG,4CAA4C,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAc,EACd,IAA6F;IAE7F,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;IAEpB,IAAI,CAAC;QACH,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QACvD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,EAAE,CAAC,GAAG,CAAC,2BAA2B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAAC;QACxG,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;IACrE,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9B,EAAE,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;QACrF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/B,EAAE,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;QACzD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAC7G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAChB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChB,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IAED,EAAE,CAAC,GAAG,CACJ,mCAAmC,KAAK,CAAC,EAAE,4EAA4E,CACxH,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type UseCases } from '../../wiring.js';
2
+ import type { CommandIo, ExitCode } from './io.js';
3
+ /**
4
+ * Runs a server command at the operator's terminal and exits with its code.
5
+ * A bad configuration or a failed migration is told in its own words; any
6
+ * other failure as `describeFailure` tells it, a database error by its codes.
7
+ */
8
+ export declare function runAtTerminal(command: (io: CommandIo) => Promise<ExitCode>): Promise<never>;
9
+ /** Runs a server command against the configured database and exits with its code. */
10
+ export declare function runCommand(args: string[], command: (run: {
11
+ args: string[];
12
+ useCases: UseCases;
13
+ io: CommandIo;
14
+ }) => Promise<ExitCode>): Promise<never>;
@@ -0,0 +1,40 @@
1
+ import { ConfigError, loadConfig } from '../../config.js';
2
+ import { createUseCases } from '../../wiring.js';
3
+ import { createPrismaClient } from '../prisma/client.js';
4
+ import { describeFailure } from '../prisma/failure-log.js';
5
+ import { MigrationError } from '../prisma/migrate.js';
6
+ import { terminalIo } from './terminal.js';
7
+ /**
8
+ * Runs a server command at the operator's terminal and exits with its code.
9
+ * A bad configuration or a failed migration is told in its own words; any
10
+ * other failure as `describeFailure` tells it, a database error by its codes.
11
+ */
12
+ export async function runAtTerminal(command) {
13
+ const io = terminalIo({ input: process.stdin, output: process.stdout, errors: process.stderr });
14
+ let code;
15
+ try {
16
+ code = await command(io);
17
+ }
18
+ catch (error) {
19
+ io.err(error instanceof ConfigError || error instanceof MigrationError ? error.message : describeFailure(error));
20
+ code = 1;
21
+ }
22
+ finally {
23
+ io.close();
24
+ }
25
+ process.exit(code);
26
+ }
27
+ /** Runs a server command against the configured database and exits with its code. */
28
+ export function runCommand(args, command) {
29
+ return runAtTerminal(async (io) => {
30
+ const config = loadConfig(process.env);
31
+ const prisma = createPrismaClient(config.databaseUrl);
32
+ try {
33
+ return await command({ args, useCases: createUseCases({ prisma }), io });
34
+ }
35
+ finally {
36
+ await prisma.$disconnect();
37
+ }
38
+ });
39
+ }
40
+ //# sourceMappingURL=run.js.map