@opengeni/db 0.31.1 → 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.
Files changed (122) hide show
  1. package/dist/browser-auth.d.ts +209 -1
  2. package/dist/browser-downloads.d.ts +51 -0
  3. package/dist/browser-identities.d.ts +11 -2
  4. package/dist/browser-sessions.d.ts +83 -1
  5. package/dist/browser-state-artifacts.d.ts +75 -1
  6. package/dist/canonical-human-identities.d.ts +48 -0
  7. package/dist/canonical-human-identities.js +28 -0
  8. package/dist/canonical-human-identities.js.map +1 -0
  9. package/dist/capability-integrations.d.ts +8 -6
  10. package/dist/{chunk-MWDVXQOL.js → chunk-5KTIEDX7.js} +5773 -4212
  11. package/dist/chunk-5KTIEDX7.js.map +1 -0
  12. package/dist/{chunk-NBE6CHRI.js → chunk-CQZ4QSP5.js} +49 -9
  13. package/dist/chunk-CQZ4QSP5.js.map +1 -0
  14. package/dist/chunk-F32YT7MP.js +117 -0
  15. package/dist/chunk-F32YT7MP.js.map +1 -0
  16. package/dist/{chunk-ISI2TIUG.js → chunk-JC5QPLUM.js} +30 -3
  17. package/dist/chunk-JC5QPLUM.js.map +1 -0
  18. package/dist/{chunk-F5FT7BEZ.js → chunk-P3RE4D2B.js} +2 -2
  19. package/dist/chunk-TAUTWOS5.js +259 -0
  20. package/dist/chunk-TAUTWOS5.js.map +1 -0
  21. package/dist/{chunk-YHZXQ7HP.js → chunk-VKLB2ZGI.js} +446 -19
  22. package/dist/chunk-VKLB2ZGI.js.map +1 -0
  23. package/dist/database.d.ts +5 -0
  24. package/dist/editable-artifact-durable-export.js +2 -2
  25. package/dist/editable-artifacts.js +3 -3
  26. package/dist/index.d.ts +438 -29
  27. package/dist/index.js +35640 -28969
  28. package/dist/index.js.map +1 -1
  29. package/dist/insights.d.ts +23 -7
  30. package/dist/integration-bindings.d.ts +24 -24
  31. package/dist/integration-facets.d.ts +99 -0
  32. package/dist/interaction-revisions.d.ts +11 -0
  33. package/dist/interaction-schema.d.ts +698 -34
  34. package/dist/provision-roles.js +1 -1
  35. package/dist/runtime-posture.d.ts +8 -7
  36. package/dist/schema.d.ts +9464 -5412
  37. package/dist/schema.js +51 -9
  38. package/dist/session-control.d.ts +29 -3
  39. package/dist/session-tenancy.d.ts +44 -0
  40. package/dist/session-tenancy.js +16 -0
  41. package/dist/session-tenancy.js.map +1 -0
  42. package/dist/slack-task-policy-schema.d.ts +847 -0
  43. package/dist/slack-task-policy.d.ts +65 -0
  44. package/dist/task-notes-schema.d.ts +924 -0
  45. package/dist/task-notes.d.ts +85 -0
  46. package/dist/video-generation.d.ts +9 -0
  47. package/dist/video-generation.js +5 -3
  48. package/dist/xai-subscription.d.ts +326 -0
  49. package/drizzle/0212_browser_state_transfer_hardening.sql +560 -0
  50. package/drizzle/0213_browser_interaction_authority.sql +67 -0
  51. package/drizzle/0214_browser_download_saves.sql +34 -0
  52. package/drizzle/0215_browser_controller_host.sql +385 -0
  53. package/drizzle/0216_browser_auth_health_evidence.sql +137 -0
  54. package/drizzle/0217_external_browser_auth_operations.sql +22 -0
  55. package/drizzle/0218_organization_tenancy_foundation.sql +299 -0
  56. package/drizzle/0219_organization_tenancy_managed_human_provisioning.sql +317 -0
  57. package/drizzle/0219_site_auth_maintenance_sessions.sql +234 -0
  58. package/drizzle/0220_memory_slack_append_only_cascade.sql +38 -0
  59. package/drizzle/0220_session_channels.sql +54 -0
  60. package/drizzle/0221_sessions_channel_index.sql +5 -0
  61. package/drizzle/0222_session_visibility_authority_epochs.sql +158 -0
  62. package/drizzle/0222_sessions_channel_fk.sql +89 -0
  63. package/drizzle/0223_pending_tool_event_output.sql +55 -0
  64. package/drizzle/0223_sessions_channel_fk_validate.sql +118 -0
  65. package/drizzle/0224_slack_post_outcome_reconciliation.sql +123 -0
  66. package/drizzle/0225_session_visibility_fork_activation.sql +1363 -0
  67. package/drizzle/0226_personal_codex_authority_foundation.sql +365 -0
  68. package/drizzle/0227_slack_native_actions.sql +145 -0
  69. package/drizzle/0228_interaction_controller_data_plane.sql +14 -0
  70. package/drizzle/0228_slack_task_policy.sql +400 -0
  71. package/drizzle/0229_slack_inbox_file_fact.sql +10 -0
  72. package/drizzle/0230_user_scoped_variable_sets_rigs.sql +84 -0
  73. package/drizzle/0231_integration_definition_identity_cutover.sql +271 -0
  74. package/drizzle/0232_integration_facet_authority_cutover.sql +610 -0
  75. package/drizzle/0233_skill_and_integration_authority_cutover.sql +1162 -0
  76. package/drizzle/0234_xai_subscription_authority.sql +1139 -0
  77. package/drizzle/0235_canonical_human_login_bindings.sql +920 -0
  78. package/drizzle/0236_browser_identity_lifecycle.sql +39 -0
  79. package/drizzle/0236_session_visibility_slack_policy.sql +72 -0
  80. package/drizzle/0237_interaction_transition_reaper.sql +263 -0
  81. package/drizzle/0238_goal_persistence_policy.sql +471 -0
  82. package/drizzle/0238_supergrok_realtime_model.sql +29 -0
  83. package/drizzle/0239_supergrok_video_funding.sql +50 -0
  84. package/drizzle/0239_task_tree_notes.sql +990 -0
  85. package/package.json +13 -5
  86. package/src/browser-auth.ts +2600 -123
  87. package/src/browser-downloads.ts +517 -0
  88. package/src/browser-identities.ts +220 -3
  89. package/src/browser-sessions.ts +334 -45
  90. package/src/browser-state-artifacts.ts +402 -12
  91. package/src/canonical-human-identities.ts +317 -0
  92. package/src/capability-integrations.ts +121 -213
  93. package/src/database.ts +41 -1
  94. package/src/index.ts +4157 -394
  95. package/src/insights.ts +109 -28
  96. package/src/integration-bindings.ts +101 -101
  97. package/src/{integration-features.ts → integration-facets.ts} +187 -184
  98. package/src/interaction-revisions.ts +33 -3
  99. package/src/interaction-schema.ts +311 -8
  100. package/src/pack-components.ts +43 -43
  101. package/src/pack-installations.ts +0 -43
  102. package/src/plugin-packages.ts +9 -9
  103. package/src/provision-roles.ts +232 -0
  104. package/src/runtime-posture.ts +227 -14
  105. package/src/schema.ts +1188 -75
  106. package/src/session-control.ts +122 -37
  107. package/src/session-queue-commands.ts +78 -1
  108. package/src/session-tenancy.ts +188 -0
  109. package/src/session-tool-call-settlement.ts +9 -3
  110. package/src/slack-task-policy-schema.ts +130 -0
  111. package/src/slack-task-policy.ts +341 -0
  112. package/src/task-notes-schema.ts +135 -0
  113. package/src/task-notes.ts +178 -0
  114. package/src/video-generation.ts +90 -12
  115. package/src/workspace-artifacts.ts +1 -1
  116. package/src/xai-subscription.ts +1887 -0
  117. package/dist/chunk-ISI2TIUG.js.map +0 -1
  118. package/dist/chunk-MWDVXQOL.js.map +0 -1
  119. package/dist/chunk-NBE6CHRI.js.map +0 -1
  120. package/dist/chunk-YHZXQ7HP.js.map +0 -1
  121. package/dist/integration-features.d.ts +0 -99
  122. /package/dist/{chunk-F5FT7BEZ.js.map → chunk-P3RE4D2B.js.map} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { AccessContext, AccessGrant, AccessPrincipalKind, ApiKey, AttemptToolResult, BillingBalance, CapabilityCatalogItem, CapabilityInstallation, CapabilityKind, CapabilityPack, CapabilitySource, ConnectionKind, ConnectionMetadata, ConnectionStatus, DocumentAuthorityKind, McpServerConnectionRef, FileAsset, FileUploadStatus, FirstPartyMcpToolName, HumanInputQuestion, HumanInputResponse, KnowledgeMemory, KnowledgeMemoryKind, KnowledgeMemoryStatus, KnowledgeSourceRef, GitHubInstallationAuthorityKind, GitHubRepositoryScope, HostEventExportBatch, HostUsageExportBatch, ManagedAccount, McpPersonalConnectionDelegation, Permission, PackInstallation, PackInstallationStatus, ResourceRef, SandboxBackend, SandboxOs, ScheduledTask, ScheduledTaskAction, ScheduledTaskActionKind, KnowledgeSourceSyncAction, ScheduledTaskAgentConfig, ScheduledTaskOverlapPolicy, ScheduledTaskRun, ScheduledTaskRunMode, ScheduledTaskRunStatus, ScheduledTaskScheduleSpec, ScheduledTaskStatus, ScheduledTaskTriggerType, SlackInstallationBinding, Session, SessionAuthorizationListScope, SessionListResponse, SessionEvent, SessionEventPayloadMode, SessionEventReadDirection, SessionEventSemanticClass, SessionEventType, SessionGoal, SessionGoalCreatedBy, SessionGoalStatus, SessionHumanInputRequest, LineageNode, SessionMcpApprovalPolicy, SessionSkill, SessionMcpServerMetadata, SessionStatus, SessionToolPolicy, SessionTurn, SessionQueueSnapshot, SessionSystemUpdate, SessionSystemUpdateKind, SystemUpdateClassification, SessionTurnSource, SessionTurnStatus, TurnInitiator, TurnInitiatorContext, SocialConnection, SocialConnectionStatus, SocialPost, SocialProvider, ToolRef, ReasoningEffort, UsageEvent, Workspace, WorkspaceControlEvent, VariableSet, VariableSetSecret, VariableSetVariableMetadata, WorkspaceMember, WorkspaceRegisteredPack, Rig, RigProviderImage, RigProviderImages, RigVersion, RigChange, RigChangeKind, RigChangeStatus, RigCheck, NativeSnapshotDescriptor, TarWorkspaceArchiveDescriptor, WorkspaceArchiveDescriptor, ModalCheckpointProviderBinding, SandboxProviderContinuityRecovery } from "@opengeni/contracts";
2
- import { type TimelineAnnotation } from "@opengeni/contracts";
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";
3
4
  import { type LatencyMode, SessionSystemUpdatePayload, TurnExecutionPolicyV1 } from "@opengeni/contracts";
4
5
  import { type Settings } from "@opengeni/config";
5
6
  import { type CodexFetch } from "@opengeni/codex";
@@ -20,14 +21,17 @@ export * from "./new-session-drafts.js";
20
21
  export * from "./workspace-instruction-policies.js";
21
22
  export * from "./company-profile.js";
22
23
  export * from "./workspace-learning-policy.js";
24
+ export * from "./slack-task-policy.js";
23
25
  export * from "./preference-registry.js";
24
26
  export * from "./memory-governance.js";
25
27
  export * from "./memory-slack-delivery.js";
26
28
  export * from "./scoped-knowledge.js";
27
29
  export * from "./knowledge-source-sync.js";
30
+ export * from "./task-notes.js";
28
31
  export * from "./generated-images.js";
29
32
  export * from "./slack-user-link-access.js";
30
33
  export * from "./video-generation.js";
34
+ export * from "./xai-subscription.js";
31
35
  export { interruptedToolCallResult } from "./session-tool-call-settlement.js";
32
36
  export { decryptEnvironmentValue, encryptEnvironmentValue } from "./environment-crypto.js";
33
37
  export { decryptEnvironmentValue as decryptVariableSetValue, encryptEnvironmentValue as encryptVariableSetValue, } from "./environment-crypto.js";
@@ -35,14 +39,15 @@ export * from "./persistence-errors.js";
35
39
  export * from "./runtime-posture.js";
36
40
  export * from "./capability-integrations.js";
37
41
  export * from "./integration-bindings.js";
38
- export * from "./integration-features.js";
42
+ export * from "./integration-facets.js";
39
43
  export * from "./insights.js";
40
44
  export { memoryTextForStorage } from "./memory-domain.js";
41
45
  export { migrate, runMigrations } from "./migrate.js";
42
46
  export { provisionRoles, type ProvisionResult, type ProvisionRolesOptions, } from "./provision-roles.js";
43
47
  export * from "./memory-domain.js";
44
48
  import { type Database, type SessionActivityDatabase } from "./database.js";
45
- export { createDb, registerDbBinding, retrySessionActivityRls, rlsContextForWorkspace, rlsStrategyFor, setRlsContext, setSubjectRlsContext, withAccountRls, withDatabaseStatementTimeout, withRlsContext, withSessionActivityRlsContext, withSessionActivitySavepoint, withWorkspaceRls, withWorkspaceSessionActivityRls, withWorkspaceSubjectRls, withWorkspaceSubjectSessionActivityRls, withWorkspaceUsageLock, withSandboxProviderReadLock, SandboxProviderReadLockUnavailableError, type CreateDbOptions, type Database, type DbClient, type SessionActivityDatabase, type RlsContext, type RlsStrategy, type SandboxProviderReadLockIdentity, type UserLookup, } from "./database.js";
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";
46
51
  import { buildCodexTokenResolver as buildCodexTokenResolverCore, fetchCodexRateLimitResetCreditsForAccount as fetchCodexRateLimitResetCreditsForAccountCore, fetchCodexUsageForAccount as fetchCodexUsageForAccountCore, type CodexAccountUsageSnapshot, type CodexAuthDeps, type CodexCredentialForRun } from "./codex-token-resolver.js";
47
52
  import { buildConnectionTokenResolver as buildConnectionTokenResolverCore, type ConnectionBrokerDeps, type ConnectionCredentialForBroker, type ConnectionTokenResolverOptions } from "./connection-token-resolver.js";
48
53
  /** Raised when a durable session tool-policy write lost its version fence. */
@@ -246,6 +251,15 @@ export declare function ensureManagedAccessForUser(db: Database, input: {
246
251
  email: string;
247
252
  name: string;
248
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>;
249
263
  export declare function getWorkspace(db: Database, workspaceId: string): Promise<Workspace | null>;
250
264
  export declare function getManagedAccount(db: Database, accountId: string): Promise<ManagedAccount | null>;
251
265
  export declare function requireWorkspace(db: Database, workspaceId: string): Promise<Workspace>;
@@ -598,6 +612,7 @@ export type CreateScheduledTaskInput = {
598
612
  createdByContext?: TurnInitiatorContext;
599
613
  createdByActor?: AgentSessionCreationActor | null;
600
614
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
615
+ xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
601
616
  targetSessionId?: string | null;
602
617
  variableSetId?: string | null;
603
618
  rigId?: string | null;
@@ -817,9 +832,10 @@ export type SlackBotPostOperation = {
817
832
  targetKind: "channel" | "user";
818
833
  targetId: string;
819
834
  requestDigest: string;
820
- status: "provider_started" | "completed";
835
+ status: "pending" | "provider_started" | "outcome_unknown" | "completed";
821
836
  claimHolderId: string | null;
822
837
  claimExpiresAt: Date | null;
838
+ claimMode: "send" | "reconcile" | null;
823
839
  attemptCount: number;
824
840
  lastFailureCode: string | null;
825
841
  slackChannelId: string | null;
@@ -828,6 +844,24 @@ export type SlackBotPostOperation = {
828
844
  createdAt: Date;
829
845
  updatedAt: Date;
830
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
+ };
831
865
  export type SlackBotDeleteOperation = {
832
866
  id: string;
833
867
  accountId: string;
@@ -897,7 +931,7 @@ export type CreateCapabilityCatalogItemInput = {
897
931
  accountId: string;
898
932
  workspaceId: string;
899
933
  id: string;
900
- kind: Exclude<CapabilityKind, "pack">;
934
+ kind: "mcp";
901
935
  source: CapabilitySource;
902
936
  name: string;
903
937
  description?: string | null;
@@ -972,7 +1006,7 @@ export type EnableCapabilityInstallationInput = {
972
1006
  accountId: string;
973
1007
  workspaceId: string;
974
1008
  capabilityId: string;
975
- kind: CapabilityKind;
1009
+ kind: "mcp";
976
1010
  config?: Record<string, unknown>;
977
1011
  metadata?: Record<string, unknown>;
978
1012
  };
@@ -982,13 +1016,18 @@ export type InstallPortableSkillInput = {
982
1016
  subjectId: string;
983
1017
  capabilityId: string;
984
1018
  pluginKey: string;
985
- source: "github" | "skills_sh" | "pack";
1019
+ source: "library" | "github" | "skills_sh" | "pack";
986
1020
  sourceUrl: string;
987
1021
  repositoryUrl: string;
1022
+ version?: string;
988
1023
  sourceCommit: string;
989
1024
  sourcePath: string;
990
1025
  name: string;
991
1026
  description: string;
1027
+ category?: string;
1028
+ tags?: string[];
1029
+ provenance?: "platform" | "deployment" | "registry" | "workspace";
1030
+ sourceProvenance?: string;
992
1031
  contentSha256: string;
993
1032
  totalBytes: number;
994
1033
  license?: string | null;
@@ -1002,6 +1041,7 @@ export type InstallPortableSkillInput = {
1002
1041
  expectedInstallationVersion?: number;
1003
1042
  };
1004
1043
  export type InstalledPortableSkill = {
1044
+ created: boolean;
1005
1045
  capabilityId: string;
1006
1046
  pluginId: string;
1007
1047
  pluginVersionId: string;
@@ -1009,7 +1049,8 @@ export type InstalledPortableSkill = {
1009
1049
  pluginInstallationId: string;
1010
1050
  facetInstallationId: string;
1011
1051
  installationVersion: number;
1012
- source: "github" | "skills_sh" | "pack";
1052
+ source: "library" | "github" | "skills_sh" | "pack";
1053
+ version: string;
1013
1054
  sourceUrl: string;
1014
1055
  sourceCommit: string;
1015
1056
  contentSha256: string;
@@ -1017,6 +1058,8 @@ export type InstalledPortableSkill = {
1017
1058
  };
1018
1059
  export type PortableSkillRuntime = {
1019
1060
  capabilityId: string;
1061
+ source: "library" | "github" | "skills_sh" | "pack";
1062
+ version: string;
1020
1063
  name: string;
1021
1064
  description: string;
1022
1065
  sourceUrl: string;
@@ -1028,6 +1071,29 @@ export type PortableSkillRuntime = {
1028
1071
  content: string;
1029
1072
  }>;
1030
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
+ };
1031
1097
  export type PortableSkillOwner = {
1032
1098
  kind: "direct" | "plugin" | "pack" | "migration";
1033
1099
  id: string;
@@ -1126,6 +1192,7 @@ export type EnqueueSessionTurnInput = {
1126
1192
  initiator: TurnInitiator;
1127
1193
  initiatorContext?: TurnInitiatorContext;
1128
1194
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
1195
+ xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
1129
1196
  /** Steer inserts before all waiting prompts; Send appends after them. */
1130
1197
  placement?: "head" | "tail";
1131
1198
  };
@@ -1138,6 +1205,8 @@ export type SessionTurnForExecution = SessionTurn & {
1138
1205
  personalConnectionDelegations: McpPersonalConnectionDelegation[];
1139
1206
  /** Worker-only causal authority; never inferred from the current worker. */
1140
1207
  initiatingHumanSubjectId: string | null;
1208
+ xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
1209
+ goalSnapshot: SessionGoalSnapshot;
1141
1210
  };
1142
1211
  export declare function createFileUpload(db: Database, input: {
1143
1212
  accountId: string;
@@ -1418,14 +1487,16 @@ export declare function upsertCapabilityCatalogItem(db: Database, input: CreateC
1418
1487
  export declare function listCapabilityCatalogItems(db: Database, workspaceId: string): Promise<CapabilityCatalogItem[]>;
1419
1488
  export declare function getCapabilityCatalogItem(db: Database, workspaceId: string, capabilityId: string): Promise<CapabilityCatalogItem | null>;
1420
1489
  /**
1421
- * Install one immutable, already-validated portable Skill through the v2
1422
- * Plugin/facet ownership model and dual-write the v1 compatibility projection.
1423
- * Repeating the same exact source is idempotent; changing a commit's content
1424
- * fails instead of silently rewriting immutable history.
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.
1425
1494
  */
1426
1495
  export declare function installPortableSkill(db: Database, input: InstallPortableSkillInput): Promise<InstalledPortableSkill>;
1427
- /** Return exact text artifacts for active v2 Skill installations. */
1496
+ /** Return exact text artifacts for active authoritative Skill installations. */
1428
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[]>;
1429
1500
  export declare function getPortableSkillUninstallPreview(db: Database, workspaceId: string, capabilityId: string): Promise<PortableSkillUninstallPreview>;
1430
1501
  export declare function uninstallPortableSkill(db: Database, input: {
1431
1502
  accountId: string;
@@ -1512,7 +1583,7 @@ export type SlackBotUserLink = {
1512
1583
  createdAt: Date;
1513
1584
  updatedAt: Date;
1514
1585
  };
1515
- 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";
1516
1587
  export type SlackInteractionInboxEntry = {
1517
1588
  id: string;
1518
1589
  accountId: string;
@@ -1527,6 +1598,7 @@ export type SlackInteractionInboxEntry = {
1527
1598
  slackThreadTs: string | null;
1528
1599
  triggerKind: SlackInteractionTriggerKind;
1529
1600
  text: string;
1601
+ hasFiles: boolean;
1530
1602
  status: "pending" | "processing" | "processed" | "failed";
1531
1603
  claimHolderId: string | null;
1532
1604
  claimExpiresAt: Date | null;
@@ -1548,6 +1620,7 @@ export type SlackInteraction = {
1548
1620
  slackThreadTs: string;
1549
1621
  routeKey: string;
1550
1622
  triggeringProviderEventId: string;
1623
+ initiatingSlackUserId: string | null;
1551
1624
  owningSubjectId: string;
1552
1625
  visibility: "private" | "workspace";
1553
1626
  sessionReservationId: string;
@@ -1574,6 +1647,29 @@ export type SlackInteractionProgressDelivery = {
1574
1647
  operationId: string;
1575
1648
  createdAt: Date;
1576
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
+ };
1577
1673
  export declare function resolveSlackInstallationRoute(db: Database, slackTeamId: string): Promise<SlackInstallationRoute | null>;
1578
1674
  export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt">): Promise<SlackBotUserLink>;
1579
1675
  export declare function getSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<SlackBotUserLink | null>;
@@ -1600,11 +1696,42 @@ export declare function releaseSlackInteractionInbox(db: Database, input: {
1600
1696
  errorCode: string;
1601
1697
  retryAt: Date;
1602
1698
  }): Promise<boolean>;
1603
- export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "deliveryAttemptCount" | "deliveryRetryAt" | "deliveryLastErrorCode" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt">): Promise<{
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<{
1604
1702
  created: boolean;
1605
1703
  interaction: SlackInteraction;
1606
1704
  }>;
1607
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>;
1608
1735
  /**
1609
1736
  * Resolve an already-durable Slack task to its canonical interaction.
1610
1737
  *
@@ -1747,7 +1874,7 @@ export declare function recordSlackBotInstallCallbackFailure(db: Database, input
1747
1874
  reason: SlackBotInstallCallbackFailureReason;
1748
1875
  }): Promise<boolean>;
1749
1876
  export type ClaimSlackBotPostOperationResult = {
1750
- kind: "claimed" | "in_progress" | "completed";
1877
+ kind: "claimed" | "reconcile" | "in_progress" | "completed";
1751
1878
  operation: SlackBotPostOperation;
1752
1879
  } | {
1753
1880
  kind: "conflict" | "connection_not_found";
@@ -1755,8 +1882,8 @@ export type ClaimSlackBotPostOperationResult = {
1755
1882
  /**
1756
1883
  * Claims one durable Slack post identity. The insert occurs before any provider
1757
1884
  * call; retries retain the original client_msg_id and immutable request digest.
1758
- * A live claim suppresses concurrent sends, while a released/expired claim can
1759
- * be reclaimed after response loss or process death.
1885
+ * A live claim suppresses concurrent work. An expired provider_started claim is
1886
+ * conservatively converted to outcome_unknown and may only be reconciled.
1760
1887
  */
1761
1888
  export declare function claimSlackBotPostOperation(db: Database, input: {
1762
1889
  accountId: string;
@@ -1769,12 +1896,20 @@ export declare function claimSlackBotPostOperation(db: Database, input: {
1769
1896
  claimHolderId: string;
1770
1897
  claimLeaseMs: number;
1771
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>;
1772
1906
  export declare function releaseSlackBotPostOperationClaim(db: Database, input: {
1773
1907
  accountId: string;
1774
1908
  workspaceId: string;
1775
1909
  connectionId: string;
1776
1910
  operationId: string;
1777
1911
  claimHolderId: string;
1912
+ outcomeUnknown: boolean;
1778
1913
  failureCode: string;
1779
1914
  }): Promise<boolean>;
1780
1915
  export type CompleteSlackBotPostOperationResult = {
@@ -1797,6 +1932,40 @@ export declare function completeSlackBotPostOperation(db: Database, input: {
1797
1932
  auditMetadata: Record<string, unknown>;
1798
1933
  }): Promise<CompleteSlackBotPostOperationResult>;
1799
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">;
1800
1969
  export type ClaimSlackBotDeleteOperationResult = {
1801
1970
  kind: "claimed" | "reconcile" | "in_progress" | "completed";
1802
1971
  operation: SlackBotDeleteOperation;
@@ -1956,6 +2125,8 @@ export type WorkspaceMemorySearchInput = {
1956
2125
  kind?: KnowledgeMemoryKind | undefined;
1957
2126
  limit?: number | undefined;
1958
2127
  mode?: WorkspaceMemorySearchMode | undefined;
2128
+ /** Agent-only containment. Human audit/search callers omit this. */
2129
+ agentPromptMode?: WorkspaceMemoryPromptMode | undefined;
1959
2130
  };
1960
2131
  export type WorkspaceMemorySearchResult = {
1961
2132
  memory: KnowledgeMemory;
@@ -2023,6 +2194,7 @@ export declare function createScheduledTask(db: Database, input: CreateScheduled
2023
2194
  export declare function updateScheduledTask(db: Database, workspaceId: string, taskId: string, input: UpdateScheduledTaskInput): Promise<ScheduledTask>;
2024
2195
  export declare function getScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask | null>;
2025
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>;
2026
2198
  export declare function requireScheduledTask(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
2027
2199
  export declare class ScheduledTaskTargetConflictError extends Error {
2028
2200
  constructor();
@@ -2183,6 +2355,31 @@ export declare function deleteRigIfNoActiveSessions(db: Database, workspaceId: s
2183
2355
  deleted: boolean;
2184
2356
  activeSessionCount: number;
2185
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>;
2186
2383
  export declare function countRigs(db: Database, workspaceId: string): Promise<number>;
2187
2384
  export declare function countSessionsUsingRig(db: Database, workspaceId: string, rigId: string): Promise<number>;
2188
2385
  export declare function createRigVersion(db: Database, workspaceId: string, rigId: string, input: RigVersionContentInput, options?: {
@@ -2866,6 +3063,101 @@ export declare function reconcileCodexCapacityWait<TPolicyScope = never, TUnavai
2866
3063
  resolvePolicyScope?: CodexCredentialLeasePolicyScopeResolver<TPolicyScope>;
2867
3064
  filterNewAllocationCandidates?: CodexCredentialLeaseCandidateFilter<TPolicyScope, TUnavailableDiagnostic>;
2868
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>;
2869
3161
  /**
2870
3162
  * Extend a live holder and return the database-confirmed expiry. A
2871
3163
  * missing/expired/released row returns null. A successful result lets the worker
@@ -3385,6 +3677,7 @@ export type SessionCreateInput = {
3385
3677
  variableSetId?: string | null;
3386
3678
  rigId?: string | null;
3387
3679
  rigVersionId?: string | null;
3680
+ channelId?: string | null;
3388
3681
  firstPartyMcpPermissions?: Permission[] | null;
3389
3682
  firstPartyMcpTools?: FirstPartyMcpToolName[];
3390
3683
  instructions?: string | null;
@@ -3395,9 +3688,14 @@ export type SessionCreateInput = {
3395
3688
  sandboxOs?: SandboxOs;
3396
3689
  mcpServers?: CreateSessionMcpServerInput[];
3397
3690
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
3691
+ initialXaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
3398
3692
  maxNestedAgentDepthOverride?: number | null;
3399
3693
  allowNestedAgentDepthIncrease?: boolean;
3400
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>;
3401
3699
  };
3402
3700
  export declare function createSession(db: Database, input: SessionCreateInput): Promise<DbSession>;
3403
3701
  /**
@@ -3423,8 +3721,17 @@ export declare function createSessionWithIdempotencyKey(db: Database, input: Ses
3423
3721
  }): Promise<SessionCreateSuccessResult>;
3424
3722
  export declare function getSessionByCreateIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<Session | null>;
3425
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>;
3426
3732
  export declare function getSessionTurnPersonalConnectionDelegations(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<McpPersonalConnectionDelegation[]>;
3427
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>;
3428
3735
  export declare function getSessionSpawnDenial(db: Database, workspaceId: string, denialId: string): Promise<SessionSpawnDenial | null>;
3429
3736
  export declare function getSessionSpawnDenialByIdempotencyKey(db: Database, workspaceId: string, createIdempotencyKey: string): Promise<SessionSpawnDenial | null>;
3430
3737
  export declare function listSessionSpawnDenials(db: Database, workspaceId: string, options?: {
@@ -3885,6 +4192,8 @@ export declare function registerPendingSessionToolCall(db: Database, input: Pend
3885
4192
  /** Record the raw SDK result without dropping the call receipt. */
3886
4193
  export declare function recordPendingSessionToolCallResult(db: Database, input: Omit<PendingSessionToolCallInput, "callType" | "callItem"> & {
3887
4194
  resultItem: Record<string, unknown>;
4195
+ /** Exact agent.toolCall.output value, separate from model-facing history. */
4196
+ eventOutput?: unknown;
3888
4197
  /** Commit a durable async-video acceptance fence with this exact result. */
3889
4198
  videoGenerationAcceptance?: {
3890
4199
  operationId: string;
@@ -3933,9 +4242,9 @@ export declare function getActiveSessionHistoryItems(db: Database, workspaceId:
3933
4242
  * pod OOM killer as admission.
3934
4243
  */
3935
4244
  export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_BYTES: number;
3936
- export declare const ACTIVE_SESSION_HISTORY_MAX_ROWS = 4096;
3937
- export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_NODES = 65536;
3938
- export declare const ACTIVE_SESSION_HISTORY_MAX_JSON_PROPERTIES = 32768;
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;
3939
4248
  export type ActiveSessionHistoryLimitKind = "json_bytes" | "rows" | "json_nodes" | "json_properties";
3940
4249
  export declare class ActiveSessionHistoryLimitExceededError extends Error {
3941
4250
  readonly actualBytes: number;
@@ -4384,6 +4693,9 @@ export interface LeaseSnapshot {
4384
4693
  rigVersionId: string | null;
4385
4694
  dataPlaneUrl: string | null;
4386
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;
4387
4699
  leaseEpoch: number;
4388
4700
  /** Monotonic filesystem mutation intent for the exact live workspace. */
4389
4701
  workspaceGeneration: number;
@@ -6007,6 +6319,17 @@ export declare function recordLeaseTerminalDataPlaneUrl(db: Database, input: {
6007
6319
  expectedEpoch: number;
6008
6320
  terminalDataPlaneUrl: string | null;
6009
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>;
6010
6333
  export type SandboxKind = (typeof schema.sandboxKindValues)[number];
6011
6334
  export type EnrollmentExposure = (typeof schema.enrollmentExposureValues)[number];
6012
6335
  export type EnrollmentStatus = (typeof schema.enrollmentStatusValues)[number];
@@ -6088,11 +6411,12 @@ export declare class MachineRemovalRevisionConflictError extends Error {
6088
6411
  constructor(message: string, currentUpdatedAt: string);
6089
6412
  }
6090
6413
  /**
6091
- * Remove one connected-machine enrollment without touching the durable identity
6092
- * or any session/route/archive evidence. The enrollment row is the lifecycle
6093
- * truth: status -> revoked rejects future auth-callout/heartbeat/reconnect
6094
- * attempts, while a fresh device-flow re-enrollment can reactivate the same
6095
- * public-key identity with a new credential family.
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.
6096
6420
  *
6097
6421
  * The operation key is scoped to the workspace and is receipt-backed. A retry
6098
6422
  * with the same key and request fingerprint replays the exact committed result;
@@ -6457,6 +6781,12 @@ export type CreateSessionGoalInput = {
6457
6781
  text: string;
6458
6782
  successCriteria?: string | null;
6459
6783
  maxAutoContinuations?: number | null;
6784
+ mutationPolicy?: SessionGoalMutationPolicy;
6785
+ expectedObjectiveRevision?: number;
6786
+ expectedGoalId?: string;
6787
+ changeKind?: SessionGoalChangeKind;
6788
+ changeRationale?: string;
6789
+ sourceProposalId?: string;
6460
6790
  createdBy: SessionGoalCreatedBy;
6461
6791
  };
6462
6792
  export declare function createSessionGoal(db: Database, input: CreateSessionGoalInput): Promise<SessionGoal>;
@@ -6504,15 +6834,21 @@ export declare function upsertSessionGoalWithEvent(db: Database, input: CreateSe
6504
6834
  }): Promise<{
6505
6835
  goal: SessionGoal;
6506
6836
  replaced: boolean;
6837
+ workflowWakeRevision: number | null;
6507
6838
  events: SessionEvent[];
6508
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>;
6509
6842
  /**
6510
- * goal_update semantics: revise text/criteria without changing status. The
6511
- * version bump counts as progress for the no-progress detector.
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.
6512
6847
  */
6513
6848
  export declare function updateSessionGoal(db: Database, workspaceId: string, sessionId: string, input: {
6514
6849
  text?: string;
6515
6850
  successCriteria?: string | null;
6851
+ mutationPolicy?: SessionGoalMutationPolicy;
6516
6852
  }): Promise<SessionGoal>;
6517
6853
  /**
6518
6854
  * Agent goal_update: session sequence ownership, goal mutation, and its audit
@@ -6523,7 +6859,12 @@ export declare function updateSessionGoal(db: Database, workspaceId: string, ses
6523
6859
  export declare function updateSessionGoalWithEvent(db: Database, workspaceId: string, sessionId: string, input: {
6524
6860
  text?: string;
6525
6861
  successCriteria?: string | null;
6862
+ mutationPolicy?: SessionGoalMutationPolicy;
6863
+ /** @deprecated A semantic rewrite never counts as progress; use goal_progress. */
6526
6864
  progressNote?: string;
6865
+ changeKind?: SessionGoalChangeKind;
6866
+ rationale?: string;
6867
+ expectedObjectiveRevision?: number;
6527
6868
  actor: "agent" | "api";
6528
6869
  command?: {
6529
6870
  accountId: string;
@@ -6537,6 +6878,28 @@ export declare function updateSessionGoalWithEvent(db: Database, workspaceId: st
6537
6878
  events: SessionEvent[];
6538
6879
  operationId: string | null;
6539
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;
6540
6903
  }>;
6541
6904
  /**
6542
6905
  * Sets a session's display title. The clobber guard lives entirely in this
@@ -6683,6 +7046,7 @@ export type InitializeSessionStartInput = {
6683
7046
  text: string;
6684
7047
  successCriteria?: string | null;
6685
7048
  maxAutoContinuations?: number | null;
7049
+ mutationPolicy?: SessionGoalMutationPolicy;
6686
7050
  } | null;
6687
7051
  consumeNewSessionDraft?: {
6688
7052
  subjectId: string;
@@ -6717,6 +7081,10 @@ export type SessionWorkTrigger = {
6717
7081
  export declare const MAX_INTERNAL_UPDATE_BYTES: number;
6718
7082
  export declare const MAX_INTERNAL_UPDATE_BATCH_MEMBERS = 100;
6719
7083
  export declare const MAX_INTERNAL_UPDATE_BATCH_BYTES: number;
7084
+ export type FrozenXaiExecutionAuthority = {
7085
+ snapshot: XaiProviderAccountAuthoritySnapshotV1;
7086
+ subjectId: string | null;
7087
+ };
6720
7088
  export type ClaimSessionWorkForAttemptInput = {
6721
7089
  sessionId: string;
6722
7090
  workflowId: string;
@@ -6732,6 +7100,11 @@ export type ClaimSessionWorkForAttemptResult = {
6732
7100
  action: "unclaimed";
6733
7101
  reason: "gate-closed" | "no-work" | "stale-approval" | "control-pending";
6734
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;
6735
7108
  /**
6736
7109
  * Claim and register one inference attempt after a turn worker has accepted the
6737
7110
  * Temporal activity. This is the only transition into `running`: queue choice,
@@ -6845,6 +7218,7 @@ export type SessionWorkPeek = {
6845
7218
  } | {
6846
7219
  kind: "approval-wait";
6847
7220
  humanInputRequestId?: string;
7221
+ interactionInterventionId?: string;
6848
7222
  expiresAt?: string;
6849
7223
  } | {
6850
7224
  kind: "capacity-wait";
@@ -6928,6 +7302,12 @@ export type ApplySessionTurnSettlementInput = {
6928
7302
  allowSkip: boolean;
6929
7303
  expiresAt?: Date | null;
6930
7304
  }>;
7305
+ interactionInterventionRequests?: Array<{
7306
+ id: string;
7307
+ operationId: string;
7308
+ toolCallId: string;
7309
+ input: RequestHumanInteractionToolInput;
7310
+ }>;
6931
7311
  };
6932
7312
  recording?: SessionTurnRecordingSettlement;
6933
7313
  /**
@@ -7137,6 +7517,7 @@ export type SessionSystemUpdateOutboxDelivery = {
7137
7517
  payload: ChildTerminalResultPayload;
7138
7518
  lineage: Record<string, unknown>;
7139
7519
  personalConnectionDelegations: McpPersonalConnectionDelegation[];
7520
+ xaiProviderAccountAuthoritySnapshot: XaiProviderAccountAuthoritySnapshotV1;
7140
7521
  };
7141
7522
  /**
7142
7523
  * Read the exact durable parent-update row created by terminal turn settlement.
@@ -7243,6 +7624,7 @@ export type AddSessionSystemUpdateInput = {
7243
7624
  summary: string;
7244
7625
  lineage?: Record<string, unknown>;
7245
7626
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
7627
+ xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
7246
7628
  } & SessionSystemUpdateInputVariant;
7247
7629
  export type AddSessionSystemUpdateResult = {
7248
7630
  added: false;
@@ -7288,7 +7670,29 @@ export declare function acceptSessionApprovalDecision(db: Database, input: {
7288
7670
  subjectId: string;
7289
7671
  payload: Record<string, unknown>;
7290
7672
  clientEventId?: string | null;
7673
+ interactionIntervention?: {
7674
+ interventionId: string;
7675
+ operationId: string;
7676
+ expectedVersion: number;
7677
+ outcome: "completed" | "dismissed";
7678
+ };
7291
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>;
7292
7696
  /**
7293
7697
  * Durable attempt fence for activity-produced events. A cancelled or replaced
7294
7698
  * attempt may still flush SDK callbacks after Temporal cancellation; those late
@@ -7399,5 +7803,10 @@ export * from "./codemode-operations.js";
7399
7803
  export * from "./browser-sessions.js";
7400
7804
  export * from "./computer-sessions.js";
7401
7805
  export * from "./browser-identities.js";
7806
+ export * from "./browser-state-artifacts.js";
7402
7807
  export * from "./browser-auth.js";
7808
+ export * from "./browser-downloads.js";
7403
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";