@opengeni/db 3.7.4 → 4.0.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automations.d.ts +4 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-integrations.d.ts +2 -0
- package/dist/{chunk-6DPJA36C.js → chunk-2XEZK4LF.js} +7 -1
- package/dist/chunk-2XEZK4LF.js.map +1 -0
- package/dist/{chunk-4NAR7FBA.js → chunk-3RI33YQN.js} +67 -1
- package/dist/chunk-3RI33YQN.js.map +1 -0
- package/dist/{chunk-SZAWDXQC.js → chunk-CJROYHSC.js} +3 -3
- package/dist/{chunk-DZCYW2WT.js → chunk-MX6V5F65.js} +2 -2
- package/dist/{chunk-S3TDDCS2.js → chunk-N5VXJ4I2.js} +151 -78
- package/dist/chunk-N5VXJ4I2.js.map +1 -0
- package/dist/{chunk-U4WPPEBH.js → chunk-NLFHMPUB.js} +2 -2
- package/dist/{chunk-5NNCGFQY.js → chunk-P6NSEG2S.js} +2 -2
- package/dist/{chunk-O56DM5GZ.js → chunk-QM6YOWHZ.js} +624 -57
- package/dist/chunk-QM6YOWHZ.js.map +1 -0
- package/dist/{chunk-US4IS6IV.js → chunk-RZNOSEMC.js} +2 -2
- package/dist/{chunk-F6PBS6WE.js → chunk-UFAMOUWL.js} +2 -2
- package/dist/codemode-operations.d.ts +5 -0
- package/dist/codex-token-resolver.d.ts +6 -2
- package/dist/connection-token-resolver.d.ts +8 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/generated-images.d.ts +15 -0
- package/dist/index.d.ts +393 -91
- package/dist/index.js +9992 -6069
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +9 -0
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/managed-user-setup.d.ts +3 -0
- package/dist/mcp-oauth.d.ts +80 -0
- package/dist/migrate.d.ts +1 -0
- package/dist/migrate.js +3 -1
- package/dist/model-catalog.d.ts +153 -0
- package/dist/model-context-snapshots.d.ts +20 -0
- package/dist/new-session-drafts.d.ts +12 -0
- package/dist/organization-membership-lifecycle.d.ts +8 -1
- package/dist/organization-model-providers.d.ts +101 -0
- package/dist/pack-components.d.ts +1 -0
- package/dist/pr-review.d.ts +9 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +8 -8
- package/dist/schema.d.ts +7708 -5050
- package/dist/schema.js +25 -1
- package/dist/session-background-commands.d.ts +18 -6
- package/dist/session-background-commands.js +15 -9
- package/dist/session-control.d.ts +37 -2
- package/dist/session-goal-pacing.d.ts +3 -6
- package/dist/session-queue-commands.d.ts +17 -0
- package/dist/session-tenancy.js +3 -3
- package/dist/tool-gateway-approvals.d.ts +31 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-artifacts.d.ts +17 -3
- package/dist/xai-subscription.d.ts +8 -0
- package/drizzle/0387_bound_host_export_session_payloads.sql +165 -0
- package/drizzle/0388_sandbox_provider_deadline_interactions.sql +491 -0
- package/drizzle/0389_model_catalog_and_gateway_custom_models.sql +241 -0
- package/drizzle/0390_organization_model_provider_connections.sql +197 -0
- package/drizzle/0391_sandbox_provider_deadline_interaction_followup.sql +295 -0
- package/drizzle/0392_context_compaction_pending_observability.sql +198 -0
- package/drizzle/0393_workspace_memory_and_learning_defaults.sql +102 -0
- package/drizzle/0394_session_selected_skill_activation.sql +20 -0
- package/drizzle/0395_scheduled_task_unclaimed_occurrence_invalidation.sql +154 -0
- package/drizzle/0396_model_call_equivalent_credit_cost.sql +28 -0
- package/drizzle/0397_sandbox_deadline_rotation_preemption.sql +113 -0
- package/drizzle/0398_organization_workspace_management_entry.sql +206 -0
- package/drizzle/0399_additional_managed_organization_creation.sql +691 -0
- package/drizzle/0400_session_attempt_model_context_snapshots.sql +65 -0
- package/drizzle/0401_organization_user_setup_token_transport.sql +178 -0
- package/drizzle/0402_session_input_wait_and_background_command_results.sql +1023 -0
- package/drizzle/0403_codex_unconditional_credential_leasing.sql +181 -0
- package/drizzle/0404_mcp_oauth_authorization_server.sql +471 -0
- package/drizzle/0405_tool_gateway_approval_capabilities.sql +184 -0
- package/drizzle/0406_workspace_html_site_sources.sql +71 -0
- package/package.json +6 -6
- package/src/automations.ts +9 -1
- package/src/capability-integrations.ts +8 -0
- package/src/codemode-operations.ts +31 -21
- package/src/codex-token-resolver.ts +16 -6
- package/src/connection-token-resolver.ts +52 -3
- package/src/generated-images.ts +70 -6
- package/src/index.ts +3894 -994
- package/src/insights-model-bundle.ts +54 -5
- package/src/insights.ts +53 -7
- package/src/managed-user-setup.ts +14 -3
- package/src/mcp-oauth.ts +488 -0
- package/src/migrate.ts +9 -1
- package/src/model-catalog.ts +682 -0
- package/src/model-context-snapshots.ts +151 -0
- package/src/new-session-drafts.ts +66 -21
- package/src/organization-membership-lifecycle.ts +47 -5
- package/src/organization-model-providers.ts +614 -0
- package/src/pack-components.ts +15 -2
- package/src/pr-review.ts +19 -0
- package/src/provision-roles.ts +4 -0
- package/src/runtime-posture.ts +64 -0
- package/src/schema.ts +666 -61
- package/src/session-background-commands.ts +180 -78
- package/src/session-control.ts +181 -12
- package/src/session-goal-pacing.ts +4 -8
- package/src/session-queue-commands.ts +157 -82
- package/src/tool-gateway-approvals.ts +168 -0
- package/src/workspace-artifacts.ts +633 -178
- package/src/xai-subscription.ts +66 -14
- package/dist/chunk-4NAR7FBA.js.map +0 -1
- package/dist/chunk-6DPJA36C.js.map +0 -1
- package/dist/chunk-O56DM5GZ.js.map +0 -1
- package/dist/chunk-S3TDDCS2.js.map +0 -1
- /package/dist/{chunk-SZAWDXQC.js.map → chunk-CJROYHSC.js.map} +0 -0
- /package/dist/{chunk-DZCYW2WT.js.map → chunk-MX6V5F65.js.map} +0 -0
- /package/dist/{chunk-U4WPPEBH.js.map → chunk-NLFHMPUB.js.map} +0 -0
- /package/dist/{chunk-5NNCGFQY.js.map → chunk-P6NSEG2S.js.map} +0 -0
- /package/dist/{chunk-US4IS6IV.js.map → chunk-RZNOSEMC.js.map} +0 -0
- /package/dist/{chunk-F6PBS6WE.js.map → chunk-UFAMOUWL.js.map} +0 -0
|
@@ -68,6 +68,7 @@ __export(schema_exports, {
|
|
|
68
68
|
connectorActionPolicies: () => connectorActionPolicies,
|
|
69
69
|
connectorActionRequests: () => connectorActionRequests,
|
|
70
70
|
creditLedgerEntries: () => creditLedgerEntries,
|
|
71
|
+
deploymentModelCatalog: () => deploymentModelCatalog,
|
|
71
72
|
deviceEnrollmentRequests: () => deviceEnrollmentRequests,
|
|
72
73
|
deviceEnrollmentStatusValues: () => deviceEnrollmentStatusValues,
|
|
73
74
|
documentBases: () => documentBases,
|
|
@@ -160,6 +161,11 @@ __export(schema_exports, {
|
|
|
160
161
|
managedAuthLoginTransactions: () => managedAuthLoginTransactions,
|
|
161
162
|
managedAuthSessionSetOperations: () => managedAuthSessionSetOperations,
|
|
162
163
|
managedAuthSessionSets: () => managedAuthSessionSets,
|
|
164
|
+
mcpOauthAccessTokens: () => mcpOauthAccessTokens,
|
|
165
|
+
mcpOauthAuthorizationCodes: () => mcpOauthAuthorizationCodes,
|
|
166
|
+
mcpOauthAuthorizationRequests: () => mcpOauthAuthorizationRequests,
|
|
167
|
+
mcpOauthClients: () => mcpOauthClients,
|
|
168
|
+
mcpOauthRefreshTokens: () => mcpOauthRefreshTokens,
|
|
163
169
|
memorySlackPublicationConfigurations: () => memorySlackPublicationConfigurations,
|
|
164
170
|
memorySlackPublicationReceipts: () => memorySlackPublicationReceipts,
|
|
165
171
|
memorySlackPublications: () => memorySlackPublications,
|
|
@@ -175,6 +181,9 @@ __export(schema_exports, {
|
|
|
175
181
|
organizationMembershipLifecycleEvents: () => organizationMembershipLifecycleEvents,
|
|
176
182
|
organizationMembershipOperationReceipts: () => organizationMembershipOperationReceipts,
|
|
177
183
|
organizationMemberships: () => organizationMemberships,
|
|
184
|
+
organizationModelProviderConnectionOperations: () => organizationModelProviderConnectionOperations,
|
|
185
|
+
organizationModelProviderConnections: () => organizationModelProviderConnections,
|
|
186
|
+
organizationModelProviderCustomModels: () => organizationModelProviderCustomModels,
|
|
178
187
|
organizationPrivateSessionSettingEvents: () => organizationPrivateSessionSettingEvents,
|
|
179
188
|
organizationPrivateSessionSettings: () => organizationPrivateSessionSettings,
|
|
180
189
|
organizationProfileEvents: () => organizationProfileEvents,
|
|
@@ -231,6 +240,7 @@ __export(schema_exports, {
|
|
|
231
240
|
scheduledTasks: () => scheduledTasks,
|
|
232
241
|
sessionAttemptCodemodeCalls: () => sessionAttemptCodemodeCalls,
|
|
233
242
|
sessionAttemptInterruptions: () => sessionAttemptInterruptions,
|
|
243
|
+
sessionAttemptModelContextSnapshots: () => sessionAttemptModelContextSnapshots,
|
|
234
244
|
sessionAttemptToolCatalogs: () => sessionAttemptToolCatalogs,
|
|
235
245
|
sessionBackgroundCommands: () => sessionBackgroundCommands,
|
|
236
246
|
sessionCommandReceipts: () => sessionCommandReceipts,
|
|
@@ -295,6 +305,7 @@ __export(schema_exports, {
|
|
|
295
305
|
taskNoteWriteCapabilities: () => taskNoteWriteCapabilities,
|
|
296
306
|
taskNotes: () => taskNotes,
|
|
297
307
|
temporalScheduleCleanupOutbox: () => temporalScheduleCleanupOutbox,
|
|
308
|
+
toolGatewayApprovalCapabilities: () => toolGatewayApprovalCapabilities,
|
|
298
309
|
transcriptionRecordingChunkStateValues: () => transcriptionRecordingChunkStateValues,
|
|
299
310
|
transcriptionRecordingChunks: () => transcriptionRecordingChunks,
|
|
300
311
|
transcriptionRecordingObjectKindValues: () => transcriptionRecordingObjectKindValues,
|
|
@@ -316,6 +327,7 @@ __export(schema_exports, {
|
|
|
316
327
|
workspaceCaptures: () => workspaceCaptures,
|
|
317
328
|
workspaceCodexSubscriptionPreferences: () => workspaceCodexSubscriptionPreferences,
|
|
318
329
|
workspaceControlEvents: () => workspaceControlEvents,
|
|
330
|
+
workspaceGatewayCustomModels: () => workspaceGatewayCustomModels,
|
|
319
331
|
workspaceInferenceControls: () => workspaceInferenceControls,
|
|
320
332
|
workspaceInstructionPolicyActivationEvents: () => workspaceInstructionPolicyActivationEvents,
|
|
321
333
|
workspaceInstructionPolicyDeactivationEvents: () => workspaceInstructionPolicyDeactivationEvents,
|
|
@@ -6387,9 +6399,9 @@ var workspaces = pgTable19(
|
|
|
6387
6399
|
// White-label agent persona template override. NULL means the deployment
|
|
6388
6400
|
// default (OPENGENI_AGENT_INSTRUCTIONS_TEMPLATE / DEFAULT_AGENT_INSTRUCTIONS).
|
|
6389
6401
|
agentInstructions: text19("agent_instructions"),
|
|
6390
|
-
// Growth-ready per-workspace settings bag (migration 0045).
|
|
6391
|
-
//
|
|
6392
|
-
settings: jsonb15("settings").$type().notNull().default({}),
|
|
6402
|
+
// Growth-ready per-workspace settings bag (migration 0045). Migration 0393
|
|
6403
|
+
// makes Memory enabled by default; explicit false remains authoritative.
|
|
6404
|
+
settings: jsonb15("settings").$type().notNull().default({ memoryEnabled: true }),
|
|
6393
6405
|
// The workspace's default rig (migration 0047). NULL ⇒ no default; sessions
|
|
6394
6406
|
// created without an explicit rig ride no rig (today's behavior exactly). FK
|
|
6395
6407
|
// (-> rigs(id) ON DELETE SET NULL) lives in migration 0047, not a Drizzle
|
|
@@ -6455,7 +6467,12 @@ var workspaceArtifacts = pgTable19(
|
|
|
6455
6467
|
table.slug
|
|
6456
6468
|
),
|
|
6457
6469
|
workspaceId: uniqueIndex19("workspace_artifacts_workspace_id_uq").on(table.workspaceId, table.id),
|
|
6458
|
-
list: index19("workspace_artifacts_list_idx").on(table.workspaceId, table.updatedAt)
|
|
6470
|
+
list: index19("workspace_artifacts_list_idx").on(table.workspaceId, table.updatedAt),
|
|
6471
|
+
statusList: index19("workspace_artifacts_status_list_idx").on(
|
|
6472
|
+
table.workspaceId,
|
|
6473
|
+
table.status,
|
|
6474
|
+
table.updatedAt
|
|
6475
|
+
)
|
|
6459
6476
|
})
|
|
6460
6477
|
);
|
|
6461
6478
|
var workspaceArtifactVersions = pgTable19(
|
|
@@ -6470,6 +6487,10 @@ var workspaceArtifactVersions = pgTable19(
|
|
|
6470
6487
|
contentType: text19("content_type").$type().notNull().default("text/html"),
|
|
6471
6488
|
contentSha256: text19("content_sha256").notNull(),
|
|
6472
6489
|
sizeBytes: integer18("size_bytes").notNull(),
|
|
6490
|
+
sourceKey: text19("source_key"),
|
|
6491
|
+
sourceSha256: text19("source_sha256"),
|
|
6492
|
+
sourceSizeBytes: integer18("source_size_bytes"),
|
|
6493
|
+
requestedTools: jsonb15("requested_tools").$type().notNull().default([]),
|
|
6473
6494
|
operationKey: text19("operation_key").notNull(),
|
|
6474
6495
|
sourceSessionId: uuid19("source_session_id"),
|
|
6475
6496
|
sourceTurnId: uuid19("source_turn_id"),
|
|
@@ -6529,6 +6550,7 @@ var workspaceArtifactEvents = pgTable19(
|
|
|
6529
6550
|
fromVersionId: uuid19("from_version_id"),
|
|
6530
6551
|
toVersionId: uuid19("to_version_id").notNull(),
|
|
6531
6552
|
operationKey: text19("operation_key").notNull(),
|
|
6553
|
+
requestDigest: text19("request_digest"),
|
|
6532
6554
|
sourceSessionId: uuid19("source_session_id"),
|
|
6533
6555
|
sourceTurnId: uuid19("source_turn_id"),
|
|
6534
6556
|
sourceAttemptId: uuid19("source_attempt_id"),
|
|
@@ -6746,8 +6768,12 @@ var organizationProfileEvents = pgTable19(
|
|
|
6746
6768
|
actorMembershipId: uuid19("actor_membership_id").notNull(),
|
|
6747
6769
|
previousName: text19("previous_name").notNull(),
|
|
6748
6770
|
requestedName: text19("requested_name").notNull(),
|
|
6749
|
-
expectedUpdatedAt: timestamp19("expected_updated_at", {
|
|
6750
|
-
|
|
6771
|
+
expectedUpdatedAt: timestamp19("expected_updated_at", {
|
|
6772
|
+
withTimezone: true
|
|
6773
|
+
}).notNull(),
|
|
6774
|
+
resultUpdatedAt: timestamp19("result_updated_at", {
|
|
6775
|
+
withTimezone: true
|
|
6776
|
+
}).notNull(),
|
|
6751
6777
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6752
6778
|
},
|
|
6753
6779
|
(table) => ({
|
|
@@ -6820,7 +6846,9 @@ var organizationPrivateSessionSettingEvents = pgTable19(
|
|
|
6820
6846
|
expectedVersion: bigint14("expected_version", { mode: "number" }).notNull(),
|
|
6821
6847
|
resultEnabled: boolean11("result_enabled").notNull(),
|
|
6822
6848
|
resultVersion: bigint14("result_version", { mode: "number" }).notNull(),
|
|
6823
|
-
resultUpdatedAt: timestamp19("result_updated_at", {
|
|
6849
|
+
resultUpdatedAt: timestamp19("result_updated_at", {
|
|
6850
|
+
withTimezone: true
|
|
6851
|
+
}).notNull(),
|
|
6824
6852
|
changed: boolean11("changed").notNull(),
|
|
6825
6853
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
6826
6854
|
},
|
|
@@ -6942,7 +6970,9 @@ var organizationInvitationBindingEvents = pgTable19(
|
|
|
6942
6970
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
6943
6971
|
invitationId: uuid19("invitation_id").notNull(),
|
|
6944
6972
|
targetSubjectId: text19("target_subject_id").notNull(),
|
|
6945
|
-
resultingRevision: bigint14("resulting_revision", {
|
|
6973
|
+
resultingRevision: bigint14("resulting_revision", {
|
|
6974
|
+
mode: "number"
|
|
6975
|
+
}).notNull(),
|
|
6946
6976
|
boundAt: timestamp19("bound_at", { withTimezone: true }).notNull().defaultNow()
|
|
6947
6977
|
},
|
|
6948
6978
|
(table) => ({
|
|
@@ -7036,13 +7066,19 @@ var organizationUserRetentionDeletions = pgTable19(
|
|
|
7036
7066
|
{
|
|
7037
7067
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
7038
7068
|
membershipId: uuid19("membership_id").notNull(),
|
|
7039
|
-
retentionUntil: timestamp19("retention_until", {
|
|
7069
|
+
retentionUntil: timestamp19("retention_until", {
|
|
7070
|
+
withTimezone: true
|
|
7071
|
+
}).notNull(),
|
|
7040
7072
|
state: text19("state").notNull().default("claimed"),
|
|
7041
7073
|
claimOperationId: uuid19("claim_operation_id").notNull(),
|
|
7042
|
-
claimExpiresAt: timestamp19("claim_expires_at", {
|
|
7074
|
+
claimExpiresAt: timestamp19("claim_expires_at", {
|
|
7075
|
+
withTimezone: true
|
|
7076
|
+
}).notNull(),
|
|
7043
7077
|
attemptCount: integer18("attempt_count").notNull().default(1),
|
|
7044
7078
|
databaseResult: jsonb15("database_result").$type(),
|
|
7045
|
-
databaseFinalizedAt: timestamp19("database_finalized_at", {
|
|
7079
|
+
databaseFinalizedAt: timestamp19("database_finalized_at", {
|
|
7080
|
+
withTimezone: true
|
|
7081
|
+
}),
|
|
7046
7082
|
result: jsonb15("result").$type(),
|
|
7047
7083
|
completedAt: timestamp19("completed_at", { withTimezone: true }),
|
|
7048
7084
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -7410,7 +7446,9 @@ var codexSubscriptionCredentials = pgTable19(
|
|
|
7410
7446
|
{
|
|
7411
7447
|
id: uuid19("id").primaryKey().defaultRandom(),
|
|
7412
7448
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
7413
|
-
workspaceId: uuid19("workspace_id").references(() => workspaces.id, {
|
|
7449
|
+
workspaceId: uuid19("workspace_id").references(() => workspaces.id, {
|
|
7450
|
+
onDelete: "cascade"
|
|
7451
|
+
}),
|
|
7414
7452
|
organizationId: uuid19("organization_id").references(() => managedAccounts.id, {
|
|
7415
7453
|
onDelete: "cascade"
|
|
7416
7454
|
}),
|
|
@@ -7542,7 +7580,6 @@ var organizationCodexRotationSettings = pgTable19(
|
|
|
7542
7580
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
7543
7581
|
activeCredentialId: uuid19("active_credential_id"),
|
|
7544
7582
|
rotationEnabled: boolean11("rotation_enabled").notNull().default(false),
|
|
7545
|
-
leaseRotationEnabled: boolean11("lease_rotation_enabled").notNull().default(false),
|
|
7546
7583
|
rotationStrategy: text19("rotation_strategy").notNull().default("sharded"),
|
|
7547
7584
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
7548
7585
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -7922,7 +7959,9 @@ var connectionUseOnceConsumptionReceipts = pgTable19(
|
|
|
7922
7959
|
grantId: uuid19("grant_id").primaryKey(),
|
|
7923
7960
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
7924
7961
|
authorityId: uuid19("authority_id").notNull(),
|
|
7925
|
-
authorityGeneration: bigint14("authority_generation", {
|
|
7962
|
+
authorityGeneration: bigint14("authority_generation", {
|
|
7963
|
+
mode: "number"
|
|
7964
|
+
}).notNull(),
|
|
7926
7965
|
grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
|
|
7927
7966
|
acceptedWorkKind: text19("accepted_work_kind").notNull(),
|
|
7928
7967
|
acceptedWorkId: uuid19("accepted_work_id").notNull(),
|
|
@@ -8531,7 +8570,9 @@ var slackInteractionInbox = pgTable19(
|
|
|
8531
8570
|
targetAccountId: uuid19("target_account_id"),
|
|
8532
8571
|
targetWorkspaceId: uuid19("target_workspace_id"),
|
|
8533
8572
|
routePromptId: uuid19("route_prompt_id"),
|
|
8534
|
-
routePromptExpiresAt: timestamp19("route_prompt_expires_at", {
|
|
8573
|
+
routePromptExpiresAt: timestamp19("route_prompt_expires_at", {
|
|
8574
|
+
withTimezone: true
|
|
8575
|
+
}),
|
|
8535
8576
|
processedAt: timestamp19("processed_at", { withTimezone: true }),
|
|
8536
8577
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
8537
8578
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -9220,6 +9261,192 @@ var integrationOauthStateNonces = pgTable19(
|
|
|
9220
9261
|
expires: index19("integration_oauth_state_nonces_expires_idx").on(table.expiresAt)
|
|
9221
9262
|
})
|
|
9222
9263
|
);
|
|
9264
|
+
var mcpOauthClients = pgTable19(
|
|
9265
|
+
"mcp_oauth_clients",
|
|
9266
|
+
{
|
|
9267
|
+
clientId: text19("client_id").primaryKey(),
|
|
9268
|
+
redirectUris: jsonb15("redirect_uris").$type().notNull(),
|
|
9269
|
+
clientName: text19("client_name"),
|
|
9270
|
+
tokenEndpointAuthMethod: text19("token_endpoint_auth_method").notNull().default("none"),
|
|
9271
|
+
grantTypes: jsonb15("grant_types").$type().notNull(),
|
|
9272
|
+
responseTypes: jsonb15("response_types").$type().notNull(),
|
|
9273
|
+
registrationScopeHash: text19("registration_scope_hash").notNull(),
|
|
9274
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
9275
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull()
|
|
9276
|
+
},
|
|
9277
|
+
(table) => ({
|
|
9278
|
+
created: index19("mcp_oauth_clients_created_idx").on(table.createdAt),
|
|
9279
|
+
scopeCreated: index19("mcp_oauth_clients_scope_created_idx").on(
|
|
9280
|
+
table.registrationScopeHash,
|
|
9281
|
+
table.createdAt
|
|
9282
|
+
),
|
|
9283
|
+
expires: index19("mcp_oauth_clients_expires_idx").on(table.expiresAt, table.clientId)
|
|
9284
|
+
})
|
|
9285
|
+
);
|
|
9286
|
+
var mcpOauthGrantColumns = () => ({
|
|
9287
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
9288
|
+
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
9289
|
+
subjectId: text19("subject_id").notNull(),
|
|
9290
|
+
resource: text19("resource").notNull(),
|
|
9291
|
+
permissions: jsonb15("permissions").$type().notNull(),
|
|
9292
|
+
toolIdentities: jsonb15("tool_identities").$type().notNull()
|
|
9293
|
+
});
|
|
9294
|
+
var mcpOauthAuthorizationRequests = pgTable19(
|
|
9295
|
+
"mcp_oauth_authorization_requests",
|
|
9296
|
+
{
|
|
9297
|
+
requestHash: text19("request_hash").primaryKey(),
|
|
9298
|
+
clientId: text19("client_id").notNull().references(() => mcpOauthClients.clientId, { onDelete: "cascade" }),
|
|
9299
|
+
...mcpOauthGrantColumns(),
|
|
9300
|
+
redirectUri: text19("redirect_uri").notNull(),
|
|
9301
|
+
codeChallenge: text19("code_challenge").notNull(),
|
|
9302
|
+
state: text19("state"),
|
|
9303
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
|
|
9304
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
9305
|
+
},
|
|
9306
|
+
(table) => ({
|
|
9307
|
+
workspaceAccount: foreignKey({
|
|
9308
|
+
name: "mcp_oauth_authorization_requests_workspace_account_fk",
|
|
9309
|
+
columns: [table.workspaceId, table.accountId],
|
|
9310
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
9311
|
+
}).onDelete("cascade"),
|
|
9312
|
+
expires: index19("mcp_oauth_authorization_requests_expires_idx").on(table.expiresAt)
|
|
9313
|
+
})
|
|
9314
|
+
);
|
|
9315
|
+
var mcpOauthAuthorizationCodes = pgTable19(
|
|
9316
|
+
"mcp_oauth_authorization_codes",
|
|
9317
|
+
{
|
|
9318
|
+
codeHash: text19("code_hash").primaryKey(),
|
|
9319
|
+
clientId: text19("client_id").notNull().references(() => mcpOauthClients.clientId, { onDelete: "cascade" }),
|
|
9320
|
+
...mcpOauthGrantColumns(),
|
|
9321
|
+
redirectUri: text19("redirect_uri").notNull(),
|
|
9322
|
+
codeChallenge: text19("code_challenge").notNull(),
|
|
9323
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
|
|
9324
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
9325
|
+
},
|
|
9326
|
+
(table) => ({
|
|
9327
|
+
workspaceAccount: foreignKey({
|
|
9328
|
+
name: "mcp_oauth_authorization_codes_workspace_account_fk",
|
|
9329
|
+
columns: [table.workspaceId, table.accountId],
|
|
9330
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
9331
|
+
}).onDelete("cascade"),
|
|
9332
|
+
expires: index19("mcp_oauth_authorization_codes_expires_idx").on(table.expiresAt)
|
|
9333
|
+
})
|
|
9334
|
+
);
|
|
9335
|
+
var mcpOauthRefreshTokens = pgTable19(
|
|
9336
|
+
"mcp_oauth_refresh_tokens",
|
|
9337
|
+
{
|
|
9338
|
+
tokenHash: text19("token_hash").primaryKey(),
|
|
9339
|
+
familyId: uuid19("family_id").notNull(),
|
|
9340
|
+
generation: integer18("generation").notNull(),
|
|
9341
|
+
clientId: text19("client_id").notNull().references(() => mcpOauthClients.clientId, { onDelete: "cascade" }),
|
|
9342
|
+
...mcpOauthGrantColumns(),
|
|
9343
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
|
|
9344
|
+
revokedAt: timestamp19("revoked_at", { withTimezone: true }),
|
|
9345
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
9346
|
+
},
|
|
9347
|
+
(table) => ({
|
|
9348
|
+
workspaceAccount: foreignKey({
|
|
9349
|
+
name: "mcp_oauth_refresh_tokens_workspace_account_fk",
|
|
9350
|
+
columns: [table.workspaceId, table.accountId],
|
|
9351
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
9352
|
+
}).onDelete("cascade"),
|
|
9353
|
+
familyGeneration: uniqueIndex19("mcp_oauth_refresh_tokens_family_generation_uq").on(
|
|
9354
|
+
table.familyId,
|
|
9355
|
+
table.generation
|
|
9356
|
+
),
|
|
9357
|
+
expires: index19("mcp_oauth_refresh_tokens_expires_idx").on(table.expiresAt)
|
|
9358
|
+
})
|
|
9359
|
+
);
|
|
9360
|
+
var mcpOauthAccessTokens = pgTable19(
|
|
9361
|
+
"mcp_oauth_access_tokens",
|
|
9362
|
+
{
|
|
9363
|
+
tokenHash: text19("token_hash").primaryKey(),
|
|
9364
|
+
refreshFamilyId: uuid19("refresh_family_id").notNull(),
|
|
9365
|
+
refreshGeneration: integer18("refresh_generation").notNull(),
|
|
9366
|
+
clientId: text19("client_id").notNull().references(() => mcpOauthClients.clientId, { onDelete: "cascade" }),
|
|
9367
|
+
...mcpOauthGrantColumns(),
|
|
9368
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
|
|
9369
|
+
revokedAt: timestamp19("revoked_at", { withTimezone: true }),
|
|
9370
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
9371
|
+
},
|
|
9372
|
+
(table) => ({
|
|
9373
|
+
workspaceAccount: foreignKey({
|
|
9374
|
+
name: "mcp_oauth_access_tokens_workspace_account_fk",
|
|
9375
|
+
columns: [table.workspaceId, table.accountId],
|
|
9376
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
9377
|
+
}).onDelete("cascade"),
|
|
9378
|
+
family: index19("mcp_oauth_access_tokens_family_idx").on(
|
|
9379
|
+
table.refreshFamilyId,
|
|
9380
|
+
table.refreshGeneration
|
|
9381
|
+
),
|
|
9382
|
+
expires: index19("mcp_oauth_access_tokens_expires_idx").on(table.expiresAt)
|
|
9383
|
+
})
|
|
9384
|
+
);
|
|
9385
|
+
var toolGatewayApprovalCapabilities = pgTable19(
|
|
9386
|
+
"tool_gateway_approval_capabilities",
|
|
9387
|
+
{
|
|
9388
|
+
tokenHash: text19("token_hash").primaryKey(),
|
|
9389
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
9390
|
+
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
9391
|
+
subjectId: text19("subject_id").notNull(),
|
|
9392
|
+
operationId: uuid19("operation_id").notNull(),
|
|
9393
|
+
catalogDigest: text19("catalog_digest").notNull(),
|
|
9394
|
+
serverId: text19("server_id").notNull(),
|
|
9395
|
+
toolName: text19("tool_name").notNull(),
|
|
9396
|
+
argumentsDigest: text19("arguments_digest").notNull(),
|
|
9397
|
+
authorityDigest: text19("authority_digest").notNull(),
|
|
9398
|
+
expiresAt: timestamp19("expires_at", { withTimezone: true }).notNull(),
|
|
9399
|
+
consumedAt: timestamp19("consumed_at", { withTimezone: true }),
|
|
9400
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
9401
|
+
},
|
|
9402
|
+
(table) => ({
|
|
9403
|
+
workspaceAccount: foreignKey({
|
|
9404
|
+
name: "tool_gateway_approval_capabilities_workspace_account_fk",
|
|
9405
|
+
columns: [table.workspaceId, table.accountId],
|
|
9406
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
9407
|
+
}).onDelete("cascade"),
|
|
9408
|
+
operation: uniqueIndex19("tool_gateway_approval_capabilities_operation_uq").on(
|
|
9409
|
+
table.workspaceId,
|
|
9410
|
+
table.subjectId,
|
|
9411
|
+
table.operationId
|
|
9412
|
+
),
|
|
9413
|
+
expires: index19("tool_gateway_approval_capabilities_expires_idx").on(
|
|
9414
|
+
table.expiresAt,
|
|
9415
|
+
table.tokenHash
|
|
9416
|
+
),
|
|
9417
|
+
liveSubjectExpiry: index19("tool_gateway_approval_capabilities_live_subject_expiry_idx").on(table.workspaceId, table.subjectId, table.expiresAt, table.tokenHash).where(sql16`${table.consumedAt} is null`),
|
|
9418
|
+
tokenHashValid: check11(
|
|
9419
|
+
"tool_gateway_approval_capabilities_token_hash_chk",
|
|
9420
|
+
sql16`${table.tokenHash} ~ '^[0-9a-f]{64}$'`
|
|
9421
|
+
),
|
|
9422
|
+
catalogDigestValid: check11(
|
|
9423
|
+
"tool_gateway_approval_capabilities_catalog_digest_chk",
|
|
9424
|
+
sql16`${table.catalogDigest} ~ '^[0-9a-f]{64}$'`
|
|
9425
|
+
),
|
|
9426
|
+
argumentsDigestValid: check11(
|
|
9427
|
+
"tool_gateway_approval_capabilities_arguments_digest_chk",
|
|
9428
|
+
sql16`${table.argumentsDigest} ~ '^[0-9a-f]{64}$'`
|
|
9429
|
+
),
|
|
9430
|
+
authorityDigestValid: check11(
|
|
9431
|
+
"tool_gateway_approval_capabilities_authority_digest_chk",
|
|
9432
|
+
sql16`${table.authorityDigest} ~ '^[0-9a-f]{64}$'`
|
|
9433
|
+
),
|
|
9434
|
+
subjectValid: check11(
|
|
9435
|
+
"tool_gateway_approval_capabilities_subject_chk",
|
|
9436
|
+
sql16`length(btrim(${table.subjectId})) between 1 and 1024`
|
|
9437
|
+
),
|
|
9438
|
+
identityValid: check11(
|
|
9439
|
+
"tool_gateway_approval_capabilities_identity_chk",
|
|
9440
|
+
sql16`length(${table.serverId}) between 1 and 256
|
|
9441
|
+
and length(${table.toolName}) between 1 and 512`
|
|
9442
|
+
),
|
|
9443
|
+
expiryValid: check11(
|
|
9444
|
+
"tool_gateway_approval_capabilities_expiry_chk",
|
|
9445
|
+
sql16`${table.expiresAt} > ${table.createdAt}
|
|
9446
|
+
and ${table.expiresAt} <= ${table.createdAt} + interval '10 minutes'`
|
|
9447
|
+
)
|
|
9448
|
+
})
|
|
9449
|
+
);
|
|
9223
9450
|
var codexRotationSettings = pgTable19(
|
|
9224
9451
|
"codex_rotation_settings",
|
|
9225
9452
|
{
|
|
@@ -9227,14 +9454,10 @@ var codexRotationSettings = pgTable19(
|
|
|
9227
9454
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
9228
9455
|
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
9229
9456
|
activeCredentialId: uuid19("active_credential_id"),
|
|
9230
|
-
//
|
|
9231
|
-
// only
|
|
9232
|
-
//
|
|
9457
|
+
// User-owned account-selection policy. When false, every new turn may lease
|
|
9458
|
+
// only the active credential and waits if that credential is unavailable.
|
|
9459
|
+
// When true, the allocator may choose another eligible account.
|
|
9233
9460
|
rotationEnabled: boolean11("rotation_enabled").notNull().default(false),
|
|
9234
|
-
// Revision-aware allocator cutover. Only migration-compatible API/worker
|
|
9235
|
-
// code reads this bit; old binaries safely ignore it and keep the legacy
|
|
9236
|
-
// pin/rotation policy.
|
|
9237
|
-
leaseRotationEnabled: boolean11("lease_rotation_enabled").notNull().default(false),
|
|
9238
9461
|
rotationStrategy: text19("rotation_strategy").notNull().default("sharded"),
|
|
9239
9462
|
// sharded-rotation policy: legacy residue; behavior is always sharded
|
|
9240
9463
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -9267,9 +9490,12 @@ var codexCredentialLeases = pgTable19(
|
|
|
9267
9490
|
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
9268
9491
|
credentialId: uuid19("credential_id").notNull(),
|
|
9269
9492
|
turnId: uuid19("turn_id").notNull(),
|
|
9270
|
-
//
|
|
9271
|
-
// durable turn
|
|
9272
|
-
//
|
|
9493
|
+
// Durable turn-attempt fence. The worker holder includes the
|
|
9494
|
+
// durable workflow turn-attempt identity; dispatchId remains a separate
|
|
9495
|
+
// attempt/audit identity. A successor dispatch for the same durable turn
|
|
9496
|
+
// replaces holderId and increments generation atomically; stale/zombie
|
|
9497
|
+
// heartbeats and releases must match both values. Generation may restart
|
|
9498
|
+
// at 1 after an expired row is reaped, so holder identity cannot be reused.
|
|
9273
9499
|
holderId: text19("holder_id").notNull(),
|
|
9274
9500
|
generation: integer18("generation").notNull().default(1),
|
|
9275
9501
|
leasedUntil: timestamp19("leased_until", { withTimezone: true }).notNull(),
|
|
@@ -9282,7 +9508,6 @@ var codexCredentialLeases = pgTable19(
|
|
|
9282
9508
|
table.turnId
|
|
9283
9509
|
),
|
|
9284
9510
|
activeCredential: index19("codex_credential_leases_active_credential_idx").on(
|
|
9285
|
-
table.workspaceId,
|
|
9286
9511
|
table.credentialId,
|
|
9287
9512
|
table.leasedUntil
|
|
9288
9513
|
),
|
|
@@ -9637,6 +9862,14 @@ var sessions = pgTable19(
|
|
|
9637
9862
|
nestedAgentDepthPolicySessionId: uuid19("nested_agent_depth_policy_session_id"),
|
|
9638
9863
|
temporalWorkflowId: text19("temporal_workflow_id"),
|
|
9639
9864
|
activeTurnId: uuid19("active_turn_id"),
|
|
9865
|
+
// Session-scoped out-of-turn wait (`wait_for_input`). The exact declaring
|
|
9866
|
+
// turn and absolute deadline are durable PostgreSQL authority; workflow
|
|
9867
|
+
// signals and timers only nudge reevaluation. A newer finished turn or a
|
|
9868
|
+
// terminal timeout input retires all four fields together.
|
|
9869
|
+
inputWaitTurnId: uuid19("input_wait_turn_id"),
|
|
9870
|
+
inputWaitUntil: timestamp19("input_wait_until", { withTimezone: true }),
|
|
9871
|
+
inputWaitReason: text19("input_wait_reason"),
|
|
9872
|
+
inputWaitSetAt: timestamp19("input_wait_set_at", { withTimezone: true }),
|
|
9640
9873
|
// Actual input tokens reported for the latest authoritative ordinary model
|
|
9641
9874
|
// call. Compaction/context clearing invalidates it to null; local history
|
|
9642
9875
|
// estimates must never be stored here.
|
|
@@ -9789,6 +10022,21 @@ var sessions = pgTable19(
|
|
|
9789
10022
|
"sessions_initial_model_context_check",
|
|
9790
10023
|
sql16`${table.initialModelContext} is null
|
|
9791
10024
|
or opengeni_private.model_context_value_valid(${table.initialModelContext})`
|
|
10025
|
+
),
|
|
10026
|
+
inputWaitValid: check11(
|
|
10027
|
+
"sessions_input_wait_check",
|
|
10028
|
+
sql16`(
|
|
10029
|
+
${table.inputWaitTurnId} is null
|
|
10030
|
+
and ${table.inputWaitUntil} is null
|
|
10031
|
+
and ${table.inputWaitReason} is null
|
|
10032
|
+
and ${table.inputWaitSetAt} is null
|
|
10033
|
+
) or (
|
|
10034
|
+
${table.inputWaitTurnId} is not null
|
|
10035
|
+
and ${table.inputWaitUntil} is not null
|
|
10036
|
+
and ${table.inputWaitReason} is not null
|
|
10037
|
+
and octet_length(btrim(${table.inputWaitReason})) between 1 and 2048
|
|
10038
|
+
and ${table.inputWaitSetAt} is not null
|
|
10039
|
+
)`
|
|
9792
10040
|
)
|
|
9793
10041
|
})
|
|
9794
10042
|
);
|
|
@@ -11602,7 +11850,9 @@ var turnPersonalResourceSnapshots = pgTable19(
|
|
|
11602
11850
|
mode: "number"
|
|
11603
11851
|
}).notNull(),
|
|
11604
11852
|
authorityId: uuid19("authority_id").notNull(),
|
|
11605
|
-
authorityGeneration: bigint14("authority_generation", {
|
|
11853
|
+
authorityGeneration: bigint14("authority_generation", {
|
|
11854
|
+
mode: "number"
|
|
11855
|
+
}).notNull(),
|
|
11606
11856
|
grantId: uuid19("grant_id").notNull(),
|
|
11607
11857
|
grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
|
|
11608
11858
|
grantMode: text19("grant_mode").notNull(),
|
|
@@ -11614,7 +11864,9 @@ var turnPersonalResourceSnapshots = pgTable19(
|
|
|
11614
11864
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
11615
11865
|
},
|
|
11616
11866
|
(table) => ({
|
|
11617
|
-
pk: primaryKey8({
|
|
11867
|
+
pk: primaryKey8({
|
|
11868
|
+
columns: [table.turnId, table.resourceKind, table.resourceId]
|
|
11869
|
+
}),
|
|
11618
11870
|
receipt: foreignKey({
|
|
11619
11871
|
name: "turn_personal_resource_snapshots_receipt_fk",
|
|
11620
11872
|
columns: [table.turnId],
|
|
@@ -11661,7 +11913,9 @@ var turnPersonalResourceOnceReceipts = pgTable19(
|
|
|
11661
11913
|
turnId: uuid19("turn_id").notNull(),
|
|
11662
11914
|
accountId: uuid19("account_id").notNull(),
|
|
11663
11915
|
authorityId: uuid19("authority_id").notNull(),
|
|
11664
|
-
authorityGeneration: bigint14("authority_generation", {
|
|
11916
|
+
authorityGeneration: bigint14("authority_generation", {
|
|
11917
|
+
mode: "number"
|
|
11918
|
+
}).notNull(),
|
|
11665
11919
|
grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
|
|
11666
11920
|
consumedAt: timestamp19("consumed_at", { withTimezone: true }).notNull().defaultNow()
|
|
11667
11921
|
},
|
|
@@ -11925,7 +12179,9 @@ var turnConnectionAuthoritySnapshots = pgTable19(
|
|
|
11925
12179
|
turnId: uuid19("turn_id").notNull(),
|
|
11926
12180
|
serverId: text19("server_id").notNull(),
|
|
11927
12181
|
connectionId: uuid19("connection_id").notNull(),
|
|
11928
|
-
connectionGeneration: bigint14("connection_generation", {
|
|
12182
|
+
connectionGeneration: bigint14("connection_generation", {
|
|
12183
|
+
mode: "number"
|
|
12184
|
+
}).notNull(),
|
|
11929
12185
|
originWorkspaceId: uuid19("origin_workspace_id").notNull(),
|
|
11930
12186
|
providerDomain: text19("provider_domain").notNull(),
|
|
11931
12187
|
connectionKind: text19("connection_kind").notNull(),
|
|
@@ -12118,6 +12374,58 @@ var sessionAttemptToolCatalogs = pgTable19(
|
|
|
12118
12374
|
)
|
|
12119
12375
|
})
|
|
12120
12376
|
);
|
|
12377
|
+
var sessionAttemptModelContextSnapshots = pgTable19(
|
|
12378
|
+
"session_attempt_model_context_snapshots",
|
|
12379
|
+
{
|
|
12380
|
+
attemptId: uuid19("attempt_id").primaryKey(),
|
|
12381
|
+
accountId: uuid19("account_id").notNull(),
|
|
12382
|
+
workspaceId: uuid19("workspace_id").notNull(),
|
|
12383
|
+
sessionId: uuid19("session_id").notNull(),
|
|
12384
|
+
turnId: uuid19("turn_id").notNull(),
|
|
12385
|
+
executionGeneration: integer18("execution_generation").notNull(),
|
|
12386
|
+
requestIndex: integer18("request_index").notNull(),
|
|
12387
|
+
capturedAt: timestamp19("captured_at", { withTimezone: true }).notNull(),
|
|
12388
|
+
snapshot: jsonb15("snapshot").$type().notNull(),
|
|
12389
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull(),
|
|
12390
|
+
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull()
|
|
12391
|
+
},
|
|
12392
|
+
(table) => ({
|
|
12393
|
+
attemptOwner: foreignKey({
|
|
12394
|
+
name: "session_attempt_model_context_snapshots_attempt_owner_fk",
|
|
12395
|
+
columns: [table.accountId, table.workspaceId, table.sessionId, table.turnId, table.attemptId],
|
|
12396
|
+
foreignColumns: [
|
|
12397
|
+
sessionTurnAttempts.accountId,
|
|
12398
|
+
sessionTurnAttempts.workspaceId,
|
|
12399
|
+
sessionTurnAttempts.sessionId,
|
|
12400
|
+
sessionTurnAttempts.turnId,
|
|
12401
|
+
sessionTurnAttempts.id
|
|
12402
|
+
]
|
|
12403
|
+
}).onDelete("cascade"),
|
|
12404
|
+
sessionLatest: index19("session_attempt_model_context_snapshots_session_idx").on(
|
|
12405
|
+
table.workspaceId,
|
|
12406
|
+
table.sessionId,
|
|
12407
|
+
table.capturedAt.desc()
|
|
12408
|
+
),
|
|
12409
|
+
requestIndexValid: check11(
|
|
12410
|
+
"session_attempt_model_context_snapshots_request_index_check",
|
|
12411
|
+
sql16`${table.requestIndex} > 0 and ${table.executionGeneration} > 0`
|
|
12412
|
+
),
|
|
12413
|
+
snapshotSize: check11(
|
|
12414
|
+
"session_attempt_model_context_snapshots_size_check",
|
|
12415
|
+
sql16`octet_length(${table.snapshot}::text) between 2 and 16777216`
|
|
12416
|
+
),
|
|
12417
|
+
snapshotIdentity: check11(
|
|
12418
|
+
"session_attempt_model_context_snapshots_identity_check",
|
|
12419
|
+
sql16`jsonb_typeof(${table.snapshot}) = 'object'
|
|
12420
|
+
and ${table.snapshot} ?& array['version', 'capturedAt', 'source', 'requestIndex', 'instructions', 'layers', 'tools', 'skills', 'tokens']::text[]
|
|
12421
|
+
and (${table.snapshot}->>'version')::integer = 1
|
|
12422
|
+
and ${table.snapshot}->>'source' = 'model_request'
|
|
12423
|
+
and jsonb_typeof(${table.snapshot}->'layers') = 'array'
|
|
12424
|
+
and jsonb_typeof(${table.snapshot}->'tools') = 'array'
|
|
12425
|
+
and jsonb_typeof(${table.snapshot}->'skills') = 'array'`
|
|
12426
|
+
)
|
|
12427
|
+
})
|
|
12428
|
+
);
|
|
12121
12429
|
var sessionAttemptCodemodeCalls = pgTable19(
|
|
12122
12430
|
"session_attempt_codemode_calls",
|
|
12123
12431
|
{
|
|
@@ -12429,7 +12737,15 @@ var sessionCommandReceipts = pgTable19(
|
|
|
12429
12737
|
table.targetSessionId,
|
|
12430
12738
|
table.createdAt
|
|
12431
12739
|
),
|
|
12740
|
+
promptActorOperation: index19("session_command_receipts_prompt_actor_operation_idx").on(
|
|
12741
|
+
table.workspaceId,
|
|
12742
|
+
table.actorType,
|
|
12743
|
+
table.actorSubjectId,
|
|
12744
|
+
table.actorAttemptId,
|
|
12745
|
+
table.operationKey
|
|
12746
|
+
).where(sql16`${table.action} in ('prompt.send', 'prompt.steer')`),
|
|
12432
12747
|
goalUpdateOperation: uniqueIndex19("session_command_receipts_goal_update_operation_uq").on(table.workspaceId, table.action, table.targetSessionId, table.operationKey).where(sql16`${table.action} = 'goal.update'`),
|
|
12748
|
+
waitForInputOperation: uniqueIndex19("session_command_receipts_wait_for_input_operation_uq").on(table.workspaceId, table.action, table.targetSessionId, table.operationKey).where(sql16`${table.action} = 'session.wait_for_input'`),
|
|
12433
12749
|
actorValid: check11(
|
|
12434
12750
|
"session_command_receipts_actor_check",
|
|
12435
12751
|
sql16`(
|
|
@@ -12674,7 +12990,7 @@ var sessionSystemUpdates = pgTable19(
|
|
|
12674
12990
|
(table) => ({
|
|
12675
12991
|
kindValid: check11(
|
|
12676
12992
|
"system_updates_kind_check",
|
|
12677
|
-
sql16`${table.kind} in ('scheduled_occurrence', 'goal_continuation', 'agent_message', 'agent_steer_instruction', 'child_terminal_result', 'media_generation_result', 'child_requires_action', 'child_requires_action_resolved', 'child_paused', 'child_waiting_capacity', 'child_progress')`
|
|
12993
|
+
sql16`${table.kind} in ('scheduled_occurrence', 'goal_continuation', 'agent_message', 'agent_steer_instruction', 'session_wait_timeout', 'background_command_result', 'child_terminal_result', 'media_generation_result', 'child_requires_action', 'child_requires_action_resolved', 'child_paused', 'child_waiting_capacity', 'child_progress')`
|
|
12678
12994
|
),
|
|
12679
12995
|
payloadKindValid: check11(
|
|
12680
12996
|
"system_updates_payload_kind_check",
|
|
@@ -12845,15 +13161,10 @@ var sessionGoals = pgTable19(
|
|
|
12845
13161
|
continuationObservedRevision: bigint14("continuation_observed_revision", {
|
|
12846
13162
|
mode: "number"
|
|
12847
13163
|
}).notNull().default(0),
|
|
12848
|
-
//
|
|
12849
|
-
//
|
|
12850
|
-
// the
|
|
12851
|
-
|
|
12852
|
-
// four columns together.
|
|
12853
|
-
continuationHoldTurnId: uuid19("continuation_hold_turn_id"),
|
|
12854
|
-
continuationHoldUntil: timestamp19("continuation_hold_until", { withTimezone: true }),
|
|
12855
|
-
continuationHoldReason: text19("continuation_hold_reason"),
|
|
12856
|
-
continuationHoldSetAt: timestamp19("continuation_hold_set_at", { withTimezone: true }),
|
|
13164
|
+
// A terminal condition can keep the goal active while making unchanged
|
|
13165
|
+
// autonomous input unsafe. The fence is honored only while this remains
|
|
13166
|
+
// the newest finished turn; newer work or a goal mutation clears it.
|
|
13167
|
+
continuationSuppressedTurnId: uuid19("continuation_suppressed_turn_id"),
|
|
12857
13168
|
metadata: jsonb15("metadata").$type().notNull().default({}),
|
|
12858
13169
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
12859
13170
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -12871,10 +13182,6 @@ var sessionGoals = pgTable19(
|
|
|
12871
13182
|
continuationRevisionValid: check11(
|
|
12872
13183
|
"session_goals_continuation_revision_check",
|
|
12873
13184
|
sql16`${table.continuationWakeRevision} >= 0 and ${table.continuationObservedRevision} >= 0 and ${table.continuationObservedRevision} <= ${table.continuationWakeRevision} and ${table.continuationWakeRevision} <= 9007199254740991 and ${table.continuationObservedRevision} <= 9007199254740991`
|
|
12874
|
-
),
|
|
12875
|
-
continuationHoldValid: check11(
|
|
12876
|
-
"session_goals_continuation_hold_check",
|
|
12877
|
-
sql16`(${table.continuationHoldTurnId} is null and ${table.continuationHoldUntil} is null and ${table.continuationHoldReason} is null and ${table.continuationHoldSetAt} is null) or (${table.continuationHoldTurnId} is not null and ${table.continuationHoldUntil} is not null and ${table.continuationHoldSetAt} is not null and (${table.continuationHoldReason} is null or octet_length(${table.continuationHoldReason}) <= 2048))`
|
|
12878
13185
|
)
|
|
12879
13186
|
})
|
|
12880
13187
|
);
|
|
@@ -12988,7 +13295,7 @@ var codexCapacityWaiters = pgTable19(
|
|
|
12988
13295
|
earliestResetAt: timestamp19("earliest_reset_at", { withTimezone: true }),
|
|
12989
13296
|
nextCheckAt: timestamp19("next_check_at", { withTimezone: true }).notNull(),
|
|
12990
13297
|
resetKind: text19("reset_kind").notNull(),
|
|
12991
|
-
// authoritative | bounded_refresh
|
|
13298
|
+
// authoritative | bounded_refresh | mutation_only
|
|
12992
13299
|
refreshAttempt: integer18("refresh_attempt").notNull().default(0),
|
|
12993
13300
|
// Coalescing outbox generation. Every eligibility-affecting mutation bumps
|
|
12994
13301
|
// wakeRevision. Duplicate/lost Temporal signals are harmless because only
|
|
@@ -13925,7 +14232,9 @@ var sandboxWorkspaceMutationAdmissions = pgTable19(
|
|
|
13925
14232
|
// authorization revision observed at admission. The revision is audit
|
|
13926
14233
|
// evidence: a role change is not a revocation and must not fence a writer.
|
|
13927
14234
|
initiatorOrganizationMembershipId: uuid19("initiator_organization_membership_id"),
|
|
13928
|
-
initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
|
|
14235
|
+
initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
|
|
14236
|
+
mode: "number"
|
|
14237
|
+
}),
|
|
13929
14238
|
// Session tenancy authority observed when the operation was admitted; the
|
|
13930
14239
|
// same triple `session_turn_attempts` freezes for a turn.
|
|
13931
14240
|
authorityEpoch: integer18("authority_epoch"),
|
|
@@ -14134,7 +14443,9 @@ var sandboxRetainedProcesses = pgTable19(
|
|
|
14134
14443
|
initiatorSubjectId: text19("initiator_subject_id").notNull().default("unattributed-legacy"),
|
|
14135
14444
|
initiatingHumanSubjectId: text19("initiating_human_subject_id"),
|
|
14136
14445
|
initiatorOrganizationMembershipId: uuid19("initiator_organization_membership_id"),
|
|
14137
|
-
initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
|
|
14446
|
+
initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
|
|
14447
|
+
mode: "number"
|
|
14448
|
+
}),
|
|
14138
14449
|
authorityEpoch: integer18("authority_epoch"),
|
|
14139
14450
|
authorityVisibility: text19("authority_visibility", {
|
|
14140
14451
|
enum: ["user_private", "workspace_shared"]
|
|
@@ -14380,7 +14691,9 @@ var sessionBackgroundCommands = pgTable19(
|
|
|
14380
14691
|
accountId: uuid19("account_id").notNull(),
|
|
14381
14692
|
workspaceId: uuid19("workspace_id").notNull(),
|
|
14382
14693
|
sessionId: uuid19("session_id").notNull(),
|
|
14383
|
-
provider: text19("provider", {
|
|
14694
|
+
provider: text19("provider", {
|
|
14695
|
+
enum: ["managed", "connected_machine"]
|
|
14696
|
+
}).notNull(),
|
|
14384
14697
|
state: text19("state", { enum: ["running", "stopping", "exited", "lost"] }).notNull().default("running"),
|
|
14385
14698
|
retainedProcessId: uuid19("retained_process_id"),
|
|
14386
14699
|
controlWorkspaceId: uuid19("control_workspace_id"),
|
|
@@ -14396,13 +14709,19 @@ var sessionBackgroundCommands = pgTable19(
|
|
|
14396
14709
|
settledAt: timestamp19("settled_at", { withTimezone: true }),
|
|
14397
14710
|
reconcileAfter: timestamp19("reconcile_after", { withTimezone: true }).notNull().defaultNow(),
|
|
14398
14711
|
reconcileClaimId: uuid19("reconcile_claim_id"),
|
|
14399
|
-
reconcileClaimedAt: timestamp19("reconcile_claimed_at", {
|
|
14712
|
+
reconcileClaimedAt: timestamp19("reconcile_claimed_at", {
|
|
14713
|
+
withTimezone: true
|
|
14714
|
+
}),
|
|
14400
14715
|
reconcileAttempts: integer18("reconcile_attempts").notNull().default(0),
|
|
14401
14716
|
lastReconcileOutcome: text19("last_reconcile_outcome"),
|
|
14402
|
-
reconcileProofOutcome: text19("reconcile_proof_outcome", {
|
|
14717
|
+
reconcileProofOutcome: text19("reconcile_proof_outcome", {
|
|
14718
|
+
enum: ["exited", "lost"]
|
|
14719
|
+
}),
|
|
14403
14720
|
reconcileProofExitCode: integer18("reconcile_proof_exit_code"),
|
|
14404
14721
|
reconcileProofReason: text19("reconcile_proof_reason"),
|
|
14405
|
-
reconcileProofObservedAt: timestamp19("reconcile_proof_observed_at", {
|
|
14722
|
+
reconcileProofObservedAt: timestamp19("reconcile_proof_observed_at", {
|
|
14723
|
+
withTimezone: true
|
|
14724
|
+
}),
|
|
14406
14725
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
14407
14726
|
},
|
|
14408
14727
|
(table) => ({
|
|
@@ -15420,12 +15739,18 @@ var prReviewAppRegistrations = pgTable19(
|
|
|
15420
15739
|
providerAccountType: text19("provider_account_type"),
|
|
15421
15740
|
githubActorId: text19("github_actor_id"),
|
|
15422
15741
|
authorityKind: text19("authority_kind"),
|
|
15423
|
-
authorityCheckedAt: timestamp19("authority_checked_at", {
|
|
15424
|
-
|
|
15742
|
+
authorityCheckedAt: timestamp19("authority_checked_at", {
|
|
15743
|
+
withTimezone: true
|
|
15744
|
+
}),
|
|
15745
|
+
authorityExpiresAt: timestamp19("authority_expires_at", {
|
|
15746
|
+
withTimezone: true
|
|
15747
|
+
}),
|
|
15425
15748
|
authorityNonce: text19("authority_nonce"),
|
|
15426
15749
|
credentialKind: text19("credential_kind").notNull(),
|
|
15427
15750
|
credentialEncrypted: text19("credential_encrypted"),
|
|
15428
|
-
accessTokenExpiresAt: timestamp19("access_token_expires_at", {
|
|
15751
|
+
accessTokenExpiresAt: timestamp19("access_token_expires_at", {
|
|
15752
|
+
withTimezone: true
|
|
15753
|
+
}),
|
|
15429
15754
|
webhookAuthKind: text19("webhook_auth_kind").notNull(),
|
|
15430
15755
|
webhookUsername: text19("webhook_username"),
|
|
15431
15756
|
status: text19("status").notNull().default("active"),
|
|
@@ -15554,7 +15879,9 @@ var prReviewManagedGithubAuthorityNonces = pgTable19(
|
|
|
15554
15879
|
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
15555
15880
|
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
15556
15881
|
installationId: text19("installation_id").notNull(),
|
|
15557
|
-
authorityExpiresAt: timestamp19("authority_expires_at", {
|
|
15882
|
+
authorityExpiresAt: timestamp19("authority_expires_at", {
|
|
15883
|
+
withTimezone: true
|
|
15884
|
+
}).notNull(),
|
|
15558
15885
|
consumedAt: timestamp19("consumed_at", { withTimezone: true }).notNull().defaultNow()
|
|
15559
15886
|
},
|
|
15560
15887
|
(table) => ({
|
|
@@ -15710,6 +16037,9 @@ var modelCallFacts = pgTable19(
|
|
|
15710
16037
|
estimatedProviderCostMicros: bigint14("estimated_provider_cost_micros", {
|
|
15711
16038
|
mode: "number"
|
|
15712
16039
|
}),
|
|
16040
|
+
equivalentCreditCostMicros: bigint14("equivalent_credit_cost_micros", {
|
|
16041
|
+
mode: "number"
|
|
16042
|
+
}),
|
|
15713
16043
|
pricingSource: text19("pricing_source"),
|
|
15714
16044
|
contextContributions: jsonb15("context_contributions").$type(),
|
|
15715
16045
|
occurredAt: timestamp19("occurred_at", { withTimezone: true }).notNull(),
|
|
@@ -15751,6 +16081,10 @@ var modelCallFacts = pgTable19(
|
|
|
15751
16081
|
"model_call_facts_estimated_provider_cost_check",
|
|
15752
16082
|
sql16`${table.estimatedProviderCostMicros} is null or ${table.estimatedProviderCostMicros} >= 0`
|
|
15753
16083
|
),
|
|
16084
|
+
equivalentCreditCostValid: check11(
|
|
16085
|
+
"model_call_facts_equivalent_credit_cost_check",
|
|
16086
|
+
sql16`${table.equivalentCreditCostMicros} is null or (${table.equivalentCreditCostMicros} >= 0 and ${table.estimatedProviderCostMicros} is not null)`
|
|
16087
|
+
),
|
|
15754
16088
|
pricingSourceValid: check11(
|
|
15755
16089
|
"model_call_facts_pricing_source_check",
|
|
15756
16090
|
sql16`(${table.estimatedProviderCostMicros} is null and ${table.pricingSource} is null)
|
|
@@ -16331,7 +16665,9 @@ var automationRuns = pgTable19(
|
|
|
16331
16665
|
occurrenceKey: text19("occurrence_key").notNull(),
|
|
16332
16666
|
acceptedExecution: jsonb15("accepted_execution").$type().notNull(),
|
|
16333
16667
|
status: text19("status").notNull().default("queued"),
|
|
16334
|
-
sessionId: uuid19("session_id").references(() => sessions.id, {
|
|
16668
|
+
sessionId: uuid19("session_id").references(() => sessions.id, {
|
|
16669
|
+
onDelete: "set null"
|
|
16670
|
+
}),
|
|
16335
16671
|
errorCode: text19("error_code"),
|
|
16336
16672
|
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
16337
16673
|
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
@@ -17176,6 +17512,225 @@ var rigChanges = pgTable19(
|
|
|
17176
17512
|
workspaceStatus: index19("rig_changes_workspace_status_idx").on(table.workspaceId, table.status)
|
|
17177
17513
|
})
|
|
17178
17514
|
);
|
|
17515
|
+
var deploymentModelCatalog = pgTable19(
|
|
17516
|
+
"deployment_model_catalog",
|
|
17517
|
+
{
|
|
17518
|
+
singleton: boolean11("singleton").primaryKey().notNull().default(true),
|
|
17519
|
+
document: jsonb15("document").$type().notNull(),
|
|
17520
|
+
version: bigint14("version", { mode: "number" }).notNull().default(1),
|
|
17521
|
+
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
17522
|
+
},
|
|
17523
|
+
(table) => ({
|
|
17524
|
+
singletonCheck: check11("deployment_model_catalog_singleton_chk", sql16`${table.singleton}`),
|
|
17525
|
+
documentCheck: check11(
|
|
17526
|
+
"deployment_model_catalog_document_chk",
|
|
17527
|
+
sql16`jsonb_typeof(${table.document}) = 'object'`
|
|
17528
|
+
),
|
|
17529
|
+
versionCheck: check11("deployment_model_catalog_version_chk", sql16`${table.version} > 0`)
|
|
17530
|
+
})
|
|
17531
|
+
);
|
|
17532
|
+
var workspaceGatewayCustomModels = pgTable19(
|
|
17533
|
+
"workspace_gateway_custom_models",
|
|
17534
|
+
{
|
|
17535
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
17536
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
17537
|
+
workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
|
|
17538
|
+
providerKind: text19("provider_kind").$type().notNull(),
|
|
17539
|
+
upstreamModelId: text19("upstream_model_id").notNull(),
|
|
17540
|
+
label: text19("label"),
|
|
17541
|
+
version: integer18("version").notNull().default(1),
|
|
17542
|
+
createOperationId: uuid19("create_operation_id").notNull(),
|
|
17543
|
+
createRequestHash: text19("create_request_hash").notNull(),
|
|
17544
|
+
deleteOperationId: uuid19("delete_operation_id"),
|
|
17545
|
+
deleteRequestHash: text19("delete_request_hash"),
|
|
17546
|
+
createdBySubjectId: text19("created_by_subject_id").notNull(),
|
|
17547
|
+
retiredAt: timestamp19("retired_at", { withTimezone: true }),
|
|
17548
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
17549
|
+
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
17550
|
+
},
|
|
17551
|
+
(table) => ({
|
|
17552
|
+
workspaceAccountFk: foreignKey({
|
|
17553
|
+
name: "workspace_gateway_custom_models_workspace_account_fk",
|
|
17554
|
+
columns: [table.workspaceId, table.accountId],
|
|
17555
|
+
foreignColumns: [workspaces.id, workspaces.accountId]
|
|
17556
|
+
}).onDelete("cascade"),
|
|
17557
|
+
workspaceUpstream: uniqueIndex19("workspace_gateway_custom_models_workspace_upstream_uq").on(table.workspaceId, table.providerKind, table.upstreamModelId).where(sql16`${table.retiredAt} is null`),
|
|
17558
|
+
createOperation: uniqueIndex19("workspace_gateway_custom_models_create_operation_uq").on(
|
|
17559
|
+
table.workspaceId,
|
|
17560
|
+
table.providerKind,
|
|
17561
|
+
table.createOperationId
|
|
17562
|
+
),
|
|
17563
|
+
deleteOperation: uniqueIndex19("workspace_gateway_custom_models_delete_operation_uq").on(table.workspaceId, table.providerKind, table.deleteOperationId).where(sql16`${table.deleteOperationId} is not null`),
|
|
17564
|
+
providerKindCheck: check11(
|
|
17565
|
+
"workspace_gateway_custom_models_provider_kind_chk",
|
|
17566
|
+
sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
|
|
17567
|
+
),
|
|
17568
|
+
upstreamCheck: check11(
|
|
17569
|
+
"workspace_gateway_custom_models_upstream_chk",
|
|
17570
|
+
sql16`octet_length(${table.upstreamModelId}) between 1 and 238 and ${table.upstreamModelId} ~ '^[!-~]+$' and ${table.upstreamModelId} !~ '[|]'`
|
|
17571
|
+
),
|
|
17572
|
+
labelCheck: check11(
|
|
17573
|
+
"workspace_gateway_custom_models_label_chk",
|
|
17574
|
+
sql16`${table.label} is null or (octet_length(${table.label}) between 1 and 128 and ${table.label} !~ '[\r\n|]')`
|
|
17575
|
+
),
|
|
17576
|
+
actorCheck: check11(
|
|
17577
|
+
"workspace_gateway_custom_models_actor_chk",
|
|
17578
|
+
sql16`octet_length(${table.createdBySubjectId}) between 1 and 1024`
|
|
17579
|
+
),
|
|
17580
|
+
versionCheck: check11("workspace_gateway_custom_models_version_chk", sql16`${table.version} > 0`),
|
|
17581
|
+
createHashCheck: check11(
|
|
17582
|
+
"workspace_gateway_custom_models_create_hash_chk",
|
|
17583
|
+
sql16`${table.createRequestHash} ~ '^[a-f0-9]{64}$'`
|
|
17584
|
+
),
|
|
17585
|
+
deleteReceiptCheck: check11(
|
|
17586
|
+
"workspace_gateway_custom_models_delete_receipt_chk",
|
|
17587
|
+
sql16`(${table.deleteOperationId} is null and ${table.deleteRequestHash} is null) or (${table.deleteOperationId} is not null and ${table.deleteRequestHash} ~ '^[a-f0-9]{64}$' and ${table.retiredAt} is not null)`
|
|
17588
|
+
)
|
|
17589
|
+
})
|
|
17590
|
+
);
|
|
17591
|
+
var organizationModelProviderConnections = pgTable19(
|
|
17592
|
+
"organization_model_provider_connections",
|
|
17593
|
+
{
|
|
17594
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
17595
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
17596
|
+
providerKind: text19("provider_kind").$type().notNull(),
|
|
17597
|
+
status: text19("status").$type().notNull().default("active"),
|
|
17598
|
+
credentialEncrypted: text19("credential_encrypted").notNull(),
|
|
17599
|
+
version: integer18("version").notNull().default(1),
|
|
17600
|
+
operationId: uuid19("operation_id").notNull(),
|
|
17601
|
+
requestHash: text19("request_hash").notNull(),
|
|
17602
|
+
updatedBySubjectId: text19("updated_by_subject_id").notNull(),
|
|
17603
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
17604
|
+
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
17605
|
+
},
|
|
17606
|
+
(table) => ({
|
|
17607
|
+
accountProvider: uniqueIndex19("organization_model_provider_connections_account_provider_uq").on(
|
|
17608
|
+
table.accountId,
|
|
17609
|
+
table.providerKind
|
|
17610
|
+
),
|
|
17611
|
+
operation: uniqueIndex19("organization_model_provider_connections_operation_uq").on(
|
|
17612
|
+
table.accountId,
|
|
17613
|
+
table.providerKind,
|
|
17614
|
+
table.operationId
|
|
17615
|
+
),
|
|
17616
|
+
providerKindCheck: check11(
|
|
17617
|
+
"organization_model_provider_connections_provider_kind_chk",
|
|
17618
|
+
sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
|
|
17619
|
+
),
|
|
17620
|
+
statusCheck: check11(
|
|
17621
|
+
"organization_model_provider_connections_status_chk",
|
|
17622
|
+
sql16`${table.status} in ('active', 'revoked')`
|
|
17623
|
+
),
|
|
17624
|
+
versionCheck: check11(
|
|
17625
|
+
"organization_model_provider_connections_version_chk",
|
|
17626
|
+
sql16`${table.version} > 0`
|
|
17627
|
+
),
|
|
17628
|
+
requestHashCheck: check11(
|
|
17629
|
+
"organization_model_provider_connections_request_hash_chk",
|
|
17630
|
+
sql16`${table.requestHash} ~ '^[a-f0-9]{64}$'`
|
|
17631
|
+
),
|
|
17632
|
+
actorCheck: check11(
|
|
17633
|
+
"organization_model_provider_connections_actor_chk",
|
|
17634
|
+
sql16`octet_length(${table.updatedBySubjectId}) between 1 and 1024`
|
|
17635
|
+
)
|
|
17636
|
+
})
|
|
17637
|
+
);
|
|
17638
|
+
var organizationModelProviderConnectionOperations = pgTable19(
|
|
17639
|
+
"organization_model_provider_connection_operations",
|
|
17640
|
+
{
|
|
17641
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
17642
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
17643
|
+
providerKind: text19("provider_kind").$type().notNull(),
|
|
17644
|
+
operationId: uuid19("operation_id").notNull(),
|
|
17645
|
+
requestHash: text19("request_hash").notNull(),
|
|
17646
|
+
resultStatus: text19("result_status").$type().notNull(),
|
|
17647
|
+
resultVersion: integer18("result_version").notNull(),
|
|
17648
|
+
resultCreatedAt: timestamp19("result_created_at", {
|
|
17649
|
+
withTimezone: true
|
|
17650
|
+
}).notNull(),
|
|
17651
|
+
resultUpdatedAt: timestamp19("result_updated_at", {
|
|
17652
|
+
withTimezone: true
|
|
17653
|
+
}).notNull(),
|
|
17654
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
17655
|
+
},
|
|
17656
|
+
(table) => ({
|
|
17657
|
+
operation: uniqueIndex19("organization_model_provider_connection_operations_operation_uq").on(
|
|
17658
|
+
table.accountId,
|
|
17659
|
+
table.providerKind,
|
|
17660
|
+
table.operationId
|
|
17661
|
+
),
|
|
17662
|
+
providerKindCheck: check11(
|
|
17663
|
+
"organization_model_provider_connection_operations_provider_kind_chk",
|
|
17664
|
+
sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
|
|
17665
|
+
),
|
|
17666
|
+
resultStatusCheck: check11(
|
|
17667
|
+
"organization_model_provider_connection_operations_result_status_chk",
|
|
17668
|
+
sql16`${table.resultStatus} in ('active', 'revoked')`
|
|
17669
|
+
),
|
|
17670
|
+
resultVersionCheck: check11(
|
|
17671
|
+
"organization_model_provider_connection_operations_result_version_chk",
|
|
17672
|
+
sql16`${table.resultVersion} > 0`
|
|
17673
|
+
),
|
|
17674
|
+
requestHashCheck: check11(
|
|
17675
|
+
"organization_model_provider_connection_operations_request_hash_chk",
|
|
17676
|
+
sql16`${table.requestHash} ~ '^[a-f0-9]{64}$'`
|
|
17677
|
+
)
|
|
17678
|
+
})
|
|
17679
|
+
);
|
|
17680
|
+
var organizationModelProviderCustomModels = pgTable19(
|
|
17681
|
+
"organization_model_provider_custom_models",
|
|
17682
|
+
{
|
|
17683
|
+
id: uuid19("id").primaryKey().defaultRandom(),
|
|
17684
|
+
accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
|
|
17685
|
+
providerKind: text19("provider_kind").$type().notNull(),
|
|
17686
|
+
upstreamModelId: text19("upstream_model_id").notNull(),
|
|
17687
|
+
label: text19("label"),
|
|
17688
|
+
version: integer18("version").notNull().default(1),
|
|
17689
|
+
createOperationId: uuid19("create_operation_id").notNull(),
|
|
17690
|
+
createRequestHash: text19("create_request_hash").notNull(),
|
|
17691
|
+
deleteOperationId: uuid19("delete_operation_id"),
|
|
17692
|
+
deleteRequestHash: text19("delete_request_hash"),
|
|
17693
|
+
createdBySubjectId: text19("created_by_subject_id").notNull(),
|
|
17694
|
+
retiredAt: timestamp19("retired_at", { withTimezone: true }),
|
|
17695
|
+
createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
17696
|
+
updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
17697
|
+
},
|
|
17698
|
+
(table) => ({
|
|
17699
|
+
accountUpstream: uniqueIndex19("organization_model_provider_custom_models_active_uq").on(table.accountId, table.providerKind, table.upstreamModelId).where(sql16`${table.retiredAt} is null`),
|
|
17700
|
+
createOperation: uniqueIndex19(
|
|
17701
|
+
"organization_model_provider_custom_models_create_operation_uq"
|
|
17702
|
+
).on(table.accountId, table.providerKind, table.createOperationId),
|
|
17703
|
+
deleteOperation: uniqueIndex19("organization_model_provider_custom_models_delete_operation_uq").on(table.accountId, table.providerKind, table.deleteOperationId).where(sql16`${table.deleteOperationId} is not null`),
|
|
17704
|
+
providerKindCheck: check11(
|
|
17705
|
+
"organization_model_provider_custom_models_provider_kind_chk",
|
|
17706
|
+
sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
|
|
17707
|
+
),
|
|
17708
|
+
upstreamCheck: check11(
|
|
17709
|
+
"organization_model_provider_custom_models_upstream_chk",
|
|
17710
|
+
sql16`octet_length(${table.upstreamModelId}) between 1 and 238 and ${table.upstreamModelId} ~ '^[!-~]+$' and ${table.upstreamModelId} !~ '[|]'`
|
|
17711
|
+
),
|
|
17712
|
+
labelCheck: check11(
|
|
17713
|
+
"organization_model_provider_custom_models_label_chk",
|
|
17714
|
+
sql16`${table.label} is null or (octet_length(${table.label}) between 1 and 128 and ${table.label} !~ '[\r\n|]')`
|
|
17715
|
+
),
|
|
17716
|
+
versionCheck: check11(
|
|
17717
|
+
"organization_model_provider_custom_models_version_chk",
|
|
17718
|
+
sql16`${table.version} > 0`
|
|
17719
|
+
),
|
|
17720
|
+
actorCheck: check11(
|
|
17721
|
+
"organization_model_provider_custom_models_actor_chk",
|
|
17722
|
+
sql16`octet_length(${table.createdBySubjectId}) between 1 and 1024`
|
|
17723
|
+
),
|
|
17724
|
+
createHashCheck: check11(
|
|
17725
|
+
"organization_model_provider_custom_models_create_hash_chk",
|
|
17726
|
+
sql16`${table.createRequestHash} ~ '^[a-f0-9]{64}$'`
|
|
17727
|
+
),
|
|
17728
|
+
deleteReceiptCheck: check11(
|
|
17729
|
+
"organization_model_provider_custom_models_delete_receipt_chk",
|
|
17730
|
+
sql16`(${table.deleteOperationId} is null and ${table.deleteRequestHash} is null) or (${table.deleteOperationId} is not null and ${table.deleteRequestHash} ~ '^[a-f0-9]{64}$' and ${table.retiredAt} is not null)`
|
|
17731
|
+
)
|
|
17732
|
+
})
|
|
17733
|
+
);
|
|
17179
17734
|
|
|
17180
17735
|
export {
|
|
17181
17736
|
LOSSLESS_CONTENT_CODEC_VERSION,
|
|
@@ -17372,6 +17927,12 @@ export {
|
|
|
17372
17927
|
slackBotDeleteOperations,
|
|
17373
17928
|
integrationOauthClients,
|
|
17374
17929
|
integrationOauthStateNonces,
|
|
17930
|
+
mcpOauthClients,
|
|
17931
|
+
mcpOauthAuthorizationRequests,
|
|
17932
|
+
mcpOauthAuthorizationCodes,
|
|
17933
|
+
mcpOauthRefreshTokens,
|
|
17934
|
+
mcpOauthAccessTokens,
|
|
17935
|
+
toolGatewayApprovalCapabilities,
|
|
17375
17936
|
codexRotationSettings,
|
|
17376
17937
|
workspaceModelPolicies,
|
|
17377
17938
|
codexCredentialLeases,
|
|
@@ -17414,6 +17975,7 @@ export {
|
|
|
17414
17975
|
turnConnectionAuthoritySnapshots,
|
|
17415
17976
|
connectionUseAuditFacts,
|
|
17416
17977
|
sessionAttemptToolCatalogs,
|
|
17978
|
+
sessionAttemptModelContextSnapshots,
|
|
17417
17979
|
sessionAttemptCodemodeCalls,
|
|
17418
17980
|
connectorActionRequests,
|
|
17419
17981
|
sessionCommandReceipts,
|
|
@@ -17523,6 +18085,11 @@ export {
|
|
|
17523
18085
|
rigs,
|
|
17524
18086
|
rigVersions,
|
|
17525
18087
|
rigChanges,
|
|
18088
|
+
deploymentModelCatalog,
|
|
18089
|
+
workspaceGatewayCustomModels,
|
|
18090
|
+
organizationModelProviderConnections,
|
|
18091
|
+
organizationModelProviderConnectionOperations,
|
|
18092
|
+
organizationModelProviderCustomModels,
|
|
17526
18093
|
schema_exports
|
|
17527
18094
|
};
|
|
17528
|
-
//# sourceMappingURL=chunk-
|
|
18095
|
+
//# sourceMappingURL=chunk-QM6YOWHZ.js.map
|