@opengeni/db 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/chunk-ELMUCYZF.js +906 -0
  2. package/dist/chunk-ELMUCYZF.js.map +1 -0
  3. package/dist/chunk-N4WTE6SB.js +4033 -0
  4. package/dist/chunk-N4WTE6SB.js.map +1 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +3594 -2059
  7. package/dist/index.js.map +1 -1
  8. package/dist/provision-roles.d.ts +472 -43
  9. package/dist/provision-roles.js +1 -1
  10. package/dist/{schema-BejThLcd.d.ts → schema-Bh1Hr7xY.d.ts} +2507 -970
  11. package/dist/schema.d.ts +1 -1
  12. package/dist/schema.js +9 -1
  13. package/drizzle/0122_codex_capacity_same_turn.sql +59 -0
  14. package/drizzle/0123_session_tool_policy_version.sql +14 -0
  15. package/drizzle/0124_session_event_duplicate_lookup.sql +4 -0
  16. package/drizzle/0125_document_drops_visibility.sql +29 -0
  17. package/drizzle/0126_document_access_constraints.sql +138 -0
  18. package/drizzle/0127_document_default_base_index.sql +5 -0
  19. package/drizzle/0128_github_installation_authority.sql +69 -0
  20. package/drizzle/0129_retained_process_reconciliation.sql +356 -0
  21. package/drizzle/0130_workspace_instruction_policies.sql +330 -0
  22. package/drizzle/0131_slack_bot_install_and_post_idempotency.sql +133 -0
  23. package/package.json +4 -3
  24. package/src/event-payload-sanitizer.ts +167 -55
  25. package/src/index.ts +1850 -264
  26. package/src/new-session-drafts.ts +127 -6
  27. package/src/provision-roles.ts +184 -2
  28. package/src/runtime-posture-cli.ts +57 -0
  29. package/src/runtime-posture.ts +770 -0
  30. package/src/schema.ts +243 -3
  31. package/src/session-control.ts +1 -0
  32. package/src/workspace-instruction-policies-schema.ts +140 -0
  33. package/src/workspace-instruction-policies.ts +624 -0
  34. package/dist/chunk-BMFDXFPA.js +0 -155
  35. package/dist/chunk-BMFDXFPA.js.map +0 -1
  36. package/dist/chunk-VUKRIBO5.js +0 -3679
  37. package/dist/chunk-VUKRIBO5.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { TurnInitiatorContext, SessionMcpApprovalPolicy, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, TurnExecutionPolicyV1, NewSessionDraftOptions, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, Session, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionToolPolicy, SessionGoalStatus, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, ConnectionMetadata, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
1
+ import { TurnInitiatorContext, SessionMcpApprovalPolicy, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, TurnExecutionPolicyV1, NewSessionDraftOptions, WorkspaceInstructionPolicyHead, WorkspaceInstructionPolicyActivationResponse, WorkspaceInstructionPolicyTarget, WorkspaceInstructionPolicyProvenanceSource, WorkspaceInstructionPolicyDraftProvenanceSource, WorkspaceInstructionPolicyRevision, WorkspaceInstructionPolicyDiffResponse, WorkspaceInstructionPolicyListQuery, WorkspaceInstructionPolicyListResponse, SecretForRedaction, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, ConnectionMetadata, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, Session, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, GitHubInstallationAuthorityKind, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionToolPolicy, SessionGoalStatus, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
2
2
  import { environmentsEncryptionKeyBytes, Settings, McpServerConnectionRef } from '@opengeni/config';
3
3
  import { refreshCodexToken, CodexRateLimitResetCreditsDetails, ResetCreditFetchFailureReason, CodexTokenSnapshot, CodexFetch, CodexUsagePayload } from '@opengeni/codex';
4
4
  import { SQL } from 'drizzle-orm';
5
5
  import { PgDatabase, PgTransactionConfig } from 'drizzle-orm/pg-core';
6
6
  import postgres from 'postgres';
7
- import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, n as newSessionDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-BejThLcd.js';
7
+ import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, n as newSessionDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-Bh1Hr7xY.js';
8
8
  import './migrate.js';
9
9
  import { FetchLike, DnsLookup } from '@opengeni/network';
10
10
 
@@ -26,7 +26,7 @@ type SessionCommandActor = {
26
26
  turnId: string;
27
27
  executionGeneration: number;
28
28
  };
29
- type SessionTurnAttemptOutcome = "completed" | "failed" | "cancelled" | "superseded" | "requires_action" | "interrupted_recoverable" | "lease_lost_recoverable" | "pre_cutover_closed";
29
+ type SessionTurnAttemptOutcome = "completed" | "failed" | "cancelled" | "superseded" | "requires_action" | "waiting_capacity" | "interrupted_recoverable" | "lease_lost_recoverable" | "pre_cutover_closed";
30
30
  type EffectiveControlBlocker = {
31
31
  kind: "session" | "workspace";
32
32
  sessionId?: string;
@@ -537,6 +537,8 @@ declare class NewSessionDraftAccessError extends Error {
537
537
  readonly name = "NewSessionDraftAccessError";
538
538
  constructor();
539
539
  }
540
+ declare function newSessionDraftToolsProvided(row: NewSessionDraftRow): boolean;
541
+ declare function publicNewSessionDraftOptions(row: NewSessionDraftRow): NewSessionDraftOptions;
540
542
  declare function getNewSessionDraftInTransaction(db: Database, input: {
541
543
  workspaceId: string;
542
544
  subjectId: string;
@@ -550,18 +552,88 @@ declare function saveNewSessionDraftInTransaction(db: Database, input: {
550
552
  text: string;
551
553
  resources: ResourceRef[];
552
554
  tools: ToolRef[];
555
+ toolsProvided: boolean;
553
556
  model: string;
554
557
  reasoningEffort: ReasoningEffort;
555
558
  options: NewSessionDraftOptions;
556
559
  /** API-key and delegated service subjects have no workspace-membership row. */
557
560
  requireWorkspaceMembership?: boolean;
558
561
  }): Promise<NewSessionDraftRow>;
559
- /** Delete only the submitted revision; a newer sibling-tab revision survives. */
560
- declare function consumeNewSessionDraftInTransaction(db: Database, input: {
562
+ /**
563
+ * Replace one exact accepted draft with the next-create safe seed. The row is
564
+ * locked before the revision check so a concurrent save either commits first
565
+ * and wins (this returns false), or observes the incremented seed revision and
566
+ * reports a typed OCC conflict. A missing row is an idempotent no-op.
567
+ */
568
+ declare function seedNewSessionDraftInTransaction(db: Database, input: {
561
569
  workspaceId: string;
562
570
  subjectId: string;
563
571
  expectedRevision: number;
564
572
  }): Promise<boolean>;
573
+ /** @deprecated Kept as a compatibility name for low-level callers. */
574
+ declare const consumeNewSessionDraftInTransaction: typeof seedNewSessionDraftInTransaction;
575
+
576
+ type DraftInput = WorkspaceInstructionPolicyTarget & {
577
+ accountId: string;
578
+ workspaceId: string;
579
+ content: string;
580
+ provenanceSource: WorkspaceInstructionPolicyProvenanceSource;
581
+ provenanceSourceId: string | null;
582
+ supersedesRevisionId: string | null;
583
+ createdBySubjectId: string;
584
+ };
585
+ type CallerDraftInput = Omit<DraftInput, "provenanceSource"> & {
586
+ provenanceSource: WorkspaceInstructionPolicyDraftProvenanceSource;
587
+ };
588
+ declare class WorkspaceInstructionPolicyConflictError extends Error {
589
+ readonly currentHead: WorkspaceInstructionPolicyHead | null;
590
+ readonly name = "WorkspaceInstructionPolicyConflictError";
591
+ readonly code = "WORKSPACE_INSTRUCTION_POLICY_CONFLICT";
592
+ constructor(currentHead: WorkspaceInstructionPolicyHead | null);
593
+ }
594
+ declare class WorkspaceInstructionPolicyNotFoundError extends Error {
595
+ readonly name = "WorkspaceInstructionPolicyNotFoundError";
596
+ constructor(message?: string);
597
+ }
598
+ declare class WorkspaceInstructionPolicyInvalidOperationError extends Error {
599
+ readonly name = "WorkspaceInstructionPolicyInvalidOperationError";
600
+ }
601
+ declare class WorkspaceInstructionPolicyLegacyUnavailableError extends Error {
602
+ readonly name = "WorkspaceInstructionPolicyLegacyUnavailableError";
603
+ constructor();
604
+ }
605
+ declare function createWorkspaceInstructionPolicyDraft(db: Database, input: CallerDraftInput): Promise<WorkspaceInstructionPolicyRevision>;
606
+ /** Import only the stored legacy override; never materialize a deployment default or activate it. */
607
+ declare function importLegacyWorkspaceInstructionPolicyDraft(db: Database, input: {
608
+ accountId: string;
609
+ workspaceId: string;
610
+ createdBySubjectId: string;
611
+ supersedesRevisionId: string | null;
612
+ }): Promise<WorkspaceInstructionPolicyRevision>;
613
+ declare function listWorkspaceInstructionPolicyRevisions(db: Database, workspaceId: string, query: WorkspaceInstructionPolicyListQuery): Promise<WorkspaceInstructionPolicyListResponse>;
614
+ declare function getWorkspaceInstructionPolicyRevision(db: Database, workspaceId: string, revisionId: string): Promise<WorkspaceInstructionPolicyRevision>;
615
+ /** Deterministic, dependency-free unified line diff; large inputs degrade to a full replacement. */
616
+ declare function diffWorkspaceInstructionPolicyContent(from: WorkspaceInstructionPolicyRevision, to: WorkspaceInstructionPolicyRevision): string;
617
+ declare function diffWorkspaceInstructionPolicyRevisions(db: Database, workspaceId: string, input: {
618
+ fromRevisionId: string;
619
+ toRevisionId: string;
620
+ }): Promise<WorkspaceInstructionPolicyDiffResponse>;
621
+ declare function activateWorkspaceInstructionPolicyRevision(db: Database, input: {
622
+ accountId: string;
623
+ workspaceId: string;
624
+ revisionId: string;
625
+ expectedCurrentRevisionId: string | null;
626
+ actorSubjectId: string;
627
+ reason: string;
628
+ }): Promise<WorkspaceInstructionPolicyActivationResponse>;
629
+ declare function rollbackWorkspaceInstructionPolicyRevision(db: Database, input: {
630
+ accountId: string;
631
+ workspaceId: string;
632
+ targetRevisionId: string;
633
+ expectedCurrentRevisionId: string;
634
+ actorSubjectId: string;
635
+ reason: string;
636
+ }): Promise<WorkspaceInstructionPolicyActivationResponse>;
565
637
 
566
638
  /** Provider-valid result for a started call whose durable outcome is unknown. */
567
639
  declare function interruptedToolCallResult(input: {
@@ -601,18 +673,19 @@ type SanitizeEventPayloadOptions = {
601
673
  * this from a producer-controlled payload field.
602
674
  */
603
675
  fullEvidence?: unknown;
676
+ /** Exact runtime credential provenance to remove from keys and values. */
677
+ knownSecrets?: readonly SecretForRedaction[];
604
678
  };
605
679
  declare function sanitizeEventPayload<T>(payload: T, options?: SanitizeEventPayloadOptions): T;
606
680
  /**
607
- * Make model-facing conversation data safe for Postgres without redacting it.
681
+ * Make model-facing conversation data safe for Postgres and secret-redacted.
608
682
  *
609
- * Session events are an audit/UI projection and deliberately redact fields such
610
- * as `token` and `authorization`. Conversation history is the replay source for
611
- * the model, so applying event redaction there silently changes tool arguments
612
- * and can make recovery diverge from the call that actually ran. This walker
613
- * performs only the database-safety repair (NUL removal and UTF-16 repair).
683
+ * Conversation history is the replay source for the model, so this boundary
684
+ * retains protocol structure and non-sensitive diagnostics while removing
685
+ * credential-bearing fields and text before durable storage. It also performs
686
+ * the database-safety repair (NUL removal and UTF-16 repair).
614
687
  */
615
- declare function sanitizeModelPayload<T>(payload: T): T;
688
+ declare function sanitizeModelPayload<T>(payload: T, knownSecrets?: readonly SecretForRedaction[]): T;
616
689
 
617
690
  type DatabaseFailureCode = "db_deadlock" | "db_serialization_failure" | "db_failure";
618
691
  type PersistenceRetryOutcome = "not_retryable" | "exhausted";
@@ -684,6 +757,108 @@ type IdempotentPersistenceTransactionOptions = {
684
757
  */
685
758
  declare function runIdempotentPersistenceTransaction<T>(options: IdempotentPersistenceTransactionOptions, transaction: (attempt: number) => Promise<T>): Promise<T>;
686
759
 
760
+ /**
761
+ * The complete standalone tenant-table contract. Adding or removing a
762
+ * FORCE-RLS table is an architectural change: update this list in the same
763
+ * commit as the migration so startup cannot silently accept an unreviewed gap.
764
+ */
765
+ declare const FORCE_RLS_TABLES: readonly ["agent_run_states", "api_keys", "audit_events", "billing_customers", "capability_catalog_items", "capability_installations", "codex_capacity_waiters", "codex_credential_leases", "codex_reset_redemption_attempts", "codex_rotation_settings", "codex_subscription_credentials", "composer_drafts", "connections", "credit_ledger_entries", "device_enrollment_requests", "document_bases", "document_chunks", "documents", "enrollments", "file_uploads", "files", "github_installation_repositories", "github_installations", "host_export_config", "host_export_consumers", "host_export_cursor_state", "host_export_dead_letters", "host_export_outbox", "import_batches", "integration_oauth_state_nonces", "knowledge_memories", "machine_metrics_latest", "machine_metrics_series", "new_session_drafts", "pack_installations", "rig_changes", "rig_versions", "rigs", "sandbox_lease_holders", "sandbox_leases", "sandbox_pty_sessions", "sandbox_retained_processes", "sandbox_session_envelopes", "sandbox_workspace_mutation_admissions", "sandboxes", "scheduled_task_runs", "scheduled_tasks", "session_attempt_interruptions", "session_command_receipts", "session_events", "session_goals", "session_history_items", "session_human_input_requests", "session_list_snapshots", "session_mcp_servers", "session_pending_tool_calls", "session_pins", "session_recordings", "session_spawn_denials", "session_stream_acknowledgments", "session_system_update_outbox", "session_system_updates", "session_turn_attempts", "session_turns", "session_workflow_wake_outbox", "sessions", "slack_bot_post_operations", "social_connections", "social_posts", "usage_events", "workspace_captures", "workspace_control_events", "workspace_inference_controls", "workspace_instruction_policy_activation_events", "workspace_instruction_policy_heads", "workspace_instruction_policy_revisions", "workspace_model_policies", "workspace_packs", "workspace_session_activity_revisions", "workspace_variable_set_variables", "workspace_variable_sets"];
766
+ /**
767
+ * Deployment-global and authentication tables used by ordinary API/worker
768
+ * traffic. They intentionally do not carry workspace RLS: their access model
769
+ * is implemented by the authentication/access layer or by exact global keys.
770
+ */
771
+ declare const NON_RLS_RUNTIME_TABLES: readonly ["auth_identities", "auth_rate_limits", "auth_sessions", "auth_users", "auth_verifications", "integration_oauth_clients", "managed_accounts", "nested_agent_depth_configuration", "stripe_webhook_events", "workspace_memberships", "workspaces"];
772
+ /**
773
+ * Exact full-CRUD class for the standalone runtime role. This is deliberately
774
+ * explicit instead of being derived from FORCE_RLS_TABLES: adding a protected
775
+ * table must not silently grant it broader DML than its migration intended.
776
+ */
777
+ declare const RUNTIME_FULL_DML_TABLES: readonly ["agent_run_states", "api_keys", "audit_events", "auth_identities", "auth_rate_limits", "auth_sessions", "auth_users", "auth_verifications", "billing_customers", "capability_catalog_items", "capability_installations", "codex_capacity_waiters", "codex_credential_leases", "codex_reset_redemption_attempts", "codex_rotation_settings", "codex_subscription_credentials", "composer_drafts", "connections", "credit_ledger_entries", "device_enrollment_requests", "document_bases", "document_chunks", "documents", "enrollments", "file_uploads", "files", "github_installation_repositories", "github_installations", "import_batches", "integration_oauth_clients", "integration_oauth_state_nonces", "knowledge_memories", "machine_metrics_latest", "machine_metrics_series", "managed_accounts", "new_session_drafts", "pack_installations", "rig_changes", "rig_versions", "rigs", "sandbox_lease_holders", "sandbox_leases", "sandbox_pty_sessions", "sandbox_retained_processes", "sandbox_session_envelopes", "sandbox_workspace_mutation_admissions", "sandboxes", "scheduled_task_runs", "scheduled_tasks", "session_attempt_interruptions", "session_command_receipts", "session_events", "session_goals", "session_history_items", "session_human_input_requests", "session_list_snapshots", "session_mcp_servers", "session_pending_tool_calls", "session_pins", "session_recordings", "session_stream_acknowledgments", "session_system_update_outbox", "session_system_updates", "session_turn_attempts", "session_turns", "session_workflow_wake_outbox", "sessions", "slack_bot_post_operations", "social_connections", "social_posts", "stripe_webhook_events", "usage_events", "workspace_captures", "workspace_control_events", "workspace_inference_controls", "workspace_instruction_policy_heads", "workspace_memberships", "workspace_model_policies", "workspace_packs", "workspace_session_activity_revisions", "workspace_variable_set_variables", "workspace_variable_sets", "workspaces"];
778
+ /** Configuration is deployment-global and intentionally read-only at runtime. */
779
+ declare const RUNTIME_READ_ONLY_TABLES: readonly ["nested_agent_depth_configuration"];
780
+ /** Append-only evidence/revision tables are insertable and queryable, never mutable. */
781
+ declare const RUNTIME_READ_INSERT_TABLES: readonly ["session_spawn_denials", "workspace_instruction_policy_activation_events", "workspace_instruction_policy_revisions"];
782
+ /**
783
+ * These FORCE-RLS tables are owned by security-definer host-export routines.
784
+ * The ordinary application role must have no direct table privileges on them.
785
+ */
786
+ declare const PROTECTED_NO_DIRECT_DML_TABLES: readonly ["host_export_config", "host_export_consumers", "host_export_cursor_state", "host_export_dead_letters", "host_export_outbox"];
787
+ type RuntimeTableDmlPrivilege = "SELECT" | "INSERT" | "UPDATE" | "DELETE";
788
+ type RuntimeTablePrivilegeContract = Readonly<Record<string, readonly RuntimeTableDmlPrivilege[]>>;
789
+ /** Exact per-table DML contract. Absence means no direct table privileges. */
790
+ declare const RUNTIME_TABLE_PRIVILEGES: RuntimeTablePrivilegeContract;
791
+ /** All tables with any direct runtime DML; retained as the aggregate public contract. */
792
+ declare const RUNTIME_DML_TABLES: readonly string[];
793
+ type RuntimeDatabasePostureOptions = {
794
+ rlsStrategy: RlsStrategy;
795
+ expectedRole?: string;
796
+ targetSchema?: string;
797
+ protectedTables?: readonly string[];
798
+ tablePrivileges?: RuntimeTablePrivilegeContract;
799
+ protectedNoDirectDmlTables?: readonly string[];
800
+ };
801
+ type RuntimeDatabaseIdentity = {
802
+ currentUser: string;
803
+ sessionUser: string;
804
+ databaseOwner: string;
805
+ canConnectDatabase: boolean;
806
+ canCreateInDatabase: boolean;
807
+ rowSecurity: string;
808
+ canLogin: boolean;
809
+ superuser: boolean;
810
+ inherit: boolean;
811
+ createRole: boolean;
812
+ createDatabase: boolean;
813
+ replication: boolean;
814
+ bypassRls: boolean;
815
+ };
816
+ type RuntimeSchemaPosture = {
817
+ name: string;
818
+ owner: string;
819
+ usage: boolean;
820
+ create: boolean;
821
+ };
822
+ type RuntimeTablePosture = {
823
+ name: string;
824
+ owner: string;
825
+ rlsEnabled: boolean;
826
+ rlsForced: boolean;
827
+ rlsActive: boolean;
828
+ policyCount: number;
829
+ select: boolean;
830
+ insert: boolean;
831
+ update: boolean;
832
+ delete: boolean;
833
+ truncate: boolean;
834
+ references: boolean;
835
+ trigger: boolean;
836
+ };
837
+ type RuntimeRoutinePosture = {
838
+ name: string;
839
+ owner: string;
840
+ execute: boolean;
841
+ };
842
+ type RuntimeDatabasePosture = {
843
+ identity: RuntimeDatabaseIdentity;
844
+ memberships: string[];
845
+ schemas: RuntimeSchemaPosture[];
846
+ ownedSchemas: string[];
847
+ ownedRelations: string[];
848
+ tables: RuntimeTablePosture[];
849
+ privateRoutines: RuntimeRoutinePosture[];
850
+ };
851
+ declare class RuntimeDatabasePostureError extends Error {
852
+ readonly violations: readonly string[];
853
+ constructor(violations: readonly string[]);
854
+ }
855
+ /** Inspect only PostgreSQL catalogs and privilege functions; no tenant rows. */
856
+ declare function inspectRuntimeDatabasePosture(db: Database, options: RuntimeDatabasePostureOptions): Promise<RuntimeDatabasePosture>;
857
+ /** Pure deterministic evaluator used by startup/readiness and unit tests. */
858
+ declare function evaluateRuntimeDatabasePosture(posture: RuntimeDatabasePosture, options: RuntimeDatabasePostureOptions): string[];
859
+ declare function assertRuntimeDatabasePosture(db: Database, options: RuntimeDatabasePostureOptions): Promise<RuntimeDatabasePosture>;
860
+ declare function runtimeDatabaseReadyCheck(db: Database, options: RuntimeDatabasePostureOptions): () => Promise<void>;
861
+
687
862
  /** Reject writes whose sanitized text exceeds this many characters. */
688
863
  declare const MEMORY_TEXT_MAX_CHARS = 4000;
689
864
  /** Per-workspace cap on agent-visible memory records (active ∪ approved). */
@@ -932,6 +1107,12 @@ declare function refreshOAuthConnectionCredential(cred: ConnectionCredentialForB
932
1107
  }>;
933
1108
 
934
1109
  type Database = PgDatabase<any, typeof schema>;
1110
+ /** Raised when a durable session tool-policy write lost its version fence. */
1111
+ declare class SessionToolPolicyVersionConflictError extends Error {
1112
+ readonly currentVersion: number;
1113
+ readonly code = "SESSION_TOOL_POLICY_CONFLICT";
1114
+ constructor(currentVersion: number);
1115
+ }
935
1116
  type DbClient = {
936
1117
  db: Database;
937
1118
  close: () => Promise<void>;
@@ -1270,16 +1451,36 @@ type GitHubInstallation = {
1270
1451
  accountId: string;
1271
1452
  workspaceId: string;
1272
1453
  installationId: number;
1454
+ githubAccountId: number | null;
1273
1455
  accountLogin: string | null;
1274
1456
  accountType: string | null;
1275
1457
  repositoryScope: GitHubRepositoryScope;
1276
1458
  linkedBySubjectId: string | null;
1459
+ githubActorId: number | null;
1460
+ githubActorLogin: string | null;
1461
+ authorityKind: GitHubInstallationAuthorityKind | null;
1462
+ authorityCheckedAt: string | null;
1463
+ authorityExpiresAt: string | null;
1464
+ authorityNonce: string | null;
1277
1465
  createdAt: string;
1278
1466
  updatedAt: string;
1279
1467
  };
1280
1468
  type GitHubInstallationAccess = GitHubInstallation & {
1281
1469
  repositoryIds: number[];
1282
1470
  };
1471
+ declare class GitHubInstallationAuthorityCommitError extends Error {
1472
+ constructor();
1473
+ }
1474
+ /**
1475
+ * True only for a binding created by the owner-authority transaction. Legacy
1476
+ * installation rows remain visible for audit/unlink, but can never make a
1477
+ * workspace healthy, enumerate repositories, or authorize a token mint.
1478
+ *
1479
+ * `authorityExpiresAt` is the expiry of the consumed proof, not of the durable
1480
+ * delegation. A binding remains delegated after that instant; GitHub's live
1481
+ * installation/repository checks govern its ongoing usability.
1482
+ */
1483
+ declare function hasAuditableGitHubInstallationAuthority(installation: GitHubInstallationAccess): boolean;
1283
1484
  declare function upsertGitHubInstallation(db: Database, input: {
1284
1485
  accountId: string;
1285
1486
  workspaceId: string;
@@ -1297,6 +1498,22 @@ declare function bindGitHubInstallationRepositories(db: Database, input: {
1297
1498
  linkedBySubjectId: string;
1298
1499
  repositoryIds: number[];
1299
1500
  }): Promise<GitHubInstallationAccess>;
1501
+ declare function bindAuthorizedGitHubInstallationRepositories(db: Database, input: {
1502
+ accountId: string;
1503
+ workspaceId: string;
1504
+ installationId: number;
1505
+ githubAccountId: number;
1506
+ accountLogin: string | null;
1507
+ accountType: string | null;
1508
+ linkedBySubjectId: string;
1509
+ githubActorId: number;
1510
+ githubActorLogin: string;
1511
+ authorityKind: GitHubInstallationAuthorityKind;
1512
+ authorityCheckedAt: Date;
1513
+ authorityExpiresAt: Date;
1514
+ authorityNonce: string;
1515
+ repositoryIds: number[];
1516
+ }): Promise<GitHubInstallationAccess | null>;
1300
1517
  declare function listGitHubInstallationsForWorkspace(db: Database, workspaceId: string): Promise<GitHubInstallation[]>;
1301
1518
  declare function listGitHubInstallationIdsForWorkspace(db: Database, workspaceId: string): Promise<number[]>;
1302
1519
  declare function listGitHubInstallationAccessForWorkspace(db: Database, workspaceId: string): Promise<GitHubInstallationAccess[]>;
@@ -1505,6 +1722,8 @@ type CreateConnectionInput = {
1505
1722
  credentialEncrypted: string;
1506
1723
  grantedScopes?: string[];
1507
1724
  expiresAt?: Date | null;
1725
+ verifiedInstallAt?: Date | null;
1726
+ verifiedInstallVersion?: number | null;
1508
1727
  metadata?: Record<string, unknown>;
1509
1728
  createdBySubjectId?: string | null;
1510
1729
  updatedBySubjectId?: string | null;
@@ -1521,9 +1740,37 @@ type UpdateConnectionInput = {
1521
1740
  credentialEncrypted?: string;
1522
1741
  grantedScopes?: string[];
1523
1742
  expiresAt?: Date | null;
1743
+ verifiedInstallAt?: Date | null;
1744
+ verifiedInstallVersion?: number | null;
1524
1745
  metadata?: Record<string, unknown>;
1525
1746
  updatedBySubjectId?: string | null;
1526
1747
  };
1748
+ /** Server-owned verification facts; public schemas expose them read-only and nullable. */
1749
+ type ConnectionMetadataWithVerification = ConnectionMetadata & {
1750
+ verifiedInstallAt: string | null;
1751
+ verifiedInstallVersion: number | null;
1752
+ };
1753
+ type SlackBotPostOperation = {
1754
+ id: string;
1755
+ accountId: string;
1756
+ workspaceId: string;
1757
+ connectionId: string;
1758
+ operationId: string;
1759
+ clientMessageId: string;
1760
+ targetKind: "channel" | "user";
1761
+ targetId: string;
1762
+ requestDigest: string;
1763
+ status: "provider_started" | "completed";
1764
+ claimHolderId: string | null;
1765
+ claimExpiresAt: Date | null;
1766
+ attemptCount: number;
1767
+ lastFailureCode: string | null;
1768
+ slackChannelId: string | null;
1769
+ slackMessageTimestamp: string | null;
1770
+ completedAt: Date | null;
1771
+ createdAt: Date;
1772
+ updatedAt: Date;
1773
+ };
1527
1774
  type ConnectionCredentialForBroker = {
1528
1775
  id: string;
1529
1776
  accountId: string;
@@ -1870,11 +2117,62 @@ declare function decryptedCapabilityHeaders(server: EnabledMcpCapabilityServer,
1870
2117
  */
1871
2118
  declare function getStoredCapabilityHeaderCiphertext(db: Database, workspaceId: string, capabilityId: string): Promise<Record<string, string> | null>;
1872
2119
  declare function mcpServerIdForCapability(capabilityId: string, metadata?: Record<string, unknown>): string;
1873
- declare function createConnection(db: Database, input: CreateConnectionInput): Promise<ConnectionMetadata>;
1874
- declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadata[]>;
1875
- declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadata | null>;
1876
- declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadata | null>;
1877
- declare function revokeConnection(db: Database, workspaceId: string, connectionId: string, updatedBySubjectId?: string | null): Promise<ConnectionMetadata | null>;
2120
+ declare function createConnection(db: Database, input: CreateConnectionInput): Promise<ConnectionMetadataWithVerification>;
2121
+ declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
2122
+ declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
2123
+ declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
2124
+ declare function revokeConnection(db: Database, workspaceId: string, connectionId: string, updatedBySubjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
2125
+ type ClaimSlackBotPostOperationResult = {
2126
+ kind: "claimed" | "in_progress" | "completed";
2127
+ operation: SlackBotPostOperation;
2128
+ } | {
2129
+ kind: "conflict" | "connection_not_found";
2130
+ };
2131
+ /**
2132
+ * Claims one durable Slack post identity. The insert occurs before any provider
2133
+ * call; retries retain the original client_msg_id and immutable request digest.
2134
+ * A live claim suppresses concurrent sends, while a released/expired claim can
2135
+ * be reclaimed after response loss or process death.
2136
+ */
2137
+ declare function claimSlackBotPostOperation(db: Database, input: {
2138
+ accountId: string;
2139
+ workspaceId: string;
2140
+ connectionId: string;
2141
+ operationId: string;
2142
+ targetKind: "channel" | "user";
2143
+ targetId: string;
2144
+ requestDigest: string;
2145
+ claimHolderId: string;
2146
+ claimLeaseMs: number;
2147
+ }): Promise<ClaimSlackBotPostOperationResult>;
2148
+ declare function releaseSlackBotPostOperationClaim(db: Database, input: {
2149
+ accountId: string;
2150
+ workspaceId: string;
2151
+ connectionId: string;
2152
+ operationId: string;
2153
+ claimHolderId: string;
2154
+ failureCode: string;
2155
+ }): Promise<boolean>;
2156
+ type CompleteSlackBotPostOperationResult = {
2157
+ kind: "completed";
2158
+ operation: SlackBotPostOperation;
2159
+ newlyCompleted: boolean;
2160
+ } | {
2161
+ kind: "not_found" | "not_owned";
2162
+ };
2163
+ /** Completion and the single success audit receipt commit atomically. */
2164
+ declare function completeSlackBotPostOperation(db: Database, input: {
2165
+ accountId: string;
2166
+ workspaceId: string;
2167
+ connectionId: string;
2168
+ operationId: string;
2169
+ claimHolderId: string;
2170
+ slackChannelId: string;
2171
+ slackMessageTimestamp: string;
2172
+ subjectId?: string | null;
2173
+ auditMetadata: Record<string, unknown>;
2174
+ }): Promise<CompleteSlackBotPostOperationResult>;
2175
+ declare function getSlackBotPostOperation(db: Database, workspaceId: string, connectionId: string, operationId: string): Promise<SlackBotPostOperation | null>;
1878
2176
  declare function loadConnectionCredentialForBroker(db: Database, settings: Settings, input: {
1879
2177
  workspaceId: string;
1880
2178
  connectionId?: string;
@@ -2542,12 +2840,13 @@ type CodexCapacityWait = {
2542
2840
  accountId: string;
2543
2841
  workspaceId: string;
2544
2842
  sessionId: string;
2545
- goalId: string;
2843
+ goalId: string | null;
2546
2844
  blockedTurnId: string;
2845
+ blockedTurnGeneration: number;
2547
2846
  workflowId: string;
2548
2847
  generation: number;
2549
2848
  status: CodexCapacityWaitStatus;
2550
- goalVersion: number;
2849
+ goalVersion: number | null;
2551
2850
  policyHash: string | null;
2552
2851
  earliestResetAt: Date | null;
2553
2852
  nextCheckAt: Date;
@@ -2607,7 +2906,10 @@ type ReconcileCodexCapacityWaitResult = {
2607
2906
  } | {
2608
2907
  action: "resumed";
2609
2908
  waiter: CodexCapacityWait;
2610
- update: SessionSystemUpdate;
2909
+ events: SessionEvent[];
2910
+ } | {
2911
+ action: "paused";
2912
+ waiter: CodexCapacityWait;
2611
2913
  events: SessionEvent[];
2612
2914
  } | {
2613
2915
  action: "superseded";
@@ -2627,14 +2929,13 @@ declare const CODEX_CAPACITY_REFRESH_MAX_MS: number;
2627
2929
  */
2628
2930
  declare function codexCapacityRefreshBackoffMs(attempt: number): number;
2629
2931
  /**
2630
- * Atomically settle one all-unavailable turn and arm exactly one durable wait.
2631
- * Lock order is allocator rotation row -> workspace control -> actual workspace
2632
- * -> session -> exact turn -> exact attempt -> goal -> live lease (when a
2633
- * reactive failure owns one) -> waiter. The control share lock and effective
2634
- * control recheck prevent a capacity boundary from closing an attempt after a
2635
- * committed Pause. The failed turn, idle/capacity-paused session, durable
2636
- * events, lease release, and waiter generation commit together; a crash cannot
2637
- * leave only half of the boundary visible.
2932
+ * Atomically close one all-unavailable attempt and arm exactly one durable wait
2933
+ * for the same logical turn. Lock order is allocator rotation row -> workspace
2934
+ * control -> actual workspace -> session -> exact turn -> exact attempt ->
2935
+ * optional goal -> live lease (when a reactive failure owns one) -> waiter.
2936
+ * The waiting turn/session pointer, durable events, exact lease release, and
2937
+ * waiter generation commit together; a crash cannot leave only half of the
2938
+ * boundary visible.
2638
2939
  */
2639
2940
  declare function armCodexCapacityWait(db: Database, input: {
2640
2941
  accountId: string;
@@ -2643,8 +2944,8 @@ declare function armCodexCapacityWait(db: Database, input: {
2643
2944
  turnId: string;
2644
2945
  attemptId: string;
2645
2946
  workflowId: string;
2646
- goalId: string;
2647
- goalVersion: number;
2947
+ goalId?: string | null;
2948
+ goalVersion?: number | null;
2648
2949
  policyHash?: string | null;
2649
2950
  earliestResetAt: Date | null;
2650
2951
  resetKind: CodexCapacityResetKind;
@@ -2660,8 +2961,8 @@ declare function armCodexCapacityWait(db: Database, input: {
2660
2961
  }): Promise<ArmCodexCapacityWaitResult>;
2661
2962
  declare function getCodexCapacityWaitForSession(db: Database, workspaceId: string, sessionId: string): Promise<CodexCapacityWait | null>;
2662
2963
  /**
2663
- * Same-transaction capacity-mutation/outbox seam for account eligibility and
2664
- * policy-scope membership/default changes. The allocator rotation row is always the
2964
+ * Same-transaction capacity-mutation/outbox seam for eligibility and
2965
+ * membership/default changes. The allocator rotation row is always the
2665
2966
  * first lock. Mutations report whether capacity truth changed; only then are
2666
2967
  * matching waiter wake revisions advanced and returned for best-effort signal.
2667
2968
  */
@@ -2677,10 +2978,11 @@ declare function listPendingCodexCapacityWakeTargets(db: Database, workspaceId:
2677
2978
  /**
2678
2979
  * Row-lock and re-evaluate one waiter. Availability is decided by a pure
2679
2980
  * caller supplied policy over the same rotation-row transaction as normal
2680
- * acquisition. If available, one system goal-continuation event and one turn
2681
- * are committed; duplicate timers/signals observe status=resumed and do no
2682
- * work. If any goal/control/policy/turn/queue fence changed, the waiter is
2683
- * superseded without inference.
2981
+ * acquisition. If available, the exact blocked turn becomes `recovering`;
2982
+ * duplicate timers/signals observe status=resumed and do no work. Effective
2983
+ * Pause leaves the waiter untouched, ordinary queued prompts remain behind the
2984
+ * current inference, and only an explicit semantic fence change supersedes the
2985
+ * waiter/blocked turn without inference.
2684
2986
  */
2685
2987
  declare function reconcileCodexCapacityWait<TPolicyScope = never, TUnavailableDiagnostic = never>(db: Database, input: {
2686
2988
  accountId: string;
@@ -4249,9 +4551,16 @@ declare function recordWarmingSandboxCreated(db: Database, input: {
4249
4551
  recorded: boolean;
4250
4552
  lease: LeaseSnapshot | null;
4251
4553
  }>;
4554
+ type LostProviderWorkspaceSettlement = {
4555
+ processesLost: number;
4556
+ admissionsRejected: number;
4557
+ ptysClosed: number;
4558
+ processHoldersDeleted: number;
4559
+ };
4252
4560
  type MarkWarmLeaseInstanceLostResult = {
4253
4561
  status: "marked";
4254
4562
  lease: LeaseSnapshot;
4563
+ settlement: LostProviderWorkspaceSettlement;
4255
4564
  } | {
4256
4565
  status: "stale";
4257
4566
  lease: LeaseSnapshot | null;
@@ -4263,10 +4572,11 @@ type MarkWarmLeaseInstanceLostResult = {
4263
4572
  * box, but only the first one transitions the lease to cold and advances its
4264
4573
  * epoch. The next ordinary acquire elects one cold->warming spawner.
4265
4574
  *
4266
- * Holders remain intact because their logical work/viewer interest still exists.
4267
- * Only live provider identity is cleared. A persisted workspace archive is
4268
- * reduced to the same minimal cold envelope used by the drain/failure paths, so
4269
- * the elected replacement can hydrate it without carrying the dead box id.
4575
+ * Logical turn/viewer interest remains intact, while holders for active
4576
+ * processes that physically belonged to the lost provider are removed with
4577
+ * their terminal loss proof. A persisted workspace archive is reduced to the
4578
+ * same minimal cold envelope used by the drain/failure paths, so the elected
4579
+ * replacement can hydrate it without carrying the dead box id.
4270
4580
  */
4271
4581
  declare function markWarmLeaseInstanceLost(db: Database, input: {
4272
4582
  accountId: string;
@@ -4277,6 +4587,33 @@ declare function markWarmLeaseInstanceLost(db: Database, input: {
4277
4587
  /** Bounded classifier output only; never raw provider error text. */
4278
4588
  diagnostic?: string;
4279
4589
  }): Promise<MarkWarmLeaseInstanceLostResult>;
4590
+ type ReconcileColdLostLeaseInstanceBlockersResult = {
4591
+ status: "reconciled";
4592
+ lease: LeaseSnapshot;
4593
+ settlement: LostProviderWorkspaceSettlement;
4594
+ } | {
4595
+ status: "stale";
4596
+ lease: LeaseSnapshot | null;
4597
+ };
4598
+ /**
4599
+ * Settle blockers left by a provider-loss transition that predates exact loss
4600
+ * cleanup. This is deliberately narrower than markWarmLeaseInstanceLost: it
4601
+ * requires the already-cold lease to match the full operator-observed
4602
+ * generation/archive tuple, the current epoch to be exactly lostEpoch + 1, and
4603
+ * recovery truth to name the same missing provider. It never advances an epoch,
4604
+ * rematerializes a provider, or changes archive/recovery completeness.
4605
+ */
4606
+ declare function reconcileColdLostLeaseInstanceBlockers(db: Database, input: {
4607
+ accountId: string;
4608
+ workspaceId: string;
4609
+ sandboxGroupId: string;
4610
+ expectedCurrentEpoch: number;
4611
+ expectedLostEpoch: number;
4612
+ expectedLostInstanceId: string;
4613
+ expectedWorkspaceGeneration: number;
4614
+ expectedArchiveGeneration: number | null;
4615
+ expectedArchiveComplete: boolean;
4616
+ }): Promise<ReconcileColdLostLeaseInstanceBlockersResult>;
4280
4617
  declare function failWarmingToCold(db: Database, input: {
4281
4618
  accountId: string;
4282
4619
  workspaceId: string;
@@ -4385,7 +4722,7 @@ declare function confirmDrainCold(db: Database, input: {
4385
4722
  }>;
4386
4723
  declare class SandboxWorkspaceMutationFencedError extends Error {
4387
4724
  readonly code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted";
4388
- readonly name = "SandboxWorkspaceMutationFencedError";
4725
+ readonly name: string;
4389
4726
  constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted", message: string);
4390
4727
  }
4391
4728
  type SandboxWorkspaceMutationAdmission = {
@@ -4433,7 +4770,53 @@ type SandboxRetainedProcess = {
4433
4770
  settlementReason: string | null;
4434
4771
  startedAt: string;
4435
4772
  settledAt: string | null;
4773
+ reconcileAfter: string;
4774
+ reconcileClaimId: string | null;
4775
+ reconcileClaimedAt: string | null;
4776
+ reconcileAttempts: number;
4777
+ lastReconcileOutcome: string | null;
4778
+ reconcileProofOutcome: "exited" | "lost" | null;
4779
+ reconcileProofExitCode: number | null;
4780
+ reconcileProofReason: "provider_exit_banner" | "provider_session_lost_banner" | "provider_instance_not_found" | null;
4781
+ reconcileProofObservedAt: string | null;
4782
+ };
4783
+ type RetainedProcessProviderProof = {
4784
+ outcome: "exited";
4785
+ exitCode: number;
4786
+ reason: "provider_exit_banner";
4787
+ } | {
4788
+ outcome: "lost";
4789
+ exitCode: null;
4790
+ reason: "provider_session_lost_banner" | "provider_instance_not_found";
4791
+ };
4792
+ type SandboxRetainedProcessIdentity = Pick<SandboxRetainedProcess, "leaseId" | "sandboxGroupId" | "parentAdmissionId" | "holderId" | "leaseEpoch" | "providerBackend" | "providerInstanceId" | "routeKind" | "routeTargetId" | "routeEpoch" | "providerSessionId">;
4793
+ type SandboxRetainedProcessReconciliationClaim = {
4794
+ process: SandboxRetainedProcess;
4795
+ claimId: string;
4796
+ ownerState: string;
4797
+ ownerAttemptOutcome: string | null;
4798
+ };
4799
+ type ActiveRetainedProcessOwnerCount = {
4800
+ ownerState: string;
4801
+ activeCount: number;
4802
+ terminalOwnerCount: number;
4803
+ };
4804
+ type ExpiredDrainingSandboxLeaseCount = {
4805
+ backend: string;
4806
+ ageBucket: "lt_5m" | "5m_1h" | "1h_1d" | "gte_1d";
4807
+ count: number;
4436
4808
  };
4809
+ declare function retainedProcessSettlementIdentity(process: SandboxRetainedProcess): SandboxRetainedProcessIdentity;
4810
+ declare function retainedProcessReconciliationProof(process: SandboxRetainedProcess): RetainedProcessProviderProof | null;
4811
+ /** Durable promotion committed before a mutable route/turn authority check
4812
+ * rejected the provider output. The process identity is safe to hand to the
4813
+ * exact-backend cancellation path; callers must still reject the output and
4814
+ * must never replay the provider mutation. */
4815
+ declare class SandboxRetainedProcessPromotionFencedError extends SandboxWorkspaceMutationFencedError {
4816
+ readonly process: SandboxRetainedProcess;
4817
+ readonly name = "SandboxRetainedProcessPromotionFencedError";
4818
+ constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced", message: string, process: SandboxRetainedProcess);
4819
+ }
4437
4820
  /**
4438
4821
  * Advance the live workspace's mutation generation before an acknowledged
4439
4822
  * filesystem-writing operation reaches the provider. The normal activity write
@@ -4576,6 +4959,44 @@ declare function getRetainedProcess(db: Database, input: {
4576
4959
  sessionId: string;
4577
4960
  processId: string;
4578
4961
  }): Promise<SandboxRetainedProcess | null>;
4962
+ /** Claim a bounded, oldest-due batch of active retained processes whose exact
4963
+ * owner attempt is closed (or whose direct request already returned). Claim
4964
+ * expiry only recovers coordination after worker death; it is never provider
4965
+ * exit proof. Rows that settle between the global claim and scoped read are
4966
+ * deliberately omitted. */
4967
+ declare function claimTerminalRetainedProcesses(db: Database, input: {
4968
+ claimId: string;
4969
+ limit: number;
4970
+ claimTtlMs: number;
4971
+ }): Promise<SandboxRetainedProcessReconciliationClaim[]>;
4972
+ /** Durably checkpoint exact provider exit/loss proof before canonical
4973
+ * settlement. This closes the worker-death window between provider observation
4974
+ * and settlement without converting owner state, age, timeout, or claim expiry
4975
+ * into physical proof. */
4976
+ declare function recordRetainedProcessReconciliationProof(db: Database, input: {
4977
+ accountId: string;
4978
+ workspaceId: string;
4979
+ sessionId: string;
4980
+ processId: string;
4981
+ expected: SandboxRetainedProcessIdentity;
4982
+ claimId: string;
4983
+ proof: RetainedProcessProviderProof;
4984
+ }): Promise<SandboxRetainedProcess>;
4985
+ /** Release one exact reconciliation claim after an ambiguous/running provider
4986
+ * observation. This schedules a bounded retry but never changes process,
4987
+ * admission, holder, lease, archive, snapshot, or workspace state. */
4988
+ declare function deferRetainedProcessReconciliation(db: Database, input: {
4989
+ accountId: string;
4990
+ workspaceId: string;
4991
+ sessionId: string;
4992
+ processId: string;
4993
+ expected: SandboxRetainedProcessIdentity;
4994
+ claimId: string;
4995
+ outcome: string;
4996
+ retryAfterMs: number;
4997
+ }): Promise<boolean>;
4998
+ declare function countActiveRetainedProcessesByOwnerState(db: Database): Promise<ActiveRetainedProcessOwnerCount[]>;
4999
+ declare function countExpiredDrainingSandboxLeases(db: Database): Promise<ExpiredDrainingSandboxLeaseCount[]>;
4579
5000
  /** Settle an exact retained process only after exit or definitive loss proof.
4580
5001
  * The process row, parent admission, non-TTL holder, and lease count transition
4581
5002
  * commit atomically. Duplicate identical proof is idempotent; conflicting proof
@@ -4585,6 +5006,8 @@ declare function settleRetainedProcess(db: Database, input: {
4585
5006
  workspaceId: string;
4586
5007
  sessionId: string;
4587
5008
  processId: string;
5009
+ expected: SandboxRetainedProcessIdentity;
5010
+ reconciliationClaimId?: string;
4588
5011
  outcome: "exited" | "lost";
4589
5012
  exitCode?: number | null;
4590
5013
  reason: string;
@@ -6002,19 +6425,25 @@ type LockedSessionUpdateContext = {
6002
6425
  updateSessionMcpServerCredentials: (updates: UpdateSessionMcpServerCredentialsInput[]) => Promise<UpdateSessionMcpServerCredentialsResult>;
6003
6426
  updateSessionMcpApprovalPolicy: (serverId: string, requireApproval: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResult>;
6004
6427
  listPendingSessionTurns: () => Promise<SessionTurn[]>;
6428
+ getLockedSession: (sessionId: string) => Promise<Session | null>;
6005
6429
  };
6006
6430
  type LockedSessionUpdateResult = {
6007
6431
  events: AppendEventInput[];
6008
6432
  update?: {
6009
6433
  resources?: ResourceRef[];
6010
6434
  tools?: ToolRef[];
6435
+ toolPolicy?: SessionToolPolicy;
6436
+ toolPolicyVersion?: number;
6437
+ expectedToolPolicyVersion?: number;
6011
6438
  model?: string;
6012
6439
  metadata?: Record<string, unknown>;
6013
6440
  status?: SessionStatus;
6014
6441
  activeTurnId?: string | null;
6015
6442
  };
6016
6443
  };
6017
- declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>): Promise<SessionEvent[]>;
6444
+ declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>, options?: {
6445
+ lockParentSession?: boolean;
6446
+ }): Promise<SessionEvent[]>;
6018
6447
  declare function sessionSubject(workspaceId: string, sessionId: string): string;
6019
6448
 
6020
- export { type CodexResetRedemptionOutcome as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BeginSandboxRematerializationResult as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexAccountUsageSnapshot as D, type CodexAllocatorUpdateResult as E, type CodexAuthDeps as F, type CodexCapacityAvailabilityDecision as G, type CodexCapacityMutationResult as H, type CodexCapacityResetKind as I, type CodexCapacitySelectionContext as J, type CodexCapacityWait as K, type CodexCapacityWaitStatus as L, type CodexCapacityWakeTarget as M, type CodexCredentialForRun as N, type CodexCredentialLeaseCandidateFilter as O, type CodexCredentialLeaseCandidateFilterResult as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialLeasePolicyScopeResolver as Q, type CodexCredentialLeaseQuarantine as R, type CodexCredentialLeaseResult as S, type CodexCredentialLeaseSelection as T, type CodexCredentialLeaseSelectionContext as U, type CodexCredentialStatus as V, type CodexCredentialTokens as W, type CodexLeaseAccountStatus as X, type CodexPinSource as Y, type CodexRateLimitResetCreditsAccountResult as Z, type CodexResetRedemptionAttempt as _, type AcceptSessionApprovalDecisionResult as a, type InstallOrReadTurnExecutionPolicyForAttemptResult as a$, type CodexResetRedemptionRecovery as a0, type CodexResetRedemptionSendNotReadyReason as a1, type CodexResetRedemptionStatus as a2, type CodexRotationSettings as a3, type CodexRotationStrategy as a4, type CodexTokenDeadlineClock as a5, type CodexTokenDeadlineOptions as a6, type ComposerDraftRow as a7, type ConnectionBrokerDeps as a8, type ConnectionCredentialForBroker as a9, type EffectiveSessionControl as aA, type EnableCapabilityInstallationInput as aB, type EnabledMcpCapabilityServer as aC, type EnqueueSessionTurnInput as aD, type EnrollmentExposure as aE, type EnrollmentOs as aF, type EnrollmentRecord as aG, type EnrollmentStatus as aH, type ExpiredFileUploadCleanupClaim as aI, type FenceCodexResetRedemptionSendResult as aJ, type FileUploadCleanupClaimResult as aK, type ForceDrainResult as aL, type FrozenTurnInitiator as aM, type GitHubInstallation as aN, type GitHubInstallationAccess as aO, type GoalContinuationDecision as aP, type HostExportConsumerStatus as aQ, type HostExportKind as aR, HostExportPayloadError as aS, HostMcpCredentialBindingError as aT, type HostMcpCredentialResolverContext as aU, HostMcpCredentialScopeError as aV, HumanInputResponseValidationError as aW, type IdempotentPersistenceTransactionOptions as aX, type ImportBatch as aY, type InitializeSessionStartInput as aZ, type InitializeSessionStartResult as a_, ConnectionRefreshHttpError as aa, type ConsumeOAuthStateNonceInput as ab, type CorrectWorkspaceMemoryInput as ac, type CorrectWorkspaceMemoryResult as ad, type CreateCapabilityCatalogItemInput as ae, type CreateConnectionInput as af, type CreateDbOptions as ag, type CreateImportBatchInput as ah, type CreateKnowledgeMemoryInput as ai, type CreatePackInstallationInput as aj, type CreateScheduledTaskInput as ak, type CreateSessionGoalInput as al, type CreateSessionMcpServerInput as am, type CreateSocialConnectionInput as an, type CreateSocialPostInput as ao, type CreditBalanceByAccount as ap, type Database as aq, type DatabaseFailureCode as ar, type DbClient as as, type DbSession as at, type DeviceEnrollmentRequestRecord as au, type DeviceEnrollmentStatus as av, type EditQueueCommandResult as aw, type EffectiveControlBlocker as ax, type EffectiveControlResumeOption as ay, type EffectiveControlState as az, type AcceptSessionHumanInputResponseResult as b, RigChangeTransitionError as b$, type IntegrationOAuthClientForUse as b0, type LeaseHolderKind as b1, type LeaseSnapshot as b2, type ListKnowledgeMemoryOptions as b3, type ListSessionEventPageOptions as b4, type ListSessionEventsOptions as b5, type ListSessionsForSubjectOptions as b6, type ListSessionsOptions as b7, type LiveModalSandboxLeaseAttribution as b8, MACHINE_METRICS_SERIES_INTERVAL_MS as b9, NewSessionDraftAccessError as bA, NewSessionDraftConflictError as bB, type NewSessionDraftRow as bC, type PendingSessionToolCallInput as bD, type PersistenceFailureDetails as bE, type PersistenceRetryOutcome as bF, type QueueCommandConflictCode as bG, QueueCommandConflictError as bH, type QueueCommandResult as bI, type QueuedTurnRow as bJ, type ReapDrainable as bK, type ReconcileCodexCapacityWaitResult as bL, type RecoverSessionDispatchInput as bM, type RecoverSessionDispatchResult as bN, type RefreshTransportOptions as bO, type RegisterWorkspacePackInput as bP, type RegistryCapabilityCatalogItemInput as bQ, type RegistryCatalogSurfaceKey as bR, type ReplaceIntegrationOAuthClientInput as bS, type RequestSessionTurnRecoveryInput as bT, type RequestSessionTurnRecoveryResult as bU, type ResolveConnectionCredentialInput as bV, type ResolveConnectionCredentialResult as bW, type RetainedFileArtifact as bX, RigActiveVersionChangedError as bY, RigChangeAlreadyVerifyingError as bZ, type RigChangeMonitoringSummary as b_, MAX_INTERNAL_UPDATE_BATCH_BYTES as ba, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as bb, MAX_INTERNAL_UPDATE_BYTES as bc, MEMORY_ACTIVE_RECORD_CAP as bd, MEMORY_BLOCK_KIND_ORDER as be, MEMORY_BLOCK_RECORD_LIMIT as bf, MEMORY_CORRECT_TOOL_DESCRIPTION as bg, MEMORY_KIND_SECTION_TITLES as bh, MEMORY_NEAR_DUP_COSINE_THRESHOLD as bi, MEMORY_NEAR_DUP_NEIGHBORS as bj, MEMORY_SAVE_TOOL_DESCRIPTION as bk, MEMORY_SEARCH_DEFAULT_LIMIT as bl, MEMORY_SEARCH_MAX_LIMIT as bm, MEMORY_SEARCH_TOOL_DESCRIPTION as bn, MEMORY_TEXT_MAX_CHARS as bo, MEMORY_VISIBLE_RECORD_CAP as bp, type MachineMetricsRow as bq, type MachineMetricsSample as br, type MarkWarmLeaseInstanceLostResult as bs, type MaterializeGoalContinuationResult as bt, type MemoryBlockRecord as bu, type MemoryEmbedder as bv, type MemorySanitizeResult as bw, type MeterableWarmLease as bx, type NestedAgentDepthDeploymentPolicy as by, type NestedAgentDepthPolicySource as bz, type AccrueWarmSecondsResult as c, type SessionListCursor as c$, type RigVersionContentInput as c0, type RigVersionMonitoringSummary as c1, type RlsContext as c2, type RlsStrategy as c3, SESSION_ANCESTRY_LIMIT as c4, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as c5, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as c6, SESSION_DISCOVERY_GOAL_MAX_CHARS as c7, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as c8, SESSION_EVENT_DB_PAGE_MAX_BYTES as c9, type SaveWorkspaceMemoryResult as cA, type SessionAttemptInterruptionSettlement as cB, type SessionCodexState as cC, type SessionCommandActor as cD, SessionCommandIdempotencyError as cE, type SessionCommandReceiptRow as cF, SessionContextBusyError as cG, SessionControlConflictError as cH, SessionControlInvariantError as cI, type SessionControlMutationResult as cJ, type SessionCreateDeniedResult as cK, type SessionCreateInput as cL, type SessionCreateResult as cM, type SessionCreateSuccessResult as cN, type SessionDepthPolicy as cO, type SessionDiscoveryControl as cP, type SessionDiscoveryCursor as cQ, type SessionDiscoveryOrderBy as cR, type SessionDiscoverySummary as cS, type SessionEventPage as cT, SessionEventPersistenceError as cU, type SessionEventWriteLockInput as cV, type SessionEventWriteLocks as cW, type SessionGoalContinuationProjection as cX, SessionIdConflictError as cY, type SessionLineage as cZ, SessionListAccessError as c_, SESSION_LIST_SNAPSHOT_MAX_ACTIVE_PER_SUBJECT as ca, SESSION_LIST_SNAPSHOT_MAX_IDS as cb, type SafeDatabaseErrorFacts as cc, type SandboxArchiveAvailability as cd, type SandboxArchiveRevision as ce, SandboxImageConflictError as cf, type SandboxKind as cg, type SandboxLeaseLiveness as ch, SandboxLeaseRecoveryBlockedError as ci, SandboxLeaseSupersededError as cj, type SandboxOpenPtySessionRow as ck, type SandboxProviderExistence as cl, type SandboxPtyProcessIdentity as cm, type SandboxPtySessionRow as cn, type SandboxRecord as co, type SandboxRecoveryState as cp, type SandboxRestoreStatus as cq, type SandboxRetainedProcess as cr, type SandboxRetainedProcessState as cs, SandboxRigConflictError as ct, type SandboxWorkspaceMutationAdmission as cu, SandboxWorkspaceMutationFencedError as cv, type SandboxWorkspaceMutationProviderOutcome as cw, type SandboxWorkspaceReadiness as cx, SanitizedDatabasePersistenceCause as cy, type SaveWorkspaceMemoryInput as cz, type AcquireLeaseInput as d, acceptSessionHumanInputResponse as d$, SessionListCursorError as d0, SessionListCursorExpiredError as d1, SessionListSnapshotLimitError as d2, type SessionMcpServerForRun as d3, SessionPinAccessError as d4, SessionPinVersionConflictError as d5, type SessionRecordingCodec as d6, type SessionRecordingMode as d7, type SessionRecordingRow as d8, type SessionRecordingState as d9, type UpdateKnowledgeMemoryInput as dA, type UpdateScheduledTaskInput as dB, type UpdateSessionMcpApprovalPolicyResult as dC, type UpdateSessionMcpServerCredentialsInput as dD, type UpdateSessionMcpServerCredentialsResult as dE, type UpsertCodexSubscriptionCredentialResult as dF, type UserLookup as dG, type VariableSetForRun as dH, WORKSPACE_MEMORY_BLOCK_EMPTY as dI, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as dJ, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as dK, type WorkspaceCaptureCommitResult as dL, type WorkspaceCaptureGcPlan as dM, type WorkspaceCaptureGcRow as dN, type WorkspaceCaptureRow as dO, type WorkspaceControlLockMode as dP, type WorkspaceControlMutationResult as dQ, type WorkspaceControlRow as dR, type WorkspaceEnvironmentForRun as dS, type WorkspaceMemoryOrigin as dT, type WorkspaceMemorySearchInput as dU, type WorkspaceMemorySearchMode as dV, type WorkspaceMemorySearchResult as dW, type WorkspaceModelPolicy as dX, abandonCodexResetRedemptionBeforeProvider as dY, abandonRecordingForTurnAttempt as dZ, acceptSessionApprovalDecision as d_, type SessionSpawnDenial as da, type SessionSpawnDenialCode as db, SessionSpawnDeniedDbError as dc, type SessionSystemUpdateOutboxDelivery as dd, type SessionTurnAttemptOutcome as de, type SessionTurnForExecution as df, type SessionTurnRecordingSettlement as dg, type SessionWorkPeek as dh, type SessionWorkTrigger as di, type SessionWorkflowWake as dj, type SessionWorkflowWakeDeliveryResult as dk, type SetSessionCodexPinOptions as dl, type SetSessionGoalStatusEvent as dm, type SettleCodexCredentialFailoverResult as dn, type SettleCodexCredentialLeaseLossResult as dp, type SteerQueueCommandResult as dq, type StoreIntegrationOAuthClientInput as dr, type StoredIntegrationOAuthClient as ds, type StreamAcknowledgment as dt, type SubmitHumanPromptResult as du, type ToolspaceCallReservation as dv, type ToolspaceTurnAttemptClaims as dw, type TurnAttemptFenceRejectReason as dx, type UpdateConnectionInput as dy, type UpdateImportBatchCountsInput as dz, type AcquireLeaseResult as e, consumeNewSessionDraftInTransaction as e$, accrueWarmSeconds as e0, acknowledgeHostExportBatch as e1, acquireCodexCredentialLease as e2, acquireLease as e3, activateRigVersion as e4, addSessionSystemUpdate as e5, addSessionSystemUpdateWithSourceMutation as e6, admitToolspaceTurnAttempt as e7, adoptCodexResetRedemptionAttempt as e8, advanceWorkspaceGeneration as e9, buildHostConnectionTokenResolver as eA, canonicalSessionCommandHash as eB, claimCodexResetRedemption as eC, claimExpiredFileUploadCleanup as eD, claimFileUploadCleanup as eE, claimHostExportBatch as eF, claimPendingSessionSystemUpdateOutbox as eG, claimPendingSessionWorkflowWakes as eH, claimSessionWorkForAttempt as eI, clearDurablePendingSessionToolCalls as eJ, clearEnrollmentWentOffline as eK, clearPendingSessionToolspaceCall as eL, clearSessionContext as eM, clearSessionGoal as eN, clearedContextMarkerItem as eO, closePtySession as eP, closeSessionTurnAttemptInTransaction as eQ, codexCapacityRefreshBackoffMs as eR, commitWarmingToWarm as eS, completeCodexResetRedemption as eT, completeExpiredFileUploadCleanup as eU, completeFileUpload as eV, completeFileUploadCleanup as eW, computeWorkspaceCaptureGcPlan as eX, confirmDrainCold as eY, consumeDeviceEnrollmentRequest as eZ, consumeIntegrationOAuthStateNonce as e_, advanceWorkspaceGenerationForDirectRequest as ea, advanceWorkspaceGenerationForRetainedProcess as eb, allAccountPermissions as ec, allWorkspacePermissions as ed, appendSessionEventToSandboxGroup as ee, appendSessionEvents as ef, appendSessionEventsAndUpdateSession as eg, appendSessionEventsForTurnAttempt as eh, appendSessionEventsWithLockedSessionUpdate as ei, appendSessionHistoryItems as ej, applyContextCompaction as ek, applyCreditDebitUpToBalance as el, applyCreditLedgerEntry as em, applySessionTurnSettlement as en, approveDeviceEnrollmentRequest as eo, areGitHubRepositoriesAllowedForWorkspace as ep, armCodexCapacityWait as eq, assertAgentCommandAuthorityInTransaction as er, autoResumeSessionBranchInTransaction as es, beginRigChangeVerificationAttempt as et, beginSandboxRematerialization as eu, bindGitHubInstallationRepositories as ev, bootstrapWorkspace as ew, buildChildCompletionDigest as ex, buildCodexTokenResolver as ey, buildConnectionTokenResolver as ez, type ActiveSandboxPointer as f, disableHostExportConsumer as f$, correctWorkspaceMemory as f0, countActiveApiKeysForWorkspace as f1, countActiveSessionHistoryItems as f2, countActiveSessionsForWorkspace as f3, countActiveSessionsUsingEnvironment as f4, countActiveSessionsUsingVariableSet as f5, countConsecutiveReactiveRotations as f6, countQueuedTurns as f7, countRigs as f8, countSandboxLeasesByLiveness as f9, createSessionWithIdempotencyKey as fA, createSessionWithIdempotencyKeyResult as fB, createSocialConnection as fC, createSocialPost as fD, createVariableSet as fE, createWorkspace as fF, createWorkspaceEnvironment as fG, databaseFailureCode as fH, deadLetterHostExportHead as fI, decodeSessionListCursor as fJ, decryptEnvironmentValue as fK, decryptedCapabilityHeaders as fL, deleteGitHubInstallationBinding as fM, deleteRecording as fN, deleteRig as fO, deleteRigIfNoActiveSessions as fP, deleteScheduledTask as fQ, deleteSessionQueueItemInTransaction as fR, deleteVariableSet as fS, deleteVariableSetVariable as fT, deleteWorkspace as fU, deleteWorkspaceCaptureRows as fV, deleteWorkspaceEnvironment as fW, deleteWorkspaceEnvironmentVariable as fX, deleteWorkspacePack as fY, denyDeviceEnrollmentRequest as fZ, disableCapabilityInstallation as f_, countScheduledTasksForWorkspace as fa, countScheduledTasksUsingEnvironment as fb, countScheduledTasksUsingVariableSet as fc, countSessionHistoryItems as fd, countSessionsUsingRig as fe, countVariableSets as ff, countWorkspaceEnvironments as fg, countWorkspacesForAccount as fh, createApiKey as fi, createConnection as fj, createDb as fk, createDeviceEnrollmentRequest as fl, createEnrollment as fm, createFileUpload as fn, createImportBatch as fo, createKnowledgeMemory as fp, createRig as fq, createRigChange as fr, createRigVersion as fs, createRigVersionForChangePromotion as ft, createSandbox as fu, createScheduledTask as fv, createScheduledTaskRun as fw, createSession as fx, createSessionGoal as fy, createSessionMcpServers as fz, type AddSessionSystemUpdateInput as g, getRetainedProcess as g$, disconnectAllCodexAccounts as g0, disconnectCodexAccount as g1, editQueuedTurnInTransaction as g2, enableCapabilityInstallation as g3, enablePackInstallation as g4, encodeSessionListCursor as g5, encryptEnvironmentValue as g6, enqueueSessionTurn as g7, enqueueSessionWorkflowWake as g8, enqueueSessionWorkflowWakeIfRunnable as g9, getCodexCapacityWaitForSession as gA, getCodexCredentialStatus as gB, getCodexResetRedemptionAttempt as gC, getCodexRotationSettings as gD, getComposerDraftInTransaction as gE, getConnectionMetadata as gF, getDeviceEnrollmentRequestByDeviceCode as gG, getEnrollment as gH, getFile as gI, getFileUpload as gJ, getHostExportConsumerStatus as gK, getHumanInputResumeForEvent as gL, getKnowledgeMemory as gM, getLatestRunState as gN, getLatestStartedSessionTurn as gO, getManagedAccount as gP, getManagedUserByEmail as gQ, getMaterializedSandboxFileResources as gR, getNestedAgentDepthDeploymentPolicy as gS, getNewSessionDraftInTransaction as gT, getOpenPtySession as gU, getOrCreateSessionSystemUpdateOutbox as gV, getPackInstallation as gW, getPendingDeviceEnrollmentRequestByUserCode as gX, getPendingDeviceEnrollmentRequestByUserCodeGlobal as gY, getRecording as gZ, getRetainedFileArtifact as g_, enqueueSessionWorkflowWakeInTransaction as ga, ensureCodexRotationSettings as gb, ensureManagedAccessForUser as gc, estimateMemoryTokens as gd, evaluateGoalContinuation as ge, evaluateSessionControl as gf, evaluateSessionControls as gg, evaluateSessionDiscoveryControls as gh, expireSessionHumanInputRequest as gi, failHostExportBatch as gj, failSandboxRematerialization as gk, failWarmingToCold as gl, fenceCodexResetRedemptionSend as gm, fetchCodexRateLimitResetCreditsForAccount as gn, fetchCodexUsageForAccount as go, finalizeEnrollmentByToken as gp, findActiveApiKeyByHash as gq, forceDrainOverLimitViewerOnlyBoxes as gr, frozenInitiatorForCommandActor as gs, getActiveSessionHistoryItems as gt, getActiveSessionTurnForExecution as gu, getAnySessionInGroup as gv, getBillingBalance as gw, getBillingCustomer as gx, getCapabilityCatalogItem as gy, getCapabilityInstallation as gz, type AddSessionSystemUpdateResult as h, isStripeWebhookProcessed as h$, getRig as h0, getRigByName as h1, getRigChange as h2, getRigName as h3, getRigVersion as h4, getRigVersionById as h5, getSandbox as h6, getSandboxSessionEnvelope as h7, getScheduledTask as h8, getSession as h9, getWorkspaceEnvironment as hA, getWorkspaceEnvironmentByName as hB, getWorkspaceEnvironmentValuesForRun as hC, getWorkspaceGrant as hD, getWorkspaceModelPolicy as hE, getWorkspacePack as hF, grantWorkspaceAccess as hG, hasCreditLedgerEntry as hH, hashMemoryText as hI, heartbeatCodexCredentialLease as hJ, heartbeatCodexCredentialLeaseUntil as hK, heartbeatLeaseHolder as hL, ingestMachineMetricsSample as hM, initializeSessionStartAtomically as hN, insertFailedWorkspaceCapture as hO, insertMachineMetricsSeries as hP, insertPtySession as hQ, insertRecording as hR, insertWorkspaceCapture as hS, installOrReadTurnExecutionPolicyForAttempt as hT, interruptedToolCallResult as hU, isCodexBilledTurn as hV, isDatabasePersistenceFailure as hW, isMemoryTextTooLong as hX, isRetryablePersistenceSqlState as hY, isSessionCompactionRequested as hZ, isSessionEventPersistenceError as h_, getSessionByCreateIdempotencyKey as ha, getSessionCodexState as hb, getSessionEvent as hc, getSessionEventByClientEventId as hd, getSessionForSubject as he, getSessionGoal as hf, getSessionGoalWithContinuation as hg, getSessionHistoryItems as hh, getSessionHumanInputRequest as hi, getSessionLineage as hj, getSessionQueueSnapshot as hk, getSessionRootId as hl, getSessionSpawnDenial as hm, getSessionSpawnDenialByIdempotencyKey as hn, getSessionSystemUpdateOutboxByDedupeKey as ho, getSessionTurn as hp, getSessionTurnForAttempt as hq, getSocialConnection as hr, getStoredCapabilityHeaderCiphertext as hs, getStreamAcknowledgment as ht, getVariableSet as hu, getVariableSetByName as hv, getVariableSetValuesForRun as hw, getWorkspace as hx, getWorkspaceControlEvent as hy, getWorkspaceDefaultRigId as hz, type AdoptCodexResetRedemptionResult as i, lockWorkspaceInferenceControl as i$, latestWorkspaceCapture as i0, listApiKeys as i1, listCapabilityCatalogItems as i2, listCapabilityInstallations as i3, listCodexAccountStatuses as i4, listCodexResetRedemptionRecoveries as i5, listConnectionsMetadata as i6, listCreditBalancesByAccount as i7, listDistinctRigVersionIdsInGroup as i8, listDistinctVariableSetIdsInGroup as i9, listSessionEventPage as iA, listSessionEvents as iB, listSessionHumanInputRequests as iC, listSessionIdsInGroup as iD, listSessionMcpServerMetadata as iE, listSessionMcpServersForChildInheritance as iF, listSessionMcpServersForRun as iG, listSessionSpawnDenials as iH, listSessionSystemUpdatesForTurn as iI, listSessionTurns as iJ, listSessions as iK, listSessionsForSubject as iL, listSocialConnections as iM, listSocialPosts as iN, listUsageEvents as iO, listVariableSets as iP, listWorkspaceControlEvents as iQ, listWorkspaceEnvironments as iR, listWorkspaceMembers as iS, listWorkspacePacks as iT, listWorkspacesForSubject as iU, loadCodexCredentialForRun as iV, loadConnectionCredentialForBroker as iW, loadIntegrationOAuthClient as iX, loadVariableSetForRun as iY, loadWorkspaceEnvironmentForRun as iZ, lockSessionEventWriteRows as i_, listEnabledMcpCapabilityServers as ia, listEnrollments as ib, listGitHubInstallationAccessForWorkspace as ic, listGitHubInstallationIdsForWorkspace as id, listGitHubInstallationsForWorkspace as ie, listKnowledgeMemories as ig, listLiveModalSandboxLeaseAttributions as ih, listMeterableWarmLeases as ii, listOpenPtySessions as ij, listOutstandingSessionSystemUpdates as ik, listPackInstallations as il, listPendingCodexCapacityWakeTargets as im, listPendingSessionTurns as io, listRecordings as ip, listRegistryCatalogSurfaceKeys as iq, listRigChangeMonitoringSummaries as ir, listRigChanges as is, listRigVersionMonitoringSummaries as it, listRigVersions as iu, listRigs as iv, listSandboxes as iw, listScheduledTaskRuns as ix, listScheduledTasks as iy, listSessionDiscoverySummaries as iz, AgentCommandAuthorityError as j, registerPendingSessionToolCall as j$, markFileUploadFailed as j0, markSandboxFileResourcesMaterialized as j1, markSandboxProviderReady as j2, markSandboxRestoreVerifying as j3, markScheduledTaskRunFailedIfQueued as j4, markSessionAttemptQuiesced as j5, markSessionSystemUpdateOutboxDeliveredInTransaction as j6, markSessionSystemUpdateOutboxFailed as j7, markSessionWorkflowWakeDelivered as j8, markSessionWorkflowWakeFailed as j9, readMachineMetricsSeries as jA, readWorkspaceArchiveCapturePreflight as jB, reapExpiredSessionListSnapshots as jC, reapStaleLeaseHolders as jD, reapStaleLeaseHoldersGlobal as jE, reconcileCodexCapacityWait as jF, recordAuditEvent as jG, recordCodexAccountConnectors as jH, recordCodexAccountUsage as jI, recordCodexAccountUsageWithWakeTargets as jJ, recordCodexTokenRefresh as jK, recordConnectionTokenRefresh as jL, recordConnectionUsed as jM, recordLeaseDataPlaneUrl as jN, recordLeaseTerminalDataPlaneUrl as jO, recordPendingSessionToolCallResult as jP, recordSessionActiveCodexCredential as jQ, recordSkippedContextCompaction as jR, recordStreamAcknowledgment as jS, recordStripeWebhookEvent as jT, recordUsageEvent as jU, recordWarmingSandboxCreated as jV, recoverSessionDispatch as jW, refreshOAuthConnectionCredential as jX, registerDbBinding as jY, registerHostExportConsumer as jZ, registerInternalUpdateWakeInTransaction as j_, markStaleRegistryCatalogItems as ja, markStripeWebhookProcessed as jb, markWarmLeaseInstanceLost as jc, materializeGoalContinuation as jd, mcpServerIdForCapability as je, moveQueuedTurnInTransaction as jf, mutateSessionControlInTransaction as jg, mutateWorkspaceControlInTransaction as jh, nestedPostgresSqlState as ji, nextSessionHistoryPosition as jj, normalizeBearerScheme as jk, normalizeMemoryText as jl, orphanedResultRowIndicesForRepair as jm, peekSessionWork as jn, persistDrainSnapshot as jo, persistWarmSnapshot as jp, planWorkspaceCaptureGc as jq, projectEffectiveControlForRelatedAccess as jr, projectSessionForRelatedAccess as js, pruneHostExportOutbox as jt, quarantineCodexCredentialForLease as ju, reArmDrainingLease as jv, readActiveSandbox as jw, readLease as jx, readMachineMetricsLatest as jy, readMachineMetricsLatestForWorkspace as jz, type AgentInternalUpdateCommandResult as k, setSessionGoalStatusWithEvent as k$, registerSessionTurnAttemptClaim as k0, registerSessionWorkflowWakeInTransaction as k1, registerWorkspacePack as k2, releaseCodexCredentialLease as k3, releaseCodexResetRedemptionClaim as k4, releaseLeaseHolder as k5, removeWorkspaceMember as k6, renameCodexAccount as k7, renderWorkspaceMemoryBlock as k8, replaceIntegrationOAuthClient as k9, sanitizeModelPayload as kA, saveComposerDraftInTransaction as kB, saveNewSessionDraftInTransaction as kC, saveRunState as kD, saveWorkspaceMemory as kE, searchWorkspaceMemories as kF, sendAgentMessageInTransaction as kG, serializeEffectiveSessionControl as kH, sessionAuthorizationScopeFilter as kI, sessionSubject as kJ, sessionTreeStatsForSessions as kK, sessionsWithActiveOpOnEnrollment as kL, setActiveCodexCredential as kM, setActiveSandbox as kN, setCodexCredentialExhausted as kO, setCodexCredentialExhaustedWithWakeTargets as kP, setCodexCredentialStatus as kQ, setCodexCredentialStatusById as kR, setConnectionStatus as kS, setEnrollmentDisplayState as kT, setEnrollmentOpStreamState as kU, setEnrollmentWentOffline as kV, setInitialActiveCodexCredential as kW, setRlsContext as kX, setSessionCodexPin as kY, setSessionGoalLastContinuationTurn as kZ, setSessionGoalStatus as k_, requestSessionCompaction as ka, requestSessionTurnRecovery as kb, requireFile as kc, requireScheduledTask as kd, requireSession as ke, requireSocialConnection as kf, requireWorkspace as kg, reserveSessionCommandReceipt as kh, reserveToolspaceCallForAttempt as ki, resolveWorkspaceMemoryBlock as kj, resumeHostExportConsumer as kk, retainWorkspaceMutationProcess as kl, retireHostExportConsumer as km, revokeApiKey as kn, revokeConnection as ko, revokeEnrollment as kp, revokeViewer as kq, rewindHostExportConsumer as kr, rlsContextForWorkspace as ks, rlsStrategyFor as kt, rotateWorkspaceArchives as ku, runIdempotentPersistenceTransaction as kv, safeDatabaseErrorFacts as kw, sanitizeEventPayload as kx, sanitizeEventString as ky, sanitizeMemoryText as kz, type AppendEventInput as l, withWorkspaceRls as l$, setSessionLastInputTokensForTurnAttempt as l0, setSessionPin as l1, setSubjectRlsContext as l2, setTemporalWorkflowId as l3, setVariableSetVariable as l4, setWorkspaceDefaultRig as l5, setWorkspaceEnvironmentVariable as l6, settleCodexCredentialFailover as l7, settleCodexCredentialLeaseLoss as l8, settleRetainedProcess as l9, updateSessionGoalWithEvent as lA, updateSessionMcpApprovalPolicy as lB, updateSessionMcpServerCredentials as lC, updateSessionTitle as lD, updateVariableSet as lE, updateWorkspace as lF, updateWorkspaceEnvironment as lG, updateWorkspaceSettings as lH, upsertBillingCustomer as lI, upsertCapabilityCatalogItem as lJ, upsertCodexSubscriptionCredential as lK, upsertGitHubInstallation as lL, upsertMachineMetricsLatest as lM, upsertRegistryCapabilityCatalogItem as lN, upsertSandboxSessionEnvelope as lO, upsertSessionGoal as lP, upsertSessionGoalWithEvent as lQ, upsertWorkspaceModelPolicy as lR, validateHumanInputResponse as lS, verifyDirectWorkspaceMutationSettlement as lT, verifyRetainedProcessMutationSettlement as lU, verifyWorkspaceMutationSettlement as lV, withAccountRls as lW, withCodexCapacityMutation as lX, withCodexCredentialRefreshLock as lY, withCodexTokenDeadline as lZ, withRlsContext as l_, settleScheduledTaskRunInTransaction as la, settleSessionAttemptInterruptions as lb, settleSessionIdleWithParentOutbox as lc, shortMemoryId as ld, steerAgentSessionInTransaction as le, steerQueuedTurnInTransaction as lf, storeIntegrationOAuthClient as lg, submitHumanPromptInTransaction as lh, sumUsageQuantity as li, supersedeSessionCurrentDirectionInTransaction as lj, touchEnrollmentLastSeen as lk, touchLeaseHolder as ll, updateCodexAllocatorEligibility as lm, updateCodexRotationSettings as ln, updateConnection as lo, updateImportBatchCounts as lp, updateKnowledgeMemory as lq, updatePackInstallationStatus as lr, updatePtySessionActivity as ls, updateRecording as lt, updateRig as lu, updateRigChangeStatus as lv, updateScheduledTask as lw, updateScheduledTaskRun as lx, updateSessionCommandReceiptResult as ly, updateSessionGoal as lz, type ApplyContextCompactionResult as m, withWorkspaceSubjectRls as m0, withWorkspaceUsageLock as m1, workspaceCaptureAtRevision as m2, workspaceCodexSubscriptionActive as m3, type ApplySessionTurnSettlementInput as n, type ApplySessionTurnSettlementResult as o, type ArmCodexCapacityWaitResult as p, provisionRoles, type BootstrapWorkspaceInput as q, CODEX_CAPACITY_REFRESH_MIN_MS as r, CODEX_CREDENTIAL_LEASE_TTL_MS as s, CODEX_RESET_REDEMPTION_OUTCOMES as t, CODEX_ROTATION_STRATEGIES as u, type ClaimCodexResetRedemptionResult as v, type ClaimSessionWorkForAttemptInput as w, type ClaimSessionWorkForAttemptResult as x, type ClearSessionContextResult as y, type CodexAccountStatus as z };
6449
+ export { type CodexRateLimitResetCreditsAccountResult as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BeginSandboxRematerializationResult as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type ClearSessionContextResult as D, type CodexAccountStatus as E, type CodexAccountUsageSnapshot as F, type CodexAllocatorUpdateResult as G, type CodexAuthDeps as H, type CodexCapacityAvailabilityDecision as I, type CodexCapacityMutationResult as J, type CodexCapacityResetKind as K, type CodexCapacitySelectionContext as L, type CodexCapacityWait as M, type CodexCapacityWaitStatus as N, type CodexCapacityWakeTarget as O, type CodexCredentialForRun as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialLeaseCandidateFilter as Q, type CodexCredentialLeaseCandidateFilterResult as R, type CodexCredentialLeasePolicyScopeResolver as S, type CodexCredentialLeaseQuarantine as T, type CodexCredentialLeaseResult as U, type CodexCredentialLeaseSelection as V, type CodexCredentialLeaseSelectionContext as W, type CodexCredentialStatus as X, type CodexCredentialTokens as Y, type CodexLeaseAccountStatus as Z, type CodexPinSource as _, type AcceptSessionApprovalDecisionResult as a, type HostMcpCredentialResolverContext as a$, type CodexResetRedemptionAttempt as a0, type CodexResetRedemptionOutcome as a1, type CodexResetRedemptionRecovery as a2, type CodexResetRedemptionSendNotReadyReason as a3, type CodexResetRedemptionStatus as a4, type CodexRotationSettings as a5, type CodexRotationStrategy as a6, type CodexTokenDeadlineClock as a7, type CodexTokenDeadlineOptions as a8, type CompleteSlackBotPostOperationResult as a9, type EditQueueCommandResult as aA, type EffectiveControlBlocker as aB, type EffectiveControlResumeOption as aC, type EffectiveControlState as aD, type EffectiveSessionControl as aE, type EnableCapabilityInstallationInput as aF, type EnabledMcpCapabilityServer as aG, type EnqueueSessionTurnInput as aH, type EnrollmentExposure as aI, type EnrollmentOs as aJ, type EnrollmentRecord as aK, type EnrollmentStatus as aL, type ExpiredDrainingSandboxLeaseCount as aM, type ExpiredFileUploadCleanupClaim as aN, FORCE_RLS_TABLES as aO, type FenceCodexResetRedemptionSendResult as aP, type FileUploadCleanupClaimResult as aQ, type ForceDrainResult as aR, type FrozenTurnInitiator as aS, type GitHubInstallation as aT, type GitHubInstallationAccess as aU, GitHubInstallationAuthorityCommitError as aV, type GoalContinuationDecision as aW, type HostExportConsumerStatus as aX, type HostExportKind as aY, HostExportPayloadError as aZ, HostMcpCredentialBindingError as a_, type ComposerDraftRow as aa, type ConnectionBrokerDeps as ab, type ConnectionCredentialForBroker as ac, type ConnectionMetadataWithVerification as ad, ConnectionRefreshHttpError as ae, type ConsumeOAuthStateNonceInput as af, type CorrectWorkspaceMemoryInput as ag, type CorrectWorkspaceMemoryResult as ah, type CreateCapabilityCatalogItemInput as ai, type CreateConnectionInput as aj, type CreateDbOptions as ak, type CreateImportBatchInput as al, type CreateKnowledgeMemoryInput as am, type CreatePackInstallationInput as an, type CreateScheduledTaskInput as ao, type CreateSessionGoalInput as ap, type CreateSessionMcpServerInput as aq, type CreateSocialConnectionInput as ar, type CreateSocialPostInput as as, type CreditBalanceByAccount as at, type Database as au, type DatabaseFailureCode as av, type DbClient as aw, type DbSession as ax, type DeviceEnrollmentRequestRecord as ay, type DeviceEnrollmentStatus as az, type AcceptSessionHumanInputResponseResult as b, type ReconcileColdLostLeaseInstanceBlockersResult as b$, HostMcpCredentialScopeError as b0, HumanInputResponseValidationError as b1, type IdempotentPersistenceTransactionOptions as b2, type ImportBatch as b3, type InitializeSessionStartInput as b4, type InitializeSessionStartResult as b5, type InstallOrReadTurnExecutionPolicyForAttemptResult as b6, type IntegrationOAuthClientForUse as b7, type LeaseHolderKind as b8, type LeaseSnapshot as b9, type MarkWarmLeaseInstanceLostResult as bA, type MaterializeGoalContinuationResult as bB, type MemoryBlockRecord as bC, type MemoryEmbedder as bD, type MemorySanitizeResult as bE, type MeterableWarmLease as bF, NON_RLS_RUNTIME_TABLES as bG, type NestedAgentDepthDeploymentPolicy as bH, type NestedAgentDepthPolicySource as bI, NewSessionDraftAccessError as bJ, NewSessionDraftConflictError as bK, type NewSessionDraftRow as bL, PROTECTED_NO_DIRECT_DML_TABLES as bM, type PendingSessionToolCallInput as bN, type PersistenceFailureDetails as bO, type PersistenceRetryOutcome as bP, type QueueCommandConflictCode as bQ, QueueCommandConflictError as bR, type QueueCommandResult as bS, type QueuedTurnRow as bT, RUNTIME_DML_TABLES as bU, RUNTIME_FULL_DML_TABLES as bV, RUNTIME_READ_INSERT_TABLES as bW, RUNTIME_READ_ONLY_TABLES as bX, RUNTIME_TABLE_PRIVILEGES as bY, type ReapDrainable as bZ, type ReconcileCodexCapacityWaitResult as b_, type ListKnowledgeMemoryOptions as ba, type ListSessionEventPageOptions as bb, type ListSessionEventsOptions as bc, type ListSessionsForSubjectOptions as bd, type ListSessionsOptions as be, type LiveModalSandboxLeaseAttribution as bf, type LostProviderWorkspaceSettlement as bg, MACHINE_METRICS_SERIES_INTERVAL_MS as bh, MAX_INTERNAL_UPDATE_BATCH_BYTES as bi, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as bj, MAX_INTERNAL_UPDATE_BYTES as bk, MEMORY_ACTIVE_RECORD_CAP as bl, MEMORY_BLOCK_KIND_ORDER as bm, MEMORY_BLOCK_RECORD_LIMIT as bn, MEMORY_CORRECT_TOOL_DESCRIPTION as bo, MEMORY_KIND_SECTION_TITLES as bp, MEMORY_NEAR_DUP_COSINE_THRESHOLD as bq, MEMORY_NEAR_DUP_NEIGHBORS as br, MEMORY_SAVE_TOOL_DESCRIPTION as bs, MEMORY_SEARCH_DEFAULT_LIMIT as bt, MEMORY_SEARCH_MAX_LIMIT as bu, MEMORY_SEARCH_TOOL_DESCRIPTION as bv, MEMORY_TEXT_MAX_CHARS as bw, MEMORY_VISIBLE_RECORD_CAP as bx, type MachineMetricsRow as by, type MachineMetricsSample as bz, type AccrueWarmSecondsResult as c, SanitizedDatabasePersistenceCause as c$, type RecoverSessionDispatchInput as c0, type RecoverSessionDispatchResult as c1, type RefreshTransportOptions as c2, type RegisterWorkspacePackInput as c3, type RegistryCapabilityCatalogItemInput as c4, type RegistryCatalogSurfaceKey as c5, type ReplaceIntegrationOAuthClientInput as c6, type RequestSessionTurnRecoveryInput as c7, type RequestSessionTurnRecoveryResult as c8, type ResolveConnectionCredentialInput as c9, SESSION_LIST_SNAPSHOT_MAX_ACTIVE_PER_SUBJECT as cA, SESSION_LIST_SNAPSHOT_MAX_IDS as cB, type SafeDatabaseErrorFacts as cC, type SandboxArchiveAvailability as cD, type SandboxArchiveRevision as cE, SandboxImageConflictError as cF, type SandboxKind as cG, type SandboxLeaseLiveness as cH, SandboxLeaseRecoveryBlockedError as cI, SandboxLeaseSupersededError as cJ, type SandboxOpenPtySessionRow as cK, type SandboxProviderExistence as cL, type SandboxPtyProcessIdentity as cM, type SandboxPtySessionRow as cN, type SandboxRecord as cO, type SandboxRecoveryState as cP, type SandboxRestoreStatus as cQ, type SandboxRetainedProcess as cR, type SandboxRetainedProcessIdentity as cS, SandboxRetainedProcessPromotionFencedError as cT, type SandboxRetainedProcessReconciliationClaim as cU, type SandboxRetainedProcessState as cV, SandboxRigConflictError as cW, type SandboxWorkspaceMutationAdmission as cX, SandboxWorkspaceMutationFencedError as cY, type SandboxWorkspaceMutationProviderOutcome as cZ, type SandboxWorkspaceReadiness as c_, type ResolveConnectionCredentialResult as ca, type RetainedFileArtifact as cb, type RetainedProcessProviderProof as cc, RigActiveVersionChangedError as cd, RigChangeAlreadyVerifyingError as ce, type RigChangeMonitoringSummary as cf, RigChangeTransitionError as cg, type RigVersionContentInput as ch, type RigVersionMonitoringSummary as ci, type RlsContext as cj, type RlsStrategy as ck, type RuntimeDatabaseIdentity as cl, type RuntimeDatabasePosture as cm, RuntimeDatabasePostureError as cn, type RuntimeDatabasePostureOptions as co, type RuntimeRoutinePosture as cp, type RuntimeSchemaPosture as cq, type RuntimeTableDmlPrivilege as cr, type RuntimeTablePosture as cs, type RuntimeTablePrivilegeContract as ct, SESSION_ANCESTRY_LIMIT as cu, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as cv, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as cw, SESSION_DISCOVERY_GOAL_MAX_CHARS as cx, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as cy, SESSION_EVENT_DB_PAGE_MAX_BYTES as cz, type AcquireLeaseInput as d, type ToolspaceTurnAttemptClaims as d$, type SaveWorkspaceMemoryInput as d0, type SaveWorkspaceMemoryResult as d1, type SessionAttemptInterruptionSettlement as d2, type SessionCodexState as d3, type SessionCommandActor as d4, SessionCommandIdempotencyError as d5, type SessionCommandReceiptRow as d6, SessionContextBusyError as d7, SessionControlConflictError as d8, SessionControlInvariantError as d9, type SessionRecordingCodec as dA, type SessionRecordingMode as dB, type SessionRecordingRow as dC, type SessionRecordingState as dD, type SessionSpawnDenial as dE, type SessionSpawnDenialCode as dF, SessionSpawnDeniedDbError as dG, type SessionSystemUpdateOutboxDelivery as dH, SessionToolPolicyVersionConflictError as dI, type SessionTurnAttemptOutcome as dJ, type SessionTurnForExecution as dK, type SessionTurnRecordingSettlement as dL, type SessionWorkPeek as dM, type SessionWorkTrigger as dN, type SessionWorkflowWake as dO, type SessionWorkflowWakeDeliveryResult as dP, type SetSessionCodexPinOptions as dQ, type SetSessionGoalStatusEvent as dR, type SettleCodexCredentialFailoverResult as dS, type SettleCodexCredentialLeaseLossResult as dT, type SlackBotPostOperation as dU, type SteerQueueCommandResult as dV, type StoreIntegrationOAuthClientInput as dW, type StoredIntegrationOAuthClient as dX, type StreamAcknowledgment as dY, type SubmitHumanPromptResult as dZ, type ToolspaceCallReservation as d_, type SessionControlMutationResult as da, type SessionCreateDeniedResult as db, type SessionCreateInput as dc, type SessionCreateResult as dd, type SessionCreateSuccessResult as de, type SessionDepthPolicy as df, type SessionDiscoveryControl as dg, type SessionDiscoveryCursor as dh, type SessionDiscoveryOrderBy as di, type SessionDiscoverySummary as dj, type SessionEventPage as dk, SessionEventPersistenceError as dl, type SessionEventWriteLockInput as dm, type SessionEventWriteLocks as dn, type SessionGoalContinuationProjection as dp, SessionIdConflictError as dq, type SessionLineage as dr, SessionListAccessError as ds, type SessionListCursor as dt, SessionListCursorError as du, SessionListCursorExpiredError as dv, SessionListSnapshotLimitError as dw, type SessionMcpServerForRun as dx, SessionPinAccessError as dy, SessionPinVersionConflictError as dz, type AcquireLeaseResult as e, assertAgentCommandAuthorityInTransaction as e$, type TurnAttemptFenceRejectReason as e0, type UpdateConnectionInput as e1, type UpdateImportBatchCountsInput as e2, type UpdateKnowledgeMemoryInput as e3, type UpdateScheduledTaskInput as e4, type UpdateSessionMcpApprovalPolicyResult as e5, type UpdateSessionMcpServerCredentialsInput as e6, type UpdateSessionMcpServerCredentialsResult as e7, type UpsertCodexSubscriptionCredentialResult as e8, type UserLookup as e9, acknowledgeHostExportBatch as eA, acquireCodexCredentialLease as eB, acquireLease as eC, activateRigVersion as eD, activateWorkspaceInstructionPolicyRevision as eE, addSessionSystemUpdate as eF, addSessionSystemUpdateWithSourceMutation as eG, admitToolspaceTurnAttempt as eH, adoptCodexResetRedemptionAttempt as eI, advanceWorkspaceGeneration as eJ, advanceWorkspaceGenerationForDirectRequest as eK, advanceWorkspaceGenerationForRetainedProcess as eL, allAccountPermissions as eM, allWorkspacePermissions as eN, appendSessionEventToSandboxGroup as eO, appendSessionEvents as eP, appendSessionEventsAndUpdateSession as eQ, appendSessionEventsForTurnAttempt as eR, appendSessionEventsWithLockedSessionUpdate as eS, appendSessionHistoryItems as eT, applyContextCompaction as eU, applyCreditDebitUpToBalance as eV, applyCreditLedgerEntry as eW, applySessionTurnSettlement as eX, approveDeviceEnrollmentRequest as eY, areGitHubRepositoriesAllowedForWorkspace as eZ, armCodexCapacityWait as e_, type VariableSetForRun as ea, WORKSPACE_MEMORY_BLOCK_EMPTY as eb, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as ec, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as ed, type WorkspaceCaptureCommitResult as ee, type WorkspaceCaptureGcPlan as ef, type WorkspaceCaptureGcRow as eg, type WorkspaceCaptureRow as eh, type WorkspaceControlLockMode as ei, type WorkspaceControlMutationResult as ej, type WorkspaceControlRow as ek, type WorkspaceEnvironmentForRun as el, WorkspaceInstructionPolicyConflictError as em, WorkspaceInstructionPolicyInvalidOperationError as en, WorkspaceInstructionPolicyLegacyUnavailableError as eo, WorkspaceInstructionPolicyNotFoundError as ep, type WorkspaceMemoryOrigin as eq, type WorkspaceMemorySearchInput as er, type WorkspaceMemorySearchMode as es, type WorkspaceMemorySearchResult as et, type WorkspaceModelPolicy as eu, abandonCodexResetRedemptionBeforeProvider as ev, abandonRecordingForTurnAttempt as ew, acceptSessionApprovalDecision as ex, acceptSessionHumanInputResponse as ey, accrueWarmSeconds as ez, type ActiveRetainedProcessOwnerCount as f, createDb as f$, assertRuntimeDatabasePosture as f0, autoResumeSessionBranchInTransaction as f1, beginRigChangeVerificationAttempt as f2, beginSandboxRematerialization as f3, bindAuthorizedGitHubInstallationRepositories as f4, bindGitHubInstallationRepositories as f5, bootstrapWorkspace as f6, buildChildCompletionDigest as f7, buildCodexTokenResolver as f8, buildConnectionTokenResolver as f9, computeWorkspaceCaptureGcPlan as fA, confirmDrainCold as fB, consumeDeviceEnrollmentRequest as fC, consumeIntegrationOAuthStateNonce as fD, consumeNewSessionDraftInTransaction as fE, correctWorkspaceMemory as fF, countActiveApiKeysForWorkspace as fG, countActiveRetainedProcessesByOwnerState as fH, countActiveSessionHistoryItems as fI, countActiveSessionsForWorkspace as fJ, countActiveSessionsUsingEnvironment as fK, countActiveSessionsUsingVariableSet as fL, countConsecutiveReactiveRotations as fM, countExpiredDrainingSandboxLeases as fN, countQueuedTurns as fO, countRigs as fP, countSandboxLeasesByLiveness as fQ, countScheduledTasksForWorkspace as fR, countScheduledTasksUsingEnvironment as fS, countScheduledTasksUsingVariableSet as fT, countSessionHistoryItems as fU, countSessionsUsingRig as fV, countVariableSets as fW, countWorkspaceEnvironments as fX, countWorkspacesForAccount as fY, createApiKey as fZ, createConnection as f_, buildHostConnectionTokenResolver as fa, canonicalSessionCommandHash as fb, claimCodexResetRedemption as fc, claimExpiredFileUploadCleanup as fd, claimFileUploadCleanup as fe, claimHostExportBatch as ff, claimPendingSessionSystemUpdateOutbox as fg, claimPendingSessionWorkflowWakes as fh, claimSessionWorkForAttempt as fi, claimSlackBotPostOperation as fj, claimTerminalRetainedProcesses as fk, clearDurablePendingSessionToolCalls as fl, clearEnrollmentWentOffline as fm, clearPendingSessionToolspaceCall as fn, clearSessionContext as fo, clearSessionGoal as fp, clearedContextMarkerItem as fq, closePtySession as fr, closeSessionTurnAttemptInTransaction as fs, codexCapacityRefreshBackoffMs as ft, commitWarmingToWarm as fu, completeCodexResetRedemption as fv, completeExpiredFileUploadCleanup as fw, completeFileUpload as fx, completeFileUploadCleanup as fy, completeSlackBotPostOperation as fz, type ActiveSandboxPointer as g, evaluateSessionControl as g$, createDeviceEnrollmentRequest as g0, createEnrollment as g1, createFileUpload as g2, createImportBatch as g3, createKnowledgeMemory as g4, createRig as g5, createRigChange as g6, createRigVersion as g7, createRigVersionForChangePromotion as g8, createSandbox as g9, deleteVariableSetVariable as gA, deleteWorkspace as gB, deleteWorkspaceCaptureRows as gC, deleteWorkspaceEnvironment as gD, deleteWorkspaceEnvironmentVariable as gE, deleteWorkspacePack as gF, denyDeviceEnrollmentRequest as gG, diffWorkspaceInstructionPolicyContent as gH, diffWorkspaceInstructionPolicyRevisions as gI, disableCapabilityInstallation as gJ, disableHostExportConsumer as gK, disconnectAllCodexAccounts as gL, disconnectCodexAccount as gM, editQueuedTurnInTransaction as gN, enableCapabilityInstallation as gO, enablePackInstallation as gP, encodeSessionListCursor as gQ, encryptEnvironmentValue as gR, enqueueSessionTurn as gS, enqueueSessionWorkflowWake as gT, enqueueSessionWorkflowWakeIfRunnable as gU, enqueueSessionWorkflowWakeInTransaction as gV, ensureCodexRotationSettings as gW, ensureManagedAccessForUser as gX, estimateMemoryTokens as gY, evaluateGoalContinuation as gZ, evaluateRuntimeDatabasePosture as g_, createScheduledTask as ga, createScheduledTaskRun as gb, createSession as gc, createSessionGoal as gd, createSessionMcpServers as ge, createSessionWithIdempotencyKey as gf, createSessionWithIdempotencyKeyResult as gg, createSocialConnection as gh, createSocialPost as gi, createVariableSet as gj, createWorkspace as gk, createWorkspaceEnvironment as gl, createWorkspaceInstructionPolicyDraft as gm, databaseFailureCode as gn, deadLetterHostExportHead as go, decodeSessionListCursor as gp, decryptEnvironmentValue as gq, decryptedCapabilityHeaders as gr, deferRetainedProcessReconciliation as gs, deleteGitHubInstallationBinding as gt, deleteRecording as gu, deleteRig as gv, deleteRigIfNoActiveSessions as gw, deleteScheduledTask as gx, deleteSessionQueueItemInTransaction as gy, deleteVariableSet as gz, type AddSessionSystemUpdateInput as h, getSessionGoal as h$, evaluateSessionControls as h0, evaluateSessionDiscoveryControls as h1, expireSessionHumanInputRequest as h2, failHostExportBatch as h3, failSandboxRematerialization as h4, failWarmingToCold as h5, fenceCodexResetRedemptionSend as h6, fetchCodexRateLimitResetCreditsForAccount as h7, fetchCodexUsageForAccount as h8, finalizeEnrollmentByToken as h9, getManagedUserByEmail as hA, getMaterializedSandboxFileResources as hB, getNestedAgentDepthDeploymentPolicy as hC, getNewSessionDraftInTransaction as hD, getOpenPtySession as hE, getOrCreateSessionSystemUpdateOutbox as hF, getPackInstallation as hG, getPendingDeviceEnrollmentRequestByUserCode as hH, getPendingDeviceEnrollmentRequestByUserCodeGlobal as hI, getRecording as hJ, getRetainedFileArtifact as hK, getRetainedProcess as hL, getRig as hM, getRigByName as hN, getRigChange as hO, getRigName as hP, getRigVersion as hQ, getRigVersionById as hR, getSandbox as hS, getSandboxSessionEnvelope as hT, getScheduledTask as hU, getSession as hV, getSessionByCreateIdempotencyKey as hW, getSessionCodexState as hX, getSessionEvent as hY, getSessionEventByClientEventId as hZ, getSessionForSubject as h_, findActiveApiKeyByHash as ha, forceDrainOverLimitViewerOnlyBoxes as hb, frozenInitiatorForCommandActor as hc, getActiveSessionHistoryItems as hd, getActiveSessionTurnForExecution as he, getAnySessionInGroup as hf, getBillingBalance as hg, getBillingCustomer as hh, getCapabilityCatalogItem as hi, getCapabilityInstallation as hj, getCodexCapacityWaitForSession as hk, getCodexCredentialStatus as hl, getCodexResetRedemptionAttempt as hm, getCodexRotationSettings as hn, getComposerDraftInTransaction as ho, getConnectionMetadata as hp, getDeviceEnrollmentRequestByDeviceCode as hq, getEnrollment as hr, getFile as hs, getFileUpload as ht, getHostExportConsumerStatus as hu, getHumanInputResumeForEvent as hv, getKnowledgeMemory as hw, getLatestRunState as hx, getLatestStartedSessionTurn as hy, getManagedAccount as hz, type AddSessionSystemUpdateResult as i, listDistinctRigVersionIdsInGroup as i$, getSessionGoalWithContinuation as i0, getSessionHistoryItems as i1, getSessionHumanInputRequest as i2, getSessionLineage as i3, getSessionQueueSnapshot as i4, getSessionRootId as i5, getSessionSpawnDenial as i6, getSessionSpawnDenialByIdempotencyKey as i7, getSessionSystemUpdateOutboxByDedupeKey as i8, getSessionTurn as i9, heartbeatLeaseHolder as iA, importLegacyWorkspaceInstructionPolicyDraft as iB, ingestMachineMetricsSample as iC, initializeSessionStartAtomically as iD, insertFailedWorkspaceCapture as iE, insertMachineMetricsSeries as iF, insertPtySession as iG, insertRecording as iH, insertWorkspaceCapture as iI, inspectRuntimeDatabasePosture as iJ, installOrReadTurnExecutionPolicyForAttempt as iK, interruptedToolCallResult as iL, isCodexBilledTurn as iM, isDatabasePersistenceFailure as iN, isMemoryTextTooLong as iO, isRetryablePersistenceSqlState as iP, isSessionCompactionRequested as iQ, isSessionEventPersistenceError as iR, isStripeWebhookProcessed as iS, latestWorkspaceCapture as iT, listApiKeys as iU, listCapabilityCatalogItems as iV, listCapabilityInstallations as iW, listCodexAccountStatuses as iX, listCodexResetRedemptionRecoveries as iY, listConnectionsMetadata as iZ, listCreditBalancesByAccount as i_, getSessionTurnForAttempt as ia, getSlackBotPostOperation as ib, getSocialConnection as ic, getStoredCapabilityHeaderCiphertext as id, getStreamAcknowledgment as ie, getVariableSet as ig, getVariableSetByName as ih, getVariableSetValuesForRun as ii, getWorkspace as ij, getWorkspaceControlEvent as ik, getWorkspaceDefaultRigId as il, getWorkspaceEnvironment as im, getWorkspaceEnvironmentByName as io, getWorkspaceEnvironmentValuesForRun as ip, getWorkspaceGrant as iq, getWorkspaceInstructionPolicyRevision as ir, getWorkspaceModelPolicy as is, getWorkspacePack as it, grantWorkspaceAccess as iu, hasAuditableGitHubInstallationAuthority as iv, hasCreditLedgerEntry as iw, hashMemoryText as ix, heartbeatCodexCredentialLease as iy, heartbeatCodexCredentialLeaseUntil as iz, type AdoptCodexResetRedemptionResult as j, markSessionWorkflowWakeFailed as j$, listDistinctVariableSetIdsInGroup as j0, listEnabledMcpCapabilityServers as j1, listEnrollments as j2, listGitHubInstallationAccessForWorkspace as j3, listGitHubInstallationIdsForWorkspace as j4, listGitHubInstallationsForWorkspace as j5, listKnowledgeMemories as j6, listLiveModalSandboxLeaseAttributions as j7, listMeterableWarmLeases as j8, listOpenPtySessions as j9, listSessionsForSubject as jA, listSocialConnections as jB, listSocialPosts as jC, listUsageEvents as jD, listVariableSets as jE, listWorkspaceControlEvents as jF, listWorkspaceEnvironments as jG, listWorkspaceInstructionPolicyRevisions as jH, listWorkspaceMembers as jI, listWorkspacePacks as jJ, listWorkspacesForSubject as jK, loadCodexCredentialForRun as jL, loadConnectionCredentialForBroker as jM, loadIntegrationOAuthClient as jN, loadVariableSetForRun as jO, loadWorkspaceEnvironmentForRun as jP, lockSessionEventWriteRows as jQ, lockWorkspaceInferenceControl as jR, markFileUploadFailed as jS, markSandboxFileResourcesMaterialized as jT, markSandboxProviderReady as jU, markSandboxRestoreVerifying as jV, markScheduledTaskRunFailedIfQueued as jW, markSessionAttemptQuiesced as jX, markSessionSystemUpdateOutboxDeliveredInTransaction as jY, markSessionSystemUpdateOutboxFailed as jZ, markSessionWorkflowWakeDelivered as j_, listOutstandingSessionSystemUpdates as ja, listPackInstallations as jb, listPendingCodexCapacityWakeTargets as jc, listPendingSessionTurns as jd, listRecordings as je, listRegistryCatalogSurfaceKeys as jf, listRigChangeMonitoringSummaries as jg, listRigChanges as jh, listRigVersionMonitoringSummaries as ji, listRigVersions as jj, listRigs as jk, listSandboxes as jl, listScheduledTaskRuns as jm, listScheduledTasks as jn, listSessionDiscoverySummaries as jo, listSessionEventPage as jp, listSessionEvents as jq, listSessionHumanInputRequests as jr, listSessionIdsInGroup as js, listSessionMcpServerMetadata as jt, listSessionMcpServersForChildInheritance as ju, listSessionMcpServersForRun as jv, listSessionSpawnDenials as jw, listSessionSystemUpdatesForTurn as jx, listSessionTurns as jy, listSessions as jz, AgentCommandAuthorityError as k, releaseLeaseHolder as k$, markStaleRegistryCatalogItems as k0, markStripeWebhookProcessed as k1, markWarmLeaseInstanceLost as k2, materializeGoalContinuation as k3, mcpServerIdForCapability as k4, moveQueuedTurnInTransaction as k5, mutateSessionControlInTransaction as k6, mutateWorkspaceControlInTransaction as k7, nestedPostgresSqlState as k8, newSessionDraftToolsProvided as k9, recordCodexAccountConnectors as kA, recordCodexAccountUsage as kB, recordCodexAccountUsageWithWakeTargets as kC, recordCodexTokenRefresh as kD, recordConnectionTokenRefresh as kE, recordConnectionUsed as kF, recordLeaseDataPlaneUrl as kG, recordLeaseTerminalDataPlaneUrl as kH, recordPendingSessionToolCallResult as kI, recordRetainedProcessReconciliationProof as kJ, recordSessionActiveCodexCredential as kK, recordSkippedContextCompaction as kL, recordStreamAcknowledgment as kM, recordStripeWebhookEvent as kN, recordUsageEvent as kO, recordWarmingSandboxCreated as kP, recoverSessionDispatch as kQ, refreshOAuthConnectionCredential as kR, registerDbBinding as kS, registerHostExportConsumer as kT, registerInternalUpdateWakeInTransaction as kU, registerPendingSessionToolCall as kV, registerSessionTurnAttemptClaim as kW, registerSessionWorkflowWakeInTransaction as kX, registerWorkspacePack as kY, releaseCodexCredentialLease as kZ, releaseCodexResetRedemptionClaim as k_, nextSessionHistoryPosition as ka, normalizeBearerScheme as kb, normalizeMemoryText as kc, orphanedResultRowIndicesForRepair as kd, peekSessionWork as ke, persistDrainSnapshot as kf, persistWarmSnapshot as kg, planWorkspaceCaptureGc as kh, projectEffectiveControlForRelatedAccess as ki, projectSessionForRelatedAccess as kj, pruneHostExportOutbox as kk, publicNewSessionDraftOptions as kl, quarantineCodexCredentialForLease as km, reArmDrainingLease as kn, readActiveSandbox as ko, readLease as kp, readMachineMetricsLatest as kq, readMachineMetricsLatestForWorkspace as kr, readMachineMetricsSeries as ks, readWorkspaceArchiveCapturePreflight as kt, reapExpiredSessionListSnapshots as ku, reapStaleLeaseHolders as kv, reapStaleLeaseHoldersGlobal as kw, reconcileCodexCapacityWait as kx, reconcileColdLostLeaseInstanceBlockers as ky, recordAuditEvent as kz, type AgentInternalUpdateCommandResult as l, setSessionGoalStatusWithEvent as l$, releaseSlackBotPostOperationClaim as l0, removeWorkspaceMember as l1, renameCodexAccount as l2, renderWorkspaceMemoryBlock as l3, replaceIntegrationOAuthClient as l4, requestSessionCompaction as l5, requestSessionTurnRecovery as l6, requireFile as l7, requireScheduledTask as l8, requireSession as l9, saveComposerDraftInTransaction as lA, saveNewSessionDraftInTransaction as lB, saveRunState as lC, saveWorkspaceMemory as lD, searchWorkspaceMemories as lE, seedNewSessionDraftInTransaction as lF, sendAgentMessageInTransaction as lG, serializeEffectiveSessionControl as lH, sessionAuthorizationScopeFilter as lI, sessionSubject as lJ, sessionTreeStatsForSessions as lK, sessionsWithActiveOpOnEnrollment as lL, setActiveCodexCredential as lM, setActiveSandbox as lN, setCodexCredentialExhausted as lO, setCodexCredentialExhaustedWithWakeTargets as lP, setCodexCredentialStatus as lQ, setCodexCredentialStatusById as lR, setConnectionStatus as lS, setEnrollmentDisplayState as lT, setEnrollmentOpStreamState as lU, setEnrollmentWentOffline as lV, setInitialActiveCodexCredential as lW, setRlsContext as lX, setSessionCodexPin as lY, setSessionGoalLastContinuationTurn as lZ, setSessionGoalStatus as l_, requireSocialConnection as la, requireWorkspace as lb, reserveSessionCommandReceipt as lc, reserveToolspaceCallForAttempt as ld, resolveWorkspaceMemoryBlock as le, resumeHostExportConsumer as lf, retainWorkspaceMutationProcess as lg, retainedProcessReconciliationProof as lh, retainedProcessSettlementIdentity as li, retireHostExportConsumer as lj, revokeApiKey as lk, revokeConnection as ll, revokeEnrollment as lm, revokeViewer as ln, rewindHostExportConsumer as lo, rlsContextForWorkspace as lp, rlsStrategyFor as lq, rollbackWorkspaceInstructionPolicyRevision as lr, rotateWorkspaceArchives as ls, runIdempotentPersistenceTransaction as lt, runtimeDatabaseReadyCheck as lu, safeDatabaseErrorFacts as lv, sanitizeEventPayload as lw, sanitizeEventString as lx, sanitizeMemoryText as ly, sanitizeModelPayload as lz, type AppendEventInput as m, withWorkspaceRls as m$, setSessionLastInputTokensForTurnAttempt as m0, setSessionPin as m1, setSubjectRlsContext as m2, setTemporalWorkflowId as m3, setVariableSetVariable as m4, setWorkspaceDefaultRig as m5, setWorkspaceEnvironmentVariable as m6, settleCodexCredentialFailover as m7, settleCodexCredentialLeaseLoss as m8, settleRetainedProcess as m9, updateSessionGoalWithEvent as mA, updateSessionMcpApprovalPolicy as mB, updateSessionMcpServerCredentials as mC, updateSessionTitle as mD, updateVariableSet as mE, updateWorkspace as mF, updateWorkspaceEnvironment as mG, updateWorkspaceSettings as mH, upsertBillingCustomer as mI, upsertCapabilityCatalogItem as mJ, upsertCodexSubscriptionCredential as mK, upsertGitHubInstallation as mL, upsertMachineMetricsLatest as mM, upsertRegistryCapabilityCatalogItem as mN, upsertSandboxSessionEnvelope as mO, upsertSessionGoal as mP, upsertSessionGoalWithEvent as mQ, upsertWorkspaceModelPolicy as mR, validateHumanInputResponse as mS, verifyDirectWorkspaceMutationSettlement as mT, verifyRetainedProcessMutationSettlement as mU, verifyWorkspaceMutationSettlement as mV, withAccountRls as mW, withCodexCapacityMutation as mX, withCodexCredentialRefreshLock as mY, withCodexTokenDeadline as mZ, withRlsContext as m_, settleScheduledTaskRunInTransaction as ma, settleSessionAttemptInterruptions as mb, settleSessionIdleWithParentOutbox as mc, shortMemoryId as md, steerAgentSessionInTransaction as me, steerQueuedTurnInTransaction as mf, storeIntegrationOAuthClient as mg, submitHumanPromptInTransaction as mh, sumUsageQuantity as mi, supersedeSessionCurrentDirectionInTransaction as mj, touchEnrollmentLastSeen as mk, touchLeaseHolder as ml, updateCodexAllocatorEligibility as mm, updateCodexRotationSettings as mn, updateConnection as mo, updateImportBatchCounts as mp, updateKnowledgeMemory as mq, updatePackInstallationStatus as mr, updatePtySessionActivity as ms, updateRecording as mt, updateRig as mu, updateRigChangeStatus as mv, updateScheduledTask as mw, updateScheduledTaskRun as mx, updateSessionCommandReceiptResult as my, updateSessionGoal as mz, type ApplyContextCompactionResult as n, withWorkspaceSubjectRls as n0, withWorkspaceUsageLock as n1, workspaceCaptureAtRevision as n2, workspaceCodexSubscriptionActive as n3, type ApplySessionTurnSettlementInput as o, type ApplySessionTurnSettlementResult as p, provisionRoles, type ArmCodexCapacityWaitResult as q, type BootstrapWorkspaceInput as r, CODEX_CAPACITY_REFRESH_MIN_MS as s, CODEX_CREDENTIAL_LEASE_TTL_MS as t, CODEX_RESET_REDEMPTION_OUTCOMES as u, CODEX_ROTATION_STRATEGIES as v, type ClaimCodexResetRedemptionResult as w, type ClaimSessionWorkForAttemptInput as x, type ClaimSessionWorkForAttemptResult as y, type ClaimSlackBotPostOperationResult as z };