@opengeni/db 0.28.9 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attached-browser-devices.d.ts +42 -0
- package/dist/attempt-tool-catalogs.d.ts +16 -0
- package/dist/browser-auth.d.ts +299 -0
- package/dist/browser-downloads.d.ts +51 -0
- package/dist/browser-identities.d.ts +137 -0
- package/dist/browser-sessions.d.ts +354 -0
- package/dist/browser-state-artifacts.d.ts +91 -0
- package/dist/canonical-human-identities.d.ts +48 -0
- package/dist/canonical-human-identities.js +28 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/capability-components.d.ts +37 -0
- package/dist/capability-integrations.d.ts +194 -0
- package/dist/chunk-5KTIEDX7.js +13200 -0
- package/dist/chunk-5KTIEDX7.js.map +1 -0
- package/dist/chunk-CQZ4QSP5.js +995 -0
- package/dist/chunk-CQZ4QSP5.js.map +1 -0
- package/dist/chunk-F32YT7MP.js +117 -0
- package/dist/chunk-F32YT7MP.js.map +1 -0
- package/dist/chunk-JC5QPLUM.js +666 -0
- package/dist/chunk-JC5QPLUM.js.map +1 -0
- package/dist/chunk-P3RE4D2B.js +3535 -0
- package/dist/chunk-P3RE4D2B.js.map +1 -0
- package/dist/chunk-TAUTWOS5.js +259 -0
- package/dist/chunk-TAUTWOS5.js.map +1 -0
- package/dist/chunk-VKLB2ZGI.js +2389 -0
- package/dist/chunk-VKLB2ZGI.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 +57 -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 +1122 -126
- package/dist/index.js +42329 -18407
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +73 -10
- package/dist/integration-bindings.d.ts +70 -0
- package/dist/integration-facets.d.ts +99 -0
- package/dist/interaction-revisions.d.ts +14 -0
- package/dist/interaction-schema.d.ts +6036 -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 +19 -6
- package/dist/schema.d.ts +22654 -9359
- package/dist/schema.js +209 -3
- package/dist/scoped-knowledge.d.ts +97 -1
- package/dist/session-control.d.ts +33 -7
- 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-tenancy.d.ts +44 -0
- package/dist/session-tenancy.js +16 -0
- package/dist/session-tenancy.js.map +1 -0
- package/dist/session-tool-call-settlement.d.ts +1 -1
- package/dist/slack-task-policy-schema.d.ts +847 -0
- package/dist/slack-task-policy.d.ts +65 -0
- package/dist/slack-user-link-access.d.ts +54 -0
- package/dist/task-notes-schema.d.ts +924 -0
- package/dist/task-notes.d.ts +85 -0
- package/dist/transcription-recordings.d.ts +2 -2
- package/dist/turn-initiator.d.ts +2 -2
- package/dist/video-generation.d.ts +225 -0
- package/dist/video-generation.js +68 -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/dist/xai-subscription.d.ts +326 -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_browser_state_transfer_hardening.sql +560 -0
- package/drizzle/0212_slack_installation_bindings.sql +348 -0
- package/drizzle/0213_browser_interaction_authority.sql +67 -0
- package/drizzle/0213_slack_user_link_access_requests.sql +177 -0
- package/drizzle/0214_browser_download_saves.sql +34 -0
- package/drizzle/0214_session_activity_commit_gate.sql +262 -0
- package/drizzle/0215_browser_controller_host.sql +385 -0
- package/drizzle/0215_capabilities_platform.sql +980 -0
- package/drizzle/0216_browser_auth_health_evidence.sql +137 -0
- package/drizzle/0216_pack_component_ownership.sql +235 -0
- package/drizzle/0217_capability_definition_delete_authority.sql +32 -0
- package/drizzle/0217_external_browser_auth_operations.sql +22 -0
- package/drizzle/0218_organization_tenancy_foundation.sql +299 -0
- package/drizzle/0219_organization_tenancy_managed_human_provisioning.sql +317 -0
- package/drizzle/0219_site_auth_maintenance_sessions.sql +234 -0
- package/drizzle/0220_memory_slack_append_only_cascade.sql +38 -0
- package/drizzle/0220_session_channels.sql +54 -0
- package/drizzle/0221_sessions_channel_index.sql +5 -0
- package/drizzle/0222_session_visibility_authority_epochs.sql +158 -0
- package/drizzle/0222_sessions_channel_fk.sql +89 -0
- package/drizzle/0223_pending_tool_event_output.sql +55 -0
- package/drizzle/0223_sessions_channel_fk_validate.sql +118 -0
- package/drizzle/0224_slack_post_outcome_reconciliation.sql +123 -0
- package/drizzle/0225_session_visibility_fork_activation.sql +1363 -0
- package/drizzle/0226_personal_codex_authority_foundation.sql +365 -0
- package/drizzle/0227_slack_native_actions.sql +145 -0
- package/drizzle/0228_interaction_controller_data_plane.sql +14 -0
- package/drizzle/0228_slack_task_policy.sql +400 -0
- package/drizzle/0229_slack_inbox_file_fact.sql +10 -0
- package/drizzle/0230_user_scoped_variable_sets_rigs.sql +84 -0
- package/drizzle/0231_integration_definition_identity_cutover.sql +271 -0
- package/drizzle/0232_integration_facet_authority_cutover.sql +610 -0
- package/drizzle/0233_skill_and_integration_authority_cutover.sql +1162 -0
- package/drizzle/0234_xai_subscription_authority.sql +1139 -0
- package/drizzle/0235_canonical_human_login_bindings.sql +920 -0
- package/drizzle/0236_browser_identity_lifecycle.sql +39 -0
- package/drizzle/0236_session_visibility_slack_policy.sql +72 -0
- package/drizzle/0237_interaction_transition_reaper.sql +263 -0
- package/drizzle/0238_goal_persistence_policy.sql +471 -0
- package/drizzle/0238_supergrok_realtime_model.sql +29 -0
- package/drizzle/0239_supergrok_video_funding.sql +50 -0
- package/drizzle/0239_task_tree_notes.sql +990 -0
- package/package.json +26 -5
- package/src/attached-browser-devices.ts +371 -0
- package/src/attempt-tool-catalogs.ts +131 -0
- package/src/browser-auth.ts +4373 -0
- package/src/browser-downloads.ts +517 -0
- package/src/browser-identities.ts +1385 -0
- package/src/browser-sessions.ts +2294 -0
- package/src/browser-state-artifacts.ts +449 -0
- package/src/canonical-human-identities.ts +317 -0
- package/src/capability-components.ts +166 -0
- package/src/capability-integrations.ts +1571 -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 +468 -24
- package/src/editable-artifact-durable-export.ts +1201 -0
- package/src/editable-artifact-materialization.ts +893 -0
- package/src/editable-artifacts-schema.ts +879 -0
- package/src/editable-artifacts.ts +5404 -0
- package/src/generated-images.ts +740 -0
- package/src/index.ts +9963 -1465
- package/src/insights.ts +251 -23
- package/src/integration-bindings.ts +455 -0
- package/src/integration-facets.ts +862 -0
- package/src/interaction-revisions.ts +70 -0
- package/src/interaction-schema.ts +1606 -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 +886 -0
- package/src/persistence-errors.ts +4 -7
- package/src/plugin-packages.ts +1186 -0
- package/src/provision-roles.ts +534 -1
- package/src/runtime-posture-cli.ts +9 -0
- package/src/runtime-posture.ts +721 -5
- package/src/schema.ts +6270 -3159
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +130 -42
- package/src/session-queue-commands.ts +265 -15
- 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-tenancy.ts +188 -0
- package/src/session-tool-call-settlement.ts +18 -3
- package/src/slack-task-policy-schema.ts +130 -0
- package/src/slack-task-policy.ts +341 -0
- package/src/slack-user-link-access.ts +702 -0
- package/src/task-notes-schema.ts +135 -0
- package/src/task-notes.ts +178 -0
- package/src/video-generation.ts +1530 -0
- package/src/workspace-artifacts.ts +1 -1
- package/src/workspace-learning-policy-schema.ts +139 -0
- package/src/workspace-learning-policy.ts +595 -0
- package/src/xai-subscription.ts +1887 -0
- package/dist/chunk-P6CUHXQZ.js +0 -7248
- package/dist/chunk-P6CUHXQZ.js.map +0 -1
- package/dist/chunk-VHBFHMPC.js +0 -1219
- package/dist/chunk-VHBFHMPC.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SessionGoalSnapshot } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, ManagedOrganizationMembershipProjection, 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, SessionGoalChangeKind, SessionGoalCreatedBy, SessionGoalMutationPolicy, SessionGoalRevision, 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, WorkspaceMemoryPromptMode, WorkspaceRegisteredPack, Channel, Rig, RigProviderImage, RigProviderImages, RigVersion, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
|
|
3
|
+
import { RequestHumanInteractionToolInput, XaiProviderAccountAuthoritySnapshotV1, type TimelineAnnotation } from "@opengeni/contracts";
|
|
2
4
|
import { type LatencyMode, SessionSystemUpdatePayload, TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
3
5
|
import { type Settings } from "@opengeni/config";
|
|
4
6
|
import { type CodexFetch } from "@opengeni/codex";
|
|
5
7
|
export { isCodexBilledModel } from "@opengeni/codex";
|
|
6
8
|
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";
|
|
9
|
+
export { frozenInitiatorForCommandActor, type FrozenTurnInitiator } from "./turn-initiator.js";
|
|
10
|
+
export { LOSSLESS_TEXT_PREFIX } from "./lossless-json.js";
|
|
11
|
+
import { type SessionDiscoveryControl, type SessionCommandActor, type SessionTurnAttemptOutcome } from "./session-control.js";
|
|
12
|
+
import { type SessionRealtimeContinuityEntry } from "./session-realtime-context.js";
|
|
13
|
+
import * as schema from "./schema.js";
|
|
12
14
|
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 * from "./
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
export * from "./session-control.js";
|
|
16
|
+
export * from "./session-queue-commands.js";
|
|
17
|
+
export * from "./session-realtime.js";
|
|
18
|
+
export * from "./session-realtime-context.js";
|
|
19
|
+
export * from "./session-realtime-ledger.js";
|
|
20
|
+
export * from "./new-session-drafts.js";
|
|
21
|
+
export * from "./workspace-instruction-policies.js";
|
|
22
|
+
export * from "./company-profile.js";
|
|
23
|
+
export * from "./workspace-learning-policy.js";
|
|
24
|
+
export * from "./slack-task-policy.js";
|
|
25
|
+
export * from "./preference-registry.js";
|
|
26
|
+
export * from "./memory-governance.js";
|
|
27
|
+
export * from "./memory-slack-delivery.js";
|
|
28
|
+
export * from "./scoped-knowledge.js";
|
|
29
|
+
export * from "./knowledge-source-sync.js";
|
|
30
|
+
export * from "./task-notes.js";
|
|
31
|
+
export * from "./generated-images.js";
|
|
32
|
+
export * from "./slack-user-link-access.js";
|
|
33
|
+
export * from "./video-generation.js";
|
|
34
|
+
export * from "./xai-subscription.js";
|
|
35
|
+
export { interruptedToolCallResult } from "./session-tool-call-settlement.js";
|
|
36
|
+
export { decryptEnvironmentValue, encryptEnvironmentValue } from "./environment-crypto.js";
|
|
37
|
+
export { decryptEnvironmentValue as decryptVariableSetValue, encryptEnvironmentValue as encryptVariableSetValue, } from "./environment-crypto.js";
|
|
38
|
+
export * from "./persistence-errors.js";
|
|
39
|
+
export * from "./runtime-posture.js";
|
|
40
|
+
export * from "./capability-integrations.js";
|
|
41
|
+
export * from "./integration-bindings.js";
|
|
42
|
+
export * from "./integration-facets.js";
|
|
43
|
+
export * from "./insights.js";
|
|
44
|
+
export { memoryTextForStorage } from "./memory-domain.js";
|
|
45
|
+
export { migrate, runMigrations } from "./migrate.js";
|
|
46
|
+
export { provisionRoles, type ProvisionResult, type ProvisionRolesOptions, } from "./provision-roles.js";
|
|
47
|
+
export * from "./memory-domain.js";
|
|
48
|
+
import { type Database, type SessionActivityDatabase } from "./database.js";
|
|
49
|
+
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 SessionRlsActorContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type UserLookup, } from "./database.js";
|
|
50
|
+
export { withSessionRlsActorContext } from "./database.js";
|
|
51
|
+
import { buildCodexTokenResolver as buildCodexTokenResolverCore, fetchCodexRateLimitResetCreditsForAccount as fetchCodexRateLimitResetCreditsForAccountCore, fetchCodexUsageForAccount as fetchCodexUsageForAccountCore, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun } from "./codex-token-resolver.js";
|
|
52
|
+
import { buildConnectionTokenResolver as buildConnectionTokenResolverCore, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionTokenResolverOptions } from "./connection-token-resolver.js";
|
|
37
53
|
/** Raised when a durable session tool-policy write lost its version fence. */
|
|
38
54
|
export declare class SessionToolPolicyVersionConflictError extends Error {
|
|
39
55
|
readonly currentVersion: number;
|
|
@@ -235,6 +251,15 @@ export declare function ensureManagedAccessForUser(db: Database, input: {
|
|
|
235
251
|
email: string;
|
|
236
252
|
name: string;
|
|
237
253
|
}): Promise<AccessContext>;
|
|
254
|
+
export type ManagedAccessProvisioningResult = {
|
|
255
|
+
accessContext: AccessContext;
|
|
256
|
+
organizationMemberships: ManagedOrganizationMembershipProjection[];
|
|
257
|
+
};
|
|
258
|
+
export declare function ensureManagedAccessForUserWithOrganizationMemberships(db: Database, input: {
|
|
259
|
+
userId: string;
|
|
260
|
+
email: string;
|
|
261
|
+
name: string;
|
|
262
|
+
}): Promise<ManagedAccessProvisioningResult>;
|
|
238
263
|
export declare function getWorkspace(db: Database, workspaceId: string): Promise<Workspace | null>;
|
|
239
264
|
export declare function getManagedAccount(db: Database, accountId: string): Promise<ManagedAccount | null>;
|
|
240
265
|
export declare function requireWorkspace(db: Database, workspaceId: string): Promise<Workspace>;
|
|
@@ -287,6 +312,49 @@ export declare function removeWorkspaceMember(db: Database, workspaceId: string,
|
|
|
287
312
|
*/
|
|
288
313
|
export declare function getManagedUserByEmail(db: Database, email: string): Promise<string | null>;
|
|
289
314
|
export declare function deleteWorkspace(db: Database, workspaceId: string): Promise<void>;
|
|
315
|
+
export type TemporalScheduleCleanupClaim = {
|
|
316
|
+
id: string;
|
|
317
|
+
accountId: string;
|
|
318
|
+
workspaceId: string;
|
|
319
|
+
temporalScheduleId: string;
|
|
320
|
+
claimId: string;
|
|
321
|
+
attemptCount: number;
|
|
322
|
+
};
|
|
323
|
+
export type DeleteWorkspaceIfQuiescentResult = {
|
|
324
|
+
status: "deleted";
|
|
325
|
+
temporalScheduleCleanups: TemporalScheduleCleanupClaim[];
|
|
326
|
+
} | {
|
|
327
|
+
status: "not_found" | "only_workspace" | "active_sessions" | "active_video_generations" | "live_sandboxes";
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Atomically prove a workspace has no live runtime ownership and delete it.
|
|
331
|
+
*
|
|
332
|
+
* The account/workspace parent locks block concurrent child inserts through
|
|
333
|
+
* their foreign-key key-share locks. Existing session and lease rows are then
|
|
334
|
+
* locked before their state is inspected, so a cold lease cannot become live
|
|
335
|
+
* between a preflight count and the cascade. Schedule ids are copied under the
|
|
336
|
+
* same fence and returned for post-commit Temporal cleanup.
|
|
337
|
+
*/
|
|
338
|
+
export declare function deleteWorkspaceIfQuiescent(db: Database, input: {
|
|
339
|
+
accountId: string;
|
|
340
|
+
workspaceId: string;
|
|
341
|
+
}): Promise<DeleteWorkspaceIfQuiescentResult>;
|
|
342
|
+
/** Claim a bounded cross-workspace batch after abandoned claims expire. */
|
|
343
|
+
export declare function claimTemporalScheduleCleanups(db: Database, input: {
|
|
344
|
+
claimId: string;
|
|
345
|
+
limit?: number;
|
|
346
|
+
claimSeconds?: number;
|
|
347
|
+
}): Promise<TemporalScheduleCleanupClaim[]>;
|
|
348
|
+
/**
|
|
349
|
+
* Settle only the exact claimed cleanup. A null error acknowledges the
|
|
350
|
+
* idempotent external deletion and removes the durable receipt; an error
|
|
351
|
+
* releases it with bounded exponential backoff.
|
|
352
|
+
*/
|
|
353
|
+
export declare function settleTemporalScheduleCleanup(db: Database, input: {
|
|
354
|
+
id: string;
|
|
355
|
+
claimId: string;
|
|
356
|
+
error?: string | null;
|
|
357
|
+
}): Promise<boolean>;
|
|
290
358
|
export declare function createApiKey(db: Database, input: {
|
|
291
359
|
accountId: string;
|
|
292
360
|
workspaceId?: string | null;
|
|
@@ -419,6 +487,8 @@ export type ModelCallFact = {
|
|
|
419
487
|
reasoningTokens: number | null;
|
|
420
488
|
totalTokens: number | null;
|
|
421
489
|
pricedCostMicros: number;
|
|
490
|
+
estimatedProviderCostMicros: number | null;
|
|
491
|
+
pricingSource: "configured_list_price" | "gateway_reported" | null;
|
|
422
492
|
occurredAt: Date;
|
|
423
493
|
recordedAt: Date;
|
|
424
494
|
};
|
|
@@ -438,6 +508,8 @@ export declare function recordModelCallFact(db: Database, input: {
|
|
|
438
508
|
model: string;
|
|
439
509
|
billingPath: ModelCallBillingPath;
|
|
440
510
|
pricedCostMicros: number;
|
|
511
|
+
estimatedProviderCostMicros?: number | null;
|
|
512
|
+
pricingSource?: "configured_list_price" | "gateway_reported" | null;
|
|
441
513
|
inputTokens?: number | null;
|
|
442
514
|
outputTokens?: number | null;
|
|
443
515
|
cachedTokens?: number | null;
|
|
@@ -534,11 +606,13 @@ export type CreateScheduledTaskInput = {
|
|
|
534
606
|
temporalScheduleId: string;
|
|
535
607
|
runMode: ScheduledTaskRunMode;
|
|
536
608
|
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
609
|
+
action?: ScheduledTaskAction;
|
|
537
610
|
agentConfig: ScheduledTaskAgentConfig;
|
|
538
611
|
createdBy?: TurnInitiator;
|
|
539
612
|
createdByContext?: TurnInitiatorContext;
|
|
540
613
|
createdByActor?: AgentSessionCreationActor | null;
|
|
541
614
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
615
|
+
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
542
616
|
targetSessionId?: string | null;
|
|
543
617
|
variableSetId?: string | null;
|
|
544
618
|
rigId?: string | null;
|
|
@@ -550,6 +624,7 @@ export type UpdateScheduledTaskInput = Partial<{
|
|
|
550
624
|
schedule: ScheduledTaskScheduleSpec;
|
|
551
625
|
runMode: ScheduledTaskRunMode;
|
|
552
626
|
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
627
|
+
action: ScheduledTaskAction;
|
|
553
628
|
agentConfig: ScheduledTaskAgentConfig;
|
|
554
629
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
555
630
|
reusableSessionId: string | null;
|
|
@@ -562,6 +637,11 @@ export type CreatePackInstallationInput = {
|
|
|
562
637
|
accountId: string;
|
|
563
638
|
workspaceId: string;
|
|
564
639
|
packId: string;
|
|
640
|
+
status?: PackInstallationStatus;
|
|
641
|
+
manifestSnapshot?: CapabilityPack | null;
|
|
642
|
+
manifestDigest?: string | null;
|
|
643
|
+
selectedRigId?: string | null;
|
|
644
|
+
installedBySubjectId?: string | null;
|
|
565
645
|
metadata?: Record<string, unknown>;
|
|
566
646
|
};
|
|
567
647
|
export type RegisterWorkspacePackInput = {
|
|
@@ -691,6 +771,14 @@ export type UpdateConnectionInput = {
|
|
|
691
771
|
metadata?: Record<string, unknown>;
|
|
692
772
|
updatedBySubjectId?: string | null;
|
|
693
773
|
};
|
|
774
|
+
export type PersistProviderOAuthConnectionInput = CreateConnectionInput & {
|
|
775
|
+
visibleToSubjectId: string;
|
|
776
|
+
credentialRole: string;
|
|
777
|
+
providerFamily: string;
|
|
778
|
+
providerPrincipalId: string;
|
|
779
|
+
requestedConnectionId?: string;
|
|
780
|
+
requestedConnectionVersion?: number;
|
|
781
|
+
};
|
|
694
782
|
export type UpdateSlackBotDocumentDestinationInput = {
|
|
695
783
|
accountId: string;
|
|
696
784
|
workspaceId: string;
|
|
@@ -744,9 +832,10 @@ export type SlackBotPostOperation = {
|
|
|
744
832
|
targetKind: "channel" | "user";
|
|
745
833
|
targetId: string;
|
|
746
834
|
requestDigest: string;
|
|
747
|
-
status: "provider_started" | "completed";
|
|
835
|
+
status: "pending" | "provider_started" | "outcome_unknown" | "completed";
|
|
748
836
|
claimHolderId: string | null;
|
|
749
837
|
claimExpiresAt: Date | null;
|
|
838
|
+
claimMode: "send" | "reconcile" | null;
|
|
750
839
|
attemptCount: number;
|
|
751
840
|
lastFailureCode: string | null;
|
|
752
841
|
slackChannelId: string | null;
|
|
@@ -755,6 +844,24 @@ export type SlackBotPostOperation = {
|
|
|
755
844
|
createdAt: Date;
|
|
756
845
|
updatedAt: Date;
|
|
757
846
|
};
|
|
847
|
+
export type SlackBotUpdateOperation = {
|
|
848
|
+
id: string;
|
|
849
|
+
accountId: string;
|
|
850
|
+
workspaceId: string;
|
|
851
|
+
connectionId: string;
|
|
852
|
+
operationId: string;
|
|
853
|
+
slackChannelId: string;
|
|
854
|
+
slackMessageTimestamp: string;
|
|
855
|
+
requestDigest: string;
|
|
856
|
+
status: "provider_started" | "completed";
|
|
857
|
+
claimHolderId: string | null;
|
|
858
|
+
claimExpiresAt: Date | null;
|
|
859
|
+
attemptCount: number;
|
|
860
|
+
lastFailureCode: string | null;
|
|
861
|
+
completedAt: Date | null;
|
|
862
|
+
createdAt: Date;
|
|
863
|
+
updatedAt: Date;
|
|
864
|
+
};
|
|
758
865
|
export type SlackBotDeleteOperation = {
|
|
759
866
|
id: string;
|
|
760
867
|
accountId: string;
|
|
@@ -824,7 +931,7 @@ export type CreateCapabilityCatalogItemInput = {
|
|
|
824
931
|
accountId: string;
|
|
825
932
|
workspaceId: string;
|
|
826
933
|
id: string;
|
|
827
|
-
kind:
|
|
934
|
+
kind: "mcp";
|
|
828
935
|
source: CapabilitySource;
|
|
829
936
|
name: string;
|
|
830
937
|
description?: string | null;
|
|
@@ -899,10 +1006,122 @@ export type EnableCapabilityInstallationInput = {
|
|
|
899
1006
|
accountId: string;
|
|
900
1007
|
workspaceId: string;
|
|
901
1008
|
capabilityId: string;
|
|
902
|
-
kind:
|
|
1009
|
+
kind: "mcp";
|
|
903
1010
|
config?: Record<string, unknown>;
|
|
904
1011
|
metadata?: Record<string, unknown>;
|
|
905
1012
|
};
|
|
1013
|
+
export type InstallPortableSkillInput = {
|
|
1014
|
+
accountId: string;
|
|
1015
|
+
workspaceId: string;
|
|
1016
|
+
subjectId: string;
|
|
1017
|
+
capabilityId: string;
|
|
1018
|
+
pluginKey: string;
|
|
1019
|
+
source: "library" | "github" | "skills_sh" | "pack";
|
|
1020
|
+
sourceUrl: string;
|
|
1021
|
+
repositoryUrl: string;
|
|
1022
|
+
version?: string;
|
|
1023
|
+
sourceCommit: string;
|
|
1024
|
+
sourcePath: string;
|
|
1025
|
+
name: string;
|
|
1026
|
+
description: string;
|
|
1027
|
+
category?: string;
|
|
1028
|
+
tags?: string[];
|
|
1029
|
+
provenance?: "platform" | "deployment" | "registry" | "workspace";
|
|
1030
|
+
sourceProvenance?: string;
|
|
1031
|
+
contentSha256: string;
|
|
1032
|
+
totalBytes: number;
|
|
1033
|
+
license?: string | null;
|
|
1034
|
+
files: Array<{
|
|
1035
|
+
path: string;
|
|
1036
|
+
content: string;
|
|
1037
|
+
byteSize: number;
|
|
1038
|
+
contentSha256: string;
|
|
1039
|
+
}>;
|
|
1040
|
+
owner?: PortableSkillOwner;
|
|
1041
|
+
expectedInstallationVersion?: number;
|
|
1042
|
+
};
|
|
1043
|
+
export type InstalledPortableSkill = {
|
|
1044
|
+
created: boolean;
|
|
1045
|
+
capabilityId: string;
|
|
1046
|
+
pluginId: string;
|
|
1047
|
+
pluginVersionId: string;
|
|
1048
|
+
facetId: string;
|
|
1049
|
+
pluginInstallationId: string;
|
|
1050
|
+
facetInstallationId: string;
|
|
1051
|
+
installationVersion: number;
|
|
1052
|
+
source: "library" | "github" | "skills_sh" | "pack";
|
|
1053
|
+
version: string;
|
|
1054
|
+
sourceUrl: string;
|
|
1055
|
+
sourceCommit: string;
|
|
1056
|
+
contentSha256: string;
|
|
1057
|
+
name: string;
|
|
1058
|
+
};
|
|
1059
|
+
export type PortableSkillRuntime = {
|
|
1060
|
+
capabilityId: string;
|
|
1061
|
+
source: "library" | "github" | "skills_sh" | "pack";
|
|
1062
|
+
version: string;
|
|
1063
|
+
name: string;
|
|
1064
|
+
description: string;
|
|
1065
|
+
sourceUrl: string;
|
|
1066
|
+
sourceCommit: string;
|
|
1067
|
+
sourcePath: string;
|
|
1068
|
+
contentSha256: string;
|
|
1069
|
+
files: Array<{
|
|
1070
|
+
path: string;
|
|
1071
|
+
content: string;
|
|
1072
|
+
}>;
|
|
1073
|
+
};
|
|
1074
|
+
export type InstalledSkillSummary = {
|
|
1075
|
+
capabilityId: string;
|
|
1076
|
+
pluginKey: string;
|
|
1077
|
+
installationVersion: number;
|
|
1078
|
+
name: string;
|
|
1079
|
+
description: string;
|
|
1080
|
+
category: string;
|
|
1081
|
+
tags: string[];
|
|
1082
|
+
provenance: string;
|
|
1083
|
+
source: "library" | "github" | "skills_sh" | "pack";
|
|
1084
|
+
version: string;
|
|
1085
|
+
sourceUrl: string;
|
|
1086
|
+
repositoryUrl: string;
|
|
1087
|
+
sourceCommit: string;
|
|
1088
|
+
sourcePath: string;
|
|
1089
|
+
contentSha256: string;
|
|
1090
|
+
fileCount: number;
|
|
1091
|
+
totalBytes: number;
|
|
1092
|
+
license: string | null;
|
|
1093
|
+
installedAt: string;
|
|
1094
|
+
updatedAt: string;
|
|
1095
|
+
owners: PortableSkillOwner[];
|
|
1096
|
+
};
|
|
1097
|
+
export type PortableSkillOwner = {
|
|
1098
|
+
kind: "direct" | "plugin" | "pack" | "migration";
|
|
1099
|
+
id: string;
|
|
1100
|
+
removable: boolean;
|
|
1101
|
+
};
|
|
1102
|
+
export type PortableSkillUninstallPreview = {
|
|
1103
|
+
capabilityId: string;
|
|
1104
|
+
installed: boolean;
|
|
1105
|
+
installationVersion: number | null;
|
|
1106
|
+
directOwner: PortableSkillOwner | null;
|
|
1107
|
+
remainingOwners: PortableSkillOwner[];
|
|
1108
|
+
removesRuntimeSkill: boolean;
|
|
1109
|
+
};
|
|
1110
|
+
export type UninstallPortableSkillResult = {
|
|
1111
|
+
capabilityId: string;
|
|
1112
|
+
status: "not_installed" | "uninstalled" | "retained_by_other_owners";
|
|
1113
|
+
remainingOwners: PortableSkillOwner[];
|
|
1114
|
+
};
|
|
1115
|
+
export declare class PortableSkillInstallationVersionConflictError extends Error {
|
|
1116
|
+
readonly capabilityId: string;
|
|
1117
|
+
readonly expectedVersion: number;
|
|
1118
|
+
readonly actualVersion: number;
|
|
1119
|
+
readonly name = "PortableSkillInstallationVersionConflictError";
|
|
1120
|
+
constructor(capabilityId: string, expectedVersion: number, actualVersion: number);
|
|
1121
|
+
}
|
|
1122
|
+
export declare class PortableSkillInstallationVersionRequiredError extends Error {
|
|
1123
|
+
readonly name = "PortableSkillInstallationVersionRequiredError";
|
|
1124
|
+
}
|
|
906
1125
|
export type EnabledMcpCapabilityServer = {
|
|
907
1126
|
capabilityId: string;
|
|
908
1127
|
id: string;
|
|
@@ -911,6 +1130,7 @@ export type EnabledMcpCapabilityServer = {
|
|
|
911
1130
|
allowedTools?: string[];
|
|
912
1131
|
timeoutMs?: number;
|
|
913
1132
|
cacheToolsList?: boolean;
|
|
1133
|
+
requireApproval?: SessionMcpApprovalPolicy;
|
|
914
1134
|
/**
|
|
915
1135
|
* Credential request headers stored encrypted at enable time
|
|
916
1136
|
* (AES-256-GCM under the workspace-variableSets key). Decrypted only at
|
|
@@ -972,6 +1192,7 @@ export type EnqueueSessionTurnInput = {
|
|
|
972
1192
|
initiator: TurnInitiator;
|
|
973
1193
|
initiatorContext?: TurnInitiatorContext;
|
|
974
1194
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
1195
|
+
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
975
1196
|
/** Steer inserts before all waiting prompts; Send appends after them. */
|
|
976
1197
|
placement?: "head" | "tail";
|
|
977
1198
|
};
|
|
@@ -982,6 +1203,10 @@ export type EnqueueSessionTurnInput = {
|
|
|
982
1203
|
export type SessionTurnForExecution = SessionTurn & {
|
|
983
1204
|
turnInstructions: string | null;
|
|
984
1205
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
1206
|
+
/** Worker-only causal authority; never inferred from the current worker. */
|
|
1207
|
+
initiatingHumanSubjectId: string | null;
|
|
1208
|
+
xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
1209
|
+
goalSnapshot: SessionGoalSnapshot;
|
|
985
1210
|
};
|
|
986
1211
|
export declare function createFileUpload(db: Database, input: {
|
|
987
1212
|
accountId: string;
|
|
@@ -1000,12 +1225,36 @@ export declare function createFileUpload(db: Database, input: {
|
|
|
1000
1225
|
uploadId: string;
|
|
1001
1226
|
expiresAt: string;
|
|
1002
1227
|
}>;
|
|
1228
|
+
export type PrepareGeneratedWorkspaceFileInput = {
|
|
1229
|
+
accountId: string;
|
|
1230
|
+
workspaceId: string;
|
|
1231
|
+
fileId: string;
|
|
1232
|
+
uploadId: string;
|
|
1233
|
+
filename: string;
|
|
1234
|
+
safeFilename: string;
|
|
1235
|
+
contentType: string;
|
|
1236
|
+
sizeBytes: number;
|
|
1237
|
+
sha256: string;
|
|
1238
|
+
bucket: string;
|
|
1239
|
+
objectKey: string;
|
|
1240
|
+
expiresAt: Date;
|
|
1241
|
+
};
|
|
1242
|
+
/**
|
|
1243
|
+
* Prepare one deterministic upload intent for a generated workspace file.
|
|
1244
|
+
* Retries return the same pending/ready file only when every immutable byte and
|
|
1245
|
+
* storage fact matches; identity reuse with different content fails closed.
|
|
1246
|
+
*/
|
|
1247
|
+
export declare function prepareGeneratedWorkspaceFile(db: Database, input: PrepareGeneratedWorkspaceFileInput): Promise<{
|
|
1248
|
+
file: FileAsset;
|
|
1249
|
+
uploadId: string;
|
|
1250
|
+
created: boolean;
|
|
1251
|
+
}>;
|
|
1003
1252
|
export declare function getFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset | null>;
|
|
1004
1253
|
export declare function requireFile(db: Database, workspaceId: string, fileId: string): Promise<FileAsset>;
|
|
1005
1254
|
/** One RLS-scoped query for all attachment metadata needed by a model turn. */
|
|
1006
1255
|
export declare function getFiles(db: Database, workspaceId: string, fileIds: readonly string[]): Promise<FileAsset[]>;
|
|
1007
1256
|
/** 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>;
|
|
1257
|
+
export declare function durableUserHistoryItem(prompt: string, resources: readonly ResourceRef[], annotations?: readonly TimelineAnnotation[]): Record<string, unknown>;
|
|
1009
1258
|
export type RetainedFileArtifact = {
|
|
1010
1259
|
file: FileAsset;
|
|
1011
1260
|
uploadStatus: FileUploadStatus | null;
|
|
@@ -1063,7 +1312,7 @@ export type PrepareRetainedScreenshotArtifactInput = {
|
|
|
1063
1312
|
settlementKey: string;
|
|
1064
1313
|
toolCallId: string;
|
|
1065
1314
|
toolOutputId: string;
|
|
1066
|
-
mediaType: "image/png";
|
|
1315
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
1067
1316
|
sizeBytes: number;
|
|
1068
1317
|
sha256: string;
|
|
1069
1318
|
width: number;
|
|
@@ -1237,6 +1486,24 @@ export declare function markStaleRegistryCatalogItems(db: Database, activeKeys:
|
|
|
1237
1486
|
export declare function upsertCapabilityCatalogItem(db: Database, input: CreateCapabilityCatalogItemInput): Promise<CapabilityCatalogItem>;
|
|
1238
1487
|
export declare function listCapabilityCatalogItems(db: Database, workspaceId: string): Promise<CapabilityCatalogItem[]>;
|
|
1239
1488
|
export declare function getCapabilityCatalogItem(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityCatalogItem | null>;
|
|
1489
|
+
/**
|
|
1490
|
+
* Install one immutable, already-validated Skill through the authoritative
|
|
1491
|
+
* Plugin/Skill-Facet ownership model. Repeating the same exact source is
|
|
1492
|
+
* idempotent; changing a commit's content fails instead of silently rewriting
|
|
1493
|
+
* immutable history.
|
|
1494
|
+
*/
|
|
1495
|
+
export declare function installPortableSkill(db: Database, input: InstallPortableSkillInput): Promise<InstalledPortableSkill>;
|
|
1496
|
+
/** Return exact text artifacts for active authoritative Skill installations. */
|
|
1497
|
+
export declare function listInstalledPortableSkills(db: Database, workspaceId: string): Promise<PortableSkillRuntime[]>;
|
|
1498
|
+
/** Return secret-free lifecycle summaries from the authoritative Skill ledger. */
|
|
1499
|
+
export declare function listInstalledSkills(db: Database, workspaceId: string): Promise<InstalledSkillSummary[]>;
|
|
1500
|
+
export declare function getPortableSkillUninstallPreview(db: Database, workspaceId: string, capabilityId: string): Promise<PortableSkillUninstallPreview>;
|
|
1501
|
+
export declare function uninstallPortableSkill(db: Database, input: {
|
|
1502
|
+
accountId: string;
|
|
1503
|
+
workspaceId: string;
|
|
1504
|
+
capabilityId: string;
|
|
1505
|
+
expectedInstallationVersion: number;
|
|
1506
|
+
}): Promise<UninstallPortableSkillResult>;
|
|
1240
1507
|
export declare function enableCapabilityInstallation(db: Database, input: EnableCapabilityInstallationInput): Promise<CapabilityInstallation>;
|
|
1241
1508
|
export declare function disableCapabilityInstallation(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityInstallation>;
|
|
1242
1509
|
export declare function listCapabilityInstallations(db: Database, workspaceId: string): Promise<CapabilityInstallation[]>;
|
|
@@ -1258,6 +1525,12 @@ export declare function decryptedCapabilityHeaders(server: EnabledMcpCapabilityS
|
|
|
1258
1525
|
export declare function getStoredCapabilityHeaderCiphertext(db: Database, workspaceId: string, capabilityId: string): Promise<Record<string, string> | null>;
|
|
1259
1526
|
export declare function mcpServerIdForCapability(capabilityId: string, metadata?: Record<string, unknown>): string;
|
|
1260
1527
|
export declare function createConnection(db: Database, input: CreateConnectionInput): Promise<ConnectionMetadataWithVerification>;
|
|
1528
|
+
/**
|
|
1529
|
+
* Serialize one provider-principal/owner connection generation. Distinct OAuth
|
|
1530
|
+
* starts for the same principal converge on one row, while an explicit
|
|
1531
|
+
* reconnect remains fenced to the exact Connection version captured in state.
|
|
1532
|
+
*/
|
|
1533
|
+
export declare function persistProviderOAuthConnection(db: Database, input: PersistProviderOAuthConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
1261
1534
|
export declare function listConnectionsMetadata(db: Database, workspaceId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification[]>;
|
|
1262
1535
|
export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
|
|
1263
1536
|
export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
|
|
@@ -1290,6 +1563,14 @@ export type SlackInstallationRoute = {
|
|
|
1290
1563
|
botId: string;
|
|
1291
1564
|
botUserId: string;
|
|
1292
1565
|
};
|
|
1566
|
+
export declare class SlackInstallationBindingConflictError extends Error {
|
|
1567
|
+
readonly reason: "conflicting_workspace" | "conflicting_principal" | "legacy_quarantine" | "stale_reinstall";
|
|
1568
|
+
constructor(reason: "conflicting_workspace" | "conflicting_principal" | "legacy_quarantine" | "stale_reinstall");
|
|
1569
|
+
}
|
|
1570
|
+
export declare function listSlackInstallationBindings(db: Database, input: {
|
|
1571
|
+
accountId: string;
|
|
1572
|
+
workspaceId: string;
|
|
1573
|
+
}): Promise<SlackInstallationBinding[]>;
|
|
1293
1574
|
export type SlackBotUserLink = {
|
|
1294
1575
|
id: string;
|
|
1295
1576
|
accountId: string;
|
|
@@ -1302,7 +1583,7 @@ export type SlackBotUserLink = {
|
|
|
1302
1583
|
createdAt: Date;
|
|
1303
1584
|
updatedAt: Date;
|
|
1304
1585
|
};
|
|
1305
|
-
export type SlackInteractionTriggerKind = "app_mention" | "dm" | "reaction" | "slash_command" | "message_shortcut" | "thread_reply";
|
|
1586
|
+
export type SlackInteractionTriggerKind = "app_mention" | "dm" | "reaction" | "slash_command" | "message_shortcut" | "thread_reply" | "block_action";
|
|
1306
1587
|
export type SlackInteractionInboxEntry = {
|
|
1307
1588
|
id: string;
|
|
1308
1589
|
accountId: string;
|
|
@@ -1317,6 +1598,7 @@ export type SlackInteractionInboxEntry = {
|
|
|
1317
1598
|
slackThreadTs: string | null;
|
|
1318
1599
|
triggerKind: SlackInteractionTriggerKind;
|
|
1319
1600
|
text: string;
|
|
1601
|
+
hasFiles: boolean;
|
|
1320
1602
|
status: "pending" | "processing" | "processed" | "failed";
|
|
1321
1603
|
claimHolderId: string | null;
|
|
1322
1604
|
claimExpiresAt: Date | null;
|
|
@@ -1338,6 +1620,7 @@ export type SlackInteraction = {
|
|
|
1338
1620
|
slackThreadTs: string;
|
|
1339
1621
|
routeKey: string;
|
|
1340
1622
|
triggeringProviderEventId: string;
|
|
1623
|
+
initiatingSlackUserId: string | null;
|
|
1341
1624
|
owningSubjectId: string;
|
|
1342
1625
|
visibility: "private" | "workspace";
|
|
1343
1626
|
sessionReservationId: string;
|
|
@@ -1364,6 +1647,29 @@ export type SlackInteractionProgressDelivery = {
|
|
|
1364
1647
|
operationId: string;
|
|
1365
1648
|
createdAt: Date;
|
|
1366
1649
|
};
|
|
1650
|
+
export type SlackInteractionActionKind = "approval_approve" | "approval_reject" | "human_input_select" | "human_input_skip" | "session_status" | "session_pause" | "session_resume" | "shared_result_publish";
|
|
1651
|
+
export type SlackInteractionActionHandle = {
|
|
1652
|
+
id: string;
|
|
1653
|
+
accountId: string;
|
|
1654
|
+
workspaceId: string;
|
|
1655
|
+
connectionId: string;
|
|
1656
|
+
interactionId: string;
|
|
1657
|
+
sessionId: string;
|
|
1658
|
+
sessionEventSequence: number;
|
|
1659
|
+
actionKind: SlackInteractionActionKind;
|
|
1660
|
+
actionKey: string;
|
|
1661
|
+
targetId: string | null;
|
|
1662
|
+
targetValue: string | null;
|
|
1663
|
+
authorizedSubjectId: string;
|
|
1664
|
+
authorizedSlackUserId: string;
|
|
1665
|
+
messageOperationId: string;
|
|
1666
|
+
status: "pending" | "completed" | "stale";
|
|
1667
|
+
result: string | null;
|
|
1668
|
+
expiresAt: Date;
|
|
1669
|
+
completedAt: Date | null;
|
|
1670
|
+
createdAt: Date;
|
|
1671
|
+
updatedAt: Date;
|
|
1672
|
+
};
|
|
1367
1673
|
export declare function resolveSlackInstallationRoute(db: Database, slackTeamId: string): Promise<SlackInstallationRoute | null>;
|
|
1368
1674
|
export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt">): Promise<SlackBotUserLink>;
|
|
1369
1675
|
export declare function getSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<SlackBotUserLink | null>;
|
|
@@ -1390,11 +1696,42 @@ export declare function releaseSlackInteractionInbox(db: Database, input: {
|
|
|
1390
1696
|
errorCode: string;
|
|
1391
1697
|
retryAt: Date;
|
|
1392
1698
|
}): Promise<boolean>;
|
|
1393
|
-
export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt">
|
|
1699
|
+
export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "initiatingSlackUserId" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt"> & {
|
|
1700
|
+
initiatingSlackUserId?: string | null;
|
|
1701
|
+
}): Promise<{
|
|
1394
1702
|
created: boolean;
|
|
1395
1703
|
interaction: SlackInteraction;
|
|
1396
1704
|
}>;
|
|
1397
1705
|
export declare function getSlackInteractionByRoute(db: Database, workspaceId: string, connectionId: string, routeKey: string): Promise<SlackInteraction | null>;
|
|
1706
|
+
export declare function getSlackInteractionById(db: Database, input: {
|
|
1707
|
+
accountId: string;
|
|
1708
|
+
workspaceId: string;
|
|
1709
|
+
interactionId: string;
|
|
1710
|
+
}): Promise<SlackInteraction | null>;
|
|
1711
|
+
export declare function reserveSlackInteractionActionHandles(db: Database, input: {
|
|
1712
|
+
interaction: Pick<SlackInteraction, "id" | "accountId" | "workspaceId" | "connectionId" | "sessionId" | "owningSubjectId" | "initiatingSlackUserId">;
|
|
1713
|
+
sessionEventSequence: number;
|
|
1714
|
+
messageOperationId: string;
|
|
1715
|
+
expiresAt: Date;
|
|
1716
|
+
actions: Array<{
|
|
1717
|
+
actionKind: SlackInteractionActionKind;
|
|
1718
|
+
actionKey: string;
|
|
1719
|
+
targetId?: string | null;
|
|
1720
|
+
targetValue?: string | null;
|
|
1721
|
+
}>;
|
|
1722
|
+
}): Promise<SlackInteractionActionHandle[]>;
|
|
1723
|
+
export declare function getSlackInteractionActionHandle(db: Database, input: {
|
|
1724
|
+
accountId: string;
|
|
1725
|
+
workspaceId: string;
|
|
1726
|
+
handleId: string;
|
|
1727
|
+
}): Promise<SlackInteractionActionHandle | null>;
|
|
1728
|
+
export declare function settleSlackInteractionActionHandles(db: Database, input: {
|
|
1729
|
+
accountId: string;
|
|
1730
|
+
workspaceId: string;
|
|
1731
|
+
handleId: string;
|
|
1732
|
+
result: string;
|
|
1733
|
+
stale?: boolean;
|
|
1734
|
+
}): Promise<SlackInteractionActionHandle | null>;
|
|
1398
1735
|
/**
|
|
1399
1736
|
* Resolve an already-durable Slack task to its canonical interaction.
|
|
1400
1737
|
*
|
|
@@ -1431,6 +1768,24 @@ export type SlackInteractionProgressClaim = {
|
|
|
1431
1768
|
} | {
|
|
1432
1769
|
kind: "not_owned";
|
|
1433
1770
|
};
|
|
1771
|
+
export type SlackInteractionProgressDeliveryEvidence = {
|
|
1772
|
+
sessionEventSequence: number;
|
|
1773
|
+
operationId: string;
|
|
1774
|
+
text: string;
|
|
1775
|
+
turnId: string | null;
|
|
1776
|
+
};
|
|
1777
|
+
/**
|
|
1778
|
+
* Read the at-most-three durable progress identities for terminal-delivery
|
|
1779
|
+
* reconciliation. A reserved operation may still be provider-started after a
|
|
1780
|
+
* response loss, so callers must retry the same operation id rather than
|
|
1781
|
+
* inventing a second final post.
|
|
1782
|
+
*/
|
|
1783
|
+
export declare function listSlackInteractionProgressDeliveryEvidence(db: Database, input: {
|
|
1784
|
+
accountId: string;
|
|
1785
|
+
workspaceId: string;
|
|
1786
|
+
interactionId: string;
|
|
1787
|
+
sessionId: string;
|
|
1788
|
+
}): Promise<SlackInteractionProgressDeliveryEvidence[]>;
|
|
1434
1789
|
/**
|
|
1435
1790
|
* Reserve one globally bounded progress slot before any Slack provider call.
|
|
1436
1791
|
* The interaction row lock serializes replicas and expired delivery claim
|
|
@@ -1483,6 +1838,20 @@ type SlackBotLifecycleSuccessAuditInput = {
|
|
|
1483
1838
|
credentialLabel: string;
|
|
1484
1839
|
slackTeamId: string;
|
|
1485
1840
|
};
|
|
1841
|
+
export type PersistSlackBotInstallationInput = SlackBotLifecycleSuccessAuditInput & {
|
|
1842
|
+
requestedConnectionId?: string;
|
|
1843
|
+
requestedConnectionVersion?: number;
|
|
1844
|
+
credentialEncrypted: string;
|
|
1845
|
+
grantedScopes: string[];
|
|
1846
|
+
verifiedInstallAt: Date;
|
|
1847
|
+
metadata: Record<string, unknown> & {
|
|
1848
|
+
slackTeamId: string;
|
|
1849
|
+
slackTeamName: string;
|
|
1850
|
+
botId: string;
|
|
1851
|
+
botUserId: string;
|
|
1852
|
+
};
|
|
1853
|
+
};
|
|
1854
|
+
export declare function persistSlackBotInstallationWithSuccessAudit(db: Database, input: PersistSlackBotInstallationInput): Promise<ConnectionMetadataWithVerification>;
|
|
1486
1855
|
export declare function createConnectionWithSlackBotSuccessAudit(db: Database, input: SlackBotLifecycleSuccessAuditInput & {
|
|
1487
1856
|
connection: CreateConnectionInput;
|
|
1488
1857
|
}): Promise<ConnectionMetadataWithVerification>;
|
|
@@ -1505,7 +1874,7 @@ export declare function recordSlackBotInstallCallbackFailure(db: Database, input
|
|
|
1505
1874
|
reason: SlackBotInstallCallbackFailureReason;
|
|
1506
1875
|
}): Promise<boolean>;
|
|
1507
1876
|
export type ClaimSlackBotPostOperationResult = {
|
|
1508
|
-
kind: "claimed" | "in_progress" | "completed";
|
|
1877
|
+
kind: "claimed" | "reconcile" | "in_progress" | "completed";
|
|
1509
1878
|
operation: SlackBotPostOperation;
|
|
1510
1879
|
} | {
|
|
1511
1880
|
kind: "conflict" | "connection_not_found";
|
|
@@ -1513,8 +1882,8 @@ export type ClaimSlackBotPostOperationResult = {
|
|
|
1513
1882
|
/**
|
|
1514
1883
|
* Claims one durable Slack post identity. The insert occurs before any provider
|
|
1515
1884
|
* call; retries retain the original client_msg_id and immutable request digest.
|
|
1516
|
-
* A live claim suppresses concurrent
|
|
1517
|
-
*
|
|
1885
|
+
* A live claim suppresses concurrent work. An expired provider_started claim is
|
|
1886
|
+
* conservatively converted to outcome_unknown and may only be reconciled.
|
|
1518
1887
|
*/
|
|
1519
1888
|
export declare function claimSlackBotPostOperation(db: Database, input: {
|
|
1520
1889
|
accountId: string;
|
|
@@ -1527,12 +1896,20 @@ export declare function claimSlackBotPostOperation(db: Database, input: {
|
|
|
1527
1896
|
claimHolderId: string;
|
|
1528
1897
|
claimLeaseMs: number;
|
|
1529
1898
|
}): Promise<ClaimSlackBotPostOperationResult>;
|
|
1899
|
+
export declare function markSlackBotPostOperationProviderStarted(db: Database, input: {
|
|
1900
|
+
accountId: string;
|
|
1901
|
+
workspaceId: string;
|
|
1902
|
+
connectionId: string;
|
|
1903
|
+
operationId: string;
|
|
1904
|
+
claimHolderId: string;
|
|
1905
|
+
}): Promise<boolean>;
|
|
1530
1906
|
export declare function releaseSlackBotPostOperationClaim(db: Database, input: {
|
|
1531
1907
|
accountId: string;
|
|
1532
1908
|
workspaceId: string;
|
|
1533
1909
|
connectionId: string;
|
|
1534
1910
|
operationId: string;
|
|
1535
1911
|
claimHolderId: string;
|
|
1912
|
+
outcomeUnknown: boolean;
|
|
1536
1913
|
failureCode: string;
|
|
1537
1914
|
}): Promise<boolean>;
|
|
1538
1915
|
export type CompleteSlackBotPostOperationResult = {
|
|
@@ -1555,6 +1932,40 @@ export declare function completeSlackBotPostOperation(db: Database, input: {
|
|
|
1555
1932
|
auditMetadata: Record<string, unknown>;
|
|
1556
1933
|
}): Promise<CompleteSlackBotPostOperationResult>;
|
|
1557
1934
|
export declare function getSlackBotPostOperation(db: Database, workspaceId: string, connectionId: string, operationId: string): Promise<SlackBotPostOperation | null>;
|
|
1935
|
+
export type ClaimSlackBotUpdateOperationResult = {
|
|
1936
|
+
kind: "claimed" | "in_progress" | "completed";
|
|
1937
|
+
operation: SlackBotUpdateOperation;
|
|
1938
|
+
} | {
|
|
1939
|
+
kind: "conflict" | "connection_not_found";
|
|
1940
|
+
};
|
|
1941
|
+
export declare function claimSlackBotUpdateOperation(db: Database, input: {
|
|
1942
|
+
accountId: string;
|
|
1943
|
+
workspaceId: string;
|
|
1944
|
+
connectionId: string;
|
|
1945
|
+
operationId: string;
|
|
1946
|
+
slackChannelId: string;
|
|
1947
|
+
slackMessageTimestamp: string;
|
|
1948
|
+
requestDigest: string;
|
|
1949
|
+
claimHolderId: string;
|
|
1950
|
+
claimLeaseMs: number;
|
|
1951
|
+
}): Promise<ClaimSlackBotUpdateOperationResult>;
|
|
1952
|
+
export declare function releaseSlackBotUpdateOperationClaim(db: Database, input: {
|
|
1953
|
+
accountId: string;
|
|
1954
|
+
workspaceId: string;
|
|
1955
|
+
connectionId: string;
|
|
1956
|
+
operationId: string;
|
|
1957
|
+
claimHolderId: string;
|
|
1958
|
+
failureCode: string;
|
|
1959
|
+
}): Promise<boolean>;
|
|
1960
|
+
export declare function completeSlackBotUpdateOperation(db: Database, input: {
|
|
1961
|
+
accountId: string;
|
|
1962
|
+
workspaceId: string;
|
|
1963
|
+
connectionId: string;
|
|
1964
|
+
operationId: string;
|
|
1965
|
+
claimHolderId: string;
|
|
1966
|
+
subjectId?: string | null;
|
|
1967
|
+
auditMetadata: Record<string, unknown>;
|
|
1968
|
+
}): Promise<"completed" | "not_found" | "not_owned">;
|
|
1558
1969
|
export type ClaimSlackBotDeleteOperationResult = {
|
|
1559
1970
|
kind: "claimed" | "reconcile" | "in_progress" | "completed";
|
|
1560
1971
|
operation: SlackBotDeleteOperation;
|
|
@@ -1619,8 +2030,25 @@ export declare function loadConnectionCredentialForBroker(db: Database, settings
|
|
|
1619
2030
|
allowSubjectOwned?: boolean;
|
|
1620
2031
|
}): Promise<ConnectionCredentialForBroker | null>;
|
|
1621
2032
|
export declare function workspaceVercelAiGatewayConnectionActive(db: Database, workspaceId: string): Promise<boolean>;
|
|
2033
|
+
/** Metadata-only capability revision input; never selects/decrypts the API key. */
|
|
2034
|
+
export declare function getWorkspaceVercelAiGatewayConnectionMetadata(db: Database, workspaceId: string): Promise<{
|
|
2035
|
+
connectionId: string;
|
|
2036
|
+
version: number;
|
|
2037
|
+
} | null>;
|
|
1622
2038
|
/** Resolve only the reviewed workspace-shared AI Gateway credential shape. */
|
|
1623
2039
|
export declare function loadWorkspaceVercelAiGatewayApiKey(db: Database, settings: Settings, workspaceId: string): Promise<string | null>;
|
|
2040
|
+
/**
|
|
2041
|
+
* Worker-only immutable credential lease for an asynchronous video operation.
|
|
2042
|
+
* The operation copies the already-encrypted credential envelope before its
|
|
2043
|
+
* accepted receipt commits, so a later workspace disconnect cannot strand a
|
|
2044
|
+
* paid provider job. Never expose this return value from an API route.
|
|
2045
|
+
*/
|
|
2046
|
+
export declare function loadWorkspaceVercelAiGatewayCredentialLease(db: Database, settings: Settings, workspaceId: string): Promise<{
|
|
2047
|
+
connectionId: string;
|
|
2048
|
+
version: number;
|
|
2049
|
+
credentialEncrypted: string;
|
|
2050
|
+
apiKey: string;
|
|
2051
|
+
} | null>;
|
|
1624
2052
|
export declare function recordConnectionTokenRefresh(db: Database, input: {
|
|
1625
2053
|
id: string;
|
|
1626
2054
|
version: number;
|
|
@@ -1697,6 +2125,8 @@ export type WorkspaceMemorySearchInput = {
|
|
|
1697
2125
|
kind?: KnowledgeMemoryKind | undefined;
|
|
1698
2126
|
limit?: number | undefined;
|
|
1699
2127
|
mode?: WorkspaceMemorySearchMode | undefined;
|
|
2128
|
+
/** Agent-only containment. Human audit/search callers omit this. */
|
|
2129
|
+
agentPromptMode?: WorkspaceMemoryPromptMode | undefined;
|
|
1700
2130
|
};
|
|
1701
2131
|
export type WorkspaceMemorySearchResult = {
|
|
1702
2132
|
memory: KnowledgeMemory;
|
|
@@ -1764,6 +2194,7 @@ export declare function createScheduledTask(db: Database, input: CreateScheduled
|
|
|
1764
2194
|
export declare function updateScheduledTask(db: Database, workspaceId: string, taskId: string, input: UpdateScheduledTaskInput): Promise<ScheduledTask>;
|
|
1765
2195
|
export declare function getScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask | null>;
|
|
1766
2196
|
export declare function getScheduledTaskPersonalConnectionDelegations(db: Database, workspaceId: string, taskId: string): Promise<McpPersonalConnectionDelegation[]>;
|
|
2197
|
+
export declare function getScheduledTaskXaiProviderAccountAuthoritySnapshot(db: Database, workspaceId: string, taskId: string): Promise<XaiProviderAccountAuthoritySnapshotV1>;
|
|
1767
2198
|
export declare function requireScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
|
|
1768
2199
|
export declare class ScheduledTaskTargetConflictError extends Error {
|
|
1769
2200
|
constructor();
|
|
@@ -1780,6 +2211,14 @@ export declare function requireScheduledTaskTargetInTransaction(tx: Database, in
|
|
|
1780
2211
|
targetSessionId: string;
|
|
1781
2212
|
}): Promise<void>;
|
|
1782
2213
|
export declare function listScheduledTasks(db: Database, workspaceId: string, limit?: number, offset?: number): Promise<ScheduledTask[]>;
|
|
2214
|
+
/**
|
|
2215
|
+
* Internal connector-control traversal. Keep the whole keyset walk on one
|
|
2216
|
+
* repeatable-read snapshot so task creation/update performed after discovery
|
|
2217
|
+
* cannot make an older row move between offset pages or hide a matching task.
|
|
2218
|
+
*/
|
|
2219
|
+
export declare function listKnowledgeSourceSyncTasksForConnection(db: Database, workspaceId: string, connectionId: string, pageSize?: number): Promise<Array<ScheduledTask & {
|
|
2220
|
+
action: KnowledgeSourceSyncAction;
|
|
2221
|
+
}>>;
|
|
1783
2222
|
export declare function deleteScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<void>;
|
|
1784
2223
|
export declare function createScheduledTaskRun(db: Database, input: {
|
|
1785
2224
|
workspaceId: string;
|
|
@@ -1796,6 +2235,10 @@ export declare function updateScheduledTaskRun(db: Database, workspaceId: string
|
|
|
1796
2235
|
status: ScheduledTaskRunStatus;
|
|
1797
2236
|
sessionId: string | null;
|
|
1798
2237
|
triggerEventId: string | null;
|
|
2238
|
+
actionKind: ScheduledTaskActionKind;
|
|
2239
|
+
knowledgeSyncRunId: string | null;
|
|
2240
|
+
knowledgeSummary: Record<string, unknown> | null;
|
|
2241
|
+
completedAt: Date | null;
|
|
1799
2242
|
error: string | null;
|
|
1800
2243
|
}>): Promise<ScheduledTaskRun>;
|
|
1801
2244
|
/** DB-only source mutation callback for durable scheduled delivery. */
|
|
@@ -1912,6 +2355,31 @@ export declare function deleteRigIfNoActiveSessions(db: Database, workspaceId: s
|
|
|
1912
2355
|
deleted: boolean;
|
|
1913
2356
|
activeSessionCount: number;
|
|
1914
2357
|
}>;
|
|
2358
|
+
export declare class ChannelNameConflictError extends Error {
|
|
2359
|
+
constructor(name: string);
|
|
2360
|
+
}
|
|
2361
|
+
export declare class ChannelNotFoundError extends Error {
|
|
2362
|
+
constructor(channelId: string);
|
|
2363
|
+
}
|
|
2364
|
+
export declare function createChannel(db: Database, input: {
|
|
2365
|
+
accountId: string;
|
|
2366
|
+
workspaceId: string;
|
|
2367
|
+
name: string;
|
|
2368
|
+
description?: string | null;
|
|
2369
|
+
createdBy?: string | null;
|
|
2370
|
+
}): Promise<Channel>;
|
|
2371
|
+
export declare function listChannels(db: Database, workspaceId: string): Promise<Channel[]>;
|
|
2372
|
+
export declare function getChannel(db: Database, workspaceId: string, channelId: string): Promise<Channel | null>;
|
|
2373
|
+
export declare function updateChannel(db: Database, workspaceId: string, channelId: string, input: {
|
|
2374
|
+
name?: string | undefined;
|
|
2375
|
+
description?: string | null | undefined;
|
|
2376
|
+
}): Promise<Channel | null>;
|
|
2377
|
+
export declare function deleteChannel(db: Database, workspaceId: string, channelId: string): Promise<boolean>;
|
|
2378
|
+
export declare function setSessionChannel(db: Database, input: {
|
|
2379
|
+
workspaceId: string;
|
|
2380
|
+
sessionId: string;
|
|
2381
|
+
channelId: string | null;
|
|
2382
|
+
}): Promise<boolean>;
|
|
1915
2383
|
export declare function countRigs(db: Database, workspaceId: string): Promise<number>;
|
|
1916
2384
|
export declare function countSessionsUsingRig(db: Database, workspaceId: string, rigId: string): Promise<number>;
|
|
1917
2385
|
export declare function createRigVersion(db: Database, workspaceId: string, rigId: string, input: RigVersionContentInput, options?: {
|
|
@@ -1919,6 +2387,7 @@ export declare function createRigVersion(db: Database, workspaceId: string, rigI
|
|
|
1919
2387
|
}): Promise<RigVersion>;
|
|
1920
2388
|
export declare function createRigVersionForChangePromotion(db: Database, workspaceId: string, rigId: string, changeId: string, input: RigVersionContentInput & {
|
|
1921
2389
|
expectedActiveVersionId: string;
|
|
2390
|
+
providerImages?: RigProviderImages;
|
|
1922
2391
|
}): Promise<{
|
|
1923
2392
|
version: RigVersion;
|
|
1924
2393
|
change: RigChange;
|
|
@@ -1948,6 +2417,33 @@ export declare function listRigVersionMonitoringSummaries(db: Database, workspac
|
|
|
1948
2417
|
}>;
|
|
1949
2418
|
export declare function getRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion | null>;
|
|
1950
2419
|
export declare function getRigVersionById(db: Database, workspaceId: string, versionId: string): Promise<RigVersion | null>;
|
|
2420
|
+
export type RigProviderImageBuildClaim = {
|
|
2421
|
+
status: "claimed";
|
|
2422
|
+
image: RigProviderImage;
|
|
2423
|
+
} | {
|
|
2424
|
+
status: "ready" | "in_progress" | "unsupported" | "conflict";
|
|
2425
|
+
image: RigProviderImage;
|
|
2426
|
+
};
|
|
2427
|
+
/**
|
|
2428
|
+
* Claim the one provider-image build slot for an existing immutable rig
|
|
2429
|
+
* version. A finalized ready image is never overwritten in place: if the
|
|
2430
|
+
* effective base/content identity changed, callers must mint/verify a new rig
|
|
2431
|
+
* version and runtime setup remains the truthful fallback for this one.
|
|
2432
|
+
*/
|
|
2433
|
+
export declare function claimRigVersionProviderImageBuild(db: Database, input: {
|
|
2434
|
+
workspaceId: string;
|
|
2435
|
+
versionId: string;
|
|
2436
|
+
image: RigProviderImage;
|
|
2437
|
+
staleAfterMs: number;
|
|
2438
|
+
/** Retry a same-content unsupported record only after runtime support exists. */
|
|
2439
|
+
retryUnsupported?: boolean;
|
|
2440
|
+
}): Promise<RigProviderImageBuildClaim>;
|
|
2441
|
+
/** Finalize only the exact claimed build request; late callbacks are fenced. */
|
|
2442
|
+
export declare function finalizeRigVersionProviderImageBuild(db: Database, input: {
|
|
2443
|
+
workspaceId: string;
|
|
2444
|
+
versionId: string;
|
|
2445
|
+
image: RigProviderImage;
|
|
2446
|
+
}): Promise<boolean>;
|
|
1951
2447
|
export declare function getRigName(db: Database, workspaceId: string, rigId: string): Promise<string | null>;
|
|
1952
2448
|
export declare function activateRigVersion(db: Database, workspaceId: string, rigId: string, versionId: string): Promise<RigVersion>;
|
|
1953
2449
|
export declare function createRigChange(db: Database, input: {
|
|
@@ -2526,17 +3022,23 @@ export declare function armCodexCapacityWait(db: Database, input: {
|
|
|
2526
3022
|
now?: Date;
|
|
2527
3023
|
}): Promise<ArmCodexCapacityWaitResult>;
|
|
2528
3024
|
export declare function getCodexCapacityWaitForSession(db: Database, workspaceId: string, sessionId: string): Promise<CodexCapacityWait | null>;
|
|
3025
|
+
type CodexCapacityMutationInput = {
|
|
3026
|
+
workspaceId: string;
|
|
3027
|
+
reason: string;
|
|
3028
|
+
policyHash?: string | null;
|
|
3029
|
+
};
|
|
2529
3030
|
/**
|
|
2530
3031
|
* Same-transaction capacity-mutation/outbox seam for eligibility and
|
|
2531
3032
|
* membership/default changes. The allocator rotation row is always the
|
|
2532
3033
|
* first lock. Mutations report whether capacity truth changed; only then are
|
|
2533
3034
|
* matching waiter wake revisions advanced and returned for best-effort signal.
|
|
2534
3035
|
*/
|
|
2535
|
-
export declare function withCodexCapacityMutation<T>(db: Database, input: {
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
3036
|
+
export declare function withCodexCapacityMutation<T>(db: Database, input: CodexCapacityMutationInput, mutate: (tx: Database) => Promise<{
|
|
3037
|
+
result: T;
|
|
3038
|
+
changed: boolean;
|
|
3039
|
+
}>): Promise<CodexCapacityMutationResult<T>>;
|
|
3040
|
+
/** Capacity mutation whose atomic callback also changes session activity. */
|
|
3041
|
+
export declare function withSessionCodexCapacityMutation<T>(db: Database, input: CodexCapacityMutationInput, mutate: (tx: SessionActivityDatabase) => Promise<{
|
|
2540
3042
|
result: T;
|
|
2541
3043
|
changed: boolean;
|
|
2542
3044
|
}>): Promise<CodexCapacityMutationResult<T>>;
|
|
@@ -2561,6 +3063,101 @@ export declare function reconcileCodexCapacityWait<TPolicyScope = never, TUnavai
|
|
|
2561
3063
|
resolvePolicyScope?: CodexCredentialLeasePolicyScopeResolver<TPolicyScope>;
|
|
2562
3064
|
filterNewAllocationCandidates?: CodexCredentialLeaseCandidateFilter<TPolicyScope, TUnavailableDiagnostic>;
|
|
2563
3065
|
}): Promise<ReconcileCodexCapacityWaitResult>;
|
|
3066
|
+
export type XaiCapacityWait = {
|
|
3067
|
+
id: string;
|
|
3068
|
+
accountId: string;
|
|
3069
|
+
workspaceId: string;
|
|
3070
|
+
sessionId: string;
|
|
3071
|
+
goalId: string | null;
|
|
3072
|
+
goalVersion: number | null;
|
|
3073
|
+
blockedTurnId: string;
|
|
3074
|
+
blockedTurnGeneration: number;
|
|
3075
|
+
workflowId: string;
|
|
3076
|
+
authorityScope: "workspace" | "user";
|
|
3077
|
+
ownerOrganizationMembershipId: string | null;
|
|
3078
|
+
status: CodexCapacityWaitStatus;
|
|
3079
|
+
generation: number;
|
|
3080
|
+
earliestResetAt: Date | null;
|
|
3081
|
+
nextCheckAt: Date;
|
|
3082
|
+
wakeRevision: number;
|
|
3083
|
+
observedWakeRevision: number;
|
|
3084
|
+
lastWakeReason: string;
|
|
3085
|
+
createdAt: Date;
|
|
3086
|
+
updatedAt: Date;
|
|
3087
|
+
};
|
|
3088
|
+
export type XaiCredentialLeaseQuarantine = {
|
|
3089
|
+
kind: "status";
|
|
3090
|
+
status: "needs_relogin" | "error";
|
|
3091
|
+
lastError: string;
|
|
3092
|
+
} | {
|
|
3093
|
+
kind: "cooldown";
|
|
3094
|
+
until: Date;
|
|
3095
|
+
};
|
|
3096
|
+
export type ArmXaiCapacityWaitResult = {
|
|
3097
|
+
action: "waiting";
|
|
3098
|
+
waiter: XaiCapacityWait;
|
|
3099
|
+
events: SessionEvent[];
|
|
3100
|
+
} | {
|
|
3101
|
+
action: "stale";
|
|
3102
|
+
waiter: XaiCapacityWait | null;
|
|
3103
|
+
events: SessionEvent[];
|
|
3104
|
+
};
|
|
3105
|
+
export type ReconcileXaiCapacityWaitResult = {
|
|
3106
|
+
action: "waiting";
|
|
3107
|
+
waiter: XaiCapacityWait;
|
|
3108
|
+
events: SessionEvent[];
|
|
3109
|
+
} | {
|
|
3110
|
+
action: "resumed";
|
|
3111
|
+
waiter: XaiCapacityWait;
|
|
3112
|
+
events: SessionEvent[];
|
|
3113
|
+
} | {
|
|
3114
|
+
action: "paused";
|
|
3115
|
+
waiter: XaiCapacityWait;
|
|
3116
|
+
events: SessionEvent[];
|
|
3117
|
+
} | {
|
|
3118
|
+
action: "superseded";
|
|
3119
|
+
waiter: XaiCapacityWait;
|
|
3120
|
+
events: SessionEvent[];
|
|
3121
|
+
} | {
|
|
3122
|
+
action: "stale";
|
|
3123
|
+
waiter: XaiCapacityWait | null;
|
|
3124
|
+
events: SessionEvent[];
|
|
3125
|
+
};
|
|
3126
|
+
/**
|
|
3127
|
+
* Atomically close one exact xAI attempt and preserve its logical turn behind a
|
|
3128
|
+
* durable provider-capacity waiter. The immutable authority snapshot and, for
|
|
3129
|
+
* private pools, exact initiating human are revalidated under FORCE RLS before
|
|
3130
|
+
* any session/turn projection changes.
|
|
3131
|
+
*/
|
|
3132
|
+
export declare function armXaiCapacityWait(db: Database, input: {
|
|
3133
|
+
accountId: string;
|
|
3134
|
+
workspaceId: string;
|
|
3135
|
+
subjectId: string;
|
|
3136
|
+
sessionId: string;
|
|
3137
|
+
turnId: string;
|
|
3138
|
+
attemptId: string;
|
|
3139
|
+
workflowId: string;
|
|
3140
|
+
authoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
3141
|
+
goalId?: string | null;
|
|
3142
|
+
goalVersion?: number | null;
|
|
3143
|
+
earliestResetAt: Date | null;
|
|
3144
|
+
failurePayload: Record<string, unknown>;
|
|
3145
|
+
leaseFence?: {
|
|
3146
|
+
holderId: string;
|
|
3147
|
+
generation: number;
|
|
3148
|
+
};
|
|
3149
|
+
credentialQuarantine?: XaiCredentialLeaseQuarantine;
|
|
3150
|
+
now?: Date;
|
|
3151
|
+
}): Promise<ArmXaiCapacityWaitResult>;
|
|
3152
|
+
export declare function getXaiCapacityWaitForSession(db: Database, workspaceId: string, sessionId: string): Promise<XaiCapacityWait | null>;
|
|
3153
|
+
export declare function reconcileXaiCapacityWait(db: Database, input: {
|
|
3154
|
+
accountId: string;
|
|
3155
|
+
workspaceId: string;
|
|
3156
|
+
sessionId: string;
|
|
3157
|
+
waiterId: string;
|
|
3158
|
+
generation: number;
|
|
3159
|
+
now?: Date;
|
|
3160
|
+
}): Promise<ReconcileXaiCapacityWaitResult>;
|
|
2564
3161
|
/**
|
|
2565
3162
|
* Extend a live holder and return the database-confirmed expiry. A
|
|
2566
3163
|
* missing/expired/released row returns null. A successful result lets the worker
|
|
@@ -2901,6 +3498,7 @@ export declare function getSessionCodexState(db: Database, workspaceId: string,
|
|
|
2901
3498
|
* Validates the id belongs to the workspace when non-null. Returns false if the
|
|
2902
3499
|
* session is unknown or the id is invalid.
|
|
2903
3500
|
*/
|
|
3501
|
+
export declare function setSessionCodexPinInTransaction(db: SessionActivityDatabase, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2904
3502
|
export declare function setSessionCodexPin(db: Database, workspaceId: string, sessionId: string, pinnedCredentialId: string | null, source?: CodexPinSource, options?: SetSessionCodexPinOptions): Promise<boolean>;
|
|
2905
3503
|
/** Written by the worker at the turn boundary; drives the in-session indicator. */
|
|
2906
3504
|
export declare function recordSessionActiveCodexCredential(db: Database, workspaceId: string, sessionId: string, credentialId: string): Promise<void>;
|
|
@@ -2976,6 +3574,8 @@ export type ConnectorActionInvocation = {
|
|
|
2976
3574
|
serverId: string;
|
|
2977
3575
|
toolName: string;
|
|
2978
3576
|
arguments: unknown;
|
|
3577
|
+
/** Explicit per-session MCP approval, rather than a connector-policy decision. */
|
|
3578
|
+
approvalMode?: "session_mcp";
|
|
2979
3579
|
};
|
|
2980
3580
|
export type PrepareConnectorActionApprovalResult = {
|
|
2981
3581
|
managed: false;
|
|
@@ -3007,6 +3607,12 @@ type ResolvedConnectorActionPolicy = {
|
|
|
3007
3607
|
managed: true;
|
|
3008
3608
|
source: "explicit";
|
|
3009
3609
|
entry: ConnectorActionPolicySnapshotEntry;
|
|
3610
|
+
} | {
|
|
3611
|
+
managed: true;
|
|
3612
|
+
source: "explicit";
|
|
3613
|
+
entry: null;
|
|
3614
|
+
decision: "ask";
|
|
3615
|
+
actionName: string;
|
|
3010
3616
|
} | {
|
|
3011
3617
|
managed: true;
|
|
3012
3618
|
source: "ambiguous";
|
|
@@ -3071,6 +3677,7 @@ export type SessionCreateInput = {
|
|
|
3071
3677
|
variableSetId?: string | null;
|
|
3072
3678
|
rigId?: string | null;
|
|
3073
3679
|
rigVersionId?: string | null;
|
|
3680
|
+
channelId?: string | null;
|
|
3074
3681
|
firstPartyMcpPermissions?: Permission[] | null;
|
|
3075
3682
|
firstPartyMcpTools?: FirstPartyMcpToolName[];
|
|
3076
3683
|
instructions?: string | null;
|
|
@@ -3081,9 +3688,14 @@ export type SessionCreateInput = {
|
|
|
3081
3688
|
sandboxOs?: SandboxOs;
|
|
3082
3689
|
mcpServers?: CreateSessionMcpServerInput[];
|
|
3083
3690
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
3691
|
+
initialXaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
3084
3692
|
maxNestedAgentDepthOverride?: number | null;
|
|
3085
3693
|
allowNestedAgentDepthIncrease?: boolean;
|
|
3086
3694
|
subjectId?: string | null;
|
|
3695
|
+
/** Trusted, transaction-local linkage run after the exact session row and
|
|
3696
|
+
* MCP metadata exist but before either can commit. It must perform database
|
|
3697
|
+
* work only; throwing rolls the complete create/replay transaction back. */
|
|
3698
|
+
beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
|
|
3087
3699
|
};
|
|
3088
3700
|
export declare function createSession(db: Database, input: SessionCreateInput): Promise<DbSession>;
|
|
3089
3701
|
/**
|
|
@@ -3109,8 +3721,17 @@ export declare function createSessionWithIdempotencyKey(db: Database, input: Ses
|
|
|
3109
3721
|
}): Promise<SessionCreateSuccessResult>;
|
|
3110
3722
|
export declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
|
|
3111
3723
|
export declare function getSession(db: Database, workspaceId: string, sessionId: string): Promise<Session | null>;
|
|
3724
|
+
export type SessionAuthorityProjection = {
|
|
3725
|
+
sessionId: string;
|
|
3726
|
+
rootSessionId: string;
|
|
3727
|
+
visibility: "user_private" | "workspace_shared";
|
|
3728
|
+
ownerSubjectId: string | null;
|
|
3729
|
+
};
|
|
3730
|
+
export declare function getSessionAuthorityProjection(db: Database, workspaceId: string, sessionId: string): Promise<SessionAuthorityProjection | null>;
|
|
3731
|
+
export declare function getSessionTurnXaiProviderAccountAuthoritySnapshot(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<XaiProviderAccountAuthoritySnapshotV1>;
|
|
3112
3732
|
export declare function getSessionTurnPersonalConnectionDelegations(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<McpPersonalConnectionDelegation[]>;
|
|
3113
3733
|
export declare function getSessionParentPersonalConnectionDelegations(db: Database, workspaceId: string, childSessionId: string): Promise<McpPersonalConnectionDelegation[]>;
|
|
3734
|
+
export declare function getSessionParentXaiProviderAccountAuthority(db: Database, workspaceId: string, childSessionId: string): Promise<FrozenXaiExecutionAuthority>;
|
|
3114
3735
|
export declare function getSessionSpawnDenial(db: Database, workspaceId: string, denialId: string): Promise<SessionSpawnDenial | null>;
|
|
3115
3736
|
export declare function getSessionSpawnDenialByIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<SessionSpawnDenial | null>;
|
|
3116
3737
|
export declare function listSessionSpawnDenials(db: Database, workspaceId: string, options?: {
|
|
@@ -3270,6 +3891,8 @@ export type SessionDiscoverySummary = {
|
|
|
3270
3891
|
title: string | null;
|
|
3271
3892
|
titleOriginalChars: number | null;
|
|
3272
3893
|
parentSessionId: string | null;
|
|
3894
|
+
rootSessionId: string;
|
|
3895
|
+
nestedAgentDepth: number;
|
|
3273
3896
|
status: SessionStatus;
|
|
3274
3897
|
effectiveControl: SessionDiscoveryControl;
|
|
3275
3898
|
goal: {
|
|
@@ -3302,6 +3925,9 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3302
3925
|
includeLastMessage?: boolean;
|
|
3303
3926
|
orderBy?: SessionDiscoveryOrderBy;
|
|
3304
3927
|
updatedAfter?: string;
|
|
3928
|
+
parentSessionId?: string | null;
|
|
3929
|
+
search?: string;
|
|
3930
|
+
subjectId?: string;
|
|
3305
3931
|
authorizationScope?: SessionAuthorizationListScope;
|
|
3306
3932
|
}): Promise<{
|
|
3307
3933
|
sessions: SessionDiscoverySummary[];
|
|
@@ -3314,6 +3940,17 @@ export declare function listSessionDiscoverySummaries(db: Database, workspaceId:
|
|
|
3314
3940
|
updatedThrough: string | null;
|
|
3315
3941
|
updatedAfter: string | null;
|
|
3316
3942
|
}>;
|
|
3943
|
+
export type SessionDiscoveryAncestor = {
|
|
3944
|
+
id: string;
|
|
3945
|
+
title: string | null;
|
|
3946
|
+
titleOriginalChars: number | null;
|
|
3947
|
+
};
|
|
3948
|
+
/**
|
|
3949
|
+
* Return bounded root-to-parent paths for a bounded discovery result page.
|
|
3950
|
+
* Authorization is re-applied to every ancestor so exact-session grants never
|
|
3951
|
+
* acquire parent metadata merely by searching for their target.
|
|
3952
|
+
*/
|
|
3953
|
+
export declare function listSessionDiscoveryAncestorPaths(db: Database, workspaceId: string, sessionIds: string[], authorizationScope?: SessionAuthorizationListScope): Promise<Map<string, SessionDiscoveryAncestor[]>>;
|
|
3317
3954
|
export type SessionLineage = {
|
|
3318
3955
|
ancestors: Session[];
|
|
3319
3956
|
children: LineageNode[];
|
|
@@ -3394,49 +4031,6 @@ export declare function listSessionEventPage(db: Database, workspaceId: string,
|
|
|
3394
4031
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string): Promise<SessionEvent[]>;
|
|
3395
4032
|
export declare function listSessionEvents(db: Database, workspaceId: string, sessionId: string, after: number, limit?: number): Promise<SessionEvent[]>;
|
|
3396
4033
|
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
4034
|
export declare function getSessionEvent(db: Database, workspaceId: string, eventId: string): Promise<SessionEvent | null>;
|
|
3441
4035
|
export declare function listWorkspaceControlEvents(db: Database, workspaceId: string, after?: number, limit?: number): Promise<WorkspaceControlEvent[]>;
|
|
3442
4036
|
export declare function getWorkspaceControlEvent(db: Database, workspaceId: string, eventId: string): Promise<WorkspaceControlEvent | null>;
|
|
@@ -3446,7 +4040,31 @@ export declare function getWorkspaceControlEvent(db: Database, workspaceId: stri
|
|
|
3446
4040
|
* a session, while the workspace predicate remains the tenancy boundary.
|
|
3447
4041
|
*/
|
|
3448
4042
|
export declare function getSessionEventByClientEventId(db: Database, workspaceId: string, sessionId: string, clientEventId: string): Promise<SessionEvent | null>;
|
|
3449
|
-
export declare
|
|
4043
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_BYTES: number;
|
|
4044
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_NODES = 65536;
|
|
4045
|
+
export declare const APPROVAL_RUN_STATE_MAX_JSON_PROPERTIES = 32768;
|
|
4046
|
+
export declare const APPROVAL_PENDING_MAX_JSON_BYTES: number;
|
|
4047
|
+
export declare const APPROVAL_PENDING_MAX_ITEMS = 256;
|
|
4048
|
+
export type ApprovalRunStateMaterializationLimits = {
|
|
4049
|
+
maximumJsonBytes: number;
|
|
4050
|
+
maximumJsonNodes: number;
|
|
4051
|
+
maximumJsonProperties: number;
|
|
4052
|
+
maximumPendingApprovalBytes: number;
|
|
4053
|
+
maximumPendingApprovalItems: number;
|
|
4054
|
+
};
|
|
4055
|
+
export type ApprovalRunStateLimitKind = "json_bytes" | "json_nodes" | "json_properties" | "invalid_json" | "pending_approval_bytes" | "pending_approval_items";
|
|
4056
|
+
export declare class ApprovalRunStateLimitExceededError extends Error {
|
|
4057
|
+
readonly limitKind: ApprovalRunStateLimitKind;
|
|
4058
|
+
readonly actual: number;
|
|
4059
|
+
readonly maximum: number;
|
|
4060
|
+
readonly code = "approval_run_state_too_large";
|
|
4061
|
+
constructor(limitKind: ApprovalRunStateLimitKind, actual: number, maximum: number);
|
|
4062
|
+
}
|
|
4063
|
+
/**
|
|
4064
|
+
* Read the one approval/human-input RunState through a server-measured envelope.
|
|
4065
|
+
* Ordinary turns never call this path; they use canonical history items only.
|
|
4066
|
+
*/
|
|
4067
|
+
export declare function getLatestRunState(db: Database, workspaceId: string, sessionId: string, limitOverrides?: Partial<ApprovalRunStateMaterializationLimits>): Promise<{
|
|
3450
4068
|
id: string;
|
|
3451
4069
|
turnId: string | null;
|
|
3452
4070
|
serializedRunState: string;
|
|
@@ -3571,19 +4189,16 @@ export declare function registerPendingSessionToolCall(db: Database, input: Pend
|
|
|
3571
4189
|
accepted: boolean;
|
|
3572
4190
|
registered: boolean;
|
|
3573
4191
|
}>;
|
|
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
4192
|
/** Record the raw SDK result without dropping the call receipt. */
|
|
3585
4193
|
export declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
|
|
3586
4194
|
resultItem: Record<string, unknown>;
|
|
4195
|
+
/** Exact agent.toolCall.output value, separate from model-facing history. */
|
|
4196
|
+
eventOutput?: unknown;
|
|
4197
|
+
/** Commit a durable async-video acceptance fence with this exact result. */
|
|
4198
|
+
videoGenerationAcceptance?: {
|
|
4199
|
+
operationId: string;
|
|
4200
|
+
requestDigest: string;
|
|
4201
|
+
};
|
|
3587
4202
|
}): Promise<{
|
|
3588
4203
|
accepted: boolean;
|
|
3589
4204
|
recorded: boolean;
|
|
@@ -3617,6 +4232,40 @@ export declare function getActiveSessionHistoryItems(db: Database, workspaceId:
|
|
|
3617
4232
|
item: Record<string, unknown>;
|
|
3618
4233
|
providerArtifactInvalidatedAt: Date | null;
|
|
3619
4234
|
}>>;
|
|
4235
|
+
/**
|
|
4236
|
+
* Profiled upper envelope for one session's complete active, model-facing
|
|
4237
|
+
* transcript. Bytes alone do not bound the decoded object graph, so rows, JSON
|
|
4238
|
+
* nodes, and object properties are independently limited. Normal token-driven
|
|
4239
|
+
* compaction keeps active history far below these boundaries. The limits are a
|
|
4240
|
+
* final materialization guard: a corrupt/imported/pathological transcript fails
|
|
4241
|
+
* deterministically before a Postgres driver decodes it instead of using the
|
|
4242
|
+
* pod OOM killer as admission.
|
|
4243
|
+
*/
|
|
4244
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_BYTES: number;
|
|
4245
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_ROWS = 8192;
|
|
4246
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_NODES = 131072;
|
|
4247
|
+
export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_PROPERTIES = 65536;
|
|
4248
|
+
export type ActiveSessionHistoryLimitKind = "json_bytes" | "rows" | "json_nodes" | "json_properties";
|
|
4249
|
+
export declare class ActiveSessionHistoryLimitExceededError extends Error {
|
|
4250
|
+
readonly actualBytes: number;
|
|
4251
|
+
readonly maximumBytes: number;
|
|
4252
|
+
readonly limitKind: ActiveSessionHistoryLimitKind;
|
|
4253
|
+
readonly actual: number;
|
|
4254
|
+
readonly maximum: number;
|
|
4255
|
+
readonly code = "active_history_too_large";
|
|
4256
|
+
constructor(actualBytes: number, maximumBytes: number, limitKind?: ActiveSessionHistoryLimitKind, actual?: number, maximum?: number);
|
|
4257
|
+
}
|
|
4258
|
+
/**
|
|
4259
|
+
* Memory-bounded active-history read for model input and compaction. PostgreSQL
|
|
4260
|
+
* first measures the complete logical window without returning any JSONB item,
|
|
4261
|
+
* then keyset-pages the admitted rows on the same repeatable-read snapshot.
|
|
4262
|
+
*/
|
|
4263
|
+
export declare function getActiveSessionHistoryItemsPaged(db: Database, workspaceId: string, sessionId: string, pageSize?: number, maximumJsonBytes?: number, maximumRows?: number, maximumJsonNodes?: number, maximumJsonProperties?: number): Promise<Array<{
|
|
4264
|
+
id: string;
|
|
4265
|
+
position: number;
|
|
4266
|
+
item: Record<string, unknown>;
|
|
4267
|
+
providerArtifactInvalidatedAt: Date | null;
|
|
4268
|
+
}>>;
|
|
3620
4269
|
/** Bounded finalized voice turns used only to resume a later realtime call. */
|
|
3621
4270
|
export declare function getSessionRealtimeContinuityEntries(db: Database, workspaceId: string, sessionId: string, maximumEntries?: number): Promise<SessionRealtimeContinuityEntry[]>;
|
|
3622
4271
|
/**
|
|
@@ -3979,7 +4628,7 @@ export declare function closePtySession(db: Database, input: {
|
|
|
3979
4628
|
/** List a session's OPEN PTYs (reattach + reap). */
|
|
3980
4629
|
export declare function listOpenPtySessions(db: Database, workspaceId: string, sessionId: string): Promise<SandboxOpenPtySessionRow[]>;
|
|
3981
4630
|
export type SandboxLeaseLiveness = "cold" | "warming" | "warm" | "draining";
|
|
3982
|
-
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process";
|
|
4631
|
+
export type LeaseHolderKind = "turn" | "viewer" | "direct" | "process" | "interaction";
|
|
3983
4632
|
export type SandboxProviderExistence = "not_created" | "creating" | "exists" | "missing" | "unknown";
|
|
3984
4633
|
export type SandboxArchiveAvailability = "none" | "available" | "unverified" | "invalid";
|
|
3985
4634
|
export type SandboxRestoreStatus = "not_required" | "pending" | "restoring" | "verifying" | "ready" | "degraded" | "unrecoverable";
|
|
@@ -4013,6 +4662,22 @@ export type SandboxRecoveryState = {
|
|
|
4013
4662
|
verifiedRevision: string | null;
|
|
4014
4663
|
verifiedAt: string | null;
|
|
4015
4664
|
};
|
|
4665
|
+
/** Provider-specific proof that an elected recovery owner may replace only
|
|
4666
|
+
* the disposable execution wrapper while retaining the same workspace. */
|
|
4667
|
+
continuity?: SandboxProviderContinuityRecovery;
|
|
4668
|
+
/** A provider disappeared while a non-cancellable capture response could
|
|
4669
|
+
* still settle. The cold lease retains this exact source/lineage receipt so a
|
|
4670
|
+
* late verified archive can repair recovery without reopening the old box. */
|
|
4671
|
+
lateArchiveCapture?: {
|
|
4672
|
+
version: 1;
|
|
4673
|
+
captureId: string;
|
|
4674
|
+
providerRequestId: string;
|
|
4675
|
+
sourceLeaseId: string;
|
|
4676
|
+
sourceLeaseEpoch: number;
|
|
4677
|
+
sourceInstanceId: string;
|
|
4678
|
+
sourceWorkspaceGeneration: number;
|
|
4679
|
+
recordedAt: string;
|
|
4680
|
+
};
|
|
4016
4681
|
};
|
|
4017
4682
|
export interface LeaseSnapshot {
|
|
4018
4683
|
id: string;
|
|
@@ -4028,6 +4693,9 @@ export interface LeaseSnapshot {
|
|
|
4028
4693
|
rigVersionId: string | null;
|
|
4029
4694
|
dataPlaneUrl: string | null;
|
|
4030
4695
|
terminalDataPlaneUrl: string | null;
|
|
4696
|
+
/** Cached browserd controller tunnel (7682), fenced to this lease epoch and
|
|
4697
|
+
* provider instance. Null until the first controller provisioning/resolution. */
|
|
4698
|
+
controllerDataPlaneUrl: string | null;
|
|
4031
4699
|
leaseEpoch: number;
|
|
4032
4700
|
/** Monotonic filesystem mutation intent for the exact live workspace. */
|
|
4033
4701
|
workspaceGeneration: number;
|
|
@@ -4040,9 +4708,24 @@ export interface LeaseSnapshot {
|
|
|
4040
4708
|
/** Exact provider capture currently holding the lease-local admission gate. */
|
|
4041
4709
|
archiveCapture: {
|
|
4042
4710
|
id: string;
|
|
4711
|
+
operationId: string;
|
|
4712
|
+
providerRequestId: string;
|
|
4713
|
+
providerReplaySafe: boolean;
|
|
4714
|
+
takeoverSafe: boolean;
|
|
4715
|
+
attempt: number;
|
|
4043
4716
|
workspaceGeneration: number;
|
|
4044
4717
|
startedAt: Date;
|
|
4045
4718
|
deadlineAt: Date;
|
|
4719
|
+
/** Durable proof that this exact draining capture already published a
|
|
4720
|
+
* verified current-generation archive. Null while capture is outstanding. */
|
|
4721
|
+
publishedAt: Date | null;
|
|
4722
|
+
} | null;
|
|
4723
|
+
/** Bounded exact operator hold. Active holds stop reaper capture/teardown but
|
|
4724
|
+
* deliberately do not stop a user from re-arming a resumable drain. */
|
|
4725
|
+
reaperHold: {
|
|
4726
|
+
id: string;
|
|
4727
|
+
until: Date;
|
|
4728
|
+
reason: string;
|
|
4046
4729
|
} | null;
|
|
4047
4730
|
resumeBackendId: string | null;
|
|
4048
4731
|
resumeState: Record<string, unknown> | null;
|
|
@@ -4058,7 +4741,7 @@ export interface LeaseSnapshot {
|
|
|
4058
4741
|
/** Once set, new holders and new filesystem mutations are fenced while the
|
|
4059
4742
|
* current holders quiesce and the reaper creates a successor. */
|
|
4060
4743
|
rotationRequestedAt: Date | null;
|
|
4061
|
-
rotationReason: "provider_deadline" | "operator" | null;
|
|
4744
|
+
rotationReason: "provider_deadline" | "operator" | "teardown_claim" | null;
|
|
4062
4745
|
currentCheckpointArtifactId: string | null;
|
|
4063
4746
|
previousCheckpointArtifactId: string | null;
|
|
4064
4747
|
expiresAt: Date;
|
|
@@ -4085,8 +4768,13 @@ export interface AcquireLeaseInput {
|
|
|
4085
4768
|
warmingLeaseTtlMs?: number;
|
|
4086
4769
|
expectedEpoch?: number;
|
|
4087
4770
|
/** Bounded wait for an exact provider-native capture claim to settle. The
|
|
4088
|
-
* transaction is released between retries; every retry re-reads the lease.
|
|
4771
|
+
* transaction is released between retries; every retry re-reads the lease.
|
|
4772
|
+
* The same wait also covers a requested provider rotation. The legacy field
|
|
4773
|
+
* name is retained at the API boundary so rolling workers remain compatible. */
|
|
4089
4774
|
captureWaitMs?: number;
|
|
4775
|
+
/** Optional owner cancellation for the transition wait. No holder exists
|
|
4776
|
+
* while a capture/rotation fence is observed, so cancellation is leak-free. */
|
|
4777
|
+
waitSignal?: AbortSignal;
|
|
4090
4778
|
}
|
|
4091
4779
|
export type AcquireLeaseResult = {
|
|
4092
4780
|
role: "spawner";
|
|
@@ -4103,12 +4791,32 @@ export type AcquireLeaseResult = {
|
|
|
4103
4791
|
lease: LeaseSnapshot;
|
|
4104
4792
|
} | {
|
|
4105
4793
|
role: "fenced";
|
|
4794
|
+
reason: "superseded" | "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress";
|
|
4106
4795
|
lease: LeaseSnapshot;
|
|
4107
4796
|
};
|
|
4108
4797
|
export declare class SandboxLeaseSupersededError extends Error {
|
|
4109
4798
|
readonly sandboxGroupId: string;
|
|
4110
4799
|
readonly leaseEpoch: number;
|
|
4111
|
-
|
|
4800
|
+
readonly diagnostic?: {
|
|
4801
|
+
backend: string;
|
|
4802
|
+
instanceId: string | null;
|
|
4803
|
+
liveness: SandboxLeaseLiveness;
|
|
4804
|
+
} | undefined;
|
|
4805
|
+
constructor(sandboxGroupId: string, leaseEpoch: number, diagnostic?: {
|
|
4806
|
+
backend: string;
|
|
4807
|
+
instanceId: string | null;
|
|
4808
|
+
liveness: SandboxLeaseLiveness;
|
|
4809
|
+
} | undefined);
|
|
4810
|
+
}
|
|
4811
|
+
export declare class SandboxLeaseTransitionError extends Error {
|
|
4812
|
+
readonly sandboxGroupId: string;
|
|
4813
|
+
readonly leaseEpoch: number;
|
|
4814
|
+
readonly reason: "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress";
|
|
4815
|
+
readonly backend: string;
|
|
4816
|
+
readonly instanceId: string | null;
|
|
4817
|
+
readonly liveness: SandboxLeaseLiveness;
|
|
4818
|
+
readonly name = "SandboxLeaseTransitionError";
|
|
4819
|
+
constructor(sandboxGroupId: string, leaseEpoch: number, reason: "capture_in_progress" | "rotation_in_progress" | "provider_recovery_in_progress", backend: string, instanceId: string | null, liveness: SandboxLeaseLiveness);
|
|
4112
4820
|
}
|
|
4113
4821
|
export type SandboxViewerForceDrainReason = "balance" | "warm_cap";
|
|
4114
4822
|
export declare class SandboxViewerAdmissionBlockedError extends Error {
|
|
@@ -4201,6 +4909,7 @@ export declare function failSandboxRematerialization(db: Database, input: {
|
|
|
4201
4909
|
rematerializationId: string;
|
|
4202
4910
|
failureCode: string;
|
|
4203
4911
|
retryable: boolean;
|
|
4912
|
+
discardContinuity?: boolean;
|
|
4204
4913
|
}): Promise<{
|
|
4205
4914
|
failed: boolean;
|
|
4206
4915
|
lease: LeaseSnapshot | null;
|
|
@@ -4231,11 +4940,14 @@ export declare function commitWarmingToWarm(db: Database, input: {
|
|
|
4231
4940
|
id: string;
|
|
4232
4941
|
verifiedRevision: string;
|
|
4233
4942
|
};
|
|
4943
|
+
/** Exact durable same-workspace receipt returned by the elected provider
|
|
4944
|
+
* continuity recovery. Mutually exclusive with archive hydration. */
|
|
4945
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4234
4946
|
leaseTtlMs: number;
|
|
4235
4947
|
}): Promise<{
|
|
4236
4948
|
committed: boolean;
|
|
4237
4949
|
lease: LeaseSnapshot | null;
|
|
4238
|
-
reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
|
|
4950
|
+
reason?: "stale_epoch" | "rematerialization_required" | "rematerialization_mismatch" | "recovery_mode_conflict" | "continuity_mismatch" | "archive_revision_mismatch" | "archive_generation_mismatch";
|
|
4239
4951
|
}>;
|
|
4240
4952
|
export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
4241
4953
|
accountId: string;
|
|
@@ -4246,6 +4958,7 @@ export declare function recordWarmingSandboxCreated(db: Database, input: {
|
|
|
4246
4958
|
* archive-less create. Provider attribution is accepted only while the
|
|
4247
4959
|
* warming row still carries this same attempt as well as this epoch. */
|
|
4248
4960
|
rematerializationId?: string | null;
|
|
4961
|
+
continuityRecovery?: SandboxProviderContinuityRecovery;
|
|
4249
4962
|
instanceId: string;
|
|
4250
4963
|
resumeBackendId?: string | null;
|
|
4251
4964
|
resumeState?: Record<string, unknown> | null;
|
|
@@ -4643,6 +5356,7 @@ export declare function failWarmingToCold(db: Database, input: {
|
|
|
4643
5356
|
workspaceId: string;
|
|
4644
5357
|
sandboxGroupId: string;
|
|
4645
5358
|
expectedEpoch: number;
|
|
5359
|
+
discardContinuity?: boolean;
|
|
4646
5360
|
}): Promise<void>;
|
|
4647
5361
|
export declare function releaseLeaseHolder(db: Database, input: {
|
|
4648
5362
|
accountId: string;
|
|
@@ -4651,6 +5365,11 @@ export declare function releaseLeaseHolder(db: Database, input: {
|
|
|
4651
5365
|
kind: LeaseHolderKind;
|
|
4652
5366
|
holderId: string;
|
|
4653
5367
|
idleGraceMs: number;
|
|
5368
|
+
/** The caller has crossed the non-detachable physical boundary for this
|
|
5369
|
+
* exact turn holder: every admitted attempt-owned workspace writer has
|
|
5370
|
+
* resolved, rejected, or been physically quiesced. A cancellation listener
|
|
5371
|
+
* that merely prevents a holder leak must leave this false. */
|
|
5372
|
+
workspaceWritersQuiesced?: boolean;
|
|
4654
5373
|
}): Promise<{
|
|
4655
5374
|
liveness: SandboxLeaseLiveness;
|
|
4656
5375
|
refcount: number;
|
|
@@ -4694,11 +5413,16 @@ export declare function reapStaleLeaseHolders(db: Database, input: {
|
|
|
4694
5413
|
* 10s turn heartbeat, so only a DEAD worker's holder ever crosses it). 0/absent
|
|
4695
5414
|
* = legacy never-reap. */
|
|
4696
5415
|
turnHolderTtlMs?: number;
|
|
5416
|
+
/** Delete placement-controller holders after their BrowserSession or
|
|
5417
|
+
* ComputerSession heartbeat dies. Active controllers refresh both the
|
|
5418
|
+
* resource and holder in one API heartbeat; zero disables only for tests. */
|
|
5419
|
+
interactionHolderTtlMs?: number;
|
|
4697
5420
|
idleGraceMs: number;
|
|
4698
5421
|
}): Promise<{
|
|
4699
5422
|
reapedViewers: number;
|
|
4700
5423
|
reapedDirect: number;
|
|
4701
5424
|
reapedTurns: number;
|
|
5425
|
+
reapedInteractions: number;
|
|
4702
5426
|
warmingReset: number;
|
|
4703
5427
|
drained: ReapDrainable[];
|
|
4704
5428
|
}>;
|
|
@@ -4707,6 +5431,7 @@ export declare function reapStaleLeaseHoldersGlobal(db: Database, input: {
|
|
|
4707
5431
|
/** Reap DEAD-WORKER turn holders staler than this (the lease TTL; see
|
|
4708
5432
|
* reapStaleLeaseHolders). 0/absent = never (legacy). */
|
|
4709
5433
|
turnHolderTtlMs?: number;
|
|
5434
|
+
interactionHolderTtlMs?: number;
|
|
4710
5435
|
idleGraceMs: number;
|
|
4711
5436
|
}): Promise<ReapDrainable[]>;
|
|
4712
5437
|
export interface MeterableWarmLease {
|
|
@@ -4741,6 +5466,9 @@ export declare function confirmDrainCold(db: Database, input: {
|
|
|
4741
5466
|
workspaceId: string;
|
|
4742
5467
|
sandboxGroupId: string;
|
|
4743
5468
|
expectedEpoch: number;
|
|
5469
|
+
/** Exact durable teardown ownership. Omission asserts that no claim exists;
|
|
5470
|
+
* a replaced, newly installed, or expired claim always fences this commit. */
|
|
5471
|
+
expectedCaptureId?: string;
|
|
4744
5472
|
/** Definitive provider NotFound before this drain could capture /workspace.
|
|
4745
5473
|
* With no durable archive this must become typed unrecoverable, never a
|
|
4746
5474
|
* clean cold lease that can expose an empty replacement. */
|
|
@@ -4869,6 +5597,8 @@ export declare function advanceWorkspaceGeneration(db: Database, input: {
|
|
|
4869
5597
|
/** Wait before provider admission while an exact archive capture owns this
|
|
4870
5598
|
* lease. The attempt/route fences are re-read on every bounded retry. */
|
|
4871
5599
|
captureWaitMs?: number;
|
|
5600
|
+
/** Cancel the bounded transition wait without creating an admission. */
|
|
5601
|
+
waitSignal?: AbortSignal;
|
|
4872
5602
|
/** Active-routed mutations bind to the exact session pointer. Omitted means
|
|
4873
5603
|
* an intentional home-provider write outside the routing surface. */
|
|
4874
5604
|
routeKind?: "home" | "active";
|
|
@@ -4891,6 +5621,7 @@ export declare function advanceWorkspaceGenerationForDirectRequest(db: Database,
|
|
|
4891
5621
|
routeEpoch: number;
|
|
4892
5622
|
operation: string;
|
|
4893
5623
|
captureWaitMs?: number;
|
|
5624
|
+
waitSignal?: AbortSignal;
|
|
4894
5625
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4895
5626
|
/** Admit one model/user-visible stdin write for an exact retained process. The
|
|
4896
5627
|
* process's original provider and route are authoritative even if the session's
|
|
@@ -4902,6 +5633,7 @@ export declare function advanceWorkspaceGenerationForRetainedProcess(db: Databas
|
|
|
4902
5633
|
processId: string;
|
|
4903
5634
|
operation: string;
|
|
4904
5635
|
captureWaitMs?: number;
|
|
5636
|
+
waitSignal?: AbortSignal;
|
|
4905
5637
|
}): Promise<SandboxWorkspaceMutationAdmission>;
|
|
4906
5638
|
/** Physically settle one exact provider mutation admission after its promise
|
|
4907
5639
|
* resolves or rejects. Rejections need no output acceptance, but still clear
|
|
@@ -5086,8 +5818,58 @@ export declare function readWorkspaceArchiveCapturePreflight(db: Database, input
|
|
|
5086
5818
|
archiveGeneration: number | null;
|
|
5087
5819
|
archiveComplete: boolean;
|
|
5088
5820
|
} | null>;
|
|
5821
|
+
export declare const SANDBOX_REAPER_HOLD_MAX_TTL_MS: number;
|
|
5822
|
+
/** Read the exact operator-hold target without exposing it across an
|
|
5823
|
+
* account/workspace mismatch. The operator CLI projects only non-secret fields
|
|
5824
|
+
* from this snapshot; resumeState remains an internal DB contract. */
|
|
5825
|
+
export declare function readSandboxLeaseReaperHoldTarget(db: Database, input: {
|
|
5826
|
+
accountId: string;
|
|
5827
|
+
workspaceId: string;
|
|
5828
|
+
sandboxGroupId: string;
|
|
5829
|
+
}): Promise<LeaseSnapshot | null>;
|
|
5830
|
+
export type SandboxLeaseReaperHoldResult = {
|
|
5831
|
+
status: "held";
|
|
5832
|
+
renewed: boolean;
|
|
5833
|
+
lease: LeaseSnapshot;
|
|
5834
|
+
} | {
|
|
5835
|
+
status: "lease_fenced" | "not_live" | "held_by_other" | "teardown_in_progress" | "rotation_in_progress" | "provider_deadline_conflict" | "reason_conflict";
|
|
5836
|
+
lease: LeaseSnapshot | null;
|
|
5837
|
+
};
|
|
5838
|
+
/**
|
|
5839
|
+
* Install or renew a bounded operator preservation gate on one exact physical
|
|
5840
|
+
* lease. The row lock serializes this decision with reaper claim acquisition.
|
|
5841
|
+
* A hold never creates/resumes a provider and never overrides teardown already
|
|
5842
|
+
* issued: callers must receive a positive receipt before relying on it.
|
|
5843
|
+
*/
|
|
5844
|
+
export declare function acquireSandboxLeaseReaperHold(db: Database, input: {
|
|
5845
|
+
accountId: string;
|
|
5846
|
+
workspaceId: string;
|
|
5847
|
+
sandboxGroupId: string;
|
|
5848
|
+
expectedEpoch: number;
|
|
5849
|
+
expectedInstanceId: string;
|
|
5850
|
+
holdId: string;
|
|
5851
|
+
ttlMs: number;
|
|
5852
|
+
/** Preserve this much configured rotation headroom after the hold expires.
|
|
5853
|
+
* Callers should pass the deployment's sandboxRotationLeadMs. */
|
|
5854
|
+
providerDeadlineHeadroomMs: number;
|
|
5855
|
+
reason: string;
|
|
5856
|
+
}): Promise<SandboxLeaseReaperHoldResult>;
|
|
5857
|
+
/** Release only the exact operator receipt on the exact physical lease. */
|
|
5858
|
+
export declare function releaseSandboxLeaseReaperHold(db: Database, input: {
|
|
5859
|
+
accountId: string;
|
|
5860
|
+
workspaceId: string;
|
|
5861
|
+
sandboxGroupId: string;
|
|
5862
|
+
expectedEpoch: number;
|
|
5863
|
+
expectedInstanceId: string;
|
|
5864
|
+
holdId: string;
|
|
5865
|
+
}): Promise<boolean>;
|
|
5089
5866
|
export type WorkspaceArchiveCaptureClaim = {
|
|
5090
5867
|
id: string;
|
|
5868
|
+
operationId: string;
|
|
5869
|
+
providerRequestId: string;
|
|
5870
|
+
providerReplaySafe: boolean;
|
|
5871
|
+
takeoverSafe: boolean;
|
|
5872
|
+
attempt: number;
|
|
5091
5873
|
leaseId: string;
|
|
5092
5874
|
leaseEpoch: number;
|
|
5093
5875
|
instanceId: string;
|
|
@@ -5096,13 +5878,29 @@ export type WorkspaceArchiveCaptureClaim = {
|
|
|
5096
5878
|
archiveComplete: boolean;
|
|
5097
5879
|
startedAt: Date;
|
|
5098
5880
|
deadlineAt: Date;
|
|
5881
|
+
/** Non-null only after a verified drain archive was atomically published
|
|
5882
|
+
* under this exact capture. Such a claim may finish teardown, never recapture
|
|
5883
|
+
* or release/re-arm. */
|
|
5884
|
+
publishedAt: Date | null;
|
|
5099
5885
|
};
|
|
5886
|
+
/** Read the authoritative takeover clock for one exact unpublished capture.
|
|
5887
|
+
* Provider recovery must never compare a Postgres deadline with an application
|
|
5888
|
+
* wall clock: clock skew could otherwise fence a still-accepted provider
|
|
5889
|
+
* request early. The eventual replacement remains a separate exact CAS. */
|
|
5890
|
+
export declare function workspaceArchiveCaptureDeadlineElapsed(db: Database, input: {
|
|
5891
|
+
accountId: string;
|
|
5892
|
+
workspaceId: string;
|
|
5893
|
+
sandboxGroupId: string;
|
|
5894
|
+
captureId: string;
|
|
5895
|
+
expectedEpoch: number;
|
|
5896
|
+
expectedInstanceId: string;
|
|
5897
|
+
}): Promise<boolean>;
|
|
5100
5898
|
export type ClaimWorkspaceArchiveCaptureResult = {
|
|
5101
5899
|
status: "claimed";
|
|
5102
5900
|
claim: WorkspaceArchiveCaptureClaim;
|
|
5103
5901
|
lease: LeaseSnapshot;
|
|
5104
5902
|
} | {
|
|
5105
|
-
status: "lease_fenced" | "attempt_fenced" | "capture_in_progress" | "holder_in_progress" | "mutation_in_progress" | "throttled";
|
|
5903
|
+
status: "lease_fenced" | "attempt_fenced" | "reaper_held" | "capture_in_progress" | "holder_in_progress" | "mutation_in_progress" | "throttled";
|
|
5106
5904
|
};
|
|
5107
5905
|
/**
|
|
5108
5906
|
* Atomically reserve one live provider for archive capture. Modal pauses a box
|
|
@@ -5115,11 +5913,19 @@ export declare function claimWorkspaceArchiveCapture(db: Database, input: {
|
|
|
5115
5913
|
workspaceId: string;
|
|
5116
5914
|
sandboxGroupId: string;
|
|
5117
5915
|
captureId: string;
|
|
5916
|
+
/** Stable logical request across retries. Old callers default to the exact
|
|
5917
|
+
* capture id and are normalized the same way by migration 0184's trigger. */
|
|
5918
|
+
operationId?: string;
|
|
5919
|
+
attempt?: number;
|
|
5118
5920
|
expectedEpoch: number;
|
|
5119
5921
|
expectedInstanceId: string;
|
|
5120
5922
|
liveness: "warm" | "draining";
|
|
5121
5923
|
captureTimeoutMs: number;
|
|
5122
5924
|
minIntervalMs: number;
|
|
5925
|
+
/** Explicit provider-registry proof. Optional false defaults preserve safe
|
|
5926
|
+
* rolling behavior for pre-policy callers. */
|
|
5927
|
+
providerReplaySafe?: boolean;
|
|
5928
|
+
takeoverSafe?: boolean;
|
|
5123
5929
|
warmAttempt?: {
|
|
5124
5930
|
sessionId: string;
|
|
5125
5931
|
turnId: string;
|
|
@@ -5138,17 +5944,21 @@ export declare function releaseWorkspaceArchiveCapture(db: Database, input: {
|
|
|
5138
5944
|
expectedInstanceId: string;
|
|
5139
5945
|
}): Promise<boolean>;
|
|
5140
5946
|
/**
|
|
5141
|
-
* Replace
|
|
5142
|
-
*
|
|
5143
|
-
*
|
|
5144
|
-
*
|
|
5947
|
+
* Replace a capture attempt without ever opening the admission gate. A generic
|
|
5948
|
+
* provider remains deadline-gated. A provider registration explicitly recorded
|
|
5949
|
+
* as takeover-safe may retry immediately, using either same-request idempotency
|
|
5950
|
+
* or an independently repeatable read-only capture.
|
|
5951
|
+
* captureId changes to fence teardown ownership; providerRequestId deliberately
|
|
5952
|
+
* does not, so a predecessor success remains adoptable by its successor.
|
|
5145
5953
|
*/
|
|
5146
|
-
export declare function
|
|
5954
|
+
export declare function replaceWorkspaceArchiveCaptureAfterProof(db: Database, input: {
|
|
5147
5955
|
accountId: string;
|
|
5148
5956
|
workspaceId: string;
|
|
5149
5957
|
sandboxGroupId: string;
|
|
5150
5958
|
priorCaptureId: string;
|
|
5151
5959
|
captureId: string;
|
|
5960
|
+
operationId: string;
|
|
5961
|
+
attempt: number;
|
|
5152
5962
|
expectedEpoch: number;
|
|
5153
5963
|
expectedInstanceId: string;
|
|
5154
5964
|
captureTimeoutMs: number;
|
|
@@ -5179,6 +5989,15 @@ export declare function registerSandboxCheckpointArtifact(db: Database, input: {
|
|
|
5179
5989
|
providerBinding: Record<string, unknown>;
|
|
5180
5990
|
workspaceArchive: string;
|
|
5181
5991
|
workspaceArchiveMeta: SandboxArchiveRevision;
|
|
5992
|
+
/**
|
|
5993
|
+
* Workspace checkpoints are identified by their exact capture source.
|
|
5994
|
+
* Provider-image builds instead use a provider-owned idempotency key: a
|
|
5995
|
+
* retry may run from a successor verifier lease but must converge on the
|
|
5996
|
+
* same exact immutable object. The first source remains immutable
|
|
5997
|
+
* provenance; only a byte-identical object in the same tenant/group may be
|
|
5998
|
+
* reused.
|
|
5999
|
+
*/
|
|
6000
|
+
registrationIdentity?: "capture" | "provider_object";
|
|
5182
6001
|
}): Promise<SandboxCheckpointArtifactRegistration>;
|
|
5183
6002
|
/** Hand an unpublished candidate to asynchronous GC. Referenced artifacts are
|
|
5184
6003
|
* protected both here and by the global claim function. */
|
|
@@ -5254,10 +6073,14 @@ export declare function persistDrainSnapshot(db: Database, input: {
|
|
|
5254
6073
|
accountId: string;
|
|
5255
6074
|
workspaceId: string;
|
|
5256
6075
|
sandboxGroupId: string;
|
|
6076
|
+
/** Exact source lease identity. Required for cold late-result adoption. */
|
|
6077
|
+
expectedLeaseId?: string;
|
|
5257
6078
|
expectedEpoch: number;
|
|
5258
6079
|
expectedInstanceId: string;
|
|
5259
6080
|
expectedWorkspaceGeneration: number;
|
|
5260
6081
|
captureId: string;
|
|
6082
|
+
/** Stable provider-operation lineage across atomic claim replacements. */
|
|
6083
|
+
providerRequestId?: string;
|
|
5261
6084
|
} & ({
|
|
5262
6085
|
/** Null performs only the epoch/instance/generation CAS check. */
|
|
5263
6086
|
workspaceArchive: null;
|
|
@@ -5496,6 +6319,17 @@ export declare function recordLeaseTerminalDataPlaneUrl(db: Database, input: {
|
|
|
5496
6319
|
expectedEpoch: number;
|
|
5497
6320
|
terminalDataPlaneUrl: string | null;
|
|
5498
6321
|
}): Promise<LeaseSnapshot | null>;
|
|
6322
|
+
/** Record the browserd controller tunnel for one exact warm provider instance.
|
|
6323
|
+
* Unlike desktop/terminal viewer URLs, this endpoint is an internal transport
|
|
6324
|
+
* cache: controller bearer tokens still enforce per-resource authority. */
|
|
6325
|
+
export declare function recordLeaseControllerDataPlaneUrl(db: Database, input: {
|
|
6326
|
+
accountId: string;
|
|
6327
|
+
workspaceId: string;
|
|
6328
|
+
sandboxGroupId: string;
|
|
6329
|
+
expectedEpoch: number;
|
|
6330
|
+
expectedInstanceId: string;
|
|
6331
|
+
controllerDataPlaneUrl: string | null;
|
|
6332
|
+
}): Promise<LeaseSnapshot | null>;
|
|
5499
6333
|
export type SandboxKind = (typeof schema.sandboxKindValues)[number];
|
|
5500
6334
|
export type EnrollmentExposure = (typeof schema.enrollmentExposureValues)[number];
|
|
5501
6335
|
export type EnrollmentStatus = (typeof schema.enrollmentStatusValues)[number];
|
|
@@ -5552,7 +6386,7 @@ export declare function listEnrollments(db: Database, workspaceId: string, optio
|
|
|
5552
6386
|
status?: EnrollmentStatus;
|
|
5553
6387
|
}): Promise<EnrollmentRecord[]>;
|
|
5554
6388
|
export type MachineRemovalOutcome = (typeof schema.machineRemovalOperationOutcomeValues)[number];
|
|
5555
|
-
export type MachineRemovalBlockCode = "active_route" | "active_commands" | "active_lease" | "recovery_pending" | "not_selfhosted";
|
|
6389
|
+
export type MachineRemovalBlockCode = "active_route" | "active_commands" | "machine_home" | "active_lease" | "recovery_pending" | "not_selfhosted";
|
|
5556
6390
|
export type MachineRemovalResult = {
|
|
5557
6391
|
enrollmentId: string;
|
|
5558
6392
|
outcome: MachineRemovalOutcome;
|
|
@@ -5563,6 +6397,10 @@ export type MachineRemovalResult = {
|
|
|
5563
6397
|
code: MachineRemovalBlockCode | null;
|
|
5564
6398
|
message: string;
|
|
5565
6399
|
action: string;
|
|
6400
|
+
dependentSessions: Array<{
|
|
6401
|
+
id: string;
|
|
6402
|
+
title: string | null;
|
|
6403
|
+
}>;
|
|
5566
6404
|
};
|
|
5567
6405
|
export declare class MachineRemovalIdempotencyError extends Error {
|
|
5568
6406
|
readonly name = "MachineRemovalIdempotencyError";
|
|
@@ -5573,11 +6411,12 @@ export declare class MachineRemovalRevisionConflictError extends Error {
|
|
|
5573
6411
|
constructor(message: string, currentUpdatedAt: string);
|
|
5574
6412
|
}
|
|
5575
6413
|
/**
|
|
5576
|
-
* Remove one connected-machine enrollment without
|
|
5577
|
-
* or
|
|
5578
|
-
*
|
|
5579
|
-
*
|
|
5580
|
-
*
|
|
6414
|
+
* Remove one connected-machine enrollment without deleting durable identity,
|
|
6415
|
+
* conversation, or audit evidence. Idle sessions using the machine are detached
|
|
6416
|
+
* to `none`; active work and recovery fences still block removal. The enrollment
|
|
6417
|
+
* row is the lifecycle truth: status -> revoked rejects future auth-callout/
|
|
6418
|
+
* heartbeat/reconnect attempts, while a fresh device-flow re-enrollment can
|
|
6419
|
+
* reactivate the same public-key identity with a new credential family.
|
|
5581
6420
|
*
|
|
5582
6421
|
* The operation key is scoped to the workspace and is receipt-backed. A retry
|
|
5583
6422
|
* with the same key and request fingerprint replays the exact committed result;
|
|
@@ -5942,6 +6781,12 @@ export type CreateSessionGoalInput = {
|
|
|
5942
6781
|
text: string;
|
|
5943
6782
|
successCriteria?: string | null;
|
|
5944
6783
|
maxAutoContinuations?: number | null;
|
|
6784
|
+
mutationPolicy?: SessionGoalMutationPolicy;
|
|
6785
|
+
expectedObjectiveRevision?: number;
|
|
6786
|
+
expectedGoalId?: string;
|
|
6787
|
+
changeKind?: SessionGoalChangeKind;
|
|
6788
|
+
changeRationale?: string;
|
|
6789
|
+
sourceProposalId?: string;
|
|
5945
6790
|
createdBy: SessionGoalCreatedBy;
|
|
5946
6791
|
};
|
|
5947
6792
|
export declare function createSessionGoal(db: Database, input: CreateSessionGoalInput): Promise<SessionGoal>;
|
|
@@ -5989,15 +6834,21 @@ export declare function upsertSessionGoalWithEvent(db: Database, input: CreateSe
|
|
|
5989
6834
|
}): Promise<{
|
|
5990
6835
|
goal: SessionGoal;
|
|
5991
6836
|
replaced: boolean;
|
|
6837
|
+
workflowWakeRevision: number | null;
|
|
5992
6838
|
events: SessionEvent[];
|
|
5993
6839
|
}>;
|
|
6840
|
+
export declare function listSessionGoalRevisions(db: Database, workspaceId: string, sessionId: string): Promise<SessionGoalRevision[]>;
|
|
6841
|
+
export declare function getSessionGoalRevision(db: Database, workspaceId: string, sessionId: string, revisionId: string): Promise<SessionGoalRevision | null>;
|
|
5994
6842
|
/**
|
|
5995
|
-
*
|
|
5996
|
-
*
|
|
6843
|
+
* Low-level semantic goal revision. The established lifecycle version still
|
|
6844
|
+
* advances so stale continuation updates are cancelled, while the migration
|
|
6845
|
+
* trigger advances the separate objective revision. A semantic rewrite is not
|
|
6846
|
+
* execution progress and therefore never resets the no-progress streak.
|
|
5997
6847
|
*/
|
|
5998
6848
|
export declare function updateSessionGoal(db: Database, workspaceId: string, sessionId: string, input: {
|
|
5999
6849
|
text?: string;
|
|
6000
6850
|
successCriteria?: string | null;
|
|
6851
|
+
mutationPolicy?: SessionGoalMutationPolicy;
|
|
6001
6852
|
}): Promise<SessionGoal>;
|
|
6002
6853
|
/**
|
|
6003
6854
|
* Agent goal_update: session sequence ownership, goal mutation, and its audit
|
|
@@ -6008,7 +6859,12 @@ export declare function updateSessionGoal(db: Database, workspaceId: string, ses
|
|
|
6008
6859
|
export declare function updateSessionGoalWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
6009
6860
|
text?: string;
|
|
6010
6861
|
successCriteria?: string | null;
|
|
6862
|
+
mutationPolicy?: SessionGoalMutationPolicy;
|
|
6863
|
+
/** @deprecated A semantic rewrite never counts as progress; use goal_progress. */
|
|
6011
6864
|
progressNote?: string;
|
|
6865
|
+
changeKind?: SessionGoalChangeKind;
|
|
6866
|
+
rationale?: string;
|
|
6867
|
+
expectedObjectiveRevision?: number;
|
|
6012
6868
|
actor: "agent" | "api";
|
|
6013
6869
|
command?: {
|
|
6014
6870
|
accountId: string;
|
|
@@ -6022,6 +6878,28 @@ export declare function updateSessionGoalWithEvent(db: Database, workspaceId: st
|
|
|
6022
6878
|
events: SessionEvent[];
|
|
6023
6879
|
operationId: string | null;
|
|
6024
6880
|
replay: boolean;
|
|
6881
|
+
outcome: "applied" | "proposed";
|
|
6882
|
+
proposalId: string | null;
|
|
6883
|
+
}>;
|
|
6884
|
+
/**
|
|
6885
|
+
* Record execution progress without changing goal semantics or either goal
|
|
6886
|
+
* revision. The attempt-fenced operation receipt makes a recovered tool call
|
|
6887
|
+
* converge on the original event instead of manufacturing progress twice.
|
|
6888
|
+
*/
|
|
6889
|
+
export declare function recordSessionGoalProgressWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
|
|
6890
|
+
progressNote: string;
|
|
6891
|
+
command: {
|
|
6892
|
+
accountId: string;
|
|
6893
|
+
actor: Extract<SessionCommandActor, {
|
|
6894
|
+
type: "agent_attempt";
|
|
6895
|
+
}>;
|
|
6896
|
+
operationKey: string;
|
|
6897
|
+
};
|
|
6898
|
+
}): Promise<{
|
|
6899
|
+
goal: SessionGoal;
|
|
6900
|
+
events: SessionEvent[];
|
|
6901
|
+
operationId: string;
|
|
6902
|
+
replay: boolean;
|
|
6025
6903
|
}>;
|
|
6026
6904
|
/**
|
|
6027
6905
|
* Sets a session's display title. The clobber guard lives entirely in this
|
|
@@ -6168,6 +7046,7 @@ export type InitializeSessionStartInput = {
|
|
|
6168
7046
|
text: string;
|
|
6169
7047
|
successCriteria?: string | null;
|
|
6170
7048
|
maxAutoContinuations?: number | null;
|
|
7049
|
+
mutationPolicy?: SessionGoalMutationPolicy;
|
|
6171
7050
|
} | null;
|
|
6172
7051
|
consumeNewSessionDraft?: {
|
|
6173
7052
|
subjectId: string;
|
|
@@ -6202,6 +7081,10 @@ export type SessionWorkTrigger = {
|
|
|
6202
7081
|
export declare const MAX_INTERNAL_UPDATE_BYTES: number;
|
|
6203
7082
|
export declare const MAX_INTERNAL_UPDATE_BATCH_MEMBERS = 100;
|
|
6204
7083
|
export declare const MAX_INTERNAL_UPDATE_BATCH_BYTES: number;
|
|
7084
|
+
export type FrozenXaiExecutionAuthority = {
|
|
7085
|
+
snapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
7086
|
+
subjectId: string | null;
|
|
7087
|
+
};
|
|
6205
7088
|
export type ClaimSessionWorkForAttemptInput = {
|
|
6206
7089
|
sessionId: string;
|
|
6207
7090
|
workflowId: string;
|
|
@@ -6217,6 +7100,11 @@ export type ClaimSessionWorkForAttemptResult = {
|
|
|
6217
7100
|
action: "unclaimed";
|
|
6218
7101
|
reason: "gate-closed" | "no-work" | "stale-approval" | "control-pending";
|
|
6219
7102
|
};
|
|
7103
|
+
/**
|
|
7104
|
+
* Bound legacy exact goal content only at the immutable model-context snapshot
|
|
7105
|
+
* boundary. The canonical goal/revision remains byte-for-byte unchanged.
|
|
7106
|
+
*/
|
|
7107
|
+
export declare function projectSessionGoalPromptField(value: string, maxBytes: number): string;
|
|
6220
7108
|
/**
|
|
6221
7109
|
* Claim and register one inference attempt after a turn worker has accepted the
|
|
6222
7110
|
* Temporal activity. This is the only transition into `running`: queue choice,
|
|
@@ -6245,7 +7133,7 @@ export type SessionAttemptInterruptionSettlement = {
|
|
|
6245
7133
|
* that recovery event is the logical settlement cause in place of a
|
|
6246
7134
|
* Pause/Steer interruption row.
|
|
6247
7135
|
*/
|
|
6248
|
-
export
|
|
7136
|
+
export type MarkSessionAttemptQuiescedInput = {
|
|
6249
7137
|
accountId?: string;
|
|
6250
7138
|
workspaceId: string;
|
|
6251
7139
|
sessionId: string;
|
|
@@ -6260,7 +7148,19 @@ export declare function markSessionAttemptQuiesced(db: Database, input: {
|
|
|
6260
7148
|
* admission remains strict because only a durable interruption needs this
|
|
6261
7149
|
* receipt. */
|
|
6262
7150
|
allowUninterrupted?: boolean;
|
|
6263
|
-
}
|
|
7151
|
+
};
|
|
7152
|
+
export type SessionAttemptQuiescenceCommit = {
|
|
7153
|
+
events: SessionEvent[];
|
|
7154
|
+
/** The exact still-undelivered outbox fact created by this commit, or found
|
|
7155
|
+
* on an idempotent replay after a post-commit caller failure. Postgres remains
|
|
7156
|
+
* the durable fallback; callers may deliver this fact immediately. */
|
|
7157
|
+
workflowWake: SessionWorkflowWake | null;
|
|
7158
|
+
};
|
|
7159
|
+
export declare function commitSessionAttemptQuiescence(db: Database, input: MarkSessionAttemptQuiescedInput): Promise<SessionAttemptQuiescenceCommit>;
|
|
7160
|
+
/** Compatibility projection for callers that only publish the committed
|
|
7161
|
+
* events. The turn activity uses `commitSessionAttemptQuiescence` so it can
|
|
7162
|
+
* immediately deliver the returned durable wake without waiting for repair. */
|
|
7163
|
+
export declare function markSessionAttemptQuiesced(db: Database, input: MarkSessionAttemptQuiescedInput): Promise<SessionEvent[]>;
|
|
6264
7164
|
export type ReconcileSessionAttemptQuiescenceResult = {
|
|
6265
7165
|
action: "quiesced";
|
|
6266
7166
|
events: SessionEvent[];
|
|
@@ -6318,6 +7218,7 @@ export type SessionWorkPeek = {
|
|
|
6318
7218
|
} | {
|
|
6319
7219
|
kind: "approval-wait";
|
|
6320
7220
|
humanInputRequestId?: string;
|
|
7221
|
+
interactionInterventionId?: string;
|
|
6321
7222
|
expiresAt?: string;
|
|
6322
7223
|
} | {
|
|
6323
7224
|
kind: "capacity-wait";
|
|
@@ -6401,6 +7302,12 @@ export type ApplySessionTurnSettlementInput = {
|
|
|
6401
7302
|
allowSkip: boolean;
|
|
6402
7303
|
expiresAt?: Date | null;
|
|
6403
7304
|
}>;
|
|
7305
|
+
interactionInterventionRequests?: Array<{
|
|
7306
|
+
id: string;
|
|
7307
|
+
operationId: string;
|
|
7308
|
+
toolCallId: string;
|
|
7309
|
+
input: RequestHumanInteractionToolInput;
|
|
7310
|
+
}>;
|
|
6404
7311
|
};
|
|
6405
7312
|
recording?: SessionTurnRecordingSettlement;
|
|
6406
7313
|
/**
|
|
@@ -6610,6 +7517,7 @@ export type SessionSystemUpdateOutboxDelivery = {
|
|
|
6610
7517
|
payload: ChildTerminalResultPayload;
|
|
6611
7518
|
lineage: Record<string, unknown>;
|
|
6612
7519
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
7520
|
+
xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
|
|
6613
7521
|
};
|
|
6614
7522
|
/**
|
|
6615
7523
|
* Read the exact durable parent-update row created by terminal turn settlement.
|
|
@@ -6716,6 +7624,7 @@ export type AddSessionSystemUpdateInput = {
|
|
|
6716
7624
|
summary: string;
|
|
6717
7625
|
lineage?: Record<string, unknown>;
|
|
6718
7626
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
7627
|
+
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
6719
7628
|
} & SessionSystemUpdateInputVariant;
|
|
6720
7629
|
export type AddSessionSystemUpdateResult = {
|
|
6721
7630
|
added: false;
|
|
@@ -6735,7 +7644,7 @@ export declare function addSessionSystemUpdate(db: Database, input: AddSessionSy
|
|
|
6735
7644
|
* Persist one internal update without fabricating a user prompt or queue row.
|
|
6736
7645
|
* Dedupe and any producer/outbox mutation commit in the same transaction.
|
|
6737
7646
|
*/
|
|
6738
|
-
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null) => Promise<void>): Promise<AddSessionSystemUpdateResult>;
|
|
7647
|
+
export declare function addSessionSystemUpdateWithSourceMutation(db: Database, input: AddSessionSystemUpdateInput, mutateSource: (tx: Database, wakeEventId: string | null, updateId: string | null) => Promise<void>): Promise<AddSessionSystemUpdateResult>;
|
|
6739
7648
|
export declare function listOutstandingSessionSystemUpdates(db: Database, workspaceId: string, sessionId: string): Promise<SessionSystemUpdate[]>;
|
|
6740
7649
|
/** Internal updates atomically attached when this inference was claimed. */
|
|
6741
7650
|
export declare function listSessionSystemUpdatesForTurn(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionSystemUpdate[]>;
|
|
@@ -6761,7 +7670,29 @@ export declare function acceptSessionApprovalDecision(db: Database, input: {
|
|
|
6761
7670
|
subjectId: string;
|
|
6762
7671
|
payload: Record<string, unknown>;
|
|
6763
7672
|
clientEventId?: string | null;
|
|
7673
|
+
interactionIntervention?: {
|
|
7674
|
+
interventionId: string;
|
|
7675
|
+
operationId: string;
|
|
7676
|
+
expectedVersion: number;
|
|
7677
|
+
outcome: "completed" | "dismissed";
|
|
7678
|
+
};
|
|
6764
7679
|
}): Promise<AcceptSessionApprovalDecisionResult>;
|
|
7680
|
+
export type ExpireSessionInteractionInterventionResult = {
|
|
7681
|
+
action: "expired" | "stale" | "not_found";
|
|
7682
|
+
events: SessionEvent[];
|
|
7683
|
+
};
|
|
7684
|
+
/**
|
|
7685
|
+
* Expire one model-owned intervention through the same exact approval boundary
|
|
7686
|
+
* as a human rejection. The resource settlement and rejection event commit
|
|
7687
|
+
* together inside acceptSessionApprovalDecision; a race with a human response
|
|
7688
|
+
* becomes an event-free stale result.
|
|
7689
|
+
*/
|
|
7690
|
+
export declare function expireSessionInteractionIntervention(db: Database, input: {
|
|
7691
|
+
accountId: string;
|
|
7692
|
+
workspaceId: string;
|
|
7693
|
+
sessionId: string;
|
|
7694
|
+
interventionId: string;
|
|
7695
|
+
}): Promise<ExpireSessionInteractionInterventionResult>;
|
|
6765
7696
|
/**
|
|
6766
7697
|
* Durable attempt fence for activity-produced events. A cancelled or replaced
|
|
6767
7698
|
* attempt may still flush SDK callbacks after Temporal cancellation; those late
|
|
@@ -6772,6 +7703,46 @@ export declare function appendSessionEventsForTurnAttempt(db: Database, workspac
|
|
|
6772
7703
|
events: SessionEvent[];
|
|
6773
7704
|
accepted: boolean;
|
|
6774
7705
|
}>;
|
|
7706
|
+
/**
|
|
7707
|
+
* Commit one exact-attempt mutation and its timeline projection together. The
|
|
7708
|
+
* mutation runs first so Codemode's operation-row lock order remains stable;
|
|
7709
|
+
* returning false leaves both the mutation and projection absent.
|
|
7710
|
+
*/
|
|
7711
|
+
export declare function mutateAndAppendSessionEventsForTurnAttempt(db: Database, workspaceId: string, sessionId: string, turnId: string, executionGeneration: number, attemptId: string, inputs: AppendEventInput[], mutate: (tx: Database) => Promise<boolean>): Promise<{
|
|
7712
|
+
events: SessionEvent[];
|
|
7713
|
+
accepted: boolean;
|
|
7714
|
+
mutationApplied: boolean;
|
|
7715
|
+
}>;
|
|
7716
|
+
export type SettleCodemodeOperationWithOutputInput = {
|
|
7717
|
+
accountId: string;
|
|
7718
|
+
workspaceId: string;
|
|
7719
|
+
sessionId: string;
|
|
7720
|
+
turnId: string;
|
|
7721
|
+
attemptId: string;
|
|
7722
|
+
executionGeneration: number;
|
|
7723
|
+
operationId: string;
|
|
7724
|
+
claimId: string;
|
|
7725
|
+
producerId: string;
|
|
7726
|
+
settlement: {
|
|
7727
|
+
state: "completed";
|
|
7728
|
+
result: AttemptToolResult;
|
|
7729
|
+
} | {
|
|
7730
|
+
state: "failed" | "outcome_unknown";
|
|
7731
|
+
errorCode: string;
|
|
7732
|
+
errorMessage: string;
|
|
7733
|
+
};
|
|
7734
|
+
};
|
|
7735
|
+
/**
|
|
7736
|
+
* The Codemode terminal journal row and its visible tool-call output are one
|
|
7737
|
+
* PostgreSQL commit. A worker crash can lose only live NATS fanout, which the
|
|
7738
|
+
* ordinary durable event replay repairs; it cannot leave a completed call
|
|
7739
|
+
* permanently spinning in the timeline.
|
|
7740
|
+
*/
|
|
7741
|
+
export declare function settleCodemodeOperationWithOutput(db: Database, input: SettleCodemodeOperationWithOutputInput): Promise<{
|
|
7742
|
+
committed: boolean;
|
|
7743
|
+
events: SessionEvent[];
|
|
7744
|
+
accepted: boolean;
|
|
7745
|
+
}>;
|
|
6775
7746
|
export declare function appendSessionEventToSandboxGroup(db: Database, workspaceId: string, sandboxGroupId: string, input: AppendEventInput): Promise<SessionEvent[]>;
|
|
6776
7747
|
export declare function appendSessionEventsAndUpdateSession(db: Database, workspaceId: string, sessionId: string, inputs: AppendEventInput[], update: {
|
|
6777
7748
|
resources?: ResourceRef[];
|
|
@@ -6802,7 +7773,14 @@ type LockedSessionUpdateResult = {
|
|
|
6802
7773
|
activeTurnId?: string | null;
|
|
6803
7774
|
};
|
|
6804
7775
|
};
|
|
6805
|
-
|
|
7776
|
+
/**
|
|
7777
|
+
* Serialize a callback with the session/event lock prefix and append its result.
|
|
7778
|
+
* Callers must declare whether the callback can produce semantic activity. A
|
|
7779
|
+
* raw-only declaration skips the commit gate and is verified before any event
|
|
7780
|
+
* or session-row write; conditional semantic callbacks may legitimately no-op.
|
|
7781
|
+
*/
|
|
7782
|
+
export declare function appendSessionEventsWithLockedSessionUpdate(db: Database, workspaceId: string, sessionId: string, build: (session: Session, context: LockedSessionUpdateContext) => LockedSessionUpdateResult | Promise<LockedSessionUpdateResult>, options: {
|
|
7783
|
+
activity: "raw-only" | "semantic";
|
|
6806
7784
|
lockParentSession?: boolean;
|
|
6807
7785
|
}): Promise<SessionEvent[]>;
|
|
6808
7786
|
export declare function sessionSubject(workspaceId: string, sessionId: string): string;
|
|
@@ -6810,7 +7788,25 @@ export declare function buildCodexTokenResolver(db: Database, settings: Settings
|
|
|
6810
7788
|
export declare function fetchCodexUsageForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexUsageForAccountCore>;
|
|
6811
7789
|
export declare function fetchCodexRateLimitResetCreditsForAccount(db: Database, settings: Settings, workspaceId: string, credentialId: string, fetchImpl?: CodexFetch): ReturnType<typeof fetchCodexRateLimitResetCreditsForAccountCore>;
|
|
6812
7790
|
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
|
|
7791
|
+
export { withCodexTokenDeadline, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun, type CodexCredentialTokens, type CodexRateLimitResetCreditsAccountResult, type CodexTokenDeadlineClock, type CodexTokenDeadlineOptions, } from "./codex-token-resolver.js";
|
|
7792
|
+
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";
|
|
7793
|
+
export { CapabilityComponentVersionConflictError, cleanupOrphanedCapabilityComponents, effectiveCapabilityOwnerSql, type CapabilityComponentOwnerIdentity, } from "./capability-components.js";
|
|
7794
|
+
export { adoptPackComponentReferences, finalizePackComponentOwnership, listPackInstallationComponents, PackComponentResolutionError, previewPackComponentRelease, recordPackInlineSkillComponent, releasePackComponents, resolvePackComponentReferences, resolvePackInlineSkillReferences, type PackInlineSkillRequirement, type StoredPackInstallationComponent, } from "./pack-components.js";
|
|
7795
|
+
export { deferPackInstallationOperation, finalizePackInstallationOperation, finalizePackUninstallOperation, PackManifestChangedError, PackOperationClaimLostError, PackOperationInProgressError, PackInstallationVersionConflictError, PackInstallationVersionRequiredError, PackOperationIdempotencyError, preparePackInstallationOperation, preparePackUninstallOperation, touchPackInstallationOperation, type PreparedPackInstallation, } from "./pack-installations.js";
|
|
7796
|
+
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";
|
|
7797
|
+
export * from "./workspace-artifacts.js";
|
|
7798
|
+
export * from "./transcription-recordings.js";
|
|
7799
|
+
export * from "./editable-artifacts.js";
|
|
7800
|
+
export * from "./editable-artifact-materialization.js";
|
|
7801
|
+
export * from "./attempt-tool-catalogs.js";
|
|
7802
|
+
export * from "./codemode-operations.js";
|
|
7803
|
+
export * from "./browser-sessions.js";
|
|
7804
|
+
export * from "./computer-sessions.js";
|
|
7805
|
+
export * from "./browser-identities.js";
|
|
7806
|
+
export * from "./browser-state-artifacts.js";
|
|
7807
|
+
export * from "./browser-auth.js";
|
|
7808
|
+
export * from "./browser-downloads.js";
|
|
7809
|
+
export * from "./attached-browser-devices.js";
|
|
7810
|
+
export * from "./interaction-revisions.js";
|
|
7811
|
+
export * from "./canonical-human-identities.js";
|
|
7812
|
+
export * from "./session-tenancy.js";
|