@opengeni/db 0.9.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4LG5NBTC.js → chunk-VUKRIBO5.js} +577 -12
- package/dist/chunk-VUKRIBO5.js.map +1 -0
- package/dist/{chunk-KW526IJA.js → chunk-Y5WZZVQK.js} +80 -4
- package/dist/chunk-Y5WZZVQK.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6372 -2189
- package/dist/index.js.map +1 -1
- package/dist/migrate.d.ts +6 -3
- package/dist/migrate.js +1 -1
- package/dist/provision-roles.d.ts +1122 -91
- package/dist/{schema-CdPGTHlD.d.ts → schema-CnpD6BcX.d.ts} +5908 -3626
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +19 -1
- package/drizzle/0053_codex_credential_leases.sql +2 -2
- package/drizzle/0057_durable_queue_control.sql +1 -1
- package/drizzle/0061_session_workflow_wake_outbox.sql +1 -1
- package/drizzle/0062_session_list_snapshot_reaper.sql +1 -1
- package/drizzle/0063_session_control_mega_foundation.sql +1 -1
- package/drizzle/0064_rotation_strategy_sharded_backfill.sql +1 -1
- package/drizzle/0065_codex_subscription_overview.sql +168 -0
- package/drizzle/0065_session_tool_policy.sql +38 -0
- package/drizzle/0067_session_event_payload_bounds.sql +2 -2
- package/drizzle/0068_workspace_control_event_bounds.sql +2 -2
- package/drizzle/0069_session_event_history_backfill.sql +2 -2
- package/drizzle/0074_session_activity_revisions.sql +2 -2
- package/drizzle/0106_session_attempt_mcp_approval_policies.sql +29 -0
- package/drizzle/0107_host_export_lineage_contract.sql +381 -0
- package/drizzle/0108_fence_invalidated_warming_epochs.sql +76 -0
- package/drizzle/0109_nested_agent_depth_expand.sql +42 -0
- package/drizzle/0110_nested_agent_depth_boundary.sql +480 -0
- package/drizzle/0111_nested_agent_depth_backfill.sql +49 -0
- package/drizzle/0112_nested_agent_depth_contract.sql +38 -0
- package/drizzle/0113_nested_agent_depth_validate.sql +13 -0
- package/drizzle/0114_nested_agent_depth_contract.sql +49 -0
- package/drizzle/0115_nested_agent_depth_validate.sql +11 -0
- package/drizzle/0116_nested_agent_depth_index.sql +4 -0
- package/drizzle/0117_sandbox_recovery_generations.sql +699 -0
- package/drizzle/0118_new_session_drafts.sql +59 -0
- package/drizzle/0119_pending_tool_output_policy.sql +5 -0
- package/drizzle/0120_durable_goal_wake.sql +360 -0
- package/drizzle/0121_goal_update_idempotency.sql +11 -0
- package/package.json +5 -4
- package/src/codex-token-resolver.ts +175 -14
- package/src/connection-token-resolver.ts +143 -120
- package/src/event-payload-sanitizer.ts +32 -2
- package/src/index.ts +7734 -1330
- package/src/migrate.ts +131 -2
- package/src/new-session-drafts.ts +144 -0
- package/src/schema.ts +626 -16
- package/src/session-control.ts +44 -18
- package/src/session-queue-commands.ts +94 -21
- package/src/session-tool-call-settlement.ts +6 -1
- package/dist/chunk-4LG5NBTC.js.map +0 -1
- package/dist/chunk-KW526IJA.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { TurnInitiatorContext, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck,
|
|
1
|
+
import { TurnInitiatorContext, SessionMcpApprovalPolicy, TurnInitiator, ResourceRef, ToolRef, ReasoningEffort, TurnExecutionPolicyV1, NewSessionDraftOptions, KnowledgeMemoryKind, McpCredentialsRequest, McpCredentialAuthNeededReason, McpConnectionResourceScope, ConnectionCredentialsPort, SessionEvent, SessionStatus, SessionHumanInputRequest, SystemUpdateClassification, SessionSystemUpdateKind, SessionSystemUpdatePayload, SessionSystemUpdate, SessionEventType, SessionTurnStatus, HumanInputQuestion, Permission, SessionTurn, ConnectionKind, ConnectionStatus, KnowledgeMemory, CapabilityKind, CapabilitySource, KnowledgeMemoryStatus, KnowledgeSourceRef, ScheduledTaskStatus, ScheduledTaskScheduleSpec, ScheduledTaskRunMode, ScheduledTaskOverlapPolicy, ScheduledTaskAgentConfig, SessionGoalCreatedBy, McpServerConnectionRef as McpServerConnectionRef$1, SocialProvider, SocialConnectionStatus, Session, SessionTurnSource, SandboxBackend, SandboxOs, FileAsset, FileUploadStatus, GitHubRepositoryScope, SessionGoal, SessionEventReadDirection, SessionEventSemanticClass, SessionEventPayloadMode, SessionAuthorizationListScope, CapabilityPack, RigChangeKind, RigChangeStatus, RigCheck, SessionToolPolicy, SessionGoalStatus, LineageNode, SessionMcpServerMetadata, RigVersion, BillingBalance, RigChange, AccessContext, HostEventExportBatch, HostUsageExportBatch, ApiKey, ConnectionMetadata, Rig, ScheduledTask, ScheduledTaskTriggerType, ScheduledTaskRun, SocialConnection, SocialPost, VariableSet, Workspace, CapabilityInstallation, PackInstallation, CapabilityCatalogItem, HumanInputResponse, ManagedAccount, SessionQueueSnapshot, WorkspaceControlEvent, AccessGrant, WorkspaceRegisteredPack, SessionListResponse, UsageEvent, WorkspaceMember, VariableSetVariableMetadata, PackInstallationStatus, ScheduledTaskRunStatus } from '@opengeni/contracts';
|
|
2
2
|
import { environmentsEncryptionKeyBytes, Settings, McpServerConnectionRef } from '@opengeni/config';
|
|
3
|
-
import { refreshCodexToken, CodexTokenSnapshot, CodexUsagePayload } from '@opengeni/codex';
|
|
3
|
+
import { refreshCodexToken, CodexRateLimitResetCreditsDetails, ResetCreditFetchFailureReason, CodexTokenSnapshot, CodexFetch, CodexUsagePayload } from '@opengeni/codex';
|
|
4
4
|
import { SQL } from 'drizzle-orm';
|
|
5
5
|
import { PgDatabase, PgTransactionConfig } from 'drizzle-orm/pg-core';
|
|
6
|
-
import
|
|
6
|
+
import postgres from 'postgres';
|
|
7
|
+
import { s as sessionCommandReceipts, w as workspaces, a as sessions, b as sessionTurns, c as sessionTurnAttempts, d as composerDrafts, n as newSessionDrafts, e as schema, f as enrollmentOsValues, g as enrollmentExposureValues, h as deviceEnrollmentStatusValues, i as enrollmentStatusValues, j as sandboxKindValues, k as sessionRecordingCodecValues, l as sessionRecordingModeValues, m as sessionRecordingStateValues } from './schema-CnpD6BcX.js';
|
|
7
8
|
import './migrate.js';
|
|
9
|
+
import { FetchLike, DnsLookup } from '@opengeni/network';
|
|
8
10
|
|
|
9
11
|
declare const SESSION_ANCESTRY_LIMIT = 10000;
|
|
10
|
-
type WorkspaceControlLockMode = "share" | "update";
|
|
12
|
+
type WorkspaceControlLockMode = "none" | "share" | "update";
|
|
11
13
|
type EffectiveControlState = "active" | "paused";
|
|
12
14
|
type SessionCommandActor = {
|
|
13
15
|
type: "human" | "operator";
|
|
@@ -144,7 +146,7 @@ declare function assertAgentCommandAuthorityInTransaction(db: Database, input: {
|
|
|
144
146
|
type: "agent_attempt";
|
|
145
147
|
}>;
|
|
146
148
|
targetSessionId: string;
|
|
147
|
-
action: "pause" | "resume" | "steer" | "message";
|
|
149
|
+
action: "pause" | "resume" | "steer" | "message" | "goal";
|
|
148
150
|
}): Promise<void>;
|
|
149
151
|
declare function canonicalSessionCommandHash(value: unknown): string;
|
|
150
152
|
declare function lockWorkspaceInferenceControl(db: Database, workspaceId: string, mode: WorkspaceControlLockMode): Promise<WorkspaceControlRow>;
|
|
@@ -200,6 +202,7 @@ declare function registerSessionTurnAttemptClaim(db: Database, input: {
|
|
|
200
202
|
temporalWorkflowRunId: string;
|
|
201
203
|
temporalActivityId: string;
|
|
202
204
|
verifiedControlRevision: number;
|
|
205
|
+
mcpApprovalPolicies: Record<string, SessionMcpApprovalPolicy>;
|
|
203
206
|
}): Promise<typeof sessionTurnAttempts.$inferSelect>;
|
|
204
207
|
/**
|
|
205
208
|
* Close the exact first-class owner while the caller still holds the owning
|
|
@@ -248,6 +251,7 @@ declare function reserveSessionCommandReceipt(db: Database, input: {
|
|
|
248
251
|
targetTurnId: string | null;
|
|
249
252
|
operationKey: string;
|
|
250
253
|
canonicalRequestHash: string;
|
|
254
|
+
identityScope?: "actor" | "goal_operation";
|
|
251
255
|
}): Promise<{
|
|
252
256
|
receipt: SessionCommandReceiptRow;
|
|
253
257
|
replay: boolean;
|
|
@@ -339,7 +343,7 @@ type FrozenTurnInitiator = {
|
|
|
339
343
|
};
|
|
340
344
|
declare function frozenInitiatorForCommandActor(db: Database, workspaceId: string, actor: SessionCommandActor, subjectLabel?: string): Promise<FrozenTurnInitiator>;
|
|
341
345
|
|
|
342
|
-
type QueueCommandConflictCode = "QUEUE_VERSION_CHANGED" | "QUEUE_PROMPT_STARTED" | "QUEUE_ANCHOR_CHANGED" | "PROMPT_CHANGED" | "DRAFT_CHANGED" | "DRAFT_NOT_EMPTY";
|
|
346
|
+
type QueueCommandConflictCode = "QUEUE_VERSION_CHANGED" | "QUEUE_PROMPT_STARTED" | "QUEUE_ANCHOR_CHANGED" | "PROMPT_CHANGED" | "DRAFT_CHANGED" | "DRAFT_NOT_EMPTY" | "EDIT_SOURCE_CHANGED";
|
|
343
347
|
declare class QueueCommandConflictError extends Error {
|
|
344
348
|
readonly code: QueueCommandConflictCode;
|
|
345
349
|
readonly current: {
|
|
@@ -429,6 +433,7 @@ declare function saveComposerDraftInTransaction(db: Database, input: {
|
|
|
429
433
|
text: string;
|
|
430
434
|
resources: ResourceRef[];
|
|
431
435
|
tools: ToolRef[];
|
|
436
|
+
toolsProvided: boolean;
|
|
432
437
|
model: string;
|
|
433
438
|
reasoningEffort: ReasoningEffort;
|
|
434
439
|
}): Promise<ComposerDraftRow>;
|
|
@@ -489,9 +494,12 @@ declare function submitHumanPromptInTransaction(db: Database, input: {
|
|
|
489
494
|
turnInstructions?: string | null;
|
|
490
495
|
resources: ResourceRef[];
|
|
491
496
|
tools: ToolRef[];
|
|
497
|
+
toolsProvided?: boolean;
|
|
492
498
|
model?: string | null;
|
|
493
499
|
reasoningEffort?: ReasoningEffort | null;
|
|
494
500
|
reasoningEffortFallback: ReasoningEffort;
|
|
501
|
+
/** Trusted API/core admission snapshot. Omitted only by legacy low-level callers. */
|
|
502
|
+
turnExecutionPolicy?: TurnExecutionPolicyV1;
|
|
495
503
|
source: "user" | "api";
|
|
496
504
|
mcpCredentialUpdates?: Array<{
|
|
497
505
|
id: string;
|
|
@@ -519,6 +527,42 @@ declare function steerAgentSessionInTransaction(db: Database, input: {
|
|
|
519
527
|
instruction: string;
|
|
520
528
|
}): Promise<AgentInternalUpdateCommandResult>;
|
|
521
529
|
|
|
530
|
+
type NewSessionDraftRow = typeof newSessionDrafts.$inferSelect;
|
|
531
|
+
declare class NewSessionDraftConflictError extends Error {
|
|
532
|
+
readonly currentRevision: number;
|
|
533
|
+
readonly name = "NewSessionDraftConflictError";
|
|
534
|
+
constructor(currentRevision: number);
|
|
535
|
+
}
|
|
536
|
+
declare class NewSessionDraftAccessError extends Error {
|
|
537
|
+
readonly name = "NewSessionDraftAccessError";
|
|
538
|
+
constructor();
|
|
539
|
+
}
|
|
540
|
+
declare function getNewSessionDraftInTransaction(db: Database, input: {
|
|
541
|
+
workspaceId: string;
|
|
542
|
+
subjectId: string;
|
|
543
|
+
lock?: boolean;
|
|
544
|
+
}): Promise<NewSessionDraftRow | null>;
|
|
545
|
+
declare function saveNewSessionDraftInTransaction(db: Database, input: {
|
|
546
|
+
accountId: string;
|
|
547
|
+
workspaceId: string;
|
|
548
|
+
subjectId: string;
|
|
549
|
+
expectedRevision: number;
|
|
550
|
+
text: string;
|
|
551
|
+
resources: ResourceRef[];
|
|
552
|
+
tools: ToolRef[];
|
|
553
|
+
model: string;
|
|
554
|
+
reasoningEffort: ReasoningEffort;
|
|
555
|
+
options: NewSessionDraftOptions;
|
|
556
|
+
/** API-key and delegated service subjects have no workspace-membership row. */
|
|
557
|
+
requireWorkspaceMembership?: boolean;
|
|
558
|
+
}): Promise<NewSessionDraftRow>;
|
|
559
|
+
/** Delete only the submitted revision; a newer sibling-tab revision survives. */
|
|
560
|
+
declare function consumeNewSessionDraftInTransaction(db: Database, input: {
|
|
561
|
+
workspaceId: string;
|
|
562
|
+
subjectId: string;
|
|
563
|
+
expectedRevision: number;
|
|
564
|
+
}): Promise<boolean>;
|
|
565
|
+
|
|
522
566
|
/** Provider-valid result for a started call whose durable outcome is unknown. */
|
|
523
567
|
declare function interruptedToolCallResult(input: {
|
|
524
568
|
callType: string;
|
|
@@ -551,7 +595,14 @@ declare function sanitizeEventString(value: string): string;
|
|
|
551
595
|
* combinations are traversed; non-string leaves pass through untouched. Object
|
|
552
596
|
* keys are sanitized too -- they are jsonb-constrained the same as values.
|
|
553
597
|
*/
|
|
554
|
-
|
|
598
|
+
type SanitizeEventPayloadOptions = {
|
|
599
|
+
/**
|
|
600
|
+
* Separately trusted, server-created retained-output evidence. Never populate
|
|
601
|
+
* this from a producer-controlled payload field.
|
|
602
|
+
*/
|
|
603
|
+
fullEvidence?: unknown;
|
|
604
|
+
};
|
|
605
|
+
declare function sanitizeEventPayload<T>(payload: T, options?: SanitizeEventPayloadOptions): T;
|
|
555
606
|
/**
|
|
556
607
|
* Make model-facing conversation data safe for Postgres without redacting it.
|
|
557
608
|
*
|
|
@@ -734,6 +785,22 @@ type ProvisionRolesOptions = {
|
|
|
734
785
|
*/
|
|
735
786
|
declare function provisionRoles(adminConnection: string, options?: ProvisionRolesOptions): Promise<ProvisionResult>;
|
|
736
787
|
|
|
788
|
+
type CodexTokenDeadlineClock = {
|
|
789
|
+
setTimeout: (callback: () => void, delayMs: number) => ReturnType<typeof globalThis.setTimeout>;
|
|
790
|
+
clearTimeout: (handle: ReturnType<typeof globalThis.setTimeout>) => void;
|
|
791
|
+
};
|
|
792
|
+
type CodexTokenDeadlineOptions = {
|
|
793
|
+
timeoutMs?: number | undefined;
|
|
794
|
+
signal?: AbortSignal | undefined;
|
|
795
|
+
clock?: CodexTokenDeadlineClock | undefined;
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Bound a refresh promise without abandoning its rejection handler when the
|
|
799
|
+
* deadline or cancellation wins. The provider promise is observed exactly
|
|
800
|
+
* once, while the observer itself always fulfills, so a late provider failure
|
|
801
|
+
* cannot become an unhandled rejection or replace the authoritative outcome.
|
|
802
|
+
*/
|
|
803
|
+
declare function withCodexTokenDeadline<T>(operation: Promise<T>, options?: CodexTokenDeadlineOptions): Promise<T>;
|
|
737
804
|
type CodexAuthDeps = {
|
|
738
805
|
loadCredential: typeof loadCodexCredentialForRun;
|
|
739
806
|
recordRefresh: typeof recordCodexTokenRefresh;
|
|
@@ -761,7 +828,23 @@ declare function buildCodexTokenResolver(db: Database, settings: Settings, works
|
|
|
761
828
|
* A refresh that stamps needs_relogin returns { status:"error", reason } and never
|
|
762
829
|
* hits the provider; a transient refresh error returns a plain error payload.
|
|
763
830
|
*/
|
|
764
|
-
declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string): Promise<CodexUsagePayload>;
|
|
831
|
+
declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): Promise<CodexUsagePayload>;
|
|
832
|
+
type CodexRateLimitResetCreditsAccountResult = {
|
|
833
|
+
ok: true;
|
|
834
|
+
status: number;
|
|
835
|
+
details: CodexRateLimitResetCreditsDetails;
|
|
836
|
+
} | {
|
|
837
|
+
ok: false;
|
|
838
|
+
status: number;
|
|
839
|
+
reason: ResetCreditFetchFailureReason | "needs_relogin";
|
|
840
|
+
};
|
|
841
|
+
/**
|
|
842
|
+
* Fresh detailed reset-credit inventory for one exact workspace credential.
|
|
843
|
+
* The token is refreshed through the same resolver as usage and never escapes
|
|
844
|
+
* this server-side function. Detailed rows are returned to the route only and
|
|
845
|
+
* are never persisted as redemption authority.
|
|
846
|
+
*/
|
|
847
|
+
declare function fetchCodexRateLimitResetCreditsForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): Promise<CodexRateLimitResetCreditsAccountResult>;
|
|
765
848
|
|
|
766
849
|
type ResolveConnectionCredentialResult = {
|
|
767
850
|
status: "ok";
|
|
@@ -787,6 +870,8 @@ type ResolveConnectionCredentialInput = {
|
|
|
787
870
|
/** @deprecated Use toolName. Retained for the API's pre-existing broker call shape. */
|
|
788
871
|
toolId?: string;
|
|
789
872
|
connectionRef: McpServerConnectionRef;
|
|
873
|
+
/** Exact MCP destination whose request would receive the resolved headers. */
|
|
874
|
+
destinationUrl: string;
|
|
790
875
|
forceRefresh?: boolean;
|
|
791
876
|
};
|
|
792
877
|
type HostMcpCredentialResolverContext = {
|
|
@@ -805,7 +890,7 @@ declare class HostMcpCredentialScopeError extends Error {
|
|
|
805
890
|
constructor(field: "accountId" | "workspaceId" | "sessionId");
|
|
806
891
|
}
|
|
807
892
|
declare class HostMcpCredentialBindingError extends Error {
|
|
808
|
-
constructor(field: "provider" | "providerDomain" | "connectionId" | "scopes" | "resource" | "selectedResources");
|
|
893
|
+
constructor(field: "provider" | "providerDomain" | "connectionId" | "scopes" | "resource" | "selectedResources" | "destinationUrl");
|
|
809
894
|
}
|
|
810
895
|
/**
|
|
811
896
|
* Adapts the public embedding credential port to the runtime's connection
|
|
@@ -824,6 +909,10 @@ type ConnectionBrokerDeps = {
|
|
|
824
909
|
keyBytes: typeof environmentsEncryptionKeyBytes;
|
|
825
910
|
now: () => Date;
|
|
826
911
|
};
|
|
912
|
+
type RefreshTransportOptions = {
|
|
913
|
+
fetchImpl?: FetchLike;
|
|
914
|
+
dnsLookup?: DnsLookup;
|
|
915
|
+
};
|
|
827
916
|
declare function buildConnectionTokenResolver(db: Database, settings: Settings, deps?: ConnectionBrokerDeps): (input: ResolveConnectionCredentialInput) => Promise<ResolveConnectionCredentialResult>;
|
|
828
917
|
declare class ConnectionRefreshHttpError extends Error {
|
|
829
918
|
readonly httpStatus: number;
|
|
@@ -836,12 +925,11 @@ declare class ConnectionRefreshHttpError extends Error {
|
|
|
836
925
|
* the canonical `Bearer`. A non-bearer scheme is passed through unchanged.
|
|
837
926
|
*/
|
|
838
927
|
declare function normalizeBearerScheme(tokenType: string | null | undefined): string;
|
|
839
|
-
declare function refreshOAuthConnectionCredential(cred: ConnectionCredentialForBroker, ref: McpServerConnectionRef, settings?:
|
|
928
|
+
declare function refreshOAuthConnectionCredential(cred: ConnectionCredentialForBroker, ref: McpServerConnectionRef, settings: Settings, transportOptions?: RefreshTransportOptions): Promise<{
|
|
840
929
|
credential: Record<string, unknown>;
|
|
841
930
|
expiresAt: Date | null;
|
|
842
931
|
grantedScopes?: string[];
|
|
843
932
|
}>;
|
|
844
|
-
declare function isPrivateAddress(address: string): boolean;
|
|
845
933
|
|
|
846
934
|
type Database = PgDatabase<any, typeof schema>;
|
|
847
935
|
type DbClient = {
|
|
@@ -852,6 +940,54 @@ type RlsContext = {
|
|
|
852
940
|
accountId: string;
|
|
853
941
|
workspaceId?: string | null;
|
|
854
942
|
};
|
|
943
|
+
type NestedAgentDepthPolicySource = "session" | "workspace" | "deployment" | "default";
|
|
944
|
+
type SessionDepthPolicy = {
|
|
945
|
+
rootSessionId: string;
|
|
946
|
+
nestedAgentDepth: number;
|
|
947
|
+
maxNestedAgentDepthOverride: number | null;
|
|
948
|
+
effectiveMaxNestedAgentDepth: number;
|
|
949
|
+
nestedAgentDepthPolicySource: NestedAgentDepthPolicySource;
|
|
950
|
+
nestedAgentDepthPolicySessionId: string | null;
|
|
951
|
+
};
|
|
952
|
+
type SessionSpawnDenialCode = "nested_agent_depth_exceeded" | "nested_agent_depth_override_forbidden";
|
|
953
|
+
type SessionSpawnDenial = {
|
|
954
|
+
id: string;
|
|
955
|
+
accountId: string;
|
|
956
|
+
workspaceId: string;
|
|
957
|
+
parentSessionId: string | null;
|
|
958
|
+
rootSessionId: string | null;
|
|
959
|
+
currentDepth: number;
|
|
960
|
+
attemptedDepth: number;
|
|
961
|
+
effectiveMaxNestedAgentDepth: number;
|
|
962
|
+
requestedMaxNestedAgentDepthOverride: number | null;
|
|
963
|
+
policySource: NestedAgentDepthPolicySource;
|
|
964
|
+
policySessionId: string | null;
|
|
965
|
+
subjectId: string | null;
|
|
966
|
+
code: SessionSpawnDenialCode;
|
|
967
|
+
idempotencyKey: string | null;
|
|
968
|
+
createdAt: string;
|
|
969
|
+
};
|
|
970
|
+
type NestedAgentDepthDeploymentPolicy = {
|
|
971
|
+
maxNestedAgentDepth: number;
|
|
972
|
+
policySource: "deployment" | "default";
|
|
973
|
+
};
|
|
974
|
+
type DbSession = Session & SessionDepthPolicy;
|
|
975
|
+
type SessionCreateSuccessResult = {
|
|
976
|
+
denied: false;
|
|
977
|
+
session: DbSession;
|
|
978
|
+
created: boolean;
|
|
979
|
+
};
|
|
980
|
+
type SessionCreateDeniedResult = {
|
|
981
|
+
denied: true;
|
|
982
|
+
created: false;
|
|
983
|
+
denial: SessionSpawnDenial;
|
|
984
|
+
};
|
|
985
|
+
type SessionCreateResult = SessionCreateSuccessResult | SessionCreateDeniedResult;
|
|
986
|
+
/** Thrown only after a denied create transaction has committed its evidence. */
|
|
987
|
+
declare class SessionSpawnDeniedDbError extends Error {
|
|
988
|
+
readonly denial: SessionSpawnDenial;
|
|
989
|
+
constructor(denial: SessionSpawnDenial);
|
|
990
|
+
}
|
|
855
991
|
/**
|
|
856
992
|
* RLS posture for the connection OpenGeni's query layer runs over (Step I, §7.7).
|
|
857
993
|
*
|
|
@@ -902,6 +1038,13 @@ type CreateDbOptions = {
|
|
|
902
1038
|
userLookup?: UserLookup;
|
|
903
1039
|
/** postgres-js pool size; defaults to today's `10`. */
|
|
904
1040
|
max?: number;
|
|
1041
|
+
/**
|
|
1042
|
+
* Connection-local default transaction isolation sent in the postgres-js
|
|
1043
|
+
* startup parameters. This is intentionally not a role/database default:
|
|
1044
|
+
* tests and embedded callers can exercise a different ambient isolation
|
|
1045
|
+
* without mutating a shared PostgreSQL role or affecting other connections.
|
|
1046
|
+
*/
|
|
1047
|
+
isolationLevel?: postgres.ConnectionParameters["default_transaction_isolation"];
|
|
905
1048
|
};
|
|
906
1049
|
/** The strategy bound to a handle (or the `"force"` default). */
|
|
907
1050
|
declare function rlsStrategyFor(db: Database): RlsStrategy;
|
|
@@ -1035,6 +1178,8 @@ declare function withWorkspaceRls<T>(db: Database, workspaceId: string, fn: (db:
|
|
|
1035
1178
|
* even if a future query accidentally omits its explicit subject predicate.
|
|
1036
1179
|
*/
|
|
1037
1180
|
declare function withWorkspaceSubjectRls<T>(db: Database, workspaceId: string, subjectId: string, fn: (db: Database) => Promise<T>, transactionConfig?: PgTransactionConfig): Promise<T>;
|
|
1181
|
+
/** Apply and verify actor-private RLS on an already transaction-pinned handle. */
|
|
1182
|
+
declare function setSubjectRlsContext(db: Database, subjectId: string): Promise<void>;
|
|
1038
1183
|
declare function withWorkspaceUsageLock<T>(db: Database, workspaceId: string, fn: (db: Database) => Promise<T>): Promise<T>;
|
|
1039
1184
|
declare function withAccountRls<T>(db: Database, accountId: string, fn: (db: Database) => Promise<T>): Promise<T>;
|
|
1040
1185
|
declare const allWorkspacePermissions: Permission[];
|
|
@@ -1241,6 +1386,11 @@ declare function countScheduledTasksForWorkspace(db: Database, workspaceId: stri
|
|
|
1241
1386
|
type AppendEventInput = {
|
|
1242
1387
|
type: SessionEventType;
|
|
1243
1388
|
payload?: unknown;
|
|
1389
|
+
/**
|
|
1390
|
+
* Server-created retained-output evidence for canonical audit truncation.
|
|
1391
|
+
* Producer payload fields are never trusted as evidence.
|
|
1392
|
+
*/
|
|
1393
|
+
retainedOutputEvidence?: unknown;
|
|
1244
1394
|
clientEventId?: string;
|
|
1245
1395
|
turnId?: string | null;
|
|
1246
1396
|
turnGeneration?: number | null;
|
|
@@ -1534,7 +1684,7 @@ type CreateSessionMcpServerInput = {
|
|
|
1534
1684
|
allowedTools?: string[] | null;
|
|
1535
1685
|
timeoutMs?: number | null;
|
|
1536
1686
|
cacheToolsList?: boolean | null;
|
|
1537
|
-
requireApproval?:
|
|
1687
|
+
requireApproval?: SessionMcpApprovalPolicy | null;
|
|
1538
1688
|
connectionRef?: McpServerConnectionRef$1 | null;
|
|
1539
1689
|
headersEncrypted?: Record<string, string>;
|
|
1540
1690
|
};
|
|
@@ -1546,11 +1696,15 @@ type UpdateSessionMcpServerCredentialsResult = {
|
|
|
1546
1696
|
servers: SessionMcpServerMetadata[];
|
|
1547
1697
|
missingIds: string[];
|
|
1548
1698
|
};
|
|
1699
|
+
type UpdateSessionMcpApprovalPolicyResult = {
|
|
1700
|
+
server: SessionMcpServerMetadata | null;
|
|
1701
|
+
changed: boolean;
|
|
1702
|
+
};
|
|
1549
1703
|
type SessionMcpServerForRun = SessionMcpServerMetadata & {
|
|
1550
1704
|
allowedTools?: string[];
|
|
1551
1705
|
timeoutMs?: number;
|
|
1552
1706
|
cacheToolsList?: boolean;
|
|
1553
|
-
requireApproval
|
|
1707
|
+
requireApproval: SessionMcpApprovalPolicy;
|
|
1554
1708
|
headers: Record<string, string>;
|
|
1555
1709
|
};
|
|
1556
1710
|
type EnqueueSessionTurnInput = {
|
|
@@ -1564,6 +1718,7 @@ type EnqueueSessionTurnInput = {
|
|
|
1564
1718
|
turnInstructions?: string | null;
|
|
1565
1719
|
resources: ResourceRef[];
|
|
1566
1720
|
tools: ToolRef[];
|
|
1721
|
+
toolsProvided?: boolean;
|
|
1567
1722
|
model: string;
|
|
1568
1723
|
reasoningEffort: ReasoningEffort;
|
|
1569
1724
|
sandboxBackend: SandboxBackend;
|
|
@@ -1601,6 +1756,17 @@ declare function createFileUpload(db: Database, input: {
|
|
|
1601
1756
|
}>;
|
|
1602
1757
|
declare function getFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset | null>;
|
|
1603
1758
|
declare function requireFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset>;
|
|
1759
|
+
type RetainedFileArtifact = {
|
|
1760
|
+
file: FileAsset;
|
|
1761
|
+
uploadStatus: FileUploadStatus | null;
|
|
1762
|
+
uploadExpiresAt: Date | null;
|
|
1763
|
+
};
|
|
1764
|
+
/**
|
|
1765
|
+
* RLS-scoped file lookup with just enough upload lifecycle truth to distinguish
|
|
1766
|
+
* pending, failed, and expired artifact references. The bytes and provider
|
|
1767
|
+
* location remain in the existing FileAsset/object-storage seam.
|
|
1768
|
+
*/
|
|
1769
|
+
declare function getRetainedFileArtifact(db: Database, workspaceId: string, fileId: string): Promise<RetainedFileArtifact | null>;
|
|
1604
1770
|
declare function getFileUpload(db: Database, workspaceId: string, uploadId: string): Promise<{
|
|
1605
1771
|
id: string;
|
|
1606
1772
|
status: FileUploadStatus;
|
|
@@ -2087,6 +2253,15 @@ type CodexCredentialForRun = {
|
|
|
2087
2253
|
* accessor — auto-activates a brand-new first account and ensures the
|
|
2088
2254
|
* rotation-settings row exists.
|
|
2089
2255
|
*/
|
|
2256
|
+
type UpsertCodexSubscriptionCredentialResult = {
|
|
2257
|
+
kind: "upserted";
|
|
2258
|
+
id: string;
|
|
2259
|
+
isNew: boolean;
|
|
2260
|
+
} | {
|
|
2261
|
+
kind: "unresolved_redemption";
|
|
2262
|
+
id: string;
|
|
2263
|
+
isNew: false;
|
|
2264
|
+
};
|
|
2090
2265
|
declare function upsertCodexSubscriptionCredential(db: Database, input: {
|
|
2091
2266
|
accountId: string;
|
|
2092
2267
|
workspaceId: string;
|
|
@@ -2099,10 +2274,9 @@ declare function upsertCodexSubscriptionCredential(db: Database, input: {
|
|
|
2099
2274
|
lastRefreshAt: Date | null;
|
|
2100
2275
|
accountEmail?: string | null;
|
|
2101
2276
|
label?: string | null;
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
}>;
|
|
2277
|
+
/** Direct managed-cookie human who most recently connected this row. */
|
|
2278
|
+
connectedBySubjectId?: string | null;
|
|
2279
|
+
}): Promise<UpsertCodexSubscriptionCredentialResult>;
|
|
2106
2280
|
/**
|
|
2107
2281
|
* The ONLY decrypt-read accessor. Fails closed. Never call from an API route that
|
|
2108
2282
|
* returns the result.
|
|
@@ -2231,6 +2405,12 @@ type CodexAccountStatus = {
|
|
|
2231
2405
|
status: string;
|
|
2232
2406
|
/** New automatic allocations only; health/refresh and existing turns remain independent. */
|
|
2233
2407
|
allocatorEnabled: boolean;
|
|
2408
|
+
allocatorVersion: number;
|
|
2409
|
+
allocatorUpdatedBySubjectId: string | null;
|
|
2410
|
+
allocatorUpdatedAt: Date | null;
|
|
2411
|
+
resetCreditAvailableCount: number | null;
|
|
2412
|
+
resetCreditsCheckedAt: Date | null;
|
|
2413
|
+
connectedBySubjectId: string | null;
|
|
2234
2414
|
isActive: boolean;
|
|
2235
2415
|
expiresAt: Date | null;
|
|
2236
2416
|
lastRefreshAt: Date | null;
|
|
@@ -2250,7 +2430,7 @@ type CodexAccountStatus = {
|
|
|
2250
2430
|
* the selection cursor gives deterministic fairness after those holders drain.
|
|
2251
2431
|
* None of these fields contains credential material.
|
|
2252
2432
|
*/
|
|
2253
|
-
type CodexLeaseAccountStatus = CodexAccountStatus & {
|
|
2433
|
+
type CodexLeaseAccountStatus = Omit<CodexAccountStatus, "allocatorVersion" | "allocatorUpdatedBySubjectId" | "allocatorUpdatedAt" | "resetCreditAvailableCount" | "resetCreditsCheckedAt" | "connectedBySubjectId"> & {
|
|
2254
2434
|
activeLeaseCount: number;
|
|
2255
2435
|
selectionCount: number;
|
|
2256
2436
|
lastSelectedAt: Date | null;
|
|
@@ -2552,13 +2732,198 @@ declare function quarantineCodexCredentialForLease(db: Database, input: {
|
|
|
2552
2732
|
* the workspace active pointer. Ordered by created_at ASC (stable list order).
|
|
2553
2733
|
*/
|
|
2554
2734
|
declare function listCodexAccountStatuses(db: Database, workspaceId: string): Promise<CodexAccountStatus[]>;
|
|
2735
|
+
type CodexAllocatorUpdateResult = {
|
|
2736
|
+
kind: "updated" | "unchanged";
|
|
2737
|
+
allocatorEnabled: boolean;
|
|
2738
|
+
allocatorVersion: number;
|
|
2739
|
+
allocatorUpdatedBySubjectId: string | null;
|
|
2740
|
+
allocatorUpdatedAt: Date | null;
|
|
2741
|
+
} | {
|
|
2742
|
+
kind: "conflict";
|
|
2743
|
+
allocatorEnabled: boolean;
|
|
2744
|
+
allocatorVersion: number;
|
|
2745
|
+
allocatorUpdatedBySubjectId: string | null;
|
|
2746
|
+
allocatorUpdatedAt: Date | null;
|
|
2747
|
+
} | {
|
|
2748
|
+
kind: "not_found";
|
|
2749
|
+
};
|
|
2750
|
+
/**
|
|
2751
|
+
* Toggle only NEW allocator eligibility under credential-row OCC.
|
|
2752
|
+
*
|
|
2753
|
+
* Same-state writes are idempotent even when `expectedVersion` is stale. A real
|
|
2754
|
+
* state transition requires the exact current version, increments only the
|
|
2755
|
+
* allocator version, and writes one audit row in the same transaction. It never
|
|
2756
|
+
* touches credential `version`, health, encrypted material, cooldown, or quota.
|
|
2757
|
+
*/
|
|
2758
|
+
declare function updateCodexAllocatorEligibility(db: Database, input: {
|
|
2759
|
+
accountId: string;
|
|
2760
|
+
workspaceId: string;
|
|
2761
|
+
credentialId: string;
|
|
2762
|
+
subjectId: string;
|
|
2763
|
+
enabled: boolean;
|
|
2764
|
+
expectedVersion: number;
|
|
2765
|
+
}): Promise<CodexCapacityMutationResult<CodexAllocatorUpdateResult>>;
|
|
2766
|
+
declare const CODEX_RESET_REDEMPTION_OUTCOMES: readonly ["reset", "nothingToReset", "noCredit", "alreadyRedeemed"];
|
|
2767
|
+
type CodexResetRedemptionOutcome = (typeof CODEX_RESET_REDEMPTION_OUTCOMES)[number];
|
|
2768
|
+
type CodexResetRedemptionStatus = "processing" | "provider_started" | "completed";
|
|
2769
|
+
type CodexResetRedemptionAttempt = {
|
|
2770
|
+
id: string;
|
|
2771
|
+
accountId: string;
|
|
2772
|
+
workspaceId: string;
|
|
2773
|
+
credentialId: string;
|
|
2774
|
+
subjectId: string;
|
|
2775
|
+
browserSessionHash: string;
|
|
2776
|
+
creditId: string;
|
|
2777
|
+
upstreamIdempotencyKey: string;
|
|
2778
|
+
status: CodexResetRedemptionStatus;
|
|
2779
|
+
outcome: CodexResetRedemptionOutcome | null;
|
|
2780
|
+
claimHolderId: string | null;
|
|
2781
|
+
claimExpiresAt: Date | null;
|
|
2782
|
+
confirmationExpiresAt: Date;
|
|
2783
|
+
providerStartedAt: Date | null;
|
|
2784
|
+
completedAt: Date | null;
|
|
2785
|
+
lastFailureKind: string | null;
|
|
2786
|
+
retryCount: number;
|
|
2787
|
+
createdAt: Date;
|
|
2788
|
+
updatedAt: Date;
|
|
2789
|
+
};
|
|
2790
|
+
/** Metadata-only attempt read used to resume a browser-session-bound ambiguity. */
|
|
2791
|
+
declare function getCodexResetRedemptionAttempt(db: Database, workspaceId: string, attemptId: string): Promise<CodexResetRedemptionAttempt | null>;
|
|
2792
|
+
type CodexResetRedemptionRecovery = {
|
|
2793
|
+
attemptId: string;
|
|
2794
|
+
credentialId: string;
|
|
2795
|
+
creditId: string;
|
|
2796
|
+
status: "provider_started" | "completed";
|
|
2797
|
+
outcome: CodexResetRedemptionOutcome | null;
|
|
2798
|
+
providerStartedAt: Date | null;
|
|
2799
|
+
completedAt: Date | null;
|
|
2800
|
+
createdAt: Date;
|
|
2801
|
+
updatedAt: Date;
|
|
2802
|
+
};
|
|
2803
|
+
/**
|
|
2804
|
+
* Cookie-owner discovery source for durable ambiguous/completed attempts.
|
|
2805
|
+
* Browser storage is never required to recover these non-secret identifiers.
|
|
2806
|
+
*/
|
|
2807
|
+
declare function listCodexResetRedemptionRecoveries(db: Database, input: {
|
|
2808
|
+
accountId: string;
|
|
2809
|
+
workspaceId: string;
|
|
2810
|
+
subjectId: string;
|
|
2811
|
+
}): Promise<CodexResetRedemptionRecovery[]>;
|
|
2812
|
+
type AdoptCodexResetRedemptionResult = {
|
|
2813
|
+
kind: "current" | "adopted";
|
|
2814
|
+
attempt: CodexResetRedemptionAttempt;
|
|
2815
|
+
} | {
|
|
2816
|
+
kind: "in_progress";
|
|
2817
|
+
} | {
|
|
2818
|
+
kind: "not_found";
|
|
2819
|
+
} | {
|
|
2820
|
+
kind: "forbidden";
|
|
2821
|
+
} | {
|
|
2822
|
+
kind: "conflict";
|
|
2823
|
+
};
|
|
2824
|
+
/** Adopt a released durable ambiguity/completion into the owner's current browser session. */
|
|
2825
|
+
declare function adoptCodexResetRedemptionAttempt(db: Database, input: {
|
|
2826
|
+
accountId: string;
|
|
2827
|
+
workspaceId: string;
|
|
2828
|
+
attemptId: string;
|
|
2829
|
+
credentialId: string;
|
|
2830
|
+
creditId: string;
|
|
2831
|
+
subjectId: string;
|
|
2832
|
+
browserSessionHash: string;
|
|
2833
|
+
}): Promise<AdoptCodexResetRedemptionResult>;
|
|
2834
|
+
type ClaimCodexResetRedemptionResult = {
|
|
2835
|
+
kind: "claimed";
|
|
2836
|
+
attempt: CodexResetRedemptionAttempt;
|
|
2837
|
+
} | {
|
|
2838
|
+
kind: "in_progress";
|
|
2839
|
+
attempt: CodexResetRedemptionAttempt;
|
|
2840
|
+
} | {
|
|
2841
|
+
kind: "completed";
|
|
2842
|
+
attempt: CodexResetRedemptionAttempt;
|
|
2843
|
+
} | {
|
|
2844
|
+
kind: "not_found";
|
|
2845
|
+
} | {
|
|
2846
|
+
kind: "forbidden";
|
|
2847
|
+
} | {
|
|
2848
|
+
kind: "conflict";
|
|
2849
|
+
};
|
|
2850
|
+
/**
|
|
2851
|
+
* Claim or reclaim one logical redemption across API replicas/crashes.
|
|
2852
|
+
*
|
|
2853
|
+
* A transaction advisory lock closes the initial INSERT race. A live claim
|
|
2854
|
+
* yields `in_progress`; an expired/released claim is reclaimed without changing
|
|
2855
|
+
* the status or upstream key. Existing attempt identity is immutable.
|
|
2856
|
+
*/
|
|
2857
|
+
declare function claimCodexResetRedemption(db: Database, input: {
|
|
2858
|
+
id: string;
|
|
2859
|
+
accountId: string;
|
|
2860
|
+
workspaceId: string;
|
|
2861
|
+
credentialId: string;
|
|
2862
|
+
subjectId: string;
|
|
2863
|
+
browserSessionHash: string;
|
|
2864
|
+
creditId: string;
|
|
2865
|
+
confirmationExpiresAt: Date;
|
|
2866
|
+
claimHolderId: string;
|
|
2867
|
+
claimTtlMs?: number;
|
|
2868
|
+
}): Promise<ClaimCodexResetRedemptionResult>;
|
|
2869
|
+
type CodexResetRedemptionSendNotReadyReason = "not_found" | "identity_mismatch" | "claim_expired" | "confirmation_expired" | "credential_unavailable" | "already_completed";
|
|
2870
|
+
type FenceCodexResetRedemptionSendResult = {
|
|
2871
|
+
kind: "ready";
|
|
2872
|
+
attempt: CodexResetRedemptionAttempt;
|
|
2873
|
+
} | {
|
|
2874
|
+
kind: "not_ready";
|
|
2875
|
+
reason: CodexResetRedemptionSendNotReadyReason;
|
|
2876
|
+
};
|
|
2877
|
+
/**
|
|
2878
|
+
* Final DB-time irreversible-send fence, called only after preflight and token
|
|
2879
|
+
* resolution and immediately before every provider POST (including ambiguity
|
|
2880
|
+
* retries). The credential SHARE lock serializes against disconnect and
|
|
2881
|
+
* ownership-changing reconnect. The claim is extended beyond the bounded
|
|
2882
|
+
* consume operation in the same transaction that persists provider_started.
|
|
2883
|
+
*/
|
|
2884
|
+
declare function fenceCodexResetRedemptionSend(db: Database, input: {
|
|
2885
|
+
accountId: string;
|
|
2886
|
+
workspaceId: string;
|
|
2887
|
+
attemptId: string;
|
|
2888
|
+
claimHolderId: string;
|
|
2889
|
+
credentialId: string;
|
|
2890
|
+
subjectId: string;
|
|
2891
|
+
browserSessionHash: string;
|
|
2892
|
+
sendLeaseMs?: number;
|
|
2893
|
+
}): Promise<FenceCodexResetRedemptionSendResult>;
|
|
2894
|
+
/** Delete only definite pre-provider work still owned by this request. */
|
|
2895
|
+
declare function abandonCodexResetRedemptionBeforeProvider(db: Database, input: {
|
|
2896
|
+
accountId: string;
|
|
2897
|
+
workspaceId: string;
|
|
2898
|
+
attemptId: string;
|
|
2899
|
+
claimHolderId: string;
|
|
2900
|
+
}): Promise<boolean>;
|
|
2901
|
+
/** Release a failed claim while preserving processing/provider_started truth. */
|
|
2902
|
+
declare function releaseCodexResetRedemptionClaim(db: Database, input: {
|
|
2903
|
+
accountId: string;
|
|
2904
|
+
workspaceId: string;
|
|
2905
|
+
attemptId: string;
|
|
2906
|
+
claimHolderId: string;
|
|
2907
|
+
failureKind: string;
|
|
2908
|
+
}): Promise<boolean>;
|
|
2909
|
+
/** Persist the exact provider outcome, cooldown repair, and audit atomically. */
|
|
2910
|
+
declare function completeCodexResetRedemption(db: Database, input: {
|
|
2911
|
+
accountId: string;
|
|
2912
|
+
workspaceId: string;
|
|
2913
|
+
attemptId: string;
|
|
2914
|
+
claimHolderId: string;
|
|
2915
|
+
outcome: CodexResetRedemptionOutcome;
|
|
2916
|
+
}): Promise<CodexCapacityMutationResult<CodexResetRedemptionAttempt | null>>;
|
|
2555
2917
|
/** The P2 usage-cache snapshot written by the refreshing usage wrapper. */
|
|
2556
2918
|
type CodexAccountUsageSnapshot = {
|
|
2557
|
-
primaryUsedPercent
|
|
2558
|
-
primaryResetAt
|
|
2559
|
-
secondaryUsedPercent
|
|
2560
|
-
secondaryResetAt
|
|
2561
|
-
|
|
2919
|
+
primaryUsedPercent?: number | null;
|
|
2920
|
+
primaryResetAt?: Date | null;
|
|
2921
|
+
secondaryUsedPercent?: number | null;
|
|
2922
|
+
secondaryResetAt?: Date | null;
|
|
2923
|
+
/** Present only when the quota body parsed successfully. */
|
|
2924
|
+
checkedAt?: Date;
|
|
2925
|
+
resetCreditAvailableCount?: number | null;
|
|
2926
|
+
resetCreditsCheckedAt?: Date | null;
|
|
2562
2927
|
};
|
|
2563
2928
|
/**
|
|
2564
2929
|
* Cache-write for P2 quota bars: persist the five plaintext usage columns on a
|
|
@@ -2704,9 +3069,13 @@ declare function recordSessionActiveCodexCredential(db: Database, workspaceId: s
|
|
|
2704
3069
|
declare function disconnectCodexAccount(db: Database, workspaceId: string, credentialId: string): Promise<{
|
|
2705
3070
|
removed: boolean;
|
|
2706
3071
|
newActiveCredentialId: string | null;
|
|
3072
|
+
blockedByUnresolvedRedemption: boolean;
|
|
3073
|
+
}>;
|
|
3074
|
+
/** Legacy "disconnect all"; atomically rejects when any provider work is unresolved. */
|
|
3075
|
+
declare function disconnectAllCodexAccounts(db: Database, workspaceId: string): Promise<{
|
|
3076
|
+
removed: number;
|
|
3077
|
+
blockedCredentialIds: string[];
|
|
2707
3078
|
}>;
|
|
2708
|
-
/** Legacy "disconnect all" (old workspace-wide behavior). Returns rows removed. */
|
|
2709
|
-
declare function disconnectAllCodexAccounts(db: Database, workspaceId: string): Promise<number>;
|
|
2710
3079
|
declare function recordAuditEvent(db: Database, input: {
|
|
2711
3080
|
accountId: string;
|
|
2712
3081
|
workspaceId?: string | null;
|
|
@@ -2739,7 +3108,15 @@ declare function updateSessionMcpServerCredentials(db: Database, input: {
|
|
|
2739
3108
|
sessionId: string;
|
|
2740
3109
|
updates: UpdateSessionMcpServerCredentialsInput[];
|
|
2741
3110
|
}): Promise<UpdateSessionMcpServerCredentialsResult>;
|
|
2742
|
-
declare function
|
|
3111
|
+
declare function updateSessionMcpApprovalPolicy(db: Database, input: {
|
|
3112
|
+
workspaceId: string;
|
|
3113
|
+
sessionId: string;
|
|
3114
|
+
serverId: string;
|
|
3115
|
+
requireApproval: SessionMcpApprovalPolicy;
|
|
3116
|
+
}): Promise<UpdateSessionMcpApprovalPolicyResult>;
|
|
3117
|
+
declare function listSessionMcpServersForRun(db: Database, workspaceId: string, sessionId: string, attemptId: string, encryptionKey: Uint8Array | null): Promise<SessionMcpServerForRun[]>;
|
|
3118
|
+
/** Read the persisted deployment fallback; process configuration is not policy authority. */
|
|
3119
|
+
declare function getNestedAgentDepthDeploymentPolicy(db: Database): Promise<NestedAgentDepthDeploymentPolicy>;
|
|
2743
3120
|
type AgentSessionCreationActor = Extract<SessionCommandActor, {
|
|
2744
3121
|
type: "agent_attempt";
|
|
2745
3122
|
}>;
|
|
@@ -2748,7 +3125,7 @@ declare class SessionIdConflictError extends Error {
|
|
|
2748
3125
|
readonly sessionId: string;
|
|
2749
3126
|
constructor(sessionId: string);
|
|
2750
3127
|
}
|
|
2751
|
-
|
|
3128
|
+
type SessionCreateInput = {
|
|
2752
3129
|
requestedSessionId?: string;
|
|
2753
3130
|
accountId: string;
|
|
2754
3131
|
workspaceId: string;
|
|
@@ -2756,12 +3133,8 @@ declare function createSession(db: Database, input: {
|
|
|
2756
3133
|
initialTurnInstructions?: string | null;
|
|
2757
3134
|
resources: ResourceRef[];
|
|
2758
3135
|
tools?: ToolRef[];
|
|
3136
|
+
toolPolicy?: SessionToolPolicy | null;
|
|
2759
3137
|
metadata: Record<string, unknown>;
|
|
2760
|
-
/**
|
|
2761
|
-
* Frozen creator authority. Legacy/test-only callers may omit this and get
|
|
2762
|
-
* an explicit unattributed service sentinel; production producers must pass
|
|
2763
|
-
* an authenticated subject or named service.
|
|
2764
|
-
*/
|
|
2765
3138
|
createdBy?: TurnInitiator;
|
|
2766
3139
|
createdByContext?: TurnInitiatorContext;
|
|
2767
3140
|
createdByActor?: AgentSessionCreationActor | null;
|
|
@@ -2777,47 +3150,40 @@ declare function createSession(db: Database, input: {
|
|
|
2777
3150
|
sandboxGroupId?: string | null;
|
|
2778
3151
|
sandboxOs?: SandboxOs;
|
|
2779
3152
|
mcpServers?: CreateSessionMcpServerInput[];
|
|
2780
|
-
|
|
3153
|
+
maxNestedAgentDepthOverride?: number | null;
|
|
3154
|
+
allowNestedAgentDepthIncrease?: boolean;
|
|
3155
|
+
subjectId?: string | null;
|
|
3156
|
+
};
|
|
3157
|
+
declare function createSession(db: Database, input: SessionCreateInput): Promise<DbSession>;
|
|
2781
3158
|
/**
|
|
2782
3159
|
* Inserts a session under a workspace-scoped CREATE idempotency key, collapsing
|
|
2783
|
-
* a concurrent race on the same key to a single row.
|
|
2784
|
-
*
|
|
2785
|
-
*
|
|
2786
|
-
*
|
|
2787
|
-
* callers see the same id. `created` distinguishes
|
|
2788
|
-
* inserted and must run the rest of the start flow)
|
|
2789
|
-
* the row already existed and must be returned as-is).
|
|
2790
|
-
*/
|
|
2791
|
-
declare function
|
|
2792
|
-
requestedSessionId?: string;
|
|
2793
|
-
accountId: string;
|
|
2794
|
-
workspaceId: string;
|
|
2795
|
-
initialMessage: string;
|
|
2796
|
-
initialTurnInstructions?: string | null;
|
|
2797
|
-
resources: ResourceRef[];
|
|
2798
|
-
tools?: ToolRef[];
|
|
2799
|
-
metadata: Record<string, unknown>;
|
|
2800
|
-
createdBy?: TurnInitiator;
|
|
2801
|
-
createdByContext?: TurnInitiatorContext;
|
|
2802
|
-
createdByActor?: AgentSessionCreationActor | null;
|
|
2803
|
-
model: string;
|
|
2804
|
-
sandboxBackend: SandboxBackend;
|
|
2805
|
-
variableSetId?: string | null;
|
|
2806
|
-
rigId?: string | null;
|
|
2807
|
-
rigVersionId?: string | null;
|
|
2808
|
-
firstPartyMcpPermissions?: Permission[] | null;
|
|
2809
|
-
instructions?: string | null;
|
|
2810
|
-
parentSessionId?: string | null;
|
|
3160
|
+
* a concurrent race on the same key to a single row. A losing source insert
|
|
3161
|
+
* is either handled by `onConflictDoNothing` on the partial unique index or
|
|
3162
|
+
* suppressed by the database BEFORE guard, and the durable winner is fetched
|
|
3163
|
+
* and returned. Two near-simultaneous creates with the same key therefore
|
|
3164
|
+
* yield ONE session and both callers see the same id. `created` distinguishes
|
|
3165
|
+
* the winner (true: this call inserted and must run the rest of the start flow)
|
|
3166
|
+
* from the loser/dup (false: the row already existed and must be returned as-is).
|
|
3167
|
+
*/
|
|
3168
|
+
declare function createSessionWithIdempotencyKeyResult(db: Database, input: SessionCreateInput & {
|
|
2811
3169
|
createIdempotencyKey: string;
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
3170
|
+
}): Promise<SessionCreateResult>;
|
|
3171
|
+
/**
|
|
3172
|
+
* Backward-compatible keyed create API. Denials are committed by the
|
|
3173
|
+
* admission transaction and then surfaced as SessionSpawnDeniedDbError;
|
|
3174
|
+
* callers that need a structured result use createSessionWithIdempotencyKeyResult.
|
|
3175
|
+
*/
|
|
3176
|
+
declare function createSessionWithIdempotencyKey(db: Database, input: SessionCreateInput & {
|
|
3177
|
+
createIdempotencyKey: string;
|
|
3178
|
+
}): Promise<SessionCreateSuccessResult>;
|
|
2819
3179
|
declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
|
|
2820
3180
|
declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
|
|
3181
|
+
declare function getSessionSpawnDenial(db: Database, workspaceId: string, denialId: string): Promise<SessionSpawnDenial | null>;
|
|
3182
|
+
declare function getSessionSpawnDenialByIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<SessionSpawnDenial | null>;
|
|
3183
|
+
declare function listSessionSpawnDenials(db: Database, workspaceId: string, options?: {
|
|
3184
|
+
limit?: number;
|
|
3185
|
+
parentSessionId?: string | null;
|
|
3186
|
+
}): Promise<SessionSpawnDenial[]>;
|
|
2821
3187
|
/**
|
|
2822
3188
|
* Resolve ANY session that belongs to a shared-sandbox group (addendum 05 §D.3,
|
|
2823
3189
|
* stress (e)). Used by the create-session `sandbox:{groupId}` join path to (1)
|
|
@@ -2855,6 +3221,10 @@ type ListSessionsForSubjectOptions = ListSessionsOptions & {
|
|
|
2855
3221
|
subjectId: string;
|
|
2856
3222
|
cursor?: SessionListCursor | undefined;
|
|
2857
3223
|
search?: string | undefined;
|
|
3224
|
+
/** Return only the complete personal pin projection; never scan/snapshot ordinary rows. */
|
|
3225
|
+
pinsOnly?: boolean | undefined;
|
|
3226
|
+
/** Materialize a continuation snapshot. Disable for legacy one-page array reads. */
|
|
3227
|
+
materializeSnapshot?: boolean | undefined;
|
|
2858
3228
|
authorizationScope?: SessionAuthorizationListScope | undefined;
|
|
2859
3229
|
};
|
|
2860
3230
|
declare class SessionPinVersionConflictError extends Error {
|
|
@@ -2864,9 +3234,15 @@ declare class SessionPinVersionConflictError extends Error {
|
|
|
2864
3234
|
declare class SessionListCursorError extends Error {
|
|
2865
3235
|
constructor(message?: string);
|
|
2866
3236
|
}
|
|
3237
|
+
declare class SessionListCursorExpiredError extends Error {
|
|
3238
|
+
constructor(message?: string);
|
|
3239
|
+
}
|
|
2867
3240
|
declare class SessionListAccessError extends Error {
|
|
2868
3241
|
constructor(message?: string);
|
|
2869
3242
|
}
|
|
3243
|
+
declare class SessionListSnapshotLimitError extends Error {
|
|
3244
|
+
constructor(message?: string);
|
|
3245
|
+
}
|
|
2870
3246
|
declare class SessionPinAccessError extends Error {
|
|
2871
3247
|
constructor(message?: string);
|
|
2872
3248
|
}
|
|
@@ -2896,6 +3272,8 @@ declare function sessionTreeStatsForSessions(db: Database, workspaceId: string,
|
|
|
2896
3272
|
* `UNION ALL`) makes legacy cycles terminate without a caller-sized path array.
|
|
2897
3273
|
*/
|
|
2898
3274
|
declare function sessionAuthorizationScopeFilter(scope: SessionAuthorizationListScope): SQL;
|
|
3275
|
+
declare const SESSION_LIST_SNAPSHOT_MAX_IDS = 5000;
|
|
3276
|
+
declare const SESSION_LIST_SNAPSHOT_MAX_ACTIVE_PER_SUBJECT = 32;
|
|
2899
3277
|
/** Opaque, URL-safe cursor encoding for a server-owned activity snapshot. */
|
|
2900
3278
|
declare function encodeSessionListCursor(cursor: SessionListCursor): string;
|
|
2901
3279
|
/** Decode and validate a cursor before it reaches any SQL predicate. */
|
|
@@ -2915,8 +3293,9 @@ declare function listSessionsForSubject(db: Database, workspaceId: string, optio
|
|
|
2915
3293
|
declare function getSessionForSubject(db: Database, workspaceId: string, sessionId: string, subjectId: string, relatedSessionAccess?: "target" | "root"): Promise<Session | null>;
|
|
2916
3294
|
/**
|
|
2917
3295
|
* Idempotently set a member's pin without mutating the session's lifecycle or
|
|
2918
|
-
* activity timestamps. A transaction advisory lock serializes
|
|
2919
|
-
*
|
|
3296
|
+
* activity timestamps. A subject-scoped transaction advisory lock serializes
|
|
3297
|
+
* personal pin mutations across API replicas and fences list projections;
|
|
3298
|
+
* expectedVersion rejects stale tabs.
|
|
2920
3299
|
*/
|
|
2921
3300
|
declare function setSessionPin(db: Database, input: {
|
|
2922
3301
|
workspaceId: string;
|
|
@@ -3031,6 +3410,14 @@ type ListSessionEventsOptions = {
|
|
|
3031
3410
|
excludeClasses?: readonly SessionEventSemanticClass[];
|
|
3032
3411
|
defaultExcludeTypes?: readonly SessionEventType[];
|
|
3033
3412
|
payloadMode?: SessionEventPayloadMode;
|
|
3413
|
+
/**
|
|
3414
|
+
* Internal exclusive-latest selector. Eligible legacy rows with a null
|
|
3415
|
+
* association remain visible, while late-rejected and duplicate callbacks do
|
|
3416
|
+
* not compete with current truth. Durable session sequence is authoritative
|
|
3417
|
+
* across distinct turns; turn generation is metadata only here. Callers must
|
|
3418
|
+
* pair this with a single semantic class and limit 1.
|
|
3419
|
+
*/
|
|
3420
|
+
authoritativeLatest?: boolean;
|
|
3034
3421
|
};
|
|
3035
3422
|
type ListSessionEventPageOptions = ListSessionEventsOptions & {
|
|
3036
3423
|
/** Exact UTF-8 JSON-array envelope budget for rows materialized by the app. */
|
|
@@ -3071,9 +3458,25 @@ declare function listSessionEvents(db: Database, workspaceId: string, sessionId:
|
|
|
3071
3458
|
type ToolspaceCallReservation = {
|
|
3072
3459
|
reserved: true;
|
|
3073
3460
|
count: number;
|
|
3461
|
+
turn: SessionTurnForExecution;
|
|
3074
3462
|
} | {
|
|
3075
3463
|
reserved: false;
|
|
3464
|
+
reason: TurnAttemptFenceRejectReason | "budget_exhausted";
|
|
3465
|
+
};
|
|
3466
|
+
type ToolspaceTurnAttemptClaims = {
|
|
3467
|
+
sessionId: string;
|
|
3468
|
+
turnId: string;
|
|
3469
|
+
attemptId: string;
|
|
3470
|
+
executionGeneration: number;
|
|
3076
3471
|
};
|
|
3472
|
+
/**
|
|
3473
|
+
* Admit one exact Toolspace bearer before any session credential is decrypted or
|
|
3474
|
+
* any upstream schema is enumerated. This intentionally reuses the canonical
|
|
3475
|
+
* activity write fence so Pause/Steer, attempt replacement, generation changes,
|
|
3476
|
+
* and terminal settlement revoke a copied token at the same linearization point
|
|
3477
|
+
* as other attempt-owned writes.
|
|
3478
|
+
*/
|
|
3479
|
+
declare function admitToolspaceTurnAttempt(db: Database, workspaceId: string, claims: ToolspaceTurnAttemptClaims): Promise<boolean>;
|
|
3077
3480
|
/**
|
|
3078
3481
|
* Atomically reserve one toolspace call against a turn's per-turn budget.
|
|
3079
3482
|
*
|
|
@@ -3081,10 +3484,20 @@ type ToolspaceCallReservation = {
|
|
|
3081
3484
|
* below `limit` and returns the post-increment value. Concurrent reservations
|
|
3082
3485
|
* for the same turn serialize on the row lock, so exactly `limit` of N
|
|
3083
3486
|
* simultaneous callers observe `reserved: true` — closing the read-then-append
|
|
3084
|
-
* TOCTOU the event-count approach had.
|
|
3085
|
-
*
|
|
3487
|
+
* TOCTOU the event-count approach had. The returned attempt id is captured by
|
|
3488
|
+
* that same UPDATE, so callers cannot accidentally execute under a successor
|
|
3489
|
+
* attempt. `reserved: false` means the turn is not executable, at/over budget,
|
|
3490
|
+
* or no longer exists.
|
|
3086
3491
|
*/
|
|
3087
|
-
declare function
|
|
3492
|
+
declare function reserveToolspaceCallForAttempt(db: Database, input: {
|
|
3493
|
+
accountId: string;
|
|
3494
|
+
workspaceId: string;
|
|
3495
|
+
sessionId: string;
|
|
3496
|
+
turnId: string;
|
|
3497
|
+
executionGeneration: number;
|
|
3498
|
+
attemptId: string;
|
|
3499
|
+
limit: number;
|
|
3500
|
+
}): Promise<ToolspaceCallReservation>;
|
|
3088
3501
|
declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
|
|
3089
3502
|
declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
|
|
3090
3503
|
declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
|
|
@@ -3153,6 +3566,30 @@ declare function getHumanInputResumeForEvent(db: Database, workspaceId: string,
|
|
|
3153
3566
|
response: HumanInputResponse;
|
|
3154
3567
|
} | null>;
|
|
3155
3568
|
type TurnAttemptFenceRejectReason = "workspace_paused" | "session_paused" | "pending_control" | "active_turn_changed" | "generation_changed" | "attempt_changed" | "turn_terminal" | "not_found";
|
|
3569
|
+
type InstallOrReadTurnExecutionPolicyForAttemptResult = {
|
|
3570
|
+
accepted: true;
|
|
3571
|
+
installed: boolean;
|
|
3572
|
+
policy: TurnExecutionPolicyV1;
|
|
3573
|
+
turn: SessionTurn;
|
|
3574
|
+
} | {
|
|
3575
|
+
accepted: false;
|
|
3576
|
+
reason: TurnAttemptFenceRejectReason;
|
|
3577
|
+
};
|
|
3578
|
+
/**
|
|
3579
|
+
* Freeze a legacy turn's execution identity at its first admitted attempt, or
|
|
3580
|
+
* return the policy already accepted for this logical turn. The exact active
|
|
3581
|
+
* attempt owns this mutation; malformed present metadata fails closed and a
|
|
3582
|
+
* replay never replaces an existing valid policy.
|
|
3583
|
+
*/
|
|
3584
|
+
declare function installOrReadTurnExecutionPolicyForAttempt(db: Database, input: {
|
|
3585
|
+
accountId: string;
|
|
3586
|
+
workspaceId: string;
|
|
3587
|
+
sessionId: string;
|
|
3588
|
+
turnId: string;
|
|
3589
|
+
executionGeneration: number;
|
|
3590
|
+
attemptId: string;
|
|
3591
|
+
policyForAbsent: TurnExecutionPolicyV1;
|
|
3592
|
+
}): Promise<InstallOrReadTurnExecutionPolicyForAttemptResult>;
|
|
3156
3593
|
/**
|
|
3157
3594
|
* Append conversation items (verbatim SDK AgentInputItems) to the session's
|
|
3158
3595
|
* history. Idempotent on (workspace, session, position): concurrent or
|
|
@@ -3183,6 +3620,7 @@ type PendingSessionToolCallInput = {
|
|
|
3183
3620
|
callId: string;
|
|
3184
3621
|
callType: string;
|
|
3185
3622
|
callItem: Record<string, unknown>;
|
|
3623
|
+
modelToolOutputTruncationTokens?: number;
|
|
3186
3624
|
};
|
|
3187
3625
|
/**
|
|
3188
3626
|
* Durably capture the raw SDK call item at the exact attempt boundary. This is
|
|
@@ -3195,6 +3633,16 @@ declare function registerPendingSessionToolCall(db: Database, input: PendingSess
|
|
|
3195
3633
|
accepted: boolean;
|
|
3196
3634
|
registered: boolean;
|
|
3197
3635
|
}>;
|
|
3636
|
+
/**
|
|
3637
|
+
* Clear one completed Toolspace receipt after its attempt-fenced output event is
|
|
3638
|
+
* durable. If control already replaced the attempt, its settlement transaction
|
|
3639
|
+
* owns the receipt and will retain an explicit outcome-unknown or the durable
|
|
3640
|
+
* output event instead.
|
|
3641
|
+
*/
|
|
3642
|
+
declare function clearPendingSessionToolspaceCall(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem">): Promise<{
|
|
3643
|
+
accepted: boolean;
|
|
3644
|
+
cleared: boolean;
|
|
3645
|
+
}>;
|
|
3198
3646
|
/** Record the raw SDK result without dropping the call receipt. */
|
|
3199
3647
|
declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
|
|
3200
3648
|
resultItem: Record<string, unknown>;
|
|
@@ -3483,8 +3931,17 @@ type SandboxPtySessionRow = {
|
|
|
3483
3931
|
accountId: string;
|
|
3484
3932
|
workspaceId: string;
|
|
3485
3933
|
sessionId: string;
|
|
3934
|
+
leaseId: string | null;
|
|
3935
|
+
sandboxGroupId: string | null;
|
|
3936
|
+
retainedProcessId: string | null;
|
|
3937
|
+
openAdmissionId: string | null;
|
|
3486
3938
|
execSessionId: number | null;
|
|
3487
3939
|
leaseEpoch: number;
|
|
3940
|
+
providerBackend: string | null;
|
|
3941
|
+
providerInstanceId: string | null;
|
|
3942
|
+
routeKind: "home" | "active" | null;
|
|
3943
|
+
routeTargetId: string | null;
|
|
3944
|
+
routeEpoch: number | null;
|
|
3488
3945
|
cols: number;
|
|
3489
3946
|
rows: number;
|
|
3490
3947
|
shell: string;
|
|
@@ -3495,41 +3952,108 @@ type SandboxPtySessionRow = {
|
|
|
3495
3952
|
createdAt: string;
|
|
3496
3953
|
closedAt: string | null;
|
|
3497
3954
|
};
|
|
3955
|
+
type SandboxPtyProcessIdentity = {
|
|
3956
|
+
leaseId: string;
|
|
3957
|
+
sandboxGroupId: string;
|
|
3958
|
+
retainedProcessId: string;
|
|
3959
|
+
openAdmissionId: string;
|
|
3960
|
+
execSessionId: number;
|
|
3961
|
+
leaseEpoch: number;
|
|
3962
|
+
providerBackend: string;
|
|
3963
|
+
providerInstanceId: string;
|
|
3964
|
+
routeKind: "home" | "active";
|
|
3965
|
+
routeTargetId: string | null;
|
|
3966
|
+
routeEpoch: number;
|
|
3967
|
+
};
|
|
3968
|
+
type SandboxOpenPtySessionRow = Omit<SandboxPtySessionRow, keyof SandboxPtyProcessIdentity | "status"> & SandboxPtyProcessIdentity & {
|
|
3969
|
+
status: "open";
|
|
3970
|
+
};
|
|
3498
3971
|
declare function insertPtySession(db: Database, input: {
|
|
3499
3972
|
id: string;
|
|
3500
3973
|
accountId: string;
|
|
3501
3974
|
workspaceId: string;
|
|
3502
3975
|
sessionId: string;
|
|
3503
|
-
|
|
3504
|
-
leaseEpoch: number;
|
|
3976
|
+
identity: SandboxPtyProcessIdentity;
|
|
3505
3977
|
cols: number;
|
|
3506
3978
|
rows: number;
|
|
3507
3979
|
shell: string;
|
|
3508
3980
|
cwd: string;
|
|
3509
3981
|
openedBy: string;
|
|
3510
|
-
}): Promise<
|
|
3982
|
+
}): Promise<SandboxOpenPtySessionRow>;
|
|
3511
3983
|
/** Read an OPEN PTY row by ptyId. Returns null when absent or already closed. */
|
|
3512
|
-
declare function getOpenPtySession(db: Database,
|
|
3513
|
-
|
|
3514
|
-
|
|
3984
|
+
declare function getOpenPtySession(db: Database, input: {
|
|
3985
|
+
workspaceId: string;
|
|
3986
|
+
sessionId: string;
|
|
3987
|
+
ptyId: string;
|
|
3988
|
+
}): Promise<SandboxOpenPtySessionRow | null>;
|
|
3989
|
+
/** Refresh activity/geometry only when the full retained-process identity still
|
|
3990
|
+
* matches. A numeric provider locator or PTY UUID alone is never authority. */
|
|
3515
3991
|
declare function updatePtySessionActivity(db: Database, input: {
|
|
3516
3992
|
accountId: string;
|
|
3517
3993
|
workspaceId: string;
|
|
3994
|
+
sessionId: string;
|
|
3518
3995
|
ptyId: string;
|
|
3519
|
-
|
|
3996
|
+
identity: SandboxPtyProcessIdentity;
|
|
3520
3997
|
cols?: number;
|
|
3521
3998
|
rows?: number;
|
|
3522
|
-
}): Promise<
|
|
3999
|
+
}): Promise<SandboxOpenPtySessionRow | null>;
|
|
3523
4000
|
/** Mark a PTY closed (idempotent — a double close on a closed row is a no-op). */
|
|
3524
4001
|
declare function closePtySession(db: Database, input: {
|
|
3525
4002
|
accountId: string;
|
|
3526
4003
|
workspaceId: string;
|
|
4004
|
+
sessionId: string;
|
|
3527
4005
|
ptyId: string;
|
|
4006
|
+
identity: SandboxPtyProcessIdentity;
|
|
3528
4007
|
}): Promise<SandboxPtySessionRow | null>;
|
|
3529
4008
|
/** List a session's OPEN PTYs (reattach + reap). */
|
|
3530
|
-
declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<
|
|
4009
|
+
declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxOpenPtySessionRow[]>;
|
|
3531
4010
|
type SandboxLeaseLiveness = "cold" | "warming" | "warm" | "draining";
|
|
3532
|
-
type LeaseHolderKind = "turn" | "viewer";
|
|
4011
|
+
type LeaseHolderKind = "turn" | "viewer" | "direct" | "process";
|
|
4012
|
+
type SandboxProviderExistence = "not_created" | "creating" | "exists" | "missing" | "unknown";
|
|
4013
|
+
type SandboxArchiveAvailability = "none" | "available" | "unverified" | "invalid";
|
|
4014
|
+
type SandboxRestoreStatus = "not_required" | "pending" | "restoring" | "verifying" | "ready" | "degraded" | "unrecoverable";
|
|
4015
|
+
type SandboxWorkspaceReadiness = "unknown" | "not_ready" | "ready" | "degraded" | "unrecoverable";
|
|
4016
|
+
type SandboxArchiveRevision = {
|
|
4017
|
+
version: 1;
|
|
4018
|
+
revision: string;
|
|
4019
|
+
archiveSha256: string;
|
|
4020
|
+
archiveBytes: number;
|
|
4021
|
+
capturedAt: string;
|
|
4022
|
+
workspace: {
|
|
4023
|
+
algorithm: "sha256";
|
|
4024
|
+
sha256: string;
|
|
4025
|
+
entryCount: number;
|
|
4026
|
+
fileCount: number;
|
|
4027
|
+
totalFileBytes: number;
|
|
4028
|
+
};
|
|
4029
|
+
};
|
|
4030
|
+
type SandboxRecoveryState = {
|
|
4031
|
+
provider: {
|
|
4032
|
+
status: SandboxProviderExistence;
|
|
4033
|
+
instanceId: string | null;
|
|
4034
|
+
observedAt: string | null;
|
|
4035
|
+
diagnostic?: string;
|
|
4036
|
+
};
|
|
4037
|
+
archive: {
|
|
4038
|
+
status: SandboxArchiveAvailability;
|
|
4039
|
+
current: SandboxArchiveRevision | null;
|
|
4040
|
+
previous: SandboxArchiveRevision | null;
|
|
4041
|
+
};
|
|
4042
|
+
restore: {
|
|
4043
|
+
status: SandboxRestoreStatus;
|
|
4044
|
+
rematerializationId: string | null;
|
|
4045
|
+
selectedRevision: string | null;
|
|
4046
|
+
startedAt: string | null;
|
|
4047
|
+
completedAt: string | null;
|
|
4048
|
+
failureCode?: string;
|
|
4049
|
+
retryable?: boolean;
|
|
4050
|
+
};
|
|
4051
|
+
workspace: {
|
|
4052
|
+
status: SandboxWorkspaceReadiness;
|
|
4053
|
+
verifiedRevision: string | null;
|
|
4054
|
+
verifiedAt: string | null;
|
|
4055
|
+
};
|
|
4056
|
+
};
|
|
3533
4057
|
interface LeaseSnapshot {
|
|
3534
4058
|
id: string;
|
|
3535
4059
|
sandboxGroupId: string;
|
|
@@ -3545,8 +4069,20 @@ interface LeaseSnapshot {
|
|
|
3545
4069
|
dataPlaneUrl: string | null;
|
|
3546
4070
|
terminalDataPlaneUrl: string | null;
|
|
3547
4071
|
leaseEpoch: number;
|
|
4072
|
+
/** Monotonic filesystem mutation intent for the exact live workspace. */
|
|
4073
|
+
workspaceGeneration: number;
|
|
4074
|
+
/** Generation captured by the current verified archive, or null when no
|
|
4075
|
+
* generation-complete archive exists. */
|
|
4076
|
+
archiveGeneration: number | null;
|
|
4077
|
+
/** True only when the current verified archive represents the exact current
|
|
4078
|
+
* workspace generation. This is numeric/boolean truth, never archive content. */
|
|
4079
|
+
archiveComplete: boolean;
|
|
3548
4080
|
resumeBackendId: string | null;
|
|
3549
4081
|
resumeState: Record<string, unknown> | null;
|
|
4082
|
+
/** Provider/archive/restore/workspace truth, deliberately separate from the
|
|
4083
|
+
* lease liveness and epoch fields above. Legacy envelopes project to
|
|
4084
|
+
* conservative unknown/unverified values. */
|
|
4085
|
+
recovery: SandboxRecoveryState;
|
|
3550
4086
|
expiresAt: Date;
|
|
3551
4087
|
}
|
|
3552
4088
|
interface LiveModalSandboxLeaseAttribution {
|
|
@@ -3580,6 +4116,10 @@ type AcquireLeaseResult = {
|
|
|
3580
4116
|
} | {
|
|
3581
4117
|
role: "rearmed";
|
|
3582
4118
|
lease: LeaseSnapshot;
|
|
4119
|
+
} | {
|
|
4120
|
+
role: "blocked";
|
|
4121
|
+
code: "restore_degraded" | "restore_unrecoverable";
|
|
4122
|
+
lease: LeaseSnapshot;
|
|
3583
4123
|
} | {
|
|
3584
4124
|
role: "fenced";
|
|
3585
4125
|
lease: LeaseSnapshot;
|
|
@@ -3589,6 +4129,14 @@ declare class SandboxLeaseSupersededError extends Error {
|
|
|
3589
4129
|
readonly leaseEpoch: number;
|
|
3590
4130
|
constructor(sandboxGroupId: string, leaseEpoch: number);
|
|
3591
4131
|
}
|
|
4132
|
+
declare class SandboxLeaseRecoveryBlockedError extends Error {
|
|
4133
|
+
readonly sandboxGroupId: string;
|
|
4134
|
+
readonly leaseEpoch: number;
|
|
4135
|
+
readonly code: "restore_degraded" | "restore_unrecoverable";
|
|
4136
|
+
readonly recovery: SandboxRecoveryState;
|
|
4137
|
+
readonly name = "SandboxLeaseRecoveryBlockedError";
|
|
4138
|
+
constructor(sandboxGroupId: string, leaseEpoch: number, code: "restore_degraded" | "restore_unrecoverable", recovery: SandboxRecoveryState);
|
|
4139
|
+
}
|
|
3592
4140
|
declare class SandboxImageConflictError extends Error {
|
|
3593
4141
|
readonly sandboxGroupId: string;
|
|
3594
4142
|
readonly currentImage: string;
|
|
@@ -3602,6 +4150,60 @@ declare class SandboxRigConflictError extends Error {
|
|
|
3602
4150
|
constructor(sandboxGroupId: string, currentRigVersionId: string, requestedRigVersionId: string);
|
|
3603
4151
|
}
|
|
3604
4152
|
declare function acquireLease(db: Database, input: AcquireLeaseInput): Promise<AcquireLeaseResult>;
|
|
4153
|
+
type BeginSandboxRematerializationResult = {
|
|
4154
|
+
status: "started";
|
|
4155
|
+
lease: LeaseSnapshot;
|
|
4156
|
+
} | {
|
|
4157
|
+
status: "blocked";
|
|
4158
|
+
code: "archive_unavailable" | "archive_unverified" | "archive_generation_mismatch" | "attempt_conflict" | "stale_epoch";
|
|
4159
|
+
lease: LeaseSnapshot | null;
|
|
4160
|
+
};
|
|
4161
|
+
/** Records the single cold->warming winner's exact restore attempt. The lease
|
|
4162
|
+
* election remains the sole spawner guard; this adds durable selected-revision
|
|
4163
|
+
* and progress truth under the same epoch. */
|
|
4164
|
+
declare function beginSandboxRematerialization(db: Database, input: {
|
|
4165
|
+
accountId: string;
|
|
4166
|
+
workspaceId: string;
|
|
4167
|
+
sandboxGroupId: string;
|
|
4168
|
+
expectedEpoch: number;
|
|
4169
|
+
rematerializationId: string;
|
|
4170
|
+
/** Optional durable per-session fallback envelope. When the lease has no
|
|
4171
|
+
* archive yet, its archive fields are imported under this same row lock so
|
|
4172
|
+
* restoration can never consume bytes that were not durably selected by
|
|
4173
|
+
* the lease attempt. Provider/session state is never imported here. */
|
|
4174
|
+
archiveSource?: Record<string, unknown> | null;
|
|
4175
|
+
}): Promise<BeginSandboxRematerializationResult>;
|
|
4176
|
+
declare function markSandboxRestoreVerifying(db: Database, input: {
|
|
4177
|
+
accountId: string;
|
|
4178
|
+
workspaceId: string;
|
|
4179
|
+
sandboxGroupId: string;
|
|
4180
|
+
expectedEpoch: number;
|
|
4181
|
+
rematerializationId: string;
|
|
4182
|
+
}): Promise<{
|
|
4183
|
+
wrote: boolean;
|
|
4184
|
+
}>;
|
|
4185
|
+
declare function failSandboxRematerialization(db: Database, input: {
|
|
4186
|
+
accountId: string;
|
|
4187
|
+
workspaceId: string;
|
|
4188
|
+
sandboxGroupId: string;
|
|
4189
|
+
expectedEpoch: number;
|
|
4190
|
+
rematerializationId: string;
|
|
4191
|
+
failureCode: string;
|
|
4192
|
+
retryable: boolean;
|
|
4193
|
+
}): Promise<{
|
|
4194
|
+
failed: boolean;
|
|
4195
|
+
lease: LeaseSnapshot | null;
|
|
4196
|
+
}>;
|
|
4197
|
+
declare function markSandboxProviderReady(db: Database, input: {
|
|
4198
|
+
accountId: string;
|
|
4199
|
+
workspaceId: string;
|
|
4200
|
+
sandboxGroupId: string;
|
|
4201
|
+
expectedEpoch: number;
|
|
4202
|
+
expectedInstanceId: string;
|
|
4203
|
+
}): Promise<{
|
|
4204
|
+
wrote: boolean;
|
|
4205
|
+
lease: LeaseSnapshot | null;
|
|
4206
|
+
}>;
|
|
3605
4207
|
declare function commitWarmingToWarm(db: Database, input: {
|
|
3606
4208
|
accountId: string;
|
|
3607
4209
|
workspaceId: string;
|
|
@@ -3611,16 +4213,28 @@ declare function commitWarmingToWarm(db: Database, input: {
|
|
|
3611
4213
|
dataPlaneUrl?: string | null;
|
|
3612
4214
|
resumeBackendId?: string | null;
|
|
3613
4215
|
resumeState?: Record<string, unknown> | null;
|
|
4216
|
+
/** Required when the warming lease carries a selected durable archive.
|
|
4217
|
+
* The warm transition is rejected unless this exact attempt is in the
|
|
4218
|
+
* verifying state for this exact revision. */
|
|
4219
|
+
rematerialization?: {
|
|
4220
|
+
id: string;
|
|
4221
|
+
verifiedRevision: string;
|
|
4222
|
+
};
|
|
3614
4223
|
leaseTtlMs: number;
|
|
3615
4224
|
}): Promise<{
|
|
3616
4225
|
committed: boolean;
|
|
3617
4226
|
lease: LeaseSnapshot | null;
|
|
4227
|
+
reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
|
|
3618
4228
|
}>;
|
|
3619
4229
|
declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
3620
4230
|
accountId: string;
|
|
3621
4231
|
workspaceId: string;
|
|
3622
4232
|
sandboxGroupId: string;
|
|
3623
4233
|
expectedEpoch: number;
|
|
4234
|
+
/** Exact restore attempt elected before provider create. Null for a fresh
|
|
4235
|
+
* archive-less create. Provider attribution is accepted only while the
|
|
4236
|
+
* warming row still carries this same attempt as well as this epoch. */
|
|
4237
|
+
rematerializationId?: string | null;
|
|
3624
4238
|
instanceId: string;
|
|
3625
4239
|
resumeBackendId?: string | null;
|
|
3626
4240
|
resumeState?: Record<string, unknown> | null;
|
|
@@ -3660,6 +4274,8 @@ declare function markWarmLeaseInstanceLost(db: Database, input: {
|
|
|
3660
4274
|
sandboxGroupId: string;
|
|
3661
4275
|
expectedEpoch: number;
|
|
3662
4276
|
expectedInstanceId: string;
|
|
4277
|
+
/** Bounded classifier output only; never raw provider error text. */
|
|
4278
|
+
diagnostic?: string;
|
|
3663
4279
|
}): Promise<MarkWarmLeaseInstanceLostResult>;
|
|
3664
4280
|
declare function failWarmingToCold(db: Database, input: {
|
|
3665
4281
|
accountId: string;
|
|
@@ -3719,6 +4335,7 @@ declare function reapStaleLeaseHolders(db: Database, input: {
|
|
|
3719
4335
|
idleGraceMs: number;
|
|
3720
4336
|
}): Promise<{
|
|
3721
4337
|
reapedViewers: number;
|
|
4338
|
+
reapedDirect: number;
|
|
3722
4339
|
reapedTurns: number;
|
|
3723
4340
|
warmingReset: number;
|
|
3724
4341
|
drained: ReapDrainable[];
|
|
@@ -3759,22 +4376,284 @@ declare function confirmDrainCold(db: Database, input: {
|
|
|
3759
4376
|
workspaceId: string;
|
|
3760
4377
|
sandboxGroupId: string;
|
|
3761
4378
|
expectedEpoch: number;
|
|
4379
|
+
/** Definitive provider NotFound before this drain could capture /workspace.
|
|
4380
|
+
* With no durable archive this must become typed unrecoverable, never a
|
|
4381
|
+
* clean cold lease that can expose an empty replacement. */
|
|
4382
|
+
providerMissingBeforeCapture?: boolean;
|
|
3762
4383
|
}): Promise<{
|
|
3763
4384
|
wentCold: boolean;
|
|
3764
4385
|
}>;
|
|
4386
|
+
declare class SandboxWorkspaceMutationFencedError extends Error {
|
|
4387
|
+
readonly code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted";
|
|
4388
|
+
readonly name = "SandboxWorkspaceMutationFencedError";
|
|
4389
|
+
constructor(code: "attempt_fenced" | "holder_fenced" | "lease_fenced" | "route_fenced" | "process_fenced" | "admission_fenced" | "operation_invalid" | "generation_exhausted", message: string);
|
|
4390
|
+
}
|
|
4391
|
+
type SandboxWorkspaceMutationAdmission = {
|
|
4392
|
+
id: string;
|
|
4393
|
+
leaseId: string;
|
|
4394
|
+
sandboxGroupId: string;
|
|
4395
|
+
sessionId: string;
|
|
4396
|
+
actorKind: "turn" | "direct" | "process";
|
|
4397
|
+
actorId: string;
|
|
4398
|
+
holderKind: "turn" | "direct" | "process";
|
|
4399
|
+
holderId: string;
|
|
4400
|
+
leaseEpoch: number;
|
|
4401
|
+
providerBackend: string;
|
|
4402
|
+
providerInstanceId: string;
|
|
4403
|
+
routeKind: "home" | "active";
|
|
4404
|
+
routeTargetId: string | null;
|
|
4405
|
+
routeEpoch: number;
|
|
4406
|
+
workspaceGeneration: number;
|
|
4407
|
+
};
|
|
4408
|
+
type SandboxWorkspaceMutationProviderOutcome = "resolved" | "rejected";
|
|
4409
|
+
type SandboxRetainedProcessState = "active" | "exited" | "lost";
|
|
4410
|
+
type SandboxRetainedProcess = {
|
|
4411
|
+
id: string;
|
|
4412
|
+
accountId: string;
|
|
4413
|
+
workspaceId: string;
|
|
4414
|
+
sessionId: string;
|
|
4415
|
+
leaseId: string;
|
|
4416
|
+
sandboxGroupId: string;
|
|
4417
|
+
parentAdmissionId: string;
|
|
4418
|
+
holderId: string;
|
|
4419
|
+
ownerActorKind: "turn" | "direct";
|
|
4420
|
+
ownerActorId: string;
|
|
4421
|
+
ownerTurnId: string | null;
|
|
4422
|
+
ownerAttemptId: string | null;
|
|
4423
|
+
ownerExecutionGeneration: number | null;
|
|
4424
|
+
leaseEpoch: number;
|
|
4425
|
+
providerBackend: string;
|
|
4426
|
+
providerInstanceId: string;
|
|
4427
|
+
routeKind: "home" | "active";
|
|
4428
|
+
routeTargetId: string | null;
|
|
4429
|
+
routeEpoch: number;
|
|
4430
|
+
providerSessionId: number;
|
|
4431
|
+
state: SandboxRetainedProcessState;
|
|
4432
|
+
exitCode: number | null;
|
|
4433
|
+
settlementReason: string | null;
|
|
4434
|
+
startedAt: string;
|
|
4435
|
+
settledAt: string | null;
|
|
4436
|
+
};
|
|
4437
|
+
/**
|
|
4438
|
+
* Advance the live workspace's mutation generation before an acknowledged
|
|
4439
|
+
* filesystem-writing operation reaches the provider. The normal activity write
|
|
4440
|
+
* fence is acquired first (workspace control -> workspace -> session -> turn ->
|
|
4441
|
+
* attempt), then the exact lease row is updated under its epoch + provider-id
|
|
4442
|
+
* predicates. Any failed fence rejects the operation before external effects.
|
|
4443
|
+
*/
|
|
4444
|
+
declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
4445
|
+
accountId: string;
|
|
4446
|
+
workspaceId: string;
|
|
4447
|
+
sessionId: string;
|
|
4448
|
+
turnId: string;
|
|
4449
|
+
executionGeneration: number;
|
|
4450
|
+
attemptId: string;
|
|
4451
|
+
holderId: string;
|
|
4452
|
+
sandboxGroupId: string;
|
|
4453
|
+
expectedEpoch: number;
|
|
4454
|
+
expectedInstanceId: string;
|
|
4455
|
+
operation: string;
|
|
4456
|
+
/** Active-routed mutations bind to the exact session pointer. Omitted means
|
|
4457
|
+
* an intentional home-provider write outside the routing surface. */
|
|
4458
|
+
routeKind?: "home" | "active";
|
|
4459
|
+
routeTargetId?: string | null;
|
|
4460
|
+
routeEpoch?: number;
|
|
4461
|
+
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4462
|
+
/** Admit an API/direct mutation under an exact request holder and active route.
|
|
4463
|
+
* Direct actors intentionally have no turn identity and can never inherit the
|
|
4464
|
+
* attempt-quiescence archive fallback. */
|
|
4465
|
+
declare function advanceWorkspaceGenerationForDirectRequest(db: Database, input: {
|
|
4466
|
+
accountId: string;
|
|
4467
|
+
workspaceId: string;
|
|
4468
|
+
sessionId: string;
|
|
4469
|
+
requestId: string;
|
|
4470
|
+
holderId: string;
|
|
4471
|
+
sandboxGroupId: string;
|
|
4472
|
+
expectedEpoch: number;
|
|
4473
|
+
expectedInstanceId: string;
|
|
4474
|
+
routeTargetId: string | null;
|
|
4475
|
+
routeEpoch: number;
|
|
4476
|
+
operation: string;
|
|
4477
|
+
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4478
|
+
/** Admit one model/user-visible stdin write for an exact retained process. The
|
|
4479
|
+
* process's original provider and route are authoritative even if the session's
|
|
4480
|
+
* active pointer has since moved. */
|
|
4481
|
+
declare function advanceWorkspaceGenerationForRetainedProcess(db: Database, input: {
|
|
4482
|
+
accountId: string;
|
|
4483
|
+
workspaceId: string;
|
|
4484
|
+
sessionId: string;
|
|
4485
|
+
processId: string;
|
|
4486
|
+
operation: string;
|
|
4487
|
+
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4488
|
+
/** Physically settle one exact provider mutation admission after its promise
|
|
4489
|
+
* resolves or rejects. Rejections need no output acceptance, but still clear
|
|
4490
|
+
* the in-flight capture blocker. Resolved output is accepted only after the
|
|
4491
|
+
* canonical attempt fence plus the exact live lease-holder/provider identity
|
|
4492
|
+
* are revalidated. A failed acceptance fence is reported only AFTER the
|
|
4493
|
+
* settlement transaction commits, so stale output can be rejected without
|
|
4494
|
+
* resurrecting the physical blocker. */
|
|
4495
|
+
declare function verifyWorkspaceMutationSettlement(db: Database, input: {
|
|
4496
|
+
accountId: string;
|
|
4497
|
+
workspaceId: string;
|
|
4498
|
+
sessionId: string;
|
|
4499
|
+
turnId: string;
|
|
4500
|
+
executionGeneration: number;
|
|
4501
|
+
attemptId: string;
|
|
4502
|
+
holderId: string;
|
|
4503
|
+
sandboxGroupId: string;
|
|
4504
|
+
expectedEpoch: number;
|
|
4505
|
+
expectedInstanceId: string;
|
|
4506
|
+
admission: SandboxWorkspaceMutationAdmission;
|
|
4507
|
+
operation: string;
|
|
4508
|
+
outcome: SandboxWorkspaceMutationProviderOutcome;
|
|
4509
|
+
routeKind?: "home" | "active";
|
|
4510
|
+
routeTargetId?: string | null;
|
|
4511
|
+
routeEpoch?: number;
|
|
4512
|
+
}): Promise<void>;
|
|
4513
|
+
declare function verifyDirectWorkspaceMutationSettlement(db: Database, input: {
|
|
4514
|
+
accountId: string;
|
|
4515
|
+
workspaceId: string;
|
|
4516
|
+
sessionId: string;
|
|
4517
|
+
requestId: string;
|
|
4518
|
+
holderId: string;
|
|
4519
|
+
sandboxGroupId: string;
|
|
4520
|
+
expectedEpoch: number;
|
|
4521
|
+
expectedInstanceId: string;
|
|
4522
|
+
routeTargetId: string | null;
|
|
4523
|
+
routeEpoch: number;
|
|
4524
|
+
admission: SandboxWorkspaceMutationAdmission;
|
|
4525
|
+
operation: string;
|
|
4526
|
+
outcome: SandboxWorkspaceMutationProviderOutcome;
|
|
4527
|
+
}): Promise<void>;
|
|
4528
|
+
declare function verifyRetainedProcessMutationSettlement(db: Database, input: {
|
|
4529
|
+
accountId: string;
|
|
4530
|
+
workspaceId: string;
|
|
4531
|
+
sessionId: string;
|
|
4532
|
+
processId: string;
|
|
4533
|
+
admission: SandboxWorkspaceMutationAdmission;
|
|
4534
|
+
operation: string;
|
|
4535
|
+
outcome: SandboxWorkspaceMutationProviderOutcome;
|
|
4536
|
+
}): Promise<void>;
|
|
4537
|
+
/** Promote one yielded provider exec into durable process authority. The parent
|
|
4538
|
+
* admission stays unsettled (`retained`) and a process holder is inserted in the
|
|
4539
|
+
* same transaction, so ordinary request/turn cleanup cannot open archive capture. */
|
|
4540
|
+
declare function retainWorkspaceMutationProcess(db: Database, input: {
|
|
4541
|
+
accountId: string;
|
|
4542
|
+
workspaceId: string;
|
|
4543
|
+
sessionId: string;
|
|
4544
|
+
processId: string;
|
|
4545
|
+
providerSessionId: number;
|
|
4546
|
+
admissionId: string;
|
|
4547
|
+
admittedWorkspaceGeneration: number;
|
|
4548
|
+
operation: string;
|
|
4549
|
+
owner: {
|
|
4550
|
+
kind: "turn";
|
|
4551
|
+
turnId: string;
|
|
4552
|
+
executionGeneration: number;
|
|
4553
|
+
attemptId: string;
|
|
4554
|
+
holderId: string;
|
|
4555
|
+
sandboxGroupId: string;
|
|
4556
|
+
expectedEpoch: number;
|
|
4557
|
+
expectedInstanceId: string;
|
|
4558
|
+
routeKind?: "home" | "active";
|
|
4559
|
+
routeTargetId?: string | null;
|
|
4560
|
+
routeEpoch?: number;
|
|
4561
|
+
} | {
|
|
4562
|
+
kind: "direct";
|
|
4563
|
+
requestId: string;
|
|
4564
|
+
holderId: string;
|
|
4565
|
+
sandboxGroupId: string;
|
|
4566
|
+
expectedEpoch: number;
|
|
4567
|
+
expectedInstanceId: string;
|
|
4568
|
+
routeTargetId: string | null;
|
|
4569
|
+
routeEpoch: number;
|
|
4570
|
+
};
|
|
4571
|
+
}): Promise<SandboxRetainedProcess>;
|
|
4572
|
+
/** Read one retained process by durable UUID. Callers must use the copied route
|
|
4573
|
+
* identity; a numeric provider session id alone is never sufficient authority. */
|
|
4574
|
+
declare function getRetainedProcess(db: Database, input: {
|
|
4575
|
+
workspaceId: string;
|
|
4576
|
+
sessionId: string;
|
|
4577
|
+
processId: string;
|
|
4578
|
+
}): Promise<SandboxRetainedProcess | null>;
|
|
4579
|
+
/** Settle an exact retained process only after exit or definitive loss proof.
|
|
4580
|
+
* The process row, parent admission, non-TTL holder, and lease count transition
|
|
4581
|
+
* commit atomically. Duplicate identical proof is idempotent; conflicting proof
|
|
4582
|
+
* fails closed. */
|
|
4583
|
+
declare function settleRetainedProcess(db: Database, input: {
|
|
4584
|
+
accountId: string;
|
|
4585
|
+
workspaceId: string;
|
|
4586
|
+
sessionId: string;
|
|
4587
|
+
processId: string;
|
|
4588
|
+
outcome: "exited" | "lost";
|
|
4589
|
+
exitCode?: number | null;
|
|
4590
|
+
reason: string;
|
|
4591
|
+
idleGraceMs: number;
|
|
4592
|
+
}): Promise<{
|
|
4593
|
+
settled: boolean;
|
|
4594
|
+
process: SandboxRetainedProcess;
|
|
4595
|
+
}>;
|
|
4596
|
+
/** Read the exact generation a verified capture must later fold. This is a
|
|
4597
|
+
* preflight only: persistWarmSnapshot/persistDrainSnapshot repeat the full
|
|
4598
|
+
* epoch, provider, liveness, and generation CAS under the archive-fold lock. */
|
|
4599
|
+
declare function readWorkspaceArchiveCapturePreflight(db: Database, input: {
|
|
4600
|
+
accountId: string;
|
|
4601
|
+
workspaceId: string;
|
|
4602
|
+
sandboxGroupId: string;
|
|
4603
|
+
expectedEpoch: number;
|
|
4604
|
+
expectedInstanceId: string;
|
|
4605
|
+
liveness: "warm" | "draining";
|
|
4606
|
+
}): Promise<{
|
|
4607
|
+
workspaceGeneration: number;
|
|
4608
|
+
archiveGeneration: number | null;
|
|
4609
|
+
archiveComplete: boolean;
|
|
4610
|
+
} | null>;
|
|
3765
4611
|
declare function persistDrainSnapshot(db: Database, input: {
|
|
3766
4612
|
accountId: string;
|
|
3767
4613
|
workspaceId: string;
|
|
3768
4614
|
sandboxGroupId: string;
|
|
3769
4615
|
expectedEpoch: number;
|
|
4616
|
+
expectedInstanceId: string;
|
|
4617
|
+
expectedWorkspaceGeneration: number;
|
|
3770
4618
|
/** base64 of the provider snapshot-ref / tar archive from persistWorkspace().
|
|
3771
|
-
* Pass null to CAS-check without writing
|
|
4619
|
+
* Pass null only to CAS-check without writing; this does not certify that
|
|
4620
|
+
* provider termination is lossless. */
|
|
3772
4621
|
workspaceArchive: string | null;
|
|
4622
|
+
/** Exact verified archive/tree descriptor produced by the runtime capture.
|
|
4623
|
+
* Omission is accepted only for legacy callers and remains unverified. */
|
|
4624
|
+
workspaceArchiveMeta?: SandboxArchiveRevision;
|
|
3773
4625
|
}): Promise<{
|
|
3774
4626
|
wrote: boolean;
|
|
3775
|
-
|
|
3776
|
-
|
|
4627
|
+
priorArchiveForGc: string | null;
|
|
4628
|
+
archiveRevision: string | null;
|
|
3777
4629
|
}>;
|
|
4630
|
+
/**
|
|
4631
|
+
* The ONE archive-fold write, shared by the drain seam (persistDrainSnapshot)
|
|
4632
|
+
* and the mid-session seam (persistWarmSnapshot) — the two differ only in
|
|
4633
|
+
* their CAS guard (draining@refcount0 vs warm) and their read-side semantics.
|
|
4634
|
+
*
|
|
4635
|
+
* Merges the NEW archive (+ its workspaceArchiveAt timestamp, the throttle
|
|
4636
|
+
* baseline for mid-session snapshots) into resume_state.sessionState.
|
|
4637
|
+
* jsonb_set's create_missing does NOT create intermediate objects, so a direct
|
|
4638
|
+
* set of '{sessionState,workspaceArchive}' is a silent no-op when
|
|
4639
|
+
* `sessionState` is absent (a null resume_state, or a legacy flat envelope).
|
|
4640
|
+
* Instead: rebuild `sessionState` as (existing sessionState OR '{}') merged
|
|
4641
|
+
* (||) with the fold — this CREATES sessionState if absent AND preserves its
|
|
4642
|
+
* existing siblings (providerState/manifest/exposedPorts). The archive is
|
|
4643
|
+
* bound as a jsonb string scalar (to_jsonb(text)). Re-asserting the caller's
|
|
4644
|
+
* CAS guard keeps the write atomic with its FOR UPDATE lock. Archive-slot
|
|
4645
|
+
* rotation is computed by rotateWorkspaceArchives before this writer is called,
|
|
4646
|
+
* so the warm and drain seams use exactly the same retention policy.
|
|
4647
|
+
*/
|
|
4648
|
+
declare function rotateWorkspaceArchives(input: {
|
|
4649
|
+
resumeState: Record<string, unknown> | null;
|
|
4650
|
+
priorCurrentArchive: string | null;
|
|
4651
|
+
priorPreviousArchive: string | null;
|
|
4652
|
+
}): {
|
|
4653
|
+
previousArchive: string | null;
|
|
4654
|
+
previousArchiveMeta: SandboxArchiveRevision | null;
|
|
4655
|
+
priorArchiveForGc: string | null;
|
|
4656
|
+
};
|
|
3778
4657
|
/**
|
|
3779
4658
|
* MID-SESSION /workspace snapshot fold (sandbox-file-persistence). The WARM
|
|
3780
4659
|
* sibling of persistDrainSnapshot: a turn that HOLDS the live box folds a fresh
|
|
@@ -3794,8 +4673,13 @@ declare function persistWarmSnapshot(db: Database, input: {
|
|
|
3794
4673
|
attemptId: string;
|
|
3795
4674
|
sandboxGroupId: string;
|
|
3796
4675
|
expectedEpoch: number;
|
|
4676
|
+
expectedInstanceId: string;
|
|
4677
|
+
expectedWorkspaceGeneration: number;
|
|
3797
4678
|
/** base64 of the provider snapshot-ref / tar archive from persistWorkspace(). */
|
|
3798
4679
|
workspaceArchive: string;
|
|
4680
|
+
/** Exact verified archive/tree descriptor produced by the runtime capture.
|
|
4681
|
+
* Omission is accepted only for legacy callers and remains unverified. */
|
|
4682
|
+
workspaceArchiveMeta?: SandboxArchiveRevision;
|
|
3799
4683
|
/** Snapshots newer than this many ms are kept (throttle); 0 = always write. */
|
|
3800
4684
|
minIntervalMs: number;
|
|
3801
4685
|
/** Wall-clock (ms) this capture STARTED. Ordering is by capture-initiation,
|
|
@@ -3809,6 +4693,7 @@ declare function persistWarmSnapshot(db: Database, input: {
|
|
|
3809
4693
|
throttled: boolean;
|
|
3810
4694
|
superseded: boolean;
|
|
3811
4695
|
priorArchiveForGc: string | null;
|
|
4696
|
+
archiveRevision: string | null;
|
|
3812
4697
|
}>;
|
|
3813
4698
|
declare function getMaterializedSandboxFileResources(db: Database, input: {
|
|
3814
4699
|
accountId: string;
|
|
@@ -4352,6 +5237,23 @@ type CreateSessionGoalInput = {
|
|
|
4352
5237
|
};
|
|
4353
5238
|
declare function createSessionGoal(db: Database, input: CreateSessionGoalInput): Promise<SessionGoal>;
|
|
4354
5239
|
declare function getSessionGoal(db: Database, workspaceId: string, sessionId: string): Promise<SessionGoal | null>;
|
|
5240
|
+
type SessionGoalContinuationProjection = {
|
|
5241
|
+
state: "inactive" | "scheduled" | "running" | "blocked" | "invariant_broken";
|
|
5242
|
+
reason: "goal_inactive" | "wake_pending" | "continuation_pending" | "human_work_pending" | "goal_turn_running" | "human_turn_running" | "workstream_paused" | "approval_required" | "provider_backpressure" | "session_cancelled" | "system_work_pending" | "missing_obligation";
|
|
5243
|
+
wakeRevision: number;
|
|
5244
|
+
observedRevision: number;
|
|
5245
|
+
nextAttemptAt: string | null;
|
|
5246
|
+
lastError: string | null;
|
|
5247
|
+
};
|
|
5248
|
+
/**
|
|
5249
|
+
* Read the goal and its autonomy state from one repeatable Postgres snapshot.
|
|
5250
|
+
* The projection never infers liveness from the public session status alone:
|
|
5251
|
+
* goal revisions, typed internal updates/turns, capacity waiters, admission
|
|
5252
|
+
* control, and the workflow-wake delivery ledger each remain distinct truth.
|
|
5253
|
+
*/
|
|
5254
|
+
declare function getSessionGoalWithContinuation(db: Database, workspaceId: string, sessionId: string): Promise<(SessionGoal & {
|
|
5255
|
+
continuation: SessionGoalContinuationProjection;
|
|
5256
|
+
}) | null>;
|
|
4355
5257
|
declare function clearSessionGoal(db: Database, workspaceId: string, sessionId: string): Promise<{
|
|
4356
5258
|
cleared: boolean;
|
|
4357
5259
|
goal: SessionGoal | null;
|
|
@@ -4367,6 +5269,19 @@ declare function upsertSessionGoal(db: Database, input: CreateSessionGoalInput):
|
|
|
4367
5269
|
goal: SessionGoal;
|
|
4368
5270
|
replaced: boolean;
|
|
4369
5271
|
}>;
|
|
5272
|
+
/**
|
|
5273
|
+
* Agent/API goal_set: session sequence ownership, the create-or-replace
|
|
5274
|
+
* mutation, and goal.set timeline fact commit together. The session-first lock
|
|
5275
|
+
* order matches active-turn event writes; goal_set must never hold a goal row
|
|
5276
|
+
* while waiting for the session sequence owner.
|
|
5277
|
+
*/
|
|
5278
|
+
declare function upsertSessionGoalWithEvent(db: Database, input: CreateSessionGoalInput & {
|
|
5279
|
+
actor: "agent" | "api";
|
|
5280
|
+
}): Promise<{
|
|
5281
|
+
goal: SessionGoal;
|
|
5282
|
+
replaced: boolean;
|
|
5283
|
+
events: SessionEvent[];
|
|
5284
|
+
}>;
|
|
4370
5285
|
/**
|
|
4371
5286
|
* goal_update semantics: revise text/criteria without changing status. The
|
|
4372
5287
|
* version bump counts as progress for the no-progress detector.
|
|
@@ -4375,6 +5290,30 @@ declare function updateSessionGoal(db: Database, workspaceId: string, sessionId:
|
|
|
4375
5290
|
text?: string;
|
|
4376
5291
|
successCriteria?: string | null;
|
|
4377
5292
|
}): Promise<SessionGoal>;
|
|
5293
|
+
/**
|
|
5294
|
+
* Agent goal_update: session sequence ownership, goal mutation, and its audit
|
|
5295
|
+
* event commit together. Locking the session before the goal also matches an
|
|
5296
|
+
* active turn's event-write order and avoids the workspace->session inversion
|
|
5297
|
+
* that previously self-locked root goal mutations.
|
|
5298
|
+
*/
|
|
5299
|
+
declare function updateSessionGoalWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
5300
|
+
text?: string;
|
|
5301
|
+
successCriteria?: string | null;
|
|
5302
|
+
progressNote?: string;
|
|
5303
|
+
actor: "agent" | "api";
|
|
5304
|
+
command?: {
|
|
5305
|
+
accountId: string;
|
|
5306
|
+
actor: Extract<SessionCommandActor, {
|
|
5307
|
+
type: "agent_attempt";
|
|
5308
|
+
}>;
|
|
5309
|
+
operationKey: string;
|
|
5310
|
+
};
|
|
5311
|
+
}): Promise<{
|
|
5312
|
+
goal: SessionGoal;
|
|
5313
|
+
events: SessionEvent[];
|
|
5314
|
+
operationId: string | null;
|
|
5315
|
+
replay: boolean;
|
|
5316
|
+
}>;
|
|
4378
5317
|
/**
|
|
4379
5318
|
* Sets a session's display title. The clobber guard lives entirely in this
|
|
4380
5319
|
* single atomic UPDATE: a user-set title is permanent, so agent/auto writes
|
|
@@ -4412,6 +5351,31 @@ declare function setSessionGoalStatus(db: Database, workspaceId: string, session
|
|
|
4412
5351
|
changed: boolean;
|
|
4413
5352
|
workflowWakeRevision: number | null;
|
|
4414
5353
|
}>;
|
|
5354
|
+
type SetSessionGoalStatusEvent = {
|
|
5355
|
+
type: "goal.completed";
|
|
5356
|
+
evidence: string;
|
|
5357
|
+
} | {
|
|
5358
|
+
type: "goal.paused";
|
|
5359
|
+
actor: "agent" | "api";
|
|
5360
|
+
reason: string;
|
|
5361
|
+
rationale?: string;
|
|
5362
|
+
} | {
|
|
5363
|
+
type: "goal.resumed";
|
|
5364
|
+
actor: "api";
|
|
5365
|
+
};
|
|
5366
|
+
/** Status mutation and its timeline fact share the same session-first commit. */
|
|
5367
|
+
declare function setSessionGoalStatusWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
5368
|
+
status: SessionGoalStatus;
|
|
5369
|
+
evidence?: string;
|
|
5370
|
+
rationale?: string;
|
|
5371
|
+
pausedReason?: string;
|
|
5372
|
+
event: SetSessionGoalStatusEvent;
|
|
5373
|
+
}): Promise<{
|
|
5374
|
+
goal: SessionGoal;
|
|
5375
|
+
changed: boolean;
|
|
5376
|
+
workflowWakeRevision: number | null;
|
|
5377
|
+
events: SessionEvent[];
|
|
5378
|
+
}>;
|
|
4415
5379
|
declare function setSessionGoalLastContinuationTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<void>;
|
|
4416
5380
|
type GoalContinuationDecision = {
|
|
4417
5381
|
decision: "none";
|
|
@@ -4442,18 +5406,63 @@ declare function evaluateGoalContinuation(db: Database, input: {
|
|
|
4442
5406
|
noProgressLimit: number;
|
|
4443
5407
|
budgetBlocked?: string | null;
|
|
4444
5408
|
}): Promise<GoalContinuationDecision>;
|
|
5409
|
+
type MaterializeGoalContinuationResult = {
|
|
5410
|
+
action: "none" | "queue";
|
|
5411
|
+
events: [];
|
|
5412
|
+
} | {
|
|
5413
|
+
action: "paused";
|
|
5414
|
+
events: SessionEvent[];
|
|
5415
|
+
} | {
|
|
5416
|
+
action: "continue";
|
|
5417
|
+
events: SessionEvent[];
|
|
5418
|
+
update: SessionSystemUpdate;
|
|
5419
|
+
goalWakeRevision: number;
|
|
5420
|
+
workflowWakeRevision: number;
|
|
5421
|
+
};
|
|
5422
|
+
/**
|
|
5423
|
+
* Consume one durable goal-wake revision into one continuation obligation.
|
|
5424
|
+
*
|
|
5425
|
+
* This is deliberately one outer PostgreSQL transaction. The existing locked
|
|
5426
|
+
* evaluator runs as a nested savepoint, so its no-progress/counter mutation is
|
|
5427
|
+
* rolled back if prompt construction, update/event insertion, metering, or the
|
|
5428
|
+
* workflow-wake outbox write fails. Retrying after a lost COMMIT response sees
|
|
5429
|
+
* the same stable goal revision and the already-pending update; it never spends
|
|
5430
|
+
* another continuation count or creates another usage row.
|
|
5431
|
+
*/
|
|
5432
|
+
declare function materializeGoalContinuation(db: Database, input: {
|
|
5433
|
+
accountId: string;
|
|
5434
|
+
workspaceId: string;
|
|
5435
|
+
sessionId: string;
|
|
5436
|
+
workflowId: string;
|
|
5437
|
+
defaultMaxAutoContinuations?: number | null;
|
|
5438
|
+
noProgressLimit: number;
|
|
5439
|
+
budgetBlocked?: string | null;
|
|
5440
|
+
policy: {
|
|
5441
|
+
model: string;
|
|
5442
|
+
reasoningEffort: ReasoningEffort;
|
|
5443
|
+
tools: ToolRef[];
|
|
5444
|
+
sandboxBackend: SandboxBackend;
|
|
5445
|
+
};
|
|
5446
|
+
prompt: (goal: SessionGoal, autoContinuation: number, cap: number | null) => string;
|
|
5447
|
+
}): Promise<MaterializeGoalContinuationResult>;
|
|
4445
5448
|
type InitializeSessionStartInput = {
|
|
4446
5449
|
accountId: string;
|
|
4447
5450
|
workspaceId: string;
|
|
4448
5451
|
sessionId: string;
|
|
4449
5452
|
clientEventId?: string;
|
|
4450
5453
|
reasoningEffortFallback: ReasoningEffort;
|
|
5454
|
+
/** Trusted create-session policy. Omitted only by legacy low-level callers. */
|
|
5455
|
+
turnExecutionPolicy?: TurnExecutionPolicyV1;
|
|
4451
5456
|
createdEventPayload: Record<string, unknown>;
|
|
4452
5457
|
goal?: {
|
|
4453
5458
|
text: string;
|
|
4454
5459
|
successCriteria?: string | null;
|
|
4455
5460
|
maxAutoContinuations?: number | null;
|
|
4456
5461
|
} | null;
|
|
5462
|
+
consumeNewSessionDraft?: {
|
|
5463
|
+
subjectId: string;
|
|
5464
|
+
expectedRevision: number;
|
|
5465
|
+
} | null;
|
|
4457
5466
|
};
|
|
4458
5467
|
type InitializeSessionStartResult = {
|
|
4459
5468
|
events: SessionEvent[];
|
|
@@ -4784,6 +5793,12 @@ type RecoverSessionDispatchResult = {
|
|
|
4784
5793
|
*/
|
|
4785
5794
|
declare function recoverSessionDispatch(db: Database, workspaceId: string, input: RecoverSessionDispatchInput): Promise<RecoverSessionDispatchResult>;
|
|
4786
5795
|
declare function getSessionTurn(db: Database, workspaceId: string, turnId: string): Promise<SessionTurn | null>;
|
|
5796
|
+
/**
|
|
5797
|
+
* Resolve the exact currently executable turn/attempt from authoritative
|
|
5798
|
+
* pointers in one query. This avoids treating a stale session preview as proof
|
|
5799
|
+
* that no attempt exists during an atomic claim transition.
|
|
5800
|
+
*/
|
|
5801
|
+
declare function getActiveSessionTurnForExecution(db: Database, workspaceId: string, sessionId: string): Promise<SessionTurnForExecution | null>;
|
|
4787
5802
|
declare function getSessionTurnForAttempt(db: Database, workspaceId: string, sessionId: string, attemptId: string): Promise<SessionTurnForExecution | null>;
|
|
4788
5803
|
/**
|
|
4789
5804
|
* Return the newest turn that reached agent execution for a session. A claimed
|
|
@@ -4876,11 +5891,26 @@ declare function enqueueSessionWorkflowWakeIfRunnable(db: Database, input: {
|
|
|
4876
5891
|
/** Claim only explicit, undelivered wake revisions; never infer work by scan. */
|
|
4877
5892
|
declare function claimPendingSessionWorkflowWakes(db: Database, limit?: number): Promise<SessionWorkflowWake[]>;
|
|
4878
5893
|
/**
|
|
4879
|
-
* Acknowledge an immediate post-commit signal
|
|
4880
|
-
*
|
|
4881
|
-
*
|
|
5894
|
+
* Acknowledge an immediate post-commit signal only after it cannot strand an
|
|
5895
|
+
* accepted Agent Steer. Temporal accepting a signal is transport evidence, not
|
|
5896
|
+
* proof that a closing workflow observed Postgres or admitted its pending
|
|
5897
|
+
* direction. While active control still has an actionable Agent Steer, retain
|
|
5898
|
+
* the revision so the bounded outbox dispatcher retries signalWithStart. The
|
|
5899
|
+
* attempt-fenced claim consumes the update once; a real Pause is the typed
|
|
5900
|
+
* blocker and may acknowledge this revision because Resume commits a new one.
|
|
5901
|
+
*
|
|
5902
|
+
* An older sender may advance only its own revision; it cannot clear a claim or
|
|
5903
|
+
* failure state belonging to a newer revision. The control -> workspace ->
|
|
5904
|
+
* session lock prefix serializes this decision with Steer, Pause/Resume, and
|
|
5905
|
+
* claim without weakening physical-quiescence admission.
|
|
4882
5906
|
*/
|
|
4883
|
-
|
|
5907
|
+
type SessionWorkflowWakeDeliveryResult = {
|
|
5908
|
+
action: "acknowledged";
|
|
5909
|
+
} | {
|
|
5910
|
+
action: "pending_admission";
|
|
5911
|
+
blocker: "pending_agent_steer";
|
|
5912
|
+
};
|
|
5913
|
+
declare function markSessionWorkflowWakeDelivered(db: Database, input: Omit<SessionWorkflowWake, "interruptionRequested">): Promise<SessionWorkflowWakeDeliveryResult>;
|
|
4884
5914
|
/** Record delivery failure; the claim already scheduled the bounded retry. */
|
|
4885
5915
|
declare function markSessionWorkflowWakeFailed(db: Database, input: SessionWorkflowWake, error: string): Promise<boolean>;
|
|
4886
5916
|
declare function getOrCreateSessionSystemUpdateOutbox(db: Database, input: Omit<SessionSystemUpdateOutboxDelivery, "id" | "status">): Promise<SessionSystemUpdateOutboxDelivery>;
|
|
@@ -4970,6 +6000,7 @@ declare function appendSessionEventsAndUpdateSession(db: Database, workspaceId:
|
|
|
4970
6000
|
}): Promise<SessionEvent[]>;
|
|
4971
6001
|
type LockedSessionUpdateContext = {
|
|
4972
6002
|
updateSessionMcpServerCredentials: (updates: UpdateSessionMcpServerCredentialsInput[]) => Promise<UpdateSessionMcpServerCredentialsResult>;
|
|
6003
|
+
updateSessionMcpApprovalPolicy: (serverId: string, requireApproval: SessionMcpApprovalPolicy) => Promise<UpdateSessionMcpApprovalPolicyResult>;
|
|
4973
6004
|
listPendingSessionTurns: () => Promise<SessionTurn[]>;
|
|
4974
6005
|
};
|
|
4975
6006
|
type LockedSessionUpdateResult = {
|
|
@@ -4986,4 +6017,4 @@ type LockedSessionUpdateResult = {
|
|
|
4986
6017
|
declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>): Promise<SessionEvent[]>;
|
|
4987
6018
|
declare function sessionSubject(workspaceId: string, sessionId: string): string;
|
|
4988
6019
|
|
|
4989
|
-
export { type CorrectWorkspaceMemoryInput as $, AGENT_VISIBLE_MEMORY_STATUSES as A, type BootstrapWorkspaceInput as B, CODEX_CAPACITY_REFRESH_MAX_MS as C, type CodexCapacityResetKind as D, type CodexCapacitySelectionContext as E, type CodexCapacityWait as F, type CodexCapacityWaitStatus as G, type CodexCapacityWakeTarget as H, type CodexCredentialForRun as I, type CodexCredentialLeaseCandidateFilter as J, type CodexCredentialLeaseCandidateFilterResult as K, type CodexCredentialLeasePolicyScopeResolver as L, type CodexCredentialLeaseQuarantine as M, type CodexCredentialLeaseResult as N, type CodexCredentialLeaseSelection as O, type CodexCredentialLeaseSelectionContext as P, type ProvisionResult, type ProvisionRolesOptions, type CodexCredentialStatus as Q, type CodexCredentialTokens as R, type CodexLeaseAccountStatus as S, type CodexPinSource as T, type CodexRotationSettings as U, type CodexRotationStrategy as V, type ComposerDraftRow as W, type ConnectionBrokerDeps as X, type ConnectionCredentialForBroker as Y, ConnectionRefreshHttpError as Z, type ConsumeOAuthStateNonceInput as _, type AcceptSessionApprovalDecisionResult as a, MEMORY_BLOCK_RECORD_LIMIT as a$, type CorrectWorkspaceMemoryResult as a0, type CreateCapabilityCatalogItemInput as a1, type CreateConnectionInput as a2, type CreateDbOptions as a3, type CreateImportBatchInput as a4, type CreateKnowledgeMemoryInput as a5, type CreatePackInstallationInput as a6, type CreateScheduledTaskInput as a7, type CreateSessionGoalInput as a8, type CreateSessionMcpServerInput as a9, type GoalContinuationDecision as aA, type HostExportConsumerStatus as aB, type HostExportKind as aC, HostExportPayloadError as aD, HostMcpCredentialBindingError as aE, type HostMcpCredentialResolverContext as aF, HostMcpCredentialScopeError as aG, HumanInputResponseValidationError as aH, type IdempotentPersistenceTransactionOptions as aI, type ImportBatch as aJ, type InitializeSessionStartInput as aK, type InitializeSessionStartResult as aL, type IntegrationOAuthClientForUse as aM, type LeaseHolderKind as aN, type LeaseSnapshot as aO, type ListKnowledgeMemoryOptions as aP, type ListSessionEventPageOptions as aQ, type ListSessionEventsOptions as aR, type ListSessionsForSubjectOptions as aS, type ListSessionsOptions as aT, type LiveModalSandboxLeaseAttribution as aU, MACHINE_METRICS_SERIES_INTERVAL_MS as aV, MAX_INTERNAL_UPDATE_BATCH_BYTES as aW, MAX_INTERNAL_UPDATE_BATCH_MEMBERS as aX, MAX_INTERNAL_UPDATE_BYTES as aY, MEMORY_ACTIVE_RECORD_CAP as aZ, MEMORY_BLOCK_KIND_ORDER as a_, type CreateSocialConnectionInput as aa, type CreateSocialPostInput as ab, type CreditBalanceByAccount as ac, type Database as ad, type DatabaseFailureCode as ae, type DbClient as af, type DeviceEnrollmentRequestRecord as ag, type DeviceEnrollmentStatus as ah, type EditQueueCommandResult as ai, type EffectiveControlBlocker as aj, type EffectiveControlResumeOption as ak, type EffectiveControlState as al, type EffectiveSessionControl as am, type EnableCapabilityInstallationInput as an, type EnabledMcpCapabilityServer as ao, type EnqueueSessionTurnInput as ap, type EnrollmentExposure as aq, type EnrollmentOs as ar, type EnrollmentRecord as as, type EnrollmentStatus as at, type ExpiredFileUploadCleanupClaim as au, type FileUploadCleanupClaimResult as av, type ForceDrainResult as aw, type FrozenTurnInitiator as ax, type GitHubInstallation as ay, type GitHubInstallationAccess as az, type AcceptSessionHumanInputResponseResult as b, type SessionCommandActor as b$, MEMORY_CORRECT_TOOL_DESCRIPTION as b0, MEMORY_KIND_SECTION_TITLES as b1, MEMORY_NEAR_DUP_COSINE_THRESHOLD as b2, MEMORY_NEAR_DUP_NEIGHBORS as b3, MEMORY_SAVE_TOOL_DESCRIPTION as b4, MEMORY_SEARCH_DEFAULT_LIMIT as b5, MEMORY_SEARCH_MAX_LIMIT as b6, MEMORY_SEARCH_TOOL_DESCRIPTION as b7, MEMORY_TEXT_MAX_CHARS as b8, MEMORY_VISIBLE_RECORD_CAP as b9, RigActiveVersionChangedError as bA, RigChangeAlreadyVerifyingError as bB, type RigChangeMonitoringSummary as bC, RigChangeTransitionError as bD, type RigVersionContentInput as bE, type RigVersionMonitoringSummary as bF, type RlsContext as bG, type RlsStrategy as bH, SESSION_ANCESTRY_LIMIT as bI, SESSION_DISCOVERY_CONTROL_TARGET_LIMIT as bJ, SESSION_DISCOVERY_CONTROL_TITLE_MAX_CHARS as bK, SESSION_DISCOVERY_GOAL_MAX_CHARS as bL, SESSION_DISCOVERY_MESSAGE_MAX_CHARS as bM, SESSION_EVENT_DB_PAGE_MAX_BYTES as bN, type SafeDatabaseErrorFacts as bO, SandboxImageConflictError as bP, type SandboxKind as bQ, type SandboxLeaseLiveness as bR, SandboxLeaseSupersededError as bS, type SandboxPtySessionRow as bT, type SandboxRecord as bU, SandboxRigConflictError as bV, SanitizedDatabasePersistenceCause as bW, type SaveWorkspaceMemoryInput as bX, type SaveWorkspaceMemoryResult as bY, type SessionAttemptInterruptionSettlement as bZ, type SessionCodexState as b_, type MachineMetricsRow as ba, type MachineMetricsSample as bb, type MarkWarmLeaseInstanceLostResult as bc, type MemoryBlockRecord as bd, type MemoryEmbedder as be, type MemorySanitizeResult as bf, type MeterableWarmLease as bg, type PendingSessionToolCallInput as bh, type PersistenceFailureDetails as bi, type PersistenceRetryOutcome as bj, type QueueCommandConflictCode as bk, QueueCommandConflictError as bl, type QueueCommandResult as bm, type QueuedTurnRow as bn, type ReapDrainable as bo, type ReconcileCodexCapacityWaitResult as bp, type RecoverSessionDispatchInput as bq, type RecoverSessionDispatchResult as br, type RegisterWorkspacePackInput as bs, type RegistryCapabilityCatalogItemInput as bt, type RegistryCatalogSurfaceKey as bu, type ReplaceIntegrationOAuthClientInput as bv, type RequestSessionTurnRecoveryInput as bw, type RequestSessionTurnRecoveryResult as bx, type ResolveConnectionCredentialInput as by, type ResolveConnectionCredentialResult as bz, type AccrueWarmSecondsResult as c, type WorkspaceMemorySearchInput as c$, SessionCommandIdempotencyError as c0, type SessionCommandReceiptRow as c1, SessionContextBusyError as c2, SessionControlConflictError as c3, SessionControlInvariantError as c4, type SessionControlMutationResult as c5, type SessionDiscoveryControl as c6, type SessionDiscoveryCursor as c7, type SessionDiscoveryOrderBy as c8, type SessionDiscoverySummary as c9, type SteerQueueCommandResult as cA, type StoreIntegrationOAuthClientInput as cB, type StoredIntegrationOAuthClient as cC, type StreamAcknowledgment as cD, type SubmitHumanPromptResult as cE, type ToolspaceCallReservation as cF, type TurnAttemptFenceRejectReason as cG, type UpdateConnectionInput as cH, type UpdateImportBatchCountsInput as cI, type UpdateKnowledgeMemoryInput as cJ, type UpdateScheduledTaskInput as cK, type UpdateSessionMcpServerCredentialsInput as cL, type UpdateSessionMcpServerCredentialsResult as cM, type UserLookup as cN, type VariableSetForRun as cO, WORKSPACE_MEMORY_BLOCK_EMPTY as cP, WORKSPACE_MEMORY_BLOCK_HEADER_POPULATED as cQ, WORKSPACE_MEMORY_BLOCK_TOKEN_BUDGET as cR, type WorkspaceCaptureCommitResult as cS, type WorkspaceCaptureGcPlan as cT, type WorkspaceCaptureGcRow as cU, type WorkspaceCaptureRow as cV, type WorkspaceControlLockMode as cW, type WorkspaceControlMutationResult as cX, type WorkspaceControlRow as cY, type WorkspaceEnvironmentForRun as cZ, type WorkspaceMemoryOrigin as c_, type SessionEventPage as ca, SessionEventPersistenceError as cb, type SessionEventWriteLockInput as cc, type SessionEventWriteLocks as cd, SessionIdConflictError as ce, type SessionLineage as cf, SessionListAccessError as cg, type SessionListCursor as ch, SessionListCursorError as ci, type SessionMcpServerForRun as cj, SessionPinAccessError as ck, SessionPinVersionConflictError as cl, type SessionRecordingCodec as cm, type SessionRecordingMode as cn, type SessionRecordingRow as co, type SessionRecordingState as cp, type SessionSystemUpdateOutboxDelivery as cq, type SessionTurnAttemptOutcome as cr, type SessionTurnForExecution as cs, type SessionTurnRecordingSettlement as ct, type SessionWorkPeek as cu, type SessionWorkTrigger as cv, type SessionWorkflowWake as cw, type SetSessionCodexPinOptions as cx, type SettleCodexCredentialFailoverResult as cy, type SettleCodexCredentialLeaseLossResult as cz, type AcquireLeaseInput as d, countActiveSessionHistoryItems as d$, type WorkspaceMemorySearchMode as d0, type WorkspaceMemorySearchResult as d1, type WorkspaceModelPolicy as d2, abandonRecordingForTurnAttempt as d3, acceptSessionApprovalDecision as d4, acceptSessionHumanInputResponse as d5, accrueWarmSeconds as d6, acknowledgeHostExportBatch as d7, acquireCodexCredentialLease as d8, acquireLease as d9, buildConnectionTokenResolver as dA, buildHostConnectionTokenResolver as dB, canonicalSessionCommandHash as dC, claimExpiredFileUploadCleanup as dD, claimFileUploadCleanup as dE, claimHostExportBatch as dF, claimPendingSessionSystemUpdateOutbox as dG, claimPendingSessionWorkflowWakes as dH, claimSessionWorkForAttempt as dI, clearDurablePendingSessionToolCalls as dJ, clearEnrollmentWentOffline as dK, clearSessionContext as dL, clearSessionGoal as dM, clearedContextMarkerItem as dN, closePtySession as dO, closeSessionTurnAttemptInTransaction as dP, codexCapacityRefreshBackoffMs as dQ, commitWarmingToWarm as dR, completeExpiredFileUploadCleanup as dS, completeFileUpload as dT, completeFileUploadCleanup as dU, computeWorkspaceCaptureGcPlan as dV, confirmDrainCold as dW, consumeDeviceEnrollmentRequest as dX, consumeIntegrationOAuthStateNonce as dY, correctWorkspaceMemory as dZ, countActiveApiKeysForWorkspace as d_, activateRigVersion as da, addSessionSystemUpdate as db, addSessionSystemUpdateWithSourceMutation as dc, allAccountPermissions as dd, allWorkspacePermissions as de, appendSessionEventToSandboxGroup as df, appendSessionEvents as dg, appendSessionEventsAndUpdateSession as dh, appendSessionEventsForTurnAttempt as di, appendSessionEventsWithLockedSessionUpdate as dj, appendSessionHistoryItems as dk, applyContextCompaction as dl, applyCreditDebitUpToBalance as dm, applyCreditLedgerEntry as dn, applySessionTurnSettlement as dp, approveDeviceEnrollmentRequest as dq, areGitHubRepositoriesAllowedForWorkspace as dr, armCodexCapacityWait as ds, assertAgentCommandAuthorityInTransaction as dt, autoResumeSessionBranchInTransaction as du, beginRigChangeVerificationAttempt as dv, bindGitHubInstallationRepositories as dw, bootstrapWorkspace as dx, buildChildCompletionDigest as dy, buildCodexTokenResolver as dz, type AcquireLeaseResult as e, enableCapabilityInstallation as e$, countActiveSessionsForWorkspace as e0, countActiveSessionsUsingEnvironment as e1, countActiveSessionsUsingVariableSet as e2, countConsecutiveReactiveRotations as e3, countQueuedTurns as e4, countRigs as e5, countSandboxLeasesByLiveness as e6, countScheduledTasksForWorkspace as e7, countScheduledTasksUsingEnvironment as e8, countScheduledTasksUsingVariableSet as e9, createVariableSet as eA, createWorkspace as eB, createWorkspaceEnvironment as eC, databaseFailureCode as eD, deadLetterHostExportHead as eE, decodeSessionListCursor as eF, decryptEnvironmentValue as eG, decryptedCapabilityHeaders as eH, deleteGitHubInstallationBinding as eI, deleteRecording as eJ, deleteRig as eK, deleteRigIfNoActiveSessions as eL, deleteScheduledTask as eM, deleteSessionQueueItemInTransaction as eN, deleteVariableSet as eO, deleteVariableSetVariable as eP, deleteWorkspace as eQ, deleteWorkspaceCaptureRows as eR, deleteWorkspaceEnvironment as eS, deleteWorkspaceEnvironmentVariable as eT, deleteWorkspacePack as eU, denyDeviceEnrollmentRequest as eV, disableCapabilityInstallation as eW, disableHostExportConsumer as eX, disconnectAllCodexAccounts as eY, disconnectCodexAccount as eZ, editQueuedTurnInTransaction as e_, countSessionHistoryItems as ea, countSessionsUsingRig as eb, countVariableSets as ec, countWorkspaceEnvironments as ed, countWorkspacesForAccount as ee, createApiKey as ef, createConnection as eg, createDb as eh, createDeviceEnrollmentRequest as ei, createEnrollment as ej, createFileUpload as ek, createImportBatch as el, createKnowledgeMemory as em, createRig as en, createRigChange as eo, createRigVersion as ep, createRigVersionForChangePromotion as eq, createSandbox as er, createScheduledTask as es, createScheduledTaskRun as et, createSession as eu, createSessionGoal as ev, createSessionMcpServers as ew, createSessionWithIdempotencyKey as ex, createSocialConnection as ey, createSocialPost as ez, type ActiveSandboxPointer as f, getSessionEvent as f$, enablePackInstallation as f0, encodeSessionListCursor as f1, encryptEnvironmentValue as f2, enqueueSessionTurn as f3, enqueueSessionWorkflowWake as f4, enqueueSessionWorkflowWakeIfRunnable as f5, enqueueSessionWorkflowWakeInTransaction as f6, ensureCodexRotationSettings as f7, ensureManagedAccessForUser as f8, estimateMemoryTokens as f9, getFileUpload as fA, getHostExportConsumerStatus as fB, getHumanInputResumeForEvent as fC, getKnowledgeMemory as fD, getLatestRunState as fE, getLatestStartedSessionTurn as fF, getManagedAccount as fG, getManagedUserByEmail as fH, getMaterializedSandboxFileResources as fI, getOpenPtySession as fJ, getOrCreateSessionSystemUpdateOutbox as fK, getPackInstallation as fL, getPendingDeviceEnrollmentRequestByUserCode as fM, getPendingDeviceEnrollmentRequestByUserCodeGlobal as fN, getRecording as fO, getRig as fP, getRigByName as fQ, getRigChange as fR, getRigName as fS, getRigVersion as fT, getRigVersionById as fU, getSandbox as fV, getSandboxSessionEnvelope as fW, getScheduledTask as fX, getSession as fY, getSessionByCreateIdempotencyKey as fZ, getSessionCodexState as f_, evaluateGoalContinuation as fa, evaluateSessionControl as fb, evaluateSessionControls as fc, evaluateSessionDiscoveryControls as fd, expireSessionHumanInputRequest as fe, failHostExportBatch as ff, failWarmingToCold as fg, fetchCodexUsageForAccount as fh, finalizeEnrollmentByToken as fi, findActiveApiKeyByHash as fj, forceDrainOverLimitViewerOnlyBoxes as fk, frozenInitiatorForCommandActor as fl, getActiveSessionHistoryItems as fm, getAnySessionInGroup as fn, getBillingBalance as fo, getBillingCustomer as fp, getCapabilityCatalogItem as fq, getCapabilityInstallation as fr, getCodexCapacityWaitForSession as fs, getCodexCredentialStatus as ft, getCodexRotationSettings as fu, getComposerDraftInTransaction as fv, getConnectionMetadata as fw, getDeviceEnrollmentRequestByDeviceCode as fx, getEnrollment as fy, getFile as fz, type AddSessionSystemUpdateInput as g, listLiveModalSandboxLeaseAttributions as g$, getSessionEventByClientEventId as g0, getSessionForSubject as g1, getSessionGoal as g2, getSessionHistoryItems as g3, getSessionHumanInputRequest as g4, getSessionLineage as g5, getSessionQueueSnapshot as g6, getSessionRootId as g7, getSessionSystemUpdateOutboxByDedupeKey as g8, getSessionTurn as g9, insertPtySession as gA, insertRecording as gB, insertWorkspaceCapture as gC, interruptedToolCallResult as gD, isCodexBilledTurn as gE, isDatabasePersistenceFailure as gF, isMemoryTextTooLong as gG, isPrivateAddress as gH, isRetryablePersistenceSqlState as gI, isSessionCompactionRequested as gJ, isSessionEventPersistenceError as gK, isStripeWebhookProcessed as gL, latestWorkspaceCapture as gM, listApiKeys as gN, listCapabilityCatalogItems as gO, listCapabilityInstallations as gP, listCodexAccountStatuses as gQ, listConnectionsMetadata as gR, listCreditBalancesByAccount as gS, listDistinctRigVersionIdsInGroup as gT, listDistinctVariableSetIdsInGroup as gU, listEnabledMcpCapabilityServers as gV, listEnrollments as gW, listGitHubInstallationAccessForWorkspace as gX, listGitHubInstallationIdsForWorkspace as gY, listGitHubInstallationsForWorkspace as gZ, listKnowledgeMemories as g_, getSessionTurnForAttempt as ga, getSocialConnection as gb, getStoredCapabilityHeaderCiphertext as gc, getStreamAcknowledgment as gd, getVariableSet as ge, getVariableSetByName as gf, getVariableSetValuesForRun as gg, getWorkspace as gh, getWorkspaceControlEvent as gi, getWorkspaceDefaultRigId as gj, getWorkspaceEnvironment as gk, getWorkspaceEnvironmentByName as gl, getWorkspaceEnvironmentValuesForRun as gm, getWorkspaceGrant as gn, getWorkspaceModelPolicy as go, getWorkspacePack as gp, grantWorkspaceAccess as gq, hasCreditLedgerEntry as gr, hashMemoryText as gs, heartbeatCodexCredentialLease as gt, heartbeatCodexCredentialLeaseUntil as gu, heartbeatLeaseHolder as gv, ingestMachineMetricsSample as gw, initializeSessionStartAtomically as gx, insertFailedWorkspaceCapture as gy, insertMachineMetricsSeries as gz, type AddSessionSystemUpdateResult as h, orphanedResultRowIndicesForRepair as h$, listMeterableWarmLeases as h0, listOpenPtySessions as h1, listOutstandingSessionSystemUpdates as h2, listPackInstallations as h3, listPendingCodexCapacityWakeTargets as h4, listPendingSessionTurns as h5, listRecordings as h6, listRegistryCatalogSurfaceKeys as h7, listRigChangeMonitoringSummaries as h8, listRigChanges as h9, listWorkspacesForSubject as hA, loadCodexCredentialForRun as hB, loadConnectionCredentialForBroker as hC, loadIntegrationOAuthClient as hD, loadVariableSetForRun as hE, loadWorkspaceEnvironmentForRun as hF, lockSessionEventWriteRows as hG, lockWorkspaceInferenceControl as hH, markFileUploadFailed as hI, markSandboxFileResourcesMaterialized as hJ, markScheduledTaskRunFailedIfQueued as hK, markSessionAttemptQuiesced as hL, markSessionSystemUpdateOutboxDeliveredInTransaction as hM, markSessionSystemUpdateOutboxFailed as hN, markSessionWorkflowWakeDelivered as hO, markSessionWorkflowWakeFailed as hP, markStaleRegistryCatalogItems as hQ, markStripeWebhookProcessed as hR, markWarmLeaseInstanceLost as hS, mcpServerIdForCapability as hT, moveQueuedTurnInTransaction as hU, mutateSessionControlInTransaction as hV, mutateWorkspaceControlInTransaction as hW, nestedPostgresSqlState as hX, nextSessionHistoryPosition as hY, normalizeBearerScheme as hZ, normalizeMemoryText as h_, listRigVersionMonitoringSummaries as ha, listRigVersions as hb, listRigs as hc, listSandboxes as hd, listScheduledTaskRuns as he, listScheduledTasks as hf, listSessionDiscoverySummaries as hg, listSessionEventPage as hh, listSessionEvents as hi, listSessionHumanInputRequests as hj, listSessionIdsInGroup as hk, listSessionMcpServerMetadata as hl, listSessionMcpServersForChildInheritance as hm, listSessionMcpServersForRun as hn, listSessionSystemUpdatesForTurn as ho, listSessionTurns as hp, listSessions as hq, listSessionsForSubject as hr, listSocialConnections as hs, listSocialPosts as ht, listUsageEvents as hu, listVariableSets as hv, listWorkspaceControlEvents as hw, listWorkspaceEnvironments as hx, listWorkspaceMembers as hy, listWorkspacePacks as hz, AgentCommandAuthorityError as i, revokeApiKey as i$, peekSessionWork as i0, persistDrainSnapshot as i1, persistWarmSnapshot as i2, planWorkspaceCaptureGc as i3, projectEffectiveControlForRelatedAccess as i4, projectSessionForRelatedAccess as i5, pruneHostExportOutbox as i6, quarantineCodexCredentialForLease as i7, reArmDrainingLease as i8, readActiveSandbox as i9, recoverSessionDispatch as iA, refreshOAuthConnectionCredential as iB, registerDbBinding as iC, registerHostExportConsumer as iD, registerInternalUpdateWakeInTransaction as iE, registerPendingSessionToolCall as iF, registerSessionTurnAttemptClaim as iG, registerSessionWorkflowWakeInTransaction as iH, registerWorkspacePack as iI, releaseCodexCredentialLease as iJ, releaseLeaseHolder as iK, removeWorkspaceMember as iL, renameCodexAccount as iM, renderWorkspaceMemoryBlock as iN, replaceIntegrationOAuthClient as iO, requestSessionCompaction as iP, requestSessionTurnRecovery as iQ, requireFile as iR, requireScheduledTask as iS, requireSession as iT, requireSocialConnection as iU, requireWorkspace as iV, reserveSessionCommandReceipt as iW, reserveToolspaceCallForTurn as iX, resolveWorkspaceMemoryBlock as iY, resumeHostExportConsumer as iZ, retireHostExportConsumer as i_, readLease as ia, readMachineMetricsLatest as ib, readMachineMetricsLatestForWorkspace as ic, readMachineMetricsSeries as id, reapExpiredSessionListSnapshots as ie, reapStaleLeaseHolders as ig, reapStaleLeaseHoldersGlobal as ih, reconcileCodexCapacityWait as ii, recordAuditEvent as ij, recordCodexAccountConnectors as ik, recordCodexAccountUsage as il, recordCodexAccountUsageWithWakeTargets as im, recordCodexTokenRefresh as io, recordConnectionTokenRefresh as ip, recordConnectionUsed as iq, recordLeaseDataPlaneUrl as ir, recordLeaseTerminalDataPlaneUrl as is, recordPendingSessionToolCallResult as it, recordSessionActiveCodexCredential as iu, recordSkippedContextCompaction as iv, recordStreamAcknowledgment as iw, recordStripeWebhookEvent as ix, recordUsageEvent as iy, recordWarmingSandboxCreated as iz, type AgentInternalUpdateCommandResult as j, updateRecording as j$, revokeConnection as j0, revokeEnrollment as j1, revokeViewer as j2, rewindHostExportConsumer as j3, rlsContextForWorkspace as j4, rlsStrategyFor as j5, runIdempotentPersistenceTransaction as j6, safeDatabaseErrorFacts as j7, sanitizeEventPayload as j8, sanitizeEventString as j9, setSessionGoalStatus as jA, setSessionLastInputTokensForTurnAttempt as jB, setSessionPin as jC, setTemporalWorkflowId as jD, setVariableSetVariable as jE, setWorkspaceDefaultRig as jF, setWorkspaceEnvironmentVariable as jG, settleCodexCredentialFailover as jH, settleCodexCredentialLeaseLoss as jI, settleScheduledTaskRunInTransaction as jJ, settleSessionAttemptInterruptions as jK, settleSessionIdleWithParentOutbox as jL, shortMemoryId as jM, steerAgentSessionInTransaction as jN, steerQueuedTurnInTransaction as jO, storeIntegrationOAuthClient as jP, submitHumanPromptInTransaction as jQ, sumUsageQuantity as jR, supersedeSessionCurrentDirectionInTransaction as jS, touchEnrollmentLastSeen as jT, touchLeaseHolder as jU, updateCodexRotationSettings as jV, updateConnection as jW, updateImportBatchCounts as jX, updateKnowledgeMemory as jY, updatePackInstallationStatus as jZ, updatePtySessionActivity as j_, sanitizeMemoryText as ja, sanitizeModelPayload as jb, saveComposerDraftInTransaction as jc, saveRunState as jd, saveWorkspaceMemory as je, searchWorkspaceMemories as jf, sendAgentMessageInTransaction as jg, serializeEffectiveSessionControl as jh, sessionAuthorizationScopeFilter as ji, sessionSubject as jj, sessionTreeStatsForSessions as jk, sessionsWithActiveOpOnEnrollment as jl, setActiveCodexCredential as jm, setActiveSandbox as jn, setCodexCredentialExhausted as jo, setCodexCredentialExhaustedWithWakeTargets as jp, setCodexCredentialStatus as jq, setCodexCredentialStatusById as jr, setConnectionStatus as js, setEnrollmentDisplayState as jt, setEnrollmentOpStreamState as ju, setEnrollmentWentOffline as jv, setInitialActiveCodexCredential as jw, setRlsContext as jx, setSessionCodexPin as jy, setSessionGoalLastContinuationTurn as jz, type AppendEventInput as k, updateRig as k0, updateRigChangeStatus as k1, updateScheduledTask as k2, updateScheduledTaskRun as k3, updateSessionCommandReceiptResult as k4, updateSessionGoal as k5, updateSessionMcpServerCredentials as k6, updateSessionTitle as k7, updateVariableSet as k8, updateWorkspace as k9, updateWorkspaceEnvironment as ka, updateWorkspaceSettings as kb, upsertBillingCustomer as kc, upsertCapabilityCatalogItem as kd, upsertCodexSubscriptionCredential as ke, upsertGitHubInstallation as kf, upsertMachineMetricsLatest as kg, upsertRegistryCapabilityCatalogItem as kh, upsertSandboxSessionEnvelope as ki, upsertSessionGoal as kj, upsertWorkspaceModelPolicy as kk, validateHumanInputResponse as kl, withAccountRls as km, withCodexCapacityMutation as kn, withCodexCredentialRefreshLock as ko, withRlsContext as kp, withWorkspaceRls as kq, withWorkspaceSubjectRls as kr, withWorkspaceUsageLock as ks, workspaceCaptureAtRevision as kt, workspaceCodexSubscriptionActive as ku, type ApplyContextCompactionResult as l, type ApplySessionTurnSettlementInput as m, type ApplySessionTurnSettlementResult as n, type ArmCodexCapacityWaitResult as o, CODEX_CAPACITY_REFRESH_MIN_MS as p, provisionRoles, CODEX_CREDENTIAL_LEASE_TTL_MS as q, CODEX_ROTATION_STRATEGIES as r, type ClaimSessionWorkForAttemptInput as s, type ClaimSessionWorkForAttemptResult as t, type ClearSessionContextResult as u, type CodexAccountStatus as v, type CodexAccountUsageSnapshot as w, type CodexAuthDeps as x, type CodexCapacityAvailabilityDecision as y, type CodexCapacityMutationResult as z };
|
|
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 };
|