@ai-matrx/chat 0.6.6 → 0.7.1

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 (249) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/agents/components/agent-widgets/AgentChatHistorySidebar.js +16 -55
  4. package/dist/agents/components/chat/chat-door.d.ts +67 -0
  5. package/dist/agents/components/chat/chat-door.js +100 -0
  6. package/dist/agents/components/conversation-history/AgentConversationList.d.ts +83 -0
  7. package/dist/agents/components/conversation-history/AgentConversationList.js +252 -0
  8. package/dist/agents/components/conversation-history/ConversationArchiveSection.d.ts +5 -1
  9. package/dist/agents/components/conversation-history/ConversationArchiveSection.js +22 -4
  10. package/dist/agents/components/conversation-history/ConversationHistorySidebar.js +20 -65
  11. package/dist/agents/components/inputs/input-components/TextareaInput.js +2 -0
  12. package/dist/agents/components/inputs/input-components/VariableInputComponent.js +7 -6
  13. package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.d.ts +3 -0
  14. package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.js +40 -0
  15. package/dist/agents/components/inputs/smart-input/ConversationContextRail.js +6 -29
  16. package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.d.ts +3 -0
  17. package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.js +35 -0
  18. package/dist/agents/components/inputs/smart-input/InboxQueueStrip.js +0 -8
  19. package/dist/agents/components/inputs/smart-input/RunToolPicker.js +15 -11
  20. package/dist/agents/components/inputs/smart-input/composer/ComposerPlusMenu.js +22 -0
  21. package/dist/agents/components/inputs/smart-input/rail-pill.d.ts +35 -0
  22. package/dist/agents/components/inputs/smart-input/rail-pill.js +30 -0
  23. package/dist/agents/components/inputs/variable-input-variations/AgentVariableForm.js +52 -48
  24. package/dist/agents/components/run-controls/panels/shared.d.ts +1 -1
  25. package/dist/agents/components/shared/AgentModeController.js +3 -2
  26. package/dist/agents/components/shell/AgentRunSidebarMenu.js +15 -54
  27. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +1 -2
  28. package/dist/agents/engine.d.ts +15 -0
  29. package/dist/agents/engine.js +17 -0
  30. package/dist/agents/hooks/useModelControls.js +3 -175
  31. package/dist/agents/redux/agent-definition/selectors.d.ts +237 -237
  32. package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -50
  33. package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -147
  34. package/dist/agents/redux/conversation-history/thunks.js +6 -18
  35. package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +1 -73
  36. package/dist/agents/redux/conversation-list/conversation-list.selectors.js +2 -36
  37. package/dist/agents/redux/conversation-list/conversation-list.slice.d.ts +7 -22
  38. package/dist/agents/redux/conversation-list/conversation-list.slice.js +7 -62
  39. package/dist/agents/redux/conversation-list/conversation-list.thunks.d.ts +0 -25
  40. package/dist/agents/redux/conversation-list/conversation-list.thunks.js +2 -58
  41. package/dist/agents/redux/conversation-list/conversation-list.types.d.ts +0 -5
  42. package/dist/agents/redux/conversation-list/conversation-rows.d.ts +16 -0
  43. package/dist/agents/redux/conversation-list/conversation-rows.js +24 -0
  44. package/dist/agents/redux/conversation-list/conversation-trash.thunks.d.ts +1 -0
  45. package/dist/agents/redux/conversation-list/conversation-trash.thunks.js +13 -18
  46. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -54
  47. package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -14
  48. package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -5
  49. package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -3
  50. package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -8
  51. package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -5
  52. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -7
  53. package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -1
  54. package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -7
  55. package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -1
  56. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -14
  57. package/dist/agents/redux/execution-system/thunks/create-instance.thunk.d.ts +10 -1
  58. package/dist/agents/redux/execution-system/thunks/create-instance.thunk.js +114 -265
  59. package/dist/agents/redux/execution-system/thunks/dispatch-matrx-extend-tool.thunk.js +18 -2
  60. package/dist/agents/redux/execution-system/thunks/dispatch-surface-client-tool.thunk.js +10 -28
  61. package/dist/agents/redux/execution-system/thunks/dispatch-surface-write.thunk.js +10 -25
  62. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +20 -0
  63. package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +6 -1
  64. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +58 -0
  65. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +62 -0
  66. package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.d.ts +23 -0
  67. package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.js +37 -0
  68. package/dist/agents/redux/execution-system/thunks/resume-instance.thunk.js +10 -2
  69. package/dist/agents/redux/execution-system/utils/build-tool-injection.d.ts +7 -0
  70. package/dist/agents/redux/execution-system/utils/build-tool-injection.js +18 -6
  71. package/dist/agents/redux/execution-system/utils/host-turn.d.ts +45 -0
  72. package/dist/agents/redux/execution-system/utils/host-turn.js +119 -0
  73. package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -1
  74. package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.d.ts +50 -20
  75. package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.js +9 -101
  76. package/dist/agents/types/tool-injection.types.d.ts +18 -2
  77. package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -2
  78. package/dist/agents/ui-first-tools/redux/pending-asks.slice.d.ts +2 -1
  79. package/dist/agents/ui-first-tools/redux/resolve-asks-with-input.thunk.js +1 -1
  80. package/dist/agents/ui-first-tools/tools/ask-response.d.ts +29 -0
  81. package/dist/agents/ui-first-tools/tools/ask-response.js +15 -0
  82. package/dist/agents/ui-first-tools/tools/schemas.d.ts +3 -25
  83. package/dist/agents/ui-first-tools/tools/schemas.js +1 -12
  84. package/dist/agents/ui-first-tools/ui/ApprovalCard.js +1 -1
  85. package/dist/agents/ui-first-tools/ui/AskWizard.d.ts +1 -1
  86. package/dist/agents/ui-first-tools/ui/AskWizard.js +1 -1
  87. package/dist/cx-chat/_legacy-stubs.d.ts +5 -5
  88. package/dist/cx-chat/components/SsrSidebarChats.js +13 -15
  89. package/dist/cx-chat/components/messages/UserMessage.d.ts +2 -2
  90. package/dist/cx-chat/types/conversation.d.ts +6 -6
  91. package/dist/cx-chat/utils/buildContentBlocksForSave.d.ts +1 -1
  92. package/dist/cx-chat/utils/cx-content-converter.d.ts +1 -1
  93. package/dist/host/bare-host-chrome.js +9 -3
  94. package/dist/host/composer-extensions.d.ts +75 -0
  95. package/dist/host/composer-extensions.js +92 -0
  96. package/dist/host/configure.js +1 -0
  97. package/dist/host/contract.d.ts +105 -13
  98. package/dist/host/defaults/confirm.d.ts +15 -0
  99. package/dist/host/defaults/confirm.js +25 -0
  100. package/dist/host/defaults/files-ui.d.ts +85 -0
  101. package/dist/host/defaults/files-ui.js +158 -0
  102. package/dist/host/defaults/gates.d.ts +27 -0
  103. package/dist/host/defaults/gates.js +72 -0
  104. package/dist/host/defaults/media-client.d.ts +15 -0
  105. package/dist/host/defaults/media-client.js +40 -0
  106. package/dist/host/defaults/voice.d.ts +81 -0
  107. package/dist/host/defaults/voice.js +239 -0
  108. package/dist/host/device-tool-handoff.d.ts +26 -0
  109. package/dist/host/device-tool-handoff.js +45 -0
  110. package/dist/host/index.d.ts +1 -0
  111. package/dist/host/index.js +4 -1
  112. package/dist/host/microphone.d.ts +11 -0
  113. package/dist/host/microphone.js +17 -0
  114. package/dist/host/ui-slots.d.ts +29 -74
  115. package/dist/host/ui-slots.js +40 -42
  116. package/dist/store/create-chat-store.d.ts +2 -2
  117. package/dist/store/middlewares.d.ts +5 -5
  118. package/dist/store/slices.d.ts +1 -1
  119. package/dist/surfaces/redux/selectors.d.ts +2 -2
  120. package/dist/tool-call-visualization/components/ToolCallVisualization.js +3 -2
  121. package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.d.ts +15 -0
  122. package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.js +36 -0
  123. package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.d.ts +40 -0
  124. package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +296 -0
  125. package/dist/tool-call-visualization/configured-rows/CopyToolButton.d.ts +23 -0
  126. package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +62 -0
  127. package/dist/tool-call-visualization/configured-rows/ToolProgressView.d.ts +23 -0
  128. package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +147 -0
  129. package/dist/tool-call-visualization/configured-rows/field-components.d.ts +15 -0
  130. package/dist/tool-call-visualization/configured-rows/field-components.js +244 -0
  131. package/dist/tool-call-visualization/configured-rows/helpers.d.ts +39 -0
  132. package/dist/tool-call-visualization/configured-rows/helpers.js +110 -0
  133. package/dist/tool-call-visualization/configured-rows/register.d.ts +25 -0
  134. package/dist/tool-call-visualization/configured-rows/register.js +51 -0
  135. package/dist/tool-call-visualization/configured-rows/registries.d.ts +27 -0
  136. package/dist/tool-call-visualization/configured-rows/registries.js +14 -0
  137. package/dist/tool-call-visualization/configured-rows/to-row-entry.d.ts +8 -0
  138. package/dist/tool-call-visualization/configured-rows/to-row-entry.js +38 -0
  139. package/dist/tool-call-visualization/configured-rows/transforms.d.ts +14 -0
  140. package/dist/tool-call-visualization/configured-rows/transforms.js +30 -0
  141. package/dist/tool-call-visualization/configured-rows/types.d.ts +140 -0
  142. package/dist/tool-call-visualization/redux/selectors.d.ts +1 -1
  143. package/dist/tool-call-visualization/registry/registry.d.ts +1 -1
  144. package/dist/tool-call-visualization/registry/registry.js +8 -1
  145. package/dist/tool-call-visualization/types.d.ts +1 -1
  146. package/dist/ui/chat-protocol-types.d.ts +0 -1
  147. package/dist/ui/ownership.d.ts +25 -0
  148. package/dist/ui/ownership.js +18 -0
  149. package/dist/voice-agent/audio/audioCapture.js +11 -6
  150. package/dist/window-panels/windows/agents/AgentRunHistoryWindow.d.ts +1 -2
  151. package/dist/window-panels/windows/agents/AgentRunHistoryWindow.js +21 -181
  152. package/dist/window-panels/windows/agents/AgentRunWindow.js +26 -13
  153. package/package.json +4627 -125
  154. package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.d.ts +0 -7
  155. package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.js +0 -33
  156. package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.d.ts +0 -6
  157. package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.js +0 -21
  158. package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.d.ts +0 -6
  159. package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.js +0 -11
  160. package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.d.ts +0 -12
  161. package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.js +0 -7
  162. package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.d.ts +0 -4
  163. package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.js +0 -81
  164. package/dist/agents/components/run/run-sidebar/SidebarHeader.d.ts +0 -21
  165. package/dist/agents/components/run/run-sidebar/SidebarHeader.js +0 -50
  166. package/dist/agents/components/run-controls/AdvancedRunSettings/index.d.ts +0 -6
  167. package/dist/agents/components/run-controls/AdvancedRunSettings/index.js +0 -32
  168. package/dist/agents/components/run-controls/RunSettingsModal.d.ts +0 -5
  169. package/dist/agents/components/run-controls/RunSettingsModal.js +0 -22
  170. package/dist/agents/components/shell/AgentBuildSidebarExtras.d.ts +0 -6
  171. package/dist/agents/components/shell/AgentBuildSidebarExtras.js +0 -30
  172. package/dist/agents/constants/agent-system-competitors.d.ts +0 -9
  173. package/dist/agents/constants/agent-system-competitors.js +0 -125
  174. package/dist/agents/hooks/message-crud/useMessageActions.d.ts +0 -29
  175. package/dist/agents/hooks/message-crud/useMessageActions.js +0 -119
  176. package/dist/agents/hooks/useConversationPendingCalls.d.ts +0 -30
  177. package/dist/agents/hooks/useConversationPendingCalls.js +0 -42
  178. package/dist/agents/model-registry/model-classes.d.ts +0 -1
  179. package/dist/agents/model-registry/model-classes.js +0 -1
  180. package/dist/agents/redux/conversation-history/index.d.ts +0 -18
  181. package/dist/agents/redux/conversation-history/index.js +0 -4
  182. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.d.ts +0 -38
  183. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.js +0 -42
  184. package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.d.ts +0 -58
  185. package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.js +0 -50
  186. package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.d.ts +0 -76
  187. package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.js +0 -101
  188. package/dist/agents/redux/execution-system/thunks/attach-workflow-run.d.ts +0 -38
  189. package/dist/agents/redux/execution-system/thunks/attach-workflow-run.js +0 -25
  190. package/dist/agents/redux/execution-system/utils/source-slice-helpers.d.ts +0 -45
  191. package/dist/agents/redux/execution-system/utils/source-slice-helpers.js +0 -50
  192. package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.d.ts +0 -25
  193. package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.js +0 -15
  194. package/dist/agents/services/agentService.d.ts +0 -12
  195. package/dist/agents/services/agentService.js +0 -92
  196. package/dist/agents/utils/escape-code-fences.d.ts +0 -15
  197. package/dist/agents/utils/escape-code-fences.js +0 -9
  198. package/dist/agents/utils/normalize-managed-options.d.ts +0 -30
  199. package/dist/agents/utils/normalize-managed-options.js +0 -29
  200. package/dist/agents/utils/processedDocumentContext.d.ts +0 -51
  201. package/dist/agents/utils/processedDocumentContext.js +0 -51
  202. package/dist/agents/utils/variable-validation.d.ts +0 -28
  203. package/dist/agents/utils/variable-validation.js +0 -54
  204. package/dist/cx-chat/components/ChatConversationSkeleton.d.ts +0 -9
  205. package/dist/cx-chat/components/ChatConversationSkeleton.js +0 -45
  206. package/dist/cx-chat/components/ChatPanelBackButton.d.ts +0 -1
  207. package/dist/cx-chat/components/ChatPanelBackButton.js +0 -26
  208. package/dist/cx-chat/components/messages/MessageErrorBoundary.d.ts +0 -20
  209. package/dist/cx-chat/components/messages/MessageErrorBoundary.js +0 -40
  210. package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.d.ts +0 -14
  211. package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.js +0 -160
  212. package/dist/cx-chat/components/variable-inputs/NumberInput.d.ts +0 -15
  213. package/dist/cx-chat/components/variable-inputs/NumberInput.js +0 -79
  214. package/dist/cx-chat/components/variable-inputs/RadioGroupInput.d.ts +0 -14
  215. package/dist/cx-chat/components/variable-inputs/RadioGroupInput.js +0 -125
  216. package/dist/cx-chat/components/variable-inputs/SelectInput.d.ts +0 -14
  217. package/dist/cx-chat/components/variable-inputs/SelectInput.js +0 -92
  218. package/dist/cx-chat/components/variable-inputs/TextareaInput.d.ts +0 -14
  219. package/dist/cx-chat/components/variable-inputs/TextareaInput.js +0 -46
  220. package/dist/cx-chat/components/variable-inputs/ToggleInput.d.ts +0 -14
  221. package/dist/cx-chat/components/variable-inputs/ToggleInput.js +0 -46
  222. package/dist/cx-chat/hooks/useChatPersistence.d.ts +0 -28
  223. package/dist/cx-chat/hooks/useChatPersistence.js +0 -180
  224. package/dist/cx-chat/hooks/useInstanceBootstrap.d.ts +0 -1
  225. package/dist/cx-chat/hooks/useInstanceBootstrap.js +0 -115
  226. package/dist/cx-chat/types/content.d.ts +0 -184
  227. package/dist/cx-chat/types/content.js +0 -91
  228. package/dist/cx-chat/types/cx-tables.d.ts +0 -176
  229. package/dist/cx-chat/utils/settings-diff.d.ts +0 -13
  230. package/dist/cx-chat/utils/settings-diff.js +0 -25
  231. package/dist/public-chat/components/AgentSelector.d.ts +0 -22
  232. package/dist/public-chat/components/AgentSelector.js +0 -80
  233. package/dist/public-chat/components/GuidedVariableInputs.d.ts +0 -25
  234. package/dist/public-chat/components/GuidedVariableInputs.js +0 -623
  235. package/dist/public-chat/components/PublicVariableInputs.d.ts +0 -29
  236. package/dist/public-chat/components/PublicVariableInputs.js +0 -172
  237. package/dist/public-chat/types/content.d.ts +0 -184
  238. package/dist/public-chat/types/content.js +0 -91
  239. package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.d.ts +0 -15
  240. package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.js +0 -31
  241. package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.d.ts +0 -24
  242. package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.js +0 -26
  243. package/dist/ui/AudioOutputBlockSkeleton.d.ts +0 -17
  244. package/dist/ui/AudioOutputBlockSkeleton.js +0 -78
  245. package/dist/ui/lazy/PublicChatVariableInputs.d.ts +0 -2
  246. package/dist/ui/lazy/PublicChatVariableInputs.js +0 -16
  247. package/dist/utils/xml/readXmlTag.d.ts +0 -12
  248. package/dist/utils/xml/readXmlTag.js +0 -66
  249. /package/dist/{cx-chat/types/cx-tables.js → tool-call-visualization/configured-rows/types.js} +0 -0
@@ -1,25 +1,13 @@
1
1
  /**
2
2
  * dispatchScribeTool — turns a delegated scribe tool call into execution +
3
- * result, mirroring `dispatchWarRoomMasterTool`'s NOTIFY-AND-PLAY model (no HITL
4
- * pause): playing back the user's own recording is non-destructive, so the tool
5
- * runs immediately, the result posts, and the suspended loop resumes once.
6
- *
7
- * Safety without an approval gate:
8
- * 1. Args are Zod-validated before anything runs (malformed ⇒ clean error).
9
- * 2. The handler resolves its target session and refuses cleanly (`ok:false`)
10
- * when none is bound — never guesses.
11
- * 3. Every result goes through the single `submitToolResult` funnel so the
12
- * hard-suspended loop resumes exactly once. We never throw.
3
+ * result in the NOTIFY-AND-PLAY model (no HITL pause): playing back the user's
4
+ * own recording is non-destructive, so the tool runs immediately, the result
5
+ * posts, and the suspended loop resumes once. The shared behaviour lives in
6
+ * `createNotifyAndPlayDispatcher`; this file only names the scribe family.
13
7
  */
14
- import type { ChatRootState } from "../../../store/root-state.js";
15
- export interface DispatchScribeToolPayload {
16
- conversationId: string;
17
- requestId: string;
18
- callId: string;
19
- toolName: string;
20
- args: Record<string, unknown>;
21
- }
22
- export declare const dispatchScribeTool: import("@reduxjs/toolkit").AsyncThunk<void, DispatchScribeToolPayload, {
8
+ import { type NotifyAndPlayPayload } from "../../redux/execution-system/thunks/notify-and-play-dispatcher.js";
9
+ export type DispatchScribeToolPayload = NotifyAndPlayPayload;
10
+ export declare const dispatchScribeTool: import("@reduxjs/toolkit").AsyncThunk<void, NotifyAndPlayPayload, {
23
11
  dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction>;
24
12
  extra?: unknown;
25
13
  rejectValue?: unknown;
@@ -27,5 +15,47 @@ export declare const dispatchScribeTool: import("@reduxjs/toolkit").AsyncThunk<v
27
15
  pendingMeta?: unknown;
28
16
  fulfilledMeta?: unknown;
29
17
  rejectedMeta?: unknown;
30
- state: ChatRootState;
18
+ state: {
19
+ voiceAgent: import("../../../voice-agent/types.js").VoiceAgentState;
20
+ agentDefinition: import("../../types/agent-definition.types.js").AgentDefinitionSliceState;
21
+ conversationList: import("../../redux/conversation-list/conversation-list.types.js").ConversationListState;
22
+ conversationHistory: import("../../redux/conversation-history/types.js").ConversationHistoryState;
23
+ agentShortcut: import("../../redux/agent-shortcuts/types.js").AgentShortcutSliceState;
24
+ agentShortcutCategory: import("../../redux/agent-shortcut-categories/types.js").AgentShortcutCategorySliceState;
25
+ surfaceUserState: import("../../../surfaces/redux/userStateSlice.js").SurfaceUserStateSlice;
26
+ conversations: import("../../redux/execution-system/conversations/conversations.slice.js").ConversationsState;
27
+ chatIncognito: import("../../redux/chat/chat-incognito.slice.js").ChatIncognitoState;
28
+ chatRoute: import("../../redux/chat/chat-route.slice.js").ChatRouteState;
29
+ instanceModelOverrides: import("../../redux/execution-system/instance-model-overrides/instance-model-overrides.slice.js").InstanceModelOverridesState;
30
+ instanceInputCapabilities: import("../../redux/execution-system/instance-input-capabilities/instance-input-capabilities.slice.js").InstanceInputCapabilitiesState;
31
+ instanceVariableValues: import("../../redux/execution-system/instance-variable-values/instance-variable-values.slice.js").InstanceVariableValuesState;
32
+ instanceResources: import("../../redux/execution-system/instance-resources/instance-resources.slice.js").InstanceResourcesState;
33
+ instanceContext: import("../../redux/execution-system/instance-context/instance-context.slice.js").InstanceContextState;
34
+ instanceWorkingDocument: import("../../redux/execution-system/instance-working-document/instance-working-document.slice.js").InstanceWorkingDocumentSliceState;
35
+ instanceUserInput: import("../../redux/execution-system/instance-user-input/instance-user-input.slice.js").InstanceUserInputSliceState;
36
+ instanceClientTools: import("../../redux/execution-system/instance-client-tools/instance-client-tools.slice.js").InstanceClientToolsState;
37
+ pendingAsks: import("../../ui-first-tools/redux/pending-asks.slice.js").PendingAsksState;
38
+ conversationInbox: import("../../redux/execution-system/inbox/inbox.slice.js").ConversationInboxState;
39
+ agentLists: import("../../ui-first-tools/redux/agent-lists.slice.js").AgentListsState;
40
+ instanceUIState: import("../../redux/execution-system/instance-ui-state/instance-ui-state.slice.js").InstanceUIStateSlice;
41
+ activeTools: import("../../redux/execution-system/active-tools/active-tools.slice.js").ActiveToolsState;
42
+ activeRequests: import("../../redux/execution-system/active-requests/active-requests.slice.js").ActiveRequestsState;
43
+ runSets: import("../../redux/execution-system/run-sets/run-sets.slice.js").RunSetsState;
44
+ messages: import("../../redux/execution-system/messages/messages.slice.js").MessagesState;
45
+ observability: import("../../redux/execution-system/observability/observability.slice.js").ObservabilityState;
46
+ contextState: import("../../redux/execution-system/context-state/context-state.slice.js").ContextStateSliceState;
47
+ observationalMemory: import("../../redux/execution-system/observational-memory/observational-memory.slice.js").ObservationalMemoryState;
48
+ cacheBypass: import("../../redux/execution-system/message-crud/cache-bypass.slice.js").CacheBypassState;
49
+ conversationFocus: import("../../redux/execution-system/conversation-focus/conversation-focus.slice.js").ConversationFocusState;
50
+ surfaces: import("../../redux/surfaces/surfaces.slice.js").SurfacesState;
51
+ surfacesCatalog: import("../../../surfaces/redux/surfacesCatalogSlice.js").SurfacesCatalogSliceState;
52
+ agentSurfaceBindings: import("../../../surfaces/redux/agentSurfaceBindingsSlice.js").AgentSurfaceBindingsSliceState;
53
+ surfaceConfig: import("../../../surfaces/redux/surfaceConfigSlice.js").SurfaceConfigSliceState;
54
+ agentAssistantMarkdownDraft: import("../../redux/agent-assistant-markdown-draft.slice.js").AgentAssistantMarkdownDraftState;
55
+ mcp: import("../../redux/mcp/mcp.slice.js").McpSliceState;
56
+ proposedDirectives: import("../../redux/proposed-directives/proposedDirectivesSlice.js").ProposedDirectivesState;
57
+ conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
58
+ chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
59
+ hostConversations: import("../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
60
+ } & import("../../../store/root-state.js").ChatHostReadSlices;
31
61
  }>;
@@ -1,106 +1,14 @@
1
- import { createAsyncThunk } from "@reduxjs/toolkit";
2
- import { extractErrorMessage } from "@ai-matrx/data/net";
3
- import { submitToolResult } from "../../api/submit-tool-results.js";
4
- import { upsertToolLifecycle } from "../../redux/execution-system/active-requests/active-requests.slice.js";
1
+ import {
2
+ createNotifyAndPlayDispatcher
3
+ } from "../../redux/execution-system/thunks/notify-and-play-dispatcher.js";
5
4
  import { getScribeToolEntry } from "../tools/registry.js";
6
5
  import { isScribeToolName } from "../tools/names.js";
7
- const dispatchScribeTool = createAsyncThunk(
8
- "scribeTools/dispatch",
9
- async ({ conversationId, requestId, callId, toolName, args }, { dispatch, getState }) => {
10
- const state = getState();
11
- const userId = state.userAuth?.id ?? null;
12
- const fail = (errorType, message, durationMs) => {
13
- dispatch(
14
- upsertToolLifecycle({
15
- requestId,
16
- callId,
17
- toolName,
18
- status: "error",
19
- isDelegated: true,
20
- errorType,
21
- errorMessage: message,
22
- result: { ok: false, reason: errorType, message }
23
- })
24
- );
25
- dispatch(
26
- submitToolResult({
27
- conversationId,
28
- call_id: callId,
29
- tool_name: toolName,
30
- is_error: true,
31
- output: { ok: false, reason: errorType, message },
32
- error_message: message,
33
- ...durationMs !== void 0 ? { duration_ms: durationMs } : {}
34
- })
35
- );
36
- };
37
- const complete = (output, durationMs) => {
38
- dispatch(
39
- upsertToolLifecycle({
40
- requestId,
41
- callId,
42
- toolName,
43
- status: "completed",
44
- isDelegated: true,
45
- result: output
46
- })
47
- );
48
- dispatch(
49
- submitToolResult({
50
- conversationId,
51
- call_id: callId,
52
- tool_name: toolName,
53
- is_error: false,
54
- output,
55
- duration_ms: durationMs
56
- })
57
- );
58
- };
59
- if (!userId) {
60
- fail("unauthenticated", "user not authenticated");
61
- return;
62
- }
63
- if (!isScribeToolName(toolName)) {
64
- fail("unknown_tool", `Unknown scribe tool: ${toolName}`);
65
- return;
66
- }
67
- const entry = getScribeToolEntry(toolName);
68
- if (!entry) {
69
- fail("unknown_tool", `Unknown scribe tool: ${toolName}`);
70
- return;
71
- }
72
- const parsed = entry.schema.safeParse(args);
73
- if (!parsed.success) {
74
- fail(
75
- "schema",
76
- `args failed schema for ${toolName}: ${JSON.stringify(
77
- parsed.error.format()
78
- )}`
79
- );
80
- return;
81
- }
82
- const startedAt = performance.now();
83
- try {
84
- const result = await entry.handler.run(parsed.data, {
85
- conversationId,
86
- callId,
87
- userId,
88
- dispatch,
89
- getState
90
- });
91
- complete(
92
- result,
93
- Math.round(performance.now() - startedAt)
94
- );
95
- } catch (cause) {
96
- fail(
97
- "handler_threw",
98
- extractErrorMessage(cause),
99
- Math.round(performance.now() - startedAt)
100
- );
101
- }
102
- }
103
- );
6
+ const dispatchScribeTool = createNotifyAndPlayDispatcher({
7
+ typePrefix: "scribeTools/dispatch",
8
+ family: "scribe",
9
+ isToolName: isScribeToolName,
10
+ getEntry: getScribeToolEntry
11
+ });
104
12
  export {
105
13
  dispatchScribeTool
106
14
  };
@@ -63,6 +63,14 @@ export type ToolSpec = ToolSpecRegistered | ToolSpecInline | ToolSpecAgent;
63
63
  * Unknown capability names cause the backend to return 422.
64
64
  */
65
65
  export type ClientCapabilityName = "editor-state" | "sandbox-fs" | "agent-fs" | "desktop-native" | "widget-handle";
66
+ /**
67
+ * A capability name a HOST contributes per turn (`registry.contextSources` — e.g. `browser-dom` from a
68
+ * browser extension). Open by design: the server validates it (unknown → 422). The package's own
69
+ * providers stay keyed on the closed `ClientCapabilityName`, so their payloads keep full typing.
70
+ */
71
+ export type HostCapabilityName = string & {
72
+ readonly __hostCapability?: true;
73
+ };
66
74
  /**
67
75
  * Wire payload for `client.state["desktop-native"]`. Mirrors aidream's
68
76
  * `DesktopNativePayload` (packages/matrx-ai/matrx_ai/capabilities/desktop_native.py)
@@ -142,10 +150,13 @@ export interface ClientContext {
142
150
  * declare both.
143
151
  */
144
152
  surface?: string;
145
- capabilities: ClientCapabilityName[];
153
+ /** The package's own capabilities plus any a host contributes (`registry.contextSources`). */
154
+ capabilities: Array<ClientCapabilityName | HostCapabilityName>;
146
155
  state: Partial<{
147
156
  [K in ClientCapabilityName]: ClientCapabilityPayloads[K];
148
- }>;
157
+ }> & {
158
+ [hostCapability: string]: Record<string, unknown>;
159
+ };
149
160
  /** Session-only MCP server slugs merged into config.mcp_servers on the host. */
150
161
  mcp?: string[];
151
162
  }
@@ -153,4 +164,9 @@ export interface ToolInjectionResult {
153
164
  tools?: ToolSpec[];
154
165
  tools_replace?: ToolSpec[] | null;
155
166
  client?: ClientContext;
167
+ /**
168
+ * Context entries the host contributed for this turn (`registry.contextSources`). Request builders merge
169
+ * them UNDER the request's own `context` (`mergeHostTurnContext`) — never over a key already set.
170
+ */
171
+ hostContext?: Readonly<Record<string, unknown>>;
156
172
  }
@@ -16,7 +16,7 @@ export declare const selectAgentTaskCounts: (conversationId: string) => ((state:
16
16
  voiceAgent: import("../../../voice-agent/types.js").VoiceAgentState;
17
17
  agentDefinition: import("../../types/agent-definition.types.js").AgentDefinitionSliceState;
18
18
  conversationList: import("../../redux/conversation-list/conversation-list.types.js").ConversationListState;
19
- conversationHistory: import("../../redux/conversation-history/index.js").ConversationHistoryState;
19
+ conversationHistory: import("../../redux/conversation-history/types.js").ConversationHistoryState;
20
20
  agentShortcut: import("../../redux/agent-shortcuts/types.js").AgentShortcutSliceState;
21
21
  agentShortcutCategory: import("../../redux/agent-shortcut-categories/types.js").AgentShortcutCategorySliceState;
22
22
  surfaceUserState: import("../../../surfaces/redux/userStateSlice.js").SurfaceUserStateSlice;
@@ -99,7 +99,7 @@ export declare const selectUserTodoCounts: (conversationId: string) => ((state:
99
99
  voiceAgent: import("../../../voice-agent/types.js").VoiceAgentState;
100
100
  agentDefinition: import("../../types/agent-definition.types.js").AgentDefinitionSliceState;
101
101
  conversationList: import("../../redux/conversation-list/conversation-list.types.js").ConversationListState;
102
- conversationHistory: import("../../redux/conversation-history/index.js").ConversationHistoryState;
102
+ conversationHistory: import("../../redux/conversation-history/types.js").ConversationHistoryState;
103
103
  agentShortcut: import("../../redux/agent-shortcuts/types.js").AgentShortcutSliceState;
104
104
  agentShortcutCategory: import("../../redux/agent-shortcut-categories/types.js").AgentShortcutCategorySliceState;
105
105
  surfaceUserState: import("../../../surfaces/redux/userStateSlice.js").SurfaceUserStateSlice;
@@ -13,7 +13,8 @@
13
13
  * promise wiring lives in `pending-asks.thunks.ts` to avoid storing
14
14
  * non-serializable callbacks in Redux.
15
15
  */
16
- import type { AskUserResponse, UserAskOption } from "../tools/schemas.js";
16
+ import type { AskUserResponse } from "../tools/ask-response.js";
17
+ import type { UserAskOption } from "../tools/schemas.js";
17
18
  import type { ApprovalChange } from "../ui/approval-types.js";
18
19
  export type PendingAskKind = "confirm" | "choice" | "choice_many" | "text" | "secret" | "notify" | "plan_approval" | "takeover" | "approval" | "email_review";
19
20
  export type PendingAskStatus = "pending" | "resolved" | "cancelled" | "expired";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./pending-asks.slice.js";
7
7
  import { resolveAskByCallId, cancelAskByCallId } from "./ask-resolver-registry.js";
8
8
  import { getAskDraft } from "./ask-draft-registry.js";
9
- import { EMPTY_ASK_RESPONSE } from "../tools/schemas.js";
9
+ import { EMPTY_ASK_RESPONSE } from "../tools/ask-response.js";
10
10
  const ASK_KINDS_DECIDED_ONLY_ON_THEIR_CARD = /* @__PURE__ */ new Set([
11
11
  "approval",
12
12
  "plan_approval",
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The ask-user response envelope and its empty value: plain data, no zod. Kept out of `schemas.ts`
3
+ * so the code that only builds or carries a response does not pull the schema library into the
4
+ * first chat screen.
5
+ */
6
+ /**
7
+ * Unified ask-user response envelope (matches the matrx-extend contract).
8
+ * Exactly one of {answer, selected, confirmed, action+freeform} is populated
9
+ * for non-cancelled / non-timed-out responses, depending on the input `type`.
10
+ */
11
+ export interface AskUserResponse {
12
+ answer: string | null;
13
+ selected: string[] | null;
14
+ confirmed: boolean | null;
15
+ action: string | null;
16
+ freeform: string | null;
17
+ /** Optional freeform note the user attached ALONGSIDE their structured answer. */
18
+ additional_instructions: string | null;
19
+ /** True when the user declined the structured question(s) and typed a freeform reply (in `freeform`). */
20
+ wrote_instead: boolean;
21
+ /**
22
+ * Structured payload from a card that carries its own shape (the Gmail review
23
+ * card returns the exact bytes it sent). Null for every plain ask.
24
+ */
25
+ data: Record<string, unknown> | null;
26
+ cancelled: boolean;
27
+ timed_out: boolean;
28
+ }
29
+ export declare const EMPTY_ASK_RESPONSE: AskUserResponse;
@@ -0,0 +1,15 @@
1
+ const EMPTY_ASK_RESPONSE = {
2
+ answer: null,
3
+ selected: null,
4
+ confirmed: null,
5
+ action: null,
6
+ freeform: null,
7
+ additional_instructions: null,
8
+ wrote_instead: false,
9
+ data: null,
10
+ cancelled: false,
11
+ timed_out: false
12
+ };
13
+ export {
14
+ EMPTY_ASK_RESPONSE
15
+ };
@@ -216,30 +216,9 @@ export interface GoogleEmailSendResult {
216
216
  from_email?: string | null;
217
217
  error?: string;
218
218
  }
219
- /**
220
- * Unified ask-user response envelope (matches the matrx-extend contract).
221
- * Exactly one of {answer, selected, confirmed, action+freeform} is populated
222
- * for non-cancelled / non-timed-out responses, depending on the input `type`.
223
- */
224
- export interface AskUserResponse {
225
- answer: string | null;
226
- selected: string[] | null;
227
- confirmed: boolean | null;
228
- action: string | null;
229
- freeform: string | null;
230
- /** Optional freeform note the user attached ALONGSIDE their structured answer. */
231
- additional_instructions: string | null;
232
- /** True when the user declined the structured question(s) and typed a freeform reply (in `freeform`). */
233
- wrote_instead: boolean;
234
- /**
235
- * Structured payload from a card that carries its own shape (the Gmail review
236
- * card returns the exact bytes it sent). Null for every plain ask.
237
- */
238
- data: Record<string, unknown> | null;
239
- cancelled: boolean;
240
- timed_out: boolean;
241
- }
242
- export declare const EMPTY_ASK_RESPONSE: AskUserResponse;
219
+ export { EMPTY_ASK_RESPONSE } from "./ask-response.js";
220
+ export type { AskUserResponse } from "./ask-response.js";
221
+ import type { AskUserResponse } from "./ask-response.js";
243
222
  /**
244
223
  * Batched response — emitted when the `user` tool was called with
245
224
  * `questions: SingleQuestion[]`. Each entry in `answers` matches the
@@ -256,4 +235,3 @@ export interface BatchedAskUserResponse {
256
235
  /** True when the user took the write-instead escape on any question (short-circuits the batch). */
257
236
  wrote_instead: boolean;
258
237
  }
259
- export {};
@@ -158,18 +158,7 @@ const googleEmailSendArgsSchema = z.object({
158
158
  subject: z.string().min(1).max(998),
159
159
  body: z.string().min(1).max(1e5)
160
160
  });
161
- const EMPTY_ASK_RESPONSE = {
162
- answer: null,
163
- selected: null,
164
- confirmed: null,
165
- action: null,
166
- freeform: null,
167
- additional_instructions: null,
168
- wrote_instead: false,
169
- data: null,
170
- cancelled: false,
171
- timed_out: false
172
- };
161
+ import { EMPTY_ASK_RESPONSE } from "./ask-response.js";
173
162
  export {
174
163
  EMPTY_ASK_RESPONSE,
175
164
  googleEmailSendArgsSchema,
@@ -23,7 +23,7 @@ import { cn } from "@ai-matrx/design-system";
23
23
  import { useAppDispatch } from "../../../store/hooks.js";
24
24
  import { resolvePendingAsk } from "../redux/pending-asks.slice.js";
25
25
  import { resolveAskByCallId } from "../redux/ask-resolver-registry.js";
26
- import { EMPTY_ASK_RESPONSE } from "../tools/schemas.js";
26
+ import { EMPTY_ASK_RESPONSE } from "../tools/ask-response.js";
27
27
  import { REMEMBER_SENTINEL } from "./approval-types.js";
28
28
  import { AgentCardShell } from "./AgentCardShell.js";
29
29
  const VERB_META = {
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import { type ReactNode } from "react";
15
15
  import type { PendingAsk } from "../redux/pending-asks.slice.js";
16
- import type { AskUserResponse } from "../tools/schemas.js";
16
+ import { type AskUserResponse } from "../tools/ask-response.js";
17
17
  /** What the wizard hands back: one envelope per question, by position. */
18
18
  export interface AskWizardResult {
19
19
  answers: AskUserResponse[];
@@ -4,7 +4,7 @@ import { useMemo, useState } from "react";
4
4
  import { ChevronLeft, ChevronRight } from "lucide-react";
5
5
  import { Textarea } from "@ai-matrx/design-system";
6
6
  import { cn } from "@ai-matrx/design-system";
7
- import { EMPTY_ASK_RESPONSE } from "../tools/schemas.js";
7
+ import { EMPTY_ASK_RESPONSE } from "../tools/ask-response.js";
8
8
  import { getAskDraft, setAskDraft } from "../redux/ask-draft-registry.js";
9
9
  import { AskCardCountdown } from "./AskCardCountdown.js";
10
10
  import { AgentCardShell } from "./AgentCardShell.js";
@@ -1,7 +1,7 @@
1
1
  import type { VariableDefinition } from "../agents/types/agent-definition.types.js";
2
2
  import type { Resource } from "../agents/resources/types.js";
3
- export type { ApiMode, ChatModeConfig, MessageRole, MessageStatus, SessionStatus, SessionUIState, ConversationMessage, ConversationResource, ConversationSession, ChatConversationsState, StartSessionPayload, AddMessagePayload, UpdateMessagePayload, AppendStreamChunkPayload, PushStreamEventPayload, SetConversationIdPayload, SetCurrentInputPayload, UpdateVariablePayload, SetExpandedVariablePayload, AddResourcePayload, RemoveResourcePayload, UpdateUIStatePayload, LoadConversationPayload, } from "./types/conversation.js";
4
- import type { SessionUIState, ConversationMessage, ConversationResource, ConversationSession, ApiMode, SessionStatus } from "./types/conversation.js";
3
+ export type { ApiMode, ChatModeConfig, MessageRole, MessageStatus, SessionStatus, SessionUIState, FlatConversationMessage, ConversationResource, ConversationSession, ChatConversationsState, StartSessionPayload, AddMessagePayload, UpdateMessagePayload, AppendStreamChunkPayload, PushStreamEventPayload, SetConversationIdPayload, SetCurrentInputPayload, UpdateVariablePayload, SetExpandedVariablePayload, AddResourcePayload, RemoveResourcePayload, UpdateUIStatePayload, LoadConversationPayload, } from "./types/conversation.js";
4
+ import type { SessionUIState, FlatConversationMessage, ConversationResource, ConversationSession, ApiMode, SessionStatus } from "./types/conversation.js";
5
5
  export interface ActiveChatAgent {
6
6
  promptId?: string;
7
7
  name?: string;
@@ -168,8 +168,8 @@ export declare const editMessage: StubThunk<{
168
168
  newContent?: unknown;
169
169
  }>;
170
170
  export declare const selectSession: (_state: unknown, _sessionId?: string) => ConversationSession;
171
- export declare const selectMessages: (_state: unknown, _sessionId?: string) => ConversationMessage[];
172
- export declare const selectGroupedMessages: (_state: unknown, _sessionId?: string) => ConversationMessage[];
171
+ export declare const selectMessages: (_state: unknown, _sessionId?: string) => FlatConversationMessage[];
172
+ export declare const selectGroupedMessages: (_state: unknown, _sessionId?: string) => FlatConversationMessage[];
173
173
  export declare const selectResources: (_state: unknown, _sessionId?: string) => ConversationResource[];
174
174
  export declare const selectUIState: (_state: unknown, _sessionId?: string) => SessionUIState;
175
175
  export declare const selectIsStreaming: (_state: unknown, _sessionId?: string) => boolean;
@@ -185,7 +185,7 @@ export declare const selectShowVariables: (_state: unknown, _sessionId?: string)
185
185
  export declare const selectShowDebugInfo: (_state: unknown, _sessionId?: string) => boolean;
186
186
  export declare const selectShowSystemMessages: (_state: unknown, _sessionId?: string) => boolean;
187
187
  export declare const selectSessionHasUnsavedChanges: (_state: unknown, _sessionId?: string) => boolean;
188
- export declare const selectDirtyMessages: (_state: unknown, _sessionId?: string) => ConversationMessage[];
188
+ export declare const selectDirtyMessages: (_state: unknown, _sessionId?: string) => FlatConversationMessage[];
189
189
  export declare const selectMessageHasUnsavedChanges: (_state: unknown, _sessionId?: string, _messageId?: string) => boolean;
190
190
  export declare const selectActiveChatAgent: (_state: unknown) => ActiveChatAgent;
191
191
  export declare const selectTurnCount: (_conversationId: string) => (_state: unknown) => number;
@@ -21,14 +21,12 @@ import { ShareModal } from "../../host/ui-slots.js";
21
21
  import { useAppDispatch, useAppSelector } from "../../store/hooks.js";
22
22
  import { idMatchesQuery } from "@ai-matrx/kit/search-scoring";
23
23
  import { ReadFailure } from "../../host/ui-slots.js";
24
+ import { selectConversationIsPending } from "../../agents/redux/conversation-list/conversation-list.selectors.js";
25
+ import { fetchConversationHistory } from "../../agents/redux/conversation-history/thunks.js";
24
26
  import {
25
- selectConversationIsPending,
26
- selectGlobalConversationList,
27
- selectGlobalListError,
28
- selectGlobalListHasMore,
29
- selectGlobalListStatus
30
- } from "../../agents/redux/conversation-list/conversation-list.selectors.js";
31
- import { fetchGlobalConversations } from "../../agents/redux/conversation-list/conversation-list.thunks.js";
27
+ makeSelectConversationHistoryItems,
28
+ makeSelectConversationHistoryStatus
29
+ } from "../../agents/redux/conversation-history/selectors.js";
32
30
  const toSidebarItem = (c) => ({
33
31
  id: c.conversationId,
34
32
  title: conversationTitleText(c.title),
@@ -36,7 +34,9 @@ const toSidebarItem = (c) => ({
36
34
  messageCount: c.messageCount,
37
35
  status: c.status
38
36
  });
39
- const selectSidebarConversations = (state) => selectGlobalConversationList(state);
37
+ const SIDEBAR_SCOPE_ID = "cx-chat-sidebar";
38
+ const selectSidebarConversations = makeSelectConversationHistoryItems(SIDEBAR_SCOPE_ID);
39
+ const selectSidebarStatus = makeSelectConversationHistoryStatus(SIDEBAR_SCOPE_ID);
40
40
  import { conversationTitleText } from "@ai-matrx/content-ir/surfaces";
41
41
  const GROUP_ORDER = ["Today", "Yesterday", "This Week", "This Month", "Older"];
42
42
  function groupByTime(items) {
@@ -274,20 +274,18 @@ function SsrSidebarChats({
274
274
  const isAuthenticated = !!useSelector(selectUserId);
275
275
  const conversations = useAppSelector(selectSidebarConversations);
276
276
  const items = conversations.map(toSidebarItem);
277
- const listStatus = useAppSelector(selectGlobalListStatus);
278
- const listError = useAppSelector(selectGlobalListError);
279
- const hasMore = useAppSelector(selectGlobalListHasMore);
277
+ const { status: listStatus, error: listError, hasMore } = useAppSelector(selectSidebarStatus);
280
278
  const isLoading = listStatus === "loading" || listStatus === "idle";
281
279
  const reload = () => {
282
- void dispatch(fetchGlobalConversations({ replace: true }));
280
+ void dispatch(fetchConversationHistory({ scopeId: SIDEBAR_SCOPE_ID, replace: true }));
283
281
  };
284
282
  useEffect(() => {
285
283
  if (!isAuthenticated) return;
286
- void dispatch(fetchGlobalConversations({ replace: true }));
284
+ void dispatch(fetchConversationHistory({ scopeId: SIDEBAR_SCOPE_ID, replace: true }));
287
285
  }, [dispatch, isAuthenticated]);
288
286
  useEffect(() => {
289
287
  const handleChanged = () => {
290
- void dispatch(fetchGlobalConversations({ replace: true }));
288
+ void dispatch(fetchConversationHistory({ scopeId: SIDEBAR_SCOPE_ID, replace: true }));
291
289
  };
292
290
  window.addEventListener("chat:conversationCreated", handleChanged);
293
291
  window.addEventListener("chat:conversationUpdated", handleChanged);
@@ -311,7 +309,7 @@ function SsrSidebarChats({
311
309
  (entries) => {
312
310
  if (entries[0].isIntersecting) {
313
311
  void dispatch(
314
- fetchGlobalConversations({ offset: items.length, replace: false })
312
+ fetchConversationHistory({ scopeId: SIDEBAR_SCOPE_ID, replace: false })
315
313
  );
316
314
  }
317
315
  },
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import type { ConversationMessage } from "../../types/conversation.js";
2
+ import type { FlatConversationMessage } from "../../types/conversation.js";
3
3
  interface UserMessageProps {
4
- message: ConversationMessage;
4
+ message: FlatConversationMessage;
5
5
  onContentChange?: (messageId: string, newContent: string) => void;
6
6
  compact?: boolean;
7
7
  }
@@ -11,7 +11,7 @@
11
11
  import type { TypedStreamEvent } from "@ai-matrx/agents/generated/stream-events";
12
12
  import type { LLMParams } from "../../host/server/types.js";
13
13
  import type { Json } from "../../host/db-types.js";
14
- import type { CxToolCall, CxContentBlock, CxContentHistoryEntry } from "./cx-tables.js";
14
+ import type { CxToolCall, CxContentBlock, CxContentHistoryEntry } from "../../public-chat/types/cx-tables.js";
15
15
  import type { VariableDefinition } from "../../agents/types/agent-definition.types.js";
16
16
  export type MessageRole = "system" | "user" | "assistant";
17
17
  export type MessageStatus = "pending" | "streaming" | "complete" | "error";
@@ -19,7 +19,7 @@ export interface ConversationResource {
19
19
  type: string;
20
20
  data: Record<string, unknown>;
21
21
  }
22
- export interface ConversationMessage {
22
+ export interface FlatConversationMessage {
23
23
  id: string;
24
24
  /** Display role for rendering: 'user' | 'assistant' | 'system' */
25
25
  role: MessageRole;
@@ -151,7 +151,7 @@ export interface ConversationSession {
151
151
  variableDefaults: VariableDefinition[];
152
152
  /** Whether this session needs variable replacement before first execution */
153
153
  requiresVariableReplacement: boolean;
154
- messages: ConversationMessage[];
154
+ messages: FlatConversationMessage[];
155
155
  /**
156
156
  * All CxToolCall records for this conversation, keyed by call_id.
157
157
  * Populated when loading a conversation from DB.
@@ -187,7 +187,7 @@ export interface StartSessionPayload {
187
187
  }
188
188
  export interface AddMessagePayload {
189
189
  sessionId: string;
190
- message: Omit<ConversationMessage, "id" | "timestamp"> & {
190
+ message: Omit<FlatConversationMessage, "id" | "timestamp"> & {
191
191
  id?: string;
192
192
  timestamp?: string;
193
193
  };
@@ -195,7 +195,7 @@ export interface AddMessagePayload {
195
195
  export interface UpdateMessagePayload {
196
196
  sessionId: string;
197
197
  messageId: string;
198
- updates: Partial<ConversationMessage>;
198
+ updates: Partial<FlatConversationMessage>;
199
199
  }
200
200
  export interface AppendStreamChunkPayload {
201
201
  sessionId: string;
@@ -239,7 +239,7 @@ export interface UpdateUIStatePayload {
239
239
  export interface LoadConversationPayload {
240
240
  sessionId: string;
241
241
  conversationId: string;
242
- messages: ConversationMessage[];
242
+ messages: FlatConversationMessage[];
243
243
  agentId: string;
244
244
  variableDefaults?: VariableDefinition[];
245
245
  /** All CxToolCall records for the conversation, keyed by call_id */
@@ -6,5 +6,5 @@
6
6
  * current display content. For streamed messages or when rawContent only contains
7
7
  * simple text, it returns a single text block.
8
8
  */
9
- import type { CxContentBlock } from "../types/cx-tables.js";
9
+ import type { CxContentBlock } from "../../public-chat/types/cx-tables.js";
10
10
  export declare function buildContentBlocksForSave(currentContent: string, rawContent?: unknown[]): CxContentBlock[];
@@ -10,7 +10,7 @@
10
10
  * `features/tool-call-visualization` and the agent execution slice, so
11
11
  * this converter intentionally drops tool_call / tool_result blocks.
12
12
  */
13
- import type { CxContentBlock, CxMessage, CxToolCall } from "../types/cx-tables.js";
13
+ import type { CxContentBlock, CxMessage, CxToolCall } from "../../public-chat/types/cx-tables.js";
14
14
  import type { Json } from "../../host/db-types.js";
15
15
  /** Result of converting a single message's content blocks */
16
16
  export interface ConvertedMessageContent {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { TooltipProvider } from "@ai-matrx/design-system";
4
+ import { ConfirmDialogHost, TooltipProvider } from "@ai-matrx/design-system";
5
5
  import { createAssociationsStore } from "@ai-matrx/associations/core";
6
6
  import { AssociationsProvider } from "@ai-matrx/associations/react";
7
7
  import { AgentCatalogProvider } from "@ai-matrx/agents/catalog/react";
@@ -10,6 +10,8 @@ import { ModelCatalogProvider } from "@ai-matrx/agents/models/react";
10
10
  import { hasChatScopes, registerChatScopes } from "../context/sources/scopes.js";
11
11
  import { configureBareFilesHost } from "./defaults/files-host.js";
12
12
  import { registerBareReadableBlocks } from "./defaults/bare-block-dispatch.js";
13
+ import { installBareHostSpeech } from "./defaults/voice.js";
14
+ import { BareMediaProvider } from "./defaults/media-client.js";
13
15
  const SAVE_REASON = "save this";
14
16
  function BareHostChrome({ host, children }) {
15
17
  const [associations] = useState(
@@ -37,12 +39,16 @@ function BareHostChrome({ host, children }) {
37
39
  });
38
40
  useState(() => configureBareFilesHost(host));
39
41
  useState(() => registerBareReadableBlocks());
42
+ useState(() => installBareHostSpeech(host));
40
43
  const [catalog] = useState(() => host.catalog());
41
44
  const [models] = useState(() => ({
42
45
  catalog: createModelCatalog({ client: host.db }),
43
46
  favorites: createModelFavorites({ client: host.db })
44
47
  }));
45
- return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsx(AgentCatalogProvider, { catalog, children: /* @__PURE__ */ jsx(AssociationsProvider, { store: associations, children: /* @__PURE__ */ jsx(ModelCatalogProvider, { catalog: models.catalog, favorites: models.favorites, children }) }) }) });
48
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsx(AgentCatalogProvider, { catalog, children: /* @__PURE__ */ jsx(AssociationsProvider, { store: associations, children: /* @__PURE__ */ jsx(BareMediaProvider, { host, children: /* @__PURE__ */ jsxs(ModelCatalogProvider, { catalog: models.catalog, favorites: models.favorites, children: [
49
+ children,
50
+ /* @__PURE__ */ jsx(ConfirmDialogHost, {})
51
+ ] }) }) }) }) });
46
52
  }
47
53
  export {
48
54
  BareHostChrome