@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.
Files changed (225) hide show
  1. package/dist/attached-browser-devices.d.ts +42 -0
  2. package/dist/attempt-tool-catalogs.d.ts +16 -0
  3. package/dist/browser-auth.d.ts +299 -0
  4. package/dist/browser-downloads.d.ts +51 -0
  5. package/dist/browser-identities.d.ts +137 -0
  6. package/dist/browser-sessions.d.ts +354 -0
  7. package/dist/browser-state-artifacts.d.ts +91 -0
  8. package/dist/canonical-human-identities.d.ts +48 -0
  9. package/dist/canonical-human-identities.js +28 -0
  10. package/dist/canonical-human-identities.js.map +1 -0
  11. package/dist/capability-components.d.ts +37 -0
  12. package/dist/capability-integrations.d.ts +194 -0
  13. package/dist/chunk-5KTIEDX7.js +13200 -0
  14. package/dist/chunk-5KTIEDX7.js.map +1 -0
  15. package/dist/chunk-CQZ4QSP5.js +995 -0
  16. package/dist/chunk-CQZ4QSP5.js.map +1 -0
  17. package/dist/chunk-F32YT7MP.js +117 -0
  18. package/dist/chunk-F32YT7MP.js.map +1 -0
  19. package/dist/chunk-JC5QPLUM.js +666 -0
  20. package/dist/chunk-JC5QPLUM.js.map +1 -0
  21. package/dist/chunk-P3RE4D2B.js +3535 -0
  22. package/dist/chunk-P3RE4D2B.js.map +1 -0
  23. package/dist/chunk-TAUTWOS5.js +259 -0
  24. package/dist/chunk-TAUTWOS5.js.map +1 -0
  25. package/dist/chunk-VKLB2ZGI.js +2389 -0
  26. package/dist/chunk-VKLB2ZGI.js.map +1 -0
  27. package/dist/codemode-operations.d.ts +117 -0
  28. package/dist/codex-token-resolver.d.ts +2 -2
  29. package/dist/company-profile-schema.d.ts +798 -0
  30. package/dist/company-profile.d.ts +268 -0
  31. package/dist/computer-sessions.d.ts +109 -0
  32. package/dist/connection-token-resolver.d.ts +9 -4
  33. package/dist/database.d.ts +57 -3
  34. package/dist/editable-artifact-durable-export.d.ts +153 -0
  35. package/dist/editable-artifact-durable-export.js +788 -0
  36. package/dist/editable-artifact-durable-export.js.map +1 -0
  37. package/dist/editable-artifact-materialization.d.ts +123 -0
  38. package/dist/editable-artifacts-schema.d.ts +4152 -0
  39. package/dist/editable-artifacts.d.ts +610 -0
  40. package/dist/editable-artifacts.js +26 -0
  41. package/dist/editable-artifacts.js.map +1 -0
  42. package/dist/generated-images.d.ts +139 -0
  43. package/dist/index.d.ts +1122 -126
  44. package/dist/index.js +42329 -18407
  45. package/dist/index.js.map +1 -1
  46. package/dist/insights.d.ts +73 -10
  47. package/dist/integration-bindings.d.ts +70 -0
  48. package/dist/integration-facets.d.ts +99 -0
  49. package/dist/interaction-revisions.d.ts +14 -0
  50. package/dist/interaction-schema.d.ts +6036 -0
  51. package/dist/knowledge-source-sync-schema.d.ts +1679 -0
  52. package/dist/knowledge-source-sync.d.ts +274 -0
  53. package/dist/memory-governance.d.ts +2 -2
  54. package/dist/memory-slack-delivery.d.ts +101 -0
  55. package/dist/new-session-drafts.d.ts +2 -2
  56. package/dist/pack-components.d.ts +76 -0
  57. package/dist/pack-installations.d.ts +86 -0
  58. package/dist/persistence-errors.d.ts +3 -3
  59. package/dist/plugin-packages.d.ts +126 -0
  60. package/dist/preference-registry.d.ts +1 -1
  61. package/dist/provision-roles.d.ts +9 -1
  62. package/dist/provision-roles.js +1 -1
  63. package/dist/runtime-posture.d.ts +19 -6
  64. package/dist/schema.d.ts +22654 -9359
  65. package/dist/schema.js +209 -3
  66. package/dist/scoped-knowledge.d.ts +97 -1
  67. package/dist/session-control.d.ts +33 -7
  68. package/dist/session-queue-commands.d.ts +19 -11
  69. package/dist/session-realtime-context.d.ts +2 -2
  70. package/dist/session-realtime-ledger.d.ts +4 -4
  71. package/dist/session-realtime-mirror.d.ts +2 -2
  72. package/dist/session-realtime-state.d.ts +1 -1
  73. package/dist/session-realtime-terminal.d.ts +1 -1
  74. package/dist/session-realtime.d.ts +7 -7
  75. package/dist/session-tenancy.d.ts +44 -0
  76. package/dist/session-tenancy.js +16 -0
  77. package/dist/session-tenancy.js.map +1 -0
  78. package/dist/session-tool-call-settlement.d.ts +1 -1
  79. package/dist/slack-task-policy-schema.d.ts +847 -0
  80. package/dist/slack-task-policy.d.ts +65 -0
  81. package/dist/slack-user-link-access.d.ts +54 -0
  82. package/dist/task-notes-schema.d.ts +924 -0
  83. package/dist/task-notes.d.ts +85 -0
  84. package/dist/transcription-recordings.d.ts +2 -2
  85. package/dist/turn-initiator.d.ts +2 -2
  86. package/dist/video-generation.d.ts +225 -0
  87. package/dist/video-generation.js +68 -0
  88. package/dist/video-generation.js.map +1 -0
  89. package/dist/workspace-artifacts.d.ts +1 -1
  90. package/dist/workspace-instruction-policies.d.ts +1 -1
  91. package/dist/workspace-learning-policy-schema.d.ts +932 -0
  92. package/dist/workspace-learning-policy.d.ts +161 -0
  93. package/dist/xai-subscription.d.ts +326 -0
  94. package/drizzle/0183_model_call_provider_cost_estimates.sql +39 -0
  95. package/drizzle/0184_sandbox_drain_teardown_fence.sql +682 -0
  96. package/drizzle/0185_temporal_schedule_cleanup_outbox.sql +168 -0
  97. package/drizzle/0186_sandbox_capture_provider_contract.sql +400 -0
  98. package/drizzle/0187_generated_image_artifacts.sql +173 -0
  99. package/drizzle/0188_image_generation_retention_failure.sql +25 -0
  100. package/drizzle/0189_retained_session_image_formats.sql +13 -0
  101. package/drizzle/0190_timeline_annotations.sql +31 -0
  102. package/drizzle/0191_editable_artifact_engine.sql +3853 -0
  103. package/drizzle/0192_editable_artifact_live_tickets.sql +338 -0
  104. package/drizzle/0193_editable_artifact_authorization.sql +190 -0
  105. package/drizzle/0194_editable_artifact_durable_exports.sql +160 -0
  106. package/drizzle/0195_editable_artifact_import_authorization.sql +203 -0
  107. package/drizzle/0196_rig_provider_images.sql +152 -0
  108. package/drizzle/0197_knowledge_source_sync_schedules.sql +523 -0
  109. package/drizzle/0198_memory_slack_publication_delivery.sql +393 -0
  110. package/drizzle/0199_workspace_learning_policy.sql +980 -0
  111. package/drizzle/0201_company_profile_authority.sql +849 -0
  112. package/drizzle/0202_document_index_checkpoints.sql +85 -0
  113. package/drizzle/0203_durable_video_generation.sql +353 -0
  114. package/drizzle/0204_video_generation_funding.sql +44 -0
  115. package/drizzle/0205_attempt_tool_catalogs.sql +230 -0
  116. package/drizzle/0206_browser_sessions.sql +646 -0
  117. package/drizzle/0207_browser_identities.sql +379 -0
  118. package/drizzle/0208_attached_browser_devices.sql +165 -0
  119. package/drizzle/0209_computer_sessions.sql +575 -0
  120. package/drizzle/0210_browser_auth_network_interventions.sql +441 -0
  121. package/drizzle/0211_editable_artifact_session_links.sql +58 -0
  122. package/drizzle/0212_browser_state_transfer_hardening.sql +560 -0
  123. package/drizzle/0212_slack_installation_bindings.sql +348 -0
  124. package/drizzle/0213_browser_interaction_authority.sql +67 -0
  125. package/drizzle/0213_slack_user_link_access_requests.sql +177 -0
  126. package/drizzle/0214_browser_download_saves.sql +34 -0
  127. package/drizzle/0214_session_activity_commit_gate.sql +262 -0
  128. package/drizzle/0215_browser_controller_host.sql +385 -0
  129. package/drizzle/0215_capabilities_platform.sql +980 -0
  130. package/drizzle/0216_browser_auth_health_evidence.sql +137 -0
  131. package/drizzle/0216_pack_component_ownership.sql +235 -0
  132. package/drizzle/0217_capability_definition_delete_authority.sql +32 -0
  133. package/drizzle/0217_external_browser_auth_operations.sql +22 -0
  134. package/drizzle/0218_organization_tenancy_foundation.sql +299 -0
  135. package/drizzle/0219_organization_tenancy_managed_human_provisioning.sql +317 -0
  136. package/drizzle/0219_site_auth_maintenance_sessions.sql +234 -0
  137. package/drizzle/0220_memory_slack_append_only_cascade.sql +38 -0
  138. package/drizzle/0220_session_channels.sql +54 -0
  139. package/drizzle/0221_sessions_channel_index.sql +5 -0
  140. package/drizzle/0222_session_visibility_authority_epochs.sql +158 -0
  141. package/drizzle/0222_sessions_channel_fk.sql +89 -0
  142. package/drizzle/0223_pending_tool_event_output.sql +55 -0
  143. package/drizzle/0223_sessions_channel_fk_validate.sql +118 -0
  144. package/drizzle/0224_slack_post_outcome_reconciliation.sql +123 -0
  145. package/drizzle/0225_session_visibility_fork_activation.sql +1363 -0
  146. package/drizzle/0226_personal_codex_authority_foundation.sql +365 -0
  147. package/drizzle/0227_slack_native_actions.sql +145 -0
  148. package/drizzle/0228_interaction_controller_data_plane.sql +14 -0
  149. package/drizzle/0228_slack_task_policy.sql +400 -0
  150. package/drizzle/0229_slack_inbox_file_fact.sql +10 -0
  151. package/drizzle/0230_user_scoped_variable_sets_rigs.sql +84 -0
  152. package/drizzle/0231_integration_definition_identity_cutover.sql +271 -0
  153. package/drizzle/0232_integration_facet_authority_cutover.sql +610 -0
  154. package/drizzle/0233_skill_and_integration_authority_cutover.sql +1162 -0
  155. package/drizzle/0234_xai_subscription_authority.sql +1139 -0
  156. package/drizzle/0235_canonical_human_login_bindings.sql +920 -0
  157. package/drizzle/0236_browser_identity_lifecycle.sql +39 -0
  158. package/drizzle/0236_session_visibility_slack_policy.sql +72 -0
  159. package/drizzle/0237_interaction_transition_reaper.sql +263 -0
  160. package/drizzle/0238_goal_persistence_policy.sql +471 -0
  161. package/drizzle/0238_supergrok_realtime_model.sql +29 -0
  162. package/drizzle/0239_supergrok_video_funding.sql +50 -0
  163. package/drizzle/0239_task_tree_notes.sql +990 -0
  164. package/package.json +26 -5
  165. package/src/attached-browser-devices.ts +371 -0
  166. package/src/attempt-tool-catalogs.ts +131 -0
  167. package/src/browser-auth.ts +4373 -0
  168. package/src/browser-downloads.ts +517 -0
  169. package/src/browser-identities.ts +1385 -0
  170. package/src/browser-sessions.ts +2294 -0
  171. package/src/browser-state-artifacts.ts +449 -0
  172. package/src/canonical-human-identities.ts +317 -0
  173. package/src/capability-components.ts +166 -0
  174. package/src/capability-integrations.ts +1571 -0
  175. package/src/codemode-operations.ts +674 -0
  176. package/src/company-profile-schema.ts +143 -0
  177. package/src/company-profile.ts +968 -0
  178. package/src/computer-sessions.ts +1130 -0
  179. package/src/connection-token-resolver.ts +270 -25
  180. package/src/database.ts +468 -24
  181. package/src/editable-artifact-durable-export.ts +1201 -0
  182. package/src/editable-artifact-materialization.ts +893 -0
  183. package/src/editable-artifacts-schema.ts +879 -0
  184. package/src/editable-artifacts.ts +5404 -0
  185. package/src/generated-images.ts +740 -0
  186. package/src/index.ts +9963 -1465
  187. package/src/insights.ts +251 -23
  188. package/src/integration-bindings.ts +455 -0
  189. package/src/integration-facets.ts +862 -0
  190. package/src/interaction-revisions.ts +70 -0
  191. package/src/interaction-schema.ts +1606 -0
  192. package/src/knowledge-source-sync-schema.ts +192 -0
  193. package/src/knowledge-source-sync.ts +1922 -0
  194. package/src/memory-slack-delivery.ts +801 -0
  195. package/src/pack-components.ts +954 -0
  196. package/src/pack-installations.ts +886 -0
  197. package/src/persistence-errors.ts +4 -7
  198. package/src/plugin-packages.ts +1186 -0
  199. package/src/provision-roles.ts +534 -1
  200. package/src/runtime-posture-cli.ts +9 -0
  201. package/src/runtime-posture.ts +721 -5
  202. package/src/schema.ts +6270 -3159
  203. package/src/scoped-knowledge-schema.ts +1 -1
  204. package/src/scoped-knowledge.ts +655 -3
  205. package/src/session-control.ts +130 -42
  206. package/src/session-queue-commands.ts +265 -15
  207. package/src/session-realtime-context.ts +2 -2
  208. package/src/session-realtime-ledger.ts +3 -3
  209. package/src/session-realtime.ts +7 -7
  210. package/src/session-tenancy.ts +188 -0
  211. package/src/session-tool-call-settlement.ts +18 -3
  212. package/src/slack-task-policy-schema.ts +130 -0
  213. package/src/slack-task-policy.ts +341 -0
  214. package/src/slack-user-link-access.ts +702 -0
  215. package/src/task-notes-schema.ts +135 -0
  216. package/src/task-notes.ts +178 -0
  217. package/src/video-generation.ts +1530 -0
  218. package/src/workspace-artifacts.ts +1 -1
  219. package/src/workspace-learning-policy-schema.ts +139 -0
  220. package/src/workspace-learning-policy.ts +595 -0
  221. package/src/xai-subscription.ts +1887 -0
  222. package/dist/chunk-P6CUHXQZ.js +0 -7248
  223. package/dist/chunk-P6CUHXQZ.js.map +0 -1
  224. package/dist/chunk-VHBFHMPC.js +0 -1219
  225. package/dist/chunk-VHBFHMPC.js.map +0 -1
@@ -0,0 +1,274 @@
1
+ import { type FileAsset, KnowledgeSourceSyncRunSummary, type ScheduledTask } from "@opengeni/contracts";
2
+ import type { Database } from "./database.js";
3
+ export type KnowledgeSourceSyncState = {
4
+ sourceId: string;
5
+ scheduledTaskId: string;
6
+ sourceSyncGeneration: number;
7
+ sourceConfigGeneration: number;
8
+ sourceLifecycleGeneration: number;
9
+ executionCheckpoint: Record<string, unknown> | null;
10
+ executionCheckpointGeneration: number;
11
+ activeScanGeneration: number;
12
+ providerCursor: Record<string, unknown> | null;
13
+ wakeRevision: number;
14
+ pendingWakeCount: number;
15
+ bufferedWake: boolean;
16
+ bufferedScheduledTaskRunId: string | null;
17
+ reconnectRequired: boolean;
18
+ lastSuccessAt: string | null;
19
+ lastCompletedAt: string | null;
20
+ lastSummary: ReturnType<typeof KnowledgeSourceSyncRunSummary.parse> | null;
21
+ };
22
+ export type KnowledgeSourceSyncObservationFloor = {
23
+ externalObjectId: string;
24
+ providerRevision: string | null;
25
+ metadataHash: string | null;
26
+ };
27
+ export type KnowledgeSourceSyncObservationFence = {
28
+ initiatingSubjectId: string;
29
+ scanGeneration: number;
30
+ executionCheckpointGeneration: number;
31
+ observations: KnowledgeSourceSyncObservationFloor[];
32
+ };
33
+ export type KnowledgeSourceSyncObjectObservationResult = KnowledgeSourceSyncObservationFloor & {
34
+ disposition: "accepted" | "replayed" | "stale" | "conflict";
35
+ currentVersion: {
36
+ providerRevision: string | null;
37
+ metadataHash: string | null;
38
+ sourceLifecycleGeneration: number;
39
+ objectLifecycleGeneration: number;
40
+ currentObjectLifecycleGeneration: number;
41
+ objectLifecycleState: string;
42
+ aclGeneration: number;
43
+ indexObligationStatus: string | null;
44
+ } | null;
45
+ };
46
+ export declare function compareCanonicalDecimalProviderRevisions(candidate: string | null, floor: string | null): -1 | 0 | 1 | null;
47
+ export declare function ensureKnowledgeSourceSyncState(db: Database, task: ScheduledTask): Promise<KnowledgeSourceSyncState>;
48
+ export declare function reconcileKnowledgeSourceSyncLiveGeneration(db: Database, input: {
49
+ accountId: string;
50
+ workspaceId: string;
51
+ sourceId: string;
52
+ scheduledTaskRunId: string;
53
+ initiatingSubjectId: string;
54
+ sourceConfigGeneration: number;
55
+ sourceLifecycleGeneration: number;
56
+ liveSourceSyncGeneration: number;
57
+ }): Promise<KnowledgeSourceSyncState>;
58
+ export declare function recordKnowledgeSourceSyncWake(db: Database, input: {
59
+ accountId: string;
60
+ workspaceId: string;
61
+ sourceId: string;
62
+ scheduledTaskId: string;
63
+ scheduledTaskRunId: string;
64
+ cause: "scheduled" | "manual" | "initial" | "provider_event" | "retry" | "repair";
65
+ producerKey: string;
66
+ sourceConfigGeneration: number;
67
+ sourceLifecycleGeneration: number;
68
+ }): Promise<void>;
69
+ export declare function claimKnowledgeSourceSyncLease(db: Database, input: {
70
+ accountId: string;
71
+ workspaceId: string;
72
+ sourceId: string;
73
+ scheduledTaskRunId: string;
74
+ overlapPolicy: "skip" | "buffer_one";
75
+ leaseMs?: number;
76
+ }): Promise<{
77
+ action: "claimed";
78
+ state: KnowledgeSourceSyncState;
79
+ } | {
80
+ action: "skipped" | "buffered";
81
+ state: KnowledgeSourceSyncState;
82
+ }>;
83
+ export declare function checkpointKnowledgeSourceSync(db: Database, input: {
84
+ accountId: string;
85
+ workspaceId: string;
86
+ sourceId: string;
87
+ scheduledTaskRunId: string;
88
+ sourceConfigGeneration: number;
89
+ sourceLifecycleGeneration: number;
90
+ executionCheckpoint: Record<string, unknown>;
91
+ observationFence?: KnowledgeSourceSyncObservationFence;
92
+ }): Promise<KnowledgeSourceSyncState>;
93
+ export declare function settleKnowledgeSourceSyncLease(db: Database, input: {
94
+ accountId: string;
95
+ workspaceId: string;
96
+ sourceId: string;
97
+ scheduledTaskRunId: string;
98
+ knowledgeSyncRunId?: string | null;
99
+ status: "succeeded" | "failed";
100
+ summary: ReturnType<typeof KnowledgeSourceSyncRunSummary.parse>;
101
+ error?: string | null;
102
+ sourceConfigGeneration: number;
103
+ sourceLifecycleGeneration: number;
104
+ sourceSyncGeneration: number;
105
+ completedSourceSyncGeneration?: number | null;
106
+ executionCheckpoint?: Record<string, unknown> | null;
107
+ providerCursor?: Record<string, unknown> | null;
108
+ observationFence?: KnowledgeSourceSyncObservationFence;
109
+ }): Promise<{
110
+ bufferedWake: boolean;
111
+ bufferedScheduledTaskRunId: string | null;
112
+ }>;
113
+ export declare function listObservedKnowledgeSourceSyncExternalObjectIds(db: Database, input: {
114
+ accountId: string;
115
+ workspaceId: string;
116
+ sourceId: string;
117
+ externalObjectIds: string[];
118
+ }): Promise<Set<string>>;
119
+ /**
120
+ * Release only the exact active lease after a retryable DB safety obligation
121
+ * fails. The wake and scheduled-task run deliberately remain open so Temporal
122
+ * can reclaim the same deterministic run; no provider checkpoint survives a
123
+ * reconnect/permission-loss failure.
124
+ */
125
+ export declare function releaseKnowledgeSourceSyncLeaseForRetry(db: Database, input: {
126
+ accountId: string;
127
+ workspaceId: string;
128
+ sourceId: string;
129
+ scheduledTaskRunId: string;
130
+ }): Promise<void>;
131
+ export declare function completeKnowledgeSourceSyncWakeWithoutLease(db: Database, input: {
132
+ accountId: string;
133
+ workspaceId: string;
134
+ sourceId: string;
135
+ scheduledTaskRunId: string;
136
+ }): Promise<void>;
137
+ export declare function recordKnowledgeSourceSyncItemOutcomes(db: Database, input: {
138
+ accountId: string;
139
+ workspaceId: string;
140
+ scheduledTaskRunId: string;
141
+ knowledgeSyncRunId?: string | null;
142
+ sourceId: string;
143
+ sourceConfigGeneration: number;
144
+ sourceLifecycleGeneration: number;
145
+ outcomes: Array<{
146
+ externalObjectId: string;
147
+ outcome: "imported" | "unchanged" | "skipped" | "failed" | "tombstoned";
148
+ reasonCode?: string | null;
149
+ detail?: string | null;
150
+ contentSha256?: string | null;
151
+ sizeBytes?: number | null;
152
+ providerRevision?: string | null;
153
+ metadataHash?: string | null;
154
+ aclEligibility?: "pending" | "eligible" | "denied";
155
+ aclEvidence?: Record<string, unknown> | null;
156
+ indexObligationId?: string | null;
157
+ }>;
158
+ }): Promise<void>;
159
+ export declare function recordKnowledgeSourceSyncObjectObservations(db: Database, input: {
160
+ accountId: string;
161
+ workspaceId: string;
162
+ sourceId: string;
163
+ scheduledTaskRunId: string;
164
+ initiatingSubjectId: string;
165
+ scanGeneration: number;
166
+ executionCheckpointGeneration: number;
167
+ revisionOrdering?: "first_observation" | "canonical_decimal";
168
+ observations: Array<{
169
+ externalObjectId: string;
170
+ providerRevision?: string | null;
171
+ metadataHash?: string | null;
172
+ }>;
173
+ }): Promise<KnowledgeSourceSyncObjectObservationResult[]>;
174
+ export declare function reconcileKnowledgeSourceSyncCompleteScan(db: Database, input: {
175
+ accountId: string;
176
+ workspaceId: string;
177
+ sourceId: string;
178
+ scheduledTaskRunId: string;
179
+ initiatingSubjectId: string;
180
+ sourceSyncGeneration: number;
181
+ sourceConfigGeneration: number;
182
+ sourceLifecycleGeneration: number;
183
+ scanGeneration: number;
184
+ }): Promise<string[]>;
185
+ export declare function getKnowledgeSourceSyncIndexObligationForVersion(db: Database, input: {
186
+ accountId: string;
187
+ workspaceId: string;
188
+ knowledgeDocumentVersionId: string;
189
+ initiatingSubjectId: string;
190
+ }): Promise<{
191
+ id: string;
192
+ status: string;
193
+ aclEligibility: string;
194
+ sourceSyncGeneration: number;
195
+ documentId: string;
196
+ } | null>;
197
+ export declare function enqueueKnowledgeSourceSyncIndexObligation(db: Database, input: {
198
+ accountId: string;
199
+ workspaceId: string;
200
+ scheduledTaskRunId: string;
201
+ sourceId: string;
202
+ sourceSyncGeneration: number;
203
+ initiatingSubjectId: string;
204
+ externalObjectId: string;
205
+ knowledgeSourceObjectId: string;
206
+ knowledgeDocumentVersionId: string;
207
+ documentId: string;
208
+ sourceConfigGeneration: number;
209
+ sourceLifecycleGeneration: number;
210
+ objectLifecycleGeneration: number;
211
+ objectVersionGeneration: number;
212
+ citationLocator: Record<string, unknown>;
213
+ }): Promise<{
214
+ id: string;
215
+ status: string;
216
+ aclEligibility: string;
217
+ sourceSyncGeneration: number;
218
+ documentId: string;
219
+ }>;
220
+ /**
221
+ * Re-open a transiently failed index obligation only while its complete
222
+ * source/object/version authority is still current. The immutable obligation
223
+ * identity and original source-sync generation remain intact; the new task run
224
+ * merely becomes the retry owner.
225
+ */
226
+ export declare function retryKnowledgeSourceSyncIndexObligation(db: Database, input: {
227
+ accountId: string;
228
+ workspaceId: string;
229
+ obligationId: string;
230
+ scheduledTaskRunId: string;
231
+ }): Promise<"pending" | "indexed" | "invalidated">;
232
+ export declare function recordKnowledgeSourceSyncAclEvidence(db: Database, input: {
233
+ accountId: string;
234
+ workspaceId: string;
235
+ obligationId: string;
236
+ sourceSyncGeneration: number;
237
+ sourceConfigGeneration: number;
238
+ sourceLifecycleGeneration: number;
239
+ objectLifecycleGeneration: number;
240
+ objectVersionGeneration: number;
241
+ eligibility: "eligible" | "denied";
242
+ evidence: Record<string, unknown>;
243
+ }): Promise<void>;
244
+ /** Bounded retention hook. Callers choose policy and cadence; pending index or
245
+ * ACL obligations are never deleted by age alone. */
246
+ export declare function pruneKnowledgeSourceSyncEvidence(db: Database, input: {
247
+ accountId: string;
248
+ workspaceId: string;
249
+ before: Date;
250
+ limit?: number;
251
+ }): Promise<{
252
+ itemOutcomes: number;
253
+ wakes: number;
254
+ indexObligations: number;
255
+ }>;
256
+ export declare function settleKnowledgeSourceSyncIndexObligation(db: Database, input: {
257
+ accountId: string;
258
+ workspaceId: string;
259
+ obligationId: string;
260
+ status: "indexed" | "failed" | "invalidated";
261
+ failureCode?: string | null;
262
+ }): Promise<"settled" | "invalidated">;
263
+ export declare function ensureKnowledgeSourceBlobFile(db: Database, input: {
264
+ accountId: string;
265
+ workspaceId: string;
266
+ fileId: string;
267
+ filename: string;
268
+ safeFilename: string;
269
+ contentType: string;
270
+ sizeBytes: number;
271
+ sha256: string;
272
+ bucket: string;
273
+ objectKey: string;
274
+ }): Promise<FileAsset>;
@@ -1,5 +1,5 @@
1
- import type { Database } from "./database";
2
- import { type MemoryOperationPlanInput, type MemoryRevertPlanInput } from "./memory-domain";
1
+ import type { Database } from "./database.js";
2
+ import { type MemoryOperationPlanInput, type MemoryRevertPlanInput } from "./memory-domain.js";
3
3
  export declare class MemoryGovernanceAuthorityError extends Error {
4
4
  readonly name = "MemoryGovernanceAuthorityError";
5
5
  }
@@ -0,0 +1,101 @@
1
+ import { type MemorySlackPublication, type MemorySlackPublicationConfiguration, type MemorySlackPublicationState } from "@opengeni/contracts";
2
+ import { type Database } from "./database.js";
3
+ import * as schema from "./schema.js";
4
+ export type MemorySlackPublicationActor = {
5
+ kind: "human" | "agent" | "service";
6
+ subjectId: string;
7
+ initiatingHumanSubjectId?: string | null;
8
+ sessionId?: string | null;
9
+ turnId?: string | null;
10
+ attemptId?: string | null;
11
+ };
12
+ export type WorkspaceMemorySlackPublicationSnapshot = {
13
+ accountId: string;
14
+ workspaceId: string;
15
+ id: string;
16
+ version: number;
17
+ status: string;
18
+ kind: string;
19
+ scopeType: string;
20
+ namespace: string;
21
+ labels: string[];
22
+ validFrom: string;
23
+ validUntil: string | null;
24
+ supersedesId: string | null;
25
+ supersededById: string | null;
26
+ };
27
+ export declare function getWorkspaceMemorySlackPublicationSnapshot(db: Database, workspaceId: string, memoryId: string): Promise<WorkspaceMemorySlackPublicationSnapshot | null>;
28
+ export type MemorySlackPublicationConfigurationInput = {
29
+ accountId: string;
30
+ workspaceId: string;
31
+ expectedRevision: number;
32
+ enabled: boolean;
33
+ connectionId: string | null;
34
+ slackTeamId: string | null;
35
+ slackChannelId: string | null;
36
+ slackChannelName: string | null;
37
+ autoImportances: Array<"major" | "normal" | "minor">;
38
+ reviewImportances: Array<"major" | "normal" | "minor">;
39
+ subjectId: string;
40
+ };
41
+ export declare class MemorySlackPublicationRevisionConflictError extends Error {
42
+ readonly currentRevision: number;
43
+ constructor(currentRevision: number);
44
+ }
45
+ export declare function listMemorySlackPublicationConfigurations(db: Database, workspaceId: string, limit?: number): Promise<MemorySlackPublicationConfiguration[]>;
46
+ export declare function getCurrentMemorySlackPublicationConfiguration(db: Database, workspaceId: string): Promise<MemorySlackPublicationConfiguration | null>;
47
+ export declare function createMemorySlackPublicationConfiguration(db: Database, input: MemorySlackPublicationConfigurationInput): Promise<MemorySlackPublicationConfiguration>;
48
+ export type EnqueueMemorySlackPublicationInput = {
49
+ accountId: string;
50
+ workspaceId: string;
51
+ sourceType: "workspace_memory" | "durable_learning";
52
+ sourceId: string;
53
+ sourceVersion?: string | null;
54
+ sourceIdempotencyKey: string;
55
+ projection: Record<string, unknown>;
56
+ importance: "major" | "normal" | "minor";
57
+ deliveryMode: "auto" | "review";
58
+ actor: MemorySlackPublicationActor;
59
+ };
60
+ export type EnqueueMemorySlackPublicationResult = {
61
+ kind: "not_configured";
62
+ } | {
63
+ kind: "disabled";
64
+ configuration: MemorySlackPublicationConfiguration;
65
+ } | {
66
+ kind: "enqueued" | "replayed";
67
+ publication: MemorySlackPublication;
68
+ };
69
+ export declare function enqueueMemorySlackPublication(db: Database, input: EnqueueMemorySlackPublicationInput): Promise<EnqueueMemorySlackPublicationResult>;
70
+ export type ClaimedMemorySlackPublication = typeof schema.memorySlackPublications.$inferSelect;
71
+ export declare function claimMemorySlackPublication(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<ClaimedMemorySlackPublication | null>;
72
+ export declare function currentMemorySlackConfigurationMatches(db: Database, publication: ClaimedMemorySlackPublication): Promise<boolean>;
73
+ export declare function completeMemorySlackPublication(db: Database, input: {
74
+ publication: ClaimedMemorySlackPublication;
75
+ claimHolderId: string;
76
+ slackChannelId: string;
77
+ slackMessageTimestamp: string;
78
+ }): Promise<boolean>;
79
+ export declare function deferMemorySlackPublication(db: Database, input: {
80
+ publication: ClaimedMemorySlackPublication;
81
+ claimHolderId: string;
82
+ retryAt: Date;
83
+ errorCode: string;
84
+ }): Promise<boolean>;
85
+ export declare function failMemorySlackPublication(db: Database, input: {
86
+ publication: ClaimedMemorySlackPublication;
87
+ claimHolderId: string;
88
+ errorCode: string;
89
+ cancelled?: boolean;
90
+ }): Promise<boolean>;
91
+ export declare function actOnMemorySlackPublication(db: Database, input: {
92
+ workspaceId: string;
93
+ publicationId: string;
94
+ expectedState: MemorySlackPublicationState;
95
+ action: "approve" | "reject" | "retry";
96
+ subjectId: string;
97
+ }): Promise<MemorySlackPublication | null>;
98
+ export declare function listMemorySlackPublications(db: Database, workspaceId: string, options?: {
99
+ limit?: number;
100
+ states?: MemorySlackPublicationState[];
101
+ }): Promise<MemorySlackPublication[]>;
@@ -1,6 +1,6 @@
1
1
  import type { NewSessionDraftOptions, LatencyMode, ReasoningEffort, ResourceRef, ToolRef } from "@opengeni/contracts";
2
- import type { Database } from "./database";
3
- import * as schema from "./schema";
2
+ import type { Database } from "./database.js";
3
+ import * as schema from "./schema.js";
4
4
  export type NewSessionDraftRow = typeof schema.newSessionDrafts.$inferSelect;
5
5
  export declare class NewSessionDraftConflictError extends Error {
6
6
  readonly currentRevision: number;
@@ -0,0 +1,76 @@
1
+ import { type CapabilityPackComponentReference, type PackComponentResolution } from "@opengeni/contracts";
2
+ import { type Database } from "./database.js";
3
+ type PackComponentKind = PackComponentResolution["kind"];
4
+ export type PackInlineSkillRequirement = {
5
+ key: string;
6
+ capabilityId: string;
7
+ name: string;
8
+ contentSha256: string;
9
+ };
10
+ export type StoredPackInstallationComponent = {
11
+ id: string;
12
+ packInstallationId: string;
13
+ key: string;
14
+ kind: PackComponentKind;
15
+ capabilityId: string;
16
+ resolvedId: string;
17
+ digest: string;
18
+ metadata: Record<string, unknown>;
19
+ };
20
+ export declare class PackComponentResolutionError extends Error {
21
+ readonly componentKey: string;
22
+ readonly status: "missing" | "mismatch";
23
+ readonly name = "PackComponentResolutionError";
24
+ constructor(componentKey: string, status: "missing" | "mismatch");
25
+ }
26
+ export declare function resolvePackComponentReferences(db: Database, workspaceId: string, references: readonly CapabilityPackComponentReference[]): Promise<PackComponentResolution[]>;
27
+ /**
28
+ * Resolve inline Pack Skills against effective owners by case-insensitive
29
+ * runtime name. Exact content is shareable; different content under the same
30
+ * active name is a conflict. The current Pack owner may be excluded so an
31
+ * update can replace its own previous inline Skill safely.
32
+ */
33
+ export declare function resolvePackInlineSkillReferences(db: Database, workspaceId: string, requirements: readonly PackInlineSkillRequirement[], excludePackInstallationId?: string): Promise<PackComponentResolution[]>;
34
+ export declare function adoptPackComponentReferences(db: Database, input: {
35
+ accountId: string;
36
+ workspaceId: string;
37
+ packInstallationId: string;
38
+ references: readonly CapabilityPackComponentReference[];
39
+ }): Promise<{
40
+ components: StoredPackInstallationComponent[];
41
+ retainedFacetInstallationIds: string[];
42
+ retainedBindingIds: string[];
43
+ }>;
44
+ export declare function listPackInstallationComponents(db: Database, workspaceId: string, packInstallationId: string): Promise<StoredPackInstallationComponent[]>;
45
+ export declare function recordPackInlineSkillComponent(db: Database, input: {
46
+ accountId: string;
47
+ workspaceId: string;
48
+ packInstallationId: string;
49
+ componentKey: string;
50
+ capabilityId: string;
51
+ facetInstallationId: string;
52
+ contentSha256: string;
53
+ name: string;
54
+ }): Promise<StoredPackInstallationComponent>;
55
+ export declare function finalizePackComponentOwnership(db: Database, input: {
56
+ accountId: string;
57
+ workspaceId: string;
58
+ packInstallationId: string;
59
+ retainedComponentKeys: string[];
60
+ retainedFacetInstallationIds: string[];
61
+ retainedBindingIds: string[];
62
+ }): Promise<void>;
63
+ export declare function previewPackComponentRelease(db: Database, workspaceId: string, packInstallationId: string): Promise<Array<{
64
+ key: string;
65
+ kind: PackComponentKind;
66
+ capabilityId: string;
67
+ retainedByOtherOwners: boolean;
68
+ }>>;
69
+ export declare function releasePackComponents(db: Database, input: {
70
+ accountId: string;
71
+ workspaceId: string;
72
+ packInstallationId: string;
73
+ }): Promise<{
74
+ retainedComponents: string[];
75
+ }>;
76
+ export {};
@@ -0,0 +1,86 @@
1
+ import { type CapabilityPack, type PackInstallation } from "@opengeni/contracts";
2
+ import { type Database } from "./database.js";
3
+ export declare class PackOperationIdempotencyError extends Error {
4
+ readonly name = "PackOperationIdempotencyError";
5
+ }
6
+ export declare class PackOperationInProgressError extends Error {
7
+ readonly name = "PackOperationInProgressError";
8
+ }
9
+ export declare class PackOperationClaimLostError extends Error {
10
+ readonly name = "PackOperationClaimLostError";
11
+ }
12
+ export declare class PackManifestChangedError extends Error {
13
+ readonly name = "PackManifestChangedError";
14
+ }
15
+ export declare class PackInstallationVersionConflictError extends Error {
16
+ readonly expectedVersion: number;
17
+ readonly actualVersion: number;
18
+ readonly name = "PackInstallationVersionConflictError";
19
+ constructor(expectedVersion: number, actualVersion: number);
20
+ }
21
+ export declare class PackInstallationVersionRequiredError extends Error {
22
+ readonly name = "PackInstallationVersionRequiredError";
23
+ }
24
+ export type PreparedPackInstallation = {
25
+ installation: PackInstallation;
26
+ operationId: string;
27
+ operationVersion: number;
28
+ replayResult: Record<string, unknown> | null;
29
+ };
30
+ export declare function preparePackInstallationOperation(db: Database, input: {
31
+ accountId: string;
32
+ workspaceId: string;
33
+ subjectId: string;
34
+ pack: CapabilityPack;
35
+ manifestDigest: string;
36
+ selectedRigId: string | null;
37
+ metadata: Record<string, unknown>;
38
+ idempotencyKey: string;
39
+ requestDigest: string;
40
+ registeredManifestDigest?: string;
41
+ expectedInstallationVersion?: number;
42
+ }): Promise<PreparedPackInstallation>;
43
+ export declare function finalizePackInstallationOperation(db: Database, input: {
44
+ accountId: string;
45
+ workspaceId: string;
46
+ operationId: string;
47
+ operationVersion: number;
48
+ packInstallationId: string;
49
+ packId: string;
50
+ result: Record<string, unknown>;
51
+ }): Promise<PackInstallation>;
52
+ export declare function deferPackInstallationOperation(db: Database, input: {
53
+ accountId: string;
54
+ workspaceId: string;
55
+ operationId: string;
56
+ operationVersion: number;
57
+ packInstallationId: string;
58
+ phase: string;
59
+ errorCode: string;
60
+ }): Promise<void>;
61
+ export declare function touchPackInstallationOperation(db: Database, input: {
62
+ accountId: string;
63
+ workspaceId: string;
64
+ operationId: string;
65
+ operationVersion: number;
66
+ }): Promise<void>;
67
+ export declare function preparePackUninstallOperation(db: Database, input: {
68
+ accountId: string;
69
+ workspaceId: string;
70
+ subjectId: string;
71
+ packId: string;
72
+ expectedInstallationVersion: number;
73
+ idempotencyKey: string;
74
+ requestDigest: string;
75
+ }): Promise<PreparedPackInstallation | {
76
+ replayResult: Record<string, unknown>;
77
+ }>;
78
+ export declare function finalizePackUninstallOperation(db: Database, input: {
79
+ accountId: string;
80
+ workspaceId: string;
81
+ operationId: string;
82
+ operationVersion: number;
83
+ packInstallationId: string;
84
+ packId: string;
85
+ result: Record<string, unknown>;
86
+ }): Promise<void>;
@@ -33,13 +33,13 @@ export declare function isDatabasePersistenceFailure(error: unknown): boolean;
33
33
  export declare function safeDatabaseErrorFacts(error: unknown): SafeDatabaseErrorFacts;
34
34
  /**
35
35
  * Typed persistence classification that retains the exact original failure as
36
- * `cause`. Classification metadata supplements the cause; it never replaces or
37
- * rewrites source error content.
36
+ * `cause` for internal diagnostics. The ordinary Error message is deliberately
37
+ * stable and source-free so a generic presentation path can never disclose SQL,
38
+ * parameters, or driver detail by rendering `.message`.
38
39
  */
39
40
  export declare class SessionEventPersistenceError extends Error {
40
41
  readonly details: PersistenceFailureDetails;
41
42
  readonly name = "SessionEventPersistenceError";
42
- readonly cause: unknown;
43
43
  constructor(details: PersistenceFailureDetails, cause?: unknown);
44
44
  get code(): DatabaseFailureCode;
45
45
  }