@aeolus-fleet/core 0.40.0 → 0.41.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 (105) hide show
  1. package/README.md +5 -5
  2. package/dist/adapters/crypto/account-token-signatures.js +1 -1
  3. package/dist/adapters/crypto/account-token-signatures.js.map +1 -1
  4. package/dist/adapters/prisma/delivery-notices.d.ts +2 -2
  5. package/dist/adapters/prisma/delivery-notices.js +2 -2
  6. package/dist/adapters/prisma/fleet-event-wakeups.d.ts +1 -7
  7. package/dist/adapters/prisma/fleet-event-wakeups.js +0 -19
  8. package/dist/adapters/prisma/fleet-event-wakeups.js.map +1 -1
  9. package/dist/adapters/prisma/generated/enums.d.ts +1 -0
  10. package/dist/adapters/prisma/generated/enums.js +2 -1
  11. package/dist/adapters/prisma/generated/enums.js.map +1 -1
  12. package/dist/adapters/prisma/generated/internal/class.js +1 -1
  13. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  14. package/dist/adapters/prisma/installation.js +2 -2
  15. package/dist/adapters/prisma/installation.js.map +1 -1
  16. package/dist/adapters/prisma/receiver-wakeups.d.ts +11 -17
  17. package/dist/adapters/prisma/receiver-wakeups.js +0 -60
  18. package/dist/adapters/prisma/receiver-wakeups.js.map +1 -1
  19. package/dist/adapters/prisma/registry.js +3 -3
  20. package/dist/adapters/prisma/registry.js.map +1 -1
  21. package/dist/adapters/telemetry/calls.d.ts +0 -8
  22. package/dist/adapters/telemetry/calls.js +3 -39
  23. package/dist/adapters/telemetry/calls.js.map +1 -1
  24. package/dist/adapters/trpc/console.d.ts +4 -0
  25. package/dist/adapters/trpc/fleet.d.ts +12 -13
  26. package/dist/adapters/trpc/fleet.js +4 -4
  27. package/dist/adapters/trpc/fleet.js.map +1 -1
  28. package/dist/adapters/trpc/installation.d.ts +12 -0
  29. package/dist/adapters/trpc/router.d.ts +30 -18
  30. package/dist/adapters/trpc/ship-protocol.js +1 -1
  31. package/dist/adapters/trpc/ship-protocol.js.map +1 -1
  32. package/dist/adapters/trpc/ship.d.ts +9 -13
  33. package/dist/adapters/trpc/ship.js +11 -14
  34. package/dist/adapters/trpc/ship.js.map +1 -1
  35. package/dist/adapters/trpc/trpc.js +0 -2
  36. package/dist/adapters/trpc/trpc.js.map +1 -1
  37. package/dist/app.d.ts +1 -3
  38. package/dist/app.js +8 -12
  39. package/dist/app.js.map +1 -1
  40. package/dist/domain/identity/authenticate-installation.d.ts +1 -1
  41. package/dist/domain/identity/authenticate-installation.js +2 -2
  42. package/dist/domain/identity/authenticate-installation.js.map +1 -1
  43. package/dist/domain/identity/notice.js +1 -0
  44. package/dist/domain/identity/notice.js.map +1 -1
  45. package/dist/domain/messaging/check-inbox.d.ts +6 -23
  46. package/dist/domain/messaging/check-inbox.js +14 -59
  47. package/dist/domain/messaging/check-inbox.js.map +1 -1
  48. package/dist/domain/messaging/message.d.ts +1 -1
  49. package/dist/domain/messaging/message.js +2 -2
  50. package/dist/domain/messaging/message.js.map +1 -1
  51. package/dist/domain/messaging/ports.d.ts +1 -16
  52. package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -6
  53. package/dist/domain/messaging/push-receive-deliveries.js +5 -7
  54. package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
  55. package/dist/domain/messaging/receive-deliveries.d.ts +4 -34
  56. package/dist/domain/messaging/receive-deliveries.js +4 -46
  57. package/dist/domain/messaging/receive-deliveries.js.map +1 -1
  58. package/dist/domain/messaging/receive-reply.d.ts +5 -8
  59. package/dist/domain/messaging/receive-reply.js +10 -9
  60. package/dist/domain/messaging/receive-reply.js.map +1 -1
  61. package/dist/domain/registry/check-reach.d.ts +1 -1
  62. package/dist/domain/registry/check-reach.js +2 -2
  63. package/dist/domain/registry/check-reach.js.map +1 -1
  64. package/dist/domain/registry/expectations.js +1 -0
  65. package/dist/domain/registry/expectations.js.map +1 -1
  66. package/dist/domain/registry/network-settings.d.ts +5 -2
  67. package/dist/domain/registry/network-settings.js +2 -2
  68. package/dist/domain/registry/network-settings.js.map +1 -1
  69. package/dist/domain/registry/ports.d.ts +2 -2
  70. package/dist/domain/registry/read-reach.js +1 -1
  71. package/dist/domain/registry/read-reach.js.map +1 -1
  72. package/dist/domain/registry/ship-order.js +1 -1
  73. package/dist/domain/registry/ship-order.js.map +1 -1
  74. package/dist/domain/registry/verified-facts.js +1 -0
  75. package/dist/domain/registry/verified-facts.js.map +1 -1
  76. package/dist/domain/shared/caller.js +1 -0
  77. package/dist/domain/shared/caller.js.map +1 -1
  78. package/dist/domain/shared/errors.d.ts +1 -1
  79. package/dist/domain/shared/errors.js.map +1 -1
  80. package/dist/domain/shared/events.d.ts +0 -13
  81. package/dist/domain/shared/follow-fleet.d.ts +9 -15
  82. package/dist/domain/shared/follow-fleet.js +16 -55
  83. package/dist/domain/shared/follow-fleet.js.map +1 -1
  84. package/dist/domain/shared/read-fleet-limits.d.ts +2 -2
  85. package/dist/domain/shared/read-fleet-limits.js +1 -1
  86. package/dist/start.d.ts +1 -1
  87. package/dist/start.js +1 -1
  88. package/dist/testing/container-sweeper.d.ts +47 -0
  89. package/dist/testing/container-sweeper.js +101 -1
  90. package/dist/testing/container-sweeper.js.map +1 -1
  91. package/dist/testing/postgres-container.js +2 -2
  92. package/dist/testing/postgres-container.js.map +1 -1
  93. package/dist/testing/postgres-global-setup.d.ts +1 -1
  94. package/dist/testing/postgres-global-setup.js +3 -2
  95. package/dist/testing/postgres-global-setup.js.map +1 -1
  96. package/dist/wiring.d.ts +3 -10
  97. package/dist/wiring.js +3 -15
  98. package/dist/wiring.js.map +1 -1
  99. package/package.json +2 -2
  100. package/src/adapters/prisma/migrations/20261115180000_trierarch_kind/migration.sql +2 -0
  101. package/src/adapters/prisma/migrations/20261115180100_trierarch_kind_backfill/migration.sql +38 -0
  102. package/src/adapters/prisma/schema.prisma +1 -0
  103. package/dist/domain/messaging/inbox-wait.d.ts +0 -8
  104. package/dist/domain/messaging/inbox-wait.js +0 -19
  105. package/dist/domain/messaging/inbox-wait.js.map +0 -1
@@ -17,7 +17,7 @@ const config = {
17
17
  "clientVersion": "7.10.0",
18
18
  "engineVersion": "0edf323efd1d98336f3f0a68684b56f689b900d3",
19
19
  "activeProvider": "postgresql",
20
- "inlineSchema": "// Aeolus core tables (docs/architecture.md, \"Core tables\").\n//\n// Prefixed ids, fleet_id on every table except fleets, and the columns and key\n// constraints named in the architecture. Columns a later slice owns (a message's\n// sender and selector, for one) arrive with that slice.\n//\n// References to rows of the same fleet carry fleet_id in the foreign key, so a\n// row can never point at another fleet's ship, lease, message or delivery.\n//\n// Timestamps have no database default: the application's Clock port sets every\n// one of them, so tests control time.\n//\n// Check constraints and the append-only rule for events live in the migration\n// SQL, because Prisma does not model them.\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"./generated\"\n moduleFormat = \"esm\"\n importFileExtension = \"js\"\n runtime = \"nodejs\"\n previewFeatures = [\"partialIndexes\"]\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\n/// The tenant: one operator's ships, messages and history. Ids start with flt_.\nmodel Fleet {\n id String @id\n name String\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n /// The sequence number of the fleet's last committed event. A unit of work\n /// takes its numbers from it as its last statements, so the row lock orders\n /// the numbers as the transactions commit.\n lastEventSeq BigInt @default(0) @map(\"last_event_seq\")\n /// Whether the fleet sets its own ship limit (else it follows the installation\n /// default), and that limit: null for no limit.\n shipLimitSet Boolean @default(false) @map(\"ship_limit_set\")\n shipLimit Int? @map(\"ship_limit\")\n /// The same for its daily message limit.\n dailyMessageLimitSet Boolean @default(false) @map(\"daily_message_limit_set\")\n dailyMessageLimit Int? @map(\"daily_message_limit\")\n /// The same for the schedules each of its ships may hold, and for the\n /// minimum interval of a repeating schedule, in seconds (decision 0062).\n schedulesPerShipLimitSet Boolean @default(false) @map(\"schedules_per_ship_limit_set\")\n schedulesPerShipLimit Int? @map(\"schedules_per_ship_limit\")\n minimumScheduleIntervalSet Boolean @default(false) @map(\"minimum_schedule_interval_set\")\n minimumScheduleInterval Int? @map(\"minimum_schedule_interval\")\n /// The same for its retention in days (decision 0066): null for kept for good.\n retentionSet Boolean @default(false) @map(\"retention_set\")\n retentionDays Int? @map(\"retention_days\")\n /// When its last pruning pass ran, and from when it keeps its finished\n /// history, as its last finished pass left it (decision 0066); null before any.\n /// When the installation deleted it (decision 0020): the fleet reads as gone from then, and the removal pass takes its rows away in batches, the fleet last; null while it stands.\n deletedAt DateTime? @map(\"deleted_at\") @db.Timestamptz(3)\n prunedAt DateTime? @map(\"pruned_at\") @db.Timestamptz(3)\n keptFrom DateTime? @map(\"kept_from\") @db.Timestamptz(3)\n /// Its sealing (decision 0068): null while it is not sealed; then sealing until no payload is stored plain, and sealed. The company key that wraps its data keys, by its reference.\n sealingState SealingState? @map(\"sealing_state\")\n /// Since when it reads its sealing state: turned on, or the sealing pass left no payload plain.\n sealingStateSince DateTime? @map(\"sealing_state_since\") @db.Timestamptz(3)\n /// The sealing pass's progress (decision 0068, B5): the payloads stored plain when it turned sealing on, and how many the pass sealed since.\n payloadsToSeal Int @default(0) @map(\"payloads_to_seal\")\n payloadsSealed Int @default(0) @map(\"payloads_sealed\")\n companyKey String? @map(\"company_key\")\n /// Its recovery key (decision 0068, B6), when the company set one: the public half, an age X25519 recipient, and\n /// its fingerprint (SHA256: and the unpadded base64 SHA-256 of the recipient). Each data key is wrapped to it too.\n recoveryKey String? @map(\"recovery_key\")\n recoveryKeyFingerprint String? @map(\"recovery_key_fingerprint\")\n /// Whether its company key answered its last unwrap, and since when (decision 0068, B11): the key vault's reason\n /// while it refuses (accessDenied, disabled, notFound, unreachable), null while it answers. Since when set with the sealing.\n keyUnavailableReason String? @map(\"key_unavailable_reason\")\n keyAvailabilitySince DateTime? @map(\"key_availability_since\") @db.Timestamptz(3)\n\n messageMetadataBackfill MessageMetadataBackfill?\n ships Ship[]\n leases Lease[]\n crewRequests CrewRequest[]\n crewRequestGiveBacks CrewRequestGiveBack[]\n clearRequests WorktreeClearRequest[]\n labels Label[]\n labelValues LabelValue[]\n shipLabels ShipLabel[]\n networkSettings NetworkSettings?\n networkRulesDraft NetworkRulesDraft?\n declaredNetworkRules DeclaredNetworkRules[]\n installationDeclaredNetworkRules InstallationDeclaredNetworkRules?\n commissionApprovals CommissionApproval[]\n scopeNamespaces ScopeNamespace[]\n definedScopes DefinedScope[]\n verifiedFacts VerifiedFacts[]\n alerts Alert[]\n shipExpectations ShipExpectations[]\n reachRefusals ReachRefusal[]\n credentials Credential[]\n messages Message[]\n messageDays MessageDay[]\n exchanges Exchange[]\n prunedExchanges PrunedExchange[]\n deliveries Delivery[]\n overdueDeliveries OverdueDelivery[]\n events Event[]\n consoleSessions ConsoleSession[]\n signInTickets SignInTicket[]\n noticeDismissals NoticeDismissal[]\n guideProgress GuideProgress[]\n accountNoticeDismissals AccountNoticeDismissal[]\n accountGuideProgress AccountGuideProgress[]\n operator Operator?\n healthSnapshots HealthSnapshot[]\n healthSnapshotDeliveries HealthSnapshotDelivery[]\n meetings Meeting[]\n dataKeys DataKey[]\n meetingParticipants MeetingParticipant[]\n meetingMicRequests MeetingMicRequest[]\n schedules Schedule[]\n featureFlags FleetFeatureFlag[]\n\n @@map(\"fleets\")\n}\n\n/// A sealed fleet's sealing (decision 0068): payloads stored plain before still wait for the sealing pass, or none do.\nenum SealingState {\n sealing\n sealed\n}\n\n/// What a ship is (decision 0044): argo the one operator, the viewer, an agent session, a person's ship or an app's.\nenum ShipKind {\n operator\n agent\n viewer\n person\n app\n plugin\n\n @@map(\"ship_kind\")\n}\n\n/// A durable, addressable identity with an inbox. Ids start with shp_.\n/// Scopes are set when the ship is created and checked before every call.\nmodel Ship {\n id String @id\n fleetId String @map(\"fleet_id\")\n name String\n type String\n kind ShipKind\n scopes String[]\n note String?\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n retiredAt DateTime? @map(\"retired_at\") @db.Timestamptz(3)\n /// When the pruning pass removed it, past the fleet's retention (decision 0070): the row stays a remnant its kept history names.\n removedAt DateTime? @map(\"removed_at\") @db.Timestamptz(3)\n /// The actor that commissioned it, its idempotency key and the request's hash; null for argo.\n /// commissioned_by names the actor: a ship's id, an account's id, or `installation`.\n commissionedByKind CommissionerKind? @map(\"commissioned_by_kind\")\n commissionedBy String? @map(\"commissioned_by\")\n commissionKey String? @map(\"commission_key\")\n commissionRequestHash String? @map(\"commission_request_hash\")\n /// The ship that answers for it, a person's ship or argo (decision 0045); null for argo and the viewer.\n ownerShipId String? @map(\"owner_ship_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n owner Ship? @relation(\"ShipOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)\n ownedShips Ship[] @relation(\"ShipOwner\")\n leases Lease[]\n credentials Credential[]\n sentMessages Message[] @relation(\"MessageSender\")\n addressedMessages Message[] @relation(\"MessageSelectorShip\")\n deliveries Delivery[] @relation(\"DeliveryRecipientShip\")\n claimedDeliveries Delivery[] @relation(\"DeliveryClaimedByShip\")\n overdueDeliveries OverdueDelivery[]\n consoleSessions ConsoleSession[]\n actorOfEvents Event[] @relation(\"EventActorShip\")\n actorThroughOfEvents Event[] @relation(\"EventActorThroughShip\")\n events Event[] @relation(\"EventShip\")\n crewRequest CrewRequest? @relation(\"CrewRequestShip\")\n assignedCrews CrewRequest[] @relation(\"CrewRequestAssignee\")\n requestedCrews CrewRequest[] @relation(\"CrewRequestRequester\")\n givenBackCrews CrewRequestGiveBack[] @relation(\"CrewRequestGiveBackTrierarch\")\n clearRequests WorktreeClearRequest[] @relation(\"WorktreeClearRequestTrierarch\")\n clearedWorktrees WorktreeClearRequest[] @relation(\"WorktreeClearRequestShip\")\n requestedClears WorktreeClearRequest[] @relation(\"WorktreeClearRequestRequester\")\n ownedLabels Label[] @relation(\"LabelOwner\")\n labels ShipLabel[] @relation(\"ShipLabelShip\")\n declaredNetworkRules DeclaredNetworkRules[]\n commissionApprovals CommissionApproval[]\n declaredNamespace ScopeNamespace?\n verifiedFacts VerifiedFacts[]\n alerts Alert[]\n shipExpectations ShipExpectations[]\n ownedMeetings Meeting[] @relation(\"MeetingOwner\")\n moderatedMeetings Meeting[] @relation(\"MeetingModerator\")\n openedMeetings Meeting[] @relation(\"MeetingOpener\")\n micHeldMeetings Meeting[] @relation(\"MeetingMicHolder\")\n meetings MeetingParticipant[]\n schedules Schedule[] @relation(\"ScheduleShip\")\n scheduledTo Schedule[] @relation(\"ScheduleSelectorShip\")\n exchanges Exchange[] @relation(\"ExchangeShip\")\n exchangedWith Exchange[] @relation(\"ExchangeOtherShip\")\n prunedExchanges PrunedExchange[] @relation(\"PrunedExchangeShip\")\n prunedExchangesWith PrunedExchange[] @relation(\"PrunedExchangeOtherShip\")\n\n @@unique([fleetId, id])\n /// An idempotency key is used once per commissioning actor.\n @@unique([fleetId, commissionedByKind, commissionedBy, commissionKey], map: \"ships_commission_key_key\")\n /// A name is unique among ships that are not retired, and reusable after retirement.\n @@unique([fleetId, name], map: \"ships_fleet_id_name_active_key\", where: { retiredAt: null })\n /// Exactly one operator ship per fleet.\n @@unique([fleetId], map: \"ships_fleet_id_operator_key\", where: raw(\"kind = 'operator'::ship_kind\"))\n /// At most one viewer ship per fleet (decision 0022).\n @@unique([fleetId], map: \"ships_fleet_id_viewer_key\", where: raw(\"kind = 'viewer'::ship_kind\"))\n @@index([fleetId, ownerShipId])\n @@index([fleetId, type], map: \"ships_type_listing_idx\", where: { retiredAt: null })\n @@index([fleetId, kind], map: \"ships_kind_listing_idx\", where: { retiredAt: null })\n /// The pruning pass picks the oldest retired ships not removed yet (decision 0070).\n @@index([fleetId, retiredAt, id], map: \"ships_removal_idx\", where: raw(\"((retired_at IS NOT NULL) AND (removed_at IS NULL))\"))\n @@map(\"ships\")\n}\n\n/// Where the session crewing a ship runs. OTHER carries a description; the other kinds none.\nenum ReportState {\n working\n blocked\n idle\n\n @@map(\"report_state\")\n}\n\n/// A pushed session's turn, as its hooks report it (decision 0040).\nenum LeaseWaker {\n trierarch\n pluginWatcher\n personApp\n gateway\n adapter\n\n @@map(\"lease_waker\")\n}\n\nenum TurnState {\n idle\n busy\n\n @@map(\"turn_state\")\n}\n\n/// The kind of a session's latest event as its trierarch observes it (headless design, H14).\nenum ActivityKind {\n text\n tool\n result\n error\n\n @@map(\"activity_kind\")\n}\n\nenum LocationKind {\n DEVICE\n CLOUD\n SERVER\n OTHER\n\n @@map(\"location_kind\")\n}\n\n/// The exclusive right of one session to crew a ship, and where that session runs.\n/// Ids start with lse_.\n/// The hash of the crew token register gave the session, unique across all fleets:\n/// finding a ship by its crew token is a lookup not scoped by fleet (ADR 0007). A\n/// console session's lease on argo has none; the console session holds its token.\nmodel Lease {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n location LocationKind\n locationDescription String? @map(\"location_description\")\n /// The harness the session stated when it claimed the ship; none for argo's console lease and for leases from before harnesses were stated.\n harness String?\n crewTokenHash String? @unique @map(\"crew_token_hash\")\n startedAt DateTime @map(\"started_at\") @db.Timestamptz(3)\n /// The last call by its crew: observation only, nothing acts on it (ADR 0016).\n lastSeenAt DateTime? @map(\"last_seen_at\") @db.Timestamptz(3)\n /// The crew's last report: plain data, nothing acts on it. Null until it reports.\n reportState ReportState? @map(\"report_state\")\n reportNote String? @map(\"report_note\")\n reportedAt DateTime? @map(\"reported_at\") @db.Timestamptz(3)\n /// When the state, note, task or step last changed; details alone do not move it (decision 0028). Null until it reports.\n reportChangedAt DateTime? @map(\"report_changed_at\") @db.Timestamptz(3)\n /// What the crew works on: a typed reference, a kind and its fields (decision 0028). Null when it names none.\n reportTask Json? @map(\"report_task\")\n /// Where the crew is in its task, step at of of; both null when it gives none.\n reportStepAt Int? @map(\"report_step_at\")\n reportStepOf Int? @map(\"report_step_of\")\n /// The report's details: one JSON object stored without meaning, at most 16 KB (decision 0028). Null when there are none.\n reportDetails Json? @map(\"report_details\")\n /// Moves by one each time the details change; 0 before any.\n reportDetailsVersion Int @default(0) @map(\"report_details_version\")\n /// 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).\n statement Json?\n /// Moves by one each time the statement changes; 0 before any.\n statementVersion Int @default(0) @map(\"statement_version\")\n /// From the lease's first push receive: the computer side takes its deliveries, and the agent's plain receive answers nothing (decision 0040).\n pushedAt DateTime? @map(\"pushed_at\") @db.Timestamptz(3)\n /// What wakes the ship, as its first push receive stated it; null when it stated none (interop 5.1).\n waker LeaseWaker?\n /// The session's turn as its hooks last reported it, and when they saw it change; null until they report (decision 0040).\n turn TurnState?\n turnAt DateTime? @map(\"turn_at\") @db.Timestamptz(3)\n /// 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).\n activityAt DateTime? @map(\"activity_at\") @db.Timestamptz(3)\n activityKind ActivityKind? @map(\"activity_kind\")\n activityTool String? @map(\"activity_tool\")\n /// When the trierarch wrote it, and the report interval it stated: past twice that interval it reads unknown.\n activityReportedAt DateTime? @map(\"activity_reported_at\") @db.Timestamptz(3)\n activityIntervalSeconds Int? @map(\"activity_interval_seconds\")\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n consoleSessions ConsoleSession[]\n claimedDeliveries Delivery[]\n overdueDeliveries OverdueDelivery[]\n\n @@unique([fleetId, id])\n /// At most one open lease per ship.\n @@unique([shipId], map: \"leases_ship_id_open_key\", where: { endedAt: null })\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@map(\"leases\")\n}\n\n/// How the assigned trierarch says its crew of a ship stands (decision 0029).\nenum CrewStatus {\n crewing\n running\n restarting\n crashed\n releasing\n\n @@map(\"crew_status\")\n}\n\n/// A standing request that a ship be kept crewed (decision 0029): at most one per\n/// ship, so the ship's id is its key. Its settings are crew settings of at most\n/// 16 KB, checked but never acted on; each request replaces them and moves their\n/// version by one.\nmodel CrewRequest {\n shipId String @id @map(\"ship_id\")\n fleetId String @map(\"fleet_id\")\n settings Json\n settingsVersion Int @map(\"settings_version\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n /// The ship that made it last; null for a request made before it was recorded.\n requestedBy String? @map(\"requested_by_ship_id\")\n /// The trierarch ship it is assigned to; null while unassigned.\n assignedTo String? @map(\"assigned_to_ship_id\")\n /// How its trierarch says the crew stands; null until it says.\n status CrewStatus?\n /// Why no trierarch can take it, written by the assigner while unassigned; null when none.\n reason String?\n /// How many times its trierarch restarted the session within its restart window, with the status: 0 on its first start.\n attempt Int @default(0)\n /// When the session its trierarch runs now started, with the status; null while none runs.\n sessionStartedAt DateTime? @map(\"session_started_at\") @db.Timestamptz(3)\n /// Whether its crew is final: set by its trierarch's first running, restarting or crashed, kept whatever status follows, cleared on every new settings version.\n isFinal Boolean @default(false) @map(\"is_final\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"CrewRequestShip\", fields: [fleetId, shipId], references: [fleetId, id])\n assignee Ship? @relation(\"CrewRequestAssignee\", fields: [fleetId, assignedTo], references: [fleetId, id])\n requester Ship? @relation(\"CrewRequestRequester\", fields: [fleetId, requestedBy], references: [fleetId, id])\n givenBack CrewRequestGiveBack[]\n\n @@unique([fleetId, shipId])\n /// A trierarch reads the requests assigned to it.\n @@index([fleetId, assignedTo])\n /// A delete of a ship checks the requests it made with an index.\n @@index([fleetId, requestedBy])\n @@map(\"crew_requests\")\n}\n\n/// A trierarch that gave a crew request back before its crew was final (#382): one per trierarch, until the next settings version.\nmodel CrewRequestGiveBack {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n trierarchShipId String @map(\"trierarch_ship_id\")\n settingsVersion Int @map(\"settings_version\")\n reason String\n givenBackAt DateTime @map(\"given_back_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n crewRequest CrewRequest @relation(fields: [fleetId, shipId], references: [fleetId, shipId])\n trierarch Ship @relation(\"CrewRequestGiveBackTrierarch\", fields: [fleetId, trierarchShipId], references: [fleetId, id])\n\n @@id([fleetId, shipId, trierarchShipId])\n @@index([fleetId, trierarchShipId])\n @@map(\"crew_request_give_backs\")\n}\n\n/// A pending request that a trierarch clear a worktree it kept (decision 0032),\n/// named by the ship it belonged to and its repository: never a path.\nmodel WorktreeClearRequest {\n fleetId String @map(\"fleet_id\")\n trierarchShipId String @map(\"trierarch_ship_id\")\n shipId String @map(\"ship_id\")\n repository String\n requestedBy String @map(\"requested_by_ship_id\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n trierarch Ship @relation(\"WorktreeClearRequestTrierarch\", fields: [fleetId, trierarchShipId], references: [fleetId, id])\n ship Ship @relation(\"WorktreeClearRequestShip\", fields: [fleetId, shipId], references: [fleetId, id])\n requester Ship @relation(\"WorktreeClearRequestRequester\", fields: [fleetId, requestedBy], references: [fleetId, id])\n\n @@id([fleetId, trierarchShipId, shipId, repository])\n @@index([fleetId, shipId])\n @@index([fleetId, requestedBy])\n @@map(\"worktree_clear_requests\")\n}\n\n/// A label (decision 0031): a key unique in its fleet with its defined values,\n/// owned by the ship that defined it. Ids start with lbl_. A retired or deleted\n/// label is deleted with its values; its events stay.\nmodel Label {\n id String @id\n fleetId String @map(\"fleet_id\")\n key String\n /// A ship or the installation (decision 0031); the installation's label names no owner ship.\n ownerKind LabelOwnerKind @default(ship) @map(\"owner_kind\")\n ownerShipId String? @map(\"owner_ship_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n owner Ship? @relation(\"LabelOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id])\n values LabelValue[]\n carriers ShipLabel[]\n\n @@unique([fleetId, id])\n @@unique([fleetId, key])\n /// A retire finds the labels its ship owns.\n @@index([fleetId, ownerShipId])\n @@map(\"labels\")\n}\n\n/// One value of a label, each once, at most 50 a label. Ids start with lbv_; a\n/// value keeps its id while its label has it.\nmodel LabelValue {\n id String @id\n fleetId String @map(\"fleet_id\")\n labelId String @map(\"label_id\")\n value String\n /// Its place in the order the owner gave the values.\n position Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n label Label @relation(fields: [fleetId, labelId], references: [fleetId, id])\n carriers ShipLabel[]\n\n @@unique([fleetId, id])\n @@unique([fleetId, labelId, value])\n @@map(\"label_values\")\n}\n\n/// A label value a ship carries: a ship holds a set of values, so the ship and\n/// the value are its key.\nmodel ShipLabel {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n labelId String @map(\"label_id\")\n valueId String @map(\"value_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ShipLabelShip\", fields: [fleetId, shipId], references: [fleetId, id])\n label Label @relation(fields: [fleetId, labelId], references: [fleetId, id])\n value LabelValue @relation(fields: [fleetId, valueId], references: [fleetId, id])\n\n @@id([fleetId, shipId, valueId])\n /// A change of values, a delete and a retire find every ship that carries a label.\n @@index([fleetId, labelId])\n /// Removing a value checks that no ship carries it.\n @@index([fleetId, valueId])\n @@map(\"ship_labels\")\n}\n\n/// A fleet's network settings (decision 0034), once it first set rules: its\n/// rules as JSON, none (null) for all-to-all, and their version. A send and a\n/// set take turns on an advisory lock on them (network.ts).\nmodel NetworkSettings {\n fleetId String @id @map(\"fleet_id\")\n /// The fleet's own rules as last applied (decision 0034); NULL while none\n /// are, all-to-all with open on.\n rules Json?\n /// The viewer reading every ship, the built-in rule an actor turns (decision 0034). On at fleet create.\n builtInViewerRead Boolean @default(true) @map(\"built_in_viewer_read\")\n version Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"network_settings\")\n}\n\n/// The draft of a fleet's own rules (decision 0034): one a fleet at most, the\n/// rules as JSON or NULL for all-to-all. Nothing in force reads it; an apply\n/// moves it into network_settings and removes it.\nmodel NetworkRulesDraft {\n fleetId String @id @map(\"fleet_id\")\n rules Json?\n savedAt DateTime @map(\"saved_at\") @db.Timestamptz(3)\n savedAgainstVersion Int @map(\"saved_against_version\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"network_rules_drafts\")\n}\n\n/// The network rules a ship declared on the labels it owns (decision 0037),\n/// its whole list as JSON, at most 20. No row while it declares none; a retire\n/// removes its row.\nmodel DeclaredNetworkRules {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n rules Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId])\n @@map(\"declared_network_rules\")\n}\n\n/// The network rules the installation declares on the labels it owns in one\n/// fleet (decisions 0037, 0052), its whole list as JSON; no row while it\n/// declares none.\nmodel InstallationDeclaredNetworkRules {\n fleetId String @id @map(\"fleet_id\")\n rules Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"installation_declared_network_rules\")\n}\n\n/// A plugin's namespace (decision 0046): taken up for good by the ship that\n/// declared it, one per ship and unique in the fleet, with its whole list of\n/// scopes and their descriptions as JSON, in order. It goes when its declarer\n/// retires.\nmodel ScopeNamespace {\n fleetId String @map(\"fleet_id\")\n namespace String\n declaredBy String @map(\"declared_by\")\n scopes Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n declarer Ship @relation(fields: [fleetId, declaredBy], references: [fleetId, id])\n\n @@id([fleetId, namespace])\n @@unique([fleetId, declaredBy])\n @@map(\"scope_namespaces\")\n}\n\n/// One of the fleet's own scopes (design gateway-scopes, 4.1), with its one-line description.\nmodel DefinedScope {\n fleetId String @map(\"fleet_id\")\n scope String\n description String\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, scope])\n @@map(\"defined_scopes\")\n}\n\n/// One writer's verified facts about a ship (decision 0059): what it checked,\n/// as JSON in the shape common gives, set whole and kept with the ship. The\n/// writer is an actor: a ship or an account by its id, or the installation\n/// by its name, as a commissioning actor is.\nmodel VerifiedFacts {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n writerKind FactWriterKind @map(\"writer_kind\")\n writer String\n facts Json\n writtenAt DateTime @map(\"written_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId, writerKind, writer])\n /// A retiring writer finds its facts about every ship.\n @@index([fleetId, writerKind, writer])\n @@map(\"verified_facts\")\n}\n\n/// An alert on a ship (decision 0071): what the watch raised when a fact and\n/// its signal parted, open until the watch clears it or the ship retires.\n/// Ids start with alt_. One per ship, signal and occurrence, open or cleared,\n/// so an occurrence is raised once. facts holds the signal's facts at raise,\n/// as common's schema gives them.\nmodel Alert {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n signal String\n occurrenceKey String @map(\"occurrence_key\")\n facts Json\n ownerShipId String? @map(\"owner_ship_id\")\n since DateTime @db.Timestamptz(3)\n raisedAt DateTime @map(\"raised_at\") @db.Timestamptz(3)\n clearedAt DateTime? @map(\"cleared_at\") @db.Timestamptz(3)\n clearedWhy String? @map(\"cleared_why\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@unique([fleetId, shipId, signal, occurrenceKey])\n /// The fleet's open alerts, newest first, a page at a time.\n @@index([fleetId, id(sort: Desc)], map: \"alerts_open_idx\", where: { clearedAt: null })\n /// A ship's open alerts, and how many it has.\n @@index([fleetId, shipId], map: \"alerts_open_on_ship_idx\", where: { clearedAt: null })\n @@map(\"alerts\")\n}\n\n/// The expectations on a ship (decision 0071): what its owner, or a ship\n/// that manages it, expects of it, standing, at most one of each. Each keeps\n/// who set it (JSON, as common's expectation setter) and when; its columns\n/// are null while it is not set. No row while none holds; a retire removes it.\nmodel ShipExpectations {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n reportChangesWithinMinutes Int? @map(\"report_changes_within_minutes\")\n reportChangesWithinSetBy Json? @map(\"report_changes_within_set_by\")\n reportChangesWithinSetAt DateTime? @map(\"report_changes_within_set_at\") @db.Timestamptz(3)\n taskDoneByTask Json? @map(\"task_done_by_task\")\n taskDoneBy DateTime? @map(\"task_done_by\") @db.Timestamptz(3)\n taskDoneBySetBy Json? @map(\"task_done_by_set_by\")\n taskDoneBySetAt DateTime? @map(\"task_done_by_set_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId])\n @@map(\"ship_expectations\")\n}\n\n/// A send the network rules refused (decision 0034), recorded in the\n/// transaction that refused it. Ids start with rfs_. Sender and recipient are\n/// as they were then: ids, names and the label values they carried, as JSON,\n/// so a later rename or relabelling keeps the record true. Only argo reads it.\nmodel ReachRefusal {\n id String @id\n fleetId String @map(\"fleet_id\")\n at DateTime @db.Timestamptz(3)\n sender Json\n /// The plugin ship that read on behalf of the sender (decision 0034); null for the sender's own call.\n askedBy Json? @map(\"asked_by\")\n recipient Json\n /// What the sender tried to do: send, read or manage (decision 0034).\n verb String\n settingsVersion Int @map(\"settings_version\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n /// They page newest first by id.\n @@index([fleetId, id])\n @@map(\"reach_refusals\")\n}\n\n/// A ship secret, stored only as its hash. Ids start with crd_.\n/// The hash is unique across all fleets: finding a ship by its secret is one of the\n/// lookups not scoped by fleet (ADR 0007).\nmodel Credential {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n secretHash String @unique @map(\"secret_hash\")\n issuedAt DateTime @map(\"issued_at\") @db.Timestamptz(3)\n claimedAt DateTime? @map(\"claimed_at\") @db.Timestamptz(3)\n invalidatedAt DateTime? @map(\"invalidated_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n /// At most one valid secret per ship.\n @@unique([shipId], map: \"credentials_ship_id_valid_key\", where: { invalidatedAt: null })\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@map(\"credentials\")\n}\n\n/// Who a message is for: one ship or any ship of a type. Group and fleet come later.\nenum SelectorKind {\n ship\n type\n meeting\n label\n\n @@map(\"selector_kind\")\n}\n\n/// The messages a fleet stored on one UTC day and their payloads' UTF-8 bytes\n/// (performance design, decision 1). A unit of work adds to it as its last\n/// statements, after the fleet's event numbers, so the row lock is held only\n/// until commit. Storage is the sum of the days; the daily message limit\n/// counts today's row.\n/// A feature flag that is on for a fleet (decision 0069): a row per flag that\n/// is on, none being off. The flag by its key in common's list, as text, so a\n/// new flag needs no migration.\nmodel FleetFeatureFlag {\n fleetId String @map(\"fleet_id\")\n flag String\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, flag])\n @@map(\"fleet_feature_flags\")\n}\n\nmodel MessageDay {\n fleetId String @map(\"fleet_id\")\n day DateTime @db.Date\n messages Int\n payloadBytes BigInt @map(\"payload_bytes\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, day])\n @@map(\"message_days\")\n}\n\n/// A fleet's cursor of the fill after start (docs/architecture.md, Backfills): the last message it visited\n/// by id and the last exchange by key, committed with each batch.\nmodel MessageMetadataBackfill {\n fleetId String @id @map(\"fleet_id\")\n afterMessageId String? @map(\"after_message_id\")\n afterShipId String? @map(\"after_ship_id\")\n afterOtherShipId String? @map(\"after_other_ship_id\")\n isComplete Boolean @default(false) @map(\"is_complete\")\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Cascade)\n\n @@map(\"message_metadata_backfills\")\n}\n\n/// The rollup of a person ship's list of exchanges (docs/design/exchange-read, E4, E5): per other ship it\n/// exchanged with, the newest message between them and how many of the other ship's deliveries to it are\n/// not yet acknowledged. Written in the transactions that make and change deliveries, never counted from history.\nmodel Exchange {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n otherShipId String @map(\"other_ship_id\")\n newestMessageId String @map(\"newest_message_id\")\n unacknowledged Int @default(0)\n unseenPlainMessages Int? @map(\"unseen_plain_messages\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ExchangeShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n otherShip Ship @relation(\"ExchangeOtherShip\", fields: [fleetId, otherShipId], references: [fleetId, id], onDelete: Restrict)\n newestMessage Message @relation(fields: [fleetId, newestMessageId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, shipId, otherShipId])\n /// The list pages a ship's rows newest first.\n @@index([fleetId, shipId, newestMessageId])\n @@index([fleetId, otherShipId])\n @@index([fleetId, newestMessageId])\n @@map(\"exchanges\")\n}\n\n/// How far pruning went in one exchange (docs/design/exchange-history): the send time of the newest\n/// message of the two ships' exchange that pruning removed, only ever moved forward. One row per pair,\n/// the lower ship id first; a ship's exchange with itself names it twice. Written only by the pruning\n/// batch, in its transaction. No foreign key to a message: what it points at is gone.\nmodel PrunedExchange {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n otherShipId String @map(\"other_ship_id\")\n prunedUpTo DateTime @map(\"pruned_up_to\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Restrict)\n ship Ship @relation(\"PrunedExchangeShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n otherShip Ship @relation(\"PrunedExchangeOtherShip\", fields: [fleetId, otherShipId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, shipId, otherShipId])\n /// Backs the foreign key to the other ship; the read uses the primary key alone.\n @@index([fleetId, otherShipId])\n @@map(\"pruned_exchanges\")\n}\n\n/// An immutable envelope plus an opaque payload of at most 256 KB, sent by one ship.\n/// Ids start with msg_. The selector is stored as resolved at send time: a ship's\n/// id, never its name, or a type. It can name the message it replies to, and a\n/// resend names the message it resends (nothing sets that yet).\nmodel Message {\n id String @id\n fleetId String @map(\"fleet_id\")\n senderShipId String @map(\"sender_ship_id\")\n selectorKind SelectorKind @map(\"selector_kind\")\n selectorShipId String? @map(\"selector_ship_id\")\n selectorType String? @map(\"selector_type\")\n /// The label selection a send to a label was sent to, its value ids as sent (decision 0065); none for any other selector.\n selectorValueIds String[] @default([]) @map(\"selector_value_ids\")\n /// Null in a sealed fleet (decision 0068): the sealed payload is the data key, nonce and ciphertext with its tag,\n /// beside the plain payload's UTF-8 byte count.\n payload String?\n sealedDataKeyId String? @map(\"sealed_data_key_id\")\n sealedNonce Bytes? @map(\"sealed_nonce\")\n sealedCiphertext Bytes? @map(\"sealed_ciphertext\")\n sealedPayloadBytes Int? @map(\"sealed_payload_bytes\")\n /// The question uuid a withdrawal or a replacement names, read at send (decision 0068, B18).\n questionId String? @map(\"question_id\")\n /// The question uuid a question or a replacement asks, and the one an answer names, read at send (#1632).\n askedQuestionId String? @map(\"asked_question_id\")\n answeredQuestionId String? @map(\"answered_question_id\")\n contentType String @map(\"content_type\")\n /// The model the sender's session stated; none from argo and on messages from before models were stated.\n model String?\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n /// The message it replies to and the one it resends, as written: no foreign\n /// key, so a kept message may name one that is no longer kept (decision 0066).\n inReplyToMessageId String? @map(\"in_reply_to_message_id\")\n resendOfMessageId String? @map(\"resend_of_message_id\")\n /// The meeting it was sent to, or the meeting whose added notice it is (decision 0061).\n meetingId String? @map(\"meeting_id\")\n /// The schedule it was sent for, and that send time; none on a live send (decision 0062).\n scheduleId String? @map(\"schedule_id\")\n sendTime DateTime? @map(\"send_time\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n senderShip Ship @relation(\"MessageSender\", fields: [fleetId, senderShipId], references: [fleetId, id], onDelete: Restrict)\n selectorShip Ship? @relation(\"MessageSelectorShip\", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)\n meeting Meeting? @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n schedule Schedule? @relation(\"MessageSchedule\", fields: [fleetId, scheduleId], references: [fleetId, id], onDelete: Restrict)\n sealedDataKey DataKey? @relation(fields: [fleetId, sealedDataKeyId], references: [fleetId, id], onDelete: Restrict)\n repliedToBySchedules Schedule[] @relation(\"ScheduleInReplyTo\")\n lastSentBySchedules Schedule[] @relation(\"ScheduleLastMessage\")\n deliveries Delivery[]\n events Event[]\n exchangesNewest Exchange[]\n\n @@unique([fleetId, id])\n /// A sender uses an idempotency key once: a repeat of the same request, told by its\n /// request hash, returns the original message; another request with the key is refused.\n @@unique([fleetId, senderShipId, idempotencyKey])\n /// A ship's current model is its newest message with a model.\n @@index([fleetId, senderShipId, createdAt])\n /// A ship's messages page newest first by id: those it sent and those sent to it.\n @@index([fleetId, senderShipId, id])\n /// The installation counts a fleet's messages of the last 7 days (#1126).\n @@index([fleetId, createdAt])\n /// A question's withdrawals and replacements, found by the question uuid they name (decisions 0038, 0068).\n @@index([fleetId, questionId], map: \"messages_fleet_id_question_id_idx\", where: { questionId: { not: null } })\n /// The questions a ship asked, by message id: its open ones are selected along it when it retires (#1632).\n @@index([fleetId, senderShipId, id], map: \"messages_fleet_id_sender_ship_id_id_asked_idx\", where: { askedQuestionId: { not: null } })\n /// A data key's sealed messages, for its foreign key.\n @@index([fleetId, sealedDataKeyId])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, selectorShipId, id])\n @@index([fleetId, inReplyToMessageId])\n @@index([fleetId, resendOfMessageId])\n /// The messages a schedule sent (decision 0062): the foreign key's index (#331).\n @@index([fleetId, scheduleId])\n /// A meeting's contributions page newest first by id (decision 0061).\n @@index([fleetId, meetingId, id])\n @@index([fleetId, selectorShipId, createdAt, id], map: \"messages_pings_idx\", where: raw(\"(content_type = 'application/vnd.aeolus.ping'::text)\"))\n @@map(\"messages\")\n}\n\nenum DeliveryState {\n pending\n received\n handed\n acknowledged\n handled\n notHandled\n undeliverable\n dismissed\n abandoned\n\n @@map(\"delivery_state\")\n}\n\n/// One message to one resolved recipient: a ship or a type. Ids start with dlv_.\n/// A receive hands it to the ship and the lease of the crew receiving, or a push\n/// receive takes it for them: set while it is received or handed, kept once\n/// acknowledged, none while it is pending. Attempts count the hand-overs; the fifth\n/// makes it undeliverable. The hand-over number is the last one the crew reported\n/// with handed (decision 0040), none while pending.\n/// The read date is set when the operator opens a message to argo.\n/// For a type under network rules, the ships of the type its sender may reach,\n/// fixed at send time: only they claim it (decision 0034). Empty: any ship of\n/// the type, as a send no ship of the type may take is refused.\n/// A meeting of ships (decision 0061), id mtg_: one owner and one moderator,\n/// both participants, the opener at first.\nmodel Meeting {\n id String @id\n fleetId String @map(\"fleet_id\")\n title String?\n ownerShipId String @map(\"owner_ship_id\")\n moderatorShipId String @map(\"moderator_ship_id\")\n openedByShipId String @map(\"opened_by_ship_id\")\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n openedAt DateTime @map(\"opened_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n /// The participant that holds the mic; none while it is free.\n micHolderShipId String? @map(\"mic_holder_ship_id\")\n micPattern MicPattern @default(moderator) @map(\"mic_pattern\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n micHolder Ship? @relation(\"MeetingMicHolder\", fields: [fleetId, micHolderShipId], references: [fleetId, id], onDelete: Restrict)\n micRequests MeetingMicRequest[]\n owner Ship @relation(\"MeetingOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)\n moderator Ship @relation(\"MeetingModerator\", fields: [fleetId, moderatorShipId], references: [fleetId, id], onDelete: Restrict)\n openedBy Ship @relation(\"MeetingOpener\", fields: [fleetId, openedByShipId], references: [fleetId, id], onDelete: Restrict)\n participants MeetingParticipant[]\n messages Message[]\n\n @@unique([fleetId, id])\n /// An opener uses an idempotency key once.\n @@unique([fleetId, openedByShipId, idempotencyKey])\n /// Every foreign key has an index leading with its columns (#331).\n @@index([fleetId, ownerShipId])\n @@index([fleetId, moderatorShipId])\n @@index([fleetId, micHolderShipId])\n @@map(\"meetings\")\n}\n\n/// How a meeting's free mic passes (decision 0061, M9): the moderator's pick, or the oldest request.\n/// A ship's scheduled message (decision 0062): its send input as given, its timing and\n/// refusal strategy, its state, next send time and attempt, and its last outcome.\nmodel Schedule {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n /// The selector as the creator gave it: a ship by id or by name, a type, or a label selection by value ids; never a meeting.\n selectorKind SelectorKind @map(\"selector_kind\")\n selectorShipId String? @map(\"selector_ship_id\")\n selectorShipName String? @map(\"selector_ship_name\")\n selectorType String? @map(\"selector_type\")\n selectorValueIds String[] @default([]) @map(\"selector_value_ids\")\n /// Null in a sealed fleet (decision 0068): the sealed payload is the data key, nonce and ciphertext with its tag,\n /// beside the plain payload's UTF-8 byte count, as a message's.\n payload String?\n sealedDataKeyId String? @map(\"sealed_data_key_id\")\n sealedNonce Bytes? @map(\"sealed_nonce\")\n sealedCiphertext Bytes? @map(\"sealed_ciphertext\")\n sealedPayloadBytes Int? @map(\"sealed_payload_bytes\")\n contentType String @map(\"content_type\")\n model String?\n inReplyToMessageId String? @map(\"in_reply_to_message_id\")\n isForced Boolean @map(\"is_forced\")\n timingKind ScheduleTimingKind @map(\"timing_kind\")\n /// The timing: once an instant; every a duration, or a cron and its zone, each from a start to an end or a count of sends.\n onceAt DateTime? @map(\"once_at\") @db.Timestamptz(3)\n every String?\n cron String?\n timeZone String? @map(\"time_zone\")\n start DateTime? @db.Timestamptz(3)\n end DateTime? @db.Timestamptz(3)\n count Int?\n onRefused RefusalStrategy @map(\"on_refused\")\n retryWindow String @map(\"retry_window\")\n onMissed MissedStrategy @map(\"on_missed\")\n grace String\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n state ScheduleState\n nextSendTime DateTime? @map(\"next_send_time\") @db.Timestamptz(3)\n nextAttemptAt DateTime? @map(\"next_attempt_at\") @db.Timestamptz(3)\n lastOutcomeKind ScheduleOutcomeKind? @map(\"last_outcome_kind\")\n lastMessageId String? @map(\"last_message_id\")\n lastRefusalCode String? @map(\"last_refusal_code\")\n lastSendTime DateTime? @map(\"last_send_time\") @db.Timestamptz(3)\n lastOutcomeAt DateTime? @map(\"last_outcome_at\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n cancelledAt DateTime? @map(\"cancelled_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ScheduleShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n selectorShip Ship? @relation(\"ScheduleSelectorShip\", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)\n inReplyTo Message? @relation(\"ScheduleInReplyTo\", fields: [fleetId, inReplyToMessageId], references: [fleetId, id], onDelete: Restrict)\n sealedDataKey DataKey? @relation(fields: [fleetId, sealedDataKeyId], references: [fleetId, id], onDelete: Restrict)\n lastMessage Message? @relation(\"ScheduleLastMessage\", fields: [fleetId, lastMessageId], references: [fleetId, id], onDelete: Restrict)\n messages Message[] @relation(\"MessageSchedule\")\n\n @@unique([fleetId, id])\n /// A ship uses an idempotency key once for its schedules.\n @@unique([fleetId, shipId, idempotencyKey])\n /// A ship's schedules page newest first by id.\n @@index([fleetId, shipId, id])\n /// The claim of the active schedules that are due, earliest attempt first.\n @@index([fleetId, nextAttemptAt, id], map: \"schedules_due_idx\", where: raw(\"(state = 'active'::schedule_state)\"))\n /// Every foreign key has an index leading with its columns (#331).\n @@index([fleetId, selectorShipId])\n @@index([fleetId, inReplyToMessageId])\n @@index([fleetId, lastMessageId])\n @@index([fleetId, sealedDataKeyId])\n @@map(\"schedules\")\n}\n\nenum ScheduleState {\n active\n paused\n ended\n cancelled\n\n @@map(\"schedule_state\")\n}\n\nenum ScheduleTimingKind {\n once\n every\n cron\n\n @@map(\"schedule_timing_kind\")\n}\n\nenum RefusalStrategy {\n skip\n retry\n pause\n\n @@map(\"refusal_strategy\")\n}\n\nenum MissedStrategy {\n each\n once\n skip\n\n @@map(\"missed_strategy\")\n}\n\nenum ScheduleOutcomeKind {\n sent\n refused\n missed\n\n @@map(\"schedule_outcome_kind\")\n}\n\nenum MicPattern {\n moderator\n fifo\n\n @@map(\"mic_pattern\")\n}\n\n/// A participant waiting for the mic of its meeting, since its time (decision 0061, M8): once per meeting.\nmodel MeetingMicRequest {\n fleetId String @map(\"fleet_id\")\n meetingId String @map(\"meeting_id\")\n shipId String @map(\"ship_id\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n /// Its place on the list, the oldest request's 0.\n place Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n participant MeetingParticipant @relation(fields: [fleetId, meetingId, shipId], references: [fleetId, meetingId, shipId], onDelete: Restrict)\n\n @@id([fleetId, meetingId, shipId])\n @@map(\"meeting_mic_requests\")\n}\n\n/// A ship in a meeting and when it joined (decision 0061): once per meeting.\nmodel MeetingParticipant {\n fleetId String @map(\"fleet_id\")\n meetingId String @map(\"meeting_id\")\n shipId String @map(\"ship_id\")\n joinedAt DateTime @map(\"joined_at\") @db.Timestamptz(3)\n /// Its place in the order the meeting's ships joined, the opener's 0.\n place Int\n /// When it left or was revoked; none while it is present (decision 0061, M13).\n leftAt DateTime? @map(\"left_at\") @db.Timestamptz(3)\n /// Whether the owner revoked its right to rejoin.\n isRevoked Boolean @default(false) @map(\"is_revoked\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n micRequest MeetingMicRequest?\n\n @@id([fleetId, meetingId, shipId])\n /// A ship's meetings, and a retire checking them.\n @@index([fleetId, shipId])\n @@map(\"meeting_participants\")\n}\n\nmodel Delivery {\n id String @id\n fleetId String @map(\"fleet_id\")\n messageId String @map(\"message_id\")\n recipientShipId String? @map(\"recipient_ship_id\")\n recipientType String? @map(\"recipient_type\")\n state DeliveryState @default(pending)\n claimedByShipId String? @map(\"claimed_by_ship_id\")\n claimedByLeaseId String? @map(\"claimed_by_lease_id\")\n attempts Int @default(0)\n handOverNumber Int? @map(\"hand_over_number\")\n /// When its crew handed it once more after the turn that took it died; only once (decision 0040).\n handedOnceMoreAt DateTime? @map(\"handed_once_more_at\") @db.Timestamptz(3)\n /// Whether its message was forced: it comes first in receive and push receive (decision 0040).\n isForced Boolean @default(false) @map(\"is_forced\")\n reachableShipIds String[] @default([]) @map(\"reachable_ship_ids\")\n /// Its message's sender, and whether its message is in an exchange: no meeting, no ping (docs/design/exchange-read, E1, E3).\n senderShipId String @map(\"sender_ship_id\")\n isInExchange Boolean @default(false) @map(\"is_in_exchange\")\n /// The ship it reached: its recipient, or the ship of its type that claimed it. Generated by the database from the two, never written.\n reachedShipId String? @default(dbgenerated(\"COALESCE(recipient_ship_id, claimed_by_ship_id)\")) @map(\"reached_ship_id\")\n readAt DateTime? @map(\"read_at\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n message Message @relation(fields: [fleetId, messageId], references: [fleetId, id])\n recipientShip Ship? @relation(\"DeliveryRecipientShip\", fields: [fleetId, recipientShipId], references: [fleetId, id], onDelete: Restrict)\n claimedByShip Ship? @relation(\"DeliveryClaimedByShip\", fields: [fleetId, claimedByShipId], references: [fleetId, id], onDelete: Restrict)\n claimedByLease Lease? @relation(fields: [fleetId, claimedByLeaseId], references: [fleetId, id], onDelete: Restrict)\n events Event[]\n overdue OverdueDelivery[]\n\n @@unique([fleetId, id])\n /// One row per recipient.\n @@unique([messageId, recipientShipId])\n @@unique([messageId, recipientType])\n @@index([fleetId, recipientShipId, state])\n /// A ship's inbox pages newest first by id.\n @@index([fleetId, recipientShipId, id])\n @@index([fleetId, recipientType, state])\n /// The installation's health figures scan a fleet's open deliveries by state (decision 0041). Partial, so a foreign key check never picks it.\n @@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]))\"))\n /// A crew's own deliveries in flight, which its next receive returns first.\n @@index([fleetId, claimedByLeaseId, state])\n /// 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.\n @@index([fleetId, claimedByShipId, id], map: \"deliveries_record_fleet_id_claimed_by_ship_id_id_idx\", where: raw(\"(recipient_type IS NOT NULL)\"))\n /// Seen up to here finds the deliveries of its type a ship claimed that are still in flight (docs/design/exchange-read, E6). Partial, so a foreign key check never picks it.\n @@index([fleetId, claimedByShipId, id], map: \"deliveries_in_flight_claimed_idx\", where: raw(\"((recipient_type IS NOT NULL) AND (state = ANY (ARRAY['received'::delivery_state, 'handed'::delivery_state])))\"))\n /// One exchange page is two range scans, one per direction (docs/design/exchange-read, E3). Partial, so a foreign key check never picks it.\n @@index([fleetId, reachedShipId, senderShipId, id], map: \"deliveries_exchange_idx\", where: raw(\"is_in_exchange\"))\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, messageId, id])\n @@index([fleetId, claimedByShipId])\n @@map(\"deliveries\")\n}\n\n/// Which of the 10 and 60 minute clocks ran out (decision 0040).\nenum OverdueClock {\n notConfirmed\n idle\n busy\n\n @@map(\"overdue_clock\")\n}\n\n/// A delivery argo was told is overdue on a pushed lease: its clock ran out\n/// while it waited in the state kept here. Once per lease and delivery, so a\n/// pass after a restart, or a second pass at once, tells nothing again.\nmodel OverdueDelivery {\n fleetId String @map(\"fleet_id\")\n leaseId String @map(\"lease_id\")\n deliveryId String @map(\"delivery_id\")\n shipId String @map(\"ship_id\")\n state DeliveryState\n clock OverdueClock\n minutes Int\n toldAt DateTime @map(\"told_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n lease Lease @relation(fields: [fleetId, leaseId], references: [fleetId, id], onDelete: Restrict)\n delivery Delivery @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, leaseId, deliveryId])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, deliveryId])\n @@index([fleetId, shipId])\n @@map(\"overdue_deliveries\")\n}\n\n/// The stuck snapshot (docs/design/performance/performance.md, section 5):\n/// one row per fleet and closed hour, written once by the 30 second pass and\n/// kept for 168 hours. Its counts are by message parties, so a read counts\n/// only what its caller reads (decision 0034).\nmodel HealthSnapshot {\n fleetId String @map(\"fleet_id\")\n hour DateTime @db.Timestamptz(3)\n /// The last event folded into it, by its seq.\n seq BigInt\n /// Stuck at the hour mark: cause, place, message parties, count and oldest since, each.\n stuck Json\n /// The waits from send to acknowledgement in the hour, by message parties, as counts per duration bucket.\n acknowledged Json\n /// The same waits summed over every message, as a reader of every ship reads them.\n acknowledgedWaits Json @map(\"acknowledged_waits\")\n /// Each lease's latest turn as of seq; the latest row's is the fold's.\n turns Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, hour])\n @@map(\"health_snapshots\")\n}\n\n/// The fleet's open deliveries as of its latest snapshot, each at its latest\n/// step: replaced whole by each close. A copy for the fold, so no foreign key\n/// but the fleet's.\nmodel HealthSnapshotDelivery {\n fleetId String @map(\"fleet_id\")\n deliveryId String @map(\"delivery_id\")\n messageId String @map(\"message_id\")\n senderShipId String @map(\"sender_ship_id\")\n recipientShipId String? @map(\"recipient_ship_id\")\n recipientType String? @map(\"recipient_type\")\n claimedByShipId String? @map(\"claimed_by_ship_id\")\n reachableShipIds String[] @map(\"reachable_ship_ids\")\n sentAt DateTime @map(\"sent_at\") @db.Timestamptz(3)\n /// Its latest step: the state, since when, and the ship and lease that took it; none while pending since its send.\n state DeliveryState?\n since DateTime? @db.Timestamptz(3)\n stepShipId String? @map(\"step_ship_id\")\n leaseId String? @map(\"lease_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, deliveryId])\n @@map(\"health_snapshot_deliveries\")\n}\n\n/// Append-only log of every state change: never updated or deleted. Ids start with evt_.\n/// Records its type and time, who caused it (a ship, or the system when\n/// actor_ship_id is null), the ship, message and delivery it concerns, and a few\n/// details as a flat JSON object.\nmodel Event {\n id String @id\n fleetId String @map(\"fleet_id\")\n type String\n occurredAt DateTime @map(\"occurred_at\") @db.Timestamptz(3)\n /// Who caused it (decision 0057): a ship, an account, the installation or the system.\n actorKind EventActorKind @default(system) @map(\"actor_kind\")\n actorShipId String? @map(\"actor_ship_id\")\n /// The account that caused it, by pagasae's id only: never an email.\n actorAccountId String? @map(\"actor_account_id\")\n /// The ship that presented the account's token, a plugin's page or the gateway, if one did.\n actorThroughShipId String? @map(\"actor_through_ship_id\")\n /// The account signed in to the console as argo when argo caused it, by its id only (decision 0054).\n actorSignedInAccountId String? @map(\"actor_signed_in_account_id\")\n shipId String? @map(\"ship_id\")\n messageId String? @map(\"message_id\")\n deliveryId String? @map(\"delivery_id\")\n details Json\n /// The event's place in its fleet's stream, in commit order and without\n /// gaps: where a live subscription resumes. The id is not, since ids are\n /// taken before their transaction commits.\n seq BigInt\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n actorShip Ship? @relation(\"EventActorShip\", fields: [fleetId, actorShipId], references: [fleetId, id], onDelete: Restrict)\n actorThroughShip Ship? @relation(\"EventActorThroughShip\", fields: [fleetId, actorThroughShipId], references: [fleetId, id], onDelete: Restrict)\n ship Ship? @relation(\"EventShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n message Message? @relation(fields: [fleetId, messageId], references: [fleetId, id], onDelete: Restrict)\n delivery Delivery? @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)\n\n @@unique([fleetId, seq])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n /// A ship's timeline pages through the events it caused and those naming\n /// it by their place in the stream, each through its own index.\n @@index([fleetId, actorShipId, seq])\n @@index([actorThroughShipId, fleetId])\n @@index([fleetId, shipId, seq])\n @@index([fleetId, messageId])\n @@index([fleetId, deliveryId])\n /// The health reads take a fleet's events since a time (decision 0042).\n @@index([fleetId, occurredAt])\n @@index([fleetId, shipId, seq], map: \"events_starting_prompt_issued_idx\", where: raw(\"(type = 'StartingPromptIssued'::text)\"))\n /// The owner a commissioner named last, preselected for argo's next commission from the console (decision 0045).\n @@index([fleetId, actorShipId, seq], map: \"events_owner_set_idx\", where: raw(\"(type = 'OwnerSet'::text)\"))\n /// A ship's messages page through those it claimed as a ship of their type by id.\n @@index([fleetId, shipId, messageId], map: \"events_delivery_handed_idx\", where: raw(\"(type = 'DeliveryHanded'::text)\"))\n /// A first stuck snapshot reads each lease's turn at its oldest hour from the turn reports alone.\n @@index([fleetId, occurredAt], map: \"events_turn_reported_idx\", where: raw(\"(type = 'TurnReported'::text)\"))\n /// The pruning pass finds the mic and participant events of ended meetings (decision 0066).\n @@index([fleetId, seq], map: \"events_meeting_parts_idx\", where: raw(\"(type = ANY (ARRAY['ParticipantAdded'::text, 'ParticipantLeft'::text, 'ParticipantRejoined'::text, 'ParticipantRevoked'::text, 'MicRequested'::text, 'MicRequestWithdrawn'::text, 'MicGiven'::text, 'MicReleased'::text, 'MicTaken'::text, 'MicPatternSet'::text]))\"))\n /// The pruning pass finds a crew's session and secret events past the cutoff (decision 0066).\n @@index([fleetId, occurredAt], map: \"events_crew_idx\", where: raw(\"(type = ANY (ARRAY['ShipClaimed'::text, 'LeaseRevoked'::text, 'LeasePushed'::text, 'ShipReported'::text, 'TurnReported'::text, 'StatementSet'::text, 'CrewStatusChanged'::text, 'SignInTicketIssued'::text, 'ViewerSessionStarted'::text, 'StartingPromptIssued'::text, 'CredentialRevoked'::text]))\"))\n @@map(\"events\")\n}\n\n/// Why a console session ended: a sign-in elsewhere took argo over, the\n/// operator signed out, or the password was reset.\nenum ConsoleSessionEndReason {\n takenOver\n signedOut\n passwordReset\n accountCutOff\n\n @@map(\"console_session_end_reason\")\n}\n\n/// argo's own sign-in: email and Argon2id password hash. fleet:init creates it\n/// with neither, until argo sets both in Settings; a hosting installation\n/// creates it with an email and no password. Ids start with opr_.\n/// The email is unique across all fleets: finding the account by email is the one\n/// lookup not scoped by fleet (ADR 0007). One account per fleet in v1.\nmodel Operator {\n id String @id\n fleetId String @unique @map(\"fleet_id\")\n /// The fleets the installation creates may share one; the email of argo's own sign-in (with a password) is no other operator's.\n email String?\n passwordHash String? @map(\"password_hash\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@unique([email], map: \"operators_sign_in_email_key\", where: raw(\"(password_hash IS NOT NULL)\"))\n @@index([email])\n @@map(\"operators\")\n}\n\n/// The operator crewing argo through the web console. Ids start with ses_.\n/// Only the hash of the session token is stored, unique across all fleets: finding\n/// a session by its token is the one lookup not scoped by fleet (ADR 0007).\n/// Valid until expires_at, which moves to idle_limit_seconds after each use\n/// (30 days for the operator, 2 hours for a viewer), never past ends_by.\nmodel ConsoleSession {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n /// The lease on argo it holds; null for a viewer session (decision 0022).\n leaseId String? @map(\"lease_id\")\n idleLimitSeconds Int @map(\"idle_limit_seconds\")\n /// No use renews it past this; null when only idleness ends it.\n endsBy DateTime? @map(\"ends_by\") @db.Timestamptz(3)\n /// The device it signed in from, as the browser told: \"Mac · Chrome\".\n device String @default(\"Unknown device\")\n /// The account that signed in as argo, by its id only; null for argo's own sign-in and a viewer (decision 0054).\n accountId String? @map(\"account_id\")\n tokenHash String @unique @map(\"token_hash\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n lastUsedAt DateTime @map(\"last_used_at\") @db.Timestamptz(3)\n expiresAt DateTime @map(\"expires_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n /// Why the session ended; null while it has not.\n endReason ConsoleSessionEndReason? @map(\"end_reason\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n lease Lease? @relation(fields: [fleetId, leaseId], references: [fleetId, id])\n\n noticeDismissals NoticeDismissal[]\n guideProgress GuideProgress[]\n\n /// At most one live session holding argo's lease per fleet: signing in ends the previous one. Viewer sessions run beside it.\n @@unique([fleetId], map: \"console_sessions_fleet_id_open_key\", where: raw(\"ended_at IS NULL AND lease_id IS NOT NULL\"))\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@index([fleetId, leaseId])\n @@map(\"console_sessions\")\n}\n\n/// A one-time sign-in ticket for the fleet's operator, issued by a hosting\n/// installation and redeemed in the console (decision 0020). Only its hash is\n/// stored, unique across all fleets: redeeming finds it before the fleet is known.\nmodel SignInTicket {\n tokenHash String @id @map(\"token_hash\")\n fleetId String @map(\"fleet_id\")\n /// Whom it signs in as: the operator or a viewer (decision 0022).\n signInAs SignInAs @map(\"sign_in_as\")\n /// The account it signs in as argo, by its id only; null for argo's own or a viewer's ticket (decision 0054).\n accountId String? @map(\"account_id\")\n issuedAt DateTime @map(\"issued_at\") @db.Timestamptz(3)\n expiresAt DateTime @map(\"expires_at\") @db.Timestamptz(3)\n /// When it signed in; null while unused.\n usedAt DateTime? @map(\"used_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@index([fleetId])\n @@map(\"sign_in_tickets\")\n}\n\nenum SignInAs {\n operator\n viewer\n\n @@map(\"sign_in_as\")\n}\n\n/// The installation's settings (decision 0020): the default ship, daily message,\n/// schedules per ship and minimum schedule interval (seconds) limits and the\n/// default retention in days (decision 0066) for fleets, and the cap on fleets,\n/// each null for none. One row at most, and none until the installation sets\n/// them. Belongs to no fleet.\nmodel InstallationSettings {\n id Int @id @default(1)\n defaultShipLimit Int? @map(\"default_ship_limit\")\n defaultDailyMessageLimit Int? @map(\"default_daily_message_limit\")\n defaultSchedulesPerShipLimit Int? @map(\"default_schedules_per_ship_limit\")\n defaultMinimumScheduleInterval Int? @map(\"default_minimum_schedule_interval\")\n defaultRetentionDays Int? @map(\"default_retention_days\")\n fleetCap Int? @map(\"fleet_cap\")\n\n @@map(\"installation_settings\")\n}\n\nenum InstallationRequestKind {\n createFleet @map(\"create_fleet\")\n deleteFleet @map(\"delete_fleet\")\n\n @@map(\"installation_request_kind\")\n}\n\n/// A create or delete of a fleet the installation carried out, under its caller's\n/// request id, so a replay answers the same (decision 0020). It belongs to the\n/// installation, not to a fleet, and keeps the request as a hash only. A create's\n/// row names the fleet and argo it answers with and is deleted with that fleet; a\n/// delete's row names nothing of the fleet.\nmodel InstallationRequest {\n requestId String @id @map(\"request_id\")\n kind InstallationRequestKind\n requestHash String @map(\"request_hash\")\n /// The created fleet and its argo; null for a delete.\n fleetId String? @map(\"fleet_id\")\n operatorShipId String? @map(\"operator_ship_id\")\n at DateTime @db.Timestamptz(3)\n\n @@index([fleetId])\n @@map(\"installation_requests\")\n}\n\n/// A console notice the installation sets (decision 0023), shown above every\n/// page to the sessions of its audience. It belongs to no fleet.\nmodel Notice {\n id String @id\n /// Its place in the installation's order.\n position Int\n audience NoticeAudience\n text String\n /// Its links: label, and url, isSignOut or both.\n links Json @default(\"[]\")\n isDismissible Boolean @default(false) @map(\"is_dismissible\")\n\n @@map(\"notices\")\n}\n\nenum NoticeAudience {\n everyone\n operators\n viewers\n accounts\n\n @@map(\"notice_audience\")\n}\n\n/// A notice a console session dismissed, for itself (decision 0023). It goes\n/// with its session and its fleet.\nmodel NoticeDismissal {\n fleetId String @map(\"fleet_id\")\n consoleSessionId String @map(\"console_session_id\")\n noticeId String @map(\"notice_id\")\n dismissedAt DateTime @map(\"dismissed_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n consoleSession ConsoleSession @relation(fields: [consoleSessionId], references: [id])\n\n @@id([consoleSessionId, noticeId])\n @@index([fleetId])\n @@map(\"notice_dismissals\")\n}\n\n/// A notice an account signed in to the console as itself dismissed, for\n/// itself, kept by its account id in each fleet (accounts design, A9). Core\n/// stores no account: the id is pagasae's. It goes with its fleet.\nmodel AccountNoticeDismissal {\n fleetId String @map(\"fleet_id\")\n accountId String @map(\"account_id\")\n noticeId String @map(\"notice_id\")\n dismissedAt DateTime @map(\"dismissed_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, accountId, noticeId])\n @@map(\"account_notice_dismissals\")\n}\n\n/// The installation's guide (decision 0024): steps for the console sessions of\n/// one audience. At most one row; it belongs to no fleet.\nmodel Guide {\n /// Always \"guide\": the installation has one guide or none.\n id String @id\n audience NoticeAudience\n /// Its steps, in order: path, anchor (optional), title and text.\n steps Json\n\n @@map(\"guides\")\n}\n\nenum GuideProgressState {\n open\n skipped\n finished\n\n @@map(\"guide_progress_state\")\n}\n\n/// Where a console session is in the guide, for itself (decision 0024). It\n/// goes with its session and its fleet.\nmodel GuideProgress {\n fleetId String @map(\"fleet_id\")\n consoleSessionId String @id @map(\"console_session_id\")\n step Int\n state GuideProgressState\n recordedAt DateTime @map(\"recorded_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n consoleSession ConsoleSession @relation(fields: [consoleSessionId], references: [id])\n\n @@index([fleetId])\n @@map(\"guide_progress\")\n}\n\n/// Where an account signed in to the console as itself is in the guide, kept\n/// by its account id in each fleet (accounts design, A9). It goes with its fleet.\nmodel AccountGuideProgress {\n fleetId String @map(\"fleet_id\")\n accountId String @map(\"account_id\")\n step Int\n state GuideProgressState\n recordedAt DateTime @map(\"recorded_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, accountId])\n @@map(\"account_guide_progress\")\n}\n\n/// An account pagasae cut off (decision 0058): its tokens issued before\n/// cut_off_at are refused in every fleet until forget_at, when the longest of\n/// them has ended. The installation's, not a fleet's: no fleet_id (ADR 0007).\n/// Never an email: the account by pagasae's id only.\nmodel AccountCutOff {\n accountId String @id @map(\"account_id\")\n cutOffAt DateTime @map(\"cut_off_at\") @db.Timestamptz(3)\n forgetAt DateTime @map(\"forget_at\") @db.Timestamptz(3)\n\n /// Forgetting finds the cut-offs that ended.\n @@index([forgetAt])\n @@map(\"account_cut_offs\")\n}\n\n/// Who caused an event (decision 0057).\nenum EventActorKind {\n ship\n account\n installation\n system\n\n @@map(\"event_actor_kind\")\n}\n\n/// Who commissioned a ship (decision 0057).\n/// Who wrote a verified fact (decision 0059).\nenum FactWriterKind {\n ship\n account\n installation\n\n @@map(\"fact_writer_kind\")\n}\n\nenum CommissionerKind {\n ship\n account\n installation\n\n @@map(\"commissioner_kind\")\n}\n\nenum LabelOwnerKind {\n ship\n installation\n\n @@map(\"label_owner_kind\")\n}\n\n/// A sealed fleet's data key (decision 0068): kept only wrapped, by the company key and by the recovery key\n/// when set, with a check value (HMAC-SHA-256 of a fixed text under the key) that proves an unwrap gave\n/// the right key. Never unwrapped in the database. Old keys stay to unseal old payloads.\nmodel DataKey {\n id String @id\n fleetId String @map(\"fleet_id\")\n wrappedByCompanyKey Bytes @map(\"wrapped_by_company_key\")\n wrappedByRecoveryKey Bytes? @map(\"wrapped_by_recovery_key\")\n checkValue Bytes @map(\"check_value\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n isCurrent Boolean @map(\"is_current\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n messages Message[]\n schedules Schedule[]\n\n @@unique([fleetId, id])\n /// One current data key per fleet.\n @@unique([fleetId], map: \"data_keys_fleet_id_current_key\", where: { isCurrent: true })\n @@map(\"data_keys\")\n}\n\n/// Immutable bounded commission rights. Only withdrawnAt changes after recording.\nmodel CommissionApproval {\n id String @id\n fleetId String @map(\"fleet_id\")\n approver Json\n commissionerId String @map(\"commissioner_id\")\n scopes String[]\n subjectDigest String @map(\"subject_digest\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n withdrawnAt DateTime? @map(\"withdrawn_at\") @db.Timestamptz(3)\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Restrict)\n commissioner Ship @relation(fields: [fleetId, commissionerId], references: [fleetId, id], onDelete: Restrict)\n\n @@unique([fleetId, id])\n @@index([fleetId, commissionerId])\n @@map(\"commission_approvals\")\n}\n",
20
+ "inlineSchema": "// Aeolus core tables (docs/architecture.md, \"Core tables\").\n//\n// Prefixed ids, fleet_id on every table except fleets, and the columns and key\n// constraints named in the architecture. Columns a later slice owns (a message's\n// sender and selector, for one) arrive with that slice.\n//\n// References to rows of the same fleet carry fleet_id in the foreign key, so a\n// row can never point at another fleet's ship, lease, message or delivery.\n//\n// Timestamps have no database default: the application's Clock port sets every\n// one of them, so tests control time.\n//\n// Check constraints and the append-only rule for events live in the migration\n// SQL, because Prisma does not model them.\n\ngenerator client {\n provider = \"prisma-client\"\n output = \"./generated\"\n moduleFormat = \"esm\"\n importFileExtension = \"js\"\n runtime = \"nodejs\"\n previewFeatures = [\"partialIndexes\"]\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\n/// The tenant: one operator's ships, messages and history. Ids start with flt_.\nmodel Fleet {\n id String @id\n name String\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n /// The sequence number of the fleet's last committed event. A unit of work\n /// takes its numbers from it as its last statements, so the row lock orders\n /// the numbers as the transactions commit.\n lastEventSeq BigInt @default(0) @map(\"last_event_seq\")\n /// Whether the fleet sets its own ship limit (else it follows the installation\n /// default), and that limit: null for no limit.\n shipLimitSet Boolean @default(false) @map(\"ship_limit_set\")\n shipLimit Int? @map(\"ship_limit\")\n /// The same for its daily message limit.\n dailyMessageLimitSet Boolean @default(false) @map(\"daily_message_limit_set\")\n dailyMessageLimit Int? @map(\"daily_message_limit\")\n /// The same for the schedules each of its ships may hold, and for the\n /// minimum interval of a repeating schedule, in seconds (decision 0062).\n schedulesPerShipLimitSet Boolean @default(false) @map(\"schedules_per_ship_limit_set\")\n schedulesPerShipLimit Int? @map(\"schedules_per_ship_limit\")\n minimumScheduleIntervalSet Boolean @default(false) @map(\"minimum_schedule_interval_set\")\n minimumScheduleInterval Int? @map(\"minimum_schedule_interval\")\n /// The same for its retention in days (decision 0066): null for kept for good.\n retentionSet Boolean @default(false) @map(\"retention_set\")\n retentionDays Int? @map(\"retention_days\")\n /// When its last pruning pass ran, and from when it keeps its finished\n /// history, as its last finished pass left it (decision 0066); null before any.\n /// When the installation deleted it (decision 0020): the fleet reads as gone from then, and the removal pass takes its rows away in batches, the fleet last; null while it stands.\n deletedAt DateTime? @map(\"deleted_at\") @db.Timestamptz(3)\n prunedAt DateTime? @map(\"pruned_at\") @db.Timestamptz(3)\n keptFrom DateTime? @map(\"kept_from\") @db.Timestamptz(3)\n /// Its sealing (decision 0068): null while it is not sealed; then sealing until no payload is stored plain, and sealed. The company key that wraps its data keys, by its reference.\n sealingState SealingState? @map(\"sealing_state\")\n /// Since when it reads its sealing state: turned on, or the sealing pass left no payload plain.\n sealingStateSince DateTime? @map(\"sealing_state_since\") @db.Timestamptz(3)\n /// The sealing pass's progress (decision 0068, B5): the payloads stored plain when it turned sealing on, and how many the pass sealed since.\n payloadsToSeal Int @default(0) @map(\"payloads_to_seal\")\n payloadsSealed Int @default(0) @map(\"payloads_sealed\")\n companyKey String? @map(\"company_key\")\n /// Its recovery key (decision 0068, B6), when the company set one: the public half, an age X25519 recipient, and\n /// its fingerprint (SHA256: and the unpadded base64 SHA-256 of the recipient). Each data key is wrapped to it too.\n recoveryKey String? @map(\"recovery_key\")\n recoveryKeyFingerprint String? @map(\"recovery_key_fingerprint\")\n /// Whether its company key answered its last unwrap, and since when (decision 0068, B11): the key vault's reason\n /// while it refuses (accessDenied, disabled, notFound, unreachable), null while it answers. Since when set with the sealing.\n keyUnavailableReason String? @map(\"key_unavailable_reason\")\n keyAvailabilitySince DateTime? @map(\"key_availability_since\") @db.Timestamptz(3)\n\n messageMetadataBackfill MessageMetadataBackfill?\n ships Ship[]\n leases Lease[]\n crewRequests CrewRequest[]\n crewRequestGiveBacks CrewRequestGiveBack[]\n clearRequests WorktreeClearRequest[]\n labels Label[]\n labelValues LabelValue[]\n shipLabels ShipLabel[]\n networkSettings NetworkSettings?\n networkRulesDraft NetworkRulesDraft?\n declaredNetworkRules DeclaredNetworkRules[]\n installationDeclaredNetworkRules InstallationDeclaredNetworkRules?\n commissionApprovals CommissionApproval[]\n scopeNamespaces ScopeNamespace[]\n definedScopes DefinedScope[]\n verifiedFacts VerifiedFacts[]\n alerts Alert[]\n shipExpectations ShipExpectations[]\n reachRefusals ReachRefusal[]\n credentials Credential[]\n messages Message[]\n messageDays MessageDay[]\n exchanges Exchange[]\n prunedExchanges PrunedExchange[]\n deliveries Delivery[]\n overdueDeliveries OverdueDelivery[]\n events Event[]\n consoleSessions ConsoleSession[]\n signInTickets SignInTicket[]\n noticeDismissals NoticeDismissal[]\n guideProgress GuideProgress[]\n accountNoticeDismissals AccountNoticeDismissal[]\n accountGuideProgress AccountGuideProgress[]\n operator Operator?\n healthSnapshots HealthSnapshot[]\n healthSnapshotDeliveries HealthSnapshotDelivery[]\n meetings Meeting[]\n dataKeys DataKey[]\n meetingParticipants MeetingParticipant[]\n meetingMicRequests MeetingMicRequest[]\n schedules Schedule[]\n featureFlags FleetFeatureFlag[]\n\n @@map(\"fleets\")\n}\n\n/// A sealed fleet's sealing (decision 0068): payloads stored plain before still wait for the sealing pass, or none do.\nenum SealingState {\n sealing\n sealed\n}\n\n/// What a ship is (decision 0044): argo the one operator, the viewer, an agent session, a person's ship or an app's.\nenum ShipKind {\n operator\n agent\n viewer\n person\n app\n plugin\n trierarch\n\n @@map(\"ship_kind\")\n}\n\n/// A durable, addressable identity with an inbox. Ids start with shp_.\n/// Scopes are set when the ship is created and checked before every call.\nmodel Ship {\n id String @id\n fleetId String @map(\"fleet_id\")\n name String\n type String\n kind ShipKind\n scopes String[]\n note String?\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n retiredAt DateTime? @map(\"retired_at\") @db.Timestamptz(3)\n /// When the pruning pass removed it, past the fleet's retention (decision 0070): the row stays a remnant its kept history names.\n removedAt DateTime? @map(\"removed_at\") @db.Timestamptz(3)\n /// The actor that commissioned it, its idempotency key and the request's hash; null for argo.\n /// commissioned_by names the actor: a ship's id, an account's id, or `installation`.\n commissionedByKind CommissionerKind? @map(\"commissioned_by_kind\")\n commissionedBy String? @map(\"commissioned_by\")\n commissionKey String? @map(\"commission_key\")\n commissionRequestHash String? @map(\"commission_request_hash\")\n /// The ship that answers for it, a person's ship or argo (decision 0045); null for argo and the viewer.\n ownerShipId String? @map(\"owner_ship_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n owner Ship? @relation(\"ShipOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)\n ownedShips Ship[] @relation(\"ShipOwner\")\n leases Lease[]\n credentials Credential[]\n sentMessages Message[] @relation(\"MessageSender\")\n addressedMessages Message[] @relation(\"MessageSelectorShip\")\n deliveries Delivery[] @relation(\"DeliveryRecipientShip\")\n claimedDeliveries Delivery[] @relation(\"DeliveryClaimedByShip\")\n overdueDeliveries OverdueDelivery[]\n consoleSessions ConsoleSession[]\n actorOfEvents Event[] @relation(\"EventActorShip\")\n actorThroughOfEvents Event[] @relation(\"EventActorThroughShip\")\n events Event[] @relation(\"EventShip\")\n crewRequest CrewRequest? @relation(\"CrewRequestShip\")\n assignedCrews CrewRequest[] @relation(\"CrewRequestAssignee\")\n requestedCrews CrewRequest[] @relation(\"CrewRequestRequester\")\n givenBackCrews CrewRequestGiveBack[] @relation(\"CrewRequestGiveBackTrierarch\")\n clearRequests WorktreeClearRequest[] @relation(\"WorktreeClearRequestTrierarch\")\n clearedWorktrees WorktreeClearRequest[] @relation(\"WorktreeClearRequestShip\")\n requestedClears WorktreeClearRequest[] @relation(\"WorktreeClearRequestRequester\")\n ownedLabels Label[] @relation(\"LabelOwner\")\n labels ShipLabel[] @relation(\"ShipLabelShip\")\n declaredNetworkRules DeclaredNetworkRules[]\n commissionApprovals CommissionApproval[]\n declaredNamespace ScopeNamespace?\n verifiedFacts VerifiedFacts[]\n alerts Alert[]\n shipExpectations ShipExpectations[]\n ownedMeetings Meeting[] @relation(\"MeetingOwner\")\n moderatedMeetings Meeting[] @relation(\"MeetingModerator\")\n openedMeetings Meeting[] @relation(\"MeetingOpener\")\n micHeldMeetings Meeting[] @relation(\"MeetingMicHolder\")\n meetings MeetingParticipant[]\n schedules Schedule[] @relation(\"ScheduleShip\")\n scheduledTo Schedule[] @relation(\"ScheduleSelectorShip\")\n exchanges Exchange[] @relation(\"ExchangeShip\")\n exchangedWith Exchange[] @relation(\"ExchangeOtherShip\")\n prunedExchanges PrunedExchange[] @relation(\"PrunedExchangeShip\")\n prunedExchangesWith PrunedExchange[] @relation(\"PrunedExchangeOtherShip\")\n\n @@unique([fleetId, id])\n /// An idempotency key is used once per commissioning actor.\n @@unique([fleetId, commissionedByKind, commissionedBy, commissionKey], map: \"ships_commission_key_key\")\n /// A name is unique among ships that are not retired, and reusable after retirement.\n @@unique([fleetId, name], map: \"ships_fleet_id_name_active_key\", where: { retiredAt: null })\n /// Exactly one operator ship per fleet.\n @@unique([fleetId], map: \"ships_fleet_id_operator_key\", where: raw(\"kind = 'operator'::ship_kind\"))\n /// At most one viewer ship per fleet (decision 0022).\n @@unique([fleetId], map: \"ships_fleet_id_viewer_key\", where: raw(\"kind = 'viewer'::ship_kind\"))\n @@index([fleetId, ownerShipId])\n @@index([fleetId, type], map: \"ships_type_listing_idx\", where: { retiredAt: null })\n @@index([fleetId, kind], map: \"ships_kind_listing_idx\", where: { retiredAt: null })\n /// The pruning pass picks the oldest retired ships not removed yet (decision 0070).\n @@index([fleetId, retiredAt, id], map: \"ships_removal_idx\", where: raw(\"((retired_at IS NOT NULL) AND (removed_at IS NULL))\"))\n @@map(\"ships\")\n}\n\n/// Where the session crewing a ship runs. OTHER carries a description; the other kinds none.\nenum ReportState {\n working\n blocked\n idle\n\n @@map(\"report_state\")\n}\n\n/// A pushed session's turn, as its hooks report it (decision 0040).\nenum LeaseWaker {\n trierarch\n pluginWatcher\n personApp\n gateway\n adapter\n\n @@map(\"lease_waker\")\n}\n\nenum TurnState {\n idle\n busy\n\n @@map(\"turn_state\")\n}\n\n/// The kind of a session's latest event as its trierarch observes it (headless design, H14).\nenum ActivityKind {\n text\n tool\n result\n error\n\n @@map(\"activity_kind\")\n}\n\nenum LocationKind {\n DEVICE\n CLOUD\n SERVER\n OTHER\n\n @@map(\"location_kind\")\n}\n\n/// The exclusive right of one session to crew a ship, and where that session runs.\n/// Ids start with lse_.\n/// The hash of the crew token register gave the session, unique across all fleets:\n/// finding a ship by its crew token is a lookup not scoped by fleet (ADR 0007). A\n/// console session's lease on argo has none; the console session holds its token.\nmodel Lease {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n location LocationKind\n locationDescription String? @map(\"location_description\")\n /// The harness the session stated when it claimed the ship; none for argo's console lease and for leases from before harnesses were stated.\n harness String?\n crewTokenHash String? @unique @map(\"crew_token_hash\")\n startedAt DateTime @map(\"started_at\") @db.Timestamptz(3)\n /// The last call by its crew: observation only, nothing acts on it (ADR 0016).\n lastSeenAt DateTime? @map(\"last_seen_at\") @db.Timestamptz(3)\n /// The crew's last report: plain data, nothing acts on it. Null until it reports.\n reportState ReportState? @map(\"report_state\")\n reportNote String? @map(\"report_note\")\n reportedAt DateTime? @map(\"reported_at\") @db.Timestamptz(3)\n /// When the state, note, task or step last changed; details alone do not move it (decision 0028). Null until it reports.\n reportChangedAt DateTime? @map(\"report_changed_at\") @db.Timestamptz(3)\n /// What the crew works on: a typed reference, a kind and its fields (decision 0028). Null when it names none.\n reportTask Json? @map(\"report_task\")\n /// Where the crew is in its task, step at of of; both null when it gives none.\n reportStepAt Int? @map(\"report_step_at\")\n reportStepOf Int? @map(\"report_step_of\")\n /// The report's details: one JSON object stored without meaning, at most 16 KB (decision 0028). Null when there are none.\n reportDetails Json? @map(\"report_details\")\n /// Moves by one each time the details change; 0 before any.\n reportDetailsVersion Int @default(0) @map(\"report_details_version\")\n /// 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).\n statement Json?\n /// Moves by one each time the statement changes; 0 before any.\n statementVersion Int @default(0) @map(\"statement_version\")\n /// From the lease's first push receive: the computer side takes its deliveries, and the agent's plain receive answers nothing (decision 0040).\n pushedAt DateTime? @map(\"pushed_at\") @db.Timestamptz(3)\n /// What wakes the ship, as its first push receive stated it; null when it stated none (interop 5.1).\n waker LeaseWaker?\n /// The session's turn as its hooks last reported it, and when they saw it change; null until they report (decision 0040).\n turn TurnState?\n turnAt DateTime? @map(\"turn_at\") @db.Timestamptz(3)\n /// 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).\n activityAt DateTime? @map(\"activity_at\") @db.Timestamptz(3)\n activityKind ActivityKind? @map(\"activity_kind\")\n activityTool String? @map(\"activity_tool\")\n /// When the trierarch wrote it, and the report interval it stated: past twice that interval it reads unknown.\n activityReportedAt DateTime? @map(\"activity_reported_at\") @db.Timestamptz(3)\n activityIntervalSeconds Int? @map(\"activity_interval_seconds\")\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n consoleSessions ConsoleSession[]\n claimedDeliveries Delivery[]\n overdueDeliveries OverdueDelivery[]\n\n @@unique([fleetId, id])\n /// At most one open lease per ship.\n @@unique([shipId], map: \"leases_ship_id_open_key\", where: { endedAt: null })\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@map(\"leases\")\n}\n\n/// How the assigned trierarch says its crew of a ship stands (decision 0029).\nenum CrewStatus {\n crewing\n running\n restarting\n crashed\n releasing\n\n @@map(\"crew_status\")\n}\n\n/// A standing request that a ship be kept crewed (decision 0029): at most one per\n/// ship, so the ship's id is its key. Its settings are crew settings of at most\n/// 16 KB, checked but never acted on; each request replaces them and moves their\n/// version by one.\nmodel CrewRequest {\n shipId String @id @map(\"ship_id\")\n fleetId String @map(\"fleet_id\")\n settings Json\n settingsVersion Int @map(\"settings_version\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n /// The ship that made it last; null for a request made before it was recorded.\n requestedBy String? @map(\"requested_by_ship_id\")\n /// The trierarch ship it is assigned to; null while unassigned.\n assignedTo String? @map(\"assigned_to_ship_id\")\n /// How its trierarch says the crew stands; null until it says.\n status CrewStatus?\n /// Why no trierarch can take it, written by the assigner while unassigned; null when none.\n reason String?\n /// How many times its trierarch restarted the session within its restart window, with the status: 0 on its first start.\n attempt Int @default(0)\n /// When the session its trierarch runs now started, with the status; null while none runs.\n sessionStartedAt DateTime? @map(\"session_started_at\") @db.Timestamptz(3)\n /// Whether its crew is final: set by its trierarch's first running, restarting or crashed, kept whatever status follows, cleared on every new settings version.\n isFinal Boolean @default(false) @map(\"is_final\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"CrewRequestShip\", fields: [fleetId, shipId], references: [fleetId, id])\n assignee Ship? @relation(\"CrewRequestAssignee\", fields: [fleetId, assignedTo], references: [fleetId, id])\n requester Ship? @relation(\"CrewRequestRequester\", fields: [fleetId, requestedBy], references: [fleetId, id])\n givenBack CrewRequestGiveBack[]\n\n @@unique([fleetId, shipId])\n /// A trierarch reads the requests assigned to it.\n @@index([fleetId, assignedTo])\n /// A delete of a ship checks the requests it made with an index.\n @@index([fleetId, requestedBy])\n @@map(\"crew_requests\")\n}\n\n/// A trierarch that gave a crew request back before its crew was final (#382): one per trierarch, until the next settings version.\nmodel CrewRequestGiveBack {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n trierarchShipId String @map(\"trierarch_ship_id\")\n settingsVersion Int @map(\"settings_version\")\n reason String\n givenBackAt DateTime @map(\"given_back_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n crewRequest CrewRequest @relation(fields: [fleetId, shipId], references: [fleetId, shipId])\n trierarch Ship @relation(\"CrewRequestGiveBackTrierarch\", fields: [fleetId, trierarchShipId], references: [fleetId, id])\n\n @@id([fleetId, shipId, trierarchShipId])\n @@index([fleetId, trierarchShipId])\n @@map(\"crew_request_give_backs\")\n}\n\n/// A pending request that a trierarch clear a worktree it kept (decision 0032),\n/// named by the ship it belonged to and its repository: never a path.\nmodel WorktreeClearRequest {\n fleetId String @map(\"fleet_id\")\n trierarchShipId String @map(\"trierarch_ship_id\")\n shipId String @map(\"ship_id\")\n repository String\n requestedBy String @map(\"requested_by_ship_id\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n trierarch Ship @relation(\"WorktreeClearRequestTrierarch\", fields: [fleetId, trierarchShipId], references: [fleetId, id])\n ship Ship @relation(\"WorktreeClearRequestShip\", fields: [fleetId, shipId], references: [fleetId, id])\n requester Ship @relation(\"WorktreeClearRequestRequester\", fields: [fleetId, requestedBy], references: [fleetId, id])\n\n @@id([fleetId, trierarchShipId, shipId, repository])\n @@index([fleetId, shipId])\n @@index([fleetId, requestedBy])\n @@map(\"worktree_clear_requests\")\n}\n\n/// A label (decision 0031): a key unique in its fleet with its defined values,\n/// owned by the ship that defined it. Ids start with lbl_. A retired or deleted\n/// label is deleted with its values; its events stay.\nmodel Label {\n id String @id\n fleetId String @map(\"fleet_id\")\n key String\n /// A ship or the installation (decision 0031); the installation's label names no owner ship.\n ownerKind LabelOwnerKind @default(ship) @map(\"owner_kind\")\n ownerShipId String? @map(\"owner_ship_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n owner Ship? @relation(\"LabelOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id])\n values LabelValue[]\n carriers ShipLabel[]\n\n @@unique([fleetId, id])\n @@unique([fleetId, key])\n /// A retire finds the labels its ship owns.\n @@index([fleetId, ownerShipId])\n @@map(\"labels\")\n}\n\n/// One value of a label, each once, at most 50 a label. Ids start with lbv_; a\n/// value keeps its id while its label has it.\nmodel LabelValue {\n id String @id\n fleetId String @map(\"fleet_id\")\n labelId String @map(\"label_id\")\n value String\n /// Its place in the order the owner gave the values.\n position Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n label Label @relation(fields: [fleetId, labelId], references: [fleetId, id])\n carriers ShipLabel[]\n\n @@unique([fleetId, id])\n @@unique([fleetId, labelId, value])\n @@map(\"label_values\")\n}\n\n/// A label value a ship carries: a ship holds a set of values, so the ship and\n/// the value are its key.\nmodel ShipLabel {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n labelId String @map(\"label_id\")\n valueId String @map(\"value_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ShipLabelShip\", fields: [fleetId, shipId], references: [fleetId, id])\n label Label @relation(fields: [fleetId, labelId], references: [fleetId, id])\n value LabelValue @relation(fields: [fleetId, valueId], references: [fleetId, id])\n\n @@id([fleetId, shipId, valueId])\n /// A change of values, a delete and a retire find every ship that carries a label.\n @@index([fleetId, labelId])\n /// Removing a value checks that no ship carries it.\n @@index([fleetId, valueId])\n @@map(\"ship_labels\")\n}\n\n/// A fleet's network settings (decision 0034), once it first set rules: its\n/// rules as JSON, none (null) for all-to-all, and their version. A send and a\n/// set take turns on an advisory lock on them (network.ts).\nmodel NetworkSettings {\n fleetId String @id @map(\"fleet_id\")\n /// The fleet's own rules as last applied (decision 0034); NULL while none\n /// are, all-to-all with open on.\n rules Json?\n /// The viewer reading every ship, the built-in rule an actor turns (decision 0034). On at fleet create.\n builtInViewerRead Boolean @default(true) @map(\"built_in_viewer_read\")\n version Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"network_settings\")\n}\n\n/// The draft of a fleet's own rules (decision 0034): one a fleet at most, the\n/// rules as JSON or NULL for all-to-all. Nothing in force reads it; an apply\n/// moves it into network_settings and removes it.\nmodel NetworkRulesDraft {\n fleetId String @id @map(\"fleet_id\")\n rules Json?\n savedAt DateTime @map(\"saved_at\") @db.Timestamptz(3)\n savedAgainstVersion Int @map(\"saved_against_version\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"network_rules_drafts\")\n}\n\n/// The network rules a ship declared on the labels it owns (decision 0037),\n/// its whole list as JSON, at most 20. No row while it declares none; a retire\n/// removes its row.\nmodel DeclaredNetworkRules {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n rules Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId])\n @@map(\"declared_network_rules\")\n}\n\n/// The network rules the installation declares on the labels it owns in one\n/// fleet (decisions 0037, 0052), its whole list as JSON; no row while it\n/// declares none.\nmodel InstallationDeclaredNetworkRules {\n fleetId String @id @map(\"fleet_id\")\n rules Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@map(\"installation_declared_network_rules\")\n}\n\n/// A plugin's namespace (decision 0046): taken up for good by the ship that\n/// declared it, one per ship and unique in the fleet, with its whole list of\n/// scopes and their descriptions as JSON, in order. It goes when its declarer\n/// retires.\nmodel ScopeNamespace {\n fleetId String @map(\"fleet_id\")\n namespace String\n declaredBy String @map(\"declared_by\")\n scopes Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n declarer Ship @relation(fields: [fleetId, declaredBy], references: [fleetId, id])\n\n @@id([fleetId, namespace])\n @@unique([fleetId, declaredBy])\n @@map(\"scope_namespaces\")\n}\n\n/// One of the fleet's own scopes (design gateway-scopes, 4.1), with its one-line description.\nmodel DefinedScope {\n fleetId String @map(\"fleet_id\")\n scope String\n description String\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, scope])\n @@map(\"defined_scopes\")\n}\n\n/// One writer's verified facts about a ship (decision 0059): what it checked,\n/// as JSON in the shape common gives, set whole and kept with the ship. The\n/// writer is an actor: a ship or an account by its id, or the installation\n/// by its name, as a commissioning actor is.\nmodel VerifiedFacts {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n writerKind FactWriterKind @map(\"writer_kind\")\n writer String\n facts Json\n writtenAt DateTime @map(\"written_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId, writerKind, writer])\n /// A retiring writer finds its facts about every ship.\n @@index([fleetId, writerKind, writer])\n @@map(\"verified_facts\")\n}\n\n/// An alert on a ship (decision 0071): what the watch raised when a fact and\n/// its signal parted, open until the watch clears it or the ship retires.\n/// Ids start with alt_. One per ship, signal and occurrence, open or cleared,\n/// so an occurrence is raised once. facts holds the signal's facts at raise,\n/// as common's schema gives them.\nmodel Alert {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n signal String\n occurrenceKey String @map(\"occurrence_key\")\n facts Json\n ownerShipId String? @map(\"owner_ship_id\")\n since DateTime @db.Timestamptz(3)\n raisedAt DateTime @map(\"raised_at\") @db.Timestamptz(3)\n clearedAt DateTime? @map(\"cleared_at\") @db.Timestamptz(3)\n clearedWhy String? @map(\"cleared_why\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@unique([fleetId, shipId, signal, occurrenceKey])\n /// The fleet's open alerts, newest first, a page at a time.\n @@index([fleetId, id(sort: Desc)], map: \"alerts_open_idx\", where: { clearedAt: null })\n /// A ship's open alerts, and how many it has.\n @@index([fleetId, shipId], map: \"alerts_open_on_ship_idx\", where: { clearedAt: null })\n @@map(\"alerts\")\n}\n\n/// The expectations on a ship (decision 0071): what its owner, or a ship\n/// that manages it, expects of it, standing, at most one of each. Each keeps\n/// who set it (JSON, as common's expectation setter) and when; its columns\n/// are null while it is not set. No row while none holds; a retire removes it.\nmodel ShipExpectations {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n reportChangesWithinMinutes Int? @map(\"report_changes_within_minutes\")\n reportChangesWithinSetBy Json? @map(\"report_changes_within_set_by\")\n reportChangesWithinSetAt DateTime? @map(\"report_changes_within_set_at\") @db.Timestamptz(3)\n taskDoneByTask Json? @map(\"task_done_by_task\")\n taskDoneBy DateTime? @map(\"task_done_by\") @db.Timestamptz(3)\n taskDoneBySetBy Json? @map(\"task_done_by_set_by\")\n taskDoneBySetAt DateTime? @map(\"task_done_by_set_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n @@id([fleetId, shipId])\n @@map(\"ship_expectations\")\n}\n\n/// A send the network rules refused (decision 0034), recorded in the\n/// transaction that refused it. Ids start with rfs_. Sender and recipient are\n/// as they were then: ids, names and the label values they carried, as JSON,\n/// so a later rename or relabelling keeps the record true. Only argo reads it.\nmodel ReachRefusal {\n id String @id\n fleetId String @map(\"fleet_id\")\n at DateTime @db.Timestamptz(3)\n sender Json\n /// The plugin ship that read on behalf of the sender (decision 0034); null for the sender's own call.\n askedBy Json? @map(\"asked_by\")\n recipient Json\n /// What the sender tried to do: send, read or manage (decision 0034).\n verb String\n settingsVersion Int @map(\"settings_version\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n /// They page newest first by id.\n @@index([fleetId, id])\n @@map(\"reach_refusals\")\n}\n\n/// A ship secret, stored only as its hash. Ids start with crd_.\n/// The hash is unique across all fleets: finding a ship by its secret is one of the\n/// lookups not scoped by fleet (ADR 0007).\nmodel Credential {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n secretHash String @unique @map(\"secret_hash\")\n issuedAt DateTime @map(\"issued_at\") @db.Timestamptz(3)\n claimedAt DateTime? @map(\"claimed_at\") @db.Timestamptz(3)\n invalidatedAt DateTime? @map(\"invalidated_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n\n /// At most one valid secret per ship.\n @@unique([shipId], map: \"credentials_ship_id_valid_key\", where: { invalidatedAt: null })\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@map(\"credentials\")\n}\n\n/// Who a message is for: one ship or any ship of a type. Group and fleet come later.\nenum SelectorKind {\n ship\n type\n meeting\n label\n\n @@map(\"selector_kind\")\n}\n\n/// The messages a fleet stored on one UTC day and their payloads' UTF-8 bytes\n/// (performance design, decision 1). A unit of work adds to it as its last\n/// statements, after the fleet's event numbers, so the row lock is held only\n/// until commit. Storage is the sum of the days; the daily message limit\n/// counts today's row.\n/// A feature flag that is on for a fleet (decision 0069): a row per flag that\n/// is on, none being off. The flag by its key in common's list, as text, so a\n/// new flag needs no migration.\nmodel FleetFeatureFlag {\n fleetId String @map(\"fleet_id\")\n flag String\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, flag])\n @@map(\"fleet_feature_flags\")\n}\n\nmodel MessageDay {\n fleetId String @map(\"fleet_id\")\n day DateTime @db.Date\n messages Int\n payloadBytes BigInt @map(\"payload_bytes\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, day])\n @@map(\"message_days\")\n}\n\n/// A fleet's cursor of the fill after start (docs/architecture.md, Backfills): the last message it visited\n/// by id and the last exchange by key, committed with each batch.\nmodel MessageMetadataBackfill {\n fleetId String @id @map(\"fleet_id\")\n afterMessageId String? @map(\"after_message_id\")\n afterShipId String? @map(\"after_ship_id\")\n afterOtherShipId String? @map(\"after_other_ship_id\")\n isComplete Boolean @default(false) @map(\"is_complete\")\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Cascade)\n\n @@map(\"message_metadata_backfills\")\n}\n\n/// The rollup of a person ship's list of exchanges (docs/design/exchange-read, E4, E5): per other ship it\n/// exchanged with, the newest message between them and how many of the other ship's deliveries to it are\n/// not yet acknowledged. Written in the transactions that make and change deliveries, never counted from history.\nmodel Exchange {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n otherShipId String @map(\"other_ship_id\")\n newestMessageId String @map(\"newest_message_id\")\n unacknowledged Int @default(0)\n unseenPlainMessages Int? @map(\"unseen_plain_messages\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ExchangeShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n otherShip Ship @relation(\"ExchangeOtherShip\", fields: [fleetId, otherShipId], references: [fleetId, id], onDelete: Restrict)\n newestMessage Message @relation(fields: [fleetId, newestMessageId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, shipId, otherShipId])\n /// The list pages a ship's rows newest first.\n @@index([fleetId, shipId, newestMessageId])\n @@index([fleetId, otherShipId])\n @@index([fleetId, newestMessageId])\n @@map(\"exchanges\")\n}\n\n/// How far pruning went in one exchange (docs/design/exchange-history): the send time of the newest\n/// message of the two ships' exchange that pruning removed, only ever moved forward. One row per pair,\n/// the lower ship id first; a ship's exchange with itself names it twice. Written only by the pruning\n/// batch, in its transaction. No foreign key to a message: what it points at is gone.\nmodel PrunedExchange {\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n otherShipId String @map(\"other_ship_id\")\n prunedUpTo DateTime @map(\"pruned_up_to\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Restrict)\n ship Ship @relation(\"PrunedExchangeShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n otherShip Ship @relation(\"PrunedExchangeOtherShip\", fields: [fleetId, otherShipId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, shipId, otherShipId])\n /// Backs the foreign key to the other ship; the read uses the primary key alone.\n @@index([fleetId, otherShipId])\n @@map(\"pruned_exchanges\")\n}\n\n/// An immutable envelope plus an opaque payload of at most 256 KB, sent by one ship.\n/// Ids start with msg_. The selector is stored as resolved at send time: a ship's\n/// id, never its name, or a type. It can name the message it replies to, and a\n/// resend names the message it resends (nothing sets that yet).\nmodel Message {\n id String @id\n fleetId String @map(\"fleet_id\")\n senderShipId String @map(\"sender_ship_id\")\n selectorKind SelectorKind @map(\"selector_kind\")\n selectorShipId String? @map(\"selector_ship_id\")\n selectorType String? @map(\"selector_type\")\n /// The label selection a send to a label was sent to, its value ids as sent (decision 0065); none for any other selector.\n selectorValueIds String[] @default([]) @map(\"selector_value_ids\")\n /// Null in a sealed fleet (decision 0068): the sealed payload is the data key, nonce and ciphertext with its tag,\n /// beside the plain payload's UTF-8 byte count.\n payload String?\n sealedDataKeyId String? @map(\"sealed_data_key_id\")\n sealedNonce Bytes? @map(\"sealed_nonce\")\n sealedCiphertext Bytes? @map(\"sealed_ciphertext\")\n sealedPayloadBytes Int? @map(\"sealed_payload_bytes\")\n /// The question uuid a withdrawal or a replacement names, read at send (decision 0068, B18).\n questionId String? @map(\"question_id\")\n /// The question uuid a question or a replacement asks, and the one an answer names, read at send (#1632).\n askedQuestionId String? @map(\"asked_question_id\")\n answeredQuestionId String? @map(\"answered_question_id\")\n contentType String @map(\"content_type\")\n /// The model the sender's session stated; none from argo and on messages from before models were stated.\n model String?\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n /// The message it replies to and the one it resends, as written: no foreign\n /// key, so a kept message may name one that is no longer kept (decision 0066).\n inReplyToMessageId String? @map(\"in_reply_to_message_id\")\n resendOfMessageId String? @map(\"resend_of_message_id\")\n /// The meeting it was sent to, or the meeting whose added notice it is (decision 0061).\n meetingId String? @map(\"meeting_id\")\n /// The schedule it was sent for, and that send time; none on a live send (decision 0062).\n scheduleId String? @map(\"schedule_id\")\n sendTime DateTime? @map(\"send_time\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n senderShip Ship @relation(\"MessageSender\", fields: [fleetId, senderShipId], references: [fleetId, id], onDelete: Restrict)\n selectorShip Ship? @relation(\"MessageSelectorShip\", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)\n meeting Meeting? @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n schedule Schedule? @relation(\"MessageSchedule\", fields: [fleetId, scheduleId], references: [fleetId, id], onDelete: Restrict)\n sealedDataKey DataKey? @relation(fields: [fleetId, sealedDataKeyId], references: [fleetId, id], onDelete: Restrict)\n repliedToBySchedules Schedule[] @relation(\"ScheduleInReplyTo\")\n lastSentBySchedules Schedule[] @relation(\"ScheduleLastMessage\")\n deliveries Delivery[]\n events Event[]\n exchangesNewest Exchange[]\n\n @@unique([fleetId, id])\n /// A sender uses an idempotency key once: a repeat of the same request, told by its\n /// request hash, returns the original message; another request with the key is refused.\n @@unique([fleetId, senderShipId, idempotencyKey])\n /// A ship's current model is its newest message with a model.\n @@index([fleetId, senderShipId, createdAt])\n /// A ship's messages page newest first by id: those it sent and those sent to it.\n @@index([fleetId, senderShipId, id])\n /// The installation counts a fleet's messages of the last 7 days (#1126).\n @@index([fleetId, createdAt])\n /// A question's withdrawals and replacements, found by the question uuid they name (decisions 0038, 0068).\n @@index([fleetId, questionId], map: \"messages_fleet_id_question_id_idx\", where: { questionId: { not: null } })\n /// The questions a ship asked, by message id: its open ones are selected along it when it retires (#1632).\n @@index([fleetId, senderShipId, id], map: \"messages_fleet_id_sender_ship_id_id_asked_idx\", where: { askedQuestionId: { not: null } })\n /// A data key's sealed messages, for its foreign key.\n @@index([fleetId, sealedDataKeyId])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, selectorShipId, id])\n @@index([fleetId, inReplyToMessageId])\n @@index([fleetId, resendOfMessageId])\n /// The messages a schedule sent (decision 0062): the foreign key's index (#331).\n @@index([fleetId, scheduleId])\n /// A meeting's contributions page newest first by id (decision 0061).\n @@index([fleetId, meetingId, id])\n @@index([fleetId, selectorShipId, createdAt, id], map: \"messages_pings_idx\", where: raw(\"(content_type = 'application/vnd.aeolus.ping'::text)\"))\n @@map(\"messages\")\n}\n\nenum DeliveryState {\n pending\n received\n handed\n acknowledged\n handled\n notHandled\n undeliverable\n dismissed\n abandoned\n\n @@map(\"delivery_state\")\n}\n\n/// One message to one resolved recipient: a ship or a type. Ids start with dlv_.\n/// A receive hands it to the ship and the lease of the crew receiving, or a push\n/// receive takes it for them: set while it is received or handed, kept once\n/// acknowledged, none while it is pending. Attempts count the hand-overs; the fifth\n/// makes it undeliverable. The hand-over number is the last one the crew reported\n/// with handed (decision 0040), none while pending.\n/// The read date is set when the operator opens a message to argo.\n/// For a type under network rules, the ships of the type its sender may reach,\n/// fixed at send time: only they claim it (decision 0034). Empty: any ship of\n/// the type, as a send no ship of the type may take is refused.\n/// A meeting of ships (decision 0061), id mtg_: one owner and one moderator,\n/// both participants, the opener at first.\nmodel Meeting {\n id String @id\n fleetId String @map(\"fleet_id\")\n title String?\n ownerShipId String @map(\"owner_ship_id\")\n moderatorShipId String @map(\"moderator_ship_id\")\n openedByShipId String @map(\"opened_by_ship_id\")\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n openedAt DateTime @map(\"opened_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n /// The participant that holds the mic; none while it is free.\n micHolderShipId String? @map(\"mic_holder_ship_id\")\n micPattern MicPattern @default(moderator) @map(\"mic_pattern\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n micHolder Ship? @relation(\"MeetingMicHolder\", fields: [fleetId, micHolderShipId], references: [fleetId, id], onDelete: Restrict)\n micRequests MeetingMicRequest[]\n owner Ship @relation(\"MeetingOwner\", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)\n moderator Ship @relation(\"MeetingModerator\", fields: [fleetId, moderatorShipId], references: [fleetId, id], onDelete: Restrict)\n openedBy Ship @relation(\"MeetingOpener\", fields: [fleetId, openedByShipId], references: [fleetId, id], onDelete: Restrict)\n participants MeetingParticipant[]\n messages Message[]\n\n @@unique([fleetId, id])\n /// An opener uses an idempotency key once.\n @@unique([fleetId, openedByShipId, idempotencyKey])\n /// Every foreign key has an index leading with its columns (#331).\n @@index([fleetId, ownerShipId])\n @@index([fleetId, moderatorShipId])\n @@index([fleetId, micHolderShipId])\n @@map(\"meetings\")\n}\n\n/// How a meeting's free mic passes (decision 0061, M9): the moderator's pick, or the oldest request.\n/// A ship's scheduled message (decision 0062): its send input as given, its timing and\n/// refusal strategy, its state, next send time and attempt, and its last outcome.\nmodel Schedule {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n /// The selector as the creator gave it: a ship by id or by name, a type, or a label selection by value ids; never a meeting.\n selectorKind SelectorKind @map(\"selector_kind\")\n selectorShipId String? @map(\"selector_ship_id\")\n selectorShipName String? @map(\"selector_ship_name\")\n selectorType String? @map(\"selector_type\")\n selectorValueIds String[] @default([]) @map(\"selector_value_ids\")\n /// Null in a sealed fleet (decision 0068): the sealed payload is the data key, nonce and ciphertext with its tag,\n /// beside the plain payload's UTF-8 byte count, as a message's.\n payload String?\n sealedDataKeyId String? @map(\"sealed_data_key_id\")\n sealedNonce Bytes? @map(\"sealed_nonce\")\n sealedCiphertext Bytes? @map(\"sealed_ciphertext\")\n sealedPayloadBytes Int? @map(\"sealed_payload_bytes\")\n contentType String @map(\"content_type\")\n model String?\n inReplyToMessageId String? @map(\"in_reply_to_message_id\")\n isForced Boolean @map(\"is_forced\")\n timingKind ScheduleTimingKind @map(\"timing_kind\")\n /// The timing: once an instant; every a duration, or a cron and its zone, each from a start to an end or a count of sends.\n onceAt DateTime? @map(\"once_at\") @db.Timestamptz(3)\n every String?\n cron String?\n timeZone String? @map(\"time_zone\")\n start DateTime? @db.Timestamptz(3)\n end DateTime? @db.Timestamptz(3)\n count Int?\n onRefused RefusalStrategy @map(\"on_refused\")\n retryWindow String @map(\"retry_window\")\n onMissed MissedStrategy @map(\"on_missed\")\n grace String\n idempotencyKey String @map(\"idempotency_key\")\n requestHash String @map(\"request_hash\")\n state ScheduleState\n nextSendTime DateTime? @map(\"next_send_time\") @db.Timestamptz(3)\n nextAttemptAt DateTime? @map(\"next_attempt_at\") @db.Timestamptz(3)\n lastOutcomeKind ScheduleOutcomeKind? @map(\"last_outcome_kind\")\n lastMessageId String? @map(\"last_message_id\")\n lastRefusalCode String? @map(\"last_refusal_code\")\n lastSendTime DateTime? @map(\"last_send_time\") @db.Timestamptz(3)\n lastOutcomeAt DateTime? @map(\"last_outcome_at\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n cancelledAt DateTime? @map(\"cancelled_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(\"ScheduleShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n selectorShip Ship? @relation(\"ScheduleSelectorShip\", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)\n inReplyTo Message? @relation(\"ScheduleInReplyTo\", fields: [fleetId, inReplyToMessageId], references: [fleetId, id], onDelete: Restrict)\n sealedDataKey DataKey? @relation(fields: [fleetId, sealedDataKeyId], references: [fleetId, id], onDelete: Restrict)\n lastMessage Message? @relation(\"ScheduleLastMessage\", fields: [fleetId, lastMessageId], references: [fleetId, id], onDelete: Restrict)\n messages Message[] @relation(\"MessageSchedule\")\n\n @@unique([fleetId, id])\n /// A ship uses an idempotency key once for its schedules.\n @@unique([fleetId, shipId, idempotencyKey])\n /// A ship's schedules page newest first by id.\n @@index([fleetId, shipId, id])\n /// The claim of the active schedules that are due, earliest attempt first.\n @@index([fleetId, nextAttemptAt, id], map: \"schedules_due_idx\", where: raw(\"(state = 'active'::schedule_state)\"))\n /// Every foreign key has an index leading with its columns (#331).\n @@index([fleetId, selectorShipId])\n @@index([fleetId, inReplyToMessageId])\n @@index([fleetId, lastMessageId])\n @@index([fleetId, sealedDataKeyId])\n @@map(\"schedules\")\n}\n\nenum ScheduleState {\n active\n paused\n ended\n cancelled\n\n @@map(\"schedule_state\")\n}\n\nenum ScheduleTimingKind {\n once\n every\n cron\n\n @@map(\"schedule_timing_kind\")\n}\n\nenum RefusalStrategy {\n skip\n retry\n pause\n\n @@map(\"refusal_strategy\")\n}\n\nenum MissedStrategy {\n each\n once\n skip\n\n @@map(\"missed_strategy\")\n}\n\nenum ScheduleOutcomeKind {\n sent\n refused\n missed\n\n @@map(\"schedule_outcome_kind\")\n}\n\nenum MicPattern {\n moderator\n fifo\n\n @@map(\"mic_pattern\")\n}\n\n/// A participant waiting for the mic of its meeting, since its time (decision 0061, M8): once per meeting.\nmodel MeetingMicRequest {\n fleetId String @map(\"fleet_id\")\n meetingId String @map(\"meeting_id\")\n shipId String @map(\"ship_id\")\n requestedAt DateTime @map(\"requested_at\") @db.Timestamptz(3)\n /// Its place on the list, the oldest request's 0.\n place Int\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n participant MeetingParticipant @relation(fields: [fleetId, meetingId, shipId], references: [fleetId, meetingId, shipId], onDelete: Restrict)\n\n @@id([fleetId, meetingId, shipId])\n @@map(\"meeting_mic_requests\")\n}\n\n/// A ship in a meeting and when it joined (decision 0061): once per meeting.\nmodel MeetingParticipant {\n fleetId String @map(\"fleet_id\")\n meetingId String @map(\"meeting_id\")\n shipId String @map(\"ship_id\")\n joinedAt DateTime @map(\"joined_at\") @db.Timestamptz(3)\n /// Its place in the order the meeting's ships joined, the opener's 0.\n place Int\n /// When it left or was revoked; none while it is present (decision 0061, M13).\n leftAt DateTime? @map(\"left_at\") @db.Timestamptz(3)\n /// Whether the owner revoked its right to rejoin.\n isRevoked Boolean @default(false) @map(\"is_revoked\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n micRequest MeetingMicRequest?\n\n @@id([fleetId, meetingId, shipId])\n /// A ship's meetings, and a retire checking them.\n @@index([fleetId, shipId])\n @@map(\"meeting_participants\")\n}\n\nmodel Delivery {\n id String @id\n fleetId String @map(\"fleet_id\")\n messageId String @map(\"message_id\")\n recipientShipId String? @map(\"recipient_ship_id\")\n recipientType String? @map(\"recipient_type\")\n state DeliveryState @default(pending)\n claimedByShipId String? @map(\"claimed_by_ship_id\")\n claimedByLeaseId String? @map(\"claimed_by_lease_id\")\n attempts Int @default(0)\n handOverNumber Int? @map(\"hand_over_number\")\n /// When its crew handed it once more after the turn that took it died; only once (decision 0040).\n handedOnceMoreAt DateTime? @map(\"handed_once_more_at\") @db.Timestamptz(3)\n /// Whether its message was forced: it comes first in receive and push receive (decision 0040).\n isForced Boolean @default(false) @map(\"is_forced\")\n reachableShipIds String[] @default([]) @map(\"reachable_ship_ids\")\n /// Its message's sender, and whether its message is in an exchange: no meeting, no ping (docs/design/exchange-read, E1, E3).\n senderShipId String @map(\"sender_ship_id\")\n isInExchange Boolean @default(false) @map(\"is_in_exchange\")\n /// The ship it reached: its recipient, or the ship of its type that claimed it. Generated by the database from the two, never written.\n reachedShipId String? @default(dbgenerated(\"COALESCE(recipient_ship_id, claimed_by_ship_id)\")) @map(\"reached_ship_id\")\n readAt DateTime? @map(\"read_at\") @db.Timestamptz(3)\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n message Message @relation(fields: [fleetId, messageId], references: [fleetId, id])\n recipientShip Ship? @relation(\"DeliveryRecipientShip\", fields: [fleetId, recipientShipId], references: [fleetId, id], onDelete: Restrict)\n claimedByShip Ship? @relation(\"DeliveryClaimedByShip\", fields: [fleetId, claimedByShipId], references: [fleetId, id], onDelete: Restrict)\n claimedByLease Lease? @relation(fields: [fleetId, claimedByLeaseId], references: [fleetId, id], onDelete: Restrict)\n events Event[]\n overdue OverdueDelivery[]\n\n @@unique([fleetId, id])\n /// One row per recipient.\n @@unique([messageId, recipientShipId])\n @@unique([messageId, recipientType])\n @@index([fleetId, recipientShipId, state])\n /// A ship's inbox pages newest first by id.\n @@index([fleetId, recipientShipId, id])\n @@index([fleetId, recipientType, state])\n /// The installation's health figures scan a fleet's open deliveries by state (decision 0041). Partial, so a foreign key check never picks it.\n @@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]))\"))\n /// A crew's own deliveries in flight, which its next receive returns first.\n @@index([fleetId, claimedByLeaseId, state])\n /// 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.\n @@index([fleetId, claimedByShipId, id], map: \"deliveries_record_fleet_id_claimed_by_ship_id_id_idx\", where: raw(\"(recipient_type IS NOT NULL)\"))\n /// Seen up to here finds the deliveries of its type a ship claimed that are still in flight (docs/design/exchange-read, E6). Partial, so a foreign key check never picks it.\n @@index([fleetId, claimedByShipId, id], map: \"deliveries_in_flight_claimed_idx\", where: raw(\"((recipient_type IS NOT NULL) AND (state = ANY (ARRAY['received'::delivery_state, 'handed'::delivery_state])))\"))\n /// One exchange page is two range scans, one per direction (docs/design/exchange-read, E3). Partial, so a foreign key check never picks it.\n @@index([fleetId, reachedShipId, senderShipId, id], map: \"deliveries_exchange_idx\", where: raw(\"is_in_exchange\"))\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, messageId, id])\n @@index([fleetId, claimedByShipId])\n @@map(\"deliveries\")\n}\n\n/// Which of the 10 and 60 minute clocks ran out (decision 0040).\nenum OverdueClock {\n notConfirmed\n idle\n busy\n\n @@map(\"overdue_clock\")\n}\n\n/// A delivery argo was told is overdue on a pushed lease: its clock ran out\n/// while it waited in the state kept here. Once per lease and delivery, so a\n/// pass after a restart, or a second pass at once, tells nothing again.\nmodel OverdueDelivery {\n fleetId String @map(\"fleet_id\")\n leaseId String @map(\"lease_id\")\n deliveryId String @map(\"delivery_id\")\n shipId String @map(\"ship_id\")\n state DeliveryState\n clock OverdueClock\n minutes Int\n toldAt DateTime @map(\"told_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n lease Lease @relation(fields: [fleetId, leaseId], references: [fleetId, id], onDelete: Restrict)\n delivery Delivery @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n\n @@id([fleetId, leaseId, deliveryId])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, deliveryId])\n @@index([fleetId, shipId])\n @@map(\"overdue_deliveries\")\n}\n\n/// The stuck snapshot (docs/design/performance/performance.md, section 5):\n/// one row per fleet and closed hour, written once by the 30 second pass and\n/// kept for 168 hours. Its counts are by message parties, so a read counts\n/// only what its caller reads (decision 0034).\nmodel HealthSnapshot {\n fleetId String @map(\"fleet_id\")\n hour DateTime @db.Timestamptz(3)\n /// The last event folded into it, by its seq.\n seq BigInt\n /// Stuck at the hour mark: cause, place, message parties, count and oldest since, each.\n stuck Json\n /// The waits from send to acknowledgement in the hour, by message parties, as counts per duration bucket.\n acknowledged Json\n /// The same waits summed over every message, as a reader of every ship reads them.\n acknowledgedWaits Json @map(\"acknowledged_waits\")\n /// Each lease's latest turn as of seq; the latest row's is the fold's.\n turns Json\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, hour])\n @@map(\"health_snapshots\")\n}\n\n/// The fleet's open deliveries as of its latest snapshot, each at its latest\n/// step: replaced whole by each close. A copy for the fold, so no foreign key\n/// but the fleet's.\nmodel HealthSnapshotDelivery {\n fleetId String @map(\"fleet_id\")\n deliveryId String @map(\"delivery_id\")\n messageId String @map(\"message_id\")\n senderShipId String @map(\"sender_ship_id\")\n recipientShipId String? @map(\"recipient_ship_id\")\n recipientType String? @map(\"recipient_type\")\n claimedByShipId String? @map(\"claimed_by_ship_id\")\n reachableShipIds String[] @map(\"reachable_ship_ids\")\n sentAt DateTime @map(\"sent_at\") @db.Timestamptz(3)\n /// Its latest step: the state, since when, and the ship and lease that took it; none while pending since its send.\n state DeliveryState?\n since DateTime? @db.Timestamptz(3)\n stepShipId String? @map(\"step_ship_id\")\n leaseId String? @map(\"lease_id\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, deliveryId])\n @@map(\"health_snapshot_deliveries\")\n}\n\n/// Append-only log of every state change: never updated or deleted. Ids start with evt_.\n/// Records its type and time, who caused it (a ship, or the system when\n/// actor_ship_id is null), the ship, message and delivery it concerns, and a few\n/// details as a flat JSON object.\nmodel Event {\n id String @id\n fleetId String @map(\"fleet_id\")\n type String\n occurredAt DateTime @map(\"occurred_at\") @db.Timestamptz(3)\n /// Who caused it (decision 0057): a ship, an account, the installation or the system.\n actorKind EventActorKind @default(system) @map(\"actor_kind\")\n actorShipId String? @map(\"actor_ship_id\")\n /// The account that caused it, by pagasae's id only: never an email.\n actorAccountId String? @map(\"actor_account_id\")\n /// The ship that presented the account's token, a plugin's page or the gateway, if one did.\n actorThroughShipId String? @map(\"actor_through_ship_id\")\n /// The account signed in to the console as argo when argo caused it, by its id only (decision 0054).\n actorSignedInAccountId String? @map(\"actor_signed_in_account_id\")\n shipId String? @map(\"ship_id\")\n messageId String? @map(\"message_id\")\n deliveryId String? @map(\"delivery_id\")\n details Json\n /// The event's place in its fleet's stream, in commit order and without\n /// gaps: where a live subscription resumes. The id is not, since ids are\n /// taken before their transaction commits.\n seq BigInt\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n actorShip Ship? @relation(\"EventActorShip\", fields: [fleetId, actorShipId], references: [fleetId, id], onDelete: Restrict)\n actorThroughShip Ship? @relation(\"EventActorThroughShip\", fields: [fleetId, actorThroughShipId], references: [fleetId, id], onDelete: Restrict)\n ship Ship? @relation(\"EventShip\", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)\n message Message? @relation(fields: [fleetId, messageId], references: [fleetId, id], onDelete: Restrict)\n delivery Delivery? @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)\n\n @@unique([fleetId, seq])\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n /// A ship's timeline pages through the events it caused and those naming\n /// it by their place in the stream, each through its own index.\n @@index([fleetId, actorShipId, seq])\n @@index([actorThroughShipId, fleetId])\n @@index([fleetId, shipId, seq])\n @@index([fleetId, messageId])\n @@index([fleetId, deliveryId])\n /// The health reads take a fleet's events since a time (decision 0042).\n @@index([fleetId, occurredAt])\n @@index([fleetId, shipId, seq], map: \"events_starting_prompt_issued_idx\", where: raw(\"(type = 'StartingPromptIssued'::text)\"))\n /// The owner a commissioner named last, preselected for argo's next commission from the console (decision 0045).\n @@index([fleetId, actorShipId, seq], map: \"events_owner_set_idx\", where: raw(\"(type = 'OwnerSet'::text)\"))\n /// A ship's messages page through those it claimed as a ship of their type by id.\n @@index([fleetId, shipId, messageId], map: \"events_delivery_handed_idx\", where: raw(\"(type = 'DeliveryHanded'::text)\"))\n /// A first stuck snapshot reads each lease's turn at its oldest hour from the turn reports alone.\n @@index([fleetId, occurredAt], map: \"events_turn_reported_idx\", where: raw(\"(type = 'TurnReported'::text)\"))\n /// The pruning pass finds the mic and participant events of ended meetings (decision 0066).\n @@index([fleetId, seq], map: \"events_meeting_parts_idx\", where: raw(\"(type = ANY (ARRAY['ParticipantAdded'::text, 'ParticipantLeft'::text, 'ParticipantRejoined'::text, 'ParticipantRevoked'::text, 'MicRequested'::text, 'MicRequestWithdrawn'::text, 'MicGiven'::text, 'MicReleased'::text, 'MicTaken'::text, 'MicPatternSet'::text]))\"))\n /// The pruning pass finds a crew's session and secret events past the cutoff (decision 0066).\n @@index([fleetId, occurredAt], map: \"events_crew_idx\", where: raw(\"(type = ANY (ARRAY['ShipClaimed'::text, 'LeaseRevoked'::text, 'LeasePushed'::text, 'ShipReported'::text, 'TurnReported'::text, 'StatementSet'::text, 'CrewStatusChanged'::text, 'SignInTicketIssued'::text, 'ViewerSessionStarted'::text, 'StartingPromptIssued'::text, 'CredentialRevoked'::text]))\"))\n @@map(\"events\")\n}\n\n/// Why a console session ended: a sign-in elsewhere took argo over, the\n/// operator signed out, or the password was reset.\nenum ConsoleSessionEndReason {\n takenOver\n signedOut\n passwordReset\n accountCutOff\n\n @@map(\"console_session_end_reason\")\n}\n\n/// argo's own sign-in: email and Argon2id password hash. fleet:init creates it\n/// with neither, until argo sets both in Settings; a hosting installation\n/// creates it with an email and no password. Ids start with opr_.\n/// The email is unique across all fleets: finding the account by email is the one\n/// lookup not scoped by fleet (ADR 0007). One account per fleet in v1.\nmodel Operator {\n id String @id\n fleetId String @unique @map(\"fleet_id\")\n /// The fleets the installation creates may share one; the email of argo's own sign-in (with a password) is no other operator's.\n email String?\n passwordHash String? @map(\"password_hash\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@unique([email], map: \"operators_sign_in_email_key\", where: raw(\"(password_hash IS NOT NULL)\"))\n @@index([email])\n @@map(\"operators\")\n}\n\n/// The operator crewing argo through the web console. Ids start with ses_.\n/// Only the hash of the session token is stored, unique across all fleets: finding\n/// a session by its token is the one lookup not scoped by fleet (ADR 0007).\n/// Valid until expires_at, which moves to idle_limit_seconds after each use\n/// (30 days for the operator, 2 hours for a viewer), never past ends_by.\nmodel ConsoleSession {\n id String @id\n fleetId String @map(\"fleet_id\")\n shipId String @map(\"ship_id\")\n /// The lease on argo it holds; null for a viewer session (decision 0022).\n leaseId String? @map(\"lease_id\")\n idleLimitSeconds Int @map(\"idle_limit_seconds\")\n /// No use renews it past this; null when only idleness ends it.\n endsBy DateTime? @map(\"ends_by\") @db.Timestamptz(3)\n /// The device it signed in from, as the browser told: \"Mac · Chrome\".\n device String @default(\"Unknown device\")\n /// The account that signed in as argo, by its id only; null for argo's own sign-in and a viewer (decision 0054).\n accountId String? @map(\"account_id\")\n tokenHash String @unique @map(\"token_hash\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n lastUsedAt DateTime @map(\"last_used_at\") @db.Timestamptz(3)\n expiresAt DateTime @map(\"expires_at\") @db.Timestamptz(3)\n endedAt DateTime? @map(\"ended_at\") @db.Timestamptz(3)\n /// Why the session ended; null while it has not.\n endReason ConsoleSessionEndReason? @map(\"end_reason\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])\n lease Lease? @relation(fields: [fleetId, leaseId], references: [fleetId, id])\n\n noticeDismissals NoticeDismissal[]\n guideProgress GuideProgress[]\n\n /// At most one live session holding argo's lease per fleet: signing in ends the previous one. Viewer sessions run beside it.\n @@unique([fleetId], map: \"console_sessions_fleet_id_open_key\", where: raw(\"ended_at IS NULL AND lease_id IS NOT NULL\"))\n /// Every foreign key has an index leading with its columns, so deleting a\n /// referenced row checks it with an index, not a scan (#331).\n @@index([fleetId, shipId])\n @@index([fleetId, leaseId])\n @@map(\"console_sessions\")\n}\n\n/// A one-time sign-in ticket for the fleet's operator, issued by a hosting\n/// installation and redeemed in the console (decision 0020). Only its hash is\n/// stored, unique across all fleets: redeeming finds it before the fleet is known.\nmodel SignInTicket {\n tokenHash String @id @map(\"token_hash\")\n fleetId String @map(\"fleet_id\")\n /// Whom it signs in as: the operator or a viewer (decision 0022).\n signInAs SignInAs @map(\"sign_in_as\")\n /// The account it signs in as argo, by its id only; null for argo's own or a viewer's ticket (decision 0054).\n accountId String? @map(\"account_id\")\n issuedAt DateTime @map(\"issued_at\") @db.Timestamptz(3)\n expiresAt DateTime @map(\"expires_at\") @db.Timestamptz(3)\n /// When it signed in; null while unused.\n usedAt DateTime? @map(\"used_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@index([fleetId])\n @@map(\"sign_in_tickets\")\n}\n\nenum SignInAs {\n operator\n viewer\n\n @@map(\"sign_in_as\")\n}\n\n/// The installation's settings (decision 0020): the default ship, daily message,\n/// schedules per ship and minimum schedule interval (seconds) limits and the\n/// default retention in days (decision 0066) for fleets, and the cap on fleets,\n/// each null for none. One row at most, and none until the installation sets\n/// them. Belongs to no fleet.\nmodel InstallationSettings {\n id Int @id @default(1)\n defaultShipLimit Int? @map(\"default_ship_limit\")\n defaultDailyMessageLimit Int? @map(\"default_daily_message_limit\")\n defaultSchedulesPerShipLimit Int? @map(\"default_schedules_per_ship_limit\")\n defaultMinimumScheduleInterval Int? @map(\"default_minimum_schedule_interval\")\n defaultRetentionDays Int? @map(\"default_retention_days\")\n fleetCap Int? @map(\"fleet_cap\")\n\n @@map(\"installation_settings\")\n}\n\nenum InstallationRequestKind {\n createFleet @map(\"create_fleet\")\n deleteFleet @map(\"delete_fleet\")\n\n @@map(\"installation_request_kind\")\n}\n\n/// A create or delete of a fleet the installation carried out, under its caller's\n/// request id, so a replay answers the same (decision 0020). It belongs to the\n/// installation, not to a fleet, and keeps the request as a hash only. A create's\n/// row names the fleet and argo it answers with and is deleted with that fleet; a\n/// delete's row names nothing of the fleet.\nmodel InstallationRequest {\n requestId String @id @map(\"request_id\")\n kind InstallationRequestKind\n requestHash String @map(\"request_hash\")\n /// The created fleet and its argo; null for a delete.\n fleetId String? @map(\"fleet_id\")\n operatorShipId String? @map(\"operator_ship_id\")\n at DateTime @db.Timestamptz(3)\n\n @@index([fleetId])\n @@map(\"installation_requests\")\n}\n\n/// A console notice the installation sets (decision 0023), shown above every\n/// page to the sessions of its audience. It belongs to no fleet.\nmodel Notice {\n id String @id\n /// Its place in the installation's order.\n position Int\n audience NoticeAudience\n text String\n /// Its links: label, and url, isSignOut or both.\n links Json @default(\"[]\")\n isDismissible Boolean @default(false) @map(\"is_dismissible\")\n\n @@map(\"notices\")\n}\n\nenum NoticeAudience {\n everyone\n operators\n viewers\n accounts\n\n @@map(\"notice_audience\")\n}\n\n/// A notice a console session dismissed, for itself (decision 0023). It goes\n/// with its session and its fleet.\nmodel NoticeDismissal {\n fleetId String @map(\"fleet_id\")\n consoleSessionId String @map(\"console_session_id\")\n noticeId String @map(\"notice_id\")\n dismissedAt DateTime @map(\"dismissed_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n consoleSession ConsoleSession @relation(fields: [consoleSessionId], references: [id])\n\n @@id([consoleSessionId, noticeId])\n @@index([fleetId])\n @@map(\"notice_dismissals\")\n}\n\n/// A notice an account signed in to the console as itself dismissed, for\n/// itself, kept by its account id in each fleet (accounts design, A9). Core\n/// stores no account: the id is pagasae's. It goes with its fleet.\nmodel AccountNoticeDismissal {\n fleetId String @map(\"fleet_id\")\n accountId String @map(\"account_id\")\n noticeId String @map(\"notice_id\")\n dismissedAt DateTime @map(\"dismissed_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, accountId, noticeId])\n @@map(\"account_notice_dismissals\")\n}\n\n/// The installation's guide (decision 0024): steps for the console sessions of\n/// one audience. At most one row; it belongs to no fleet.\nmodel Guide {\n /// Always \"guide\": the installation has one guide or none.\n id String @id\n audience NoticeAudience\n /// Its steps, in order: path, anchor (optional), title and text.\n steps Json\n\n @@map(\"guides\")\n}\n\nenum GuideProgressState {\n open\n skipped\n finished\n\n @@map(\"guide_progress_state\")\n}\n\n/// Where a console session is in the guide, for itself (decision 0024). It\n/// goes with its session and its fleet.\nmodel GuideProgress {\n fleetId String @map(\"fleet_id\")\n consoleSessionId String @id @map(\"console_session_id\")\n step Int\n state GuideProgressState\n recordedAt DateTime @map(\"recorded_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n consoleSession ConsoleSession @relation(fields: [consoleSessionId], references: [id])\n\n @@index([fleetId])\n @@map(\"guide_progress\")\n}\n\n/// Where an account signed in to the console as itself is in the guide, kept\n/// by its account id in each fleet (accounts design, A9). It goes with its fleet.\nmodel AccountGuideProgress {\n fleetId String @map(\"fleet_id\")\n accountId String @map(\"account_id\")\n step Int\n state GuideProgressState\n recordedAt DateTime @map(\"recorded_at\") @db.Timestamptz(3)\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n\n @@id([fleetId, accountId])\n @@map(\"account_guide_progress\")\n}\n\n/// An account pagasae cut off (decision 0058): its tokens issued before\n/// cut_off_at are refused in every fleet until forget_at, when the longest of\n/// them has ended. The installation's, not a fleet's: no fleet_id (ADR 0007).\n/// Never an email: the account by pagasae's id only.\nmodel AccountCutOff {\n accountId String @id @map(\"account_id\")\n cutOffAt DateTime @map(\"cut_off_at\") @db.Timestamptz(3)\n forgetAt DateTime @map(\"forget_at\") @db.Timestamptz(3)\n\n /// Forgetting finds the cut-offs that ended.\n @@index([forgetAt])\n @@map(\"account_cut_offs\")\n}\n\n/// Who caused an event (decision 0057).\nenum EventActorKind {\n ship\n account\n installation\n system\n\n @@map(\"event_actor_kind\")\n}\n\n/// Who commissioned a ship (decision 0057).\n/// Who wrote a verified fact (decision 0059).\nenum FactWriterKind {\n ship\n account\n installation\n\n @@map(\"fact_writer_kind\")\n}\n\nenum CommissionerKind {\n ship\n account\n installation\n\n @@map(\"commissioner_kind\")\n}\n\nenum LabelOwnerKind {\n ship\n installation\n\n @@map(\"label_owner_kind\")\n}\n\n/// A sealed fleet's data key (decision 0068): kept only wrapped, by the company key and by the recovery key\n/// when set, with a check value (HMAC-SHA-256 of a fixed text under the key) that proves an unwrap gave\n/// the right key. Never unwrapped in the database. Old keys stay to unseal old payloads.\nmodel DataKey {\n id String @id\n fleetId String @map(\"fleet_id\")\n wrappedByCompanyKey Bytes @map(\"wrapped_by_company_key\")\n wrappedByRecoveryKey Bytes? @map(\"wrapped_by_recovery_key\")\n checkValue Bytes @map(\"check_value\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n isCurrent Boolean @map(\"is_current\")\n\n fleet Fleet @relation(fields: [fleetId], references: [id])\n messages Message[]\n schedules Schedule[]\n\n @@unique([fleetId, id])\n /// One current data key per fleet.\n @@unique([fleetId], map: \"data_keys_fleet_id_current_key\", where: { isCurrent: true })\n @@map(\"data_keys\")\n}\n\n/// Immutable bounded commission rights. Only withdrawnAt changes after recording.\nmodel CommissionApproval {\n id String @id\n fleetId String @map(\"fleet_id\")\n approver Json\n commissionerId String @map(\"commissioner_id\")\n scopes String[]\n subjectDigest String @map(\"subject_digest\")\n createdAt DateTime @map(\"created_at\") @db.Timestamptz(3)\n withdrawnAt DateTime? @map(\"withdrawn_at\") @db.Timestamptz(3)\n fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Restrict)\n commissioner Ship @relation(fields: [fleetId, commissionerId], references: [fleetId, id], onDelete: Restrict)\n\n @@unique([fleetId, id])\n @@index([fleetId, commissionerId])\n @@map(\"commission_approvals\")\n}\n",
21
21
  "runtimeDataModel": {
22
22
  "models": {},
23
23
  "enums": {},
@@ -1 +1 @@
1
- {"version":3,"file":"class.js","sourceRoot":"","sources":["../../../../../src/adapters/prisma/generated/internal/class.ts"],"names":[],"mappings":"AACA,qEAAqE;AACrE,oBAAoB;AACpB,wCAAwC;AACxC,eAAe;AACf;;;;;;GAMG;AAEH,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAA;AAIxD,MAAM,MAAM,GAAkC;IAC5C,iBAAiB,EAAE;QACjB,gBAAgB;KACjB;IACD,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,0CAA0C;IAC3D,gBAAgB,EAAE,YAAY;IAC9B,cAAc,EAAE,s5+EAAs5+E;IACt6+E,kBAAkB,EAAE;QAClB,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;KACZ;IACD,wBAAwB,EAAE;QACxB,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ;CACF,CAAA;AAED,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,0x9DAA0x9D,CAAC,CAAA;AACh09D,MAAM,CAAC,sBAAsB,GAAG;IAC9B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,679BAA679B,CAAC;IACl99B,KAAK,EAAE,4kzYAA4kzY;CACplzY,CAAA;AAED,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IACnD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AAC1C,CAAC;AAED,MAAM,CAAC,YAAY,GAAG;IACpB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,8DAA8D,CAAC;IAEpG,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,0EAA0E,CAAC,CAAA;QACzG,OAAO,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,UAAU,EAAE,6BAA6B;CAC1C,CAAA;AAknBD,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAuC,CAAA;AAC9E,CAAC"}
1
+ {"version":3,"file":"class.js","sourceRoot":"","sources":["../../../../../src/adapters/prisma/generated/internal/class.ts"],"names":[],"mappings":"AACA,qEAAqE;AACrE,oBAAoB;AACpB,wCAAwC;AACxC,eAAe;AACf;;;;;;GAMG;AAEH,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAA;AAIxD,MAAM,MAAM,GAAkC;IAC5C,iBAAiB,EAAE;QACjB,gBAAgB;KACjB;IACD,eAAe,EAAE,QAAQ;IACzB,eAAe,EAAE,0CAA0C;IAC3D,gBAAgB,EAAE,YAAY;IAC9B,cAAc,EAAE,m6+EAAm6+E;IACn7+E,kBAAkB,EAAE;QAClB,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;KACZ;IACD,wBAAwB,EAAE;QACxB,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ;CACF,CAAA;AAED,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,0x9DAA0x9D,CAAC,CAAA;AACh09D,MAAM,CAAC,sBAAsB,GAAG;IAC9B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,679BAA679B,CAAC;IACl99B,KAAK,EAAE,4kzYAA4kzY;CACplzY,CAAA;AAED,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IAClD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAA;IAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IACnD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AAC1C,CAAC;AAED,MAAM,CAAC,YAAY,GAAG;IACpB,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,8DAA8D,CAAC;IAEpG,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,0EAA0E,CAAC,CAAA;QACzG,OAAO,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IAED,UAAU,EAAE,6BAA6B;CAC1C,CAAA;AAknBD,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,eAAe,CAAC,MAAM,CAAuC,CAAA;AAC9E,CAAC"}
@@ -103,7 +103,7 @@ function toFacts(row) {
103
103
  export function installationFleetsStatement(fleetId, window) {
104
104
  return Prisma.sql `
105
105
  SELECT f.id AS "fleetId", f.name, o.email AS "operatorEmail", f.created_at AS "createdAt",
106
- (SELECT count(*) FROM ships s WHERE s.fleet_id = f.id AND s.retired_at IS NULL) AS "shipCount",
106
+ (SELECT count(*) FROM ships s WHERE s.fleet_id = f.id AND s.retired_at IS NULL AND s.kind <> 'viewer') AS "shipCount",
107
107
  -- The last 7 times 24 hours: the whole UTC days from the first one's start from the days each send counted on,
108
108
  -- and only the hours before it, the rest of the day the window starts in, from the messages.
109
109
  (SELECT coalesce(sum(md.messages), 0) FROM message_days md WHERE md.fleet_id = f.id AND md.day >= (${window.firstDay} AT TIME ZONE 'UTC')::date)
@@ -220,7 +220,7 @@ export function createPrismaFleetLimitReads(prisma) {
220
220
  const limits = { fleets: createPrismaFleetRepository(prisma), installationSettings: createPrismaInstallationSettings(prisma) };
221
221
  return {
222
222
  applied: (fleetId) => appliedLimits(limits, fleetId),
223
- activeShips: (fleetId) => prisma.ship.count({ where: { fleetId, retiredAt: null } }),
223
+ activeShips: (fleetId) => prisma.ship.count({ where: { fleetId, retiredAt: null, kind: { not: 'viewer' } } }),
224
224
  messagesOn: async (fleetId, day) => {
225
225
  const row = await prisma.messageDay.findUnique({ where: { fleetId_day: { fleetId, day } }, select: { messages: true } });
226
226
  return row?.messages ?? 0;
@@ -1 +1 @@
1
- {"version":3,"file":"installation.js","sourceRoot":"","sources":["../../../src/adapters/prisma/installation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAgB,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAS5D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,kEAAkE;AAClE,8EAA8E;AAE9E,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE;IACrC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC3C,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;CACb,CAAC,CAAC;AAEH,SAAS,qBAAqB,CAAC,GAAY;IACzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3E,IAAI,IAAI,KAAK,aAAa,EAAE,C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EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,IAAI,IAAI;KACvI,CAAC;AACJ,CAAC"}
@@ -1,28 +1,22 @@
1
1
  /**
2
- * Wakes waiting receives and open wake streams from the notices the delivery
3
- * listener hears (ADR 0003). Each watches its ship and its type; a notice of a
4
- * delivery pending for either wakes it, and it looks in the database again.
5
- * Held in the server's memory only: a wake-up is a hint, and a receive that
6
- * misses one still returns within its wait, as a stream's crew still looks at
7
- * its next wake, reopen or safety look, so nothing the guarantee depends on
8
- * lives here.
2
+ * Wakes open wake streams from the notices the delivery listener hears (ADR
3
+ * 0003, decision 0072). Each watches its ship and its type; a notice of a
4
+ * delivery pending for either wakes it, and its crew looks in the database.
5
+ * Held in the server's memory only: a wake is a hint, and a stream's crew
6
+ * still looks at its next wake, reopen or safety look, so nothing the
7
+ * guarantee depends on lives here. No call waits on it.
9
8
  */
10
- import type { ReceiverWakeups, WakeStreams } from '../../domain/messaging/ports.js';
9
+ import type { WakeStreams } from '../../domain/messaging/ports.js';
11
10
  import type { DeliveryNotice } from '../../domain/shared/notifier.js';
12
- export interface ReceiverWakeupHub extends ReceiverWakeups, WakeStreams {
13
- /** Wakes the receives and streams watching the ship or the type the delivery is pending for. */
11
+ export interface ReceiverWakeupHub extends WakeStreams {
12
+ /** Wakes the streams watching the ship or the type the delivery is pending for. */
14
13
  deliveryPending: (notice: DeliveryNotice) => void;
15
14
  /**
16
- * Wakes every waiting receive and every open stream (reason `reconnect`), so each looks again. For when the listener
15
+ * Wakes every open stream (reason `reconnect`), so each crew looks again. For when the listener
17
16
  * starts listening again: notices sent while it did not listen are gone.
18
17
  */
19
18
  wakeAll: () => void;
20
- /**
21
- * Ends every wait at once, as if its time had passed, and every later one:
22
- * for a stopping server, so no receive holds the stop up. Each answers
23
- * what it would at the end of its wait: no deliveries. Every open stream
24
- * ends too, and no stream opens after.
25
- */
19
+ /** Ends every open stream at once, for a stopping server: no stream opens after. */
26
20
  endAll: () => void;
27
21
  }
28
22
  export declare function createReceiverWakeups(): ReceiverWakeupHub;