@opengeni/db 0.16.2 → 0.17.1

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.
@@ -86,9 +86,16 @@ export const FORCE_RLS_TABLES = [
86
86
  "sessions",
87
87
  "slack_bot_delete_operations",
88
88
  "slack_bot_post_operations",
89
+ "slack_bot_user_links",
90
+ "slack_interaction_inbox",
91
+ "slack_interaction_progress_deliveries",
92
+ "slack_interactions",
89
93
  "social_connections",
90
94
  "social_posts",
91
95
  "usage_events",
96
+ "workspace_artifact_events",
97
+ "workspace_artifact_versions",
98
+ "workspace_artifacts",
92
99
  "workspace_captures",
93
100
  "workspace_control_events",
94
101
  "workspace_inference_controls",
@@ -198,10 +205,15 @@ export const RUNTIME_FULL_DML_TABLES = [
198
205
  "sessions",
199
206
  "slack_bot_delete_operations",
200
207
  "slack_bot_post_operations",
208
+ "slack_bot_user_links",
209
+ "slack_interaction_inbox",
210
+ "slack_interaction_progress_deliveries",
211
+ "slack_interactions",
201
212
  "social_connections",
202
213
  "social_posts",
203
214
  "stripe_webhook_events",
204
215
  "usage_events",
216
+ "workspace_artifacts",
205
217
  "workspace_captures",
206
218
  "workspace_control_events",
207
219
  "workspace_inference_controls",
@@ -227,6 +239,8 @@ export const RUNTIME_READ_INSERT_TABLES = [
227
239
  "preference_registry_preferences",
228
240
  "preference_registry_revisions",
229
241
  "session_spawn_denials",
242
+ "workspace_artifact_events",
243
+ "workspace_artifact_versions",
230
244
  "workspace_instruction_policy_activation_events",
231
245
  "workspace_instruction_policy_revisions",
232
246
  ] as const;
@@ -557,7 +571,11 @@ export async function inspectRuntimeDatabasePosture(
557
571
  and p.prokind in ('f', 'p')
558
572
  order by p.proname, pg_get_function_identity_arguments(p.oid)
559
573
  `),
560
- ).map((row) => ({ name: row.name, owner: row.owner, execute: row.can_execute }));
574
+ ).map((row) => ({
575
+ name: row.name,
576
+ owner: row.owner,
577
+ execute: row.can_execute,
578
+ }));
561
579
 
562
580
  return {
563
581
  identity: mappedIdentity,
package/src/schema.ts CHANGED
@@ -109,6 +109,169 @@ export const workspaces = pgTable(
109
109
  }),
110
110
  );
111
111
 
112
+ // A single generic workspace-published surface. Presentation labels such as
113
+ // app, page, gallery, or document are intentionally not persisted as types.
114
+ export const workspaceArtifacts = pgTable(
115
+ "workspace_artifacts",
116
+ {
117
+ id: uuid("id").primaryKey().defaultRandom(),
118
+ accountId: uuid("account_id")
119
+ .notNull()
120
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
121
+ workspaceId: uuid("workspace_id")
122
+ .notNull()
123
+ .references(() => workspaces.id, { onDelete: "cascade" }),
124
+ slug: text("slug").notNull(),
125
+ title: text("title").notNull(),
126
+ description: text("description"),
127
+ status: text("status").$type<"active" | "archived">().notNull().default("active"),
128
+ // The FK to workspace_artifact_versions is installed by migration after
129
+ // that table exists. Keeping this pointer here makes reads inexpensive.
130
+ currentVersionId: uuid("current_version_id"),
131
+ createdBySubjectId: text("created_by_subject_id").notNull(),
132
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
133
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
134
+ },
135
+ (table) => ({
136
+ workspaceAccount: foreignKey({
137
+ name: "workspace_artifacts_workspace_account_fk",
138
+ columns: [table.workspaceId, table.accountId],
139
+ foreignColumns: [workspaces.id, workspaces.accountId],
140
+ }).onDelete("cascade"),
141
+ workspaceSlug: uniqueIndex("workspace_artifacts_workspace_slug_uq").on(
142
+ table.workspaceId,
143
+ table.slug,
144
+ ),
145
+ workspaceId: uniqueIndex("workspace_artifacts_workspace_id_uq").on(table.workspaceId, table.id),
146
+ list: index("workspace_artifacts_list_idx").on(table.workspaceId, table.updatedAt),
147
+ }),
148
+ );
149
+
150
+ export const workspaceArtifactVersions = pgTable(
151
+ "workspace_artifact_versions",
152
+ {
153
+ id: uuid("id").primaryKey().defaultRandom(),
154
+ accountId: uuid("account_id")
155
+ .notNull()
156
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
157
+ workspaceId: uuid("workspace_id")
158
+ .notNull()
159
+ .references(() => workspaces.id, { onDelete: "cascade" }),
160
+ artifactId: uuid("artifact_id").notNull(),
161
+ revision: integer("revision").notNull(),
162
+ contentKey: text("content_key").notNull(),
163
+ contentType: text("content_type").$type<"text/html">().notNull().default("text/html"),
164
+ contentSha256: text("content_sha256").notNull(),
165
+ sizeBytes: integer("size_bytes").notNull(),
166
+ operationKey: text("operation_key").notNull(),
167
+ sourceSessionId: uuid("source_session_id"),
168
+ sourceTurnId: uuid("source_turn_id"),
169
+ sourceAttemptId: uuid("source_attempt_id"),
170
+ sourceExecutionGeneration: integer("source_execution_generation"),
171
+ createdBySubjectId: text("created_by_subject_id").notNull(),
172
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
173
+ },
174
+ (table) => ({
175
+ workspaceAccount: foreignKey({
176
+ name: "workspace_artifact_versions_workspace_account_fk",
177
+ columns: [table.workspaceId, table.accountId],
178
+ foreignColumns: [workspaces.id, workspaces.accountId],
179
+ }).onDelete("cascade"),
180
+ artifact: foreignKey({
181
+ name: "workspace_artifact_versions_artifact_fk",
182
+ columns: [table.workspaceId, table.artifactId],
183
+ foreignColumns: [workspaceArtifacts.workspaceId, workspaceArtifacts.id],
184
+ }).onDelete("cascade"),
185
+ workspaceId: uniqueIndex("workspace_artifact_versions_workspace_id_uq").on(
186
+ table.workspaceId,
187
+ table.id,
188
+ ),
189
+ revision: uniqueIndex("workspace_artifact_versions_revision_uq").on(
190
+ table.workspaceId,
191
+ table.artifactId,
192
+ table.revision,
193
+ ),
194
+ operation: uniqueIndex("workspace_artifact_versions_operation_uq").on(
195
+ table.workspaceId,
196
+ table.operationKey,
197
+ ),
198
+ provenance: check(
199
+ "workspace_artifact_versions_provenance_chk",
200
+ sql`(
201
+ ${table.sourceSessionId} is null
202
+ and ${table.sourceTurnId} is null
203
+ and ${table.sourceAttemptId} is null
204
+ and ${table.sourceExecutionGeneration} is null
205
+ ) or (
206
+ ${table.sourceSessionId} is not null
207
+ and ${table.sourceTurnId} is not null
208
+ and ${table.sourceAttemptId} is not null
209
+ and ${table.sourceExecutionGeneration} > 0
210
+ )`,
211
+ ),
212
+ }),
213
+ );
214
+
215
+ export const workspaceArtifactEvents = pgTable(
216
+ "workspace_artifact_events",
217
+ {
218
+ id: uuid("id").primaryKey().defaultRandom(),
219
+ accountId: uuid("account_id")
220
+ .notNull()
221
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
222
+ workspaceId: uuid("workspace_id")
223
+ .notNull()
224
+ .references(() => workspaces.id, { onDelete: "cascade" }),
225
+ artifactId: uuid("artifact_id").notNull(),
226
+ type: text("type").$type<"published" | "rolled_back">().notNull(),
227
+ fromVersionId: uuid("from_version_id"),
228
+ toVersionId: uuid("to_version_id").notNull(),
229
+ operationKey: text("operation_key").notNull(),
230
+ sourceSessionId: uuid("source_session_id"),
231
+ sourceTurnId: uuid("source_turn_id"),
232
+ sourceAttemptId: uuid("source_attempt_id"),
233
+ sourceExecutionGeneration: integer("source_execution_generation"),
234
+ actorSubjectId: text("actor_subject_id").notNull(),
235
+ reason: text("reason").notNull(),
236
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
237
+ },
238
+ (table) => ({
239
+ workspaceAccount: foreignKey({
240
+ name: "workspace_artifact_events_workspace_account_fk",
241
+ columns: [table.workspaceId, table.accountId],
242
+ foreignColumns: [workspaces.id, workspaces.accountId],
243
+ }).onDelete("cascade"),
244
+ artifact: foreignKey({
245
+ name: "workspace_artifact_events_artifact_fk",
246
+ columns: [table.workspaceId, table.artifactId],
247
+ foreignColumns: [workspaceArtifacts.workspaceId, workspaceArtifacts.id],
248
+ }).onDelete("cascade"),
249
+ operation: uniqueIndex("workspace_artifact_events_operation_uq").on(
250
+ table.workspaceId,
251
+ table.operationKey,
252
+ ),
253
+ list: index("workspace_artifact_events_list_idx").on(
254
+ table.workspaceId,
255
+ table.artifactId,
256
+ table.createdAt,
257
+ ),
258
+ provenance: check(
259
+ "workspace_artifact_events_provenance_chk",
260
+ sql`(
261
+ ${table.sourceSessionId} is null
262
+ and ${table.sourceTurnId} is null
263
+ and ${table.sourceAttemptId} is null
264
+ and ${table.sourceExecutionGeneration} is null
265
+ ) or (
266
+ ${table.sourceSessionId} is not null
267
+ and ${table.sourceTurnId} is not null
268
+ and ${table.sourceAttemptId} is not null
269
+ and ${table.sourceExecutionGeneration} > 0
270
+ )`,
271
+ ),
272
+ }),
273
+ );
274
+
112
275
  // One target-schema-local deployment fallback. The migration runner reconciles
113
276
  // this singleton from OPENGENI_MAX_NESTED_AGENT_DEPTH; session admission locks
114
277
  // and reads it through the SECURITY DEFINER capability installed by the
@@ -381,12 +544,16 @@ export const codexSubscriptionCredentials = pgTable(
381
544
  // continues to own `version`; quota/cache writes own neither counter.
382
545
  allocatorVersion: integer("allocator_version").notNull().default(1),
383
546
  allocatorUpdatedBySubjectId: text("allocator_updated_by_subject_id"),
384
- allocatorUpdatedAt: timestamp("allocator_updated_at", { withTimezone: true }),
547
+ allocatorUpdatedAt: timestamp("allocator_updated_at", {
548
+ withTimezone: true,
549
+ }),
385
550
  // Authoritative count-only summary cached from /wham/usage. Detailed rows
386
551
  // are never persisted as redemption authority; every first POST preflights
387
552
  // the provider's fresh detail endpoint.
388
553
  resetCreditAvailableCount: integer("reset_credit_available_count"),
389
- resetCreditsCheckedAt: timestamp("reset_credits_checked_at", { withTimezone: true }),
554
+ resetCreditsCheckedAt: timestamp("reset_credits_checked_at", {
555
+ withTimezone: true,
556
+ }),
390
557
  // Set only by a direct Better Auth cookie connection/reconnection. Legacy,
391
558
  // configured, delegated, API-key, and agent-created rows remain view-only.
392
559
  connectedBySubjectId: text("connected_by_subject_id"),
@@ -436,7 +603,9 @@ export const codexResetRedemptionAttempts = pgTable(
436
603
  outcome: text("outcome"),
437
604
  claimHolderId: uuid("claim_holder_id"),
438
605
  claimExpiresAt: timestamp("claim_expires_at", { withTimezone: true }),
439
- confirmationExpiresAt: timestamp("confirmation_expires_at", { withTimezone: true }).notNull(),
606
+ confirmationExpiresAt: timestamp("confirmation_expires_at", {
607
+ withTimezone: true,
608
+ }).notNull(),
440
609
  providerStartedAt: timestamp("provider_started_at", { withTimezone: true }),
441
610
  completedAt: timestamp("completed_at", { withTimezone: true }),
442
611
  lastFailureKind: text("last_failure_kind"),
@@ -544,6 +713,194 @@ export const connections = pgTable(
544
713
  }),
545
714
  );
546
715
 
716
+ export const slackBotUserLinks = pgTable(
717
+ "slack_bot_user_links",
718
+ {
719
+ id: uuid("id").primaryKey().defaultRandom(),
720
+ accountId: uuid("account_id")
721
+ .notNull()
722
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
723
+ workspaceId: uuid("workspace_id")
724
+ .notNull()
725
+ .references(() => workspaces.id, { onDelete: "cascade" }),
726
+ connectionId: uuid("connection_id")
727
+ .notNull()
728
+ .references(() => connections.id, { onDelete: "cascade" }),
729
+ slackTeamId: text("slack_team_id").notNull(),
730
+ slackUserId: text("slack_user_id").notNull(),
731
+ subjectId: text("subject_id").notNull(),
732
+ linkedBySubjectId: text("linked_by_subject_id").notNull(),
733
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
734
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
735
+ },
736
+ (table) => ({
737
+ connectionUser: uniqueIndex("slack_bot_user_links_connection_user_uq").on(
738
+ table.connectionId,
739
+ table.slackUserId,
740
+ ),
741
+ workspaceSubject: index("slack_bot_user_links_workspace_subject_idx").on(
742
+ table.workspaceId,
743
+ table.subjectId,
744
+ ),
745
+ }),
746
+ );
747
+
748
+ export const slackInteractionInbox = pgTable(
749
+ "slack_interaction_inbox",
750
+ {
751
+ id: uuid("id").primaryKey().defaultRandom(),
752
+ accountId: uuid("account_id")
753
+ .notNull()
754
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
755
+ workspaceId: uuid("workspace_id")
756
+ .notNull()
757
+ .references(() => workspaces.id, { onDelete: "cascade" }),
758
+ connectionId: uuid("connection_id")
759
+ .notNull()
760
+ .references(() => connections.id, { onDelete: "cascade" }),
761
+ providerEventId: text("provider_event_id").notNull(),
762
+ providerMessageId: text("provider_message_id").notNull(),
763
+ slackTeamId: text("slack_team_id").notNull(),
764
+ slackUserId: text("slack_user_id").notNull(),
765
+ slackChannelId: text("slack_channel_id").notNull(),
766
+ slackMessageTs: text("slack_message_ts").notNull(),
767
+ slackThreadTs: text("slack_thread_ts"),
768
+ triggerKind: text("trigger_kind")
769
+ .$type<"app_mention" | "dm" | "slash_command" | "message_shortcut" | "thread_reply">()
770
+ .notNull(),
771
+ text: text("text").notNull(),
772
+ status: text("status")
773
+ .$type<"pending" | "processing" | "processed" | "failed">()
774
+ .notNull()
775
+ .default("pending"),
776
+ claimHolderId: uuid("claim_holder_id"),
777
+ claimExpiresAt: timestamp("claim_expires_at", { withTimezone: true }),
778
+ attemptCount: integer("attempt_count").notNull().default(0),
779
+ lastErrorCode: text("last_error_code"),
780
+ processedAt: timestamp("processed_at", { withTimezone: true }),
781
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
782
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
783
+ },
784
+ (table) => ({
785
+ providerEvent: uniqueIndex("slack_interaction_inbox_provider_event_uq").on(
786
+ table.connectionId,
787
+ table.providerEventId,
788
+ ),
789
+ providerMessage: uniqueIndex("slack_interaction_inbox_provider_message_uq").on(
790
+ table.connectionId,
791
+ table.providerMessageId,
792
+ ),
793
+ pending: index("slack_interaction_inbox_pending_idx").on(
794
+ table.status,
795
+ table.createdAt,
796
+ table.id,
797
+ ),
798
+ }),
799
+ );
800
+
801
+ export const slackInteractions = pgTable(
802
+ "slack_interactions",
803
+ {
804
+ id: uuid("id").primaryKey().defaultRandom(),
805
+ accountId: uuid("account_id")
806
+ .notNull()
807
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
808
+ workspaceId: uuid("workspace_id")
809
+ .notNull()
810
+ .references(() => workspaces.id, { onDelete: "cascade" }),
811
+ connectionId: uuid("connection_id")
812
+ .notNull()
813
+ .references(() => connections.id, { onDelete: "cascade" }),
814
+ slackTeamId: text("slack_team_id").notNull(),
815
+ slackChannelId: text("slack_channel_id").notNull(),
816
+ slackThreadTs: text("slack_thread_ts").notNull(),
817
+ routeKey: text("route_key").notNull(),
818
+ triggeringProviderEventId: text("triggering_provider_event_id").notNull(),
819
+ owningSubjectId: text("owning_subject_id").notNull(),
820
+ visibility: text("visibility").$type<"private" | "workspace">().notNull(),
821
+ sessionReservationId: uuid("session_reservation_id").notNull().defaultRandom(),
822
+ sessionId: uuid("session_id").references(() => sessions.id, {
823
+ onDelete: "cascade",
824
+ }),
825
+ lastDeliveredSessionEventSequence: integer("last_delivered_session_event_sequence")
826
+ .notNull()
827
+ .default(0),
828
+ deliveryClaimHolderId: uuid("delivery_claim_holder_id"),
829
+ deliveryClaimExpiresAt: timestamp("delivery_claim_expires_at", {
830
+ withTimezone: true,
831
+ }),
832
+ ackSlackMessageTs: text("ack_slack_message_ts"),
833
+ progressCount: integer("progress_count").notNull().default(0),
834
+ terminalDeliveryState: text("terminal_delivery_state")
835
+ .$type<"open" | "completed" | "failed" | "cancelled" | "blocked">()
836
+ .notNull()
837
+ .default("open"),
838
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
839
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
840
+ },
841
+ (table) => ({
842
+ route: uniqueIndex("slack_interactions_route_uq").on(table.connectionId, table.routeKey),
843
+ identity: uniqueIndex("slack_interactions_identity_uq").on(
844
+ table.accountId,
845
+ table.workspaceId,
846
+ table.id,
847
+ ),
848
+ workspaceReservation: uniqueIndex("slack_interactions_workspace_reservation_uq").on(
849
+ table.workspaceId,
850
+ table.sessionReservationId,
851
+ ),
852
+ workspaceSession: uniqueIndex("slack_interactions_workspace_session_uq")
853
+ .on(table.workspaceId, table.sessionId)
854
+ .where(sql`${table.sessionId} is not null`),
855
+ delivery: index("slack_interactions_delivery_idx").on(
856
+ table.terminalDeliveryState,
857
+ table.updatedAt,
858
+ table.id,
859
+ ),
860
+ }),
861
+ );
862
+
863
+ export const slackInteractionProgressDeliveries = pgTable(
864
+ "slack_interaction_progress_deliveries",
865
+ {
866
+ id: uuid("id").primaryKey().defaultRandom(),
867
+ accountId: uuid("account_id")
868
+ .notNull()
869
+ .references(() => managedAccounts.id, { onDelete: "cascade" }),
870
+ workspaceId: uuid("workspace_id")
871
+ .notNull()
872
+ .references(() => workspaces.id, { onDelete: "cascade" }),
873
+ interactionId: uuid("interaction_id").notNull(),
874
+ sessionEventSequence: integer("session_event_sequence").notNull(),
875
+ slot: integer("slot").notNull(),
876
+ operationId: uuid("operation_id").notNull(),
877
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
878
+ },
879
+ (table) => ({
880
+ interactionIdentity: foreignKey({
881
+ columns: [table.accountId, table.workspaceId, table.interactionId],
882
+ foreignColumns: [
883
+ slackInteractions.accountId,
884
+ slackInteractions.workspaceId,
885
+ slackInteractions.id,
886
+ ],
887
+ name: "slack_interaction_progress_deliveries_interaction_fk",
888
+ }).onDelete("cascade"),
889
+ event: uniqueIndex("slack_interaction_progress_deliveries_event_uq").on(
890
+ table.interactionId,
891
+ table.sessionEventSequence,
892
+ ),
893
+ slot: uniqueIndex("slack_interaction_progress_deliveries_slot_uq").on(
894
+ table.interactionId,
895
+ table.slot,
896
+ ),
897
+ operation: uniqueIndex("slack_interaction_progress_deliveries_operation_uq").on(
898
+ table.workspaceId,
899
+ table.operationId,
900
+ ),
901
+ }),
902
+ );
903
+
547
904
  // Durable provider-operation identity for OpenGeni Slack bot posts. The
548
905
  // caller-supplied operation UUID is also Slack's client_msg_id; a bounded claim
549
906
  // serializes live attempts while an expired/released claim can safely retry the
@@ -2234,10 +2591,14 @@ export const sessionGoals = pgTable(
2234
2591
  // update, timeline events, usage row, and workflow-wake outbox row.
2235
2592
  // Temporal signals and workflow history are replaceable nudges over these
2236
2593
  // monotonic revisions.
2237
- continuationWakeRevision: bigint("continuation_wake_revision", { mode: "number" })
2594
+ continuationWakeRevision: bigint("continuation_wake_revision", {
2595
+ mode: "number",
2596
+ })
2238
2597
  .notNull()
2239
2598
  .default(0),
2240
- continuationObservedRevision: bigint("continuation_observed_revision", { mode: "number" })
2599
+ continuationObservedRevision: bigint("continuation_observed_revision", {
2600
+ mode: "number",
2601
+ })
2241
2602
  .notNull()
2242
2603
  .default(0),
2243
2604
  metadata: jsonb("metadata").$type<Record<string, unknown>>().notNull().default({}),
@@ -2911,8 +3272,12 @@ export const sandboxLeases = pgTable(
2911
3272
  lastMeterTick: integer("last_meter_tick").notNull().default(0),
2912
3273
 
2913
3274
  providerCreatedAt: timestamp("provider_created_at", { withTimezone: true }),
2914
- providerDeadlineAt: timestamp("provider_deadline_at", { withTimezone: true }),
2915
- rotationRequestedAt: timestamp("rotation_requested_at", { withTimezone: true }),
3275
+ providerDeadlineAt: timestamp("provider_deadline_at", {
3276
+ withTimezone: true,
3277
+ }),
3278
+ rotationRequestedAt: timestamp("rotation_requested_at", {
3279
+ withTimezone: true,
3280
+ }),
2916
3281
  rotationReason: text("rotation_reason", {
2917
3282
  enum: ["provider_deadline", "operator"],
2918
3283
  }),
@@ -3017,7 +3382,9 @@ export const sandboxLeaseHolders = pgTable(
3017
3382
  leaseId: uuid("lease_id")
3018
3383
  .notNull()
3019
3384
  .references(() => sandboxLeases.id, { onDelete: "cascade" }),
3020
- kind: text("kind", { enum: ["turn", "viewer", "direct", "process"] }).notNull(),
3385
+ kind: text("kind", {
3386
+ enum: ["turn", "viewer", "direct", "process"],
3387
+ }).notNull(),
3021
3388
  holderId: text("holder_id").notNull(),
3022
3389
  // The attributing session within the (possibly shared) group.
3023
3390
  subjectId: uuid("subject_id"),
@@ -3062,7 +3429,9 @@ export const sandboxWorkspaceMutationAdmissions = pgTable(
3062
3429
  .references(() => sandboxLeases.id, { onDelete: "cascade" }),
3063
3430
  sandboxGroupId: uuid("sandbox_group_id").notNull(),
3064
3431
  sessionId: uuid("session_id").notNull(),
3065
- actorKind: text("actor_kind", { enum: sandboxWorkspaceMutationActorKindValues }).notNull(),
3432
+ actorKind: text("actor_kind", {
3433
+ enum: sandboxWorkspaceMutationActorKindValues,
3434
+ }).notNull(),
3066
3435
  actorId: uuid("actor_id").notNull(),
3067
3436
  // Exact turn authority is present only for actor_kind='turn'. Direct HTTP
3068
3437
  // requests and retained processes never invent a turn or quiescence owner.
@@ -3209,7 +3578,9 @@ export const sandboxRetainedProcesses = pgTable(
3209
3578
  sandboxGroupId: uuid("sandbox_group_id").notNull(),
3210
3579
  parentAdmissionId: uuid("parent_admission_id").notNull(),
3211
3580
  holderId: text("holder_id").notNull(),
3212
- ownerActorKind: text("owner_actor_kind", { enum: ["turn", "direct"] }).notNull(),
3581
+ ownerActorKind: text("owner_actor_kind", {
3582
+ enum: ["turn", "direct"],
3583
+ }).notNull(),
3213
3584
  ownerActorId: uuid("owner_actor_id").notNull(),
3214
3585
  ownerTurnId: uuid("owner_turn_id"),
3215
3586
  ownerAttemptId: uuid("owner_attempt_id"),
@@ -3237,13 +3608,19 @@ export const sandboxRetainedProcesses = pgTable(
3237
3608
  // never exit/loss proof.
3238
3609
  reconcileAfter: timestamp("reconcile_after", { withTimezone: true }).notNull().defaultNow(),
3239
3610
  reconcileClaimId: uuid("reconcile_claim_id"),
3240
- reconcileClaimedAt: timestamp("reconcile_claimed_at", { withTimezone: true }),
3611
+ reconcileClaimedAt: timestamp("reconcile_claimed_at", {
3612
+ withTimezone: true,
3613
+ }),
3241
3614
  reconcileAttempts: integer("reconcile_attempts").notNull().default(0),
3242
3615
  lastReconcileOutcome: text("last_reconcile_outcome"),
3243
- reconcileProofOutcome: text("reconcile_proof_outcome", { enum: ["exited", "lost"] }),
3616
+ reconcileProofOutcome: text("reconcile_proof_outcome", {
3617
+ enum: ["exited", "lost"],
3618
+ }),
3244
3619
  reconcileProofExitCode: integer("reconcile_proof_exit_code"),
3245
3620
  reconcileProofReason: text("reconcile_proof_reason"),
3246
- reconcileProofObservedAt: timestamp("reconcile_proof_observed_at", { withTimezone: true }),
3621
+ reconcileProofObservedAt: timestamp("reconcile_proof_observed_at", {
3622
+ withTimezone: true,
3623
+ }),
3247
3624
  },
3248
3625
  (table) => ({
3249
3626
  workspaceAccount: foreignKey({
@@ -3995,8 +4372,12 @@ export const githubInstallations = pgTable(
3995
4372
  githubActorId: bigint("github_actor_id", { mode: "number" }),
3996
4373
  githubActorLogin: text("github_actor_login"),
3997
4374
  authorityKind: text("authority_kind"),
3998
- authorityCheckedAt: timestamp("authority_checked_at", { withTimezone: true }),
3999
- authorityExpiresAt: timestamp("authority_expires_at", { withTimezone: true }),
4375
+ authorityCheckedAt: timestamp("authority_checked_at", {
4376
+ withTimezone: true,
4377
+ }),
4378
+ authorityExpiresAt: timestamp("authority_expires_at", {
4379
+ withTimezone: true,
4380
+ }),
4000
4381
  authorityNonce: text("authority_nonce"),
4001
4382
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
4002
4383
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
@@ -4326,7 +4707,9 @@ export const hostExportOutbox = pgTable(
4326
4707
  payload: jsonb("payload").$type<unknown>().notNull(),
4327
4708
  envelopeBytes: integer("envelope_bytes").notNull(),
4328
4709
  occurredAt: timestamp("occurred_at", { withTimezone: true }).notNull(),
4329
- sourceRecordedAt: timestamp("source_recorded_at", { withTimezone: true }).notNull(),
4710
+ sourceRecordedAt: timestamp("source_recorded_at", {
4711
+ withTimezone: true,
4712
+ }).notNull(),
4330
4713
  enqueuedAt: timestamp("enqueued_at", { withTimezone: true }).notNull(),
4331
4714
  },
4332
4715
  (table) => ({