@opengeni/db 0.7.3 → 0.9.3

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 (59) hide show
  1. package/dist/{chunk-B22X3IEZ.js → chunk-4LG5NBTC.js} +512 -32
  2. package/dist/chunk-4LG5NBTC.js.map +1 -0
  3. package/dist/{chunk-YFQ7SGE4.js → chunk-BMFDXFPA.js} +23 -1
  4. package/dist/chunk-BMFDXFPA.js.map +1 -0
  5. package/dist/chunk-KW526IJA.js +127 -0
  6. package/dist/chunk-KW526IJA.js.map +1 -0
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +6068 -2090
  9. package/dist/index.js.map +1 -1
  10. package/dist/migrate.d.ts +29 -4
  11. package/dist/migrate.js +3 -1
  12. package/dist/provision-roles.d.ts +721 -46
  13. package/dist/provision-roles.js +1 -1
  14. package/dist/{schema-BN5mB9xZ.d.ts → schema-CdPGTHlD.d.ts} +2118 -119
  15. package/dist/schema.d.ts +1 -1
  16. package/dist/schema.js +17 -1
  17. package/drizzle/0064_rotation_strategy_sharded_backfill.sql +15 -0
  18. package/drizzle/0065_session_attempt_quiescence.sql +26 -0
  19. package/drizzle/0066_session_interruption_attempt_lookup.sql +4 -0
  20. package/drizzle/0067_session_event_payload_bounds.sql +209 -0
  21. package/drizzle/0068_workspace_control_event_bounds.sql +134 -0
  22. package/drizzle/0069_session_event_history_backfill.sql +32 -0
  23. package/drizzle/0070_session_event_type_sequence_lookup.sql +4 -0
  24. package/drizzle/0071_session_event_monitoring_tail.sql +10 -0
  25. package/drizzle/0072_sessions_workspace_created_id_idx.sql +4 -0
  26. package/drizzle/0073_sessions_workspace_updated_id_idx.sql +4 -0
  27. package/drizzle/0074_session_activity_revisions.sql +72 -0
  28. package/drizzle/0075_sessions_workspace_activity_revision_idx.sql +4 -0
  29. package/drizzle/0076_session_workflow_wake_acl.sql +13 -0
  30. package/drizzle/0077_session_attempt_latest_lookup.sql +4 -0
  31. package/drizzle/0094_quarantine_credential_bearing_catalog_urls.sql +51 -0
  32. package/drizzle/0095_github_existing_installations.sql +84 -0
  33. package/drizzle/0096_session_turn_initiators.sql +97 -0
  34. package/drizzle/0097_host_export_outbox.sql +1220 -0
  35. package/drizzle/0098_usage_events_workspace_session_idx.sql +4 -0
  36. package/drizzle/0099_session_human_input_attempt_owner_index.sql +6 -0
  37. package/drizzle/0100_session_human_input_requests.sql +89 -0
  38. package/drizzle/0101_session_mcp_connection_refs.sql +30 -0
  39. package/drizzle/0102_session_command_receipt_service_actor.sql +16 -0
  40. package/drizzle/0103_host_export_root_session.sql +166 -0
  41. package/drizzle/0104_host_export_root_session_backfill.sql +27 -0
  42. package/drizzle/0105_session_turn_instructions.sql +9 -0
  43. package/package.json +4 -4
  44. package/src/connection-token-resolver.ts +287 -1
  45. package/src/event-payload-sanitizer.ts +57 -19
  46. package/src/index.ts +5377 -1125
  47. package/src/memory-domain.ts +1 -1
  48. package/src/migrate.ts +86 -23
  49. package/src/persistence-errors.ts +252 -0
  50. package/src/provision-roles.ts +42 -0
  51. package/src/schema.ts +552 -34
  52. package/src/session-control.ts +518 -38
  53. package/src/session-queue-commands.ts +308 -57
  54. package/src/session-tool-call-settlement.ts +58 -7
  55. package/src/turn-initiator.ts +155 -0
  56. package/dist/chunk-7LDU7F5P.js +0 -80
  57. package/dist/chunk-7LDU7F5P.js.map +0 -1
  58. package/dist/chunk-B22X3IEZ.js.map +0 -1
  59. package/dist/chunk-YFQ7SGE4.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { ResourceRef, ToolRef, ReasoningEffort, KnowledgeMemoryKind, SessionEvent, SessionStatus, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, SocialProvider, SocialConnectionStatus, McpServerConnectionRef as McpServerConnectionRef$1, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, SessionGoal, CapabilityPack, RigCheck, Session, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, ApiKey, ConnectionMetadata, Rig, RigChangeKind, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, SessionGoalStatus, VariableSetVariableMetadata, PackInstallationStatus, RigChangeStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
1
+ import { TurnInitiatorContext, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionGoalStatus, Session, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, ConnectionMetadata, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
2
2
  import { environmentsEncryptionKeyBytes, Settings, McpServerConnectionRef } from '@opengeni/config';
3
3
  import { refreshCodexToken, CodexTokenSnapshot, CodexUsagePayload } from '@opengeni/codex';
4
+ import { SQL } from 'drizzle-orm';
4
5
  import { PgDatabase, PgTransactionConfig } from 'drizzle-orm/pg-core';
5
- import { s as sessionCommandReceipts, a as sessionTurnAttempts, c as composerDrafts, b as sessionTurns, d as schema, e as enrollmentOsValues, f as enrollmentExposureValues, g as deviceEnrollmentStatusValues, h as enrollmentStatusValues, i as sandboxKindValues, j as sessionRecordingCodecValues, k as sessionRecordingModeValues, l as sessionRecordingStateValues } from './schema-BN5mB9xZ.js';
6
- import 'drizzle-orm';
6
+ import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-CdPGTHlD.js';
7
7
  import './migrate.js';
8
8
 
9
9
  declare const SESSION_ANCESTRY_LIMIT = 10000;
@@ -12,6 +12,11 @@ type EffectiveControlState = "active" | "paused";
12
12
  type SessionCommandActor = {
13
13
  type: "human" | "operator";
14
14
  subjectId: string;
15
+ } | {
16
+ type: "service";
17
+ subjectId: string;
18
+ subjectLabel?: string;
19
+ context?: TurnInitiatorContext;
15
20
  } | {
16
21
  type: "agent_attempt";
17
22
  attemptId: string;
@@ -52,7 +57,27 @@ type EffectiveSessionControl = {
52
57
  settlement: {
53
58
  state: "stopping";
54
59
  attemptCount: number;
60
+ interruptionPendingCount: number;
61
+ quiescencePendingCount: number;
62
+ } | null;
63
+ };
64
+ declare const SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS = 200;
65
+ declare const SESSION_DISCOVERY_CONTROL_TARGET_LIMIT = 100;
66
+ /**
67
+ * Purpose-built control projection for session discovery. Full blocker evidence,
68
+ * actors/reasons, resume options, etags, and settlement state remain available
69
+ * from the ordinary session detail APIs; this shape is intentionally only what
70
+ * `sessions_list` renders.
71
+ */
72
+ type SessionDiscoveryControl = {
73
+ state: EffectiveControlState;
74
+ primaryBlocker: {
75
+ kind: "session" | "workspace";
76
+ sessionId?: string;
77
+ displayName: string;
78
+ displayNameOriginalChars: number;
55
79
  } | null;
80
+ additionalBlockerCount: number;
56
81
  };
57
82
  declare function serializeEffectiveSessionControl(control: EffectiveSessionControl): {
58
83
  primaryBlocker: (Omit<EffectiveControlBlocker, "changedAt"> & {
@@ -82,6 +107,8 @@ declare function serializeEffectiveSessionControl(control: EffectiveSessionContr
82
107
  settlement: {
83
108
  state: "stopping";
84
109
  attemptCount: number;
110
+ interruptionPendingCount: number;
111
+ quiescencePendingCount: number;
85
112
  } | null;
86
113
  };
87
114
  type WorkspaceControlRow = {
@@ -121,6 +148,47 @@ declare function assertAgentCommandAuthorityInTransaction(db: Database, input: {
121
148
  }): Promise<void>;
122
149
  declare function canonicalSessionCommandHash(value: unknown): string;
123
150
  declare function lockWorkspaceInferenceControl(db: Database, workspaceId: string, mode: WorkspaceControlLockMode): Promise<WorkspaceControlRow>;
151
+ type SessionEventWriteLockInput = {
152
+ workspaceId: string;
153
+ /**
154
+ * Control-aware writes take this lock first. Callers that already hold the
155
+ * workspace control row (for example a Pause mutation under FOR UPDATE) say
156
+ * `already_locked`; ordinary audit/title appends explicitly use `none`.
157
+ */
158
+ controlLock: WorkspaceControlLockMode | "already_locked" | "none";
159
+ /** Used only when a staged caller already established the workspace prefix. */
160
+ workspaceLock?: "key_share" | "already_locked";
161
+ sessionIds?: string[];
162
+ turnIds?: string[];
163
+ attemptIds?: string[];
164
+ };
165
+ type SessionEventWriteLocks = {
166
+ control: WorkspaceControlRow | null;
167
+ workspace: typeof workspaces.$inferSelect | null;
168
+ sessions: Array<typeof sessions.$inferSelect>;
169
+ turns: Array<typeof sessionTurns.$inferSelect>;
170
+ attempts: Array<typeof sessionTurnAttempts.$inferSelect>;
171
+ };
172
+ /**
173
+ * Establish the one canonical lock prefix for every `session_events` writer:
174
+ *
175
+ * workspace_inference_controls (when control-aware)
176
+ * -> actual workspaces row FOR KEY SHARE
177
+ * -> session rows FOR UPDATE, UUID ordered
178
+ * -> exact turn rows FOR UPDATE, UUID ordered
179
+ * -> exact attempt rows FOR UPDATE, UUID ordered
180
+ *
181
+ * `FOR KEY SHARE` is deliberate. Event inserts need the workspace key to remain
182
+ * stable for their FK, but they do not mutate the workspace. The old generic
183
+ * `FOR UPDATE` lock serialized unrelated sessions and inverted the activity
184
+ * path's session -> implicit workspace-FK edge.
185
+ *
186
+ * Complex lifecycle transactions may acquire allocator/control locks before
187
+ * this helper and may discover exact turn IDs only after locking the session.
188
+ * They use the explicit `already_locked` stages, while retaining the same
189
+ * monotonic table order. New event writers should prefer one complete call.
190
+ */
191
+ declare function lockSessionEventWriteRows(db: Database, input: SessionEventWriteLockInput): Promise<SessionEventWriteLocks>;
124
192
  declare function registerSessionTurnAttemptClaim(db: Database, input: {
125
193
  id: string;
126
194
  accountId: string;
@@ -153,9 +221,23 @@ declare function closeSessionTurnAttemptInTransaction(db: Database, input: {
153
221
  }>;
154
222
  declare function evaluateSessionControls(db: Database, workspaceId: string, sessionIds: string[], options?: {
155
223
  lock?: WorkspaceControlLockMode;
224
+ /** Reuse a control row already locked before workspace/session/turn rows. */
225
+ workspaceControl?: WorkspaceControlRow | undefined;
156
226
  }): Promise<Map<string, EffectiveSessionControl>>;
227
+ /**
228
+ * Return one compact aggregate row per target for `sessions_list`.
229
+ *
230
+ * Unlike `evaluateSessionControls`, the database boundary never returns a row
231
+ * per blocker/ancestor, nor does application code construct blocker or resume
232
+ * option arrays. The recursive walk carries no growing visited-path array: a
233
+ * missing ancestor stops below the limit, while a cycle cannot reach a root and
234
+ * therefore runs into the hard `SESSION_ANCESTRY_LIMIT`. The externally
235
+ * supplied target set is capped by `SESSION_DISCOVERY_CONTROL_TARGET_LIMIT`.
236
+ */
237
+ declare function evaluateSessionDiscoveryControls(db: Database, workspaceId: string, sessionIds: string[]): Promise<Map<string, SessionDiscoveryControl>>;
157
238
  declare function evaluateSessionControl(db: Database, workspaceId: string, sessionId: string, options?: {
158
239
  lock?: WorkspaceControlLockMode;
240
+ workspaceControl?: WorkspaceControlRow | undefined;
159
241
  }): Promise<EffectiveSessionControl>;
160
242
  declare function reserveSessionCommandReceipt(db: Database, input: {
161
243
  accountId: string;
@@ -224,7 +306,7 @@ declare function autoResumeSessionBranchInTransaction(db: Database, input: {
224
306
  workspaceId: string;
225
307
  sessionId: string;
226
308
  actor: string;
227
- reason: "human_send" | "human_steer" | "agent_steer";
309
+ reason: "human_send" | "human_steer" | "service_send" | "service_steer" | "agent_steer";
228
310
  observedControlEtag?: string | null;
229
311
  }): Promise<{
230
312
  revision: number;
@@ -251,6 +333,12 @@ declare function mutateWorkspaceControlInTransaction(db: Database, input: {
251
333
  expectedRevision?: number | null;
252
334
  }): Promise<WorkspaceControlMutationResult>;
253
335
 
336
+ type FrozenTurnInitiator = {
337
+ initiator: TurnInitiator;
338
+ context: TurnInitiatorContext;
339
+ };
340
+ declare function frozenInitiatorForCommandActor(db: Database, workspaceId: string, actor: SessionCommandActor, subjectLabel?: string): Promise<FrozenTurnInitiator>;
341
+
254
342
  type QueueCommandConflictCode = "QUEUE_VERSION_CHANGED" | "QUEUE_PROMPT_STARTED" | "QUEUE_ANCHOR_CHANGED" | "PROMPT_CHANGED" | "DRAFT_CHANGED" | "DRAFT_NOT_EMPTY";
255
343
  declare class QueueCommandConflictError extends Error {
256
344
  readonly code: QueueCommandConflictCode;
@@ -391,12 +479,14 @@ declare function submitHumanPromptInTransaction(db: Database, input: {
391
479
  workspaceId: string;
392
480
  sessionId: string;
393
481
  subjectId: string;
482
+ subjectLabel?: string;
394
483
  actor: SessionCommandActor;
395
484
  operationKey: string;
396
485
  delivery: "send" | "steer";
397
486
  controlEtag?: string | null;
398
487
  expectedDraftRevision?: number | null;
399
488
  text: string;
489
+ turnInstructions?: string | null;
400
490
  resources: ResourceRef[];
401
491
  tools: ToolRef[];
402
492
  model?: string | null;
@@ -449,23 +539,6 @@ declare function encryptEnvironmentValue(key: Uint8Array, plaintext: string): st
449
539
  */
450
540
  declare function decryptEnvironmentValue(key: Uint8Array, stored: string): string;
451
541
 
452
- /**
453
- * Last line of defense against a session event crashing a whole turn.
454
- *
455
- * Postgres `text`/`jsonb` cannot store a NUL byte (U+0000) nor lone UTF-16
456
- * surrogates. Raw exec output routinely carries both -- chrome/crashpad logs,
457
- * `cat` of a binary, random bytes -- and the worker persists that output verbatim
458
- * inside `agent.toolCall.output` / `sandbox.command.output` event payloads. When
459
- * such a payload reaches `INSERT INTO session_events`, the driver rejects it
460
- * ("Failed query: insert into session_events") and the turn dies.
461
- *
462
- * `sanitizeEventPayload` deep-walks any payload value (objects, arrays, nested)
463
- * and, for every string, strips NUL and rewrites invalid/lone UTF-16 surrogates
464
- * to the Unicode replacement char (U+FFFD), so the result is always valid UTF-8
465
- * that jsonb can store. It is cheap and total: only strings are touched, and only
466
- * the two disallowed classes of code unit -- no meaningful text is lost, no
467
- * truncation (truncation is handled elsewhere).
468
- */
469
542
  /**
470
543
  * Strip NUL and repair invalid/lone UTF-16 surrogates in a single string.
471
544
  * Returns the input unchanged (same reference) when it is already clean, so the
@@ -490,6 +563,76 @@ declare function sanitizeEventPayload<T>(payload: T): T;
490
563
  */
491
564
  declare function sanitizeModelPayload<T>(payload: T): T;
492
565
 
566
+ type DatabaseFailureCode = "db_deadlock" | "db_serialization_failure" | "db_failure";
567
+ type PersistenceRetryOutcome = "not_retryable" | "exhausted";
568
+ type SafeDatabaseErrorFacts = {
569
+ severity?: string;
570
+ schema?: string;
571
+ table?: string;
572
+ column?: string;
573
+ dataType?: string;
574
+ constraint?: string;
575
+ routine?: string;
576
+ };
577
+ type PersistenceFailureDetails = {
578
+ code: DatabaseFailureCode;
579
+ sqlState: string | null;
580
+ stage: string;
581
+ eventTypes: string[];
582
+ correlationId: string;
583
+ attempts: number;
584
+ retryOutcome: PersistenceRetryOutcome;
585
+ database: SafeDatabaseErrorFacts;
586
+ };
587
+ /** Find the driver SQLSTATE even when Drizzle wrapped it under nested causes. */
588
+ declare function nestedPostgresSqlState(error: unknown): string | null;
589
+ declare function databaseFailureCode(sqlState: string | null): DatabaseFailureCode;
590
+ declare function isRetryablePersistenceSqlState(sqlState: string | null): boolean;
591
+ /**
592
+ * Distinguish database/ORM failures from expected domain exceptions when a
593
+ * driver omitted SQLSTATE. This checks shape only and never retains query text,
594
+ * bound parameters, or a raw driver cause.
595
+ */
596
+ declare function isDatabasePersistenceFailure(error: unknown): boolean;
597
+ /** Extract only PostgreSQL diagnostic identifiers; never query text/parameters. */
598
+ declare function safeDatabaseErrorFacts(error: unknown): SafeDatabaseErrorFacts;
599
+ /** Public-safe cause that preserves database classification without driver data. */
600
+ declare class SanitizedDatabasePersistenceCause extends Error {
601
+ readonly sqlState: string | null;
602
+ readonly database: SafeDatabaseErrorFacts;
603
+ readonly name = "SanitizedDatabasePersistenceCause";
604
+ constructor(sqlState: string | null, database: SafeDatabaseErrorFacts);
605
+ }
606
+ /**
607
+ * Public-safe replacement for a raw Drizzle/postgres-js failure. Its `cause`
608
+ * is a newly constructed sanitized projection; the original driver cause can
609
+ * contain full SQL and bound parameters and is never retained.
610
+ */
611
+ declare class SessionEventPersistenceError extends Error {
612
+ readonly details: PersistenceFailureDetails;
613
+ readonly name = "SessionEventPersistenceError";
614
+ readonly cause: SanitizedDatabasePersistenceCause;
615
+ constructor(details: PersistenceFailureDetails);
616
+ get code(): DatabaseFailureCode;
617
+ }
618
+ declare function isSessionEventPersistenceError(error: unknown): error is SessionEventPersistenceError;
619
+ type IdempotentPersistenceTransactionOptions = {
620
+ stage: string;
621
+ eventTypes?: string[];
622
+ maxAttempts?: number;
623
+ correlationId?: string;
624
+ onRetry?: (input: {
625
+ attempt: number;
626
+ sqlState: "40P01" | "40001";
627
+ }) => void | Promise<void>;
628
+ };
629
+ /**
630
+ * Retry only the supplied idempotent database transaction/savepoint. Provider
631
+ * inference, tools, NATS, and all other external effects must remain outside
632
+ * this function. A single correlation ID follows every persistence attempt.
633
+ */
634
+ declare function runIdempotentPersistenceTransaction<T>(options: IdempotentPersistenceTransactionOptions, transaction: (attempt: number) => Promise<T>): Promise<T>;
635
+
493
636
  /** Reject writes whose sanitized text exceeds this many characters. */
494
637
  declare const MEMORY_TEXT_MAX_CHARS = 4000;
495
638
  /** Per-workspace cap on agent-visible memory records (active ∪ approved). */
@@ -536,6 +679,7 @@ declare function renderWorkspaceMemoryBlock(records: readonly MemoryBlockRecord[
536
679
 
537
680
  type ProvisionResult = {
538
681
  appRole: string | null;
682
+ hostExportRole: string | null;
539
683
  temporalRole: string | null;
540
684
  temporalDatabases: string[];
541
685
  schema: string;
@@ -559,6 +703,16 @@ type ProvisionRolesOptions = {
559
703
  rlsStrategy?: RlsStrategy;
560
704
  appRole?: string;
561
705
  appPassword?: string;
706
+ /**
707
+ * Optional cross-workspace projection role. It receives schema USAGE and
708
+ * EXECUTE only on the host-export API; it receives no table privileges.
709
+ * Provision it after the first migration run so the schema exists. The
710
+ * provisioner also registers same-owner default privileges for future
711
+ * host-export functions; shipped migrations preserve existing exporter ACLs
712
+ * when a migration-only upgrade adds a function.
713
+ */
714
+ hostExportRole?: string;
715
+ hostExportPassword?: string;
562
716
  temporalRole?: string;
563
717
  temporalPassword?: string;
564
718
  temporalDatabases?: string[];
@@ -616,21 +770,50 @@ type ResolveConnectionCredentialResult = {
616
770
  expiresAt?: Date | null;
617
771
  } | {
618
772
  status: "auth_needed";
619
- reason: "missing_connection" | "expired" | "insufficient_scope" | "refresh_failed";
773
+ reason: McpCredentialAuthNeededReason;
620
774
  providerDomain: string;
775
+ provider?: string;
621
776
  connectionId?: string;
622
777
  scopes?: string[];
623
778
  resource?: string;
779
+ selectedResources?: McpConnectionResourceScope[];
624
780
  authorizationUrl?: string;
625
781
  };
626
782
  type ResolveConnectionCredentialInput = {
627
783
  workspaceId: string;
628
784
  subjectId?: string;
629
785
  serverId: string;
786
+ toolName?: string;
787
+ /** @deprecated Use toolName. Retained for the API's pre-existing broker call shape. */
630
788
  toolId?: string;
631
789
  connectionRef: McpServerConnectionRef;
632
790
  forceRefresh?: boolean;
633
791
  };
792
+ type HostMcpCredentialResolverContext = {
793
+ accountId: string;
794
+ workspaceId: string;
795
+ sessionId: string;
796
+ rootSessionId: string;
797
+ turnId: string;
798
+ attemptId: string | null;
799
+ executionGeneration: number;
800
+ initiator: TurnInitiator;
801
+ initiatorContext: TurnInitiatorContext;
802
+ surface: McpCredentialsRequest["surface"];
803
+ };
804
+ declare class HostMcpCredentialScopeError extends Error {
805
+ constructor(field: "accountId" | "workspaceId" | "sessionId");
806
+ }
807
+ declare class HostMcpCredentialBindingError extends Error {
808
+ constructor(field: "provider" | "providerDomain" | "connectionId" | "scopes" | "resource" | "selectedResources");
809
+ }
810
+ /**
811
+ * Adapts the public embedding credential port to the runtime's connection
812
+ * resolver contract. Scope echoes are checked before credential headers can
813
+ * reach a request; the returned object is a fresh copy so a host cannot mutate
814
+ * headers after resolution.
815
+ */
816
+ declare function buildHostConnectionTokenResolver(resolve: NonNullable<ConnectionCredentialsPort["mcpCredentials"]>, context: HostMcpCredentialResolverContext): (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
634
817
  type ConnectionBrokerDeps = {
635
818
  loadCredential: typeof loadConnectionCredentialForBroker;
636
819
  recordRefresh: typeof recordConnectionTokenRefresh;
@@ -710,7 +893,7 @@ type CreateDbOptions = {
710
893
  * it as a per-session startup parameter (the supported, query-param-free way;
711
894
  * URL `?search_path=` is IGNORED by postgres-js). Keep `public` LAST so the
712
895
  * `vector` type and `gen_random_uuid()` (which live in `public` on the
713
- * pgvector image) still resolve — the SPIKE-1 live footgun.
896
+ * pgvector image) still resolve — the schema-isolation contract live footgun.
714
897
  */
715
898
  searchPath?: string;
716
899
  /** RLS posture; defaults to `"force"` (today's standalone). */
@@ -733,6 +916,115 @@ declare function registerDbBinding(db: Database, binding: {
733
916
  rlsStrategy?: RlsStrategy;
734
917
  userLookup?: UserLookup;
735
918
  }): void;
919
+ type HostExportKind = "session_event" | "usage_event";
920
+ /**
921
+ * A leased row did not satisfy this consumer build's export contract. Only
922
+ * bounded schema diagnostics are retained here; the source payload is never
923
+ * copied into the error. The lease can therefore be failed visibly, or an
924
+ * operator can re-claim it with a known token and explicitly dead-letter the
925
+ * reported head cursor.
926
+ */
927
+ declare class HostExportPayloadError extends Error {
928
+ readonly kind: HostExportKind;
929
+ readonly consumerId: string;
930
+ readonly leaseToken: string;
931
+ readonly cursor: string;
932
+ readonly schemaIssues: string[];
933
+ readonly name = "HostExportPayloadError";
934
+ constructor(kind: HostExportKind, consumerId: string, leaseToken: string, cursor: string, schemaIssues: string[]);
935
+ }
936
+ type HostExportConsumerStatus = {
937
+ exportKind: HostExportKind;
938
+ consumerId: string;
939
+ checkpoint: string;
940
+ enabled: boolean;
941
+ consecutiveFailures: number;
942
+ nextAttemptAt: string;
943
+ lastError: string | null;
944
+ lastErrorAt: string | null;
945
+ blockedAt: string | null;
946
+ leaseExpiresAt: string | null;
947
+ maxCursor: string;
948
+ pendingCount: string;
949
+ unassignedCount: string;
950
+ prunedThrough: string;
951
+ };
952
+ /**
953
+ * Enable a named consumer. This call deliberately requires a database handle
954
+ * authenticated as the separately provisioned host-export role; the ordinary
955
+ * tenant-scoped app role cannot execute this cross-workspace API.
956
+ */
957
+ declare function registerHostExportConsumer(db: Database, input: {
958
+ kind: HostExportKind;
959
+ consumerId: string;
960
+ }): Promise<void>;
961
+ declare function disableHostExportConsumer(db: Database, input: {
962
+ kind: HostExportKind;
963
+ consumerId: string;
964
+ }): Promise<void>;
965
+ /**
966
+ * Permanently remove a quiesced consumer and release its retention floor.
967
+ * Unlike disable, re-registering this name later starts at the retained floor.
968
+ */
969
+ declare function retireHostExportConsumer(db: Database, input: {
970
+ kind: HostExportKind;
971
+ consumerId: string;
972
+ }): Promise<void>;
973
+ declare function claimHostExportBatch(db: Database, input: {
974
+ kind: "session_event";
975
+ consumerId: string;
976
+ leaseToken: string;
977
+ leaseHolderId: string;
978
+ leaseSeconds?: number;
979
+ limit?: number;
980
+ maxBytes?: number;
981
+ }): Promise<HostEventExportBatch | null>;
982
+ declare function claimHostExportBatch(db: Database, input: {
983
+ kind: "usage_event";
984
+ consumerId: string;
985
+ leaseToken: string;
986
+ leaseHolderId: string;
987
+ leaseSeconds?: number;
988
+ limit?: number;
989
+ maxBytes?: number;
990
+ }): Promise<HostUsageExportBatch | null>;
991
+ declare function acknowledgeHostExportBatch(db: Database, input: {
992
+ kind: HostExportKind;
993
+ consumerId: string;
994
+ leaseToken: string;
995
+ }): Promise<string>;
996
+ declare function failHostExportBatch(db: Database, input: {
997
+ kind: HostExportKind;
998
+ consumerId: string;
999
+ leaseToken: string;
1000
+ error: string;
1001
+ maxFailures?: number;
1002
+ }): Promise<number>;
1003
+ declare function deadLetterHostExportHead(db: Database, input: {
1004
+ kind: HostExportKind;
1005
+ consumerId: string;
1006
+ leaseToken: string;
1007
+ cursor: string;
1008
+ reason: string;
1009
+ }): Promise<string>;
1010
+ declare function resumeHostExportConsumer(db: Database, input: {
1011
+ kind: HostExportKind;
1012
+ consumerId: string;
1013
+ }): Promise<void>;
1014
+ declare function rewindHostExportConsumer(db: Database, input: {
1015
+ kind: HostExportKind;
1016
+ consumerId: string;
1017
+ checkpoint: string;
1018
+ }): Promise<void>;
1019
+ declare function pruneHostExportOutbox(db: Database, input: {
1020
+ kind: HostExportKind;
1021
+ graceSeconds?: number;
1022
+ limit?: number;
1023
+ }): Promise<number>;
1024
+ declare function getHostExportConsumerStatus(db: Database, input: {
1025
+ kind: HostExportKind;
1026
+ consumerId: string;
1027
+ }): Promise<HostExportConsumerStatus | null>;
736
1028
  declare function setRlsContext(db: Database, context: RlsContext): Promise<void>;
737
1029
  declare function withRlsContext<T>(db: Database, context: RlsContext, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
738
1030
  declare function rlsContextForWorkspace(db: Database, workspaceId: string): Promise<RlsContext>;
@@ -835,18 +1127,40 @@ type GitHubInstallation = {
835
1127
  installationId: number;
836
1128
  accountLogin: string | null;
837
1129
  accountType: string | null;
1130
+ repositoryScope: GitHubRepositoryScope;
1131
+ linkedBySubjectId: string | null;
838
1132
  createdAt: string;
839
1133
  updatedAt: string;
840
1134
  };
1135
+ type GitHubInstallationAccess = GitHubInstallation & {
1136
+ repositoryIds: number[];
1137
+ };
841
1138
  declare function upsertGitHubInstallation(db: Database, input: {
842
1139
  accountId: string;
843
1140
  workspaceId: string;
844
1141
  installationId: number;
845
1142
  accountLogin?: string | null;
846
1143
  accountType?: string | null;
1144
+ linkedBySubjectId?: string | null;
847
1145
  }): Promise<GitHubInstallation>;
1146
+ declare function bindGitHubInstallationRepositories(db: Database, input: {
1147
+ accountId: string;
1148
+ workspaceId: string;
1149
+ installationId: number;
1150
+ accountLogin?: string | null;
1151
+ accountType?: string | null;
1152
+ linkedBySubjectId: string;
1153
+ repositoryIds: number[];
1154
+ }): Promise<GitHubInstallationAccess>;
848
1155
  declare function listGitHubInstallationsForWorkspace(db: Database, workspaceId: string): Promise<GitHubInstallation[]>;
849
1156
  declare function listGitHubInstallationIdsForWorkspace(db: Database, workspaceId: string): Promise<number[]>;
1157
+ declare function listGitHubInstallationAccessForWorkspace(db: Database, workspaceId: string): Promise<GitHubInstallationAccess[]>;
1158
+ declare function areGitHubRepositoriesAllowedForWorkspace(db: Database, workspaceId: string, installationId: number, repositoryIds: number[]): Promise<boolean>;
1159
+ declare function deleteGitHubInstallationBinding(db: Database, input: {
1160
+ accountId: string;
1161
+ workspaceId: string;
1162
+ installationId: number;
1163
+ }): Promise<boolean>;
850
1164
  declare function recordUsageEvent(db: Database, input: {
851
1165
  accountId: string;
852
1166
  workspaceId: string;
@@ -856,6 +1170,12 @@ declare function recordUsageEvent(db: Database, input: {
856
1170
  unit: string;
857
1171
  sourceResourceType?: string | null;
858
1172
  sourceResourceId?: string | null;
1173
+ sessionId?: string | null;
1174
+ turnId?: string | null;
1175
+ turnAttemptId?: string | null;
1176
+ initiator?: TurnInitiator | null;
1177
+ initiatorContext?: TurnInitiatorContext;
1178
+ origin?: SessionTurnSource | null;
859
1179
  idempotencyKey: string;
860
1180
  occurredAt?: Date;
861
1181
  }): Promise<UsageEvent>;
@@ -1215,6 +1535,7 @@ type CreateSessionMcpServerInput = {
1215
1535
  timeoutMs?: number | null;
1216
1536
  cacheToolsList?: boolean | null;
1217
1537
  requireApproval?: boolean | string[] | null;
1538
+ connectionRef?: McpServerConnectionRef$1 | null;
1218
1539
  headersEncrypted?: Record<string, string>;
1219
1540
  };
1220
1541
  type UpdateSessionMcpServerCredentialsInput = {
@@ -1240,6 +1561,7 @@ type EnqueueSessionTurnInput = {
1240
1561
  temporalWorkflowId: string;
1241
1562
  source: SessionTurnSource;
1242
1563
  prompt: string;
1564
+ turnInstructions?: string | null;
1243
1565
  resources: ResourceRef[];
1244
1566
  tools: ToolRef[];
1245
1567
  model: string;
@@ -1248,9 +1570,18 @@ type EnqueueSessionTurnInput = {
1248
1570
  sandboxOs?: SandboxOs | null;
1249
1571
  metadata: Record<string, unknown>;
1250
1572
  lineage?: Record<string, unknown>;
1573
+ initiator: TurnInitiator;
1574
+ initiatorContext?: TurnInitiatorContext;
1251
1575
  /** Steer inserts before all waiting prompts; Send appends after them. */
1252
1576
  placement?: "head" | "tail";
1253
1577
  };
1578
+ /**
1579
+ * Worker-only turn projection. Host instructions are durable execution input,
1580
+ * never part of the public SessionTurn/queue/HTTP contract.
1581
+ */
1582
+ type SessionTurnForExecution = SessionTurn & {
1583
+ turnInstructions: string | null;
1584
+ };
1254
1585
  declare function createFileUpload(db: Database, input: {
1255
1586
  accountId: string;
1256
1587
  workspaceId: string;
@@ -1595,6 +1926,28 @@ declare function createRigVersionForChangePromotion(db: Database, workspaceId: s
1595
1926
  change: RigChange;
1596
1927
  }>;
1597
1928
  declare function listRigVersions(db: Database, workspaceId: string, rigId: string): Promise<RigVersion[]>;
1929
+ type RigVersionMonitoringSummary = {
1930
+ id: string;
1931
+ rigId: string;
1932
+ version: number;
1933
+ active: boolean;
1934
+ image: string | null;
1935
+ imageOriginalChars: number | null;
1936
+ setupScriptBytes: number;
1937
+ checkCount: number;
1938
+ credentialHookCount: number;
1939
+ defaultVariableSetCount: number;
1940
+ changelog: string | null;
1941
+ changelogOriginalChars: number | null;
1942
+ createdBy: string | null;
1943
+ createdAt: string;
1944
+ };
1945
+ /** Compact-by-query historical rig versions for the model-facing MCP surface. */
1946
+ declare function listRigVersionMonitoringSummaries(db: Database, workspaceId: string, rigId: string, limit?: number): Promise<{
1947
+ versions: RigVersionMonitoringSummary[];
1948
+ hasMore: boolean;
1949
+ total: number;
1950
+ }>;
1598
1951
  declare function getRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion | null>;
1599
1952
  declare function getRigVersionById(db: Database, workspaceId: string, versionId: string): Promise<RigVersion | null>;
1600
1953
  declare function getRigName(db: Database, workspaceId: string, rigId: string): Promise<string | null>;
@@ -1609,6 +1962,31 @@ declare function createRigChange(db: Database, input: {
1609
1962
  proposedBy?: string | null;
1610
1963
  }): Promise<RigChange>;
1611
1964
  declare function listRigChanges(db: Database, workspaceId: string, rigId: string, limit?: number): Promise<RigChange[]>;
1965
+ type RigChangeMonitoringSummary = {
1966
+ id: string;
1967
+ rigId: string;
1968
+ baseVersionId: string | null;
1969
+ kind: RigChangeKind;
1970
+ status: RigChangeStatus;
1971
+ proposedBy: string | null;
1972
+ resultVersionId: string | null;
1973
+ commandPreview: string | null;
1974
+ commandOriginalChars: number | null;
1975
+ payloadBytes: number;
1976
+ verificationBytes: number;
1977
+ verificationLogBytes: number;
1978
+ verificationStartedAt: string | null;
1979
+ verificationFinishedAt: string | null;
1980
+ verificationPassed: boolean | null;
1981
+ createdAt: string;
1982
+ updatedAt: string;
1983
+ };
1984
+ /** Compact-by-query recent rig changes for the model-facing MCP surface. */
1985
+ declare function listRigChangeMonitoringSummaries(db: Database, workspaceId: string, rigId: string, limit?: number): Promise<{
1986
+ changes: RigChangeMonitoringSummary[];
1987
+ hasMore: boolean;
1988
+ total: number;
1989
+ }>;
1612
1990
  declare function getRigChange(db: Database, workspaceId: string, changeId: string): Promise<RigChange | null>;
1613
1991
  declare function updateRigChangeStatus(db: Database, workspaceId: string, changeId: string, input: {
1614
1992
  status: RigChangeStatus;
@@ -1880,8 +2258,8 @@ type CodexLeaseAccountStatus = CodexAccountStatus & {
1880
2258
  /**
1881
2259
  * Opaque accepted-turn policy scope resolved while the durable turn is locked.
1882
2260
  *
1883
- * OPE-21 deliberately does not know the shape of named pools. A downstream
1884
- * allocator policy (OPE-32) owns its private scope type and supplies a pure
2261
+ * This API deliberately does not know the shape of named pools. A downstream
2262
+ * allocator policy owns its private scope type and supplies a pure
1885
2263
  * metadata resolver. The resolved value is handed to the selector in the same
1886
2264
  * workspace rotation-row transaction as lease acquisition, so future pool
1887
2265
  * membership filtering cannot race the accepted turn's frozen policy.
@@ -1966,7 +2344,7 @@ declare function acquireCodexCredentialLease<T, TPolicyScope = never, TUnavailab
1966
2344
  /**
1967
2345
  * Optional downstream parser for private accepted-turn policy metadata.
1968
2346
  * It is pure, runs under the turn/rotation transaction, and must not query
1969
- * pool membership itself. OPE-21 stores or interprets no pool identifiers.
2347
+ * pool membership itself. This module stores or interprets no pool identifiers.
1970
2348
  */
1971
2349
  resolvePolicyScope?: CodexCredentialLeasePolicyScopeResolver<TPolicyScope>;
1972
2350
  /**
@@ -2070,11 +2448,13 @@ declare const CODEX_CAPACITY_REFRESH_MAX_MS: number;
2070
2448
  declare function codexCapacityRefreshBackoffMs(attempt: number): number;
2071
2449
  /**
2072
2450
  * Atomically settle one all-unavailable turn and arm exactly one durable wait.
2073
- * Lock order is allocator rotation row -> session -> goal -> blocked turn ->
2074
- * live lease (when a reactive failure owns one) -> waiter. The failed turn,
2075
- * idle/capacity-paused session, durable events, lease release, and waiter
2076
- * generation commit together; a crash cannot leave only half of the boundary
2077
- * visible.
2451
+ * Lock order is allocator rotation row -> workspace control -> actual workspace
2452
+ * -> session -> exact turn -> exact attempt -> goal -> live lease (when a
2453
+ * reactive failure owns one) -> waiter. The control share lock and effective
2454
+ * control recheck prevent a capacity boundary from closing an attempt after a
2455
+ * committed Pause. The failed turn, idle/capacity-paused session, durable
2456
+ * events, lease release, and waiter generation commit together; a crash cannot
2457
+ * leave only half of the boundary visible.
2078
2458
  */
2079
2459
  declare function armCodexCapacityWait(db: Database, input: {
2080
2460
  accountId: string;
@@ -2100,8 +2480,8 @@ declare function armCodexCapacityWait(db: Database, input: {
2100
2480
  }): Promise<ArmCodexCapacityWaitResult>;
2101
2481
  declare function getCodexCapacityWaitForSession(db: Database, workspaceId: string, sessionId: string): Promise<CodexCapacityWait | null>;
2102
2482
  /**
2103
- * Same-transaction capacity-mutation/outbox seam for OPE-24 eligibility and
2104
- * OPE-32 membership/default changes. The allocator rotation row is always the
2483
+ * Same-transaction capacity-mutation/outbox seam for account eligibility and
2484
+ * policy-scope membership/default changes. The allocator rotation row is always the
2105
2485
  * first lock. Mutations report whether capacity truth changed; only then are
2106
2486
  * matching waiter wake revisions advanced and returned for best-effort signal.
2107
2487
  */
@@ -2343,19 +2723,48 @@ declare function createSessionMcpServers(db: Database, input: {
2343
2723
  servers: CreateSessionMcpServerInput[];
2344
2724
  }): Promise<SessionMcpServerMetadata[]>;
2345
2725
  declare function listSessionMcpServerMetadata(db: Database, workspaceId: string, sessionId: string): Promise<SessionMcpServerMetadata[]>;
2726
+ /**
2727
+ * Returns the complete stored server configuration needed to snapshot an
2728
+ * immediate parent's MCP context onto a child session. Credential values stay
2729
+ * encrypted throughout this path: the core can copy the ciphertext into the
2730
+ * child's rows, but it never receives plaintext headers.
2731
+ *
2732
+ * This is intentionally distinct from `listSessionMcpServersForRun`, whose
2733
+ * worker-only responsibility is decrypting credentials at the execution
2734
+ * boundary.
2735
+ */
2736
+ declare function listSessionMcpServersForChildInheritance(db: Database, workspaceId: string, sessionId: string): Promise<CreateSessionMcpServerInput[]>;
2346
2737
  declare function updateSessionMcpServerCredentials(db: Database, input: {
2347
2738
  workspaceId: string;
2348
2739
  sessionId: string;
2349
2740
  updates: UpdateSessionMcpServerCredentialsInput[];
2350
2741
  }): Promise<UpdateSessionMcpServerCredentialsResult>;
2351
- declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, encryptionKey: Uint8Array): Promise<SessionMcpServerForRun[]>;
2742
+ declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, encryptionKey: Uint8Array | null): Promise<SessionMcpServerForRun[]>;
2743
+ type AgentSessionCreationActor = Extract<SessionCommandActor, {
2744
+ type: "agent_attempt";
2745
+ }>;
2746
+ /** A caller-preallocated session UUID is already owned by another session. */
2747
+ declare class SessionIdConflictError extends Error {
2748
+ readonly sessionId: string;
2749
+ constructor(sessionId: string);
2750
+ }
2352
2751
  declare function createSession(db: Database, input: {
2752
+ requestedSessionId?: string;
2353
2753
  accountId: string;
2354
2754
  workspaceId: string;
2355
2755
  initialMessage: string;
2756
+ initialTurnInstructions?: string | null;
2356
2757
  resources: ResourceRef[];
2357
2758
  tools?: ToolRef[];
2358
2759
  metadata: Record<string, unknown>;
2760
+ /**
2761
+ * Frozen creator authority. Legacy/test-only callers may omit this and get
2762
+ * an explicit unattributed service sentinel; production producers must pass
2763
+ * an authenticated subject or named service.
2764
+ */
2765
+ createdBy?: TurnInitiator;
2766
+ createdByContext?: TurnInitiatorContext;
2767
+ createdByActor?: AgentSessionCreationActor | null;
2359
2768
  model: string;
2360
2769
  sandboxBackend: SandboxBackend;
2361
2770
  variableSetId?: string | null;
@@ -2380,12 +2789,17 @@ declare function createSession(db: Database, input: {
2380
2789
  * the row already existed and must be returned as-is).
2381
2790
  */
2382
2791
  declare function createSessionWithIdempotencyKey(db: Database, input: {
2792
+ requestedSessionId?: string;
2383
2793
  accountId: string;
2384
2794
  workspaceId: string;
2385
2795
  initialMessage: string;
2796
+ initialTurnInstructions?: string | null;
2386
2797
  resources: ResourceRef[];
2387
2798
  tools?: ToolRef[];
2388
2799
  metadata: Record<string, unknown>;
2800
+ createdBy?: TurnInitiator;
2801
+ createdByContext?: TurnInitiatorContext;
2802
+ createdByActor?: AgentSessionCreationActor | null;
2389
2803
  model: string;
2390
2804
  sandboxBackend: SandboxBackend;
2391
2805
  variableSetId?: string | null;
@@ -2441,6 +2855,7 @@ type ListSessionsForSubjectOptions = ListSessionsOptions & {
2441
2855
  subjectId: string;
2442
2856
  cursor?: SessionListCursor | undefined;
2443
2857
  search?: string | undefined;
2858
+ authorizationScope?: SessionAuthorizationListScope | undefined;
2444
2859
  };
2445
2860
  declare class SessionPinVersionConflictError extends Error {
2446
2861
  readonly current: Pick<Session, "pinned" | "pinnedAt" | "pinVersion">;
@@ -2455,6 +2870,32 @@ declare class SessionListAccessError extends Error {
2455
2870
  declare class SessionPinAccessError extends Error {
2456
2871
  constructor(message?: string);
2457
2872
  }
2873
+ type SessionTreeStats = NonNullable<Session["treeStats"]>;
2874
+ /**
2875
+ * Remove control metadata derived from sessions other than the exact target.
2876
+ * Effective state and the opaque OCC etag remain usable without exposing
2877
+ * ancestor ids/titles/actors/reasons or descendant settlement facts.
2878
+ */
2879
+ declare function projectEffectiveControlForRelatedAccess(control: Session["effectiveControl"], sessionId: string, access: "target" | "root"): Session["effectiveControl"];
2880
+ /**
2881
+ * Remove metadata derived from sessions other than the exact authorized
2882
+ * target, including parent identity and descendant counts.
2883
+ */
2884
+ declare function projectSessionForRelatedAccess(session: Session, access: "target" | "root"): Session;
2885
+ /**
2886
+ * Return bounded descendant aggregates for the bounded set of rows being
2887
+ * painted in the session rail. Each selected root receives an independent
2888
+ * fixed node/depth budget. `truncated=true` makes every count an explicit lower
2889
+ * bound when a deep, wide, overlapping, or cyclic graph reaches that budget.
2890
+ */
2891
+ declare function sessionTreeStatsForSessions(db: Database, workspaceId: string, rootIds: string[]): Promise<Map<string, SessionTreeStats>>;
2892
+ /**
2893
+ * Convert the embedding host's complete list scope into a workspace-bound SQL
2894
+ * predicate. Root scopes include every descendant through the durable parent
2895
+ * graph; exact ids never imply access to related sessions. `UNION` (rather than
2896
+ * `UNION ALL`) makes legacy cycles terminate without a caller-sized path array.
2897
+ */
2898
+ declare function sessionAuthorizationScopeFilter(scope: SessionAuthorizationListScope): SQL;
2458
2899
  /** Opaque, URL-safe cursor encoding for a server-owned activity snapshot. */
2459
2900
  declare function encodeSessionListCursor(cursor: SessionListCursor): string;
2460
2901
  /** Decode and validate a cursor before it reaches any SQL predicate. */
@@ -2471,7 +2912,7 @@ declare function reapExpiredSessionListSnapshots(db: Database, limit?: number):
2471
2912
  */
2472
2913
  declare function listSessionsForSubject(db: Database, workspaceId: string, options: ListSessionsForSubjectOptions): Promise<SessionListResponse>;
2473
2914
  /** Read a session with the caller subject's personal pin projection. */
2474
- declare function getSessionForSubject(db: Database, workspaceId: string, sessionId: string, subjectId: string): Promise<Session | null>;
2915
+ declare function getSessionForSubject(db: Database, workspaceId: string, sessionId: string, subjectId: string, relatedSessionAccess?: "target" | "root"): Promise<Session | null>;
2475
2916
  /**
2476
2917
  * Idempotently set a member's pin without mutating the session's lifecycle or
2477
2918
  * activity timestamps. A transaction advisory lock serializes same-subject,
@@ -2486,11 +2927,83 @@ declare function setSessionPin(db: Database, input: {
2486
2927
  }): Promise<Session | null>;
2487
2928
  declare function listSessions(db: Database, workspaceId: string, limit?: number): Promise<Session[]>;
2488
2929
  declare function listSessions(db: Database, workspaceId: string, options?: ListSessionsOptions): Promise<Session[]>;
2930
+ type SessionDiscoveryOrderBy = "createdAt" | "updatedAt";
2931
+ type SessionDiscoveryCursor = {
2932
+ orderBy: SessionDiscoveryOrderBy;
2933
+ /** Decimal database activity revision; zero is the legacy/created-order bucket. */
2934
+ sortRevision: string;
2935
+ /** Exact PostgreSQL timestamp text (including microseconds), not a JS Date. */
2936
+ sortAt: string;
2937
+ id: string;
2938
+ /** Created-order timestamp ceiling; retained as diagnostic context for updated order. */
2939
+ snapshotAt: string;
2940
+ /** First-page revision fence: later activity belongs to the next incremental scan. */
2941
+ snapshotRevision: string;
2942
+ /** Incremental revision scope is cursor-bound and cannot change on continuation. */
2943
+ updatedAfter: string | null;
2944
+ };
2945
+ declare const SESSION_DISCOVERY_GOAL_MAX_CHARS = 600;
2946
+ declare const SESSION_DISCOVERY_MESSAGE_MAX_CHARS = 600;
2947
+ type SessionDiscoverySummary = {
2948
+ id: string;
2949
+ title: string | null;
2950
+ titleOriginalChars: number | null;
2951
+ parentSessionId: string | null;
2952
+ status: SessionStatus;
2953
+ effectiveControl: SessionDiscoveryControl;
2954
+ goal: {
2955
+ status: SessionGoalStatus;
2956
+ text: string;
2957
+ textOriginalChars: number;
2958
+ } | null;
2959
+ queuedPromptCount: number;
2960
+ treeStats: NonNullable<Session["treeStats"]>;
2961
+ latestMessage: {
2962
+ type: SessionEventType;
2963
+ preview: string | null;
2964
+ previewOriginalChars: number | null;
2965
+ } | null;
2966
+ createdAt: string;
2967
+ updatedAt: string;
2968
+ /** Internal exact revision key; omitted from the MCP row projection. */
2969
+ sortRevision: string;
2970
+ /** Internal exact keyset timestamp; omitted from the MCP row projection. */
2971
+ sortAt: string;
2972
+ };
2973
+ /**
2974
+ * Compact-by-construction discovery projection for the first-party
2975
+ * `sessions_list` MCP tool. It never selects instructions, resources, tools,
2976
+ * MCP metadata, repositories, settings, or full event/history bodies.
2977
+ */
2978
+ declare function listSessionDiscoverySummaries(db: Database, workspaceId: string, options: {
2979
+ limit: number;
2980
+ cursor?: SessionDiscoveryCursor;
2981
+ includeLastMessage?: boolean;
2982
+ orderBy?: SessionDiscoveryOrderBy;
2983
+ updatedAfter?: string;
2984
+ authorizationScope?: SessionAuthorizationListScope;
2985
+ }): Promise<{
2986
+ sessions: SessionDiscoverySummary[];
2987
+ hasMore: boolean;
2988
+ nextCursor: SessionDiscoveryCursor | null;
2989
+ total: number;
2990
+ orderBy: SessionDiscoveryOrderBy;
2991
+ snapshotAt: string;
2992
+ snapshotRevision: string;
2993
+ updatedThrough: string | null;
2994
+ updatedAfter: string | null;
2995
+ }>;
2489
2996
  type SessionLineage = {
2490
2997
  ancestors: Session[];
2491
2998
  children: LineageNode[];
2492
2999
  truncated: boolean;
2493
3000
  };
3001
+ /**
3002
+ * Resolve a session tree to its root without materializing the full lineage.
3003
+ * Every recursive hop stays workspace-scoped and invalid/cyclic/deep chains
3004
+ * fail closed instead of returning an ambiguous credential authority.
3005
+ */
3006
+ declare function getSessionRootId(db: Database, workspaceId: string, sessionId: string): Promise<string | null>;
2494
3007
  /**
2495
3008
  * Read the full lineage slice around a session. Every recursive step carries
2496
3009
  * workspace_id as a hard predicate; a foreign parent/child id is invisible even
@@ -2511,7 +3024,47 @@ type ListSessionEventsOptions = {
2511
3024
  after?: number;
2512
3025
  before?: number;
2513
3026
  limit?: number;
3027
+ direction?: SessionEventReadDirection;
3028
+ includeTypes?: readonly SessionEventType[];
3029
+ excludeTypes?: readonly SessionEventType[];
3030
+ includeClasses?: readonly SessionEventSemanticClass[];
3031
+ excludeClasses?: readonly SessionEventSemanticClass[];
3032
+ defaultExcludeTypes?: readonly SessionEventType[];
3033
+ payloadMode?: SessionEventPayloadMode;
3034
+ };
3035
+ type ListSessionEventPageOptions = ListSessionEventsOptions & {
3036
+ /** Exact UTF-8 JSON-array envelope budget for rows materialized by the app. */
3037
+ maxBytes?: number;
3038
+ /** Internal SQL fetch size. Batches never escape the surrounding RLS transaction. */
3039
+ batchSize?: number;
3040
+ };
3041
+ type SessionEventPage = {
3042
+ events: SessionEvent[];
3043
+ hasMore: boolean;
3044
+ bytes: number;
3045
+ direction: SessionEventReadDirection;
3046
+ coveredSequence: {
3047
+ first: number;
3048
+ last: number;
3049
+ } | null;
3050
+ nextAfter: number | null;
3051
+ nextBefore: number | null;
3052
+ truncatedBy: "count" | "bytes" | null;
2514
3053
  };
3054
+ declare const SESSION_EVENT_DB_PAGE_MAX_BYTES: number;
3055
+ /**
3056
+ * Read one direction-aware session-event page without transferring legacy raw
3057
+ * payloads or malformed free-form envelope strings out of PostgreSQL.
3058
+ *
3059
+ * Migration 0067 deliberately leaves historical rows untouched. This query
3060
+ * invokes its immutable payload projector in SQL and mirrors the rolling
3061
+ * envelope guard in SQL, then accumulates small batches under one RLS
3062
+ * transaction. `bytes` is the exact UTF-8 size of `JSON.stringify(events)`;
3063
+ * `hasMore` is true whenever count or byte selection stopped before the durable
3064
+ * range ended. A nonempty durable range can therefore never become an empty,
3065
+ * non-advancing HTTP page.
3066
+ */
3067
+ declare function listSessionEventPage(db: Database, workspaceId: string, sessionId: string, options?: ListSessionEventPageOptions): Promise<SessionEventPage>;
2515
3068
  declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string): Promise<SessionEvent[]>;
2516
3069
  declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, after: number, limit?: number): Promise<SessionEvent[]>;
2517
3070
  declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, options: ListSessionEventsOptions): Promise<SessionEvent[]>;
@@ -2548,6 +3101,57 @@ declare function getLatestRunState(db: Database, workspaceId: string, sessionId:
2548
3101
  pendingApprovals: unknown[];
2549
3102
  frozenCodexCredentialId: string | null;
2550
3103
  } | null>;
3104
+ declare class HumanInputResponseValidationError extends Error {
3105
+ readonly code: "INVALID_RESPONSE" | "SKIP_NOT_ALLOWED";
3106
+ readonly name = "HumanInputResponseValidationError";
3107
+ constructor(code: "INVALID_RESPONSE" | "SKIP_NOT_ALLOWED", message: string);
3108
+ }
3109
+ declare function getSessionHumanInputRequest(db: Database, workspaceId: string, sessionId: string, requestId: string): Promise<SessionHumanInputRequest | null>;
3110
+ declare function listSessionHumanInputRequests(db: Database, workspaceId: string, sessionId: string, options?: {
3111
+ status?: SessionHumanInputRequest["status"];
3112
+ limit?: number;
3113
+ }): Promise<SessionHumanInputRequest[]>;
3114
+ declare function validateHumanInputResponse(request: Pick<SessionHumanInputRequest, "questions" | "allowSkip">, rawResponse: unknown): HumanInputResponse;
3115
+ type AcceptSessionHumanInputResponseResult = {
3116
+ action: "accepted";
3117
+ request: SessionHumanInputRequest;
3118
+ event: SessionEvent;
3119
+ events: SessionEvent[];
3120
+ workflowWakeRevision: number;
3121
+ } | {
3122
+ action: "conflict";
3123
+ request: SessionHumanInputRequest;
3124
+ events: SessionEvent[];
3125
+ workflowWakeRevision: number | null;
3126
+ } | {
3127
+ action: "not_found";
3128
+ };
3129
+ /**
3130
+ * First-writer-wins settlement for one pending structured input boundary.
3131
+ * Session + logical turn + current freeze generation are locked with the row;
3132
+ * the creation attempt is provenance and is intentionally not the resume owner.
3133
+ */
3134
+ declare function acceptSessionHumanInputResponse(db: Database, input: {
3135
+ accountId: string;
3136
+ workspaceId: string;
3137
+ sessionId: string;
3138
+ requestId: string;
3139
+ response: unknown;
3140
+ respondedBy: string;
3141
+ clientEventId?: string | null;
3142
+ expireOnly?: boolean;
3143
+ }): Promise<AcceptSessionHumanInputResponseResult>;
3144
+ declare function expireSessionHumanInputRequest(db: Database, input: {
3145
+ accountId: string;
3146
+ workspaceId: string;
3147
+ sessionId: string;
3148
+ requestId: string;
3149
+ }): Promise<AcceptSessionHumanInputResponseResult>;
3150
+ declare function getHumanInputResumeForEvent(db: Database, workspaceId: string, sessionId: string, event: Pick<SessionEvent, "type" | "payload">): Promise<{
3151
+ requestId: string;
3152
+ toolCallId: string;
3153
+ response: HumanInputResponse;
3154
+ } | null>;
2551
3155
  type TurnAttemptFenceRejectReason = "workspace_paused" | "session_paused" | "pending_control" | "active_turn_changed" | "generation_changed" | "attempt_changed" | "turn_terminal" | "not_found";
2552
3156
  /**
2553
3157
  * Append conversation items (verbatim SDK AgentInputItems) to the session's
@@ -2563,6 +3167,7 @@ declare function appendSessionHistoryItems(db: Database, input: {
2563
3167
  expectedExecutionGeneration: number;
2564
3168
  expectedAttemptId: string;
2565
3169
  producerCodexCredentialId?: string | null;
3170
+ modelToolOutputTruncationTokens?: number;
2566
3171
  items: Array<{
2567
3172
  position: number;
2568
3173
  item: Record<string, unknown>;
@@ -2596,14 +3201,15 @@ declare function recordPendingSessionToolCallResult(db: Database, input: Omit<Pe
2596
3201
  }): Promise<{
2597
3202
  accepted: boolean;
2598
3203
  recorded: boolean;
2599
- allResultsRecorded: boolean;
2600
3204
  }>;
2601
3205
  /**
2602
3206
  * Remove completed receipts only after the full SDK call/result batch is
2603
3207
  * durable. Until then every raw result remains available to an attempt-ending
2604
3208
  * transaction, including reverse-completing parallel calls.
2605
3209
  */
2606
- declare function clearDurablePendingSessionToolCalls(db: Database, input: Omit<PendingSessionToolCallInput, "callId" | "callType" | "callItem">): Promise<{
3210
+ declare function clearDurablePendingSessionToolCalls(db: Database, input: Omit<PendingSessionToolCallInput, "callId" | "callType" | "callItem"> & {
3211
+ callIds: string[];
3212
+ }): Promise<{
2607
3213
  accepted: boolean;
2608
3214
  cleared: number;
2609
3215
  }>;
@@ -2705,7 +3311,7 @@ declare function recordSkippedContextCompaction(db: Database, input: {
2705
3311
  turnId: string;
2706
3312
  expectedExecutionGeneration: number;
2707
3313
  expectedAttemptId: string;
2708
- reason: "no_history" | "replacement_not_smaller";
3314
+ reason: "no_history" | "replacement_not_smaller" | "replacement_unchanged" | "summarization_failed";
2709
3315
  }): Promise<{
2710
3316
  recorded: true;
2711
3317
  events: SessionEvent[];
@@ -3183,6 +3789,9 @@ declare function persistDrainSnapshot(db: Database, input: {
3183
3789
  declare function persistWarmSnapshot(db: Database, input: {
3184
3790
  accountId: string;
3185
3791
  workspaceId: string;
3792
+ sessionId: string;
3793
+ turnId: string;
3794
+ attemptId: string;
3186
3795
  sandboxGroupId: string;
3187
3796
  expectedEpoch: number;
3188
3797
  /** base64 of the provider snapshot-ref / tar archive from persistWorkspace(). */
@@ -3242,15 +3851,17 @@ type WorkspaceCaptureCommitResult = {
3242
3851
  * — can embed the same number). Writes ONLY when a warm lease with the expected
3243
3852
  * epoch still exists for the sandbox group (the same supersession guard
3244
3853
  * persistWarmSnapshot uses, expressed as an EXISTS on sandbox_leases). Returns
3245
- * the assigned revision, or null when the fence rejected the write (superseded /
3246
- * released lease). Captures for one session are serialized (one turn at a time),
3247
- * so the explicit revision never races the unique (session_id, revision) index.
3854
+ * the assigned revision, or null when the fence rejected the write (interrupted
3855
+ * attempt, cancelled/superseded turn, or released/superseded lease). Captures for
3856
+ * one session are serialized (one turn at a time), so the explicit revision never
3857
+ * races the unique (session_id, revision) index.
3248
3858
  */
3249
3859
  declare function insertWorkspaceCapture(db: Database, input: {
3250
3860
  accountId: string;
3251
3861
  workspaceId: string;
3252
3862
  sessionId: string;
3253
- turnId: string | null;
3863
+ turnId: string;
3864
+ attemptId: string;
3254
3865
  sandboxGroupId: string;
3255
3866
  expectedEpoch: number;
3256
3867
  revision: number;
@@ -3274,7 +3885,8 @@ declare function insertFailedWorkspaceCapture(db: Database, input: {
3274
3885
  accountId: string;
3275
3886
  workspaceId: string;
3276
3887
  sessionId: string;
3277
- turnId: string | null;
3888
+ turnId: string;
3889
+ attemptId: string;
3278
3890
  sandboxGroupId: string;
3279
3891
  expectedEpoch: number;
3280
3892
  revision: number;
@@ -3877,7 +4489,7 @@ type ClaimSessionWorkForAttemptInput = {
3877
4489
  };
3878
4490
  type ClaimSessionWorkForAttemptResult = {
3879
4491
  action: "claimed";
3880
- turn: SessionTurn;
4492
+ turn: SessionTurnForExecution;
3881
4493
  } | {
3882
4494
  action: "unclaimed";
3883
4495
  reason: "gate-closed" | "no-work" | "stale-approval" | "control-pending";
@@ -3896,6 +4508,33 @@ type SessionAttemptInterruptionSettlement = {
3896
4508
  turnId: string | null;
3897
4509
  outcome: SessionTurnAttemptOutcome | null;
3898
4510
  };
4511
+ /**
4512
+ * Acknowledge that the exact cancelled attempt reached its final quiescence
4513
+ * boundary: after this transaction it has no inference, user-visible output,
4514
+ * or workspace-persistence authority. Fenced/idempotent cleanup and telemetry
4515
+ * may still finish. This may race the workflow's logical settlement transaction
4516
+ * in either order; both use the canonical control -> workspace -> session ->
4517
+ * exact turn -> exact attempt lock order and require the durable interruption.
4518
+ * Temporal activity cancellation/terminalization is transport state only. The
4519
+ * workflow admits a replacement from this durable receipt, never from the
4520
+ * activity promise.
4521
+ */
4522
+ declare function markSessionAttemptQuiesced(db: Database, input: {
4523
+ accountId?: string;
4524
+ workspaceId: string;
4525
+ sessionId: string;
4526
+ attemptId: string;
4527
+ temporalWorkflowId: string;
4528
+ /** When supplied, both values bind an activity-owned recovery proof to the
4529
+ * exact persisted Temporal dispatch. Legacy v1 replay callers omit them. */
4530
+ temporalWorkflowRunId?: string;
4531
+ temporalActivityId?: string;
4532
+ /** The dying activity also reaches this boundary for non-control ownership
4533
+ * fences. It may no-op when no Pause/Steer interruption exists; replacement
4534
+ * admission remains strict because only a durable interruption needs this
4535
+ * receipt. */
4536
+ allowUninterrupted?: boolean;
4537
+ }): Promise<SessionEvent[]>;
3899
4538
  /**
3900
4539
  * Settle every durable interruption cause for one exact first-class attempt.
3901
4540
  * Steer wins the logical-turn fate when causes coexist; effective control after
@@ -3910,6 +4549,8 @@ type SessionWorkPeek = {
3910
4549
  triggerEventId: string;
3911
4550
  } | {
3912
4551
  kind: "approval-wait";
4552
+ humanInputRequestId?: string;
4553
+ expiresAt?: string;
3913
4554
  } | {
3914
4555
  kind: "capacity-wait";
3915
4556
  ref: {
@@ -3921,6 +4562,9 @@ type SessionWorkPeek = {
3921
4562
  } | {
3922
4563
  kind: "interruption-pending";
3923
4564
  attemptId: string;
4565
+ } | {
4566
+ kind: "cancellation-wait";
4567
+ attemptId: string;
3924
4568
  } | {
3925
4569
  kind: "idle";
3926
4570
  };
@@ -3972,7 +4616,38 @@ type ApplySessionTurnSettlementInput = {
3972
4616
  sessionStatus: SessionStatus;
3973
4617
  activeTurnId: string | null;
3974
4618
  events: AppendEventInput[];
4619
+ /**
4620
+ * A mid-turn SDK freeze installed atomically with requires_action. Human
4621
+ * input requests are public protocol rows; ordinary approvals remain only in
4622
+ * pendingApprovals. No request can become visible without the exact frozen
4623
+ * RunState needed to resume it, and no frozen request can miss its status
4624
+ * transition/events because all writes share this transaction.
4625
+ */
4626
+ runState?: {
4627
+ serializedRunState: string;
4628
+ pendingApprovals: unknown[];
4629
+ frozenCodexCredentialId?: string | null;
4630
+ humanInputRequests?: Array<{
4631
+ id: string;
4632
+ toolCallId: string;
4633
+ questions: HumanInputQuestion[];
4634
+ allowSkip: boolean;
4635
+ expiresAt?: Date | null;
4636
+ }>;
4637
+ };
3975
4638
  recording?: SessionTurnRecordingSettlement;
4639
+ /**
4640
+ * Atomically consume an operator /compact request and record why it could
4641
+ * not install a replacement. This lives on the terminal turn settlement so
4642
+ * a worker crash can never clear the request without also publishing the
4643
+ * attempt-owned failure truth.
4644
+ */
4645
+ compactionRequestFailure?: {
4646
+ reason: "summarization_failed";
4647
+ producerId?: string | null;
4648
+ producerSeq?: number | null;
4649
+ occurredAt?: Date;
4650
+ };
3976
4651
  };
3977
4652
  type ApplySessionTurnSettlementResult = {
3978
4653
  action: "settled";
@@ -4109,7 +4784,7 @@ type RecoverSessionDispatchResult = {
4109
4784
  */
4110
4785
  declare function recoverSessionDispatch(db: Database, workspaceId: string, input: RecoverSessionDispatchInput): Promise<RecoverSessionDispatchResult>;
4111
4786
  declare function getSessionTurn(db: Database, workspaceId: string, turnId: string): Promise<SessionTurn | null>;
4112
- declare function getSessionTurnForAttempt(db: Database, workspaceId: string, sessionId: string, attemptId: string): Promise<SessionTurn | null>;
4787
+ declare function getSessionTurnForAttempt(db: Database, workspaceId: string, sessionId: string, attemptId: string): Promise<SessionTurnForExecution | null>;
4113
4788
  /**
4114
4789
  * Return the newest turn that reached agent execution for a session. A claimed
4115
4790
  * turn's `started_at` is set before worker admission, so it is not sufficient
@@ -4311,4 +4986,4 @@ type LockedSessionUpdateResult = {
4311
4986
  declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>): Promise<SessionEvent[]>;
4312
4987
  declare function sessionSubject(workspaceId: string, sessionId: string): string;
4313
4988
 
4314
- export { type CorrectWorkspaceMemoryResult as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BootstrapWorkspaceInput as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexCapacitySelectionContext as D, type CodexCapacityWait as E, type CodexCapacityWaitStatus as F, type CodexCapacityWakeTarget as G, type CodexCredentialForRun as H, type CodexCredentialLeaseCandidateFilter as I, type CodexCredentialLeaseCandidateFilterResult as J, type CodexCredentialLeasePolicyScopeResolver as K, type CodexCredentialLeaseQuarantine as L, type CodexCredentialLeaseResult as M, type CodexCredentialLeaseSelection as N, type CodexCredentialLeaseSelectionContext as O, type CodexCredentialStatus as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialTokens as Q, type CodexLeaseAccountStatus as R, type CodexPinSource as S, type CodexRotationSettings as T, type CodexRotationStrategy as U, type ComposerDraftRow as V, type ConnectionBrokerDeps as W, type ConnectionCredentialForBroker as X, ConnectionRefreshHttpError as Y, type ConsumeOAuthStateNonceInput as Z, type CorrectWorkspaceMemoryInput as _, type AcceptSessionApprovalDecisionResult as a, type MarkWarmLeaseInstanceLostResult as a$, type CreateCapabilityCatalogItemInput as a0, type CreateConnectionInput as a1, type CreateDbOptions as a2, type CreateImportBatchInput as a3, type CreateKnowledgeMemoryInput as a4, type CreatePackInstallationInput as a5, type CreateScheduledTaskInput as a6, type CreateSessionGoalInput as a7, type CreateSessionMcpServerInput as a8, type CreateSocialConnectionInput as a9, type IntegrationOAuthClientForUse as aA, type LeaseHolderKind as aB, type LeaseSnapshot as aC, type ListKnowledgeMemoryOptions as aD, type ListSessionEventsOptions as aE, type ListSessionsForSubjectOptions as aF, type ListSessionsOptions as aG, type LiveModalSandboxLeaseAttribution as aH, MACHINE_METRICS_SERIES_INTERVAL_MS as aI, MAX_INTERNAL_UPDATE_BATCH_BYTES as aJ, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as aK, MAX_INTERNAL_UPDATE_BYTES as aL, MEMORY_ACTIVE_RECORD_CAP as aM, MEMORY_BLOCK_KIND_ORDER as aN, MEMORY_BLOCK_RECORD_LIMIT as aO, MEMORY_CORRECT_TOOL_DESCRIPTION as aP, MEMORY_KIND_SECTION_TITLES as aQ, MEMORY_NEAR_DUP_COSINE_THRESHOLD as aR, MEMORY_NEAR_DUP_NEIGHBORS as aS, MEMORY_SAVE_TOOL_DESCRIPTION as aT, MEMORY_SEARCH_DEFAULT_LIMIT as aU, MEMORY_SEARCH_MAX_LIMIT as aV, MEMORY_SEARCH_TOOL_DESCRIPTION as aW, MEMORY_TEXT_MAX_CHARS as aX, MEMORY_VISIBLE_RECORD_CAP as aY, type MachineMetricsRow as aZ, type MachineMetricsSample as a_, type CreateSocialPostInput as aa, type CreditBalanceByAccount as ab, type Database as ac, type DbClient as ad, type DeviceEnrollmentRequestRecord as ae, type DeviceEnrollmentStatus as af, type EditQueueCommandResult as ag, type EffectiveControlBlocker as ah, type EffectiveControlResumeOption as ai, type EffectiveControlState as aj, type EffectiveSessionControl as ak, type EnableCapabilityInstallationInput as al, type EnabledMcpCapabilityServer as am, type EnqueueSessionTurnInput as an, type EnrollmentExposure as ao, type EnrollmentOs as ap, type EnrollmentRecord as aq, type EnrollmentStatus as ar, type ExpiredFileUploadCleanupClaim as as, type FileUploadCleanupClaimResult as at, type ForceDrainResult as au, type GitHubInstallation as av, type GoalContinuationDecision as aw, type ImportBatch as ax, type InitializeSessionStartInput as ay, type InitializeSessionStartResult as az, type AccrueWarmSecondsResult as b, type SetSessionCodexPinOptions as b$, type MemoryBlockRecord as b0, type MemoryEmbedder as b1, type MemorySanitizeResult as b2, type MeterableWarmLease as b3, type PendingSessionToolCallInput as b4, type QueueCommandConflictCode as b5, QueueCommandConflictError as b6, type QueueCommandResult as b7, type QueuedTurnRow as b8, type ReapDrainable as b9, type SaveWorkspaceMemoryResult as bA, type SessionAttemptInterruptionSettlement as bB, type SessionCodexState as bC, type SessionCommandActor as bD, SessionCommandIdempotencyError as bE, type SessionCommandReceiptRow as bF, SessionContextBusyError as bG, SessionControlConflictError as bH, SessionControlInvariantError as bI, type SessionControlMutationResult as bJ, type SessionLineage as bK, SessionListAccessError as bL, type SessionListCursor as bM, SessionListCursorError as bN, type SessionMcpServerForRun as bO, SessionPinAccessError as bP, SessionPinVersionConflictError as bQ, type SessionRecordingCodec as bR, type SessionRecordingMode as bS, type SessionRecordingRow as bT, type SessionRecordingState as bU, type SessionSystemUpdateOutboxDelivery as bV, type SessionTurnAttemptOutcome as bW, type SessionTurnRecordingSettlement as bX, type SessionWorkPeek as bY, type SessionWorkTrigger as bZ, type SessionWorkflowWake as b_, type ReconcileCodexCapacityWaitResult as ba, type RecoverSessionDispatchInput as bb, type RecoverSessionDispatchResult as bc, type RegisterWorkspacePackInput as bd, type RegistryCapabilityCatalogItemInput as be, type RegistryCatalogSurfaceKey as bf, type ReplaceIntegrationOAuthClientInput as bg, type RequestSessionTurnRecoveryInput as bh, type RequestSessionTurnRecoveryResult as bi, type ResolveConnectionCredentialInput as bj, type ResolveConnectionCredentialResult as bk, RigActiveVersionChangedError as bl, RigChangeAlreadyVerifyingError as bm, RigChangeTransitionError as bn, type RigVersionContentInput as bo, type RlsContext as bp, type RlsStrategy as bq, SESSION_ANCESTRY_LIMIT as br, SandboxImageConflictError as bs, type SandboxKind as bt, type SandboxLeaseLiveness as bu, SandboxLeaseSupersededError as bv, type SandboxPtySessionRow as bw, type SandboxRecord as bx, SandboxRigConflictError as by, type SaveWorkspaceMemoryInput as bz, type AcquireLeaseInput as c, claimFileUploadCleanup as c$, type SettleCodexCredentialFailoverResult as c0, type SettleCodexCredentialLeaseLossResult as c1, type SteerQueueCommandResult as c2, type StoreIntegrationOAuthClientInput as c3, type StoredIntegrationOAuthClient as c4, type StreamAcknowledgment as c5, type SubmitHumanPromptResult as c6, type ToolspaceCallReservation as c7, type TurnAttemptFenceRejectReason as c8, type UpdateConnectionInput as c9, acquireLease as cA, activateRigVersion as cB, addSessionSystemUpdate as cC, addSessionSystemUpdateWithSourceMutation as cD, allAccountPermissions as cE, allWorkspacePermissions as cF, appendSessionEventToSandboxGroup as cG, appendSessionEvents as cH, appendSessionEventsAndUpdateSession as cI, appendSessionEventsForTurnAttempt as cJ, appendSessionEventsWithLockedSessionUpdate as cK, appendSessionHistoryItems as cL, applyContextCompaction as cM, applyCreditDebitUpToBalance as cN, applyCreditLedgerEntry as cO, applySessionTurnSettlement as cP, approveDeviceEnrollmentRequest as cQ, armCodexCapacityWait as cR, assertAgentCommandAuthorityInTransaction as cS, autoResumeSessionBranchInTransaction as cT, beginRigChangeVerificationAttempt as cU, bootstrapWorkspace as cV, buildChildCompletionDigest as cW, buildCodexTokenResolver as cX, buildConnectionTokenResolver as cY, canonicalSessionCommandHash as cZ, claimExpiredFileUploadCleanup as c_, type UpdateImportBatchCountsInput as ca, type UpdateKnowledgeMemoryInput as cb, type UpdateScheduledTaskInput as cc, type UpdateSessionMcpServerCredentialsInput as cd, type UpdateSessionMcpServerCredentialsResult as ce, type UserLookup as cf, type VariableSetForRun as cg, WORKSPACE_MEMORY_BLOCK_EMPTY as ch, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as ci, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as cj, type WorkspaceCaptureCommitResult as ck, type WorkspaceCaptureGcPlan as cl, type WorkspaceCaptureGcRow as cm, type WorkspaceCaptureRow as cn, type WorkspaceControlLockMode as co, type WorkspaceControlMutationResult as cp, type WorkspaceEnvironmentForRun as cq, type WorkspaceMemoryOrigin as cr, type WorkspaceMemorySearchInput as cs, type WorkspaceMemorySearchMode as ct, type WorkspaceMemorySearchResult as cu, type WorkspaceModelPolicy as cv, abandonRecordingForTurnAttempt as cw, acceptSessionApprovalDecision as cx, accrueWarmSeconds as cy, acquireCodexCredentialLease as cz, type AcquireLeaseResult as d, decryptEnvironmentValue as d$, claimPendingSessionSystemUpdateOutbox as d0, claimPendingSessionWorkflowWakes as d1, claimSessionWorkForAttempt as d2, clearDurablePendingSessionToolCalls as d3, clearEnrollmentWentOffline as d4, clearSessionContext as d5, clearSessionGoal as d6, clearedContextMarkerItem as d7, closePtySession as d8, closeSessionTurnAttemptInTransaction as d9, countWorkspaceEnvironments as dA, countWorkspacesForAccount as dB, createApiKey as dC, createConnection as dD, createDb as dE, createDeviceEnrollmentRequest as dF, createEnrollment as dG, createFileUpload as dH, createImportBatch as dI, createKnowledgeMemory as dJ, createRig as dK, createRigChange as dL, createRigVersion as dM, createRigVersionForChangePromotion as dN, createSandbox as dO, createScheduledTask as dP, createScheduledTaskRun as dQ, createSession as dR, createSessionGoal as dS, createSessionMcpServers as dT, createSessionWithIdempotencyKey as dU, createSocialConnection as dV, createSocialPost as dW, createVariableSet as dX, createWorkspace as dY, createWorkspaceEnvironment as dZ, decodeSessionListCursor as d_, codexCapacityRefreshBackoffMs as da, commitWarmingToWarm as db, completeExpiredFileUploadCleanup as dc, completeFileUpload as dd, completeFileUploadCleanup as de, computeWorkspaceCaptureGcPlan as df, confirmDrainCold as dg, consumeDeviceEnrollmentRequest as dh, consumeIntegrationOAuthStateNonce as di, correctWorkspaceMemory as dj, countActiveApiKeysForWorkspace as dk, countActiveSessionHistoryItems as dl, countActiveSessionsForWorkspace as dm, countActiveSessionsUsingEnvironment as dn, countActiveSessionsUsingVariableSet as dp, countConsecutiveReactiveRotations as dq, countQueuedTurns as dr, countRigs as ds, countSandboxLeasesByLiveness as dt, countScheduledTasksForWorkspace as du, countScheduledTasksUsingEnvironment as dv, countScheduledTasksUsingVariableSet as dw, countSessionHistoryItems as dx, countSessionsUsingRig as dy, countVariableSets as dz, type ActiveSandboxPointer as e, getRecording as e$, decryptedCapabilityHeaders as e0, deleteRecording as e1, deleteRig as e2, deleteRigIfNoActiveSessions as e3, deleteScheduledTask as e4, deleteSessionQueueItemInTransaction as e5, deleteVariableSet as e6, deleteVariableSetVariable as e7, deleteWorkspace as e8, deleteWorkspaceCaptureRows as e9, forceDrainOverLimitViewerOnlyBoxes as eA, getActiveSessionHistoryItems as eB, getAnySessionInGroup as eC, getBillingBalance as eD, getBillingCustomer as eE, getCapabilityCatalogItem as eF, getCapabilityInstallation as eG, getCodexCapacityWaitForSession as eH, getCodexCredentialStatus as eI, getCodexRotationSettings as eJ, getComposerDraftInTransaction as eK, getConnectionMetadata as eL, getDeviceEnrollmentRequestByDeviceCode as eM, getEnrollment as eN, getFile as eO, getFileUpload as eP, getKnowledgeMemory as eQ, getLatestRunState as eR, getLatestStartedSessionTurn as eS, getManagedAccount as eT, getManagedUserByEmail as eU, getMaterializedSandboxFileResources as eV, getOpenPtySession as eW, getOrCreateSessionSystemUpdateOutbox as eX, getPackInstallation as eY, getPendingDeviceEnrollmentRequestByUserCode as eZ, getPendingDeviceEnrollmentRequestByUserCodeGlobal as e_, deleteWorkspaceEnvironment as ea, deleteWorkspaceEnvironmentVariable as eb, deleteWorkspacePack as ec, denyDeviceEnrollmentRequest as ed, disableCapabilityInstallation as ee, disconnectAllCodexAccounts as ef, disconnectCodexAccount as eg, editQueuedTurnInTransaction as eh, enableCapabilityInstallation as ei, enablePackInstallation as ej, encodeSessionListCursor as ek, encryptEnvironmentValue as el, enqueueSessionTurn as em, enqueueSessionWorkflowWake as en, enqueueSessionWorkflowWakeIfRunnable as eo, enqueueSessionWorkflowWakeInTransaction as ep, ensureCodexRotationSettings as eq, ensureManagedAccessForUser as er, estimateMemoryTokens as es, evaluateGoalContinuation as et, evaluateSessionControl as eu, evaluateSessionControls as ev, failWarmingToCold as ew, fetchCodexUsageForAccount as ex, finalizeEnrollmentByToken as ey, findActiveApiKeyByHash as ez, type AddSessionSystemUpdateInput as f, listDistinctRigVersionIdsInGroup as f$, getRig as f0, getRigByName as f1, getRigChange as f2, getRigName as f3, getRigVersion as f4, getRigVersionById as f5, getSandbox as f6, getSandboxSessionEnvelope as f7, getScheduledTask as f8, getSession as f9, getWorkspacePack as fA, grantWorkspaceAccess as fB, hasCreditLedgerEntry as fC, hashMemoryText as fD, heartbeatCodexCredentialLease as fE, heartbeatCodexCredentialLeaseUntil as fF, heartbeatLeaseHolder as fG, ingestMachineMetricsSample as fH, initializeSessionStartAtomically as fI, insertFailedWorkspaceCapture as fJ, insertMachineMetricsSeries as fK, insertPtySession as fL, insertRecording as fM, insertWorkspaceCapture as fN, interruptedToolCallResult as fO, isCodexBilledTurn as fP, isMemoryTextTooLong as fQ, isPrivateAddress as fR, isSessionCompactionRequested as fS, isStripeWebhookProcessed as fT, latestWorkspaceCapture as fU, listApiKeys as fV, listCapabilityCatalogItems as fW, listCapabilityInstallations as fX, listCodexAccountStatuses as fY, listConnectionsMetadata as fZ, listCreditBalancesByAccount as f_, getSessionByCreateIdempotencyKey as fa, getSessionCodexState as fb, getSessionEvent as fc, getSessionEventByClientEventId as fd, getSessionForSubject as fe, getSessionGoal as ff, getSessionHistoryItems as fg, getSessionLineage as fh, getSessionQueueSnapshot as fi, getSessionSystemUpdateOutboxByDedupeKey as fj, getSessionTurn as fk, getSessionTurnForAttempt as fl, getSocialConnection as fm, getStoredCapabilityHeaderCiphertext as fn, getStreamAcknowledgment as fo, getVariableSet as fp, getVariableSetByName as fq, getVariableSetValuesForRun as fr, getWorkspace as fs, getWorkspaceControlEvent as ft, getWorkspaceDefaultRigId as fu, getWorkspaceEnvironment as fv, getWorkspaceEnvironmentByName as fw, getWorkspaceEnvironmentValuesForRun as fx, getWorkspaceGrant as fy, getWorkspaceModelPolicy as fz, type AddSessionSystemUpdateResult as g, persistDrainSnapshot as g$, listDistinctVariableSetIdsInGroup as g0, listEnabledMcpCapabilityServers as g1, listEnrollments as g2, listGitHubInstallationIdsForWorkspace as g3, listGitHubInstallationsForWorkspace as g4, listKnowledgeMemories as g5, listLiveModalSandboxLeaseAttributions as g6, listMeterableWarmLeases as g7, listOpenPtySessions as g8, listOutstandingSessionSystemUpdates as g9, listWorkspacePacks as gA, listWorkspacesForSubject as gB, loadCodexCredentialForRun as gC, loadConnectionCredentialForBroker as gD, loadIntegrationOAuthClient as gE, loadVariableSetForRun as gF, loadWorkspaceEnvironmentForRun as gG, lockWorkspaceInferenceControl as gH, markFileUploadFailed as gI, markSandboxFileResourcesMaterialized as gJ, markScheduledTaskRunFailedIfQueued as gK, markSessionSystemUpdateOutboxDeliveredInTransaction as gL, markSessionSystemUpdateOutboxFailed as gM, markSessionWorkflowWakeDelivered as gN, markSessionWorkflowWakeFailed as gO, markStaleRegistryCatalogItems as gP, markStripeWebhookProcessed as gQ, markWarmLeaseInstanceLost as gR, mcpServerIdForCapability as gS, moveQueuedTurnInTransaction as gT, mutateSessionControlInTransaction as gU, mutateWorkspaceControlInTransaction as gV, nextSessionHistoryPosition as gW, normalizeBearerScheme as gX, normalizeMemoryText as gY, orphanedResultRowIndicesForRepair as gZ, peekSessionWork as g_, listPackInstallations as ga, listPendingCodexCapacityWakeTargets as gb, listPendingSessionTurns as gc, listRecordings as gd, listRegistryCatalogSurfaceKeys as ge, listRigChanges as gf, listRigVersions as gg, listRigs as gh, listSandboxes as gi, listScheduledTaskRuns as gj, listScheduledTasks as gk, listSessionEvents as gl, listSessionIdsInGroup as gm, listSessionMcpServerMetadata as gn, listSessionMcpServersForRun as go, listSessionSystemUpdatesForTurn as gp, listSessionTurns as gq, listSessions as gr, listSessionsForSubject as gs, listSocialConnections as gt, listSocialPosts as gu, listUsageEvents as gv, listVariableSets as gw, listWorkspaceControlEvents as gx, listWorkspaceEnvironments as gy, listWorkspaceMembers as gz, AgentCommandAuthorityError as h, saveComposerDraftInTransaction as h$, persistWarmSnapshot as h0, planWorkspaceCaptureGc as h1, quarantineCodexCredentialForLease as h2, reArmDrainingLease as h3, readActiveSandbox as h4, readLease as h5, readMachineMetricsLatest as h6, readMachineMetricsLatestForWorkspace as h7, readMachineMetricsSeries as h8, reapExpiredSessionListSnapshots as h9, registerWorkspacePack as hA, releaseCodexCredentialLease as hB, releaseLeaseHolder as hC, removeWorkspaceMember as hD, renameCodexAccount as hE, renderWorkspaceMemoryBlock as hF, replaceIntegrationOAuthClient as hG, requestSessionCompaction as hH, requestSessionTurnRecovery as hI, requireFile as hJ, requireScheduledTask as hK, requireSession as hL, requireSocialConnection as hM, requireWorkspace as hN, reserveSessionCommandReceipt as hO, reserveToolspaceCallForTurn as hP, resolveWorkspaceMemoryBlock as hQ, revokeApiKey as hR, revokeConnection as hS, revokeEnrollment as hT, revokeViewer as hU, rlsContextForWorkspace as hV, rlsStrategyFor as hW, sanitizeEventPayload as hX, sanitizeEventString as hY, sanitizeMemoryText as hZ, sanitizeModelPayload as h_, reapStaleLeaseHolders as ha, reapStaleLeaseHoldersGlobal as hb, reconcileCodexCapacityWait as hc, recordAuditEvent as hd, recordCodexAccountConnectors as he, recordCodexAccountUsage as hf, recordCodexAccountUsageWithWakeTargets as hg, recordCodexTokenRefresh as hh, recordConnectionTokenRefresh as hi, recordConnectionUsed as hj, recordLeaseDataPlaneUrl as hk, recordLeaseTerminalDataPlaneUrl as hl, recordPendingSessionToolCallResult as hm, recordSessionActiveCodexCredential as hn, recordSkippedContextCompaction as ho, recordStreamAcknowledgment as hp, recordStripeWebhookEvent as hq, recordUsageEvent as hr, recordWarmingSandboxCreated as hs, recoverSessionDispatch as ht, refreshOAuthConnectionCredential as hu, registerDbBinding as hv, registerInternalUpdateWakeInTransaction as hw, registerPendingSessionToolCall as hx, registerSessionTurnAttemptClaim as hy, registerSessionWorkflowWakeInTransaction as hz, type AgentInternalUpdateCommandResult as i, upsertBillingCustomer as i$, saveRunState as i0, saveWorkspaceMemory as i1, searchWorkspaceMemories as i2, sendAgentMessageInTransaction as i3, serializeEffectiveSessionControl as i4, sessionSubject as i5, sessionsWithActiveOpOnEnrollment as i6, setActiveCodexCredential as i7, setActiveSandbox as i8, setCodexCredentialExhausted as i9, steerAgentSessionInTransaction as iA, steerQueuedTurnInTransaction as iB, storeIntegrationOAuthClient as iC, submitHumanPromptInTransaction as iD, sumUsageQuantity as iE, supersedeSessionCurrentDirectionInTransaction as iF, touchEnrollmentLastSeen as iG, touchLeaseHolder as iH, updateCodexRotationSettings as iI, updateConnection as iJ, updateImportBatchCounts as iK, updateKnowledgeMemory as iL, updatePackInstallationStatus as iM, updatePtySessionActivity as iN, updateRecording as iO, updateRig as iP, updateRigChangeStatus as iQ, updateScheduledTask as iR, updateScheduledTaskRun as iS, updateSessionCommandReceiptResult as iT, updateSessionGoal as iU, updateSessionMcpServerCredentials as iV, updateSessionTitle as iW, updateVariableSet as iX, updateWorkspace as iY, updateWorkspaceEnvironment as iZ, updateWorkspaceSettings as i_, setCodexCredentialExhaustedWithWakeTargets as ia, setCodexCredentialStatus as ib, setCodexCredentialStatusById as ic, setConnectionStatus as id, setEnrollmentDisplayState as ie, setEnrollmentOpStreamState as ig, setEnrollmentWentOffline as ih, setInitialActiveCodexCredential as ii, setRlsContext as ij, setSessionCodexPin as ik, setSessionGoalLastContinuationTurn as il, setSessionGoalStatus as im, setSessionLastInputTokensForTurnAttempt as io, setSessionPin as ip, setTemporalWorkflowId as iq, setVariableSetVariable as ir, setWorkspaceDefaultRig as is, setWorkspaceEnvironmentVariable as it, settleCodexCredentialFailover as iu, settleCodexCredentialLeaseLoss as iv, settleScheduledTaskRunInTransaction as iw, settleSessionAttemptInterruptions as ix, settleSessionIdleWithParentOutbox as iy, shortMemoryId as iz, type AppendEventInput as j, upsertCapabilityCatalogItem as j0, upsertCodexSubscriptionCredential as j1, upsertGitHubInstallation as j2, upsertMachineMetricsLatest as j3, upsertRegistryCapabilityCatalogItem as j4, upsertSandboxSessionEnvelope as j5, upsertSessionGoal as j6, upsertWorkspaceModelPolicy as j7, withAccountRls as j8, withCodexCapacityMutation as j9, withCodexCredentialRefreshLock as ja, withRlsContext as jb, withWorkspaceRls as jc, withWorkspaceSubjectRls as jd, withWorkspaceUsageLock as je, workspaceCaptureAtRevision as jf, workspaceCodexSubscriptionActive as jg, type ApplyContextCompactionResult as k, type ApplySessionTurnSettlementInput as l, type ApplySessionTurnSettlementResult as m, type ArmCodexCapacityWaitResult as n, CODEX_CAPACITY_REFRESH_MIN_MS as o, CODEX_CREDENTIAL_LEASE_TTL_MS as p, provisionRoles, CODEX_ROTATION_STRATEGIES as q, type ClaimSessionWorkForAttemptInput as r, type ClaimSessionWorkForAttemptResult as s, type ClearSessionContextResult as t, type CodexAccountStatus as u, type CodexAccountUsageSnapshot as v, type CodexAuthDeps as w, type CodexCapacityAvailabilityDecision as x, type CodexCapacityMutationResult as y, type CodexCapacityResetKind as z };
4989
+ export { type CorrectWorkspaceMemoryInput as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BootstrapWorkspaceInput as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexCapacityResetKind as D, type CodexCapacitySelectionContext as E, type CodexCapacityWait as F, type CodexCapacityWaitStatus as G, type CodexCapacityWakeTarget as H, type CodexCredentialForRun as I, type CodexCredentialLeaseCandidateFilter as J, type CodexCredentialLeaseCandidateFilterResult as K, type CodexCredentialLeasePolicyScopeResolver as L, type CodexCredentialLeaseQuarantine as M, type CodexCredentialLeaseResult as N, type CodexCredentialLeaseSelection as O, type CodexCredentialLeaseSelectionContext as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialStatus as Q, type CodexCredentialTokens as R, type CodexLeaseAccountStatus as S, type CodexPinSource as T, type CodexRotationSettings as U, type CodexRotationStrategy as V, type ComposerDraftRow as W, type ConnectionBrokerDeps as X, type ConnectionCredentialForBroker as Y, ConnectionRefreshHttpError as Z, type ConsumeOAuthStateNonceInput as _, type AcceptSessionApprovalDecisionResult as a, MEMORY_BLOCK_RECORD_LIMIT as a$, type CorrectWorkspaceMemoryResult as a0, type CreateCapabilityCatalogItemInput as a1, type CreateConnectionInput as a2, type CreateDbOptions as a3, type CreateImportBatchInput as a4, type CreateKnowledgeMemoryInput as a5, type CreatePackInstallationInput as a6, type CreateScheduledTaskInput as a7, type CreateSessionGoalInput as a8, type CreateSessionMcpServerInput as a9, type GoalContinuationDecision as aA, type HostExportConsumerStatus as aB, type HostExportKind as aC, HostExportPayloadError as aD, HostMcpCredentialBindingError as aE, type HostMcpCredentialResolverContext as aF, HostMcpCredentialScopeError as aG, HumanInputResponseValidationError as aH, type IdempotentPersistenceTransactionOptions as aI, type ImportBatch as aJ, type InitializeSessionStartInput as aK, type InitializeSessionStartResult as aL, type IntegrationOAuthClientForUse as aM, type LeaseHolderKind as aN, type LeaseSnapshot as aO, type ListKnowledgeMemoryOptions as aP, type ListSessionEventPageOptions as aQ, type ListSessionEventsOptions as aR, type ListSessionsForSubjectOptions as aS, type ListSessionsOptions as aT, type LiveModalSandboxLeaseAttribution as aU, MACHINE_METRICS_SERIES_INTERVAL_MS as aV, MAX_INTERNAL_UPDATE_BATCH_BYTES as aW, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as aX, MAX_INTERNAL_UPDATE_BYTES as aY, MEMORY_ACTIVE_RECORD_CAP as aZ, MEMORY_BLOCK_KIND_ORDER as a_, type CreateSocialConnectionInput as aa, type CreateSocialPostInput as ab, type CreditBalanceByAccount as ac, type Database as ad, type DatabaseFailureCode as ae, type DbClient as af, type DeviceEnrollmentRequestRecord as ag, type DeviceEnrollmentStatus as ah, type EditQueueCommandResult as ai, type EffectiveControlBlocker as aj, type EffectiveControlResumeOption as ak, type EffectiveControlState as al, type EffectiveSessionControl as am, type EnableCapabilityInstallationInput as an, type EnabledMcpCapabilityServer as ao, type EnqueueSessionTurnInput as ap, type EnrollmentExposure as aq, type EnrollmentOs as ar, type EnrollmentRecord as as, type EnrollmentStatus as at, type ExpiredFileUploadCleanupClaim as au, type FileUploadCleanupClaimResult as av, type ForceDrainResult as aw, type FrozenTurnInitiator as ax, type GitHubInstallation as ay, type GitHubInstallationAccess as az, type AcceptSessionHumanInputResponseResult as b, type SessionCommandActor as b$, MEMORY_CORRECT_TOOL_DESCRIPTION as b0, MEMORY_KIND_SECTION_TITLES as b1, MEMORY_NEAR_DUP_COSINE_THRESHOLD as b2, MEMORY_NEAR_DUP_NEIGHBORS as b3, MEMORY_SAVE_TOOL_DESCRIPTION as b4, MEMORY_SEARCH_DEFAULT_LIMIT as b5, MEMORY_SEARCH_MAX_LIMIT as b6, MEMORY_SEARCH_TOOL_DESCRIPTION as b7, MEMORY_TEXT_MAX_CHARS as b8, MEMORY_VISIBLE_RECORD_CAP as b9, RigActiveVersionChangedError as bA, RigChangeAlreadyVerifyingError as bB, type RigChangeMonitoringSummary as bC, RigChangeTransitionError as bD, type RigVersionContentInput as bE, type RigVersionMonitoringSummary as bF, type RlsContext as bG, type RlsStrategy as bH, SESSION_ANCESTRY_LIMIT as bI, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as bJ, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as bK, SESSION_DISCOVERY_GOAL_MAX_CHARS as bL, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as bM, SESSION_EVENT_DB_PAGE_MAX_BYTES as bN, type SafeDatabaseErrorFacts as bO, SandboxImageConflictError as bP, type SandboxKind as bQ, type SandboxLeaseLiveness as bR, SandboxLeaseSupersededError as bS, type SandboxPtySessionRow as bT, type SandboxRecord as bU, SandboxRigConflictError as bV, SanitizedDatabasePersistenceCause as bW, type SaveWorkspaceMemoryInput as bX, type SaveWorkspaceMemoryResult as bY, type SessionAttemptInterruptionSettlement as bZ, type SessionCodexState as b_, type MachineMetricsRow as ba, type MachineMetricsSample as bb, type MarkWarmLeaseInstanceLostResult as bc, type MemoryBlockRecord as bd, type MemoryEmbedder as be, type MemorySanitizeResult as bf, type MeterableWarmLease as bg, type PendingSessionToolCallInput as bh, type PersistenceFailureDetails as bi, type PersistenceRetryOutcome as bj, type QueueCommandConflictCode as bk, QueueCommandConflictError as bl, type QueueCommandResult as bm, type QueuedTurnRow as bn, type ReapDrainable as bo, type ReconcileCodexCapacityWaitResult as bp, type RecoverSessionDispatchInput as bq, type RecoverSessionDispatchResult as br, type RegisterWorkspacePackInput as bs, type RegistryCapabilityCatalogItemInput as bt, type RegistryCatalogSurfaceKey as bu, type ReplaceIntegrationOAuthClientInput as bv, type RequestSessionTurnRecoveryInput as bw, type RequestSessionTurnRecoveryResult as bx, type ResolveConnectionCredentialInput as by, type ResolveConnectionCredentialResult as bz, type AccrueWarmSecondsResult as c, type WorkspaceMemorySearchInput as c$, SessionCommandIdempotencyError as c0, type SessionCommandReceiptRow as c1, SessionContextBusyError as c2, SessionControlConflictError as c3, SessionControlInvariantError as c4, type SessionControlMutationResult as c5, type SessionDiscoveryControl as c6, type SessionDiscoveryCursor as c7, type SessionDiscoveryOrderBy as c8, type SessionDiscoverySummary as c9, type SteerQueueCommandResult as cA, type StoreIntegrationOAuthClientInput as cB, type StoredIntegrationOAuthClient as cC, type StreamAcknowledgment as cD, type SubmitHumanPromptResult as cE, type ToolspaceCallReservation as cF, type TurnAttemptFenceRejectReason as cG, type UpdateConnectionInput as cH, type UpdateImportBatchCountsInput as cI, type UpdateKnowledgeMemoryInput as cJ, type UpdateScheduledTaskInput as cK, type UpdateSessionMcpServerCredentialsInput as cL, type UpdateSessionMcpServerCredentialsResult as cM, type UserLookup as cN, type VariableSetForRun as cO, WORKSPACE_MEMORY_BLOCK_EMPTY as cP, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as cQ, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as cR, type WorkspaceCaptureCommitResult as cS, type WorkspaceCaptureGcPlan as cT, type WorkspaceCaptureGcRow as cU, type WorkspaceCaptureRow as cV, type WorkspaceControlLockMode as cW, type WorkspaceControlMutationResult as cX, type WorkspaceControlRow as cY, type WorkspaceEnvironmentForRun as cZ, type WorkspaceMemoryOrigin as c_, type SessionEventPage as ca, SessionEventPersistenceError as cb, type SessionEventWriteLockInput as cc, type SessionEventWriteLocks as cd, SessionIdConflictError as ce, type SessionLineage as cf, SessionListAccessError as cg, type SessionListCursor as ch, SessionListCursorError as ci, type SessionMcpServerForRun as cj, SessionPinAccessError as ck, SessionPinVersionConflictError as cl, type SessionRecordingCodec as cm, type SessionRecordingMode as cn, type SessionRecordingRow as co, type SessionRecordingState as cp, type SessionSystemUpdateOutboxDelivery as cq, type SessionTurnAttemptOutcome as cr, type SessionTurnForExecution as cs, type SessionTurnRecordingSettlement as ct, type SessionWorkPeek as cu, type SessionWorkTrigger as cv, type SessionWorkflowWake as cw, type SetSessionCodexPinOptions as cx, type SettleCodexCredentialFailoverResult as cy, type SettleCodexCredentialLeaseLossResult as cz, type AcquireLeaseInput as d, countActiveSessionHistoryItems as d$, type WorkspaceMemorySearchMode as d0, type WorkspaceMemorySearchResult as d1, type WorkspaceModelPolicy as d2, abandonRecordingForTurnAttempt as d3, acceptSessionApprovalDecision as d4, acceptSessionHumanInputResponse as d5, accrueWarmSeconds as d6, acknowledgeHostExportBatch as d7, acquireCodexCredentialLease as d8, acquireLease as d9, buildConnectionTokenResolver as dA, buildHostConnectionTokenResolver as dB, canonicalSessionCommandHash as dC, claimExpiredFileUploadCleanup as dD, claimFileUploadCleanup as dE, claimHostExportBatch as dF, claimPendingSessionSystemUpdateOutbox as dG, claimPendingSessionWorkflowWakes as dH, claimSessionWorkForAttempt as dI, clearDurablePendingSessionToolCalls as dJ, clearEnrollmentWentOffline as dK, clearSessionContext as dL, clearSessionGoal as dM, clearedContextMarkerItem as dN, closePtySession as dO, closeSessionTurnAttemptInTransaction as dP, codexCapacityRefreshBackoffMs as dQ, commitWarmingToWarm as dR, completeExpiredFileUploadCleanup as dS, completeFileUpload as dT, completeFileUploadCleanup as dU, computeWorkspaceCaptureGcPlan as dV, confirmDrainCold as dW, consumeDeviceEnrollmentRequest as dX, consumeIntegrationOAuthStateNonce as dY, correctWorkspaceMemory as dZ, countActiveApiKeysForWorkspace as d_, activateRigVersion as da, addSessionSystemUpdate as db, addSessionSystemUpdateWithSourceMutation as dc, allAccountPermissions as dd, allWorkspacePermissions as de, appendSessionEventToSandboxGroup as df, appendSessionEvents as dg, appendSessionEventsAndUpdateSession as dh, appendSessionEventsForTurnAttempt as di, appendSessionEventsWithLockedSessionUpdate as dj, appendSessionHistoryItems as dk, applyContextCompaction as dl, applyCreditDebitUpToBalance as dm, applyCreditLedgerEntry as dn, applySessionTurnSettlement as dp, approveDeviceEnrollmentRequest as dq, areGitHubRepositoriesAllowedForWorkspace as dr, armCodexCapacityWait as ds, assertAgentCommandAuthorityInTransaction as dt, autoResumeSessionBranchInTransaction as du, beginRigChangeVerificationAttempt as dv, bindGitHubInstallationRepositories as dw, bootstrapWorkspace as dx, buildChildCompletionDigest as dy, buildCodexTokenResolver as dz, type AcquireLeaseResult as e, enableCapabilityInstallation as e$, countActiveSessionsForWorkspace as e0, countActiveSessionsUsingEnvironment as e1, countActiveSessionsUsingVariableSet as e2, countConsecutiveReactiveRotations as e3, countQueuedTurns as e4, countRigs as e5, countSandboxLeasesByLiveness as e6, countScheduledTasksForWorkspace as e7, countScheduledTasksUsingEnvironment as e8, countScheduledTasksUsingVariableSet as e9, createVariableSet as eA, createWorkspace as eB, createWorkspaceEnvironment as eC, databaseFailureCode as eD, deadLetterHostExportHead as eE, decodeSessionListCursor as eF, decryptEnvironmentValue as eG, decryptedCapabilityHeaders as eH, deleteGitHubInstallationBinding as eI, deleteRecording as eJ, deleteRig as eK, deleteRigIfNoActiveSessions as eL, deleteScheduledTask as eM, deleteSessionQueueItemInTransaction as eN, deleteVariableSet as eO, deleteVariableSetVariable as eP, deleteWorkspace as eQ, deleteWorkspaceCaptureRows as eR, deleteWorkspaceEnvironment as eS, deleteWorkspaceEnvironmentVariable as eT, deleteWorkspacePack as eU, denyDeviceEnrollmentRequest as eV, disableCapabilityInstallation as eW, disableHostExportConsumer as eX, disconnectAllCodexAccounts as eY, disconnectCodexAccount as eZ, editQueuedTurnInTransaction as e_, countSessionHistoryItems as ea, countSessionsUsingRig as eb, countVariableSets as ec, countWorkspaceEnvironments as ed, countWorkspacesForAccount as ee, createApiKey as ef, createConnection as eg, createDb as eh, createDeviceEnrollmentRequest as ei, createEnrollment as ej, createFileUpload as ek, createImportBatch as el, createKnowledgeMemory as em, createRig as en, createRigChange as eo, createRigVersion as ep, createRigVersionForChangePromotion as eq, createSandbox as er, createScheduledTask as es, createScheduledTaskRun as et, createSession as eu, createSessionGoal as ev, createSessionMcpServers as ew, createSessionWithIdempotencyKey as ex, createSocialConnection as ey, createSocialPost as ez, type ActiveSandboxPointer as f, getSessionEvent as f$, enablePackInstallation as f0, encodeSessionListCursor as f1, encryptEnvironmentValue as f2, enqueueSessionTurn as f3, enqueueSessionWorkflowWake as f4, enqueueSessionWorkflowWakeIfRunnable as f5, enqueueSessionWorkflowWakeInTransaction as f6, ensureCodexRotationSettings as f7, ensureManagedAccessForUser as f8, estimateMemoryTokens as f9, getFileUpload as fA, getHostExportConsumerStatus as fB, getHumanInputResumeForEvent as fC, getKnowledgeMemory as fD, getLatestRunState as fE, getLatestStartedSessionTurn as fF, getManagedAccount as fG, getManagedUserByEmail as fH, getMaterializedSandboxFileResources as fI, getOpenPtySession as fJ, getOrCreateSessionSystemUpdateOutbox as fK, getPackInstallation as fL, getPendingDeviceEnrollmentRequestByUserCode as fM, getPendingDeviceEnrollmentRequestByUserCodeGlobal as fN, getRecording as fO, getRig as fP, getRigByName as fQ, getRigChange as fR, getRigName as fS, getRigVersion as fT, getRigVersionById as fU, getSandbox as fV, getSandboxSessionEnvelope as fW, getScheduledTask as fX, getSession as fY, getSessionByCreateIdempotencyKey as fZ, getSessionCodexState as f_, evaluateGoalContinuation as fa, evaluateSessionControl as fb, evaluateSessionControls as fc, evaluateSessionDiscoveryControls as fd, expireSessionHumanInputRequest as fe, failHostExportBatch as ff, failWarmingToCold as fg, fetchCodexUsageForAccount as fh, finalizeEnrollmentByToken as fi, findActiveApiKeyByHash as fj, forceDrainOverLimitViewerOnlyBoxes as fk, frozenInitiatorForCommandActor as fl, getActiveSessionHistoryItems as fm, getAnySessionInGroup as fn, getBillingBalance as fo, getBillingCustomer as fp, getCapabilityCatalogItem as fq, getCapabilityInstallation as fr, getCodexCapacityWaitForSession as fs, getCodexCredentialStatus as ft, getCodexRotationSettings as fu, getComposerDraftInTransaction as fv, getConnectionMetadata as fw, getDeviceEnrollmentRequestByDeviceCode as fx, getEnrollment as fy, getFile as fz, type AddSessionSystemUpdateInput as g, listLiveModalSandboxLeaseAttributions as g$, getSessionEventByClientEventId as g0, getSessionForSubject as g1, getSessionGoal as g2, getSessionHistoryItems as g3, getSessionHumanInputRequest as g4, getSessionLineage as g5, getSessionQueueSnapshot as g6, getSessionRootId as g7, getSessionSystemUpdateOutboxByDedupeKey as g8, getSessionTurn as g9, insertPtySession as gA, insertRecording as gB, insertWorkspaceCapture as gC, interruptedToolCallResult as gD, isCodexBilledTurn as gE, isDatabasePersistenceFailure as gF, isMemoryTextTooLong as gG, isPrivateAddress as gH, isRetryablePersistenceSqlState as gI, isSessionCompactionRequested as gJ, isSessionEventPersistenceError as gK, isStripeWebhookProcessed as gL, latestWorkspaceCapture as gM, listApiKeys as gN, listCapabilityCatalogItems as gO, listCapabilityInstallations as gP, listCodexAccountStatuses as gQ, listConnectionsMetadata as gR, listCreditBalancesByAccount as gS, listDistinctRigVersionIdsInGroup as gT, listDistinctVariableSetIdsInGroup as gU, listEnabledMcpCapabilityServers as gV, listEnrollments as gW, listGitHubInstallationAccessForWorkspace as gX, listGitHubInstallationIdsForWorkspace as gY, listGitHubInstallationsForWorkspace as gZ, listKnowledgeMemories as g_, getSessionTurnForAttempt as ga, getSocialConnection as gb, getStoredCapabilityHeaderCiphertext as gc, getStreamAcknowledgment as gd, getVariableSet as ge, getVariableSetByName as gf, getVariableSetValuesForRun as gg, getWorkspace as gh, getWorkspaceControlEvent as gi, getWorkspaceDefaultRigId as gj, getWorkspaceEnvironment as gk, getWorkspaceEnvironmentByName as gl, getWorkspaceEnvironmentValuesForRun as gm, getWorkspaceGrant as gn, getWorkspaceModelPolicy as go, getWorkspacePack as gp, grantWorkspaceAccess as gq, hasCreditLedgerEntry as gr, hashMemoryText as gs, heartbeatCodexCredentialLease as gt, heartbeatCodexCredentialLeaseUntil as gu, heartbeatLeaseHolder as gv, ingestMachineMetricsSample as gw, initializeSessionStartAtomically as gx, insertFailedWorkspaceCapture as gy, insertMachineMetricsSeries as gz, type AddSessionSystemUpdateResult as h, orphanedResultRowIndicesForRepair as h$, listMeterableWarmLeases as h0, listOpenPtySessions as h1, listOutstandingSessionSystemUpdates as h2, listPackInstallations as h3, listPendingCodexCapacityWakeTargets as h4, listPendingSessionTurns as h5, listRecordings as h6, listRegistryCatalogSurfaceKeys as h7, listRigChangeMonitoringSummaries as h8, listRigChanges as h9, listWorkspacesForSubject as hA, loadCodexCredentialForRun as hB, loadConnectionCredentialForBroker as hC, loadIntegrationOAuthClient as hD, loadVariableSetForRun as hE, loadWorkspaceEnvironmentForRun as hF, lockSessionEventWriteRows as hG, lockWorkspaceInferenceControl as hH, markFileUploadFailed as hI, markSandboxFileResourcesMaterialized as hJ, markScheduledTaskRunFailedIfQueued as hK, markSessionAttemptQuiesced as hL, markSessionSystemUpdateOutboxDeliveredInTransaction as hM, markSessionSystemUpdateOutboxFailed as hN, markSessionWorkflowWakeDelivered as hO, markSessionWorkflowWakeFailed as hP, markStaleRegistryCatalogItems as hQ, markStripeWebhookProcessed as hR, markWarmLeaseInstanceLost as hS, mcpServerIdForCapability as hT, moveQueuedTurnInTransaction as hU, mutateSessionControlInTransaction as hV, mutateWorkspaceControlInTransaction as hW, nestedPostgresSqlState as hX, nextSessionHistoryPosition as hY, normalizeBearerScheme as hZ, normalizeMemoryText as h_, listRigVersionMonitoringSummaries as ha, listRigVersions as hb, listRigs as hc, listSandboxes as hd, listScheduledTaskRuns as he, listScheduledTasks as hf, listSessionDiscoverySummaries as hg, listSessionEventPage as hh, listSessionEvents as hi, listSessionHumanInputRequests as hj, listSessionIdsInGroup as hk, listSessionMcpServerMetadata as hl, listSessionMcpServersForChildInheritance as hm, listSessionMcpServersForRun as hn, listSessionSystemUpdatesForTurn as ho, listSessionTurns as hp, listSessions as hq, listSessionsForSubject as hr, listSocialConnections as hs, listSocialPosts as ht, listUsageEvents as hu, listVariableSets as hv, listWorkspaceControlEvents as hw, listWorkspaceEnvironments as hx, listWorkspaceMembers as hy, listWorkspacePacks as hz, AgentCommandAuthorityError as i, revokeApiKey as i$, peekSessionWork as i0, persistDrainSnapshot as i1, persistWarmSnapshot as i2, planWorkspaceCaptureGc as i3, projectEffectiveControlForRelatedAccess as i4, projectSessionForRelatedAccess as i5, pruneHostExportOutbox as i6, quarantineCodexCredentialForLease as i7, reArmDrainingLease as i8, readActiveSandbox as i9, recoverSessionDispatch as iA, refreshOAuthConnectionCredential as iB, registerDbBinding as iC, registerHostExportConsumer as iD, registerInternalUpdateWakeInTransaction as iE, registerPendingSessionToolCall as iF, registerSessionTurnAttemptClaim as iG, registerSessionWorkflowWakeInTransaction as iH, registerWorkspacePack as iI, releaseCodexCredentialLease as iJ, releaseLeaseHolder as iK, removeWorkspaceMember as iL, renameCodexAccount as iM, renderWorkspaceMemoryBlock as iN, replaceIntegrationOAuthClient as iO, requestSessionCompaction as iP, requestSessionTurnRecovery as iQ, requireFile as iR, requireScheduledTask as iS, requireSession as iT, requireSocialConnection as iU, requireWorkspace as iV, reserveSessionCommandReceipt as iW, reserveToolspaceCallForTurn as iX, resolveWorkspaceMemoryBlock as iY, resumeHostExportConsumer as iZ, retireHostExportConsumer as i_, readLease as ia, readMachineMetricsLatest as ib, readMachineMetricsLatestForWorkspace as ic, readMachineMetricsSeries as id, reapExpiredSessionListSnapshots as ie, reapStaleLeaseHolders as ig, reapStaleLeaseHoldersGlobal as ih, reconcileCodexCapacityWait as ii, recordAuditEvent as ij, recordCodexAccountConnectors as ik, recordCodexAccountUsage as il, recordCodexAccountUsageWithWakeTargets as im, recordCodexTokenRefresh as io, recordConnectionTokenRefresh as ip, recordConnectionUsed as iq, recordLeaseDataPlaneUrl as ir, recordLeaseTerminalDataPlaneUrl as is, recordPendingSessionToolCallResult as it, recordSessionActiveCodexCredential as iu, recordSkippedContextCompaction as iv, recordStreamAcknowledgment as iw, recordStripeWebhookEvent as ix, recordUsageEvent as iy, recordWarmingSandboxCreated as iz, type AgentInternalUpdateCommandResult as j, updateRecording as j$, revokeConnection as j0, revokeEnrollment as j1, revokeViewer as j2, rewindHostExportConsumer as j3, rlsContextForWorkspace as j4, rlsStrategyFor as j5, runIdempotentPersistenceTransaction as j6, safeDatabaseErrorFacts as j7, sanitizeEventPayload as j8, sanitizeEventString as j9, setSessionGoalStatus as jA, setSessionLastInputTokensForTurnAttempt as jB, setSessionPin as jC, setTemporalWorkflowId as jD, setVariableSetVariable as jE, setWorkspaceDefaultRig as jF, setWorkspaceEnvironmentVariable as jG, settleCodexCredentialFailover as jH, settleCodexCredentialLeaseLoss as jI, settleScheduledTaskRunInTransaction as jJ, settleSessionAttemptInterruptions as jK, settleSessionIdleWithParentOutbox as jL, shortMemoryId as jM, steerAgentSessionInTransaction as jN, steerQueuedTurnInTransaction as jO, storeIntegrationOAuthClient as jP, submitHumanPromptInTransaction as jQ, sumUsageQuantity as jR, supersedeSessionCurrentDirectionInTransaction as jS, touchEnrollmentLastSeen as jT, touchLeaseHolder as jU, updateCodexRotationSettings as jV, updateConnection as jW, updateImportBatchCounts as jX, updateKnowledgeMemory as jY, updatePackInstallationStatus as jZ, updatePtySessionActivity as j_, sanitizeMemoryText as ja, sanitizeModelPayload as jb, saveComposerDraftInTransaction as jc, saveRunState as jd, saveWorkspaceMemory as je, searchWorkspaceMemories as jf, sendAgentMessageInTransaction as jg, serializeEffectiveSessionControl as jh, sessionAuthorizationScopeFilter as ji, sessionSubject as jj, sessionTreeStatsForSessions as jk, sessionsWithActiveOpOnEnrollment as jl, setActiveCodexCredential as jm, setActiveSandbox as jn, setCodexCredentialExhausted as jo, setCodexCredentialExhaustedWithWakeTargets as jp, setCodexCredentialStatus as jq, setCodexCredentialStatusById as jr, setConnectionStatus as js, setEnrollmentDisplayState as jt, setEnrollmentOpStreamState as ju, setEnrollmentWentOffline as jv, setInitialActiveCodexCredential as jw, setRlsContext as jx, setSessionCodexPin as jy, setSessionGoalLastContinuationTurn as jz, type AppendEventInput as k, updateRig as k0, updateRigChangeStatus as k1, updateScheduledTask as k2, updateScheduledTaskRun as k3, updateSessionCommandReceiptResult as k4, updateSessionGoal as k5, updateSessionMcpServerCredentials as k6, updateSessionTitle as k7, updateVariableSet as k8, updateWorkspace as k9, updateWorkspaceEnvironment as ka, updateWorkspaceSettings as kb, upsertBillingCustomer as kc, upsertCapabilityCatalogItem as kd, upsertCodexSubscriptionCredential as ke, upsertGitHubInstallation as kf, upsertMachineMetricsLatest as kg, upsertRegistryCapabilityCatalogItem as kh, upsertSandboxSessionEnvelope as ki, upsertSessionGoal as kj, upsertWorkspaceModelPolicy as kk, validateHumanInputResponse as kl, withAccountRls as km, withCodexCapacityMutation as kn, withCodexCredentialRefreshLock as ko, withRlsContext as kp, withWorkspaceRls as kq, withWorkspaceSubjectRls as kr, withWorkspaceUsageLock as ks, workspaceCaptureAtRevision as kt, workspaceCodexSubscriptionActive as ku, type ApplyContextCompactionResult as l, type ApplySessionTurnSettlementInput as m, type ApplySessionTurnSettlementResult as n, type ArmCodexCapacityWaitResult as o, CODEX_CAPACITY_REFRESH_MIN_MS as p, provisionRoles, CODEX_CREDENTIAL_LEASE_TTL_MS as q, CODEX_ROTATION_STRATEGIES as r, type ClaimSessionWorkForAttemptInput as s, type ClaimSessionWorkForAttemptResult as t, type ClearSessionContextResult as u, type CodexAccountStatus as v, type CodexAccountUsageSnapshot as w, type CodexAuthDeps as x, type CodexCapacityAvailabilityDecision as y, type CodexCapacityMutationResult as z };