@ai-matrx/chat 0.6.5 → 0.7.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 (274) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/README.md +1 -1
  3. package/dist/agents/components/agent-widgets/AgentChatHistorySidebar.js +16 -55
  4. package/dist/agents/components/chat/ChatHistorySidebar.d.ts +4 -4
  5. package/dist/agents/components/chat/ChatHistorySidebar.js +2 -2
  6. package/dist/agents/components/chat/ChatSidebarMenu.js +1 -1
  7. package/dist/agents/components/chat/chat-door.d.ts +67 -0
  8. package/dist/agents/components/chat/chat-door.js +100 -0
  9. package/dist/agents/components/conversation-actions/conversationActionRegistry.d.ts +8 -0
  10. package/dist/agents/components/conversation-actions/conversationActionRegistry.js +11 -4
  11. package/dist/agents/components/conversation-history/AgentConversationList.d.ts +83 -0
  12. package/dist/agents/components/conversation-history/AgentConversationList.js +252 -0
  13. package/dist/agents/components/conversation-history/ConversationArchiveSection.d.ts +11 -0
  14. package/dist/agents/components/conversation-history/{ConversationTrashSection.js → ConversationArchiveSection.js} +41 -23
  15. package/dist/agents/components/conversation-history/ConversationHistorySidebar.d.ts +29 -10
  16. package/dist/agents/components/conversation-history/ConversationHistorySidebar.js +94 -141
  17. package/dist/agents/components/conversation-history/ConversationPickerWindow.js +1 -2
  18. package/dist/agents/components/inputs/input-components/TextareaInput.js +2 -0
  19. package/dist/agents/components/inputs/input-components/VariableInputComponent.js +7 -6
  20. package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.d.ts +3 -0
  21. package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.js +40 -0
  22. package/dist/agents/components/inputs/smart-input/ConversationContextRail.js +6 -29
  23. package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.d.ts +3 -0
  24. package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.js +35 -0
  25. package/dist/agents/components/inputs/smart-input/InboxQueueStrip.js +0 -8
  26. package/dist/agents/components/inputs/smart-input/RunControlsTabPanel.d.ts +2 -0
  27. package/dist/agents/components/inputs/smart-input/RunControlsTabPanel.js +8 -1
  28. package/dist/agents/components/inputs/smart-input/RunToolPicker.js +17 -12
  29. package/dist/agents/components/inputs/smart-input/composer/ComposerPlusMenu.js +22 -0
  30. package/dist/agents/components/inputs/smart-input/rail-pill.d.ts +35 -0
  31. package/dist/agents/components/inputs/smart-input/rail-pill.js +30 -0
  32. package/dist/agents/components/inputs/variable-input-variations/AgentVariableForm.js +52 -48
  33. package/dist/agents/components/run/AgentRunHeader.js +11 -5
  34. package/dist/agents/components/run-controls/panels/shared.d.ts +1 -1
  35. package/dist/agents/components/shared/AgentHeaderMobile.js +1 -0
  36. package/dist/agents/components/shared/AgentModeController.js +91 -27
  37. package/dist/agents/components/shared/AgentSelectorIsland.js +2 -1
  38. package/dist/agents/components/shell/AgentRunSidebarMenu.js +15 -54
  39. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +1 -2
  40. package/dist/agents/engine.d.ts +15 -0
  41. package/dist/agents/engine.js +17 -0
  42. package/dist/agents/hooks/useModelControls.js +3 -175
  43. package/dist/agents/redux/agent-definition/run-tier-record.js +1 -0
  44. package/dist/agents/redux/agent-definition/selectors.d.ts +237 -237
  45. package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -50
  46. package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -147
  47. package/dist/agents/redux/conversation-history/history-filters.d.ts +6 -0
  48. package/dist/agents/redux/conversation-history/history-filters.js +4 -1
  49. package/dist/agents/redux/conversation-history/selectors.js +2 -3
  50. package/dist/agents/redux/conversation-history/slice.d.ts +6 -9
  51. package/dist/agents/redux/conversation-history/slice.js +14 -23
  52. package/dist/agents/redux/conversation-history/thunks.js +7 -41
  53. package/dist/agents/redux/conversation-history/types.d.ts +12 -12
  54. package/dist/agents/redux/conversation-history/types.js +4 -6
  55. package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +7 -73
  56. package/dist/agents/redux/conversation-list/conversation-list.selectors.js +12 -36
  57. package/dist/agents/redux/conversation-list/conversation-list.slice.d.ts +7 -22
  58. package/dist/agents/redux/conversation-list/conversation-list.slice.js +7 -62
  59. package/dist/agents/redux/conversation-list/conversation-list.thunks.d.ts +0 -25
  60. package/dist/agents/redux/conversation-list/conversation-list.thunks.js +2 -58
  61. package/dist/agents/redux/conversation-list/conversation-list.types.d.ts +6 -5
  62. package/dist/agents/redux/conversation-list/conversation-row-actions.thunks.js +11 -2
  63. package/dist/agents/redux/conversation-list/conversation-rows.d.ts +16 -0
  64. package/dist/agents/redux/conversation-list/conversation-rows.js +24 -0
  65. package/dist/agents/redux/conversation-list/conversation-trash.thunks.d.ts +12 -4
  66. package/dist/agents/redux/conversation-list/conversation-trash.thunks.js +52 -36
  67. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -54
  68. package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -14
  69. package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -5
  70. package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -3
  71. package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -8
  72. package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -5
  73. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -7
  74. package/dist/agents/redux/execution-system/message-crud/soft-delete-conversation.thunk.js +5 -2
  75. package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -1
  76. package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -7
  77. package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -1
  78. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -14
  79. package/dist/agents/redux/execution-system/thunks/create-instance.thunk.d.ts +10 -1
  80. package/dist/agents/redux/execution-system/thunks/create-instance.thunk.js +114 -265
  81. package/dist/agents/redux/execution-system/thunks/dispatch-matrx-extend-tool.thunk.js +18 -2
  82. package/dist/agents/redux/execution-system/thunks/dispatch-surface-client-tool.thunk.js +10 -28
  83. package/dist/agents/redux/execution-system/thunks/dispatch-surface-write.thunk.js +10 -25
  84. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +20 -0
  85. package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +6 -1
  86. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +58 -0
  87. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +62 -0
  88. package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.d.ts +23 -0
  89. package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.js +37 -0
  90. package/dist/agents/redux/execution-system/thunks/resume-instance.thunk.js +10 -2
  91. package/dist/agents/redux/execution-system/utils/build-tool-injection.d.ts +7 -0
  92. package/dist/agents/redux/execution-system/utils/build-tool-injection.js +18 -6
  93. package/dist/agents/redux/execution-system/utils/host-turn.d.ts +45 -0
  94. package/dist/agents/redux/execution-system/utils/host-turn.js +119 -0
  95. package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -1
  96. package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.d.ts +50 -20
  97. package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.js +9 -101
  98. package/dist/agents/types/tool-injection.types.d.ts +18 -2
  99. package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -2
  100. package/dist/agents/ui-first-tools/redux/pending-asks.slice.d.ts +2 -1
  101. package/dist/agents/ui-first-tools/redux/resolve-asks-with-input.thunk.js +1 -1
  102. package/dist/agents/ui-first-tools/tools/ask-response.d.ts +29 -0
  103. package/dist/agents/ui-first-tools/tools/ask-response.js +15 -0
  104. package/dist/agents/ui-first-tools/tools/schemas.d.ts +3 -25
  105. package/dist/agents/ui-first-tools/tools/schemas.js +1 -12
  106. package/dist/agents/ui-first-tools/ui/ApprovalCard.js +1 -1
  107. package/dist/agents/ui-first-tools/ui/AskWizard.d.ts +1 -1
  108. package/dist/agents/ui-first-tools/ui/AskWizard.js +1 -1
  109. package/dist/cx-chat/_legacy-stubs.d.ts +5 -5
  110. package/dist/cx-chat/components/SsrSidebarChats.js +13 -15
  111. package/dist/cx-chat/components/messages/UserMessage.d.ts +2 -2
  112. package/dist/cx-chat/types/conversation.d.ts +6 -6
  113. package/dist/cx-chat/utils/buildContentBlocksForSave.d.ts +1 -1
  114. package/dist/cx-chat/utils/cx-content-converter.d.ts +1 -1
  115. package/dist/host/bare-host-chrome.js +9 -3
  116. package/dist/host/composer-extensions.d.ts +75 -0
  117. package/dist/host/composer-extensions.js +92 -0
  118. package/dist/host/configure.js +1 -0
  119. package/dist/host/contract.d.ts +105 -13
  120. package/dist/host/defaults/confirm.d.ts +15 -0
  121. package/dist/host/defaults/confirm.js +25 -0
  122. package/dist/host/defaults/files-ui.d.ts +85 -0
  123. package/dist/host/defaults/files-ui.js +158 -0
  124. package/dist/host/defaults/gates.d.ts +27 -0
  125. package/dist/host/defaults/gates.js +72 -0
  126. package/dist/host/defaults/media-client.d.ts +15 -0
  127. package/dist/host/defaults/media-client.js +40 -0
  128. package/dist/host/defaults/voice.d.ts +81 -0
  129. package/dist/host/defaults/voice.js +239 -0
  130. package/dist/host/device-tool-handoff.d.ts +26 -0
  131. package/dist/host/device-tool-handoff.js +45 -0
  132. package/dist/host/index.d.ts +1 -0
  133. package/dist/host/index.js +4 -1
  134. package/dist/host/microphone.d.ts +11 -0
  135. package/dist/host/microphone.js +17 -0
  136. package/dist/host/ui-slots.d.ts +29 -74
  137. package/dist/host/ui-slots.js +40 -42
  138. package/dist/store/create-chat-store.d.ts +2 -2
  139. package/dist/store/middlewares.d.ts +5 -5
  140. package/dist/store/slices.d.ts +1 -1
  141. package/dist/surfaces/redux/selectors.d.ts +2 -2
  142. package/dist/tool-call-visualization/components/ToolCallVisualization.js +3 -2
  143. package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.d.ts +15 -0
  144. package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.js +36 -0
  145. package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.d.ts +40 -0
  146. package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +296 -0
  147. package/dist/tool-call-visualization/configured-rows/CopyToolButton.d.ts +23 -0
  148. package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +62 -0
  149. package/dist/tool-call-visualization/configured-rows/ToolProgressView.d.ts +23 -0
  150. package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +147 -0
  151. package/dist/tool-call-visualization/configured-rows/field-components.d.ts +15 -0
  152. package/dist/tool-call-visualization/configured-rows/field-components.js +244 -0
  153. package/dist/tool-call-visualization/configured-rows/helpers.d.ts +39 -0
  154. package/dist/tool-call-visualization/configured-rows/helpers.js +110 -0
  155. package/dist/tool-call-visualization/configured-rows/register.d.ts +25 -0
  156. package/dist/tool-call-visualization/configured-rows/register.js +51 -0
  157. package/dist/tool-call-visualization/configured-rows/registries.d.ts +27 -0
  158. package/dist/tool-call-visualization/configured-rows/registries.js +14 -0
  159. package/dist/tool-call-visualization/configured-rows/to-row-entry.d.ts +8 -0
  160. package/dist/tool-call-visualization/configured-rows/to-row-entry.js +38 -0
  161. package/dist/tool-call-visualization/configured-rows/transforms.d.ts +14 -0
  162. package/dist/tool-call-visualization/configured-rows/transforms.js +30 -0
  163. package/dist/tool-call-visualization/configured-rows/types.d.ts +140 -0
  164. package/dist/tool-call-visualization/redux/selectors.d.ts +1 -1
  165. package/dist/tool-call-visualization/registry/registry.d.ts +1 -1
  166. package/dist/tool-call-visualization/registry/registry.js +8 -1
  167. package/dist/tool-call-visualization/types.d.ts +1 -1
  168. package/dist/ui/chat-protocol-types.d.ts +0 -1
  169. package/dist/ui/ownership.d.ts +25 -0
  170. package/dist/ui/ownership.js +18 -0
  171. package/dist/voice-agent/audio/audioCapture.js +11 -6
  172. package/dist/window-panels/windows/agents/AgentRunHistoryWindow.d.ts +1 -2
  173. package/dist/window-panels/windows/agents/AgentRunHistoryWindow.js +21 -181
  174. package/dist/window-panels/windows/agents/AgentRunWindow.d.ts +1 -1
  175. package/dist/window-panels/windows/agents/AgentRunWindow.js +27 -21
  176. package/dist/window-panels/windows/agents/RunControlsWindow.js +1 -0
  177. package/package.json +4583 -121
  178. package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.d.ts +0 -7
  179. package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.js +0 -33
  180. package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.d.ts +0 -6
  181. package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.js +0 -21
  182. package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.d.ts +0 -6
  183. package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.js +0 -11
  184. package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.d.ts +0 -12
  185. package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.js +0 -7
  186. package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.d.ts +0 -4
  187. package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.js +0 -81
  188. package/dist/agents/components/conversation-history/ConversationTrashSection.d.ts +0 -7
  189. package/dist/agents/components/run/run-sidebar/SidebarHeader.d.ts +0 -21
  190. package/dist/agents/components/run/run-sidebar/SidebarHeader.js +0 -50
  191. package/dist/agents/components/run-controls/AdvancedRunSettings/index.d.ts +0 -6
  192. package/dist/agents/components/run-controls/AdvancedRunSettings/index.js +0 -32
  193. package/dist/agents/components/run-controls/RunSettingsModal.d.ts +0 -5
  194. package/dist/agents/components/run-controls/RunSettingsModal.js +0 -22
  195. package/dist/agents/components/shell/AgentBuildSidebarExtras.d.ts +0 -6
  196. package/dist/agents/components/shell/AgentBuildSidebarExtras.js +0 -30
  197. package/dist/agents/constants/agent-system-competitors.d.ts +0 -9
  198. package/dist/agents/constants/agent-system-competitors.js +0 -125
  199. package/dist/agents/hooks/message-crud/useMessageActions.d.ts +0 -29
  200. package/dist/agents/hooks/message-crud/useMessageActions.js +0 -119
  201. package/dist/agents/hooks/useConversationPendingCalls.d.ts +0 -30
  202. package/dist/agents/hooks/useConversationPendingCalls.js +0 -42
  203. package/dist/agents/model-registry/model-classes.d.ts +0 -1
  204. package/dist/agents/model-registry/model-classes.js +0 -1
  205. package/dist/agents/redux/conversation-history/index.d.ts +0 -18
  206. package/dist/agents/redux/conversation-history/index.js +0 -4
  207. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.d.ts +0 -38
  208. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.js +0 -42
  209. package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.d.ts +0 -58
  210. package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.js +0 -50
  211. package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.d.ts +0 -76
  212. package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.js +0 -101
  213. package/dist/agents/redux/execution-system/thunks/attach-workflow-run.d.ts +0 -38
  214. package/dist/agents/redux/execution-system/thunks/attach-workflow-run.js +0 -25
  215. package/dist/agents/redux/execution-system/utils/source-slice-helpers.d.ts +0 -45
  216. package/dist/agents/redux/execution-system/utils/source-slice-helpers.js +0 -50
  217. package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.d.ts +0 -25
  218. package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.js +0 -15
  219. package/dist/agents/services/agentService.d.ts +0 -12
  220. package/dist/agents/services/agentService.js +0 -92
  221. package/dist/agents/utils/escape-code-fences.d.ts +0 -15
  222. package/dist/agents/utils/escape-code-fences.js +0 -9
  223. package/dist/agents/utils/normalize-managed-options.d.ts +0 -30
  224. package/dist/agents/utils/normalize-managed-options.js +0 -29
  225. package/dist/agents/utils/processedDocumentContext.d.ts +0 -51
  226. package/dist/agents/utils/processedDocumentContext.js +0 -51
  227. package/dist/agents/utils/variable-validation.d.ts +0 -28
  228. package/dist/agents/utils/variable-validation.js +0 -54
  229. package/dist/cx-chat/components/ChatConversationSkeleton.d.ts +0 -9
  230. package/dist/cx-chat/components/ChatConversationSkeleton.js +0 -45
  231. package/dist/cx-chat/components/ChatPanelBackButton.d.ts +0 -1
  232. package/dist/cx-chat/components/ChatPanelBackButton.js +0 -26
  233. package/dist/cx-chat/components/messages/MessageErrorBoundary.d.ts +0 -20
  234. package/dist/cx-chat/components/messages/MessageErrorBoundary.js +0 -40
  235. package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.d.ts +0 -14
  236. package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.js +0 -160
  237. package/dist/cx-chat/components/variable-inputs/NumberInput.d.ts +0 -15
  238. package/dist/cx-chat/components/variable-inputs/NumberInput.js +0 -79
  239. package/dist/cx-chat/components/variable-inputs/RadioGroupInput.d.ts +0 -14
  240. package/dist/cx-chat/components/variable-inputs/RadioGroupInput.js +0 -125
  241. package/dist/cx-chat/components/variable-inputs/SelectInput.d.ts +0 -14
  242. package/dist/cx-chat/components/variable-inputs/SelectInput.js +0 -92
  243. package/dist/cx-chat/components/variable-inputs/TextareaInput.d.ts +0 -14
  244. package/dist/cx-chat/components/variable-inputs/TextareaInput.js +0 -46
  245. package/dist/cx-chat/components/variable-inputs/ToggleInput.d.ts +0 -14
  246. package/dist/cx-chat/components/variable-inputs/ToggleInput.js +0 -46
  247. package/dist/cx-chat/hooks/useChatPersistence.d.ts +0 -28
  248. package/dist/cx-chat/hooks/useChatPersistence.js +0 -180
  249. package/dist/cx-chat/hooks/useInstanceBootstrap.d.ts +0 -1
  250. package/dist/cx-chat/hooks/useInstanceBootstrap.js +0 -115
  251. package/dist/cx-chat/types/content.d.ts +0 -184
  252. package/dist/cx-chat/types/content.js +0 -91
  253. package/dist/cx-chat/types/cx-tables.d.ts +0 -176
  254. package/dist/cx-chat/utils/settings-diff.d.ts +0 -13
  255. package/dist/cx-chat/utils/settings-diff.js +0 -25
  256. package/dist/public-chat/components/AgentSelector.d.ts +0 -22
  257. package/dist/public-chat/components/AgentSelector.js +0 -80
  258. package/dist/public-chat/components/GuidedVariableInputs.d.ts +0 -25
  259. package/dist/public-chat/components/GuidedVariableInputs.js +0 -623
  260. package/dist/public-chat/components/PublicVariableInputs.d.ts +0 -29
  261. package/dist/public-chat/components/PublicVariableInputs.js +0 -172
  262. package/dist/public-chat/types/content.d.ts +0 -184
  263. package/dist/public-chat/types/content.js +0 -91
  264. package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.d.ts +0 -15
  265. package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.js +0 -31
  266. package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.d.ts +0 -24
  267. package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.js +0 -26
  268. package/dist/ui/AudioOutputBlockSkeleton.d.ts +0 -17
  269. package/dist/ui/AudioOutputBlockSkeleton.js +0 -78
  270. package/dist/ui/lazy/PublicChatVariableInputs.d.ts +0 -2
  271. package/dist/ui/lazy/PublicChatVariableInputs.js +0 -16
  272. package/dist/utils/xml/readXmlTag.d.ts +0 -12
  273. package/dist/utils/xml/readXmlTag.js +0 -66
  274. /package/dist/{cx-chat/types/cx-tables.js → tool-call-visualization/configured-rows/types.js} +0 -0
@@ -0,0 +1,252 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo, useState } from "react";
4
+ import { ChevronDown, ChevronRight, MessageSquare } from "lucide-react";
5
+ import { Button } from "@ai-matrx/design-system/controls";
6
+ import { ItemRow } from "../../../host/ui-slots.js";
7
+ import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
8
+ import { selectAgentById } from "../../redux/agent-definition/selectors.js";
9
+ import { fetchAgentConversations } from "../../redux/conversation-list/conversation-list.thunks.js";
10
+ import { makeSelectAgentConversations } from "../../redux/conversation-list/conversation-list.selectors.js";
11
+ import { renameConversation } from "../../redux/conversation-list/conversation-row-actions.thunks.js";
12
+ import { ConversationArchiveSection } from "./ConversationArchiveSection.js";
13
+ import {
14
+ buildConversationMenu
15
+ } from "../conversation-actions/conversationActionRegistry.js";
16
+ function formatConversationDate(iso) {
17
+ if (!iso) return "";
18
+ const d = new Date(iso);
19
+ const now = /* @__PURE__ */ new Date();
20
+ const diffDays = Math.floor((now.getTime() - d.getTime()) / 864e5);
21
+ if (diffDays === 0)
22
+ return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
23
+ if (diffDays === 1) return "Yesterday";
24
+ if (diffDays < 7) return `${diffDays}d ago`;
25
+ return d.toLocaleDateString([], { month: "short", day: "numeric" });
26
+ }
27
+ function groupConversationsByVersion(conversations) {
28
+ const map = /* @__PURE__ */ new Map();
29
+ for (const conv of conversations) {
30
+ const v = conv.agentVersionNumber ?? 0;
31
+ const group = map.get(v);
32
+ if (group) group.push(conv);
33
+ else map.set(v, [conv]);
34
+ }
35
+ return Array.from(map.entries()).sort(([a], [b]) => b - a).map(([versionNumber, convs]) => ({
36
+ versionNumber,
37
+ conversations: [...convs].sort(
38
+ (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
39
+ )
40
+ }));
41
+ }
42
+ function agentRunHref(agentId, conversationId) {
43
+ return `/agents/go/${agentId}/run?conversationId=${conversationId}`;
44
+ }
45
+ function useAgentConversationList(agentId) {
46
+ const dispatch = useAppDispatch();
47
+ const agentName = useAppSelector(
48
+ (state) => agentId ? selectAgentById(state, agentId)?.name ?? null : null
49
+ );
50
+ const canonicalAgentId = useAppSelector((state) => {
51
+ if (!agentId) return null;
52
+ const agent = selectAgentById(state, agentId);
53
+ return agent?.parentAgentId ?? agent?.id ?? agentId;
54
+ });
55
+ const selectConversations = useMemo(
56
+ () => canonicalAgentId ? makeSelectAgentConversations(canonicalAgentId, null) : null,
57
+ [canonicalAgentId]
58
+ );
59
+ const entry = useAppSelector(
60
+ (state) => selectConversations ? selectConversations(state) : null
61
+ );
62
+ const status = entry?.status ?? "idle";
63
+ const conversations = entry?.conversations ?? EMPTY;
64
+ const archived = entry?.archived ?? EMPTY;
65
+ useEffect(() => {
66
+ if (canonicalAgentId && status === "idle") {
67
+ dispatch(
68
+ fetchAgentConversations({
69
+ agentId: canonicalAgentId,
70
+ versionFilter: null
71
+ })
72
+ );
73
+ }
74
+ }, [canonicalAgentId, status, dispatch]);
75
+ const versionGroups = useMemo(
76
+ () => groupConversationsByVersion(conversations),
77
+ [conversations]
78
+ );
79
+ const archivedGroups = useMemo(
80
+ () => groupConversationsByVersion(archived),
81
+ [archived]
82
+ );
83
+ return {
84
+ canonicalAgentId,
85
+ agentName,
86
+ status,
87
+ error: entry?.error ?? null,
88
+ fetchedAt: entry?.fetchedAt ?? null,
89
+ conversations,
90
+ archived,
91
+ versionGroups,
92
+ archivedGroups
93
+ };
94
+ }
95
+ const EMPTY = [];
96
+ function ConversationListRow({
97
+ conv,
98
+ href,
99
+ sourceFeature,
100
+ active,
101
+ onOpen,
102
+ openInPlace,
103
+ linkRow = false,
104
+ size = "sm",
105
+ surfaceKey,
106
+ entity,
107
+ agent,
108
+ source,
109
+ isFavorite,
110
+ untitled = "Untitled",
111
+ kebabAriaLabel,
112
+ onMutationSuccess,
113
+ secondaryLabel,
114
+ leading,
115
+ trailing,
116
+ className
117
+ }) {
118
+ const dispatch = useAppDispatch();
119
+ const title = conv.title?.trim() || untitled;
120
+ return /* @__PURE__ */ jsx(
121
+ ItemRow,
122
+ {
123
+ sourceFeature,
124
+ entity,
125
+ className,
126
+ size,
127
+ label: title,
128
+ secondaryLabel,
129
+ href: linkRow ? href : void 0,
130
+ active,
131
+ onOpen,
132
+ openInPlace,
133
+ leading,
134
+ kebabAriaLabel,
135
+ menu: () => buildConversationMenu({
136
+ conversationId: conv.conversationId,
137
+ title: conv.title,
138
+ isFavorite: isFavorite ?? conv.isFavorite ?? false,
139
+ isArchived: conv.status === "archived",
140
+ excludeFromKg: conv.excludeFromKg ?? false,
141
+ href,
142
+ ...surfaceKey ? { surfaceKey } : {},
143
+ ...agent ? { agent } : {},
144
+ ...source ? { source } : {},
145
+ ...onMutationSuccess ? { onMutationSuccess } : {},
146
+ dispatch
147
+ }),
148
+ rename: {
149
+ value: conv.title ?? "",
150
+ emptyFallback: untitled,
151
+ onCommit: async (next) => {
152
+ const result = await dispatch(
153
+ renameConversation({
154
+ conversationId: conv.conversationId,
155
+ title: next
156
+ })
157
+ );
158
+ if (renameConversation.fulfilled.match(result)) {
159
+ onMutationSuccess?.();
160
+ }
161
+ }
162
+ },
163
+ trailing
164
+ }
165
+ );
166
+ }
167
+ function VersionGroupRow({
168
+ group,
169
+ agentId,
170
+ selectedId,
171
+ onSelect,
172
+ defaultOpen,
173
+ sourceFeature
174
+ }) {
175
+ const [open, setOpen] = useState(defaultOpen);
176
+ const hasActive = group.conversations.some(
177
+ (c) => c.conversationId === selectedId
178
+ );
179
+ return /* @__PURE__ */ jsxs("div", { children: [
180
+ /* @__PURE__ */ jsxs(
181
+ Button,
182
+ {
183
+ variant: "quiet",
184
+ pressed: hasActive,
185
+ icon: open ? /* @__PURE__ */ jsx(ChevronDown, {}) : /* @__PURE__ */ jsx(ChevronRight, {}),
186
+ onClick: () => setOpen((v) => !v),
187
+ className: "w-full",
188
+ children: [
189
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-wide flex-1 min-w-0 truncate", children: group.versionNumber ? `Version ${group.versionNumber}` : "Latest" }),
190
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/60 shrink-0 ml-1", children: group.conversations.length })
191
+ ]
192
+ }
193
+ ),
194
+ open && /* @__PURE__ */ jsx("div", { className: "pl-2", children: group.conversations.map((conv) => {
195
+ const date = formatConversationDate(conv.updatedAt);
196
+ return /* @__PURE__ */ jsx(
197
+ ConversationListRow,
198
+ {
199
+ conv,
200
+ href: agentRunHref(agentId, conv.conversationId),
201
+ sourceFeature,
202
+ active: conv.conversationId === selectedId,
203
+ onOpen: () => onSelect(conv.conversationId),
204
+ trailing: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-[10px] text-muted-foreground/70", children: [
205
+ /* @__PURE__ */ jsx(MessageSquare, { className: "w-2.5 h-2.5 shrink-0" }),
206
+ conv.messageCount,
207
+ date ? ` \xB7 ${date}` : ""
208
+ ] })
209
+ },
210
+ conv.conversationId
211
+ );
212
+ }) })
213
+ ] });
214
+ }
215
+ function AgentVersionGroupedList({
216
+ agentId,
217
+ list,
218
+ selectedId,
219
+ onSelect,
220
+ sourceFeature
221
+ }) {
222
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
223
+ list.versionGroups.map((group, i) => /* @__PURE__ */ jsx(
224
+ VersionGroupRow,
225
+ {
226
+ group,
227
+ agentId,
228
+ selectedId,
229
+ onSelect,
230
+ defaultOpen: i === 0,
231
+ sourceFeature
232
+ },
233
+ group.versionNumber
234
+ )),
235
+ /* @__PURE__ */ jsx(
236
+ ConversationArchiveSection,
237
+ {
238
+ agentIds: [agentId],
239
+ onOpen: onSelect,
240
+ className: "mt-1"
241
+ }
242
+ )
243
+ ] });
244
+ }
245
+ export {
246
+ AgentVersionGroupedList,
247
+ ConversationListRow,
248
+ agentRunHref,
249
+ formatConversationDate,
250
+ groupConversationsByVersion,
251
+ useAgentConversationList
252
+ };
@@ -0,0 +1,11 @@
1
+ interface ConversationArchiveSectionProps {
2
+ /** `"consumer"` matches the comfortable /chat sidebar; `"dense"` the rest. */
3
+ variant?: "dense" | "consumer";
4
+ /** Only these agents' conversations (a per-agent list). Default: all of mine. */
5
+ agentIds?: string[];
6
+ /** Open a row (an archived conversation is readable). Omit = rows are not links. */
7
+ onOpen?: (conversationId: string) => void;
8
+ className?: string;
9
+ }
10
+ export declare function ConversationArchiveSection({ variant, agentIds, onOpen, className, }: ConversationArchiveSectionProps): import("react").JSX.Element;
11
+ export default ConversationArchiveSection;
@@ -1,36 +1,42 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useState } from "react";
4
- import { Loader2, Trash2, Undo2 } from "lucide-react";
3
+ import { useCallback, useState } from "react";
4
+ import { Archive, Loader2, Undo2 } from "lucide-react";
5
5
  import { cn } from "@ai-matrx/design-system";
6
6
  import { toast } from "../../../host/notify.js";
7
7
  import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
8
8
  import {
9
- fetchTrashedConversations,
9
+ fetchArchivedConversations,
10
10
  restoreConversation
11
11
  } from "../../redux/conversation-list/conversation-trash.thunks.js";
12
12
  import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
13
13
  import { Button, DisclosureHeader } from "@ai-matrx/design-system/controls";
14
- function ConversationTrashSection({
14
+ function ConversationArchiveSection({
15
15
  variant = "dense",
16
+ agentIds,
17
+ onOpen,
16
18
  className
17
19
  }) {
18
20
  const dispatch = useAppDispatch();
19
21
  const [open, setOpen] = useState(false);
20
22
  const [restoringId, setRestoringId] = useState(null);
21
- const ids = useAppSelector(
23
+ const allIds = useAppSelector(
22
24
  (state) => state.conversationList.trashConversationIds
23
25
  );
24
26
  const bodies = useAppSelector(
25
27
  (state) => state.conversationList.trashByConversationId
26
28
  );
29
+ const ids = agentIds && agentIds.length > 0 ? allIds.filter((id) => {
30
+ const agentId = bodies[id]?.agentId;
31
+ return !!agentId && agentIds.includes(agentId);
32
+ }) : allIds;
27
33
  const status = useAppSelector((state) => state.conversationList.trashStatus);
28
34
  const error = useAppSelector((state) => state.conversationList.trashError);
29
- useEffect(() => {
30
- if (open && status === "idle") {
31
- void dispatch(fetchTrashedConversations());
32
- }
33
- }, [open, status, dispatch]);
35
+ const toggle = () => {
36
+ const next = !open;
37
+ setOpen(next);
38
+ if (next) void dispatch(fetchArchivedConversations({ agentIds }));
39
+ };
34
40
  const handleRestore = useCallback(
35
41
  async (conversationId) => {
36
42
  setRestoringId(conversationId);
@@ -51,22 +57,22 @@ function ConversationTrashSection({
51
57
  {
52
58
  className: "w-full",
53
59
  open,
54
- onClick: () => setOpen((v) => !v),
55
- icon: /* @__PURE__ */ jsx(Trash2, {}),
56
- title: "Trash",
60
+ onClick: toggle,
61
+ icon: /* @__PURE__ */ jsx(Archive, {}),
62
+ title: "Archived",
57
63
  end: open && status === "succeeded" ? ids.length : void 0
58
64
  }
59
65
  ),
60
- open && /* @__PURE__ */ jsxs("div", { className: "pb-1", children: [
61
- status === "loading" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 text-[11px] text-muted-foreground", children: [
66
+ open && /* @__PURE__ */ jsxs("div", { className: "max-h-64 overflow-y-auto pb-1", children: [
67
+ status === "loading" && ids.length === 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2 text-[11px] text-muted-foreground", children: [
62
68
  /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin" }),
63
- "Opening the trash\u2026"
69
+ "Opening\u2026"
64
70
  ] }),
65
71
  status === "failed" && /* @__PURE__ */ jsxs("p", { className: "px-3 py-2 text-[11px] text-destructive", children: [
66
- error ?? "The trash could not be read.",
72
+ error ?? "Archived chats could not be read.",
67
73
  /* @__PURE__ */ jsx(ErrorAlchemyMenu, { error })
68
74
  ] }),
69
- status === "succeeded" && ids.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-2 text-[11px] text-muted-foreground", children: "Nothing deleted. Deleted conversations land here and can be restored." }),
75
+ status === "succeeded" && ids.length === 0 && /* @__PURE__ */ jsx("p", { className: "px-3 py-2 text-[11px] text-muted-foreground", children: "Nothing archived." }),
70
76
  ids.map((id) => {
71
77
  const conv = bodies[id];
72
78
  if (!conv) return null;
@@ -79,7 +85,19 @@ function ConversationTrashSection({
79
85
  dense ? "h-6" : "h-8"
80
86
  ),
81
87
  children: [
82
- /* @__PURE__ */ jsx(
88
+ onOpen && !conv.deletedAt ? /* @__PURE__ */ jsx(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ onClick: () => onOpen(id),
93
+ className: cn(
94
+ "min-w-0 flex-1 truncate text-left text-muted-foreground hover:text-foreground",
95
+ dense ? "text-[11px]" : "text-xs"
96
+ ),
97
+ title,
98
+ children: title
99
+ }
100
+ ) : /* @__PURE__ */ jsx(
83
101
  "span",
84
102
  {
85
103
  className: cn(
@@ -90,7 +108,7 @@ function ConversationTrashSection({
90
108
  children: title
91
109
  }
92
110
  ),
93
- /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: restoringId === id ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Undo2, {}), onClick: () => void handleRestore(id), disabled: restoringId === id, "aria-label": `Restore ${title}`, className: "shrink-0", children: "Restore" })
111
+ /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: restoringId === id ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Undo2, {}), onClick: () => void handleRestore(id), disabled: restoringId === id, "aria-label": `Restore ${title}`, title: "Restore", className: "shrink-0" })
94
112
  ]
95
113
  },
96
114
  id
@@ -99,8 +117,8 @@ function ConversationTrashSection({
99
117
  ] })
100
118
  ] });
101
119
  }
102
- var ConversationTrashSection_default = ConversationTrashSection;
120
+ var ConversationArchiveSection_default = ConversationArchiveSection;
103
121
  export {
104
- ConversationTrashSection,
105
- ConversationTrashSection_default as default
122
+ ConversationArchiveSection,
123
+ ConversationArchiveSection_default as default
106
124
  };
@@ -97,20 +97,12 @@ export interface ConversationHistorySidebarProps {
97
97
  topSlot?: React.ReactNode;
98
98
  /** Extra header actions (shown next to grouping + search toggles). */
99
99
  headerActions?: React.ReactNode;
100
- /**
101
- * Consumer variant only: the heading over the list. Default "Filtered Chats"
102
- * (the /chat sidebar, which really does filter by source). A surface that
103
- * lists one agent's conversations names what the list IS instead.
104
- */
105
- historyLabel?: string;
106
100
  /** Controls whether the built-in search input is shown. Default: true. */
107
101
  showSearch?: boolean;
108
102
  /** Controls whether the grouping toggle is shown. Default: true (dense). */
109
103
  showGroupingToggle?: boolean;
110
- /**
111
- * Consumer variant only: start with the search field open + focused.
112
- */
113
- initialSearchOpen?: boolean;
104
+ /** Consumer variant only: put the caret in the search field on mount. */
105
+ autoFocusSearch?: boolean;
114
106
  /**
115
107
  * Consumer variant only: suppress the built-in inline search affordance
116
108
  * (when surrounding chrome already provides a search entry point).
@@ -124,6 +116,33 @@ export interface ConversationHistorySidebarProps {
124
116
  * list is not a conversation library.
125
117
  */
126
118
  serverSearch?: boolean;
119
+ /**
120
+ * Show only these conversations — a surface whose list is "what belongs to
121
+ * THIS thing" (a board's own conversations). `null`/omitted = no restriction;
122
+ * `[]` = an empty list with no read. The list reads again when the set
123
+ * changes. Pair with `serverSearch={false}`: the ranked search spans the
124
+ * person's whole library, so a restricted list filters what it holds.
125
+ */
126
+ onlyConversationIds?: string[] | null;
127
+ /**
128
+ * With `onlyConversationIds`: a row menu entry that takes the conversation OUT
129
+ * of the list (e.g. "Remove from this board") without touching the
130
+ * conversation itself. The host does the removal; the list then shrinks when
131
+ * the host passes the smaller set.
132
+ */
133
+ removeFromList?: {
134
+ label: string;
135
+ onRemove: (conv: ConversationListItem) => void;
136
+ };
137
+ /**
138
+ * A host that FREEZES and wakes this component (a board tile's Activity,
139
+ * which re-runs every effect on wake) sets this so a wake never re-reads the
140
+ * list: the mount fetch is skipped while the scope already holds a first page
141
+ * that was read for the same agents, source filter and lanes. A changed
142
+ * filter, Refresh, search and "load more" still read. Default false — the
143
+ * list refreshes each time it mounts.
144
+ */
145
+ keepLoaded?: boolean;
127
146
  className?: string;
128
147
  /** Extra classes for the built-in search input (dense). */
129
148
  searchInputClassName?: string;