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

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 (216) 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 +32 -0
  86. package/dist/react/chat-cleanup/ChatCleanupPanel.js +34 -0
  87. package/dist/react/chat-cleanup/chat-cleanup.hooks.d.ts +174 -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 +15 -0
  91. package/dist/react/components/ChatSettingsDialog.d.ts +3 -0
  92. package/dist/react/components/ChatSettingsDialog.js +3 -3
  93. package/dist/react/components/ConversationList.d.ts +19 -5
  94. package/dist/react/components/ConversationList.hooks.d.ts +1 -0
  95. package/dist/react/components/ConversationList.hooks.js +4 -2
  96. package/dist/react/components/ConversationList.js +66 -9
  97. package/dist/react/components/Icon.d.ts +1 -1
  98. package/dist/react/components/Icon.js +7 -0
  99. package/dist/react/components/Markdown.js +6 -6
  100. package/dist/react/components/MarkdownLink.d.ts +25 -0
  101. package/dist/react/components/MarkdownLink.js +17 -0
  102. package/dist/react/components/RoutedA2uiSurfaceCard.d.ts +80 -0
  103. package/dist/react/components/RoutedA2uiSurfaceCard.js +15 -0
  104. package/dist/react/components/ToolCard.d.ts +4 -2
  105. package/dist/react/components/ToolCard.js +46 -4
  106. package/dist/react/components/ToolCard.rules.d.ts +5 -2
  107. package/dist/react/components/ToolCard.rules.js +12 -5
  108. package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
  109. package/dist/react/components/mcp-ui-surface-state.d.ts +3 -1
  110. package/dist/react/components/mcp-ui-surface-state.js +2 -2
  111. package/dist/react/components/own-link.d.ts +26 -0
  112. package/dist/react/components/own-link.js +36 -0
  113. package/dist/react/features/bridged-chat/create-staged-attachment-uploader.d.ts +7 -0
  114. package/dist/react/features/bridged-chat/create-staged-attachment-uploader.js +26 -0
  115. package/dist/react/features/bridged-chat/hooks/useBridgedChatTransport.hooks.d.ts +12 -0
  116. package/dist/react/features/bridged-chat/hooks/useBridgedChatTransport.hooks.js +60 -0
  117. package/dist/react/features/bridged-chat/index.d.ts +8 -0
  118. package/dist/react/features/bridged-chat/index.js +7 -0
  119. package/dist/react/features/bridged-chat/types.d.ts +49 -0
  120. package/dist/react/features/bridged-chat/types.js +2 -0
  121. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +1 -1
  122. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts +6 -0
  123. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js +101 -59
  124. package/dist/react/features/chat-pane/hooks/useChatPaneNewTabLinks.hooks.d.ts +3 -0
  125. package/dist/react/features/chat-pane/hooks/useChatPaneNewTabLinks.hooks.js +26 -16
  126. package/dist/react/features/chat-pane/model-options.d.ts +3 -1
  127. package/dist/react/features/chat-pane/model-options.js +3 -3
  128. package/dist/react/features/chat-pane/rules.js +4 -3
  129. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  130. package/dist/react/features/chat-pane/styles.js +16 -0
  131. package/dist/react/features/conversation-chat-pane/components/ConversationChatPane.d.ts +10 -0
  132. package/dist/react/features/conversation-chat-pane/components/ConversationChatPane.js +19 -0
  133. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneChat.d.ts +12 -0
  134. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneChat.js +21 -0
  135. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneHeader.d.ts +13 -0
  136. package/dist/react/features/conversation-chat-pane/components/ConversationChatPaneHeader.js +9 -0
  137. package/dist/react/features/conversation-chat-pane/components/ConversationDeleteConfirm.d.ts +12 -0
  138. package/dist/react/features/conversation-chat-pane/components/ConversationDeleteConfirm.js +12 -0
  139. package/dist/react/features/conversation-chat-pane/hooks/useConversationChatPane.hooks.d.ts +7 -0
  140. package/dist/react/features/conversation-chat-pane/hooks/useConversationChatPane.hooks.js +43 -0
  141. package/dist/react/features/conversation-chat-pane/index.d.ts +9 -0
  142. package/dist/react/features/conversation-chat-pane/index.js +8 -0
  143. package/dist/react/features/conversation-chat-pane/rules.d.ts +25 -0
  144. package/dist/react/features/conversation-chat-pane/rules.js +29 -0
  145. package/dist/react/features/conversation-chat-pane/types.d.ts +139 -0
  146. package/dist/react/features/conversation-chat-pane/types.js +2 -0
  147. package/dist/react/features/conversations/conversation-controller.d.ts +16 -0
  148. package/dist/react/features/conversations/conversation-controller.js +280 -0
  149. package/dist/react/features/conversations/hooks/useConversationDeleteConfirmation.hooks.d.ts +15 -0
  150. package/dist/react/features/conversations/hooks/useConversationDeleteConfirmation.hooks.js +33 -0
  151. package/dist/react/features/conversations/hooks/useStoredConversations.hooks.d.ts +16 -0
  152. package/dist/react/features/conversations/hooks/useStoredConversations.hooks.js +36 -0
  153. package/dist/react/features/conversations/index.d.ts +9 -0
  154. package/dist/react/features/conversations/index.js +8 -0
  155. package/dist/react/features/conversations/types.d.ts +120 -0
  156. package/dist/react/features/conversations/types.js +2 -0
  157. package/dist/react/features/voice-input/space-hold-rules.d.ts +65 -0
  158. package/dist/react/features/voice-input/space-hold-rules.js +48 -0
  159. package/dist/react/hooks/testing/fake-transport.d.ts +1 -1
  160. package/dist/react/hooks/useAnsweredCards.d.ts +2 -1
  161. package/dist/react/hooks/useConversation.js +5 -2
  162. package/dist/react/hooks/useExtEventGroups.d.ts +1 -1
  163. package/dist/react/hooks/useRunActivity.d.ts +2 -1
  164. package/dist/react/hooks/useRunStream.d.ts +1 -1
  165. package/dist/react/hooks/useRunStream.js +1 -1
  166. package/dist/react/hooks/useSurfaceRecovery.js +3 -1
  167. package/dist/react/hooks/useToolTimeline.d.ts +2 -1
  168. package/dist/react/index.d.ts +5 -2
  169. package/dist/react/index.js +4 -2
  170. package/dist/react/message-blocks.d.ts +1 -48
  171. package/dist/react/message-blocks.js +47 -0
  172. package/dist/react/styles/chat-settings.css +42 -14
  173. package/dist/server/chat-cleanup-routes.d.ts +56 -0
  174. package/dist/server/chat-cleanup-routes.js +56 -0
  175. package/dist/server/durable-runs/recover.js +193 -171
  176. package/dist/server/run-finalizer/entry.js +133 -110
  177. package/dist/store/legacy/sqlite/conversations.js +29 -17
  178. package/dist/store/pglite/index.d.ts +1 -0
  179. package/dist/store/pglite/index.js +1 -0
  180. package/dist/store/ports.d.ts +12 -0
  181. package/dist/store/postgres/index.d.ts +1 -0
  182. package/dist/store/postgres/index.js +1 -0
  183. package/dist/store/runtime/attempt-base-retention.d.ts +57 -0
  184. package/dist/store/runtime/attempt-base-retention.js +103 -0
  185. package/dist/store/runtime/chat-maintenance.d.ts +16 -0
  186. package/dist/store/runtime/chat-maintenance.js +19 -0
  187. package/dist/store/runtime/chat-principal.d.ts +63 -0
  188. package/dist/store/runtime/chat-principal.js +39 -0
  189. package/dist/store/runtime/checkpoint-delta.d.ts +1 -1
  190. package/dist/store/runtime/durable-run-queries.d.ts +124 -0
  191. package/dist/store/runtime/durable-run-queries.js +122 -0
  192. package/dist/store/runtime/durable-run-store.d.ts +1 -1
  193. package/dist/store/runtime/durable-run-store.js +291 -343
  194. package/dist/store/runtime/entry.d.ts +3 -0
  195. package/dist/store/runtime/entry.js +3 -0
  196. package/dist/store/runtime/events-json.d.ts +1 -1
  197. package/dist/store/runtime/lazy-run-ledger.d.ts +19 -0
  198. package/dist/store/runtime/lazy-run-ledger.js +28 -0
  199. package/dist/store/runtime/run-ledger.d.ts +4 -1
  200. package/dist/store/runtime/run-ledger.js +256 -204
  201. package/dist/store/sql/bulk-deletion.d.ts +36 -0
  202. package/dist/store/sql/bulk-deletion.js +103 -0
  203. package/dist/store/sql/store-queries.d.ts +170 -0
  204. package/dist/store/sql/store-queries.js +212 -0
  205. package/dist/store/sql/store-rows.d.ts +106 -0
  206. package/dist/store/sql/store-rows.js +116 -0
  207. package/dist/store/sql/store-writes.d.ts +46 -0
  208. package/dist/store/sql/store-writes.js +161 -0
  209. package/dist/store/sql/store.d.ts +3 -16
  210. package/dist/store/sql/store.js +58 -428
  211. package/dist/store/sql/tables.d.ts +1 -0
  212. package/dist/store/sqlite/index.d.ts +1 -0
  213. package/dist/store/sqlite/index.js +1 -0
  214. package/dist/store/sqlite/schema.d.ts +1 -1
  215. package/dist/store/sqlite/schema.js +5 -1
  216. package/package.json +171 -20
@@ -0,0 +1,25 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { createAgentPresentationPort, localCliScopeCopy, selectedAgentWarning } from '../ai-agent-presentation.js';
3
+ /** Observe the same detection that renders Settings cards, including rescans and selection changes. */
4
+ export function useAiAgentPresentation({ port, config, locale, desktop, defaultLocalAgentId, translate, scopeKeys }, _optional = {}) {
5
+ const [agents, setAgents] = useState([]);
6
+ const live = useRef(false);
7
+ useEffect(() => {
8
+ live.current = true;
9
+ return () => { live.current = false; };
10
+ }, []);
11
+ const presentationPort = useMemo(() => createAgentPresentationPort({
12
+ port,
13
+ // Detection can finish after navigating away; no state should be written to an unmounted tab.
14
+ onAgents: ({ agents: next }, _options = {}) => { if (live.current)
15
+ setAgents((previous) => JSON.stringify(previous) === JSON.stringify(next) ? previous : next); },
16
+ }), [port]);
17
+ return {
18
+ port: presentationPort,
19
+ scopeCopy: localCliScopeCopy({ desktop, ...scopeKeys }),
20
+ // The dock's useLocalCliSelection defaults an unset ledger selection to Claude. Warn about
21
+ // that same effective choice here, including a fresh desktop install with no saved agent id.
22
+ warning: selectedAgentWarning({ mode: config?.mode ?? '', agentId: config?.localCli.agentId ?? defaultLocalAgentId, agents, locale, translate }),
23
+ };
24
+ }
25
+ //# sourceMappingURL=use-ai-agent-presentation.hooks.js.map
@@ -0,0 +1,32 @@
1
+ import type { ChatCleanupConfirm, WiredChatCleanup } from "./chat-cleanup.hooks.js";
2
+ /**
3
+ * The chat cleanup's home in the chat settings dialog (its `displayExtra` slot): a broom toggle with
4
+ * its label, which turns on row ticking in the chat list, and the 1–365 day chooser in front of
5
+ * `ChatCleanupDialog` (which shows the server's count, bytes and kept reasons before anything is
6
+ * deleted). Holds no state of its own; everything comes from the injected {@link WiredChatCleanup}.
7
+ *
8
+ * Why the toggle is a plain icon button and not `cleanup.kit.Button`: the kit button is the host's
9
+ * filled action button, and as the dock header's "Clean up chats" it rendered as a large accent text
10
+ * button among the header's small icons (owner, 2026-11-29). The kit button stays for the actions.
11
+ *
12
+ * @param props.confirm - Unused here (delete-selected lives in {@link ChatCleanupSelectionActions});
13
+ * kept so both halves take the same props from the host.
14
+ * @complexity O(k) in the number of kept chats the preview names.
15
+ */
16
+ export declare function ChatCleanupPanel({ cleanup }: {
17
+ cleanup: WiredChatCleanup;
18
+ confirm: ChatCleanupConfirm;
19
+ }, _optional?: {}): import("react").JSX.Element;
20
+ /**
21
+ * The chat list's foot while rows are ticked (`ConversationList`'s `selectionActions`): "Delete
22
+ * selected", which asks `confirm` first, and "Done", which leaves ticking mode. They sit under the
23
+ * ticks they act on; a header button for them read as unrelated chrome.
24
+ *
25
+ * @param props.confirm - The admin confirm dialog; delete-selected waits for its visible answer.
26
+ * @complexity O(1).
27
+ */
28
+ export declare function ChatCleanupSelectionActions({ cleanup, confirm }: {
29
+ cleanup: WiredChatCleanup;
30
+ confirm: ChatCleanupConfirm;
31
+ }, _optional?: {}): import("react").JSX.Element;
32
+ //# sourceMappingURL=ChatCleanupPanel.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ChatCleanupDialog } from "../components/ChatCleanupDialog.js";
3
+ import { Icon } from "../components/Icon.js";
4
+ /**
5
+ * The chat cleanup's home in the chat settings dialog (its `displayExtra` slot): a broom toggle with
6
+ * its label, which turns on row ticking in the chat list, and the 1–365 day chooser in front of
7
+ * `ChatCleanupDialog` (which shows the server's count, bytes and kept reasons before anything is
8
+ * deleted). Holds no state of its own; everything comes from the injected {@link WiredChatCleanup}.
9
+ *
10
+ * Why the toggle is a plain icon button and not `cleanup.kit.Button`: the kit button is the host's
11
+ * filled action button, and as the dock header's "Clean up chats" it rendered as a large accent text
12
+ * button among the header's small icons (owner, 2026-11-29). The kit button stays for the actions.
13
+ *
14
+ * @param props.confirm - Unused here (delete-selected lives in {@link ChatCleanupSelectionActions});
15
+ * kept so both halves take the same props from the host.
16
+ * @complexity O(k) in the number of kept chats the preview names.
17
+ */
18
+ export function ChatCleanupPanel({ cleanup }, _optional = {}) {
19
+ return (_jsxs("div", { className: "jini-chat-cleanup", children: [_jsxs("button", { type: "button", className: "jini-chat-cleanup-toggle", "aria-expanded": cleanup.open, title: cleanup.copy.open, onClick: () => cleanup.setOpen(!cleanup.open), children: [_jsx(Icon, { name: "broom", size: 16 }), _jsx("span", { children: cleanup.copy.open })] }), cleanup.open ? _jsxs("div", { className: "jini-chat-cleanup-panel", children: [_jsxs("label", { className: "jini-chat-cleanup-age", children: [cleanup.copy.olderThan, _jsx("input", { type: "number", min: 1, max: 365, step: 1, value: Number.isNaN(cleanup.olderThanDays) ? "" : cleanup.olderThanDays, onChange: (event) => cleanup.setOlderThanDays(event.currentTarget.valueAsNumber) })] }), _jsx(ChatCleanupDialog, { useChatCleanup: cleanup.useDialog, kit: cleanup.kit, copy: cleanup.copy.dialog, onDone: () => cleanup.setOpen(false) }), cleanup.error ? _jsx("p", { role: "alert", className: "jini-chat-cleanup-error", children: cleanup.error }) : null] }) : null] }));
20
+ }
21
+ /**
22
+ * The chat list's foot while rows are ticked (`ConversationList`'s `selectionActions`): "Delete
23
+ * selected", which asks `confirm` first, and "Done", which leaves ticking mode. They sit under the
24
+ * ticks they act on; a header button for them read as unrelated chrome.
25
+ *
26
+ * @param props.confirm - The admin confirm dialog; delete-selected waits for its visible answer.
27
+ * @complexity O(1).
28
+ */
29
+ export function ChatCleanupSelectionActions({ cleanup, confirm }, _optional = {}) {
30
+ const { Button } = cleanup.kit;
31
+ const count = cleanup.selectedIds.length;
32
+ return _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", "data-variant": "danger", disabled: count === 0, onClick: () => { void cleanup.deleteSelected({ confirm }); }, children: cleanup.copy.deleteSelected({ count }) }), _jsx(Button, { type: "button", "data-variant": "ghost", onClick: () => cleanup.setOpen(false), children: cleanup.copy.done }), cleanup.error ? _jsx("p", { role: "alert", className: "jini-chat-cleanup-error", children: cleanup.error }) : null] });
33
+ }
34
+ //# sourceMappingURL=ChatCleanupPanel.js.map
@@ -0,0 +1,174 @@
1
+ import { type ButtonHTMLAttributes, type ComponentProps, type ElementType } from "react";
2
+ import type { ChatCleanupDialog } from "../components/ChatCleanupDialog.js";
3
+ import type { ConversationListHooks, ConversationListItem } from "../components/ConversationList.js";
4
+ /**
5
+ * @file The dock's chat cleanup state: optimistic pins, chats hidden after a confirmed deletion,
6
+ * the age preview and its token-bound apply, and delete-selected behind a visible confirmation.
7
+ * No network here: every call goes through the injected {@link ChatCleanupClient}.
8
+ *
9
+ * Why selection or an optimistic pin does not authorize deletion: both are browser-only guesses.
10
+ * A ticked checkbox is a pointer gesture, not consent, so delete-selected still waits for the
11
+ * admin's visible confirmation and then sends `confirm: true` (owner rule d). An optimistic pin is
12
+ * not a saved pin until the server answers, so it can protect nothing; the age cleanup trusts only
13
+ * the server's own preview (which re-reads `pinned` and names every kept chat) and applies only
14
+ * with the token the server issued for that same confirmed preview. The token lives in React state
15
+ * for this mounted dock and is never written to browser storage, so a reload means choosing again.
16
+ */
17
+ /** A chat the server kept out of a cleanup, and why (`pinned`, `open`, `active`, `recoverable`, `changed`, `unknown`). */
18
+ export interface ChatCleanupKept {
19
+ id: string;
20
+ title: string | null;
21
+ reason: string;
22
+ }
23
+ /** `POST cleanup/preview`'s answer: the server's own count, bytes and kept list, plus the token apply needs. */
24
+ export interface ChatCleanupPreview {
25
+ count: number;
26
+ bytes: number;
27
+ kept: ChatCleanupKept[];
28
+ previewToken: string;
29
+ }
30
+ /** `cleanup/apply` and `delete-selected`; a `previewToken` means the same confirmed preview has more to delete. */
31
+ export interface ChatCleanupResult {
32
+ deleted: string[];
33
+ kept: ChatCleanupKept[];
34
+ previewToken?: string;
35
+ }
36
+ /** Every string the cleanup panel and `ChatCleanupDialog` show. */
37
+ export interface ChatCleanupCopy {
38
+ dialog: {
39
+ preview: string;
40
+ confirm: string;
41
+ expired: string;
42
+ choose: string;
43
+ partial: string;
44
+ count: (required: {
45
+ count: number;
46
+ bytes: number;
47
+ }) => string;
48
+ };
49
+ open: string;
50
+ /** Leaves row ticking from the chat list's selection actions. */
51
+ done: string;
52
+ olderThan: string;
53
+ deleteSelected: (required: {
54
+ count: number;
55
+ }) => string;
56
+ deleteSelectedBody: string;
57
+ untitled: string;
58
+ reason: (required: {
59
+ reason: string;
60
+ }) => string;
61
+ errors: {
62
+ notConfigured: string;
63
+ invalid: string;
64
+ failed: string;
65
+ };
66
+ }
67
+ /** The cleanup half of the admin chat client; the real one is bound in `assistant-chats-dependencies.hooks.ts`. */
68
+ export interface ChatCleanupClient {
69
+ setPinned: (required: {
70
+ id: string;
71
+ pinned: boolean;
72
+ }) => Promise<{
73
+ id: string;
74
+ pinned: boolean;
75
+ }>;
76
+ preview: (required: {
77
+ before: number;
78
+ }) => Promise<ChatCleanupPreview>;
79
+ apply: (required: {
80
+ previewToken: string;
81
+ }) => Promise<ChatCleanupResult>;
82
+ deleteSelected: (required: {
83
+ ids: readonly string[];
84
+ confirm: true;
85
+ }) => Promise<ChatCleanupResult>;
86
+ }
87
+ /**
88
+ * The host's action button. Callers pass `data-variant` ("secondary" | "danger" | "ghost") for the
89
+ * look; a hyphenated attribute keeps a plain `"button"` a valid kit, which simply ignores it.
90
+ */
91
+ export type ChatCleanupKit = {
92
+ Button: ElementType<ButtonHTMLAttributes<HTMLButtonElement>>;
93
+ };
94
+ /** The admin confirm dialog's request (`useConfirmRequest().confirm`). */
95
+ export type ChatCleanupConfirm = (required: {
96
+ dialog: {
97
+ title: string;
98
+ body: string;
99
+ confirmLabel: string;
100
+ tone: "danger";
101
+ };
102
+ }) => Promise<boolean>;
103
+ export type ChatCleanupDialogState = ReturnType<ComponentProps<typeof ChatCleanupDialog>["useChatCleanup"]>;
104
+ /** Everything the dock header and cleanup panel need; the dock takes it from a required hook prop. */
105
+ export interface WiredChatCleanup {
106
+ listHooks: ConversationListHooks;
107
+ kit: ChatCleanupKit;
108
+ copy: ChatCleanupCopy;
109
+ open: boolean;
110
+ setOpen: (open: boolean) => void;
111
+ olderThanDays: number;
112
+ setOlderThanDays: (days: number) => void;
113
+ selectedIds: readonly string[];
114
+ select: (required: {
115
+ ids: string[];
116
+ }) => void;
117
+ togglePin: (required: {
118
+ id: string;
119
+ pinned: boolean;
120
+ }) => void;
121
+ visibleConversations: <T extends ConversationListItem>(required: {
122
+ conversations: T[];
123
+ }) => T[];
124
+ useDialog: () => ChatCleanupDialogState;
125
+ deleteSelected: (required: {
126
+ confirm: ChatCleanupConfirm;
127
+ }) => Promise<void>;
128
+ error: string | null;
129
+ }
130
+ /** Plain words for a failed cleanup call; expiry is handled as a state, not an error. @complexity O(1). */
131
+ export declare function cleanupErrorText({ error, copy }: {
132
+ error: unknown;
133
+ copy: ChatCleanupCopy;
134
+ }, _optional?: {}): string;
135
+ /** Optimistic pins and locally hidden (deleted) chats layered over the dock's conversation list. */
136
+ export declare function useChatListOverlay({ client, onError }: {
137
+ client: ChatCleanupClient;
138
+ onError: (error: unknown) => void;
139
+ }, _optional?: {}): {
140
+ togglePin: ({ id, pinned }: {
141
+ id: string;
142
+ pinned: boolean;
143
+ }) => void;
144
+ hide: (ids: readonly string[]) => void;
145
+ visibleConversations: <T extends ConversationListItem>({ conversations }: {
146
+ conversations: T[];
147
+ }) => T[];
148
+ };
149
+ /** The age chooser's preview → confirm → apply (→ partial continuation) cycle for `ChatCleanupDialog`. */
150
+ export declare function useCleanupPreview({ client, copy, clock, olderThanDays, hide, onError }: {
151
+ client: ChatCleanupClient;
152
+ copy: ChatCleanupCopy;
153
+ clock: () => number;
154
+ olderThanDays: number;
155
+ hide: (ids: readonly string[]) => void;
156
+ onError: (error: unknown) => void;
157
+ }, _optional?: {}): () => ChatCleanupDialogState;
158
+ /** Ticked chats and their deletion, which waits for the admin's visible confirmation first. */
159
+ export declare function useSelectedDeletion({ client, copy, hide, onError, clearError }: {
160
+ client: ChatCleanupClient;
161
+ copy: ChatCleanupCopy;
162
+ hide: (ids: readonly string[]) => void;
163
+ onError: (error: unknown) => void;
164
+ clearError: () => void;
165
+ }, _optional?: {}): {
166
+ selectedIds: readonly string[];
167
+ select: ({ ids }: {
168
+ ids: string[];
169
+ }) => void;
170
+ deleteSelected: ({ confirm }: {
171
+ confirm: ChatCleanupConfirm;
172
+ }) => Promise<void>;
173
+ };
174
+ //# sourceMappingURL=chat-cleanup.hooks.d.ts.map
@@ -0,0 +1,83 @@
1
+ import { useCallback, useState } from "react";
2
+ const DAY_MS = 86_400_000;
3
+ /** Plain words for a failed cleanup call; expiry is handled as a state, not an error. @complexity O(1). */
4
+ export function cleanupErrorText({ error, copy }, _optional = {}) {
5
+ const { status, code } = (error ?? {});
6
+ if (status === 503 || code === "NOT_CONFIGURED")
7
+ return copy.errors.notConfigured;
8
+ if (status === 400 || code === "VALIDATION_ERROR")
9
+ return copy.errors.invalid;
10
+ return copy.errors.failed;
11
+ }
12
+ const isExpired = (error) => error?.code === "PREVIEW_EXPIRED";
13
+ /** Optimistic pins and locally hidden (deleted) chats layered over the dock's conversation list. */
14
+ export function useChatListOverlay({ client, onError }, _optional = {}) {
15
+ const [pins, setPins] = useState(new Map());
16
+ const [hidden, setHidden] = useState(new Set());
17
+ const togglePin = useCallback(({ id, pinned }) => {
18
+ setPins((map) => new Map(map).set(id, pinned));
19
+ client.setPinned({ id, pinned }).then((saved) => setPins((map) => new Map(map).set(id, saved.pinned)), (error) => { setPins((map) => { const next = new Map(map); next.delete(id); return next; }); onError(error); });
20
+ }, [client, onError]);
21
+ const hide = useCallback((ids) => setHidden((set) => new Set([...set, ...ids])), []);
22
+ const visibleConversations = useCallback(({ conversations }) => conversations.filter((item) => !hidden.has(item.id)).map((item) => pins.has(item.id) ? { ...item, pinned: pins.get(item.id) } : item), [pins, hidden]);
23
+ return { togglePin, hide, visibleConversations };
24
+ }
25
+ /** The age chooser's preview → confirm → apply (→ partial continuation) cycle for `ChatCleanupDialog`. */
26
+ export function useCleanupPreview({ client, copy, clock, olderThanDays, hide, onError }, _optional = {}) {
27
+ const [phase, setPhase] = useState({ state: "preview" });
28
+ const preview = () => {
29
+ if (!Number.isInteger(olderThanDays) || olderThanDays < 1 || olderThanDays > 365) {
30
+ onError({ code: "VALIDATION_ERROR" });
31
+ return;
32
+ }
33
+ client.preview({ before: clock() - olderThanDays * DAY_MS }).then(({ previewToken, count, bytes, kept }) => setPhase({ state: "confirm", previewToken, count, bytes, kept }), onError);
34
+ };
35
+ const apply = async ({ previewToken }) => {
36
+ // Continue only the confirmed preview this dialog is showing, never a token from elsewhere.
37
+ if ((phase.state !== "confirm" && phase.state !== "partial") || phase.previewToken !== previewToken)
38
+ return { complete: false };
39
+ try {
40
+ const result = await client.apply({ previewToken });
41
+ hide(result.deleted);
42
+ setPhase(result.previewToken ? { ...phase, state: "partial", previewToken: result.previewToken, kept: result.kept } : { state: "preview" });
43
+ return { complete: !result.previewToken };
44
+ }
45
+ catch (error) {
46
+ if (isExpired(error))
47
+ setPhase({ state: "expired" });
48
+ else
49
+ onError(error);
50
+ return { complete: false };
51
+ }
52
+ };
53
+ const shown = phase.state === "confirm" || phase.state === "partial"
54
+ ? { ...phase, kept: phase.kept.map((item) => ({ id: item.id, title: item.title ?? copy.untitled, reason: copy.reason({ reason: item.reason }) })) }
55
+ : { state: phase.state, count: 0, bytes: 0, kept: [] };
56
+ const choose = () => setPhase({ state: "preview" });
57
+ return () => ({ ...shown, preview, choose, apply });
58
+ }
59
+ /** Ticked chats and their deletion, which waits for the admin's visible confirmation first. */
60
+ export function useSelectedDeletion({ client, copy, hide, onError, clearError }, _optional = {}) {
61
+ const [selectedIds, setSelectedIds] = useState([]);
62
+ const select = useCallback(({ ids }) => setSelectedIds(ids), []);
63
+ const deleteSelected = async ({ confirm }) => {
64
+ const ids = selectedIds;
65
+ if (ids.length === 0)
66
+ return;
67
+ const label = copy.deleteSelected({ count: ids.length });
68
+ if (await confirm({ dialog: { title: label, body: copy.deleteSelectedBody, confirmLabel: label, tone: "danger" } }) !== true)
69
+ return;
70
+ try {
71
+ const result = await client.deleteSelected({ ids, confirm: true });
72
+ hide(result.deleted);
73
+ // The server rechecks every id; chats it kept stay ticked so the admin can see them.
74
+ setSelectedIds(result.kept.map((item) => item.id));
75
+ clearError();
76
+ }
77
+ catch (error) {
78
+ onError(error);
79
+ }
80
+ };
81
+ return { selectedIds, select, deleteSelected };
82
+ }
83
+ //# sourceMappingURL=chat-cleanup.hooks.js.map
@@ -0,0 +1,38 @@
1
+ import type { ButtonHTMLAttributes, ElementType } from 'react';
2
+ export declare function ChatCleanupDialog({ useChatCleanup, kit: { Button }, copy, onDone }: {
3
+ useChatCleanup: () => {
4
+ state: 'preview' | 'confirm' | 'partial' | 'expired';
5
+ previewToken?: string;
6
+ count: number;
7
+ bytes: number;
8
+ kept: readonly {
9
+ id: string;
10
+ title: string | null;
11
+ reason: string;
12
+ }[];
13
+ preview: () => void;
14
+ choose: () => void;
15
+ apply: (required: {
16
+ previewToken: string;
17
+ confirm: true;
18
+ }) => Promise<{
19
+ complete: boolean;
20
+ }>;
21
+ };
22
+ kit: {
23
+ Button: ElementType<ButtonHTMLAttributes<HTMLButtonElement>>;
24
+ };
25
+ copy: {
26
+ preview: string;
27
+ confirm: string;
28
+ expired: string;
29
+ choose: string;
30
+ partial: string;
31
+ count: (required: {
32
+ count: number;
33
+ bytes: number;
34
+ }) => string;
35
+ };
36
+ onDone: () => void;
37
+ }, _optional?: {}): import("react").JSX.Element;
38
+ //# sourceMappingURL=ChatCleanupDialog.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function ChatCleanupDialog({ useChatCleanup, kit: { Button }, copy, onDone }, _optional = {}) {
3
+ const cleanup = useChatCleanup();
4
+ // A group, not role="dialog": it renders inside the chat settings modal, and a second dialog role
5
+ // nested in it would announce a dialog that never takes focus. `data-variant` asks the host's kit
6
+ // button for a quieter or a danger look; a plain `<button>` just ignores it.
7
+ return _jsxs("div", { role: "group", className: "jini-chat-cleanup-preview", children: [cleanup.state === 'preview' ? _jsx(Button, { type: "button", "data-variant": "secondary", onClick: cleanup.preview, children: copy.preview }) : null, cleanup.state === 'expired' ? _jsxs(_Fragment, { children: [_jsx("p", { children: copy.expired }), _jsx(Button, { type: "button", "data-variant": "secondary", onClick: cleanup.choose, children: copy.choose })] }) : null, cleanup.state === 'confirm' || cleanup.state === 'partial' ? _jsxs(_Fragment, { children: [_jsx("p", { children: copy.count({ count: cleanup.count, bytes: cleanup.bytes }) }), cleanup.state === 'partial' ? _jsx("p", { children: copy.partial }) : null, _jsx("ul", { children: cleanup.kept.map(item => _jsxs("li", { children: [item.title, ": ", item.reason] }, item.id)) }), _jsx(Button, { type: "button", "data-variant": "danger", disabled: !cleanup.previewToken, onClick: async () => {
8
+ if (!cleanup.previewToken)
9
+ return;
10
+ const result = await cleanup.apply({ previewToken: cleanup.previewToken, confirm: true });
11
+ if (result.complete)
12
+ onDone();
13
+ }, children: copy.confirm })] }) : null] });
14
+ }
15
+ //# sourceMappingURL=ChatCleanupDialog.js.map
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from 'react';
1
2
  import { useChatSettingsView, type ChatPermissionsPort, type ChatSettingsSection } from './ChatSettingsDialog.hooks.js';
2
3
  /** Advanced chat settings; the host supplies display actions, capabilities and persistence.
3
4
  * Native dialog semantics own modal focus containment; closing restores the opener.
@@ -10,5 +11,7 @@ export declare function ChatSettingsDialog({ useChatSettingsViewHook, ...require
10
11
  displaySections: readonly ChatSettingsSection[];
11
12
  permissions: ChatPermissionsPort;
12
13
  t?: (key: string) => string;
14
+ /** A host control after the display groups (the dock's chat cleanup); absent shows nothing extra. */
15
+ displayExtra?: ReactNode;
13
16
  }): import("react").JSX.Element;
14
17
  //# sourceMappingURL=ChatSettingsDialog.d.ts.map
@@ -64,7 +64,7 @@ export function ChatSettingsDialog({ useChatSettingsViewHook = useChatSettingsVi
64
64
  const verticalOutside = y < box.top || y > box.bottom;
65
65
  if ((x === 0 && y === 0) || horizontalOutside || verticalOutside)
66
66
  required.onClose();
67
- }, children: _jsx(ChatSettingsBody, { vm: vm, titleId: titleId, closeRef: closeRef, onClose: required.onClose }) });
67
+ }, children: _jsx(ChatSettingsBody, { vm: vm, titleId: titleId, closeRef: closeRef, onClose: required.onClose, displayExtra: required.displayExtra }) });
68
68
  }
69
69
  function renderDisplaySection(section) {
70
70
  if (section.radio)
@@ -77,8 +77,8 @@ function renderDisplaySection(section) {
77
77
  function renderPermissions(vm) {
78
78
  return _jsxs(_Fragment, { children: [_jsx("p", { className: "jini-chat-settings-note", children: vm.t('Permission changes apply to the next run.') }), vm.permissions.unavailableReason && _jsx("p", { className: "jini-chat-settings-note", children: vm.t(vm.permissions.unavailableReason) }), _jsx(SettingSwitch, { className: "jini-chat-settings-row--master", label: vm.master.label, checked: vm.master.checked, disabled: vm.master.disabled, onChange: checked => vm.master.onCheckedChange({ checked }), description: vm.master.description, descriptionId: vm.master.descriptionId }), _jsx("div", { className: "jini-chat-settings-capabilities", children: vm.capabilities.map(item => _jsx(SettingSwitch, { label: item.control.label, checked: item.control.checked, disabled: item.control.disabled, onChange: checked => item.control.onCheckedChange({ checked }), description: item.description, descriptionId: item.descriptionId }, item.key)) }), vm.permissions.busy && _jsx("p", { role: "status", className: "jini-chat-settings-note", children: vm.t('Saving…') }), vm.permissions.error && _jsx("p", { role: "alert", className: "jini-chat-settings-error", children: vm.permissions.error })] });
79
79
  }
80
- function ChatSettingsBody({ vm, titleId, closeRef, onClose }) {
81
- return _jsxs(_Fragment, { children: [_jsxs("header", { className: "jini-chat-settings-header", children: [_jsx("h2", { id: titleId, className: "jini-dialog-title", children: vm.t('Chat settings') }), _jsx("button", { ref: closeRef, type: "button", className: "jini-dialog-close jini-chat-settings-close", "aria-label": vm.t('Close'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx(TabBar, { tabs: vm.tabs, activeId: vm.tab, onChange: vm.setTab, ariaLabel: vm.t('Chat settings') }), _jsx("div", { className: "jini-chat-settings-body", role: "tabpanel", "aria-label": vm.tab === 'display' ? vm.t('Display') : vm.t('Agent permissions'), children: vm.tab === 'display' ? vm.display.map(renderDisplaySection)
80
+ function ChatSettingsBody({ vm, titleId, closeRef, onClose, displayExtra }) {
81
+ return _jsxs(_Fragment, { children: [_jsxs("header", { className: "jini-chat-settings-header", children: [_jsx("h2", { id: titleId, className: "jini-dialog-title", children: vm.t('Chat settings') }), _jsx("button", { ref: closeRef, type: "button", className: "jini-dialog-close jini-chat-settings-close", "aria-label": vm.t('Close'), onClick: onClose, children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] }), _jsx(TabBar, { tabs: vm.tabs, activeId: vm.tab, onChange: vm.setTab, ariaLabel: vm.t('Chat settings') }), _jsx("div", { className: "jini-chat-settings-body", role: "tabpanel", "aria-label": vm.tab === 'display' ? vm.t('Display') : vm.t('Agent permissions'), children: vm.tab === 'display' ? _jsxs(_Fragment, { children: [vm.display.map(renderDisplaySection), displayExtra] })
82
82
  : renderPermissions(vm) }), " "] });
83
83
  }
84
84
  //# sourceMappingURL=ChatSettingsDialog.js.map
@@ -6,7 +6,7 @@ import type { Logger } from '@jini-ai/core/primitives';
6
6
  * into `ChatPane`'s `leadingAccessory` slot — it needs no changes to `ChatPane` itself.
7
7
  *
8
8
  * Storage-agnostic by construction. It takes data and callbacks and owns nothing durable, so a
9
- * host backs it with `@jini-ai/sqlite-chat`'s `ChatHistoryStore`, an HTTP endpoint, or an in-memory
9
+ * host backs it with `@jini-ai/chat/store/sqlite`'s `ChatHistoryStore`, an HTTP endpoint, or an in-memory
10
10
  * array without this file knowing the difference.
11
11
  *
12
12
  * Search is a **client-side filter by default**, and delegates to `onSearch` when a host provides
@@ -28,8 +28,19 @@ export interface ConversationListItem {
28
28
  title: string | null;
29
29
  messageCount?: number;
30
30
  updatedAt?: number;
31
+ pinned?: boolean;
31
32
  }
32
33
  export interface ConversationListProps {
34
+ hooks: ConversationListHooks;
35
+ selectable?: boolean;
36
+ selectedIds?: readonly string[];
37
+ onTogglePin?: (required: {
38
+ id: string;
39
+ pinned: boolean;
40
+ }) => void;
41
+ onSelectionChange?: (required: {
42
+ ids: string[];
43
+ }) => void;
33
44
  report?: Pick<Logger, 'error'> | undefined;
34
45
  conversations: ConversationListItem[];
35
46
  activeConversationId: string | null;
@@ -60,14 +71,17 @@ export interface ConversationListProps {
60
71
  * the icon (the browser's dark tip would otherwise show on top of it). Defaults to true.
61
72
  */
62
73
  nativeTitle?: boolean;
74
+ /**
75
+ * Shown at the foot of the open menu while `selectable` is on: the host's actions over the ticked
76
+ * rows (e.g. "Delete selected"). They live beside the ticks they act on rather than in a header.
77
+ */
78
+ selectionActions?: React.ReactNode;
63
79
  }
64
- /** Hooks ConversationList calls; defaults to the real ones, a test hands in fakes. */
80
+ /** Hooks ConversationList calls; the host passes the real ones or a test hands in fakes. */
65
81
  export declare const defaultConversationListHooks: {
66
82
  useT: typeof useT;
67
83
  useConversationListView: typeof useConversationListView;
68
84
  };
69
85
  export type ConversationListHooks = typeof defaultConversationListHooks;
70
- export declare function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled, emptyState, triggerLabel, nativeTitle, hooks, report, }: ConversationListProps & {
71
- hooks?: ConversationListHooks | undefined;
72
- }): import("react").JSX.Element;
86
+ export declare function ConversationList({ conversations: savedConversations, activeConversationId, onSelect, onCreate, onDelete, onRename, onSearch, confirmDelete, createDisabled, emptyState, triggerLabel, nativeTitle, hooks, report, selectable, selectedIds, onTogglePin, onSelectionChange, selectionActions, }: ConversationListProps, _optional?: {}): import("react").JSX.Element;
73
87
  //# sourceMappingURL=ConversationList.d.ts.map
@@ -51,5 +51,6 @@ export declare function useConversationListView({ savedConversations, activeConv
51
51
  emptyLabel: () => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
52
52
  scheduleSelect: (id: string) => void;
53
53
  createConversation: () => void;
54
+ selectionAnchor: import("react").RefObject<string | null>;
54
55
  };
55
56
  //# sourceMappingURL=ConversationList.hooks.d.ts.map
@@ -137,7 +137,7 @@ export function useConversationListView({ savedConversations, activeConversation
137
137
  cancelled = true;
138
138
  };
139
139
  }, [onSearch, deferredQuery, report]);
140
- const visible = useMemo(() => {
140
+ const filtered = useMemo(() => {
141
141
  if (onSearch)
142
142
  return serverResults ?? conversations;
143
143
  const needle = deferredQuery.trim().toLocaleLowerCase();
@@ -145,6 +145,8 @@ export function useConversationListView({ savedConversations, activeConversation
145
145
  return conversations;
146
146
  return conversations.filter((c) => (c.title ?? t('Untitled')).toLocaleLowerCase().includes(needle));
147
147
  }, [onSearch, serverResults, conversations, deferredQuery, t]);
148
+ const visible = useMemo(() => [...filtered].sort((a, b) => Number(Boolean(b.pinned)) - Number(Boolean(a.pinned))), [filtered]);
149
+ const selectionAnchor = useRef(null);
148
150
  // One timestamp for the whole render so every row's "5m ago" is computed against the same
149
151
  // instant — otherwise rows drawn either side of a second boundary disagree.
150
152
  const now = Date.now();
@@ -196,6 +198,6 @@ export function useConversationListView({ savedConversations, activeConversation
196
198
  runConversationListHostEffect({ effectName: 'onCreate', effect: () => onCreate() }, { report });
197
199
  setOpen(false);
198
200
  };
199
- return { open, setOpen, query, setQuery, conversations, rawTitles, editingId, setEditingId, rootRef, visible, now, commitRename, startRename, requestDelete, active, emptyLabel, scheduleSelect, createConversation };
201
+ return { open, setOpen, query, setQuery, conversations, rawTitles, editingId, setEditingId, rootRef, visible, now, commitRename, startRename, requestDelete, active, emptyLabel, scheduleSelect, createConversation, selectionAnchor };
200
202
  }
201
203
  //# sourceMappingURL=ConversationList.hooks.js.map