@opengeni/db 3.7.4-canary.0 → 3.8.2-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.
Files changed (62) hide show
  1. package/dist/canonical-human-identities.js +3 -3
  2. package/dist/{chunk-DXJ2WY6W.js → chunk-53A2PEHT.js} +241 -31
  3. package/dist/chunk-53A2PEHT.js.map +1 -0
  4. package/dist/{chunk-JS3AWDKZ.js → chunk-5S4BQAHX.js} +3 -3
  5. package/dist/{chunk-JP6IYGYI.js → chunk-CITYUGMW.js} +3 -3
  6. package/dist/{chunk-6FIVOJ3V.js → chunk-F5YOZEYQ.js} +45 -1
  7. package/dist/chunk-F5YOZEYQ.js.map +1 -0
  8. package/dist/{chunk-ZTSJPFDH.js → chunk-HZV7O6JR.js} +2 -2
  9. package/dist/{chunk-VDXHLVDE.js → chunk-RLQVPOVR.js} +2 -2
  10. package/dist/{chunk-LHKB62GC.js → chunk-UKOGHUGC.js} +2 -2
  11. package/dist/{chunk-QL4AHBYD.js → chunk-X6TO5HII.js} +2 -2
  12. package/dist/{chunk-3ZMN4EXC.js → chunk-Y53WEFYB.js} +2 -2
  13. package/dist/connection-token-resolver.d.ts +4 -0
  14. package/dist/editable-artifact-durable-export.js +2 -2
  15. package/dist/editable-artifacts.js +3 -3
  16. package/dist/index.d.ts +59 -12
  17. package/dist/index.js +5259 -4374
  18. package/dist/index.js.map +1 -1
  19. package/dist/insights.d.ts +9 -0
  20. package/dist/managed-auth-session-sets.js +3 -3
  21. package/dist/new-session-drafts.d.ts +12 -0
  22. package/dist/organization-membership-lifecycle.d.ts +8 -1
  23. package/dist/organization-model-providers.d.ts +101 -0
  24. package/dist/pack-components.d.ts +1 -0
  25. package/dist/provision-roles.js +1 -1
  26. package/dist/runtime-posture.d.ts +5 -5
  27. package/dist/schema.d.ts +645 -0
  28. package/dist/schema.js +7 -1
  29. package/dist/session-background-commands.js +3 -3
  30. package/dist/session-tenancy.js +3 -3
  31. package/dist/video-generation.js +3 -3
  32. package/drizzle/0390_organization_model_provider_connections.sql +197 -0
  33. package/drizzle/0391_sandbox_provider_deadline_interaction_followup.sql +295 -0
  34. package/drizzle/0392_context_compaction_pending_observability.sql +198 -0
  35. package/drizzle/0393_workspace_memory_and_learning_defaults.sql +102 -0
  36. package/drizzle/0394_session_selected_skill_activation.sql +20 -0
  37. package/drizzle/0395_scheduled_task_unclaimed_occurrence_invalidation.sql +154 -0
  38. package/drizzle/0396_model_call_equivalent_credit_cost.sql +28 -0
  39. package/drizzle/0397_sandbox_deadline_rotation_preemption.sql +113 -0
  40. package/drizzle/0398_organization_workspace_management_entry.sql +206 -0
  41. package/drizzle/0399_additional_managed_organization_creation.sql +691 -0
  42. package/package.json +6 -6
  43. package/src/connection-token-resolver.ts +12 -0
  44. package/src/index.ts +701 -155
  45. package/src/insights-model-bundle.ts +54 -5
  46. package/src/insights.ts +32 -0
  47. package/src/new-session-drafts.ts +66 -21
  48. package/src/organization-membership-lifecycle.ts +47 -5
  49. package/src/organization-model-providers.ts +614 -0
  50. package/src/pack-components.ts +15 -2
  51. package/src/provision-roles.ts +2 -0
  52. package/src/runtime-posture.ts +44 -0
  53. package/src/schema.ts +250 -30
  54. package/dist/chunk-6FIVOJ3V.js.map +0 -1
  55. package/dist/chunk-DXJ2WY6W.js.map +0 -1
  56. /package/dist/{chunk-JS3AWDKZ.js.map → chunk-5S4BQAHX.js.map} +0 -0
  57. /package/dist/{chunk-JP6IYGYI.js.map → chunk-CITYUGMW.js.map} +0 -0
  58. /package/dist/{chunk-ZTSJPFDH.js.map → chunk-HZV7O6JR.js.map} +0 -0
  59. /package/dist/{chunk-VDXHLVDE.js.map → chunk-RLQVPOVR.js.map} +0 -0
  60. /package/dist/{chunk-LHKB62GC.js.map → chunk-UKOGHUGC.js.map} +0 -0
  61. /package/dist/{chunk-QL4AHBYD.js.map → chunk-X6TO5HII.js.map} +0 -0
  62. /package/dist/{chunk-3ZMN4EXC.js.map → chunk-Y53WEFYB.js.map} +0 -0
@@ -11,9 +11,9 @@ import {
11
11
  getCanonicalHumanIdentityProjection,
12
12
  synchronizeCanonicalHumanLoginBindings,
13
13
  validateCanonicalHumanSession
14
- } from "./chunk-3ZMN4EXC.js";
15
- import "./chunk-ZTSJPFDH.js";
16
- import "./chunk-DXJ2WY6W.js";
14
+ } from "./chunk-Y53WEFYB.js";
15
+ import "./chunk-HZV7O6JR.js";
16
+ import "./chunk-53A2PEHT.js";
17
17
  import "./chunk-PZ5AY32C.js";
18
18
  export {
19
19
  CanonicalHumanIdentityAuthorityError,
@@ -176,6 +176,9 @@ __export(schema_exports, {
176
176
  organizationMembershipLifecycleEvents: () => organizationMembershipLifecycleEvents,
177
177
  organizationMembershipOperationReceipts: () => organizationMembershipOperationReceipts,
178
178
  organizationMemberships: () => organizationMemberships,
179
+ organizationModelProviderConnectionOperations: () => organizationModelProviderConnectionOperations,
180
+ organizationModelProviderConnections: () => organizationModelProviderConnections,
181
+ organizationModelProviderCustomModels: () => organizationModelProviderCustomModels,
179
182
  organizationPrivateSessionSettingEvents: () => organizationPrivateSessionSettingEvents,
180
183
  organizationPrivateSessionSettings: () => organizationPrivateSessionSettings,
181
184
  organizationProfileEvents: () => organizationProfileEvents,
@@ -6389,9 +6392,9 @@ var workspaces = pgTable19(
6389
6392
  // White-label agent persona template override. NULL means the deployment
6390
6393
  // default (OPENGENI_AGENT_INSTRUCTIONS_TEMPLATE / DEFAULT_AGENT_INSTRUCTIONS).
6391
6394
  agentInstructions: text19("agent_instructions"),
6392
- // Growth-ready per-workspace settings bag (migration 0045). Holds memoryEnabled
6393
- // and future workspace-level toggles; validated/merged via WorkspaceSettingsSchema.
6394
- settings: jsonb15("settings").$type().notNull().default({}),
6395
+ // Growth-ready per-workspace settings bag (migration 0045). Migration 0393
6396
+ // makes Memory enabled by default; explicit false remains authoritative.
6397
+ settings: jsonb15("settings").$type().notNull().default({ memoryEnabled: true }),
6395
6398
  // The workspace's default rig (migration 0047). NULL ⇒ no default; sessions
6396
6399
  // created without an explicit rig ride no rig (today's behavior exactly). FK
6397
6400
  // (-> rigs(id) ON DELETE SET NULL) lives in migration 0047, not a Drizzle
@@ -6748,8 +6751,12 @@ var organizationProfileEvents = pgTable19(
6748
6751
  actorMembershipId: uuid19("actor_membership_id").notNull(),
6749
6752
  previousName: text19("previous_name").notNull(),
6750
6753
  requestedName: text19("requested_name").notNull(),
6751
- expectedUpdatedAt: timestamp19("expected_updated_at", { withTimezone: true }).notNull(),
6752
- resultUpdatedAt: timestamp19("result_updated_at", { withTimezone: true }).notNull(),
6754
+ expectedUpdatedAt: timestamp19("expected_updated_at", {
6755
+ withTimezone: true
6756
+ }).notNull(),
6757
+ resultUpdatedAt: timestamp19("result_updated_at", {
6758
+ withTimezone: true
6759
+ }).notNull(),
6753
6760
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
6754
6761
  },
6755
6762
  (table) => ({
@@ -6822,7 +6829,9 @@ var organizationPrivateSessionSettingEvents = pgTable19(
6822
6829
  expectedVersion: bigint14("expected_version", { mode: "number" }).notNull(),
6823
6830
  resultEnabled: boolean11("result_enabled").notNull(),
6824
6831
  resultVersion: bigint14("result_version", { mode: "number" }).notNull(),
6825
- resultUpdatedAt: timestamp19("result_updated_at", { withTimezone: true }).notNull(),
6832
+ resultUpdatedAt: timestamp19("result_updated_at", {
6833
+ withTimezone: true
6834
+ }).notNull(),
6826
6835
  changed: boolean11("changed").notNull(),
6827
6836
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
6828
6837
  },
@@ -6944,7 +6953,9 @@ var organizationInvitationBindingEvents = pgTable19(
6944
6953
  accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
6945
6954
  invitationId: uuid19("invitation_id").notNull(),
6946
6955
  targetSubjectId: text19("target_subject_id").notNull(),
6947
- resultingRevision: bigint14("resulting_revision", { mode: "number" }).notNull(),
6956
+ resultingRevision: bigint14("resulting_revision", {
6957
+ mode: "number"
6958
+ }).notNull(),
6948
6959
  boundAt: timestamp19("bound_at", { withTimezone: true }).notNull().defaultNow()
6949
6960
  },
6950
6961
  (table) => ({
@@ -7038,13 +7049,19 @@ var organizationUserRetentionDeletions = pgTable19(
7038
7049
  {
7039
7050
  accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
7040
7051
  membershipId: uuid19("membership_id").notNull(),
7041
- retentionUntil: timestamp19("retention_until", { withTimezone: true }).notNull(),
7052
+ retentionUntil: timestamp19("retention_until", {
7053
+ withTimezone: true
7054
+ }).notNull(),
7042
7055
  state: text19("state").notNull().default("claimed"),
7043
7056
  claimOperationId: uuid19("claim_operation_id").notNull(),
7044
- claimExpiresAt: timestamp19("claim_expires_at", { withTimezone: true }).notNull(),
7057
+ claimExpiresAt: timestamp19("claim_expires_at", {
7058
+ withTimezone: true
7059
+ }).notNull(),
7045
7060
  attemptCount: integer18("attempt_count").notNull().default(1),
7046
7061
  databaseResult: jsonb15("database_result").$type(),
7047
- databaseFinalizedAt: timestamp19("database_finalized_at", { withTimezone: true }),
7062
+ databaseFinalizedAt: timestamp19("database_finalized_at", {
7063
+ withTimezone: true
7064
+ }),
7048
7065
  result: jsonb15("result").$type(),
7049
7066
  completedAt: timestamp19("completed_at", { withTimezone: true }),
7050
7067
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
@@ -7412,7 +7429,9 @@ var codexSubscriptionCredentials = pgTable19(
7412
7429
  {
7413
7430
  id: uuid19("id").primaryKey().defaultRandom(),
7414
7431
  accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
7415
- workspaceId: uuid19("workspace_id").references(() => workspaces.id, { onDelete: "cascade" }),
7432
+ workspaceId: uuid19("workspace_id").references(() => workspaces.id, {
7433
+ onDelete: "cascade"
7434
+ }),
7416
7435
  organizationId: uuid19("organization_id").references(() => managedAccounts.id, {
7417
7436
  onDelete: "cascade"
7418
7437
  }),
@@ -7924,7 +7943,9 @@ var connectionUseOnceConsumptionReceipts = pgTable19(
7924
7943
  grantId: uuid19("grant_id").primaryKey(),
7925
7944
  accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
7926
7945
  authorityId: uuid19("authority_id").notNull(),
7927
- authorityGeneration: bigint14("authority_generation", { mode: "number" }).notNull(),
7946
+ authorityGeneration: bigint14("authority_generation", {
7947
+ mode: "number"
7948
+ }).notNull(),
7928
7949
  grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
7929
7950
  acceptedWorkKind: text19("accepted_work_kind").notNull(),
7930
7951
  acceptedWorkId: uuid19("accepted_work_id").notNull(),
@@ -8533,7 +8554,9 @@ var slackInteractionInbox = pgTable19(
8533
8554
  targetAccountId: uuid19("target_account_id"),
8534
8555
  targetWorkspaceId: uuid19("target_workspace_id"),
8535
8556
  routePromptId: uuid19("route_prompt_id"),
8536
- routePromptExpiresAt: timestamp19("route_prompt_expires_at", { withTimezone: true }),
8557
+ routePromptExpiresAt: timestamp19("route_prompt_expires_at", {
8558
+ withTimezone: true
8559
+ }),
8537
8560
  processedAt: timestamp19("processed_at", { withTimezone: true }),
8538
8561
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
8539
8562
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
@@ -11604,7 +11627,9 @@ var turnPersonalResourceSnapshots = pgTable19(
11604
11627
  mode: "number"
11605
11628
  }).notNull(),
11606
11629
  authorityId: uuid19("authority_id").notNull(),
11607
- authorityGeneration: bigint14("authority_generation", { mode: "number" }).notNull(),
11630
+ authorityGeneration: bigint14("authority_generation", {
11631
+ mode: "number"
11632
+ }).notNull(),
11608
11633
  grantId: uuid19("grant_id").notNull(),
11609
11634
  grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
11610
11635
  grantMode: text19("grant_mode").notNull(),
@@ -11616,7 +11641,9 @@ var turnPersonalResourceSnapshots = pgTable19(
11616
11641
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
11617
11642
  },
11618
11643
  (table) => ({
11619
- pk: primaryKey8({ columns: [table.turnId, table.resourceKind, table.resourceId] }),
11644
+ pk: primaryKey8({
11645
+ columns: [table.turnId, table.resourceKind, table.resourceId]
11646
+ }),
11620
11647
  receipt: foreignKey({
11621
11648
  name: "turn_personal_resource_snapshots_receipt_fk",
11622
11649
  columns: [table.turnId],
@@ -11663,7 +11690,9 @@ var turnPersonalResourceOnceReceipts = pgTable19(
11663
11690
  turnId: uuid19("turn_id").notNull(),
11664
11691
  accountId: uuid19("account_id").notNull(),
11665
11692
  authorityId: uuid19("authority_id").notNull(),
11666
- authorityGeneration: bigint14("authority_generation", { mode: "number" }).notNull(),
11693
+ authorityGeneration: bigint14("authority_generation", {
11694
+ mode: "number"
11695
+ }).notNull(),
11667
11696
  grantGeneration: bigint14("grant_generation", { mode: "number" }).notNull(),
11668
11697
  consumedAt: timestamp19("consumed_at", { withTimezone: true }).notNull().defaultNow()
11669
11698
  },
@@ -11927,7 +11956,9 @@ var turnConnectionAuthoritySnapshots = pgTable19(
11927
11956
  turnId: uuid19("turn_id").notNull(),
11928
11957
  serverId: text19("server_id").notNull(),
11929
11958
  connectionId: uuid19("connection_id").notNull(),
11930
- connectionGeneration: bigint14("connection_generation", { mode: "number" }).notNull(),
11959
+ connectionGeneration: bigint14("connection_generation", {
11960
+ mode: "number"
11961
+ }).notNull(),
11931
11962
  originWorkspaceId: uuid19("origin_workspace_id").notNull(),
11932
11963
  providerDomain: text19("provider_domain").notNull(),
11933
11964
  connectionKind: text19("connection_kind").notNull(),
@@ -12860,9 +12891,13 @@ var sessionGoals = pgTable19(
12860
12891
  // Any newer finished turn, a passed deadline, or a goal mutation clears all
12861
12892
  // four columns together.
12862
12893
  continuationHoldTurnId: uuid19("continuation_hold_turn_id"),
12863
- continuationHoldUntil: timestamp19("continuation_hold_until", { withTimezone: true }),
12894
+ continuationHoldUntil: timestamp19("continuation_hold_until", {
12895
+ withTimezone: true
12896
+ }),
12864
12897
  continuationHoldReason: text19("continuation_hold_reason"),
12865
- continuationHoldSetAt: timestamp19("continuation_hold_set_at", { withTimezone: true }),
12898
+ continuationHoldSetAt: timestamp19("continuation_hold_set_at", {
12899
+ withTimezone: true
12900
+ }),
12866
12901
  metadata: jsonb15("metadata").$type().notNull().default({}),
12867
12902
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
12868
12903
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
@@ -13934,7 +13969,9 @@ var sandboxWorkspaceMutationAdmissions = pgTable19(
13934
13969
  // authorization revision observed at admission. The revision is audit
13935
13970
  // evidence: a role change is not a revocation and must not fence a writer.
13936
13971
  initiatorOrganizationMembershipId: uuid19("initiator_organization_membership_id"),
13937
- initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", { mode: "number" }),
13972
+ initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
13973
+ mode: "number"
13974
+ }),
13938
13975
  // Session tenancy authority observed when the operation was admitted; the
13939
13976
  // same triple `session_turn_attempts` freezes for a turn.
13940
13977
  authorityEpoch: integer18("authority_epoch"),
@@ -14143,7 +14180,9 @@ var sandboxRetainedProcesses = pgTable19(
14143
14180
  initiatorSubjectId: text19("initiator_subject_id").notNull().default("unattributed-legacy"),
14144
14181
  initiatingHumanSubjectId: text19("initiating_human_subject_id"),
14145
14182
  initiatorOrganizationMembershipId: uuid19("initiator_organization_membership_id"),
14146
- initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", { mode: "number" }),
14183
+ initiatorAuthorizationRevision: bigint14("initiator_authorization_revision", {
14184
+ mode: "number"
14185
+ }),
14147
14186
  authorityEpoch: integer18("authority_epoch"),
14148
14187
  authorityVisibility: text19("authority_visibility", {
14149
14188
  enum: ["user_private", "workspace_shared"]
@@ -14389,7 +14428,9 @@ var sessionBackgroundCommands = pgTable19(
14389
14428
  accountId: uuid19("account_id").notNull(),
14390
14429
  workspaceId: uuid19("workspace_id").notNull(),
14391
14430
  sessionId: uuid19("session_id").notNull(),
14392
- provider: text19("provider", { enum: ["managed", "connected_machine"] }).notNull(),
14431
+ provider: text19("provider", {
14432
+ enum: ["managed", "connected_machine"]
14433
+ }).notNull(),
14393
14434
  state: text19("state", { enum: ["running", "stopping", "exited", "lost"] }).notNull().default("running"),
14394
14435
  retainedProcessId: uuid19("retained_process_id"),
14395
14436
  controlWorkspaceId: uuid19("control_workspace_id"),
@@ -14405,13 +14446,19 @@ var sessionBackgroundCommands = pgTable19(
14405
14446
  settledAt: timestamp19("settled_at", { withTimezone: true }),
14406
14447
  reconcileAfter: timestamp19("reconcile_after", { withTimezone: true }).notNull().defaultNow(),
14407
14448
  reconcileClaimId: uuid19("reconcile_claim_id"),
14408
- reconcileClaimedAt: timestamp19("reconcile_claimed_at", { withTimezone: true }),
14449
+ reconcileClaimedAt: timestamp19("reconcile_claimed_at", {
14450
+ withTimezone: true
14451
+ }),
14409
14452
  reconcileAttempts: integer18("reconcile_attempts").notNull().default(0),
14410
14453
  lastReconcileOutcome: text19("last_reconcile_outcome"),
14411
- reconcileProofOutcome: text19("reconcile_proof_outcome", { enum: ["exited", "lost"] }),
14454
+ reconcileProofOutcome: text19("reconcile_proof_outcome", {
14455
+ enum: ["exited", "lost"]
14456
+ }),
14412
14457
  reconcileProofExitCode: integer18("reconcile_proof_exit_code"),
14413
14458
  reconcileProofReason: text19("reconcile_proof_reason"),
14414
- reconcileProofObservedAt: timestamp19("reconcile_proof_observed_at", { withTimezone: true }),
14459
+ reconcileProofObservedAt: timestamp19("reconcile_proof_observed_at", {
14460
+ withTimezone: true
14461
+ }),
14415
14462
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
14416
14463
  },
14417
14464
  (table) => ({
@@ -15429,12 +15476,18 @@ var prReviewAppRegistrations = pgTable19(
15429
15476
  providerAccountType: text19("provider_account_type"),
15430
15477
  githubActorId: text19("github_actor_id"),
15431
15478
  authorityKind: text19("authority_kind"),
15432
- authorityCheckedAt: timestamp19("authority_checked_at", { withTimezone: true }),
15433
- authorityExpiresAt: timestamp19("authority_expires_at", { withTimezone: true }),
15479
+ authorityCheckedAt: timestamp19("authority_checked_at", {
15480
+ withTimezone: true
15481
+ }),
15482
+ authorityExpiresAt: timestamp19("authority_expires_at", {
15483
+ withTimezone: true
15484
+ }),
15434
15485
  authorityNonce: text19("authority_nonce"),
15435
15486
  credentialKind: text19("credential_kind").notNull(),
15436
15487
  credentialEncrypted: text19("credential_encrypted"),
15437
- accessTokenExpiresAt: timestamp19("access_token_expires_at", { withTimezone: true }),
15488
+ accessTokenExpiresAt: timestamp19("access_token_expires_at", {
15489
+ withTimezone: true
15490
+ }),
15438
15491
  webhookAuthKind: text19("webhook_auth_kind").notNull(),
15439
15492
  webhookUsername: text19("webhook_username"),
15440
15493
  status: text19("status").notNull().default("active"),
@@ -15563,7 +15616,9 @@ var prReviewManagedGithubAuthorityNonces = pgTable19(
15563
15616
  accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
15564
15617
  workspaceId: uuid19("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
15565
15618
  installationId: text19("installation_id").notNull(),
15566
- authorityExpiresAt: timestamp19("authority_expires_at", { withTimezone: true }).notNull(),
15619
+ authorityExpiresAt: timestamp19("authority_expires_at", {
15620
+ withTimezone: true
15621
+ }).notNull(),
15567
15622
  consumedAt: timestamp19("consumed_at", { withTimezone: true }).notNull().defaultNow()
15568
15623
  },
15569
15624
  (table) => ({
@@ -15719,6 +15774,9 @@ var modelCallFacts = pgTable19(
15719
15774
  estimatedProviderCostMicros: bigint14("estimated_provider_cost_micros", {
15720
15775
  mode: "number"
15721
15776
  }),
15777
+ equivalentCreditCostMicros: bigint14("equivalent_credit_cost_micros", {
15778
+ mode: "number"
15779
+ }),
15722
15780
  pricingSource: text19("pricing_source"),
15723
15781
  contextContributions: jsonb15("context_contributions").$type(),
15724
15782
  occurredAt: timestamp19("occurred_at", { withTimezone: true }).notNull(),
@@ -15760,6 +15818,10 @@ var modelCallFacts = pgTable19(
15760
15818
  "model_call_facts_estimated_provider_cost_check",
15761
15819
  sql16`${table.estimatedProviderCostMicros} is null or ${table.estimatedProviderCostMicros} >= 0`
15762
15820
  ),
15821
+ equivalentCreditCostValid: check11(
15822
+ "model_call_facts_equivalent_credit_cost_check",
15823
+ sql16`${table.equivalentCreditCostMicros} is null or (${table.equivalentCreditCostMicros} >= 0 and ${table.estimatedProviderCostMicros} is not null)`
15824
+ ),
15763
15825
  pricingSourceValid: check11(
15764
15826
  "model_call_facts_pricing_source_check",
15765
15827
  sql16`(${table.estimatedProviderCostMicros} is null and ${table.pricingSource} is null)
@@ -16340,7 +16402,9 @@ var automationRuns = pgTable19(
16340
16402
  occurrenceKey: text19("occurrence_key").notNull(),
16341
16403
  acceptedExecution: jsonb15("accepted_execution").$type().notNull(),
16342
16404
  status: text19("status").notNull().default("queued"),
16343
- sessionId: uuid19("session_id").references(() => sessions.id, { onDelete: "set null" }),
16405
+ sessionId: uuid19("session_id").references(() => sessions.id, {
16406
+ onDelete: "set null"
16407
+ }),
16344
16408
  errorCode: text19("error_code"),
16345
16409
  createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
16346
16410
  updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
@@ -17261,6 +17325,149 @@ var workspaceGatewayCustomModels = pgTable19(
17261
17325
  )
17262
17326
  })
17263
17327
  );
17328
+ var organizationModelProviderConnections = pgTable19(
17329
+ "organization_model_provider_connections",
17330
+ {
17331
+ id: uuid19("id").primaryKey().defaultRandom(),
17332
+ accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
17333
+ providerKind: text19("provider_kind").$type().notNull(),
17334
+ status: text19("status").$type().notNull().default("active"),
17335
+ credentialEncrypted: text19("credential_encrypted").notNull(),
17336
+ version: integer18("version").notNull().default(1),
17337
+ operationId: uuid19("operation_id").notNull(),
17338
+ requestHash: text19("request_hash").notNull(),
17339
+ updatedBySubjectId: text19("updated_by_subject_id").notNull(),
17340
+ createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
17341
+ updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
17342
+ },
17343
+ (table) => ({
17344
+ accountProvider: uniqueIndex19("organization_model_provider_connections_account_provider_uq").on(
17345
+ table.accountId,
17346
+ table.providerKind
17347
+ ),
17348
+ operation: uniqueIndex19("organization_model_provider_connections_operation_uq").on(
17349
+ table.accountId,
17350
+ table.providerKind,
17351
+ table.operationId
17352
+ ),
17353
+ providerKindCheck: check11(
17354
+ "organization_model_provider_connections_provider_kind_chk",
17355
+ sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
17356
+ ),
17357
+ statusCheck: check11(
17358
+ "organization_model_provider_connections_status_chk",
17359
+ sql16`${table.status} in ('active', 'revoked')`
17360
+ ),
17361
+ versionCheck: check11(
17362
+ "organization_model_provider_connections_version_chk",
17363
+ sql16`${table.version} > 0`
17364
+ ),
17365
+ requestHashCheck: check11(
17366
+ "organization_model_provider_connections_request_hash_chk",
17367
+ sql16`${table.requestHash} ~ '^[a-f0-9]{64}$'`
17368
+ ),
17369
+ actorCheck: check11(
17370
+ "organization_model_provider_connections_actor_chk",
17371
+ sql16`octet_length(${table.updatedBySubjectId}) between 1 and 1024`
17372
+ )
17373
+ })
17374
+ );
17375
+ var organizationModelProviderConnectionOperations = pgTable19(
17376
+ "organization_model_provider_connection_operations",
17377
+ {
17378
+ id: uuid19("id").primaryKey().defaultRandom(),
17379
+ accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
17380
+ providerKind: text19("provider_kind").$type().notNull(),
17381
+ operationId: uuid19("operation_id").notNull(),
17382
+ requestHash: text19("request_hash").notNull(),
17383
+ resultStatus: text19("result_status").$type().notNull(),
17384
+ resultVersion: integer18("result_version").notNull(),
17385
+ resultCreatedAt: timestamp19("result_created_at", {
17386
+ withTimezone: true
17387
+ }).notNull(),
17388
+ resultUpdatedAt: timestamp19("result_updated_at", {
17389
+ withTimezone: true
17390
+ }).notNull(),
17391
+ createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow()
17392
+ },
17393
+ (table) => ({
17394
+ operation: uniqueIndex19("organization_model_provider_connection_operations_operation_uq").on(
17395
+ table.accountId,
17396
+ table.providerKind,
17397
+ table.operationId
17398
+ ),
17399
+ providerKindCheck: check11(
17400
+ "organization_model_provider_connection_operations_provider_kind_chk",
17401
+ sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
17402
+ ),
17403
+ resultStatusCheck: check11(
17404
+ "organization_model_provider_connection_operations_result_status_chk",
17405
+ sql16`${table.resultStatus} in ('active', 'revoked')`
17406
+ ),
17407
+ resultVersionCheck: check11(
17408
+ "organization_model_provider_connection_operations_result_version_chk",
17409
+ sql16`${table.resultVersion} > 0`
17410
+ ),
17411
+ requestHashCheck: check11(
17412
+ "organization_model_provider_connection_operations_request_hash_chk",
17413
+ sql16`${table.requestHash} ~ '^[a-f0-9]{64}$'`
17414
+ )
17415
+ })
17416
+ );
17417
+ var organizationModelProviderCustomModels = pgTable19(
17418
+ "organization_model_provider_custom_models",
17419
+ {
17420
+ id: uuid19("id").primaryKey().defaultRandom(),
17421
+ accountId: uuid19("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
17422
+ providerKind: text19("provider_kind").$type().notNull(),
17423
+ upstreamModelId: text19("upstream_model_id").notNull(),
17424
+ label: text19("label"),
17425
+ version: integer18("version").notNull().default(1),
17426
+ createOperationId: uuid19("create_operation_id").notNull(),
17427
+ createRequestHash: text19("create_request_hash").notNull(),
17428
+ deleteOperationId: uuid19("delete_operation_id"),
17429
+ deleteRequestHash: text19("delete_request_hash"),
17430
+ createdBySubjectId: text19("created_by_subject_id").notNull(),
17431
+ retiredAt: timestamp19("retired_at", { withTimezone: true }),
17432
+ createdAt: timestamp19("created_at", { withTimezone: true }).notNull().defaultNow(),
17433
+ updatedAt: timestamp19("updated_at", { withTimezone: true }).notNull().defaultNow()
17434
+ },
17435
+ (table) => ({
17436
+ accountUpstream: uniqueIndex19("organization_model_provider_custom_models_active_uq").on(table.accountId, table.providerKind, table.upstreamModelId).where(sql16`${table.retiredAt} is null`),
17437
+ createOperation: uniqueIndex19(
17438
+ "organization_model_provider_custom_models_create_operation_uq"
17439
+ ).on(table.accountId, table.providerKind, table.createOperationId),
17440
+ deleteOperation: uniqueIndex19("organization_model_provider_custom_models_delete_operation_uq").on(table.accountId, table.providerKind, table.deleteOperationId).where(sql16`${table.deleteOperationId} is not null`),
17441
+ providerKindCheck: check11(
17442
+ "organization_model_provider_custom_models_provider_kind_chk",
17443
+ sql16`${table.providerKind} in ('vercel_gateway', 'openrouter')`
17444
+ ),
17445
+ upstreamCheck: check11(
17446
+ "organization_model_provider_custom_models_upstream_chk",
17447
+ sql16`octet_length(${table.upstreamModelId}) between 1 and 238 and ${table.upstreamModelId} ~ '^[!-~]+$' and ${table.upstreamModelId} !~ '[|]'`
17448
+ ),
17449
+ labelCheck: check11(
17450
+ "organization_model_provider_custom_models_label_chk",
17451
+ sql16`${table.label} is null or (octet_length(${table.label}) between 1 and 128 and ${table.label} !~ '[\r\n|]')`
17452
+ ),
17453
+ versionCheck: check11(
17454
+ "organization_model_provider_custom_models_version_chk",
17455
+ sql16`${table.version} > 0`
17456
+ ),
17457
+ actorCheck: check11(
17458
+ "organization_model_provider_custom_models_actor_chk",
17459
+ sql16`octet_length(${table.createdBySubjectId}) between 1 and 1024`
17460
+ ),
17461
+ createHashCheck: check11(
17462
+ "organization_model_provider_custom_models_create_hash_chk",
17463
+ sql16`${table.createRequestHash} ~ '^[a-f0-9]{64}$'`
17464
+ ),
17465
+ deleteReceiptCheck: check11(
17466
+ "organization_model_provider_custom_models_delete_receipt_chk",
17467
+ 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)`
17468
+ )
17469
+ })
17470
+ );
17264
17471
 
17265
17472
  export {
17266
17473
  LOSSLESS_CONTENT_CODEC_VERSION,
@@ -17610,6 +17817,9 @@ export {
17610
17817
  rigChanges,
17611
17818
  deploymentModelCatalog,
17612
17819
  workspaceGatewayCustomModels,
17820
+ organizationModelProviderConnections,
17821
+ organizationModelProviderConnectionOperations,
17822
+ organizationModelProviderCustomModels,
17613
17823
  schema_exports
17614
17824
  };
17615
- //# sourceMappingURL=chunk-DXJ2WY6W.js.map
17825
+ //# sourceMappingURL=chunk-53A2PEHT.js.map