@opengeni/db 0.10.7 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{chunk-P6PKXY5W.js → chunk-VUKRIBO5.js} +485 -12
  2. package/dist/chunk-VUKRIBO5.js.map +1 -0
  3. package/dist/{chunk-KW526IJA.js → chunk-Y5WZZVQK.js} +80 -4
  4. package/dist/chunk-Y5WZZVQK.js.map +1 -0
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.js +5114 -2085
  7. package/dist/index.js.map +1 -1
  8. package/dist/migrate.d.ts +6 -3
  9. package/dist/migrate.js +1 -1
  10. package/dist/provision-roles.d.ts +720 -63
  11. package/dist/{schema-CqkzrBRS.d.ts → schema-CnpD6BcX.d.ts} +4684 -2913
  12. package/dist/schema.d.ts +1 -1
  13. package/dist/schema.js +17 -1
  14. package/drizzle/0109_nested_agent_depth_expand.sql +42 -0
  15. package/drizzle/0110_nested_agent_depth_boundary.sql +480 -0
  16. package/drizzle/0111_nested_agent_depth_backfill.sql +49 -0
  17. package/drizzle/0112_nested_agent_depth_contract.sql +38 -0
  18. package/drizzle/0113_nested_agent_depth_validate.sql +13 -0
  19. package/drizzle/0114_nested_agent_depth_contract.sql +49 -0
  20. package/drizzle/0115_nested_agent_depth_validate.sql +11 -0
  21. package/drizzle/0116_nested_agent_depth_index.sql +4 -0
  22. package/drizzle/0117_sandbox_recovery_generations.sql +699 -0
  23. package/drizzle/0118_new_session_drafts.sql +59 -0
  24. package/drizzle/0119_pending_tool_output_policy.sql +5 -0
  25. package/drizzle/0120_durable_goal_wake.sql +360 -0
  26. package/drizzle/0121_goal_update_idempotency.sql +11 -0
  27. package/package.json +3 -3
  28. package/src/index.ts +5961 -1240
  29. package/src/migrate.ts +131 -2
  30. package/src/new-session-drafts.ts +144 -0
  31. package/src/schema.ts +519 -15
  32. package/src/session-control.ts +42 -18
  33. package/src/session-tool-call-settlement.ts +6 -1
  34. package/dist/chunk-KW526IJA.js.map +0 -1
  35. package/dist/chunk-P6PKXY5W.js.map +0 -1
@@ -1,14 +1,15 @@
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';
1
+ import { TurnInitiatorContext, SessionMcpApprovalPolicy, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, TurnExecutionPolicyV1, NewSessionDraftOptions, 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, Session, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionToolPolicy, SessionGoalStatus, 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';
2
2
  import { environmentsEncryptionKeyBytes, Settings, McpServerConnectionRef } from '@opengeni/config';
3
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-CqkzrBRS.js';
6
+ import postgres from 'postgres';
7
+ import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, n as newSessionDrafts, 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-CnpD6BcX.js';
7
8
  import './migrate.js';
8
9
  import { FetchLike, DnsLookup } from '@opengeni/network';
9
10
 
10
11
  declare const SESSION_ANCESTRY_LIMIT = 10000;
11
- type WorkspaceControlLockMode = "share" | "update";
12
+ type WorkspaceControlLockMode = "none" | "share" | "update";
12
13
  type EffectiveControlState = "active" | "paused";
13
14
  type SessionCommandActor = {
14
15
  type: "human" | "operator";
@@ -145,7 +146,7 @@ declare function assertAgentCommandAuthorityInTransaction(db: Database, input: {
145
146
  type: "agent_attempt";
146
147
  }>;
147
148
  targetSessionId: string;
148
- action: "pause" | "resume" | "steer" | "message";
149
+ action: "pause" | "resume" | "steer" | "message" | "goal";
149
150
  }): Promise<void>;
150
151
  declare function canonicalSessionCommandHash(value: unknown): string;
151
152
  declare function lockWorkspaceInferenceControl(db: Database, workspaceId: string, mode: WorkspaceControlLockMode): Promise<WorkspaceControlRow>;
@@ -250,6 +251,7 @@ declare function reserveSessionCommandReceipt(db: Database, input: {
250
251
  targetTurnId: string | null;
251
252
  operationKey: string;
252
253
  canonicalRequestHash: string;
254
+ identityScope?: "actor" | "goal_operation";
253
255
  }): Promise<{
254
256
  receipt: SessionCommandReceiptRow;
255
257
  replay: boolean;
@@ -525,6 +527,42 @@ declare function steerAgentSessionInTransaction(db: Database, input: {
525
527
  instruction: string;
526
528
  }): Promise<AgentInternalUpdateCommandResult>;
527
529
 
530
+ type NewSessionDraftRow = typeof newSessionDrafts.$inferSelect;
531
+ declare class NewSessionDraftConflictError extends Error {
532
+ readonly currentRevision: number;
533
+ readonly name = "NewSessionDraftConflictError";
534
+ constructor(currentRevision: number);
535
+ }
536
+ declare class NewSessionDraftAccessError extends Error {
537
+ readonly name = "NewSessionDraftAccessError";
538
+ constructor();
539
+ }
540
+ declare function getNewSessionDraftInTransaction(db: Database, input: {
541
+ workspaceId: string;
542
+ subjectId: string;
543
+ lock?: boolean;
544
+ }): Promise<NewSessionDraftRow | null>;
545
+ declare function saveNewSessionDraftInTransaction(db: Database, input: {
546
+ accountId: string;
547
+ workspaceId: string;
548
+ subjectId: string;
549
+ expectedRevision: number;
550
+ text: string;
551
+ resources: ResourceRef[];
552
+ tools: ToolRef[];
553
+ model: string;
554
+ reasoningEffort: ReasoningEffort;
555
+ options: NewSessionDraftOptions;
556
+ /** API-key and delegated service subjects have no workspace-membership row. */
557
+ requireWorkspaceMembership?: boolean;
558
+ }): Promise<NewSessionDraftRow>;
559
+ /** Delete only the submitted revision; a newer sibling-tab revision survives. */
560
+ declare function consumeNewSessionDraftInTransaction(db: Database, input: {
561
+ workspaceId: string;
562
+ subjectId: string;
563
+ expectedRevision: number;
564
+ }): Promise<boolean>;
565
+
528
566
  /** Provider-valid result for a started call whose durable outcome is unknown. */
529
567
  declare function interruptedToolCallResult(input: {
530
568
  callType: string;
@@ -902,6 +940,54 @@ type RlsContext = {
902
940
  accountId: string;
903
941
  workspaceId?: string | null;
904
942
  };
943
+ type NestedAgentDepthPolicySource = "session" | "workspace" | "deployment" | "default";
944
+ type SessionDepthPolicy = {
945
+ rootSessionId: string;
946
+ nestedAgentDepth: number;
947
+ maxNestedAgentDepthOverride: number | null;
948
+ effectiveMaxNestedAgentDepth: number;
949
+ nestedAgentDepthPolicySource: NestedAgentDepthPolicySource;
950
+ nestedAgentDepthPolicySessionId: string | null;
951
+ };
952
+ type SessionSpawnDenialCode = "nested_agent_depth_exceeded" | "nested_agent_depth_override_forbidden";
953
+ type SessionSpawnDenial = {
954
+ id: string;
955
+ accountId: string;
956
+ workspaceId: string;
957
+ parentSessionId: string | null;
958
+ rootSessionId: string | null;
959
+ currentDepth: number;
960
+ attemptedDepth: number;
961
+ effectiveMaxNestedAgentDepth: number;
962
+ requestedMaxNestedAgentDepthOverride: number | null;
963
+ policySource: NestedAgentDepthPolicySource;
964
+ policySessionId: string | null;
965
+ subjectId: string | null;
966
+ code: SessionSpawnDenialCode;
967
+ idempotencyKey: string | null;
968
+ createdAt: string;
969
+ };
970
+ type NestedAgentDepthDeploymentPolicy = {
971
+ maxNestedAgentDepth: number;
972
+ policySource: "deployment" | "default";
973
+ };
974
+ type DbSession = Session & SessionDepthPolicy;
975
+ type SessionCreateSuccessResult = {
976
+ denied: false;
977
+ session: DbSession;
978
+ created: boolean;
979
+ };
980
+ type SessionCreateDeniedResult = {
981
+ denied: true;
982
+ created: false;
983
+ denial: SessionSpawnDenial;
984
+ };
985
+ type SessionCreateResult = SessionCreateSuccessResult | SessionCreateDeniedResult;
986
+ /** Thrown only after a denied create transaction has committed its evidence. */
987
+ declare class SessionSpawnDeniedDbError extends Error {
988
+ readonly denial: SessionSpawnDenial;
989
+ constructor(denial: SessionSpawnDenial);
990
+ }
905
991
  /**
906
992
  * RLS posture for the connection OpenGeni's query layer runs over (Step I, §7.7).
907
993
  *
@@ -952,6 +1038,13 @@ type CreateDbOptions = {
952
1038
  userLookup?: UserLookup;
953
1039
  /** postgres-js pool size; defaults to today's `10`. */
954
1040
  max?: number;
1041
+ /**
1042
+ * Connection-local default transaction isolation sent in the postgres-js
1043
+ * startup parameters. This is intentionally not a role/database default:
1044
+ * tests and embedded callers can exercise a different ambient isolation
1045
+ * without mutating a shared PostgreSQL role or affecting other connections.
1046
+ */
1047
+ isolationLevel?: postgres.ConnectionParameters["default_transaction_isolation"];
955
1048
  };
956
1049
  /** The strategy bound to a handle (or the `"force"` default). */
957
1050
  declare function rlsStrategyFor(db: Database): RlsStrategy;
@@ -1085,6 +1178,8 @@ declare function withWorkspaceRls<T>(db: Database, workspaceId: string, fn: (db:
1085
1178
  * even if a future query accidentally omits its explicit subject predicate.
1086
1179
  */
1087
1180
  declare function withWorkspaceSubjectRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
1181
+ /** Apply and verify actor-private RLS on an already transaction-pinned handle. */
1182
+ declare function setSubjectRlsContext(db: Database, subjectId: string): Promise<void>;
1088
1183
  declare function withWorkspaceUsageLock<T>(db: Database, workspaceId: string, fn: (db: Database) => Promise<T>): Promise<T>;
1089
1184
  declare function withAccountRls<T>(db: Database, accountId: string, fn: (db: Database) => Promise<T>): Promise<T>;
1090
1185
  declare const allWorkspacePermissions: Permission[];
@@ -3020,6 +3115,8 @@ declare function updateSessionMcpApprovalPolicy(db: Database, input: {
3020
3115
  requireApproval: SessionMcpApprovalPolicy;
3021
3116
  }): Promise<UpdateSessionMcpApprovalPolicyResult>;
3022
3117
  declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, attemptId: string, encryptionKey: Uint8Array | null): Promise<SessionMcpServerForRun[]>;
3118
+ /** Read the persisted deployment fallback; process configuration is not policy authority. */
3119
+ declare function getNestedAgentDepthDeploymentPolicy(db: Database): Promise<NestedAgentDepthDeploymentPolicy>;
3023
3120
  type AgentSessionCreationActor = Extract<SessionCommandActor, {
3024
3121
  type: "agent_attempt";
3025
3122
  }>;
@@ -3028,7 +3125,7 @@ declare class SessionIdConflictError extends Error {
3028
3125
  readonly sessionId: string;
3029
3126
  constructor(sessionId: string);
3030
3127
  }
3031
- declare function createSession(db: Database, input: {
3128
+ type SessionCreateInput = {
3032
3129
  requestedSessionId?: string;
3033
3130
  accountId: string;
3034
3131
  workspaceId: string;
@@ -3038,11 +3135,6 @@ declare function createSession(db: Database, input: {
3038
3135
  tools?: ToolRef[];
3039
3136
  toolPolicy?: SessionToolPolicy | null;
3040
3137
  metadata: Record<string, unknown>;
3041
- /**
3042
- * Frozen creator authority. Legacy/test-only callers may omit this and get
3043
- * an explicit unattributed service sentinel; production producers must pass
3044
- * an authenticated subject or named service.
3045
- */
3046
3138
  createdBy?: TurnInitiator;
3047
3139
  createdByContext?: TurnInitiatorContext;
3048
3140
  createdByActor?: AgentSessionCreationActor | null;
@@ -3058,48 +3150,40 @@ declare function createSession(db: Database, input: {
3058
3150
  sandboxGroupId?: string | null;
3059
3151
  sandboxOs?: SandboxOs;
3060
3152
  mcpServers?: CreateSessionMcpServerInput[];
3061
- }): Promise<Session>;
3153
+ maxNestedAgentDepthOverride?: number | null;
3154
+ allowNestedAgentDepthIncrease?: boolean;
3155
+ subjectId?: string | null;
3156
+ };
3157
+ declare function createSession(db: Database, input: SessionCreateInput): Promise<DbSession>;
3062
3158
  /**
3063
3159
  * Inserts a session under a workspace-scoped CREATE idempotency key, collapsing
3064
- * a concurrent race on the same key to a single row. On the unique-violation
3065
- * the conflicting insert does nothing (`onConflictDoNothing` on the partial
3066
- * unique index) and the now-existing winning row is fetched and returned, so
3067
- * two near-simultaneous creates with the same key yield ONE session and both
3068
- * callers see the same id. `created` distinguishes the winner (true: this call
3069
- * inserted and must run the rest of the start flow) from the loser/dup (false:
3070
- * the row already existed and must be returned as-is).
3071
- */
3072
- declare function createSessionWithIdempotencyKey(db: Database, input: {
3073
- requestedSessionId?: string;
3074
- accountId: string;
3075
- workspaceId: string;
3076
- initialMessage: string;
3077
- initialTurnInstructions?: string | null;
3078
- resources: ResourceRef[];
3079
- tools?: ToolRef[];
3080
- toolPolicy?: SessionToolPolicy | null;
3081
- metadata: Record<string, unknown>;
3082
- createdBy?: TurnInitiator;
3083
- createdByContext?: TurnInitiatorContext;
3084
- createdByActor?: AgentSessionCreationActor | null;
3085
- model: string;
3086
- sandboxBackend: SandboxBackend;
3087
- variableSetId?: string | null;
3088
- rigId?: string | null;
3089
- rigVersionId?: string | null;
3090
- firstPartyMcpPermissions?: Permission[] | null;
3091
- instructions?: string | null;
3092
- parentSessionId?: string | null;
3160
+ * a concurrent race on the same key to a single row. A losing source insert
3161
+ * is either handled by `onConflictDoNothing` on the partial unique index or
3162
+ * suppressed by the database BEFORE guard, and the durable winner is fetched
3163
+ * and returned. Two near-simultaneous creates with the same key therefore
3164
+ * yield ONE session and both callers see the same id. `created` distinguishes
3165
+ * the winner (true: this call inserted and must run the rest of the start flow)
3166
+ * from the loser/dup (false: the row already existed and must be returned as-is).
3167
+ */
3168
+ declare function createSessionWithIdempotencyKeyResult(db: Database, input: SessionCreateInput & {
3093
3169
  createIdempotencyKey: string;
3094
- sandboxGroupId?: string | null;
3095
- sandboxOs?: SandboxOs;
3096
- mcpServers?: CreateSessionMcpServerInput[];
3097
- }): Promise<{
3098
- session: Session;
3099
- created: boolean;
3100
- }>;
3170
+ }): Promise<SessionCreateResult>;
3171
+ /**
3172
+ * Backward-compatible keyed create API. Denials are committed by the
3173
+ * admission transaction and then surfaced as SessionSpawnDeniedDbError;
3174
+ * callers that need a structured result use createSessionWithIdempotencyKeyResult.
3175
+ */
3176
+ declare function createSessionWithIdempotencyKey(db: Database, input: SessionCreateInput & {
3177
+ createIdempotencyKey: string;
3178
+ }): Promise<SessionCreateSuccessResult>;
3101
3179
  declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
3102
3180
  declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
3181
+ declare function getSessionSpawnDenial(db: Database, workspaceId: string, denialId: string): Promise<SessionSpawnDenial | null>;
3182
+ declare function getSessionSpawnDenialByIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<SessionSpawnDenial | null>;
3183
+ declare function listSessionSpawnDenials(db: Database, workspaceId: string, options?: {
3184
+ limit?: number;
3185
+ parentSessionId?: string | null;
3186
+ }): Promise<SessionSpawnDenial[]>;
3103
3187
  /**
3104
3188
  * Resolve ANY session that belongs to a shared-sandbox group (addendum 05 §D.3,
3105
3189
  * stress (e)). Used by the create-session `sandbox:{groupId}` join path to (1)
@@ -3137,6 +3221,10 @@ type ListSessionsForSubjectOptions = ListSessionsOptions & {
3137
3221
  subjectId: string;
3138
3222
  cursor?: SessionListCursor | undefined;
3139
3223
  search?: string | undefined;
3224
+ /** Return only the complete personal pin projection; never scan/snapshot ordinary rows. */
3225
+ pinsOnly?: boolean | undefined;
3226
+ /** Materialize a continuation snapshot. Disable for legacy one-page array reads. */
3227
+ materializeSnapshot?: boolean | undefined;
3140
3228
  authorizationScope?: SessionAuthorizationListScope | undefined;
3141
3229
  };
3142
3230
  declare class SessionPinVersionConflictError extends Error {
@@ -3146,9 +3234,15 @@ declare class SessionPinVersionConflictError extends Error {
3146
3234
  declare class SessionListCursorError extends Error {
3147
3235
  constructor(message?: string);
3148
3236
  }
3237
+ declare class SessionListCursorExpiredError extends Error {
3238
+ constructor(message?: string);
3239
+ }
3149
3240
  declare class SessionListAccessError extends Error {
3150
3241
  constructor(message?: string);
3151
3242
  }
3243
+ declare class SessionListSnapshotLimitError extends Error {
3244
+ constructor(message?: string);
3245
+ }
3152
3246
  declare class SessionPinAccessError extends Error {
3153
3247
  constructor(message?: string);
3154
3248
  }
@@ -3178,6 +3272,8 @@ declare function sessionTreeStatsForSessions(db: Database, workspaceId: string,
3178
3272
  * `UNION ALL`) makes legacy cycles terminate without a caller-sized path array.
3179
3273
  */
3180
3274
  declare function sessionAuthorizationScopeFilter(scope: SessionAuthorizationListScope): SQL;
3275
+ declare const SESSION_LIST_SNAPSHOT_MAX_IDS = 5000;
3276
+ declare const SESSION_LIST_SNAPSHOT_MAX_ACTIVE_PER_SUBJECT = 32;
3181
3277
  /** Opaque, URL-safe cursor encoding for a server-owned activity snapshot. */
3182
3278
  declare function encodeSessionListCursor(cursor: SessionListCursor): string;
3183
3279
  /** Decode and validate a cursor before it reaches any SQL predicate. */
@@ -3197,8 +3293,9 @@ declare function listSessionsForSubject(db: Database, workspaceId: string, optio
3197
3293
  declare function getSessionForSubject(db: Database, workspaceId: string, sessionId: string, subjectId: string, relatedSessionAccess?: "target" | "root"): Promise<Session | null>;
3198
3294
  /**
3199
3295
  * Idempotently set a member's pin without mutating the session's lifecycle or
3200
- * activity timestamps. A transaction advisory lock serializes same-subject,
3201
- * same-session actions across API replicas; expectedVersion rejects stale tabs.
3296
+ * activity timestamps. A subject-scoped transaction advisory lock serializes
3297
+ * personal pin mutations across API replicas and fences list projections;
3298
+ * expectedVersion rejects stale tabs.
3202
3299
  */
3203
3300
  declare function setSessionPin(db: Database, input: {
3204
3301
  workspaceId: string;
@@ -3523,6 +3620,7 @@ type PendingSessionToolCallInput = {
3523
3620
  callId: string;
3524
3621
  callType: string;
3525
3622
  callItem: Record<string, unknown>;
3623
+ modelToolOutputTruncationTokens?: number;
3526
3624
  };
3527
3625
  /**
3528
3626
  * Durably capture the raw SDK call item at the exact attempt boundary. This is
@@ -3833,8 +3931,17 @@ type SandboxPtySessionRow = {
3833
3931
  accountId: string;
3834
3932
  workspaceId: string;
3835
3933
  sessionId: string;
3934
+ leaseId: string | null;
3935
+ sandboxGroupId: string | null;
3936
+ retainedProcessId: string | null;
3937
+ openAdmissionId: string | null;
3836
3938
  execSessionId: number | null;
3837
3939
  leaseEpoch: number;
3940
+ providerBackend: string | null;
3941
+ providerInstanceId: string | null;
3942
+ routeKind: "home" | "active" | null;
3943
+ routeTargetId: string | null;
3944
+ routeEpoch: number | null;
3838
3945
  cols: number;
3839
3946
  rows: number;
3840
3947
  shell: string;
@@ -3845,41 +3952,108 @@ type SandboxPtySessionRow = {
3845
3952
  createdAt: string;
3846
3953
  closedAt: string | null;
3847
3954
  };
3955
+ type SandboxPtyProcessIdentity = {
3956
+ leaseId: string;
3957
+ sandboxGroupId: string;
3958
+ retainedProcessId: string;
3959
+ openAdmissionId: string;
3960
+ execSessionId: number;
3961
+ leaseEpoch: number;
3962
+ providerBackend: string;
3963
+ providerInstanceId: string;
3964
+ routeKind: "home" | "active";
3965
+ routeTargetId: string | null;
3966
+ routeEpoch: number;
3967
+ };
3968
+ type SandboxOpenPtySessionRow = Omit<SandboxPtySessionRow, keyof SandboxPtyProcessIdentity | "status"> & SandboxPtyProcessIdentity & {
3969
+ status: "open";
3970
+ };
3848
3971
  declare function insertPtySession(db: Database, input: {
3849
3972
  id: string;
3850
3973
  accountId: string;
3851
3974
  workspaceId: string;
3852
3975
  sessionId: string;
3853
- execSessionId?: number | null;
3854
- leaseEpoch: number;
3976
+ identity: SandboxPtyProcessIdentity;
3855
3977
  cols: number;
3856
3978
  rows: number;
3857
3979
  shell: string;
3858
3980
  cwd: string;
3859
3981
  openedBy: string;
3860
- }): Promise<SandboxPtySessionRow>;
3982
+ }): Promise<SandboxOpenPtySessionRow>;
3861
3983
  /** Read an OPEN PTY row by ptyId. Returns null when absent or already closed. */
3862
- declare function getOpenPtySession(db: Database, workspaceId: string, ptyId: string): Promise<SandboxPtySessionRow | null>;
3863
- /** Stamp the SDK exec-session id (known only after the open exec yields a still-
3864
- * running process) + refresh the input-activity TTL. */
3984
+ declare function getOpenPtySession(db: Database, input: {
3985
+ workspaceId: string;
3986
+ sessionId: string;
3987
+ ptyId: string;
3988
+ }): Promise<SandboxOpenPtySessionRow | null>;
3989
+ /** Refresh activity/geometry only when the full retained-process identity still
3990
+ * matches. A numeric provider locator or PTY UUID alone is never authority. */
3865
3991
  declare function updatePtySessionActivity(db: Database, input: {
3866
3992
  accountId: string;
3867
3993
  workspaceId: string;
3994
+ sessionId: string;
3868
3995
  ptyId: string;
3869
- execSessionId?: number | null;
3996
+ identity: SandboxPtyProcessIdentity;
3870
3997
  cols?: number;
3871
3998
  rows?: number;
3872
- }): Promise<SandboxPtySessionRow | null>;
3999
+ }): Promise<SandboxOpenPtySessionRow | null>;
3873
4000
  /** Mark a PTY closed (idempotent — a double close on a closed row is a no-op). */
3874
4001
  declare function closePtySession(db: Database, input: {
3875
4002
  accountId: string;
3876
4003
  workspaceId: string;
4004
+ sessionId: string;
3877
4005
  ptyId: string;
4006
+ identity: SandboxPtyProcessIdentity;
3878
4007
  }): Promise<SandboxPtySessionRow | null>;
3879
4008
  /** List a session's OPEN PTYs (reattach + reap). */
3880
- declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxPtySessionRow[]>;
4009
+ declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxOpenPtySessionRow[]>;
3881
4010
  type SandboxLeaseLiveness = "cold" | "warming" | "warm" | "draining";
3882
- type LeaseHolderKind = "turn" | "viewer";
4011
+ type LeaseHolderKind = "turn" | "viewer" | "direct" | "process";
4012
+ type SandboxProviderExistence = "not_created" | "creating" | "exists" | "missing" | "unknown";
4013
+ type SandboxArchiveAvailability = "none" | "available" | "unverified" | "invalid";
4014
+ type SandboxRestoreStatus = "not_required" | "pending" | "restoring" | "verifying" | "ready" | "degraded" | "unrecoverable";
4015
+ type SandboxWorkspaceReadiness = "unknown" | "not_ready" | "ready" | "degraded" | "unrecoverable";
4016
+ type SandboxArchiveRevision = {
4017
+ version: 1;
4018
+ revision: string;
4019
+ archiveSha256: string;
4020
+ archiveBytes: number;
4021
+ capturedAt: string;
4022
+ workspace: {
4023
+ algorithm: "sha256";
4024
+ sha256: string;
4025
+ entryCount: number;
4026
+ fileCount: number;
4027
+ totalFileBytes: number;
4028
+ };
4029
+ };
4030
+ type SandboxRecoveryState = {
4031
+ provider: {
4032
+ status: SandboxProviderExistence;
4033
+ instanceId: string | null;
4034
+ observedAt: string | null;
4035
+ diagnostic?: string;
4036
+ };
4037
+ archive: {
4038
+ status: SandboxArchiveAvailability;
4039
+ current: SandboxArchiveRevision | null;
4040
+ previous: SandboxArchiveRevision | null;
4041
+ };
4042
+ restore: {
4043
+ status: SandboxRestoreStatus;
4044
+ rematerializationId: string | null;
4045
+ selectedRevision: string | null;
4046
+ startedAt: string | null;
4047
+ completedAt: string | null;
4048
+ failureCode?: string;
4049
+ retryable?: boolean;
4050
+ };
4051
+ workspace: {
4052
+ status: SandboxWorkspaceReadiness;
4053
+ verifiedRevision: string | null;
4054
+ verifiedAt: string | null;
4055
+ };
4056
+ };
3883
4057
  interface LeaseSnapshot {
3884
4058
  id: string;
3885
4059
  sandboxGroupId: string;
@@ -3895,8 +4069,20 @@ interface LeaseSnapshot {
3895
4069
  dataPlaneUrl: string | null;
3896
4070
  terminalDataPlaneUrl: string | null;
3897
4071
  leaseEpoch: number;
4072
+ /** Monotonic filesystem mutation intent for the exact live workspace. */
4073
+ workspaceGeneration: number;
4074
+ /** Generation captured by the current verified archive, or null when no
4075
+ * generation-complete archive exists. */
4076
+ archiveGeneration: number | null;
4077
+ /** True only when the current verified archive represents the exact current
4078
+ * workspace generation. This is numeric/boolean truth, never archive content. */
4079
+ archiveComplete: boolean;
3898
4080
  resumeBackendId: string | null;
3899
4081
  resumeState: Record<string, unknown> | null;
4082
+ /** Provider/archive/restore/workspace truth, deliberately separate from the
4083
+ * lease liveness and epoch fields above. Legacy envelopes project to
4084
+ * conservative unknown/unverified values. */
4085
+ recovery: SandboxRecoveryState;
3900
4086
  expiresAt: Date;
3901
4087
  }
3902
4088
  interface LiveModalSandboxLeaseAttribution {
@@ -3930,6 +4116,10 @@ type AcquireLeaseResult = {
3930
4116
  } | {
3931
4117
  role: "rearmed";
3932
4118
  lease: LeaseSnapshot;
4119
+ } | {
4120
+ role: "blocked";
4121
+ code: "restore_degraded" | "restore_unrecoverable";
4122
+ lease: LeaseSnapshot;
3933
4123
  } | {
3934
4124
  role: "fenced";
3935
4125
  lease: LeaseSnapshot;
@@ -3939,6 +4129,14 @@ declare class SandboxLeaseSupersededError extends Error {
3939
4129
  readonly leaseEpoch: number;
3940
4130
  constructor(sandboxGroupId: string, leaseEpoch: number);
3941
4131
  }
4132
+ declare class SandboxLeaseRecoveryBlockedError extends Error {
4133
+ readonly sandboxGroupId: string;
4134
+ readonly leaseEpoch: number;
4135
+ readonly code: "restore_degraded" | "restore_unrecoverable";
4136
+ readonly recovery: SandboxRecoveryState;
4137
+ readonly name = "SandboxLeaseRecoveryBlockedError";
4138
+ constructor(sandboxGroupId: string, leaseEpoch: number, code: "restore_degraded" | "restore_unrecoverable", recovery: SandboxRecoveryState);
4139
+ }
3942
4140
  declare class SandboxImageConflictError extends Error {
3943
4141
  readonly sandboxGroupId: string;
3944
4142
  readonly currentImage: string;
@@ -3952,6 +4150,60 @@ declare class SandboxRigConflictError extends Error {
3952
4150
  constructor(sandboxGroupId: string, currentRigVersionId: string, requestedRigVersionId: string);
3953
4151
  }
3954
4152
  declare function acquireLease(db: Database, input: AcquireLeaseInput): Promise<AcquireLeaseResult>;
4153
+ type BeginSandboxRematerializationResult = {
4154
+ status: "started";
4155
+ lease: LeaseSnapshot;
4156
+ } | {
4157
+ status: "blocked";
4158
+ code: "archive_unavailable" | "archive_unverified" | "archive_generation_mismatch" | "attempt_conflict" | "stale_epoch";
4159
+ lease: LeaseSnapshot | null;
4160
+ };
4161
+ /** Records the single cold->warming winner's exact restore attempt. The lease
4162
+ * election remains the sole spawner guard; this adds durable selected-revision
4163
+ * and progress truth under the same epoch. */
4164
+ declare function beginSandboxRematerialization(db: Database, input: {
4165
+ accountId: string;
4166
+ workspaceId: string;
4167
+ sandboxGroupId: string;
4168
+ expectedEpoch: number;
4169
+ rematerializationId: string;
4170
+ /** Optional durable per-session fallback envelope. When the lease has no
4171
+ * archive yet, its archive fields are imported under this same row lock so
4172
+ * restoration can never consume bytes that were not durably selected by
4173
+ * the lease attempt. Provider/session state is never imported here. */
4174
+ archiveSource?: Record<string, unknown> | null;
4175
+ }): Promise<BeginSandboxRematerializationResult>;
4176
+ declare function markSandboxRestoreVerifying(db: Database, input: {
4177
+ accountId: string;
4178
+ workspaceId: string;
4179
+ sandboxGroupId: string;
4180
+ expectedEpoch: number;
4181
+ rematerializationId: string;
4182
+ }): Promise<{
4183
+ wrote: boolean;
4184
+ }>;
4185
+ declare function failSandboxRematerialization(db: Database, input: {
4186
+ accountId: string;
4187
+ workspaceId: string;
4188
+ sandboxGroupId: string;
4189
+ expectedEpoch: number;
4190
+ rematerializationId: string;
4191
+ failureCode: string;
4192
+ retryable: boolean;
4193
+ }): Promise<{
4194
+ failed: boolean;
4195
+ lease: LeaseSnapshot | null;
4196
+ }>;
4197
+ declare function markSandboxProviderReady(db: Database, input: {
4198
+ accountId: string;
4199
+ workspaceId: string;
4200
+ sandboxGroupId: string;
4201
+ expectedEpoch: number;
4202
+ expectedInstanceId: string;
4203
+ }): Promise<{
4204
+ wrote: boolean;
4205
+ lease: LeaseSnapshot | null;
4206
+ }>;
3955
4207
  declare function commitWarmingToWarm(db: Database, input: {
3956
4208
  accountId: string;
3957
4209
  workspaceId: string;
@@ -3961,16 +4213,28 @@ declare function commitWarmingToWarm(db: Database, input: {
3961
4213
  dataPlaneUrl?: string | null;
3962
4214
  resumeBackendId?: string | null;
3963
4215
  resumeState?: Record<string, unknown> | null;
4216
+ /** Required when the warming lease carries a selected durable archive.
4217
+ * The warm transition is rejected unless this exact attempt is in the
4218
+ * verifying state for this exact revision. */
4219
+ rematerialization?: {
4220
+ id: string;
4221
+ verifiedRevision: string;
4222
+ };
3964
4223
  leaseTtlMs: number;
3965
4224
  }): Promise<{
3966
4225
  committed: boolean;
3967
4226
  lease: LeaseSnapshot | null;
4227
+ reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
3968
4228
  }>;
3969
4229
  declare function recordWarmingSandboxCreated(db: Database, input: {
3970
4230
  accountId: string;
3971
4231
  workspaceId: string;
3972
4232
  sandboxGroupId: string;
3973
4233
  expectedEpoch: number;
4234
+ /** Exact restore attempt elected before provider create. Null for a fresh
4235
+ * archive-less create. Provider attribution is accepted only while the
4236
+ * warming row still carries this same attempt as well as this epoch. */
4237
+ rematerializationId?: string | null;
3974
4238
  instanceId: string;
3975
4239
  resumeBackendId?: string | null;
3976
4240
  resumeState?: Record<string, unknown> | null;
@@ -4010,6 +4274,8 @@ declare function markWarmLeaseInstanceLost(db: Database, input: {
4010
4274
  sandboxGroupId: string;
4011
4275
  expectedEpoch: number;
4012
4276
  expectedInstanceId: string;
4277
+ /** Bounded classifier output only; never raw provider error text. */
4278
+ diagnostic?: string;
4013
4279
  }): Promise<MarkWarmLeaseInstanceLostResult>;
4014
4280
  declare function failWarmingToCold(db: Database, input: {
4015
4281
  accountId: string;
@@ -4069,6 +4335,7 @@ declare function reapStaleLeaseHolders(db: Database, input: {
4069
4335
  idleGraceMs: number;
4070
4336
  }): Promise<{
4071
4337
  reapedViewers: number;
4338
+ reapedDirect: number;
4072
4339
  reapedTurns: number;
4073
4340
  warmingReset: number;
4074
4341
  drained: ReapDrainable[];
@@ -4109,22 +4376,284 @@ declare function confirmDrainCold(db: Database, input: {
4109
4376
  workspaceId: string;
4110
4377
  sandboxGroupId: string;
4111
4378
  expectedEpoch: number;
4379
+ /** Definitive provider NotFound before this drain could capture /workspace.
4380
+ * With no durable archive this must become typed unrecoverable, never a
4381
+ * clean cold lease that can expose an empty replacement. */
4382
+ providerMissingBeforeCapture?: boolean;
4112
4383
  }): Promise<{
4113
4384
  wentCold: boolean;
4114
4385
  }>;
4386
+ declare class SandboxWorkspaceMutationFencedError extends Error {
4387
+ readonly code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted";
4388
+ readonly name = "SandboxWorkspaceMutationFencedError";
4389
+ constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted", message: string);
4390
+ }
4391
+ type SandboxWorkspaceMutationAdmission = {
4392
+ id: string;
4393
+ leaseId: string;
4394
+ sandboxGroupId: string;
4395
+ sessionId: string;
4396
+ actorKind: "turn" | "direct" | "process";
4397
+ actorId: string;
4398
+ holderKind: "turn" | "direct" | "process";
4399
+ holderId: string;
4400
+ leaseEpoch: number;
4401
+ providerBackend: string;
4402
+ providerInstanceId: string;
4403
+ routeKind: "home" | "active";
4404
+ routeTargetId: string | null;
4405
+ routeEpoch: number;
4406
+ workspaceGeneration: number;
4407
+ };
4408
+ type SandboxWorkspaceMutationProviderOutcome = "resolved" | "rejected";
4409
+ type SandboxRetainedProcessState = "active" | "exited" | "lost";
4410
+ type SandboxRetainedProcess = {
4411
+ id: string;
4412
+ accountId: string;
4413
+ workspaceId: string;
4414
+ sessionId: string;
4415
+ leaseId: string;
4416
+ sandboxGroupId: string;
4417
+ parentAdmissionId: string;
4418
+ holderId: string;
4419
+ ownerActorKind: "turn" | "direct";
4420
+ ownerActorId: string;
4421
+ ownerTurnId: string | null;
4422
+ ownerAttemptId: string | null;
4423
+ ownerExecutionGeneration: number | null;
4424
+ leaseEpoch: number;
4425
+ providerBackend: string;
4426
+ providerInstanceId: string;
4427
+ routeKind: "home" | "active";
4428
+ routeTargetId: string | null;
4429
+ routeEpoch: number;
4430
+ providerSessionId: number;
4431
+ state: SandboxRetainedProcessState;
4432
+ exitCode: number | null;
4433
+ settlementReason: string | null;
4434
+ startedAt: string;
4435
+ settledAt: string | null;
4436
+ };
4437
+ /**
4438
+ * Advance the live workspace's mutation generation before an acknowledged
4439
+ * filesystem-writing operation reaches the provider. The normal activity write
4440
+ * fence is acquired first (workspace control -> workspace -> session -> turn ->
4441
+ * attempt), then the exact lease row is updated under its epoch + provider-id
4442
+ * predicates. Any failed fence rejects the operation before external effects.
4443
+ */
4444
+ declare function advanceWorkspaceGeneration(db: Database, input: {
4445
+ accountId: string;
4446
+ workspaceId: string;
4447
+ sessionId: string;
4448
+ turnId: string;
4449
+ executionGeneration: number;
4450
+ attemptId: string;
4451
+ holderId: string;
4452
+ sandboxGroupId: string;
4453
+ expectedEpoch: number;
4454
+ expectedInstanceId: string;
4455
+ operation: string;
4456
+ /** Active-routed mutations bind to the exact session pointer. Omitted means
4457
+ * an intentional home-provider write outside the routing surface. */
4458
+ routeKind?: "home" | "active";
4459
+ routeTargetId?: string | null;
4460
+ routeEpoch?: number;
4461
+ }): Promise<SandboxWorkspaceMutationAdmission>;
4462
+ /** Admit an API/direct mutation under an exact request holder and active route.
4463
+ * Direct actors intentionally have no turn identity and can never inherit the
4464
+ * attempt-quiescence archive fallback. */
4465
+ declare function advanceWorkspaceGenerationForDirectRequest(db: Database, input: {
4466
+ accountId: string;
4467
+ workspaceId: string;
4468
+ sessionId: string;
4469
+ requestId: string;
4470
+ holderId: string;
4471
+ sandboxGroupId: string;
4472
+ expectedEpoch: number;
4473
+ expectedInstanceId: string;
4474
+ routeTargetId: string | null;
4475
+ routeEpoch: number;
4476
+ operation: string;
4477
+ }): Promise<SandboxWorkspaceMutationAdmission>;
4478
+ /** Admit one model/user-visible stdin write for an exact retained process. The
4479
+ * process's original provider and route are authoritative even if the session's
4480
+ * active pointer has since moved. */
4481
+ declare function advanceWorkspaceGenerationForRetainedProcess(db: Database, input: {
4482
+ accountId: string;
4483
+ workspaceId: string;
4484
+ sessionId: string;
4485
+ processId: string;
4486
+ operation: string;
4487
+ }): Promise<SandboxWorkspaceMutationAdmission>;
4488
+ /** Physically settle one exact provider mutation admission after its promise
4489
+ * resolves or rejects. Rejections need no output acceptance, but still clear
4490
+ * the in-flight capture blocker. Resolved output is accepted only after the
4491
+ * canonical attempt fence plus the exact live lease-holder/provider identity
4492
+ * are revalidated. A failed acceptance fence is reported only AFTER the
4493
+ * settlement transaction commits, so stale output can be rejected without
4494
+ * resurrecting the physical blocker. */
4495
+ declare function verifyWorkspaceMutationSettlement(db: Database, input: {
4496
+ accountId: string;
4497
+ workspaceId: string;
4498
+ sessionId: string;
4499
+ turnId: string;
4500
+ executionGeneration: number;
4501
+ attemptId: string;
4502
+ holderId: string;
4503
+ sandboxGroupId: string;
4504
+ expectedEpoch: number;
4505
+ expectedInstanceId: string;
4506
+ admission: SandboxWorkspaceMutationAdmission;
4507
+ operation: string;
4508
+ outcome: SandboxWorkspaceMutationProviderOutcome;
4509
+ routeKind?: "home" | "active";
4510
+ routeTargetId?: string | null;
4511
+ routeEpoch?: number;
4512
+ }): Promise<void>;
4513
+ declare function verifyDirectWorkspaceMutationSettlement(db: Database, input: {
4514
+ accountId: string;
4515
+ workspaceId: string;
4516
+ sessionId: string;
4517
+ requestId: string;
4518
+ holderId: string;
4519
+ sandboxGroupId: string;
4520
+ expectedEpoch: number;
4521
+ expectedInstanceId: string;
4522
+ routeTargetId: string | null;
4523
+ routeEpoch: number;
4524
+ admission: SandboxWorkspaceMutationAdmission;
4525
+ operation: string;
4526
+ outcome: SandboxWorkspaceMutationProviderOutcome;
4527
+ }): Promise<void>;
4528
+ declare function verifyRetainedProcessMutationSettlement(db: Database, input: {
4529
+ accountId: string;
4530
+ workspaceId: string;
4531
+ sessionId: string;
4532
+ processId: string;
4533
+ admission: SandboxWorkspaceMutationAdmission;
4534
+ operation: string;
4535
+ outcome: SandboxWorkspaceMutationProviderOutcome;
4536
+ }): Promise<void>;
4537
+ /** Promote one yielded provider exec into durable process authority. The parent
4538
+ * admission stays unsettled (`retained`) and a process holder is inserted in the
4539
+ * same transaction, so ordinary request/turn cleanup cannot open archive capture. */
4540
+ declare function retainWorkspaceMutationProcess(db: Database, input: {
4541
+ accountId: string;
4542
+ workspaceId: string;
4543
+ sessionId: string;
4544
+ processId: string;
4545
+ providerSessionId: number;
4546
+ admissionId: string;
4547
+ admittedWorkspaceGeneration: number;
4548
+ operation: string;
4549
+ owner: {
4550
+ kind: "turn";
4551
+ turnId: string;
4552
+ executionGeneration: number;
4553
+ attemptId: string;
4554
+ holderId: string;
4555
+ sandboxGroupId: string;
4556
+ expectedEpoch: number;
4557
+ expectedInstanceId: string;
4558
+ routeKind?: "home" | "active";
4559
+ routeTargetId?: string | null;
4560
+ routeEpoch?: number;
4561
+ } | {
4562
+ kind: "direct";
4563
+ requestId: string;
4564
+ holderId: string;
4565
+ sandboxGroupId: string;
4566
+ expectedEpoch: number;
4567
+ expectedInstanceId: string;
4568
+ routeTargetId: string | null;
4569
+ routeEpoch: number;
4570
+ };
4571
+ }): Promise<SandboxRetainedProcess>;
4572
+ /** Read one retained process by durable UUID. Callers must use the copied route
4573
+ * identity; a numeric provider session id alone is never sufficient authority. */
4574
+ declare function getRetainedProcess(db: Database, input: {
4575
+ workspaceId: string;
4576
+ sessionId: string;
4577
+ processId: string;
4578
+ }): Promise<SandboxRetainedProcess | null>;
4579
+ /** Settle an exact retained process only after exit or definitive loss proof.
4580
+ * The process row, parent admission, non-TTL holder, and lease count transition
4581
+ * commit atomically. Duplicate identical proof is idempotent; conflicting proof
4582
+ * fails closed. */
4583
+ declare function settleRetainedProcess(db: Database, input: {
4584
+ accountId: string;
4585
+ workspaceId: string;
4586
+ sessionId: string;
4587
+ processId: string;
4588
+ outcome: "exited" | "lost";
4589
+ exitCode?: number | null;
4590
+ reason: string;
4591
+ idleGraceMs: number;
4592
+ }): Promise<{
4593
+ settled: boolean;
4594
+ process: SandboxRetainedProcess;
4595
+ }>;
4596
+ /** Read the exact generation a verified capture must later fold. This is a
4597
+ * preflight only: persistWarmSnapshot/persistDrainSnapshot repeat the full
4598
+ * epoch, provider, liveness, and generation CAS under the archive-fold lock. */
4599
+ declare function readWorkspaceArchiveCapturePreflight(db: Database, input: {
4600
+ accountId: string;
4601
+ workspaceId: string;
4602
+ sandboxGroupId: string;
4603
+ expectedEpoch: number;
4604
+ expectedInstanceId: string;
4605
+ liveness: "warm" | "draining";
4606
+ }): Promise<{
4607
+ workspaceGeneration: number;
4608
+ archiveGeneration: number | null;
4609
+ archiveComplete: boolean;
4610
+ } | null>;
4115
4611
  declare function persistDrainSnapshot(db: Database, input: {
4116
4612
  accountId: string;
4117
4613
  workspaceId: string;
4118
4614
  sandboxGroupId: string;
4119
4615
  expectedEpoch: number;
4616
+ expectedInstanceId: string;
4617
+ expectedWorkspaceGeneration: number;
4120
4618
  /** base64 of the provider snapshot-ref / tar archive from persistWorkspace().
4121
- * Pass null to CAS-check without writing (for backends with no persistWorkspace). */
4619
+ * Pass null only to CAS-check without writing; this does not certify that
4620
+ * provider termination is lossless. */
4122
4621
  workspaceArchive: string | null;
4622
+ /** Exact verified archive/tree descriptor produced by the runtime capture.
4623
+ * Omission is accepted only for legacy callers and remains unverified. */
4624
+ workspaceArchiveMeta?: SandboxArchiveRevision;
4123
4625
  }): Promise<{
4124
4626
  wrote: boolean;
4125
- priorArchive: string | null;
4126
- priorArchivePrev: string | null;
4627
+ priorArchiveForGc: string | null;
4628
+ archiveRevision: string | null;
4127
4629
  }>;
4630
+ /**
4631
+ * The ONE archive-fold write, shared by the drain seam (persistDrainSnapshot)
4632
+ * and the mid-session seam (persistWarmSnapshot) — the two differ only in
4633
+ * their CAS guard (draining@refcount0 vs warm) and their read-side semantics.
4634
+ *
4635
+ * Merges the NEW archive (+ its workspaceArchiveAt timestamp, the throttle
4636
+ * baseline for mid-session snapshots) into resume_state.sessionState.
4637
+ * jsonb_set's create_missing does NOT create intermediate objects, so a direct
4638
+ * set of '{sessionState,workspaceArchive}' is a silent no-op when
4639
+ * `sessionState` is absent (a null resume_state, or a legacy flat envelope).
4640
+ * Instead: rebuild `sessionState` as (existing sessionState OR '{}') merged
4641
+ * (||) with the fold — this CREATES sessionState if absent AND preserves its
4642
+ * existing siblings (providerState/manifest/exposedPorts). The archive is
4643
+ * bound as a jsonb string scalar (to_jsonb(text)). Re-asserting the caller's
4644
+ * CAS guard keeps the write atomic with its FOR UPDATE lock. Archive-slot
4645
+ * rotation is computed by rotateWorkspaceArchives before this writer is called,
4646
+ * so the warm and drain seams use exactly the same retention policy.
4647
+ */
4648
+ declare function rotateWorkspaceArchives(input: {
4649
+ resumeState: Record<string, unknown> | null;
4650
+ priorCurrentArchive: string | null;
4651
+ priorPreviousArchive: string | null;
4652
+ }): {
4653
+ previousArchive: string | null;
4654
+ previousArchiveMeta: SandboxArchiveRevision | null;
4655
+ priorArchiveForGc: string | null;
4656
+ };
4128
4657
  /**
4129
4658
  * MID-SESSION /workspace snapshot fold (sandbox-file-persistence). The WARM
4130
4659
  * sibling of persistDrainSnapshot: a turn that HOLDS the live box folds a fresh
@@ -4144,8 +4673,13 @@ declare function persistWarmSnapshot(db: Database, input: {
4144
4673
  attemptId: string;
4145
4674
  sandboxGroupId: string;
4146
4675
  expectedEpoch: number;
4676
+ expectedInstanceId: string;
4677
+ expectedWorkspaceGeneration: number;
4147
4678
  /** base64 of the provider snapshot-ref / tar archive from persistWorkspace(). */
4148
4679
  workspaceArchive: string;
4680
+ /** Exact verified archive/tree descriptor produced by the runtime capture.
4681
+ * Omission is accepted only for legacy callers and remains unverified. */
4682
+ workspaceArchiveMeta?: SandboxArchiveRevision;
4149
4683
  /** Snapshots newer than this many ms are kept (throttle); 0 = always write. */
4150
4684
  minIntervalMs: number;
4151
4685
  /** Wall-clock (ms) this capture STARTED. Ordering is by capture-initiation,
@@ -4159,6 +4693,7 @@ declare function persistWarmSnapshot(db: Database, input: {
4159
4693
  throttled: boolean;
4160
4694
  superseded: boolean;
4161
4695
  priorArchiveForGc: string | null;
4696
+ archiveRevision: string | null;
4162
4697
  }>;
4163
4698
  declare function getMaterializedSandboxFileResources(db: Database, input: {
4164
4699
  accountId: string;
@@ -4702,6 +5237,23 @@ type CreateSessionGoalInput = {
4702
5237
  };
4703
5238
  declare function createSessionGoal(db: Database, input: CreateSessionGoalInput): Promise<SessionGoal>;
4704
5239
  declare function getSessionGoal(db: Database, workspaceId: string, sessionId: string): Promise<SessionGoal | null>;
5240
+ type SessionGoalContinuationProjection = {
5241
+ state: "inactive" | "scheduled" | "running" | "blocked" | "invariant_broken";
5242
+ reason: "goal_inactive" | "wake_pending" | "continuation_pending" | "human_work_pending" | "goal_turn_running" | "human_turn_running" | "workstream_paused" | "approval_required" | "provider_backpressure" | "session_cancelled" | "system_work_pending" | "missing_obligation";
5243
+ wakeRevision: number;
5244
+ observedRevision: number;
5245
+ nextAttemptAt: string | null;
5246
+ lastError: string | null;
5247
+ };
5248
+ /**
5249
+ * Read the goal and its autonomy state from one repeatable Postgres snapshot.
5250
+ * The projection never infers liveness from the public session status alone:
5251
+ * goal revisions, typed internal updates/turns, capacity waiters, admission
5252
+ * control, and the workflow-wake delivery ledger each remain distinct truth.
5253
+ */
5254
+ declare function getSessionGoalWithContinuation(db: Database, workspaceId: string, sessionId: string): Promise<(SessionGoal & {
5255
+ continuation: SessionGoalContinuationProjection;
5256
+ }) | null>;
4705
5257
  declare function clearSessionGoal(db: Database, workspaceId: string, sessionId: string): Promise<{
4706
5258
  cleared: boolean;
4707
5259
  goal: SessionGoal | null;
@@ -4717,6 +5269,19 @@ declare function upsertSessionGoal(db: Database, input: CreateSessionGoalInput):
4717
5269
  goal: SessionGoal;
4718
5270
  replaced: boolean;
4719
5271
  }>;
5272
+ /**
5273
+ * Agent/API goal_set: session sequence ownership, the create-or-replace
5274
+ * mutation, and goal.set timeline fact commit together. The session-first lock
5275
+ * order matches active-turn event writes; goal_set must never hold a goal row
5276
+ * while waiting for the session sequence owner.
5277
+ */
5278
+ declare function upsertSessionGoalWithEvent(db: Database, input: CreateSessionGoalInput & {
5279
+ actor: "agent" | "api";
5280
+ }): Promise<{
5281
+ goal: SessionGoal;
5282
+ replaced: boolean;
5283
+ events: SessionEvent[];
5284
+ }>;
4720
5285
  /**
4721
5286
  * goal_update semantics: revise text/criteria without changing status. The
4722
5287
  * version bump counts as progress for the no-progress detector.
@@ -4725,6 +5290,30 @@ declare function updateSessionGoal(db: Database, workspaceId: string, sessionId:
4725
5290
  text?: string;
4726
5291
  successCriteria?: string | null;
4727
5292
  }): Promise<SessionGoal>;
5293
+ /**
5294
+ * Agent goal_update: session sequence ownership, goal mutation, and its audit
5295
+ * event commit together. Locking the session before the goal also matches an
5296
+ * active turn's event-write order and avoids the workspace->session inversion
5297
+ * that previously self-locked root goal mutations.
5298
+ */
5299
+ declare function updateSessionGoalWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
5300
+ text?: string;
5301
+ successCriteria?: string | null;
5302
+ progressNote?: string;
5303
+ actor: "agent" | "api";
5304
+ command?: {
5305
+ accountId: string;
5306
+ actor: Extract<SessionCommandActor, {
5307
+ type: "agent_attempt";
5308
+ }>;
5309
+ operationKey: string;
5310
+ };
5311
+ }): Promise<{
5312
+ goal: SessionGoal;
5313
+ events: SessionEvent[];
5314
+ operationId: string | null;
5315
+ replay: boolean;
5316
+ }>;
4728
5317
  /**
4729
5318
  * Sets a session's display title. The clobber guard lives entirely in this
4730
5319
  * single atomic UPDATE: a user-set title is permanent, so agent/auto writes
@@ -4762,6 +5351,31 @@ declare function setSessionGoalStatus(db: Database, workspaceId: string, session
4762
5351
  changed: boolean;
4763
5352
  workflowWakeRevision: number | null;
4764
5353
  }>;
5354
+ type SetSessionGoalStatusEvent = {
5355
+ type: "goal.completed";
5356
+ evidence: string;
5357
+ } | {
5358
+ type: "goal.paused";
5359
+ actor: "agent" | "api";
5360
+ reason: string;
5361
+ rationale?: string;
5362
+ } | {
5363
+ type: "goal.resumed";
5364
+ actor: "api";
5365
+ };
5366
+ /** Status mutation and its timeline fact share the same session-first commit. */
5367
+ declare function setSessionGoalStatusWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
5368
+ status: SessionGoalStatus;
5369
+ evidence?: string;
5370
+ rationale?: string;
5371
+ pausedReason?: string;
5372
+ event: SetSessionGoalStatusEvent;
5373
+ }): Promise<{
5374
+ goal: SessionGoal;
5375
+ changed: boolean;
5376
+ workflowWakeRevision: number | null;
5377
+ events: SessionEvent[];
5378
+ }>;
4765
5379
  declare function setSessionGoalLastContinuationTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<void>;
4766
5380
  type GoalContinuationDecision = {
4767
5381
  decision: "none";
@@ -4792,6 +5406,45 @@ declare function evaluateGoalContinuation(db: Database, input: {
4792
5406
  noProgressLimit: number;
4793
5407
  budgetBlocked?: string | null;
4794
5408
  }): Promise<GoalContinuationDecision>;
5409
+ type MaterializeGoalContinuationResult = {
5410
+ action: "none" | "queue";
5411
+ events: [];
5412
+ } | {
5413
+ action: "paused";
5414
+ events: SessionEvent[];
5415
+ } | {
5416
+ action: "continue";
5417
+ events: SessionEvent[];
5418
+ update: SessionSystemUpdate;
5419
+ goalWakeRevision: number;
5420
+ workflowWakeRevision: number;
5421
+ };
5422
+ /**
5423
+ * Consume one durable goal-wake revision into one continuation obligation.
5424
+ *
5425
+ * This is deliberately one outer PostgreSQL transaction. The existing locked
5426
+ * evaluator runs as a nested savepoint, so its no-progress/counter mutation is
5427
+ * rolled back if prompt construction, update/event insertion, metering, or the
5428
+ * workflow-wake outbox write fails. Retrying after a lost COMMIT response sees
5429
+ * the same stable goal revision and the already-pending update; it never spends
5430
+ * another continuation count or creates another usage row.
5431
+ */
5432
+ declare function materializeGoalContinuation(db: Database, input: {
5433
+ accountId: string;
5434
+ workspaceId: string;
5435
+ sessionId: string;
5436
+ workflowId: string;
5437
+ defaultMaxAutoContinuations?: number | null;
5438
+ noProgressLimit: number;
5439
+ budgetBlocked?: string | null;
5440
+ policy: {
5441
+ model: string;
5442
+ reasoningEffort: ReasoningEffort;
5443
+ tools: ToolRef[];
5444
+ sandboxBackend: SandboxBackend;
5445
+ };
5446
+ prompt: (goal: SessionGoal, autoContinuation: number, cap: number | null) => string;
5447
+ }): Promise<MaterializeGoalContinuationResult>;
4795
5448
  type InitializeSessionStartInput = {
4796
5449
  accountId: string;
4797
5450
  workspaceId: string;
@@ -4806,6 +5459,10 @@ type InitializeSessionStartInput = {
4806
5459
  successCriteria?: string | null;
4807
5460
  maxAutoContinuations?: number | null;
4808
5461
  } | null;
5462
+ consumeNewSessionDraft?: {
5463
+ subjectId: string;
5464
+ expectedRevision: number;
5465
+ } | null;
4809
5466
  };
4810
5467
  type InitializeSessionStartResult = {
4811
5468
  events: SessionEvent[];
@@ -5360,4 +6017,4 @@ type LockedSessionUpdateResult = {
5360
6017
  declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>): Promise<SessionEvent[]>;
5361
6018
  declare function sessionSubject(workspaceId: string, sessionId: string): string;
5362
6019
 
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 };
6020
+ export { type CodexResetRedemptionOutcome as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BeginSandboxRematerializationResult as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexAccountUsageSnapshot as D, type CodexAllocatorUpdateResult as E, type CodexAuthDeps as F, type CodexCapacityAvailabilityDecision as G, type CodexCapacityMutationResult as H, type CodexCapacityResetKind as I, type CodexCapacitySelectionContext as J, type CodexCapacityWait as K, type CodexCapacityWaitStatus as L, type CodexCapacityWakeTarget as M, type CodexCredentialForRun as N, type CodexCredentialLeaseCandidateFilter as O, type CodexCredentialLeaseCandidateFilterResult as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialLeasePolicyScopeResolver as Q, type CodexCredentialLeaseQuarantine as R, type CodexCredentialLeaseResult as S, type CodexCredentialLeaseSelection as T, type CodexCredentialLeaseSelectionContext as U, type CodexCredentialStatus as V, type CodexCredentialTokens as W, type CodexLeaseAccountStatus as X, type CodexPinSource as Y, type CodexRateLimitResetCreditsAccountResult as Z, type CodexResetRedemptionAttempt as _, type AcceptSessionApprovalDecisionResult as a, type InstallOrReadTurnExecutionPolicyForAttemptResult as a$, type CodexResetRedemptionRecovery as a0, type CodexResetRedemptionSendNotReadyReason as a1, type CodexResetRedemptionStatus as a2, type CodexRotationSettings as a3, type CodexRotationStrategy as a4, type CodexTokenDeadlineClock as a5, type CodexTokenDeadlineOptions as a6, type ComposerDraftRow as a7, type ConnectionBrokerDeps as a8, type ConnectionCredentialForBroker as a9, type EffectiveSessionControl as aA, type EnableCapabilityInstallationInput as aB, type EnabledMcpCapabilityServer as aC, type EnqueueSessionTurnInput as aD, type EnrollmentExposure as aE, type EnrollmentOs as aF, type EnrollmentRecord as aG, type EnrollmentStatus as aH, type ExpiredFileUploadCleanupClaim as aI, type FenceCodexResetRedemptionSendResult as aJ, type FileUploadCleanupClaimResult as aK, type ForceDrainResult as aL, type FrozenTurnInitiator as aM, type GitHubInstallation as aN, type GitHubInstallationAccess as aO, type GoalContinuationDecision as aP, type HostExportConsumerStatus as aQ, type HostExportKind as aR, HostExportPayloadError as aS, HostMcpCredentialBindingError as aT, type HostMcpCredentialResolverContext as aU, HostMcpCredentialScopeError as aV, HumanInputResponseValidationError as aW, type IdempotentPersistenceTransactionOptions as aX, type ImportBatch as aY, type InitializeSessionStartInput as aZ, type InitializeSessionStartResult as a_, ConnectionRefreshHttpError as aa, type ConsumeOAuthStateNonceInput as ab, type CorrectWorkspaceMemoryInput as ac, type CorrectWorkspaceMemoryResult as ad, type CreateCapabilityCatalogItemInput as ae, type CreateConnectionInput as af, type CreateDbOptions as ag, type CreateImportBatchInput as ah, type CreateKnowledgeMemoryInput as ai, type CreatePackInstallationInput as aj, type CreateScheduledTaskInput as ak, type CreateSessionGoalInput as al, type CreateSessionMcpServerInput as am, type CreateSocialConnectionInput as an, type CreateSocialPostInput as ao, type CreditBalanceByAccount as ap, type Database as aq, type DatabaseFailureCode as ar, type DbClient as as, type DbSession as at, type DeviceEnrollmentRequestRecord as au, type DeviceEnrollmentStatus as av, type EditQueueCommandResult as aw, type EffectiveControlBlocker as ax, type EffectiveControlResumeOption as ay, type EffectiveControlState as az, type AcceptSessionHumanInputResponseResult as b, RigChangeTransitionError as b$, type IntegrationOAuthClientForUse as b0, type LeaseHolderKind as b1, type LeaseSnapshot as b2, type ListKnowledgeMemoryOptions as b3, type ListSessionEventPageOptions as b4, type ListSessionEventsOptions as b5, type ListSessionsForSubjectOptions as b6, type ListSessionsOptions as b7, type LiveModalSandboxLeaseAttribution as b8, MACHINE_METRICS_SERIES_INTERVAL_MS as b9, NewSessionDraftAccessError as bA, NewSessionDraftConflictError as bB, type NewSessionDraftRow as bC, type PendingSessionToolCallInput as bD, type PersistenceFailureDetails as bE, type PersistenceRetryOutcome as bF, type QueueCommandConflictCode as bG, QueueCommandConflictError as bH, type QueueCommandResult as bI, type QueuedTurnRow as bJ, type ReapDrainable as bK, type ReconcileCodexCapacityWaitResult as bL, type RecoverSessionDispatchInput as bM, type RecoverSessionDispatchResult as bN, type RefreshTransportOptions as bO, type RegisterWorkspacePackInput as bP, type RegistryCapabilityCatalogItemInput as bQ, type RegistryCatalogSurfaceKey as bR, type ReplaceIntegrationOAuthClientInput as bS, type RequestSessionTurnRecoveryInput as bT, type RequestSessionTurnRecoveryResult as bU, type ResolveConnectionCredentialInput as bV, type ResolveConnectionCredentialResult as bW, type RetainedFileArtifact as bX, RigActiveVersionChangedError as bY, RigChangeAlreadyVerifyingError as bZ, type RigChangeMonitoringSummary as b_, MAX_INTERNAL_UPDATE_BATCH_BYTES as ba, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as bb, MAX_INTERNAL_UPDATE_BYTES as bc, MEMORY_ACTIVE_RECORD_CAP as bd, MEMORY_BLOCK_KIND_ORDER as be, MEMORY_BLOCK_RECORD_LIMIT as bf, MEMORY_CORRECT_TOOL_DESCRIPTION as bg, MEMORY_KIND_SECTION_TITLES as bh, MEMORY_NEAR_DUP_COSINE_THRESHOLD as bi, MEMORY_NEAR_DUP_NEIGHBORS as bj, MEMORY_SAVE_TOOL_DESCRIPTION as bk, MEMORY_SEARCH_DEFAULT_LIMIT as bl, MEMORY_SEARCH_MAX_LIMIT as bm, MEMORY_SEARCH_TOOL_DESCRIPTION as bn, MEMORY_TEXT_MAX_CHARS as bo, MEMORY_VISIBLE_RECORD_CAP as bp, type MachineMetricsRow as bq, type MachineMetricsSample as br, type MarkWarmLeaseInstanceLostResult as bs, type MaterializeGoalContinuationResult as bt, type MemoryBlockRecord as bu, type MemoryEmbedder as bv, type MemorySanitizeResult as bw, type MeterableWarmLease as bx, type NestedAgentDepthDeploymentPolicy as by, type NestedAgentDepthPolicySource as bz, type AccrueWarmSecondsResult as c, type SessionListCursor as c$, type RigVersionContentInput as c0, type RigVersionMonitoringSummary as c1, type RlsContext as c2, type RlsStrategy as c3, SESSION_ANCESTRY_LIMIT as c4, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as c5, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as c6, SESSION_DISCOVERY_GOAL_MAX_CHARS as c7, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as c8, SESSION_EVENT_DB_PAGE_MAX_BYTES as c9, type SaveWorkspaceMemoryResult as cA, type SessionAttemptInterruptionSettlement as cB, type SessionCodexState as cC, type SessionCommandActor as cD, SessionCommandIdempotencyError as cE, type SessionCommandReceiptRow as cF, SessionContextBusyError as cG, SessionControlConflictError as cH, SessionControlInvariantError as cI, type SessionControlMutationResult as cJ, type SessionCreateDeniedResult as cK, type SessionCreateInput as cL, type SessionCreateResult as cM, type SessionCreateSuccessResult as cN, type SessionDepthPolicy as cO, type SessionDiscoveryControl as cP, type SessionDiscoveryCursor as cQ, type SessionDiscoveryOrderBy as cR, type SessionDiscoverySummary as cS, type SessionEventPage as cT, SessionEventPersistenceError as cU, type SessionEventWriteLockInput as cV, type SessionEventWriteLocks as cW, type SessionGoalContinuationProjection as cX, SessionIdConflictError as cY, type SessionLineage as cZ, SessionListAccessError as c_, SESSION_LIST_SNAPSHOT_MAX_ACTIVE_PER_SUBJECT as ca, SESSION_LIST_SNAPSHOT_MAX_IDS as cb, type SafeDatabaseErrorFacts as cc, type SandboxArchiveAvailability as cd, type SandboxArchiveRevision as ce, SandboxImageConflictError as cf, type SandboxKind as cg, type SandboxLeaseLiveness as ch, SandboxLeaseRecoveryBlockedError as ci, SandboxLeaseSupersededError as cj, type SandboxOpenPtySessionRow as ck, type SandboxProviderExistence as cl, type SandboxPtyProcessIdentity as cm, type SandboxPtySessionRow as cn, type SandboxRecord as co, type SandboxRecoveryState as cp, type SandboxRestoreStatus as cq, type SandboxRetainedProcess as cr, type SandboxRetainedProcessState as cs, SandboxRigConflictError as ct, type SandboxWorkspaceMutationAdmission as cu, SandboxWorkspaceMutationFencedError as cv, type SandboxWorkspaceMutationProviderOutcome as cw, type SandboxWorkspaceReadiness as cx, SanitizedDatabasePersistenceCause as cy, type SaveWorkspaceMemoryInput as cz, type AcquireLeaseInput as d, acceptSessionHumanInputResponse as d$, SessionListCursorError as d0, SessionListCursorExpiredError as d1, SessionListSnapshotLimitError as d2, type SessionMcpServerForRun as d3, SessionPinAccessError as d4, SessionPinVersionConflictError as d5, type SessionRecordingCodec as d6, type SessionRecordingMode as d7, type SessionRecordingRow as d8, type SessionRecordingState as d9, type UpdateKnowledgeMemoryInput as dA, type UpdateScheduledTaskInput as dB, type UpdateSessionMcpApprovalPolicyResult as dC, type UpdateSessionMcpServerCredentialsInput as dD, type UpdateSessionMcpServerCredentialsResult as dE, type UpsertCodexSubscriptionCredentialResult as dF, type UserLookup as dG, type VariableSetForRun as dH, WORKSPACE_MEMORY_BLOCK_EMPTY as dI, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as dJ, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as dK, type WorkspaceCaptureCommitResult as dL, type WorkspaceCaptureGcPlan as dM, type WorkspaceCaptureGcRow as dN, type WorkspaceCaptureRow as dO, type WorkspaceControlLockMode as dP, type WorkspaceControlMutationResult as dQ, type WorkspaceControlRow as dR, type WorkspaceEnvironmentForRun as dS, type WorkspaceMemoryOrigin as dT, type WorkspaceMemorySearchInput as dU, type WorkspaceMemorySearchMode as dV, type WorkspaceMemorySearchResult as dW, type WorkspaceModelPolicy as dX, abandonCodexResetRedemptionBeforeProvider as dY, abandonRecordingForTurnAttempt as dZ, acceptSessionApprovalDecision as d_, type SessionSpawnDenial as da, type SessionSpawnDenialCode as db, SessionSpawnDeniedDbError as dc, type SessionSystemUpdateOutboxDelivery as dd, type SessionTurnAttemptOutcome as de, type SessionTurnForExecution as df, type SessionTurnRecordingSettlement as dg, type SessionWorkPeek as dh, type SessionWorkTrigger as di, type SessionWorkflowWake as dj, type SessionWorkflowWakeDeliveryResult as dk, type SetSessionCodexPinOptions as dl, type SetSessionGoalStatusEvent as dm, type SettleCodexCredentialFailoverResult as dn, type SettleCodexCredentialLeaseLossResult as dp, type SteerQueueCommandResult as dq, type StoreIntegrationOAuthClientInput as dr, type StoredIntegrationOAuthClient as ds, type StreamAcknowledgment as dt, type SubmitHumanPromptResult as du, type ToolspaceCallReservation as dv, type ToolspaceTurnAttemptClaims as dw, type TurnAttemptFenceRejectReason as dx, type UpdateConnectionInput as dy, type UpdateImportBatchCountsInput as dz, type AcquireLeaseResult as e, consumeNewSessionDraftInTransaction as e$, accrueWarmSeconds as e0, acknowledgeHostExportBatch as e1, acquireCodexCredentialLease as e2, acquireLease as e3, activateRigVersion as e4, addSessionSystemUpdate as e5, addSessionSystemUpdateWithSourceMutation as e6, admitToolspaceTurnAttempt as e7, adoptCodexResetRedemptionAttempt as e8, advanceWorkspaceGeneration as e9, buildHostConnectionTokenResolver as eA, canonicalSessionCommandHash as eB, claimCodexResetRedemption as eC, claimExpiredFileUploadCleanup as eD, claimFileUploadCleanup as eE, claimHostExportBatch as eF, claimPendingSessionSystemUpdateOutbox as eG, claimPendingSessionWorkflowWakes as eH, claimSessionWorkForAttempt as eI, clearDurablePendingSessionToolCalls as eJ, clearEnrollmentWentOffline as eK, clearPendingSessionToolspaceCall as eL, clearSessionContext as eM, clearSessionGoal as eN, clearedContextMarkerItem as eO, closePtySession as eP, closeSessionTurnAttemptInTransaction as eQ, codexCapacityRefreshBackoffMs as eR, commitWarmingToWarm as eS, completeCodexResetRedemption as eT, completeExpiredFileUploadCleanup as eU, completeFileUpload as eV, completeFileUploadCleanup as eW, computeWorkspaceCaptureGcPlan as eX, confirmDrainCold as eY, consumeDeviceEnrollmentRequest as eZ, consumeIntegrationOAuthStateNonce as e_, advanceWorkspaceGenerationForDirectRequest as ea, advanceWorkspaceGenerationForRetainedProcess as eb, allAccountPermissions as ec, allWorkspacePermissions as ed, appendSessionEventToSandboxGroup as ee, appendSessionEvents as ef, appendSessionEventsAndUpdateSession as eg, appendSessionEventsForTurnAttempt as eh, appendSessionEventsWithLockedSessionUpdate as ei, appendSessionHistoryItems as ej, applyContextCompaction as ek, applyCreditDebitUpToBalance as el, applyCreditLedgerEntry as em, applySessionTurnSettlement as en, approveDeviceEnrollmentRequest as eo, areGitHubRepositoriesAllowedForWorkspace as ep, armCodexCapacityWait as eq, assertAgentCommandAuthorityInTransaction as er, autoResumeSessionBranchInTransaction as es, beginRigChangeVerificationAttempt as et, beginSandboxRematerialization as eu, bindGitHubInstallationRepositories as ev, bootstrapWorkspace as ew, buildChildCompletionDigest as ex, buildCodexTokenResolver as ey, buildConnectionTokenResolver as ez, type ActiveSandboxPointer as f, disableHostExportConsumer as f$, correctWorkspaceMemory as f0, countActiveApiKeysForWorkspace as f1, countActiveSessionHistoryItems as f2, countActiveSessionsForWorkspace as f3, countActiveSessionsUsingEnvironment as f4, countActiveSessionsUsingVariableSet as f5, countConsecutiveReactiveRotations as f6, countQueuedTurns as f7, countRigs as f8, countSandboxLeasesByLiveness as f9, createSessionWithIdempotencyKey as fA, createSessionWithIdempotencyKeyResult as fB, createSocialConnection as fC, createSocialPost as fD, createVariableSet as fE, createWorkspace as fF, createWorkspaceEnvironment as fG, databaseFailureCode as fH, deadLetterHostExportHead as fI, decodeSessionListCursor as fJ, decryptEnvironmentValue as fK, decryptedCapabilityHeaders as fL, deleteGitHubInstallationBinding as fM, deleteRecording as fN, deleteRig as fO, deleteRigIfNoActiveSessions as fP, deleteScheduledTask as fQ, deleteSessionQueueItemInTransaction as fR, deleteVariableSet as fS, deleteVariableSetVariable as fT, deleteWorkspace as fU, deleteWorkspaceCaptureRows as fV, deleteWorkspaceEnvironment as fW, deleteWorkspaceEnvironmentVariable as fX, deleteWorkspacePack as fY, denyDeviceEnrollmentRequest as fZ, disableCapabilityInstallation as f_, countScheduledTasksForWorkspace as fa, countScheduledTasksUsingEnvironment as fb, countScheduledTasksUsingVariableSet as fc, countSessionHistoryItems as fd, countSessionsUsingRig as fe, countVariableSets as ff, countWorkspaceEnvironments as fg, countWorkspacesForAccount as fh, createApiKey as fi, createConnection as fj, createDb as fk, createDeviceEnrollmentRequest as fl, createEnrollment as fm, createFileUpload as fn, createImportBatch as fo, createKnowledgeMemory as fp, createRig as fq, createRigChange as fr, createRigVersion as fs, createRigVersionForChangePromotion as ft, createSandbox as fu, createScheduledTask as fv, createScheduledTaskRun as fw, createSession as fx, createSessionGoal as fy, createSessionMcpServers as fz, type AddSessionSystemUpdateInput as g, getRetainedProcess as g$, disconnectAllCodexAccounts as g0, disconnectCodexAccount as g1, editQueuedTurnInTransaction as g2, enableCapabilityInstallation as g3, enablePackInstallation as g4, encodeSessionListCursor as g5, encryptEnvironmentValue as g6, enqueueSessionTurn as g7, enqueueSessionWorkflowWake as g8, enqueueSessionWorkflowWakeIfRunnable as g9, getCodexCapacityWaitForSession as gA, getCodexCredentialStatus as gB, getCodexResetRedemptionAttempt as gC, getCodexRotationSettings as gD, getComposerDraftInTransaction as gE, getConnectionMetadata as gF, getDeviceEnrollmentRequestByDeviceCode as gG, getEnrollment as gH, getFile as gI, getFileUpload as gJ, getHostExportConsumerStatus as gK, getHumanInputResumeForEvent as gL, getKnowledgeMemory as gM, getLatestRunState as gN, getLatestStartedSessionTurn as gO, getManagedAccount as gP, getManagedUserByEmail as gQ, getMaterializedSandboxFileResources as gR, getNestedAgentDepthDeploymentPolicy as gS, getNewSessionDraftInTransaction as gT, getOpenPtySession as gU, getOrCreateSessionSystemUpdateOutbox as gV, getPackInstallation as gW, getPendingDeviceEnrollmentRequestByUserCode as gX, getPendingDeviceEnrollmentRequestByUserCodeGlobal as gY, getRecording as gZ, getRetainedFileArtifact as g_, enqueueSessionWorkflowWakeInTransaction as ga, ensureCodexRotationSettings as gb, ensureManagedAccessForUser as gc, estimateMemoryTokens as gd, evaluateGoalContinuation as ge, evaluateSessionControl as gf, evaluateSessionControls as gg, evaluateSessionDiscoveryControls as gh, expireSessionHumanInputRequest as gi, failHostExportBatch as gj, failSandboxRematerialization as gk, failWarmingToCold as gl, fenceCodexResetRedemptionSend as gm, fetchCodexRateLimitResetCreditsForAccount as gn, fetchCodexUsageForAccount as go, finalizeEnrollmentByToken as gp, findActiveApiKeyByHash as gq, forceDrainOverLimitViewerOnlyBoxes as gr, frozenInitiatorForCommandActor as gs, getActiveSessionHistoryItems as gt, getActiveSessionTurnForExecution as gu, getAnySessionInGroup as gv, getBillingBalance as gw, getBillingCustomer as gx, getCapabilityCatalogItem as gy, getCapabilityInstallation as gz, type AddSessionSystemUpdateResult as h, isStripeWebhookProcessed as h$, getRig as h0, getRigByName as h1, getRigChange as h2, getRigName as h3, getRigVersion as h4, getRigVersionById as h5, getSandbox as h6, getSandboxSessionEnvelope as h7, getScheduledTask as h8, getSession as h9, getWorkspaceEnvironment as hA, getWorkspaceEnvironmentByName as hB, getWorkspaceEnvironmentValuesForRun as hC, getWorkspaceGrant as hD, getWorkspaceModelPolicy as hE, getWorkspacePack as hF, grantWorkspaceAccess as hG, hasCreditLedgerEntry as hH, hashMemoryText as hI, heartbeatCodexCredentialLease as hJ, heartbeatCodexCredentialLeaseUntil as hK, heartbeatLeaseHolder as hL, ingestMachineMetricsSample as hM, initializeSessionStartAtomically as hN, insertFailedWorkspaceCapture as hO, insertMachineMetricsSeries as hP, insertPtySession as hQ, insertRecording as hR, insertWorkspaceCapture as hS, installOrReadTurnExecutionPolicyForAttempt as hT, interruptedToolCallResult as hU, isCodexBilledTurn as hV, isDatabasePersistenceFailure as hW, isMemoryTextTooLong as hX, isRetryablePersistenceSqlState as hY, isSessionCompactionRequested as hZ, isSessionEventPersistenceError as h_, getSessionByCreateIdempotencyKey as ha, getSessionCodexState as hb, getSessionEvent as hc, getSessionEventByClientEventId as hd, getSessionForSubject as he, getSessionGoal as hf, getSessionGoalWithContinuation as hg, getSessionHistoryItems as hh, getSessionHumanInputRequest as hi, getSessionLineage as hj, getSessionQueueSnapshot as hk, getSessionRootId as hl, getSessionSpawnDenial as hm, getSessionSpawnDenialByIdempotencyKey as hn, getSessionSystemUpdateOutboxByDedupeKey as ho, getSessionTurn as hp, getSessionTurnForAttempt as hq, getSocialConnection as hr, getStoredCapabilityHeaderCiphertext as hs, getStreamAcknowledgment as ht, getVariableSet as hu, getVariableSetByName as hv, getVariableSetValuesForRun as hw, getWorkspace as hx, getWorkspaceControlEvent as hy, getWorkspaceDefaultRigId as hz, type AdoptCodexResetRedemptionResult as i, lockWorkspaceInferenceControl as i$, latestWorkspaceCapture as i0, listApiKeys as i1, listCapabilityCatalogItems as i2, listCapabilityInstallations as i3, listCodexAccountStatuses as i4, listCodexResetRedemptionRecoveries as i5, listConnectionsMetadata as i6, listCreditBalancesByAccount as i7, listDistinctRigVersionIdsInGroup as i8, listDistinctVariableSetIdsInGroup as i9, listSessionEventPage as iA, listSessionEvents as iB, listSessionHumanInputRequests as iC, listSessionIdsInGroup as iD, listSessionMcpServerMetadata as iE, listSessionMcpServersForChildInheritance as iF, listSessionMcpServersForRun as iG, listSessionSpawnDenials as iH, listSessionSystemUpdatesForTurn as iI, listSessionTurns as iJ, listSessions as iK, listSessionsForSubject as iL, listSocialConnections as iM, listSocialPosts as iN, listUsageEvents as iO, listVariableSets as iP, listWorkspaceControlEvents as iQ, listWorkspaceEnvironments as iR, listWorkspaceMembers as iS, listWorkspacePacks as iT, listWorkspacesForSubject as iU, loadCodexCredentialForRun as iV, loadConnectionCredentialForBroker as iW, loadIntegrationOAuthClient as iX, loadVariableSetForRun as iY, loadWorkspaceEnvironmentForRun as iZ, lockSessionEventWriteRows as i_, listEnabledMcpCapabilityServers as ia, listEnrollments as ib, listGitHubInstallationAccessForWorkspace as ic, listGitHubInstallationIdsForWorkspace as id, listGitHubInstallationsForWorkspace as ie, listKnowledgeMemories as ig, listLiveModalSandboxLeaseAttributions as ih, listMeterableWarmLeases as ii, listOpenPtySessions as ij, listOutstandingSessionSystemUpdates as ik, listPackInstallations as il, listPendingCodexCapacityWakeTargets as im, listPendingSessionTurns as io, listRecordings as ip, listRegistryCatalogSurfaceKeys as iq, listRigChangeMonitoringSummaries as ir, listRigChanges as is, listRigVersionMonitoringSummaries as it, listRigVersions as iu, listRigs as iv, listSandboxes as iw, listScheduledTaskRuns as ix, listScheduledTasks as iy, listSessionDiscoverySummaries as iz, AgentCommandAuthorityError as j, registerPendingSessionToolCall as j$, markFileUploadFailed as j0, markSandboxFileResourcesMaterialized as j1, markSandboxProviderReady as j2, markSandboxRestoreVerifying as j3, markScheduledTaskRunFailedIfQueued as j4, markSessionAttemptQuiesced as j5, markSessionSystemUpdateOutboxDeliveredInTransaction as j6, markSessionSystemUpdateOutboxFailed as j7, markSessionWorkflowWakeDelivered as j8, markSessionWorkflowWakeFailed as j9, readMachineMetricsSeries as jA, readWorkspaceArchiveCapturePreflight as jB, reapExpiredSessionListSnapshots as jC, reapStaleLeaseHolders as jD, reapStaleLeaseHoldersGlobal as jE, reconcileCodexCapacityWait as jF, recordAuditEvent as jG, recordCodexAccountConnectors as jH, recordCodexAccountUsage as jI, recordCodexAccountUsageWithWakeTargets as jJ, recordCodexTokenRefresh as jK, recordConnectionTokenRefresh as jL, recordConnectionUsed as jM, recordLeaseDataPlaneUrl as jN, recordLeaseTerminalDataPlaneUrl as jO, recordPendingSessionToolCallResult as jP, recordSessionActiveCodexCredential as jQ, recordSkippedContextCompaction as jR, recordStreamAcknowledgment as jS, recordStripeWebhookEvent as jT, recordUsageEvent as jU, recordWarmingSandboxCreated as jV, recoverSessionDispatch as jW, refreshOAuthConnectionCredential as jX, registerDbBinding as jY, registerHostExportConsumer as jZ, registerInternalUpdateWakeInTransaction as j_, markStaleRegistryCatalogItems as ja, markStripeWebhookProcessed as jb, markWarmLeaseInstanceLost as jc, materializeGoalContinuation as jd, mcpServerIdForCapability as je, moveQueuedTurnInTransaction as jf, mutateSessionControlInTransaction as jg, mutateWorkspaceControlInTransaction as jh, nestedPostgresSqlState as ji, nextSessionHistoryPosition as jj, normalizeBearerScheme as jk, normalizeMemoryText as jl, orphanedResultRowIndicesForRepair as jm, peekSessionWork as jn, persistDrainSnapshot as jo, persistWarmSnapshot as jp, planWorkspaceCaptureGc as jq, projectEffectiveControlForRelatedAccess as jr, projectSessionForRelatedAccess as js, pruneHostExportOutbox as jt, quarantineCodexCredentialForLease as ju, reArmDrainingLease as jv, readActiveSandbox as jw, readLease as jx, readMachineMetricsLatest as jy, readMachineMetricsLatestForWorkspace as jz, type AgentInternalUpdateCommandResult as k, setSessionGoalStatusWithEvent as k$, registerSessionTurnAttemptClaim as k0, registerSessionWorkflowWakeInTransaction as k1, registerWorkspacePack as k2, releaseCodexCredentialLease as k3, releaseCodexResetRedemptionClaim as k4, releaseLeaseHolder as k5, removeWorkspaceMember as k6, renameCodexAccount as k7, renderWorkspaceMemoryBlock as k8, replaceIntegrationOAuthClient as k9, sanitizeModelPayload as kA, saveComposerDraftInTransaction as kB, saveNewSessionDraftInTransaction as kC, saveRunState as kD, saveWorkspaceMemory as kE, searchWorkspaceMemories as kF, sendAgentMessageInTransaction as kG, serializeEffectiveSessionControl as kH, sessionAuthorizationScopeFilter as kI, sessionSubject as kJ, sessionTreeStatsForSessions as kK, sessionsWithActiveOpOnEnrollment as kL, setActiveCodexCredential as kM, setActiveSandbox as kN, setCodexCredentialExhausted as kO, setCodexCredentialExhaustedWithWakeTargets as kP, setCodexCredentialStatus as kQ, setCodexCredentialStatusById as kR, setConnectionStatus as kS, setEnrollmentDisplayState as kT, setEnrollmentOpStreamState as kU, setEnrollmentWentOffline as kV, setInitialActiveCodexCredential as kW, setRlsContext as kX, setSessionCodexPin as kY, setSessionGoalLastContinuationTurn as kZ, setSessionGoalStatus as k_, requestSessionCompaction as ka, requestSessionTurnRecovery as kb, requireFile as kc, requireScheduledTask as kd, requireSession as ke, requireSocialConnection as kf, requireWorkspace as kg, reserveSessionCommandReceipt as kh, reserveToolspaceCallForAttempt as ki, resolveWorkspaceMemoryBlock as kj, resumeHostExportConsumer as kk, retainWorkspaceMutationProcess as kl, retireHostExportConsumer as km, revokeApiKey as kn, revokeConnection as ko, revokeEnrollment as kp, revokeViewer as kq, rewindHostExportConsumer as kr, rlsContextForWorkspace as ks, rlsStrategyFor as kt, rotateWorkspaceArchives as ku, runIdempotentPersistenceTransaction as kv, safeDatabaseErrorFacts as kw, sanitizeEventPayload as kx, sanitizeEventString as ky, sanitizeMemoryText as kz, type AppendEventInput as l, withWorkspaceRls as l$, setSessionLastInputTokensForTurnAttempt as l0, setSessionPin as l1, setSubjectRlsContext as l2, setTemporalWorkflowId as l3, setVariableSetVariable as l4, setWorkspaceDefaultRig as l5, setWorkspaceEnvironmentVariable as l6, settleCodexCredentialFailover as l7, settleCodexCredentialLeaseLoss as l8, settleRetainedProcess as l9, updateSessionGoalWithEvent as lA, updateSessionMcpApprovalPolicy as lB, updateSessionMcpServerCredentials as lC, updateSessionTitle as lD, updateVariableSet as lE, updateWorkspace as lF, updateWorkspaceEnvironment as lG, updateWorkspaceSettings as lH, upsertBillingCustomer as lI, upsertCapabilityCatalogItem as lJ, upsertCodexSubscriptionCredential as lK, upsertGitHubInstallation as lL, upsertMachineMetricsLatest as lM, upsertRegistryCapabilityCatalogItem as lN, upsertSandboxSessionEnvelope as lO, upsertSessionGoal as lP, upsertSessionGoalWithEvent as lQ, upsertWorkspaceModelPolicy as lR, validateHumanInputResponse as lS, verifyDirectWorkspaceMutationSettlement as lT, verifyRetainedProcessMutationSettlement as lU, verifyWorkspaceMutationSettlement as lV, withAccountRls as lW, withCodexCapacityMutation as lX, withCodexCredentialRefreshLock as lY, withCodexTokenDeadline as lZ, withRlsContext as l_, settleScheduledTaskRunInTransaction as la, settleSessionAttemptInterruptions as lb, settleSessionIdleWithParentOutbox as lc, shortMemoryId as ld, steerAgentSessionInTransaction as le, steerQueuedTurnInTransaction as lf, storeIntegrationOAuthClient as lg, submitHumanPromptInTransaction as lh, sumUsageQuantity as li, supersedeSessionCurrentDirectionInTransaction as lj, touchEnrollmentLastSeen as lk, touchLeaseHolder as ll, updateCodexAllocatorEligibility as lm, updateCodexRotationSettings as ln, updateConnection as lo, updateImportBatchCounts as lp, updateKnowledgeMemory as lq, updatePackInstallationStatus as lr, updatePtySessionActivity as ls, updateRecording as lt, updateRig as lu, updateRigChangeStatus as lv, updateScheduledTask as lw, updateScheduledTaskRun as lx, updateSessionCommandReceiptResult as ly, updateSessionGoal as lz, type ApplyContextCompactionResult as m, withWorkspaceSubjectRls as m0, withWorkspaceUsageLock as m1, workspaceCaptureAtRevision as m2, workspaceCodexSubscriptionActive as m3, type ApplySessionTurnSettlementInput as n, type ApplySessionTurnSettlementResult as o, type ArmCodexCapacityWaitResult as p, provisionRoles, type BootstrapWorkspaceInput as q, CODEX_CAPACITY_REFRESH_MIN_MS as r, CODEX_CREDENTIAL_LEASE_TTL_MS as s, CODEX_RESET_REDEMPTION_OUTCOMES as t, CODEX_ROTATION_STRATEGIES as u, type ClaimCodexResetRedemptionResult as v, type ClaimSessionWorkForAttemptInput as w, type ClaimSessionWorkForAttemptResult as x, type ClearSessionContextResult as y, type CodexAccountStatus as z };