@treeseed/sdk 0.10.11 → 0.10.13

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 (52) hide show
  1. package/README.md +2 -2
  2. package/dist/api/auth/d1-store.js +20 -1
  3. package/dist/capacity-provider.d.ts +53 -1
  4. package/dist/capacity.d.ts +80 -1
  5. package/dist/capacity.js +687 -8
  6. package/dist/db/d1.d.ts +109 -3227
  7. package/dist/db/index.d.ts +1 -0
  8. package/dist/db/index.js +1 -0
  9. package/dist/db/market-schema.d.ts +43769 -0
  10. package/dist/db/market-schema.js +1878 -0
  11. package/dist/db/node-sqlite.d.ts +109 -3227
  12. package/dist/db/schema.d.ts +226 -5757
  13. package/dist/db/schema.js +35 -226
  14. package/dist/index.d.ts +6 -4
  15. package/dist/index.js +32 -0
  16. package/dist/market-client.d.ts +135 -0
  17. package/dist/market-client.js +134 -1
  18. package/dist/operations/services/commit-message-provider.js +1 -1
  19. package/dist/operations/services/d1-migration.js +0 -59
  20. package/dist/operations/services/deploy.js +5 -1
  21. package/dist/operations/services/github-api.d.ts +83 -0
  22. package/dist/operations/services/github-api.js +167 -0
  23. package/dist/operations/services/local-dev.js +3 -3
  24. package/dist/operations/services/mailpit-runtime.d.ts +13 -2
  25. package/dist/operations/services/mailpit-runtime.js +19 -14
  26. package/dist/operations/services/project-web-monitor.d.ts +15 -0
  27. package/dist/operations/services/project-web-monitor.js +260 -0
  28. package/dist/operations/services/railway-api.js +2 -2
  29. package/dist/operations/services/release-candidate.js +9 -9
  30. package/dist/operations/services/runtime-paths.d.ts +1 -1
  31. package/dist/operations/services/runtime-paths.js +2 -2
  32. package/dist/operations/services/template-registry.js +10 -1
  33. package/dist/operations.d.ts +1 -0
  34. package/dist/operations.js +11 -1
  35. package/dist/platform-operation-store.d.ts +4 -0
  36. package/dist/platform-operation-store.js +29 -3
  37. package/dist/platform-operations.d.ts +8 -0
  38. package/dist/platform-operations.js +19 -0
  39. package/dist/remote.js +6 -6
  40. package/dist/scripts/tenant-d1-migrate-local.js +2 -3
  41. package/dist/scripts/test-cloudflare-local.js +1 -1
  42. package/dist/scripts/workspace-command-e2e.js +3 -1
  43. package/dist/sdk-types.d.ts +281 -3
  44. package/dist/sdk-types.js +5 -1
  45. package/dist/seeds/normalize.js +6 -0
  46. package/dist/seeds/schema.js +61 -1
  47. package/dist/seeds/types.d.ts +32 -0
  48. package/drizzle/d1/0000_treeseed_d1.sql +37 -0
  49. package/drizzle/market/0000_market_control_plane.sql +2929 -0
  50. package/drizzle/market/0001_capacity_budget_mode_default.sql +4 -0
  51. package/drizzle/market/0002_user_email_addresses.sql +26 -0
  52. package/package.json +8 -1
@@ -0,0 +1,1878 @@
1
+ import { bigint, index, integer, pgTable, primaryKey, real, serial, text, uniqueIndex } from "drizzle-orm/pg-core";
2
+ const subscribers = pgTable("subscribers", {
3
+ email: text("email").primaryKey(),
4
+ createdAt: text("created_at").notNull()
5
+ });
6
+ const agentRuns = pgTable("agent_runs", {
7
+ runId: text("run_id").primaryKey(),
8
+ agentSlug: text("agent_slug").notNull(),
9
+ status: text("status").notNull(),
10
+ createdAt: text("created_at").notNull()
11
+ });
12
+ const agentMessages = pgTable("agent_messages", {
13
+ id: serial("id").primaryKey(),
14
+ typeColumn: text("type").notNull(),
15
+ payloadJson: text("payload_json").notNull(),
16
+ createdAt: text("created_at").notNull()
17
+ });
18
+ const contactSubmissions = pgTable("contact_submissions", {
19
+ id: serial("id").primaryKey(),
20
+ email: text("email").notNull(),
21
+ message: text("message").notNull(),
22
+ createdAt: text("created_at").notNull()
23
+ });
24
+ const runtimeEnvelopes = pgTable("runtime_envelopes", {
25
+ id: serial("id").primaryKey(),
26
+ recordType: text("record_type").notNull(),
27
+ payloadJson: text("payload_json").notNull(),
28
+ createdAt: text("created_at").notNull()
29
+ });
30
+ const workDays = pgTable("work_days", {
31
+ id: text("id").primaryKey(),
32
+ projectId: text("project_id").notNull(),
33
+ state: text("state").notNull(),
34
+ capacityBudget: integer("capacity_budget").notNull().default(0),
35
+ capacityUsed: integer("capacity_used").notNull().default(0),
36
+ graphVersion: text("graph_version"),
37
+ summaryJson: text("summary_json"),
38
+ startedAt: text("started_at").notNull(),
39
+ endedAt: text("ended_at"),
40
+ createdAt: text("created_at").notNull(),
41
+ updatedAt: text("updated_at").notNull()
42
+ });
43
+ const tasks = pgTable("tasks", {
44
+ id: text("id").primaryKey(),
45
+ workDayId: text("work_day_id").notNull(),
46
+ agentId: text("agent_id").notNull(),
47
+ typeColumn: text("type").notNull(),
48
+ state: text("state").notNull(),
49
+ priority: integer("priority").notNull().default(0),
50
+ idempotencyKey: text("idempotency_key").notNull().unique(),
51
+ payloadJson: text("payload_json").notNull(),
52
+ payloadHash: text("payload_hash"),
53
+ attemptCount: integer("attempt_count").notNull().default(0),
54
+ maxAttempts: integer("max_attempts").notNull().default(3),
55
+ claimedBy: text("claimed_by"),
56
+ leaseExpiresAt: text("lease_expires_at"),
57
+ availableAt: text("available_at").notNull(),
58
+ lastErrorCode: text("last_error_code"),
59
+ lastErrorMessage: text("last_error_message"),
60
+ graphVersion: text("graph_version"),
61
+ parentTaskId: text("parent_task_id"),
62
+ createdAt: text("created_at").notNull(),
63
+ startedAt: text("started_at"),
64
+ completedAt: text("completed_at"),
65
+ updatedAt: text("updated_at").notNull()
66
+ }, (table) => [
67
+ index("idx_tasks_runnable").on(table.state, table.priority, table.availableAt),
68
+ index("idx_tasks_work_day_agent").on(table.workDayId, table.agentId, table.createdAt)
69
+ ]);
70
+ const taskEvents = pgTable("task_events", {
71
+ id: text("id").primaryKey(),
72
+ taskId: text("task_id").notNull(),
73
+ seq: integer("seq").notNull(),
74
+ kind: text("kind").notNull(),
75
+ dataJson: text("data_json").notNull(),
76
+ createdAt: text("created_at").notNull()
77
+ }, (table) => [
78
+ uniqueIndex("idx_task_events_seq").on(table.taskId, table.seq)
79
+ ]);
80
+ const taskOutputs = pgTable("task_outputs", {
81
+ id: text("id").primaryKey(),
82
+ taskId: text("task_id").notNull(),
83
+ outputJson: text("output_json").notNull(),
84
+ outputRef: text("output_ref"),
85
+ createdAt: text("created_at").notNull()
86
+ });
87
+ const graphRuns = pgTable("graph_runs", {
88
+ id: text("id").primaryKey(),
89
+ workDayId: text("work_day_id").notNull(),
90
+ corpusHash: text("corpus_hash").notNull(),
91
+ graphVersion: text("graph_version").notNull(),
92
+ queryJson: text("query_json"),
93
+ seedIdsJson: text("seed_ids_json"),
94
+ selectedNodeIdsJson: text("selected_node_ids_json"),
95
+ statsJson: text("stats_json"),
96
+ snapshotRef: text("snapshot_ref"),
97
+ createdAt: text("created_at").notNull()
98
+ });
99
+ const reports = pgTable("reports", {
100
+ id: text("id").primaryKey(),
101
+ workDayId: text("work_day_id").notNull(),
102
+ kind: text("kind").notNull(),
103
+ bodyJson: text("body_json").notNull(),
104
+ renderedRef: text("rendered_ref"),
105
+ sentAt: text("sent_at"),
106
+ createdAt: text("created_at").notNull()
107
+ });
108
+ const users = pgTable("users", {
109
+ id: text("id").primaryKey(),
110
+ email: text("email"),
111
+ displayName: text("display_name"),
112
+ status: text("status").notNull().default("active"),
113
+ metadataJson: text("metadata_json"),
114
+ createdAt: text("created_at").notNull(),
115
+ updatedAt: text("updated_at").notNull(),
116
+ username: text("username")
117
+ }, (table) => [
118
+ uniqueIndex("idx_users_username").on(table.username)
119
+ ]);
120
+ const userIdentities = pgTable("user_identities", {
121
+ id: text("id").primaryKey(),
122
+ userId: text("user_id").notNull(),
123
+ provider: text("provider").notNull(),
124
+ providerSubject: text("provider_subject").notNull(),
125
+ email: text("email"),
126
+ emailVerified: integer("email_verified").notNull().default(0),
127
+ profileJson: text("profile_json"),
128
+ createdAt: text("created_at").notNull(),
129
+ updatedAt: text("updated_at").notNull()
130
+ }, (table) => [
131
+ uniqueIndex("idx_user_identities_provider_subject").on(table.provider, table.providerSubject)
132
+ ]);
133
+ const userEmailAddresses = pgTable("user_email_addresses", {
134
+ id: text("id").primaryKey(),
135
+ userId: text("user_id").notNull(),
136
+ email: text("email").notNull(),
137
+ normalizedEmail: text("normalized_email").notNull().unique(),
138
+ status: text("status").notNull().default("pending"),
139
+ isPrimary: integer("is_primary").notNull().default(0),
140
+ verificationRequestedAt: text("verification_requested_at"),
141
+ verifiedAt: text("verified_at"),
142
+ createdAt: text("created_at").notNull(),
143
+ updatedAt: text("updated_at").notNull()
144
+ }, (table) => [
145
+ index("idx_user_email_addresses_user").on(table.userId, table.status, table.isPrimary),
146
+ uniqueIndex("idx_user_email_addresses_normalized").on(table.normalizedEmail)
147
+ ]);
148
+ const roles = pgTable("roles", {
149
+ id: text("id").primaryKey(),
150
+ keyColumn: text("key").notNull().unique(),
151
+ description: text("description"),
152
+ createdAt: text("created_at").notNull()
153
+ });
154
+ const permissions = pgTable("permissions", {
155
+ id: text("id").primaryKey(),
156
+ keyColumn: text("key").notNull().unique(),
157
+ resource: text("resource").notNull(),
158
+ action: text("action").notNull(),
159
+ scope: text("scope").notNull(),
160
+ description: text("description"),
161
+ createdAt: text("created_at").notNull()
162
+ });
163
+ const rolePermissions = pgTable("role_permissions", {
164
+ roleId: text("role_id"),
165
+ permissionId: text("permission_id"),
166
+ createdAt: text("created_at").notNull()
167
+ }, (table) => [
168
+ primaryKey({ columns: [table.roleId, table.permissionId] })
169
+ ]);
170
+ const userRoleBindings = pgTable("user_role_bindings", {
171
+ id: text("id").primaryKey(),
172
+ userId: text("user_id").notNull(),
173
+ roleId: text("role_id").notNull(),
174
+ createdAt: text("created_at").notNull()
175
+ }, (table) => [
176
+ uniqueIndex("idx_user_role_bindings_user_role").on(table.userId, table.roleId)
177
+ ]);
178
+ const apiTokens = pgTable("api_tokens", {
179
+ id: text("id").primaryKey(),
180
+ userId: text("user_id").notNull(),
181
+ kind: text("kind").notNull(),
182
+ name: text("name").notNull(),
183
+ tokenPrefix: text("token_prefix").notNull(),
184
+ tokenHash: text("token_hash").notNull(),
185
+ scopesJson: text("scopes_json").notNull(),
186
+ expiresAt: text("expires_at"),
187
+ lastUsedAt: text("last_used_at"),
188
+ revokedAt: text("revoked_at"),
189
+ metadataJson: text("metadata_json"),
190
+ createdAt: text("created_at").notNull(),
191
+ updatedAt: text("updated_at").notNull()
192
+ }, (table) => [
193
+ index("idx_api_tokens_user_id").on(table.userId),
194
+ index("idx_api_tokens_prefix").on(table.tokenPrefix)
195
+ ]);
196
+ const serviceCredentials = pgTable("service_credentials", {
197
+ id: text("id").primaryKey(),
198
+ serviceId: text("service_id").notNull().unique(),
199
+ name: text("name").notNull(),
200
+ secretHash: text("secret_hash").notNull(),
201
+ rolesJson: text("roles_json").notNull(),
202
+ permissionsJson: text("permissions_json").notNull(),
203
+ revokedAt: text("revoked_at"),
204
+ createdAt: text("created_at").notNull(),
205
+ updatedAt: text("updated_at").notNull(),
206
+ lastUsedAt: text("last_used_at")
207
+ });
208
+ const authSessions = pgTable("auth_sessions", {
209
+ id: text("id").primaryKey(),
210
+ userId: text("user_id").notNull(),
211
+ sessionType: text("session_type").notNull(),
212
+ refreshTokenHash: text("refresh_token_hash").notNull(),
213
+ scopesJson: text("scopes_json").notNull(),
214
+ expiresAt: text("expires_at").notNull(),
215
+ revokedAt: text("revoked_at"),
216
+ dataJson: text("data_json"),
217
+ createdAt: text("created_at").notNull(),
218
+ updatedAt: text("updated_at").notNull()
219
+ }, (table) => [
220
+ index("idx_auth_sessions_user_id").on(table.userId)
221
+ ]);
222
+ const auditEvents = pgTable("audit_events", {
223
+ id: text("id").primaryKey(),
224
+ actorType: text("actor_type").notNull(),
225
+ actorId: text("actor_id"),
226
+ eventType: text("event_type").notNull(),
227
+ targetType: text("target_type"),
228
+ targetId: text("target_id"),
229
+ dataJson: text("data_json"),
230
+ createdAt: text("created_at").notNull()
231
+ }, (table) => [
232
+ index("idx_audit_events_target").on(table.targetType, table.targetId)
233
+ ]);
234
+ const deviceCodes = pgTable("device_codes", {
235
+ id: text("id").primaryKey(),
236
+ deviceCode: text("device_code").notNull().unique(),
237
+ userCode: text("user_code").notNull().unique(),
238
+ requestedScopesJson: text("requested_scopes_json").notNull(),
239
+ expiresAt: text("expires_at").notNull(),
240
+ intervalSeconds: integer("interval_seconds").notNull(),
241
+ status: text("status").notNull(),
242
+ userId: text("user_id"),
243
+ createdAt: text("created_at").notNull(),
244
+ updatedAt: text("updated_at").notNull()
245
+ });
246
+ const teams = pgTable("teams", {
247
+ id: text("id").primaryKey(),
248
+ slug: text("slug").notNull().unique(),
249
+ name: text("name").notNull(),
250
+ metadataJson: text("metadata_json"),
251
+ createdAt: text("created_at").notNull(),
252
+ updatedAt: text("updated_at").notNull(),
253
+ displayName: text("display_name"),
254
+ logoUrl: text("logo_url"),
255
+ profileSummary: text("profile_summary")
256
+ }, (table) => [
257
+ uniqueIndex("idx_teams_name").on(table.name)
258
+ ]);
259
+ const teamMemberships = pgTable("team_memberships", {
260
+ id: text("id").primaryKey(),
261
+ teamId: text("team_id").notNull(),
262
+ userId: text("user_id").notNull(),
263
+ status: text("status").notNull().default("active"),
264
+ createdAt: text("created_at").notNull(),
265
+ updatedAt: text("updated_at").notNull()
266
+ }, (table) => [
267
+ uniqueIndex("idx_team_memberships_team_user").on(table.teamId, table.userId)
268
+ ]);
269
+ const teamRoleBindings = pgTable("team_role_bindings", {
270
+ id: text("id").primaryKey(),
271
+ teamMembershipId: text("team_membership_id").notNull(),
272
+ roleId: text("role_id").notNull(),
273
+ createdAt: text("created_at").notNull()
274
+ });
275
+ const webSessions = pgTable("web_sessions", {
276
+ id: text("id").primaryKey(),
277
+ userId: text("user_id").notNull(),
278
+ identityId: text("identity_id"),
279
+ betterAuthSessionId: text("better_auth_session_id"),
280
+ provider: text("provider").notNull(),
281
+ providerSubject: text("provider_subject").notNull(),
282
+ email: text("email"),
283
+ displayName: text("display_name"),
284
+ principalJson: text("principal_json").notNull(),
285
+ csrfToken: text("csrf_token").notNull(),
286
+ ipAddress: text("ip_address"),
287
+ userAgent: text("user_agent"),
288
+ authenticatedAt: text("authenticated_at").notNull(),
289
+ lastSeenAt: text("last_seen_at"),
290
+ expiresAt: text("expires_at").notNull(),
291
+ revokedAt: text("revoked_at"),
292
+ createdAt: text("created_at").notNull(),
293
+ updatedAt: text("updated_at").notNull()
294
+ }, (table) => [
295
+ index("idx_web_sessions_user_id").on(table.userId)
296
+ ]);
297
+ const projects = pgTable("projects", {
298
+ id: text("id").primaryKey(),
299
+ teamId: text("team_id").notNull(),
300
+ slug: text("slug").notNull().unique(),
301
+ name: text("name").notNull(),
302
+ description: text("description"),
303
+ metadataJson: text("metadata_json"),
304
+ createdAt: text("created_at").notNull(),
305
+ updatedAt: text("updated_at").notNull()
306
+ }, (table) => [
307
+ index("idx_projects_team_id").on(table.teamId)
308
+ ]);
309
+ const projectConnections = pgTable("project_connections", {
310
+ id: text("id").primaryKey(),
311
+ projectId: text("project_id").notNull().unique(),
312
+ mode: text("mode").notNull(),
313
+ projectApiBaseUrl: text("project_api_base_url"),
314
+ executionOwner: text("execution_owner").notNull(),
315
+ runnerRegistrationState: text("runner_registration_state").notNull().default("pending"),
316
+ runnerKeyPrefix: text("runner_key_prefix"),
317
+ runnerKeyHash: text("runner_key_hash"),
318
+ runnerRegisteredAt: text("runner_registered_at"),
319
+ runnerLastSeenAt: text("runner_last_seen_at"),
320
+ metadataJson: text("metadata_json"),
321
+ createdAt: text("created_at").notNull(),
322
+ updatedAt: text("updated_at").notNull()
323
+ });
324
+ const projectCapabilityGrants = pgTable("project_capability_grants", {
325
+ id: text("id").primaryKey(),
326
+ projectId: text("project_id").notNull(),
327
+ label: text("label"),
328
+ namespace: text("namespace").notNull(),
329
+ operation: text("operation").notNull(),
330
+ executionClass: text("execution_class").notNull(),
331
+ allowedTargetsJson: text("allowed_targets_json").notNull(),
332
+ defaultDispatchMode: text("default_dispatch_mode").notNull(),
333
+ approvalPolicyJson: text("approval_policy_json").notNull().default("{}"),
334
+ resourceScopeJson: text("resource_scope_json").notNull().default("{}"),
335
+ metadataJson: text("metadata_json").notNull().default("{}"),
336
+ enabled: integer("enabled").notNull().default(1),
337
+ createdAt: text("created_at").notNull(),
338
+ updatedAt: text("updated_at").notNull()
339
+ }, (table) => [
340
+ uniqueIndex("idx_project_capability_grants_project_operation").on(table.projectId, table.namespace, table.operation)
341
+ ]);
342
+ const teamApiKeys = pgTable("team_api_keys", {
343
+ id: text("id").primaryKey(),
344
+ teamId: text("team_id").notNull(),
345
+ name: text("name").notNull(),
346
+ keyPrefix: text("key_prefix").notNull(),
347
+ keyHash: text("key_hash").notNull(),
348
+ permissionsJson: text("permissions_json").notNull(),
349
+ expiresAt: text("expires_at"),
350
+ lastUsedAt: text("last_used_at"),
351
+ revokedAt: text("revoked_at"),
352
+ createdAt: text("created_at").notNull(),
353
+ updatedAt: text("updated_at").notNull()
354
+ }, (table) => [
355
+ index("idx_team_api_keys_prefix").on(table.keyPrefix)
356
+ ]);
357
+ const entitlements = pgTable("entitlements", {
358
+ id: text("id").primaryKey(),
359
+ teamId: text("team_id"),
360
+ projectId: text("project_id"),
361
+ tier: text("tier").notNull(),
362
+ status: text("status").notNull(),
363
+ metadataJson: text("metadata_json"),
364
+ createdAt: text("created_at").notNull(),
365
+ updatedAt: text("updated_at").notNull()
366
+ }, (table) => [
367
+ uniqueIndex("idx_entitlements_project").on(table.projectId)
368
+ ]);
369
+ const remoteJobs = pgTable("remote_jobs", {
370
+ id: text("id").primaryKey(),
371
+ projectId: text("project_id").notNull(),
372
+ namespace: text("namespace").notNull(),
373
+ operation: text("operation").notNull(),
374
+ status: text("status").notNull(),
375
+ preferredMode: text("preferred_mode").notNull(),
376
+ selectedTarget: text("selected_target").notNull(),
377
+ capabilityJson: text("capability_json").notNull(),
378
+ inputJson: text("input_json").notNull(),
379
+ outputJson: text("output_json"),
380
+ errorJson: text("error_json"),
381
+ requestedByType: text("requested_by_type").notNull(),
382
+ requestedById: text("requested_by_id"),
383
+ assignedRunnerId: text("assigned_runner_id"),
384
+ idempotencyKey: text("idempotency_key"),
385
+ createdAt: text("created_at").notNull(),
386
+ updatedAt: text("updated_at").notNull(),
387
+ startedAt: text("started_at"),
388
+ finishedAt: text("finished_at"),
389
+ cancelledAt: text("cancelled_at")
390
+ }, (table) => [
391
+ index("idx_remote_jobs_project_status").on(table.projectId, table.status, table.createdAt),
392
+ index("idx_remote_jobs_project_idempotency").on(table.projectId, table.idempotencyKey)
393
+ ]);
394
+ const remoteJobEvents = pgTable("remote_job_events", {
395
+ id: text("id").primaryKey(),
396
+ jobId: text("job_id").notNull(),
397
+ seq: integer("seq").notNull(),
398
+ kind: text("kind").notNull(),
399
+ dataJson: text("data_json"),
400
+ createdAt: text("created_at").notNull()
401
+ }, (table) => [
402
+ uniqueIndex("idx_remote_job_events_job_seq").on(table.jobId, table.seq)
403
+ ]);
404
+ const knowledgePacks = pgTable("knowledge_packs", {
405
+ id: text("id").primaryKey(),
406
+ teamId: text("team_id").notNull(),
407
+ slug: text("slug").notNull().unique(),
408
+ name: text("name").notNull(),
409
+ summary: text("summary"),
410
+ sourceKind: text("source_kind").notNull(),
411
+ sourceRef: text("source_ref"),
412
+ installStrategy: text("install_strategy").notNull(),
413
+ visibility: text("visibility").notNull(),
414
+ metadataJson: text("metadata_json"),
415
+ createdAt: text("created_at").notNull(),
416
+ updatedAt: text("updated_at").notNull()
417
+ }, (table) => [
418
+ index("idx_knowledge_packs_team_id").on(table.teamId)
419
+ ]);
420
+ const teamStorageLocators = pgTable("team_storage_locators", {
421
+ id: text("id").primaryKey(),
422
+ teamId: text("team_id").notNull().unique(),
423
+ bucketName: text("bucket_name").notNull(),
424
+ manifestKeyTemplate: text("manifest_key_template").notNull(),
425
+ previewRootTemplate: text("preview_root_template").notNull(),
426
+ publicBaseUrl: text("public_base_url"),
427
+ metadataJson: text("metadata_json"),
428
+ createdAt: text("created_at").notNull(),
429
+ updatedAt: text("updated_at").notNull()
430
+ });
431
+ const catalogItems = pgTable("catalog_items", {
432
+ id: text("id").primaryKey(),
433
+ teamId: text("team_id").notNull(),
434
+ kind: text("kind").notNull(),
435
+ slug: text("slug").notNull(),
436
+ title: text("title").notNull(),
437
+ summary: text("summary"),
438
+ visibility: text("visibility").notNull(),
439
+ listingEnabled: integer("listing_enabled").notNull().default(0),
440
+ offerMode: text("offer_mode").notNull(),
441
+ manifestKey: text("manifest_key"),
442
+ artifactKey: text("artifact_key"),
443
+ searchText: text("search_text"),
444
+ metadataJson: text("metadata_json"),
445
+ createdAt: text("created_at").notNull(),
446
+ updatedAt: text("updated_at").notNull()
447
+ }, (table) => [
448
+ uniqueIndex("idx_catalog_items_kind_slug").on(table.kind, table.slug),
449
+ index("idx_catalog_items_team_kind").on(table.teamId, table.kind, table.updatedAt),
450
+ index("idx_catalog_items_visibility_listing").on(table.visibility, table.listingEnabled, table.updatedAt)
451
+ ]);
452
+ const catalogArtifactVersions = pgTable("catalog_artifact_versions", {
453
+ id: text("id").primaryKey(),
454
+ itemId: text("item_id").notNull(),
455
+ teamId: text("team_id").notNull(),
456
+ kind: text("kind").notNull(),
457
+ version: text("version").notNull(),
458
+ contentKey: text("content_key").notNull(),
459
+ manifestKey: text("manifest_key"),
460
+ metadataJson: text("metadata_json"),
461
+ publishedAt: text("published_at").notNull(),
462
+ createdAt: text("created_at").notNull(),
463
+ updatedAt: text("updated_at").notNull()
464
+ }, (table) => [
465
+ uniqueIndex("idx_catalog_artifact_versions_item_version").on(table.itemId, table.version),
466
+ index("idx_catalog_artifact_versions_team_kind").on(table.teamId, table.kind, table.publishedAt)
467
+ ]);
468
+ const catalogItemCollaborators = pgTable("catalog_item_collaborators", {
469
+ id: text("id").primaryKey(),
470
+ itemId: text("item_id").notNull(),
471
+ subjectType: text("subject_type").notNull(),
472
+ subjectId: text("subject_id").notNull(),
473
+ role: text("role").notNull(),
474
+ metadataJson: text("metadata_json"),
475
+ createdAt: text("created_at").notNull(),
476
+ updatedAt: text("updated_at").notNull()
477
+ }, (table) => [
478
+ uniqueIndex("idx_catalog_item_collaborators_subject_role").on(table.itemId, table.subjectType, table.subjectId, table.role)
479
+ ]);
480
+ const projectHosting = pgTable("project_hosting", {
481
+ id: text("id").primaryKey(),
482
+ projectId: text("project_id").notNull().unique(),
483
+ hostingKind: text("hosting_kind").notNull(),
484
+ registration: text("registration").notNull().default("none"),
485
+ marketBaseUrl: text("market_base_url"),
486
+ sourceRepoOwner: text("source_repo_owner"),
487
+ sourceRepoName: text("source_repo_name"),
488
+ sourceRepoUrl: text("source_repo_url"),
489
+ sourceRepoWorkflowPath: text("source_repo_workflow_path"),
490
+ metadataJson: text("metadata_json"),
491
+ createdAt: text("created_at").notNull(),
492
+ updatedAt: text("updated_at").notNull()
493
+ });
494
+ const projectEnvironments = pgTable("project_environments", {
495
+ id: text("id").primaryKey(),
496
+ projectId: text("project_id").notNull(),
497
+ environment: text("environment").notNull(),
498
+ deploymentProfile: text("deployment_profile").notNull(),
499
+ baseUrl: text("base_url"),
500
+ cloudflareAccountId: text("cloudflare_account_id"),
501
+ pagesProjectName: text("pages_project_name"),
502
+ workerName: text("worker_name"),
503
+ r2BucketName: text("r2_bucket_name"),
504
+ d1DatabaseName: text("d1_database_name"),
505
+ queueName: text("queue_name"),
506
+ railwayProjectName: text("railway_project_name"),
507
+ metadataJson: text("metadata_json"),
508
+ createdAt: text("created_at").notNull(),
509
+ updatedAt: text("updated_at").notNull()
510
+ }, (table) => [
511
+ uniqueIndex("idx_project_environments_project_environment").on(table.projectId, table.environment)
512
+ ]);
513
+ const projectInfrastructureResources = pgTable("project_infrastructure_resources", {
514
+ id: text("id").primaryKey(),
515
+ projectId: text("project_id").notNull(),
516
+ environment: text("environment").notNull(),
517
+ provider: text("provider").notNull(),
518
+ resourceKind: text("resource_kind").notNull(),
519
+ logicalName: text("logical_name").notNull(),
520
+ locator: text("locator"),
521
+ metadataJson: text("metadata_json"),
522
+ createdAt: text("created_at").notNull(),
523
+ updatedAt: text("updated_at").notNull()
524
+ }, (table) => [
525
+ uniqueIndex("idx_project_infrastructure_resource_unique").on(table.projectId, table.environment, table.provider, table.resourceKind, table.logicalName)
526
+ ]);
527
+ const projectDeployments = pgTable("project_deployments", {
528
+ id: text("id").primaryKey(),
529
+ teamId: text("team_id").notNull(),
530
+ projectId: text("project_id").notNull(),
531
+ environment: text("environment").notNull(),
532
+ deploymentKind: text("deployment_kind").notNull(),
533
+ action: text("action").notNull().default("deploy_web"),
534
+ status: text("status").notNull(),
535
+ platformOperationId: text("platform_operation_id"),
536
+ retryOfDeploymentId: text("retry_of_deployment_id"),
537
+ resumedFromDeploymentId: text("resumed_from_deployment_id"),
538
+ idempotencyKey: text("idempotency_key"),
539
+ requestedByUserId: text("requested_by_user_id"),
540
+ sourceRef: text("source_ref"),
541
+ releaseTag: text("release_tag"),
542
+ commitSha: text("commit_sha"),
543
+ triggeredByType: text("triggered_by_type"),
544
+ triggeredById: text("triggered_by_id"),
545
+ repositoryJson: text("repository_json").notNull().default("{}"),
546
+ externalWorkflowJson: text("external_workflow_json").notNull().default("{}"),
547
+ targetJson: text("target_json").notNull().default("{}"),
548
+ monitorJson: text("monitor_json").notNull().default("{}"),
549
+ summary: text("summary"),
550
+ errorJson: text("error_json").notNull().default("{}"),
551
+ metadataJson: text("metadata_json"),
552
+ startedAt: text("started_at"),
553
+ finishedAt: text("finished_at"),
554
+ createdAt: text("created_at").notNull(),
555
+ updatedAt: text("updated_at").notNull(),
556
+ completedAt: text("completed_at")
557
+ }, (table) => [
558
+ index("idx_project_deployments_project_created").on(table.projectId, table.createdAt),
559
+ index("idx_project_deployments_project_environment").on(table.projectId, table.environment, table.createdAt),
560
+ index("idx_project_deployments_project_status").on(table.projectId, table.status, table.updatedAt),
561
+ index("idx_project_deployments_operation").on(table.platformOperationId),
562
+ index("idx_project_deployments_team_created").on(table.teamId, table.createdAt),
563
+ uniqueIndex("idx_project_deployments_idempotency").on(table.projectId, table.idempotencyKey)
564
+ ]);
565
+ const projectDeploymentEvents = pgTable("project_deployment_events", {
566
+ id: text("id").primaryKey(),
567
+ deploymentId: text("deployment_id").notNull(),
568
+ projectId: text("project_id").notNull(),
569
+ teamId: text("team_id").notNull(),
570
+ operationId: text("operation_id"),
571
+ kind: text("kind").notNull(),
572
+ message: text("message").notNull(),
573
+ status: text("status"),
574
+ severity: text("severity").notNull().default("info"),
575
+ sequence: integer("sequence").notNull(),
576
+ payloadJson: text("payload_json").notNull().default("{}"),
577
+ createdAt: text("created_at").notNull()
578
+ }, (table) => [
579
+ index("idx_project_deployment_events_deployment_sequence").on(table.deploymentId, table.sequence),
580
+ index("idx_project_deployment_events_project_created").on(table.projectId, table.createdAt),
581
+ index("idx_project_deployment_events_operation").on(table.operationId)
582
+ ]);
583
+ const agentPools = pgTable("agent_pools", {
584
+ id: text("id").primaryKey(),
585
+ projectId: text("project_id").notNull(),
586
+ teamId: text("team_id").notNull(),
587
+ environment: text("environment").notNull(),
588
+ name: text("name").notNull(),
589
+ registrationIdentity: text("registration_identity"),
590
+ serviceBaseUrl: text("service_base_url"),
591
+ status: text("status").notNull().default("pending"),
592
+ minWorkers: integer("min_workers").notNull().default(0),
593
+ maxWorkers: integer("max_workers").notNull().default(1),
594
+ targetQueueDepth: integer("target_queue_depth").notNull().default(1),
595
+ cooldownSeconds: integer("cooldown_seconds").notNull().default(60),
596
+ metadataJson: text("metadata_json"),
597
+ createdAt: text("created_at").notNull(),
598
+ updatedAt: text("updated_at").notNull()
599
+ }, (table) => [
600
+ uniqueIndex("idx_agent_pools_project_environment_name").on(table.projectId, table.environment, table.name)
601
+ ]);
602
+ const agentPoolRegistrations = pgTable("agent_pool_registrations", {
603
+ id: text("id").primaryKey(),
604
+ poolId: text("pool_id").notNull(),
605
+ projectId: text("project_id").notNull(),
606
+ runnerId: text("runner_id"),
607
+ managerId: text("manager_id"),
608
+ serviceName: text("service_name"),
609
+ heartbeatAt: text("heartbeat_at").notNull(),
610
+ desiredWorkers: integer("desired_workers"),
611
+ observedQueueDepth: integer("observed_queue_depth"),
612
+ observedActiveLeases: integer("observed_active_leases"),
613
+ metadataJson: text("metadata_json"),
614
+ createdAt: text("created_at").notNull(),
615
+ updatedAt: text("updated_at").notNull()
616
+ }, (table) => [
617
+ index("idx_agent_pool_registrations_pool_heartbeat").on(table.poolId, table.heartbeatAt)
618
+ ]);
619
+ const agentPoolScaleDecisions = pgTable("agent_pool_scale_decisions", {
620
+ id: text("id").primaryKey(),
621
+ poolId: text("pool_id").notNull(),
622
+ projectId: text("project_id").notNull(),
623
+ environment: text("environment").notNull(),
624
+ desiredWorkers: integer("desired_workers").notNull(),
625
+ observedQueueDepth: integer("observed_queue_depth").notNull().default(0),
626
+ observedActiveLeases: integer("observed_active_leases").notNull().default(0),
627
+ workDayId: text("work_day_id"),
628
+ reason: text("reason").notNull(),
629
+ metadataJson: text("metadata_json").notNull(),
630
+ createdAt: text("created_at").notNull(),
631
+ updatedAt: text("updated_at").notNull()
632
+ }, (table) => [
633
+ index("idx_agent_pool_scale_decisions_pool_created").on(table.poolId, table.createdAt)
634
+ ]);
635
+ const projectWorkdaySummaries = pgTable("project_workday_summaries", {
636
+ id: text("id").primaryKey(),
637
+ projectId: text("project_id").notNull(),
638
+ environment: text("environment").notNull(),
639
+ workDayId: text("work_day_id").notNull(),
640
+ kind: text("kind").notNull(),
641
+ state: text("state"),
642
+ startedAt: text("started_at"),
643
+ endedAt: text("ended_at"),
644
+ summaryJson: text("summary_json").notNull(),
645
+ metadataJson: text("metadata_json").notNull(),
646
+ createdAt: text("created_at").notNull(),
647
+ updatedAt: text("updated_at").notNull()
648
+ }, (table) => [
649
+ index("idx_project_workday_summaries_project_environment_created").on(table.projectId, table.environment, table.createdAt)
650
+ ]);
651
+ const workPolicies = pgTable("work_policies", {
652
+ projectId: text("project_id"),
653
+ environment: text("environment"),
654
+ scheduleJson: text("schedule_json").notNull(),
655
+ dailyTaskCreditBudget: integer("daily_task_credit_budget").notNull().default(0),
656
+ maxQueuedTasks: integer("max_queued_tasks").notNull().default(0),
657
+ maxQueuedCredits: integer("max_queued_credits").notNull().default(0),
658
+ autoscaleJson: text("autoscale_json").notNull(),
659
+ creditWeightsJson: text("credit_weights_json").notNull(),
660
+ metadataJson: text("metadata_json").notNull(),
661
+ createdAt: text("created_at").notNull(),
662
+ updatedAt: text("updated_at").notNull(),
663
+ enabled: integer("enabled").notNull().default(1),
664
+ startCron: text("start_cron").notNull().default("0 9 * * 1-5"),
665
+ durationMinutes: integer("duration_minutes").notNull().default(480),
666
+ maxRunners: integer("max_runners").notNull().default(1),
667
+ maxWorkersPerRunner: integer("max_workers_per_runner").notNull().default(4),
668
+ dailyCreditBudget: integer("daily_credit_budget").notNull().default(0),
669
+ closeoutGraceMinutes: integer("closeout_grace_minutes").notNull().default(15)
670
+ }, (table) => [
671
+ primaryKey({ columns: [table.projectId, table.environment] })
672
+ ]);
673
+ const priorityOverrides = pgTable("priority_overrides", {
674
+ id: text("id").primaryKey(),
675
+ projectId: text("project_id").notNull(),
676
+ model: text("model").notNull(),
677
+ subjectId: text("subject_id").notNull(),
678
+ priority: real("priority").notNull().default(0),
679
+ estimatedCredits: real("estimated_credits"),
680
+ metadataJson: text("metadata_json").notNull(),
681
+ createdAt: text("created_at").notNull(),
682
+ updatedAt: text("updated_at").notNull()
683
+ }, (table) => [
684
+ index("idx_priority_overrides_project_priority").on(table.projectId, table.priority, table.updatedAt)
685
+ ]);
686
+ const prioritySnapshots = pgTable("priority_snapshots", {
687
+ id: text("id").primaryKey(),
688
+ projectId: text("project_id").notNull(),
689
+ workDayId: text("work_day_id"),
690
+ snapshotJson: text("snapshot_json").notNull(),
691
+ metadataJson: text("metadata_json").notNull(),
692
+ generatedAt: text("generated_at").notNull(),
693
+ createdAt: text("created_at").notNull(),
694
+ updatedAt: text("updated_at").notNull()
695
+ }, (table) => [
696
+ index("idx_priority_snapshots_project_generated").on(table.projectId, table.generatedAt)
697
+ ]);
698
+ const taskCreditLedger = pgTable("task_credit_ledger", {
699
+ id: text("id").primaryKey(),
700
+ projectId: text("project_id").notNull(),
701
+ workDayId: text("work_day_id").notNull(),
702
+ taskId: text("task_id"),
703
+ phase: text("phase").notNull(),
704
+ credits: real("credits").notNull(),
705
+ metadataJson: text("metadata_json").notNull(),
706
+ createdAt: text("created_at").notNull()
707
+ }, (table) => [
708
+ index("idx_task_credit_ledger_work_day_created").on(table.workDayId, table.createdAt)
709
+ ]);
710
+ const scaleDecisions = pgTable("scale_decisions", {
711
+ id: text("id").primaryKey(),
712
+ projectId: text("project_id").notNull(),
713
+ environment: text("environment").notNull(),
714
+ poolName: text("pool_name").notNull(),
715
+ workDayId: text("work_day_id"),
716
+ desiredWorkers: integer("desired_workers").notNull(),
717
+ observedQueueDepth: integer("observed_queue_depth").notNull().default(0),
718
+ observedActiveLeases: integer("observed_active_leases").notNull().default(0),
719
+ reason: text("reason").notNull(),
720
+ metadataJson: text("metadata_json").notNull(),
721
+ createdAt: text("created_at").notNull()
722
+ }, (table) => [
723
+ index("idx_scale_decisions_project_environment_pool_created").on(table.projectId, table.environment, table.poolName, table.createdAt)
724
+ ]);
725
+ const projectSummarySnapshots = pgTable("project_summary_snapshots", {
726
+ projectId: text("project_id").primaryKey(),
727
+ teamId: text("team_id").notNull(),
728
+ summaryJson: text("summary_json").notNull(),
729
+ generatedAt: text("generated_at").notNull(),
730
+ createdAt: text("created_at").notNull(),
731
+ updatedAt: text("updated_at").notNull()
732
+ }, (table) => [
733
+ index("idx_project_summary_snapshots_team_generated").on(table.teamId, table.generatedAt)
734
+ ]);
735
+ const teamInboxItems = pgTable("team_inbox_items", {
736
+ id: text("id").primaryKey(),
737
+ teamId: text("team_id").notNull(),
738
+ projectId: text("project_id"),
739
+ kind: text("kind").notNull(),
740
+ state: text("state").notNull(),
741
+ title: text("title").notNull(),
742
+ summary: text("summary"),
743
+ href: text("href"),
744
+ itemKey: text("item_key"),
745
+ metadataJson: text("metadata_json").notNull().default("{}"),
746
+ createdAt: text("created_at").notNull(),
747
+ updatedAt: text("updated_at").notNull()
748
+ }, (table) => [
749
+ index("idx_team_inbox_items_team_created").on(table.teamId, table.createdAt)
750
+ ]);
751
+ const betterAuthUser = pgTable("better_auth_user", {
752
+ id: text("id").primaryKey(),
753
+ name: text("name").notNull(),
754
+ email: text("email").notNull().unique(),
755
+ emailVerified: integer("emailVerified").notNull().default(0),
756
+ image: text("image"),
757
+ createdAt: bigint("createdAt", { mode: "number" }).notNull(),
758
+ updatedAt: bigint("updatedAt", { mode: "number" }).notNull(),
759
+ username: text("username"),
760
+ firstName: text("firstName"),
761
+ lastName: text("lastName")
762
+ }, (table) => [
763
+ uniqueIndex("idx_better_auth_user_username").on(table.username)
764
+ ]);
765
+ const betterAuthSession = pgTable("better_auth_session", {
766
+ id: text("id").primaryKey(),
767
+ expiresAt: bigint("expiresAt", { mode: "number" }).notNull(),
768
+ token: text("token").notNull().unique(),
769
+ createdAt: bigint("createdAt", { mode: "number" }).notNull(),
770
+ updatedAt: bigint("updatedAt", { mode: "number" }).notNull(),
771
+ ipAddress: text("ipAddress"),
772
+ userAgent: text("userAgent"),
773
+ userId: text("userId").notNull()
774
+ }, (table) => [
775
+ index("idx_better_auth_session_token").on(table.token),
776
+ index("idx_better_auth_session_userId").on(table.userId)
777
+ ]);
778
+ const betterAuthAccount = pgTable("better_auth_account", {
779
+ id: text("id").primaryKey(),
780
+ accountId: text("accountId").notNull(),
781
+ providerId: text("providerId").notNull(),
782
+ userId: text("userId").notNull(),
783
+ accessToken: text("accessToken"),
784
+ refreshToken: text("refreshToken"),
785
+ idToken: text("idToken"),
786
+ accessTokenExpiresAt: bigint("accessTokenExpiresAt", { mode: "number" }),
787
+ refreshTokenExpiresAt: bigint("refreshTokenExpiresAt", { mode: "number" }),
788
+ scope: text("scope"),
789
+ password: text("password"),
790
+ createdAt: bigint("createdAt", { mode: "number" }).notNull(),
791
+ updatedAt: bigint("updatedAt", { mode: "number" }).notNull()
792
+ }, (table) => [
793
+ index("idx_better_auth_account_userId").on(table.userId),
794
+ uniqueIndex("idx_better_auth_account_provider_account").on(table.providerId, table.accountId)
795
+ ]);
796
+ const betterAuthVerification = pgTable("better_auth_verification", {
797
+ id: text("id").primaryKey(),
798
+ identifier: text("identifier").notNull(),
799
+ value: text("value").notNull(),
800
+ expiresAt: bigint("expiresAt", { mode: "number" }).notNull(),
801
+ createdAt: bigint("createdAt", { mode: "number" }).notNull(),
802
+ updatedAt: bigint("updatedAt", { mode: "number" }).notNull()
803
+ }, (table) => [
804
+ index("idx_better_auth_verification_identifier").on(table.identifier)
805
+ ]);
806
+ const teamWebHosts = pgTable("team_web_hosts", {
807
+ id: text("id").primaryKey(),
808
+ teamId: text("team_id").notNull(),
809
+ provider: text("provider").notNull(),
810
+ ownership: text("ownership").notNull(),
811
+ name: text("name").notNull(),
812
+ accountLabel: text("account_label"),
813
+ allowedEnvironmentsJson: text("allowed_environments_json").notNull().default("[]"),
814
+ status: text("status").notNull().default("active"),
815
+ encryptedPayloadJson: text("encrypted_payload_json"),
816
+ metadataJson: text("metadata_json"),
817
+ createdById: text("created_by_id"),
818
+ updatedById: text("updated_by_id"),
819
+ createdAt: text("created_at").notNull(),
820
+ updatedAt: text("updated_at").notNull()
821
+ }, (table) => [
822
+ index("idx_team_web_hosts_team_provider").on(table.teamId, table.provider, table.status),
823
+ uniqueIndex("idx_team_web_hosts_team_provider_name").on(table.teamId, table.provider, table.name)
824
+ ]);
825
+ const teamInvites = pgTable("team_invites", {
826
+ id: text("id").primaryKey(),
827
+ teamId: text("team_id").notNull(),
828
+ email: text("email").notNull(),
829
+ roleKey: text("role_key").notNull(),
830
+ tokenPrefix: text("token_prefix").notNull(),
831
+ tokenHash: text("token_hash").notNull(),
832
+ status: text("status").notNull().default("pending"),
833
+ invitedByUserId: text("invited_by_user_id"),
834
+ acceptedByUserId: text("accepted_by_user_id"),
835
+ acceptedAt: text("accepted_at"),
836
+ expiresAt: text("expires_at").notNull(),
837
+ createdAt: text("created_at").notNull(),
838
+ updatedAt: text("updated_at").notNull()
839
+ }, (table) => [
840
+ index("idx_team_invites_team_status").on(table.teamId, table.status, table.createdAt),
841
+ index("idx_team_invites_token_prefix").on(table.tokenPrefix)
842
+ ]);
843
+ const capacityProviders = pgTable("capacity_providers", {
844
+ id: text("id").primaryKey(),
845
+ teamId: text("team_id"),
846
+ ownerTeamId: text("owner_team_id"),
847
+ name: text("name").notNull(),
848
+ kind: text("kind").notNull(),
849
+ status: text("status").notNull().default("pending"),
850
+ provider: text("provider").notNull(),
851
+ billingScope: text("billing_scope").notNull().default("team"),
852
+ monthlyCreditBudget: real("monthly_credit_budget").notNull().default(0),
853
+ dailyCreditBudget: real("daily_credit_budget").notNull().default(0),
854
+ creditBudgetMode: text("credit_budget_mode").notNull().default("derived"),
855
+ maxConcurrentWorkdays: integer("max_concurrent_workdays").notNull().default(1),
856
+ maxConcurrentWorkers: integer("max_concurrent_workers").notNull().default(1),
857
+ capacityModelJson: text("capacity_model_json").notNull().default("{}"),
858
+ metadataJson: text("metadata_json").notNull().default("{}"),
859
+ createdAt: text("created_at").notNull(),
860
+ updatedAt: text("updated_at").notNull()
861
+ }, (table) => [
862
+ index("idx_capacity_providers_team_status").on(table.teamId, table.status, table.provider)
863
+ ]);
864
+ const capacityProviderHosts = pgTable("capacity_provider_hosts", {
865
+ id: text("id").primaryKey(),
866
+ capacityProviderId: text("capacity_provider_id").notNull(),
867
+ hostId: text("host_id").notNull(),
868
+ role: text("role").notNull(),
869
+ required: integer("required").notNull().default(1),
870
+ metadataJson: text("metadata_json").notNull().default("{}"),
871
+ createdAt: text("created_at").notNull(),
872
+ updatedAt: text("updated_at").notNull()
873
+ }, (table) => [
874
+ uniqueIndex("idx_capacity_provider_hosts_unique").on(table.capacityProviderId, table.hostId, table.role)
875
+ ]);
876
+ const capacityProviderLanes = pgTable("capacity_provider_lanes", {
877
+ id: text("id").primaryKey(),
878
+ capacityProviderId: text("capacity_provider_id").notNull(),
879
+ name: text("name").notNull(),
880
+ businessModel: text("business_model").notNull().default("custom"),
881
+ modelFamily: text("model_family"),
882
+ modelClass: text("model_class"),
883
+ regionPolicy: text("region_policy"),
884
+ unit: text("unit").notNull().default("treeseed_credit"),
885
+ scarcityLevel: text("scarcity_level").notNull().default("medium"),
886
+ hardLimitsJson: text("hard_limits_json").notNull().default("{}"),
887
+ routingPolicyJson: text("routing_policy_json").notNull().default("{}"),
888
+ metadataJson: text("metadata_json").notNull().default("{}"),
889
+ createdAt: text("created_at").notNull(),
890
+ updatedAt: text("updated_at").notNull()
891
+ }, (table) => [
892
+ index("idx_capacity_provider_lanes_provider").on(table.capacityProviderId, table.businessModel, table.scarcityLevel)
893
+ ]);
894
+ const capacityGrants = pgTable("capacity_grants", {
895
+ id: text("id").primaryKey(),
896
+ capacityProviderId: text("capacity_provider_id").notNull(),
897
+ laneId: text("lane_id"),
898
+ grantScope: text("grant_scope").notNull().default("team"),
899
+ teamId: text("team_id").notNull(),
900
+ projectId: text("project_id"),
901
+ environment: text("environment"),
902
+ state: text("state").notNull().default("active"),
903
+ dailyCreditLimit: real("daily_credit_limit"),
904
+ weeklyCreditLimit: real("weekly_credit_limit"),
905
+ monthlyCreditLimit: real("monthly_credit_limit"),
906
+ dailyUsdLimit: real("daily_usd_limit"),
907
+ weeklyQuotaMinutes: real("weekly_quota_minutes"),
908
+ monthlyProviderUnits: real("monthly_provider_units"),
909
+ priorityWeight: real("priority_weight").notNull().default(1),
910
+ overflowPolicy: text("overflow_policy").notNull().default("soft_grant"),
911
+ metadataJson: text("metadata_json").notNull().default("{}"),
912
+ createdAt: text("created_at").notNull(),
913
+ updatedAt: text("updated_at").notNull()
914
+ }, (table) => [
915
+ index("idx_capacity_grants_team_project").on(table.teamId, table.projectId, table.state),
916
+ index("idx_capacity_grants_provider_lane").on(table.capacityProviderId, table.laneId, table.state)
917
+ ]);
918
+ const capacityReservations = pgTable("capacity_reservations", {
919
+ id: text("id").primaryKey(),
920
+ capacityProviderId: text("capacity_provider_id").notNull(),
921
+ executionProviderId: text("execution_provider_id"),
922
+ laneId: text("lane_id").notNull(),
923
+ teamId: text("team_id").notNull(),
924
+ projectId: text("project_id").notNull(),
925
+ workDayId: text("work_day_id"),
926
+ taskId: text("task_id"),
927
+ state: text("state").notNull().default("reserved"),
928
+ reservedCredits: real("reserved_credits").notNull(),
929
+ consumedCredits: real("consumed_credits").notNull().default(0),
930
+ nativeUnit: text("native_unit"),
931
+ reservedNativeAmount: real("reserved_native_amount"),
932
+ consumedNativeAmount: real("consumed_native_amount"),
933
+ reservedProviderUnits: real("reserved_provider_units"),
934
+ consumedProviderUnits: real("consumed_provider_units"),
935
+ reservedUsd: real("reserved_usd"),
936
+ consumedUsd: real("consumed_usd"),
937
+ expiresAt: text("expires_at"),
938
+ metadataJson: text("metadata_json").notNull().default("{}"),
939
+ createdAt: text("created_at").notNull(),
940
+ updatedAt: text("updated_at").notNull()
941
+ }, (table) => [
942
+ index("idx_capacity_reservations_project_workday_state").on(table.projectId, table.workDayId, table.state, table.createdAt),
943
+ index("idx_capacity_reservations_provider_state").on(table.capacityProviderId, table.laneId, table.state),
944
+ index("idx_capacity_reservations_execution_provider_state").on(table.executionProviderId, table.state, table.createdAt)
945
+ ]);
946
+ const capacityLedgerEntries = pgTable("capacity_ledger_entries", {
947
+ id: text("id").primaryKey(),
948
+ capacityProviderId: text("capacity_provider_id").notNull(),
949
+ laneId: text("lane_id"),
950
+ reservationId: text("reservation_id"),
951
+ teamId: text("team_id").notNull(),
952
+ projectId: text("project_id"),
953
+ workDayId: text("work_day_id"),
954
+ taskId: text("task_id"),
955
+ phase: text("phase").notNull(),
956
+ credits: real("credits").notNull(),
957
+ providerUnits: real("provider_units"),
958
+ usd: real("usd"),
959
+ source: text("source").notNull(),
960
+ metadataJson: text("metadata_json").notNull().default("{}"),
961
+ createdAt: text("created_at").notNull()
962
+ }, (table) => [
963
+ index("idx_capacity_ledger_project_workday_created").on(table.projectId, table.workDayId, table.createdAt)
964
+ ]);
965
+ const capacityRoutingDecisions = pgTable("capacity_routing_decisions", {
966
+ id: text("id").primaryKey(),
967
+ taskId: text("task_id"),
968
+ workDayId: text("work_day_id"),
969
+ projectId: text("project_id").notNull(),
970
+ selectedProviderId: text("selected_provider_id").notNull(),
971
+ selectedLaneId: text("selected_lane_id").notNull(),
972
+ selectedModel: text("selected_model"),
973
+ decision: text("decision").notNull().default("selected"),
974
+ reason: text("reason").notNull(),
975
+ candidateJson: text("candidate_json").notNull().default("[]"),
976
+ scoreJson: text("score_json").notNull().default("{}"),
977
+ metadataJson: text("metadata_json").notNull().default("{}"),
978
+ createdAt: text("created_at").notNull()
979
+ }, (table) => [
980
+ index("idx_capacity_routing_decisions_project_workday").on(table.projectId, table.workDayId, table.createdAt)
981
+ ]);
982
+ const taskEstimates = pgTable("task_estimates", {
983
+ id: text("id").primaryKey(),
984
+ taskId: text("task_id"),
985
+ workDayId: text("work_day_id"),
986
+ projectId: text("project_id").notNull(),
987
+ estimatePhase: text("estimate_phase").notNull(),
988
+ taskSignature: text("task_signature").notNull(),
989
+ confidence: text("confidence").notNull(),
990
+ estimatedCreditsP50: real("estimated_credits_p50").notNull(),
991
+ estimatedCreditsP90: real("estimated_credits_p90").notNull(),
992
+ reservedCredits: real("reserved_credits").notNull(),
993
+ estimatedInputTokensP50: integer("estimated_input_tokens_p50"),
994
+ estimatedInputTokensP90: integer("estimated_input_tokens_p90"),
995
+ estimatedOutputTokensP50: integer("estimated_output_tokens_p50"),
996
+ estimatedOutputTokensP90: integer("estimated_output_tokens_p90"),
997
+ estimatedQuotaMinutesP50: real("estimated_quota_minutes_p50"),
998
+ estimatedQuotaMinutesP90: real("estimated_quota_minutes_p90"),
999
+ featuresJson: text("features_json").notNull().default("{}"),
1000
+ createdAt: text("created_at").notNull(),
1001
+ executionProfileId: text("execution_profile_id").notNull().default("standard-code-model")
1002
+ }, (table) => [
1003
+ index("idx_task_estimates_project_signature").on(table.projectId, table.taskSignature, table.createdAt),
1004
+ index("idx_task_estimates_project_signature_profile").on(table.projectId, table.taskSignature, table.executionProfileId, table.createdAt)
1005
+ ]);
1006
+ const taskUsageActuals = pgTable("task_usage_actuals", {
1007
+ id: text("id").primaryKey(),
1008
+ taskId: text("task_id"),
1009
+ workDayId: text("work_day_id"),
1010
+ projectId: text("project_id").notNull(),
1011
+ taskSignature: text("task_signature").notNull(),
1012
+ capacityProviderId: text("capacity_provider_id"),
1013
+ executionProviderId: text("execution_provider_id"),
1014
+ laneId: text("lane_id"),
1015
+ businessModel: text("business_model").notNull(),
1016
+ modelName: text("model_name"),
1017
+ inputTokens: integer("input_tokens"),
1018
+ outputTokens: integer("output_tokens"),
1019
+ cachedInputTokens: integer("cached_input_tokens"),
1020
+ quotaMinutes: real("quota_minutes"),
1021
+ wallMinutes: real("wall_minutes"),
1022
+ filesOpened: integer("files_opened"),
1023
+ filesChanged: integer("files_changed"),
1024
+ diffLinesAdded: integer("diff_lines_added"),
1025
+ diffLinesRemoved: integer("diff_lines_removed"),
1026
+ testRuns: integer("test_runs"),
1027
+ retryCount: integer("retry_count"),
1028
+ actualCredits: real("actual_credits").notNull(),
1029
+ actualUsd: real("actual_usd"),
1030
+ creditFormulaVersion: text("credit_formula_version").notNull().default("treeseed.actual-credits.v1"),
1031
+ actualCreditSource: text("actual_credit_source").notNull().default("central_calculator"),
1032
+ nativeUsageJson: text("native_usage_json").notNull().default("{}"),
1033
+ metadataJson: text("metadata_json").notNull().default("{}"),
1034
+ createdAt: text("created_at").notNull(),
1035
+ executionProfileId: text("execution_profile_id").notNull().default("standard-code-model")
1036
+ }, (table) => [
1037
+ index("idx_task_usage_actuals_project_signature").on(table.projectId, table.taskSignature, table.createdAt),
1038
+ index("idx_task_usage_actuals_project_signature_profile").on(table.projectId, table.taskSignature, table.executionProfileId, table.createdAt),
1039
+ index("idx_task_usage_actuals_execution_provider").on(table.executionProviderId, table.createdAt)
1040
+ ]);
1041
+ const nativeUsageObservations = pgTable("native_usage_observations", {
1042
+ id: text("id").primaryKey(),
1043
+ taskUsageActualId: text("task_usage_actual_id"),
1044
+ taskId: text("task_id"),
1045
+ workDayId: text("work_day_id"),
1046
+ projectId: text("project_id").notNull(),
1047
+ taskSignature: text("task_signature").notNull(),
1048
+ executionProfileId: text("execution_profile_id").notNull().default("standard-code-model"),
1049
+ capacityProviderId: text("capacity_provider_id"),
1050
+ executionProviderId: text("execution_provider_id"),
1051
+ nativeUnit: text("native_unit"),
1052
+ nativeUsageJson: text("native_usage_json").notNull().default("{}"),
1053
+ observedAt: text("observed_at").notNull(),
1054
+ source: text("source").notNull().default("provider_report"),
1055
+ formulaVersion: text("formula_version").notNull().default("treeseed.actual-credits.v1"),
1056
+ actualCredits: real("actual_credits").notNull(),
1057
+ metadataJson: text("metadata_json").notNull().default("{}"),
1058
+ createdAt: text("created_at").notNull()
1059
+ }, (table) => [
1060
+ index("idx_native_usage_observations_profile").on(table.projectId, table.taskSignature, table.executionProfileId, table.createdAt),
1061
+ index("idx_native_usage_observations_provider").on(table.executionProviderId, table.createdAt)
1062
+ ]);
1063
+ const approvalRequests = pgTable("approval_requests", {
1064
+ id: text("id").primaryKey(),
1065
+ teamId: text("team_id").notNull(),
1066
+ projectId: text("project_id").notNull(),
1067
+ workDayId: text("work_day_id"),
1068
+ taskId: text("task_id"),
1069
+ kind: text("kind").notNull(),
1070
+ state: text("state").notNull().default("pending"),
1071
+ severity: text("severity").notNull().default("medium"),
1072
+ requestedByType: text("requested_by_type").notNull().default("worker"),
1073
+ requestedById: text("requested_by_id"),
1074
+ title: text("title").notNull(),
1075
+ summary: text("summary").notNull(),
1076
+ optionsJson: text("options_json").notNull().default("[]"),
1077
+ recommendationJson: text("recommendation_json").notNull().default("{}"),
1078
+ policySnapshotJson: text("policy_snapshot_json").notNull().default("{}"),
1079
+ expiresAt: text("expires_at"),
1080
+ decidedByType: text("decided_by_type"),
1081
+ decidedById: text("decided_by_id"),
1082
+ decidedAt: text("decided_at"),
1083
+ decisionJson: text("decision_json"),
1084
+ metadataJson: text("metadata_json").notNull().default("{}"),
1085
+ createdAt: text("created_at").notNull(),
1086
+ updatedAt: text("updated_at").notNull()
1087
+ }, (table) => [
1088
+ index("idx_approval_requests_team_state").on(table.teamId, table.state, table.createdAt),
1089
+ index("idx_approval_requests_project_workday").on(table.projectId, table.workDayId, table.state, table.createdAt)
1090
+ ]);
1091
+ const workdayRequests = pgTable("workday_requests", {
1092
+ id: text("id").primaryKey(),
1093
+ projectId: text("project_id").notNull(),
1094
+ environment: text("environment").notNull(),
1095
+ typeColumn: text("type").notNull(),
1096
+ state: text("state").notNull().default("pending"),
1097
+ workDayId: text("work_day_id"),
1098
+ requestedBy: text("requested_by"),
1099
+ reason: text("reason"),
1100
+ payloadJson: text("payload_json").notNull(),
1101
+ metadataJson: text("metadata_json").notNull(),
1102
+ createdAt: text("created_at").notNull(),
1103
+ updatedAt: text("updated_at").notNull()
1104
+ }, (table) => [
1105
+ index("idx_workday_requests_project_environment_state").on(table.projectId, table.environment, table.state, table.createdAt)
1106
+ ]);
1107
+ const workdayManagerLeases = pgTable("workday_manager_leases", {
1108
+ id: text("id").primaryKey(),
1109
+ projectId: text("project_id").notNull(),
1110
+ environment: text("environment").notNull(),
1111
+ workDayId: text("work_day_id"),
1112
+ managerId: text("manager_id").notNull(),
1113
+ state: text("state").notNull().default("active"),
1114
+ heartbeatAt: text("heartbeat_at").notNull(),
1115
+ expiresAt: text("expires_at").notNull(),
1116
+ metadataJson: text("metadata_json").notNull(),
1117
+ createdAt: text("created_at").notNull(),
1118
+ updatedAt: text("updated_at").notNull()
1119
+ }, (table) => [
1120
+ index("idx_workday_manager_leases_active").on(table.projectId, table.environment, table.state, table.heartbeatAt)
1121
+ ]);
1122
+ const workerRunners = pgTable("worker_runners", {
1123
+ id: text("id").primaryKey(),
1124
+ projectId: text("project_id").notNull(),
1125
+ environment: text("environment").notNull(),
1126
+ runnerId: text("runner_id").notNull(),
1127
+ runnerServiceName: text("runner_service_name").notNull(),
1128
+ volumeIdentity: text("volume_identity").notNull(),
1129
+ state: text("state").notNull().default("active"),
1130
+ maxLocalWorkers: integer("max_local_workers").notNull().default(4),
1131
+ activeLocalWorkers: integer("active_local_workers").notNull().default(0),
1132
+ availableCapacity: integer("available_capacity").notNull().default(4),
1133
+ lastHeartbeatAt: text("last_heartbeat_at"),
1134
+ claimedRepositoryIdsJson: text("claimed_repository_ids_json").notNull(),
1135
+ metadataJson: text("metadata_json").notNull(),
1136
+ createdAt: text("created_at").notNull(),
1137
+ updatedAt: text("updated_at").notNull()
1138
+ }, (table) => [
1139
+ uniqueIndex("idx_worker_runners_identity").on(table.projectId, table.environment, table.runnerId),
1140
+ index("idx_worker_runners_state_capacity").on(table.projectId, table.environment, table.state, table.availableCapacity)
1141
+ ]);
1142
+ const repositoryClaims = pgTable("repository_claims", {
1143
+ id: text("id").primaryKey(),
1144
+ projectId: text("project_id").notNull(),
1145
+ repositoryId: text("repository_id").notNull(),
1146
+ runnerId: text("runner_id").notNull(),
1147
+ runnerServiceName: text("runner_service_name").notNull(),
1148
+ volumeIdentity: text("volume_identity").notNull(),
1149
+ lastSeenCommit: text("last_seen_commit"),
1150
+ lastTaskAt: text("last_task_at"),
1151
+ claimState: text("claim_state").notNull().default("active"),
1152
+ metadataJson: text("metadata_json").notNull(),
1153
+ createdAt: text("created_at").notNull(),
1154
+ updatedAt: text("updated_at").notNull()
1155
+ }, (table) => [
1156
+ uniqueIndex("idx_repository_claims_runner_repo").on(table.projectId, table.repositoryId, table.runnerId),
1157
+ index("idx_repository_claims_repo_state").on(table.projectId, table.repositoryId, table.claimState, table.updatedAt)
1158
+ ]);
1159
+ const runnerScaleDecisions = pgTable("runner_scale_decisions", {
1160
+ id: text("id").primaryKey(),
1161
+ projectId: text("project_id").notNull(),
1162
+ environment: text("environment").notNull(),
1163
+ workDayId: text("work_day_id"),
1164
+ runnerId: text("runner_id"),
1165
+ runnerServiceName: text("runner_service_name"),
1166
+ action: text("action").notNull(),
1167
+ reason: text("reason").notNull(),
1168
+ metadataJson: text("metadata_json").notNull(),
1169
+ createdAt: text("created_at").notNull()
1170
+ }, (table) => [
1171
+ index("idx_runner_scale_decisions_project_workday").on(table.projectId, table.environment, table.workDayId, table.createdAt)
1172
+ ]);
1173
+ const repositoryHosts = pgTable("repository_hosts", {
1174
+ id: text("id").primaryKey(),
1175
+ teamId: text("team_id"),
1176
+ provider: text("provider").notNull(),
1177
+ ownership: text("ownership").notNull(),
1178
+ name: text("name").notNull(),
1179
+ accountLabel: text("account_label"),
1180
+ organizationOrOwner: text("organization_or_owner").notNull(),
1181
+ defaultVisibility: text("default_visibility").notNull().default("private"),
1182
+ softwareRepositoryNameTemplate: text("software_repository_name_template").notNull().default("{hub}-site"),
1183
+ contentRepositoryNameTemplate: text("content_repository_name_template").notNull().default("{hub}-content"),
1184
+ branchPolicyJson: text("branch_policy_json").notNull().default("{}"),
1185
+ workflowPolicyJson: text("workflow_policy_json").notNull().default("{}"),
1186
+ encryptedPayloadJson: text("encrypted_payload_json"),
1187
+ allowedProjectKindsJson: text("allowed_project_kinds_json").notNull().default('["knowledge_hub"]'),
1188
+ metadataJson: text("metadata_json").notNull().default("{}"),
1189
+ status: text("status").notNull().default("active"),
1190
+ createdById: text("created_by_id"),
1191
+ updatedById: text("updated_by_id"),
1192
+ createdAt: text("created_at").notNull(),
1193
+ updatedAt: text("updated_at").notNull()
1194
+ }, (table) => [
1195
+ index("idx_repository_hosts_team_provider").on(table.teamId, table.provider, table.status),
1196
+ uniqueIndex("idx_repository_hosts_team_provider_name").on(table.teamId, table.provider, table.name),
1197
+ uniqueIndex("idx_repository_hosts_platform_provider_name").on(table.provider, table.name)
1198
+ ]);
1199
+ const hubRepositories = pgTable("hub_repositories", {
1200
+ id: text("id").primaryKey(),
1201
+ hubId: text("hub_id").notNull(),
1202
+ teamId: text("team_id").notNull(),
1203
+ role: text("role").notNull(),
1204
+ repositoryHostId: text("repository_host_id"),
1205
+ provider: text("provider").notNull(),
1206
+ owner: text("owner").notNull(),
1207
+ name: text("name").notNull(),
1208
+ url: text("url"),
1209
+ defaultBranch: text("default_branch"),
1210
+ currentBranch: text("current_branch"),
1211
+ status: text("status").notNull().default("queued"),
1212
+ accessPolicyJson: text("access_policy_json").notNull().default("{}"),
1213
+ releasePolicyJson: text("release_policy_json").notNull().default("{}"),
1214
+ publishPolicyJson: text("publish_policy_json").notNull().default("{}"),
1215
+ submodulePath: text("submodule_path"),
1216
+ metadataJson: text("metadata_json").notNull().default("{}"),
1217
+ createdAt: text("created_at").notNull(),
1218
+ updatedAt: text("updated_at").notNull()
1219
+ }, (table) => [
1220
+ uniqueIndex("idx_hub_repositories_hub_role").on(table.hubId, table.role)
1221
+ ]);
1222
+ const hubContentSources = pgTable("hub_content_sources", {
1223
+ id: text("id").primaryKey(),
1224
+ hubId: text("hub_id").notNull().unique(),
1225
+ teamId: text("team_id").notNull(),
1226
+ contentRepositoryId: text("content_repository_id"),
1227
+ productionSource: text("production_source").notNull(),
1228
+ overlayPolicy: text("overlay_policy").notNull(),
1229
+ r2BucketName: text("r2_bucket_name"),
1230
+ r2ManifestKey: text("r2_manifest_key"),
1231
+ r2PublicBaseUrl: text("r2_public_base_url"),
1232
+ latestPublishId: text("latest_publish_id"),
1233
+ latestContentVersion: text("latest_content_version"),
1234
+ metadataJson: text("metadata_json").notNull().default("{}"),
1235
+ createdAt: text("created_at").notNull(),
1236
+ updatedAt: text("updated_at").notNull()
1237
+ });
1238
+ const hubLaunches = pgTable("hub_launches", {
1239
+ id: text("id").primaryKey(),
1240
+ hubId: text("hub_id").notNull(),
1241
+ teamId: text("team_id").notNull(),
1242
+ jobId: text("job_id"),
1243
+ intentJson: text("intent_json").notNull(),
1244
+ planJson: text("plan_json").notNull().default("{}"),
1245
+ state: text("state").notNull(),
1246
+ currentPhase: text("current_phase"),
1247
+ lastSuccessfulPhase: text("last_successful_phase"),
1248
+ resultJson: text("result_json"),
1249
+ errorJson: text("error_json"),
1250
+ createdAt: text("created_at").notNull(),
1251
+ updatedAt: text("updated_at").notNull(),
1252
+ completedAt: text("completed_at")
1253
+ }, (table) => [
1254
+ index("idx_hub_launches_hub_created").on(table.hubId, table.createdAt)
1255
+ ]);
1256
+ const hubLaunchEvents = pgTable("hub_launch_events", {
1257
+ id: text("id").primaryKey(),
1258
+ launchId: text("launch_id").notNull(),
1259
+ seq: integer("seq").notNull(),
1260
+ phase: text("phase").notNull(),
1261
+ status: text("status").notNull(),
1262
+ title: text("title"),
1263
+ summary: text("summary"),
1264
+ startedAt: text("started_at"),
1265
+ finishedAt: text("finished_at"),
1266
+ errorJson: text("error_json"),
1267
+ dataJson: text("data_json").notNull().default("{}"),
1268
+ createdAt: text("created_at").notNull()
1269
+ }, (table) => [
1270
+ uniqueIndex("idx_hub_launch_events_launch_seq").on(table.launchId, table.seq)
1271
+ ]);
1272
+ const hubWorkspaceLinks = pgTable("hub_workspace_links", {
1273
+ id: text("id").primaryKey(),
1274
+ hubId: text("hub_id").notNull(),
1275
+ teamId: text("team_id").notNull(),
1276
+ parentRepositoryHostId: text("parent_repository_host_id"),
1277
+ parentOwner: text("parent_owner"),
1278
+ parentName: text("parent_name"),
1279
+ parentUrl: text("parent_url"),
1280
+ parentBranch: text("parent_branch"),
1281
+ hubMountPath: text("hub_mount_path"),
1282
+ softwareSubmodulePath: text("software_submodule_path"),
1283
+ contentSubmodulePath: text("content_submodule_path"),
1284
+ updateSubmodulePointersEnabled: integer("update_submodule_pointers_enabled").notNull().default(0),
1285
+ accessPolicyJson: text("access_policy_json").notNull().default("{}"),
1286
+ metadataJson: text("metadata_json").notNull().default("{}"),
1287
+ createdAt: text("created_at").notNull(),
1288
+ updatedAt: text("updated_at").notNull()
1289
+ }, (table) => [
1290
+ index("idx_hub_workspace_links_hub").on(table.hubId)
1291
+ ]);
1292
+ const projectUpdatePlans = pgTable("project_update_plans", {
1293
+ id: text("id").primaryKey(),
1294
+ hubId: text("hub_id").notNull(),
1295
+ teamId: text("team_id").notNull(),
1296
+ sourceKind: text("source_kind").notNull(),
1297
+ sourceRef: text("source_ref"),
1298
+ sourceVersion: text("source_version"),
1299
+ planJson: text("plan_json").notNull().default("{}"),
1300
+ state: text("state").notNull().default("planned"),
1301
+ requiresDecision: integer("requires_decision").notNull().default(0),
1302
+ decisionId: text("decision_id"),
1303
+ createdBy: text("created_by"),
1304
+ createdAt: text("created_at").notNull(),
1305
+ updatedAt: text("updated_at").notNull()
1306
+ }, (table) => [
1307
+ index("idx_project_update_plans_hub").on(table.hubId, table.createdAt)
1308
+ ]);
1309
+ const providerCredentialSessions = pgTable("provider_credential_sessions", {
1310
+ id: text("id").primaryKey(),
1311
+ teamId: text("team_id").notNull(),
1312
+ projectId: text("project_id"),
1313
+ jobId: text("job_id"),
1314
+ hostKind: text("host_kind").notNull(),
1315
+ hostId: text("host_id").notNull(),
1316
+ purpose: text("purpose").notNull(),
1317
+ encryptedPayloadJson: text("encrypted_payload_json").notNull(),
1318
+ status: text("status").notNull().default("active"),
1319
+ expiresAt: text("expires_at").notNull(),
1320
+ consumedAt: text("consumed_at"),
1321
+ createdById: text("created_by_id"),
1322
+ createdAt: text("created_at").notNull(),
1323
+ updatedAt: text("updated_at").notNull(),
1324
+ metadataJson: text("metadata_json").notNull().default("{}")
1325
+ }, (table) => [
1326
+ index("idx_provider_credential_sessions_team_host").on(table.teamId, table.hostKind, table.hostId, table.status),
1327
+ index("idx_provider_credential_sessions_job").on(table.jobId, table.status)
1328
+ ]);
1329
+ const capacityProviderApiKeys = pgTable("capacity_provider_api_keys", {
1330
+ id: text("id").primaryKey(),
1331
+ capacityProviderId: text("capacity_provider_id").notNull(),
1332
+ teamId: text("team_id").notNull(),
1333
+ name: text("name").notNull(),
1334
+ keyPrefix: text("key_prefix").notNull(),
1335
+ keyHash: text("key_hash").notNull(),
1336
+ scopesJson: text("scopes_json").notNull().default("[]"),
1337
+ status: text("status").notNull().default("active"),
1338
+ lastUsedAt: text("last_used_at"),
1339
+ rotatedFromKeyId: text("rotated_from_key_id"),
1340
+ expiresAt: text("expires_at"),
1341
+ revokedAt: text("revoked_at"),
1342
+ createdById: text("created_by_id"),
1343
+ createdAt: text("created_at").notNull(),
1344
+ updatedAt: text("updated_at").notNull()
1345
+ }, (table) => [
1346
+ index("idx_capacity_provider_api_keys_provider_status").on(table.capacityProviderId, table.status, table.createdAt),
1347
+ index("idx_capacity_provider_api_keys_prefix").on(table.keyPrefix)
1348
+ ]);
1349
+ const userPreferences = pgTable("user_preferences", {
1350
+ userId: text("user_id").primaryKey(),
1351
+ colorScheme: text("color_scheme").notNull().default("fern"),
1352
+ themeMode: text("theme_mode").notNull().default("system"),
1353
+ createdAt: text("created_at").notNull(),
1354
+ updatedAt: text("updated_at").notNull()
1355
+ });
1356
+ const taskEstimateProfiles = pgTable("task_estimate_profiles", {
1357
+ taskSignature: text("task_signature"),
1358
+ executionProfileId: text("execution_profile_id").default("standard-code-model"),
1359
+ sampleCount: integer("sample_count").notNull().default(0),
1360
+ completedSampleCount: integer("completed_sample_count").notNull().default(0),
1361
+ interruptedSampleCount: integer("interrupted_sample_count").notNull().default(0),
1362
+ inputTokensP50: integer("input_tokens_p50"),
1363
+ inputTokensP90: integer("input_tokens_p90"),
1364
+ outputTokensP50: integer("output_tokens_p50"),
1365
+ outputTokensP90: integer("output_tokens_p90"),
1366
+ quotaMinutesP50: real("quota_minutes_p50"),
1367
+ quotaMinutesP90: real("quota_minutes_p90"),
1368
+ filesChangedP50: real("files_changed_p50"),
1369
+ filesChangedP90: real("files_changed_p90"),
1370
+ creditsP50: real("credits_p50"),
1371
+ creditsP90: real("credits_p90"),
1372
+ creditsVariance: real("credits_variance"),
1373
+ confidenceScore: real("confidence_score"),
1374
+ outlierCount: integer("outlier_count").notNull().default(0),
1375
+ partialCredits: real("partial_credits"),
1376
+ firstSampleAt: text("first_sample_at"),
1377
+ lastSampleAt: text("last_sample_at"),
1378
+ updatedAt: text("updated_at").notNull()
1379
+ }, (table) => [
1380
+ primaryKey({ columns: [table.taskSignature, table.executionProfileId] })
1381
+ ]);
1382
+ const creditConversionProfiles = pgTable("credit_conversion_profiles", {
1383
+ id: text("id").primaryKey(),
1384
+ taskSignature: text("task_signature").notNull(),
1385
+ executionProfileId: text("execution_profile_id").notNull().default("standard-code-model"),
1386
+ executionProviderKind: text("execution_provider_kind").notNull(),
1387
+ nativeUnit: text("native_unit").notNull(),
1388
+ sampleCount: integer("sample_count").notNull().default(0),
1389
+ completedSampleCount: integer("completed_sample_count").notNull().default(0),
1390
+ interruptedSampleCount: integer("interrupted_sample_count").notNull().default(0),
1391
+ nativeUnitsPerCreditP50: real("native_units_per_credit_p50"),
1392
+ nativeUnitsPerCreditP90: real("native_units_per_credit_p90"),
1393
+ creditsPerNativeUnitP50: real("credits_per_native_unit_p50"),
1394
+ creditsPerNativeUnitP90: real("credits_per_native_unit_p90"),
1395
+ actualCreditsP50: real("actual_credits_p50"),
1396
+ actualCreditsP90: real("actual_credits_p90"),
1397
+ confidence: text("confidence").notNull().default("low"),
1398
+ formulaVersion: text("formula_version").notNull(),
1399
+ metadataJson: text("metadata_json").notNull().default("{}"),
1400
+ createdAt: text("created_at").notNull(),
1401
+ updatedAt: text("updated_at").notNull()
1402
+ }, (table) => [
1403
+ uniqueIndex("idx_credit_conversion_profiles_profile_key").on(table.taskSignature, table.executionProfileId, table.executionProviderKind, table.nativeUnit),
1404
+ index("idx_credit_conversion_profiles_kind_unit").on(table.executionProviderKind, table.nativeUnit, table.updatedAt)
1405
+ ]);
1406
+ const seedRuns = pgTable("seed_runs", {
1407
+ id: text("id").primaryKey(),
1408
+ seedName: text("seed_name").notNull(),
1409
+ seedVersion: integer("seed_version").notNull(),
1410
+ environmentsJson: text("environments_json").notNull(),
1411
+ mode: text("mode").notNull(),
1412
+ state: text("state").notNull(),
1413
+ actorType: text("actor_type"),
1414
+ actorId: text("actor_id"),
1415
+ manifestHash: text("manifest_hash").notNull(),
1416
+ planJson: text("plan_json").notNull(),
1417
+ resultJson: text("result_json"),
1418
+ errorJson: text("error_json"),
1419
+ createdAt: text("created_at").notNull(),
1420
+ updatedAt: text("updated_at").notNull(),
1421
+ completedAt: text("completed_at")
1422
+ }, (table) => [
1423
+ index("idx_seed_runs_seed_created").on(table.seedName, table.createdAt),
1424
+ index("idx_seed_runs_state_created").on(table.state, table.createdAt)
1425
+ ]);
1426
+ const runtimeRecords = pgTable("runtime_records", {
1427
+ id: serial("id").primaryKey(),
1428
+ recordType: text("record_type").notNull(),
1429
+ recordKey: text("record_key").notNull(),
1430
+ lookupKey: text("lookup_key"),
1431
+ secondaryKey: text("secondary_key"),
1432
+ status: text("status").notNull(),
1433
+ schemaVersion: integer("schema_version").notNull().default(1),
1434
+ createdAt: text("created_at").notNull(),
1435
+ updatedAt: text("updated_at").notNull(),
1436
+ payloadJson: text("payload_json").notNull(),
1437
+ metaJson: text("meta_json").notNull()
1438
+ }, (table) => [
1439
+ index("idx_runtime_records_type_lookup_updated").on(table.recordType, table.lookupKey, table.updatedAt),
1440
+ index("idx_runtime_records_type_status_updated").on(table.recordType, table.status, table.updatedAt)
1441
+ ]);
1442
+ const cursorState = pgTable("cursor_state", {
1443
+ agentSlug: text("agent_slug"),
1444
+ cursorKey: text("cursor_key"),
1445
+ status: text("status").notNull(),
1446
+ schemaVersion: integer("schema_version").notNull().default(1),
1447
+ updatedAt: text("updated_at").notNull(),
1448
+ payloadJson: text("payload_json").notNull(),
1449
+ metaJson: text("meta_json").notNull()
1450
+ }, (table) => [
1451
+ primaryKey({ columns: [table.agentSlug, table.cursorKey] }),
1452
+ index("idx_cursor_state_updated").on(table.updatedAt)
1453
+ ]);
1454
+ const leaseState = pgTable("lease_state", {
1455
+ model: text("model"),
1456
+ itemKey: text("item_key"),
1457
+ status: text("status").notNull(),
1458
+ schemaVersion: integer("schema_version").notNull().default(1),
1459
+ claimedBy: text("claimed_by"),
1460
+ claimedAt: text("claimed_at"),
1461
+ leaseExpiresAt: text("lease_expires_at"),
1462
+ createdAt: text("created_at").notNull(),
1463
+ updatedAt: text("updated_at").notNull(),
1464
+ payloadJson: text("payload_json").notNull(),
1465
+ metaJson: text("meta_json").notNull()
1466
+ }, (table) => [
1467
+ primaryKey({ columns: [table.model, table.itemKey] }),
1468
+ index("idx_lease_state_status_expires").on(table.status, table.leaseExpiresAt),
1469
+ index("idx_lease_state_claimed_by").on(table.claimedBy, table.updatedAt)
1470
+ ]);
1471
+ const messageQueue = pgTable("message_queue", {
1472
+ id: serial("id").primaryKey(),
1473
+ messageType: text("message_type").notNull(),
1474
+ status: text("status").notNull(),
1475
+ schemaVersion: integer("schema_version").notNull().default(1),
1476
+ relatedModel: text("related_model"),
1477
+ relatedId: text("related_id"),
1478
+ priority: integer("priority").notNull().default(0),
1479
+ availableAt: text("available_at").notNull(),
1480
+ claimedBy: text("claimed_by"),
1481
+ claimedAt: text("claimed_at"),
1482
+ leaseExpiresAt: text("lease_expires_at"),
1483
+ attempts: integer("attempts").notNull().default(0),
1484
+ maxAttempts: integer("max_attempts").notNull().default(3),
1485
+ createdAt: text("created_at").notNull(),
1486
+ updatedAt: text("updated_at").notNull(),
1487
+ payloadJson: text("payload_json").notNull(),
1488
+ metaJson: text("meta_json").notNull()
1489
+ }, (table) => [
1490
+ index("idx_message_queue_claimable").on(table.status, table.availableAt, table.priority),
1491
+ index("idx_message_queue_related").on(table.relatedModel, table.relatedId, table.createdAt)
1492
+ ]);
1493
+ const capacityProviderRegistrations = pgTable("capacity_provider_registrations", {
1494
+ id: text("id").primaryKey(),
1495
+ capacityProviderId: text("capacity_provider_id").notNull(),
1496
+ teamId: text("team_id").notNull(),
1497
+ runtimeVersion: text("runtime_version").notNull(),
1498
+ marketId: text("market_id").notNull(),
1499
+ capabilitiesJson: text("capabilities_json").notNull().default("[]"),
1500
+ budgetsJson: text("budgets_json").notNull().default("{}"),
1501
+ healthJson: text("health_json").notNull().default("{}"),
1502
+ status: text("status").notNull().default("online"),
1503
+ registeredAt: text("registered_at").notNull(),
1504
+ lastSeenAt: text("last_seen_at").notNull(),
1505
+ disconnectedAt: text("disconnected_at"),
1506
+ createdAt: text("created_at").notNull(),
1507
+ updatedAt: text("updated_at").notNull()
1508
+ }, (table) => [
1509
+ index("idx_capacity_provider_registrations_provider_seen").on(table.capacityProviderId, table.lastSeenAt)
1510
+ ]);
1511
+ const capacityProviderDeployments = pgTable("capacity_provider_deployments", {
1512
+ id: text("id").primaryKey(),
1513
+ teamId: text("team_id").notNull(),
1514
+ capacityProviderId: text("capacity_provider_id").notNull(),
1515
+ launchMode: text("launch_mode").notNull(),
1516
+ hostKind: text("host_kind").notNull(),
1517
+ hostId: text("host_id"),
1518
+ status: text("status").notNull(),
1519
+ imageRef: text("image_ref"),
1520
+ serviceRefsJson: text("service_refs_json").notNull().default("{}"),
1521
+ envRefsJson: text("env_refs_json").notNull().default("{}"),
1522
+ resultJson: text("result_json").notNull().default("{}"),
1523
+ errorJson: text("error_json"),
1524
+ createdById: text("created_by_id"),
1525
+ createdAt: text("created_at").notNull(),
1526
+ updatedAt: text("updated_at").notNull(),
1527
+ completedAt: text("completed_at")
1528
+ }, (table) => [
1529
+ index("idx_capacity_provider_deployments_provider_created").on(table.capacityProviderId, table.createdAt)
1530
+ ]);
1531
+ const platformOperations = pgTable("platform_operations", {
1532
+ id: text("id").primaryKey(),
1533
+ namespace: text("namespace").notNull(),
1534
+ operation: text("operation").notNull(),
1535
+ status: text("status").notNull(),
1536
+ target: text("target").notNull(),
1537
+ idempotencyKey: text("idempotency_key"),
1538
+ inputJson: text("input_json").notNull().default("{}"),
1539
+ outputJson: text("output_json"),
1540
+ errorJson: text("error_json"),
1541
+ requestedByType: text("requested_by_type").notNull(),
1542
+ requestedById: text("requested_by_id"),
1543
+ assignedRunnerId: text("assigned_runner_id"),
1544
+ leaseExpiresAt: text("lease_expires_at"),
1545
+ createdAt: text("created_at").notNull(),
1546
+ updatedAt: text("updated_at").notNull(),
1547
+ startedAt: text("started_at"),
1548
+ finishedAt: text("finished_at"),
1549
+ cancelledAt: text("cancelled_at")
1550
+ }, (table) => [
1551
+ uniqueIndex("idx_platform_operations_idempotency").on(table.namespace, table.operation, table.idempotencyKey),
1552
+ index("idx_platform_operations_runnable").on(table.status, table.createdAt)
1553
+ ]);
1554
+ const platformOperationEvents = pgTable("platform_operation_events", {
1555
+ id: text("id").primaryKey(),
1556
+ operationId: text("operation_id").notNull(),
1557
+ seq: integer("seq").notNull(),
1558
+ kind: text("kind").notNull(),
1559
+ dataJson: text("data_json").notNull().default("{}"),
1560
+ createdAt: text("created_at").notNull()
1561
+ }, (table) => [
1562
+ uniqueIndex("idx_platform_operation_events_seq").on(table.operationId, table.seq)
1563
+ ]);
1564
+ const marketOperationRunners = pgTable("market_operation_runners", {
1565
+ id: text("id").primaryKey(),
1566
+ runnerKey: text("runner_key").notNull().unique(),
1567
+ name: text("name").notNull(),
1568
+ environment: text("environment").notNull(),
1569
+ status: text("status").notNull().default("online"),
1570
+ version: text("version"),
1571
+ capabilitiesJson: text("capabilities_json").notNull().default("[]"),
1572
+ activeJobCount: integer("active_job_count").notNull().default(0),
1573
+ maxConcurrentJobs: integer("max_concurrent_jobs").notNull().default(1),
1574
+ heartbeatAt: text("heartbeat_at"),
1575
+ metadataJson: text("metadata_json").notNull().default("{}"),
1576
+ createdAt: text("created_at").notNull(),
1577
+ updatedAt: text("updated_at").notNull()
1578
+ });
1579
+ const platformRepositoryClaims = pgTable("platform_repository_claims", {
1580
+ id: text("id").primaryKey(),
1581
+ repositoryKey: text("repository_key").notNull(),
1582
+ runnerId: text("runner_id").notNull(),
1583
+ workspacePath: text("workspace_path").notNull(),
1584
+ branch: text("branch"),
1585
+ commitSha: text("commit_sha"),
1586
+ claimState: text("claim_state").notNull().default("active"),
1587
+ leaseExpiresAt: text("lease_expires_at"),
1588
+ metadataJson: text("metadata_json").notNull().default("{}"),
1589
+ createdAt: text("created_at").notNull(),
1590
+ updatedAt: text("updated_at").notNull()
1591
+ }, (table) => [
1592
+ uniqueIndex("idx_platform_repository_claims_active").on(table.repositoryKey, table.runnerId),
1593
+ index("idx_platform_repository_claims_runner").on(table.runnerId, table.claimState)
1594
+ ]);
1595
+ const executionProviders = pgTable("execution_providers", {
1596
+ id: text("id").primaryKey(),
1597
+ teamId: text("team_id").notNull(),
1598
+ capacityProviderId: text("capacity_provider_id"),
1599
+ name: text("name").notNull(),
1600
+ kind: text("kind").notNull(),
1601
+ status: text("status").notNull().default("active"),
1602
+ nativeUnit: text("native_unit").notNull(),
1603
+ quotaVisibility: text("quota_visibility").notNull().default("opaque"),
1604
+ maxConcurrentWorkers: integer("max_concurrent_workers").notNull().default(1),
1605
+ resetCadence: text("reset_cadence"),
1606
+ configJson: text("config_json").notNull().default("{}"),
1607
+ metadataJson: text("metadata_json").notNull().default("{}"),
1608
+ createdAt: text("created_at").notNull(),
1609
+ updatedAt: text("updated_at").notNull()
1610
+ }, (table) => [
1611
+ index("idx_execution_providers_team_status").on(table.teamId, table.status, table.kind),
1612
+ index("idx_execution_providers_capacity_provider").on(table.capacityProviderId, table.status)
1613
+ ]);
1614
+ const executionProviderNativeLimits = pgTable("execution_provider_native_limits", {
1615
+ id: text("id").primaryKey(),
1616
+ executionProviderId: text("execution_provider_id").notNull(),
1617
+ scope: text("scope").notNull(),
1618
+ nativeUnit: text("native_unit").notNull(),
1619
+ limitAmount: real("limit_amount").notNull(),
1620
+ reserveBufferPercent: real("reserve_buffer_percent").notNull().default(0),
1621
+ resetCadence: text("reset_cadence"),
1622
+ resetAt: text("reset_at"),
1623
+ confidence: text("confidence").notNull().default("estimated"),
1624
+ source: text("source").notNull().default("configured"),
1625
+ metadataJson: text("metadata_json").notNull().default("{}"),
1626
+ createdAt: text("created_at").notNull(),
1627
+ updatedAt: text("updated_at").notNull()
1628
+ }, (table) => [
1629
+ index("idx_execution_provider_native_limits_provider_scope").on(table.executionProviderId, table.scope, table.nativeUnit)
1630
+ ]);
1631
+ const executionProviderObservations = pgTable("execution_provider_observations", {
1632
+ id: text("id").primaryKey(),
1633
+ executionProviderId: text("execution_provider_id").notNull(),
1634
+ observedAt: text("observed_at").notNull(),
1635
+ health: text("health").notNull().default("unknown"),
1636
+ activeWorkers: integer("active_workers"),
1637
+ queuedTasks: integer("queued_tasks"),
1638
+ throttleState: text("throttle_state"),
1639
+ nativeRemainingJson: text("native_remaining_json").notNull().default("{}"),
1640
+ resetAt: text("reset_at"),
1641
+ confidence: text("confidence").notNull().default("estimated"),
1642
+ metadataJson: text("metadata_json").notNull().default("{}"),
1643
+ createdAt: text("created_at").notNull()
1644
+ }, (table) => [
1645
+ index("idx_execution_provider_observations_provider_observed").on(table.executionProviderId, table.observedAt)
1646
+ ]);
1647
+ const marketAuthCredentials = pgTable("market_auth_credentials", {
1648
+ userId: text("user_id").primaryKey(),
1649
+ email: text("email").notNull().unique(),
1650
+ username: text("username").unique(),
1651
+ passwordHash: text("password_hash").notNull(),
1652
+ status: text("status").notNull().default("active"),
1653
+ createdAt: text("created_at").notNull(),
1654
+ updatedAt: text("updated_at").notNull()
1655
+ });
1656
+ const marketAuthPasswordResets = pgTable("market_auth_password_resets", {
1657
+ id: text("id").primaryKey(),
1658
+ userId: text("user_id").notNull(),
1659
+ tokenHash: text("token_hash").notNull().unique(),
1660
+ expiresAt: text("expires_at").notNull(),
1661
+ usedAt: text("used_at"),
1662
+ createdAt: text("created_at").notNull()
1663
+ });
1664
+ const treeseedMarketSchema = {
1665
+ subscribers,
1666
+ agentRuns,
1667
+ agentMessages,
1668
+ contactSubmissions,
1669
+ runtimeEnvelopes,
1670
+ workDays,
1671
+ tasks,
1672
+ taskEvents,
1673
+ taskOutputs,
1674
+ graphRuns,
1675
+ reports,
1676
+ users,
1677
+ userIdentities,
1678
+ userEmailAddresses,
1679
+ roles,
1680
+ permissions,
1681
+ rolePermissions,
1682
+ userRoleBindings,
1683
+ apiTokens,
1684
+ serviceCredentials,
1685
+ authSessions,
1686
+ auditEvents,
1687
+ deviceCodes,
1688
+ teams,
1689
+ teamMemberships,
1690
+ teamRoleBindings,
1691
+ webSessions,
1692
+ projects,
1693
+ projectConnections,
1694
+ projectCapabilityGrants,
1695
+ teamApiKeys,
1696
+ entitlements,
1697
+ remoteJobs,
1698
+ remoteJobEvents,
1699
+ knowledgePacks,
1700
+ teamStorageLocators,
1701
+ catalogItems,
1702
+ catalogArtifactVersions,
1703
+ catalogItemCollaborators,
1704
+ projectHosting,
1705
+ projectEnvironments,
1706
+ projectInfrastructureResources,
1707
+ projectDeployments,
1708
+ projectDeploymentEvents,
1709
+ agentPools,
1710
+ agentPoolRegistrations,
1711
+ agentPoolScaleDecisions,
1712
+ projectWorkdaySummaries,
1713
+ workPolicies,
1714
+ priorityOverrides,
1715
+ prioritySnapshots,
1716
+ taskCreditLedger,
1717
+ scaleDecisions,
1718
+ projectSummarySnapshots,
1719
+ teamInboxItems,
1720
+ betterAuthUser,
1721
+ betterAuthSession,
1722
+ betterAuthAccount,
1723
+ betterAuthVerification,
1724
+ teamWebHosts,
1725
+ teamInvites,
1726
+ capacityProviders,
1727
+ capacityProviderHosts,
1728
+ capacityProviderLanes,
1729
+ capacityGrants,
1730
+ capacityReservations,
1731
+ capacityLedgerEntries,
1732
+ capacityRoutingDecisions,
1733
+ taskEstimates,
1734
+ taskUsageActuals,
1735
+ nativeUsageObservations,
1736
+ approvalRequests,
1737
+ workdayRequests,
1738
+ workdayManagerLeases,
1739
+ workerRunners,
1740
+ repositoryClaims,
1741
+ runnerScaleDecisions,
1742
+ repositoryHosts,
1743
+ hubRepositories,
1744
+ hubContentSources,
1745
+ hubLaunches,
1746
+ hubLaunchEvents,
1747
+ hubWorkspaceLinks,
1748
+ projectUpdatePlans,
1749
+ providerCredentialSessions,
1750
+ capacityProviderApiKeys,
1751
+ userPreferences,
1752
+ taskEstimateProfiles,
1753
+ creditConversionProfiles,
1754
+ seedRuns,
1755
+ runtimeRecords,
1756
+ cursorState,
1757
+ leaseState,
1758
+ messageQueue,
1759
+ capacityProviderRegistrations,
1760
+ capacityProviderDeployments,
1761
+ platformOperations,
1762
+ platformOperationEvents,
1763
+ marketOperationRunners,
1764
+ platformRepositoryClaims,
1765
+ executionProviders,
1766
+ executionProviderNativeLimits,
1767
+ executionProviderObservations,
1768
+ marketAuthCredentials,
1769
+ marketAuthPasswordResets
1770
+ };
1771
+ export {
1772
+ agentMessages,
1773
+ agentPoolRegistrations,
1774
+ agentPoolScaleDecisions,
1775
+ agentPools,
1776
+ agentRuns,
1777
+ apiTokens,
1778
+ approvalRequests,
1779
+ auditEvents,
1780
+ authSessions,
1781
+ betterAuthAccount,
1782
+ betterAuthSession,
1783
+ betterAuthUser,
1784
+ betterAuthVerification,
1785
+ capacityGrants,
1786
+ capacityLedgerEntries,
1787
+ capacityProviderApiKeys,
1788
+ capacityProviderDeployments,
1789
+ capacityProviderHosts,
1790
+ capacityProviderLanes,
1791
+ capacityProviderRegistrations,
1792
+ capacityProviders,
1793
+ capacityReservations,
1794
+ capacityRoutingDecisions,
1795
+ catalogArtifactVersions,
1796
+ catalogItemCollaborators,
1797
+ catalogItems,
1798
+ contactSubmissions,
1799
+ creditConversionProfiles,
1800
+ cursorState,
1801
+ deviceCodes,
1802
+ entitlements,
1803
+ executionProviderNativeLimits,
1804
+ executionProviderObservations,
1805
+ executionProviders,
1806
+ graphRuns,
1807
+ hubContentSources,
1808
+ hubLaunchEvents,
1809
+ hubLaunches,
1810
+ hubRepositories,
1811
+ hubWorkspaceLinks,
1812
+ knowledgePacks,
1813
+ leaseState,
1814
+ marketAuthCredentials,
1815
+ marketAuthPasswordResets,
1816
+ marketOperationRunners,
1817
+ messageQueue,
1818
+ nativeUsageObservations,
1819
+ permissions,
1820
+ platformOperationEvents,
1821
+ platformOperations,
1822
+ platformRepositoryClaims,
1823
+ priorityOverrides,
1824
+ prioritySnapshots,
1825
+ projectCapabilityGrants,
1826
+ projectConnections,
1827
+ projectDeploymentEvents,
1828
+ projectDeployments,
1829
+ projectEnvironments,
1830
+ projectHosting,
1831
+ projectInfrastructureResources,
1832
+ projectSummarySnapshots,
1833
+ projectUpdatePlans,
1834
+ projectWorkdaySummaries,
1835
+ projects,
1836
+ providerCredentialSessions,
1837
+ remoteJobEvents,
1838
+ remoteJobs,
1839
+ reports,
1840
+ repositoryClaims,
1841
+ repositoryHosts,
1842
+ rolePermissions,
1843
+ roles,
1844
+ runnerScaleDecisions,
1845
+ runtimeEnvelopes,
1846
+ runtimeRecords,
1847
+ scaleDecisions,
1848
+ seedRuns,
1849
+ serviceCredentials,
1850
+ subscribers,
1851
+ taskCreditLedger,
1852
+ taskEstimateProfiles,
1853
+ taskEstimates,
1854
+ taskEvents,
1855
+ taskOutputs,
1856
+ taskUsageActuals,
1857
+ tasks,
1858
+ teamApiKeys,
1859
+ teamInboxItems,
1860
+ teamInvites,
1861
+ teamMemberships,
1862
+ teamRoleBindings,
1863
+ teamStorageLocators,
1864
+ teamWebHosts,
1865
+ teams,
1866
+ treeseedMarketSchema,
1867
+ userEmailAddresses,
1868
+ userIdentities,
1869
+ userPreferences,
1870
+ userRoleBindings,
1871
+ users,
1872
+ webSessions,
1873
+ workDays,
1874
+ workPolicies,
1875
+ workdayManagerLeases,
1876
+ workdayRequests,
1877
+ workerRunners
1878
+ };