@opengeni/db 0.28.1 → 0.31.1
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/attached-browser-devices.d.ts +42 -0
- package/dist/attempt-tool-catalogs.d.ts +16 -0
- package/dist/browser-auth.d.ts +91 -0
- package/dist/browser-identities.d.ts +128 -0
- package/dist/browser-sessions.d.ts +272 -0
- package/dist/browser-state-artifacts.d.ts +17 -0
- package/dist/capability-components.d.ts +37 -0
- package/dist/capability-integrations.d.ts +192 -0
- package/dist/chunk-F5FT7BEZ.js +3535 -0
- package/dist/chunk-F5FT7BEZ.js.map +1 -0
- package/dist/chunk-ISI2TIUG.js +639 -0
- package/dist/chunk-ISI2TIUG.js.map +1 -0
- package/dist/chunk-MWDVXQOL.js +11639 -0
- package/dist/chunk-MWDVXQOL.js.map +1 -0
- package/dist/chunk-NBE6CHRI.js +955 -0
- package/dist/chunk-NBE6CHRI.js.map +1 -0
- package/dist/{chunk-DBS5HPEW.js → chunk-YHZXQ7HP.js} +760 -11
- package/dist/chunk-YHZXQ7HP.js.map +1 -0
- package/dist/codemode-operations.d.ts +117 -0
- package/dist/codex-token-resolver.d.ts +2 -2
- package/dist/company-profile-schema.d.ts +798 -0
- package/dist/company-profile.d.ts +268 -0
- package/dist/computer-sessions.d.ts +109 -0
- package/dist/connection-token-resolver.d.ts +9 -4
- package/dist/database.d.ts +52 -3
- package/dist/editable-artifact-durable-export.d.ts +153 -0
- package/dist/editable-artifact-durable-export.js +788 -0
- package/dist/editable-artifact-durable-export.js.map +1 -0
- package/dist/editable-artifact-materialization.d.ts +123 -0
- package/dist/editable-artifacts-schema.d.ts +4152 -0
- package/dist/editable-artifacts.d.ts +610 -0
- package/dist/editable-artifacts.js +26 -0
- package/dist/editable-artifacts.js.map +1 -0
- package/dist/environment-crypto.d.ts +8 -4
- package/dist/generated-images.d.ts +139 -0
- package/dist/index.d.ts +958 -126
- package/dist/index.js +31204 -12172
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +51 -4
- package/dist/integration-bindings.d.ts +70 -0
- package/dist/integration-features.d.ts +99 -0
- package/dist/interaction-revisions.d.ts +3 -0
- package/dist/interaction-schema.d.ts +5372 -0
- package/dist/knowledge-source-sync-schema.d.ts +1679 -0
- package/dist/knowledge-source-sync.d.ts +274 -0
- package/dist/lossless-columns.d.ts +58 -0
- package/dist/lossless-json.d.ts +39 -0
- package/dist/memory-domain.d.ts +3 -6
- package/dist/memory-governance.d.ts +2 -2
- package/dist/memory-slack-delivery.d.ts +101 -0
- package/dist/new-session-drafts.d.ts +2 -2
- package/dist/pack-components.d.ts +76 -0
- package/dist/pack-installations.d.ts +86 -0
- package/dist/persistence-errors.d.ts +7 -14
- package/dist/plugin-packages.d.ts +126 -0
- package/dist/preference-registry.d.ts +1 -1
- package/dist/provision-roles.d.ts +9 -1
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +18 -6
- package/dist/schema.d.ts +19122 -8731
- package/dist/schema.js +173 -1
- package/dist/scoped-knowledge.d.ts +97 -1
- package/dist/session-control.d.ts +4 -4
- package/dist/session-queue-commands.d.ts +19 -11
- package/dist/session-realtime-context.d.ts +2 -2
- package/dist/session-realtime-ledger.d.ts +4 -4
- package/dist/session-realtime-mirror.d.ts +2 -2
- package/dist/session-realtime-state.d.ts +1 -1
- package/dist/session-realtime-terminal.d.ts +8 -1
- package/dist/session-realtime.d.ts +7 -7
- package/dist/session-tool-call-settlement.d.ts +1 -1
- package/dist/slack-user-link-access.d.ts +54 -0
- package/dist/transcription-recordings-schema.d.ts +44 -6
- package/dist/transcription-recordings.d.ts +3 -3
- package/dist/turn-initiator.d.ts +2 -2
- package/dist/video-generation.d.ts +216 -0
- package/dist/video-generation.js +66 -0
- package/dist/video-generation.js.map +1 -0
- package/dist/workspace-artifacts.d.ts +1 -1
- package/dist/workspace-instruction-policies.d.ts +1 -1
- package/dist/workspace-learning-policy-schema.d.ts +932 -0
- package/dist/workspace-learning-policy.d.ts +161 -0
- package/drizzle/0065_enrollment_credential_generation.sql +10 -0
- package/drizzle/0140_retained_screenshot_artifacts.sql +192 -0
- package/drizzle/0176_lossless_canonical_json.sql +975 -0
- package/drizzle/0177_session_events_workspace_turn_type_index.sql +5 -0
- package/drizzle/0178_permissioned_secret_reads.sql +14 -0
- package/drizzle/0179_slack_private_shortcut_delivery_gate.sql +85 -0
- package/drizzle/0180_retained_screenshot_lifecycle_fences.sql +273 -0
- package/drizzle/0181_connected_machine_removal.sql +52 -0
- package/drizzle/0182_connected_machine_remove_session_default.sql +77 -0
- package/drizzle/0183_model_call_provider_cost_estimates.sql +39 -0
- package/drizzle/0184_sandbox_drain_teardown_fence.sql +682 -0
- package/drizzle/0185_temporal_schedule_cleanup_outbox.sql +168 -0
- package/drizzle/0186_sandbox_capture_provider_contract.sql +400 -0
- package/drizzle/0187_generated_image_artifacts.sql +173 -0
- package/drizzle/0188_image_generation_retention_failure.sql +25 -0
- package/drizzle/0189_retained_session_image_formats.sql +13 -0
- package/drizzle/0190_timeline_annotations.sql +31 -0
- package/drizzle/0191_editable_artifact_engine.sql +3853 -0
- package/drizzle/0192_editable_artifact_live_tickets.sql +338 -0
- package/drizzle/0193_editable_artifact_authorization.sql +190 -0
- package/drizzle/0194_editable_artifact_durable_exports.sql +160 -0
- package/drizzle/0195_editable_artifact_import_authorization.sql +203 -0
- package/drizzle/0196_rig_provider_images.sql +152 -0
- package/drizzle/0197_knowledge_source_sync_schedules.sql +523 -0
- package/drizzle/0198_memory_slack_publication_delivery.sql +393 -0
- package/drizzle/0199_workspace_learning_policy.sql +980 -0
- package/drizzle/0201_company_profile_authority.sql +849 -0
- package/drizzle/0202_document_index_checkpoints.sql +85 -0
- package/drizzle/0203_durable_video_generation.sql +353 -0
- package/drizzle/0204_video_generation_funding.sql +44 -0
- package/drizzle/0205_attempt_tool_catalogs.sql +230 -0
- package/drizzle/0206_browser_sessions.sql +646 -0
- package/drizzle/0207_browser_identities.sql +379 -0
- package/drizzle/0208_attached_browser_devices.sql +165 -0
- package/drizzle/0209_computer_sessions.sql +575 -0
- package/drizzle/0210_browser_auth_network_interventions.sql +441 -0
- package/drizzle/0211_editable_artifact_session_links.sql +58 -0
- package/drizzle/0212_slack_installation_bindings.sql +348 -0
- package/drizzle/0213_slack_user_link_access_requests.sql +177 -0
- package/drizzle/0214_session_activity_commit_gate.sql +262 -0
- package/drizzle/0215_capabilities_platform.sql +980 -0
- package/drizzle/0216_pack_component_ownership.sql +235 -0
- package/drizzle/0217_capability_definition_delete_authority.sql +32 -0
- package/package.json +18 -5
- package/src/attached-browser-devices.ts +371 -0
- package/src/attempt-tool-catalogs.ts +131 -0
- package/src/browser-auth.ts +1896 -0
- package/src/browser-identities.ts +1168 -0
- package/src/browser-sessions.ts +2005 -0
- package/src/browser-state-artifacts.ts +59 -0
- package/src/capability-components.ts +166 -0
- package/src/capability-integrations.ts +1663 -0
- package/src/codemode-operations.ts +674 -0
- package/src/company-profile-schema.ts +143 -0
- package/src/company-profile.ts +968 -0
- package/src/computer-sessions.ts +1130 -0
- package/src/connection-token-resolver.ts +270 -25
- package/src/database.ts +434 -24
- package/src/editable-artifact-durable-export.ts +1201 -0
- package/src/editable-artifact-materialization.ts +893 -0
- package/src/editable-artifacts-schema.ts +879 -0
- package/src/editable-artifacts.ts +5404 -0
- package/src/environment-crypto.ts +22 -9
- package/src/generated-images.ts +740 -0
- package/src/index.ts +10117 -2730
- package/src/insights.ts +160 -13
- package/src/integration-bindings.ts +455 -0
- package/src/integration-features.ts +859 -0
- package/src/interaction-revisions.ts +40 -0
- package/src/interaction-schema.ts +1303 -0
- package/src/knowledge-source-sync-schema.ts +192 -0
- package/src/knowledge-source-sync.ts +1922 -0
- package/src/lossless-columns.ts +35 -0
- package/src/lossless-json.ts +322 -0
- package/src/memory-domain.ts +5 -44
- package/src/memory-slack-delivery.ts +801 -0
- package/src/pack-components.ts +954 -0
- package/src/pack-installations.ts +929 -0
- package/src/persistence-errors.ts +26 -34
- package/src/plugin-packages.ts +1186 -0
- package/src/provision-roles.ts +302 -1
- package/src/runtime-posture-cli.ts +9 -0
- package/src/runtime-posture.ts +514 -5
- package/src/schema.ts +5177 -2957
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +133 -81
- package/src/session-queue-commands.ts +511 -247
- package/src/session-realtime-context.ts +20 -7
- package/src/session-realtime-ledger.ts +32 -10
- package/src/session-realtime-mirror.ts +4 -2
- package/src/session-realtime-terminal.ts +89 -21
- package/src/session-realtime.ts +10 -9
- package/src/session-tool-call-settlement.ts +38 -15
- package/src/slack-user-link-access.ts +702 -0
- package/src/transcription-recordings-schema.ts +5 -2
- package/src/transcription-recordings.ts +70 -40
- package/src/video-generation.ts +1452 -0
- package/src/workspace-learning-policy-schema.ts +139 -0
- package/src/workspace-learning-policy.ts +595 -0
- package/dist/chunk-DBS5HPEW.js.map +0 -1
- package/dist/chunk-HT5T62CC.js +0 -6803
- package/dist/chunk-HT5T62CC.js.map +0 -1
- package/dist/event-payload-sanitizer.d.ts +0 -32
- package/src/event-payload-sanitizer.ts +0 -377
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityKind, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, McpPersonalConnectionDelegation, Permission, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalCreatedBy, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetVariableMetadata, WorkspaceMember, WorkspaceRegisteredPack, Rig, RigVersion, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding } from "@opengeni/contracts";
|
|
1
|
+
import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityKind, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, McpPersonalConnectionDelegation, Permission, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalCreatedBy, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceRegisteredPack, Rig, RigProviderImage, RigProviderImages, RigVersion, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
|
|
2
|
+
import { type TimelineAnnotation } from "@opengeni/contracts";
|
|
2
3
|
import { type LatencyMode, SessionSystemUpdatePayload, TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
3
4
|
import { type Settings } from "@opengeni/config";
|
|
4
5
|
import { type CodexFetch } from "@opengeni/codex";
|
|
5
6
|
export { isCodexBilledModel } from "@opengeni/codex";
|
|
6
7
|
import { type SQL } from "drizzle-orm";
|
|
7
|
-
export { frozenInitiatorForCommandActor, type FrozenTurnInitiator } from "./turn-initiator";
|
|
8
|
-
|
|
9
|
-
import { type
|
|
10
|
-
import
|
|
8
|
+
export { frozenInitiatorForCommandActor, type FrozenTurnInitiator } from "./turn-initiator.js";
|
|
9
|
+
export { LOSSLESS_TEXT_PREFIX } from "./lossless-json.js";
|
|
10
|
+
import { type SessionDiscoveryControl, type SessionCommandActor, type SessionTurnAttemptOutcome } from "./session-control.js";
|
|
11
|
+
import { type SessionRealtimeContinuityEntry } from "./session-realtime-context.js";
|
|
12
|
+
import * as schema from "./schema.js";
|
|
11
13
|
export { sql as dbSql } from "drizzle-orm";
|
|
12
|
-
export * from "./session-control";
|
|
13
|
-
export * from "./session-queue-commands";
|
|
14
|
-
export * from "./session-realtime";
|
|
15
|
-
export * from "./session-realtime-context";
|
|
16
|
-
export * from "./session-realtime-ledger";
|
|
17
|
-
export * from "./new-session-drafts";
|
|
18
|
-
export * from "./workspace-instruction-policies";
|
|
19
|
-
export * from "./
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export * from "./
|
|
33
|
-
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
14
|
+
export * from "./session-control.js";
|
|
15
|
+
export * from "./session-queue-commands.js";
|
|
16
|
+
export * from "./session-realtime.js";
|
|
17
|
+
export * from "./session-realtime-context.js";
|
|
18
|
+
export * from "./session-realtime-ledger.js";
|
|
19
|
+
export * from "./new-session-drafts.js";
|
|
20
|
+
export * from "./workspace-instruction-policies.js";
|
|
21
|
+
export * from "./company-profile.js";
|
|
22
|
+
export * from "./workspace-learning-policy.js";
|
|
23
|
+
export * from "./preference-registry.js";
|
|
24
|
+
export * from "./memory-governance.js";
|
|
25
|
+
export * from "./memory-slack-delivery.js";
|
|
26
|
+
export * from "./scoped-knowledge.js";
|
|
27
|
+
export * from "./knowledge-source-sync.js";
|
|
28
|
+
export * from "./generated-images.js";
|
|
29
|
+
export * from "./slack-user-link-access.js";
|
|
30
|
+
export * from "./video-generation.js";
|
|
31
|
+
export { interruptedToolCallResult } from "./session-tool-call-settlement.js";
|
|
32
|
+
export { decryptEnvironmentValue, encryptEnvironmentValue } from "./environment-crypto.js";
|
|
33
|
+
export { decryptEnvironmentValue as decryptVariableSetValue, encryptEnvironmentValue as encryptVariableSetValue, } from "./environment-crypto.js";
|
|
34
|
+
export * from "./persistence-errors.js";
|
|
35
|
+
export * from "./runtime-posture.js";
|
|
36
|
+
export * from "./capability-integrations.js";
|
|
37
|
+
export * from "./integration-bindings.js";
|
|
38
|
+
export * from "./integration-features.js";
|
|
39
|
+
export * from "./insights.js";
|
|
40
|
+
export { memoryTextForStorage } from "./memory-domain.js";
|
|
41
|
+
export { migrate, runMigrations } from "./migrate.js";
|
|
42
|
+
export { provisionRoles, type ProvisionResult, type ProvisionRolesOptions, } from "./provision-roles.js";
|
|
43
|
+
export * from "./memory-domain.js";
|
|
44
|
+
import { type Database, type SessionActivityDatabase } from "./database.js";
|
|
45
|
+
export { createDb, registerDbBinding, retrySessionActivityRls, rlsContextForWorkspace, rlsStrategyFor, setRlsContext, setSubjectRlsContext, withAccountRls, withDatabaseStatementTimeout, withRlsContext, withSessionActivityRlsContext, withSessionActivitySavepoint, withWorkspaceRls, withWorkspaceSessionActivityRls, withWorkspaceSubjectRls, withWorkspaceSubjectSessionActivityRls, withWorkspaceUsageLock, withSandboxProviderReadLock, SandboxProviderReadLockUnavailableError, type CreateDbOptions, type Database, type DbClient, type SessionActivityDatabase, type RlsContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type UserLookup, } from "./database.js";
|
|
46
|
+
import { buildCodexTokenResolver as buildCodexTokenResolverCore, fetchCodexRateLimitResetCreditsForAccount as fetchCodexRateLimitResetCreditsForAccountCore, fetchCodexUsageForAccount as fetchCodexUsageForAccountCore, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun } from "./codex-token-resolver.js";
|
|
47
|
+
import { buildConnectionTokenResolver as buildConnectionTokenResolverCore, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionTokenResolverOptions } from "./connection-token-resolver.js";
|
|
37
48
|
/** Raised when a durable session tool-policy write lost its version fence. */
|
|
38
49
|
export declare class SessionToolPolicyVersionConflictError extends Error {
|
|
39
50
|
readonly currentVersion: number;
|
|
@@ -287,6 +298,49 @@ export declare function removeWorkspaceMember(db: Database, workspaceId: string,
|
|
|
287
298
|
*/
|
|
288
299
|
export declare function getManagedUserByEmail(db: Database, email: string): Promise<string | null>;
|
|
289
300
|
export declare function deleteWorkspace(db: Database, workspaceId: string): Promise<void>;
|
|
301
|
+
export type TemporalScheduleCleanupClaim = {
|
|
302
|
+
id: string;
|
|
303
|
+
accountId: string;
|
|
304
|
+
workspaceId: string;
|
|
305
|
+
temporalScheduleId: string;
|
|
306
|
+
claimId: string;
|
|
307
|
+
attemptCount: number;
|
|
308
|
+
};
|
|
309
|
+
export type DeleteWorkspaceIfQuiescentResult = {
|
|
310
|
+
status: "deleted";
|
|
311
|
+
temporalScheduleCleanups: TemporalScheduleCleanupClaim[];
|
|
312
|
+
} | {
|
|
313
|
+
status: "not_found" | "only_workspace" | "active_sessions" | "active_video_generations" | "live_sandboxes";
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Atomically prove a workspace has no live runtime ownership and delete it.
|
|
317
|
+
*
|
|
318
|
+
* The account/workspace parent locks block concurrent child inserts through
|
|
319
|
+
* their foreign-key key-share locks. Existing session and lease rows are then
|
|
320
|
+
* locked before their state is inspected, so a cold lease cannot become live
|
|
321
|
+
* between a preflight count and the cascade. Schedule ids are copied under the
|
|
322
|
+
* same fence and returned for post-commit Temporal cleanup.
|
|
323
|
+
*/
|
|
324
|
+
export declare function deleteWorkspaceIfQuiescent(db: Database, input: {
|
|
325
|
+
accountId: string;
|
|
326
|
+
workspaceId: string;
|
|
327
|
+
}): Promise<DeleteWorkspaceIfQuiescentResult>;
|
|
328
|
+
/** Claim a bounded cross-workspace batch after abandoned claims expire. */
|
|
329
|
+
export declare function claimTemporalScheduleCleanups(db: Database, input: {
|
|
330
|
+
claimId: string;
|
|
331
|
+
limit?: number;
|
|
332
|
+
claimSeconds?: number;
|
|
333
|
+
}): Promise<TemporalScheduleCleanupClaim[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Settle only the exact claimed cleanup. A null error acknowledges the
|
|
336
|
+
* idempotent external deletion and removes the durable receipt; an error
|
|
337
|
+
* releases it with bounded exponential backoff.
|
|
338
|
+
*/
|
|
339
|
+
export declare function settleTemporalScheduleCleanup(db: Database, input: {
|
|
340
|
+
id: string;
|
|
341
|
+
claimId: string;
|
|
342
|
+
error?: string | null;
|
|
343
|
+
}): Promise<boolean>;
|
|
290
344
|
export declare function createApiKey(db: Database, input: {
|
|
291
345
|
accountId: string;
|
|
292
346
|
workspaceId?: string | null;
|
|
@@ -419,6 +473,8 @@ export type ModelCallFact = {
|
|
|
419
473
|
reasoningTokens: number | null;
|
|
420
474
|
totalTokens: number | null;
|
|
421
475
|
pricedCostMicros: number;
|
|
476
|
+
estimatedProviderCostMicros: number | null;
|
|
477
|
+
pricingSource: "configured_list_price" | "gateway_reported" | null;
|
|
422
478
|
occurredAt: Date;
|
|
423
479
|
recordedAt: Date;
|
|
424
480
|
};
|
|
@@ -438,6 +494,8 @@ export declare function recordModelCallFact(db: Database, input: {
|
|
|
438
494
|
model: string;
|
|
439
495
|
billingPath: ModelCallBillingPath;
|
|
440
496
|
pricedCostMicros: number;
|
|
497
|
+
estimatedProviderCostMicros?: number | null;
|
|
498
|
+
pricingSource?: "configured_list_price" | "gateway_reported" | null;
|
|
441
499
|
inputTokens?: number | null;
|
|
442
500
|
outputTokens?: number | null;
|
|
443
501
|
cachedTokens?: number | null;
|
|
@@ -534,11 +592,13 @@ export type CreateScheduledTaskInput = {
|
|
|
534
592
|
temporalScheduleId: string;
|
|
535
593
|
runMode: ScheduledTaskRunMode;
|
|
536
594
|
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
595
|
+
action?: ScheduledTaskAction;
|
|
537
596
|
agentConfig: ScheduledTaskAgentConfig;
|
|
538
597
|
createdBy?: TurnInitiator;
|
|
539
598
|
createdByContext?: TurnInitiatorContext;
|
|
540
599
|
createdByActor?: AgentSessionCreationActor | null;
|
|
541
600
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
601
|
+
targetSessionId?: string | null;
|
|
542
602
|
variableSetId?: string | null;
|
|
543
603
|
rigId?: string | null;
|
|
544
604
|
metadata: Record<string, unknown>;
|
|
@@ -549,9 +609,11 @@ export type UpdateScheduledTaskInput = Partial<{
|
|
|
549
609
|
schedule: ScheduledTaskScheduleSpec;
|
|
550
610
|
runMode: ScheduledTaskRunMode;
|
|
551
611
|
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
612
|
+
action: ScheduledTaskAction;
|
|
552
613
|
agentConfig: ScheduledTaskAgentConfig;
|
|
553
614
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
554
615
|
reusableSessionId: string | null;
|
|
616
|
+
targetSessionId: string | null;
|
|
555
617
|
variableSetId: string | null;
|
|
556
618
|
rigId: string | null;
|
|
557
619
|
metadata: Record<string, unknown>;
|
|
@@ -560,6 +622,11 @@ export type CreatePackInstallationInput = {
|
|
|
560
622
|
accountId: string;
|
|
561
623
|
workspaceId: string;
|
|
562
624
|
packId: string;
|
|
625
|
+
status?: PackInstallationStatus;
|
|
626
|
+
manifestSnapshot?: CapabilityPack | null;
|
|
627
|
+
manifestDigest?: string | null;
|
|
628
|
+
selectedRigId?: string | null;
|
|
629
|
+
installedBySubjectId?: string | null;
|
|
563
630
|
metadata?: Record<string, unknown>;
|
|
564
631
|
};
|
|
565
632
|
export type RegisterWorkspacePackInput = {
|
|
@@ -689,6 +756,23 @@ export type UpdateConnectionInput = {
|
|
|
689
756
|
metadata?: Record<string, unknown>;
|
|
690
757
|
updatedBySubjectId?: string | null;
|
|
691
758
|
};
|
|
759
|
+
export type PersistProviderOAuthConnectionInput = CreateConnectionInput & {
|
|
760
|
+
visibleToSubjectId: string;
|
|
761
|
+
credentialRole: string;
|
|
762
|
+
providerFamily: string;
|
|
763
|
+
providerPrincipalId: string;
|
|
764
|
+
requestedConnectionId?: string;
|
|
765
|
+
requestedConnectionVersion?: number;
|
|
766
|
+
};
|
|
767
|
+
export type UpdateSlackBotDocumentDestinationInput = {
|
|
768
|
+
accountId: string;
|
|
769
|
+
workspaceId: string;
|
|
770
|
+
connectionId: string;
|
|
771
|
+
visibleToSubjectId: string;
|
|
772
|
+
expectedVersion: number;
|
|
773
|
+
metadata: Record<string, unknown>;
|
|
774
|
+
updatedBySubjectId: string;
|
|
775
|
+
};
|
|
692
776
|
export type TransitionConnectionStateInput = {
|
|
693
777
|
workspaceId: string;
|
|
694
778
|
connectionId: string;
|
|
@@ -892,6 +976,86 @@ export type EnableCapabilityInstallationInput = {
|
|
|
892
976
|
config?: Record<string, unknown>;
|
|
893
977
|
metadata?: Record<string, unknown>;
|
|
894
978
|
};
|
|
979
|
+
export type InstallPortableSkillInput = {
|
|
980
|
+
accountId: string;
|
|
981
|
+
workspaceId: string;
|
|
982
|
+
subjectId: string;
|
|
983
|
+
capabilityId: string;
|
|
984
|
+
pluginKey: string;
|
|
985
|
+
source: "github" | "skills_sh" | "pack";
|
|
986
|
+
sourceUrl: string;
|
|
987
|
+
repositoryUrl: string;
|
|
988
|
+
sourceCommit: string;
|
|
989
|
+
sourcePath: string;
|
|
990
|
+
name: string;
|
|
991
|
+
description: string;
|
|
992
|
+
contentSha256: string;
|
|
993
|
+
totalBytes: number;
|
|
994
|
+
license?: string | null;
|
|
995
|
+
files: Array<{
|
|
996
|
+
path: string;
|
|
997
|
+
content: string;
|
|
998
|
+
byteSize: number;
|
|
999
|
+
contentSha256: string;
|
|
1000
|
+
}>;
|
|
1001
|
+
owner?: PortableSkillOwner;
|
|
1002
|
+
expectedInstallationVersion?: number;
|
|
1003
|
+
};
|
|
1004
|
+
export type InstalledPortableSkill = {
|
|
1005
|
+
capabilityId: string;
|
|
1006
|
+
pluginId: string;
|
|
1007
|
+
pluginVersionId: string;
|
|
1008
|
+
facetId: string;
|
|
1009
|
+
pluginInstallationId: string;
|
|
1010
|
+
facetInstallationId: string;
|
|
1011
|
+
installationVersion: number;
|
|
1012
|
+
source: "github" | "skills_sh" | "pack";
|
|
1013
|
+
sourceUrl: string;
|
|
1014
|
+
sourceCommit: string;
|
|
1015
|
+
contentSha256: string;
|
|
1016
|
+
name: string;
|
|
1017
|
+
};
|
|
1018
|
+
export type PortableSkillRuntime = {
|
|
1019
|
+
capabilityId: string;
|
|
1020
|
+
name: string;
|
|
1021
|
+
description: string;
|
|
1022
|
+
sourceUrl: string;
|
|
1023
|
+
sourceCommit: string;
|
|
1024
|
+
sourcePath: string;
|
|
1025
|
+
contentSha256: string;
|
|
1026
|
+
files: Array<{
|
|
1027
|
+
path: string;
|
|
1028
|
+
content: string;
|
|
1029
|
+
}>;
|
|
1030
|
+
};
|
|
1031
|
+
export type PortableSkillOwner = {
|
|
1032
|
+
kind: "direct" | "plugin" | "pack" | "migration";
|
|
1033
|
+
id: string;
|
|
1034
|
+
removable: boolean;
|
|
1035
|
+
};
|
|
1036
|
+
export type PortableSkillUninstallPreview = {
|
|
1037
|
+
capabilityId: string;
|
|
1038
|
+
installed: boolean;
|
|
1039
|
+
installationVersion: number | null;
|
|
1040
|
+
directOwner: PortableSkillOwner | null;
|
|
1041
|
+
remainingOwners: PortableSkillOwner[];
|
|
1042
|
+
removesRuntimeSkill: boolean;
|
|
1043
|
+
};
|
|
1044
|
+
export type UninstallPortableSkillResult = {
|
|
1045
|
+
capabilityId: string;
|
|
1046
|
+
status: "not_installed" | "uninstalled" | "retained_by_other_owners";
|
|
1047
|
+
remainingOwners: PortableSkillOwner[];
|
|
1048
|
+
};
|
|
1049
|
+
export declare class PortableSkillInstallationVersionConflictError extends Error {
|
|
1050
|
+
readonly capabilityId: string;
|
|
1051
|
+
readonly expectedVersion: number;
|
|
1052
|
+
readonly actualVersion: number;
|
|
1053
|
+
readonly name = "PortableSkillInstallationVersionConflictError";
|
|
1054
|
+
constructor(capabilityId: string, expectedVersion: number, actualVersion: number);
|
|
1055
|
+
}
|
|
1056
|
+
export declare class PortableSkillInstallationVersionRequiredError extends Error {
|
|
1057
|
+
readonly name = "PortableSkillInstallationVersionRequiredError";
|
|
1058
|
+
}
|
|
895
1059
|
export type EnabledMcpCapabilityServer = {
|
|
896
1060
|
capabilityId: string;
|
|
897
1061
|
id: string;
|
|
@@ -900,6 +1064,7 @@ export type EnabledMcpCapabilityServer = {
|
|
|
900
1064
|
allowedTools?: string[];
|
|
901
1065
|
timeoutMs?: number;
|
|
902
1066
|
cacheToolsList?: boolean;
|
|
1067
|
+
requireApproval?: SessionMcpApprovalPolicy;
|
|
903
1068
|
/**
|
|
904
1069
|
* Credential request headers stored encrypted at enable time
|
|
905
1070
|
* (AES-256-GCM under the workspace-variableSets key). Decrypted only at
|
|
@@ -971,6 +1136,8 @@ export type EnqueueSessionTurnInput = {
|
|
|
971
1136
|
export type SessionTurnForExecution = SessionTurn & {
|
|
972
1137
|
turnInstructions: string | null;
|
|
973
1138
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
1139
|
+
/** Worker-only causal authority; never inferred from the current worker. */
|
|
1140
|
+
initiatingHumanSubjectId: string | null;
|
|
974
1141
|
};
|
|
975
1142
|
export declare function createFileUpload(db: Database, input: {
|
|
976
1143
|
accountId: string;
|
|
@@ -989,12 +1156,36 @@ export declare function createFileUpload(db: Database, input: {
|
|
|
989
1156
|
uploadId: string;
|
|
990
1157
|
expiresAt: string;
|
|
991
1158
|
}>;
|
|
1159
|
+
export type PrepareGeneratedWorkspaceFileInput = {
|
|
1160
|
+
accountId: string;
|
|
1161
|
+
workspaceId: string;
|
|
1162
|
+
fileId: string;
|
|
1163
|
+
uploadId: string;
|
|
1164
|
+
filename: string;
|
|
1165
|
+
safeFilename: string;
|
|
1166
|
+
contentType: string;
|
|
1167
|
+
sizeBytes: number;
|
|
1168
|
+
sha256: string;
|
|
1169
|
+
bucket: string;
|
|
1170
|
+
objectKey: string;
|
|
1171
|
+
expiresAt: Date;
|
|
1172
|
+
};
|
|
1173
|
+
/**
|
|
1174
|
+
* Prepare one deterministic upload intent for a generated workspace file.
|
|
1175
|
+
* Retries return the same pending/ready file only when every immutable byte and
|
|
1176
|
+
* storage fact matches; identity reuse with different content fails closed.
|
|
1177
|
+
*/
|
|
1178
|
+
export declare function prepareGeneratedWorkspaceFile(db: Database, input: PrepareGeneratedWorkspaceFileInput): Promise<{
|
|
1179
|
+
file: FileAsset;
|
|
1180
|
+
uploadId: string;
|
|
1181
|
+
created: boolean;
|
|
1182
|
+
}>;
|
|
992
1183
|
export declare function getFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset | null>;
|
|
993
1184
|
export declare function requireFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset>;
|
|
994
1185
|
/** One RLS-scoped query for all attachment metadata needed by a model turn. */
|
|
995
1186
|
export declare function getFiles(db: Database, workspaceId: string, fileIds: readonly string[]): Promise<FileAsset[]>;
|
|
996
1187
|
/** Build the canonical user row with stable attachment refs, never inline bytes. */
|
|
997
|
-
export declare function durableUserHistoryItem(prompt: string, resources: readonly ResourceRef[]): Record<string, unknown>;
|
|
1188
|
+
export declare function durableUserHistoryItem(prompt: string, resources: readonly ResourceRef[], annotations?: readonly TimelineAnnotation[]): Record<string, unknown>;
|
|
998
1189
|
export type RetainedFileArtifact = {
|
|
999
1190
|
file: FileAsset;
|
|
1000
1191
|
uploadStatus: FileUploadStatus | null;
|
|
@@ -1006,6 +1197,138 @@ export type RetainedFileArtifact = {
|
|
|
1006
1197
|
* location remain in the existing FileAsset/object-storage seam.
|
|
1007
1198
|
*/
|
|
1008
1199
|
export declare function getRetainedFileArtifact(db: Database, workspaceId: string, fileId: string): Promise<RetainedFileArtifact | null>;
|
|
1200
|
+
export type RetainedScreenshotArtifactStatus = "pending" | "reconciling" | "ready" | "cleanup_queued" | "cleanup_pending" | "failed" | "expired" | "deleted";
|
|
1201
|
+
export type RetainedScreenshotQuotaState = "reserved" | "ready" | "released";
|
|
1202
|
+
export type RetainedScreenshotArtifact = {
|
|
1203
|
+
artifactId: string;
|
|
1204
|
+
accountId: string;
|
|
1205
|
+
workspaceId: string;
|
|
1206
|
+
sessionId: string | null;
|
|
1207
|
+
turnId: string | null;
|
|
1208
|
+
attemptId: string | null;
|
|
1209
|
+
settlementKey: string;
|
|
1210
|
+
toolCallId: string;
|
|
1211
|
+
toolOutputId: string;
|
|
1212
|
+
status: RetainedScreenshotArtifactStatus;
|
|
1213
|
+
quotaState: RetainedScreenshotQuotaState;
|
|
1214
|
+
mediaType: string;
|
|
1215
|
+
sizeBytes: number;
|
|
1216
|
+
sha256: string;
|
|
1217
|
+
width: number;
|
|
1218
|
+
height: number;
|
|
1219
|
+
retentionExpiresAt: Date;
|
|
1220
|
+
readyAt: Date | null;
|
|
1221
|
+
cleanupReason: string | null;
|
|
1222
|
+
lastError: string | null;
|
|
1223
|
+
maintenanceClaimId: string | null;
|
|
1224
|
+
maintenanceClaimedAt: Date | null;
|
|
1225
|
+
createdAt: Date;
|
|
1226
|
+
updatedAt: Date;
|
|
1227
|
+
file: FileAsset;
|
|
1228
|
+
};
|
|
1229
|
+
export declare class RetainedScreenshotQuotaExceededError extends Error {
|
|
1230
|
+
readonly quotaBytes: number;
|
|
1231
|
+
readonly usedBytes: number;
|
|
1232
|
+
readonly requestedBytes: number;
|
|
1233
|
+
readonly code = "retained_screenshot_workspace_quota_exceeded";
|
|
1234
|
+
constructor(quotaBytes: number, usedBytes: number, requestedBytes: number);
|
|
1235
|
+
}
|
|
1236
|
+
export type PrepareRetainedScreenshotArtifactInput = {
|
|
1237
|
+
artifactId: string;
|
|
1238
|
+
accountId: string;
|
|
1239
|
+
workspaceId: string;
|
|
1240
|
+
sessionId: string;
|
|
1241
|
+
turnId: string;
|
|
1242
|
+
attemptId: string;
|
|
1243
|
+
settlementKey: string;
|
|
1244
|
+
toolCallId: string;
|
|
1245
|
+
toolOutputId: string;
|
|
1246
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
1247
|
+
sizeBytes: number;
|
|
1248
|
+
sha256: string;
|
|
1249
|
+
width: number;
|
|
1250
|
+
height: number;
|
|
1251
|
+
retentionExpiresAt: Date;
|
|
1252
|
+
bucket: string;
|
|
1253
|
+
objectKey: string;
|
|
1254
|
+
workspaceQuotaBytes: number;
|
|
1255
|
+
};
|
|
1256
|
+
/**
|
|
1257
|
+
* Reserve quota and create one deterministic pending file/artifact pair.
|
|
1258
|
+
* Replays return the original row only when every immutable identity and byte
|
|
1259
|
+
* fact matches; a UUID/settlement collision fails closed.
|
|
1260
|
+
*/
|
|
1261
|
+
export declare function prepareRetainedScreenshotArtifact(db: Database, input: PrepareRetainedScreenshotArtifactInput): Promise<{
|
|
1262
|
+
artifact: RetainedScreenshotArtifact;
|
|
1263
|
+
created: boolean;
|
|
1264
|
+
}>;
|
|
1265
|
+
/** Settle one exact pending/reconciling artifact ready and move its quota once. */
|
|
1266
|
+
export declare function settleRetainedScreenshotArtifactReady(db: Database, input: {
|
|
1267
|
+
accountId: string;
|
|
1268
|
+
workspaceId: string;
|
|
1269
|
+
artifactId: string;
|
|
1270
|
+
settlementKey: string;
|
|
1271
|
+
maintenanceClaimId?: string;
|
|
1272
|
+
}): Promise<RetainedScreenshotArtifact>;
|
|
1273
|
+
/** Record a bounded diagnostic while preserving retryable pending truth. */
|
|
1274
|
+
export declare function recordRetainedScreenshotArtifactError(db: Database, input: {
|
|
1275
|
+
accountId: string;
|
|
1276
|
+
workspaceId: string;
|
|
1277
|
+
artifactId: string;
|
|
1278
|
+
settlementKey: string;
|
|
1279
|
+
error: string;
|
|
1280
|
+
}): Promise<void>;
|
|
1281
|
+
/** Session-qualified lookup: a screenshot from another session is indistinguishable from absent. */
|
|
1282
|
+
export declare function getRetainedScreenshotArtifact(db: Database, workspaceId: string, sessionId: string, artifactId: string): Promise<RetainedScreenshotArtifact | null>;
|
|
1283
|
+
export type RetainedScreenshotMaintenanceClaim = {
|
|
1284
|
+
action: "reconcile" | "delete";
|
|
1285
|
+
claimId: string;
|
|
1286
|
+
artifactId: string;
|
|
1287
|
+
accountId: string;
|
|
1288
|
+
workspaceId: string;
|
|
1289
|
+
sessionId: string | null;
|
|
1290
|
+
objectKey: string;
|
|
1291
|
+
mediaType: string;
|
|
1292
|
+
sizeBytes: number;
|
|
1293
|
+
sha256: string;
|
|
1294
|
+
width: number;
|
|
1295
|
+
height: number;
|
|
1296
|
+
retentionExpiresAt: Date;
|
|
1297
|
+
cleanupReason: string | null;
|
|
1298
|
+
};
|
|
1299
|
+
/** Bounded global claim through the migration's sole FORCE-RLS bypass. */
|
|
1300
|
+
export declare function claimRetainedScreenshotMaintenance(db: Database, input: {
|
|
1301
|
+
pendingGraceMs: number;
|
|
1302
|
+
claimTimeoutMs: number;
|
|
1303
|
+
limit: number;
|
|
1304
|
+
}): Promise<RetainedScreenshotMaintenanceClaim[]>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Atomically transfer one exact reconcile claim into cleanup ownership before
|
|
1307
|
+
* any provider delete. A concurrent ready settlement clears/replaces the claim
|
|
1308
|
+
* and makes this a stale no-op.
|
|
1309
|
+
*/
|
|
1310
|
+
export declare function promoteRetainedScreenshotMaintenanceCleanup(db: Database, input: {
|
|
1311
|
+
accountId: string;
|
|
1312
|
+
workspaceId: string;
|
|
1313
|
+
artifactId: string;
|
|
1314
|
+
claimId: string;
|
|
1315
|
+
cleanupReason: string;
|
|
1316
|
+
}): Promise<boolean>;
|
|
1317
|
+
/**
|
|
1318
|
+
* Complete a claimed reconcile/delete operation and release exactly one quota
|
|
1319
|
+
* bucket. A lost response is idempotent on the requested terminal state.
|
|
1320
|
+
*/
|
|
1321
|
+
export declare function completeRetainedScreenshotMaintenance(db: Database, input: {
|
|
1322
|
+
accountId: string;
|
|
1323
|
+
workspaceId: string;
|
|
1324
|
+
artifactId: string;
|
|
1325
|
+
claimId: string;
|
|
1326
|
+
outcome: "ready" | "failed" | "expired" | "deleted";
|
|
1327
|
+
}): Promise<boolean>;
|
|
1328
|
+
export declare function getWorkspaceScreenshotQuota(db: Database, workspaceId: string): Promise<{
|
|
1329
|
+
reservedBytes: number;
|
|
1330
|
+
readyBytes: number;
|
|
1331
|
+
} | null>;
|
|
1009
1332
|
export declare function getFileUpload(db: Database, workspaceId: string, uploadId: string): Promise<{
|
|
1010
1333
|
id: string;
|
|
1011
1334
|
status: FileUploadStatus;
|
|
@@ -1094,6 +1417,22 @@ export declare function markStaleRegistryCatalogItems(db: Database, activeKeys:
|
|
|
1094
1417
|
export declare function upsertCapabilityCatalogItem(db: Database, input: CreateCapabilityCatalogItemInput): Promise<CapabilityCatalogItem>;
|
|
1095
1418
|
export declare function listCapabilityCatalogItems(db: Database, workspaceId: string): Promise<CapabilityCatalogItem[]>;
|
|
1096
1419
|
export declare function getCapabilityCatalogItem(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityCatalogItem | null>;
|
|
1420
|
+
/**
|
|
1421
|
+
* Install one immutable, already-validated portable Skill through the v2
|
|
1422
|
+
* Plugin/facet ownership model and dual-write the v1 compatibility projection.
|
|
1423
|
+
* Repeating the same exact source is idempotent; changing a commit's content
|
|
1424
|
+
* fails instead of silently rewriting immutable history.
|
|
1425
|
+
*/
|
|
1426
|
+
export declare function installPortableSkill(db: Database, input: InstallPortableSkillInput): Promise<InstalledPortableSkill>;
|
|
1427
|
+
/** Return exact text artifacts for active v2 Skill installations. */
|
|
1428
|
+
export declare function listInstalledPortableSkills(db: Database, workspaceId: string): Promise<PortableSkillRuntime[]>;
|
|
1429
|
+
export declare function getPortableSkillUninstallPreview(db: Database, workspaceId: string, capabilityId: string): Promise<PortableSkillUninstallPreview>;
|
|
1430
|
+
export declare function uninstallPortableSkill(db: Database, input: {
|
|
1431
|
+
accountId: string;
|
|
1432
|
+
workspaceId: string;
|
|
1433
|
+
capabilityId: string;
|
|
1434
|
+
expectedInstallationVersion: number;
|
|
1435
|
+
}): Promise<UninstallPortableSkillResult>;
|
|
1097
1436
|
export declare function enableCapabilityInstallation(db: Database, input: EnableCapabilityInstallationInput): Promise<CapabilityInstallation>;
|
|
1098
1437
|
export declare function disableCapabilityInstallation(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityInstallation>;
|
|
1099
1438
|
export declare function listCapabilityInstallations(db: Database, workspaceId: string): Promise<CapabilityInstallation[]>;
|
|
@@ -1110,14 +1449,26 @@ export declare function decryptedCapabilityHeaders(server: EnabledMcpCapabilityS
|
|
|
1110
1449
|
* Returns the encrypted credential-header map stored on a capability
|
|
1111
1450
|
* installation, or null when none is stored. This is the only read path for
|
|
1112
1451
|
* the ciphertext besides listEnabledMcpCapabilityServers; the generic
|
|
1113
|
-
* installation mapping
|
|
1452
|
+
* installation mapping projects it to header names.
|
|
1114
1453
|
*/
|
|
1115
1454
|
export declare function getStoredCapabilityHeaderCiphertext(db: Database, workspaceId: string, capabilityId: string): Promise<Record<string, string> | null>;
|
|
1116
1455
|
export declare function mcpServerIdForCapability(capabilityId: string, metadata?: Record<string, unknown>): string;
|
|
1117
1456
|
export declare function createConnection(db: Database, input: CreateConnectionInput): Promise<ConnectionMetadataWithVerification>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Serialize one provider-principal/owner connection generation. Distinct OAuth
|
|
1459
|
+
* starts for the same principal converge on one row, while an explicit
|
|
1460
|
+
* reconnect remains fenced to the exact Connection version captured in state.
|
|
1461
|
+
*/
|
|
1462
|
+
export declare function persistProviderOAuthConnection(db: Database, input: PersistProviderOAuthConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1118
1463
|
export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
|
|
1119
1464
|
export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1120
1465
|
export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Updates only pre-validated workspace Slack-bot destination metadata while
|
|
1468
|
+
* atomically advancing its install proof to the new connection generation.
|
|
1469
|
+
* A stale version or already-invalid proof returns null without writing.
|
|
1470
|
+
*/
|
|
1471
|
+
export declare function updateSlackBotDocumentDestination(db: Database, input: UpdateSlackBotDocumentDestinationInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1121
1472
|
/**
|
|
1122
1473
|
* Applies a metadata/status lifecycle transition behind the connection's
|
|
1123
1474
|
* existing `(id, version)` fence. Unlike ordinary metadata edits, every
|
|
@@ -1141,6 +1492,14 @@ export type SlackInstallationRoute = {
|
|
|
1141
1492
|
botId: string;
|
|
1142
1493
|
botUserId: string;
|
|
1143
1494
|
};
|
|
1495
|
+
export declare class SlackInstallationBindingConflictError extends Error {
|
|
1496
|
+
readonly reason: "conflicting_workspace" | "conflicting_principal" | "legacy_quarantine" | "stale_reinstall";
|
|
1497
|
+
constructor(reason: "conflicting_workspace" | "conflicting_principal" | "legacy_quarantine" | "stale_reinstall");
|
|
1498
|
+
}
|
|
1499
|
+
export declare function listSlackInstallationBindings(db: Database, input: {
|
|
1500
|
+
accountId: string;
|
|
1501
|
+
workspaceId: string;
|
|
1502
|
+
}): Promise<SlackInstallationBinding[]>;
|
|
1144
1503
|
export type SlackBotUserLink = {
|
|
1145
1504
|
id: string;
|
|
1146
1505
|
accountId: string;
|
|
@@ -1282,6 +1641,24 @@ export type SlackInteractionProgressClaim = {
|
|
|
1282
1641
|
} | {
|
|
1283
1642
|
kind: "not_owned";
|
|
1284
1643
|
};
|
|
1644
|
+
export type SlackInteractionProgressDeliveryEvidence = {
|
|
1645
|
+
sessionEventSequence: number;
|
|
1646
|
+
operationId: string;
|
|
1647
|
+
text: string;
|
|
1648
|
+
turnId: string | null;
|
|
1649
|
+
};
|
|
1650
|
+
/**
|
|
1651
|
+
* Read the at-most-three durable progress identities for terminal-delivery
|
|
1652
|
+
* reconciliation. A reserved operation may still be provider-started after a
|
|
1653
|
+
* response loss, so callers must retry the same operation id rather than
|
|
1654
|
+
* inventing a second final post.
|
|
1655
|
+
*/
|
|
1656
|
+
export declare function listSlackInteractionProgressDeliveryEvidence(db: Database, input: {
|
|
1657
|
+
accountId: string;
|
|
1658
|
+
workspaceId: string;
|
|
1659
|
+
interactionId: string;
|
|
1660
|
+
sessionId: string;
|
|
1661
|
+
}): Promise<SlackInteractionProgressDeliveryEvidence[]>;
|
|
1285
1662
|
/**
|
|
1286
1663
|
* Reserve one globally bounded progress slot before any Slack provider call.
|
|
1287
1664
|
* The interaction row lock serializes replicas and expired delivery claim
|
|
@@ -1297,8 +1674,10 @@ export declare function claimSlackInteractionProgressDelivery(db: Database, inpu
|
|
|
1297
1674
|
}): Promise<SlackInteractionProgressClaim>;
|
|
1298
1675
|
export declare function rekeySlackInteractionRoute(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
|
|
1299
1676
|
routeKey: string;
|
|
1677
|
+
slackChannelId?: string;
|
|
1300
1678
|
slackThreadTs: string;
|
|
1301
1679
|
ackSlackMessageTs: string;
|
|
1680
|
+
repairUnacknowledgedPrivateShortcutDelivery?: boolean;
|
|
1302
1681
|
}): Promise<SlackInteraction | null>;
|
|
1303
1682
|
export declare function claimSlackInteractionDelivery(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackInteraction | null>;
|
|
1304
1683
|
export declare function reopenSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId">): Promise<boolean>;
|
|
@@ -1332,6 +1711,20 @@ type SlackBotLifecycleSuccessAuditInput = {
|
|
|
1332
1711
|
credentialLabel: string;
|
|
1333
1712
|
slackTeamId: string;
|
|
1334
1713
|
};
|
|
1714
|
+
export type PersistSlackBotInstallationInput = SlackBotLifecycleSuccessAuditInput & {
|
|
1715
|
+
requestedConnectionId?: string;
|
|
1716
|
+
requestedConnectionVersion?: number;
|
|
1717
|
+
credentialEncrypted: string;
|
|
1718
|
+
grantedScopes: string[];
|
|
1719
|
+
verifiedInstallAt: Date;
|
|
1720
|
+
metadata: Record<string, unknown> & {
|
|
1721
|
+
slackTeamId: string;
|
|
1722
|
+
slackTeamName: string;
|
|
1723
|
+
botId: string;
|
|
1724
|
+
botUserId: string;
|
|
1725
|
+
};
|
|
1726
|
+
};
|
|
1727
|
+
export declare function persistSlackBotInstallationWithSuccessAudit(db: Database, input: PersistSlackBotInstallationInput): Promise<ConnectionMetadataWithVerification>;
|
|
1335
1728
|
export declare function createConnectionWithSlackBotSuccessAudit(db: Database, input: SlackBotLifecycleSuccessAuditInput & {
|
|
1336
1729
|
connection: CreateConnectionInput;
|
|
1337
1730
|
}): Promise<ConnectionMetadataWithVerification>;
|
|
@@ -1468,8 +1861,25 @@ export declare function loadConnectionCredentialForBroker(db: Database, settings
|
|
|
1468
1861
|
allowSubjectOwned?: boolean;
|
|
1469
1862
|
}): Promise<ConnectionCredentialForBroker | null>;
|
|
1470
1863
|
export declare function workspaceVercelAiGatewayConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
|
|
1864
|
+
/** Metadata-only capability revision input; never selects/decrypts the API key. */
|
|
1865
|
+
export declare function getWorkspaceVercelAiGatewayConnectionMetadata(db: Database, workspaceId: string): Promise<{
|
|
1866
|
+
connectionId: string;
|
|
1867
|
+
version: number;
|
|
1868
|
+
} | null>;
|
|
1471
1869
|
/** Resolve only the reviewed workspace-shared AI Gateway credential shape. */
|
|
1472
1870
|
export declare function loadWorkspaceVercelAiGatewayApiKey(db: Database, settings: Settings, workspaceId: string): Promise<string | null>;
|
|
1871
|
+
/**
|
|
1872
|
+
* Worker-only immutable credential lease for an asynchronous video operation.
|
|
1873
|
+
* The operation copies the already-encrypted credential envelope before its
|
|
1874
|
+
* accepted receipt commits, so a later workspace disconnect cannot strand a
|
|
1875
|
+
* paid provider job. Never expose this return value from an API route.
|
|
1876
|
+
*/
|
|
1877
|
+
export declare function loadWorkspaceVercelAiGatewayCredentialLease(db: Database, settings: Settings, workspaceId: string): Promise<{
|
|
1878
|
+
connectionId: string;
|
|
1879
|
+
version: number;
|
|
1880
|
+
credentialEncrypted: string;
|
|
1881
|
+
apiKey: string;
|
|
1882
|
+
} | null>;
|
|
1473
1883
|
export declare function recordConnectionTokenRefresh(db: Database, input: {
|
|
1474
1884
|
id: string;
|
|
1475
1885
|
version: number;
|
|
@@ -1525,7 +1935,6 @@ export type SaveWorkspaceMemoryResult = {
|
|
|
1525
1935
|
superseded: KnowledgeMemory | null;
|
|
1526
1936
|
supersededId: string | null;
|
|
1527
1937
|
updated: boolean;
|
|
1528
|
-
redactionCount: number;
|
|
1529
1938
|
embedded: boolean;
|
|
1530
1939
|
};
|
|
1531
1940
|
export type CorrectWorkspaceMemoryInput = {
|
|
@@ -1615,7 +2024,29 @@ export declare function updateScheduledTask(db: Database, workspaceId: string, t
|
|
|
1615
2024
|
export declare function getScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask | null>;
|
|
1616
2025
|
export declare function getScheduledTaskPersonalConnectionDelegations(db: Database, workspaceId: string, taskId: string): Promise<McpPersonalConnectionDelegation[]>;
|
|
1617
2026
|
export declare function requireScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
|
|
1618
|
-
export declare
|
|
2027
|
+
export declare class ScheduledTaskTargetConflictError extends Error {
|
|
2028
|
+
constructor();
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* DB-only delivery fence used inside the system-update source transaction.
|
|
2032
|
+
* The task row is locked after the target session row, so a concurrent retarget
|
|
2033
|
+
* linearizes before or after the complete scheduled occurrence instead of
|
|
2034
|
+
* delivering one fire to a stale session snapshot.
|
|
2035
|
+
*/
|
|
2036
|
+
export declare function requireScheduledTaskTargetInTransaction(tx: Database, input: {
|
|
2037
|
+
workspaceId: string;
|
|
2038
|
+
taskId: string;
|
|
2039
|
+
targetSessionId: string;
|
|
2040
|
+
}): Promise<void>;
|
|
2041
|
+
export declare function listScheduledTasks(db: Database, workspaceId: string, limit?: number, offset?: number): Promise<ScheduledTask[]>;
|
|
2042
|
+
/**
|
|
2043
|
+
* Internal connector-control traversal. Keep the whole keyset walk on one
|
|
2044
|
+
* repeatable-read snapshot so task creation/update performed after discovery
|
|
2045
|
+
* cannot make an older row move between offset pages or hide a matching task.
|
|
2046
|
+
*/
|
|
2047
|
+
export declare function listKnowledgeSourceSyncTasksForConnection(db: Database, workspaceId: string, connectionId: string, pageSize?: number): Promise<Array<ScheduledTask & {
|
|
2048
|
+
action: KnowledgeSourceSyncAction;
|
|
2049
|
+
}>>;
|
|
1619
2050
|
export declare function deleteScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<void>;
|
|
1620
2051
|
export declare function createScheduledTaskRun(db: Database, input: {
|
|
1621
2052
|
workspaceId: string;
|
|
@@ -1632,6 +2063,10 @@ export declare function updateScheduledTaskRun(db: Database, workspaceId: string
|
|
|
1632
2063
|
status: ScheduledTaskRunStatus;
|
|
1633
2064
|
sessionId: string | null;
|
|
1634
2065
|
triggerEventId: string | null;
|
|
2066
|
+
actionKind: ScheduledTaskActionKind;
|
|
2067
|
+
knowledgeSyncRunId: string | null;
|
|
2068
|
+
knowledgeSummary: Record<string, unknown> | null;
|
|
2069
|
+
completedAt: Date | null;
|
|
1635
2070
|
error: string | null;
|
|
1636
2071
|
}>): Promise<ScheduledTaskRun>;
|
|
1637
2072
|
/** DB-only source mutation callback for durable scheduled delivery. */
|
|
@@ -1656,6 +2091,37 @@ export declare function createVariableSet(db: Database, input: {
|
|
|
1656
2091
|
export declare function listVariableSets(db: Database, workspaceId: string): Promise<VariableSet[]>;
|
|
1657
2092
|
export declare function getVariableSet(db: Database, workspaceId: string, variableSetId: string): Promise<VariableSet | null>;
|
|
1658
2093
|
export declare function getVariableSetByName(db: Database, workspaceId: string, name: string): Promise<VariableSet | null>;
|
|
2094
|
+
export type VariableSetSecretAuditActor = {
|
|
2095
|
+
kind: "subject";
|
|
2096
|
+
} | {
|
|
2097
|
+
kind: "agent_attempt";
|
|
2098
|
+
sessionId: string;
|
|
2099
|
+
turnId: string;
|
|
2100
|
+
attemptId: string;
|
|
2101
|
+
executionGeneration: number;
|
|
2102
|
+
};
|
|
2103
|
+
export declare class VariableSetSecretReadAuthorityError extends Error {
|
|
2104
|
+
readonly code = "VARIABLE_SET_SECRET_READ_AUTHORITY_STALE";
|
|
2105
|
+
constructor();
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Read one encrypted value, decrypt it, and commit its metadata-only audit in
|
|
2109
|
+
* one RLS transaction. Agent reads lock and recheck the canonical attempt/control
|
|
2110
|
+
* fence in that same transaction, so cancellation or replacement linearizes
|
|
2111
|
+
* either before the read (denied) or after its committed audit. The plaintext is
|
|
2112
|
+
* returned only after the audit insert commits; an audit failure rolls back and
|
|
2113
|
+
* rejects the whole operation.
|
|
2114
|
+
*/
|
|
2115
|
+
export declare function readVariableSetSecretAtomically(db: Database, input: {
|
|
2116
|
+
accountId: string;
|
|
2117
|
+
workspaceId: string;
|
|
2118
|
+
subjectId: string;
|
|
2119
|
+
variableSetId?: string;
|
|
2120
|
+
variableSetName?: string;
|
|
2121
|
+
name: string;
|
|
2122
|
+
actor: VariableSetSecretAuditActor;
|
|
2123
|
+
decrypt: (valueEncrypted: string) => string;
|
|
2124
|
+
}): Promise<VariableSetSecret | null>;
|
|
1659
2125
|
export declare function updateVariableSet(db: Database, workspaceId: string, variableSetId: string, input: {
|
|
1660
2126
|
name?: string;
|
|
1661
2127
|
description?: string | null;
|
|
@@ -1724,6 +2190,7 @@ export declare function createRigVersion(db: Database, workspaceId: string, rigI
|
|
|
1724
2190
|
}): Promise<RigVersion>;
|
|
1725
2191
|
export declare function createRigVersionForChangePromotion(db: Database, workspaceId: string, rigId: string, changeId: string, input: RigVersionContentInput & {
|
|
1726
2192
|
expectedActiveVersionId: string;
|
|
2193
|
+
providerImages?: RigProviderImages;
|
|
1727
2194
|
}): Promise<{
|
|
1728
2195
|
version: RigVersion;
|
|
1729
2196
|
change: RigChange;
|
|
@@ -1753,6 +2220,33 @@ export declare function listRigVersionMonitoringSummaries(db: Database, workspac
|
|
|
1753
2220
|
}>;
|
|
1754
2221
|
export declare function getRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion | null>;
|
|
1755
2222
|
export declare function getRigVersionById(db: Database, workspaceId: string, versionId: string): Promise<RigVersion | null>;
|
|
2223
|
+
export type RigProviderImageBuildClaim = {
|
|
2224
|
+
status: "claimed";
|
|
2225
|
+
image: RigProviderImage;
|
|
2226
|
+
} | {
|
|
2227
|
+
status: "ready" | "in_progress" | "unsupported" | "conflict";
|
|
2228
|
+
image: RigProviderImage;
|
|
2229
|
+
};
|
|
2230
|
+
/**
|
|
2231
|
+
* Claim the one provider-image build slot for an existing immutable rig
|
|
2232
|
+
* version. A finalized ready image is never overwritten in place: if the
|
|
2233
|
+
* effective base/content identity changed, callers must mint/verify a new rig
|
|
2234
|
+
* version and runtime setup remains the truthful fallback for this one.
|
|
2235
|
+
*/
|
|
2236
|
+
export declare function claimRigVersionProviderImageBuild(db: Database, input: {
|
|
2237
|
+
workspaceId: string;
|
|
2238
|
+
versionId: string;
|
|
2239
|
+
image: RigProviderImage;
|
|
2240
|
+
staleAfterMs: number;
|
|
2241
|
+
/** Retry a same-content unsupported record only after runtime support exists. */
|
|
2242
|
+
retryUnsupported?: boolean;
|
|
2243
|
+
}): Promise<RigProviderImageBuildClaim>;
|
|
2244
|
+
/** Finalize only the exact claimed build request; late callbacks are fenced. */
|
|
2245
|
+
export declare function finalizeRigVersionProviderImageBuild(db: Database, input: {
|
|
2246
|
+
workspaceId: string;
|
|
2247
|
+
versionId: string;
|
|
2248
|
+
image: RigProviderImage;
|
|
2249
|
+
}): Promise<boolean>;
|
|
1756
2250
|
export declare function getRigName(db: Database, workspaceId: string, rigId: string): Promise<string | null>;
|
|
1757
2251
|
export declare function activateRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion>;
|
|
1758
2252
|
export declare function createRigChange(db: Database, input: {
|
|
@@ -2119,7 +2613,7 @@ export type CodexCredentialLeasePolicyScopeResolver<TPolicyScope> = (turnMetadat
|
|
|
2119
2613
|
export type CodexCredentialLeaseCandidateFilterResult<TUnavailableDiagnostic = never> = {
|
|
2120
2614
|
/** Candidates from exactly one selected policy scope; never a union-ranked pool list. */
|
|
2121
2615
|
accounts: readonly CodexLeaseAccountStatus[];
|
|
2122
|
-
/** Downstream-owned,
|
|
2616
|
+
/** Downstream-owned, value-free metadata diagnostics for rejected primary/fallback scopes. */
|
|
2123
2617
|
unavailableDiagnostics?: readonly TUnavailableDiagnostic[];
|
|
2124
2618
|
};
|
|
2125
2619
|
export type CodexCredentialLeaseCandidateFilter<TPolicyScope, TUnavailableDiagnostic = never> = (input: {
|
|
@@ -2331,17 +2825,23 @@ export declare function armCodexCapacityWait(db: Database, input: {
|
|
|
2331
2825
|
now?: Date;
|
|
2332
2826
|
}): Promise<ArmCodexCapacityWaitResult>;
|
|
2333
2827
|
export declare function getCodexCapacityWaitForSession(db: Database, workspaceId: string, sessionId: string): Promise<CodexCapacityWait | null>;
|
|
2828
|
+
type CodexCapacityMutationInput = {
|
|
2829
|
+
workspaceId: string;
|
|
2830
|
+
reason: string;
|
|
2831
|
+
policyHash?: string | null;
|
|
2832
|
+
};
|
|
2334
2833
|
/**
|
|
2335
2834
|
* Same-transaction capacity-mutation/outbox seam for eligibility and
|
|
2336
2835
|
* membership/default changes. The allocator rotation row is always the
|
|
2337
2836
|
* first lock. Mutations report whether capacity truth changed; only then are
|
|
2338
2837
|
* matching waiter wake revisions advanced and returned for best-effort signal.
|
|
2339
2838
|
*/
|
|
2340
|
-
export declare function withCodexCapacityMutation<T>(db: Database, input: {
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2839
|
+
export declare function withCodexCapacityMutation<T>(db: Database, input: CodexCapacityMutationInput, mutate: (tx: Database) => Promise<{
|
|
2840
|
+
result: T;
|
|
2841
|
+
changed: boolean;
|
|
2842
|
+
}>): Promise<CodexCapacityMutationResult<T>>;
|
|
2843
|
+
/** Capacity mutation whose atomic callback also changes session activity. */
|
|
2844
|
+
export declare function withSessionCodexCapacityMutation<T>(db: Database, input: CodexCapacityMutationInput, mutate: (tx: SessionActivityDatabase) => Promise<{
|
|
2345
2845
|
result: T;
|
|
2346
2846
|
changed: boolean;
|
|
2347
2847
|
}>): Promise<CodexCapacityMutationResult<T>>;
|
|
@@ -2706,6 +3206,7 @@ export declare function getSessionCodexState(db: Database, workspaceId: string,
|
|
|
2706
3206
|
* Validates the id belongs to the workspace when non-null. Returns false if the
|
|
2707
3207
|
* session is unknown or the id is invalid.
|
|
2708
3208
|
*/
|
|
3209
|
+
export declare function setSessionCodexPinInTransaction(db: SessionActivityDatabase, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2709
3210
|
export declare function setSessionCodexPin(db: Database, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2710
3211
|
/** Written by the worker at the turn boundary; drives the in-session indicator. */
|
|
2711
3212
|
export declare function recordSessionActiveCodexCredential(db: Database, workspaceId: string, sessionId: string, credentialId: string): Promise<void>;
|
|
@@ -2781,6 +3282,8 @@ export type ConnectorActionInvocation = {
|
|
|
2781
3282
|
serverId: string;
|
|
2782
3283
|
toolName: string;
|
|
2783
3284
|
arguments: unknown;
|
|
3285
|
+
/** Explicit per-session MCP approval, rather than a connector-policy decision. */
|
|
3286
|
+
approvalMode?: "session_mcp";
|
|
2784
3287
|
};
|
|
2785
3288
|
export type PrepareConnectorActionApprovalResult = {
|
|
2786
3289
|
managed: false;
|
|
@@ -2812,6 +3315,12 @@ type ResolvedConnectorActionPolicy = {
|
|
|
2812
3315
|
managed: true;
|
|
2813
3316
|
source: "explicit";
|
|
2814
3317
|
entry: ConnectorActionPolicySnapshotEntry;
|
|
3318
|
+
} | {
|
|
3319
|
+
managed: true;
|
|
3320
|
+
source: "explicit";
|
|
3321
|
+
entry: null;
|
|
3322
|
+
decision: "ask";
|
|
3323
|
+
actionName: string;
|
|
2815
3324
|
} | {
|
|
2816
3325
|
managed: true;
|
|
2817
3326
|
source: "ambiguous";
|
|
@@ -3075,6 +3584,8 @@ export type SessionDiscoverySummary = {
|
|
|
3075
3584
|
title: string | null;
|
|
3076
3585
|
titleOriginalChars: number | null;
|
|
3077
3586
|
parentSessionId: string | null;
|
|
3587
|
+
rootSessionId: string;
|
|
3588
|
+
nestedAgentDepth: number;
|
|
3078
3589
|
status: SessionStatus;
|
|
3079
3590
|
effectiveControl: SessionDiscoveryControl;
|
|
3080
3591
|
goal: {
|
|
@@ -3107,6 +3618,9 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3107
3618
|
includeLastMessage?: boolean;
|
|
3108
3619
|
orderBy?: SessionDiscoveryOrderBy;
|
|
3109
3620
|
updatedAfter?: string;
|
|
3621
|
+
parentSessionId?: string | null;
|
|
3622
|
+
search?: string;
|
|
3623
|
+
subjectId?: string;
|
|
3110
3624
|
authorizationScope?: SessionAuthorizationListScope;
|
|
3111
3625
|
}): Promise<{
|
|
3112
3626
|
sessions: SessionDiscoverySummary[];
|
|
@@ -3119,6 +3633,17 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3119
3633
|
updatedThrough: string | null;
|
|
3120
3634
|
updatedAfter: string | null;
|
|
3121
3635
|
}>;
|
|
3636
|
+
export type SessionDiscoveryAncestor = {
|
|
3637
|
+
id: string;
|
|
3638
|
+
title: string | null;
|
|
3639
|
+
titleOriginalChars: number | null;
|
|
3640
|
+
};
|
|
3641
|
+
/**
|
|
3642
|
+
* Return bounded root-to-parent paths for a bounded discovery result page.
|
|
3643
|
+
* Authorization is re-applied to every ancestor so exact-session grants never
|
|
3644
|
+
* acquire parent metadata merely by searching for their target.
|
|
3645
|
+
*/
|
|
3646
|
+
export declare function listSessionDiscoveryAncestorPaths(db: Database, workspaceId: string, sessionIds: string[], authorizationScope?: SessionAuthorizationListScope): Promise<Map<string, SessionDiscoveryAncestor[]>>;
|
|
3122
3647
|
export type SessionLineage = {
|
|
3123
3648
|
ancestors: Session[];
|
|
3124
3649
|
children: LineageNode[];
|
|
@@ -3189,64 +3714,16 @@ export type SessionEventPage = {
|
|
|
3189
3714
|
};
|
|
3190
3715
|
export declare const SESSION_EVENT_DB_PAGE_MAX_BYTES: number;
|
|
3191
3716
|
/**
|
|
3192
|
-
* Read one direction-aware session-event page
|
|
3193
|
-
*
|
|
3194
|
-
*
|
|
3195
|
-
*
|
|
3196
|
-
*
|
|
3197
|
-
* envelope guard in SQL, then accumulates small batches under one RLS
|
|
3198
|
-
* transaction. `bytes` is the exact UTF-8 size of `JSON.stringify(events)`;
|
|
3199
|
-
* `hasMore` is true whenever count or byte selection stopped before the durable
|
|
3200
|
-
* range ended. A nonempty durable range can therefore never become an empty,
|
|
3201
|
-
* non-advancing HTTP page.
|
|
3717
|
+
* Read one direction-aware session-event page. Full mode selects the canonical
|
|
3718
|
+
* row exactly; summary/none modes derive bounded monitoring projections in SQL
|
|
3719
|
+
* without rewriting the retained source. `bytes` is the exact UTF-8 size of
|
|
3720
|
+
* `JSON.stringify(events)`; `hasMore` is true whenever count or byte selection
|
|
3721
|
+
* stopped before the durable range ended.
|
|
3202
3722
|
*/
|
|
3203
3723
|
export declare function listSessionEventPage(db: Database, workspaceId: string, sessionId: string, options?: ListSessionEventPageOptions): Promise<SessionEventPage>;
|
|
3204
3724
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string): Promise<SessionEvent[]>;
|
|
3205
3725
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, after: number, limit?: number): Promise<SessionEvent[]>;
|
|
3206
3726
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, options: ListSessionEventsOptions): Promise<SessionEvent[]>;
|
|
3207
|
-
export type ToolspaceCallReservation = {
|
|
3208
|
-
reserved: true;
|
|
3209
|
-
count: number;
|
|
3210
|
-
turn: SessionTurnForExecution;
|
|
3211
|
-
} | {
|
|
3212
|
-
reserved: false;
|
|
3213
|
-
reason: TurnAttemptFenceRejectReason | "budget_exhausted";
|
|
3214
|
-
};
|
|
3215
|
-
export type ToolspaceTurnAttemptClaims = {
|
|
3216
|
-
sessionId: string;
|
|
3217
|
-
turnId: string;
|
|
3218
|
-
attemptId: string;
|
|
3219
|
-
executionGeneration: number;
|
|
3220
|
-
};
|
|
3221
|
-
/**
|
|
3222
|
-
* Admit one exact Toolspace bearer before any session credential is decrypted or
|
|
3223
|
-
* any upstream schema is enumerated. This intentionally reuses the canonical
|
|
3224
|
-
* activity write fence so Pause/Steer, attempt replacement, generation changes,
|
|
3225
|
-
* and terminal settlement revoke a copied token at the same linearization point
|
|
3226
|
-
* as other attempt-owned writes.
|
|
3227
|
-
*/
|
|
3228
|
-
export declare function admitToolspaceTurnAttempt(db: Database, workspaceId: string, claims: ToolspaceTurnAttemptClaims): Promise<boolean>;
|
|
3229
|
-
/**
|
|
3230
|
-
* Atomically reserve one toolspace call against a turn's per-turn budget.
|
|
3231
|
-
*
|
|
3232
|
-
* A single conditional UPDATE increments `toolspace_call_count` only while it is
|
|
3233
|
-
* below `limit` and returns the post-increment value. Concurrent reservations
|
|
3234
|
-
* for the same turn serialize on the row lock, so exactly `limit` of N
|
|
3235
|
-
* simultaneous callers observe `reserved: true` — closing the read-then-append
|
|
3236
|
-
* TOCTOU the event-count approach had. The returned attempt id is captured by
|
|
3237
|
-
* that same UPDATE, so callers cannot accidentally execute under a successor
|
|
3238
|
-
* attempt. `reserved: false` means the turn is not executable, at/over budget,
|
|
3239
|
-
* or no longer exists.
|
|
3240
|
-
*/
|
|
3241
|
-
export declare function reserveToolspaceCallForAttempt(db: Database, input: {
|
|
3242
|
-
accountId: string;
|
|
3243
|
-
workspaceId: string;
|
|
3244
|
-
sessionId: string;
|
|
3245
|
-
turnId: string;
|
|
3246
|
-
executionGeneration: number;
|
|
3247
|
-
attemptId: string;
|
|
3248
|
-
limit: number;
|
|
3249
|
-
}): Promise<ToolspaceCallReservation>;
|
|
3250
3727
|
export declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
|
|
3251
3728
|
export declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
|
|
3252
3729
|
export declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
|
|
@@ -3256,7 +3733,31 @@ export declare function getWorkspaceControlEvent(db: Database, workspaceId: stri
|
|
|
3256
3733
|
* a session, while the workspace predicate remains the tenancy boundary.
|
|
3257
3734
|
*/
|
|
3258
3735
|
export declare function getSessionEventByClientEventId(db: Database, workspaceId: string, sessionId: string, clientEventId: string): Promise<SessionEvent | null>;
|
|
3259
|
-
export declare
|
|
3736
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_BYTES: number;
|
|
3737
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_NODES = 65536;
|
|
3738
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_PROPERTIES = 32768;
|
|
3739
|
+
export declare const APPROVAL_PENDING_MAX_JSON_BYTES: number;
|
|
3740
|
+
export declare const APPROVAL_PENDING_MAX_ITEMS = 256;
|
|
3741
|
+
export type ApprovalRunStateMaterializationLimits = {
|
|
3742
|
+
maximumJsonBytes: number;
|
|
3743
|
+
maximumJsonNodes: number;
|
|
3744
|
+
maximumJsonProperties: number;
|
|
3745
|
+
maximumPendingApprovalBytes: number;
|
|
3746
|
+
maximumPendingApprovalItems: number;
|
|
3747
|
+
};
|
|
3748
|
+
export type ApprovalRunStateLimitKind = "json_bytes" | "json_nodes" | "json_properties" | "invalid_json" | "pending_approval_bytes" | "pending_approval_items";
|
|
3749
|
+
export declare class ApprovalRunStateLimitExceededError extends Error {
|
|
3750
|
+
readonly limitKind: ApprovalRunStateLimitKind;
|
|
3751
|
+
readonly actual: number;
|
|
3752
|
+
readonly maximum: number;
|
|
3753
|
+
readonly code = "approval_run_state_too_large";
|
|
3754
|
+
constructor(limitKind: ApprovalRunStateLimitKind, actual: number, maximum: number);
|
|
3755
|
+
}
|
|
3756
|
+
/**
|
|
3757
|
+
* Read the one approval/human-input RunState through a server-measured envelope.
|
|
3758
|
+
* Ordinary turns never call this path; they use canonical history items only.
|
|
3759
|
+
*/
|
|
3760
|
+
export declare function getLatestRunState(db: Database, workspaceId: string, sessionId: string, limitOverrides?: Partial<ApprovalRunStateMaterializationLimits>): Promise<{
|
|
3260
3761
|
id: string;
|
|
3261
3762
|
turnId: string | null;
|
|
3262
3763
|
serializedRunState: string;
|
|
@@ -3372,8 +3873,8 @@ export type PendingSessionToolCallInput = {
|
|
|
3372
3873
|
};
|
|
3373
3874
|
/**
|
|
3374
3875
|
* Durably capture the raw SDK call item at the exact attempt boundary. This is
|
|
3375
|
-
* model-facing truth, deliberately separate from the
|
|
3376
|
-
*
|
|
3876
|
+
* model-facing truth, deliberately separate from the session-event timeline.
|
|
3877
|
+
* The receipt belongs to the logical turn so an approval resume can
|
|
3377
3878
|
* settle it from a newer attempt. Duplicate SDK delivery converges on the
|
|
3378
3879
|
* unique (turn, call) identity.
|
|
3379
3880
|
*/
|
|
@@ -3381,19 +3882,14 @@ export declare function registerPendingSessionToolCall(db: Database, input: Pend
|
|
|
3381
3882
|
accepted: boolean;
|
|
3382
3883
|
registered: boolean;
|
|
3383
3884
|
}>;
|
|
3384
|
-
/**
|
|
3385
|
-
* Clear one completed Toolspace receipt after its attempt-fenced output event is
|
|
3386
|
-
* durable. If control already replaced the attempt, its settlement transaction
|
|
3387
|
-
* owns the receipt and will retain an explicit outcome-unknown or the durable
|
|
3388
|
-
* output event instead.
|
|
3389
|
-
*/
|
|
3390
|
-
export declare function clearPendingSessionToolspaceCall(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem">): Promise<{
|
|
3391
|
-
accepted: boolean;
|
|
3392
|
-
cleared: boolean;
|
|
3393
|
-
}>;
|
|
3394
3885
|
/** Record the raw SDK result without dropping the call receipt. */
|
|
3395
3886
|
export declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
|
|
3396
3887
|
resultItem: Record<string, unknown>;
|
|
3888
|
+
/** Commit a durable async-video acceptance fence with this exact result. */
|
|
3889
|
+
videoGenerationAcceptance?: {
|
|
3890
|
+
operationId: string;
|
|
3891
|
+
requestDigest: string;
|
|
3892
|
+
};
|
|
3397
3893
|
}): Promise<{
|
|
3398
3894
|
accepted: boolean;
|
|
3399
3895
|
recorded: boolean;
|
|
@@ -3427,6 +3923,40 @@ export declare function getActiveSessionHistoryItems(db: Database, workspaceId:
|
|
|
3427
3923
|
item: Record<string, unknown>;
|
|
3428
3924
|
providerArtifactInvalidatedAt: Date | null;
|
|
3429
3925
|
}>>;
|
|
3926
|
+
/**
|
|
3927
|
+
* Profiled upper envelope for one session's complete active, model-facing
|
|
3928
|
+
* transcript. Bytes alone do not bound the decoded object graph, so rows, JSON
|
|
3929
|
+
* nodes, and object properties are independently limited. Normal token-driven
|
|
3930
|
+
* compaction keeps active history far below these boundaries. The limits are a
|
|
3931
|
+
* final materialization guard: a corrupt/imported/pathological transcript fails
|
|
3932
|
+
* deterministically before a Postgres driver decodes it instead of using the
|
|
3933
|
+
* pod OOM killer as admission.
|
|
3934
|
+
*/
|
|
3935
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_BYTES: number;
|
|
3936
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_ROWS = 4096;
|
|
3937
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_NODES = 65536;
|
|
3938
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_PROPERTIES = 32768;
|
|
3939
|
+
export type ActiveSessionHistoryLimitKind = "json_bytes" | "rows" | "json_nodes" | "json_properties";
|
|
3940
|
+
export declare class ActiveSessionHistoryLimitExceededError extends Error {
|
|
3941
|
+
readonly actualBytes: number;
|
|
3942
|
+
readonly maximumBytes: number;
|
|
3943
|
+
readonly limitKind: ActiveSessionHistoryLimitKind;
|
|
3944
|
+
readonly actual: number;
|
|
3945
|
+
readonly maximum: number;
|
|
3946
|
+
readonly code = "active_history_too_large";
|
|
3947
|
+
constructor(actualBytes: number, maximumBytes: number, limitKind?: ActiveSessionHistoryLimitKind, actual?: number, maximum?: number);
|
|
3948
|
+
}
|
|
3949
|
+
/**
|
|
3950
|
+
* Memory-bounded active-history read for model input and compaction. PostgreSQL
|
|
3951
|
+
* first measures the complete logical window without returning any JSONB item,
|
|
3952
|
+
* then keyset-pages the admitted rows on the same repeatable-read snapshot.
|
|
3953
|
+
*/
|
|
3954
|
+
export declare function getActiveSessionHistoryItemsPaged(db: Database, workspaceId: string, sessionId: string, pageSize?: number, maximumJsonBytes?: number, maximumRows?: number, maximumJsonNodes?: number, maximumJsonProperties?: number): Promise<Array<{
|
|
3955
|
+
id: string;
|
|
3956
|
+
position: number;
|
|
3957
|
+
item: Record<string, unknown>;
|
|
3958
|
+
providerArtifactInvalidatedAt: Date | null;
|
|
3959
|
+
}>>;
|
|
3430
3960
|
/** Bounded finalized voice turns used only to resume a later realtime call. */
|
|
3431
3961
|
export declare function getSessionRealtimeContinuityEntries(db: Database, workspaceId: string, sessionId: string, maximumEntries?: number): Promise<SessionRealtimeContinuityEntry[]>;
|
|
3432
3962
|
/**
|
|
@@ -3789,7 +4319,7 @@ export declare function closePtySession(db: Database, input: {
|
|
|
3789
4319
|
/** List a session's OPEN PTYs (reattach + reap). */
|
|
3790
4320
|
export declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxOpenPtySessionRow[]>;
|
|
3791
4321
|
export type SandboxLeaseLiveness = "cold" | "warming" | "warm" | "draining";
|
|
3792
|
-
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process";
|
|
4322
|
+
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process" | "interaction";
|
|
3793
4323
|
export type SandboxProviderExistence = "not_created" | "creating" | "exists" | "missing" | "unknown";
|
|
3794
4324
|
export type SandboxArchiveAvailability = "none" | "available" | "unverified" | "invalid";
|
|
3795
4325
|
export type SandboxRestoreStatus = "not_required" | "pending" | "restoring" | "verifying" | "ready" | "degraded" | "unrecoverable";
|
|
@@ -3823,6 +4353,22 @@ export type SandboxRecoveryState = {
|
|
|
3823
4353
|
verifiedRevision: string | null;
|
|
3824
4354
|
verifiedAt: string | null;
|
|
3825
4355
|
};
|
|
4356
|
+
/** Provider-specific proof that an elected recovery owner may replace only
|
|
4357
|
+
* the disposable execution wrapper while retaining the same workspace. */
|
|
4358
|
+
continuity?: SandboxProviderContinuityRecovery;
|
|
4359
|
+
/** A provider disappeared while a non-cancellable capture response could
|
|
4360
|
+
* still settle. The cold lease retains this exact source/lineage receipt so a
|
|
4361
|
+
* late verified archive can repair recovery without reopening the old box. */
|
|
4362
|
+
lateArchiveCapture?: {
|
|
4363
|
+
version: 1;
|
|
4364
|
+
captureId: string;
|
|
4365
|
+
providerRequestId: string;
|
|
4366
|
+
sourceLeaseId: string;
|
|
4367
|
+
sourceLeaseEpoch: number;
|
|
4368
|
+
sourceInstanceId: string;
|
|
4369
|
+
sourceWorkspaceGeneration: number;
|
|
4370
|
+
recordedAt: string;
|
|
4371
|
+
};
|
|
3826
4372
|
};
|
|
3827
4373
|
export interface LeaseSnapshot {
|
|
3828
4374
|
id: string;
|
|
@@ -3850,9 +4396,24 @@ export interface LeaseSnapshot {
|
|
|
3850
4396
|
/** Exact provider capture currently holding the lease-local admission gate. */
|
|
3851
4397
|
archiveCapture: {
|
|
3852
4398
|
id: string;
|
|
4399
|
+
operationId: string;
|
|
4400
|
+
providerRequestId: string;
|
|
4401
|
+
providerReplaySafe: boolean;
|
|
4402
|
+
takeoverSafe: boolean;
|
|
4403
|
+
attempt: number;
|
|
3853
4404
|
workspaceGeneration: number;
|
|
3854
4405
|
startedAt: Date;
|
|
3855
4406
|
deadlineAt: Date;
|
|
4407
|
+
/** Durable proof that this exact draining capture already published a
|
|
4408
|
+
* verified current-generation archive. Null while capture is outstanding. */
|
|
4409
|
+
publishedAt: Date | null;
|
|
4410
|
+
} | null;
|
|
4411
|
+
/** Bounded exact operator hold. Active holds stop reaper capture/teardown but
|
|
4412
|
+
* deliberately do not stop a user from re-arming a resumable drain. */
|
|
4413
|
+
reaperHold: {
|
|
4414
|
+
id: string;
|
|
4415
|
+
until: Date;
|
|
4416
|
+
reason: string;
|
|
3856
4417
|
} | null;
|
|
3857
4418
|
resumeBackendId: string | null;
|
|
3858
4419
|
resumeState: Record<string, unknown> | null;
|
|
@@ -3868,7 +4429,7 @@ export interface LeaseSnapshot {
|
|
|
3868
4429
|
/** Once set, new holders and new filesystem mutations are fenced while the
|
|
3869
4430
|
* current holders quiesce and the reaper creates a successor. */
|
|
3870
4431
|
rotationRequestedAt: Date | null;
|
|
3871
|
-
rotationReason: "provider_deadline" | "operator" | null;
|
|
4432
|
+
rotationReason: "provider_deadline" | "operator" | "teardown_claim" | null;
|
|
3872
4433
|
currentCheckpointArtifactId: string | null;
|
|
3873
4434
|
previousCheckpointArtifactId: string | null;
|
|
3874
4435
|
expiresAt: Date;
|
|
@@ -3895,8 +4456,13 @@ export interface AcquireLeaseInput {
|
|
|
3895
4456
|
warmingLeaseTtlMs?: number;
|
|
3896
4457
|
expectedEpoch?: number;
|
|
3897
4458
|
/** Bounded wait for an exact provider-native capture claim to settle. The
|
|
3898
|
-
* transaction is released between retries; every retry re-reads the lease.
|
|
4459
|
+
* transaction is released between retries; every retry re-reads the lease.
|
|
4460
|
+
* The same wait also covers a requested provider rotation. The legacy field
|
|
4461
|
+
* name is retained at the API boundary so rolling workers remain compatible. */
|
|
3899
4462
|
captureWaitMs?: number;
|
|
4463
|
+
/** Optional owner cancellation for the transition wait. No holder exists
|
|
4464
|
+
* while a capture/rotation fence is observed, so cancellation is leak-free. */
|
|
4465
|
+
waitSignal?: AbortSignal;
|
|
3900
4466
|
}
|
|
3901
4467
|
export type AcquireLeaseResult = {
|
|
3902
4468
|
role: "spawner";
|
|
@@ -3913,12 +4479,32 @@ export type AcquireLeaseResult = {
|
|
|
3913
4479
|
lease: LeaseSnapshot;
|
|
3914
4480
|
} | {
|
|
3915
4481
|
role: "fenced";
|
|
4482
|
+
reason: "superseded" | "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress";
|
|
3916
4483
|
lease: LeaseSnapshot;
|
|
3917
4484
|
};
|
|
3918
4485
|
export declare class SandboxLeaseSupersededError extends Error {
|
|
3919
4486
|
readonly sandboxGroupId: string;
|
|
3920
4487
|
readonly leaseEpoch: number;
|
|
3921
|
-
|
|
4488
|
+
readonly diagnostic?: {
|
|
4489
|
+
backend: string;
|
|
4490
|
+
instanceId: string | null;
|
|
4491
|
+
liveness: SandboxLeaseLiveness;
|
|
4492
|
+
} | undefined;
|
|
4493
|
+
constructor(sandboxGroupId: string, leaseEpoch: number, diagnostic?: {
|
|
4494
|
+
backend: string;
|
|
4495
|
+
instanceId: string | null;
|
|
4496
|
+
liveness: SandboxLeaseLiveness;
|
|
4497
|
+
} | undefined);
|
|
4498
|
+
}
|
|
4499
|
+
export declare class SandboxLeaseTransitionError extends Error {
|
|
4500
|
+
readonly sandboxGroupId: string;
|
|
4501
|
+
readonly leaseEpoch: number;
|
|
4502
|
+
readonly reason: "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress";
|
|
4503
|
+
readonly backend: string;
|
|
4504
|
+
readonly instanceId: string | null;
|
|
4505
|
+
readonly liveness: SandboxLeaseLiveness;
|
|
4506
|
+
readonly name = "SandboxLeaseTransitionError";
|
|
4507
|
+
constructor(sandboxGroupId: string, leaseEpoch: number, reason: "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress", backend: string, instanceId: string | null, liveness: SandboxLeaseLiveness);
|
|
3922
4508
|
}
|
|
3923
4509
|
export type SandboxViewerForceDrainReason = "balance" | "warm_cap";
|
|
3924
4510
|
export declare class SandboxViewerAdmissionBlockedError extends Error {
|
|
@@ -4011,6 +4597,7 @@ export declare function failSandboxRematerialization(db: Database, input: {
|
|
|
4011
4597
|
rematerializationId: string;
|
|
4012
4598
|
failureCode: string;
|
|
4013
4599
|
retryable: boolean;
|
|
4600
|
+
discardContinuity?: boolean;
|
|
4014
4601
|
}): Promise<{
|
|
4015
4602
|
failed: boolean;
|
|
4016
4603
|
lease: LeaseSnapshot | null;
|
|
@@ -4041,11 +4628,14 @@ export declare function commitWarmingToWarm(db: Database, input: {
|
|
|
4041
4628
|
id: string;
|
|
4042
4629
|
verifiedRevision: string;
|
|
4043
4630
|
};
|
|
4631
|
+
/** Exact durable same-workspace receipt returned by the elected provider
|
|
4632
|
+
* continuity recovery. Mutually exclusive with archive hydration. */
|
|
4633
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4044
4634
|
leaseTtlMs: number;
|
|
4045
4635
|
}): Promise<{
|
|
4046
4636
|
committed: boolean;
|
|
4047
4637
|
lease: LeaseSnapshot | null;
|
|
4048
|
-
reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
|
|
4638
|
+
reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "recovery_mode_conflict" | "continuity_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
|
|
4049
4639
|
}>;
|
|
4050
4640
|
export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
4051
4641
|
accountId: string;
|
|
@@ -4056,6 +4646,7 @@ export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
|
4056
4646
|
* archive-less create. Provider attribution is accepted only while the
|
|
4057
4647
|
* warming row still carries this same attempt as well as this epoch. */
|
|
4058
4648
|
rematerializationId?: string | null;
|
|
4649
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4059
4650
|
instanceId: string;
|
|
4060
4651
|
resumeBackendId?: string | null;
|
|
4061
4652
|
resumeState?: Record<string, unknown> | null;
|
|
@@ -4453,6 +5044,7 @@ export declare function failWarmingToCold(db: Database, input: {
|
|
|
4453
5044
|
workspaceId: string;
|
|
4454
5045
|
sandboxGroupId: string;
|
|
4455
5046
|
expectedEpoch: number;
|
|
5047
|
+
discardContinuity?: boolean;
|
|
4456
5048
|
}): Promise<void>;
|
|
4457
5049
|
export declare function releaseLeaseHolder(db: Database, input: {
|
|
4458
5050
|
accountId: string;
|
|
@@ -4461,6 +5053,11 @@ export declare function releaseLeaseHolder(db: Database, input: {
|
|
|
4461
5053
|
kind: LeaseHolderKind;
|
|
4462
5054
|
holderId: string;
|
|
4463
5055
|
idleGraceMs: number;
|
|
5056
|
+
/** The caller has crossed the non-detachable physical boundary for this
|
|
5057
|
+
* exact turn holder: every admitted attempt-owned workspace writer has
|
|
5058
|
+
* resolved, rejected, or been physically quiesced. A cancellation listener
|
|
5059
|
+
* that merely prevents a holder leak must leave this false. */
|
|
5060
|
+
workspaceWritersQuiesced?: boolean;
|
|
4464
5061
|
}): Promise<{
|
|
4465
5062
|
liveness: SandboxLeaseLiveness;
|
|
4466
5063
|
refcount: number;
|
|
@@ -4504,11 +5101,16 @@ export declare function reapStaleLeaseHolders(db: Database, input: {
|
|
|
4504
5101
|
* 10s turn heartbeat, so only a DEAD worker's holder ever crosses it). 0/absent
|
|
4505
5102
|
* = legacy never-reap. */
|
|
4506
5103
|
turnHolderTtlMs?: number;
|
|
5104
|
+
/** Delete placement-controller holders after their BrowserSession or
|
|
5105
|
+
* ComputerSession heartbeat dies. Active controllers refresh both the
|
|
5106
|
+
* resource and holder in one API heartbeat; zero disables only for tests. */
|
|
5107
|
+
interactionHolderTtlMs?: number;
|
|
4507
5108
|
idleGraceMs: number;
|
|
4508
5109
|
}): Promise<{
|
|
4509
5110
|
reapedViewers: number;
|
|
4510
5111
|
reapedDirect: number;
|
|
4511
5112
|
reapedTurns: number;
|
|
5113
|
+
reapedInteractions: number;
|
|
4512
5114
|
warmingReset: number;
|
|
4513
5115
|
drained: ReapDrainable[];
|
|
4514
5116
|
}>;
|
|
@@ -4517,6 +5119,7 @@ export declare function reapStaleLeaseHoldersGlobal(db: Database, input: {
|
|
|
4517
5119
|
/** Reap DEAD-WORKER turn holders staler than this (the lease TTL; see
|
|
4518
5120
|
* reapStaleLeaseHolders). 0/absent = never (legacy). */
|
|
4519
5121
|
turnHolderTtlMs?: number;
|
|
5122
|
+
interactionHolderTtlMs?: number;
|
|
4520
5123
|
idleGraceMs: number;
|
|
4521
5124
|
}): Promise<ReapDrainable[]>;
|
|
4522
5125
|
export interface MeterableWarmLease {
|
|
@@ -4551,6 +5154,9 @@ export declare function confirmDrainCold(db: Database, input: {
|
|
|
4551
5154
|
workspaceId: string;
|
|
4552
5155
|
sandboxGroupId: string;
|
|
4553
5156
|
expectedEpoch: number;
|
|
5157
|
+
/** Exact durable teardown ownership. Omission asserts that no claim exists;
|
|
5158
|
+
* a replaced, newly installed, or expired claim always fences this commit. */
|
|
5159
|
+
expectedCaptureId?: string;
|
|
4554
5160
|
/** Definitive provider NotFound before this drain could capture /workspace.
|
|
4555
5161
|
* With no durable archive this must become typed unrecoverable, never a
|
|
4556
5162
|
* clean cold lease that can expose an empty replacement. */
|
|
@@ -4679,6 +5285,8 @@ export declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
|
4679
5285
|
/** Wait before provider admission while an exact archive capture owns this
|
|
4680
5286
|
* lease. The attempt/route fences are re-read on every bounded retry. */
|
|
4681
5287
|
captureWaitMs?: number;
|
|
5288
|
+
/** Cancel the bounded transition wait without creating an admission. */
|
|
5289
|
+
waitSignal?: AbortSignal;
|
|
4682
5290
|
/** Active-routed mutations bind to the exact session pointer. Omitted means
|
|
4683
5291
|
* an intentional home-provider write outside the routing surface. */
|
|
4684
5292
|
routeKind?: "home" | "active";
|
|
@@ -4701,6 +5309,7 @@ export declare function advanceWorkspaceGenerationForDirectRequest(db: Database,
|
|
|
4701
5309
|
routeEpoch: number;
|
|
4702
5310
|
operation: string;
|
|
4703
5311
|
captureWaitMs?: number;
|
|
5312
|
+
waitSignal?: AbortSignal;
|
|
4704
5313
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4705
5314
|
/** Admit one model/user-visible stdin write for an exact retained process. The
|
|
4706
5315
|
* process's original provider and route are authoritative even if the session's
|
|
@@ -4712,6 +5321,7 @@ export declare function advanceWorkspaceGenerationForRetainedProcess(db: Databas
|
|
|
4712
5321
|
processId: string;
|
|
4713
5322
|
operation: string;
|
|
4714
5323
|
captureWaitMs?: number;
|
|
5324
|
+
waitSignal?: AbortSignal;
|
|
4715
5325
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4716
5326
|
/** Physically settle one exact provider mutation admission after its promise
|
|
4717
5327
|
* resolves or rejects. Rejections need no output acceptance, but still clear
|
|
@@ -4896,8 +5506,58 @@ export declare function readWorkspaceArchiveCapturePreflight(db: Database, input
|
|
|
4896
5506
|
archiveGeneration: number | null;
|
|
4897
5507
|
archiveComplete: boolean;
|
|
4898
5508
|
} | null>;
|
|
5509
|
+
export declare const SANDBOX_REAPER_HOLD_MAX_TTL_MS: number;
|
|
5510
|
+
/** Read the exact operator-hold target without exposing it across an
|
|
5511
|
+
* account/workspace mismatch. The operator CLI projects only non-secret fields
|
|
5512
|
+
* from this snapshot; resumeState remains an internal DB contract. */
|
|
5513
|
+
export declare function readSandboxLeaseReaperHoldTarget(db: Database, input: {
|
|
5514
|
+
accountId: string;
|
|
5515
|
+
workspaceId: string;
|
|
5516
|
+
sandboxGroupId: string;
|
|
5517
|
+
}): Promise<LeaseSnapshot | null>;
|
|
5518
|
+
export type SandboxLeaseReaperHoldResult = {
|
|
5519
|
+
status: "held";
|
|
5520
|
+
renewed: boolean;
|
|
5521
|
+
lease: LeaseSnapshot;
|
|
5522
|
+
} | {
|
|
5523
|
+
status: "lease_fenced" | "not_live" | "held_by_other" | "teardown_in_progress" | "rotation_in_progress" | "provider_deadline_conflict" | "reason_conflict";
|
|
5524
|
+
lease: LeaseSnapshot | null;
|
|
5525
|
+
};
|
|
5526
|
+
/**
|
|
5527
|
+
* Install or renew a bounded operator preservation gate on one exact physical
|
|
5528
|
+
* lease. The row lock serializes this decision with reaper claim acquisition.
|
|
5529
|
+
* A hold never creates/resumes a provider and never overrides teardown already
|
|
5530
|
+
* issued: callers must receive a positive receipt before relying on it.
|
|
5531
|
+
*/
|
|
5532
|
+
export declare function acquireSandboxLeaseReaperHold(db: Database, input: {
|
|
5533
|
+
accountId: string;
|
|
5534
|
+
workspaceId: string;
|
|
5535
|
+
sandboxGroupId: string;
|
|
5536
|
+
expectedEpoch: number;
|
|
5537
|
+
expectedInstanceId: string;
|
|
5538
|
+
holdId: string;
|
|
5539
|
+
ttlMs: number;
|
|
5540
|
+
/** Preserve this much configured rotation headroom after the hold expires.
|
|
5541
|
+
* Callers should pass the deployment's sandboxRotationLeadMs. */
|
|
5542
|
+
providerDeadlineHeadroomMs: number;
|
|
5543
|
+
reason: string;
|
|
5544
|
+
}): Promise<SandboxLeaseReaperHoldResult>;
|
|
5545
|
+
/** Release only the exact operator receipt on the exact physical lease. */
|
|
5546
|
+
export declare function releaseSandboxLeaseReaperHold(db: Database, input: {
|
|
5547
|
+
accountId: string;
|
|
5548
|
+
workspaceId: string;
|
|
5549
|
+
sandboxGroupId: string;
|
|
5550
|
+
expectedEpoch: number;
|
|
5551
|
+
expectedInstanceId: string;
|
|
5552
|
+
holdId: string;
|
|
5553
|
+
}): Promise<boolean>;
|
|
4899
5554
|
export type WorkspaceArchiveCaptureClaim = {
|
|
4900
5555
|
id: string;
|
|
5556
|
+
operationId: string;
|
|
5557
|
+
providerRequestId: string;
|
|
5558
|
+
providerReplaySafe: boolean;
|
|
5559
|
+
takeoverSafe: boolean;
|
|
5560
|
+
attempt: number;
|
|
4901
5561
|
leaseId: string;
|
|
4902
5562
|
leaseEpoch: number;
|
|
4903
5563
|
instanceId: string;
|
|
@@ -4906,13 +5566,29 @@ export type WorkspaceArchiveCaptureClaim = {
|
|
|
4906
5566
|
archiveComplete: boolean;
|
|
4907
5567
|
startedAt: Date;
|
|
4908
5568
|
deadlineAt: Date;
|
|
5569
|
+
/** Non-null only after a verified drain archive was atomically published
|
|
5570
|
+
* under this exact capture. Such a claim may finish teardown, never recapture
|
|
5571
|
+
* or release/re-arm. */
|
|
5572
|
+
publishedAt: Date | null;
|
|
4909
5573
|
};
|
|
5574
|
+
/** Read the authoritative takeover clock for one exact unpublished capture.
|
|
5575
|
+
* Provider recovery must never compare a Postgres deadline with an application
|
|
5576
|
+
* wall clock: clock skew could otherwise fence a still-accepted provider
|
|
5577
|
+
* request early. The eventual replacement remains a separate exact CAS. */
|
|
5578
|
+
export declare function workspaceArchiveCaptureDeadlineElapsed(db: Database, input: {
|
|
5579
|
+
accountId: string;
|
|
5580
|
+
workspaceId: string;
|
|
5581
|
+
sandboxGroupId: string;
|
|
5582
|
+
captureId: string;
|
|
5583
|
+
expectedEpoch: number;
|
|
5584
|
+
expectedInstanceId: string;
|
|
5585
|
+
}): Promise<boolean>;
|
|
4910
5586
|
export type ClaimWorkspaceArchiveCaptureResult = {
|
|
4911
5587
|
status: "claimed";
|
|
4912
5588
|
claim: WorkspaceArchiveCaptureClaim;
|
|
4913
5589
|
lease: LeaseSnapshot;
|
|
4914
5590
|
} | {
|
|
4915
|
-
status: "lease_fenced" | "attempt_fenced" | "capture_in_progress" | "holder_in_progress" | "mutation_in_progress" | "throttled";
|
|
5591
|
+
status: "lease_fenced" | "attempt_fenced" | "reaper_held" | "capture_in_progress" | "holder_in_progress" | "mutation_in_progress" | "throttled";
|
|
4916
5592
|
};
|
|
4917
5593
|
/**
|
|
4918
5594
|
* Atomically reserve one live provider for archive capture. Modal pauses a box
|
|
@@ -4925,11 +5601,19 @@ export declare function claimWorkspaceArchiveCapture(db: Database, input: {
|
|
|
4925
5601
|
workspaceId: string;
|
|
4926
5602
|
sandboxGroupId: string;
|
|
4927
5603
|
captureId: string;
|
|
5604
|
+
/** Stable logical request across retries. Old callers default to the exact
|
|
5605
|
+
* capture id and are normalized the same way by migration 0184's trigger. */
|
|
5606
|
+
operationId?: string;
|
|
5607
|
+
attempt?: number;
|
|
4928
5608
|
expectedEpoch: number;
|
|
4929
5609
|
expectedInstanceId: string;
|
|
4930
5610
|
liveness: "warm" | "draining";
|
|
4931
5611
|
captureTimeoutMs: number;
|
|
4932
5612
|
minIntervalMs: number;
|
|
5613
|
+
/** Explicit provider-registry proof. Optional false defaults preserve safe
|
|
5614
|
+
* rolling behavior for pre-policy callers. */
|
|
5615
|
+
providerReplaySafe?: boolean;
|
|
5616
|
+
takeoverSafe?: boolean;
|
|
4933
5617
|
warmAttempt?: {
|
|
4934
5618
|
sessionId: string;
|
|
4935
5619
|
turnId: string;
|
|
@@ -4948,17 +5632,21 @@ export declare function releaseWorkspaceArchiveCapture(db: Database, input: {
|
|
|
4948
5632
|
expectedInstanceId: string;
|
|
4949
5633
|
}): Promise<boolean>;
|
|
4950
5634
|
/**
|
|
4951
|
-
* Replace
|
|
4952
|
-
*
|
|
4953
|
-
*
|
|
4954
|
-
*
|
|
5635
|
+
* Replace a capture attempt without ever opening the admission gate. A generic
|
|
5636
|
+
* provider remains deadline-gated. A provider registration explicitly recorded
|
|
5637
|
+
* as takeover-safe may retry immediately, using either same-request idempotency
|
|
5638
|
+
* or an independently repeatable read-only capture.
|
|
5639
|
+
* captureId changes to fence teardown ownership; providerRequestId deliberately
|
|
5640
|
+
* does not, so a predecessor success remains adoptable by its successor.
|
|
4955
5641
|
*/
|
|
4956
|
-
export declare function
|
|
5642
|
+
export declare function replaceWorkspaceArchiveCaptureAfterProof(db: Database, input: {
|
|
4957
5643
|
accountId: string;
|
|
4958
5644
|
workspaceId: string;
|
|
4959
5645
|
sandboxGroupId: string;
|
|
4960
5646
|
priorCaptureId: string;
|
|
4961
5647
|
captureId: string;
|
|
5648
|
+
operationId: string;
|
|
5649
|
+
attempt: number;
|
|
4962
5650
|
expectedEpoch: number;
|
|
4963
5651
|
expectedInstanceId: string;
|
|
4964
5652
|
captureTimeoutMs: number;
|
|
@@ -4989,6 +5677,15 @@ export declare function registerSandboxCheckpointArtifact(db: Database, input: {
|
|
|
4989
5677
|
providerBinding: Record<string, unknown>;
|
|
4990
5678
|
workspaceArchive: string;
|
|
4991
5679
|
workspaceArchiveMeta: SandboxArchiveRevision;
|
|
5680
|
+
/**
|
|
5681
|
+
* Workspace checkpoints are identified by their exact capture source.
|
|
5682
|
+
* Provider-image builds instead use a provider-owned idempotency key: a
|
|
5683
|
+
* retry may run from a successor verifier lease but must converge on the
|
|
5684
|
+
* same exact immutable object. The first source remains immutable
|
|
5685
|
+
* provenance; only a byte-identical object in the same tenant/group may be
|
|
5686
|
+
* reused.
|
|
5687
|
+
*/
|
|
5688
|
+
registrationIdentity?: "capture" | "provider_object";
|
|
4992
5689
|
}): Promise<SandboxCheckpointArtifactRegistration>;
|
|
4993
5690
|
/** Hand an unpublished candidate to asynchronous GC. Referenced artifacts are
|
|
4994
5691
|
* protected both here and by the global claim function. */
|
|
@@ -5064,10 +5761,14 @@ export declare function persistDrainSnapshot(db: Database, input: {
|
|
|
5064
5761
|
accountId: string;
|
|
5065
5762
|
workspaceId: string;
|
|
5066
5763
|
sandboxGroupId: string;
|
|
5764
|
+
/** Exact source lease identity. Required for cold late-result adoption. */
|
|
5765
|
+
expectedLeaseId?: string;
|
|
5067
5766
|
expectedEpoch: number;
|
|
5068
5767
|
expectedInstanceId: string;
|
|
5069
5768
|
expectedWorkspaceGeneration: number;
|
|
5070
5769
|
captureId: string;
|
|
5770
|
+
/** Stable provider-operation lineage across atomic claim replacements. */
|
|
5771
|
+
providerRequestId?: string;
|
|
5071
5772
|
} & ({
|
|
5072
5773
|
/** Null performs only the epoch/instance/generation CAS check. */
|
|
5073
5774
|
workspaceArchive: null;
|
|
@@ -5323,6 +6024,7 @@ export type EnrollmentRecord = {
|
|
|
5323
6024
|
desktopUnavailableReason: string | null;
|
|
5324
6025
|
allowScreenControl: boolean;
|
|
5325
6026
|
status: EnrollmentStatus;
|
|
6027
|
+
credentialGeneration: number;
|
|
5326
6028
|
os: EnrollmentOs;
|
|
5327
6029
|
arch: string;
|
|
5328
6030
|
lastSeenAt: string | null;
|
|
@@ -5360,6 +6062,51 @@ export declare function getEnrollment(db: Database, workspaceId: string, enrollm
|
|
|
5360
6062
|
export declare function listEnrollments(db: Database, workspaceId: string, options?: {
|
|
5361
6063
|
status?: EnrollmentStatus;
|
|
5362
6064
|
}): Promise<EnrollmentRecord[]>;
|
|
6065
|
+
export type MachineRemovalOutcome = (typeof schema.machineRemovalOperationOutcomeValues)[number];
|
|
6066
|
+
export type MachineRemovalBlockCode = "active_route" | "active_commands" | "machine_home" | "active_lease" | "recovery_pending" | "not_selfhosted";
|
|
6067
|
+
export type MachineRemovalResult = {
|
|
6068
|
+
enrollmentId: string;
|
|
6069
|
+
outcome: MachineRemovalOutcome;
|
|
6070
|
+
removed: boolean;
|
|
6071
|
+
machineName: string | null;
|
|
6072
|
+
lastSeenAt: string | null;
|
|
6073
|
+
revokedAt: string | null;
|
|
6074
|
+
code: MachineRemovalBlockCode | null;
|
|
6075
|
+
message: string;
|
|
6076
|
+
action: string;
|
|
6077
|
+
dependentSessions: Array<{
|
|
6078
|
+
id: string;
|
|
6079
|
+
title: string | null;
|
|
6080
|
+
}>;
|
|
6081
|
+
};
|
|
6082
|
+
export declare class MachineRemovalIdempotencyError extends Error {
|
|
6083
|
+
readonly name = "MachineRemovalIdempotencyError";
|
|
6084
|
+
}
|
|
6085
|
+
export declare class MachineRemovalRevisionConflictError extends Error {
|
|
6086
|
+
readonly currentUpdatedAt: string;
|
|
6087
|
+
readonly name = "MachineRemovalRevisionConflictError";
|
|
6088
|
+
constructor(message: string, currentUpdatedAt: string);
|
|
6089
|
+
}
|
|
6090
|
+
/**
|
|
6091
|
+
* Remove one connected-machine enrollment without touching the durable identity
|
|
6092
|
+
* or any session/route/archive evidence. The enrollment row is the lifecycle
|
|
6093
|
+
* truth: status -> revoked rejects future auth-callout/heartbeat/reconnect
|
|
6094
|
+
* attempts, while a fresh device-flow re-enrollment can reactivate the same
|
|
6095
|
+
* public-key identity with a new credential family.
|
|
6096
|
+
*
|
|
6097
|
+
* The operation key is scoped to the workspace and is receipt-backed. A retry
|
|
6098
|
+
* with the same key and request fingerprint replays the exact committed result;
|
|
6099
|
+
* a different fingerprint is rejected rather than risking an accidental replay
|
|
6100
|
+
* against a changed control-plane revision.
|
|
6101
|
+
*/
|
|
6102
|
+
export declare function removeEnrollment(db: Database, input: {
|
|
6103
|
+
accountId: string;
|
|
6104
|
+
workspaceId: string;
|
|
6105
|
+
enrollmentId: string;
|
|
6106
|
+
operationKey: string;
|
|
6107
|
+
expectedUpdatedAt?: string;
|
|
6108
|
+
subjectId?: string | null;
|
|
6109
|
+
}): Promise<MachineRemovalResult | null>;
|
|
5363
6110
|
export declare function revokeEnrollment(db: Database, input: {
|
|
5364
6111
|
accountId: string;
|
|
5365
6112
|
workspaceId: string;
|
|
@@ -5367,6 +6114,14 @@ export declare function revokeEnrollment(db: Database, input: {
|
|
|
5367
6114
|
}): Promise<{
|
|
5368
6115
|
revoked: boolean;
|
|
5369
6116
|
}>;
|
|
6117
|
+
export declare function revokeEnrollmentByGeneration(db: Database, input: {
|
|
6118
|
+
workspaceId: string;
|
|
6119
|
+
enrollmentId: string;
|
|
6120
|
+
credentialGeneration: number;
|
|
6121
|
+
}): Promise<{
|
|
6122
|
+
matched: boolean;
|
|
6123
|
+
revoked: boolean;
|
|
6124
|
+
}>;
|
|
5370
6125
|
export declare function touchEnrollmentLastSeen(db: Database, input: {
|
|
5371
6126
|
accountId: string;
|
|
5372
6127
|
workspaceId: string;
|
|
@@ -5941,6 +6696,8 @@ export type InitializeSessionStartResult = {
|
|
|
5941
6696
|
turn: SessionTurn | null;
|
|
5942
6697
|
temporalWorkflowId: string;
|
|
5943
6698
|
workflowWakeRevision: number | null;
|
|
6699
|
+
/** True when this call installed/repaired start state or committed a new wake revision. */
|
|
6700
|
+
changed: boolean;
|
|
5944
6701
|
};
|
|
5945
6702
|
/**
|
|
5946
6703
|
* Install a newly created session's complete first runnable unit atomically.
|
|
@@ -5998,9 +6755,12 @@ export type SessionAttemptInterruptionSettlement = {
|
|
|
5998
6755
|
* exact turn -> exact attempt lock order and require the durable interruption.
|
|
5999
6756
|
* Temporal activity cancellation/terminalization is transport state only. The
|
|
6000
6757
|
* workflow admits a replacement from this durable receipt, never from the
|
|
6001
|
-
* activity promise.
|
|
6758
|
+
* activity promise. The same boundary also applies when the activity itself
|
|
6759
|
+
* durably requested same-turn recovery (for example during a worker rollout):
|
|
6760
|
+
* that recovery event is the logical settlement cause in place of a
|
|
6761
|
+
* Pause/Steer interruption row.
|
|
6002
6762
|
*/
|
|
6003
|
-
export
|
|
6763
|
+
export type MarkSessionAttemptQuiescedInput = {
|
|
6004
6764
|
accountId?: string;
|
|
6005
6765
|
workspaceId: string;
|
|
6006
6766
|
sessionId: string;
|
|
@@ -6015,7 +6775,19 @@ export declare function markSessionAttemptQuiesced(db: Database, input: {
|
|
|
6015
6775
|
* admission remains strict because only a durable interruption needs this
|
|
6016
6776
|
* receipt. */
|
|
6017
6777
|
allowUninterrupted?: boolean;
|
|
6018
|
-
}
|
|
6778
|
+
};
|
|
6779
|
+
export type SessionAttemptQuiescenceCommit = {
|
|
6780
|
+
events: SessionEvent[];
|
|
6781
|
+
/** The exact still-undelivered outbox fact created by this commit, or found
|
|
6782
|
+
* on an idempotent replay after a post-commit caller failure. Postgres remains
|
|
6783
|
+
* the durable fallback; callers may deliver this fact immediately. */
|
|
6784
|
+
workflowWake: SessionWorkflowWake | null;
|
|
6785
|
+
};
|
|
6786
|
+
export declare function commitSessionAttemptQuiescence(db: Database, input: MarkSessionAttemptQuiescedInput): Promise<SessionAttemptQuiescenceCommit>;
|
|
6787
|
+
/** Compatibility projection for callers that only publish the committed
|
|
6788
|
+
* events. The turn activity uses `commitSessionAttemptQuiescence` so it can
|
|
6789
|
+
* immediately deliver the returned durable wake without waiting for repair. */
|
|
6790
|
+
export declare function markSessionAttemptQuiesced(db: Database, input: MarkSessionAttemptQuiescedInput): Promise<SessionEvent[]>;
|
|
6019
6791
|
export type ReconcileSessionAttemptQuiescenceResult = {
|
|
6020
6792
|
action: "quiesced";
|
|
6021
6793
|
events: SessionEvent[];
|
|
@@ -6490,7 +7262,7 @@ export declare function addSessionSystemUpdate(db: Database, input: AddSessionSy
|
|
|
6490
7262
|
* Persist one internal update without fabricating a user prompt or queue row.
|
|
6491
7263
|
* Dedupe and any producer/outbox mutation commit in the same transaction.
|
|
6492
7264
|
*/
|
|
6493
|
-
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null) => Promise<void>): Promise<AddSessionSystemUpdateResult>;
|
|
7265
|
+
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null, updateId: string | null) => Promise<void>): Promise<AddSessionSystemUpdateResult>;
|
|
6494
7266
|
export declare function listOutstandingSessionSystemUpdates(db: Database, workspaceId: string, sessionId: string): Promise<SessionSystemUpdate[]>;
|
|
6495
7267
|
/** Internal updates atomically attached when this inference was claimed. */
|
|
6496
7268
|
export declare function listSessionSystemUpdatesForTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionSystemUpdate[]>;
|
|
@@ -6527,6 +7299,46 @@ export declare function appendSessionEventsForTurnAttempt(db: Database, workspac
|
|
|
6527
7299
|
events: SessionEvent[];
|
|
6528
7300
|
accepted: boolean;
|
|
6529
7301
|
}>;
|
|
7302
|
+
/**
|
|
7303
|
+
* Commit one exact-attempt mutation and its timeline projection together. The
|
|
7304
|
+
* mutation runs first so Codemode's operation-row lock order remains stable;
|
|
7305
|
+
* returning false leaves both the mutation and projection absent.
|
|
7306
|
+
*/
|
|
7307
|
+
export declare function mutateAndAppendSessionEventsForTurnAttempt(db: Database, workspaceId: string, sessionId: string, turnId: string, executionGeneration: number, attemptId: string, inputs: AppendEventInput[], mutate: (tx: Database) => Promise<boolean>): Promise<{
|
|
7308
|
+
events: SessionEvent[];
|
|
7309
|
+
accepted: boolean;
|
|
7310
|
+
mutationApplied: boolean;
|
|
7311
|
+
}>;
|
|
7312
|
+
export type SettleCodemodeOperationWithOutputInput = {
|
|
7313
|
+
accountId: string;
|
|
7314
|
+
workspaceId: string;
|
|
7315
|
+
sessionId: string;
|
|
7316
|
+
turnId: string;
|
|
7317
|
+
attemptId: string;
|
|
7318
|
+
executionGeneration: number;
|
|
7319
|
+
operationId: string;
|
|
7320
|
+
claimId: string;
|
|
7321
|
+
producerId: string;
|
|
7322
|
+
settlement: {
|
|
7323
|
+
state: "completed";
|
|
7324
|
+
result: AttemptToolResult;
|
|
7325
|
+
} | {
|
|
7326
|
+
state: "failed" | "outcome_unknown";
|
|
7327
|
+
errorCode: string;
|
|
7328
|
+
errorMessage: string;
|
|
7329
|
+
};
|
|
7330
|
+
};
|
|
7331
|
+
/**
|
|
7332
|
+
* The Codemode terminal journal row and its visible tool-call output are one
|
|
7333
|
+
* PostgreSQL commit. A worker crash can lose only live NATS fanout, which the
|
|
7334
|
+
* ordinary durable event replay repairs; it cannot leave a completed call
|
|
7335
|
+
* permanently spinning in the timeline.
|
|
7336
|
+
*/
|
|
7337
|
+
export declare function settleCodemodeOperationWithOutput(db: Database, input: SettleCodemodeOperationWithOutputInput): Promise<{
|
|
7338
|
+
committed: boolean;
|
|
7339
|
+
events: SessionEvent[];
|
|
7340
|
+
accepted: boolean;
|
|
7341
|
+
}>;
|
|
6530
7342
|
export declare function appendSessionEventToSandboxGroup(db: Database, workspaceId: string, sandboxGroupId: string, input: AppendEventInput): Promise<SessionEvent[]>;
|
|
6531
7343
|
export declare function appendSessionEventsAndUpdateSession(db: Database, workspaceId: string, sessionId: string, inputs: AppendEventInput[], update: {
|
|
6532
7344
|
resources?: ResourceRef[];
|
|
@@ -6557,7 +7369,14 @@ type LockedSessionUpdateResult = {
|
|
|
6557
7369
|
activeTurnId?: string | null;
|
|
6558
7370
|
};
|
|
6559
7371
|
};
|
|
6560
|
-
|
|
7372
|
+
/**
|
|
7373
|
+
* Serialize a callback with the session/event lock prefix and append its result.
|
|
7374
|
+
* Callers must declare whether the callback can produce semantic activity. A
|
|
7375
|
+
* raw-only declaration skips the commit gate and is verified before any event
|
|
7376
|
+
* or session-row write; conditional semantic callbacks may legitimately no-op.
|
|
7377
|
+
*/
|
|
7378
|
+
export declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>, options: {
|
|
7379
|
+
activity: "raw-only" | "semantic";
|
|
6561
7380
|
lockParentSession?: boolean;
|
|
6562
7381
|
}): Promise<SessionEvent[]>;
|
|
6563
7382
|
export declare function sessionSubject(workspaceId: string, sessionId: string): string;
|
|
@@ -6565,7 +7384,20 @@ export declare function buildCodexTokenResolver(db: Database, settings: Settings
|
|
|
6565
7384
|
export declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexUsageForAccountCore>;
|
|
6566
7385
|
export declare function fetchCodexRateLimitResetCreditsForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexRateLimitResetCreditsForAccountCore>;
|
|
6567
7386
|
export declare function buildConnectionTokenResolver(db: Database, settings: Settings, deps?: ConnectionBrokerDeps, options?: ConnectionTokenResolverOptions): ReturnType<typeof buildConnectionTokenResolverCore>;
|
|
6568
|
-
export { withCodexTokenDeadline, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun, type CodexCredentialTokens, type CodexRateLimitResetCreditsAccountResult, type CodexTokenDeadlineClock, type CodexTokenDeadlineOptions, } from "./codex-token-resolver";
|
|
6569
|
-
export { buildHostConnectionTokenResolver, ConnectionRefreshHttpError, HostMcpCredentialBindingError, HostMcpCredentialScopeError, isPrivateAddress, normalizeBearerScheme, refreshOAuthConnectionCredential, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionCredentialLookupInput, type ConnectionStatusGuard, type ConnectionTokenRefreshInput, type ConnectionTokenResolverOptions, type HostMcpCredentialResolverContext, type PermanentConnectionRefreshFailure, type RefreshTransportOptions, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, } from "./connection-token-resolver";
|
|
6570
|
-
export
|
|
6571
|
-
export
|
|
7387
|
+
export { withCodexTokenDeadline, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun, type CodexCredentialTokens, type CodexRateLimitResetCreditsAccountResult, type CodexTokenDeadlineClock, type CodexTokenDeadlineOptions, } from "./codex-token-resolver.js";
|
|
7388
|
+
export { buildHostConnectionTokenResolver, ConnectionRefreshHttpError, HostMcpCredentialBindingError, HostMcpCredentialScopeError, isPrivateAddress, normalizeBearerScheme, refreshOAuthConnectionCredential, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionCredentialLookupInput, type ConnectionStatusGuard, type ConnectionTokenRefreshInput, type ConnectionTokenResolverOptions, type HostMcpCredentialResolverContext, type PermanentConnectionRefreshFailure, type RefreshTransportOptions, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult, } from "./connection-token-resolver.js";
|
|
7389
|
+
export { CapabilityComponentVersionConflictError, cleanupOrphanedCapabilityComponents, effectiveCapabilityOwnerSql, type CapabilityComponentOwnerIdentity, } from "./capability-components.js";
|
|
7390
|
+
export { adoptPackComponentReferences, finalizePackComponentOwnership, listPackInstallationComponents, PackComponentResolutionError, previewPackComponentRelease, recordPackInlineSkillComponent, releasePackComponents, resolvePackComponentReferences, resolvePackInlineSkillReferences, type PackInlineSkillRequirement, type StoredPackInstallationComponent, } from "./pack-components.js";
|
|
7391
|
+
export { deferPackInstallationOperation, finalizePackInstallationOperation, finalizePackUninstallOperation, PackManifestChangedError, PackOperationClaimLostError, PackOperationInProgressError, PackInstallationVersionConflictError, PackInstallationVersionRequiredError, PackOperationIdempotencyError, preparePackInstallationOperation, preparePackUninstallOperation, touchPackInstallationOperation, type PreparedPackInstallation, } from "./pack-installations.js";
|
|
7392
|
+
export { checkpointPluginPackageOperation, deferPluginPackageOperation, finalizePluginPackageInstall, getInstalledPluginPackage, getPluginPackageUninstallPreview, installPluginMcpReference, listInstalledPluginPackages, PluginInstallationVersionConflictError, PluginInstallationVersionRequiredError, PluginOperationIdempotencyError, preparePluginPackageInstall, uninstallPluginPackage, type InstalledPluginPackage, type InstalledPluginPackageSummary, type PluginBomComponent, type PreparedPluginPackage, } from "./plugin-packages.js";
|
|
7393
|
+
export * from "./workspace-artifacts.js";
|
|
7394
|
+
export * from "./transcription-recordings.js";
|
|
7395
|
+
export * from "./editable-artifacts.js";
|
|
7396
|
+
export * from "./editable-artifact-materialization.js";
|
|
7397
|
+
export * from "./attempt-tool-catalogs.js";
|
|
7398
|
+
export * from "./codemode-operations.js";
|
|
7399
|
+
export * from "./browser-sessions.js";
|
|
7400
|
+
export * from "./computer-sessions.js";
|
|
7401
|
+
export * from "./browser-identities.js";
|
|
7402
|
+
export * from "./browser-auth.js";
|
|
7403
|
+
export * from "./attached-browser-devices.js";
|