@aeolus-fleet/core 0.33.0 → 0.35.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 (390) hide show
  1. package/README.md +29 -4
  2. package/dist/adapters/cli/fleet-api.d.ts +33 -0
  3. package/dist/adapters/cli/fleet-api.js +64 -0
  4. package/dist/adapters/cli/fleet-api.js.map +1 -0
  5. package/dist/adapters/cli/fleet-recover-keys.d.ts +22 -0
  6. package/dist/adapters/cli/fleet-recover-keys.js +81 -0
  7. package/dist/adapters/cli/fleet-recover-keys.js.map +1 -0
  8. package/dist/adapters/cli/run.js +1 -1
  9. package/dist/adapters/cli/run.js.map +1 -1
  10. package/dist/adapters/crypto/age-recovery-identity.d.ts +9 -0
  11. package/dist/adapters/crypto/age-recovery-identity.js +45 -0
  12. package/dist/adapters/crypto/age-recovery-identity.js.map +1 -0
  13. package/dist/adapters/crypto/age-recovery-keys.d.ts +2 -0
  14. package/dist/adapters/crypto/age-recovery-keys.js +36 -0
  15. package/dist/adapters/crypto/age-recovery-keys.js.map +1 -0
  16. package/dist/adapters/crypto/payload-sealer.d.ts +2 -0
  17. package/dist/adapters/crypto/payload-sealer.js +48 -0
  18. package/dist/adapters/crypto/payload-sealer.js.map +1 -0
  19. package/dist/adapters/kms/aws-kms-key-vault.d.ts +13 -0
  20. package/dist/adapters/kms/aws-kms-key-vault.js +98 -0
  21. package/dist/adapters/kms/aws-kms-key-vault.js.map +1 -0
  22. package/dist/adapters/kms/company-key-vault.d.ts +9 -0
  23. package/dist/adapters/kms/company-key-vault.js +14 -0
  24. package/dist/adapters/kms/company-key-vault.js.map +1 -0
  25. package/dist/adapters/kms/no-key-vault.d.ts +7 -0
  26. package/dist/adapters/kms/no-key-vault.js +11 -0
  27. package/dist/adapters/kms/no-key-vault.js.map +1 -0
  28. package/dist/adapters/prisma/alerts.d.ts +21 -0
  29. package/dist/adapters/prisma/alerts.js +61 -0
  30. package/dist/adapters/prisma/alerts.js.map +1 -0
  31. package/dist/adapters/prisma/expectations.d.ts +19 -0
  32. package/dist/adapters/prisma/expectations.js +46 -0
  33. package/dist/adapters/prisma/expectations.js.map +1 -0
  34. package/dist/adapters/prisma/feature-flags.d.ts +7 -0
  35. package/dist/adapters/prisma/feature-flags.js +29 -0
  36. package/dist/adapters/prisma/feature-flags.js.map +1 -0
  37. package/dist/adapters/prisma/generated/browser.d.ts +34 -2
  38. package/dist/adapters/prisma/generated/client.d.ts +34 -2
  39. package/dist/adapters/prisma/generated/commonInputTypes.d.ts +217 -97
  40. package/dist/adapters/prisma/generated/enums.d.ts +12 -0
  41. package/dist/adapters/prisma/generated/enums.js +10 -0
  42. package/dist/adapters/prisma/generated/enums.js.map +1 -1
  43. package/dist/adapters/prisma/generated/internal/class.d.ts +44 -0
  44. package/dist/adapters/prisma/generated/internal/class.js +4 -4
  45. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  46. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +399 -1
  47. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +72 -2
  48. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
  49. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +74 -0
  50. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +72 -2
  51. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
  52. package/dist/adapters/prisma/generated/models/Alert.d.ts +1527 -0
  53. package/dist/adapters/prisma/generated/models/Alert.js +2 -0
  54. package/dist/adapters/prisma/generated/models/Alert.js.map +1 -0
  55. package/dist/adapters/prisma/generated/models/DataKey.d.ts +1503 -0
  56. package/dist/adapters/prisma/generated/models/DataKey.js +2 -0
  57. package/dist/adapters/prisma/generated/models/DataKey.js.map +1 -0
  58. package/dist/adapters/prisma/generated/models/Fleet.d.ts +3644 -221
  59. package/dist/adapters/prisma/generated/models/FleetFeatureFlag.d.ts +1117 -0
  60. package/dist/adapters/prisma/generated/models/FleetFeatureFlag.js +2 -0
  61. package/dist/adapters/prisma/generated/models/FleetFeatureFlag.js.map +1 -0
  62. package/dist/adapters/prisma/generated/models/Lease.d.ts +509 -9
  63. package/dist/adapters/prisma/generated/models/Message.d.ts +729 -63
  64. package/dist/adapters/prisma/generated/models/MessageDay.d.ts +1 -5
  65. package/dist/adapters/prisma/generated/models/Schedule.d.ts +657 -50
  66. package/dist/adapters/prisma/generated/models/Ship.d.ts +939 -4
  67. package/dist/adapters/prisma/generated/models/ShipExpectations.d.ts +1468 -0
  68. package/dist/adapters/prisma/generated/models/ShipExpectations.js +2 -0
  69. package/dist/adapters/prisma/generated/models/ShipExpectations.js.map +1 -0
  70. package/dist/adapters/prisma/generated/models.d.ts +4 -0
  71. package/dist/adapters/prisma/history-pruner.js +27 -4
  72. package/dist/adapters/prisma/history-pruner.js.map +1 -1
  73. package/dist/adapters/prisma/history.d.ts +2 -2
  74. package/dist/adapters/prisma/history.js +14 -9
  75. package/dist/adapters/prisma/history.js.map +1 -1
  76. package/dist/adapters/prisma/installation.js +14 -3
  77. package/dist/adapters/prisma/installation.js.map +1 -1
  78. package/dist/adapters/prisma/messaging.js +5 -3
  79. package/dist/adapters/prisma/messaging.js.map +1 -1
  80. package/dist/adapters/prisma/overdue.js +1 -1
  81. package/dist/adapters/prisma/registry.d.ts +2 -1
  82. package/dist/adapters/prisma/registry.js +68 -14
  83. package/dist/adapters/prisma/registry.js.map +1 -1
  84. package/dist/adapters/prisma/rows.d.ts +14 -0
  85. package/dist/adapters/prisma/rows.js +65 -6
  86. package/dist/adapters/prisma/rows.js.map +1 -1
  87. package/dist/adapters/prisma/schedules.d.ts +3 -0
  88. package/dist/adapters/prisma/schedules.js +5 -4
  89. package/dist/adapters/prisma/schedules.js.map +1 -1
  90. package/dist/adapters/prisma/sealings.d.ts +4 -0
  91. package/dist/adapters/prisma/sealings.js +211 -0
  92. package/dist/adapters/prisma/sealings.js.map +1 -0
  93. package/dist/adapters/prisma/unit-of-work.d.ts +6 -2
  94. package/dist/adapters/prisma/unit-of-work.js +8 -0
  95. package/dist/adapters/prisma/unit-of-work.js.map +1 -1
  96. package/dist/adapters/trpc/alert-output.d.ts +4 -0
  97. package/dist/adapters/trpc/alert-output.js +15 -0
  98. package/dist/adapters/trpc/alert-output.js.map +1 -0
  99. package/dist/adapters/trpc/console.d.ts +13 -1
  100. package/dist/adapters/trpc/console.js +6 -3
  101. package/dist/adapters/trpc/console.js.map +1 -1
  102. package/dist/adapters/trpc/context.d.ts +28 -0
  103. package/dist/adapters/trpc/fleet.d.ts +626 -5
  104. package/dist/adapters/trpc/fleet.js +235 -20
  105. package/dist/adapters/trpc/fleet.js.map +1 -1
  106. package/dist/adapters/trpc/installation.d.ts +138 -2
  107. package/dist/adapters/trpc/installation.js +19 -3
  108. package/dist/adapters/trpc/installation.js.map +1 -1
  109. package/dist/adapters/trpc/listed-payload.d.ts +9 -0
  110. package/dist/adapters/trpc/listed-payload.js +8 -0
  111. package/dist/adapters/trpc/listed-payload.js.map +1 -0
  112. package/dist/adapters/trpc/router.d.ts +793 -4
  113. package/dist/adapters/trpc/ship-contract.js +6 -0
  114. package/dist/adapters/trpc/ship-contract.js.map +1 -1
  115. package/dist/adapters/trpc/ship-protocol.js +1 -1
  116. package/dist/adapters/trpc/ship-protocol.js.map +1 -1
  117. package/dist/adapters/trpc/ship.d.ts +49 -3
  118. package/dist/adapters/trpc/ship.js +13 -8
  119. package/dist/adapters/trpc/ship.js.map +1 -1
  120. package/dist/adapters/trpc/starting-prompt-text.js +2 -1
  121. package/dist/adapters/trpc/starting-prompt-text.js.map +1 -1
  122. package/dist/adapters/trpc/system.d.ts +10 -0
  123. package/dist/adapters/trpc/trpc.d.ts +15 -3
  124. package/dist/adapters/trpc/trpc.js +35 -6
  125. package/dist/adapters/trpc/trpc.js.map +1 -1
  126. package/dist/app.d.ts +3 -0
  127. package/dist/app.js +11 -1
  128. package/dist/app.js.map +1 -1
  129. package/dist/bin/aeolus-core.js +8 -1
  130. package/dist/bin/aeolus-core.js.map +1 -1
  131. package/dist/config.d.ts +11 -0
  132. package/dist/config.js +8 -2
  133. package/dist/config.js.map +1 -1
  134. package/dist/domain/messaging/add-to-meeting.d.ts +6 -2
  135. package/dist/domain/messaging/add-to-meeting.js +7 -4
  136. package/dist/domain/messaging/add-to-meeting.js.map +1 -1
  137. package/dist/domain/messaging/change-company-key.d.ts +46 -0
  138. package/dist/domain/messaging/change-company-key.js +74 -0
  139. package/dist/domain/messaging/change-company-key.js.map +1 -0
  140. package/dist/domain/messaging/change-meeting.d.ts +6 -2
  141. package/dist/domain/messaging/change-meeting.js +6 -4
  142. package/dist/domain/messaging/change-meeting.js.map +1 -1
  143. package/dist/domain/messaging/change-mic.d.ts +6 -1
  144. package/dist/domain/messaging/change-mic.js +6 -3
  145. package/dist/domain/messaging/change-mic.js.map +1 -1
  146. package/dist/domain/messaging/change-recovery-key.d.ts +45 -0
  147. package/dist/domain/messaging/change-recovery-key.js +68 -0
  148. package/dist/domain/messaging/change-recovery-key.js.map +1 -0
  149. package/dist/domain/messaging/company-key-check.d.ts +20 -0
  150. package/dist/domain/messaging/company-key-check.js +31 -0
  151. package/dist/domain/messaging/company-key-check.js.map +1 -0
  152. package/dist/domain/messaging/data-keys.d.ts +165 -0
  153. package/dist/domain/messaging/data-keys.js +275 -0
  154. package/dist/domain/messaging/data-keys.js.map +1 -0
  155. package/dist/domain/messaging/fleet-sealing.d.ts +75 -0
  156. package/dist/domain/messaging/fleet-sealing.js +21 -0
  157. package/dist/domain/messaging/fleet-sealing.js.map +1 -0
  158. package/dist/domain/messaging/key-unavailable.d.ts +5 -0
  159. package/dist/domain/messaging/key-unavailable.js +14 -0
  160. package/dist/domain/messaging/key-unavailable.js.map +1 -0
  161. package/dist/domain/messaging/key-vault.d.ts +61 -0
  162. package/dist/domain/messaging/key-vault.js +2 -0
  163. package/dist/domain/messaging/key-vault.js.map +1 -0
  164. package/dist/domain/messaging/meeting-notice.d.ts +15 -13
  165. package/dist/domain/messaging/meeting-notice.js +12 -3
  166. package/dist/domain/messaging/meeting-notice.js.map +1 -1
  167. package/dist/domain/messaging/message.d.ts +22 -5
  168. package/dist/domain/messaging/message.js +19 -5
  169. package/dist/domain/messaging/message.js.map +1 -1
  170. package/dist/domain/messaging/open-meeting.d.ts +8 -2
  171. package/dist/domain/messaging/open-meeting.js +6 -1
  172. package/dist/domain/messaging/open-meeting.js.map +1 -1
  173. package/dist/domain/messaging/overdue.d.ts +4 -1
  174. package/dist/domain/messaging/overdue.js +3 -3
  175. package/dist/domain/messaging/overdue.js.map +1 -1
  176. package/dist/domain/messaging/payload-sealer.d.ts +39 -0
  177. package/dist/domain/messaging/payload-sealer.js +2 -0
  178. package/dist/domain/messaging/payload-sealer.js.map +1 -0
  179. package/dist/domain/messaging/payload.d.ts +1 -1
  180. package/dist/domain/messaging/payload.js +2 -2
  181. package/dist/domain/messaging/payload.js.map +1 -1
  182. package/dist/domain/messaging/ping-ship.d.ts +4 -1
  183. package/dist/domain/messaging/ping-ship.js +6 -4
  184. package/dist/domain/messaging/ping-ship.js.map +1 -1
  185. package/dist/domain/messaging/ports.d.ts +98 -1
  186. package/dist/domain/messaging/public.d.ts +4 -1
  187. package/dist/domain/messaging/public.js +2 -0
  188. package/dist/domain/messaging/public.js.map +1 -1
  189. package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -0
  190. package/dist/domain/messaging/push-receive-deliveries.js +8 -2
  191. package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
  192. package/dist/domain/messaging/read-delivery.d.ts +6 -2
  193. package/dist/domain/messaging/read-delivery.js +7 -4
  194. package/dist/domain/messaging/read-delivery.js.map +1 -1
  195. package/dist/domain/messaging/read-meeting.d.ts +9 -3
  196. package/dist/domain/messaging/read-meeting.js +11 -4
  197. package/dist/domain/messaging/read-meeting.js.map +1 -1
  198. package/dist/domain/messaging/read-recovery-set.d.ts +34 -0
  199. package/dist/domain/messaging/read-recovery-set.js +43 -0
  200. package/dist/domain/messaging/read-recovery-set.js.map +1 -0
  201. package/dist/domain/messaging/read-sealing.d.ts +30 -0
  202. package/dist/domain/messaging/read-sealing.js +28 -0
  203. package/dist/domain/messaging/read-sealing.js.map +1 -0
  204. package/dist/domain/messaging/receive-deliveries.d.ts +18 -6
  205. package/dist/domain/messaging/receive-deliveries.js +18 -6
  206. package/dist/domain/messaging/receive-deliveries.js.map +1 -1
  207. package/dist/domain/messaging/receive-reply.d.ts +2 -0
  208. package/dist/domain/messaging/receive-reply.js +2 -1
  209. package/dist/domain/messaging/receive-reply.js.map +1 -1
  210. package/dist/domain/messaging/recover-keys.d.ts +56 -0
  211. package/dist/domain/messaging/recover-keys.js +83 -0
  212. package/dist/domain/messaging/recover-keys.js.map +1 -0
  213. package/dist/domain/messaging/recovery-key.d.ts +25 -0
  214. package/dist/domain/messaging/recovery-key.js +14 -0
  215. package/dist/domain/messaging/recovery-key.js.map +1 -0
  216. package/dist/domain/messaging/reply-to-message.d.ts +2 -0
  217. package/dist/domain/messaging/reply-to-message.js +4 -3
  218. package/dist/domain/messaging/reply-to-message.js.map +1 -1
  219. package/dist/domain/messaging/resend-delivery.d.ts +9 -2
  220. package/dist/domain/messaging/resend-delivery.js +26 -6
  221. package/dist/domain/messaging/resend-delivery.js.map +1 -1
  222. package/dist/domain/messaging/retired-participant.d.ts +5 -2
  223. package/dist/domain/messaging/retired-participant.js +2 -1
  224. package/dist/domain/messaging/retired-participant.js.map +1 -1
  225. package/dist/domain/messaging/rotate-data-keys.d.ts +33 -0
  226. package/dist/domain/messaging/rotate-data-keys.js +52 -0
  227. package/dist/domain/messaging/rotate-data-keys.js.map +1 -0
  228. package/dist/domain/messaging/schedule-message.d.ts +10 -2
  229. package/dist/domain/messaging/schedule-message.js +43 -15
  230. package/dist/domain/messaging/schedule-message.js.map +1 -1
  231. package/dist/domain/messaging/schedule.d.ts +18 -1
  232. package/dist/domain/messaging/schedule.js +15 -0
  233. package/dist/domain/messaging/schedule.js.map +1 -1
  234. package/dist/domain/messaging/seal-stored-payloads.d.ts +45 -0
  235. package/dist/domain/messaging/seal-stored-payloads.js +122 -0
  236. package/dist/domain/messaging/seal-stored-payloads.js.map +1 -0
  237. package/dist/domain/messaging/sealed-payload.d.ts +9 -0
  238. package/dist/domain/messaging/sealed-payload.js +15 -0
  239. package/dist/domain/messaging/sealed-payload.js.map +1 -0
  240. package/dist/domain/messaging/send-due-schedules.d.ts +6 -0
  241. package/dist/domain/messaging/send-due-schedules.js +63 -16
  242. package/dist/domain/messaging/send-due-schedules.js.map +1 -1
  243. package/dist/domain/messaging/send-message.d.ts +21 -7
  244. package/dist/domain/messaging/send-message.js +52 -19
  245. package/dist/domain/messaging/send-message.js.map +1 -1
  246. package/dist/domain/messaging/send-request.d.ts +4 -2
  247. package/dist/domain/messaging/send-request.js +3 -2
  248. package/dist/domain/messaging/send-request.js.map +1 -1
  249. package/dist/domain/messaging/turn-on-sealing.d.ts +61 -0
  250. package/dist/domain/messaging/turn-on-sealing.js +76 -0
  251. package/dist/domain/messaging/turn-on-sealing.js.map +1 -0
  252. package/dist/domain/registry/alert.d.ts +75 -0
  253. package/dist/domain/registry/alert.js +71 -0
  254. package/dist/domain/registry/alert.js.map +1 -0
  255. package/dist/domain/registry/claim-ship.d.ts +2 -1
  256. package/dist/domain/registry/claim-ship.js +1 -1
  257. package/dist/domain/registry/claim-ship.js.map +1 -1
  258. package/dist/domain/registry/clear-alert.d.ts +32 -0
  259. package/dist/domain/registry/clear-alert.js +40 -0
  260. package/dist/domain/registry/clear-alert.js.map +1 -0
  261. package/dist/domain/registry/create-fleet.d.ts +7 -3
  262. package/dist/domain/registry/create-fleet.js +9 -2
  263. package/dist/domain/registry/create-fleet.js.map +1 -1
  264. package/dist/domain/registry/crew-request.d.ts +9 -0
  265. package/dist/domain/registry/crew-request.js +7 -0
  266. package/dist/domain/registry/crew-request.js.map +1 -1
  267. package/dist/domain/registry/expectations.d.ts +68 -0
  268. package/dist/domain/registry/expectations.js +84 -0
  269. package/dist/domain/registry/expectations.js.map +1 -0
  270. package/dist/domain/registry/feature-flag.d.ts +66 -0
  271. package/dist/domain/registry/feature-flag.js +56 -0
  272. package/dist/domain/registry/feature-flag.js.map +1 -0
  273. package/dist/domain/registry/get-ship.d.ts +11 -1
  274. package/dist/domain/registry/get-ship.js +11 -2
  275. package/dist/domain/registry/get-ship.js.map +1 -1
  276. package/dist/domain/registry/installation-fleet.d.ts +3 -1
  277. package/dist/domain/registry/installation-fleet.js +3 -1
  278. package/dist/domain/registry/installation-fleet.js.map +1 -1
  279. package/dist/domain/registry/lease-activity.d.ts +15 -0
  280. package/dist/domain/registry/lease-activity.js +2 -0
  281. package/dist/domain/registry/lease-activity.js.map +1 -0
  282. package/dist/domain/registry/lease.d.ts +2 -2
  283. package/dist/domain/registry/lease.js +1 -1
  284. package/dist/domain/registry/list-fleet.d.ts +6 -1
  285. package/dist/domain/registry/list-fleet.js +5 -3
  286. package/dist/domain/registry/list-fleet.js.map +1 -1
  287. package/dist/domain/registry/ports.d.ts +75 -1
  288. package/dist/domain/registry/public.d.ts +4 -0
  289. package/dist/domain/registry/public.js +2 -0
  290. package/dist/domain/registry/public.js.map +1 -1
  291. package/dist/domain/registry/raise-alert.d.ts +31 -0
  292. package/dist/domain/registry/raise-alert.js +43 -0
  293. package/dist/domain/registry/raise-alert.js.map +1 -0
  294. package/dist/domain/registry/read-feature-flags.d.ts +16 -0
  295. package/dist/domain/registry/read-feature-flags.js +11 -0
  296. package/dist/domain/registry/read-feature-flags.js.map +1 -0
  297. package/dist/domain/registry/read-open-alerts.d.ts +23 -0
  298. package/dist/domain/registry/read-open-alerts.js +21 -0
  299. package/dist/domain/registry/read-open-alerts.js.map +1 -0
  300. package/dist/domain/registry/report-activity.d.ts +41 -0
  301. package/dist/domain/registry/report-activity.js +43 -0
  302. package/dist/domain/registry/report-activity.js.map +1 -0
  303. package/dist/domain/registry/report-step.d.ts +8 -0
  304. package/dist/domain/registry/report-step.js +16 -0
  305. package/dist/domain/registry/report-step.js.map +1 -0
  306. package/dist/domain/registry/report-task.d.ts +14 -0
  307. package/dist/domain/registry/report-task.js +39 -0
  308. package/dist/domain/registry/report-task.js.map +1 -0
  309. package/dist/domain/registry/report.d.ts +2 -2
  310. package/dist/domain/registry/report.js.map +1 -1
  311. package/dist/domain/registry/retire-ship.d.ts +12 -4
  312. package/dist/domain/registry/retire-ship.js +19 -5
  313. package/dist/domain/registry/retire-ship.js.map +1 -1
  314. package/dist/domain/registry/set-expectations.d.ts +33 -0
  315. package/dist/domain/registry/set-expectations.js +47 -0
  316. package/dist/domain/registry/set-expectations.js.map +1 -0
  317. package/dist/domain/registry/set-feature-flag.d.ts +34 -0
  318. package/dist/domain/registry/set-feature-flag.js +37 -0
  319. package/dist/domain/registry/set-feature-flag.js.map +1 -0
  320. package/dist/domain/registry/ship-report.d.ts +24 -7
  321. package/dist/domain/registry/ship-report.js +41 -5
  322. package/dist/domain/registry/ship-report.js.map +1 -1
  323. package/dist/domain/registry/ship.d.ts +7 -1
  324. package/dist/domain/registry/ship.js +3 -0
  325. package/dist/domain/registry/ship.js.map +1 -1
  326. package/dist/domain/shared/errors.d.ts +1 -1
  327. package/dist/domain/shared/errors.js.map +1 -1
  328. package/dist/domain/shared/history-pruning.d.ts +19 -2
  329. package/dist/domain/shared/history-pruning.js +1 -1
  330. package/dist/domain/shared/history-pruning.js.map +1 -1
  331. package/dist/domain/shared/history.d.ts +24 -22
  332. package/dist/domain/shared/history.js.map +1 -1
  333. package/dist/domain/shared/plain-history.d.ts +45 -0
  334. package/dist/domain/shared/plain-history.js +35 -0
  335. package/dist/domain/shared/plain-history.js.map +1 -0
  336. package/dist/domain/shared/prune-history.d.ts +2 -1
  337. package/dist/domain/shared/prune-history.js +8 -6
  338. package/dist/domain/shared/prune-history.js.map +1 -1
  339. package/dist/domain/shared/read-health.d.ts +14 -3
  340. package/dist/domain/shared/read-health.js +8 -4
  341. package/dist/domain/shared/read-health.js.map +1 -1
  342. package/dist/domain/shared/read-inbox-message.d.ts +7 -2
  343. package/dist/domain/shared/read-inbox-message.js +5 -1
  344. package/dist/domain/shared/read-inbox-message.js.map +1 -1
  345. package/dist/domain/shared/read-inbox-withdrawals.d.ts +9 -3
  346. package/dist/domain/shared/read-inbox-withdrawals.js +7 -3
  347. package/dist/domain/shared/read-inbox-withdrawals.js.map +1 -1
  348. package/dist/domain/shared/read-inbox.d.ts +14 -4
  349. package/dist/domain/shared/read-inbox.js +7 -3
  350. package/dist/domain/shared/read-inbox.js.map +1 -1
  351. package/dist/domain/shared/read-message-deliveries.d.ts +2 -1
  352. package/dist/domain/shared/read-message-deliveries.js +4 -3
  353. package/dist/domain/shared/read-message-deliveries.js.map +1 -1
  354. package/dist/domain/shared/read-message.d.ts +13 -3
  355. package/dist/domain/shared/read-message.js +12 -5
  356. package/dist/domain/shared/read-message.js.map +1 -1
  357. package/dist/domain/shared/read-needs-attention.d.ts +6 -2
  358. package/dist/domain/shared/read-needs-attention.js +7 -5
  359. package/dist/domain/shared/read-needs-attention.js.map +1 -1
  360. package/dist/domain/shared/read-report-tasks.d.ts +10 -0
  361. package/dist/domain/shared/read-report-tasks.js +24 -0
  362. package/dist/domain/shared/read-report-tasks.js.map +1 -0
  363. package/dist/domain/shared/read-ship-messages.d.ts +10 -1
  364. package/dist/domain/shared/read-ship-messages.js +9 -3
  365. package/dist/domain/shared/read-ship-messages.js.map +1 -1
  366. package/dist/start.js +2 -0
  367. package/dist/start.js.map +1 -1
  368. package/dist/testing/container-images.d.ts +13 -6
  369. package/dist/testing/container-images.js +14 -7
  370. package/dist/testing/container-images.js.map +1 -1
  371. package/dist/wiring.d.ts +38 -0
  372. package/dist/wiring.js +69 -20
  373. package/dist/wiring.js.map +1 -1
  374. package/package.json +4 -2
  375. package/src/adapters/prisma/migrations/20261029120000_data_keys/migration.sql +23 -0
  376. package/src/adapters/prisma/migrations/20261029180000_sealed_messages/migration.sql +42 -0
  377. package/src/adapters/prisma/migrations/20261029200000_sealed_schedules/migration.sql +20 -0
  378. package/src/adapters/prisma/migrations/20261030090000_key_availability/migration.sql +18 -0
  379. package/src/adapters/prisma/migrations/20261030120000_keys_scope/migration.sql +64 -0
  380. package/src/adapters/prisma/migrations/20261031090000_recovery_key/migration.sql +11 -0
  381. package/src/adapters/prisma/migrations/20261101090000_sealing_progress/migration.sql +16 -0
  382. package/src/adapters/prisma/migrations/20261102090000_feature_flags/migration.sql +17 -0
  383. package/src/adapters/prisma/migrations/20261103090000_removed_ships/migration.sql +21 -0
  384. package/src/adapters/prisma/migrations/20261104090000_report_task_step/migration.sql +10 -0
  385. package/src/adapters/prisma/migrations/20261105090000_payload_limit_256kb/migration.sql +15 -0
  386. package/src/adapters/prisma/migrations/20261106090000_lease_activity/migration.sql +11 -0
  387. package/src/adapters/prisma/migrations/20261107090000_alert_scope/migration.sql +64 -0
  388. package/src/adapters/prisma/migrations/20261107100000_alerts/migration.sql +33 -0
  389. package/src/adapters/prisma/migrations/20261108090000_ship_expectations/migration.sql +22 -0
  390. package/src/adapters/prisma/schema.prisma +210 -46
@@ -1,5 +1,7 @@
1
- import { cancelScheduleInputSchema, cancelScheduleOutputSchema, pauseScheduleInputSchema, pauseScheduleOutputSchema, fleetSchedulesInputSchema, schedulesOutputSchema, PAGE_SIZE_DEFAULT, PAGE_SIZE_MAX, shipCursorOf, commissionShipInputSchema, commissionShipOutputSchema, dismissDeliveryInputSchema, dismissDeliveryOutputSchema, fleetEventsInputSchema, followFleetInputSchema, followFleetOutputSchema, inboxActionOutputSchema, markDoneInputSchema, markReadInputSchema, fleetLimitsOutputSchema, fleetListOutputSchema, messageDeliveriesInputSchema, messageDeliveriesOutputSchema, messageInputSchema, messageOutputSchema, needsAttentionInputSchema, needsAttentionOutputSchema, healthOutputSchema, acknowledgedSchema, listedShipOutputSchema, shipCountsInputSchema, shipTypesInputSchema, shipTypesOutputSchema, shipCountsOutputSchema, stuckCountOutputSchema, stuckInputSchema, stuckOutputSchema, stuckSummaryOutputSchema, stuckPerHourSchema, operatorInboxInputSchema, inboxMessageInputSchema, inboxMessageSchema, inboxWithdrawalsInputSchema, operatorInboxOutputSchema, inboxCountOutputSchema, pingShipInputSchema, pingShipOutputSchema, shipOutputSchema, isInReadReach, shipInputSchema, shipMessagesInputSchema, shipMessagesOutputSchema, shipWayOutputSchema, shipTimelineInputSchema, shipTimelineOutputSchema, getStartingPromptInputSchema, recrewShipInputSchema, releaseShipInputSchema, releaseShipOutputSchema, assignCrewInputSchema, assignCrewOutputSchema, assignedCrewRequestsOutputSchema, clearRequestsOutputSchema, clearWorktreeInputSchema, clearWorktreeOutputSchema, confirmWorktreeClearedInputSchema, confirmWorktreeClearedOutputSchema, confirmCrewReleaseInputSchema, giveBackCrewRequestInputSchema, giveBackCrewRequestOutputSchema, explainCrewRequestInputSchema, explainCrewRequestOutputSchema, confirmCrewReleaseOutputSchema, crewRequestInputSchema, crewRequestOutputSchema, reportCrewStatusInputSchema, reportCrewStatusOutputSchema, removeCrewRequestInputSchema, removeCrewRequestOutputSchema, renameShipInputSchema, renameShipOutputSchema, replyInputSchema, replyOutputSchema, resendDeliveryInputSchema, resendDeliveryOutputSchema, retireShipInputSchema, retireShipOutputSchema, startingPromptOutputSchema, assignLabelInputSchema, changeLabelValuesInputSchema, changeLabelValuesOutputSchema, declareScopesInputSchema, defineScopeInputSchema, definedScopeOutputSchema, removeScopeInputSchema, removeScopeOutputSchema, declareScopesOutputSchema, grantScopesInputSchema, grantScopesOutputSchema, defineLabelInputSchema, defineLabelOutputSchema, deleteLabelInputSchema, findLabelValueInputSchema, reachRefusalsInputSchema, reachRefusalsOutputSchema, explainReachInputSchema, setOwnerInputSchema, checkManageInputSchema, checkManageOutputSchema, setOwnerOutputSchema, setVerifiedFactsInputSchema, setVerifiedFactsOutputSchema, explainReachOutputSchema, applyNetworkRulesInputSchema, checkNetworkRulesFileInputSchema, checkNetworkRulesFileOutputSchema, importNetworkRulesInputSchema, importNetworkRulesOutputSchema, exportNetworkRulesOutputSchema, discardNetworkRulesDraftOutputSchema, networkRulesDraftChangesOutputSchema, networkRulesOutputSchema, networkVersionOutputSchema, saveNetworkRulesDraftInputSchema, saveNetworkRulesDraftOutputSchema, setBuiltInRuleInputSchema, builtInRulesOutputSchema, declareNetworkRulesInputSchema, declareNetworkRulesOutputSchema, declaredNetworkRulesOutputSchema, findLabelValueOutputSchema, fleetListInputSchema, labelWriteOutputSchema, labelsOutputSchema, scopesOutputSchema, unassignLabelInputSchema, } from '@aeolus-fleet/common';
1
+ import { alertOutputOf } from './alert-output.js';
2
+ import { messageTaskAccessInputSchema, messageTaskAccessOutputSchema, turnOnSealingInputSchema, changeCompanyKeyInputSchema, changeCompanyKeyOutputSchema, changeRecoveryKeyInputSchema, changeRecoveryKeyOutputSchema, recoverySetOutputSchema, recoverKeysInputSchema, recoverKeysOutputSchema, turnOnSealingOutputSchema, sealingOutputSchema, cancelScheduleInputSchema, cancelScheduleOutputSchema, pauseScheduleInputSchema, pauseScheduleOutputSchema, fleetSchedulesInputSchema, schedulesOutputSchema, PAGE_SIZE_DEFAULT, PAGE_SIZE_MAX, shipCursorOf, commissionShipInputSchema, commissionShipOutputSchema, dismissDeliveryInputSchema, dismissDeliveryOutputSchema, fleetEventsInputSchema, followFleetInputSchema, followFleetOutputSchema, inboxActionOutputSchema, markDoneInputSchema, markReadInputSchema, fleetLimitsOutputSchema, fleetListOutputSchema, messageDeliveriesInputSchema, messageDeliveriesOutputSchema, messageInputSchema, messageOutputSchema, needsAttentionInputSchema, needsAttentionOutputSchema, fleetHealthOutputSchema, acknowledgedSchema, listedShipOutputSchema, shipCountsInputSchema, shipTypesInputSchema, shipTypesOutputSchema, shipCountsOutputSchema, stuckCountOutputSchema, stuckInputSchema, stuckOutputSchema, stuckSummaryOutputSchema, stuckPerHourSchema, operatorInboxInputSchema, inboxMessageInputSchema, inboxMessageSchema, inboxWithdrawalsInputSchema, operatorInboxOutputSchema, inboxCountOutputSchema, pingShipInputSchema, pingShipOutputSchema, shipOutputSchema, isInReadReach, shipInputSchema, shipMessagesInputSchema, shipMessagesOutputSchema, shipWayOutputSchema, shipTimelineInputSchema, shipTimelineOutputSchema, getStartingPromptInputSchema, recrewShipInputSchema, releaseShipInputSchema, releaseShipOutputSchema, assignCrewInputSchema, assignCrewOutputSchema, assignedCrewRequestsOutputSchema, clearRequestsOutputSchema, clearWorktreeInputSchema, clearWorktreeOutputSchema, confirmWorktreeClearedInputSchema, confirmWorktreeClearedOutputSchema, confirmCrewReleaseInputSchema, giveBackCrewRequestInputSchema, giveBackCrewRequestOutputSchema, explainCrewRequestInputSchema, explainCrewRequestOutputSchema, confirmCrewReleaseOutputSchema, crewRequestInputSchema, crewRequestOutputSchema, reportActivityInputSchema, reportActivityOutputSchema, reportCrewStatusInputSchema, reportCrewStatusOutputSchema, removeCrewRequestInputSchema, removeCrewRequestOutputSchema, renameShipInputSchema, renameShipOutputSchema, replyInputSchema, replyOutputSchema, resendDeliveryInputSchema, resendDeliveryOutputSchema, retireShipInputSchema, retireShipOutputSchema, startingPromptOutputSchema, assignLabelInputSchema, changeLabelValuesInputSchema, changeLabelValuesOutputSchema, declareScopesInputSchema, defineScopeInputSchema, definedScopeOutputSchema, removeScopeInputSchema, removeScopeOutputSchema, declareScopesOutputSchema, grantScopesInputSchema, grantScopesOutputSchema, defineLabelInputSchema, defineLabelOutputSchema, deleteLabelInputSchema, findLabelValueInputSchema, reachRefusalsInputSchema, reachRefusalsOutputSchema, explainReachInputSchema, setOwnerInputSchema, checkManageInputSchema, checkManageOutputSchema, setOwnerOutputSchema, setVerifiedFactsInputSchema, setExpectationsInputSchema, setExpectationsOutputSchema, raiseAlertInputSchema, clearAlertInputSchema, alertOutputSchema, openAlertsInputSchema, openAlertsOutputSchema, setVerifiedFactsOutputSchema, explainReachOutputSchema, applyNetworkRulesInputSchema, checkNetworkRulesFileInputSchema, checkNetworkRulesFileOutputSchema, importNetworkRulesInputSchema, importNetworkRulesOutputSchema, exportNetworkRulesOutputSchema, discardNetworkRulesDraftOutputSchema, networkRulesDraftChangesOutputSchema, networkRulesOutputSchema, networkVersionOutputSchema, saveNetworkRulesDraftInputSchema, saveNetworkRulesDraftOutputSchema, setBuiltInRuleInputSchema, builtInRulesOutputSchema, declareNetworkRulesInputSchema, declareNetworkRulesOutputSchema, declaredNetworkRulesOutputSchema, findLabelValueOutputSchema, fleetListInputSchema, labelWriteOutputSchema, labelsOutputSchema, scopesOutputSchema, unassignLabelInputSchema, } from '@aeolus-fleet/common';
2
3
  import { tracked } from '@trpc/server';
4
+ import { listedPayloadOutputOf } from './listed-payload.js';
3
5
  import { describedAcknowledged, describedHealth, describedPerHour, describedStuck } from './health.js';
4
6
  import { presentStartingPrompt } from './starting-prompt-text.js';
5
7
  import { schedulesPageOf } from './schedule-output.js';
@@ -24,8 +26,8 @@ function inboxEntryOutputOf(entry) {
24
26
  ...entry,
25
27
  readAt: entry.readAt?.toISOString() ?? null,
26
28
  doneAt: entry.doneAt?.toISOString() ?? null,
27
- replies: entry.replies.map((reply) => ({ ...reply, sentAt: reply.sentAt.toISOString() })),
28
- message: { ...entry.message, sentAt: entry.message.sentAt.toISOString() },
29
+ replies: entry.replies.map((reply) => ({ ...reply, ...listedPayloadOutputOf(reply.payload), sentAt: reply.sentAt.toISOString() })),
30
+ message: { ...entry.message, ...listedPayloadOutputOf(entry.message.payload), sentAt: entry.message.sentAt.toISOString() },
29
31
  };
30
32
  }
31
33
  function wayOutputOf(way) {
@@ -63,7 +65,7 @@ export const fleetRouter = router({
63
65
  "ownerOf, which needs fleet:on-behalf, names the ship that asked it for this one: the new ship gets that ship's owner instead of yours.",
64
66
  'kind is agent unless you state person, app or plugin: a person ship needs fleet:person instead and owns itself, an app ship needs fleet:on-behalf as well, and a plugin ship needs fleet:connect instead, which connects it (decision 0050).',
65
67
  "owner, which needs fleet:on-behalf and only for an app ship, names the owner argo picked for it: a person's ship or argo, never beside ownerOf.",
66
- 'Answers its shipId, its first starting prompt, one crew line per harness (claude-code, codex) and its secret, shown only this once.',
68
+ 'Answers its shipId, its first starting prompt, one crew line per harness (claude-code, codex, copilot) and its secret, shown only this once.',
67
69
  'idempotencyKey is a new unique string for every commission. Reuse one only to retry the same commission after an error or a lost answer:',
68
70
  'the retry answers the same shipId with prompt, crewLines and secret null and how its starting prompt stands (fleet_getStartingPrompt gives a new one), and a different commission with a used key is refused (CONFLICT).',
69
71
  ].join(' '),
@@ -238,6 +240,21 @@ export const fleetRouter = router({
238
240
  okOrThrow(await ctx.useCases.reportCrewStatus(ctx.caller, input));
239
241
  return {};
240
242
  }),
243
+ /** The assigned trierarch writes the activity it observes of the crewed ships it runs (docs/design/monitoring, 4.3). */
244
+ reportActivity: scopedProcedure('crew:run')
245
+ .meta({
246
+ description: [
247
+ "Needs crew:run. Writes, for each crewed ship whose crew request is assigned to yours, its session's latest event: when, its kind (text, tool, result or error) and for a tool call the tool's name, never content.",
248
+ 'State the interval you write at, in seconds: activity reads unknown once your write is older than twice it. Up to 100 ships per call;',
249
+ 'an entry for a ship not assigned to yours, without a crew request or not crewed is refused for that entry, with its code, and the rest are taken.',
250
+ ].join(' '),
251
+ })
252
+ .input(reportActivityInputSchema)
253
+ .output(reportActivityOutputSchema)
254
+ .mutation(async ({ ctx, input }) => {
255
+ const { refused } = okOrThrow(await ctx.useCases.reportActivity(ctx.caller, input));
256
+ return { refused: refused.map(({ shipId, error }) => ({ shipId, code: error.kind, message: error.message })) };
257
+ }),
241
258
  /** The assigned trierarch confirms it released the ship of a releasing request, which then goes (the finalizer). */
242
259
  confirmCrewRelease: scopedProcedure('crew:run')
243
260
  .meta({
@@ -332,6 +349,96 @@ export const fleetRouter = router({
332
349
  okOrThrow(await ctx.useCases.setOwner(ctx.caller, input));
333
350
  return {};
334
351
  }),
352
+ /**
353
+ * Turns sealing on for the fleet (decision 0068, B4): every payload it
354
+ * stores from then on is sealed under a data key its company key wraps,
355
+ * and the sealing pass seals what it stored plain before.
356
+ */
357
+ turnOnSealing: actorScopedProcedure('fleet:keys')
358
+ .input(turnOnSealingInputSchema)
359
+ .output(turnOnSealingOutputSchema)
360
+ .mutation(async ({ ctx, input }) => {
361
+ const turnedOn = okOrThrow(await ctx.useCases.turnOnSealing(ctx.caller, input));
362
+ ctx.log.info({ fleetId: ctx.caller.fleetId, companyKey: turnedOn.companyKey, recoveryKeyFingerprint: turnedOn.recoveryKeyFingerprint, state: turnedOn.state }, 'sealing turned on');
363
+ return turnedOn;
364
+ }),
365
+ /**
366
+ * Moves every data key of the sealed fleet to a new company key (decision
367
+ * 0068, B13c), rewrapped inside the company's KMS; the old key must be
368
+ * reachable. No payload is sealed again.
369
+ */
370
+ changeCompanyKey: actorScopedProcedure('fleet:keys')
371
+ .input(changeCompanyKeyInputSchema)
372
+ .output(changeCompanyKeyOutputSchema)
373
+ .mutation(async ({ ctx, input }) => {
374
+ const changed = okOrThrow(await ctx.useCases.changeCompanyKey(ctx.caller, input));
375
+ ctx.log.info({ fleetId: ctx.caller.fleetId, companyKey: changed.companyKey }, 'company key changed');
376
+ return changed;
377
+ }),
378
+ /**
379
+ * Wraps every data key of the sealed fleet to a new recovery key, or sets
380
+ * one on a fleet sealed without (decision 0068, B13d): an age X25519
381
+ * recipient, the public half of the company's offline key pair. The
382
+ * company key must be reachable. No payload is sealed again.
383
+ */
384
+ changeRecoveryKey: actorScopedProcedure('fleet:keys')
385
+ .input(changeRecoveryKeyInputSchema)
386
+ .output(changeRecoveryKeyOutputSchema)
387
+ .mutation(async ({ ctx, input }) => {
388
+ const changed = okOrThrow(await ctx.useCases.changeRecoveryKey(ctx.caller, input));
389
+ ctx.log.info({ fleetId: ctx.caller.fleetId, recoveryKeyFingerprint: changed.recoveryKeyFingerprint }, 'recovery key changed');
390
+ return changed;
391
+ }),
392
+ /**
393
+ * The sealed fleet's recovery set (decision 0068, B15): each data key
394
+ * wrapped to the recovery key alone, with its check value, for the recovery
395
+ * command on the company's computer. Nothing in it opens with any key
396
+ * Aeolus can use.
397
+ */
398
+ recoverySet: actorScopedProcedure('fleet:keys')
399
+ .output(recoverySetOutputSchema)
400
+ .query(async ({ ctx }) => {
401
+ const set = okOrThrow(await ctx.useCases.readRecoverySet(ctx.caller));
402
+ return {
403
+ ...set,
404
+ dataKeys: set.dataKeys.map(({ id, wrappedByRecoveryKey, checkValue }) => ({ id, wrappedByRecoveryKey: base64Of(wrappedByRecoveryKey), checkValue: base64Of(checkValue) })),
405
+ };
406
+ }),
407
+ /**
408
+ * Recovers the sealed fleet's data keys under a new company key (decision
409
+ * 0068, B15), as the recovery command wrapped them in the company's KMS:
410
+ * every wrap must open to its data key, or nothing changes. No payload is
411
+ * sealed again.
412
+ */
413
+ recoverKeys: actorScopedProcedure('fleet:keys')
414
+ .input(recoverKeysInputSchema)
415
+ .output(recoverKeysOutputSchema)
416
+ .mutation(async ({ ctx, input }) => {
417
+ const dataKeys = input.dataKeys.map(({ id, wrappedByCompanyKey }) => ({ id, wrappedByCompanyKey: new Uint8Array(Buffer.from(wrappedByCompanyKey, 'base64')) }));
418
+ const recovered = okOrThrow(await ctx.useCases.recoverKeys(ctx.caller, { companyKey: input.companyKey, dataKeys }));
419
+ ctx.log.info({ fleetId: ctx.caller.fleetId, companyKey: recovered.companyKey, dataKeys: dataKeys.length }, 'data keys recovered');
420
+ return recovered;
421
+ }),
422
+ /**
423
+ * The fleet's sealing (decision 0068, B5, B11): none, or its state and
424
+ * since when, the sealing pass's progress, its company key by reference, whether that key answered its last unwrap and
425
+ * since when, and its data keys' ages. Never a key.
426
+ */
427
+ sealing: actorScopedProcedure('fleet:read')
428
+ .output(sealingOutputSchema)
429
+ .query(async ({ ctx }) => {
430
+ const sealing = await ctx.useCases.readSealing(ctx.caller);
431
+ if (sealing.state === 'none') {
432
+ return sealing;
433
+ }
434
+ const { since, keyAvailability, dataKeys } = sealing;
435
+ return {
436
+ ...sealing,
437
+ since: since.toISOString(),
438
+ keyAvailability: { ...keyAvailability, since: keyAvailability.since.toISOString() },
439
+ dataKeys: dataKeys.map((dataKey) => ({ ...dataKey, createdAt: dataKey.createdAt.toISOString() })),
440
+ };
441
+ }),
335
442
  /**
336
443
  * Whether the caller manages a ship now, by the rule every fleet:manage
337
444
  * call checks (decision 0034): the gateway asks it as an approver before it
@@ -371,7 +478,7 @@ export const fleetRouter = router({
371
478
  limits: actorScopedProcedure('fleet:read')
372
479
  .meta({
373
480
  description: [
374
- "Needs fleet:read. The fleet's ship limit with its ships that are not retired (argo included), and its daily message limit with the messages it stored since 00:00 UTC and when that count starts again. A limit of null is none. Its retention: the days it keeps its finished history, null for kept for good, and keptFrom, where its kept history begins: older finished history is no longer kept, older open deliveries are; null while nothing was pruned.",
481
+ "Needs fleet:read. The fleet's ship limit with its ships that are not retired (argo included), and its daily message limit with the messages it stored since 00:00 UTC and when that count starts again. A limit of null is none. Its retention: the days it keeps its finished history, null when no retention applies, and keptFrom, where its kept history begins: older finished history is no longer kept, older open deliveries are; null while nothing was pruned.",
375
482
  ].join(' '),
376
483
  })
377
484
  .output(fleetLimitsOutputSchema)
@@ -399,7 +506,8 @@ export const fleetRouter = router({
399
506
  .output(fleetListOutputSchema)
400
507
  .query(async ({ ctx, input }) => {
401
508
  const { ships, nextCursor } = await ctx.useCases.listFleet(ctx.caller, input);
402
- return { items: ships.map((ship) => (isInReadReach(ship) ? listedShipOutputOf(ship) : ship)), nextCursor: nextCursor && shipCursorOf(nextCursor) };
509
+ const tasks = await ctx.useCases.readReportTasks(ctx.caller, ships.map((ship) => isInReadReach(ship) ? ship.report?.task ?? null : null));
510
+ return { items: ships.map((ship, index) => (isInReadReach(ship) ? listedShipOutputOf(ship, { canOpen: tasks[index]?.canOpen === true, fleetName: null }) : ship)), nextCursor: nextCursor && shipCursorOf(nextCursor) };
403
511
  }),
404
512
  /** The fleet's labels, each with its values and its owner (decision 0031). */
405
513
  labels: actorScopedProcedure('fleet:read')
@@ -499,6 +607,48 @@ export const fleetRouter = router({
499
607
  okOrThrow(await ctx.useCases.setVerifiedFacts(ctx.caller, input));
500
608
  return {};
501
609
  }),
610
+ /** Sets the expectations on a ship within the caller's manage reach (decision 0071). */
611
+ setExpectations: actorScopedProcedure('fleet:manage')
612
+ .meta({
613
+ description: [
614
+ "Needs fleet:manage, and manage reach on the ship (decision 0071): the owner's ship for the ships it owns, any other ship by a manage rule that reaches the ship.",
615
+ 'Sets what you expect of the ship, standing: reportChangesWithin, minutes (5 to 10080) within which its report changes while it says working or blocked; taskDoneBy, the task (as a report names it, a kind and its fields) and the time it is expected done by, lapsing once the report names another task.',
616
+ "Left out, one stays as it is; null clears it. Each names who set it. The fleet compares nothing and the crew is not told: once one breaks, the watch tells the ship's owner, and the ship that set it.",
617
+ 'Read them back with fleet_ship. They stay through a release and a recrew; a retire removes them. A retired ship is CONFLICT.',
618
+ ].join(' '),
619
+ })
620
+ .input(setExpectationsInputSchema)
621
+ .output(setExpectationsOutputSchema)
622
+ .mutation(async ({ ctx, input: { taskDoneBy, ...input } }) => {
623
+ okOrThrow(await ctx.useCases.setExpectations(ctx.caller, {
624
+ ...input,
625
+ ...(taskDoneBy !== undefined && { taskDoneBy: taskDoneBy && { task: taskDoneBy.task, doneBy: new Date(taskDoneBy.doneBy) } }),
626
+ }));
627
+ return {};
628
+ }),
629
+ /** Raises an alert on a ship the caller reads, once per occurrence (decision 0071). */
630
+ raiseAlert: actorScopedProcedure('fleet:alert')
631
+ .meta({
632
+ description: [
633
+ 'Needs fleet:alert, and read reach on the ship (decision 0071). Raises an alert on a ship that is not retired: the signal that parted with its facts at raise, the occurrence it is one of (occurrenceKey, such as the delivery id) and since when the fact parted.',
634
+ "The alert names the ship's owner now, the one to tell. The same ship, signal and occurrenceKey answer the alert already held, open or cleared, and raise none: an occurrence is raised once, so a second pass or a restart raises nothing twice.",
635
+ 'The fleet compares nothing and tells no one: send the owner the alert message (application/vnd.aeolus.alert+json) with the alert id as idempotency key. A retired ship is CONFLICT.',
636
+ ].join(' '),
637
+ })
638
+ .input(raiseAlertInputSchema)
639
+ .output(alertOutputSchema)
640
+ .mutation(async ({ ctx, input }) => alertOutputOf(okOrThrow(await ctx.useCases.raiseAlert(ctx.caller, input)))),
641
+ /** Clears an open alert on a ship the caller reads (decision 0071). */
642
+ clearAlert: actorScopedProcedure('fleet:alert')
643
+ .meta({
644
+ description: [
645
+ 'Needs fleet:alert, and read reach on its ship (decision 0071). Clears an open alert once its fact moved back; a cleared alert is answered as it is. Nothing is sent on clear: the lists show it gone.',
646
+ "A retire clears its ship's open alerts by itself; a release does not.",
647
+ ].join(' '),
648
+ })
649
+ .input(clearAlertInputSchema)
650
+ .output(alertOutputSchema)
651
+ .mutation(async ({ ctx, input }) => alertOutputOf(okOrThrow(await ctx.useCases.clearAlert(ctx.caller, input)))),
502
652
  /** Defines a label the caller's ship then owns (decision 0031). */
503
653
  defineLabel: actorScopedProcedure('labels:define')
504
654
  .meta({
@@ -651,7 +801,7 @@ export const fleetRouter = router({
651
801
  /**
652
802
  * The file checked before an import: what it holds and where the fleet
653
803
  * differs (design network-io, section 5). A mutation though it reads only,
654
- * as the file of up to 64 KB travels in the body, never in a query's URL.
804
+ * as the file of up to 256 KB travels in the body, never in a query's URL.
655
805
  */
656
806
  checkNetworkRulesFile: actorAllScopesProcedure('fleet:network', 'labels:define')
657
807
  .meta({
@@ -737,11 +887,11 @@ export const fleetRouter = router({
737
887
  .input(explainReachInputSchema)
738
888
  .output(explainReachOutputSchema)
739
889
  .query(async ({ ctx, input }) => okOrThrow(await ctx.useCases.explainReach(ctx.caller, input))),
740
- /** One ship of the fleet, retired ones included, with when it was commissioned, crewed and retired. */
890
+ /** One ship of the fleet, retired ones included, with when it was commissioned, crewed, retired and removed. */
741
891
  ship: actorAnyScopeProcedure('fleet:read', 'crew:run')
742
892
  .meta({
743
893
  description: [
744
- 'Needs fleet:read, or crew:run for a ship whose crew request is assigned to yours. One ship of the fleet, retired ones included: as fleet_list shows it, plus when it was commissioned, crewed and retired, its open and in-flight deliveries, and its statement as discover shows it (decision 0047).',
894
+ 'Needs fleet:read, or crew:run for a ship whose crew request is assigned to yours. One ship of the fleet, retired ones included: as fleet_list shows it, plus when it was commissioned, crewed, retired and removed (a removed ship answers its remnant, decision 0070), its open and in-flight deliveries, and its statement as discover shows it (decision 0047).',
745
895
  'A ship outside your read reach, and not assigned to yours, shows its id, name, type and status only, with isInReadReach false (decision 0034).',
746
896
  ].join(' '),
747
897
  })
@@ -752,6 +902,7 @@ export const fleetRouter = router({
752
902
  if (!isInReadReach(ship)) {
753
903
  return ship;
754
904
  }
905
+ const [task] = await ctx.useCases.readReportTasks(ctx.caller, [ship.report?.task ?? null]);
755
906
  return {
756
907
  ...ship,
757
908
  startingPrompt: ship.startingPrompt && {
@@ -762,15 +913,38 @@ export const fleetRouter = router({
762
913
  ping: pingOutputOf(ship.ping),
763
914
  scopes: [...ship.scopes],
764
915
  labels: [...ship.labels],
765
- report: ship.report && { ...ship.report, reportedAt: ship.report.reportedAt.toISOString() },
916
+ report: ship.report && {
917
+ ...ship.report,
918
+ taskView: { canOpen: task?.canOpen === true, fleetName: null },
919
+ reportedAt: ship.report.reportedAt.toISOString(),
920
+ reportChangedAt: ship.report.reportChangedAt.toISOString(),
921
+ },
922
+ activity: activityOutputOf(ship.activity),
766
923
  crewRequest: crewRequestOutputOf(ship.crewRequest),
767
924
  model: ship.model && { id: ship.model.id, statedAt: ship.model.statedAt.toISOString() },
768
925
  awaitingCrewSince: ship.awaitingCrewSince?.toISOString() ?? null,
769
926
  commissionedAt: ship.commissionedAt.toISOString(),
770
927
  crewedSince: ship.crewedSince?.toISOString() ?? null,
928
+ removedAt: ship.removedAt?.toISOString() ?? null,
771
929
  retiredAt: ship.retiredAt?.toISOString() ?? null,
930
+ openAlerts: ship.openAlerts.map(alertOutputOf),
931
+ expectations: expectationsOutputOf(ship.expectations),
772
932
  };
773
933
  }),
934
+ /** A page of the fleet's open alerts on the ships the caller reads, newest first (decision 0071). */
935
+ openAlerts: actorScopedProcedure('fleet:read')
936
+ .meta({
937
+ description: [
938
+ "Needs fleet:read. A page of the fleet's open alerts on the ships you read (decision 0071, 0034), newest first: each with its ship by id and name, the signal that parted with its facts at raise, the occurrence, since when, the owner told and when it was raised.",
939
+ `A page holds limit alerts (${String(PAGE_SIZE_DEFAULT)} unless you ask, at most ${String(PAGE_SIZE_MAX)}); pass nextCursor as cursor to read on, until it is null. A cleared alert leaves the list; fleet_ship shows a ship's own, and fleet_list how many each ship has.`,
940
+ ].join(' '),
941
+ })
942
+ .input(openAlertsInputSchema)
943
+ .output(openAlertsOutputSchema)
944
+ .query(async ({ ctx, input }) => {
945
+ const { items, nextCursor } = await ctx.useCases.readOpenAlerts(ctx.caller, input);
946
+ return { items: items.map(alertOutputOf), nextCursor };
947
+ }),
774
948
  /** The ships counted per kind: the overview's cards and subtitle, and the navigation's needs-crew count. */
775
949
  shipCounts: actorScopedProcedure('fleet:read')
776
950
  .input(shipCountsInputSchema)
@@ -790,7 +964,11 @@ export const fleetRouter = router({
790
964
  .output(listedShipOutputSchema)
791
965
  .query(async ({ ctx, input }) => {
792
966
  const ship = okOrThrow(await ctx.useCases.readListedShip(ctx.caller, input));
793
- return isInReadReach(ship) ? listedShipOutputOf(ship) : ship;
967
+ if (!isInReadReach(ship)) {
968
+ return ship;
969
+ }
970
+ const [task] = await ctx.useCases.readReportTasks(ctx.caller, [ship.report?.task ?? null]);
971
+ return listedShipOutputOf(ship, { canOpen: task?.canOpen === true, fleetName: null });
794
972
  }),
795
973
  /** A page of every change to a ship, newest first: the events naming it and the ones it caused. */
796
974
  shipTimeline: actorScopedProcedure('fleet:read')
@@ -808,6 +986,14 @@ export const fleetRouter = router({
808
986
  const { items, nextCursor } = okOrThrow(await ctx.useCases.readShipMessages(ctx.caller, input));
809
987
  return { items: items.map((message) => ({ ...message, sentAt: message.sentAt.toISOString() })), nextCursor };
810
988
  }),
989
+ /** Whether this viewer may open each message task, without fetching its payload. */
990
+ messageTaskAccess: actorScopedProcedure('fleet:read')
991
+ .input(messageTaskAccessInputSchema)
992
+ .output(messageTaskAccessOutputSchema)
993
+ .query(async ({ ctx, input }) => {
994
+ const tasks = await ctx.useCases.readReportTasks(ctx.caller, input.messageIds.map((messageId) => ({ kind: 'message', fleetId: ctx.caller.fleetId, messageId })));
995
+ return { items: input.messageIds.map((messageId, index) => ({ messageId, canOpen: tasks[index]?.canOpen === true })) };
996
+ }),
811
997
  /** One message: envelope, payload, its replies, its delivery's way through with every step, newest first, and how many deliveries it has. */
812
998
  message: actorScopedProcedure('fleet:read')
813
999
  .input(messageInputSchema)
@@ -816,6 +1002,8 @@ export const fleetRouter = router({
816
1002
  const message = okOrThrow(await ctx.useCases.readMessage(ctx.caller, input));
817
1003
  return {
818
1004
  ...message,
1005
+ ...listedPayloadOutputOf(message.payload),
1006
+ progress: message.progress && { ...message.progress, reportChangedAt: message.progress.reportChangedAt.toISOString() },
819
1007
  sentAt: message.sentAt.toISOString(),
820
1008
  replies: message.replies.map((reply) => ({ ...reply, sentAt: reply.sentAt.toISOString() })),
821
1009
  delivery: {
@@ -831,7 +1019,7 @@ export const fleetRouter = router({
831
1019
  .output(messageDeliveriesOutputSchema)
832
1020
  .query(async ({ ctx, input }) => {
833
1021
  const { items, nextCursor } = okOrThrow(await ctx.useCases.readMessageDeliveries(ctx.caller, input));
834
- return { items: items.map((delivery) => ({ ...delivery, since: delivery.since.toISOString() })), nextCursor };
1022
+ return { items: items.map((delivery) => ({ ...delivery, since: delivery.since.toISOString(), progress: delivery.progress && { ...delivery.progress, reportChangedAt: delivery.progress.reportChangedAt.toISOString() } })), nextCursor };
835
1023
  }),
836
1024
  /** A ship's side of the way: the part that serves its lease, its turn, and its oldest delivery waiting with its way. */
837
1025
  shipWay: actorScopedProcedure('fleet:read')
@@ -854,16 +1042,23 @@ export const fleetRouter = router({
854
1042
  .input(needsAttentionInputSchema)
855
1043
  .output(needsAttentionOutputSchema)
856
1044
  .query(async ({ ctx, input }) => {
857
- const { items, nextCursor } = await ctx.useCases.readNeedsAttention(ctx.caller, input);
1045
+ const { items, nextCursor } = okOrThrow(await ctx.useCases.readNeedsAttention(ctx.caller, input));
858
1046
  return {
859
- items: items.map((entry) => ({ ...entry, since: entry.since.toISOString(), message: { ...entry.message, sentAt: entry.message.sentAt.toISOString() } })),
1047
+ items: items.map((entry) => ({
1048
+ ...entry,
1049
+ since: entry.since.toISOString(),
1050
+ message: { ...entry.message, ...listedPayloadOutputOf(entry.message.payload), sentAt: entry.message.sentAt.toISOString() },
1051
+ })),
860
1052
  nextCursor,
861
1053
  };
862
1054
  }),
863
1055
  /** The fleet's health (decision 0042): its stuck deliveries by cause and place, the 7-day trend and the acknowledged in 24 hours. */
864
1056
  health: actorScopedProcedure('fleet:read')
865
- .output(healthOutputSchema)
866
- .query(async ({ ctx }) => describedHealth(await ctx.useCases.readHealth(ctx.caller))),
1057
+ .output(fleetHealthOutputSchema)
1058
+ .query(async ({ ctx }) => {
1059
+ const { keyUnavailable, ...health } = await ctx.useCases.readHealth(ctx.caller);
1060
+ return { ...describedHealth(health), keyUnavailable: keyUnavailable && { ...keyUnavailable, since: keyUnavailable.since.toISOString() } };
1061
+ }),
867
1062
  /** How many deliveries are stuck now and since when the oldest waits: the navigation's count and the overview's card. */
868
1063
  stuckCount: actorScopedProcedure('fleet:read')
869
1064
  .output(stuckCountOutputSchema)
@@ -917,7 +1112,7 @@ export const fleetRouter = router({
917
1112
  .input(operatorInboxInputSchema)
918
1113
  .output(operatorInboxOutputSchema)
919
1114
  .query(async ({ ctx, input }) => {
920
- const { items, nextCursor } = await ctx.useCases.readInbox(ctx.caller, input);
1115
+ const { items, nextCursor } = okOrThrow(await ctx.useCases.readInbox(ctx.caller, input));
921
1116
  return { items: items.map(inboxEntryOutputOf), nextCursor };
922
1117
  }),
923
1118
  /** One message to the caller's inbox, argo's for the console, by its delivery, as `inbox` lists it. */
@@ -930,7 +1125,7 @@ export const fleetRouter = router({
930
1125
  .input(inboxWithdrawalsInputSchema)
931
1126
  .output(operatorInboxOutputSchema)
932
1127
  .query(async ({ ctx, input }) => {
933
- const { items, nextCursor } = await ctx.useCases.readInboxWithdrawals(ctx.caller, input);
1128
+ const { items, nextCursor } = okOrThrow(await ctx.useCases.readInboxWithdrawals(ctx.caller, input));
934
1129
  return { items: items.map(inboxEntryOutputOf), nextCursor };
935
1130
  }),
936
1131
  /** How many messages to the caller's inbox, argo's for the console, are open: counted in one query. */
@@ -1019,8 +1214,19 @@ export const fleetRouter = router({
1019
1214
  }
1020
1215
  }),
1021
1216
  });
1217
+ /** A ship's activity as the fleet answers it, its times in ISO 8601. */
1218
+ /** A ship's expectations as `fleet.ship` reads them back (decision 0071): times in ISO 8601. */
1219
+ function expectationsOutputOf({ reportChangesWithin, taskDoneBy }) {
1220
+ return {
1221
+ reportChangesWithin: reportChangesWithin && { ...reportChangesWithin, setAt: reportChangesWithin.setAt.toISOString() },
1222
+ taskDoneBy: taskDoneBy && { ...taskDoneBy, doneBy: taskDoneBy.doneBy.toISOString(), setAt: taskDoneBy.setAt.toISOString() },
1223
+ };
1224
+ }
1225
+ function activityOutputOf(activity) {
1226
+ return activity && { ...activity, at: activity.at.toISOString(), reportedAt: activity.reportedAt.toISOString() };
1227
+ }
1022
1228
  /** A ship as fleet_list answers it, its times in ISO 8601. */
1023
- function listedShipOutputOf(ship) {
1229
+ function listedShipOutputOf(ship, taskView) {
1024
1230
  return {
1025
1231
  ...ship,
1026
1232
  startingPrompt: ship.startingPrompt && {
@@ -1031,7 +1237,13 @@ function listedShipOutputOf(ship) {
1031
1237
  ping: pingOutputOf(ship.ping),
1032
1238
  scopes: [...ship.scopes],
1033
1239
  labels: [...ship.labels],
1034
- report: ship.report && { ...ship.report, reportedAt: ship.report.reportedAt.toISOString() },
1240
+ report: ship.report && {
1241
+ ...ship.report,
1242
+ taskView,
1243
+ reportedAt: ship.report.reportedAt.toISOString(),
1244
+ reportChangedAt: ship.report.reportChangedAt.toISOString(),
1245
+ },
1246
+ activity: activityOutputOf(ship.activity),
1035
1247
  crewRequest: crewRequestOutputOf(ship.crewRequest),
1036
1248
  model: ship.model && { id: ship.model.id, statedAt: ship.model.statedAt.toISOString() },
1037
1249
  awaitingCrewSince: ship.awaitingCrewSince?.toISOString() ?? null,
@@ -1062,4 +1274,7 @@ function liveEventOf(event) {
1062
1274
  deliveryId: event.deliveryId ?? null,
1063
1275
  };
1064
1276
  }
1277
+ function base64Of(bytes) {
1278
+ return Buffer.from(bytes).toString('base64');
1279
+ }
1065
1280
  //# sourceMappingURL=fleet.js.map