@jini-ai/chat 0.7.3-next.2 → 0.7.3-next.3

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 (214) hide show
  1. package/README.md +49 -0
  2. package/dist/core/accepted-input.d.ts +1 -1
  3. package/dist/core/ag-ui/event-projection.d.ts +14 -69
  4. package/dist/core/ag-ui/event-projection.js +58 -133
  5. package/dist/core/ag-ui/event-reduction.d.ts +12 -2
  6. package/dist/core/ag-ui/event-reduction.js +35 -10
  7. package/dist/core/ag-ui/resume.d.ts +110 -0
  8. package/dist/core/ag-ui/resume.js +200 -0
  9. package/dist/core/ag-ui/run-input.d.ts +23 -0
  10. package/dist/core/ag-ui/run-input.js +45 -0
  11. package/dist/core/ag-ui/server.d.ts +69 -0
  12. package/dist/core/ag-ui/server.js +71 -0
  13. package/dist/core/agent-plugin-chat-state.js +13 -11
  14. package/dist/core/assistant-client/ag-ui-approval-relay.d.ts +113 -0
  15. package/dist/core/assistant-client/ag-ui-approval-relay.js +287 -0
  16. package/dist/core/assistant-client/ag-ui-fetch-agent.d.ts +25 -10
  17. package/dist/core/assistant-client/ag-ui-fetch-agent.js +25 -6
  18. package/dist/core/assistant-client/ag-ui-transport.d.ts +86 -3
  19. package/dist/core/assistant-client/ag-ui-transport.js +310 -80
  20. package/dist/core/assistant-client/browser-durable-subscription.d.ts +25 -0
  21. package/dist/core/assistant-client/browser-durable-subscription.js +78 -0
  22. package/dist/core/assistant-client/durable-run-subscription.js +141 -130
  23. package/dist/core/assistant-client/entry.d.ts +2 -1
  24. package/dist/core/assistant-client/entry.js +1 -0
  25. package/dist/core/assistant-client/transport-prompt.d.ts +94 -0
  26. package/dist/core/assistant-client/transport-prompt.js +180 -0
  27. package/dist/core/assistant-client/transport-run.d.ts +49 -0
  28. package/dist/core/assistant-client/transport-run.js +432 -0
  29. package/dist/core/assistant-client/transport-stream.d.ts +73 -0
  30. package/dist/core/assistant-client/transport-stream.js +128 -0
  31. package/dist/core/assistant-client/transport.d.ts +1 -1
  32. package/dist/core/assistant-client/transport.js +129 -835
  33. package/dist/core/assistant-content.d.ts +1 -17
  34. package/dist/core/assistant-content.js +16 -0
  35. package/dist/core/assistant-tool-metadata.d.ts +103 -0
  36. package/dist/core/assistant-tool-metadata.js +56 -0
  37. package/dist/core/checkpoint-interval.d.ts +1 -1
  38. package/dist/core/compact-events.d.ts +1 -1
  39. package/dist/core/durable-projection.d.ts +1 -1
  40. package/dist/core/durable-runs/continuation.d.ts +1 -1
  41. package/dist/core/durable-runs/ledger-contracts.d.ts +4 -1
  42. package/dist/core/durable-runs/ports.d.ts +2 -1
  43. package/dist/core/durable-runs/run-contracts.d.ts +1 -1
  44. package/dist/core/durable-runs/run-finalizer.d.ts +145 -0
  45. package/dist/core/durable-runs/run-finalizer.js +171 -0
  46. package/dist/core/events.d.ts +4 -82
  47. package/dist/core/events.js +2 -1
  48. package/dist/core/index.d.ts +4 -1
  49. package/dist/core/index.js +2 -1
  50. package/dist/core/messages.d.ts +1 -1
  51. package/dist/core/persistence/index.d.ts +1 -1
  52. package/dist/core/persistence/index.js +1 -1
  53. package/dist/core/question-form/normalize.d.ts +9 -3
  54. package/dist/core/question-form/normalize.js +20 -20
  55. package/dist/core/question-form/scan.js +15 -19
  56. package/dist/core/run-activity.d.ts +1 -1
  57. package/dist/core/run-events/entry.d.ts +11 -63
  58. package/dist/core/run-events/entry.js +12 -7
  59. package/dist/core/todos.d.ts +1 -1
  60. package/dist/core/todos.js +8 -0
  61. package/dist/core/tool-call-detail.d.ts +8 -1
  62. package/dist/core/tool-call-detail.js +35 -12
  63. package/dist/core/tool-events.d.ts +1 -1
  64. package/dist/core/tool-output.js +2 -6
  65. package/dist/core/tools.d.ts +2 -1
  66. package/dist/core/transport.d.ts +1 -1
  67. package/dist/core/turn-usage.d.ts +1 -1
  68. package/dist/core/util/parser.js +70 -69
  69. package/dist/embed-widget/browser/embed-send-bridge.d.ts +44 -0
  70. package/dist/embed-widget/browser/embed-send-bridge.js +60 -0
  71. package/dist/embed-widget/browser/frontend-invocation-handler.d.ts +39 -0
  72. package/dist/embed-widget/browser/frontend-invocation-handler.js +151 -0
  73. package/dist/embed-widget/browser/frontend-session-bridge.d.ts +28 -0
  74. package/dist/embed-widget/browser/frontend-session-bridge.js +201 -257
  75. package/dist/embed-widget/browser/lazy-loader.js +16 -12
  76. package/dist/embed-widget/browser/session-store.d.ts +19 -1
  77. package/dist/embed-widget/browser/session-store.js +48 -17
  78. package/dist/embed-widget/transports/fetch-sse.d.ts +1 -1
  79. package/dist/embed-widget/vanilla/index.js +131 -67
  80. package/dist/embed-widget/vanilla/state.js +53 -38
  81. package/dist/react/admin-execution/ai-agent-presentation.d.ts +35 -0
  82. package/dist/react/admin-execution/ai-agent-presentation.js +39 -0
  83. package/dist/react/admin-execution/hooks/use-ai-agent-presentation.hooks.d.ts +22 -0
  84. package/dist/react/admin-execution/hooks/use-ai-agent-presentation.hooks.js +25 -0
  85. package/dist/react/chat-cleanup/ChatCleanupPanel.d.ts +15 -0
  86. package/dist/react/chat-cleanup/ChatCleanupPanel.js +17 -0
  87. package/dist/react/chat-cleanup/chat-cleanup.hooks.d.ts +168 -0
  88. package/dist/react/chat-cleanup/chat-cleanup.hooks.js +83 -0
  89. package/dist/react/components/ChatCleanupDialog.d.ts +38 -0
  90. package/dist/react/components/ChatCleanupDialog.js +12 -0
  91. package/dist/react/components/ConversationList.d.ts +14 -5
  92. package/dist/react/components/ConversationList.hooks.d.ts +1 -0
  93. package/dist/react/components/ConversationList.hooks.js +4 -2
  94. package/dist/react/components/ConversationList.js +41 -5
  95. package/dist/react/components/Icon.d.ts +1 -1
  96. package/dist/react/components/Icon.js +2 -0
  97. package/dist/react/components/Markdown.js +6 -6
  98. package/dist/react/components/MarkdownLink.d.ts +25 -0
  99. package/dist/react/components/MarkdownLink.js +17 -0
  100. package/dist/react/components/RoutedA2uiSurfaceCard.d.ts +80 -0
  101. package/dist/react/components/RoutedA2uiSurfaceCard.js +15 -0
  102. package/dist/react/components/ToolCard.d.ts +4 -2
  103. package/dist/react/components/ToolCard.js +46 -4
  104. package/dist/react/components/ToolCard.rules.d.ts +5 -2
  105. package/dist/react/components/ToolCard.rules.js +12 -5
  106. package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
  107. package/dist/react/components/mcp-ui-surface-state.d.ts +3 -1
  108. package/dist/react/components/mcp-ui-surface-state.js +2 -2
  109. package/dist/react/components/own-link.d.ts +26 -0
  110. package/dist/react/components/own-link.js +36 -0
  111. package/dist/react/features/bridged-chat/create-staged-attachment-uploader.d.ts +7 -0
  112. package/dist/react/features/bridged-chat/create-staged-attachment-uploader.js +26 -0
  113. package/dist/react/features/bridged-chat/hooks/useBridgedChatTransport.hooks.d.ts +12 -0
  114. package/dist/react/features/bridged-chat/hooks/useBridgedChatTransport.hooks.js +60 -0
  115. package/dist/react/features/bridged-chat/index.d.ts +8 -0
  116. package/dist/react/features/bridged-chat/index.js +7 -0
  117. package/dist/react/features/bridged-chat/types.d.ts +49 -0
  118. package/dist/react/features/bridged-chat/types.js +2 -0
  119. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +1 -1
  120. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts +6 -0
  121. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js +101 -59
  122. package/dist/react/features/chat-pane/hooks/useChatPaneNewTabLinks.hooks.d.ts +3 -0
  123. package/dist/react/features/chat-pane/hooks/useChatPaneNewTabLinks.hooks.js +26 -16
  124. package/dist/react/features/chat-pane/model-options.d.ts +3 -1
  125. package/dist/react/features/chat-pane/model-options.js +3 -3
  126. package/dist/react/features/chat-pane/rules.js +4 -3
  127. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  128. package/dist/react/features/chat-pane/styles.js +16 -0
  129. package/dist/react/features/conversation-chat-pane/components/ConversationChatPane.d.ts +10 -0
  130. package/dist/react/features/conversation-chat-pane/components/ConversationChatPane.js +19 -0
  131. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneChat.d.ts +12 -0
  132. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneChat.js +21 -0
  133. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneHeader.d.ts +13 -0
  134. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneHeader.js +9 -0
  135. package/dist/react/features/conversation-chat-pane/components/ConversationDeleteConfirm.d.ts +12 -0
  136. package/dist/react/features/conversation-chat-pane/components/ConversationDeleteConfirm.js +12 -0
  137. package/dist/react/features/conversation-chat-pane/hooks/useConversationChatPane.hooks.d.ts +7 -0
  138. package/dist/react/features/conversation-chat-pane/hooks/useConversationChatPane.hooks.js +43 -0
  139. package/dist/react/features/conversation-chat-pane/index.d.ts +9 -0
  140. package/dist/react/features/conversation-chat-pane/index.js +8 -0
  141. package/dist/react/features/conversation-chat-pane/rules.d.ts +25 -0
  142. package/dist/react/features/conversation-chat-pane/rules.js +29 -0
  143. package/dist/react/features/conversation-chat-pane/types.d.ts +139 -0
  144. package/dist/react/features/conversation-chat-pane/types.js +2 -0
  145. package/dist/react/features/conversations/conversation-controller.d.ts +16 -0
  146. package/dist/react/features/conversations/conversation-controller.js +280 -0
  147. package/dist/react/features/conversations/hooks/useConversationDeleteConfirmation.hooks.d.ts +15 -0
  148. package/dist/react/features/conversations/hooks/useConversationDeleteConfirmation.hooks.js +33 -0
  149. package/dist/react/features/conversations/hooks/useStoredConversations.hooks.d.ts +16 -0
  150. package/dist/react/features/conversations/hooks/useStoredConversations.hooks.js +36 -0
  151. package/dist/react/features/conversations/index.d.ts +9 -0
  152. package/dist/react/features/conversations/index.js +8 -0
  153. package/dist/react/features/conversations/types.d.ts +120 -0
  154. package/dist/react/features/conversations/types.js +2 -0
  155. package/dist/react/features/voice-input/space-hold-rules.d.ts +65 -0
  156. package/dist/react/features/voice-input/space-hold-rules.js +48 -0
  157. package/dist/react/hooks/testing/fake-transport.d.ts +1 -1
  158. package/dist/react/hooks/useAnsweredCards.d.ts +2 -1
  159. package/dist/react/hooks/useConversation.js +5 -2
  160. package/dist/react/hooks/useExtEventGroups.d.ts +1 -1
  161. package/dist/react/hooks/useRunActivity.d.ts +2 -1
  162. package/dist/react/hooks/useRunStream.d.ts +1 -1
  163. package/dist/react/hooks/useRunStream.js +1 -1
  164. package/dist/react/hooks/useSurfaceRecovery.js +3 -1
  165. package/dist/react/hooks/useToolTimeline.d.ts +2 -1
  166. package/dist/react/index.d.ts +5 -2
  167. package/dist/react/index.js +4 -2
  168. package/dist/react/message-blocks.d.ts +1 -48
  169. package/dist/react/message-blocks.js +47 -0
  170. package/dist/react/styles/chat-settings.css +14 -14
  171. package/dist/server/chat-cleanup-routes.d.ts +56 -0
  172. package/dist/server/chat-cleanup-routes.js +56 -0
  173. package/dist/server/durable-runs/recover.js +193 -171
  174. package/dist/server/run-finalizer/entry.js +133 -110
  175. package/dist/store/legacy/sqlite/conversations.js +29 -17
  176. package/dist/store/pglite/index.d.ts +1 -0
  177. package/dist/store/pglite/index.js +1 -0
  178. package/dist/store/ports.d.ts +12 -0
  179. package/dist/store/postgres/index.d.ts +1 -0
  180. package/dist/store/postgres/index.js +1 -0
  181. package/dist/store/runtime/attempt-base-retention.d.ts +57 -0
  182. package/dist/store/runtime/attempt-base-retention.js +103 -0
  183. package/dist/store/runtime/chat-maintenance.d.ts +16 -0
  184. package/dist/store/runtime/chat-maintenance.js +19 -0
  185. package/dist/store/runtime/chat-principal.d.ts +63 -0
  186. package/dist/store/runtime/chat-principal.js +39 -0
  187. package/dist/store/runtime/checkpoint-delta.d.ts +1 -1
  188. package/dist/store/runtime/durable-run-queries.d.ts +124 -0
  189. package/dist/store/runtime/durable-run-queries.js +122 -0
  190. package/dist/store/runtime/durable-run-store.d.ts +1 -1
  191. package/dist/store/runtime/durable-run-store.js +291 -343
  192. package/dist/store/runtime/entry.d.ts +3 -0
  193. package/dist/store/runtime/entry.js +3 -0
  194. package/dist/store/runtime/events-json.d.ts +1 -1
  195. package/dist/store/runtime/lazy-run-ledger.d.ts +19 -0
  196. package/dist/store/runtime/lazy-run-ledger.js +28 -0
  197. package/dist/store/runtime/run-ledger.d.ts +4 -1
  198. package/dist/store/runtime/run-ledger.js +256 -204
  199. package/dist/store/sql/bulk-deletion.d.ts +36 -0
  200. package/dist/store/sql/bulk-deletion.js +103 -0
  201. package/dist/store/sql/store-queries.d.ts +170 -0
  202. package/dist/store/sql/store-queries.js +212 -0
  203. package/dist/store/sql/store-rows.d.ts +106 -0
  204. package/dist/store/sql/store-rows.js +116 -0
  205. package/dist/store/sql/store-writes.d.ts +46 -0
  206. package/dist/store/sql/store-writes.js +161 -0
  207. package/dist/store/sql/store.d.ts +3 -16
  208. package/dist/store/sql/store.js +58 -428
  209. package/dist/store/sql/tables.d.ts +1 -0
  210. package/dist/store/sqlite/index.d.ts +1 -0
  211. package/dist/store/sqlite/index.js +1 -0
  212. package/dist/store/sqlite/schema.d.ts +1 -1
  213. package/dist/store/sqlite/schema.js +5 -1
  214. package/package.json +171 -20
@@ -0,0 +1,103 @@
1
+ import { sql } from 'kysely';
2
+ import { copyScope } from './boundary.js';
3
+ /** Why a previewed chat is kept, or `undefined` when it may be deleted. */
4
+ function previewKeepReason({ row, open }) {
5
+ if (row.pinned_at !== null)
6
+ return 'pinned';
7
+ if (open === undefined)
8
+ return 'unknown';
9
+ if (open.has(row.id))
10
+ return 'open';
11
+ if (row.active)
12
+ return 'active';
13
+ if (row.recoverable)
14
+ return 'recoverable';
15
+ return undefined;
16
+ }
17
+ /** Total stored bytes of the messages in the given conversations. */
18
+ async function measureMessageBytes({ kernel, ids }) {
19
+ const text = sql `content || coalesce(events_json, '') || coalesce(attachments_json, '')`;
20
+ const length = kernel.dialect === 'sqlite' ? sql `length(cast(${text} as blob))` : sql `octet_length(${text})`;
21
+ const measured = await kernel.run(db => db.selectFrom('ai_chat_messages').select(sql `coalesce(sum(${length}), 0)`.as('bytes'))
22
+ .where('conversation_id', 'in', ids).executeTakeFirstOrThrow());
23
+ return Number(measured.bytes);
24
+ }
25
+ function loadCleanupPreviewRows({ kernel, scope, now, before, previewLimit }) {
26
+ return kernel.run(db => db.selectFrom('ai_chats').select(['id', 'title', 'pinned_at', 'updated_at'])
27
+ .where('scope_id', '=', scope.scopeId).where('owner_kind', '=', scope.ownerKind).where('owner_id', '=', scope.ownerId)
28
+ .where('updated_at', '<', before)
29
+ .select(eb => [
30
+ eb.exists(eb.selectFrom('ai_chat_messages as m').select('m.id').whereRef('m.conversation_id', '=', 'ai_chats.id')
31
+ .where('m.role', '=', 'assistant').where('m.run_status', 'in', ['queued', 'running'])).as('active'),
32
+ eb.exists(eb.selectFrom('ai_chat_messages as m').leftJoin('assistant_run_attempts as a', 'a.message_id', 'm.id').select('m.id')
33
+ .whereRef('m.conversation_id', '=', 'ai_chats.id').where('m.role', '=', 'assistant').where('m.run_id', 'is not', null)
34
+ .where(eb => eb.or([eb('m.run_status', 'is', null), eb('m.run_status', 'not in', ['queued', 'running', 'succeeded', 'failed', 'canceled']), eb('a.recovery_deadline', '>', now())]))).as('recoverable'),
35
+ ]).orderBy('updated_at').orderBy('id').limit(previewLimit).execute());
36
+ }
37
+ async function applyDeletionBatch({ kernel, scope, now, sorted, offset, before, openConversations, deleted, kept }) {
38
+ const batch = sorted.slice(offset, offset + 50);
39
+ // The run-slot lock is the bulk fence: acceptance cannot start a run between recheck and delete.
40
+ for (const id of batch)
41
+ await kernel.lockKey(`chat-slot:${id}`);
42
+ const open = await openConversations().catch(() => undefined);
43
+ for (const id of batch) {
44
+ const row = await kernel.run(db => db.selectFrom('ai_chats').select(['id', 'title', 'pinned_at', 'updated_at'])
45
+ .where('id', '=', id).where('scope_id', '=', scope.scopeId).where('owner_kind', '=', scope.ownerKind).where('owner_id', '=', scope.ownerId).executeTakeFirst());
46
+ if (!row)
47
+ continue;
48
+ const runs = await kernel.run(db => db.selectFrom('ai_chat_messages as m').leftJoin('assistant_run_attempts as a', 'a.message_id', 'm.id')
49
+ .select([
50
+ sql `coalesce(max(case when m.run_status in ('queued', 'running') then 1 else 0 end), 0)`.as('active'),
51
+ sql `coalesce(max(case when m.run_id is not null and (m.run_status is null or m.run_status not in ('queued', 'running', 'succeeded', 'failed', 'canceled')) then 1 else 0 end), 0)`.as('unknown'),
52
+ sql `coalesce(max(case when a.recovery_deadline > ${now()} then 1 else 0 end), 0)`.as('recoverable'),
53
+ ]).where('m.conversation_id', '=', id).where('m.role', '=', 'assistant').executeTakeFirstOrThrow());
54
+ const reason = [
55
+ [row.pinned_at !== null, 'pinned'], [before !== undefined && Number(row.updated_at) >= before, 'cutoff'],
56
+ [open === undefined, 'unknown'], [open?.has(id), 'open'],
57
+ [runs.active, 'active'],
58
+ [runs.unknown, 'unknown'],
59
+ [runs.recoverable, 'recoverable'],
60
+ ].find(([keep]) => keep)?.[1];
61
+ if (reason) {
62
+ kept.push({ id, title: row.title, reason });
63
+ continue;
64
+ }
65
+ const removed = await kernel.run(db => db.deleteFrom('ai_chats').where('id', '=', id).where('scope_id', '=', scope.scopeId)
66
+ .where('owner_kind', '=', scope.ownerKind).where('owner_id', '=', scope.ownerId).where('pinned_at', 'is', null)
67
+ .$if(before !== undefined, query => query.where('updated_at', '<', before)).returning('id').executeTakeFirst());
68
+ if (removed)
69
+ deleted.push(id);
70
+ else
71
+ kept.push({ id, title: row.title, reason: 'changed' });
72
+ }
73
+ }
74
+ export function createChatBulkDeletion({ kernel, scope: inputScope, now, openConversations }, { previewLimit = 5000 } = {}) {
75
+ const scope = copyScope({ scope: inputScope });
76
+ return {
77
+ async preview({ before }, _optional = {}) {
78
+ const rows = await loadCleanupPreviewRows({ kernel, scope, now, before, previewLimit });
79
+ const ids = [], kept = [];
80
+ const open = await openConversations().catch(() => undefined);
81
+ for (const row of rows) {
82
+ const reason = previewKeepReason({ row, open });
83
+ if (reason) {
84
+ kept.push({ id: row.id, title: row.title, reason });
85
+ continue;
86
+ }
87
+ ids.push(row.id);
88
+ }
89
+ const bytes = ids.length ? await measureMessageBytes({ kernel, ids }) : 0;
90
+ return { ids, count: ids.length, bytes, before, kept };
91
+ },
92
+ async apply({ ids, before }, _optional = {}) {
93
+ if (ids.length > 500)
94
+ throw new RangeError('Choose at most 500 chats at a time.');
95
+ const sorted = [...new Set(ids)].sort();
96
+ const deleted = [], kept = [];
97
+ for (let offset = 0; offset < sorted.length; offset += 50)
98
+ await kernel.transaction(() => applyDeletionBatch({ kernel, scope, now, sorted, offset, before, openConversations, deleted, kept }));
99
+ return { deleted, kept };
100
+ },
101
+ };
102
+ }
103
+ //# sourceMappingURL=bulk-deletion.js.map
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Read-side queries of the owner-bound SQL chat store. Every query goes through the injected
3
+ * {@link SqlStoreContext}, so the immutable owner scope, the borrowed kernel and the clock are
4
+ * passed in, never captured from module state.
5
+ */
6
+ import { type Kysely } from 'kysely';
7
+ import type { Clock } from '@jini-ai/core/primitives';
8
+ import type { StorageKernel } from '@jini-ai/core/contracts/storage';
9
+ import type { ChatMessage } from '../../core/messages.js';
10
+ import type { ChatConversation, ChatHistoryReader, ChatMessagePageInput, ChatOwnerScope, ChatPageOptions } from '../ports.js';
11
+ import type { ChatDatabase } from './tables.js';
12
+ import { type MessageRow } from './store-rows.js';
13
+ /** Everything one store instance needs, injected once by `createSqlChatStore`. */
14
+ export interface SqlStoreContext {
15
+ readonly kernel: StorageKernel<Kysely<ChatDatabase>, ChatDatabase>;
16
+ /** The single subset boundary: runs `body` on the borrowed kernel through the table-subset projection. */
17
+ readonly run: <T>(body: (db: Kysely<ChatDatabase>) => T | Promise<T>) => Promise<T>;
18
+ readonly scope: ChatOwnerScope;
19
+ readonly clock: Clock;
20
+ /** Projects a stored row to its public shape (owned by `store.ts`, which also exports it). */
21
+ readonly toMessage: (row: MessageRow) => ChatMessage;
22
+ }
23
+ type MessageReadOptions = {
24
+ includeEvents?: boolean | "user";
25
+ };
26
+ type HistoryListOptions = NonNullable<Parameters<ChatHistoryReader['list']>[1]>;
27
+ type HistoryReadOptions = NonNullable<Parameters<ChatHistoryReader['read']>[1]>;
28
+ /** This scope's conversations, projected as {@link ConversationRow}s with their message count. */
29
+ export declare function ownedConversations({ ctx, db }: {
30
+ ctx: SqlStoreContext;
31
+ db: Kysely<ChatDatabase>;
32
+ }): import("kysely").SelectQueryBuilder<ChatDatabase & {
33
+ c: import("./tables.js").AiChatsTable;
34
+ }, "c", {
35
+ updated_at: number;
36
+ id: string;
37
+ title: string | null;
38
+ created_at: number;
39
+ title_source: string;
40
+ expires_at: number | null;
41
+ pinned_at: number | null;
42
+ message_count: number | null;
43
+ }>;
44
+ /** One owner-filtered indexed lookup; missing and foreign IDs both return null. */
45
+ export declare function getConversation({ ctx, id }: {
46
+ ctx: SqlStoreContext;
47
+ id: string;
48
+ }): Promise<ChatConversation | null>;
49
+ /** All owned conversations, most recently active first. */
50
+ export declare function listConversations({ ctx }: {
51
+ ctx: SqlStoreContext;
52
+ }): Promise<ChatConversation[]>;
53
+ /** One scoped projection for all message reads, including the row returned by an upsert. */
54
+ export declare function ownedMessages({ ctx, db, conversationId }: {
55
+ ctx: SqlStoreContext;
56
+ db: Kysely<ChatDatabase>;
57
+ conversationId: string;
58
+ }, { includeEvents }?: MessageReadOptions): import("kysely").SelectQueryBuilder<ChatDatabase & {
59
+ m: import("./tables.js").AiChatMessagesTable;
60
+ } & {
61
+ c: import("./tables.js").AiChatsTable;
62
+ }, "c" | "m", {
63
+ id: string;
64
+ content: string;
65
+ role: string;
66
+ agent_id: string | null;
67
+ agent_name: string | null;
68
+ attachments_json: string | null;
69
+ run_id: string | null;
70
+ run_status: string | null;
71
+ created_at: number;
72
+ started_at: number | null;
73
+ ended_at: number | null;
74
+ } & {
75
+ events_json: string | null;
76
+ }>;
77
+ /** Read owned messages in persisted position order; foreign IDs produce no rows. */
78
+ export declare function listMessages({ ctx, conversationId }: {
79
+ ctx: SqlStoreContext;
80
+ } & ChatMessagePageInput, { includeEvents }?: MessageReadOptions): Promise<ChatMessage[]>;
81
+ /** One indexed, owner-scoped row; browser save fences do not need the conversation's history. */
82
+ export declare function messageById({ ctx, conversationId, messageId }: {
83
+ ctx: SqlStoreContext;
84
+ conversationId: string;
85
+ messageId: string;
86
+ }): Promise<ChatMessage | null>;
87
+ /** SQLite's connection/external-commit counters avoid reading message rows at all. PG uses
88
+ * MVCC versions from only this conversation's indexed metadata, never large event columns.
89
+ * @complexity O(1) SQLite; O(n) PG message metadata for n messages; O(1) returned bytes.
90
+ */
91
+ export declare function messagesVersion({ ctx, conversationId }: {
92
+ ctx: SqlStoreContext;
93
+ conversationId: string;
94
+ }): Promise<string | null>;
95
+ /** Owned message rows in position order, each with SQLite's `json_valid` verdict on its events column. */
96
+ export declare function messageRowsWithValidity({ ctx, conversationId }: {
97
+ ctx: SqlStoreContext;
98
+ conversationId: string;
99
+ }): Promise<{
100
+ id: string;
101
+ content: string;
102
+ role: string;
103
+ agent_id: string | null;
104
+ agent_name: string | null;
105
+ attachments_json: string | null;
106
+ run_id: string | null;
107
+ run_status: string | null;
108
+ created_at: number;
109
+ started_at: number | null;
110
+ ended_at: number | null;
111
+ events_json: string | null;
112
+ events_json_valid: number | null;
113
+ }[]>;
114
+ /** Literal search uses two scoped projections, not a transcript fetch per conversation.
115
+ * A continuation is bound to this owner and orders by activity descending, then ID ascending.
116
+ * @throws {ChatStoreError} For invalid inputs or a cursor belonging to another scope.
117
+ * @complexity The database scans owned content for search; at most limit+1 rows are returned.
118
+ */
119
+ export declare function historyList({ ctx, options }: {
120
+ ctx: SqlStoreContext;
121
+ options: HistoryListOptions;
122
+ }): Promise<{
123
+ items: {
124
+ firstUserLine: string;
125
+ id: string;
126
+ title: string | null;
127
+ titleSource: import("../ports.js").ChatTitleSource;
128
+ messageCount: number;
129
+ createdAt: number;
130
+ updatedAt: number;
131
+ expiresAt?: number;
132
+ pinned?: boolean;
133
+ }[];
134
+ nextCursor: string | null;
135
+ }>;
136
+ /** No attachment column is read. O(limit) rows; default tail is reversed into position order. */
137
+ export declare function historyRead({ ctx, chatId, options }: {
138
+ ctx: SqlStoreContext;
139
+ chatId: string;
140
+ options: HistoryReadOptions;
141
+ }): Promise<{
142
+ messages: {
143
+ events?: any;
144
+ id: string;
145
+ role: ChatMessage["role"];
146
+ content: string;
147
+ position: number;
148
+ createdAt: number;
149
+ }[];
150
+ hasMore: boolean;
151
+ }>;
152
+ /** One cursor page of owned conversations, activity descending then ID ascending. */
153
+ export declare function pageConversations({ ctx, options }: {
154
+ ctx: SqlStoreContext;
155
+ options: ChatPageOptions;
156
+ }): Promise<{
157
+ nextCursor?: string;
158
+ items: ChatConversation[];
159
+ }>;
160
+ /** One cursor page of an owned conversation's messages, position ascending then ID ascending. */
161
+ export declare function pageMessages({ ctx, input, options }: {
162
+ ctx: SqlStoreContext;
163
+ input: ChatMessagePageInput;
164
+ options: ChatPageOptions;
165
+ }): Promise<{
166
+ nextCursor?: string;
167
+ items: ChatMessage[];
168
+ }>;
169
+ export {};
170
+ //# sourceMappingURL=store-queries.d.ts.map
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Read-side queries of the owner-bound SQL chat store. Every query goes through the injected
3
+ * {@link SqlStoreContext}, so the immutable owner scope, the borrowed kernel and the clock are
4
+ * passed in, never captured from module state.
5
+ */
6
+ import { sql } from 'kysely';
7
+ import { MID_RUN_USER_MESSAGE_EVENT_NAME } from '../../core/turn-usage.js';
8
+ import { pageLimit, decodeCursor, encodeCursor } from './cursor.js';
9
+ import { sqliteReadVersion } from './read-version.js';
10
+ import { CONVERSATION_UPDATED_AT, MESSAGE_POSITION, assertHistoryListInputs, assertHistoryReadBounds, messageEventsColumn, ordinalId, toConversation, toHistoryMessage, } from './store-rows.js';
11
+ // Count embedded user messages in SQL: list/get still return summaries, never whole transcripts.
12
+ // Writers store `JSON.stringify` output (no whitespace, as appendedEventsJson also relies on), so
13
+ // each mid-run event holds this exact text once; text inside a JSON string has escaped quotes and
14
+ // cannot match, and invalid JSON stays readable (it counts what it holds, never throws). Plain
15
+ // length/replace run on SQLite and PostgreSQL 14+, unlike `IS JSON` (PostgreSQL 16+).
16
+ const MID_RUN_NEEDLE = `"name":"${MID_RUN_USER_MESSAGE_EVENT_NAME}"`;
17
+ const MID_RUN_COUNT = sql `((length(coalesce(m.events_json, '')) - length(replace(coalesce(m.events_json, ''), ${sql.lit(MID_RUN_NEEDLE)}, ''))) / ${sql.lit(MID_RUN_NEEDLE.length)})`;
18
+ /** This scope's conversations, projected as {@link ConversationRow}s with their message count. */
19
+ export function ownedConversations({ ctx, db }) {
20
+ const { scopeId, ownerKind, ownerId } = ctx.scope;
21
+ return db
22
+ .selectFrom("ai_chats as c")
23
+ .select((eb) => [
24
+ "c.id",
25
+ "c.title",
26
+ "c.title_source",
27
+ "c.created_at",
28
+ CONVERSATION_UPDATED_AT,
29
+ "c.expires_at",
30
+ "c.pinned_at",
31
+ eb
32
+ .selectFrom("ai_chat_messages as m")
33
+ .select(sql `coalesce(sum(1 + case when m.role = 'assistant' then ${MID_RUN_COUNT} else 0 end), 0)`.as("n"))
34
+ .whereRef("m.conversation_id", "=", "c.id")
35
+ .as("message_count"),
36
+ ])
37
+ .where("c.scope_id", "=", scopeId)
38
+ .where("c.owner_kind", "=", ownerKind)
39
+ .where("c.owner_id", "=", ownerId);
40
+ }
41
+ /** One owner-filtered indexed lookup; missing and foreign IDs both return null. */
42
+ export async function getConversation({ ctx, id }) {
43
+ const row = await ctx.run((db) => ownedConversations({ ctx, db }).where("c.id", "=", id).executeTakeFirst());
44
+ return row ? toConversation(row) : null;
45
+ }
46
+ /** All owned conversations, most recently active first. */
47
+ export async function listConversations({ ctx }) {
48
+ const rows = await ctx.run((db) => ownedConversations({ ctx, db }).orderBy(CONVERSATION_UPDATED_AT, "desc").execute());
49
+ return rows.map((row) => toConversation(row));
50
+ }
51
+ /** One scoped projection for all message reads, including the row returned by an upsert. */
52
+ export function ownedMessages({ ctx, db, conversationId }, { includeEvents = true } = {}) {
53
+ const { scopeId, ownerKind, ownerId } = ctx.scope;
54
+ return db
55
+ .selectFrom("ai_chat_messages as m")
56
+ .innerJoin("ai_chats as c", "c.id", "m.conversation_id")
57
+ .select([
58
+ "m.id",
59
+ "m.role",
60
+ "m.content",
61
+ "m.agent_id",
62
+ "m.agent_name",
63
+ "m.attachments_json",
64
+ "m.run_id",
65
+ "m.run_status",
66
+ "m.created_at",
67
+ "m.started_at",
68
+ "m.ended_at",
69
+ ])
70
+ .select(messageEventsColumn({ includeEvents }).as('events_json'))
71
+ .where("m.conversation_id", "=", conversationId)
72
+ .where("c.scope_id", "=", scopeId)
73
+ .where("c.owner_kind", "=", ownerKind)
74
+ .where("c.owner_id", "=", ownerId);
75
+ }
76
+ /** Read owned messages in persisted position order; foreign IDs produce no rows. */
77
+ export async function listMessages({ ctx, conversationId }, { includeEvents = true } = {}) {
78
+ const rows = await ctx.run(db => ownedMessages({ ctx, db, conversationId }, { includeEvents }).orderBy(MESSAGE_POSITION).execute());
79
+ return rows.map(ctx.toMessage);
80
+ }
81
+ /** One indexed, owner-scoped row; browser save fences do not need the conversation's history. */
82
+ export async function messageById({ ctx, conversationId, messageId }) {
83
+ const row = await ctx.run(db => ownedMessages({ ctx, db, conversationId }).where('m.id', '=', messageId).executeTakeFirst());
84
+ return row ? ctx.toMessage(row) : null;
85
+ }
86
+ /** SQLite's connection/external-commit counters avoid reading message rows at all. PG uses
87
+ * MVCC versions from only this conversation's indexed metadata, never large event columns.
88
+ * @complexity O(1) SQLite; O(n) PG message metadata for n messages; O(1) returned bytes.
89
+ */
90
+ export async function messagesVersion({ ctx, conversationId }) {
91
+ const { kernel } = ctx;
92
+ const { scopeId, ownerKind, ownerId } = ctx.scope;
93
+ const row = await ctx.run(db => db.selectFrom('ai_chats as c').select(eb => {
94
+ const version = kernel.dialect === 'sqlite' ? sqliteReadVersion({ kernel })
95
+ : sql `md5(coalesce(${eb.selectFrom('ai_chat_messages as m')
96
+ .select(sql `string_agg(m.id || ':' || cast(m.xmin as text), ',' order by m.position)`.as('versions'))
97
+ .whereRef('m.conversation_id', '=', 'c.id')}, ''))`;
98
+ return version.as('version');
99
+ })
100
+ .where('c.id', '=', conversationId).where('c.scope_id', '=', scopeId)
101
+ .where('c.owner_kind', '=', ownerKind).where('c.owner_id', '=', ownerId).executeTakeFirst());
102
+ return row?.version ?? null;
103
+ }
104
+ /** Owned message rows in position order, each with SQLite's `json_valid` verdict on its events column. */
105
+ export async function messageRowsWithValidity({ ctx, conversationId }) {
106
+ const valid = ctx.kernel.dialect === 'sqlite' ? sql `json_valid(m.events_json)` : sql `null`;
107
+ return ctx.run(db => ownedMessages({ ctx, db, conversationId }).select(valid.as('events_json_valid')).orderBy(MESSAGE_POSITION).execute());
108
+ }
109
+ /** Search + continuation filters for the history list, before ordering and the page limit. */
110
+ function historyConversationFilter({ ctx, db, query, anchor }) {
111
+ const id = ordinalId({ dialect: ctx.kernel.dialect, column: 'c.id' });
112
+ let statement = ownedConversations({ ctx, db }).select(eb => eb.selectFrom('ai_chat_messages as first')
113
+ .select('first.content').whereRef('first.conversation_id', '=', 'c.id').where('first.role', '=', 'user')
114
+ .orderBy('first.position').limit(1).as('first_user_line'));
115
+ if (query?.trim()) {
116
+ // Escape LIKE wildcards: user search is literal text, never an SQL/FTS expression.
117
+ const pattern = '%' + query.trim().toLowerCase().replace(/[!%_]/g, char => '!' + char) + '%';
118
+ statement = statement.where(eb => eb.or([
119
+ sql `lower(c.title) like ${pattern} escape '!'`,
120
+ eb.exists(eb.selectFrom('ai_chat_messages as found').select('found.id')
121
+ .whereRef('found.conversation_id', '=', 'c.id')
122
+ .where(sql `lower(found.content) like ${pattern} escape '!'`)),
123
+ ]));
124
+ }
125
+ if (anchor)
126
+ statement = statement.where(eb => eb.or([
127
+ eb(CONVERSATION_UPDATED_AT, '<', anchor[0]),
128
+ eb.and([eb(CONVERSATION_UPDATED_AT, '=', anchor[0]), eb(id, '>', anchor[1])]),
129
+ ]));
130
+ return statement;
131
+ }
132
+ /** Literal search uses two scoped projections, not a transcript fetch per conversation.
133
+ * A continuation is bound to this owner and orders by activity descending, then ID ascending.
134
+ * @throws {ChatStoreError} For invalid inputs or a cursor belonging to another scope.
135
+ * @complexity The database scans owned content for search; at most limit+1 rows are returned.
136
+ */
137
+ export async function historyList({ ctx, options }) {
138
+ const { query, limit = 20, cursor } = options;
139
+ assertHistoryListInputs({ limit, query });
140
+ const { scope } = ctx;
141
+ const anchor = decodeCursor({ cursor: cursor ?? undefined, kind: 'conversations', scope, conversation: null });
142
+ const id = ordinalId({ dialect: ctx.kernel.dialect, column: 'c.id' });
143
+ const rows = await ctx.run(db => historyConversationFilter({ ctx, db, query, anchor })
144
+ .orderBy(CONVERSATION_UPDATED_AT, 'desc').orderBy(id, 'asc').limit(limit + 1).execute());
145
+ const items = rows.slice(0, limit).map(row => ({ ...toConversation(row), firstUserLine: row.first_user_line ?? '' }));
146
+ const last = items.at(-1);
147
+ const nextCursor = rows.length > limit && last
148
+ ? encodeCursor({ kind: 'conversations', scope, conversation: null, anchor: [last.updatedAt, last.id] })
149
+ : null;
150
+ return { items, nextCursor };
151
+ }
152
+ /** No attachment column is read. O(limit) rows; default tail is reversed into position order. */
153
+ export async function historyRead({ ctx, chatId, options }) {
154
+ const { fromPosition, limit = 50, includeToolEvents = false } = options;
155
+ assertHistoryReadBounds({ limit, fromPosition });
156
+ const rows = await ctx.run(db => {
157
+ let statement = ownedMessages({ ctx, db, conversationId: chatId }).clearSelect().select([
158
+ 'm.id', 'm.role', 'm.content', MESSAGE_POSITION, 'm.created_at',
159
+ ]);
160
+ if (fromPosition !== undefined)
161
+ statement = statement.where(MESSAGE_POSITION, '>=', fromPosition);
162
+ return statement.select(includeToolEvents ? sql `m.events_json`.as('events_json') : sql `null`.as('events_json'))
163
+ .orderBy(MESSAGE_POSITION, fromPosition === undefined ? 'desc' : 'asc').limit(limit + 1).execute();
164
+ });
165
+ const page = rows.slice(0, limit);
166
+ if (fromPosition === undefined)
167
+ page.reverse();
168
+ return { messages: page.map(row => toHistoryMessage(row, { includeToolEvents })), hasMore: rows.length > limit };
169
+ }
170
+ /** One cursor page of owned conversations, activity descending then ID ascending. */
171
+ export async function pageConversations({ ctx, options }) {
172
+ const { scope } = ctx;
173
+ const limit = pageLimit({ options: options });
174
+ const anchor = decodeCursor({ cursor: options?.cursor, kind: 'conversations', scope: scope, conversation: null });
175
+ const id = ordinalId({ dialect: ctx.kernel.dialect, column: 'c.id' });
176
+ const rows = await ctx.run(db => {
177
+ let query = ownedConversations({ ctx, db });
178
+ if (anchor)
179
+ query = query.where(eb => eb.or([
180
+ eb(CONVERSATION_UPDATED_AT, '<', anchor[0]),
181
+ eb.and([eb(CONVERSATION_UPDATED_AT, '=', anchor[0]), eb(id, '>', anchor[1])]),
182
+ ]));
183
+ return query.orderBy(CONVERSATION_UPDATED_AT, 'desc').orderBy(id, 'asc').limit(limit + 1).execute();
184
+ });
185
+ const items = rows.slice(0, limit).map(row => toConversation(row));
186
+ const last = items.at(-1);
187
+ return { items, ...(rows.length > limit && last ? {
188
+ nextCursor: encodeCursor({ kind: 'conversations', scope: scope, conversation: null, anchor: [last.updatedAt, last.id] }),
189
+ } : {}) };
190
+ }
191
+ /** One cursor page of an owned conversation's messages, position ascending then ID ascending. */
192
+ export async function pageMessages({ ctx, input, options }) {
193
+ const { scope } = ctx;
194
+ const limit = pageLimit({ options: options });
195
+ const anchor = decodeCursor({ cursor: options?.cursor, kind: 'messages', scope: scope, conversation: input.conversationId });
196
+ const id = ordinalId({ dialect: ctx.kernel.dialect, column: 'm.id' });
197
+ // One join, at most limit+1 rows, including the ownership check; no parent pre-read.
198
+ const rows = await ctx.run(db => {
199
+ let query = ownedMessages({ ctx, db, conversationId: input.conversationId }).select(MESSAGE_POSITION);
200
+ if (anchor)
201
+ query = query.where(eb => eb.or([
202
+ eb(MESSAGE_POSITION, '>', anchor[0]),
203
+ eb.and([eb(MESSAGE_POSITION, '=', anchor[0]), eb(id, '>', anchor[1])]),
204
+ ]));
205
+ return query.orderBy(MESSAGE_POSITION, 'asc').orderBy(id, 'asc').limit(limit + 1).execute();
206
+ });
207
+ const page = rows.slice(0, limit), last = page.at(-1);
208
+ return { items: page.map(ctx.toMessage), ...(rows.length > limit && last ? {
209
+ nextCursor: encodeCursor({ kind: 'messages', scope: scope, conversation: input.conversationId, anchor: [Number(last.position), last.id] }),
210
+ } : {}) };
211
+ }
212
+ //# sourceMappingURL=store-queries.js.map
@@ -0,0 +1,106 @@
1
+ import type { OnConflictBuilder } from 'kysely';
2
+ import type { ChatMessage } from '../../core/messages.js';
3
+ import type { ChatConversation } from '../ports.js';
4
+ import type { ChatDatabase } from './tables.js';
5
+ export declare const MESSAGE_POSITION = "m.position";
6
+ export declare const CONVERSATION_UPDATED_AT = "c.updated_at";
7
+ /** UTF-8 byte ordinal ordering, identical on SQLite BINARY and PostgreSQL C collation. */
8
+ export declare function ordinalId({ dialect, column }: {
9
+ dialect: 'sqlite' | 'postgres';
10
+ column: 'c.id' | 'm.id';
11
+ }, _optional?: Record<string, never>): import("kysely").RawBuilder<string>;
12
+ /** The lock every position-assigning append to one conversation takes. */
13
+ export declare function conversationLockKey({ conversationId }: {
14
+ conversationId: string;
15
+ }, _optional?: Record<string, never>): string;
16
+ export interface ConversationRow {
17
+ id: string;
18
+ title: string | null;
19
+ title_source: string;
20
+ created_at: number;
21
+ updated_at: number;
22
+ expires_at: number | null;
23
+ pinned_at: number | null;
24
+ message_count: number | string | bigint | null;
25
+ }
26
+ export interface MessageRow {
27
+ id: string;
28
+ role: string;
29
+ content: string;
30
+ agent_id: string | null;
31
+ agent_name: string | null;
32
+ events_json: string | null;
33
+ attachments_json: string | null;
34
+ run_id: string | null;
35
+ run_status: string | null;
36
+ created_at: number;
37
+ started_at: number | null;
38
+ ended_at: number | null;
39
+ }
40
+ export declare function toConversation(row: ConversationRow): ChatConversation;
41
+ /** A NULL (or empty) JSON column is absent; anything else goes through {@link safeParse}. */
42
+ export declare function parseJsonColumn({ value }: {
43
+ value: string | null;
44
+ }, _optional?: Record<string, never>): any;
45
+ /**
46
+ * The `ai_chat_messages` insert values for one message at a fixed position. `now` is only called
47
+ * when the message carries no `createdAt`, so a counting clock sees exactly the reads it always did.
48
+ */
49
+ export declare function encodeMessageRow({ message: m, conversationId, position, now }: {
50
+ message: ChatMessage;
51
+ conversationId: string;
52
+ position: number;
53
+ now: () => number;
54
+ }, _optional?: {}): {
55
+ id: string;
56
+ conversation_id: string;
57
+ role: import("../../core/messages.js").ChatRole;
58
+ content: string;
59
+ agent_id: string | null;
60
+ agent_name: string | null;
61
+ events_json: string | null;
62
+ attachments_json: string | null;
63
+ run_id: string | null;
64
+ run_status: "queued" | "running" | "succeeded" | "failed" | "canceled" | null;
65
+ position: number;
66
+ created_at: number;
67
+ started_at: number | null;
68
+ ended_at: number | null;
69
+ };
70
+ /** Receipt-bearing user rows retain their public metadata while large assistant histories stay
71
+ * outside recovery/acceptance projections. Both dialects evaluate the same CASE expression. */
72
+ export declare function messageEventsColumn({ includeEvents }: {
73
+ includeEvents: boolean | "user";
74
+ }, _options?: {}): import("kysely").RawBuilder<string | null>;
75
+ /** The bounded history reader's projection: no attachment, agent or run column is selected. */
76
+ export interface HistoryRow {
77
+ id: string;
78
+ role: string;
79
+ content: string;
80
+ position: number;
81
+ created_at: number;
82
+ events_json: string | null;
83
+ }
84
+ /** Reject an unbounded or malformed history read before any query runs. */
85
+ export declare function assertHistoryReadBounds({ limit, fromPosition }: {
86
+ limit: number;
87
+ fromPosition: number | undefined;
88
+ }): void;
89
+ /** Project one history row; `events` is present (possibly undefined) only when tool events were asked for. */
90
+ export declare function toHistoryMessage(row: HistoryRow, { includeToolEvents }: {
91
+ includeToolEvents: boolean;
92
+ }): {
93
+ events?: any;
94
+ id: string;
95
+ role: ChatMessage["role"];
96
+ content: string;
97
+ position: number;
98
+ createdAt: number;
99
+ };
100
+ /** @throws {ChatStoreError} `invalid-input` for an out-of-range limit or an over-long/non-string query. */
101
+ export declare function assertHistoryListInputs({ limit, query }: {
102
+ limit: number;
103
+ query: unknown;
104
+ }, _optional?: {}): void;
105
+ export declare function updateOwnedMessageConflict(oc: OnConflictBuilder<ChatDatabase, "ai_chat_messages">): import("kysely").OnConflictUpdateBuilder<import("kysely").OnConflictDatabase<ChatDatabase, "ai_chat_messages">, import("kysely").OnConflictTables<"ai_chat_messages">>;
106
+ //# sourceMappingURL=store-rows.d.ts.map