@dxos/plugin-assistant 0.8.4-main.422d1c7879 → 0.8.4-main.51f1e5ca51

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 (400) hide show
  1. package/dist/lib/browser/AssistantSettings-GG52BLKS.mjs +40 -0
  2. package/dist/lib/browser/AssistantSettings-GG52BLKS.mjs.map +7 -0
  3. package/dist/lib/browser/blueprints/index.mjs +26 -3
  4. package/dist/lib/browser/blueprints/index.mjs.map +4 -4
  5. package/dist/lib/browser/{chunk-ATHYBVGN.mjs → chunk-RIJNPAYC.mjs} +5 -5
  6. package/dist/lib/browser/chunk-RIJNPAYC.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-LMVTXH54.mjs → chunk-SEMCG4ZK.mjs} +58 -17
  8. package/dist/lib/browser/chunk-SEMCG4ZK.mjs.map +7 -0
  9. package/dist/lib/browser/cli/index.mjs +3 -4
  10. package/dist/lib/browser/cli/index.mjs.map +3 -3
  11. package/dist/lib/browser/{create-chat-LBZHGVSN.mjs → create-chat-FZJASOQS.mjs} +5 -13
  12. package/dist/lib/browser/create-chat-FZJASOQS.mjs.map +7 -0
  13. package/dist/lib/browser/{ensure-companion-chat-ZEZA34MZ.mjs → ensure-companion-chat-PHUWWFVY.mjs} +4 -4
  14. package/dist/lib/browser/ensure-companion-chat-PHUWWFVY.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +804 -880
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/meta.json +1 -1
  18. package/dist/lib/browser/{on-create-space-54RNX5JI.mjs → on-create-space-OQNCM7NC.mjs} +3 -3
  19. package/dist/lib/browser/{on-create-space-54RNX5JI.mjs.map → on-create-space-OQNCM7NC.mjs.map} +1 -1
  20. package/dist/lib/browser/operations/index.mjs +3 -3
  21. package/dist/lib/browser/operations/index.mjs.map +3 -3
  22. package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs → resolve-navigation-targets-PMNR7D3P.mjs} +3 -3
  23. package/dist/lib/browser/{resolve-navigation-targets-NZOD66NY.mjs.map → resolve-navigation-targets-PMNR7D3P.mjs.map} +1 -1
  24. package/dist/lib/browser/{run-prompt-in-new-chat-THLK5YQC.mjs → run-prompt-in-new-chat-4XDYFKCV.mjs} +10 -39
  25. package/dist/lib/browser/run-prompt-in-new-chat-4XDYFKCV.mjs.map +7 -0
  26. package/dist/lib/browser/{set-current-chat-LRS3VFSH.mjs → set-current-chat-7V4DA66I.mjs} +4 -4
  27. package/dist/lib/browser/set-current-chat-7V4DA66I.mjs.map +7 -0
  28. package/dist/lib/browser/translations.mjs +171 -0
  29. package/dist/lib/browser/translations.mjs.map +7 -0
  30. package/dist/lib/browser/types/index.mjs +1 -3
  31. package/dist/lib/browser/{update-chat-name-3Y36KFAS.mjs → update-chat-name-ZGMU2UGN.mjs} +7 -22
  32. package/dist/lib/browser/update-chat-name-ZGMU2UGN.mjs.map +7 -0
  33. package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs +41 -0
  34. package/dist/lib/node-esm/AssistantSettings-23A5IMHS.mjs.map +7 -0
  35. package/dist/lib/node-esm/blueprints/index.mjs +26 -3
  36. package/dist/lib/node-esm/blueprints/index.mjs.map +4 -4
  37. package/dist/lib/node-esm/{chunk-PXAJSTGZ.mjs → chunk-NCIZY5ZV.mjs} +5 -5
  38. package/dist/lib/node-esm/chunk-NCIZY5ZV.mjs.map +7 -0
  39. package/dist/lib/node-esm/{chunk-W3JZ2F4T.mjs → chunk-XAFVSEUJ.mjs} +58 -17
  40. package/dist/lib/node-esm/chunk-XAFVSEUJ.mjs.map +7 -0
  41. package/dist/lib/node-esm/cli/index.mjs +3 -4
  42. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  43. package/dist/lib/node-esm/{create-chat-3BEG4R6J.mjs → create-chat-RY6A4WUV.mjs} +5 -13
  44. package/dist/lib/node-esm/create-chat-RY6A4WUV.mjs.map +7 -0
  45. package/dist/lib/node-esm/{ensure-companion-chat-6K2WEWFP.mjs → ensure-companion-chat-BTDU5TS2.mjs} +4 -4
  46. package/dist/lib/node-esm/ensure-companion-chat-BTDU5TS2.mjs.map +7 -0
  47. package/dist/lib/node-esm/index.mjs +804 -880
  48. package/dist/lib/node-esm/index.mjs.map +4 -4
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs → on-create-space-4LWCYT3H.mjs} +3 -3
  51. package/dist/lib/node-esm/{on-create-space-YRPZ6HZY.mjs.map → on-create-space-4LWCYT3H.mjs.map} +1 -1
  52. package/dist/lib/node-esm/operations/index.mjs +3 -3
  53. package/dist/lib/node-esm/operations/index.mjs.map +3 -3
  54. package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs → resolve-navigation-targets-GHS3XPVP.mjs} +3 -3
  55. package/dist/lib/node-esm/{resolve-navigation-targets-3PPK7XLH.mjs.map → resolve-navigation-targets-GHS3XPVP.mjs.map} +1 -1
  56. package/dist/lib/node-esm/{run-prompt-in-new-chat-OUYKCMQ7.mjs → run-prompt-in-new-chat-UF54E34O.mjs} +10 -39
  57. package/dist/lib/node-esm/run-prompt-in-new-chat-UF54E34O.mjs.map +7 -0
  58. package/dist/lib/node-esm/{set-current-chat-SMXZJD3F.mjs → set-current-chat-SWPAOLZL.mjs} +4 -4
  59. package/dist/lib/node-esm/set-current-chat-SWPAOLZL.mjs.map +7 -0
  60. package/dist/lib/node-esm/translations.mjs +172 -0
  61. package/dist/lib/node-esm/translations.mjs.map +7 -0
  62. package/dist/lib/node-esm/types/index.mjs +1 -3
  63. package/dist/lib/node-esm/{update-chat-name-HM2P4NSI.mjs → update-chat-name-CW6K5M37.mjs} +7 -22
  64. package/dist/lib/node-esm/update-chat-name-CW6K5M37.mjs.map +7 -0
  65. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  66. package/dist/types/src/blueprints/assistant/blueprint.d.ts +2 -2
  67. package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -1
  68. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  70. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  71. package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
  72. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/index.d.ts +2 -2
  74. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
  76. package/dist/types/src/capabilities/markdown.d.ts +1 -1
  77. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  80. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
  81. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  82. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  84. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  85. package/dist/types/src/cli/plugin.d.ts.map +1 -1
  86. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +1 -1
  87. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  88. package/dist/types/src/components/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/Chat/Chat.d.ts +29 -39
  90. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  91. package/dist/types/src/components/Chat/context.d.ts +29 -0
  92. package/dist/types/src/components/Chat/context.d.ts.map +1 -0
  93. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  94. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +5 -3
  95. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  96. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +1 -1
  97. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
  98. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  99. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +28 -0
  100. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -0
  101. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  102. package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts +20 -0
  103. package/dist/types/src/components/ChatPrompt/ChatStatus.d.ts.map +1 -0
  104. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  105. package/dist/types/src/components/ChatPrompt/index.d.ts +2 -0
  106. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  107. package/dist/types/src/components/ChatThread/Anchor.stories.d.ts.map +1 -1
  108. package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -3
  109. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  110. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +4 -3
  111. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  112. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
  113. package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +1 -1
  114. package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
  115. package/dist/types/src/components/ChatThread/registry.d.ts +18 -0
  116. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
  117. package/dist/types/src/components/ChatThread/sync.d.ts +1 -1
  118. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
  119. package/dist/types/src/components/ChatThread/tool-widget-state.d.ts.map +1 -1
  120. package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts +4 -4
  121. package/dist/types/src/components/ChatThread/widgets/FallbackWidget.d.ts.map +1 -1
  122. package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.d.ts.map +1 -1
  123. package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
  124. package/dist/types/src/components/ChatThread/widgets/ReferenceWidget.d.ts.map +1 -1
  125. package/dist/types/src/components/ChatThread/widgets/SelectWidget.d.ts.map +1 -1
  126. package/dist/types/src/components/ChatThread/widgets/StatsWidget.d.ts.map +1 -1
  127. package/dist/types/src/components/ChatThread/widgets/StatusWidget.d.ts.map +1 -1
  128. package/dist/types/src/components/ChatThread/widgets/SuggestionWidget.d.ts.map +1 -1
  129. package/dist/types/src/components/ChatThread/widgets/SummaryWidget.d.ts.map +1 -1
  130. package/dist/types/src/components/ChatThread/widgets/ToolWidget.d.ts.map +1 -1
  131. package/dist/types/src/components/ChatThread/widgets/ToolWidget.stories.d.ts.map +1 -1
  132. package/dist/types/src/components/ChatThread/widgets/defaults.d.ts +5 -0
  133. package/dist/types/src/components/ChatThread/widgets/defaults.d.ts.map +1 -0
  134. package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -2
  135. package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
  136. package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +2 -1
  137. package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
  138. package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +0 -1
  139. package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
  140. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -2
  141. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  142. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  143. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +3 -3
  144. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  145. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  146. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -1
  147. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -1
  148. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +4 -4
  149. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
  150. package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
  151. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  152. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  153. package/dist/types/src/containers/AgentArticle/AgentArticle.d.ts.map +1 -1
  154. package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
  155. package/dist/types/src/containers/AgentProperties/AgentProperties.d.ts.map +1 -1
  156. package/dist/types/src/containers/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
  157. package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +1 -1
  158. package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -1
  159. package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +1 -1
  160. package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -1
  161. package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
  162. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +6 -0
  163. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -0
  164. package/dist/types/src/containers/RoutineArticle/index.d.ts +2 -0
  165. package/dist/types/src/containers/RoutineArticle/index.d.ts.map +1 -0
  166. package/dist/types/src/containers/RoutineList/RoutineList.d.ts +6 -0
  167. package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +1 -0
  168. package/dist/types/src/containers/{PromptList/PromptList.stories.d.ts → RoutineList/RoutineList.stories.d.ts} +1 -1
  169. package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +1 -0
  170. package/dist/types/src/containers/RoutineList/index.d.ts +2 -0
  171. package/dist/types/src/containers/RoutineList/index.d.ts.map +1 -0
  172. package/dist/types/src/containers/TracePanel/TracePanel.d.ts +3 -2
  173. package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
  174. package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts +1 -4
  175. package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
  176. package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts +1 -1
  177. package/dist/types/src/containers/TracePanel/dxn-extractor.d.ts.map +1 -1
  178. package/dist/types/src/containers/TracePanel/execution-graph.d.ts +81 -1
  179. package/dist/types/src/containers/TracePanel/execution-graph.d.ts.map +1 -1
  180. package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts +2 -0
  181. package/dist/types/src/containers/TracePanel/execution-graph.test.d.ts.map +1 -0
  182. package/dist/types/src/containers/TracePanel/index.d.ts.map +1 -1
  183. package/dist/types/src/containers/TracePanel/testing/index.d.ts +3 -0
  184. package/dist/types/src/containers/TracePanel/testing/index.d.ts.map +1 -0
  185. package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +14 -0
  186. package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -0
  187. package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts +12 -0
  188. package/dist/types/src/containers/TracePanel/testing/snapshot-playback.d.ts.map +1 -0
  189. package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
  190. package/dist/types/src/containers/index.d.ts +2 -2
  191. package/dist/types/src/containers/index.d.ts.map +1 -1
  192. package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
  193. package/dist/types/src/hooks/index.d.ts +2 -0
  194. package/dist/types/src/hooks/index.d.ts.map +1 -1
  195. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +1 -1
  196. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  197. package/dist/types/src/hooks/useChatKeymap.d.ts +12 -0
  198. package/dist/types/src/hooks/useChatKeymap.d.ts.map +1 -0
  199. package/dist/types/src/hooks/useChatProcessor.d.ts +1 -1
  200. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  201. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  202. package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -1
  203. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
  204. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
  205. package/dist/types/src/hooks/useDebug.d.ts +10 -0
  206. package/dist/types/src/hooks/useDebug.d.ts.map +1 -0
  207. package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
  208. package/dist/types/src/hooks/useFlush.d.ts +1 -1
  209. package/dist/types/src/hooks/useFlush.d.ts.map +1 -1
  210. package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
  211. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  212. package/dist/types/src/index.d.ts +0 -3
  213. package/dist/types/src/index.d.ts.map +1 -1
  214. package/dist/types/src/operations/create-chat.d.ts +1 -1
  215. package/dist/types/src/operations/create-chat.d.ts.map +1 -1
  216. package/dist/types/src/operations/definitions.d.ts +24 -19
  217. package/dist/types/src/operations/definitions.d.ts.map +1 -1
  218. package/dist/types/src/operations/ensure-companion-chat.d.ts +1 -1
  219. package/dist/types/src/operations/ensure-companion-chat.d.ts.map +1 -1
  220. package/dist/types/src/operations/index.d.ts +1 -1
  221. package/dist/types/src/operations/index.d.ts.map +1 -1
  222. package/dist/types/src/operations/on-create-space.d.ts +1 -1
  223. package/dist/types/src/operations/on-create-space.d.ts.map +1 -1
  224. package/dist/types/src/operations/resolve-navigation-targets.d.ts +1 -1
  225. package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
  226. package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +1 -1
  227. package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
  228. package/dist/types/src/operations/set-current-chat.d.ts +1 -1
  229. package/dist/types/src/operations/set-current-chat.d.ts.map +1 -1
  230. package/dist/types/src/operations/update-chat-name.d.ts +1 -1
  231. package/dist/types/src/operations/update-chat-name.d.ts.map +1 -1
  232. package/dist/types/src/processor/processor.d.ts +2 -2
  233. package/dist/types/src/processor/processor.d.ts.map +1 -1
  234. package/dist/types/src/queue-logger.d.ts.map +1 -1
  235. package/dist/types/src/testing/index.d.ts +1 -0
  236. package/dist/types/src/testing/index.d.ts.map +1 -1
  237. package/dist/types/src/testing/test-generator.d.ts +1 -1
  238. package/dist/types/src/testing/test-generator.d.ts.map +1 -1
  239. package/dist/types/src/testing/test-services.d.ts.map +1 -1
  240. package/dist/types/src/testing/test-trace.d.ts +5 -0
  241. package/dist/types/src/testing/test-trace.d.ts.map +1 -0
  242. package/dist/types/src/translations.d.ts.map +1 -1
  243. package/dist/types/src/types/Assistant.d.ts +22 -6
  244. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  245. package/dist/types/src/types/Settings.d.ts +20 -5
  246. package/dist/types/src/types/Settings.d.ts.map +1 -1
  247. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  248. package/dist/types/src/types/events.d.ts.map +1 -1
  249. package/dist/types/src/types/index.d.ts +0 -1
  250. package/dist/types/src/types/index.d.ts.map +1 -1
  251. package/dist/types/src/types/service.d.ts +1 -1
  252. package/dist/types/src/types/service.d.ts.map +1 -1
  253. package/dist/types/tsconfig.tsbuildinfo +1 -1
  254. package/package.json +95 -91
  255. package/src/AssistantPlugin.tsx +10 -12
  256. package/src/blueprints/assistant/blueprint.test.ts +3 -3
  257. package/src/blueprints/assistant/blueprint.ts +3 -3
  258. package/src/capabilities/app-graph-builder.ts +3 -3
  259. package/src/capabilities/blueprint-definition.ts +0 -4
  260. package/src/capabilities/index.ts +1 -1
  261. package/src/capabilities/markdown.ts +1 -1
  262. package/src/capabilities/migrations.ts +1 -8
  263. package/src/capabilities/operation-handler.ts +1 -1
  264. package/src/capabilities/react-surface.tsx +16 -10
  265. package/src/cli/plugin.ts +3 -4
  266. package/src/components/AssistantSettings/AssistantSettings.stories.tsx +3 -2
  267. package/src/components/AssistantSettings/AssistantSettings.tsx +22 -111
  268. package/src/components/Chat/Chat.tsx +56 -260
  269. package/src/components/Chat/context.ts +39 -0
  270. package/src/components/ChatPrompt/ChatActions.tsx +10 -10
  271. package/src/components/ChatPrompt/ChatOptions.stories.tsx +24 -10
  272. package/src/components/ChatPrompt/ChatOptions.tsx +60 -31
  273. package/src/components/ChatPrompt/ChatPrompt.tsx +179 -0
  274. package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
  275. package/src/components/ChatPrompt/ChatStatus.tsx +123 -0
  276. package/src/components/ChatPrompt/index.ts +2 -0
  277. package/src/components/ChatThread/ChatThread.stories.tsx +3 -3
  278. package/src/components/ChatThread/ChatThread.tsx +31 -18
  279. package/src/components/ChatThread/DEBUG.md +41 -0
  280. package/src/components/ChatThread/MarkdownStream.stories.tsx +5 -4
  281. package/src/components/ChatThread/registry.tsx +53 -14
  282. package/src/components/ChatThread/sync.test.ts +80 -12
  283. package/src/components/ChatThread/sync.ts +1 -1
  284. package/src/components/ChatThread/widgets/ReasoningWidget.ts +6 -6
  285. package/src/components/ChatThread/widgets/ReferenceWidget.ts +3 -1
  286. package/src/components/ChatThread/widgets/SelectWidget.ts +3 -1
  287. package/src/components/ChatThread/widgets/StatsWidget.ts +3 -1
  288. package/src/components/ChatThread/widgets/StatusWidget.ts +3 -1
  289. package/src/components/ChatThread/widgets/SuggestionWidget.ts +1 -1
  290. package/src/components/ChatThread/widgets/SummaryWidget.tsx +3 -2
  291. package/src/components/ChatThread/widgets/ToolWidget.stories.tsx +2 -1
  292. package/src/components/ChatThread/widgets/defaults.ts +8 -0
  293. package/src/components/ChatThread/widgets/index.ts +1 -2
  294. package/src/components/ProcessTree/ProcessTree.stories.tsx +12 -38
  295. package/src/components/ProcessTree/ProcessTree.tsx +67 -35
  296. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +3 -2
  297. package/src/components/TemplateEditor/TemplateEditor.tsx +5 -5
  298. package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -3
  299. package/src/components/TemplateEditor/TemplateForm.tsx +3 -3
  300. package/src/components/Toolbox/Toolbox.stories.tsx +2 -1
  301. package/src/components/Toolbox/Toolbox.tsx +2 -2
  302. package/src/containers/AgentArticle/AgentArticle.stories.tsx +1 -1
  303. package/src/containers/AgentArticle/AgentArticle.tsx +2 -2
  304. package/src/containers/AgentProperties/AgentProperties.stories.tsx +2 -1
  305. package/src/containers/AgentProperties/AgentProperties.tsx +2 -2
  306. package/src/containers/BlueprintArticle/BlueprintArticle.tsx +1 -1
  307. package/src/containers/ChatCompanion/ChatCompanion.tsx +1 -1
  308. package/src/containers/ChatContainer/ChatContainer.tsx +16 -6
  309. package/src/containers/ChatDialog/ChatDialog.tsx +3 -9
  310. package/src/containers/{PromptArticle/PromptArticle.tsx → RoutineArticle/RoutineArticle.tsx} +4 -4
  311. package/src/containers/RoutineArticle/index.ts +5 -0
  312. package/src/containers/{PromptList/PromptList.stories.tsx → RoutineList/RoutineList.stories.tsx} +10 -9
  313. package/src/containers/{PromptList/PromptList.tsx → RoutineList/RoutineList.tsx} +6 -5
  314. package/src/containers/RoutineList/index.ts +5 -0
  315. package/src/containers/TracePanel/TracePanel.stories.tsx +204 -198
  316. package/src/containers/TracePanel/TracePanel.tsx +69 -44
  317. package/src/containers/TracePanel/dxn-extractor.test.ts +7 -7
  318. package/src/containers/TracePanel/dxn-extractor.ts +4 -4
  319. package/src/containers/TracePanel/execution-graph.test.ts +382 -0
  320. package/src/containers/TracePanel/execution-graph.ts +340 -213
  321. package/src/containers/TracePanel/testing/index.ts +6 -0
  322. package/src/containers/TracePanel/testing/simulated-agent.ts +114 -0
  323. package/src/containers/TracePanel/testing/snapshot-playback.ts +45 -0
  324. package/src/containers/index.ts +2 -2
  325. package/src/hooks/index.ts +2 -0
  326. package/src/hooks/useBlueprintRegistry.ts +1 -1
  327. package/src/hooks/useChatKeymap.ts +52 -0
  328. package/src/hooks/useChatProcessor.ts +1 -1
  329. package/src/hooks/useDebug.ts +38 -0
  330. package/src/index.ts +0 -3
  331. package/src/operations/create-chat.ts +2 -2
  332. package/src/operations/definitions.ts +4 -4
  333. package/src/operations/ensure-companion-chat.ts +1 -1
  334. package/src/operations/index.ts +1 -1
  335. package/src/operations/on-create-space.ts +1 -1
  336. package/src/operations/prompt.test.ts +5 -6
  337. package/src/operations/resolve-navigation-targets.ts +1 -1
  338. package/src/operations/run-prompt-in-new-chat.ts +3 -3
  339. package/src/operations/set-current-chat.ts +1 -1
  340. package/src/operations/update-chat-name.ts +2 -2
  341. package/src/processor/processor.test.ts +1 -1
  342. package/src/processor/processor.ts +4 -4
  343. package/src/queue-logger.ts +1 -1
  344. package/src/testing/data/trace-timeline.dx.json +3737 -1200
  345. package/src/testing/index.ts +1 -0
  346. package/src/testing/test-generator.test.ts +1 -1
  347. package/src/testing/test-generator.ts +4 -4
  348. package/src/testing/test-trace.ts +20 -0
  349. package/src/testing/trace-timeline.conversations.json +1 -1
  350. package/src/testing/trace-timeline.test.ts +53 -49
  351. package/src/translations.ts +24 -31
  352. package/src/types/Assistant.ts +11 -0
  353. package/src/types/Settings.ts +62 -7
  354. package/src/types/index.ts +0 -1
  355. package/src/types/service.ts +1 -1
  356. package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs +0 -97
  357. package/dist/lib/browser/AssistantSettings-7QMO3LGF.mjs.map +0 -7
  358. package/dist/lib/browser/chunk-ATHYBVGN.mjs.map +0 -7
  359. package/dist/lib/browser/chunk-EZRS3J25.mjs +0 -30
  360. package/dist/lib/browser/chunk-EZRS3J25.mjs.map +0 -7
  361. package/dist/lib/browser/chunk-LMVTXH54.mjs.map +0 -7
  362. package/dist/lib/browser/create-chat-LBZHGVSN.mjs.map +0 -7
  363. package/dist/lib/browser/ensure-companion-chat-ZEZA34MZ.mjs.map +0 -7
  364. package/dist/lib/browser/run-prompt-in-new-chat-THLK5YQC.mjs.map +0 -7
  365. package/dist/lib/browser/set-current-chat-LRS3VFSH.mjs.map +0 -7
  366. package/dist/lib/browser/update-chat-name-3Y36KFAS.mjs.map +0 -7
  367. package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs +0 -98
  368. package/dist/lib/node-esm/AssistantSettings-UVUTKO7E.mjs.map +0 -7
  369. package/dist/lib/node-esm/chunk-NZIKC7AN.mjs +0 -32
  370. package/dist/lib/node-esm/chunk-NZIKC7AN.mjs.map +0 -7
  371. package/dist/lib/node-esm/chunk-PXAJSTGZ.mjs.map +0 -7
  372. package/dist/lib/node-esm/chunk-W3JZ2F4T.mjs.map +0 -7
  373. package/dist/lib/node-esm/create-chat-3BEG4R6J.mjs.map +0 -7
  374. package/dist/lib/node-esm/ensure-companion-chat-6K2WEWFP.mjs.map +0 -7
  375. package/dist/lib/node-esm/run-prompt-in-new-chat-OUYKCMQ7.mjs.map +0 -7
  376. package/dist/lib/node-esm/set-current-chat-SMXZJD3F.mjs.map +0 -7
  377. package/dist/lib/node-esm/update-chat-name-HM2P4NSI.mjs.map +0 -7
  378. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +0 -10
  379. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +0 -1
  380. package/dist/types/src/components/ChatProgress/index.d.ts +0 -2
  381. package/dist/types/src/components/ChatProgress/index.d.ts.map +0 -1
  382. package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts +0 -15
  383. package/dist/types/src/components/ChatThread/widgets/PromptWidget.d.ts.map +0 -1
  384. package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts +0 -6
  385. package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +0 -1
  386. package/dist/types/src/containers/PromptArticle/index.d.ts +0 -2
  387. package/dist/types/src/containers/PromptArticle/index.d.ts.map +0 -1
  388. package/dist/types/src/containers/PromptList/PromptList.d.ts +0 -6
  389. package/dist/types/src/containers/PromptList/PromptList.d.ts.map +0 -1
  390. package/dist/types/src/containers/PromptList/PromptList.stories.d.ts.map +0 -1
  391. package/dist/types/src/containers/PromptList/index.d.ts +0 -2
  392. package/dist/types/src/containers/PromptList/index.d.ts.map +0 -1
  393. package/dist/types/src/types/defs.d.ts +0 -2
  394. package/dist/types/src/types/defs.d.ts.map +0 -1
  395. package/src/components/ChatProgress/ChatProgress.tsx +0 -56
  396. package/src/components/ChatProgress/index.ts +0 -5
  397. package/src/components/ChatThread/widgets/PromptWidget.ts +0 -30
  398. package/src/containers/PromptArticle/index.ts +0 -5
  399. package/src/containers/PromptList/index.ts +0 -5
  400. package/src/types/defs.ts +0 -5
@@ -1,45 +1,25 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- blueprint_default
4
- } from "./chunk-NZIKC7AN.mjs";
5
- import {
6
- ApiAuthorization,
7
- AssistantCapabilities,
8
- AssistantEvents,
9
- Assistant_exports,
10
- LLM_PROVIDERS,
11
- ServiceType,
12
- categoryIcons
13
- } from "./chunk-W3JZ2F4T.mjs";
14
2
  import {
15
3
  UpdateChatName
16
- } from "./chunk-PXAJSTGZ.mjs";
4
+ } from "./chunk-NCIZY5ZV.mjs";
17
5
  import "./chunk-HSLMI22Q.mjs";
18
6
 
19
7
  // src/components/index.ts
20
8
  import { lazy } from "react";
21
9
 
22
10
  // src/components/Chat/Chat.tsx
23
- import { Prec } from "@codemirror/state";
24
- import { keymap } from "@codemirror/view";
25
- import { useAtomValue } from "@effect-atom/atom-react";
26
- import { createContext } from "@radix-ui/react-context";
11
+ import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
27
12
  import * as Array2 from "effect/Array";
28
- import * as Option3 from "effect/Option";
29
- import React11, { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState5 } from "react";
13
+ import * as Option4 from "effect/Option";
14
+ import React13, { useCallback as useCallback5, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef3, useState as useState7 } from "react";
30
15
  import { Event } from "@dxos/async";
31
16
  import { Filter as Filter2, Obj as Obj3 } from "@dxos/echo";
32
- import { useVoiceInput } from "@dxos/plugin-transcription";
33
17
  import { useQuery as useQuery2 } from "@dxos/react-client/echo";
34
18
  import { useIdentity } from "@dxos/react-client/halo";
35
- import { Input as Input2, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
36
- import { ChatEditor } from "@dxos/react-ui-chat";
37
19
  import { Menu } from "@dxos/react-ui-menu";
38
20
  import { Message } from "@dxos/types";
39
- import { composable, composableProps, mx as mx7 } from "@dxos/ui-theme";
40
- import { isTruthy, trim } from "@dxos/util";
41
- import { useChatToolbarActions } from "#hooks";
42
- import { meta as meta6 } from "#meta";
21
+ import { composable, composableProps } from "@dxos/ui-theme";
22
+ import { useChatKeymapExtensions as useChatKeymapExtensions2, useChatToolbarActions, useDebug } from "#hooks";
43
23
 
44
24
  // src/components/ChatPrompt/ChatActions.tsx
45
25
  import React from "react";
@@ -49,17 +29,8 @@ import { meta } from "#meta";
49
29
  var ChatActions = ({ classNames, children, microphone, recording, processing, debug, onEvent }) => {
50
30
  const { t } = useTranslation(meta.id);
51
31
  return /* @__PURE__ */ React.createElement("div", {
52
- className: mx("flex items-center me-1", classNames)
53
- }, children, /* @__PURE__ */ React.createElement(IconButton, {
54
- disabled: !processing,
55
- variant: "ghost",
56
- icon: "ph--x--regular",
57
- iconOnly: true,
58
- label: t("cancel-processing.button"),
59
- onClick: () => onEvent?.({
60
- type: "cancel"
61
- })
62
- }), microphone && /* @__PURE__ */ React.createElement(IconButton, {
32
+ className: mx("flex items-center", classNames)
33
+ }, children, microphone && /* @__PURE__ */ React.createElement(IconButton, {
63
34
  disabled: !processing,
64
35
  classNames: mx(recording && "bg-primary-500"),
65
36
  variant: "ghost",
@@ -87,6 +58,15 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, de
87
58
  onClick: () => onEvent?.({
88
59
  type: "toggle-debug"
89
60
  })
61
+ }), /* @__PURE__ */ React.createElement(IconButton, {
62
+ disabled: !processing,
63
+ variant: "ghost",
64
+ icon: "ph--x--regular",
65
+ iconOnly: true,
66
+ label: t("cancel-processing.button"),
67
+ onClick: () => onEvent?.({
68
+ type: "cancel"
69
+ })
90
70
  }));
91
71
  };
92
72
 
@@ -95,22 +75,23 @@ import * as Option from "effect/Option";
95
75
  import React2, { useCallback, useMemo, useState } from "react";
96
76
  import { McpServer } from "@dxos/assistant-toolkit";
97
77
  import { Annotation, Filter, Obj, Type } from "@dxos/echo";
98
- import { useQuery } from "@dxos/react-client/echo";
78
+ import { useObject, useQuery } from "@dxos/react-client/echo";
99
79
  import { IconButton as IconButton2, Input, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
100
80
  import { Listbox, SearchList, useSearchListResults } from "@dxos/react-ui-search";
101
81
  import { Tabs } from "@dxos/react-ui-tabs";
102
82
  import { getStyles, mx as mx2 } from "@dxos/ui-theme";
103
83
  import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from "#hooks";
104
84
  import { meta as meta2 } from "#meta";
85
+ import { Assistant } from "#types";
105
86
  var styles = {
106
- panel: "w-[calc(100dvw-.5rem)] sm:w-max md:w-popover-default-width max-w-document-width",
107
- toolbar: "p-form-chrome border-t border-separator"
87
+ panel: "w-[calc(100dvw-.5rem)] sm:w-max max-w-document-width",
88
+ toolbar: "p-0! gap-0! border-t border-separator"
108
89
  };
109
- var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
90
+ var ChatOptions = ({ chat, db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
110
91
  const { t } = useTranslation2(meta2.id);
111
92
  return /* @__PURE__ */ React2.createElement("div", {
112
93
  role: "none",
113
- className: "flex p-2"
94
+ className: "flex"
114
95
  }, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
115
96
  asChild: true
116
97
  }, /* @__PURE__ */ React2.createElement(IconButton2, {
@@ -135,49 +116,61 @@ var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetCh
135
116
  side: "top",
136
117
  classNames: styles.panel
137
118
  }, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(Tabs.Root, {
119
+ classNames: "flex",
138
120
  orientation: "horizontal",
139
- defaultValue: "model",
121
+ defaultValue: "view",
140
122
  defaultActivePart: "list",
141
123
  tabIndex: -1
142
124
  }, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
143
- // TODO(burdon): Simplify styles.
144
- classNames: mx2("max-h-(--radix-popover-content-available-height) grid grid-rows-[1fr_min-content]", '[&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content]', '[&_[role="listbox"]]:min-h-0 [&_[role="listbox"]]:overflow-y-auto', '[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden')
125
+ classNames: mx2("grid grid-rows-[1fr_40px] w-full")
145
126
  }, /* @__PURE__ */ React2.createElement(Tabs.Panel, {
146
- value: "model",
147
- tabIndex: -1,
148
- classNames: "dx-focus-ring-inset"
149
- }, /* @__PURE__ */ React2.createElement(ModelsPanel, {
150
- presets,
151
- preset,
152
- onPresetChange
153
- })), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
154
- value: "mcp-servers",
155
127
  tabIndex: -1,
156
- classNames: "dx-focus-ring-inset"
157
- }, /* @__PURE__ */ React2.createElement(McpServersPanel, {
158
- db
128
+ classNames: "dx-focus-ring-inset overflow-hidden",
129
+ value: "view"
130
+ }, /* @__PURE__ */ React2.createElement(ViewPanel, {
131
+ chat
159
132
  })), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
160
- value: "blueprints",
161
133
  tabIndex: -1,
162
- classNames: "dx-focus-ring-inset"
134
+ classNames: "dx-focus-ring-inset overflow-hidden",
135
+ value: "blueprints"
163
136
  }, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
164
137
  blueprintRegistry,
165
138
  db,
166
139
  context
140
+ })), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
141
+ tabIndex: -1,
142
+ classNames: "dx-focus-ring-inset overflow-hidden",
143
+ value: "mcp-servers"
144
+ }, /* @__PURE__ */ React2.createElement(McpServersPanel, {
145
+ db
146
+ })), /* @__PURE__ */ React2.createElement(Tabs.Panel, {
147
+ tabIndex: -1,
148
+ classNames: "dx-focus-ring-inset overflow-hidden",
149
+ value: "model"
150
+ }, /* @__PURE__ */ React2.createElement(ModelsPanel, {
151
+ presets,
152
+ preset,
153
+ onPresetChange
167
154
  })), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
168
- classNames: styles.toolbar
155
+ classNames: [
156
+ styles.toolbar
157
+ ]
169
158
  }, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
170
- value: "model",
171
- icon: "ph--cpu--regular",
172
- label: t("chat-model.title")
159
+ value: "view",
160
+ icon: "ph--eye--regular",
161
+ label: t("chat-view.title")
173
162
  }), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
174
163
  value: "blueprints",
175
164
  icon: "ph--blueprint--regular",
176
- label: t("blueprints-in-context.title")
165
+ label: t("options.blueprints.title")
177
166
  }), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
178
167
  value: "mcp-servers",
179
168
  icon: "ph--plugs-connected--regular",
180
- label: t("mcp-servers.title")
169
+ label: t("options.mcp.title")
170
+ }), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
171
+ value: "model",
172
+ icon: "ph--cpu--regular",
173
+ label: t("options.chat-model.title")
181
174
  }))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
182
175
  };
183
176
  var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
@@ -201,7 +194,7 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
201
194
  return /* @__PURE__ */ React2.createElement(SearchList.Root, {
202
195
  onSearch: handleSearch
203
196
  }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
204
- classNames: "py-form-chrome"
197
+ classNames: "flex flex-col"
205
198
  }, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((blueprint) => {
206
199
  const isActive = activeBlueprints.has(blueprint.key);
207
200
  return /* @__PURE__ */ React2.createElement(SearchList.Item, {
@@ -212,11 +205,26 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
212
205
  checked: isActive,
213
206
  onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
214
207
  });
215
- }))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
208
+ })), /* @__PURE__ */ React2.createElement(SearchList.Input, {
216
209
  placeholder: t("search.placeholder"),
217
- classNames: "mb-form-chrome",
210
+ classNames: "border-t border-separator",
218
211
  autoFocus: true
219
- }));
212
+ })));
213
+ };
214
+ var ViewPanel = ({ chat }) => {
215
+ const { t } = useTranslation2(meta2.id);
216
+ const [view, setView] = useObject(chat, "view");
217
+ const value2 = view ?? "normal";
218
+ return /* @__PURE__ */ React2.createElement(Listbox.Root, {
219
+ value: value2,
220
+ onValueChange: setView,
221
+ autoFocus: true
222
+ }, Assistant.ChatViews.map((view2) => /* @__PURE__ */ React2.createElement(Listbox.Option, {
223
+ key: view2,
224
+ value: view2
225
+ }, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, t(`chat-view.${view2}.label`, {
226
+ defaultValue: view2
227
+ })), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null))));
220
228
  };
221
229
  var ModelsPanel = ({ presets, preset, onPresetChange }) => {
222
230
  return /* @__PURE__ */ React2.createElement(Listbox.Root, {
@@ -247,7 +255,7 @@ var McpServersPanel = ({ db }) => {
247
255
  db
248
256
  ]);
249
257
  const handleToggle = useCallback((server, enabled) => {
250
- Obj.change(server, (server2) => {
258
+ Obj.update(server, (server2) => {
251
259
  server2.enabled = enabled;
252
260
  });
253
261
  }, []);
@@ -257,7 +265,7 @@ var McpServersPanel = ({ db }) => {
257
265
  db
258
266
  ]);
259
267
  return /* @__PURE__ */ React2.createElement("div", {
260
- className: "py-form-chrome space-y-2"
268
+ className: "p-form-chrome"
261
269
  }, servers.map((server) => /* @__PURE__ */ React2.createElement("div", {
262
270
  key: server.id,
263
271
  className: "flex items-center gap-2 px-form-chrome"
@@ -280,8 +288,7 @@ var McpServersPanel = ({ db }) => {
280
288
  onSubmit: handleAdd,
281
289
  onCancel: () => setAdding(false)
282
290
  }) : /* @__PURE__ */ React2.createElement("div", {
283
- role: "none",
284
- className: "px-form-chrome"
291
+ role: "none"
285
292
  }, /* @__PURE__ */ React2.createElement(IconButton2, {
286
293
  variant: "ghost",
287
294
  icon: "ph--plus--regular",
@@ -400,13 +407,13 @@ var ObjectsPanel = ({ db, context }) => {
400
407
  icon: "ph--cube--regular",
401
408
  hue: void 0
402
409
  })));
403
- const styles2 = hue ? getStyles(hue) : void 0;
410
+ const styles3 = hue ? getStyles(hue) : void 0;
404
411
  return /* @__PURE__ */ React2.createElement(SearchList.Item, {
405
412
  classNames: "flex items-center overflow-hidden",
406
413
  key: object.id,
407
414
  value: object.id,
408
415
  icon,
409
- iconClassNames: styles2?.surfaceText,
416
+ iconClassNames: styles3?.surfaceText,
410
417
  label: Obj.getLabel(object) ?? Obj.getTypename(object) ?? object.id,
411
418
  checked: isActive,
412
419
  onSelect: () => onUpdateObject?.(Obj.getDXN(object), !isActive)
@@ -437,6 +444,17 @@ var ObjectsPanel = ({ db, context }) => {
437
444
  import React3 from "react";
438
445
  import { Select as Select2 } from "@dxos/react-ui";
439
446
 
447
+ // src/components/ChatPrompt/ChatPrompt.tsx
448
+ import { useAtomValue } from "@effect-atom/atom-react";
449
+ import * as Option3 from "effect/Option";
450
+ import React6, { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState3 } from "react";
451
+ import { useVoiceInput } from "@dxos/plugin-transcription";
452
+ import { Input as Input2, useDynamicRef, useTranslation as useTranslation4 } from "@dxos/react-ui";
453
+ import { ChatEditor } from "@dxos/react-ui-chat";
454
+ import { mx as mx5 } from "@dxos/ui-theme";
455
+ import { useChatKeymapExtensions } from "#hooks";
456
+ import { meta as meta4 } from "#meta";
457
+
440
458
  // src/components/ChatPrompt/ChatReferences.tsx
441
459
  import * as Option2 from "effect/Option";
442
460
  import React4 from "react";
@@ -466,7 +484,7 @@ var ChatReferences = ({ classNames, context, db }) => {
466
484
  icon: DEFAULT_OBJECT_ICON,
467
485
  hue: void 0
468
486
  })));
469
- const styles2 = hue ? getStyles2(hue) : void 0;
487
+ const styles3 = hue ? getStyles2(hue) : void 0;
470
488
  return /* @__PURE__ */ React4.createElement("li", {
471
489
  key: dxn.toString(),
472
490
  className: "dx-tag py-0 ps-2 flex items-center gap-1",
@@ -474,12 +492,12 @@ var ChatReferences = ({ classNames, context, db }) => {
474
492
  }, /* @__PURE__ */ React4.createElement(Icon, {
475
493
  icon,
476
494
  size: 4,
477
- classNames: styles2?.surfaceText
495
+ classNames: styles3?.surfaceText
478
496
  }), toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
479
497
  icon: "ph--x--bold",
480
498
  iconOnly: true,
481
499
  variant: "ghost",
482
- label: t("remove-object-in-context.label"),
500
+ label: t("remove-object.label"),
483
501
  classNames: "p-0 hover:bg-transparent",
484
502
  size: 3,
485
503
  onClick: () => onUpdateObject?.(dxn, false)
@@ -519,16 +537,197 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
519
537
  })));
520
538
  };
521
539
 
540
+ // src/components/ChatPrompt/ChatPrompt.tsx
541
+ var ChatPrompt = ({ classNames, outline, chat, db, processor, event, online, placeholder, onOnlineChange, onPresetChange, settings = true, presets, preset }) => {
542
+ const { t } = useTranslation4(meta4.id);
543
+ const error = useAtomValue(processor.error).pipe(Option3.getOrUndefined);
544
+ const streaming = useAtomValue(processor.streaming);
545
+ const active = useAtomValue(processor.active);
546
+ const activeRef = useDynamicRef(active);
547
+ const editorRef = useRef(null);
548
+ const [recordingState, setRecordingState] = useState3(false);
549
+ useEffect2(() => {
550
+ return event.on((ev) => {
551
+ switch (ev.type) {
552
+ case "update-prompt":
553
+ if (!editorRef.current?.getText()?.length) {
554
+ editorRef.current?.setText(ev.text);
555
+ editorRef.current?.focus();
556
+ }
557
+ break;
558
+ case "record-start":
559
+ setRecordingState(true);
560
+ break;
561
+ case "record-stop":
562
+ setRecordingState(false);
563
+ break;
564
+ }
565
+ });
566
+ }, [
567
+ event
568
+ ]);
569
+ const { recording } = useVoiceInput({
570
+ active: recordingState,
571
+ onUpdate: (text) => {
572
+ editorRef.current?.setText(text);
573
+ editorRef.current?.focus();
574
+ }
575
+ });
576
+ const extensions = useChatKeymapExtensions({
577
+ event
578
+ });
579
+ const handleSubmit = useCallback2((text) => {
580
+ if (!activeRef.current) {
581
+ event.emit({
582
+ type: "submit",
583
+ text
584
+ });
585
+ return true;
586
+ }
587
+ }, [
588
+ event
589
+ ]);
590
+ const handleEvent = useCallback2((ev) => {
591
+ event.emit(ev);
592
+ }, [
593
+ event
594
+ ]);
595
+ return /* @__PURE__ */ React6.createElement("div", {
596
+ role: "group",
597
+ className: mx5("flex flex-col w-full dx-density-fine", outline && "bg-group-surface rounded-sm! border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator", classNames)
598
+ }, /* @__PURE__ */ React6.createElement("div", {
599
+ role: "none",
600
+ className: "flex p-2 gap-2"
601
+ }, /* @__PURE__ */ React6.createElement(ChatStatusIndicator, {
602
+ classNames: "p-1",
603
+ preset,
604
+ error,
605
+ processing: streaming
606
+ }), /* @__PURE__ */ React6.createElement(ChatEditor, {
607
+ ref: editorRef,
608
+ autoFocus: true,
609
+ lineWrapping: true,
610
+ classNames: "col-span-2 pt-0.5",
611
+ placeholder: placeholder ?? t("prompt.placeholder"),
612
+ extensions,
613
+ onSubmit: handleSubmit
614
+ })), db && settings && /* @__PURE__ */ React6.createElement("div", {
615
+ role: "none",
616
+ className: "flex items-center overflow-hidden p-1.5"
617
+ }, /* @__PURE__ */ React6.createElement(ChatOptions, {
618
+ chat,
619
+ db,
620
+ blueprintRegistry: processor.blueprintRegistry,
621
+ context: processor.context,
622
+ preset,
623
+ presets,
624
+ onPresetChange
625
+ }), /* @__PURE__ */ React6.createElement("div", {
626
+ role: "none",
627
+ className: "flex h-8 grow overflow-x-auto scrollbar-none"
628
+ }, /* @__PURE__ */ React6.createElement(ChatReferences, {
629
+ db,
630
+ context: processor.context
631
+ })), /* @__PURE__ */ React6.createElement(ChatActions, {
632
+ classNames: "col-span-2",
633
+ microphone: true,
634
+ recording,
635
+ processing: streaming,
636
+ onEvent: handleEvent
637
+ }, online !== void 0 && /* @__PURE__ */ React6.createElement(Input2.Root, null, /* @__PURE__ */ React6.createElement(Input2.Label, {
638
+ srOnly: true
639
+ }, t("online-switch.label")), /* @__PURE__ */ React6.createElement(Input2.Switch, {
640
+ classNames: "mx-2",
641
+ checked: online,
642
+ onCheckedChange: onOnlineChange
643
+ })))));
644
+ };
645
+ ChatPrompt.displayName = "Chat.Prompt";
646
+
647
+ // src/components/ChatPrompt/ChatStatus.tsx
648
+ import React7, { useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
649
+ import { ChatStatus as NaturalChatStatus, formatElapsed } from "@dxos/react-ui-chat";
650
+ import { Matrix } from "@dxos/react-ui-sfx";
651
+ import { Unit } from "@dxos/util";
652
+
653
+ // src/components/Chat/context.ts
654
+ import { createContext } from "@radix-ui/react-context";
655
+ var [ChatContextProvider, useChatContext] = createContext("Chat");
656
+
657
+ // src/components/ChatPrompt/ChatStatus.tsx
658
+ var CHAT_STREAM_STATUS_NAME = "Chat.StreamStatus";
659
+ var TICK_MS = 1e3;
660
+ var ChatStatus = ({ classNames, icon }) => {
661
+ const { messages, requestTiming } = useChatContext(CHAT_STREAM_STATUS_NAME);
662
+ const { lastOutputTokens, sessionTotalTokens } = useMemo2(() => {
663
+ let last;
664
+ let total = 0;
665
+ for (const message of messages) {
666
+ for (const block of message.blocks) {
667
+ if (isStats(block) && block.usage) {
668
+ last = block.usage.outputTokens;
669
+ total += block.usage.totalTokens ?? 0;
670
+ }
671
+ }
672
+ }
673
+ return {
674
+ lastOutputTokens: last,
675
+ sessionTotalTokens: total
676
+ };
677
+ }, [
678
+ messages
679
+ ]);
680
+ const isRunning = requestTiming != null && requestTiming.endedAt == null;
681
+ const show = requestTiming || lastOutputTokens || sessionTotalTokens > 0;
682
+ if (!show) {
683
+ return null;
684
+ }
685
+ return /* @__PURE__ */ React7.createElement(NaturalChatStatus.Root, {
686
+ defaultRunning: false,
687
+ classNames: [
688
+ "py-2 gap-2 text-sm",
689
+ classNames
690
+ ]
691
+ }, icon && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Icon, null, /* @__PURE__ */ React7.createElement(Matrix, {
692
+ classNames: "w-5 h-5",
693
+ dotClassNames: "bg-primary-500",
694
+ dim: 4,
695
+ dotSize: 3,
696
+ count: 10,
697
+ interval: 500,
698
+ active: isRunning
699
+ })), show && /* @__PURE__ */ React7.createElement("div", {
700
+ role: "none",
701
+ className: "flex items-center"
702
+ }, requestTiming && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, /* @__PURE__ */ React7.createElement(Elapsed, {
703
+ timing: requestTiming
704
+ })), lastOutputTokens != null && /* @__PURE__ */ React7.createElement(React7.Fragment, null, requestTiming && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Separator, null), /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, "\u2193 ", Unit.Thousand(lastOutputTokens).toString())), sessionTotalTokens > 0 && /* @__PURE__ */ React7.createElement(React7.Fragment, null, (requestTiming || lastOutputTokens != null) && /* @__PURE__ */ React7.createElement(NaturalChatStatus.Separator, null), /* @__PURE__ */ React7.createElement(NaturalChatStatus.Text, null, "\u03A3 ", Unit.Thousand(sessionTotalTokens).toString()))));
705
+ };
706
+ var Elapsed = ({ timing }) => {
707
+ const isRunning = timing.endedAt == null;
708
+ const [now, setNow] = useState4(Date.now());
709
+ useEffect3(() => {
710
+ if (!isRunning) {
711
+ return;
712
+ }
713
+ const id = setInterval(() => setNow(Date.now()), TICK_MS);
714
+ return () => clearInterval(id);
715
+ }, [
716
+ isRunning
717
+ ]);
718
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, formatElapsed((timing.endedAt ?? now) - timing.startedAt));
719
+ };
720
+ var isStats = (block) => block._tag === "stats";
721
+
522
722
  // src/components/ChatThread/ChatThread.tsx
523
- import React10, { forwardRef, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo3, useState as useState4 } from "react";
723
+ import React12, { forwardRef, useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo4, useState as useState6 } from "react";
524
724
  import { PublicKey } from "@dxos/keys";
525
725
  import { setRef } from "@dxos/react-ui";
526
- import { MarkdownStream } from "@dxos/react-ui-components";
527
- import { mx as mx6 } from "@dxos/ui-theme";
726
+ import { MarkdownStream } from "@dxos/react-ui-markdown";
528
727
  import { keyToFallback } from "@dxos/util";
529
728
 
530
729
  // src/components/ChatThread/registry.tsx
531
- import React9 from "react";
730
+ import React11 from "react";
532
731
  import { log } from "@dxos/log";
533
732
  import { getXmlTextChild } from "@dxos/ui-editor";
534
733
 
@@ -568,45 +767,33 @@ var rehydrateToolWidgetsFromMessages = (context, messages) => {
568
767
  };
569
768
 
570
769
  // src/components/ChatThread/widgets/FallbackWidget.tsx
571
- import React6 from "react";
770
+ import React8 from "react";
572
771
  import { TogglePanel } from "@dxos/react-ui-components";
573
772
  import { JsonHighlighter } from "@dxos/react-ui-syntax-highlighter";
574
773
  var FallbackWidget = ({ _tag, ...props }) => {
575
- return /* @__PURE__ */ React6.createElement(TogglePanel.Root, null, /* @__PURE__ */ React6.createElement(TogglePanel.Header, {
774
+ return /* @__PURE__ */ React8.createElement(TogglePanel.Root, null, /* @__PURE__ */ React8.createElement(TogglePanel.Header, {
576
775
  classNames: "bg-group-surface"
577
- }, _tag), /* @__PURE__ */ React6.createElement(TogglePanel.Content, {
776
+ }, _tag), /* @__PURE__ */ React8.createElement(TogglePanel.Content, {
578
777
  classNames: "bg-modal-surface"
579
- }, /* @__PURE__ */ React6.createElement(TogglePanel.Viewport, null, /* @__PURE__ */ React6.createElement(JsonHighlighter, {
778
+ }, /* @__PURE__ */ React8.createElement(TogglePanel.Viewport, null, /* @__PURE__ */ React8.createElement(JsonHighlighter, {
580
779
  classNames: "p-2! text-sm",
581
780
  data: props
582
781
  }))));
583
782
  };
584
783
  FallbackWidget.displayName = "Fallback";
585
784
 
586
- // src/components/ChatThread/widgets/PromptWidget.ts
785
+ // src/components/ChatThread/widgets/ReasoningWidget.ts
587
786
  import { WidgetType } from "@codemirror/view";
588
787
  import { Domino } from "@dxos/ui";
589
- var PromptWidget = class extends WidgetType {
590
- text;
591
- constructor(text) {
592
- super(), this.text = text;
593
- }
594
- eq(other) {
595
- return this.text === other.text;
596
- }
597
- /**
598
- * NOTE: An ancestor element must set `data-hue` so `.dx-panel` resolves to the user's hue tokens
599
- * (see `packages/ui/ui-theme/src/css/components/panel.css`).
600
- */
601
- toDOM() {
602
- return Domino.of("div").classNames("flex justify-end my-2").append(Domino.of("div").classNames("dx-panel px-3 py-1.5 rounded-sm").text(this.text)).root;
603
- }
788
+
789
+ // src/components/ChatThread/widgets/defaults.ts
790
+ var styles2 = {
791
+ padding: "my-4",
792
+ border: "border border-subdued-separator rounded-sm"
604
793
  };
605
794
 
606
795
  // src/components/ChatThread/widgets/ReasoningWidget.ts
607
- import { WidgetType as WidgetType2 } from "@codemirror/view";
608
- import { Domino as Domino2 } from "@dxos/ui";
609
- var ReasoningWidget = class extends WidgetType2 {
796
+ var ReasoningWidget = class extends WidgetType {
610
797
  text;
611
798
  #pos;
612
799
  /** The timer id last registered for this instance (may differ from the map if superseded). */
@@ -619,21 +806,20 @@ var ReasoningWidget = class extends WidgetType2 {
619
806
  return this.text === other.text && this.#pos === other.#pos;
620
807
  }
621
808
  toDOM() {
622
- const root = Domino2.of("div").classNames("pt-2 pb-2").append(Domino2.of("div").classNames("relative overflow-hidden p-px rounded-sm border border-subdued-separator").attributes({
809
+ return Domino.of("div").classNames(styles2.padding).append(Domino.of("div").classNames("relative overflow-hidden p-px", styles2.border).attributes({
623
810
  "data-trail-container": ""
624
- }).append(Domino2.of("div").classNames("relative z-10 bg-base-surface rounded-sm text-sm text-description px-2 py-1").append(Domino2.of("div").classNames("max-h-[5lh] overflow-y-auto").text(this.text).attributes({
811
+ }).append(Domino.of("div").classNames("relative z-10 bg-base-surface rounded-sm text-sm text-subdued px-2 py-1").append(Domino.of("div").classNames("max-h-[5lh] overflow-y-auto").text(this.text).attributes({
625
812
  "data-reasoning-text": ""
626
- })), Domino2.of("div").attributes({
813
+ })), Domino.of("div").attributes({
627
814
  "data-id": this.#pos
628
815
  }))).root;
629
- return root;
630
816
  }
631
817
  updateDOM(dom) {
632
818
  dom.querySelector("[data-reasoning-text]")?.replaceChildren(this.text);
633
819
  const container = dom.querySelector("[data-trail-container]");
634
820
  let trailHost = container?.querySelector("[data-id]");
635
821
  if (container && !trailHost) {
636
- trailHost = Domino2.of("div").attributes({
822
+ trailHost = Domino.of("div").attributes({
637
823
  "data-id": this.#pos
638
824
  }).root;
639
825
  container.append(trailHost);
@@ -680,14 +866,14 @@ var trail = [
680
866
  var TRAIL_REMOVAL_DELAY_MS = 1e3;
681
867
  var trailRemovalTimers = /* @__PURE__ */ new Map();
682
868
  var createTrailLayers = () => [
683
- Domino2.of("div").classNames(...trail, "animate-trail").root,
684
- Domino2.of("div").classNames(...trail, "animate-trail-offset").root
869
+ Domino.of("div").classNames(...trail, "animate-trail").root,
870
+ Domino.of("div").classNames(...trail, "animate-trail-offset").root
685
871
  ];
686
872
 
687
873
  // src/components/ChatThread/widgets/ReferenceWidget.ts
688
- import { WidgetType as WidgetType3 } from "@codemirror/view";
689
- import { Domino as Domino3 } from "@dxos/ui";
690
- var ReferenceWidget = class extends WidgetType3 {
874
+ import { WidgetType as WidgetType2 } from "@codemirror/view";
875
+ import { Domino as Domino2 } from "@dxos/ui";
876
+ var ReferenceWidget = class extends WidgetType2 {
691
877
  text;
692
878
  dxn;
693
879
  constructor(text, dxn) {
@@ -697,16 +883,16 @@ var ReferenceWidget = class extends WidgetType3 {
697
883
  return this.dxn === other.dxn;
698
884
  }
699
885
  toDOM() {
700
- return Domino3.of("div").classNames("pt-2 pb-2").append(Domino3.of("dx-anchor").classNames("dx-tag--anchor").attributes({
886
+ return Domino2.of("div").classNames(styles2.padding).append(Domino2.of("dx-anchor").classNames("dx-tag--anchor").attributes({
701
887
  dxn: this.dxn
702
888
  }).text(this.text)).root;
703
889
  }
704
890
  };
705
891
 
706
892
  // src/components/ChatThread/widgets/SelectWidget.ts
707
- import { WidgetType as WidgetType4 } from "@codemirror/view";
708
- import { Domino as Domino4 } from "@dxos/ui";
709
- var SelectWidget = class extends WidgetType4 {
893
+ import { WidgetType as WidgetType3 } from "@codemirror/view";
894
+ import { Domino as Domino3 } from "@dxos/ui";
895
+ var SelectWidget = class extends WidgetType3 {
710
896
  options;
711
897
  constructor(options) {
712
898
  super(), this.options = options;
@@ -718,9 +904,9 @@ var SelectWidget = class extends WidgetType4 {
718
904
  * NOTE: Container must set var based on user's identity.
719
905
  */
720
906
  toDOM() {
721
- return Domino4.of("div").attributes({
907
+ return Domino3.of("div").attributes({
722
908
  role: "group"
723
- }).classNames("flex flex-wrap pt-2 pb-2 gap-1").append(...this.options.map((option) => Domino4.of("button").classNames("dx-button inline-block max-w-[100cqi]").attributes({
909
+ }).classNames(styles2.padding, "flex flex-wrap gap-1").append(...this.options.map((option) => Domino3.of("button").classNames("dx-button inline-block max-w-[100cqi]").attributes({
724
910
  "data-action": "submit",
725
911
  "data-value": option,
726
912
  "data-density": "fine"
@@ -729,9 +915,9 @@ var SelectWidget = class extends WidgetType4 {
729
915
  };
730
916
 
731
917
  // src/components/ChatThread/widgets/StatsWidget.ts
732
- import { WidgetType as WidgetType5 } from "@codemirror/view";
733
- import { Domino as Domino5 } from "@dxos/ui";
734
- var StatsWidget = class extends WidgetType5 {
918
+ import { WidgetType as WidgetType4 } from "@codemirror/view";
919
+ import { Domino as Domino4 } from "@dxos/ui";
920
+ var StatsWidget = class extends WidgetType4 {
735
921
  text;
736
922
  constructor(text) {
737
923
  super(), this.text = text;
@@ -740,7 +926,7 @@ var StatsWidget = class extends WidgetType5 {
740
926
  return this.text === other.text;
741
927
  }
742
928
  toDOM() {
743
- return Domino5.of("div").classNames("pt-2 pb-4 text-sm text-placeholder").text(this.text).root;
929
+ return Domino4.of("div").classNames(styles2.padding, "text-sm text-placeholder").text(this.text).root;
744
930
  }
745
931
  updateDOM(dom) {
746
932
  dom.textContent = this.text;
@@ -748,26 +934,97 @@ var StatsWidget = class extends WidgetType5 {
748
934
  }
749
935
  };
750
936
 
937
+ // src/components/ChatThread/widgets/StatusWidget.ts
938
+ import { WidgetType as WidgetType5 } from "@codemirror/view";
939
+ import { Domino as Domino5 } from "@dxos/ui";
940
+ var StatusWidget = class extends WidgetType5 {
941
+ text;
942
+ #pos;
943
+ /** The timer id last registered for this instance (may differ from the map if superseded). */
944
+ #ownedTimerId = null;
945
+ constructor(text, pos) {
946
+ super(), this.text = text;
947
+ this.#pos = pos === void 0 || pos === "" ? "status" : String(pos);
948
+ }
949
+ eq(other) {
950
+ return this.text === other.text && this.#pos === other.#pos;
951
+ }
952
+ toDOM() {
953
+ return Domino5.of("div").classNames(styles2.padding).append(Domino5.of("div").classNames("relative overflow-hidden rounded-sm").append(Domino5.of("div").classNames("grid grid-cols-[24px_1fr] gap-x-0.5 gap-y-0 items-start px-0.5 py-0.5 text-placeholder").append(Domino5.of("div").classNames("flex h-5 w-full shrink-0 items-center justify-center self-start").append(Domino5.of("span").classNames("block size-1.5 shrink-0 rounded-full bg-current opacity-45")), Domino5.of("div").classNames("relative min-w-0").append(Domino5.of("div").classNames("relative z-10 rounded-sm text-sm leading-5").attributes({
954
+ "data-status-text": ""
955
+ }).text(this.text), Domino5.of("div").attributes({
956
+ "data-id": this.#pos
957
+ }))))).root;
958
+ }
959
+ updateDOM(dom) {
960
+ dom.querySelector("[data-status-text]")?.replaceChildren(this.text);
961
+ const trailHost = dom.querySelector("[data-id]");
962
+ if (trailHost?.childElementCount === 0) {
963
+ trailHost.append(...createTrailLayers2());
964
+ }
965
+ this.#scheduleTrailRemoval(dom);
966
+ return true;
967
+ }
968
+ destroy(_dom) {
969
+ this.#clearOwnedTrailTimer();
970
+ }
971
+ #scheduleTrailRemoval(dom) {
972
+ const previous = trailRemovalTimers2.get(this.#pos);
973
+ if (previous !== void 0) {
974
+ clearTimeout(previous);
975
+ }
976
+ const timerId = setTimeout(() => {
977
+ if (trailRemovalTimers2.get(this.#pos) !== timerId) {
978
+ return;
979
+ }
980
+ trailRemovalTimers2.delete(this.#pos);
981
+ this.#ownedTimerId = null;
982
+ dom.querySelector("[data-id]")?.remove();
983
+ }, TRAIL_REMOVAL_DELAY_MS2);
984
+ trailRemovalTimers2.set(this.#pos, timerId);
985
+ this.#ownedTimerId = timerId;
986
+ }
987
+ #clearOwnedTrailTimer() {
988
+ const active = trailRemovalTimers2.get(this.#pos);
989
+ if (active !== void 0 && active === this.#ownedTimerId) {
990
+ clearTimeout(active);
991
+ trailRemovalTimers2.delete(this.#pos);
992
+ }
993
+ this.#ownedTimerId = null;
994
+ }
995
+ };
996
+ var trail2 = [
997
+ "absolute z-0 aspect-[2/1] w-16",
998
+ "bg-[radial-gradient(at_100%_50%,_theme(colors.green.700),_transparent_80%)]",
999
+ "[offset-anchor:100%_50%] [offset-path:border-box]"
1000
+ ];
1001
+ var TRAIL_REMOVAL_DELAY_MS2 = 1e3;
1002
+ var trailRemovalTimers2 = /* @__PURE__ */ new Map();
1003
+ var createTrailLayers2 = () => [
1004
+ Domino5.of("div").classNames(...trail2, "animate-trail").root,
1005
+ Domino5.of("div").classNames(...trail2, "animate-trail-offset").root
1006
+ ];
1007
+
751
1008
  // src/components/ChatThread/widgets/SummaryWidget.tsx
752
- import React7 from "react";
753
- import { useTranslation as useTranslation4 } from "@dxos/react-ui";
1009
+ import React9 from "react";
1010
+ import { useTranslation as useTranslation5 } from "@dxos/react-ui";
754
1011
  import { TogglePanel as TogglePanel2 } from "@dxos/react-ui-components";
755
- import { meta as meta4 } from "#meta";
1012
+ import { meta as meta5 } from "#meta";
756
1013
  var SummaryWidget = ({ children }) => {
757
- const { t } = useTranslation4(meta4.id);
758
- return /* @__PURE__ */ React7.createElement(TogglePanel2.Root, {
759
- classNames: "border border-separator rounded-sm"
760
- }, /* @__PURE__ */ React7.createElement(TogglePanel2.Header, {
1014
+ const { t } = useTranslation5(meta5.id);
1015
+ return /* @__PURE__ */ React9.createElement(TogglePanel2.Root, {
1016
+ classNames: styles2.border
1017
+ }, /* @__PURE__ */ React9.createElement(TogglePanel2.Header, {
761
1018
  classNames: "text-sm bg-group-surface"
762
- }, t("summary.label")), /* @__PURE__ */ React7.createElement(TogglePanel2.Content, null, /* @__PURE__ */ React7.createElement("div", {
1019
+ }, t("summary.label")), /* @__PURE__ */ React9.createElement(TogglePanel2.Content, null, /* @__PURE__ */ React9.createElement("div", {
763
1020
  role: "none",
764
- className: "p-1 text-sm text-description"
1021
+ className: "p-1 text-sm text-subdued"
765
1022
  }, children)));
766
1023
  };
767
1024
 
768
1025
  // src/components/ChatThread/widgets/SuggestionWidget.ts
769
1026
  import { WidgetType as WidgetType6 } from "@codemirror/view";
770
- import { Domino as Domino6, mx as mx5 } from "@dxos/ui";
1027
+ import { Domino as Domino6, mx as mx6 } from "@dxos/ui";
771
1028
  var SuggestionWidget = class extends WidgetType6 {
772
1029
  text;
773
1030
  constructor(text) {
@@ -777,26 +1034,26 @@ var SuggestionWidget = class extends WidgetType6 {
777
1034
  return this.text === other.text;
778
1035
  }
779
1036
  toDOM() {
780
- return Domino6.of("span").classNames(mx5("inline-flex max-w-[calc(100cqi-8px)] my-1 pe-2 overflow-hidden")).append(Domino6.of("button").attributes({
1037
+ return Domino6.of("span").classNames(mx6("inline-flex max-w-[calc(100cqi-8px)] my-1 pe-2 overflow-hidden")).append(Domino6.of("button").attributes({
781
1038
  "data-action": "submit",
782
1039
  "data-density": "fine",
783
1040
  "data-value": this.text
784
- }).classNames(mx5("dx-button gap-2 w-full overflow-hidden")).append(Domino6.of("dx-icon").attributes({
1041
+ }).classNames(mx6("dx-button gap-2 w-full overflow-hidden")).append(Domino6.of("dx-icon").attributes({
785
1042
  icon: "ph--lightning--regular"
786
1043
  }), Domino6.of("span").classNames("flex-1 truncate min-w-0").text(this.text))).root;
787
1044
  }
788
1045
  };
789
1046
 
790
1047
  // src/components/ChatThread/widgets/ToolWidget.tsx
791
- import React8, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState3 } from "react";
792
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
1048
+ import React10, { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2, useState as useState5 } from "react";
1049
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
793
1050
  import { NumericTabs, TextCrawl, TogglePanel as TogglePanel3 } from "@dxos/react-ui-components";
794
1051
  import { JsonHighlighter as JsonHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
795
1052
  import { isNonNullable, safeParseJson } from "@dxos/util";
796
- import { meta as meta5 } from "#meta";
1053
+ import { meta as meta6 } from "#meta";
797
1054
  var ToolWidget = ({ view, blocks = [] }) => {
798
- const { t } = useTranslation5(meta5.id);
799
- const items = useMemo2(() => {
1055
+ const { t } = useTranslation6(meta6.id);
1056
+ const items = useMemo3(() => {
800
1057
  let lastToolCall;
801
1058
  const tools = [];
802
1059
  return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
@@ -856,7 +1113,7 @@ var ToolWidget = ({ view, blocks = [] }) => {
856
1113
  blocks,
857
1114
  t
858
1115
  ]);
859
- const handleChangeOpen = useCallback2(() => {
1116
+ const handleChangeOpen = useCallback3(() => {
860
1117
  setTimeout(() => {
861
1118
  view?.requestMeasure();
862
1119
  }, 1e3);
@@ -866,21 +1123,21 @@ var ToolWidget = ({ view, blocks = [] }) => {
866
1123
  if (!items.length) {
867
1124
  return null;
868
1125
  }
869
- return /* @__PURE__ */ React8.createElement(ToolPanel, {
1126
+ return /* @__PURE__ */ React10.createElement(ToolPanel, {
870
1127
  items,
871
1128
  onChangeOpen: handleChangeOpen
872
1129
  });
873
1130
  };
874
1131
  var ToolPanel = ({ items, onChangeOpen }) => {
875
- const tabsRef = useRef(null);
876
- const [selected, setSelected] = useState3(0);
877
- const [open, setOpen] = useState3(false);
878
- useEffect2(() => {
1132
+ const tabsRef = useRef2(null);
1133
+ const [selected, setSelected] = useState5(0);
1134
+ const [open, setOpen] = useState5(false);
1135
+ useEffect4(() => {
879
1136
  setSelected((prev) => Math.min(prev, Math.max(0, items.length - 1)));
880
1137
  }, [
881
1138
  items.length
882
1139
  ]);
883
- useEffect2(() => {
1140
+ useEffect4(() => {
884
1141
  onChangeOpen?.(open);
885
1142
  if (open) {
886
1143
  tabsRef.current?.focus();
@@ -889,28 +1146,28 @@ var ToolPanel = ({ items, onChangeOpen }) => {
889
1146
  open,
890
1147
  onChangeOpen
891
1148
  ]);
892
- const handleSelect = useCallback2((index) => {
1149
+ const handleSelect = useCallback3((index) => {
893
1150
  setSelected(index);
894
1151
  }, []);
895
- return /* @__PURE__ */ React8.createElement(TogglePanel3.Root, {
1152
+ return /* @__PURE__ */ React10.createElement(TogglePanel3.Root, {
896
1153
  open,
897
1154
  onChangeOpen: setOpen
898
- }, /* @__PURE__ */ React8.createElement(TogglePanel3.Header, {
1155
+ }, /* @__PURE__ */ React10.createElement(TogglePanel3.Header, {
899
1156
  classNames: "text-sm text-placeholder"
900
- }, /* @__PURE__ */ React8.createElement(TextCrawl, {
1157
+ }, /* @__PURE__ */ React10.createElement(TextCrawl, {
901
1158
  key: "status-roll",
902
1159
  lines: items.map((item) => item.title),
903
1160
  autoAdvance: true,
904
1161
  greedy: true
905
- })), /* @__PURE__ */ React8.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React8.createElement(TogglePanel3.Viewport, {
1162
+ })), /* @__PURE__ */ React10.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React10.createElement(TogglePanel3.Viewport, {
906
1163
  classNames: "grid grid-cols-[32px_1fr]"
907
- }, /* @__PURE__ */ React8.createElement(NumericTabs, {
1164
+ }, /* @__PURE__ */ React10.createElement(NumericTabs, {
908
1165
  ref: tabsRef,
909
1166
  classNames: "p-1",
910
1167
  length: items.length,
911
1168
  selected,
912
1169
  onSelect: handleSelect
913
- }), /* @__PURE__ */ React8.createElement(JsonHighlighter2, {
1170
+ }), /* @__PURE__ */ React10.createElement(JsonHighlighter2, {
914
1171
  data: items[selected]?.content,
915
1172
  classNames: "p-1 text-xs bg-transparent",
916
1173
  replacer: {
@@ -921,90 +1178,18 @@ var ToolPanel = ({ items, onChangeOpen }) => {
921
1178
  }))));
922
1179
  };
923
1180
 
924
- // src/components/ChatThread/widgets/StatusWidget.ts
925
- import { WidgetType as WidgetType7 } from "@codemirror/view";
926
- import { Domino as Domino7 } from "@dxos/ui";
927
- var StatusWidget = class extends WidgetType7 {
928
- text;
929
- #pos;
930
- /** The timer id last registered for this instance (may differ from the map if superseded). */
931
- #ownedTimerId = null;
932
- constructor(text, pos) {
933
- super(), this.text = text;
934
- this.#pos = pos === void 0 || pos === "" ? "status" : String(pos);
935
- }
936
- eq(other) {
937
- return this.text === other.text && this.#pos === other.#pos;
938
- }
939
- toDOM() {
940
- return Domino7.of("div").classNames("py-0.5").append(Domino7.of("div").classNames("relative overflow-hidden rounded-sm").append(Domino7.of("div").classNames("grid grid-cols-[24px_1fr] gap-x-0.5 gap-y-0 items-start px-0.5 py-0.5 text-placeholder").append(Domino7.of("div").classNames("flex h-5 w-full shrink-0 items-center justify-center self-start").append(Domino7.of("span").classNames("block size-1.5 shrink-0 rounded-full bg-current opacity-45")), Domino7.of("div").classNames("relative min-w-0").append(Domino7.of("div").classNames("relative z-10 rounded-sm text-sm leading-5").attributes({
941
- "data-status-text": ""
942
- }).text(this.text), Domino7.of("div").attributes({
943
- "data-id": this.#pos
944
- }))))).root;
945
- }
946
- updateDOM(dom) {
947
- dom.querySelector("[data-status-text]")?.replaceChildren(this.text);
948
- const trailHost = dom.querySelector("[data-id]");
949
- if (trailHost?.childElementCount === 0) {
950
- trailHost.append(...createTrailLayers2());
951
- }
952
- this.#scheduleTrailRemoval(dom);
953
- return true;
954
- }
955
- destroy(_dom) {
956
- this.#clearOwnedTrailTimer();
957
- }
958
- #scheduleTrailRemoval(dom) {
959
- const previous = trailRemovalTimers2.get(this.#pos);
960
- if (previous !== void 0) {
961
- clearTimeout(previous);
962
- }
963
- const timerId = setTimeout(() => {
964
- if (trailRemovalTimers2.get(this.#pos) !== timerId) {
965
- return;
966
- }
967
- trailRemovalTimers2.delete(this.#pos);
968
- this.#ownedTimerId = null;
969
- dom.querySelector("[data-id]")?.remove();
970
- }, TRAIL_REMOVAL_DELAY_MS2);
971
- trailRemovalTimers2.set(this.#pos, timerId);
972
- this.#ownedTimerId = timerId;
973
- }
974
- #clearOwnedTrailTimer() {
975
- const active = trailRemovalTimers2.get(this.#pos);
976
- if (active !== void 0 && active === this.#ownedTimerId) {
977
- clearTimeout(active);
978
- trailRemovalTimers2.delete(this.#pos);
979
- }
980
- this.#ownedTimerId = null;
981
- }
982
- };
983
- var trail2 = [
984
- "absolute z-0 aspect-[2/1] w-16",
985
- "bg-[radial-gradient(at_100%_50%,_theme(colors.green.700),_transparent_80%)]",
986
- "[offset-anchor:100%_50%] [offset-path:border-box]"
987
- ];
988
- var TRAIL_REMOVAL_DELAY_MS2 = 1e3;
989
- var trailRemovalTimers2 = /* @__PURE__ */ new Map();
990
- var createTrailLayers2 = () => [
991
- Domino7.of("div").classNames(...trail2, "animate-trail").root,
992
- Domino7.of("div").classNames(...trail2, "animate-trail-offset").root
993
- ];
994
-
995
1181
  // src/components/ChatThread/registry.tsx
996
1182
  var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
997
1183
  var componentRegistry = {
998
1184
  //
999
- // DOM Widgets
1185
+ // Block-only (no widget — see note above).
1000
1186
  //
1001
1187
  prompt: {
1002
- block: true,
1003
- factory: ({ children }) => {
1004
- const text = getXmlTextChild(children);
1005
- return text ? new PromptWidget(text) : null;
1006
- }
1188
+ block: true
1007
1189
  },
1190
+ //
1191
+ // DOM Widgets
1192
+ //
1008
1193
  synthetic: {
1009
1194
  block: true,
1010
1195
  factory: ({ children, range }) => {
@@ -1065,10 +1250,10 @@ var componentRegistry = {
1065
1250
  },
1066
1251
  toolCall: {
1067
1252
  block: true,
1068
- Component: (props) => /* @__PURE__ */ React9.createElement("div", {
1253
+ Component: (props) => /* @__PURE__ */ React11.createElement("div", {
1069
1254
  role: "none",
1070
1255
  className: "py-2"
1071
- }, /* @__PURE__ */ React9.createElement(ToolWidget, props))
1256
+ }, /* @__PURE__ */ React11.createElement(ToolWidget, props))
1072
1257
  },
1073
1258
  toolResult: {
1074
1259
  block: true,
@@ -1086,22 +1271,36 @@ var componentRegistry = {
1086
1271
  Component: FallbackWidget
1087
1272
  }
1088
1273
  };
1089
- var blockToMarkdown = (context, message, block) => {
1090
- let str = blockToMarkdownImpl(context, message, block);
1091
- if (str && !block.pending) {
1092
- return str += "\n";
1274
+ var blockToMarkdown = createBlockRenderer("normal");
1275
+ function createBlockRenderer(viewType) {
1276
+ return (context, message, block) => {
1277
+ if (!isBlockVisible(viewType, message, block)) {
1278
+ return;
1279
+ }
1280
+ let str = blockToMarkdownImpl(context, message, block);
1281
+ if (str && !block.pending) {
1282
+ return str += "\n";
1283
+ }
1284
+ return str;
1285
+ };
1286
+ }
1287
+ var isBlockVisible = (viewType, message, block) => {
1288
+ switch (viewType) {
1289
+ case "debug":
1290
+ return true;
1291
+ case "normal":
1292
+ return block._tag !== "reasoning";
1293
+ case "summary":
1294
+ return block._tag === "text" && block.disposition !== "synthetic";
1295
+ case "thinking":
1296
+ default:
1297
+ return true;
1093
1298
  }
1094
- return str;
1095
1299
  };
1096
1300
  var blockToMarkdownImpl = (context, message, block) => {
1097
1301
  log("blockToMarkdown", {
1098
1302
  block: JSON.stringify(block)
1099
- }, {
1100
- F: __dxlog_file,
1101
- L: 150,
1102
- S: void 0,
1103
- C: (f, a) => f(...a)
1104
- });
1303
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 151, S: void 0 });
1105
1304
  switch (block._tag) {
1106
1305
  case "text": {
1107
1306
  if (message.sender.role === "user") {
@@ -1284,34 +1483,35 @@ var MessageSyncer = class {
1284
1483
  // src/components/ChatThread/ChatThread.tsx
1285
1484
  var defaultOptions = {
1286
1485
  autoScroll: true,
1287
- // The `wire` extension intercepts append transactions, buffers the text, and drips it into
1288
- // the editor one character at a time (200 chars/sec by default) while keeping XML elements,
1289
- // markdown links and images atomic. It's what gives the smooth char-by-char typewriter you
1290
- // see in the MarkdownStream/Reasoning story.
1291
- wire: true,
1292
- cursor: true
1293
- };
1294
- var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, debug = false, onEvent }, forwardedRef) => {
1295
- const [controller, setController] = useState4(null);
1296
- const handleMarkdownStreamRef = useCallback3((instance) => {
1486
+ cursor: false,
1487
+ fader: false,
1488
+ typewriter: true
1489
+ };
1490
+ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, footer, debug = false, extensions, viewType, onEvent }, forwardedRef) => {
1491
+ const [controller, setController] = useState6(null);
1492
+ const handleMarkdownStreamRef = useCallback4((instance) => {
1297
1493
  setController(instance);
1298
1494
  setRef(forwardedRef, instance);
1299
1495
  }, [
1300
1496
  forwardedRef
1301
1497
  ]);
1302
- const userHue = useMemo3(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
1498
+ const userHue = useMemo4(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
1303
1499
  identity
1304
1500
  ]);
1305
- useEffect3(() => {
1501
+ useEffect5(() => {
1306
1502
  controller?.scrollToBottom();
1307
1503
  }, [
1308
1504
  controller,
1309
1505
  error
1310
1506
  ]);
1311
- const syncer = useMemo3(() => controller && new MessageSyncer(controller, blockToMarkdown), [
1312
- controller
1507
+ const renderer = useMemo4(() => createBlockRenderer(viewType), [
1508
+ viewType
1313
1509
  ]);
1314
- useEffect3(() => {
1510
+ const syncer = useMemo4(() => controller && new MessageSyncer(controller, renderer), [
1511
+ controller,
1512
+ renderer
1513
+ ]);
1514
+ useEffect5(() => {
1315
1515
  if (!syncer) {
1316
1516
  return;
1317
1517
  }
@@ -1323,7 +1523,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1323
1523
  syncer,
1324
1524
  messages
1325
1525
  ]);
1326
- const handleEvent = useCallback3(({ type, value: value2 }) => {
1526
+ const handleEvent = useCallback4(({ type, value: value2 }) => {
1327
1527
  switch (type) {
1328
1528
  case "submit": {
1329
1529
  value2 && onEvent?.({
@@ -1336,59 +1536,47 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1336
1536
  }, [
1337
1537
  onEvent
1338
1538
  ]);
1339
- return /* @__PURE__ */ React10.createElement("div", {
1539
+ return /* @__PURE__ */ React12.createElement("div", {
1340
1540
  role: "none",
1341
1541
  "data-hue": userHue,
1342
- className: mx6("flex h-full w-full justify-center overflow-hidden", classNames)
1343
- }, /* @__PURE__ */ React10.createElement(MarkdownStream, {
1542
+ className: "contents"
1543
+ }, /* @__PURE__ */ React12.createElement(MarkdownStream, {
1544
+ key: viewType,
1545
+ classNames,
1344
1546
  registry: componentRegistry,
1345
1547
  options,
1346
1548
  debug,
1549
+ extensions,
1550
+ footer,
1347
1551
  onEvent: handleEvent,
1348
1552
  ref: handleMarkdownStreamRef
1349
1553
  }));
1350
1554
  });
1351
1555
 
1352
1556
  // src/components/Chat/Chat.tsx
1353
- var [ChatContextProvider, useChatContext] = createContext("Chat");
1354
- var ChatRoot = ({ children, chat, queue, processor, onEvent, ...props }) => {
1355
- const [debug, setDebug] = useState5(false);
1356
- const pending = useAtomValue(processor.messages);
1357
- const streaming = useAtomValue(processor.streaming);
1358
- const lastPrompt = useRef2(void 0);
1359
- const storedMessages = useQuery2(queue, Filter2.type(Message.Message));
1360
- const messages = useMemo4(() => {
1361
- return Array2.dedupeWith([
1362
- ...storedMessages,
1363
- ...pending
1364
- ], ({ id: a }, { id: b }) => a === b);
1365
- }, [
1366
- storedMessages,
1367
- pending
1557
+ var ChatRoot = ({ children, chat, feed, processor, onEvent, ...props }) => {
1558
+ const [debug, setDebug] = useState7(false);
1559
+ const streaming = useAtomValue2(processor.streaming);
1560
+ const active = useAtomValue2(processor.active);
1561
+ const requestTiming = useRequestTiming({
1562
+ active
1563
+ });
1564
+ const lastPrompt = useRef3(void 0);
1565
+ const db = props.db ?? (chat && Obj3.getDatabase(chat));
1566
+ const feedMessages = useQuery2(feed, Filter2.type(Message.Message));
1567
+ const pendingMessages = useAtomValue2(processor.messages);
1568
+ const messages = useMemo5(() => Array2.dedupeWith([
1569
+ ...feedMessages,
1570
+ ...pendingMessages
1571
+ ], ({ id: a }, { id: b }) => a === b), [
1572
+ feedMessages,
1573
+ pendingMessages
1368
1574
  ]);
1369
- const dump = useCallback4(async () => {
1370
- const objects = processor.context.getObjects();
1371
- const blueprints = processor.context.getBlueprints();
1372
- const system = await processor.getSystemPrompt();
1373
- const tools = await processor.getTools();
1374
- console.group("Chat", {
1375
- objects,
1376
- blueprints
1377
- });
1378
- console.log(trim`
1379
- System Prompt:
1380
- ${system}
1381
- `);
1382
- console.log(trim`
1383
- Tools:
1384
- ${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
1385
- `);
1386
- console.groupEnd();
1387
- }, [
1575
+ const dump = useDebug({
1388
1576
  processor
1389
- ]);
1390
- const event = useMemo4(() => new Event(), []);
1391
- useEffect4(() => {
1577
+ });
1578
+ const event = useMemo5(() => new Event(), []);
1579
+ useEffect6(() => {
1392
1580
  return event.on((ev) => {
1393
1581
  switch (ev.type) {
1394
1582
  case "toggle-debug": {
@@ -1440,18 +1628,37 @@ var ChatRoot = ({ children, chat, queue, processor, onEvent, ...props }) => {
1440
1628
  streaming,
1441
1629
  onEvent
1442
1630
  ]);
1443
- const db = props.db ?? (chat && Obj3.getDatabase(chat));
1444
- return /* @__PURE__ */ React11.createElement(ChatContextProvider, {
1631
+ return /* @__PURE__ */ React13.createElement(ChatContextProvider, {
1445
1632
  debug,
1446
1633
  event,
1447
1634
  db,
1448
1635
  chat,
1449
1636
  messages,
1450
1637
  processor,
1638
+ requestTiming,
1451
1639
  ...props
1452
1640
  }, children);
1453
1641
  };
1454
1642
  ChatRoot.displayName = "Chat.Root";
1643
+ var useRequestTiming = ({ active }) => {
1644
+ const [requestTiming, setRequestTiming] = useState7(null);
1645
+ useEffect6(() => {
1646
+ if (active) {
1647
+ setRequestTiming({
1648
+ startedAt: Date.now(),
1649
+ endedAt: null
1650
+ });
1651
+ } else {
1652
+ setRequestTiming((prev) => prev && prev.endedAt == null ? {
1653
+ ...prev,
1654
+ endedAt: Date.now()
1655
+ } : prev);
1656
+ }
1657
+ }, [
1658
+ active
1659
+ ]);
1660
+ return requestTiming;
1661
+ };
1455
1662
  var CHAT_TOOLBAR_NAME = "Chat.Toolbar";
1456
1663
  var ChatToolbar = composable(({ attendableId, companionTo, ...props }, forwardedRef) => {
1457
1664
  const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
@@ -1459,32 +1666,36 @@ var ChatToolbar = composable(({ attendableId, companionTo, ...props }, forwarded
1459
1666
  chat,
1460
1667
  companionTo
1461
1668
  });
1462
- return /* @__PURE__ */ React11.createElement(Menu.Root, {
1669
+ return /* @__PURE__ */ React13.createElement(Menu.Root, {
1463
1670
  ...menuActions,
1464
1671
  attendableId
1465
- }, /* @__PURE__ */ React11.createElement(Menu.Toolbar, {
1672
+ }, /* @__PURE__ */ React13.createElement(Menu.Toolbar, {
1466
1673
  ...composableProps(props),
1467
1674
  ref: forwardedRef
1468
1675
  }));
1469
1676
  });
1470
1677
  ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
1471
- var CHAT_VIEWPORT_NAME = "Chat.Viewport";
1472
- var ChatViewport = composable(({ children, ...props }, forwardedRef) => {
1473
- return /* @__PURE__ */ React11.createElement("div", {
1678
+ var CHAT_CONTENT_NAME = "Chat.Content";
1679
+ var ChatContent = composable(({ children, ...props }, forwardedRef) => {
1680
+ return /* @__PURE__ */ React13.createElement("div", {
1474
1681
  ...composableProps(props, {
1475
1682
  classNames: "dx-expander flex flex-col"
1476
1683
  }),
1477
1684
  ref: forwardedRef
1478
1685
  }, children);
1479
1686
  });
1480
- ChatViewport.displayName = CHAT_VIEWPORT_NAME;
1687
+ ChatContent.displayName = CHAT_CONTENT_NAME;
1481
1688
  var CHAT_THREAD_NAME = "Chat.Thread";
1482
- var ChatThread2 = (props) => {
1689
+ var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
1483
1690
  const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
1691
+ const debugView = viewType === "debug";
1484
1692
  const identity = useIdentity();
1485
- const error = useAtomValue(processor.error).pipe(Option3.getOrUndefined);
1486
- const controllerRef = useRef2(null);
1487
- useEffect4(() => {
1693
+ const error = useAtomValue2(processor.error).pipe(Option4.getOrUndefined);
1694
+ const extensions = useChatKeymapExtensions2({
1695
+ event
1696
+ });
1697
+ const controllerRef = useRef3(null);
1698
+ useEffect6(() => {
1488
1699
  return event.on((event2) => {
1489
1700
  switch (event2.type) {
1490
1701
  case "submit":
@@ -1502,7 +1713,7 @@ var ChatThread2 = (props) => {
1502
1713
  }, [
1503
1714
  event
1504
1715
  ]);
1505
- const handleEvent = useCallback4((ev) => {
1716
+ const handleEvent = useCallback5((ev) => {
1506
1717
  event.emit(ev);
1507
1718
  }, [
1508
1719
  event
@@ -1510,187 +1721,50 @@ var ChatThread2 = (props) => {
1510
1721
  if (!identity) {
1511
1722
  return null;
1512
1723
  }
1513
- return /* @__PURE__ */ React11.createElement(ChatThread, {
1724
+ return /* @__PURE__ */ React13.createElement(ChatThread, {
1514
1725
  ...props,
1515
1726
  identity,
1516
1727
  messages,
1517
1728
  error,
1518
- debug,
1729
+ debug: debugProp ?? (debug || debugView),
1730
+ viewType,
1731
+ extensions,
1519
1732
  onEvent: handleEvent,
1520
1733
  ref: controllerRef
1521
1734
  });
1522
1735
  };
1523
1736
  ChatThread2.displayName = CHAT_THREAD_NAME;
1524
1737
  var CHAT_PROMPT_NAME = "Chat.Prompt";
1525
- var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
1526
- const { t } = useTranslation6(meta6.id);
1527
- const { db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
1528
- const error = useAtomValue(processor.error).pipe(Option3.getOrUndefined);
1529
- const streaming = useAtomValue(processor.streaming);
1530
- const active = useAtomValue(processor.active);
1531
- const activeRef = useDynamicRef(active);
1532
- const editorRef = useRef2(null);
1533
- const [recordingState, setRecordingState] = useState5(false);
1534
- useEffect4(() => {
1535
- return event.on((event2) => {
1536
- switch (event2.type) {
1537
- case "update-prompt":
1538
- if (!editorRef.current?.getText()?.length) {
1539
- editorRef.current?.setText(event2.text);
1540
- editorRef.current?.focus();
1541
- }
1542
- break;
1543
- case "record-start":
1544
- setRecordingState(true);
1545
- break;
1546
- case "record-stop":
1547
- setRecordingState(false);
1548
- break;
1549
- }
1550
- });
1551
- }, [
1738
+ var ChatPrompt2 = (props) => {
1739
+ const { chat, db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
1740
+ return /* @__PURE__ */ React13.createElement(ChatPrompt, {
1741
+ ...props,
1742
+ chat,
1743
+ db,
1744
+ processor,
1552
1745
  event
1553
- ]);
1554
- const { recording } = useVoiceInput({
1555
- active: recordingState,
1556
- onUpdate: (text) => {
1557
- editorRef.current?.setText(text);
1558
- editorRef.current?.focus();
1559
- }
1560
1746
  });
1561
- const extensions = useMemo4(() => {
1562
- return [
1563
- Prec.highest(keymap.of([
1564
- {
1565
- key: "Mod-d",
1566
- preventDefault: true,
1567
- run: () => {
1568
- event.emit({
1569
- type: "toggle-debug"
1570
- });
1571
- return true;
1572
- }
1573
- },
1574
- {
1575
- key: "Mod-ArrowUp",
1576
- preventDefault: true,
1577
- run: () => {
1578
- event.emit({
1579
- type: "nav-previous"
1580
- });
1581
- return true;
1582
- },
1583
- shift: () => {
1584
- event.emit({
1585
- type: "thread-open"
1586
- });
1587
- return true;
1588
- }
1589
- },
1590
- {
1591
- key: "Mod-ArrowDown",
1592
- preventDefault: true,
1593
- run: () => {
1594
- event.emit({
1595
- type: "nav-next"
1596
- });
1597
- return true;
1598
- },
1599
- shift: () => {
1600
- event.emit({
1601
- type: "thread-close"
1602
- });
1603
- return true;
1604
- }
1605
- }
1606
- ]))
1607
- ].filter(isTruthy);
1608
- }, [
1609
- event,
1610
- expandable
1611
- ]);
1612
- const handleSubmit = useCallback4((text) => {
1613
- if (!activeRef.current) {
1614
- event.emit({
1615
- type: "submit",
1616
- text
1617
- });
1618
- return true;
1619
- }
1620
- }, [
1621
- event
1622
- ]);
1623
- const handleEvent = useCallback4((ev) => {
1624
- event.emit(ev);
1625
- }, [
1626
- event
1627
- ]);
1628
- return /* @__PURE__ */ React11.createElement("div", {
1629
- role: "group",
1630
- className: mx7("flex flex-col w-full dx-density-fine", outline && "bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm", classNames)
1631
- }, /* @__PURE__ */ React11.createElement("div", {
1632
- role: "none",
1633
- className: "flex p-2 gap-2"
1634
- }, /* @__PURE__ */ React11.createElement(ChatStatusIndicator, {
1635
- classNames: "p-1",
1636
- preset,
1637
- error,
1638
- processing: streaming
1639
- }), /* @__PURE__ */ React11.createElement(ChatEditor, {
1640
- ref: editorRef,
1641
- autoFocus: true,
1642
- lineWrapping: true,
1643
- classNames: "col-span-2 pt-0.5",
1644
- placeholder: placeholder ?? t("prompt.placeholder"),
1645
- extensions,
1646
- onSubmit: handleSubmit
1647
- })), db && settings && /* @__PURE__ */ React11.createElement("div", {
1648
- role: "none",
1649
- className: "flex items-center overflow-hidden"
1650
- }, /* @__PURE__ */ React11.createElement(ChatOptions, {
1651
- db,
1652
- blueprintRegistry: processor.blueprintRegistry,
1653
- context: processor.context,
1654
- preset,
1655
- presets,
1656
- onPresetChange
1657
- }), /* @__PURE__ */ React11.createElement("div", {
1658
- role: "none",
1659
- className: "flex grow overflow-x-auto scrollbar-none"
1660
- }, /* @__PURE__ */ React11.createElement(ChatReferences, {
1661
- db,
1662
- context: processor.context
1663
- })), /* @__PURE__ */ React11.createElement(ChatActions, {
1664
- classNames: "col-span-2",
1665
- microphone: true,
1666
- recording,
1667
- processing: streaming,
1668
- onEvent: handleEvent
1669
- }, online !== void 0 && /* @__PURE__ */ React11.createElement(Input2.Root, null, /* @__PURE__ */ React11.createElement(Input2.Label, {
1670
- srOnly: true
1671
- }, t("online-switch.label")), /* @__PURE__ */ React11.createElement(Input2.Switch, {
1672
- classNames: "mx-2",
1673
- checked: online,
1674
- onCheckedChange: onOnlineChange
1675
- })))));
1676
1747
  };
1677
- ChatPrompt.displayName = CHAT_PROMPT_NAME;
1748
+ ChatPrompt2.displayName = CHAT_PROMPT_NAME;
1678
1749
  var Chat = {
1679
1750
  Root: ChatRoot,
1680
1751
  Toolbar: ChatToolbar,
1681
- Viewport: ChatViewport,
1682
- Thread: ChatThread2,
1683
- Prompt: ChatPrompt
1752
+ Content: ChatContent,
1753
+ Prompt: ChatPrompt2,
1754
+ Status: ChatStatus,
1755
+ Thread: ChatThread2
1684
1756
  };
1685
1757
 
1686
1758
  // src/components/ProcessTree/ProcessTree.tsx
1687
1759
  import * as Match from "effect/Match";
1688
- import React12 from "react";
1760
+ import * as Option5 from "effect/Option";
1761
+ import React14 from "react";
1689
1762
  import { Process } from "@dxos/functions-runtime";
1690
- import { Icon as Icon2, ScrollArea, Treegrid } from "@dxos/react-ui";
1691
- import { composable as composable2, composableProps as composableProps2, mx as mx8 } from "@dxos/ui-theme";
1692
- var ProcessTree = composable2(({ processes, onProcessSelect, ...props }, forwardedRef) => {
1693
- const filteredProcesses = [
1763
+ import { Icon as Icon2, IconButton as IconButton4, ScrollArea, Tooltip as Tooltip2, Treegrid } from "@dxos/react-ui";
1764
+ import { composable as composable2, composableProps as composableProps2, mx as mx7 } from "@dxos/ui-theme";
1765
+ import { Unit as Unit2 } from "@dxos/util";
1766
+ var ProcessTree = composable2(({ processes, onProcessSelect, onProcessTerminate, ...props }, forwardedRef) => {
1767
+ const sortedProcesses = [
1694
1768
  ...processes.filter((process) => [
1695
1769
  Process.State.RUNNING,
1696
1770
  Process.State.HYBERNATING
@@ -1702,43 +1776,65 @@ var ProcessTree = composable2(({ processes, onProcessSelect, ...props }, forward
1702
1776
  Process.State.SUCCEEDED,
1703
1777
  Process.State.FAILED,
1704
1778
  Process.State.TERMINATED
1705
- ].includes(process.state)).slice(0, 3)
1706
- ];
1707
- return /* @__PURE__ */ React12.createElement(ScrollArea.Root, {
1779
+ ].includes(process.state))
1780
+ ].sort((a, b) => {
1781
+ const aCompletedAt = Option5.getOrElse(a.completedAt, () => Infinity);
1782
+ const bCompletedAt = Option5.getOrElse(b.completedAt, () => Infinity);
1783
+ return bCompletedAt - aCompletedAt;
1784
+ });
1785
+ return /* @__PURE__ */ React14.createElement(ScrollArea.Root, {
1708
1786
  ...composableProps2(props, {
1709
1787
  classNames: "dx-expander"
1710
1788
  }),
1711
1789
  thin: true,
1712
1790
  ref: forwardedRef
1713
- }, /* @__PURE__ */ React12.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React12.createElement(Treegrid.Root, {
1791
+ }, /* @__PURE__ */ React14.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React14.createElement(Treegrid.Root, {
1714
1792
  gridTemplateColumns: "1fr"
1715
- }, filteredProcesses.filter((process) => process.parentPid === null).map((process) => {
1716
- const activeChildren = filteredProcesses.filter((candidate) => candidate.parentPid?.toString() === process.pid.toString() && candidate.state === Process.State.RUNNING);
1717
- return /* @__PURE__ */ React12.createElement(Treegrid.Row, {
1793
+ }, sortedProcesses.filter((process) => process.parentPid === null).map((process) => {
1794
+ return /* @__PURE__ */ React14.createElement(Treegrid.Row, {
1718
1795
  key: process.pid.toString(),
1719
1796
  id: process.pid.toString(),
1720
1797
  parentOf: process.parentPid?.toString()
1721
- }, /* @__PURE__ */ React12.createElement(Treegrid.Cell, {
1798
+ }, /* @__PURE__ */ React14.createElement(Treegrid.Cell, {
1722
1799
  indent: true,
1723
- classNames: "flex items-center p-1 gap-2 min-w-0",
1800
+ classNames: mx7("grid grid-cols-[min-content_1fr_min-content_min-content] items-center gap-1 min-w-0", onProcessSelect && "dx-hover"),
1724
1801
  onClick: () => onProcessSelect?.(process)
1725
- }, /* @__PURE__ */ React12.createElement(Icon2, {
1802
+ }, /* @__PURE__ */ React14.createElement(Tooltip2.Trigger, {
1803
+ className: "p-1",
1804
+ content: process.state.toString()
1805
+ }, /* @__PURE__ */ React14.createElement(Icon2, {
1726
1806
  size: 4,
1727
- classNames: mx8(process.state === Process.State.RUNNING && "animate-spin", process.state === Process.State.FAILED && "text-error-text", process.state === Process.State.SUCCEEDED && "text-success-text"),
1807
+ classNames: mx7(process.state === Process.State.RUNNING && "animate-spin", process.state === Process.State.FAILED && "text-error-text", process.state === Process.State.SUCCEEDED && "text-success-text"),
1728
1808
  icon: Match.value(process.state).pipe(Match.when(Process.State.RUNNING, () => "ph--spinner-gap--regular"), Match.when(Process.State.SUCCEEDED, () => "ph--check-circle--regular"), Match.when(Process.State.FAILED, () => "ph--warning--regular"), Match.when(Process.State.HYBERNATING, () => "ph--spinner--regular"), Match.when(Process.State.IDLE, () => "ph--hourglass--regular"), Match.when(Process.State.TERMINATING, () => "ph--x-circle--regular"), Match.when(Process.State.TERMINATED, () => "ph--x-circle--regular"), Match.orElse(() => "ph--spinner-gap--regular"))
1729
- }), /* @__PURE__ */ React12.createElement("div", {
1809
+ })), /* @__PURE__ */ React14.createElement("div", {
1730
1810
  role: "none",
1731
1811
  className: "flex items-center gap-2 text-xs overflow-hidden"
1732
- }, /* @__PURE__ */ React12.createElement("span", {
1733
- className: "truncate text-description"
1734
- }, process.params.name))));
1812
+ }, /* @__PURE__ */ React14.createElement("span", {
1813
+ className: "truncate text-description select-none"
1814
+ }, process.params.name ?? process.pid.toString())), [
1815
+ Process.State.FAILED,
1816
+ Process.State.SUCCEEDED
1817
+ ].includes(process.state) && /* @__PURE__ */ React14.createElement("div", {
1818
+ className: "text-xs text-description tabular-nums"
1819
+ }, Unit2.Millisecond(process.metrics.wallTime).toString()) || /* @__PURE__ */ React14.createElement("div", null), onProcessTerminate && /* @__PURE__ */ React14.createElement(IconButton4, {
1820
+ classNames: "min-h-0 p-1",
1821
+ icon: "ph--x--regular",
1822
+ iconOnly: true,
1823
+ variant: "ghost",
1824
+ size: 4,
1825
+ label: "Actions",
1826
+ onClick: (event) => {
1827
+ event.stopPropagation();
1828
+ onProcessTerminate?.(process);
1829
+ }
1830
+ })));
1735
1831
  }))));
1736
1832
  });
1737
1833
 
1738
1834
  // src/components/TemplateEditor/TemplateEditor.tsx
1739
1835
  import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
1740
1836
  import { composeRefs } from "@radix-ui/react-compose-refs";
1741
- import React13 from "react";
1837
+ import React15 from "react";
1742
1838
  import { createDocAccessor } from "@dxos/echo-db";
1743
1839
  import { useThemeContext, useTranslation as useTranslation7 } from "@dxos/react-ui";
1744
1840
  import { useTextEditor } from "@dxos/react-ui-editor";
@@ -1750,8 +1846,8 @@ import { meta as meta7 } from "#meta";
1750
1846
  // src/components/TemplateEditor/extensions/handlebars-extension.ts
1751
1847
  import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
1752
1848
  import { RangeSetBuilder } from "@codemirror/state";
1753
- import { Decoration, ViewPlugin, WidgetType as WidgetType8, keymap as keymap2 } from "@codemirror/view";
1754
- import { Domino as Domino8, mx as mx9 } from "@dxos/ui";
1849
+ import { Decoration, ViewPlugin, WidgetType as WidgetType7, keymap } from "@codemirror/view";
1850
+ import { Domino as Domino7, mx as mx8 } from "@dxos/ui";
1755
1851
  var handlebars = (_ = {}) => {
1756
1852
  return [
1757
1853
  handlebarsHighlightPlugin,
@@ -1763,7 +1859,7 @@ var handlebars = (_ = {}) => {
1763
1859
  handlebarsCompletions
1764
1860
  ]
1765
1861
  }),
1766
- keymap2.of(completionKeymap)
1862
+ keymap.of(completionKeymap)
1767
1863
  ];
1768
1864
  };
1769
1865
  var regex = {
@@ -1823,7 +1919,7 @@ var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
1823
1919
  from: start,
1824
1920
  to: end,
1825
1921
  decoration: Decoration.mark({
1826
- class: mx9("dx-tag--blue", tagPadding)
1922
+ class: mx8("dx-tag--blue", tagPadding)
1827
1923
  })
1828
1924
  });
1829
1925
  }
@@ -1894,7 +1990,7 @@ var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
1894
1990
  }, {
1895
1991
  decorations: (v) => v.decorations
1896
1992
  });
1897
- var DXNWidget = class extends WidgetType8 {
1993
+ var DXNWidget = class extends WidgetType7 {
1898
1994
  _identifier;
1899
1995
  constructor(_identifier) {
1900
1996
  super(), this._identifier = _identifier;
@@ -1914,7 +2010,7 @@ var DXNWidget = class extends WidgetType8 {
1914
2010
  }
1915
2011
  return part;
1916
2012
  }).join(":");
1917
- return Domino8.of("span").classNames(mx9("font-mono dx-tag--blue", tagPadding)).text(text).root;
2013
+ return Domino7.of("span").classNames(mx8("font-mono dx-tag--blue", tagPadding)).text(text).root;
1918
2014
  }
1919
2015
  };
1920
2016
  var variables = [
@@ -2008,16 +2104,16 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
2008
2104
  const { t } = useTranslation7(meta7.id);
2009
2105
  const { themeMode } = useThemeContext();
2010
2106
  const { parentRef } = useTextEditor(() => {
2011
- const text = template.source?.target;
2012
- if (!text) {
2107
+ const target = template.source?.target;
2108
+ if (!target) {
2013
2109
  return {};
2014
2110
  }
2015
2111
  return {
2016
- initialValue: text.content ?? "",
2112
+ initialValue: target.content ?? "",
2017
2113
  extensions: [
2018
2114
  createDataExtensions({
2019
2115
  id,
2020
- text: createDocAccessor(text, [
2116
+ text: createDocAccessor(target, [
2021
2117
  "content"
2022
2118
  ])
2023
2119
  }),
@@ -2044,7 +2140,7 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
2044
2140
  template.source?.target,
2045
2141
  lineNumbers
2046
2142
  ]);
2047
- return /* @__PURE__ */ React13.createElement("div", {
2143
+ return /* @__PURE__ */ React15.createElement("div", {
2048
2144
  ...composableProps3(props, {
2049
2145
  role: "none",
2050
2146
  classNames: [
@@ -2057,21 +2153,21 @@ var TemplateEditor = composable3(({ classNames, id, template, lineNumbers = true
2057
2153
  });
2058
2154
 
2059
2155
  // src/components/Toolbox/Toolbox.tsx
2060
- import React14, { Fragment, useEffect as useEffect5, useState as useState6 } from "react";
2156
+ import React16, { Fragment, useEffect as useEffect7, useState as useState8 } from "react";
2157
+ import { Operation } from "@dxos/compute";
2061
2158
  import { log as log2 } from "@dxos/log";
2062
- import { Operation } from "@dxos/operation";
2063
2159
  import { Filter as Filter3, useQuery as useQuery3 } from "@dxos/react-client/echo";
2064
2160
  import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
2065
- import { composable as composable4, composableProps as composableProps4, mx as mx10 } from "@dxos/ui-theme";
2066
- import { ServiceType as ServiceType2 } from "#types";
2161
+ import { composable as composable4, composableProps as composableProps4, mx as mx9 } from "@dxos/ui-theme";
2162
+ import { ServiceType } from "#types";
2067
2163
  var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
2068
2164
  var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints, ...props }, forwardedRef) => {
2069
- return /* @__PURE__ */ React14.createElement(ScrollArea2.Root, {
2165
+ return /* @__PURE__ */ React16.createElement(ScrollArea2.Root, {
2070
2166
  ...composableProps4(props),
2071
2167
  thin: true,
2072
2168
  orientation: "vertical",
2073
2169
  ref: forwardedRef
2074
- }, /* @__PURE__ */ React14.createElement(ScrollArea2.Viewport, null, blueprints && blueprints.length > 0 && /* @__PURE__ */ React14.createElement(Section, {
2170
+ }, /* @__PURE__ */ React16.createElement(ScrollArea2.Viewport, null, blueprints && blueprints.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
2075
2171
  title: "Blueprints",
2076
2172
  items: blueprints.map(({ name, description, tools }) => ({
2077
2173
  name,
@@ -2080,7 +2176,7 @@ var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints,
2080
2176
  name: `\u2219 ${safeToolId(toolId)}`
2081
2177
  }))
2082
2178
  }))
2083
- }), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React14.createElement(Section, {
2179
+ }), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
2084
2180
  title: "Blueprints",
2085
2181
  items: activeBlueprints.map(({ target }) => ({
2086
2182
  name: target?.name ?? "",
@@ -2089,13 +2185,13 @@ var Toolbox = composable4(({ functions, services, blueprints, activeBlueprints,
2089
2185
  name: `\u2219 ${safeToolId(toolId)}`
2090
2186
  }))
2091
2187
  }))
2092
- }), services && services.length > 0 && /* @__PURE__ */ React14.createElement(Section, {
2188
+ }), services && services.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
2093
2189
  title: "Services",
2094
2190
  items: services.map(({ service: { serviceId, name, description } }) => ({
2095
2191
  name: name ?? serviceId,
2096
2192
  description
2097
2193
  }))
2098
- }), functions && functions.length > 0 && /* @__PURE__ */ React14.createElement(Section, {
2194
+ }), functions && functions.length > 0 && /* @__PURE__ */ React16.createElement(Section, {
2099
2195
  title: "Functions",
2100
2196
  items: functions.map(({ name, description }) => ({
2101
2197
  name,
@@ -2107,47 +2203,42 @@ Toolbox.displayName = "Toolbox";
2107
2203
  var Section = ({ title, items, striped }) => {
2108
2204
  const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
2109
2205
  const gridClassNames = "grid grid-cols-[8rem_1fr]";
2110
- const subGridClassNames = mx10("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
2111
- return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("h1", {
2206
+ const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
2207
+ return /* @__PURE__ */ React16.createElement("div", null, /* @__PURE__ */ React16.createElement("h1", {
2112
2208
  className: "px-2 text-sm"
2113
- }, title), /* @__PURE__ */ React14.createElement("div", {
2209
+ }, title), /* @__PURE__ */ React16.createElement("div", {
2114
2210
  className: gridClassNames
2115
- }, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React14.createElement(Fragment, {
2211
+ }, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React16.createElement(Fragment, {
2116
2212
  key: i
2117
- }, name && /* @__PURE__ */ React14.createElement("div", {
2213
+ }, name && /* @__PURE__ */ React16.createElement("div", {
2118
2214
  className: subGridClassNames
2119
- }, /* @__PURE__ */ React14.createElement("div", {
2215
+ }, /* @__PURE__ */ React16.createElement("div", {
2120
2216
  className: "truncate text-primary-500"
2121
- }, name), /* @__PURE__ */ React14.createElement("div", {
2217
+ }, name), /* @__PURE__ */ React16.createElement("div", {
2122
2218
  className: "line-clamp-2"
2123
- }, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React14.createElement("div", {
2219
+ }, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React16.createElement("div", {
2124
2220
  key: i2,
2125
- className: mx10(subGridClassNames, striped && stripeClassNames)
2126
- }, /* @__PURE__ */ React14.createElement("div", {
2221
+ className: mx9(subGridClassNames, striped && stripeClassNames)
2222
+ }, /* @__PURE__ */ React16.createElement("div", {
2127
2223
  className: "truncate"
2128
- }, name2), /* @__PURE__ */ React14.createElement("div", {
2224
+ }, name2), /* @__PURE__ */ React16.createElement("div", {
2129
2225
  className: "line-clamp-3 text-subdued"
2130
2226
  }, description2)))))));
2131
2227
  };
2132
2228
  var ToolboxPanel = ({ classNames, db, processor }) => {
2133
- const services = useQuery3(db, Filter3.type(ServiceType2));
2134
- const [serviceTools, setServiceTools] = useState6([]);
2135
- useEffect5(() => {
2229
+ const services = useQuery3(db, Filter3.type(ServiceType));
2230
+ const [serviceTools, setServiceTools] = useState8([]);
2231
+ useEffect7(() => {
2136
2232
  log2("creating service tools...", {
2137
2233
  services: services.length
2138
- }, {
2139
- F: __dxlog_file2,
2140
- L: 122,
2141
- S: void 0,
2142
- C: (f, a) => f(...a)
2143
- });
2234
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 80, S: void 0 });
2144
2235
  queueMicrotask(async () => {
2145
2236
  });
2146
2237
  }, [
2147
2238
  services
2148
2239
  ]);
2149
2240
  const functions = useQuery3(db, Filter3.type(Operation.PersistentOperation));
2150
- return /* @__PURE__ */ React14.createElement(Toolbox, {
2241
+ return /* @__PURE__ */ React16.createElement(Toolbox, {
2151
2242
  classNames,
2152
2243
  blueprints: processor?.context.getBlueprints(),
2153
2244
  services: serviceTools,
@@ -2159,28 +2250,28 @@ var safeToolId = (name) => {
2159
2250
  };
2160
2251
 
2161
2252
  // src/components/index.ts
2162
- var AssistantSettings = lazy(() => import("./AssistantSettings-UVUTKO7E.mjs"));
2253
+ var AssistantSettings = lazy(() => import("./AssistantSettings-23A5IMHS.mjs"));
2163
2254
 
2164
2255
  // src/hooks/useBlueprintRegistry.ts
2165
- import { useCallback as useCallback5, useEffect as useEffect6, useMemo as useMemo5, useState as useState7 } from "react";
2256
+ import { useCallback as useCallback6, useEffect as useEffect8, useMemo as useMemo6, useState as useState9 } from "react";
2166
2257
  import { useCapabilities } from "@dxos/app-framework/ui";
2167
2258
  import { AppCapabilities } from "@dxos/app-toolkit";
2168
- import { Blueprint } from "@dxos/blueprints";
2259
+ import { Blueprint } from "@dxos/compute";
2169
2260
  import { Filter as Filter4, Obj as Obj4, Ref } from "@dxos/echo";
2170
2261
  import { useQuery as useQuery4 } from "@dxos/react-client/echo";
2171
2262
  import { distinctBy } from "@dxos/util";
2172
2263
  var useBlueprintRegistry = () => {
2173
2264
  const blueprintDefinitions = useCapabilities(AppCapabilities.BlueprintDefinition);
2174
- return useMemo5(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
2265
+ return useMemo6(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
2175
2266
  blueprintDefinitions
2176
2267
  ]);
2177
2268
  };
2178
2269
  var useBlueprints2 = ({ blueprintRegistry, db }) => {
2179
- const staticBlueprints = useMemo5(() => blueprintRegistry?.query() ?? [], [
2270
+ const staticBlueprints = useMemo6(() => blueprintRegistry?.query() ?? [], [
2180
2271
  blueprintRegistry
2181
2272
  ]);
2182
2273
  const spaceBlueprints = useQuery4(db, Filter4.type(Blueprint.Blueprint));
2183
- return useMemo5(() => {
2274
+ return useMemo6(() => {
2184
2275
  const blueprints = distinctBy([
2185
2276
  ...staticBlueprints,
2186
2277
  ...spaceBlueprints
@@ -2193,8 +2284,8 @@ var useBlueprints2 = ({ blueprintRegistry, db }) => {
2193
2284
  ]);
2194
2285
  };
2195
2286
  var useActiveBlueprints2 = ({ context }) => {
2196
- const [active, setActive] = useState7(/* @__PURE__ */ new Map());
2197
- useEffect6(() => {
2287
+ const [active, setActive] = useState9(/* @__PURE__ */ new Map());
2288
+ useEffect8(() => {
2198
2289
  if (!context) {
2199
2290
  setActive(/* @__PURE__ */ new Map());
2200
2291
  return;
@@ -2214,7 +2305,7 @@ var useActiveBlueprints2 = ({ context }) => {
2214
2305
  return active;
2215
2306
  };
2216
2307
  var useBlueprintHandlers2 = ({ db, context, blueprintRegistry }) => {
2217
- const onUpdateBlueprint = useCallback5(async (key, checked) => {
2308
+ const onUpdateBlueprint = useCallback6(async (key, checked) => {
2218
2309
  if (!context || !blueprintRegistry) {
2219
2310
  return;
2220
2311
  }
@@ -2250,10 +2341,58 @@ var useBlueprintHandlers2 = ({ db, context, blueprintRegistry }) => {
2250
2341
  };
2251
2342
  };
2252
2343
 
2344
+ // src/hooks/useChatKeymap.ts
2345
+ import { Prec } from "@codemirror/state";
2346
+ import { keymap as keymap2 } from "@codemirror/view";
2347
+ import { useMemo as useMemo7 } from "react";
2348
+ import { isTruthy } from "@dxos/util";
2349
+ var useChatKeymapExtensions3 = ({ event }) => {
2350
+ return useMemo7(() => {
2351
+ return [
2352
+ Prec.highest(keymap2.of([
2353
+ {
2354
+ key: "Mod-ArrowUp",
2355
+ preventDefault: true,
2356
+ run: () => {
2357
+ event.emit({
2358
+ type: "nav-previous"
2359
+ });
2360
+ return true;
2361
+ },
2362
+ shift: () => {
2363
+ event.emit({
2364
+ type: "thread-open"
2365
+ });
2366
+ return true;
2367
+ }
2368
+ },
2369
+ {
2370
+ key: "Mod-ArrowDown",
2371
+ preventDefault: true,
2372
+ run: () => {
2373
+ event.emit({
2374
+ type: "nav-next"
2375
+ });
2376
+ return true;
2377
+ },
2378
+ shift: () => {
2379
+ event.emit({
2380
+ type: "thread-close"
2381
+ });
2382
+ return true;
2383
+ }
2384
+ }
2385
+ ]))
2386
+ ].filter(isTruthy);
2387
+ }, [
2388
+ event
2389
+ ]);
2390
+ };
2391
+
2253
2392
  // src/hooks/useChatProcessor.ts
2254
2393
  import { RegistryContext } from "@effect-atom/atom-react";
2255
2394
  import * as Effect2 from "effect/Effect";
2256
- import { useContext, useMemo as useMemo6, useState as useState8 } from "react";
2395
+ import { useContext, useMemo as useMemo8, useState as useState10 } from "react";
2257
2396
  import { AiSession } from "@dxos/assistant";
2258
2397
  import { Ref as Ref2 } from "@dxos/echo";
2259
2398
  import { createFeedServiceLayer } from "@dxos/echo-db";
@@ -2318,15 +2457,16 @@ var AiServicePresets = [
2318
2457
  import { Atom, Registry } from "@effect-atom/atom-react";
2319
2458
  import * as Effect from "effect/Effect";
2320
2459
  import * as Fiber from "effect/Fiber";
2321
- import * as Option4 from "effect/Option";
2460
+ import * as Option6 from "effect/Option";
2322
2461
  import * as Stream from "effect/Stream";
2323
2462
  import { DEFAULT_EDGE_MODEL } from "@dxos/ai";
2324
- import { AiContextService, createSystemPrompt, formatSystemPrompt, AgentService, PartialBlock, ToolExecutionServices } from "@dxos/assistant";
2463
+ import { AiContextService, createSystemPrompt, formatSystemPrompt, PartialBlock, ToolExecutionServices } from "@dxos/assistant";
2464
+ import { Trace } from "@dxos/compute";
2465
+ import { Operation as Operation2 } from "@dxos/compute";
2325
2466
  import { Obj as Obj5 } from "@dxos/echo";
2326
2467
  import { runAndForwardErrors, unwrapExit } from "@dxos/effect";
2327
- import { Trace } from "@dxos/functions";
2468
+ import { AgentService } from "@dxos/functions-runtime";
2328
2469
  import { log as log3 } from "@dxos/log";
2329
- import { Operation as Operation2 } from "@dxos/operation";
2330
2470
  import { Message as Message2 } from "@dxos/types";
2331
2471
  var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/processor/processor.ts";
2332
2472
  var defaultOptions2 = {
@@ -2359,7 +2499,7 @@ var AiChatProcessor = class {
2359
2499
  ...get(this.#streaming)
2360
2500
  ]);
2361
2501
  /** Last error. */
2362
- error = Atom.make(Option4.none());
2502
+ error = Atom.make(Option6.none());
2363
2503
  constructor(_conversation, _runtime, _feed, _options = defaultOptions2) {
2364
2504
  this._conversation = _conversation;
2365
2505
  this._runtime = _runtime;
@@ -2408,18 +2548,13 @@ var AiChatProcessor = class {
2408
2548
  }
2409
2549
  try {
2410
2550
  this.#lastRequest = requestProp;
2411
- this.#registry.set(this.error, Option4.none());
2551
+ this.#registry.set(this.error, Option6.none());
2412
2552
  this.#registry.set(this.active, true);
2413
2553
  const effect = Effect.gen(this, function* () {
2414
2554
  log3.info("init agent session", {
2415
2555
  feed: Obj5.getDXN(this._feed).toString(),
2416
2556
  model: this._options.model
2417
- }, {
2418
- F: __dxlog_file3,
2419
- L: 166,
2420
- S: this,
2421
- C: (f, a) => f(...a)
2422
- });
2557
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 95, S: this });
2423
2558
  const session = yield* AgentService.getSession(this._feed, {
2424
2559
  model: this._options.model
2425
2560
  });
@@ -2433,26 +2568,11 @@ var AiChatProcessor = class {
2433
2568
  })), Effect.fork);
2434
2569
  log3("chat processor submitting prompt", {
2435
2570
  length: requestProp.message.length
2436
- }, {
2437
- F: __dxlog_file3,
2438
- L: 182,
2439
- S: this,
2440
- C: (f, a) => f(...a)
2441
- });
2571
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 110, S: this });
2442
2572
  yield* session.submitPrompt(requestProp.message);
2443
- log3("chat processor submitPrompt returned, waiting for agent", {}, {
2444
- F: __dxlog_file3,
2445
- L: 184,
2446
- S: this,
2447
- C: (f, a) => f(...a)
2448
- });
2573
+ log3("chat processor submitPrompt returned, waiting for agent", {}, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 114, S: this });
2449
2574
  yield* session.waitForCompletion();
2450
- log3.info("session complete", void 0, {
2451
- F: __dxlog_file3,
2452
- L: 186,
2453
- S: this,
2454
- C: (f, a) => f(...a)
2455
- });
2575
+ log3.info("session complete", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 116, S: this });
2456
2576
  this.#flushStreaming();
2457
2577
  yield* this.#maybeUpdateChatName();
2458
2578
  });
@@ -2465,28 +2585,18 @@ var AiChatProcessor = class {
2465
2585
  }
2466
2586
  throw err;
2467
2587
  }
2468
- this.#registry.set(this.error, Option4.none());
2588
+ this.#registry.set(this.error, Option6.none());
2469
2589
  this.#lastRequest = void 0;
2470
2590
  this.#requestFiber = void 0;
2471
2591
  } catch (err) {
2472
2592
  log3.error("request failed", {
2473
2593
  error: err
2474
- }, {
2475
- F: __dxlog_file3,
2476
- L: 208,
2477
- S: this,
2478
- C: (f, a) => f(...a)
2479
- });
2480
- this.#registry.set(this.error, Option4.some(new Error("AI service error", {
2594
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 133, S: this });
2595
+ this.#registry.set(this.error, Option6.some(new Error("AI service error", {
2481
2596
  cause: err
2482
2597
  })));
2483
2598
  } finally {
2484
- log3.info("setting active to false", void 0, {
2485
- F: __dxlog_file3,
2486
- L: 211,
2487
- S: this,
2488
- C: (f, a) => f(...a)
2489
- });
2599
+ log3.info("setting active to false", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 140, S: this });
2490
2600
  this.#registry.set(this.active, false);
2491
2601
  this.#requestFiber = void 0;
2492
2602
  }
@@ -2600,12 +2710,7 @@ var AiChatProcessor = class {
2600
2710
  log3.info("scheduling chat name update", {
2601
2711
  hasName: !!chat.name,
2602
2712
  chance
2603
- }, {
2604
- F: __dxlog_file3,
2605
- L: 318,
2606
- S: this,
2607
- C: (f, a) => f(...a)
2608
- });
2713
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 246, S: this });
2609
2714
  return Operation2.schedule(UpdateChatName, {
2610
2715
  chat
2611
2716
  });
@@ -2616,7 +2721,7 @@ var AiChatProcessor = class {
2616
2721
  var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
2617
2722
  var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegistry, settings }) => {
2618
2723
  const observableRegistry = useContext(RegistryContext);
2619
- const [session, setSession] = useState8();
2724
+ const [session, setSession] = useState10();
2620
2725
  useAsyncEffect(async () => {
2621
2726
  if (!space || !chat) {
2622
2727
  return;
@@ -2643,7 +2748,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
2643
2748
  chat?.feed.target
2644
2749
  ]);
2645
2750
  const feed = chat?.feed.target;
2646
- const processor = useMemo6(() => {
2751
+ const processor = useMemo8(() => {
2647
2752
  if (!runtime3 || !session || !chat || !feed) {
2648
2753
  return void 0;
2649
2754
  }
@@ -2651,12 +2756,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
2651
2756
  preset,
2652
2757
  model: preset?.model,
2653
2758
  settings
2654
- }, {
2655
- F: __dxlog_file4,
2656
- L: 80,
2657
- S: void 0,
2658
- C: (f, a) => f(...a)
2659
- });
2759
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 49, S: void 0 });
2660
2760
  return new AiChatProcessor(session, runtime3, feed, {
2661
2761
  chat: chat ? Ref2.make(chat) : void 0,
2662
2762
  observableRegistry,
@@ -2674,7 +2774,7 @@ var useChatProcessor = ({ space, chat, preset, runtime: runtime3, blueprintRegis
2674
2774
  };
2675
2775
 
2676
2776
  // src/hooks/useChatServices.ts
2677
- import { useMemo as useMemo7 } from "react";
2777
+ import { useMemo as useMemo9 } from "react";
2678
2778
  import { useCapability } from "@dxos/app-framework/ui";
2679
2779
  import { getPersonalSpace } from "@dxos/app-toolkit";
2680
2780
  import { AutomationCapabilities } from "@dxos/plugin-automation/types";
@@ -2683,7 +2783,7 @@ var useChatServices = ({ id }) => {
2683
2783
  const client = useClient();
2684
2784
  id ??= getPersonalSpace(client)?.id;
2685
2785
  const runtimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
2686
- return useMemo7(() => !id ? void 0 : runtimeResolver.getRuntime(id), [
2786
+ return useMemo9(() => !id ? void 0 : runtimeResolver.getRuntime(id), [
2687
2787
  id
2688
2788
  ]);
2689
2789
  };
@@ -2691,7 +2791,7 @@ var useChatServices = ({ id }) => {
2691
2791
  // src/hooks/useChatToolbarActions.ts
2692
2792
  import { Atom as Atom2 } from "@effect-atom/atom-react";
2693
2793
  import * as Effect3 from "effect/Effect";
2694
- import { useMemo as useMemo8 } from "react";
2794
+ import { useMemo as useMemo10 } from "react";
2695
2795
  import { useOperationInvoker } from "@dxos/app-framework/ui";
2696
2796
  import { Chat as Chat2 } from "@dxos/assistant-toolkit";
2697
2797
  import { Filter as Filter5, Obj as Obj6, Query } from "@dxos/echo";
@@ -2708,7 +2808,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
2708
2808
  const { db } = useChatContext2("useChatToolbarActions");
2709
2809
  const query = companionTo ? Query.select(Filter5.id(companionTo.id)).targetOf(Chat2.CompanionTo).source() : Query.select(Filter5.nothing());
2710
2810
  const chats = useQuery5(db, query);
2711
- return useMenuActions(useMemo8(() => {
2811
+ return useMenuActions(useMemo10(() => {
2712
2812
  return Atom2.make(() => {
2713
2813
  const builder = MenuBuilder.make().root({
2714
2814
  label: [
@@ -2728,15 +2828,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
2728
2828
  type: "new",
2729
2829
  disabled: !companionTo
2730
2830
  }, () => {
2731
- invariant(companionTo, void 0, {
2732
- F: __dxlog_file5,
2733
- L: 53,
2734
- S: void 0,
2735
- A: [
2736
- "companionTo",
2737
- ""
2738
- ]
2739
- });
2831
+ invariant(companionTo, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 44, S: void 0, A: ["companionTo", ""] });
2740
2832
  return invoke(AssistantOperation.SetCurrentChat, {
2741
2833
  companionTo,
2742
2834
  chat: void 0
@@ -2752,15 +2844,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
2752
2844
  type: "rename",
2753
2845
  disabled: !chat
2754
2846
  }, () => Effect3.gen(function* () {
2755
- invariant(chat, void 0, {
2756
- F: __dxlog_file5,
2757
- L: 70,
2758
- S: this,
2759
- A: [
2760
- "chat",
2761
- ""
2762
- ]
2763
- });
2847
+ invariant(chat, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 60, S: this, A: ["chat", ""] });
2764
2848
  yield* invoke(AssistantOperation.UpdateChatName, {
2765
2849
  chat
2766
2850
  });
@@ -2797,15 +2881,7 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
2797
2881
  }
2798
2882
  ]
2799
2883
  }, () => Effect3.gen(function* () {
2800
- invariant(companionTo, void 0, {
2801
- F: __dxlog_file5,
2802
- L: 106,
2803
- S: this,
2804
- A: [
2805
- "companionTo",
2806
- ""
2807
- ]
2808
- });
2884
+ invariant(companionTo, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 97, S: this, A: ["companionTo", ""] });
2809
2885
  yield* invoke(AssistantOperation.SetCurrentChat, {
2810
2886
  companionTo,
2811
2887
  chat: chat2
@@ -2828,14 +2904,14 @@ var useChatToolbarActions2 = ({ chat, companionTo }) => {
2828
2904
  // src/hooks/useContextBinder.ts
2829
2905
  import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
2830
2906
  import * as Effect4 from "effect/Effect";
2831
- import { useContext as useContext2, useState as useState9 } from "react";
2907
+ import { useContext as useContext2, useState as useState11 } from "react";
2832
2908
  import { AiContextBinder } from "@dxos/assistant";
2833
2909
  import { createFeedServiceLayer as createFeedServiceLayer2 } from "@dxos/echo-db";
2834
2910
  import { runAndForwardErrors as runAndForwardErrors4 } from "@dxos/effect";
2835
2911
  import { useAsyncEffect as useAsyncEffect2 } from "@dxos/react-ui";
2836
2912
  var useContextBinder = (space, feed) => {
2837
2913
  const registry = useContext2(RegistryContext2);
2838
- const [binder, setBinder] = useState9();
2914
+ const [binder, setBinder] = useState11();
2839
2915
  useAsyncEffect2(async () => {
2840
2916
  setBinder(void 0);
2841
2917
  if (!space || !feed) {
@@ -2861,12 +2937,12 @@ var useContextBinder = (space, feed) => {
2861
2937
  };
2862
2938
 
2863
2939
  // src/hooks/useContextObjects.ts
2864
- import { Atom as Atom3, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
2865
- import { useCallback as useCallback6 } from "react";
2940
+ import { Atom as Atom3, useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
2941
+ import { useCallback as useCallback7 } from "react";
2866
2942
  var emptyObjectsAtom = Atom3.make([]);
2867
2943
  var useContextObjects3 = ({ db, context }) => {
2868
- const objects = useAtomValue2(context?.objects ?? emptyObjectsAtom);
2869
- const handleUpdateObject = useCallback6(async (dxn, checked) => {
2944
+ const objects = useAtomValue3(context?.objects ?? emptyObjectsAtom);
2945
+ const handleUpdateObject = useCallback7(async (dxn, checked) => {
2870
2946
  if (!db || !context) {
2871
2947
  return;
2872
2948
  }
@@ -2895,13 +2971,43 @@ var useContextObjects3 = ({ db, context }) => {
2895
2971
  };
2896
2972
  };
2897
2973
 
2974
+ // src/hooks/useDebug.ts
2975
+ import { useCallback as useCallback8 } from "react";
2976
+ import { trim } from "@dxos/util";
2977
+ var useDebug2 = ({ processor }) => {
2978
+ return useCallback8(async () => {
2979
+ const objects = processor.context.getObjects();
2980
+ const blueprints = processor.context.getBlueprints();
2981
+ const system = await processor.getSystemPrompt();
2982
+ const tools = await processor.getTools() ?? {};
2983
+ console.group("Chat", {
2984
+ objects,
2985
+ blueprints
2986
+ });
2987
+ try {
2988
+ console.log(trim`
2989
+ System Prompt:
2990
+ ${system}
2991
+ `);
2992
+ console.log(trim`
2993
+ Tools:
2994
+ ${Object.values(tools).map((tool) => JSON.stringify(tool, null, 2)).join("\n")}
2995
+ `);
2996
+ } finally {
2997
+ console.groupEnd();
2998
+ }
2999
+ }, [
3000
+ processor
3001
+ ]);
3002
+ };
3003
+
2898
3004
  // src/hooks/useFilteredTypes.ts
2899
- import * as Option5 from "effect/Option";
2900
- import { useEffect as useEffect7, useState as useState10 } from "react";
3005
+ import * as Option7 from "effect/Option";
3006
+ import { useEffect as useEffect9, useState as useState12 } from "react";
2901
3007
  import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from "@dxos/echo/internal";
2902
3008
  var useFilteredTypes2 = (db) => {
2903
- const [types, setTypes] = useState10([]);
2904
- useEffect7(() => {
3009
+ const [types, setTypes] = useState12([]);
3010
+ useEffect9(() => {
2905
3011
  if (!db) {
2906
3012
  return;
2907
3013
  }
@@ -2911,7 +3017,7 @@ var useFilteredTypes2 = (db) => {
2911
3017
  "runtime"
2912
3018
  ]
2913
3019
  }).subscribe((query) => {
2914
- const types2 = Array.from(new Set(query.results.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation).filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option5.getOrElse(() => false)))));
3020
+ const types2 = Array.from(new Set(query.results.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation).filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option7.getOrElse(() => false)))));
2915
3021
  setTypes(types2);
2916
3022
  }, {
2917
3023
  fire: true
@@ -2923,11 +3029,11 @@ var useFilteredTypes2 = (db) => {
2923
3029
  };
2924
3030
 
2925
3031
  // src/hooks/useFlush.ts
2926
- import { useCallback as useCallback7, useRef as useRef3, useState as useState11 } from "react";
3032
+ import { useCallback as useCallback9, useRef as useRef4, useState as useState13 } from "react";
2927
3033
  var useFlush = (space) => {
2928
- const [state, setState] = useState11("idle");
2929
- const resetTimer = useRef3(null);
2930
- const handleFlush = useCallback7(() => {
3034
+ const [state, setState] = useState13("idle");
3035
+ const resetTimer = useRef4(null);
3036
+ const handleFlush = useCallback9(() => {
2931
3037
  if (!space) {
2932
3038
  return;
2933
3039
  }
@@ -2953,9 +3059,9 @@ var useFlush = (space) => {
2953
3059
  };
2954
3060
 
2955
3061
  // src/hooks/useOnline.ts
2956
- import { useState as useState12 } from "react";
3062
+ import { useState as useState14 } from "react";
2957
3063
  var useOnline = () => {
2958
- const [online, setOnline] = useState12(true);
3064
+ const [online, setOnline] = useState14(true);
2959
3065
  return [
2960
3066
  online,
2961
3067
  setOnline
@@ -2963,24 +3069,24 @@ var useOnline = () => {
2963
3069
  };
2964
3070
 
2965
3071
  // src/hooks/usePresets.ts
2966
- import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo9, useState as useState13 } from "react";
3072
+ import { useCallback as useCallback10, useEffect as useEffect10, useMemo as useMemo11, useState as useState15 } from "react";
2967
3073
  var usePresets = (online) => {
2968
- const [preset, setPreset] = useState13();
2969
- const presets = useMemo9(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
3074
+ const [preset, setPreset] = useState15();
3075
+ const presets = useMemo11(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
2970
3076
  online
2971
3077
  ]);
2972
- const presetOptions = useMemo9(() => presets.map(({ id, model, label }) => ({
3078
+ const presetOptions = useMemo11(() => presets.map(({ id, model, label }) => ({
2973
3079
  id,
2974
3080
  label: label ?? model
2975
3081
  })), [
2976
3082
  presets
2977
3083
  ]);
2978
- useEffect8(() => {
3084
+ useEffect10(() => {
2979
3085
  setPreset(presets[0]);
2980
3086
  }, [
2981
3087
  presets
2982
3088
  ]);
2983
- const handlePresetChange = useCallback8((id) => {
3089
+ const handlePresetChange = useCallback10((id) => {
2984
3090
  const preset2 = presets.find((preset3) => preset3.id === id);
2985
3091
  if (preset2) {
2986
3092
  setPreset(preset2);
@@ -2996,10 +3102,10 @@ var usePresets = (online) => {
2996
3102
  };
2997
3103
 
2998
3104
  // src/hooks/useReferencesProvider.ts
2999
- import { useMemo as useMemo10 } from "react";
3105
+ import { useMemo as useMemo12 } from "react";
3000
3106
  import { Filter as Filter6, Obj as Obj7 } from "@dxos/echo";
3001
3107
  var useReferencesProvider = (space) => {
3002
- return useMemo10(() => {
3108
+ return useMemo12(() => {
3003
3109
  if (!space) {
3004
3110
  return void 0;
3005
3111
  }
@@ -3044,214 +3150,41 @@ var meta9 = {
3044
3150
  var ASSISTANT_DIALOG = `${meta9.id}.assistant.dialog`;
3045
3151
  var ASSISTANT_COMPANION_VARIANT = "assistant-chat";
3046
3152
 
3047
- // src/translations.ts
3048
- import { Chat as Chat3, Agent, McpServer as McpServer2 } from "@dxos/assistant-toolkit";
3049
- import { Blueprint as Blueprint2, Prompt } from "@dxos/blueprints";
3050
- import { Sequence } from "@dxos/conductor";
3051
- import { Type as Type2 } from "@dxos/echo";
3052
- import { translations as componentsTranslations } from "@dxos/react-ui-components";
3053
- import { translations as formTranslations } from "@dxos/react-ui-form";
3054
- import { meta as meta10 } from "#meta";
3055
- var translations = [
3056
- ...componentsTranslations,
3057
- ...formTranslations,
3058
- {
3059
- "en-US": {
3060
- // TODO(burdon): From assistant.
3061
- [Blueprint2.Blueprint.typename]: {
3062
- "typename.label": "Blueprint",
3063
- "typename.label_zero": "Blueprints",
3064
- "typename.label_one": "Blueprint",
3065
- "typename.label_other": "Blueprints",
3066
- "object-name.placeholder": "New blueprint",
3067
- "add-object.label": "Add blueprint",
3068
- "rename-object.label": "Rename blueprint",
3069
- "delete-object.label": "Delete blueprint",
3070
- "object-deleted.label": "Blueprint deleted"
3071
- },
3072
- [Type2.getTypename(Prompt.Prompt)]: {
3073
- "typename.label": "Prompt",
3074
- "typename.label_zero": "Prompts",
3075
- "typename.label_one": "Prompt",
3076
- "typename.label_other": "Prompts",
3077
- "object-name.placeholder": "New prompt",
3078
- "add-object.label": "Add prompt",
3079
- "rename-object.label": "Rename prompt",
3080
- "delete-object.label": "Delete prompt",
3081
- "object-deleted.label": "Prompt deleted"
3082
- },
3083
- // TODO(burdon): From conductor.
3084
- [Sequence.typename]: {
3085
- "typename.label": "Sequence",
3086
- "typename.label_zero": "Sequences",
3087
- "typename.label_one": "Sequence",
3088
- "typename.label_other": "Sequences",
3089
- "object-name.placeholder": "New sequence",
3090
- "add-object.label": "Add sequence",
3091
- "rename-object.label": "Rename sequence",
3092
- "delete-object.label": "Delete sequence",
3093
- "object-deleted.label": "Sequence deleted"
3094
- },
3095
- [Chat3.Chat.typename]: {
3096
- "typename.label": "AI Chat",
3097
- "object-name.placeholder": "New AI Chat",
3098
- "add-object.label": "Add AI chat",
3099
- "rename-object.label": "Rename AI Chat",
3100
- "delete-object.label": "Delete AI Chat",
3101
- "object-deleted.label": "AI Chat deleted"
3102
- },
3103
- [McpServer2.McpServer.typename]: {
3104
- "typename.label": "MCP Server",
3105
- "typename.label_zero": "MCP Servers",
3106
- "typename.label_one": "MCP Server",
3107
- "typename.label_other": "MCP Servers"
3108
- },
3109
- [Agent.Agent.typename]: {
3110
- "typename.label": "Agent",
3111
- "typename.label_zero": "Agents",
3112
- "typename.label_one": "Agent",
3113
- "typename.label_other": "Agents",
3114
- "object-name.placeholder": "New agent",
3115
- "add-object.label": "Add agent",
3116
- "rename-object.label": "Rename agent",
3117
- "delete-object.label": "Delete agent",
3118
- "object-deleted.label": "Agent deleted"
3119
- },
3120
- // TODO(burdon): Reconcile with react-ui-chat.
3121
- [meta10.id]: {
3122
- "templates.label": "Templates",
3123
- "open-ambient-chat.label": "Open Assistant",
3124
- "assistant-chat.label": "Assistant",
3125
- "plugin.name": "Assistant",
3126
- "settings.title": "Assistant settings",
3127
- "object.placeholder": "New prompt",
3128
- "create-object.label": "Create prompt",
3129
- "create-trigger.label": "Create trigger",
3130
- "create-stack-section.label": "Create prompt",
3131
- "command.placeholder": "Enter slash command...",
3132
- "template.placeholder": "Enter template...",
3133
- "value.placeholder": "Enter value...",
3134
- "prompt-rules.label": "Prompt Rules",
3135
- "typename.placeholder": "Enter typename of objects which this template is for",
3136
- "description.placeholder": "Enter description of when this template should be used",
3137
- "select-preset-template.placeholder": "Select preset",
3138
- "service-registry.label": "Service Registry",
3139
- "type-filter.placeholder": "Type",
3140
- "any-type-filter.label": "Any",
3141
- "no-blueprint.message": "No active blueprints",
3142
- "tool-call.label": "Calling",
3143
- "tool-result.label": "Success",
3144
- "tool-error.label": "Tool call failed",
3145
- "invocations.label": "Invocations",
3146
- "trace.label": "Trace",
3147
- "assistant-dialog.title": "Assistant",
3148
- "open-assistant.label": "Open assistant",
3149
- "reset-blueprints.label": "Reset blueprints",
3150
- "no-results.message": "No results",
3151
- "cancel.button": "Cancel",
3152
- "save.button": "Save",
3153
- "new-thread.button": "New Chat",
3154
- "rename-thread.button": "Rename Chat",
3155
- "chat-history.label": "Chat History",
3156
- "chat-update-name.label": "Update AI Chat name",
3157
- "toolkit.label": "Toolkit",
3158
- "stats.label": "Stats",
3159
- "summary.label": "Summary",
3160
- "thinking.label": "Thinking",
3161
- "search.placeholder": "Search...",
3162
- "prompt.placeholder": "Enter question or command...",
3163
- "context-objects.button": "Add to context",
3164
- "context-settings.button": "Chat settings",
3165
- "microphone.button": "Click to speak",
3166
- "cancel-processing.button": "Stop processing",
3167
- "blueprints-in-context.title": "Blueprints",
3168
- "objects-in-context.title": "Content",
3169
- "remove-object-in-context.label": "Remove document",
3170
- "chat-model.title": "Models",
3171
- "mcp-servers.title": "MCP",
3172
- "mcp-server-add.label": "Add MCP server",
3173
- "mcp-server-remove.label": "Remove MCP server",
3174
- "mcp-server-name.label": "Server name",
3175
- "mcp-server-name.placeholder": "Name",
3176
- "mcp-server-url.label": "Server URL",
3177
- "mcp-server-url.placeholder": "https://...",
3178
- "mcp-server-protocol.label": "Protocol",
3179
- "mcp-server-api-key.label": "API key",
3180
- "mcp-server-api-key.placeholder": "API key (optional)",
3181
- "debug.button": "Debug",
3182
- "online-switch.label": "Online",
3183
- "run-prompt.label": "Run prompt",
3184
- "typename.label": "Typename",
3185
- "branch-thread.menu": "Branch chat",
3186
- "chat-toolbar.title": "Chat toolbar",
3187
- "settings.default.label": "Default",
3188
- "settings.custom-prompts.label": "Use custom prompts",
3189
- "settings.custom-prompts.description": "Allow the assistant to use custom prompts defined in your spaces.",
3190
- "settings.llm-provider.label": "LLM provider",
3191
- "settings.llm-provider.description": "Select which language model service to use for AI responses.",
3192
- "settings.edge-llm-model.label": "Remote language model",
3193
- "settings.edge-llm-model.description": "Choose the remote language model used for AI requests.",
3194
- "settings.ollama-llm-model.label": "Ollama language model",
3195
- "settings.ollama-llm-model.description": "Choose the locally hosted Ollama model for AI requests.",
3196
- "settings.default-llm-model.label": "Default language model",
3197
- // Trigger status
3198
- "trigger-status-disabled.label": "Triggers disabled",
3199
- "trigger-status-idle.label": "Triggers idle",
3200
- "trigger-status-edge.label": "Triggers will run on EDGE",
3201
- "trigger-status-running.label": "Trigger running",
3202
- "trigger-status-error.label": "Trigger error",
3203
- "trigger-runtime.label": "Auto trigger execution",
3204
- "trigger-last-invocation.label": "Last run",
3205
- "trigger-duration.label": "Duration",
3206
- // AgentArticle.
3207
- "project-empty-spec.message": "Open the Properties companion to configure the agent.",
3208
- "project-empty-spec.description": "Open the Assistant companion to interact with the agent.",
3209
- "artifacts.label": "Artifacts",
3210
- "input-queue.label": "Inputs",
3211
- // AgentProperties.
3212
- "instructions.label": "Instructions",
3213
- "instructions.placeholder": "Enter instructions, goals, and constraints for the assistant.",
3214
- "reset-history.button": "Reset",
3215
- "subscriptions.label": "Subscriptions"
3216
- }
3217
- }
3218
- }
3219
- ];
3220
-
3221
3153
  // src/AssistantPlugin.tsx
3222
3154
  import * as Effect5 from "effect/Effect";
3223
- import * as Option6 from "effect/Option";
3155
+ import * as Option8 from "effect/Option";
3224
3156
  import { ActivationEvent, ActivationEvents, Capability, Plugin } from "@dxos/app-framework";
3225
3157
  import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
3226
3158
  import { ContextBinding } from "@dxos/assistant";
3227
- import { Agent as Agent2, AgentBlueprint, Chat as Chat4, McpServer as McpServer3, Memory, Plan, ResearchGraph } from "@dxos/assistant-toolkit";
3228
- import { Blueprint as Blueprint3, Prompt as Prompt2 } from "@dxos/blueprints";
3229
- import { Sequence as Sequence2 } from "@dxos/conductor";
3230
- import { Annotation as Annotation3, Feed, Obj as Obj8, Type as Type3 } from "@dxos/echo";
3231
- import { Operation as Operation3 } from "@dxos/operation";
3159
+ import { Agent, AgentBlueprint, Chat as Chat3, McpServer as McpServer2, Memory, Plan } from "@dxos/assistant-toolkit";
3160
+ import { Blueprint as Blueprint2, Routine } from "@dxos/compute";
3161
+ import { Operation as Operation3 } from "@dxos/compute";
3162
+ import { Sequence } from "@dxos/conductor";
3163
+ import { Annotation as Annotation3, Feed, Obj as Obj8, Type as Type2 } from "@dxos/echo";
3232
3164
  import { AutomationCapabilities as AutomationCapabilities2 } from "@dxos/plugin-automation/types";
3233
3165
  import { ClientEvents } from "@dxos/plugin-client/types";
3234
3166
  import { DeckEvents } from "@dxos/plugin-deck/types";
3235
- import { MarkdownEvents } from "@dxos/plugin-markdown";
3167
+ import { MarkdownEvents } from "@dxos/plugin-markdown/types";
3236
3168
  import { SpaceOperation } from "@dxos/plugin-space/operations";
3237
3169
  import { SpaceCapabilities, SpaceEvents } from "@dxos/plugin-space/types";
3238
3170
  import { Text } from "@dxos/schema";
3239
3171
  import { HasSubject, Message as Message3 } from "@dxos/types";
3240
3172
  import { AiService, AppGraphBuilder, AssistantState, BlueprintDefinition, CompanionChatProvisioner, EdgeModelResolver, LocalModelResolver, MarkdownExtension, Migrations, OperationHandler, ReactSurface, Settings, Toolkit } from "#capabilities";
3241
- import { meta as meta11 } from "#meta";
3173
+ import { meta as meta10 } from "#meta";
3242
3174
  import { AssistantOperation as AssistantOperation2 } from "#operations";
3243
- import { AssistantEvents as AssistantEvents2 } from "#types";
3244
- var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3175
+ import { translations } from "#translations";
3176
+ import { AssistantEvents } from "#types";
3177
+ var AssistantPlugin = Plugin.define(meta10).pipe(AppPlugin.addAppGraphModule({
3245
3178
  activate: AppGraphBuilder
3246
3179
  }), AppPlugin.addBlueprintDefinitionModule({
3247
3180
  activate: BlueprintDefinition
3248
3181
  }), AppPlugin.addMetadataModule({
3249
3182
  metadata: [
3250
3183
  {
3251
- id: Type3.getTypename(Chat4.Chat),
3184
+ id: Type2.getTypename(Chat3.Chat),
3252
3185
  metadata: {
3253
- icon: Annotation3.IconAnnotation.get(Chat4.Chat).pipe(Option6.getOrThrow).icon,
3254
- iconHue: Annotation3.IconAnnotation.get(Chat4.Chat).pipe(Option6.getOrThrow).hue ?? "white",
3186
+ icon: Annotation3.IconAnnotation.get(Chat3.Chat).pipe(Option8.getOrThrow).icon,
3187
+ iconHue: Annotation3.IconAnnotation.get(Chat3.Chat).pipe(Option8.getOrThrow).hue ?? "white",
3255
3188
  createObject: (props, options) => Effect5.gen(function* () {
3256
3189
  const { object } = yield* Operation3.invoke(AssistantOperation2.CreateChat, {
3257
3190
  db: options.db,
@@ -3267,13 +3200,13 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3267
3200
  }
3268
3201
  },
3269
3202
  {
3270
- id: Type3.getTypename(Blueprint3.Blueprint),
3203
+ id: Type2.getTypename(Blueprint2.Blueprint),
3271
3204
  metadata: {
3272
- icon: Annotation3.IconAnnotation.get(Blueprint3.Blueprint).pipe(Option6.getOrThrow).icon,
3273
- iconHue: Annotation3.IconAnnotation.get(Blueprint3.Blueprint).pipe(Option6.getOrThrow).hue ?? "white",
3205
+ icon: Annotation3.IconAnnotation.get(Blueprint2.Blueprint).pipe(Option8.getOrThrow).icon,
3206
+ iconHue: Annotation3.IconAnnotation.get(Blueprint2.Blueprint).pipe(Option8.getOrThrow).hue ?? "white",
3274
3207
  inputSchema: AssistantOperation2.BlueprintForm,
3275
3208
  createObject: (props, options) => Effect5.gen(function* () {
3276
- const object = Blueprint3.make(props);
3209
+ const object = Blueprint2.make(props);
3277
3210
  return yield* Operation3.invoke(SpaceOperation.AddObject, {
3278
3211
  object,
3279
3212
  target: options.target,
@@ -3284,12 +3217,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3284
3217
  }
3285
3218
  },
3286
3219
  {
3287
- id: Type3.getTypename(Prompt2.Prompt),
3220
+ id: Type2.getTypename(Routine.Routine),
3288
3221
  metadata: {
3289
- icon: Annotation3.IconAnnotation.get(Prompt2.Prompt).pipe(Option6.getOrThrow).icon,
3290
- iconHue: Annotation3.IconAnnotation.get(Prompt2.Prompt).pipe(Option6.getOrThrow).hue ?? "white",
3222
+ icon: Annotation3.IconAnnotation.get(Routine.Routine).pipe(Option8.getOrThrow).icon,
3223
+ iconHue: Annotation3.IconAnnotation.get(Routine.Routine).pipe(Option8.getOrThrow).hue ?? "white",
3291
3224
  createObject: (props, options) => Effect5.gen(function* () {
3292
- const object = Prompt2.make(props);
3225
+ const object = Routine.make(props);
3293
3226
  return yield* Operation3.invoke(SpaceOperation.AddObject, {
3294
3227
  object,
3295
3228
  target: options.target,
@@ -3300,12 +3233,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3300
3233
  }
3301
3234
  },
3302
3235
  {
3303
- id: Type3.getTypename(Sequence2),
3236
+ id: Type2.getTypename(Sequence),
3304
3237
  metadata: {
3305
- icon: Annotation3.IconAnnotation.get(Sequence2).pipe(Option6.getOrThrow).icon,
3306
- iconHue: Annotation3.IconAnnotation.get(Sequence2).pipe(Option6.getOrThrow).hue ?? "white",
3238
+ icon: Annotation3.IconAnnotation.get(Sequence).pipe(Option8.getOrThrow).icon,
3239
+ iconHue: Annotation3.IconAnnotation.get(Sequence).pipe(Option8.getOrThrow).hue ?? "white",
3307
3240
  createObject: (props, options) => Effect5.gen(function* () {
3308
- const object = Obj8.make(Sequence2, props);
3241
+ const object = Obj8.make(Sequence, props);
3309
3242
  return yield* Operation3.invoke(SpaceOperation.AddObject, {
3310
3243
  object,
3311
3244
  target: options.target,
@@ -3316,12 +3249,12 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3316
3249
  }
3317
3250
  },
3318
3251
  {
3319
- id: Type3.getTypename(Agent2.Agent),
3252
+ id: Type2.getTypename(Agent.Agent),
3320
3253
  metadata: {
3321
- icon: Annotation3.IconAnnotation.get(Agent2.Agent).pipe(Option6.getOrThrow).icon,
3322
- iconHue: Annotation3.IconAnnotation.get(Agent2.Agent).pipe(Option6.getOrThrow).hue ?? "white",
3254
+ icon: Annotation3.IconAnnotation.get(Agent.Agent).pipe(Option8.getOrThrow).icon,
3255
+ iconHue: Annotation3.IconAnnotation.get(Agent.Agent).pipe(Option8.getOrThrow).hue ?? "white",
3323
3256
  createObject: (props, options) => Effect5.gen(function* () {
3324
- const object = yield* Agent2.makeInitialized({
3257
+ const object = yield* Agent.makeInitialized({
3325
3258
  name: "",
3326
3259
  instructions: ""
3327
3260
  }, AgentBlueprint.make()).pipe(withComputeRuntime(options.db.spaceId));
@@ -3339,19 +3272,18 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3339
3272
  activate: OperationHandler
3340
3273
  }), AppPlugin.addSchemaModule({
3341
3274
  schema: [
3342
- Chat4.Chat,
3343
- Chat4.CompanionTo,
3344
- Blueprint3.Blueprint,
3275
+ Chat3.Chat,
3276
+ Chat3.CompanionTo,
3277
+ Blueprint2.Blueprint,
3345
3278
  ContextBinding,
3346
3279
  Feed.Feed,
3347
3280
  HasSubject.HasSubject,
3348
3281
  Message3.Message,
3349
- Prompt2.Prompt,
3350
- ResearchGraph.ResearchGraph,
3351
- Agent2.Agent,
3352
- McpServer3.McpServer,
3282
+ Routine.Routine,
3283
+ Agent.Agent,
3284
+ McpServer2.McpServer,
3353
3285
  Plan.Plan,
3354
- Sequence2,
3286
+ Sequence,
3355
3287
  Memory.Memory,
3356
3288
  Text.Text
3357
3289
  ]
@@ -3379,14 +3311,14 @@ var AssistantPlugin = Plugin.define(meta11).pipe(AppPlugin.addAppGraphModule({
3379
3311
  activatesOn: SpaceEvents.SpaceCreated,
3380
3312
  activate: () => Effect5.succeed(Capability.contributes(SpaceCapabilities.OnCreateSpace, (params) => Operation3.invoke(AssistantOperation2.OnCreateSpace, params)))
3381
3313
  }), Plugin.addModule({
3382
- activatesOn: AssistantEvents2.SetupAiServiceProviders,
3314
+ activatesOn: AssistantEvents.SetupAiServiceProviders,
3383
3315
  activate: EdgeModelResolver
3384
3316
  }), Plugin.addModule({
3385
- activatesOn: AssistantEvents2.SetupAiServiceProviders,
3317
+ activatesOn: AssistantEvents.SetupAiServiceProviders,
3386
3318
  activate: LocalModelResolver
3387
3319
  }), Plugin.addModule({
3388
3320
  firesBeforeActivation: [
3389
- AssistantEvents2.SetupAiServiceProviders
3321
+ AssistantEvents.SetupAiServiceProviders
3390
3322
  ],
3391
3323
  // TODO(dmaretskyi): This should activate lazily when the AI chat is used.
3392
3324
  activatesOn: ActivationEvents.Startup,
@@ -3410,34 +3342,26 @@ var withComputeRuntime = (spaceId) => (effect) => Effect5.gen(function* () {
3410
3342
  export {
3411
3343
  ASSISTANT_COMPANION_VARIANT,
3412
3344
  ASSISTANT_DIALOG,
3413
- ApiAuthorization,
3414
- Assistant_exports as Assistant,
3415
- blueprint_default as AssistantBlueprint,
3416
- AssistantCapabilities,
3417
- AssistantEvents,
3418
3345
  AssistantPlugin,
3419
3346
  AssistantSettings,
3420
3347
  Chat,
3421
- ChatContextProvider,
3422
- LLM_PROVIDERS,
3423
3348
  ProcessTree,
3424
- ServiceType,
3425
3349
  TemplateEditor,
3426
3350
  Toolbox,
3427
3351
  ToolboxPanel,
3428
- categoryIcons,
3429
3352
  meta9 as meta,
3430
- translations,
3431
3353
  useActiveBlueprints2 as useActiveBlueprints,
3432
3354
  useBlueprintHandlers2 as useBlueprintHandlers,
3433
3355
  useBlueprintRegistry,
3434
3356
  useBlueprints2 as useBlueprints,
3435
3357
  useChatContext,
3358
+ useChatKeymapExtensions3 as useChatKeymapExtensions,
3436
3359
  useChatProcessor,
3437
3360
  useChatServices,
3438
3361
  useChatToolbarActions2 as useChatToolbarActions,
3439
3362
  useContextBinder,
3440
3363
  useContextObjects3 as useContextObjects,
3364
+ useDebug2 as useDebug,
3441
3365
  useFilteredTypes2 as useFilteredTypes,
3442
3366
  useFlush,
3443
3367
  useOnline,