@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
@@ -6,11 +6,6 @@ import {
6
6
  } from "./conversation-list.types.js";
7
7
  const initialState = {
8
8
  byConversationId: {},
9
- allConversationIds: [],
10
- globalStatus: "idle",
11
- globalError: null,
12
- globalLastFetchedAt: null,
13
- globalHasMore: false,
14
9
  agentCaches: {},
15
10
  trashConversationIds: [],
16
11
  trashByConversationId: {},
@@ -30,34 +25,6 @@ const conversationListSlice = createSlice({
30
25
  name: "conversationList",
31
26
  initialState,
32
27
  reducers: {
33
- // ── Global sidebar list ──────────────────────────────────────────────────
34
- setGlobalListLoading(state) {
35
- state.globalStatus = "loading";
36
- state.globalError = null;
37
- },
38
- setGlobalListSuccess(state, action) {
39
- const { items, hasMore, replace = true } = action.payload;
40
- for (const item of items) mergeItem(state, item);
41
- if (replace) {
42
- state.allConversationIds = items.map((i) => i.conversationId);
43
- } else {
44
- const existing = new Set(state.allConversationIds);
45
- for (const item of items) {
46
- if (!existing.has(item.conversationId)) {
47
- state.allConversationIds.push(item.conversationId);
48
- existing.add(item.conversationId);
49
- }
50
- }
51
- }
52
- state.globalHasMore = hasMore;
53
- state.globalStatus = "succeeded";
54
- state.globalLastFetchedAt = Date.now();
55
- state.globalError = null;
56
- },
57
- setGlobalListError(state, action) {
58
- state.globalStatus = "failed";
59
- state.globalError = action.payload;
60
- },
61
28
  // ── The trash (soft-deleted rows) ────────────────────────────────────────
62
29
  setTrashLoading(state) {
63
30
  state.trashStatus = "loading";
@@ -65,10 +32,10 @@ const conversationListSlice = createSlice({
65
32
  },
66
33
  setTrashSuccess(state, action) {
67
34
  const { items } = action.payload;
68
- state.trashConversationIds = items.map((i) => i.conversationId);
69
35
  for (const item of items) {
70
36
  state.trashByConversationId[item.conversationId] = item;
71
37
  }
38
+ state.trashConversationIds = Object.values(state.trashByConversationId).sort((a, b) => (b.updatedAt ?? "").localeCompare(a.updatedAt ?? "")).map((i) => i.conversationId);
72
39
  state.trashStatus = "succeeded";
73
40
  state.trashError = null;
74
41
  },
@@ -101,13 +68,13 @@ const conversationListSlice = createSlice({
101
68
  if (!existing) return;
102
69
  state.byConversationId[conversationId] = { ...existing, ...patch };
103
70
  },
104
- /** Prepend a newly-created conversation to the global list. */
71
+ /**
72
+ * Put a (restored / newly created) row into the entity store. Which LIST it
73
+ * appears in is the conversation-history scopes' business
74
+ * (`upsertConversationIntoScopes`), not this slice's.
75
+ */
105
76
  prependConversation(state, action) {
106
- const item = action.payload;
107
- mergeItem(state, item);
108
- const idx = state.allConversationIds.indexOf(item.conversationId);
109
- if (idx >= 0) state.allConversationIds.splice(idx, 1);
110
- state.allConversationIds.unshift(item.conversationId);
77
+ mergeItem(state, action.payload);
111
78
  },
112
79
  /** Optimistic rename — pair with `revertRename` on failure. */
113
80
  renameConversation(state, action) {
@@ -125,26 +92,12 @@ const conversationListSlice = createSlice({
125
92
  removeConversation(state, action) {
126
93
  const conversationId = action.payload;
127
94
  delete state.byConversationId[conversationId];
128
- const idx = state.allConversationIds.indexOf(conversationId);
129
- if (idx >= 0) state.allConversationIds.splice(idx, 1);
130
95
  for (const entry of Object.values(state.agentCaches)) {
131
96
  const i = entry.conversationIds.indexOf(conversationId);
132
97
  if (i >= 0) entry.conversationIds.splice(i, 1);
133
98
  }
134
99
  removePending(state, conversationId);
135
100
  },
136
- /** Bump to top by updatedAt (global list only — agent caches are order-preserving). */
137
- touchConversation(state, action) {
138
- const { conversationId, updatedAt } = action.payload;
139
- const item = state.byConversationId[conversationId];
140
- if (!item) return;
141
- item.updatedAt = updatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
142
- const idx = state.allConversationIds.indexOf(conversationId);
143
- if (idx > 0) {
144
- state.allConversationIds.splice(idx, 1);
145
- state.allConversationIds.unshift(conversationId);
146
- }
147
- },
148
101
  // ── Pending operations ───────────────────────────────────────────────────
149
102
  markPending(state, action) {
150
103
  if (!state.pendingOperations.includes(action.payload)) {
@@ -251,9 +204,6 @@ const conversationListSlice = createSlice({
251
204
  });
252
205
  const conversationListActions = conversationListSlice.actions;
253
206
  const {
254
- setGlobalListLoading,
255
- setGlobalListSuccess,
256
- setGlobalListError,
257
207
  setTrashLoading,
258
208
  setTrashSuccess,
259
209
  setTrashError,
@@ -265,7 +215,6 @@ const {
265
215
  renameConversation,
266
216
  revertRename,
267
217
  removeConversation,
268
- touchConversation,
269
218
  markPending,
270
219
  clearPending,
271
220
  setAgentCacheLoading,
@@ -304,13 +253,9 @@ export {
304
253
  setAgentCacheError,
305
254
  setAgentCacheLoading,
306
255
  setAgentCacheSuccess,
307
- setGlobalListError,
308
- setGlobalListLoading,
309
- setGlobalListSuccess,
310
256
  setTrashError,
311
257
  setTrashLoading,
312
258
  setTrashSuccess,
313
- touchConversation,
314
259
  upsertAgentConversationInCaches,
315
260
  upsertConversation,
316
261
  upsertConversationInCaches
@@ -68,29 +68,4 @@ export declare const fetchAgentConversationsNormalized: import("@reduxjs/toolkit
68
68
  * agx_agent.id before dispatching the RPC-backed normalized thunk.
69
69
  */
70
70
  export declare function fetchAgentConversations(input: FetchAgentConversationsArgInput): ChatThunk<Promise<FetchAgentConversationsResult>>;
71
- export interface FetchGlobalConversationsArgs {
72
- limit?: number;
73
- offset?: number;
74
- replace?: boolean;
75
- }
76
- export interface FetchGlobalConversationsResult {
77
- items: ConversationListItem[];
78
- hasMore: boolean;
79
- }
80
- /**
81
- * Fetches the signed-in user's most recent conversations across all agents.
82
- * Reads directly from `cx_conversation` — the table is RLS-filtered to the
83
- * requesting user, so no agent scoping is required. Used by the `(a)/chat`
84
- * global history sidebar.
85
- */
86
- export declare const fetchGlobalConversations: import("@reduxjs/toolkit").AsyncThunk<FetchGlobalConversationsResult, void | FetchGlobalConversationsArgs, {
87
- state?: unknown;
88
- dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
89
- extra?: unknown;
90
- serializedErrorType?: unknown;
91
- pendingMeta?: unknown;
92
- fulfilledMeta?: unknown;
93
- rejectedMeta?: unknown;
94
- rejectValue: string;
95
- }>;
96
71
  export {};
@@ -1,6 +1,7 @@
1
1
  import { selectAgentById } from "../agent-definition/selectors.js";
2
2
  import { createAsyncThunk } from "@reduxjs/toolkit";
3
3
  import { supabase } from "../../../host/db.js";
4
+ import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
4
5
  import { favoritesService } from "../../../context/sources/scopes.js";
5
6
  import { isScopesRpcErr } from "../../../context/sources/scopes.js";
6
7
  import { conversationListCacheKey } from "./conversation-list.types.js";
@@ -8,15 +9,8 @@ import { selectAgentIdFromInstance } from "../execution-system/conversations/con
8
9
  import {
9
10
  setAgentCacheLoading,
10
11
  setAgentCacheSuccess,
11
- setAgentCacheError,
12
- setGlobalListLoading,
13
- setGlobalListSuccess,
14
- setGlobalListError
12
+ setAgentCacheError
15
13
  } from "./conversation-list.slice.js";
16
- import { CONVERSATION_LIST_PAGE_SIZE } from "./conversation-list.types.js";
17
- import { excludeHiddenLane } from "../conversation-history/history-filters.js";
18
- import { getUserId, hasBrowserSession } from "../../../host/identity.js";
19
- import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
20
14
  function resolveCanonicalAgentIdForConversationsFetch(input, state) {
21
15
  const versionFilter = input.versionFilter === void 0 ? null : input.versionFilter;
22
16
  let mapKey;
@@ -130,60 +124,10 @@ function fetchAgentConversations(input) {
130
124
  ).unwrap();
131
125
  };
132
126
  }
133
- const fetchGlobalConversations = createAsyncThunk(
134
- "conversationList/fetchGlobalConversations",
135
- async (rawArgs, { dispatch, rejectWithValue }) => {
136
- const args = rawArgs;
137
- const limit = args?.limit ?? CONVERSATION_LIST_PAGE_SIZE;
138
- const offset = args?.offset ?? 0;
139
- const replace = args?.replace ?? true;
140
- dispatch(setGlobalListLoading());
141
- const viewerId = getUserId();
142
- if (!viewerId && !await hasBrowserSession()) {
143
- dispatch(setGlobalListSuccess({ items: [], hasMore: false, replace }));
144
- return { items: [], hasMore: false };
145
- }
146
- let listQuery = excludeHiddenLane(
147
- // a mandate candidate's shadow leg is never listed (lanes.ts)
148
- supabase.schema("chat").from("conversation").select(
149
- "id, title, description, status, message_count, initial_agent_id, last_model_id, source_app, source_feature, created_at, updated_at, exclude_from_kg"
150
- ).is("deleted_at", null).eq("is_ephemeral", false)
151
- ).order("updated_at", { ascending: false }).range(offset, offset + limit - 1);
152
- if (viewerId) {
153
- listQuery = listQuery.eq("created_by", viewerId);
154
- }
155
- const { data, error } = await listQuery;
156
- if (error) {
157
- dispatch(setGlobalListError(error.message));
158
- return rejectWithValue(error.message);
159
- }
160
- const rows = data ?? [];
161
- const mapped = rows.map((row) => ({
162
- conversationId: row.id,
163
- title: conversationTitleText(row.title ?? null),
164
- description: row.description ?? null,
165
- updatedAt: row.updated_at,
166
- createdAt: row.created_at,
167
- status: row.status,
168
- messageCount: row.message_count ?? 0,
169
- isFavorite: false,
170
- excludeFromKg: row.exclude_from_kg ?? false,
171
- agentId: row.initial_agent_id ?? null,
172
- lastModelId: row.last_model_id ?? null,
173
- sourceApp: row.source_app ?? void 0,
174
- sourceFeature: row.source_feature ?? void 0
175
- }));
176
- const items = await applyFavoritesFromUes(mapped);
177
- const hasMore = items.length === limit;
178
- dispatch(setGlobalListSuccess({ items, hasMore, replace }));
179
- return { items, hasMore };
180
- }
181
- );
182
127
  export {
183
128
  applyFavoritesFromUes,
184
129
  fetchAgentConversations,
185
130
  fetchAgentConversationsNormalized,
186
- fetchGlobalConversations,
187
131
  mapRpcRowToAgentConversationListItem,
188
132
  mapRpcRowToConversationListItem,
189
133
  resolveCanonicalAgentIdForConversationsFetch
@@ -39,6 +39,12 @@ export interface ConversationListItem {
39
39
  * unknown. Never client-written — display/filter only.
40
40
  */
41
41
  originClass?: string;
42
+ /**
43
+ * Set only on rows in the "Archived" section that were DELETED (soft delete,
44
+ * `deleted_at`) rather than archived (`status = 'archived'`). Restore picks
45
+ * its door from it.
46
+ */
47
+ deletedAt?: string | null;
42
48
  }
43
49
  export type ConversationListLoadStatus = "idle" | "loading" | "succeeded" | "failed";
44
50
  /**
@@ -60,11 +66,6 @@ export interface ConversationListAgentCacheEntry {
60
66
  }
61
67
  export interface ConversationListState {
62
68
  byConversationId: Record<string, ConversationListItem>;
63
- allConversationIds: string[];
64
- globalStatus: ConversationListLoadStatus;
65
- globalError: string | null;
66
- globalLastFetchedAt: number | null;
67
- globalHasMore: boolean;
68
69
  agentCaches: Record<string, ConversationListAgentCacheEntry>;
69
70
  /**
70
71
  * THE TRASH — soft-deleted conversations (`deleted_at IS NOT NULL`), read on
@@ -6,8 +6,11 @@ import { isScopesRpcErr } from "../../../context/sources/scopes.js";
6
6
  import {
7
7
  patchConversation,
8
8
  renameConversation as renameConversationListItem,
9
- revertRename
9
+ revertRename,
10
+ addToTrash,
11
+ removeFromTrash
10
12
  } from "./conversation-list.slice.js";
13
+ import { findConversationRow } from "./conversation-list.selectors.js";
11
14
  import { patchConversationInScopes } from "../conversation-history/slice.js";
12
15
  import { patchConversation as patchConversationRecord } from "../execution-system/conversations/conversations.slice.js";
13
16
  import { setConversationLabel as setMessagesConversationLabel } from "../execution-system/messages/messages.slice.js";
@@ -103,7 +106,8 @@ const setConversationFavorite = createAsyncThunk(
103
106
  );
104
107
  const setConversationArchived = createAsyncThunk(
105
108
  "conversationRow/setArchived",
106
- async ({ conversationId, archived }, { dispatch, rejectWithValue }) => {
109
+ async ({ conversationId, archived }, { dispatch, getState, rejectWithValue }) => {
110
+ const before = findConversationRow(getState(), conversationId);
107
111
  const nextStatus = archived ? "archived" : "active";
108
112
  const action = archived ? "archive this conversation" : "restore this conversation";
109
113
  const { data, error } = await supabase.schema("chat").from("conversation").update({ status: nextStatus, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", conversationId).select("id");
@@ -121,6 +125,11 @@ const setConversationArchived = createAsyncThunk(
121
125
  dispatch(
122
126
  patchConversationRecord({ conversationId, persistedStatus: nextStatus })
123
127
  );
128
+ if (archived) {
129
+ if (before) dispatch(addToTrash({ ...before, status: nextStatus }));
130
+ } else {
131
+ dispatch(removeFromTrash(conversationId));
132
+ }
124
133
  return { conversationId, status: nextStatus };
125
134
  }
126
135
  );
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The ONE place a `chat.conversation` row becomes a `ConversationListItem`,
3
+ * and the one column list every "my conversations" read projects.
4
+ *
5
+ * The global sidebar thunk and the scoped conversation-history thunk each
6
+ * carried their own copy of this projection (same columns, same field-by-field
7
+ * mapper); they differed only by `origin_class` and the title transform.
8
+ * Favorite state is NOT here: it is canonical in `platform.user_entity_state`
9
+ * and overlaid by `applyFavoritesFromUes` after the rows load.
10
+ */
11
+ import type { ConversationListItem } from "./conversation-list.types.js";
12
+ /** Columns projected from `chat.conversation` — enough for any list row. */
13
+ export declare const CONVERSATION_ROW_COLUMNS = "id, title, description, status, message_count, initial_agent_id, last_model_id, source_app, source_feature, origin_class, created_at, updated_at, exclude_from_kg";
14
+ /** Structural row type — the columns above, loosely typed like the query result. */
15
+ export type ConversationDbRow = Record<string, unknown>;
16
+ export declare function mapConversationDbRow(row: ConversationDbRow): ConversationListItem;
@@ -0,0 +1,24 @@
1
+ import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
2
+ const CONVERSATION_ROW_COLUMNS = "id, title, description, status, message_count, initial_agent_id, last_model_id, source_app, source_feature, origin_class, created_at, updated_at, exclude_from_kg";
3
+ function mapConversationDbRow(row) {
4
+ return {
5
+ conversationId: row.id,
6
+ title: conversationTitleText(row.title ?? null),
7
+ description: row.description ?? null,
8
+ updatedAt: row.updated_at,
9
+ createdAt: row.created_at,
10
+ status: row.status,
11
+ messageCount: row.message_count ?? 0,
12
+ isFavorite: false,
13
+ excludeFromKg: row.exclude_from_kg ?? false,
14
+ agentId: row.initial_agent_id ?? null,
15
+ lastModelId: row.last_model_id ?? null,
16
+ sourceApp: row.source_app ?? void 0,
17
+ sourceFeature: row.source_feature ?? void 0,
18
+ originClass: row.origin_class ?? void 0
19
+ };
20
+ }
21
+ export {
22
+ CONVERSATION_ROW_COLUMNS,
23
+ mapConversationDbRow
24
+ };
@@ -1,5 +1,10 @@
1
1
  /**
2
- * THE TRASH — reading soft-deleted conversations back, and restoring one.
2
+ * THE ARCHIVE — reading archived AND deleted conversations back, and restoring one.
3
+ *
4
+ * One place, called "Archived" (Arman, 2026-10-08): a conversation the person
5
+ * archived (`status = 'archived'`) and one they deleted (`deleted_at` stamped)
6
+ * both land in the same section at the foot of every conversation list, and
7
+ * Restore brings either back. The store fields keep their `trash*` names.
3
8
  *
4
9
  * DD-179. Deleting a conversation was a one-way door: `cx_soft_delete_conversation`
5
10
  * stamps `deleted_at` and every reader filters `deleted_at IS NULL`, so the row
@@ -17,10 +22,11 @@
17
22
  */
18
23
  import type { ChatDispatch, ChatRootState } from "../../../store/root-state.js";
19
24
  import type { ConversationListItem } from "./conversation-list.types.js";
20
- export declare const fetchTrashedConversations: import("@reduxjs/toolkit").AsyncThunk<{
25
+ export declare const fetchArchivedConversations: import("@reduxjs/toolkit").AsyncThunk<{
21
26
  items: ConversationListItem[];
22
27
  }, void | {
23
28
  limit?: number;
29
+ agentIds?: string[];
24
30
  }, {
25
31
  extra?: unknown;
26
32
  serializedErrorType?: unknown;
@@ -41,8 +47,10 @@ interface RestoreResult {
41
47
  restored: boolean;
42
48
  }
43
49
  /**
44
- * Undo a soft delete. ONE door: `public.cx_restore_conversation`, the exact
45
- * inverse of `cx_soft_delete_conversation`.
50
+ * Bring a row out of the Archived section. A deleted row goes back through
51
+ * ONE door, `public.cx_restore_conversation` (the exact inverse of
52
+ * `cx_soft_delete_conversation`); an archived row goes back through
53
+ * `setConversationArchived`. A row that is both takes both doors.
46
54
  *
47
55
  * `false` back from the RPC means the row is absent, was never deleted, or is
48
56
  * not this caller's to restore — all of which are a refusal, not a success, so
@@ -3,25 +3,32 @@ import { supabase } from "../../../host/db.js";
3
3
  import { operationFailed } from "@ai-matrx/kit/errors";
4
4
  import { ensureEffectiveKnob } from "../../../host/prefs.js";
5
5
  import { selectActiveOrganizationId } from "../../../context/sources/scopes.js";
6
+ import {
7
+ CONVERSATION_ROW_COLUMNS,
8
+ mapConversationDbRow
9
+ } from "./conversation-rows.js";
6
10
  import {
7
11
  setTrashLoading,
8
12
  setTrashSuccess,
9
13
  setTrashError,
10
14
  removeFromTrash,
15
+ addToTrash,
11
16
  prependConversation
12
17
  } from "./conversation-list.slice.js";
13
18
  import { upsertConversationIntoScopes } from "../conversation-history/slice.js";
14
19
  import { getUserId } from "../../../host/identity.js";
20
+ import { setConversationArchived } from "./conversation-row-actions.thunks.js";
15
21
  const CONVERSATION_TRASH_PAGE_SIZE_KNOB = {
16
22
  feature: "agents.conversations",
17
23
  key: "trash_page_size"
18
24
  };
19
- const fetchTrashedConversations = createAsyncThunk(
25
+ const fetchArchivedConversations = createAsyncThunk(
20
26
  "conversationList/fetchTrashed",
21
27
  async (rawArgs, { dispatch, getState, rejectWithValue }) => {
22
28
  dispatch(setTrashLoading());
23
29
  const viewerId = getUserId();
24
- let limit = rawArgs?.limit;
30
+ const args = rawArgs;
31
+ let limit = args?.limit;
25
32
  if (limit === void 0) {
26
33
  const organizationId = selectActiveOrganizationId(getState());
27
34
  try {
@@ -43,37 +50,26 @@ const fetchTrashedConversations = createAsyncThunk(
43
50
  }
44
51
  limit = resolved;
45
52
  } catch (error2) {
46
- const message = `The trash could not be opened: the setting that decides how many deleted conversations one page shows ("${CONVERSATION_TRASH_PAGE_SIZE_KNOB.feature}.${CONVERSATION_TRASH_PAGE_SIZE_KNOB.key}") could not be read \u2014 ${error2 instanceof Error ? error2.message : String(error2)}.`;
53
+ const message = `The archive could not be opened: the setting that decides how many archived conversations one page shows ("${CONVERSATION_TRASH_PAGE_SIZE_KNOB.feature}.${CONVERSATION_TRASH_PAGE_SIZE_KNOB.key}") could not be read \u2014 ${error2 instanceof Error ? error2.message : String(error2)}.`;
47
54
  dispatch(setTrashError(message));
48
55
  return rejectWithValue({ message });
49
56
  }
50
57
  }
51
- let query = supabase.schema("chat").from("conversation").select(
52
- "id, title, description, status, message_count, initial_agent_id, last_model_id, source_app, source_feature, created_at, updated_at, deleted_at, exclude_from_kg"
53
- ).not("deleted_at", "is", null).eq("is_ephemeral", false).order("deleted_at", { ascending: false }).limit(limit);
58
+ let query = supabase.schema("chat").from("conversation").select(`${CONVERSATION_ROW_COLUMNS}, deleted_at`).or("deleted_at.not.is.null,status.eq.archived").eq("is_ephemeral", false).order("updated_at", { ascending: false }).limit(limit);
54
59
  if (viewerId) query = query.eq("created_by", viewerId);
60
+ if (args?.agentIds && args.agentIds.length > 0) {
61
+ query = query.in("initial_agent_id", args.agentIds);
62
+ }
55
63
  const { data, error } = await query;
56
64
  if (error) {
57
- const message = operationFailed("open the trash", error).message;
65
+ const message = operationFailed("open the archive", error).message;
58
66
  dispatch(setTrashError(message));
59
67
  return rejectWithValue({ message });
60
68
  }
61
69
  const items = (data ?? []).map((row) => ({
62
- conversationId: row.id,
63
- title: row.title ?? null,
64
- description: row.description ?? null,
70
+ ...mapConversationDbRow(row),
65
71
  updatedAt: row.deleted_at ?? row.updated_at,
66
- createdAt: row.created_at,
67
- status: row.status,
68
- messageCount: row.message_count ?? 0,
69
- // Pins and knowledge-graph state are irrelevant in the trash and are not
70
- // read here; a restored row picks its real values up on the next list load.
71
- isFavorite: false,
72
- excludeFromKg: row.exclude_from_kg ?? false,
73
- agentId: row.initial_agent_id ?? null,
74
- lastModelId: row.last_model_id ?? null,
75
- sourceApp: row.source_app ?? void 0,
76
- sourceFeature: row.source_feature ?? void 0
72
+ deletedAt: row.deleted_at ?? null
77
73
  }));
78
74
  dispatch(setTrashSuccess({ items }));
79
75
  return { items };
@@ -82,27 +78,47 @@ const fetchTrashedConversations = createAsyncThunk(
82
78
  const restoreConversation = createAsyncThunk(
83
79
  "conversationList/restore",
84
80
  async ({ conversationId }, { dispatch, getState, rejectWithValue }) => {
85
- const { data, error } = await supabase.rpc("cx_restore_conversation", {
86
- p_conversation_id: conversationId
87
- });
88
- if (error) {
89
- return rejectWithValue({
90
- message: operationFailed("restore this conversation", error).message
81
+ const item = getState().conversationList.trashByConversationId[conversationId];
82
+ const wasDeleted = !item || Boolean(item.deletedAt);
83
+ const wasArchived = item?.status === "archived";
84
+ if (wasDeleted) {
85
+ const { data, error } = await supabase.rpc("cx_restore_conversation", {
86
+ p_conversation_id: conversationId
91
87
  });
88
+ if (error) {
89
+ return rejectWithValue({
90
+ message: operationFailed("restore this conversation", error).message
91
+ });
92
+ }
93
+ if (data !== true) {
94
+ return rejectWithValue({
95
+ message: operationFailed("restore this conversation").message
96
+ });
97
+ }
98
+ if (item) dispatch(addToTrash({ ...item, deletedAt: null }));
92
99
  }
93
- if (data !== true) {
94
- return rejectWithValue({
95
- message: operationFailed("restore this conversation").message
96
- });
100
+ if (wasArchived) {
101
+ const unarchived = await dispatch(
102
+ setConversationArchived({ conversationId, archived: false })
103
+ );
104
+ if (setConversationArchived.rejected.match(unarchived)) {
105
+ return rejectWithValue({
106
+ message: unarchived.payload?.message ?? operationFailed("restore this conversation").message
107
+ });
108
+ }
97
109
  }
98
- const item = getState().conversationList.trashByConversationId[conversationId];
99
110
  dispatch(removeFromTrash(conversationId));
100
111
  if (item) {
101
- dispatch(prependConversation(item));
112
+ const row = {
113
+ ...item,
114
+ status: wasArchived ? "active" : item.status,
115
+ deletedAt: null
116
+ };
117
+ dispatch(prependConversation(row));
102
118
  dispatch(
103
119
  upsertConversationIntoScopes({
104
- row: item,
105
- agentId: item.agentId ?? ""
120
+ row,
121
+ agentId: row.agentId ?? ""
106
122
  })
107
123
  );
108
124
  }
@@ -110,6 +126,6 @@ const restoreConversation = createAsyncThunk(
110
126
  }
111
127
  );
112
128
  export {
113
- fetchTrashedConversations,
129
+ fetchArchivedConversations,
114
130
  restoreConversation
115
131
  };