@aeolus-fleet/core 0.34.0 → 0.36.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 (174) hide show
  1. package/README.md +5 -4
  2. package/dist/adapters/prisma/alerts.d.ts +21 -0
  3. package/dist/adapters/prisma/alerts.js +61 -0
  4. package/dist/adapters/prisma/alerts.js.map +1 -0
  5. package/dist/adapters/prisma/expectations.d.ts +19 -0
  6. package/dist/adapters/prisma/expectations.js +46 -0
  7. package/dist/adapters/prisma/expectations.js.map +1 -0
  8. package/dist/adapters/prisma/generated/browser.d.ts +18 -1
  9. package/dist/adapters/prisma/generated/client.d.ts +18 -1
  10. package/dist/adapters/prisma/generated/commonInputTypes.d.ts +30 -0
  11. package/dist/adapters/prisma/generated/enums.d.ts +7 -0
  12. package/dist/adapters/prisma/generated/enums.js +6 -0
  13. package/dist/adapters/prisma/generated/enums.js.map +1 -1
  14. package/dist/adapters/prisma/generated/internal/class.d.ts +22 -0
  15. package/dist/adapters/prisma/generated/internal/class.js +4 -4
  16. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  17. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +197 -1
  18. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +36 -0
  19. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
  20. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +38 -0
  21. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +36 -0
  22. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
  23. package/dist/adapters/prisma/generated/models/Alert.d.ts +1527 -0
  24. package/dist/adapters/prisma/generated/models/Alert.js +2 -0
  25. package/dist/adapters/prisma/generated/models/Alert.js.map +1 -0
  26. package/dist/adapters/prisma/generated/models/Fleet.d.ts +1068 -118
  27. package/dist/adapters/prisma/generated/models/Lease.d.ts +509 -2
  28. package/dist/adapters/prisma/generated/models/Message.d.ts +1 -1
  29. package/dist/adapters/prisma/generated/models/Ship.d.ts +939 -1
  30. package/dist/adapters/prisma/generated/models/ShipExpectations.d.ts +1468 -0
  31. package/dist/adapters/prisma/generated/models/ShipExpectations.js +2 -0
  32. package/dist/adapters/prisma/generated/models/ShipExpectations.js.map +1 -0
  33. package/dist/adapters/prisma/generated/models.d.ts +2 -0
  34. package/dist/adapters/prisma/history-pruner.js +24 -2
  35. package/dist/adapters/prisma/history-pruner.js.map +1 -1
  36. package/dist/adapters/prisma/history.js +9 -2
  37. package/dist/adapters/prisma/history.js.map +1 -1
  38. package/dist/adapters/prisma/messaging.js +39 -0
  39. package/dist/adapters/prisma/messaging.js.map +1 -1
  40. package/dist/adapters/prisma/overdue.js +1 -1
  41. package/dist/adapters/prisma/registry.d.ts +2 -1
  42. package/dist/adapters/prisma/registry.js +66 -14
  43. package/dist/adapters/prisma/registry.js.map +1 -1
  44. package/dist/adapters/prisma/rows.d.ts +3 -0
  45. package/dist/adapters/prisma/rows.js +40 -4
  46. package/dist/adapters/prisma/rows.js.map +1 -1
  47. package/dist/adapters/prisma/unit-of-work.d.ts +3 -1
  48. package/dist/adapters/prisma/unit-of-work.js +4 -0
  49. package/dist/adapters/prisma/unit-of-work.js.map +1 -1
  50. package/dist/adapters/trpc/alert-output.d.ts +4 -0
  51. package/dist/adapters/trpc/alert-output.js +15 -0
  52. package/dist/adapters/trpc/alert-output.js.map +1 -0
  53. package/dist/adapters/trpc/context.d.ts +14 -0
  54. package/dist/adapters/trpc/fleet.d.ts +479 -5
  55. package/dist/adapters/trpc/fleet.js +123 -10
  56. package/dist/adapters/trpc/fleet.js.map +1 -1
  57. package/dist/adapters/trpc/router.d.ts +542 -4
  58. package/dist/adapters/trpc/ship-contract.js +5 -0
  59. package/dist/adapters/trpc/ship-contract.js.map +1 -1
  60. package/dist/adapters/trpc/ship-protocol.js +4 -2
  61. package/dist/adapters/trpc/ship-protocol.js.map +1 -1
  62. package/dist/adapters/trpc/ship.d.ts +80 -3
  63. package/dist/adapters/trpc/ship.js +42 -8
  64. package/dist/adapters/trpc/ship.js.map +1 -1
  65. package/dist/adapters/trpc/trpc.js +4 -0
  66. package/dist/adapters/trpc/trpc.js.map +1 -1
  67. package/dist/domain/messaging/delivery.d.ts +8 -3
  68. package/dist/domain/messaging/delivery.js +15 -2
  69. package/dist/domain/messaging/delivery.js.map +1 -1
  70. package/dist/domain/messaging/message.d.ts +5 -1
  71. package/dist/domain/messaging/message.js.map +1 -1
  72. package/dist/domain/messaging/overdue.d.ts +4 -1
  73. package/dist/domain/messaging/overdue.js +3 -3
  74. package/dist/domain/messaging/overdue.js.map +1 -1
  75. package/dist/domain/messaging/payload.d.ts +1 -1
  76. package/dist/domain/messaging/payload.js +2 -2
  77. package/dist/domain/messaging/payload.js.map +1 -1
  78. package/dist/domain/messaging/ports.d.ts +15 -0
  79. package/dist/domain/messaging/read-record.d.ts +38 -0
  80. package/dist/domain/messaging/read-record.js +59 -0
  81. package/dist/domain/messaging/read-record.js.map +1 -0
  82. package/dist/domain/messaging/sealed-payload.js +1 -1
  83. package/dist/domain/messaging/send-message.d.ts +1 -1
  84. package/dist/domain/messaging/send-message.js +1 -1
  85. package/dist/domain/registry/alert.d.ts +75 -0
  86. package/dist/domain/registry/alert.js +71 -0
  87. package/dist/domain/registry/alert.js.map +1 -0
  88. package/dist/domain/registry/claim-ship.d.ts +2 -1
  89. package/dist/domain/registry/claim-ship.js +1 -1
  90. package/dist/domain/registry/claim-ship.js.map +1 -1
  91. package/dist/domain/registry/clear-alert.d.ts +32 -0
  92. package/dist/domain/registry/clear-alert.js +40 -0
  93. package/dist/domain/registry/clear-alert.js.map +1 -0
  94. package/dist/domain/registry/crew-request.d.ts +9 -0
  95. package/dist/domain/registry/crew-request.js +7 -0
  96. package/dist/domain/registry/crew-request.js.map +1 -1
  97. package/dist/domain/registry/expectations.d.ts +68 -0
  98. package/dist/domain/registry/expectations.js +84 -0
  99. package/dist/domain/registry/expectations.js.map +1 -0
  100. package/dist/domain/registry/get-ship.d.ts +9 -1
  101. package/dist/domain/registry/get-ship.js +10 -2
  102. package/dist/domain/registry/get-ship.js.map +1 -1
  103. package/dist/domain/registry/lease-activity.d.ts +15 -0
  104. package/dist/domain/registry/lease-activity.js +2 -0
  105. package/dist/domain/registry/lease-activity.js.map +1 -0
  106. package/dist/domain/registry/lease.d.ts +1 -1
  107. package/dist/domain/registry/list-fleet.d.ts +6 -1
  108. package/dist/domain/registry/list-fleet.js +5 -3
  109. package/dist/domain/registry/list-fleet.js.map +1 -1
  110. package/dist/domain/registry/ports.d.ts +61 -1
  111. package/dist/domain/registry/public.d.ts +2 -0
  112. package/dist/domain/registry/public.js +1 -0
  113. package/dist/domain/registry/public.js.map +1 -1
  114. package/dist/domain/registry/raise-alert.d.ts +31 -0
  115. package/dist/domain/registry/raise-alert.js +43 -0
  116. package/dist/domain/registry/raise-alert.js.map +1 -0
  117. package/dist/domain/registry/read-open-alerts.d.ts +23 -0
  118. package/dist/domain/registry/read-open-alerts.js +21 -0
  119. package/dist/domain/registry/read-open-alerts.js.map +1 -0
  120. package/dist/domain/registry/report-activity.d.ts +41 -0
  121. package/dist/domain/registry/report-activity.js +43 -0
  122. package/dist/domain/registry/report-activity.js.map +1 -0
  123. package/dist/domain/registry/report-step.d.ts +8 -0
  124. package/dist/domain/registry/report-step.js +16 -0
  125. package/dist/domain/registry/report-step.js.map +1 -0
  126. package/dist/domain/registry/report-task.d.ts +14 -0
  127. package/dist/domain/registry/report-task.js +39 -0
  128. package/dist/domain/registry/report-task.js.map +1 -0
  129. package/dist/domain/registry/report.d.ts +2 -2
  130. package/dist/domain/registry/report.js.map +1 -1
  131. package/dist/domain/registry/retire-ship.d.ts +6 -2
  132. package/dist/domain/registry/retire-ship.js +12 -1
  133. package/dist/domain/registry/retire-ship.js.map +1 -1
  134. package/dist/domain/registry/set-expectations.d.ts +33 -0
  135. package/dist/domain/registry/set-expectations.js +47 -0
  136. package/dist/domain/registry/set-expectations.js.map +1 -0
  137. package/dist/domain/registry/ship-report.d.ts +24 -7
  138. package/dist/domain/registry/ship-report.js +41 -5
  139. package/dist/domain/registry/ship-report.js.map +1 -1
  140. package/dist/domain/registry/ship.d.ts +7 -1
  141. package/dist/domain/registry/ship.js +3 -0
  142. package/dist/domain/registry/ship.js.map +1 -1
  143. package/dist/domain/shared/errors.d.ts +1 -1
  144. package/dist/domain/shared/errors.js.map +1 -1
  145. package/dist/domain/shared/history-pruning.d.ts +19 -2
  146. package/dist/domain/shared/history-pruning.js +1 -1
  147. package/dist/domain/shared/history-pruning.js.map +1 -1
  148. package/dist/domain/shared/history.d.ts +2 -1
  149. package/dist/domain/shared/history.js.map +1 -1
  150. package/dist/domain/shared/prune-history.d.ts +2 -1
  151. package/dist/domain/shared/prune-history.js +8 -6
  152. package/dist/domain/shared/prune-history.js.map +1 -1
  153. package/dist/domain/shared/read-message-deliveries.d.ts +2 -1
  154. package/dist/domain/shared/read-message-deliveries.js +4 -3
  155. package/dist/domain/shared/read-message-deliveries.js.map +1 -1
  156. package/dist/domain/shared/read-message.d.ts +2 -1
  157. package/dist/domain/shared/read-message.js +6 -3
  158. package/dist/domain/shared/read-message.js.map +1 -1
  159. package/dist/domain/shared/read-report-tasks.d.ts +10 -0
  160. package/dist/domain/shared/read-report-tasks.js +24 -0
  161. package/dist/domain/shared/read-report-tasks.js.map +1 -0
  162. package/dist/wiring.d.ts +14 -0
  163. package/dist/wiring.js +14 -0
  164. package/dist/wiring.js.map +1 -1
  165. package/package.json +2 -2
  166. package/src/adapters/prisma/migrations/20261103090000_removed_ships/migration.sql +21 -0
  167. package/src/adapters/prisma/migrations/20261104090000_report_task_step/migration.sql +10 -0
  168. package/src/adapters/prisma/migrations/20261105090000_payload_limit_256kb/migration.sql +15 -0
  169. package/src/adapters/prisma/migrations/20261106090000_lease_activity/migration.sql +11 -0
  170. package/src/adapters/prisma/migrations/20261107090000_alert_scope/migration.sql +64 -0
  171. package/src/adapters/prisma/migrations/20261107100000_alerts/migration.sql +33 -0
  172. package/src/adapters/prisma/migrations/20261108090000_ship_expectations/migration.sql +22 -0
  173. package/src/adapters/prisma/migrations/20261108100000_delivery_record_index/migration.sql +4 -0
  174. package/src/adapters/prisma/schema.prisma +108 -23
@@ -0,0 +1,22 @@
1
+ -- The expectations on ships (decision 0071): one row per ship while any holds, removed when the ship retires.
2
+ -- CreateTable
3
+ CREATE TABLE "ship_expectations" (
4
+ "fleet_id" TEXT NOT NULL,
5
+ "ship_id" TEXT NOT NULL,
6
+ "report_changes_within_minutes" INTEGER,
7
+ "report_changes_within_set_by" JSONB,
8
+ "report_changes_within_set_at" TIMESTAMPTZ(3),
9
+ "task_done_by_task" JSONB,
10
+ "task_done_by" TIMESTAMPTZ(3),
11
+ "task_done_by_set_by" JSONB,
12
+ "task_done_by_set_at" TIMESTAMPTZ(3),
13
+
14
+ CONSTRAINT "ship_expectations_pkey" PRIMARY KEY ("fleet_id","ship_id")
15
+ );
16
+
17
+ -- AddForeignKey
18
+ ALTER TABLE "ship_expectations" ADD CONSTRAINT "ship_expectations_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "ship_expectations" ADD CONSTRAINT "ship_expectations_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
22
+
@@ -0,0 +1,4 @@
1
+ -- A ship's record reads the deliveries of its type it claimed newest first by id (Bridge, CC12).
2
+ -- Partial: a foreign key check on deliveries never matches its predicate, so a bulk delete never picks it.
3
+ CREATE INDEX "deliveries_record_fleet_id_claimed_by_ship_id_id_idx" ON "deliveries"("fleet_id", "claimed_by_ship_id", "id")
4
+ WHERE recipient_type IS NOT NULL;
@@ -87,6 +87,8 @@ model Fleet {
87
87
  scopeNamespaces ScopeNamespace[]
88
88
  definedScopes DefinedScope[]
89
89
  verifiedFacts VerifiedFacts[]
90
+ alerts Alert[]
91
+ shipExpectations ShipExpectations[]
90
92
  reachRefusals ReachRefusal[]
91
93
  credentials Credential[]
92
94
  messages Message[]
@@ -143,6 +145,8 @@ model Ship {
143
145
  note String?
144
146
  createdAt DateTime @map("created_at") @db.Timestamptz(3)
145
147
  retiredAt DateTime? @map("retired_at") @db.Timestamptz(3)
148
+ /// When the pruning pass removed it, past the fleet's retention (decision 0070): the row stays a remnant its kept history names.
149
+ removedAt DateTime? @map("removed_at") @db.Timestamptz(3)
146
150
  /// The actor that commissioned it, its idempotency key and the request's hash; null for argo.
147
151
  /// commissioned_by names the actor: a ship's id, an account's id, or `installation`.
148
152
  commissionedByKind CommissionerKind? @map("commissioned_by_kind")
@@ -177,6 +181,8 @@ model Ship {
177
181
  declaredNetworkRules DeclaredNetworkRules[]
178
182
  declaredNamespace ScopeNamespace?
179
183
  verifiedFacts VerifiedFacts[]
184
+ alerts Alert[]
185
+ shipExpectations ShipExpectations[]
180
186
  ownedMeetings Meeting[] @relation("MeetingOwner")
181
187
  moderatedMeetings Meeting[] @relation("MeetingModerator")
182
188
  openedMeetings Meeting[] @relation("MeetingOpener")
@@ -197,6 +203,8 @@ model Ship {
197
203
  @@index([fleetId, ownerShipId])
198
204
  @@index([fleetId, type], map: "ships_type_listing_idx", where: { retiredAt: null })
199
205
  @@index([fleetId, kind], map: "ships_kind_listing_idx", where: { retiredAt: null })
206
+ /// The pruning pass picks the oldest retired ships not removed yet (decision 0070).
207
+ @@index([fleetId, retiredAt, id], map: "ships_removal_idx", where: raw("((retired_at IS NOT NULL) AND (removed_at IS NULL))"))
200
208
  @@map("ships")
201
209
  }
202
210
 
@@ -227,6 +235,16 @@ enum TurnState {
227
235
  @@map("turn_state")
228
236
  }
229
237
 
238
+ /// The kind of a session's latest event as its trierarch observes it (headless design, H14).
239
+ enum ActivityKind {
240
+ text
241
+ tool
242
+ result
243
+ error
244
+
245
+ @@map("activity_kind")
246
+ }
247
+
230
248
  enum LocationKind {
231
249
  DEVICE
232
250
  CLOUD
@@ -242,37 +260,51 @@ enum LocationKind {
242
260
  /// finding a ship by its crew token is a lookup not scoped by fleet (ADR 0007). A
243
261
  /// console session's lease on argo has none; the console session holds its token.
244
262
  model Lease {
245
- id String @id
246
- fleetId String @map("fleet_id")
247
- shipId String @map("ship_id")
248
- location LocationKind
249
- locationDescription String? @map("location_description")
263
+ id String @id
264
+ fleetId String @map("fleet_id")
265
+ shipId String @map("ship_id")
266
+ location LocationKind
267
+ locationDescription String? @map("location_description")
250
268
  /// The harness the session stated when it claimed the ship; none for argo's console lease and for leases from before harnesses were stated.
251
- harness String?
252
- crewTokenHash String? @unique @map("crew_token_hash")
253
- startedAt DateTime @map("started_at") @db.Timestamptz(3)
269
+ harness String?
270
+ crewTokenHash String? @unique @map("crew_token_hash")
271
+ startedAt DateTime @map("started_at") @db.Timestamptz(3)
254
272
  /// The last call by its crew: observation only, nothing acts on it (ADR 0016).
255
- lastSeenAt DateTime? @map("last_seen_at") @db.Timestamptz(3)
273
+ lastSeenAt DateTime? @map("last_seen_at") @db.Timestamptz(3)
256
274
  /// The crew's last report: plain data, nothing acts on it. Null until it reports.
257
- reportState ReportState? @map("report_state")
258
- reportNote String? @map("report_note")
259
- reportedAt DateTime? @map("reported_at") @db.Timestamptz(3)
275
+ reportState ReportState? @map("report_state")
276
+ reportNote String? @map("report_note")
277
+ reportedAt DateTime? @map("reported_at") @db.Timestamptz(3)
278
+ /// When the state, note, task or step last changed; details alone do not move it (decision 0028). Null until it reports.
279
+ reportChangedAt DateTime? @map("report_changed_at") @db.Timestamptz(3)
280
+ /// What the crew works on: a typed reference, a kind and its fields (decision 0028). Null when it names none.
281
+ reportTask Json? @map("report_task")
282
+ /// Where the crew is in its task, step at of of; both null when it gives none.
283
+ reportStepAt Int? @map("report_step_at")
284
+ reportStepOf Int? @map("report_step_of")
260
285
  /// The report's details: one JSON object stored without meaning, at most 16 KB (decision 0028). Null when there are none.
261
- reportDetails Json? @map("report_details")
286
+ reportDetails Json? @map("report_details")
262
287
  /// Moves by one each time the details change; 0 before any.
263
- reportDetailsVersion Int @default(0) @map("report_details_version")
264
- /// The crew's statement: what its ship is and offers, at most 64 KB, its shape common's; null until it states one (decision 0047).
265
- statement Json?
288
+ reportDetailsVersion Int @default(0) @map("report_details_version")
289
+ /// The crew's statement: what its ship is and offers, at most 256 KB, its shape common's; null until it states one (decision 0047).
290
+ statement Json?
266
291
  /// Moves by one each time the statement changes; 0 before any.
267
- statementVersion Int @default(0) @map("statement_version")
292
+ statementVersion Int @default(0) @map("statement_version")
268
293
  /// From the lease's first push receive: the computer side takes its deliveries, and the agent's plain receive answers nothing (decision 0040).
269
- pushedAt DateTime? @map("pushed_at") @db.Timestamptz(3)
294
+ pushedAt DateTime? @map("pushed_at") @db.Timestamptz(3)
270
295
  /// What wakes the ship, as its first push receive stated it; null when it stated none (interop 5.1).
271
- waker LeaseWaker?
296
+ waker LeaseWaker?
272
297
  /// The session's turn as its hooks last reported it, and when they saw it change; null until they report (decision 0040).
273
- turn TurnState?
274
- turnAt DateTime? @map("turn_at") @db.Timestamptz(3)
275
- endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
298
+ turn TurnState?
299
+ turnAt DateTime? @map("turn_at") @db.Timestamptz(3)
300
+ /// What its assigned trierarch last observed of the session: the latest event's time, kind and tool, never content; null until it writes (docs/design/monitoring, 4.3).
301
+ activityAt DateTime? @map("activity_at") @db.Timestamptz(3)
302
+ activityKind ActivityKind? @map("activity_kind")
303
+ activityTool String? @map("activity_tool")
304
+ /// When the trierarch wrote it, and the report interval it stated: past twice that interval it reads unknown.
305
+ activityReportedAt DateTime? @map("activity_reported_at") @db.Timestamptz(3)
306
+ activityIntervalSeconds Int? @map("activity_interval_seconds")
307
+ endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
276
308
 
277
309
  fleet Fleet @relation(fields: [fleetId], references: [id])
278
310
  ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
@@ -545,6 +577,57 @@ model VerifiedFacts {
545
577
  @@map("verified_facts")
546
578
  }
547
579
 
580
+ /// An alert on a ship (decision 0071): what the watch raised when a fact and
581
+ /// its signal parted, open until the watch clears it or the ship retires.
582
+ /// Ids start with alt_. One per ship, signal and occurrence, open or cleared,
583
+ /// so an occurrence is raised once. facts holds the signal's facts at raise,
584
+ /// as common's schema gives them.
585
+ model Alert {
586
+ id String @id
587
+ fleetId String @map("fleet_id")
588
+ shipId String @map("ship_id")
589
+ signal String
590
+ occurrenceKey String @map("occurrence_key")
591
+ facts Json
592
+ ownerShipId String? @map("owner_ship_id")
593
+ since DateTime @db.Timestamptz(3)
594
+ raisedAt DateTime @map("raised_at") @db.Timestamptz(3)
595
+ clearedAt DateTime? @map("cleared_at") @db.Timestamptz(3)
596
+ clearedWhy String? @map("cleared_why")
597
+
598
+ fleet Fleet @relation(fields: [fleetId], references: [id])
599
+ ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
600
+
601
+ @@unique([fleetId, shipId, signal, occurrenceKey])
602
+ /// The fleet's open alerts, newest first, a page at a time.
603
+ @@index([fleetId, id(sort: Desc)], map: "alerts_open_idx", where: { clearedAt: null })
604
+ /// A ship's open alerts, and how many it has.
605
+ @@index([fleetId, shipId], map: "alerts_open_on_ship_idx", where: { clearedAt: null })
606
+ @@map("alerts")
607
+ }
608
+
609
+ /// The expectations on a ship (decision 0071): what its owner, or a ship
610
+ /// that manages it, expects of it, standing, at most one of each. Each keeps
611
+ /// who set it (JSON, as common's expectation setter) and when; its columns
612
+ /// are null while it is not set. No row while none holds; a retire removes it.
613
+ model ShipExpectations {
614
+ fleetId String @map("fleet_id")
615
+ shipId String @map("ship_id")
616
+ reportChangesWithinMinutes Int? @map("report_changes_within_minutes")
617
+ reportChangesWithinSetBy Json? @map("report_changes_within_set_by")
618
+ reportChangesWithinSetAt DateTime? @map("report_changes_within_set_at") @db.Timestamptz(3)
619
+ taskDoneByTask Json? @map("task_done_by_task")
620
+ taskDoneBy DateTime? @map("task_done_by") @db.Timestamptz(3)
621
+ taskDoneBySetBy Json? @map("task_done_by_set_by")
622
+ taskDoneBySetAt DateTime? @map("task_done_by_set_at") @db.Timestamptz(3)
623
+
624
+ fleet Fleet @relation(fields: [fleetId], references: [id])
625
+ ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
626
+
627
+ @@id([fleetId, shipId])
628
+ @@map("ship_expectations")
629
+ }
630
+
548
631
  /// A send the network rules refused (decision 0034), recorded in the
549
632
  /// transaction that refused it. Ids start with rfs_. Sender and recipient are
550
633
  /// as they were then: ids, names and the label values they carried, as JSON,
@@ -632,7 +715,7 @@ model MessageDay {
632
715
  @@map("message_days")
633
716
  }
634
717
 
635
- /// An immutable envelope plus an opaque payload of at most 64 KB, sent by one ship.
718
+ /// An immutable envelope plus an opaque payload of at most 256 KB, sent by one ship.
636
719
  /// Ids start with msg_. The selector is stored as resolved at send time: a ship's
637
720
  /// id, never its name, or a type. It can name the message it replies to, and a
638
721
  /// resend names the message it resends (nothing sets that yet).
@@ -970,6 +1053,8 @@ model Delivery {
970
1053
  @@index([fleetId, state, createdAt], map: "deliveries_open_fleet_id_state_created_at_idx", where: raw("(state = ANY (ARRAY['pending'::delivery_state, 'received'::delivery_state, 'handed'::delivery_state, 'undeliverable'::delivery_state, 'notHandled'::delivery_state]))"))
971
1054
  /// A crew's own deliveries in flight, which its next receive returns first.
972
1055
  @@index([fleetId, claimedByLeaseId, state])
1056
+ /// A ship's record pages the deliveries of its type it claimed newest first by id (Bridge, CC12). Partial, so a foreign key check never picks it.
1057
+ @@index([fleetId, claimedByShipId, id], map: "deliveries_record_fleet_id_claimed_by_ship_id_id_idx", where: raw("(recipient_type IS NOT NULL)"))
973
1058
  /// Every foreign key has an index leading with its columns, so deleting a
974
1059
  /// referenced row checks it with an index, not a scan (#331).
975
1060
  @@index([fleetId, messageId, id])