@opengeni/db 0.9.3 → 0.10.7

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 (33) hide show
  1. package/dist/{chunk-4LG5NBTC.js → chunk-P6PKXY5W.js} +93 -1
  2. package/dist/chunk-P6PKXY5W.js.map +1 -0
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.js +1332 -178
  5. package/dist/index.js.map +1 -1
  6. package/dist/provision-roles.d.ts +406 -32
  7. package/dist/{schema-CdPGTHlD.d.ts → schema-CqkzrBRS.d.ts} +513 -2
  8. package/dist/schema.d.ts +1 -1
  9. package/dist/schema.js +3 -1
  10. package/drizzle/0053_codex_credential_leases.sql +2 -2
  11. package/drizzle/0057_durable_queue_control.sql +1 -1
  12. package/drizzle/0061_session_workflow_wake_outbox.sql +1 -1
  13. package/drizzle/0062_session_list_snapshot_reaper.sql +1 -1
  14. package/drizzle/0063_session_control_mega_foundation.sql +1 -1
  15. package/drizzle/0064_rotation_strategy_sharded_backfill.sql +1 -1
  16. package/drizzle/0065_codex_subscription_overview.sql +168 -0
  17. package/drizzle/0065_session_tool_policy.sql +38 -0
  18. package/drizzle/0067_session_event_payload_bounds.sql +2 -2
  19. package/drizzle/0068_workspace_control_event_bounds.sql +2 -2
  20. package/drizzle/0069_session_event_history_backfill.sql +2 -2
  21. package/drizzle/0074_session_activity_revisions.sql +2 -2
  22. package/drizzle/0106_session_attempt_mcp_approval_policies.sql +29 -0
  23. package/drizzle/0107_host_export_lineage_contract.sql +381 -0
  24. package/drizzle/0108_fence_invalidated_warming_epochs.sql +76 -0
  25. package/package.json +5 -4
  26. package/src/codex-token-resolver.ts +175 -14
  27. package/src/connection-token-resolver.ts +143 -120
  28. package/src/event-payload-sanitizer.ts +32 -2
  29. package/src/index.ts +1888 -205
  30. package/src/schema.ts +107 -1
  31. package/src/session-control.ts +2 -0
  32. package/src/session-queue-commands.ts +94 -21
  33. package/dist/chunk-4LG5NBTC.js.map +0 -1
@@ -1,10 +1,11 @@
1
- import { TurnInitiatorContext, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionGoalStatus, Session, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, ConnectionMetadata, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
1
+ import { TurnInitiatorContext, SessionMcpApprovalPolicy, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, TurnExecutionPolicyV1, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionGoalStatus, Session, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, ConnectionMetadata, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SessionToolPolicy, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
2
2
  import { environmentsEncryptionKeyBytes, Settings, McpServerConnectionRef } from '@opengeni/config';
3
- import { refreshCodexToken, CodexTokenSnapshot, CodexUsagePayload } from '@opengeni/codex';
3
+ import { refreshCodexToken, CodexRateLimitResetCreditsDetails, ResetCreditFetchFailureReason, CodexTokenSnapshot, CodexFetch, CodexUsagePayload } from '@opengeni/codex';
4
4
  import { SQL } from 'drizzle-orm';
5
5
  import { PgDatabase, PgTransactionConfig } from 'drizzle-orm/pg-core';
6
- import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-CdPGTHlD.js';
6
+ import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-CqkzrBRS.js';
7
7
  import './migrate.js';
8
+ import { FetchLike, DnsLookup } from '@opengeni/network';
8
9
 
9
10
  declare const SESSION_ANCESTRY_LIMIT = 10000;
10
11
  type WorkspaceControlLockMode = "share" | "update";
@@ -200,6 +201,7 @@ declare function registerSessionTurnAttemptClaim(db: Database, input: {
200
201
  temporalWorkflowRunId: string;
201
202
  temporalActivityId: string;
202
203
  verifiedControlRevision: number;
204
+ mcpApprovalPolicies: Record<string, SessionMcpApprovalPolicy>;
203
205
  }): Promise<typeof sessionTurnAttempts.$inferSelect>;
204
206
  /**
205
207
  * Close the exact first-class owner while the caller still holds the owning
@@ -339,7 +341,7 @@ type FrozenTurnInitiator = {
339
341
  };
340
342
  declare function frozenInitiatorForCommandActor(db: Database, workspaceId: string, actor: SessionCommandActor, subjectLabel?: string): Promise<FrozenTurnInitiator>;
341
343
 
342
- type QueueCommandConflictCode = "QUEUE_VERSION_CHANGED" | "QUEUE_PROMPT_STARTED" | "QUEUE_ANCHOR_CHANGED" | "PROMPT_CHANGED" | "DRAFT_CHANGED" | "DRAFT_NOT_EMPTY";
344
+ type QueueCommandConflictCode = "QUEUE_VERSION_CHANGED" | "QUEUE_PROMPT_STARTED" | "QUEUE_ANCHOR_CHANGED" | "PROMPT_CHANGED" | "DRAFT_CHANGED" | "DRAFT_NOT_EMPTY" | "EDIT_SOURCE_CHANGED";
343
345
  declare class QueueCommandConflictError extends Error {
344
346
  readonly code: QueueCommandConflictCode;
345
347
  readonly current: {
@@ -429,6 +431,7 @@ declare function saveComposerDraftInTransaction(db: Database, input: {
429
431
  text: string;
430
432
  resources: ResourceRef[];
431
433
  tools: ToolRef[];
434
+ toolsProvided: boolean;
432
435
  model: string;
433
436
  reasoningEffort: ReasoningEffort;
434
437
  }): Promise<ComposerDraftRow>;
@@ -489,9 +492,12 @@ declare function submitHumanPromptInTransaction(db: Database, input: {
489
492
  turnInstructions?: string | null;
490
493
  resources: ResourceRef[];
491
494
  tools: ToolRef[];
495
+ toolsProvided?: boolean;
492
496
  model?: string | null;
493
497
  reasoningEffort?: ReasoningEffort | null;
494
498
  reasoningEffortFallback: ReasoningEffort;
499
+ /** Trusted API/core admission snapshot. Omitted only by legacy low-level callers. */
500
+ turnExecutionPolicy?: TurnExecutionPolicyV1;
495
501
  source: "user" | "api";
496
502
  mcpCredentialUpdates?: Array<{
497
503
  id: string;
@@ -551,7 +557,14 @@ declare function sanitizeEventString(value: string): string;
551
557
  * combinations are traversed; non-string leaves pass through untouched. Object
552
558
  * keys are sanitized too -- they are jsonb-constrained the same as values.
553
559
  */
554
- declare function sanitizeEventPayload<T>(payload: T): T;
560
+ type SanitizeEventPayloadOptions = {
561
+ /**
562
+ * Separately trusted, server-created retained-output evidence. Never populate
563
+ * this from a producer-controlled payload field.
564
+ */
565
+ fullEvidence?: unknown;
566
+ };
567
+ declare function sanitizeEventPayload<T>(payload: T, options?: SanitizeEventPayloadOptions): T;
555
568
  /**
556
569
  * Make model-facing conversation data safe for Postgres without redacting it.
557
570
  *
@@ -734,6 +747,22 @@ type ProvisionRolesOptions = {
734
747
  */
735
748
  declare function provisionRoles(adminConnection: string, options?: ProvisionRolesOptions): Promise<ProvisionResult>;
736
749
 
750
+ type CodexTokenDeadlineClock = {
751
+ setTimeout: (callback: () => void, delayMs: number) => ReturnType<typeof globalThis.setTimeout>;
752
+ clearTimeout: (handle: ReturnType<typeof globalThis.setTimeout>) => void;
753
+ };
754
+ type CodexTokenDeadlineOptions = {
755
+ timeoutMs?: number | undefined;
756
+ signal?: AbortSignal | undefined;
757
+ clock?: CodexTokenDeadlineClock | undefined;
758
+ };
759
+ /**
760
+ * Bound a refresh promise without abandoning its rejection handler when the
761
+ * deadline or cancellation wins. The provider promise is observed exactly
762
+ * once, while the observer itself always fulfills, so a late provider failure
763
+ * cannot become an unhandled rejection or replace the authoritative outcome.
764
+ */
765
+ declare function withCodexTokenDeadline<T>(operation: Promise<T>, options?: CodexTokenDeadlineOptions): Promise<T>;
737
766
  type CodexAuthDeps = {
738
767
  loadCredential: typeof loadCodexCredentialForRun;
739
768
  recordRefresh: typeof recordCodexTokenRefresh;
@@ -761,7 +790,23 @@ declare function buildCodexTokenResolver(db: Database, settings: Settings, works
761
790
  * A refresh that stamps needs_relogin returns { status:"error", reason } and never
762
791
  * hits the provider; a transient refresh error returns a plain error payload.
763
792
  */
764
- declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string): Promise<CodexUsagePayload>;
793
+ declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): Promise<CodexUsagePayload>;
794
+ type CodexRateLimitResetCreditsAccountResult = {
795
+ ok: true;
796
+ status: number;
797
+ details: CodexRateLimitResetCreditsDetails;
798
+ } | {
799
+ ok: false;
800
+ status: number;
801
+ reason: ResetCreditFetchFailureReason | "needs_relogin";
802
+ };
803
+ /**
804
+ * Fresh detailed reset-credit inventory for one exact workspace credential.
805
+ * The token is refreshed through the same resolver as usage and never escapes
806
+ * this server-side function. Detailed rows are returned to the route only and
807
+ * are never persisted as redemption authority.
808
+ */
809
+ declare function fetchCodexRateLimitResetCreditsForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): Promise<CodexRateLimitResetCreditsAccountResult>;
765
810
 
766
811
  type ResolveConnectionCredentialResult = {
767
812
  status: "ok";
@@ -787,6 +832,8 @@ type ResolveConnectionCredentialInput = {
787
832
  /** @deprecated Use toolName. Retained for the API's pre-existing broker call shape. */
788
833
  toolId?: string;
789
834
  connectionRef: McpServerConnectionRef;
835
+ /** Exact MCP destination whose request would receive the resolved headers. */
836
+ destinationUrl: string;
790
837
  forceRefresh?: boolean;
791
838
  };
792
839
  type HostMcpCredentialResolverContext = {
@@ -805,7 +852,7 @@ declare class HostMcpCredentialScopeError extends Error {
805
852
  constructor(field: "accountId" | "workspaceId" | "sessionId");
806
853
  }
807
854
  declare class HostMcpCredentialBindingError extends Error {
808
- constructor(field: "provider" | "providerDomain" | "connectionId" | "scopes" | "resource" | "selectedResources");
855
+ constructor(field: "provider" | "providerDomain" | "connectionId" | "scopes" | "resource" | "selectedResources" | "destinationUrl");
809
856
  }
810
857
  /**
811
858
  * Adapts the public embedding credential port to the runtime's connection
@@ -824,6 +871,10 @@ type ConnectionBrokerDeps = {
824
871
  keyBytes: typeof environmentsEncryptionKeyBytes;
825
872
  now: () => Date;
826
873
  };
874
+ type RefreshTransportOptions = {
875
+ fetchImpl?: FetchLike;
876
+ dnsLookup?: DnsLookup;
877
+ };
827
878
  declare function buildConnectionTokenResolver(db: Database, settings: Settings, deps?: ConnectionBrokerDeps): (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
828
879
  declare class ConnectionRefreshHttpError extends Error {
829
880
  readonly httpStatus: number;
@@ -836,12 +887,11 @@ declare class ConnectionRefreshHttpError extends Error {
836
887
  * the canonical `Bearer`. A non-bearer scheme is passed through unchanged.
837
888
  */
838
889
  declare function normalizeBearerScheme(tokenType: string | null | undefined): string;
839
- declare function refreshOAuthConnectionCredential(cred: ConnectionCredentialForBroker, ref: McpServerConnectionRef, settings?: Settings): Promise<{
890
+ declare function refreshOAuthConnectionCredential(cred: ConnectionCredentialForBroker, ref: McpServerConnectionRef, settings: Settings, transportOptions?: RefreshTransportOptions): Promise<{
840
891
  credential: Record<string, unknown>;
841
892
  expiresAt: Date | null;
842
893
  grantedScopes?: string[];
843
894
  }>;
844
- declare function isPrivateAddress(address: string): boolean;
845
895
 
846
896
  type Database = PgDatabase<any, typeof schema>;
847
897
  type DbClient = {
@@ -1241,6 +1291,11 @@ declare function countScheduledTasksForWorkspace(db: Database, workspaceId: stri
1241
1291
  type AppendEventInput = {
1242
1292
  type: SessionEventType;
1243
1293
  payload?: unknown;
1294
+ /**
1295
+ * Server-created retained-output evidence for canonical audit truncation.
1296
+ * Producer payload fields are never trusted as evidence.
1297
+ */
1298
+ retainedOutputEvidence?: unknown;
1244
1299
  clientEventId?: string;
1245
1300
  turnId?: string | null;
1246
1301
  turnGeneration?: number | null;
@@ -1534,7 +1589,7 @@ type CreateSessionMcpServerInput = {
1534
1589
  allowedTools?: string[] | null;
1535
1590
  timeoutMs?: number | null;
1536
1591
  cacheToolsList?: boolean | null;
1537
- requireApproval?: boolean | string[] | null;
1592
+ requireApproval?: SessionMcpApprovalPolicy | null;
1538
1593
  connectionRef?: McpServerConnectionRef$1 | null;
1539
1594
  headersEncrypted?: Record<string, string>;
1540
1595
  };
@@ -1546,11 +1601,15 @@ type UpdateSessionMcpServerCredentialsResult = {
1546
1601
  servers: SessionMcpServerMetadata[];
1547
1602
  missingIds: string[];
1548
1603
  };
1604
+ type UpdateSessionMcpApprovalPolicyResult = {
1605
+ server: SessionMcpServerMetadata | null;
1606
+ changed: boolean;
1607
+ };
1549
1608
  type SessionMcpServerForRun = SessionMcpServerMetadata & {
1550
1609
  allowedTools?: string[];
1551
1610
  timeoutMs?: number;
1552
1611
  cacheToolsList?: boolean;
1553
- requireApproval?: boolean | string[];
1612
+ requireApproval: SessionMcpApprovalPolicy;
1554
1613
  headers: Record<string, string>;
1555
1614
  };
1556
1615
  type EnqueueSessionTurnInput = {
@@ -1564,6 +1623,7 @@ type EnqueueSessionTurnInput = {
1564
1623
  turnInstructions?: string | null;
1565
1624
  resources: ResourceRef[];
1566
1625
  tools: ToolRef[];
1626
+ toolsProvided?: boolean;
1567
1627
  model: string;
1568
1628
  reasoningEffort: ReasoningEffort;
1569
1629
  sandboxBackend: SandboxBackend;
@@ -1601,6 +1661,17 @@ declare function createFileUpload(db: Database, input: {
1601
1661
  }>;
1602
1662
  declare function getFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset | null>;
1603
1663
  declare function requireFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset>;
1664
+ type RetainedFileArtifact = {
1665
+ file: FileAsset;
1666
+ uploadStatus: FileUploadStatus | null;
1667
+ uploadExpiresAt: Date | null;
1668
+ };
1669
+ /**
1670
+ * RLS-scoped file lookup with just enough upload lifecycle truth to distinguish
1671
+ * pending, failed, and expired artifact references. The bytes and provider
1672
+ * location remain in the existing FileAsset/object-storage seam.
1673
+ */
1674
+ declare function getRetainedFileArtifact(db: Database, workspaceId: string, fileId: string): Promise<RetainedFileArtifact | null>;
1604
1675
  declare function getFileUpload(db: Database, workspaceId: string, uploadId: string): Promise<{
1605
1676
  id: string;
1606
1677
  status: FileUploadStatus;
@@ -2087,6 +2158,15 @@ type CodexCredentialForRun = {
2087
2158
  * accessor — auto-activates a brand-new first account and ensures the
2088
2159
  * rotation-settings row exists.
2089
2160
  */
2161
+ type UpsertCodexSubscriptionCredentialResult = {
2162
+ kind: "upserted";
2163
+ id: string;
2164
+ isNew: boolean;
2165
+ } | {
2166
+ kind: "unresolved_redemption";
2167
+ id: string;
2168
+ isNew: false;
2169
+ };
2090
2170
  declare function upsertCodexSubscriptionCredential(db: Database, input: {
2091
2171
  accountId: string;
2092
2172
  workspaceId: string;
@@ -2099,10 +2179,9 @@ declare function upsertCodexSubscriptionCredential(db: Database, input: {
2099
2179
  lastRefreshAt: Date | null;
2100
2180
  accountEmail?: string | null;
2101
2181
  label?: string | null;
2102
- }): Promise<{
2103
- id: string;
2104
- isNew: boolean;
2105
- }>;
2182
+ /** Direct managed-cookie human who most recently connected this row. */
2183
+ connectedBySubjectId?: string | null;
2184
+ }): Promise<UpsertCodexSubscriptionCredentialResult>;
2106
2185
  /**
2107
2186
  * The ONLY decrypt-read accessor. Fails closed. Never call from an API route that
2108
2187
  * returns the result.
@@ -2231,6 +2310,12 @@ type CodexAccountStatus = {
2231
2310
  status: string;
2232
2311
  /** New automatic allocations only; health/refresh and existing turns remain independent. */
2233
2312
  allocatorEnabled: boolean;
2313
+ allocatorVersion: number;
2314
+ allocatorUpdatedBySubjectId: string | null;
2315
+ allocatorUpdatedAt: Date | null;
2316
+ resetCreditAvailableCount: number | null;
2317
+ resetCreditsCheckedAt: Date | null;
2318
+ connectedBySubjectId: string | null;
2234
2319
  isActive: boolean;
2235
2320
  expiresAt: Date | null;
2236
2321
  lastRefreshAt: Date | null;
@@ -2250,7 +2335,7 @@ type CodexAccountStatus = {
2250
2335
  * the selection cursor gives deterministic fairness after those holders drain.
2251
2336
  * None of these fields contains credential material.
2252
2337
  */
2253
- type CodexLeaseAccountStatus = CodexAccountStatus & {
2338
+ type CodexLeaseAccountStatus = Omit<CodexAccountStatus, "allocatorVersion" | "allocatorUpdatedBySubjectId" | "allocatorUpdatedAt" | "resetCreditAvailableCount" | "resetCreditsCheckedAt" | "connectedBySubjectId"> & {
2254
2339
  activeLeaseCount: number;
2255
2340
  selectionCount: number;
2256
2341
  lastSelectedAt: Date | null;
@@ -2552,13 +2637,198 @@ declare function quarantineCodexCredentialForLease(db: Database, input: {
2552
2637
  * the workspace active pointer. Ordered by created_at ASC (stable list order).
2553
2638
  */
2554
2639
  declare function listCodexAccountStatuses(db: Database, workspaceId: string): Promise<CodexAccountStatus[]>;
2640
+ type CodexAllocatorUpdateResult = {
2641
+ kind: "updated" | "unchanged";
2642
+ allocatorEnabled: boolean;
2643
+ allocatorVersion: number;
2644
+ allocatorUpdatedBySubjectId: string | null;
2645
+ allocatorUpdatedAt: Date | null;
2646
+ } | {
2647
+ kind: "conflict";
2648
+ allocatorEnabled: boolean;
2649
+ allocatorVersion: number;
2650
+ allocatorUpdatedBySubjectId: string | null;
2651
+ allocatorUpdatedAt: Date | null;
2652
+ } | {
2653
+ kind: "not_found";
2654
+ };
2655
+ /**
2656
+ * Toggle only NEW allocator eligibility under credential-row OCC.
2657
+ *
2658
+ * Same-state writes are idempotent even when `expectedVersion` is stale. A real
2659
+ * state transition requires the exact current version, increments only the
2660
+ * allocator version, and writes one audit row in the same transaction. It never
2661
+ * touches credential `version`, health, encrypted material, cooldown, or quota.
2662
+ */
2663
+ declare function updateCodexAllocatorEligibility(db: Database, input: {
2664
+ accountId: string;
2665
+ workspaceId: string;
2666
+ credentialId: string;
2667
+ subjectId: string;
2668
+ enabled: boolean;
2669
+ expectedVersion: number;
2670
+ }): Promise<CodexCapacityMutationResult<CodexAllocatorUpdateResult>>;
2671
+ declare const CODEX_RESET_REDEMPTION_OUTCOMES: readonly ["reset", "nothingToReset", "noCredit", "alreadyRedeemed"];
2672
+ type CodexResetRedemptionOutcome = (typeof CODEX_RESET_REDEMPTION_OUTCOMES)[number];
2673
+ type CodexResetRedemptionStatus = "processing" | "provider_started" | "completed";
2674
+ type CodexResetRedemptionAttempt = {
2675
+ id: string;
2676
+ accountId: string;
2677
+ workspaceId: string;
2678
+ credentialId: string;
2679
+ subjectId: string;
2680
+ browserSessionHash: string;
2681
+ creditId: string;
2682
+ upstreamIdempotencyKey: string;
2683
+ status: CodexResetRedemptionStatus;
2684
+ outcome: CodexResetRedemptionOutcome | null;
2685
+ claimHolderId: string | null;
2686
+ claimExpiresAt: Date | null;
2687
+ confirmationExpiresAt: Date;
2688
+ providerStartedAt: Date | null;
2689
+ completedAt: Date | null;
2690
+ lastFailureKind: string | null;
2691
+ retryCount: number;
2692
+ createdAt: Date;
2693
+ updatedAt: Date;
2694
+ };
2695
+ /** Metadata-only attempt read used to resume a browser-session-bound ambiguity. */
2696
+ declare function getCodexResetRedemptionAttempt(db: Database, workspaceId: string, attemptId: string): Promise<CodexResetRedemptionAttempt | null>;
2697
+ type CodexResetRedemptionRecovery = {
2698
+ attemptId: string;
2699
+ credentialId: string;
2700
+ creditId: string;
2701
+ status: "provider_started" | "completed";
2702
+ outcome: CodexResetRedemptionOutcome | null;
2703
+ providerStartedAt: Date | null;
2704
+ completedAt: Date | null;
2705
+ createdAt: Date;
2706
+ updatedAt: Date;
2707
+ };
2708
+ /**
2709
+ * Cookie-owner discovery source for durable ambiguous/completed attempts.
2710
+ * Browser storage is never required to recover these non-secret identifiers.
2711
+ */
2712
+ declare function listCodexResetRedemptionRecoveries(db: Database, input: {
2713
+ accountId: string;
2714
+ workspaceId: string;
2715
+ subjectId: string;
2716
+ }): Promise<CodexResetRedemptionRecovery[]>;
2717
+ type AdoptCodexResetRedemptionResult = {
2718
+ kind: "current" | "adopted";
2719
+ attempt: CodexResetRedemptionAttempt;
2720
+ } | {
2721
+ kind: "in_progress";
2722
+ } | {
2723
+ kind: "not_found";
2724
+ } | {
2725
+ kind: "forbidden";
2726
+ } | {
2727
+ kind: "conflict";
2728
+ };
2729
+ /** Adopt a released durable ambiguity/completion into the owner's current browser session. */
2730
+ declare function adoptCodexResetRedemptionAttempt(db: Database, input: {
2731
+ accountId: string;
2732
+ workspaceId: string;
2733
+ attemptId: string;
2734
+ credentialId: string;
2735
+ creditId: string;
2736
+ subjectId: string;
2737
+ browserSessionHash: string;
2738
+ }): Promise<AdoptCodexResetRedemptionResult>;
2739
+ type ClaimCodexResetRedemptionResult = {
2740
+ kind: "claimed";
2741
+ attempt: CodexResetRedemptionAttempt;
2742
+ } | {
2743
+ kind: "in_progress";
2744
+ attempt: CodexResetRedemptionAttempt;
2745
+ } | {
2746
+ kind: "completed";
2747
+ attempt: CodexResetRedemptionAttempt;
2748
+ } | {
2749
+ kind: "not_found";
2750
+ } | {
2751
+ kind: "forbidden";
2752
+ } | {
2753
+ kind: "conflict";
2754
+ };
2755
+ /**
2756
+ * Claim or reclaim one logical redemption across API replicas/crashes.
2757
+ *
2758
+ * A transaction advisory lock closes the initial INSERT race. A live claim
2759
+ * yields `in_progress`; an expired/released claim is reclaimed without changing
2760
+ * the status or upstream key. Existing attempt identity is immutable.
2761
+ */
2762
+ declare function claimCodexResetRedemption(db: Database, input: {
2763
+ id: string;
2764
+ accountId: string;
2765
+ workspaceId: string;
2766
+ credentialId: string;
2767
+ subjectId: string;
2768
+ browserSessionHash: string;
2769
+ creditId: string;
2770
+ confirmationExpiresAt: Date;
2771
+ claimHolderId: string;
2772
+ claimTtlMs?: number;
2773
+ }): Promise<ClaimCodexResetRedemptionResult>;
2774
+ type CodexResetRedemptionSendNotReadyReason = "not_found" | "identity_mismatch" | "claim_expired" | "confirmation_expired" | "credential_unavailable" | "already_completed";
2775
+ type FenceCodexResetRedemptionSendResult = {
2776
+ kind: "ready";
2777
+ attempt: CodexResetRedemptionAttempt;
2778
+ } | {
2779
+ kind: "not_ready";
2780
+ reason: CodexResetRedemptionSendNotReadyReason;
2781
+ };
2782
+ /**
2783
+ * Final DB-time irreversible-send fence, called only after preflight and token
2784
+ * resolution and immediately before every provider POST (including ambiguity
2785
+ * retries). The credential SHARE lock serializes against disconnect and
2786
+ * ownership-changing reconnect. The claim is extended beyond the bounded
2787
+ * consume operation in the same transaction that persists provider_started.
2788
+ */
2789
+ declare function fenceCodexResetRedemptionSend(db: Database, input: {
2790
+ accountId: string;
2791
+ workspaceId: string;
2792
+ attemptId: string;
2793
+ claimHolderId: string;
2794
+ credentialId: string;
2795
+ subjectId: string;
2796
+ browserSessionHash: string;
2797
+ sendLeaseMs?: number;
2798
+ }): Promise<FenceCodexResetRedemptionSendResult>;
2799
+ /** Delete only definite pre-provider work still owned by this request. */
2800
+ declare function abandonCodexResetRedemptionBeforeProvider(db: Database, input: {
2801
+ accountId: string;
2802
+ workspaceId: string;
2803
+ attemptId: string;
2804
+ claimHolderId: string;
2805
+ }): Promise<boolean>;
2806
+ /** Release a failed claim while preserving processing/provider_started truth. */
2807
+ declare function releaseCodexResetRedemptionClaim(db: Database, input: {
2808
+ accountId: string;
2809
+ workspaceId: string;
2810
+ attemptId: string;
2811
+ claimHolderId: string;
2812
+ failureKind: string;
2813
+ }): Promise<boolean>;
2814
+ /** Persist the exact provider outcome, cooldown repair, and audit atomically. */
2815
+ declare function completeCodexResetRedemption(db: Database, input: {
2816
+ accountId: string;
2817
+ workspaceId: string;
2818
+ attemptId: string;
2819
+ claimHolderId: string;
2820
+ outcome: CodexResetRedemptionOutcome;
2821
+ }): Promise<CodexCapacityMutationResult<CodexResetRedemptionAttempt | null>>;
2555
2822
  /** The P2 usage-cache snapshot written by the refreshing usage wrapper. */
2556
2823
  type CodexAccountUsageSnapshot = {
2557
- primaryUsedPercent: number | null;
2558
- primaryResetAt: Date | null;
2559
- secondaryUsedPercent: number | null;
2560
- secondaryResetAt: Date | null;
2561
- checkedAt: Date;
2824
+ primaryUsedPercent?: number | null;
2825
+ primaryResetAt?: Date | null;
2826
+ secondaryUsedPercent?: number | null;
2827
+ secondaryResetAt?: Date | null;
2828
+ /** Present only when the quota body parsed successfully. */
2829
+ checkedAt?: Date;
2830
+ resetCreditAvailableCount?: number | null;
2831
+ resetCreditsCheckedAt?: Date | null;
2562
2832
  };
2563
2833
  /**
2564
2834
  * Cache-write for P2 quota bars: persist the five plaintext usage columns on a
@@ -2704,9 +2974,13 @@ declare function recordSessionActiveCodexCredential(db: Database, workspaceId: s
2704
2974
  declare function disconnectCodexAccount(db: Database, workspaceId: string, credentialId: string): Promise<{
2705
2975
  removed: boolean;
2706
2976
  newActiveCredentialId: string | null;
2977
+ blockedByUnresolvedRedemption: boolean;
2978
+ }>;
2979
+ /** Legacy "disconnect all"; atomically rejects when any provider work is unresolved. */
2980
+ declare function disconnectAllCodexAccounts(db: Database, workspaceId: string): Promise<{
2981
+ removed: number;
2982
+ blockedCredentialIds: string[];
2707
2983
  }>;
2708
- /** Legacy "disconnect all" (old workspace-wide behavior). Returns rows removed. */
2709
- declare function disconnectAllCodexAccounts(db: Database, workspaceId: string): Promise<number>;
2710
2984
  declare function recordAuditEvent(db: Database, input: {
2711
2985
  accountId: string;
2712
2986
  workspaceId?: string | null;
@@ -2739,7 +3013,13 @@ declare function updateSessionMcpServerCredentials(db: Database, input: {
2739
3013
  sessionId: string;
2740
3014
  updates: UpdateSessionMcpServerCredentialsInput[];
2741
3015
  }): Promise<UpdateSessionMcpServerCredentialsResult>;
2742
- declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, encryptionKey: Uint8Array | null): Promise<SessionMcpServerForRun[]>;
3016
+ declare function updateSessionMcpApprovalPolicy(db: Database, input: {
3017
+ workspaceId: string;
3018
+ sessionId: string;
3019
+ serverId: string;
3020
+ requireApproval: SessionMcpApprovalPolicy;
3021
+ }): Promise<UpdateSessionMcpApprovalPolicyResult>;
3022
+ declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, attemptId: string, encryptionKey: Uint8Array | null): Promise<SessionMcpServerForRun[]>;
2743
3023
  type AgentSessionCreationActor = Extract<SessionCommandActor, {
2744
3024
  type: "agent_attempt";
2745
3025
  }>;
@@ -2756,6 +3036,7 @@ declare function createSession(db: Database, input: {
2756
3036
  initialTurnInstructions?: string | null;
2757
3037
  resources: ResourceRef[];
2758
3038
  tools?: ToolRef[];
3039
+ toolPolicy?: SessionToolPolicy | null;
2759
3040
  metadata: Record<string, unknown>;
2760
3041
  /**
2761
3042
  * Frozen creator authority. Legacy/test-only callers may omit this and get
@@ -2796,6 +3077,7 @@ declare function createSessionWithIdempotencyKey(db: Database, input: {
2796
3077
  initialTurnInstructions?: string | null;
2797
3078
  resources: ResourceRef[];
2798
3079
  tools?: ToolRef[];
3080
+ toolPolicy?: SessionToolPolicy | null;
2799
3081
  metadata: Record<string, unknown>;
2800
3082
  createdBy?: TurnInitiator;
2801
3083
  createdByContext?: TurnInitiatorContext;
@@ -3031,6 +3313,14 @@ type ListSessionEventsOptions = {
3031
3313
  excludeClasses?: readonly SessionEventSemanticClass[];
3032
3314
  defaultExcludeTypes?: readonly SessionEventType[];
3033
3315
  payloadMode?: SessionEventPayloadMode;
3316
+ /**
3317
+ * Internal exclusive-latest selector. Eligible legacy rows with a null
3318
+ * association remain visible, while late-rejected and duplicate callbacks do
3319
+ * not compete with current truth. Durable session sequence is authoritative
3320
+ * across distinct turns; turn generation is metadata only here. Callers must
3321
+ * pair this with a single semantic class and limit 1.
3322
+ */
3323
+ authoritativeLatest?: boolean;
3034
3324
  };
3035
3325
  type ListSessionEventPageOptions = ListSessionEventsOptions & {
3036
3326
  /** Exact UTF-8 JSON-array envelope budget for rows materialized by the app. */
@@ -3071,9 +3361,25 @@ declare function listSessionEvents(db: Database, workspaceId: string, sessionId:
3071
3361
  type ToolspaceCallReservation = {
3072
3362
  reserved: true;
3073
3363
  count: number;
3364
+ turn: SessionTurnForExecution;
3074
3365
  } | {
3075
3366
  reserved: false;
3367
+ reason: TurnAttemptFenceRejectReason | "budget_exhausted";
3368
+ };
3369
+ type ToolspaceTurnAttemptClaims = {
3370
+ sessionId: string;
3371
+ turnId: string;
3372
+ attemptId: string;
3373
+ executionGeneration: number;
3076
3374
  };
3375
+ /**
3376
+ * Admit one exact Toolspace bearer before any session credential is decrypted or
3377
+ * any upstream schema is enumerated. This intentionally reuses the canonical
3378
+ * activity write fence so Pause/Steer, attempt replacement, generation changes,
3379
+ * and terminal settlement revoke a copied token at the same linearization point
3380
+ * as other attempt-owned writes.
3381
+ */
3382
+ declare function admitToolspaceTurnAttempt(db: Database, workspaceId: string, claims: ToolspaceTurnAttemptClaims): Promise<boolean>;
3077
3383
  /**
3078
3384
  * Atomically reserve one toolspace call against a turn's per-turn budget.
3079
3385
  *
@@ -3081,10 +3387,20 @@ type ToolspaceCallReservation = {
3081
3387
  * below `limit` and returns the post-increment value. Concurrent reservations
3082
3388
  * for the same turn serialize on the row lock, so exactly `limit` of N
3083
3389
  * simultaneous callers observe `reserved: true` — closing the read-then-append
3084
- * TOCTOU the event-count approach had. `reserved: false` means the turn is at or
3085
- * over budget (or the turn row no longer exists).
3390
+ * TOCTOU the event-count approach had. The returned attempt id is captured by
3391
+ * that same UPDATE, so callers cannot accidentally execute under a successor
3392
+ * attempt. `reserved: false` means the turn is not executable, at/over budget,
3393
+ * or no longer exists.
3086
3394
  */
3087
- declare function reserveToolspaceCallForTurn(db: Database, workspaceId: string, sessionId: string, turnId: string, limit: number): Promise<ToolspaceCallReservation>;
3395
+ declare function reserveToolspaceCallForAttempt(db: Database, input: {
3396
+ accountId: string;
3397
+ workspaceId: string;
3398
+ sessionId: string;
3399
+ turnId: string;
3400
+ executionGeneration: number;
3401
+ attemptId: string;
3402
+ limit: number;
3403
+ }): Promise<ToolspaceCallReservation>;
3088
3404
  declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
3089
3405
  declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
3090
3406
  declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
@@ -3153,6 +3469,30 @@ declare function getHumanInputResumeForEvent(db: Database, workspaceId: string,
3153
3469
  response: HumanInputResponse;
3154
3470
  } | null>;
3155
3471
  type TurnAttemptFenceRejectReason = "workspace_paused" | "session_paused" | "pending_control" | "active_turn_changed" | "generation_changed" | "attempt_changed" | "turn_terminal" | "not_found";
3472
+ type InstallOrReadTurnExecutionPolicyForAttemptResult = {
3473
+ accepted: true;
3474
+ installed: boolean;
3475
+ policy: TurnExecutionPolicyV1;
3476
+ turn: SessionTurn;
3477
+ } | {
3478
+ accepted: false;
3479
+ reason: TurnAttemptFenceRejectReason;
3480
+ };
3481
+ /**
3482
+ * Freeze a legacy turn's execution identity at its first admitted attempt, or
3483
+ * return the policy already accepted for this logical turn. The exact active
3484
+ * attempt owns this mutation; malformed present metadata fails closed and a
3485
+ * replay never replaces an existing valid policy.
3486
+ */
3487
+ declare function installOrReadTurnExecutionPolicyForAttempt(db: Database, input: {
3488
+ accountId: string;
3489
+ workspaceId: string;
3490
+ sessionId: string;
3491
+ turnId: string;
3492
+ executionGeneration: number;
3493
+ attemptId: string;
3494
+ policyForAbsent: TurnExecutionPolicyV1;
3495
+ }): Promise<InstallOrReadTurnExecutionPolicyForAttemptResult>;
3156
3496
  /**
3157
3497
  * Append conversation items (verbatim SDK AgentInputItems) to the session's
3158
3498
  * history. Idempotent on (workspace, session, position): concurrent or
@@ -3195,6 +3535,16 @@ declare function registerPendingSessionToolCall(db: Database, input: PendingSess
3195
3535
  accepted: boolean;
3196
3536
  registered: boolean;
3197
3537
  }>;
3538
+ /**
3539
+ * Clear one completed Toolspace receipt after its attempt-fenced output event is
3540
+ * durable. If control already replaced the attempt, its settlement transaction
3541
+ * owns the receipt and will retain an explicit outcome-unknown or the durable
3542
+ * output event instead.
3543
+ */
3544
+ declare function clearPendingSessionToolspaceCall(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem">): Promise<{
3545
+ accepted: boolean;
3546
+ cleared: boolean;
3547
+ }>;
3198
3548
  /** Record the raw SDK result without dropping the call receipt. */
3199
3549
  declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
3200
3550
  resultItem: Record<string, unknown>;
@@ -4448,6 +4798,8 @@ type InitializeSessionStartInput = {
4448
4798
  sessionId: string;
4449
4799
  clientEventId?: string;
4450
4800
  reasoningEffortFallback: ReasoningEffort;
4801
+ /** Trusted create-session policy. Omitted only by legacy low-level callers. */
4802
+ turnExecutionPolicy?: TurnExecutionPolicyV1;
4451
4803
  createdEventPayload: Record<string, unknown>;
4452
4804
  goal?: {
4453
4805
  text: string;
@@ -4784,6 +5136,12 @@ type RecoverSessionDispatchResult = {
4784
5136
  */
4785
5137
  declare function recoverSessionDispatch(db: Database, workspaceId: string, input: RecoverSessionDispatchInput): Promise<RecoverSessionDispatchResult>;
4786
5138
  declare function getSessionTurn(db: Database, workspaceId: string, turnId: string): Promise<SessionTurn | null>;
5139
+ /**
5140
+ * Resolve the exact currently executable turn/attempt from authoritative
5141
+ * pointers in one query. This avoids treating a stale session preview as proof
5142
+ * that no attempt exists during an atomic claim transition.
5143
+ */
5144
+ declare function getActiveSessionTurnForExecution(db: Database, workspaceId: string, sessionId: string): Promise<SessionTurnForExecution | null>;
4787
5145
  declare function getSessionTurnForAttempt(db: Database, workspaceId: string, sessionId: string, attemptId: string): Promise<SessionTurnForExecution | null>;
4788
5146
  /**
4789
5147
  * Return the newest turn that reached agent execution for a session. A claimed
@@ -4876,11 +5234,26 @@ declare function enqueueSessionWorkflowWakeIfRunnable(db: Database, input: {
4876
5234
  /** Claim only explicit, undelivered wake revisions; never infer work by scan. */
4877
5235
  declare function claimPendingSessionWorkflowWakes(db: Database, limit?: number): Promise<SessionWorkflowWake[]>;
4878
5236
  /**
4879
- * Acknowledge an immediate post-commit signal. An older sender may advance only
4880
- * its own revision; it cannot clear a claim or failure state belonging to a
4881
- * newer revision.
5237
+ * Acknowledge an immediate post-commit signal only after it cannot strand an
5238
+ * accepted Agent Steer. Temporal accepting a signal is transport evidence, not
5239
+ * proof that a closing workflow observed Postgres or admitted its pending
5240
+ * direction. While active control still has an actionable Agent Steer, retain
5241
+ * the revision so the bounded outbox dispatcher retries signalWithStart. The
5242
+ * attempt-fenced claim consumes the update once; a real Pause is the typed
5243
+ * blocker and may acknowledge this revision because Resume commits a new one.
5244
+ *
5245
+ * An older sender may advance only its own revision; it cannot clear a claim or
5246
+ * failure state belonging to a newer revision. The control -> workspace ->
5247
+ * session lock prefix serializes this decision with Steer, Pause/Resume, and
5248
+ * claim without weakening physical-quiescence admission.
4882
5249
  */
4883
- declare function markSessionWorkflowWakeDelivered(db: Database, input: Omit<SessionWorkflowWake, "interruptionRequested">): Promise<void>;
5250
+ type SessionWorkflowWakeDeliveryResult = {
5251
+ action: "acknowledged";
5252
+ } | {
5253
+ action: "pending_admission";
5254
+ blocker: "pending_agent_steer";
5255
+ };
5256
+ declare function markSessionWorkflowWakeDelivered(db: Database, input: Omit<SessionWorkflowWake, "interruptionRequested">): Promise<SessionWorkflowWakeDeliveryResult>;
4884
5257
  /** Record delivery failure; the claim already scheduled the bounded retry. */
4885
5258
  declare function markSessionWorkflowWakeFailed(db: Database, input: SessionWorkflowWake, error: string): Promise<boolean>;
4886
5259
  declare function getOrCreateSessionSystemUpdateOutbox(db: Database, input: Omit<SessionSystemUpdateOutboxDelivery, "id" | "status">): Promise<SessionSystemUpdateOutboxDelivery>;
@@ -4970,6 +5343,7 @@ declare function appendSessionEventsAndUpdateSession(db: Database, workspaceId:
4970
5343
  }): Promise<SessionEvent[]>;
4971
5344
  type LockedSessionUpdateContext = {
4972
5345
  updateSessionMcpServerCredentials: (updates: UpdateSessionMcpServerCredentialsInput[]) => Promise<UpdateSessionMcpServerCredentialsResult>;
5346
+ updateSessionMcpApprovalPolicy: (serverId: string, requireApproval: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResult>;
4973
5347
  listPendingSessionTurns: () => Promise<SessionTurn[]>;
4974
5348
  };
4975
5349
  type LockedSessionUpdateResult = {
@@ -4986,4 +5360,4 @@ type LockedSessionUpdateResult = {
4986
5360
  declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>): Promise<SessionEvent[]>;
4987
5361
  declare function sessionSubject(workspaceId: string, sessionId: string): string;
4988
5362
 
4989
- export { type CorrectWorkspaceMemoryInput as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BootstrapWorkspaceInput as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexCapacityResetKind as D, type CodexCapacitySelectionContext as E, type CodexCapacityWait as F, type CodexCapacityWaitStatus as G, type CodexCapacityWakeTarget as H, type CodexCredentialForRun as I, type CodexCredentialLeaseCandidateFilter as J, type CodexCredentialLeaseCandidateFilterResult as K, type CodexCredentialLeasePolicyScopeResolver as L, type CodexCredentialLeaseQuarantine as M, type CodexCredentialLeaseResult as N, type CodexCredentialLeaseSelection as O, type CodexCredentialLeaseSelectionContext as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialStatus as Q, type CodexCredentialTokens as R, type CodexLeaseAccountStatus as S, type CodexPinSource as T, type CodexRotationSettings as U, type CodexRotationStrategy as V, type ComposerDraftRow as W, type ConnectionBrokerDeps as X, type ConnectionCredentialForBroker as Y, ConnectionRefreshHttpError as Z, type ConsumeOAuthStateNonceInput as _, type AcceptSessionApprovalDecisionResult as a, MEMORY_BLOCK_RECORD_LIMIT as a$, type CorrectWorkspaceMemoryResult as a0, type CreateCapabilityCatalogItemInput as a1, type CreateConnectionInput as a2, type CreateDbOptions as a3, type CreateImportBatchInput as a4, type CreateKnowledgeMemoryInput as a5, type CreatePackInstallationInput as a6, type CreateScheduledTaskInput as a7, type CreateSessionGoalInput as a8, type CreateSessionMcpServerInput as a9, type GoalContinuationDecision as aA, type HostExportConsumerStatus as aB, type HostExportKind as aC, HostExportPayloadError as aD, HostMcpCredentialBindingError as aE, type HostMcpCredentialResolverContext as aF, HostMcpCredentialScopeError as aG, HumanInputResponseValidationError as aH, type IdempotentPersistenceTransactionOptions as aI, type ImportBatch as aJ, type InitializeSessionStartInput as aK, type InitializeSessionStartResult as aL, type IntegrationOAuthClientForUse as aM, type LeaseHolderKind as aN, type LeaseSnapshot as aO, type ListKnowledgeMemoryOptions as aP, type ListSessionEventPageOptions as aQ, type ListSessionEventsOptions as aR, type ListSessionsForSubjectOptions as aS, type ListSessionsOptions as aT, type LiveModalSandboxLeaseAttribution as aU, MACHINE_METRICS_SERIES_INTERVAL_MS as aV, MAX_INTERNAL_UPDATE_BATCH_BYTES as aW, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as aX, MAX_INTERNAL_UPDATE_BYTES as aY, MEMORY_ACTIVE_RECORD_CAP as aZ, MEMORY_BLOCK_KIND_ORDER as a_, type CreateSocialConnectionInput as aa, type CreateSocialPostInput as ab, type CreditBalanceByAccount as ac, type Database as ad, type DatabaseFailureCode as ae, type DbClient as af, type DeviceEnrollmentRequestRecord as ag, type DeviceEnrollmentStatus as ah, type EditQueueCommandResult as ai, type EffectiveControlBlocker as aj, type EffectiveControlResumeOption as ak, type EffectiveControlState as al, type EffectiveSessionControl as am, type EnableCapabilityInstallationInput as an, type EnabledMcpCapabilityServer as ao, type EnqueueSessionTurnInput as ap, type EnrollmentExposure as aq, type EnrollmentOs as ar, type EnrollmentRecord as as, type EnrollmentStatus as at, type ExpiredFileUploadCleanupClaim as au, type FileUploadCleanupClaimResult as av, type ForceDrainResult as aw, type FrozenTurnInitiator as ax, type GitHubInstallation as ay, type GitHubInstallationAccess as az, type AcceptSessionHumanInputResponseResult as b, type SessionCommandActor as b$, MEMORY_CORRECT_TOOL_DESCRIPTION as b0, MEMORY_KIND_SECTION_TITLES as b1, MEMORY_NEAR_DUP_COSINE_THRESHOLD as b2, MEMORY_NEAR_DUP_NEIGHBORS as b3, MEMORY_SAVE_TOOL_DESCRIPTION as b4, MEMORY_SEARCH_DEFAULT_LIMIT as b5, MEMORY_SEARCH_MAX_LIMIT as b6, MEMORY_SEARCH_TOOL_DESCRIPTION as b7, MEMORY_TEXT_MAX_CHARS as b8, MEMORY_VISIBLE_RECORD_CAP as b9, RigActiveVersionChangedError as bA, RigChangeAlreadyVerifyingError as bB, type RigChangeMonitoringSummary as bC, RigChangeTransitionError as bD, type RigVersionContentInput as bE, type RigVersionMonitoringSummary as bF, type RlsContext as bG, type RlsStrategy as bH, SESSION_ANCESTRY_LIMIT as bI, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as bJ, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as bK, SESSION_DISCOVERY_GOAL_MAX_CHARS as bL, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as bM, SESSION_EVENT_DB_PAGE_MAX_BYTES as bN, type SafeDatabaseErrorFacts as bO, SandboxImageConflictError as bP, type SandboxKind as bQ, type SandboxLeaseLiveness as bR, SandboxLeaseSupersededError as bS, type SandboxPtySessionRow as bT, type SandboxRecord as bU, SandboxRigConflictError as bV, SanitizedDatabasePersistenceCause as bW, type SaveWorkspaceMemoryInput as bX, type SaveWorkspaceMemoryResult as bY, type SessionAttemptInterruptionSettlement as bZ, type SessionCodexState as b_, type MachineMetricsRow as ba, type MachineMetricsSample as bb, type MarkWarmLeaseInstanceLostResult as bc, type MemoryBlockRecord as bd, type MemoryEmbedder as be, type MemorySanitizeResult as bf, type MeterableWarmLease as bg, type PendingSessionToolCallInput as bh, type PersistenceFailureDetails as bi, type PersistenceRetryOutcome as bj, type QueueCommandConflictCode as bk, QueueCommandConflictError as bl, type QueueCommandResult as bm, type QueuedTurnRow as bn, type ReapDrainable as bo, type ReconcileCodexCapacityWaitResult as bp, type RecoverSessionDispatchInput as bq, type RecoverSessionDispatchResult as br, type RegisterWorkspacePackInput as bs, type RegistryCapabilityCatalogItemInput as bt, type RegistryCatalogSurfaceKey as bu, type ReplaceIntegrationOAuthClientInput as bv, type RequestSessionTurnRecoveryInput as bw, type RequestSessionTurnRecoveryResult as bx, type ResolveConnectionCredentialInput as by, type ResolveConnectionCredentialResult as bz, type AccrueWarmSecondsResult as c, type WorkspaceMemorySearchInput as c$, SessionCommandIdempotencyError as c0, type SessionCommandReceiptRow as c1, SessionContextBusyError as c2, SessionControlConflictError as c3, SessionControlInvariantError as c4, type SessionControlMutationResult as c5, type SessionDiscoveryControl as c6, type SessionDiscoveryCursor as c7, type SessionDiscoveryOrderBy as c8, type SessionDiscoverySummary as c9, type SteerQueueCommandResult as cA, type StoreIntegrationOAuthClientInput as cB, type StoredIntegrationOAuthClient as cC, type StreamAcknowledgment as cD, type SubmitHumanPromptResult as cE, type ToolspaceCallReservation as cF, type TurnAttemptFenceRejectReason as cG, type UpdateConnectionInput as cH, type UpdateImportBatchCountsInput as cI, type UpdateKnowledgeMemoryInput as cJ, type UpdateScheduledTaskInput as cK, type UpdateSessionMcpServerCredentialsInput as cL, type UpdateSessionMcpServerCredentialsResult as cM, type UserLookup as cN, type VariableSetForRun as cO, WORKSPACE_MEMORY_BLOCK_EMPTY as cP, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as cQ, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as cR, type WorkspaceCaptureCommitResult as cS, type WorkspaceCaptureGcPlan as cT, type WorkspaceCaptureGcRow as cU, type WorkspaceCaptureRow as cV, type WorkspaceControlLockMode as cW, type WorkspaceControlMutationResult as cX, type WorkspaceControlRow as cY, type WorkspaceEnvironmentForRun as cZ, type WorkspaceMemoryOrigin as c_, type SessionEventPage as ca, SessionEventPersistenceError as cb, type SessionEventWriteLockInput as cc, type SessionEventWriteLocks as cd, SessionIdConflictError as ce, type SessionLineage as cf, SessionListAccessError as cg, type SessionListCursor as ch, SessionListCursorError as ci, type SessionMcpServerForRun as cj, SessionPinAccessError as ck, SessionPinVersionConflictError as cl, type SessionRecordingCodec as cm, type SessionRecordingMode as cn, type SessionRecordingRow as co, type SessionRecordingState as cp, type SessionSystemUpdateOutboxDelivery as cq, type SessionTurnAttemptOutcome as cr, type SessionTurnForExecution as cs, type SessionTurnRecordingSettlement as ct, type SessionWorkPeek as cu, type SessionWorkTrigger as cv, type SessionWorkflowWake as cw, type SetSessionCodexPinOptions as cx, type SettleCodexCredentialFailoverResult as cy, type SettleCodexCredentialLeaseLossResult as cz, type AcquireLeaseInput as d, countActiveSessionHistoryItems as d$, type WorkspaceMemorySearchMode as d0, type WorkspaceMemorySearchResult as d1, type WorkspaceModelPolicy as d2, abandonRecordingForTurnAttempt as d3, acceptSessionApprovalDecision as d4, acceptSessionHumanInputResponse as d5, accrueWarmSeconds as d6, acknowledgeHostExportBatch as d7, acquireCodexCredentialLease as d8, acquireLease as d9, buildConnectionTokenResolver as dA, buildHostConnectionTokenResolver as dB, canonicalSessionCommandHash as dC, claimExpiredFileUploadCleanup as dD, claimFileUploadCleanup as dE, claimHostExportBatch as dF, claimPendingSessionSystemUpdateOutbox as dG, claimPendingSessionWorkflowWakes as dH, claimSessionWorkForAttempt as dI, clearDurablePendingSessionToolCalls as dJ, clearEnrollmentWentOffline as dK, clearSessionContext as dL, clearSessionGoal as dM, clearedContextMarkerItem as dN, closePtySession as dO, closeSessionTurnAttemptInTransaction as dP, codexCapacityRefreshBackoffMs as dQ, commitWarmingToWarm as dR, completeExpiredFileUploadCleanup as dS, completeFileUpload as dT, completeFileUploadCleanup as dU, computeWorkspaceCaptureGcPlan as dV, confirmDrainCold as dW, consumeDeviceEnrollmentRequest as dX, consumeIntegrationOAuthStateNonce as dY, correctWorkspaceMemory as dZ, countActiveApiKeysForWorkspace as d_, activateRigVersion as da, addSessionSystemUpdate as db, addSessionSystemUpdateWithSourceMutation as dc, allAccountPermissions as dd, allWorkspacePermissions as de, appendSessionEventToSandboxGroup as df, appendSessionEvents as dg, appendSessionEventsAndUpdateSession as dh, appendSessionEventsForTurnAttempt as di, appendSessionEventsWithLockedSessionUpdate as dj, appendSessionHistoryItems as dk, applyContextCompaction as dl, applyCreditDebitUpToBalance as dm, applyCreditLedgerEntry as dn, applySessionTurnSettlement as dp, approveDeviceEnrollmentRequest as dq, areGitHubRepositoriesAllowedForWorkspace as dr, armCodexCapacityWait as ds, assertAgentCommandAuthorityInTransaction as dt, autoResumeSessionBranchInTransaction as du, beginRigChangeVerificationAttempt as dv, bindGitHubInstallationRepositories as dw, bootstrapWorkspace as dx, buildChildCompletionDigest as dy, buildCodexTokenResolver as dz, type AcquireLeaseResult as e, enableCapabilityInstallation as e$, countActiveSessionsForWorkspace as e0, countActiveSessionsUsingEnvironment as e1, countActiveSessionsUsingVariableSet as e2, countConsecutiveReactiveRotations as e3, countQueuedTurns as e4, countRigs as e5, countSandboxLeasesByLiveness as e6, countScheduledTasksForWorkspace as e7, countScheduledTasksUsingEnvironment as e8, countScheduledTasksUsingVariableSet as e9, createVariableSet as eA, createWorkspace as eB, createWorkspaceEnvironment as eC, databaseFailureCode as eD, deadLetterHostExportHead as eE, decodeSessionListCursor as eF, decryptEnvironmentValue as eG, decryptedCapabilityHeaders as eH, deleteGitHubInstallationBinding as eI, deleteRecording as eJ, deleteRig as eK, deleteRigIfNoActiveSessions as eL, deleteScheduledTask as eM, deleteSessionQueueItemInTransaction as eN, deleteVariableSet as eO, deleteVariableSetVariable as eP, deleteWorkspace as eQ, deleteWorkspaceCaptureRows as eR, deleteWorkspaceEnvironment as eS, deleteWorkspaceEnvironmentVariable as eT, deleteWorkspacePack as eU, denyDeviceEnrollmentRequest as eV, disableCapabilityInstallation as eW, disableHostExportConsumer as eX, disconnectAllCodexAccounts as eY, disconnectCodexAccount as eZ, editQueuedTurnInTransaction as e_, countSessionHistoryItems as ea, countSessionsUsingRig as eb, countVariableSets as ec, countWorkspaceEnvironments as ed, countWorkspacesForAccount as ee, createApiKey as ef, createConnection as eg, createDb as eh, createDeviceEnrollmentRequest as ei, createEnrollment as ej, createFileUpload as ek, createImportBatch as el, createKnowledgeMemory as em, createRig as en, createRigChange as eo, createRigVersion as ep, createRigVersionForChangePromotion as eq, createSandbox as er, createScheduledTask as es, createScheduledTaskRun as et, createSession as eu, createSessionGoal as ev, createSessionMcpServers as ew, createSessionWithIdempotencyKey as ex, createSocialConnection as ey, createSocialPost as ez, type ActiveSandboxPointer as f, getSessionEvent as f$, enablePackInstallation as f0, encodeSessionListCursor as f1, encryptEnvironmentValue as f2, enqueueSessionTurn as f3, enqueueSessionWorkflowWake as f4, enqueueSessionWorkflowWakeIfRunnable as f5, enqueueSessionWorkflowWakeInTransaction as f6, ensureCodexRotationSettings as f7, ensureManagedAccessForUser as f8, estimateMemoryTokens as f9, getFileUpload as fA, getHostExportConsumerStatus as fB, getHumanInputResumeForEvent as fC, getKnowledgeMemory as fD, getLatestRunState as fE, getLatestStartedSessionTurn as fF, getManagedAccount as fG, getManagedUserByEmail as fH, getMaterializedSandboxFileResources as fI, getOpenPtySession as fJ, getOrCreateSessionSystemUpdateOutbox as fK, getPackInstallation as fL, getPendingDeviceEnrollmentRequestByUserCode as fM, getPendingDeviceEnrollmentRequestByUserCodeGlobal as fN, getRecording as fO, getRig as fP, getRigByName as fQ, getRigChange as fR, getRigName as fS, getRigVersion as fT, getRigVersionById as fU, getSandbox as fV, getSandboxSessionEnvelope as fW, getScheduledTask as fX, getSession as fY, getSessionByCreateIdempotencyKey as fZ, getSessionCodexState as f_, evaluateGoalContinuation as fa, evaluateSessionControl as fb, evaluateSessionControls as fc, evaluateSessionDiscoveryControls as fd, expireSessionHumanInputRequest as fe, failHostExportBatch as ff, failWarmingToCold as fg, fetchCodexUsageForAccount as fh, finalizeEnrollmentByToken as fi, findActiveApiKeyByHash as fj, forceDrainOverLimitViewerOnlyBoxes as fk, frozenInitiatorForCommandActor as fl, getActiveSessionHistoryItems as fm, getAnySessionInGroup as fn, getBillingBalance as fo, getBillingCustomer as fp, getCapabilityCatalogItem as fq, getCapabilityInstallation as fr, getCodexCapacityWaitForSession as fs, getCodexCredentialStatus as ft, getCodexRotationSettings as fu, getComposerDraftInTransaction as fv, getConnectionMetadata as fw, getDeviceEnrollmentRequestByDeviceCode as fx, getEnrollment as fy, getFile as fz, type AddSessionSystemUpdateInput as g, listLiveModalSandboxLeaseAttributions as g$, getSessionEventByClientEventId as g0, getSessionForSubject as g1, getSessionGoal as g2, getSessionHistoryItems as g3, getSessionHumanInputRequest as g4, getSessionLineage as g5, getSessionQueueSnapshot as g6, getSessionRootId as g7, getSessionSystemUpdateOutboxByDedupeKey as g8, getSessionTurn as g9, insertPtySession as gA, insertRecording as gB, insertWorkspaceCapture as gC, interruptedToolCallResult as gD, isCodexBilledTurn as gE, isDatabasePersistenceFailure as gF, isMemoryTextTooLong as gG, isPrivateAddress as gH, isRetryablePersistenceSqlState as gI, isSessionCompactionRequested as gJ, isSessionEventPersistenceError as gK, isStripeWebhookProcessed as gL, latestWorkspaceCapture as gM, listApiKeys as gN, listCapabilityCatalogItems as gO, listCapabilityInstallations as gP, listCodexAccountStatuses as gQ, listConnectionsMetadata as gR, listCreditBalancesByAccount as gS, listDistinctRigVersionIdsInGroup as gT, listDistinctVariableSetIdsInGroup as gU, listEnabledMcpCapabilityServers as gV, listEnrollments as gW, listGitHubInstallationAccessForWorkspace as gX, listGitHubInstallationIdsForWorkspace as gY, listGitHubInstallationsForWorkspace as gZ, listKnowledgeMemories as g_, getSessionTurnForAttempt as ga, getSocialConnection as gb, getStoredCapabilityHeaderCiphertext as gc, getStreamAcknowledgment as gd, getVariableSet as ge, getVariableSetByName as gf, getVariableSetValuesForRun as gg, getWorkspace as gh, getWorkspaceControlEvent as gi, getWorkspaceDefaultRigId as gj, getWorkspaceEnvironment as gk, getWorkspaceEnvironmentByName as gl, getWorkspaceEnvironmentValuesForRun as gm, getWorkspaceGrant as gn, getWorkspaceModelPolicy as go, getWorkspacePack as gp, grantWorkspaceAccess as gq, hasCreditLedgerEntry as gr, hashMemoryText as gs, heartbeatCodexCredentialLease as gt, heartbeatCodexCredentialLeaseUntil as gu, heartbeatLeaseHolder as gv, ingestMachineMetricsSample as gw, initializeSessionStartAtomically as gx, insertFailedWorkspaceCapture as gy, insertMachineMetricsSeries as gz, type AddSessionSystemUpdateResult as h, orphanedResultRowIndicesForRepair as h$, listMeterableWarmLeases as h0, listOpenPtySessions as h1, listOutstandingSessionSystemUpdates as h2, listPackInstallations as h3, listPendingCodexCapacityWakeTargets as h4, listPendingSessionTurns as h5, listRecordings as h6, listRegistryCatalogSurfaceKeys as h7, listRigChangeMonitoringSummaries as h8, listRigChanges as h9, listWorkspacesForSubject as hA, loadCodexCredentialForRun as hB, loadConnectionCredentialForBroker as hC, loadIntegrationOAuthClient as hD, loadVariableSetForRun as hE, loadWorkspaceEnvironmentForRun as hF, lockSessionEventWriteRows as hG, lockWorkspaceInferenceControl as hH, markFileUploadFailed as hI, markSandboxFileResourcesMaterialized as hJ, markScheduledTaskRunFailedIfQueued as hK, markSessionAttemptQuiesced as hL, markSessionSystemUpdateOutboxDeliveredInTransaction as hM, markSessionSystemUpdateOutboxFailed as hN, markSessionWorkflowWakeDelivered as hO, markSessionWorkflowWakeFailed as hP, markStaleRegistryCatalogItems as hQ, markStripeWebhookProcessed as hR, markWarmLeaseInstanceLost as hS, mcpServerIdForCapability as hT, moveQueuedTurnInTransaction as hU, mutateSessionControlInTransaction as hV, mutateWorkspaceControlInTransaction as hW, nestedPostgresSqlState as hX, nextSessionHistoryPosition as hY, normalizeBearerScheme as hZ, normalizeMemoryText as h_, listRigVersionMonitoringSummaries as ha, listRigVersions as hb, listRigs as hc, listSandboxes as hd, listScheduledTaskRuns as he, listScheduledTasks as hf, listSessionDiscoverySummaries as hg, listSessionEventPage as hh, listSessionEvents as hi, listSessionHumanInputRequests as hj, listSessionIdsInGroup as hk, listSessionMcpServerMetadata as hl, listSessionMcpServersForChildInheritance as hm, listSessionMcpServersForRun as hn, listSessionSystemUpdatesForTurn as ho, listSessionTurns as hp, listSessions as hq, listSessionsForSubject as hr, listSocialConnections as hs, listSocialPosts as ht, listUsageEvents as hu, listVariableSets as hv, listWorkspaceControlEvents as hw, listWorkspaceEnvironments as hx, listWorkspaceMembers as hy, listWorkspacePacks as hz, AgentCommandAuthorityError as i, revokeApiKey as i$, peekSessionWork as i0, persistDrainSnapshot as i1, persistWarmSnapshot as i2, planWorkspaceCaptureGc as i3, projectEffectiveControlForRelatedAccess as i4, projectSessionForRelatedAccess as i5, pruneHostExportOutbox as i6, quarantineCodexCredentialForLease as i7, reArmDrainingLease as i8, readActiveSandbox as i9, recoverSessionDispatch as iA, refreshOAuthConnectionCredential as iB, registerDbBinding as iC, registerHostExportConsumer as iD, registerInternalUpdateWakeInTransaction as iE, registerPendingSessionToolCall as iF, registerSessionTurnAttemptClaim as iG, registerSessionWorkflowWakeInTransaction as iH, registerWorkspacePack as iI, releaseCodexCredentialLease as iJ, releaseLeaseHolder as iK, removeWorkspaceMember as iL, renameCodexAccount as iM, renderWorkspaceMemoryBlock as iN, replaceIntegrationOAuthClient as iO, requestSessionCompaction as iP, requestSessionTurnRecovery as iQ, requireFile as iR, requireScheduledTask as iS, requireSession as iT, requireSocialConnection as iU, requireWorkspace as iV, reserveSessionCommandReceipt as iW, reserveToolspaceCallForTurn as iX, resolveWorkspaceMemoryBlock as iY, resumeHostExportConsumer as iZ, retireHostExportConsumer as i_, readLease as ia, readMachineMetricsLatest as ib, readMachineMetricsLatestForWorkspace as ic, readMachineMetricsSeries as id, reapExpiredSessionListSnapshots as ie, reapStaleLeaseHolders as ig, reapStaleLeaseHoldersGlobal as ih, reconcileCodexCapacityWait as ii, recordAuditEvent as ij, recordCodexAccountConnectors as ik, recordCodexAccountUsage as il, recordCodexAccountUsageWithWakeTargets as im, recordCodexTokenRefresh as io, recordConnectionTokenRefresh as ip, recordConnectionUsed as iq, recordLeaseDataPlaneUrl as ir, recordLeaseTerminalDataPlaneUrl as is, recordPendingSessionToolCallResult as it, recordSessionActiveCodexCredential as iu, recordSkippedContextCompaction as iv, recordStreamAcknowledgment as iw, recordStripeWebhookEvent as ix, recordUsageEvent as iy, recordWarmingSandboxCreated as iz, type AgentInternalUpdateCommandResult as j, updateRecording as j$, revokeConnection as j0, revokeEnrollment as j1, revokeViewer as j2, rewindHostExportConsumer as j3, rlsContextForWorkspace as j4, rlsStrategyFor as j5, runIdempotentPersistenceTransaction as j6, safeDatabaseErrorFacts as j7, sanitizeEventPayload as j8, sanitizeEventString as j9, setSessionGoalStatus as jA, setSessionLastInputTokensForTurnAttempt as jB, setSessionPin as jC, setTemporalWorkflowId as jD, setVariableSetVariable as jE, setWorkspaceDefaultRig as jF, setWorkspaceEnvironmentVariable as jG, settleCodexCredentialFailover as jH, settleCodexCredentialLeaseLoss as jI, settleScheduledTaskRunInTransaction as jJ, settleSessionAttemptInterruptions as jK, settleSessionIdleWithParentOutbox as jL, shortMemoryId as jM, steerAgentSessionInTransaction as jN, steerQueuedTurnInTransaction as jO, storeIntegrationOAuthClient as jP, submitHumanPromptInTransaction as jQ, sumUsageQuantity as jR, supersedeSessionCurrentDirectionInTransaction as jS, touchEnrollmentLastSeen as jT, touchLeaseHolder as jU, updateCodexRotationSettings as jV, updateConnection as jW, updateImportBatchCounts as jX, updateKnowledgeMemory as jY, updatePackInstallationStatus as jZ, updatePtySessionActivity as j_, sanitizeMemoryText as ja, sanitizeModelPayload as jb, saveComposerDraftInTransaction as jc, saveRunState as jd, saveWorkspaceMemory as je, searchWorkspaceMemories as jf, sendAgentMessageInTransaction as jg, serializeEffectiveSessionControl as jh, sessionAuthorizationScopeFilter as ji, sessionSubject as jj, sessionTreeStatsForSessions as jk, sessionsWithActiveOpOnEnrollment as jl, setActiveCodexCredential as jm, setActiveSandbox as jn, setCodexCredentialExhausted as jo, setCodexCredentialExhaustedWithWakeTargets as jp, setCodexCredentialStatus as jq, setCodexCredentialStatusById as jr, setConnectionStatus as js, setEnrollmentDisplayState as jt, setEnrollmentOpStreamState as ju, setEnrollmentWentOffline as jv, setInitialActiveCodexCredential as jw, setRlsContext as jx, setSessionCodexPin as jy, setSessionGoalLastContinuationTurn as jz, type AppendEventInput as k, updateRig as k0, updateRigChangeStatus as k1, updateScheduledTask as k2, updateScheduledTaskRun as k3, updateSessionCommandReceiptResult as k4, updateSessionGoal as k5, updateSessionMcpServerCredentials as k6, updateSessionTitle as k7, updateVariableSet as k8, updateWorkspace as k9, updateWorkspaceEnvironment as ka, updateWorkspaceSettings as kb, upsertBillingCustomer as kc, upsertCapabilityCatalogItem as kd, upsertCodexSubscriptionCredential as ke, upsertGitHubInstallation as kf, upsertMachineMetricsLatest as kg, upsertRegistryCapabilityCatalogItem as kh, upsertSandboxSessionEnvelope as ki, upsertSessionGoal as kj, upsertWorkspaceModelPolicy as kk, validateHumanInputResponse as kl, withAccountRls as km, withCodexCapacityMutation as kn, withCodexCredentialRefreshLock as ko, withRlsContext as kp, withWorkspaceRls as kq, withWorkspaceSubjectRls as kr, withWorkspaceUsageLock as ks, workspaceCaptureAtRevision as kt, workspaceCodexSubscriptionActive as ku, type ApplyContextCompactionResult as l, type ApplySessionTurnSettlementInput as m, type ApplySessionTurnSettlementResult as n, type ArmCodexCapacityWaitResult as o, CODEX_CAPACITY_REFRESH_MIN_MS as p, provisionRoles, CODEX_CREDENTIAL_LEASE_TTL_MS as q, CODEX_ROTATION_STRATEGIES as r, type ClaimSessionWorkForAttemptInput as s, type ClaimSessionWorkForAttemptResult as t, type ClearSessionContextResult as u, type CodexAccountStatus as v, type CodexAccountUsageSnapshot as w, type CodexAuthDeps as x, type CodexCapacityAvailabilityDecision as y, type CodexCapacityMutationResult as z };
5363
+ export { type CodexResetRedemptionRecovery as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BootstrapWorkspaceInput as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexAllocatorUpdateResult as D, type CodexAuthDeps as E, type CodexCapacityAvailabilityDecision as F, type CodexCapacityMutationResult as G, type CodexCapacityResetKind as H, type CodexCapacitySelectionContext as I, type CodexCapacityWait as J, type CodexCapacityWaitStatus as K, type CodexCapacityWakeTarget as L, type CodexCredentialForRun as M, type CodexCredentialLeaseCandidateFilter as N, type CodexCredentialLeaseCandidateFilterResult as O, type CodexCredentialLeasePolicyScopeResolver as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialLeaseQuarantine as Q, type CodexCredentialLeaseResult as R, type CodexCredentialLeaseSelection as S, type CodexCredentialLeaseSelectionContext as T, type CodexCredentialStatus as U, type CodexCredentialTokens as V, type CodexLeaseAccountStatus as W, type CodexPinSource as X, type CodexRateLimitResetCreditsAccountResult as Y, type CodexResetRedemptionAttempt as Z, type CodexResetRedemptionOutcome as _, type AcceptSessionApprovalDecisionResult as a, type LeaseHolderKind as a$, type CodexResetRedemptionSendNotReadyReason as a0, type CodexResetRedemptionStatus as a1, type CodexRotationSettings as a2, type CodexRotationStrategy as a3, type CodexTokenDeadlineClock as a4, type CodexTokenDeadlineOptions as a5, type ComposerDraftRow as a6, type ConnectionBrokerDeps as a7, type ConnectionCredentialForBroker as a8, ConnectionRefreshHttpError as a9, type EnabledMcpCapabilityServer as aA, type EnqueueSessionTurnInput as aB, type EnrollmentExposure as aC, type EnrollmentOs as aD, type EnrollmentRecord as aE, type EnrollmentStatus as aF, type ExpiredFileUploadCleanupClaim as aG, type FenceCodexResetRedemptionSendResult as aH, type FileUploadCleanupClaimResult as aI, type ForceDrainResult as aJ, type FrozenTurnInitiator as aK, type GitHubInstallation as aL, type GitHubInstallationAccess as aM, type GoalContinuationDecision as aN, type HostExportConsumerStatus as aO, type HostExportKind as aP, HostExportPayloadError as aQ, HostMcpCredentialBindingError as aR, type HostMcpCredentialResolverContext as aS, HostMcpCredentialScopeError as aT, HumanInputResponseValidationError as aU, type IdempotentPersistenceTransactionOptions as aV, type ImportBatch as aW, type InitializeSessionStartInput as aX, type InitializeSessionStartResult as aY, type InstallOrReadTurnExecutionPolicyForAttemptResult as aZ, type IntegrationOAuthClientForUse as a_, type ConsumeOAuthStateNonceInput as aa, type CorrectWorkspaceMemoryInput as ab, type CorrectWorkspaceMemoryResult as ac, type CreateCapabilityCatalogItemInput as ad, type CreateConnectionInput as ae, type CreateDbOptions as af, type CreateImportBatchInput as ag, type CreateKnowledgeMemoryInput as ah, type CreatePackInstallationInput as ai, type CreateScheduledTaskInput as aj, type CreateSessionGoalInput as ak, type CreateSessionMcpServerInput as al, type CreateSocialConnectionInput as am, type CreateSocialPostInput as an, type CreditBalanceByAccount as ao, type Database as ap, type DatabaseFailureCode as aq, type DbClient as ar, type DeviceEnrollmentRequestRecord as as, type DeviceEnrollmentStatus as at, type EditQueueCommandResult as au, type EffectiveControlBlocker as av, type EffectiveControlResumeOption as aw, type EffectiveControlState as ax, type EffectiveSessionControl as ay, type EnableCapabilityInstallationInput as az, type AcceptSessionHumanInputResponseResult as b, SESSION_DISCOVERY_GOAL_MAX_CHARS as b$, type LeaseSnapshot as b0, type ListKnowledgeMemoryOptions as b1, type ListSessionEventPageOptions as b2, type ListSessionEventsOptions as b3, type ListSessionsForSubjectOptions as b4, type ListSessionsOptions as b5, type LiveModalSandboxLeaseAttribution as b6, MACHINE_METRICS_SERIES_INTERVAL_MS as b7, MAX_INTERNAL_UPDATE_BATCH_BYTES as b8, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as b9, type QueueCommandResult as bA, type QueuedTurnRow as bB, type ReapDrainable as bC, type ReconcileCodexCapacityWaitResult as bD, type RecoverSessionDispatchInput as bE, type RecoverSessionDispatchResult as bF, type RefreshTransportOptions as bG, type RegisterWorkspacePackInput as bH, type RegistryCapabilityCatalogItemInput as bI, type RegistryCatalogSurfaceKey as bJ, type ReplaceIntegrationOAuthClientInput as bK, type RequestSessionTurnRecoveryInput as bL, type RequestSessionTurnRecoveryResult as bM, type ResolveConnectionCredentialInput as bN, type ResolveConnectionCredentialResult as bO, type RetainedFileArtifact as bP, RigActiveVersionChangedError as bQ, RigChangeAlreadyVerifyingError as bR, type RigChangeMonitoringSummary as bS, RigChangeTransitionError as bT, type RigVersionContentInput as bU, type RigVersionMonitoringSummary as bV, type RlsContext as bW, type RlsStrategy as bX, SESSION_ANCESTRY_LIMIT as bY, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as bZ, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as b_, MAX_INTERNAL_UPDATE_BYTES as ba, MEMORY_ACTIVE_RECORD_CAP as bb, MEMORY_BLOCK_KIND_ORDER as bc, MEMORY_BLOCK_RECORD_LIMIT as bd, MEMORY_CORRECT_TOOL_DESCRIPTION as be, MEMORY_KIND_SECTION_TITLES as bf, MEMORY_NEAR_DUP_COSINE_THRESHOLD as bg, MEMORY_NEAR_DUP_NEIGHBORS as bh, MEMORY_SAVE_TOOL_DESCRIPTION as bi, MEMORY_SEARCH_DEFAULT_LIMIT as bj, MEMORY_SEARCH_MAX_LIMIT as bk, MEMORY_SEARCH_TOOL_DESCRIPTION as bl, MEMORY_TEXT_MAX_CHARS as bm, MEMORY_VISIBLE_RECORD_CAP as bn, type MachineMetricsRow as bo, type MachineMetricsSample as bp, type MarkWarmLeaseInstanceLostResult as bq, type MemoryBlockRecord as br, type MemoryEmbedder as bs, type MemorySanitizeResult as bt, type MeterableWarmLease as bu, type PendingSessionToolCallInput as bv, type PersistenceFailureDetails as bw, type PersistenceRetryOutcome as bx, type QueueCommandConflictCode as by, QueueCommandConflictError as bz, type AccrueWarmSecondsResult as c, type UpdateKnowledgeMemoryInput as c$, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as c0, SESSION_EVENT_DB_PAGE_MAX_BYTES as c1, type SafeDatabaseErrorFacts as c2, SandboxImageConflictError as c3, type SandboxKind as c4, type SandboxLeaseLiveness as c5, SandboxLeaseSupersededError as c6, type SandboxPtySessionRow as c7, type SandboxRecord as c8, SandboxRigConflictError as c9, SessionPinAccessError as cA, SessionPinVersionConflictError as cB, type SessionRecordingCodec as cC, type SessionRecordingMode as cD, type SessionRecordingRow as cE, type SessionRecordingState as cF, type SessionSystemUpdateOutboxDelivery as cG, type SessionTurnAttemptOutcome as cH, type SessionTurnForExecution as cI, type SessionTurnRecordingSettlement as cJ, type SessionWorkPeek as cK, type SessionWorkTrigger as cL, type SessionWorkflowWake as cM, type SessionWorkflowWakeDeliveryResult as cN, type SetSessionCodexPinOptions as cO, type SettleCodexCredentialFailoverResult as cP, type SettleCodexCredentialLeaseLossResult as cQ, type SteerQueueCommandResult as cR, type StoreIntegrationOAuthClientInput as cS, type StoredIntegrationOAuthClient as cT, type StreamAcknowledgment as cU, type SubmitHumanPromptResult as cV, type ToolspaceCallReservation as cW, type ToolspaceTurnAttemptClaims as cX, type TurnAttemptFenceRejectReason as cY, type UpdateConnectionInput as cZ, type UpdateImportBatchCountsInput as c_, SanitizedDatabasePersistenceCause as ca, type SaveWorkspaceMemoryInput as cb, type SaveWorkspaceMemoryResult as cc, type SessionAttemptInterruptionSettlement as cd, type SessionCodexState as ce, type SessionCommandActor as cf, SessionCommandIdempotencyError as cg, type SessionCommandReceiptRow as ch, SessionContextBusyError as ci, SessionControlConflictError as cj, SessionControlInvariantError as ck, type SessionControlMutationResult as cl, type SessionDiscoveryControl as cm, type SessionDiscoveryCursor as cn, type SessionDiscoveryOrderBy as co, type SessionDiscoverySummary as cp, type SessionEventPage as cq, SessionEventPersistenceError as cr, type SessionEventWriteLockInput as cs, type SessionEventWriteLocks as ct, SessionIdConflictError as cu, type SessionLineage as cv, SessionListAccessError as cw, type SessionListCursor as cx, SessionListCursorError as cy, type SessionMcpServerForRun as cz, type AcquireLeaseInput as d, claimExpiredFileUploadCleanup as d$, type UpdateScheduledTaskInput as d0, type UpdateSessionMcpApprovalPolicyResult as d1, type UpdateSessionMcpServerCredentialsInput as d2, type UpdateSessionMcpServerCredentialsResult as d3, type UpsertCodexSubscriptionCredentialResult as d4, type UserLookup as d5, type VariableSetForRun as d6, WORKSPACE_MEMORY_BLOCK_EMPTY as d7, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as d8, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as d9, adoptCodexResetRedemptionAttempt as dA, allAccountPermissions as dB, allWorkspacePermissions as dC, appendSessionEventToSandboxGroup as dD, appendSessionEvents as dE, appendSessionEventsAndUpdateSession as dF, appendSessionEventsForTurnAttempt as dG, appendSessionEventsWithLockedSessionUpdate as dH, appendSessionHistoryItems as dI, applyContextCompaction as dJ, applyCreditDebitUpToBalance as dK, applyCreditLedgerEntry as dL, applySessionTurnSettlement as dM, approveDeviceEnrollmentRequest as dN, areGitHubRepositoriesAllowedForWorkspace as dO, armCodexCapacityWait as dP, assertAgentCommandAuthorityInTransaction as dQ, autoResumeSessionBranchInTransaction as dR, beginRigChangeVerificationAttempt as dS, bindGitHubInstallationRepositories as dT, bootstrapWorkspace as dU, buildChildCompletionDigest as dV, buildCodexTokenResolver as dW, buildConnectionTokenResolver as dX, buildHostConnectionTokenResolver as dY, canonicalSessionCommandHash as dZ, claimCodexResetRedemption as d_, type WorkspaceCaptureCommitResult as da, type WorkspaceCaptureGcPlan as db, type WorkspaceCaptureGcRow as dc, type WorkspaceCaptureRow as dd, type WorkspaceControlLockMode as de, type WorkspaceControlMutationResult as df, type WorkspaceControlRow as dg, type WorkspaceEnvironmentForRun as dh, type WorkspaceMemoryOrigin as di, type WorkspaceMemorySearchInput as dj, type WorkspaceMemorySearchMode as dk, type WorkspaceMemorySearchResult as dl, type WorkspaceModelPolicy as dm, abandonCodexResetRedemptionBeforeProvider as dn, abandonRecordingForTurnAttempt as dp, acceptSessionApprovalDecision as dq, acceptSessionHumanInputResponse as dr, accrueWarmSeconds as ds, acknowledgeHostExportBatch as dt, acquireCodexCredentialLease as du, acquireLease as dv, activateRigVersion as dw, addSessionSystemUpdate as dx, addSessionSystemUpdateWithSourceMutation as dy, admitToolspaceTurnAttempt as dz, type AcquireLeaseResult as e, createWorkspace as e$, claimFileUploadCleanup as e0, claimHostExportBatch as e1, claimPendingSessionSystemUpdateOutbox as e2, claimPendingSessionWorkflowWakes as e3, claimSessionWorkForAttempt as e4, clearDurablePendingSessionToolCalls as e5, clearEnrollmentWentOffline as e6, clearPendingSessionToolspaceCall as e7, clearSessionContext as e8, clearSessionGoal as e9, countSessionHistoryItems as eA, countSessionsUsingRig as eB, countVariableSets as eC, countWorkspaceEnvironments as eD, countWorkspacesForAccount as eE, createApiKey as eF, createConnection as eG, createDb as eH, createDeviceEnrollmentRequest as eI, createEnrollment as eJ, createFileUpload as eK, createImportBatch as eL, createKnowledgeMemory as eM, createRig as eN, createRigChange as eO, createRigVersion as eP, createRigVersionForChangePromotion as eQ, createSandbox as eR, createScheduledTask as eS, createScheduledTaskRun as eT, createSession as eU, createSessionGoal as eV, createSessionMcpServers as eW, createSessionWithIdempotencyKey as eX, createSocialConnection as eY, createSocialPost as eZ, createVariableSet as e_, clearedContextMarkerItem as ea, closePtySession as eb, closeSessionTurnAttemptInTransaction as ec, codexCapacityRefreshBackoffMs as ed, commitWarmingToWarm as ee, completeCodexResetRedemption as ef, completeExpiredFileUploadCleanup as eg, completeFileUpload as eh, completeFileUploadCleanup as ei, computeWorkspaceCaptureGcPlan as ej, confirmDrainCold as ek, consumeDeviceEnrollmentRequest as el, consumeIntegrationOAuthStateNonce as em, correctWorkspaceMemory as en, countActiveApiKeysForWorkspace as eo, countActiveSessionHistoryItems as ep, countActiveSessionsForWorkspace as eq, countActiveSessionsUsingEnvironment as er, countActiveSessionsUsingVariableSet as es, countConsecutiveReactiveRotations as et, countQueuedTurns as eu, countRigs as ev, countSandboxLeasesByLiveness as ew, countScheduledTasksForWorkspace as ex, countScheduledTasksUsingEnvironment as ey, countScheduledTasksUsingVariableSet as ez, type ActiveSandboxPointer as f, getDeviceEnrollmentRequestByDeviceCode as f$, createWorkspaceEnvironment as f0, databaseFailureCode as f1, deadLetterHostExportHead as f2, decodeSessionListCursor as f3, decryptEnvironmentValue as f4, decryptedCapabilityHeaders as f5, deleteGitHubInstallationBinding as f6, deleteRecording as f7, deleteRig as f8, deleteRigIfNoActiveSessions as f9, evaluateGoalContinuation as fA, evaluateSessionControl as fB, evaluateSessionControls as fC, evaluateSessionDiscoveryControls as fD, expireSessionHumanInputRequest as fE, failHostExportBatch as fF, failWarmingToCold as fG, fenceCodexResetRedemptionSend as fH, fetchCodexRateLimitResetCreditsForAccount as fI, fetchCodexUsageForAccount as fJ, finalizeEnrollmentByToken as fK, findActiveApiKeyByHash as fL, forceDrainOverLimitViewerOnlyBoxes as fM, frozenInitiatorForCommandActor as fN, getActiveSessionHistoryItems as fO, getActiveSessionTurnForExecution as fP, getAnySessionInGroup as fQ, getBillingBalance as fR, getBillingCustomer as fS, getCapabilityCatalogItem as fT, getCapabilityInstallation as fU, getCodexCapacityWaitForSession as fV, getCodexCredentialStatus as fW, getCodexResetRedemptionAttempt as fX, getCodexRotationSettings as fY, getComposerDraftInTransaction as fZ, getConnectionMetadata as f_, deleteScheduledTask as fa, deleteSessionQueueItemInTransaction as fb, deleteVariableSet as fc, deleteVariableSetVariable as fd, deleteWorkspace as fe, deleteWorkspaceCaptureRows as ff, deleteWorkspaceEnvironment as fg, deleteWorkspaceEnvironmentVariable as fh, deleteWorkspacePack as fi, denyDeviceEnrollmentRequest as fj, disableCapabilityInstallation as fk, disableHostExportConsumer as fl, disconnectAllCodexAccounts as fm, disconnectCodexAccount as fn, editQueuedTurnInTransaction as fo, enableCapabilityInstallation as fp, enablePackInstallation as fq, encodeSessionListCursor as fr, encryptEnvironmentValue as fs, enqueueSessionTurn as ft, enqueueSessionWorkflowWake as fu, enqueueSessionWorkflowWakeIfRunnable as fv, enqueueSessionWorkflowWakeInTransaction as fw, ensureCodexRotationSettings as fx, ensureManagedAccessForUser as fy, estimateMemoryTokens as fz, type AddSessionSystemUpdateInput as g, ingestMachineMetricsSample as g$, getEnrollment as g0, getFile as g1, getFileUpload as g2, getHostExportConsumerStatus as g3, getHumanInputResumeForEvent as g4, getKnowledgeMemory as g5, getLatestRunState as g6, getLatestStartedSessionTurn as g7, getManagedAccount as g8, getManagedUserByEmail as g9, getSessionLineage as gA, getSessionQueueSnapshot as gB, getSessionRootId as gC, getSessionSystemUpdateOutboxByDedupeKey as gD, getSessionTurn as gE, getSessionTurnForAttempt as gF, getSocialConnection as gG, getStoredCapabilityHeaderCiphertext as gH, getStreamAcknowledgment as gI, getVariableSet as gJ, getVariableSetByName as gK, getVariableSetValuesForRun as gL, getWorkspace as gM, getWorkspaceControlEvent as gN, getWorkspaceDefaultRigId as gO, getWorkspaceEnvironment as gP, getWorkspaceEnvironmentByName as gQ, getWorkspaceEnvironmentValuesForRun as gR, getWorkspaceGrant as gS, getWorkspaceModelPolicy as gT, getWorkspacePack as gU, grantWorkspaceAccess as gV, hasCreditLedgerEntry as gW, hashMemoryText as gX, heartbeatCodexCredentialLease as gY, heartbeatCodexCredentialLeaseUntil as gZ, heartbeatLeaseHolder as g_, getMaterializedSandboxFileResources as ga, getOpenPtySession as gb, getOrCreateSessionSystemUpdateOutbox as gc, getPackInstallation as gd, getPendingDeviceEnrollmentRequestByUserCode as ge, getPendingDeviceEnrollmentRequestByUserCodeGlobal as gf, getRecording as gg, getRetainedFileArtifact as gh, getRig as gi, getRigByName as gj, getRigChange as gk, getRigName as gl, getRigVersion as gm, getRigVersionById as gn, getSandbox as go, getSandboxSessionEnvelope as gp, getScheduledTask as gq, getSession as gr, getSessionByCreateIdempotencyKey as gs, getSessionCodexState as gt, getSessionEvent as gu, getSessionEventByClientEventId as gv, getSessionForSubject as gw, getSessionGoal as gx, getSessionHistoryItems as gy, getSessionHumanInputRequest as gz, type AddSessionSystemUpdateResult as h, listVariableSets as h$, initializeSessionStartAtomically as h0, insertFailedWorkspaceCapture as h1, insertMachineMetricsSeries as h2, insertPtySession as h3, insertRecording as h4, insertWorkspaceCapture as h5, installOrReadTurnExecutionPolicyForAttempt as h6, interruptedToolCallResult as h7, isCodexBilledTurn as h8, isDatabasePersistenceFailure as h9, listPendingCodexCapacityWakeTargets as hA, listPendingSessionTurns as hB, listRecordings as hC, listRegistryCatalogSurfaceKeys as hD, listRigChangeMonitoringSummaries as hE, listRigChanges as hF, listRigVersionMonitoringSummaries as hG, listRigVersions as hH, listRigs as hI, listSandboxes as hJ, listScheduledTaskRuns as hK, listScheduledTasks as hL, listSessionDiscoverySummaries as hM, listSessionEventPage as hN, listSessionEvents as hO, listSessionHumanInputRequests as hP, listSessionIdsInGroup as hQ, listSessionMcpServerMetadata as hR, listSessionMcpServersForChildInheritance as hS, listSessionMcpServersForRun as hT, listSessionSystemUpdatesForTurn as hU, listSessionTurns as hV, listSessions as hW, listSessionsForSubject as hX, listSocialConnections as hY, listSocialPosts as hZ, listUsageEvents as h_, isMemoryTextTooLong as ha, isRetryablePersistenceSqlState as hb, isSessionCompactionRequested as hc, isSessionEventPersistenceError as hd, isStripeWebhookProcessed as he, latestWorkspaceCapture as hf, listApiKeys as hg, listCapabilityCatalogItems as hh, listCapabilityInstallations as hi, listCodexAccountStatuses as hj, listCodexResetRedemptionRecoveries as hk, listConnectionsMetadata as hl, listCreditBalancesByAccount as hm, listDistinctRigVersionIdsInGroup as hn, listDistinctVariableSetIdsInGroup as ho, listEnabledMcpCapabilityServers as hp, listEnrollments as hq, listGitHubInstallationAccessForWorkspace as hr, listGitHubInstallationIdsForWorkspace as hs, listGitHubInstallationsForWorkspace as ht, listKnowledgeMemories as hu, listLiveModalSandboxLeaseAttributions as hv, listMeterableWarmLeases as hw, listOpenPtySessions as hx, listOutstandingSessionSystemUpdates as hy, listPackInstallations as hz, type AdoptCodexResetRedemptionResult as i, recordSkippedContextCompaction as i$, listWorkspaceControlEvents as i0, listWorkspaceEnvironments as i1, listWorkspaceMembers as i2, listWorkspacePacks as i3, listWorkspacesForSubject as i4, loadCodexCredentialForRun as i5, loadConnectionCredentialForBroker as i6, loadIntegrationOAuthClient as i7, loadVariableSetForRun as i8, loadWorkspaceEnvironmentForRun as i9, persistWarmSnapshot as iA, planWorkspaceCaptureGc as iB, projectEffectiveControlForRelatedAccess as iC, projectSessionForRelatedAccess as iD, pruneHostExportOutbox as iE, quarantineCodexCredentialForLease as iF, reArmDrainingLease as iG, readActiveSandbox as iH, readLease as iI, readMachineMetricsLatest as iJ, readMachineMetricsLatestForWorkspace as iK, readMachineMetricsSeries as iL, reapExpiredSessionListSnapshots as iM, reapStaleLeaseHolders as iN, reapStaleLeaseHoldersGlobal as iO, reconcileCodexCapacityWait as iP, recordAuditEvent as iQ, recordCodexAccountConnectors as iR, recordCodexAccountUsage as iS, recordCodexAccountUsageWithWakeTargets as iT, recordCodexTokenRefresh as iU, recordConnectionTokenRefresh as iV, recordConnectionUsed as iW, recordLeaseDataPlaneUrl as iX, recordLeaseTerminalDataPlaneUrl as iY, recordPendingSessionToolCallResult as iZ, recordSessionActiveCodexCredential as i_, lockSessionEventWriteRows as ia, lockWorkspaceInferenceControl as ib, markFileUploadFailed as ic, markSandboxFileResourcesMaterialized as id, markScheduledTaskRunFailedIfQueued as ie, markSessionAttemptQuiesced as ig, markSessionSystemUpdateOutboxDeliveredInTransaction as ih, markSessionSystemUpdateOutboxFailed as ii, markSessionWorkflowWakeDelivered as ij, markSessionWorkflowWakeFailed as ik, markStaleRegistryCatalogItems as il, markStripeWebhookProcessed as im, markWarmLeaseInstanceLost as io, mcpServerIdForCapability as ip, moveQueuedTurnInTransaction as iq, mutateSessionControlInTransaction as ir, mutateWorkspaceControlInTransaction as is, nestedPostgresSqlState as it, nextSessionHistoryPosition as iu, normalizeBearerScheme as iv, normalizeMemoryText as iw, orphanedResultRowIndicesForRepair as ix, peekSessionWork as iy, persistDrainSnapshot as iz, AgentCommandAuthorityError as j, setEnrollmentOpStreamState as j$, recordStreamAcknowledgment as j0, recordStripeWebhookEvent as j1, recordUsageEvent as j2, recordWarmingSandboxCreated as j3, recoverSessionDispatch as j4, refreshOAuthConnectionCredential as j5, registerDbBinding as j6, registerHostExportConsumer as j7, registerInternalUpdateWakeInTransaction as j8, registerPendingSessionToolCall as j9, rewindHostExportConsumer as jA, rlsContextForWorkspace as jB, rlsStrategyFor as jC, runIdempotentPersistenceTransaction as jD, safeDatabaseErrorFacts as jE, sanitizeEventPayload as jF, sanitizeEventString as jG, sanitizeMemoryText as jH, sanitizeModelPayload as jI, saveComposerDraftInTransaction as jJ, saveRunState as jK, saveWorkspaceMemory as jL, searchWorkspaceMemories as jM, sendAgentMessageInTransaction as jN, serializeEffectiveSessionControl as jO, sessionAuthorizationScopeFilter as jP, sessionSubject as jQ, sessionTreeStatsForSessions as jR, sessionsWithActiveOpOnEnrollment as jS, setActiveCodexCredential as jT, setActiveSandbox as jU, setCodexCredentialExhausted as jV, setCodexCredentialExhaustedWithWakeTargets as jW, setCodexCredentialStatus as jX, setCodexCredentialStatusById as jY, setConnectionStatus as jZ, setEnrollmentDisplayState as j_, registerSessionTurnAttemptClaim as ja, registerSessionWorkflowWakeInTransaction as jb, registerWorkspacePack as jc, releaseCodexCredentialLease as jd, releaseCodexResetRedemptionClaim as je, releaseLeaseHolder as jf, removeWorkspaceMember as jg, renameCodexAccount as jh, renderWorkspaceMemoryBlock as ji, replaceIntegrationOAuthClient as jj, requestSessionCompaction as jk, requestSessionTurnRecovery as jl, requireFile as jm, requireScheduledTask as jn, requireSession as jo, requireSocialConnection as jp, requireWorkspace as jq, reserveSessionCommandReceipt as jr, reserveToolspaceCallForAttempt as js, resolveWorkspaceMemoryBlock as jt, resumeHostExportConsumer as ju, retireHostExportConsumer as jv, revokeApiKey as jw, revokeConnection as jx, revokeEnrollment as jy, revokeViewer as jz, type AgentInternalUpdateCommandResult as k, withWorkspaceSubjectRls as k$, setEnrollmentWentOffline as k0, setInitialActiveCodexCredential as k1, setRlsContext as k2, setSessionCodexPin as k3, setSessionGoalLastContinuationTurn as k4, setSessionGoalStatus as k5, setSessionLastInputTokensForTurnAttempt as k6, setSessionPin as k7, setTemporalWorkflowId as k8, setVariableSetVariable as k9, updateScheduledTask as kA, updateScheduledTaskRun as kB, updateSessionCommandReceiptResult as kC, updateSessionGoal as kD, updateSessionMcpApprovalPolicy as kE, updateSessionMcpServerCredentials as kF, updateSessionTitle as kG, updateVariableSet as kH, updateWorkspace as kI, updateWorkspaceEnvironment as kJ, updateWorkspaceSettings as kK, upsertBillingCustomer as kL, upsertCapabilityCatalogItem as kM, upsertCodexSubscriptionCredential as kN, upsertGitHubInstallation as kO, upsertMachineMetricsLatest as kP, upsertRegistryCapabilityCatalogItem as kQ, upsertSandboxSessionEnvelope as kR, upsertSessionGoal as kS, upsertWorkspaceModelPolicy as kT, validateHumanInputResponse as kU, withAccountRls as kV, withCodexCapacityMutation as kW, withCodexCredentialRefreshLock as kX, withCodexTokenDeadline as kY, withRlsContext as kZ, withWorkspaceRls as k_, setWorkspaceDefaultRig as ka, setWorkspaceEnvironmentVariable as kb, settleCodexCredentialFailover as kc, settleCodexCredentialLeaseLoss as kd, settleScheduledTaskRunInTransaction as ke, settleSessionAttemptInterruptions as kf, settleSessionIdleWithParentOutbox as kg, shortMemoryId as kh, steerAgentSessionInTransaction as ki, steerQueuedTurnInTransaction as kj, storeIntegrationOAuthClient as kk, submitHumanPromptInTransaction as kl, sumUsageQuantity as km, supersedeSessionCurrentDirectionInTransaction as kn, touchEnrollmentLastSeen as ko, touchLeaseHolder as kp, updateCodexAllocatorEligibility as kq, updateCodexRotationSettings as kr, updateConnection as ks, updateImportBatchCounts as kt, updateKnowledgeMemory as ku, updatePackInstallationStatus as kv, updatePtySessionActivity as kw, updateRecording as kx, updateRig as ky, updateRigChangeStatus as kz, type AppendEventInput as l, withWorkspaceUsageLock as l0, workspaceCaptureAtRevision as l1, workspaceCodexSubscriptionActive as l2, type ApplyContextCompactionResult as m, type ApplySessionTurnSettlementInput as n, type ApplySessionTurnSettlementResult as o, type ArmCodexCapacityWaitResult as p, provisionRoles, CODEX_CAPACITY_REFRESH_MIN_MS as q, CODEX_CREDENTIAL_LEASE_TTL_MS as r, CODEX_RESET_REDEMPTION_OUTCOMES as s, CODEX_ROTATION_STRATEGIES as t, type ClaimCodexResetRedemptionResult as u, type ClaimSessionWorkForAttemptInput as v, type ClaimSessionWorkForAttemptResult as w, type ClearSessionContextResult as x, type CodexAccountStatus as y, type CodexAccountUsageSnapshot as z };