@opengeni/db 0.28.9 → 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-VHBFHMPC.js → chunk-YHZXQ7HP.js} +754 -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/generated-images.d.ts +139 -0
- package/dist/index.d.ts +698 -111
- package/dist/index.js +27573 -10322
- 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/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 +3 -3
- 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 +18342 -9099
- package/dist/schema.js +165 -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 +1 -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.d.ts +2 -2
- 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/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 +427 -23
- 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/generated-images.ts +740 -0
- package/src/index.ts +5917 -1182
- 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/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 +4 -7
- 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 +508 -5
- package/src/schema.ts +5117 -3119
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +8 -5
- package/src/session-queue-commands.ts +187 -14
- package/src/session-realtime-context.ts +2 -2
- package/src/session-realtime-ledger.ts +3 -3
- package/src/session-realtime.ts +7 -7
- package/src/session-tool-call-settlement.ts +9 -0
- package/src/slack-user-link-access.ts +702 -0
- 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-P6CUHXQZ.js +0 -7248
- package/dist/chunk-P6CUHXQZ.js.map +0 -1
- package/dist/chunk-VHBFHMPC.js.map +0 -1
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, VariableSetSecret, 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
|
-
export { LOSSLESS_TEXT_PREFIX } from "./lossless-json";
|
|
9
|
-
import { type SessionDiscoveryControl, type SessionCommandActor, type SessionTurnAttemptOutcome } from "./session-control";
|
|
10
|
-
import { type SessionRealtimeContinuityEntry } from "./session-realtime-context";
|
|
11
|
-
import * as schema from "./schema";
|
|
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";
|
|
12
13
|
export { sql as dbSql } from "drizzle-orm";
|
|
13
|
-
export * from "./session-control";
|
|
14
|
-
export * from "./session-queue-commands";
|
|
15
|
-
export * from "./session-realtime";
|
|
16
|
-
export * from "./session-realtime-context";
|
|
17
|
-
export * from "./session-realtime-ledger";
|
|
18
|
-
export * from "./new-session-drafts";
|
|
19
|
-
export * from "./workspace-instruction-policies";
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export
|
|
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,6 +592,7 @@ 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;
|
|
@@ -550,6 +609,7 @@ export type UpdateScheduledTaskInput = Partial<{
|
|
|
550
609
|
schedule: ScheduledTaskScheduleSpec;
|
|
551
610
|
runMode: ScheduledTaskRunMode;
|
|
552
611
|
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
612
|
+
action: ScheduledTaskAction;
|
|
553
613
|
agentConfig: ScheduledTaskAgentConfig;
|
|
554
614
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
555
615
|
reusableSessionId: string | null;
|
|
@@ -562,6 +622,11 @@ export type CreatePackInstallationInput = {
|
|
|
562
622
|
accountId: string;
|
|
563
623
|
workspaceId: string;
|
|
564
624
|
packId: string;
|
|
625
|
+
status?: PackInstallationStatus;
|
|
626
|
+
manifestSnapshot?: CapabilityPack | null;
|
|
627
|
+
manifestDigest?: string | null;
|
|
628
|
+
selectedRigId?: string | null;
|
|
629
|
+
installedBySubjectId?: string | null;
|
|
565
630
|
metadata?: Record<string, unknown>;
|
|
566
631
|
};
|
|
567
632
|
export type RegisterWorkspacePackInput = {
|
|
@@ -691,6 +756,14 @@ export type UpdateConnectionInput = {
|
|
|
691
756
|
metadata?: Record<string, unknown>;
|
|
692
757
|
updatedBySubjectId?: string | null;
|
|
693
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
|
+
};
|
|
694
767
|
export type UpdateSlackBotDocumentDestinationInput = {
|
|
695
768
|
accountId: string;
|
|
696
769
|
workspaceId: string;
|
|
@@ -903,6 +976,86 @@ export type EnableCapabilityInstallationInput = {
|
|
|
903
976
|
config?: Record<string, unknown>;
|
|
904
977
|
metadata?: Record<string, unknown>;
|
|
905
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
|
+
}
|
|
906
1059
|
export type EnabledMcpCapabilityServer = {
|
|
907
1060
|
capabilityId: string;
|
|
908
1061
|
id: string;
|
|
@@ -911,6 +1064,7 @@ export type EnabledMcpCapabilityServer = {
|
|
|
911
1064
|
allowedTools?: string[];
|
|
912
1065
|
timeoutMs?: number;
|
|
913
1066
|
cacheToolsList?: boolean;
|
|
1067
|
+
requireApproval?: SessionMcpApprovalPolicy;
|
|
914
1068
|
/**
|
|
915
1069
|
* Credential request headers stored encrypted at enable time
|
|
916
1070
|
* (AES-256-GCM under the workspace-variableSets key). Decrypted only at
|
|
@@ -982,6 +1136,8 @@ export type EnqueueSessionTurnInput = {
|
|
|
982
1136
|
export type SessionTurnForExecution = SessionTurn & {
|
|
983
1137
|
turnInstructions: string | null;
|
|
984
1138
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
1139
|
+
/** Worker-only causal authority; never inferred from the current worker. */
|
|
1140
|
+
initiatingHumanSubjectId: string | null;
|
|
985
1141
|
};
|
|
986
1142
|
export declare function createFileUpload(db: Database, input: {
|
|
987
1143
|
accountId: string;
|
|
@@ -1000,12 +1156,36 @@ export declare function createFileUpload(db: Database, input: {
|
|
|
1000
1156
|
uploadId: string;
|
|
1001
1157
|
expiresAt: string;
|
|
1002
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
|
+
}>;
|
|
1003
1183
|
export declare function getFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset | null>;
|
|
1004
1184
|
export declare function requireFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset>;
|
|
1005
1185
|
/** One RLS-scoped query for all attachment metadata needed by a model turn. */
|
|
1006
1186
|
export declare function getFiles(db: Database, workspaceId: string, fileIds: readonly string[]): Promise<FileAsset[]>;
|
|
1007
1187
|
/** Build the canonical user row with stable attachment refs, never inline bytes. */
|
|
1008
|
-
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>;
|
|
1009
1189
|
export type RetainedFileArtifact = {
|
|
1010
1190
|
file: FileAsset;
|
|
1011
1191
|
uploadStatus: FileUploadStatus | null;
|
|
@@ -1063,7 +1243,7 @@ export type PrepareRetainedScreenshotArtifactInput = {
|
|
|
1063
1243
|
settlementKey: string;
|
|
1064
1244
|
toolCallId: string;
|
|
1065
1245
|
toolOutputId: string;
|
|
1066
|
-
mediaType: "image/png";
|
|
1246
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
1067
1247
|
sizeBytes: number;
|
|
1068
1248
|
sha256: string;
|
|
1069
1249
|
width: number;
|
|
@@ -1237,6 +1417,22 @@ export declare function markStaleRegistryCatalogItems(db: Database, activeKeys:
|
|
|
1237
1417
|
export declare function upsertCapabilityCatalogItem(db: Database, input: CreateCapabilityCatalogItemInput): Promise<CapabilityCatalogItem>;
|
|
1238
1418
|
export declare function listCapabilityCatalogItems(db: Database, workspaceId: string): Promise<CapabilityCatalogItem[]>;
|
|
1239
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>;
|
|
1240
1436
|
export declare function enableCapabilityInstallation(db: Database, input: EnableCapabilityInstallationInput): Promise<CapabilityInstallation>;
|
|
1241
1437
|
export declare function disableCapabilityInstallation(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityInstallation>;
|
|
1242
1438
|
export declare function listCapabilityInstallations(db: Database, workspaceId: string): Promise<CapabilityInstallation[]>;
|
|
@@ -1258,6 +1454,12 @@ export declare function decryptedCapabilityHeaders(server: EnabledMcpCapabilityS
|
|
|
1258
1454
|
export declare function getStoredCapabilityHeaderCiphertext(db: Database, workspaceId: string, capabilityId: string): Promise<Record<string, string> | null>;
|
|
1259
1455
|
export declare function mcpServerIdForCapability(capabilityId: string, metadata?: Record<string, unknown>): string;
|
|
1260
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>;
|
|
1261
1463
|
export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
|
|
1262
1464
|
export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1263
1465
|
export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
@@ -1290,6 +1492,14 @@ export type SlackInstallationRoute = {
|
|
|
1290
1492
|
botId: string;
|
|
1291
1493
|
botUserId: string;
|
|
1292
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[]>;
|
|
1293
1503
|
export type SlackBotUserLink = {
|
|
1294
1504
|
id: string;
|
|
1295
1505
|
accountId: string;
|
|
@@ -1431,6 +1641,24 @@ export type SlackInteractionProgressClaim = {
|
|
|
1431
1641
|
} | {
|
|
1432
1642
|
kind: "not_owned";
|
|
1433
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[]>;
|
|
1434
1662
|
/**
|
|
1435
1663
|
* Reserve one globally bounded progress slot before any Slack provider call.
|
|
1436
1664
|
* The interaction row lock serializes replicas and expired delivery claim
|
|
@@ -1483,6 +1711,20 @@ type SlackBotLifecycleSuccessAuditInput = {
|
|
|
1483
1711
|
credentialLabel: string;
|
|
1484
1712
|
slackTeamId: string;
|
|
1485
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>;
|
|
1486
1728
|
export declare function createConnectionWithSlackBotSuccessAudit(db: Database, input: SlackBotLifecycleSuccessAuditInput & {
|
|
1487
1729
|
connection: CreateConnectionInput;
|
|
1488
1730
|
}): Promise<ConnectionMetadataWithVerification>;
|
|
@@ -1619,8 +1861,25 @@ export declare function loadConnectionCredentialForBroker(db: Database, settings
|
|
|
1619
1861
|
allowSubjectOwned?: boolean;
|
|
1620
1862
|
}): Promise<ConnectionCredentialForBroker | null>;
|
|
1621
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>;
|
|
1622
1869
|
/** Resolve only the reviewed workspace-shared AI Gateway credential shape. */
|
|
1623
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>;
|
|
1624
1883
|
export declare function recordConnectionTokenRefresh(db: Database, input: {
|
|
1625
1884
|
id: string;
|
|
1626
1885
|
version: number;
|
|
@@ -1780,6 +2039,14 @@ export declare function requireScheduledTaskTargetInTransaction(tx: Database, in
|
|
|
1780
2039
|
targetSessionId: string;
|
|
1781
2040
|
}): Promise<void>;
|
|
1782
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
|
+
}>>;
|
|
1783
2050
|
export declare function deleteScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<void>;
|
|
1784
2051
|
export declare function createScheduledTaskRun(db: Database, input: {
|
|
1785
2052
|
workspaceId: string;
|
|
@@ -1796,6 +2063,10 @@ export declare function updateScheduledTaskRun(db: Database, workspaceId: string
|
|
|
1796
2063
|
status: ScheduledTaskRunStatus;
|
|
1797
2064
|
sessionId: string | null;
|
|
1798
2065
|
triggerEventId: string | null;
|
|
2066
|
+
actionKind: ScheduledTaskActionKind;
|
|
2067
|
+
knowledgeSyncRunId: string | null;
|
|
2068
|
+
knowledgeSummary: Record<string, unknown> | null;
|
|
2069
|
+
completedAt: Date | null;
|
|
1799
2070
|
error: string | null;
|
|
1800
2071
|
}>): Promise<ScheduledTaskRun>;
|
|
1801
2072
|
/** DB-only source mutation callback for durable scheduled delivery. */
|
|
@@ -1919,6 +2190,7 @@ export declare function createRigVersion(db: Database, workspaceId: string, rigI
|
|
|
1919
2190
|
}): Promise<RigVersion>;
|
|
1920
2191
|
export declare function createRigVersionForChangePromotion(db: Database, workspaceId: string, rigId: string, changeId: string, input: RigVersionContentInput & {
|
|
1921
2192
|
expectedActiveVersionId: string;
|
|
2193
|
+
providerImages?: RigProviderImages;
|
|
1922
2194
|
}): Promise<{
|
|
1923
2195
|
version: RigVersion;
|
|
1924
2196
|
change: RigChange;
|
|
@@ -1948,6 +2220,33 @@ export declare function listRigVersionMonitoringSummaries(db: Database, workspac
|
|
|
1948
2220
|
}>;
|
|
1949
2221
|
export declare function getRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion | null>;
|
|
1950
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>;
|
|
1951
2250
|
export declare function getRigName(db: Database, workspaceId: string, rigId: string): Promise<string | null>;
|
|
1952
2251
|
export declare function activateRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion>;
|
|
1953
2252
|
export declare function createRigChange(db: Database, input: {
|
|
@@ -2526,17 +2825,23 @@ export declare function armCodexCapacityWait(db: Database, input: {
|
|
|
2526
2825
|
now?: Date;
|
|
2527
2826
|
}): Promise<ArmCodexCapacityWaitResult>;
|
|
2528
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
|
+
};
|
|
2529
2833
|
/**
|
|
2530
2834
|
* Same-transaction capacity-mutation/outbox seam for eligibility and
|
|
2531
2835
|
* membership/default changes. The allocator rotation row is always the
|
|
2532
2836
|
* first lock. Mutations report whether capacity truth changed; only then are
|
|
2533
2837
|
* matching waiter wake revisions advanced and returned for best-effort signal.
|
|
2534
2838
|
*/
|
|
2535
|
-
export declare function withCodexCapacityMutation<T>(db: Database, input: {
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
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<{
|
|
2540
2845
|
result: T;
|
|
2541
2846
|
changed: boolean;
|
|
2542
2847
|
}>): Promise<CodexCapacityMutationResult<T>>;
|
|
@@ -2901,6 +3206,7 @@ export declare function getSessionCodexState(db: Database, workspaceId: string,
|
|
|
2901
3206
|
* Validates the id belongs to the workspace when non-null. Returns false if the
|
|
2902
3207
|
* session is unknown or the id is invalid.
|
|
2903
3208
|
*/
|
|
3209
|
+
export declare function setSessionCodexPinInTransaction(db: SessionActivityDatabase, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2904
3210
|
export declare function setSessionCodexPin(db: Database, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2905
3211
|
/** Written by the worker at the turn boundary; drives the in-session indicator. */
|
|
2906
3212
|
export declare function recordSessionActiveCodexCredential(db: Database, workspaceId: string, sessionId: string, credentialId: string): Promise<void>;
|
|
@@ -2976,6 +3282,8 @@ export type ConnectorActionInvocation = {
|
|
|
2976
3282
|
serverId: string;
|
|
2977
3283
|
toolName: string;
|
|
2978
3284
|
arguments: unknown;
|
|
3285
|
+
/** Explicit per-session MCP approval, rather than a connector-policy decision. */
|
|
3286
|
+
approvalMode?: "session_mcp";
|
|
2979
3287
|
};
|
|
2980
3288
|
export type PrepareConnectorActionApprovalResult = {
|
|
2981
3289
|
managed: false;
|
|
@@ -3007,6 +3315,12 @@ type ResolvedConnectorActionPolicy = {
|
|
|
3007
3315
|
managed: true;
|
|
3008
3316
|
source: "explicit";
|
|
3009
3317
|
entry: ConnectorActionPolicySnapshotEntry;
|
|
3318
|
+
} | {
|
|
3319
|
+
managed: true;
|
|
3320
|
+
source: "explicit";
|
|
3321
|
+
entry: null;
|
|
3322
|
+
decision: "ask";
|
|
3323
|
+
actionName: string;
|
|
3010
3324
|
} | {
|
|
3011
3325
|
managed: true;
|
|
3012
3326
|
source: "ambiguous";
|
|
@@ -3270,6 +3584,8 @@ export type SessionDiscoverySummary = {
|
|
|
3270
3584
|
title: string | null;
|
|
3271
3585
|
titleOriginalChars: number | null;
|
|
3272
3586
|
parentSessionId: string | null;
|
|
3587
|
+
rootSessionId: string;
|
|
3588
|
+
nestedAgentDepth: number;
|
|
3273
3589
|
status: SessionStatus;
|
|
3274
3590
|
effectiveControl: SessionDiscoveryControl;
|
|
3275
3591
|
goal: {
|
|
@@ -3302,6 +3618,9 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3302
3618
|
includeLastMessage?: boolean;
|
|
3303
3619
|
orderBy?: SessionDiscoveryOrderBy;
|
|
3304
3620
|
updatedAfter?: string;
|
|
3621
|
+
parentSessionId?: string | null;
|
|
3622
|
+
search?: string;
|
|
3623
|
+
subjectId?: string;
|
|
3305
3624
|
authorizationScope?: SessionAuthorizationListScope;
|
|
3306
3625
|
}): Promise<{
|
|
3307
3626
|
sessions: SessionDiscoverySummary[];
|
|
@@ -3314,6 +3633,17 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3314
3633
|
updatedThrough: string | null;
|
|
3315
3634
|
updatedAfter: string | null;
|
|
3316
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[]>>;
|
|
3317
3647
|
export type SessionLineage = {
|
|
3318
3648
|
ancestors: Session[];
|
|
3319
3649
|
children: LineageNode[];
|
|
@@ -3394,49 +3724,6 @@ export declare function listSessionEventPage(db: Database, workspaceId: string,
|
|
|
3394
3724
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string): Promise<SessionEvent[]>;
|
|
3395
3725
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, after: number, limit?: number): Promise<SessionEvent[]>;
|
|
3396
3726
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, options: ListSessionEventsOptions): Promise<SessionEvent[]>;
|
|
3397
|
-
export type ToolspaceCallReservation = {
|
|
3398
|
-
reserved: true;
|
|
3399
|
-
count: number;
|
|
3400
|
-
turn: SessionTurnForExecution;
|
|
3401
|
-
} | {
|
|
3402
|
-
reserved: false;
|
|
3403
|
-
reason: TurnAttemptFenceRejectReason | "budget_exhausted";
|
|
3404
|
-
};
|
|
3405
|
-
export type ToolspaceTurnAttemptClaims = {
|
|
3406
|
-
sessionId: string;
|
|
3407
|
-
turnId: string;
|
|
3408
|
-
attemptId: string;
|
|
3409
|
-
executionGeneration: number;
|
|
3410
|
-
};
|
|
3411
|
-
/**
|
|
3412
|
-
* Admit one exact Toolspace bearer before any session credential is decrypted or
|
|
3413
|
-
* any upstream schema is enumerated. This intentionally reuses the canonical
|
|
3414
|
-
* activity write fence so Pause/Steer, attempt replacement, generation changes,
|
|
3415
|
-
* and terminal settlement revoke a copied token at the same linearization point
|
|
3416
|
-
* as other attempt-owned writes.
|
|
3417
|
-
*/
|
|
3418
|
-
export declare function admitToolspaceTurnAttempt(db: Database, workspaceId: string, claims: ToolspaceTurnAttemptClaims): Promise<boolean>;
|
|
3419
|
-
/**
|
|
3420
|
-
* Atomically reserve one toolspace call against a turn's per-turn budget.
|
|
3421
|
-
*
|
|
3422
|
-
* A single conditional UPDATE increments `toolspace_call_count` only while it is
|
|
3423
|
-
* below `limit` and returns the post-increment value. Concurrent reservations
|
|
3424
|
-
* for the same turn serialize on the row lock, so exactly `limit` of N
|
|
3425
|
-
* simultaneous callers observe `reserved: true` — closing the read-then-append
|
|
3426
|
-
* TOCTOU the event-count approach had. The returned attempt id is captured by
|
|
3427
|
-
* that same UPDATE, so callers cannot accidentally execute under a successor
|
|
3428
|
-
* attempt. `reserved: false` means the turn is not executable, at/over budget,
|
|
3429
|
-
* or no longer exists.
|
|
3430
|
-
*/
|
|
3431
|
-
export declare function reserveToolspaceCallForAttempt(db: Database, input: {
|
|
3432
|
-
accountId: string;
|
|
3433
|
-
workspaceId: string;
|
|
3434
|
-
sessionId: string;
|
|
3435
|
-
turnId: string;
|
|
3436
|
-
executionGeneration: number;
|
|
3437
|
-
attemptId: string;
|
|
3438
|
-
limit: number;
|
|
3439
|
-
}): Promise<ToolspaceCallReservation>;
|
|
3440
3727
|
export declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
|
|
3441
3728
|
export declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
|
|
3442
3729
|
export declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
|
|
@@ -3446,7 +3733,31 @@ export declare function getWorkspaceControlEvent(db: Database, workspaceId: stri
|
|
|
3446
3733
|
* a session, while the workspace predicate remains the tenancy boundary.
|
|
3447
3734
|
*/
|
|
3448
3735
|
export declare function getSessionEventByClientEventId(db: Database, workspaceId: string, sessionId: string, clientEventId: string): Promise<SessionEvent | null>;
|
|
3449
|
-
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<{
|
|
3450
3761
|
id: string;
|
|
3451
3762
|
turnId: string | null;
|
|
3452
3763
|
serializedRunState: string;
|
|
@@ -3571,19 +3882,14 @@ export declare function registerPendingSessionToolCall(db: Database, input: Pend
|
|
|
3571
3882
|
accepted: boolean;
|
|
3572
3883
|
registered: boolean;
|
|
3573
3884
|
}>;
|
|
3574
|
-
/**
|
|
3575
|
-
* Clear one completed Toolspace receipt after its attempt-fenced output event is
|
|
3576
|
-
* durable. If control already replaced the attempt, its settlement transaction
|
|
3577
|
-
* owns the receipt and will retain an explicit outcome-unknown or the durable
|
|
3578
|
-
* output event instead.
|
|
3579
|
-
*/
|
|
3580
|
-
export declare function clearPendingSessionToolspaceCall(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem">): Promise<{
|
|
3581
|
-
accepted: boolean;
|
|
3582
|
-
cleared: boolean;
|
|
3583
|
-
}>;
|
|
3584
3885
|
/** Record the raw SDK result without dropping the call receipt. */
|
|
3585
3886
|
export declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
|
|
3586
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
|
+
};
|
|
3587
3893
|
}): Promise<{
|
|
3588
3894
|
accepted: boolean;
|
|
3589
3895
|
recorded: boolean;
|
|
@@ -3617,6 +3923,40 @@ export declare function getActiveSessionHistoryItems(db: Database, workspaceId:
|
|
|
3617
3923
|
item: Record<string, unknown>;
|
|
3618
3924
|
providerArtifactInvalidatedAt: Date | null;
|
|
3619
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
|
+
}>>;
|
|
3620
3960
|
/** Bounded finalized voice turns used only to resume a later realtime call. */
|
|
3621
3961
|
export declare function getSessionRealtimeContinuityEntries(db: Database, workspaceId: string, sessionId: string, maximumEntries?: number): Promise<SessionRealtimeContinuityEntry[]>;
|
|
3622
3962
|
/**
|
|
@@ -3979,7 +4319,7 @@ export declare function closePtySession(db: Database, input: {
|
|
|
3979
4319
|
/** List a session's OPEN PTYs (reattach + reap). */
|
|
3980
4320
|
export declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxOpenPtySessionRow[]>;
|
|
3981
4321
|
export type SandboxLeaseLiveness = "cold" | "warming" | "warm" | "draining";
|
|
3982
|
-
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process";
|
|
4322
|
+
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process" | "interaction";
|
|
3983
4323
|
export type SandboxProviderExistence = "not_created" | "creating" | "exists" | "missing" | "unknown";
|
|
3984
4324
|
export type SandboxArchiveAvailability = "none" | "available" | "unverified" | "invalid";
|
|
3985
4325
|
export type SandboxRestoreStatus = "not_required" | "pending" | "restoring" | "verifying" | "ready" | "degraded" | "unrecoverable";
|
|
@@ -4013,6 +4353,22 @@ export type SandboxRecoveryState = {
|
|
|
4013
4353
|
verifiedRevision: string | null;
|
|
4014
4354
|
verifiedAt: string | null;
|
|
4015
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
|
+
};
|
|
4016
4372
|
};
|
|
4017
4373
|
export interface LeaseSnapshot {
|
|
4018
4374
|
id: string;
|
|
@@ -4040,9 +4396,24 @@ export interface LeaseSnapshot {
|
|
|
4040
4396
|
/** Exact provider capture currently holding the lease-local admission gate. */
|
|
4041
4397
|
archiveCapture: {
|
|
4042
4398
|
id: string;
|
|
4399
|
+
operationId: string;
|
|
4400
|
+
providerRequestId: string;
|
|
4401
|
+
providerReplaySafe: boolean;
|
|
4402
|
+
takeoverSafe: boolean;
|
|
4403
|
+
attempt: number;
|
|
4043
4404
|
workspaceGeneration: number;
|
|
4044
4405
|
startedAt: Date;
|
|
4045
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;
|
|
4046
4417
|
} | null;
|
|
4047
4418
|
resumeBackendId: string | null;
|
|
4048
4419
|
resumeState: Record<string, unknown> | null;
|
|
@@ -4058,7 +4429,7 @@ export interface LeaseSnapshot {
|
|
|
4058
4429
|
/** Once set, new holders and new filesystem mutations are fenced while the
|
|
4059
4430
|
* current holders quiesce and the reaper creates a successor. */
|
|
4060
4431
|
rotationRequestedAt: Date | null;
|
|
4061
|
-
rotationReason: "provider_deadline" | "operator" | null;
|
|
4432
|
+
rotationReason: "provider_deadline" | "operator" | "teardown_claim" | null;
|
|
4062
4433
|
currentCheckpointArtifactId: string | null;
|
|
4063
4434
|
previousCheckpointArtifactId: string | null;
|
|
4064
4435
|
expiresAt: Date;
|
|
@@ -4085,8 +4456,13 @@ export interface AcquireLeaseInput {
|
|
|
4085
4456
|
warmingLeaseTtlMs?: number;
|
|
4086
4457
|
expectedEpoch?: number;
|
|
4087
4458
|
/** Bounded wait for an exact provider-native capture claim to settle. The
|
|
4088
|
-
* 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. */
|
|
4089
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;
|
|
4090
4466
|
}
|
|
4091
4467
|
export type AcquireLeaseResult = {
|
|
4092
4468
|
role: "spawner";
|
|
@@ -4103,12 +4479,32 @@ export type AcquireLeaseResult = {
|
|
|
4103
4479
|
lease: LeaseSnapshot;
|
|
4104
4480
|
} | {
|
|
4105
4481
|
role: "fenced";
|
|
4482
|
+
reason: "superseded" | "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress";
|
|
4106
4483
|
lease: LeaseSnapshot;
|
|
4107
4484
|
};
|
|
4108
4485
|
export declare class SandboxLeaseSupersededError extends Error {
|
|
4109
4486
|
readonly sandboxGroupId: string;
|
|
4110
4487
|
readonly leaseEpoch: number;
|
|
4111
|
-
|
|
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);
|
|
4112
4508
|
}
|
|
4113
4509
|
export type SandboxViewerForceDrainReason = "balance" | "warm_cap";
|
|
4114
4510
|
export declare class SandboxViewerAdmissionBlockedError extends Error {
|
|
@@ -4201,6 +4597,7 @@ export declare function failSandboxRematerialization(db: Database, input: {
|
|
|
4201
4597
|
rematerializationId: string;
|
|
4202
4598
|
failureCode: string;
|
|
4203
4599
|
retryable: boolean;
|
|
4600
|
+
discardContinuity?: boolean;
|
|
4204
4601
|
}): Promise<{
|
|
4205
4602
|
failed: boolean;
|
|
4206
4603
|
lease: LeaseSnapshot | null;
|
|
@@ -4231,11 +4628,14 @@ export declare function commitWarmingToWarm(db: Database, input: {
|
|
|
4231
4628
|
id: string;
|
|
4232
4629
|
verifiedRevision: string;
|
|
4233
4630
|
};
|
|
4631
|
+
/** Exact durable same-workspace receipt returned by the elected provider
|
|
4632
|
+
* continuity recovery. Mutually exclusive with archive hydration. */
|
|
4633
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4234
4634
|
leaseTtlMs: number;
|
|
4235
4635
|
}): Promise<{
|
|
4236
4636
|
committed: boolean;
|
|
4237
4637
|
lease: LeaseSnapshot | null;
|
|
4238
|
-
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";
|
|
4239
4639
|
}>;
|
|
4240
4640
|
export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
4241
4641
|
accountId: string;
|
|
@@ -4246,6 +4646,7 @@ export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
|
4246
4646
|
* archive-less create. Provider attribution is accepted only while the
|
|
4247
4647
|
* warming row still carries this same attempt as well as this epoch. */
|
|
4248
4648
|
rematerializationId?: string | null;
|
|
4649
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4249
4650
|
instanceId: string;
|
|
4250
4651
|
resumeBackendId?: string | null;
|
|
4251
4652
|
resumeState?: Record<string, unknown> | null;
|
|
@@ -4643,6 +5044,7 @@ export declare function failWarmingToCold(db: Database, input: {
|
|
|
4643
5044
|
workspaceId: string;
|
|
4644
5045
|
sandboxGroupId: string;
|
|
4645
5046
|
expectedEpoch: number;
|
|
5047
|
+
discardContinuity?: boolean;
|
|
4646
5048
|
}): Promise<void>;
|
|
4647
5049
|
export declare function releaseLeaseHolder(db: Database, input: {
|
|
4648
5050
|
accountId: string;
|
|
@@ -4651,6 +5053,11 @@ export declare function releaseLeaseHolder(db: Database, input: {
|
|
|
4651
5053
|
kind: LeaseHolderKind;
|
|
4652
5054
|
holderId: string;
|
|
4653
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;
|
|
4654
5061
|
}): Promise<{
|
|
4655
5062
|
liveness: SandboxLeaseLiveness;
|
|
4656
5063
|
refcount: number;
|
|
@@ -4694,11 +5101,16 @@ export declare function reapStaleLeaseHolders(db: Database, input: {
|
|
|
4694
5101
|
* 10s turn heartbeat, so only a DEAD worker's holder ever crosses it). 0/absent
|
|
4695
5102
|
* = legacy never-reap. */
|
|
4696
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;
|
|
4697
5108
|
idleGraceMs: number;
|
|
4698
5109
|
}): Promise<{
|
|
4699
5110
|
reapedViewers: number;
|
|
4700
5111
|
reapedDirect: number;
|
|
4701
5112
|
reapedTurns: number;
|
|
5113
|
+
reapedInteractions: number;
|
|
4702
5114
|
warmingReset: number;
|
|
4703
5115
|
drained: ReapDrainable[];
|
|
4704
5116
|
}>;
|
|
@@ -4707,6 +5119,7 @@ export declare function reapStaleLeaseHoldersGlobal(db: Database, input: {
|
|
|
4707
5119
|
/** Reap DEAD-WORKER turn holders staler than this (the lease TTL; see
|
|
4708
5120
|
* reapStaleLeaseHolders). 0/absent = never (legacy). */
|
|
4709
5121
|
turnHolderTtlMs?: number;
|
|
5122
|
+
interactionHolderTtlMs?: number;
|
|
4710
5123
|
idleGraceMs: number;
|
|
4711
5124
|
}): Promise<ReapDrainable[]>;
|
|
4712
5125
|
export interface MeterableWarmLease {
|
|
@@ -4741,6 +5154,9 @@ export declare function confirmDrainCold(db: Database, input: {
|
|
|
4741
5154
|
workspaceId: string;
|
|
4742
5155
|
sandboxGroupId: string;
|
|
4743
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;
|
|
4744
5160
|
/** Definitive provider NotFound before this drain could capture /workspace.
|
|
4745
5161
|
* With no durable archive this must become typed unrecoverable, never a
|
|
4746
5162
|
* clean cold lease that can expose an empty replacement. */
|
|
@@ -4869,6 +5285,8 @@ export declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
|
4869
5285
|
/** Wait before provider admission while an exact archive capture owns this
|
|
4870
5286
|
* lease. The attempt/route fences are re-read on every bounded retry. */
|
|
4871
5287
|
captureWaitMs?: number;
|
|
5288
|
+
/** Cancel the bounded transition wait without creating an admission. */
|
|
5289
|
+
waitSignal?: AbortSignal;
|
|
4872
5290
|
/** Active-routed mutations bind to the exact session pointer. Omitted means
|
|
4873
5291
|
* an intentional home-provider write outside the routing surface. */
|
|
4874
5292
|
routeKind?: "home" | "active";
|
|
@@ -4891,6 +5309,7 @@ export declare function advanceWorkspaceGenerationForDirectRequest(db: Database,
|
|
|
4891
5309
|
routeEpoch: number;
|
|
4892
5310
|
operation: string;
|
|
4893
5311
|
captureWaitMs?: number;
|
|
5312
|
+
waitSignal?: AbortSignal;
|
|
4894
5313
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4895
5314
|
/** Admit one model/user-visible stdin write for an exact retained process. The
|
|
4896
5315
|
* process's original provider and route are authoritative even if the session's
|
|
@@ -4902,6 +5321,7 @@ export declare function advanceWorkspaceGenerationForRetainedProcess(db: Databas
|
|
|
4902
5321
|
processId: string;
|
|
4903
5322
|
operation: string;
|
|
4904
5323
|
captureWaitMs?: number;
|
|
5324
|
+
waitSignal?: AbortSignal;
|
|
4905
5325
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4906
5326
|
/** Physically settle one exact provider mutation admission after its promise
|
|
4907
5327
|
* resolves or rejects. Rejections need no output acceptance, but still clear
|
|
@@ -5086,8 +5506,58 @@ export declare function readWorkspaceArchiveCapturePreflight(db: Database, input
|
|
|
5086
5506
|
archiveGeneration: number | null;
|
|
5087
5507
|
archiveComplete: boolean;
|
|
5088
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>;
|
|
5089
5554
|
export type WorkspaceArchiveCaptureClaim = {
|
|
5090
5555
|
id: string;
|
|
5556
|
+
operationId: string;
|
|
5557
|
+
providerRequestId: string;
|
|
5558
|
+
providerReplaySafe: boolean;
|
|
5559
|
+
takeoverSafe: boolean;
|
|
5560
|
+
attempt: number;
|
|
5091
5561
|
leaseId: string;
|
|
5092
5562
|
leaseEpoch: number;
|
|
5093
5563
|
instanceId: string;
|
|
@@ -5096,13 +5566,29 @@ export type WorkspaceArchiveCaptureClaim = {
|
|
|
5096
5566
|
archiveComplete: boolean;
|
|
5097
5567
|
startedAt: Date;
|
|
5098
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;
|
|
5099
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>;
|
|
5100
5586
|
export type ClaimWorkspaceArchiveCaptureResult = {
|
|
5101
5587
|
status: "claimed";
|
|
5102
5588
|
claim: WorkspaceArchiveCaptureClaim;
|
|
5103
5589
|
lease: LeaseSnapshot;
|
|
5104
5590
|
} | {
|
|
5105
|
-
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";
|
|
5106
5592
|
};
|
|
5107
5593
|
/**
|
|
5108
5594
|
* Atomically reserve one live provider for archive capture. Modal pauses a box
|
|
@@ -5115,11 +5601,19 @@ export declare function claimWorkspaceArchiveCapture(db: Database, input: {
|
|
|
5115
5601
|
workspaceId: string;
|
|
5116
5602
|
sandboxGroupId: string;
|
|
5117
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;
|
|
5118
5608
|
expectedEpoch: number;
|
|
5119
5609
|
expectedInstanceId: string;
|
|
5120
5610
|
liveness: "warm" | "draining";
|
|
5121
5611
|
captureTimeoutMs: number;
|
|
5122
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;
|
|
5123
5617
|
warmAttempt?: {
|
|
5124
5618
|
sessionId: string;
|
|
5125
5619
|
turnId: string;
|
|
@@ -5138,17 +5632,21 @@ export declare function releaseWorkspaceArchiveCapture(db: Database, input: {
|
|
|
5138
5632
|
expectedInstanceId: string;
|
|
5139
5633
|
}): Promise<boolean>;
|
|
5140
5634
|
/**
|
|
5141
|
-
* Replace
|
|
5142
|
-
*
|
|
5143
|
-
*
|
|
5144
|
-
*
|
|
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.
|
|
5145
5641
|
*/
|
|
5146
|
-
export declare function
|
|
5642
|
+
export declare function replaceWorkspaceArchiveCaptureAfterProof(db: Database, input: {
|
|
5147
5643
|
accountId: string;
|
|
5148
5644
|
workspaceId: string;
|
|
5149
5645
|
sandboxGroupId: string;
|
|
5150
5646
|
priorCaptureId: string;
|
|
5151
5647
|
captureId: string;
|
|
5648
|
+
operationId: string;
|
|
5649
|
+
attempt: number;
|
|
5152
5650
|
expectedEpoch: number;
|
|
5153
5651
|
expectedInstanceId: string;
|
|
5154
5652
|
captureTimeoutMs: number;
|
|
@@ -5179,6 +5677,15 @@ export declare function registerSandboxCheckpointArtifact(db: Database, input: {
|
|
|
5179
5677
|
providerBinding: Record<string, unknown>;
|
|
5180
5678
|
workspaceArchive: string;
|
|
5181
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";
|
|
5182
5689
|
}): Promise<SandboxCheckpointArtifactRegistration>;
|
|
5183
5690
|
/** Hand an unpublished candidate to asynchronous GC. Referenced artifacts are
|
|
5184
5691
|
* protected both here and by the global claim function. */
|
|
@@ -5254,10 +5761,14 @@ export declare function persistDrainSnapshot(db: Database, input: {
|
|
|
5254
5761
|
accountId: string;
|
|
5255
5762
|
workspaceId: string;
|
|
5256
5763
|
sandboxGroupId: string;
|
|
5764
|
+
/** Exact source lease identity. Required for cold late-result adoption. */
|
|
5765
|
+
expectedLeaseId?: string;
|
|
5257
5766
|
expectedEpoch: number;
|
|
5258
5767
|
expectedInstanceId: string;
|
|
5259
5768
|
expectedWorkspaceGeneration: number;
|
|
5260
5769
|
captureId: string;
|
|
5770
|
+
/** Stable provider-operation lineage across atomic claim replacements. */
|
|
5771
|
+
providerRequestId?: string;
|
|
5261
5772
|
} & ({
|
|
5262
5773
|
/** Null performs only the epoch/instance/generation CAS check. */
|
|
5263
5774
|
workspaceArchive: null;
|
|
@@ -5552,7 +6063,7 @@ export declare function listEnrollments(db: Database, workspaceId: string, optio
|
|
|
5552
6063
|
status?: EnrollmentStatus;
|
|
5553
6064
|
}): Promise<EnrollmentRecord[]>;
|
|
5554
6065
|
export type MachineRemovalOutcome = (typeof schema.machineRemovalOperationOutcomeValues)[number];
|
|
5555
|
-
export type MachineRemovalBlockCode = "active_route" | "active_commands" | "active_lease" | "recovery_pending" | "not_selfhosted";
|
|
6066
|
+
export type MachineRemovalBlockCode = "active_route" | "active_commands" | "machine_home" | "active_lease" | "recovery_pending" | "not_selfhosted";
|
|
5556
6067
|
export type MachineRemovalResult = {
|
|
5557
6068
|
enrollmentId: string;
|
|
5558
6069
|
outcome: MachineRemovalOutcome;
|
|
@@ -5563,6 +6074,10 @@ export type MachineRemovalResult = {
|
|
|
5563
6074
|
code: MachineRemovalBlockCode | null;
|
|
5564
6075
|
message: string;
|
|
5565
6076
|
action: string;
|
|
6077
|
+
dependentSessions: Array<{
|
|
6078
|
+
id: string;
|
|
6079
|
+
title: string | null;
|
|
6080
|
+
}>;
|
|
5566
6081
|
};
|
|
5567
6082
|
export declare class MachineRemovalIdempotencyError extends Error {
|
|
5568
6083
|
readonly name = "MachineRemovalIdempotencyError";
|
|
@@ -6245,7 +6760,7 @@ export type SessionAttemptInterruptionSettlement = {
|
|
|
6245
6760
|
* that recovery event is the logical settlement cause in place of a
|
|
6246
6761
|
* Pause/Steer interruption row.
|
|
6247
6762
|
*/
|
|
6248
|
-
export
|
|
6763
|
+
export type MarkSessionAttemptQuiescedInput = {
|
|
6249
6764
|
accountId?: string;
|
|
6250
6765
|
workspaceId: string;
|
|
6251
6766
|
sessionId: string;
|
|
@@ -6260,7 +6775,19 @@ export declare function markSessionAttemptQuiesced(db: Database, input: {
|
|
|
6260
6775
|
* admission remains strict because only a durable interruption needs this
|
|
6261
6776
|
* receipt. */
|
|
6262
6777
|
allowUninterrupted?: boolean;
|
|
6263
|
-
}
|
|
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[]>;
|
|
6264
6791
|
export type ReconcileSessionAttemptQuiescenceResult = {
|
|
6265
6792
|
action: "quiesced";
|
|
6266
6793
|
events: SessionEvent[];
|
|
@@ -6735,7 +7262,7 @@ export declare function addSessionSystemUpdate(db: Database, input: AddSessionSy
|
|
|
6735
7262
|
* Persist one internal update without fabricating a user prompt or queue row.
|
|
6736
7263
|
* Dedupe and any producer/outbox mutation commit in the same transaction.
|
|
6737
7264
|
*/
|
|
6738
|
-
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>;
|
|
6739
7266
|
export declare function listOutstandingSessionSystemUpdates(db: Database, workspaceId: string, sessionId: string): Promise<SessionSystemUpdate[]>;
|
|
6740
7267
|
/** Internal updates atomically attached when this inference was claimed. */
|
|
6741
7268
|
export declare function listSessionSystemUpdatesForTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionSystemUpdate[]>;
|
|
@@ -6772,6 +7299,46 @@ export declare function appendSessionEventsForTurnAttempt(db: Database, workspac
|
|
|
6772
7299
|
events: SessionEvent[];
|
|
6773
7300
|
accepted: boolean;
|
|
6774
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
|
+
}>;
|
|
6775
7342
|
export declare function appendSessionEventToSandboxGroup(db: Database, workspaceId: string, sandboxGroupId: string, input: AppendEventInput): Promise<SessionEvent[]>;
|
|
6776
7343
|
export declare function appendSessionEventsAndUpdateSession(db: Database, workspaceId: string, sessionId: string, inputs: AppendEventInput[], update: {
|
|
6777
7344
|
resources?: ResourceRef[];
|
|
@@ -6802,7 +7369,14 @@ type LockedSessionUpdateResult = {
|
|
|
6802
7369
|
activeTurnId?: string | null;
|
|
6803
7370
|
};
|
|
6804
7371
|
};
|
|
6805
|
-
|
|
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";
|
|
6806
7380
|
lockParentSession?: boolean;
|
|
6807
7381
|
}): Promise<SessionEvent[]>;
|
|
6808
7382
|
export declare function sessionSubject(workspaceId: string, sessionId: string): string;
|
|
@@ -6810,7 +7384,20 @@ export declare function buildCodexTokenResolver(db: Database, settings: Settings
|
|
|
6810
7384
|
export declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexUsageForAccountCore>;
|
|
6811
7385
|
export declare function fetchCodexRateLimitResetCreditsForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexRateLimitResetCreditsForAccountCore>;
|
|
6812
7386
|
export declare function buildConnectionTokenResolver(db: Database, settings: Settings, deps?: ConnectionBrokerDeps, options?: ConnectionTokenResolverOptions): ReturnType<typeof buildConnectionTokenResolverCore>;
|
|
6813
|
-
export { withCodexTokenDeadline, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun, type CodexCredentialTokens, type CodexRateLimitResetCreditsAccountResult, type CodexTokenDeadlineClock, type CodexTokenDeadlineOptions, } from "./codex-token-resolver";
|
|
6814
|
-
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";
|
|
6815
|
-
export
|
|
6816
|
-
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";
|