@opengeni/db 0.27.9 → 0.27.11

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.
@@ -11,6 +11,7 @@ __export(schema_exports, {
11
11
  billingCustomers: () => billingCustomers,
12
12
  capabilityCatalogItems: () => capabilityCatalogItems,
13
13
  capabilityInstallations: () => capabilityInstallations,
14
+ codexAppsSettings: () => codexAppsSettings,
14
15
  codexCapacityWaiters: () => codexCapacityWaiters,
15
16
  codexCredentialLeases: () => codexCredentialLeases,
16
17
  codexResetRedemptionAttempts: () => codexResetRedemptionAttempts,
@@ -1765,21 +1766,11 @@ var codexSubscriptionCredentials = pgTable5(
1765
1766
  // usage cap on a rotation turn; the rotation engine treats `exhausted_until > now()` as
1766
1767
  // capped/skip so it isn't immediately re-picked. Self-clears via the now() comparison.
1767
1768
  exhaustedUntil: timestamp5("exhausted_until", { withTimezone: true }),
1768
- // P4 connector-aware rotation cache (plaintext metadata; NEVER a token). The set
1769
- // of ORIGINAL-dotted connector namespaces (github/gmail/linear/…) this account
1770
- // exposes via codex_apps, captured from the per-turn tools/list. null ⇒ never
1771
- // probed (the ranker treats it as unknown: never credited as covering, never
1772
- // excluded). The writer only ever sets a NON-empty set, so a flaky empty turn
1773
- // can't false-drop coverage. connectorsCheckedAt is the freshness clock.
1774
- connectorNamespaces: text5("connector_namespaces").array(),
1775
- connectorsCheckedAt: timestamp5("connectors_checked_at", {
1776
- withTimezone: true
1777
- }),
1778
1769
  // Workspace-local, server-held fairness cursor. Provider usage headers are
1779
1770
  // capacity hints, never the sole allocator: live lease count is ranked first
1780
1771
  // and this cursor deterministically breaks equal-load/equal-capacity ties.
1781
1772
  // This flag controls NEW automatic allocations only. Credential health,
1782
- // refresh, encrypted material, and already-frozen/in-flight turns are
1773
+ // refresh, encrypted material, and an already-leased in-flight turn are
1783
1774
  // intentionally independent. account eligibility policy owns toggle OCC/audit and product UI.
1784
1775
  allocatorEnabled: boolean3("allocator_enabled").notNull().default(true),
1785
1776
  // Independent OCC/audit sequence for the allocator toggle. Token refresh
@@ -1812,6 +1803,46 @@ var codexSubscriptionCredentials = pgTable5(
1812
1803
  workspaceIdentity: uniqueIndex5("codex_subscription_credentials_workspace_id_idx").on(
1813
1804
  table.workspaceId,
1814
1805
  table.id
1806
+ ),
1807
+ workspaceAccountIdentity: uniqueIndex5(
1808
+ "codex_subscription_credentials_workspace_account_id_idx"
1809
+ ).on(table.workspaceId, table.accountId, table.id)
1810
+ })
1811
+ );
1812
+ var codexAppsSettings = pgTable5(
1813
+ "codex_apps_settings",
1814
+ {
1815
+ id: uuid5("id").primaryKey().defaultRandom(),
1816
+ accountId: uuid5("account_id").notNull().references(() => managedAccounts.id, { onDelete: "cascade" }),
1817
+ workspaceId: uuid5("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
1818
+ credentialId: uuid5("credential_id"),
1819
+ version: integer5("version").notNull().default(1),
1820
+ designatedAt: timestamp5("designated_at", { withTimezone: true }),
1821
+ updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow()
1822
+ },
1823
+ (table) => ({
1824
+ workspaceAccount: foreignKey({
1825
+ name: "codex_apps_settings_workspace_account_fk",
1826
+ columns: [table.workspaceId, table.accountId],
1827
+ foreignColumns: [workspaces.id, workspaces.accountId]
1828
+ }).onDelete("cascade"),
1829
+ credentialScope: foreignKey({
1830
+ name: "codex_apps_settings_credential_scope_fk",
1831
+ columns: [table.workspaceId, table.accountId, table.credentialId],
1832
+ foreignColumns: [
1833
+ codexSubscriptionCredentials.workspaceId,
1834
+ codexSubscriptionCredentials.accountId,
1835
+ codexSubscriptionCredentials.id
1836
+ ]
1837
+ }).onDelete("cascade"),
1838
+ workspace: uniqueIndex5("codex_apps_settings_workspace_idx").on(table.workspaceId),
1839
+ designationShape: check4(
1840
+ "codex_apps_settings_designation_shape_chk",
1841
+ sql5`${table.version} > 0 and (
1842
+ (${table.credentialId} is null and ${table.designatedAt} is null)
1843
+ or
1844
+ (${table.credentialId} is not null and ${table.designatedAt} is not null)
1845
+ )`
1815
1846
  )
1816
1847
  })
1817
1848
  );
@@ -4317,25 +4348,9 @@ var agentRunStates = pgTable5("agent_run_states", {
4317
4348
  stateVersion: integer5("state_version").notNull(),
4318
4349
  serializedRunState: text5("serialized_run_state").notNull(),
4319
4350
  pendingApprovals: jsonb5("pending_approvals").$type().notNull().default([]),
4320
- // The Codex account that FROZE this run state: the turn's resolved codex
4321
- // credential id (pin > workspace-active), or NULL when frozen on the
4322
- // non-codex / Azure path (or before this column existed). The serialized
4323
- // RunState blob round-trips `reasoning.encrypted_content` minted by the
4324
- // ChatGPT/Codex backend — account/org-bound, so a foreign blob 400s — and the
4325
- // foreign reasoning ids the Responses backend validates; but the blob carries
4326
- // NO per-item producer tag (those live only on session_history_items). So we
4327
- // stamp the freezing account here: on an approval resume whose codex account
4328
- // DIFFERS from this value,
4329
- // the replay path neutralizes every reasoning item's account-bound identity
4330
- // (encrypted_content + provider id) in the blob before it reaches the model.
4331
- // Deliberately NO FK: provenance must OUTLIVE the account's hard-disconnect (a
4332
- // stale-but-null tag still mismatches a live codex id, so the strip stays
4333
- // correct either way). NULL on both sides (non-codex freeze + non-codex
4334
- // resume) is a no-op, so single-account and non-codex sessions are unchanged.
4335
- frozenCodexCredentialId: uuid5("frozen_codex_credential_id"),
4336
- // Exact provider rejection invalidates only the opaque reasoning identity
4337
- // inside this frozen state. The serialized receipt remains durable and
4338
- // auditable; the resume path neutralizes its provider-bound identity.
4351
+ // Exact provider rejection marks the latest current-turn receipt only when it
4352
+ // was part of the rejected request. The serialized receipt remains durable;
4353
+ // recovery builds a temporary view without unusable opaque artifacts.
4339
4354
  providerArtifactInvalidatedAt: timestamp5("provider_artifact_invalidated_at", {
4340
4355
  withTimezone: true
4341
4356
  }),
@@ -4440,22 +4455,11 @@ var sessionHistoryItems = pgTable5(
4440
4455
  // inserts ONE synthetic active summary row at the boundary. Defaults true so
4441
4456
  // every existing and normally-appended row is live.
4442
4457
  active: boolean3("active").notNull().default(true),
4443
- // The Codex account that PRODUCED these items: the per-turn resolved codex
4444
- // credential id (pin > workspace-active), or NULL when produced on the
4445
- // non-codex / Azure path (or before this column existed). Used to strip
4446
- // cross-account `reasoning.encrypted_content` blobs those are account/org-
4447
- // bound, minted by the ChatGPT/Codex backend, so replaying account A's blob
4448
- // into a turn running on account B 400s. The read path drops the encrypted
4449
- // reasoning of any item whose producer != the turn's current codex account.
4450
- // Deliberately NO FK: provenance must OUTLIVE the account's hard-disconnect
4451
- // (an ON DELETE SET NULL would erase the tag, and a stale-but-null tag still
4452
- // mismatches a live codex id so the strip stays correct either way).
4453
- producerCodexCredentialId: uuid5("producer_codex_credential_id"),
4454
- // An exact provider 400 can prove that an otherwise same-credential opaque
4455
- // reasoning artifact is no longer decryptable. Keep the original item and
4456
- // producer provenance immutable, but record the attempt-fenced rejection so
4457
- // later model reads omit only the provider-bound identity. No FK: the receipt
4458
- // must outlive operational attempt retention just like producer provenance.
4458
+ // An exact provider 400 can prove that the request's active opaque artifact
4459
+ // set is no longer usable. Keep each canonical item immutable, but record the
4460
+ // attempt-fenced rejection on the exact candidate row IDs so later model
4461
+ // reads build a temporary projection. No FK: the receipt must outlive
4462
+ // operational attempt retention.
4459
4463
  providerArtifactInvalidatedAt: timestamp5("provider_artifact_invalidated_at", {
4460
4464
  withTimezone: true
4461
4465
  }),
@@ -6443,6 +6447,7 @@ export {
6443
6447
  workspaceVariableSets,
6444
6448
  workspaceVariableSetVariables,
6445
6449
  codexSubscriptionCredentials,
6450
+ codexAppsSettings,
6446
6451
  codexResetRedemptionAttempts,
6447
6452
  connections,
6448
6453
  connectionDisconnectOperations,
@@ -6545,4 +6550,4 @@ export {
6545
6550
  rigChanges,
6546
6551
  schema_exports
6547
6552
  };
6548
- //# sourceMappingURL=chunk-NX2JNJJP.js.map
6553
+ //# sourceMappingURL=chunk-JYQPJ6Y5.js.map