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