@dxos/plugin-assistant 0.9.0 → 0.9.1-staging.ee54ba693a

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 (619) hide show
  1. package/PLUGIN.mdl +18 -24
  2. package/dist/lib/neutral/{AgentArticle-K7XM46OQ.mjs → AgentArticle-GV6EEW3I.mjs} +9 -8
  3. package/dist/lib/neutral/AgentArticle-GV6EEW3I.mjs.map +7 -0
  4. package/dist/lib/neutral/AssistantPlugin.mjs +1 -1
  5. package/dist/lib/neutral/AssistantPlugin.node.mjs +6 -6
  6. package/dist/lib/neutral/AssistantPlugin.node.mjs.map +3 -3
  7. package/dist/lib/neutral/AssistantPlugin.workerd.mjs +7 -34
  8. package/dist/lib/neutral/AssistantPlugin.workerd.mjs.map +4 -4
  9. package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs +302 -0
  10. package/dist/lib/neutral/AssistantSettings-3N5M5VCN.mjs.map +7 -0
  11. package/dist/lib/neutral/{ChatArticle-VNVZCDUR.mjs → ChatArticle-OO7GGEFW.mjs} +2 -2
  12. package/dist/lib/neutral/{ChatCompanion-LBUHYWQG.mjs → ChatCompanion-GIFJRY6I.mjs} +28 -28
  13. package/dist/lib/neutral/ChatCompanion-GIFJRY6I.mjs.map +7 -0
  14. package/dist/lib/neutral/{ChatDialog-DCA6FLOV.mjs → ChatDialog-5MXN4MXS.mjs} +9 -8
  15. package/dist/lib/neutral/ChatDialog-5MXN4MXS.mjs.map +7 -0
  16. package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs +72 -0
  17. package/dist/lib/neutral/IntegrationPrompt-2HJQFYJE.mjs.map +7 -0
  18. package/dist/lib/neutral/{PlanArticle-TS5ULWYS.mjs → PlanArticle-VPK2IYWU.mjs} +8 -2
  19. package/dist/lib/neutral/PlanArticle-VPK2IYWU.mjs.map +7 -0
  20. package/dist/lib/neutral/SpaceHomePrompt-ISAB76LD.mjs +114 -0
  21. package/dist/lib/neutral/SpaceHomePrompt-ISAB76LD.mjs.map +7 -0
  22. package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs +63 -0
  23. package/dist/lib/neutral/SpaceHomeSuggestions-IDH77QQR.mjs.map +7 -0
  24. package/dist/lib/neutral/TracePanel-JKNWADJ4.mjs +12 -0
  25. package/dist/lib/neutral/TracePanel-JKNWADJ4.mjs.map +7 -0
  26. package/dist/lib/neutral/{TriggerStatus-X7Y5JFZJ.mjs → TriggerStatus-FURRBHYA.mjs} +9 -7
  27. package/dist/lib/neutral/TriggerStatus-FURRBHYA.mjs.map +7 -0
  28. package/dist/lib/neutral/{agent-hydrator-PJBYVMBW.mjs → agent-hydrator-OBO3RHLO.mjs} +3 -4
  29. package/dist/lib/neutral/agent-hydrator-OBO3RHLO.mjs.map +7 -0
  30. package/dist/lib/neutral/{agent-service-WCAP5MLI.mjs → agent-service-XFJ4VQMT.mjs} +6 -6
  31. package/dist/lib/neutral/agent-service-XFJ4VQMT.mjs.map +7 -0
  32. package/dist/lib/neutral/ai-context-LIKJYMIN.mjs +14 -0
  33. package/dist/lib/neutral/ai-context-LIKJYMIN.mjs.map +7 -0
  34. package/dist/lib/neutral/{ai-service-AADUIKBY.mjs → ai-service-DM6YXWUC.mjs} +9 -5
  35. package/dist/lib/neutral/ai-service-DM6YXWUC.mjs.map +7 -0
  36. package/dist/lib/neutral/{app-graph-builder-WUFHQH3Y.mjs → app-graph-builder-OPVOEQY7.mjs} +45 -28
  37. package/dist/lib/neutral/app-graph-builder-OPVOEQY7.mjs.map +7 -0
  38. package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs +97 -0
  39. package/dist/lib/neutral/automation-templates-MADJLXGJ.mjs.map +7 -0
  40. package/dist/lib/neutral/capabilities/index.mjs +21 -19
  41. package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
  42. package/dist/lib/neutral/{chunk-KLYLW4WH.mjs → chunk-5IHQ52KJ.mjs} +1 -1
  43. package/dist/lib/neutral/chunk-5IHQ52KJ.mjs.map +7 -0
  44. package/dist/lib/neutral/{chunk-YXRGZYYH.mjs → chunk-6Q4OBGIK.mjs} +87 -59
  45. package/dist/lib/neutral/chunk-6Q4OBGIK.mjs.map +7 -0
  46. package/dist/lib/neutral/chunk-BXI2R4OO.mjs +410 -0
  47. package/dist/lib/neutral/chunk-BXI2R4OO.mjs.map +7 -0
  48. package/dist/lib/neutral/{chunk-5H6UJHLF.mjs → chunk-CMPLPDYE.mjs} +12 -12
  49. package/dist/lib/neutral/chunk-CMPLPDYE.mjs.map +7 -0
  50. package/dist/lib/neutral/chunk-GPHT3HYS.mjs +8 -0
  51. package/dist/lib/neutral/{chunk-SMFJD7BP.mjs.map → chunk-GPHT3HYS.mjs.map} +2 -2
  52. package/dist/lib/neutral/chunk-HKLSFB5I.mjs +90 -0
  53. package/dist/lib/neutral/chunk-HKLSFB5I.mjs.map +7 -0
  54. package/dist/lib/neutral/chunk-L7AR4VTA.mjs +53 -0
  55. package/dist/lib/neutral/chunk-L7AR4VTA.mjs.map +7 -0
  56. package/dist/lib/neutral/chunk-LS72HWMM.mjs +42 -0
  57. package/dist/lib/neutral/chunk-LS72HWMM.mjs.map +7 -0
  58. package/dist/lib/neutral/{chunk-HLANPOBA.mjs → chunk-OZWZGIV2.mjs} +5 -3
  59. package/dist/lib/neutral/chunk-OZWZGIV2.mjs.map +7 -0
  60. package/dist/lib/neutral/{toolkit-GVWXPDLJ.mjs → chunk-QOKLFHUS.mjs} +3 -4
  61. package/dist/lib/neutral/{toolkit-GVWXPDLJ.mjs.map → chunk-QOKLFHUS.mjs.map} +1 -1
  62. package/dist/lib/neutral/{TracePanel-KTZJ6JNR.mjs → chunk-SCTHQVIJ.mjs} +11 -23
  63. package/dist/lib/neutral/chunk-SCTHQVIJ.mjs.map +7 -0
  64. package/dist/lib/neutral/chunk-U4LTLBAX.mjs +56 -0
  65. package/dist/lib/neutral/chunk-U4LTLBAX.mjs.map +7 -0
  66. package/dist/lib/neutral/{chunk-RKVVK3R3.mjs → chunk-UPKFUZ6V.mjs} +22 -17
  67. package/dist/lib/neutral/chunk-UPKFUZ6V.mjs.map +7 -0
  68. package/dist/lib/neutral/{operation-handler-SF36MOB5.mjs → chunk-V2Y4XE3O.mjs} +3 -4
  69. package/dist/lib/neutral/{operation-handler-SF36MOB5.mjs.map → chunk-V2Y4XE3O.mjs.map} +1 -1
  70. package/dist/lib/neutral/chunk-XVGEJWJX.mjs +133 -0
  71. package/dist/lib/neutral/chunk-XVGEJWJX.mjs.map +7 -0
  72. package/dist/lib/neutral/{companion-chat-provisioner-YZZ73P6E.mjs → companion-chat-provisioner-IQV5VIVE.mjs} +14 -8
  73. package/dist/lib/neutral/companion-chat-provisioner-IQV5VIVE.mjs.map +7 -0
  74. package/dist/lib/neutral/components/index.mjs +749 -632
  75. package/dist/lib/neutral/components/index.mjs.map +4 -4
  76. package/dist/lib/neutral/{integration-provider-RBD3AFJU.mjs → connector-ITLLTBPZ.mjs} +13 -14
  77. package/dist/lib/neutral/connector-ITLLTBPZ.mjs.map +7 -0
  78. package/dist/lib/neutral/containers/index.mjs +15 -13
  79. package/dist/lib/neutral/containers/index.mjs.map +3 -3
  80. package/dist/lib/neutral/{create-chat-SGGQ6HVN.mjs → create-chat-YGVZZYGP.mjs} +18 -16
  81. package/dist/lib/neutral/create-chat-YGVZZYGP.mjs.map +7 -0
  82. package/dist/lib/neutral/{create-object-U2SOFZLR.mjs → create-object-5PAEJ6KM.mjs} +11 -27
  83. package/dist/lib/neutral/create-object-5PAEJ6KM.mjs.map +7 -0
  84. package/dist/lib/neutral/{edge-model-resolver-BBVOJBGJ.mjs → edge-model-resolver-WDJWDZTT.mjs} +2 -2
  85. package/dist/lib/neutral/execution-graph/index.mjs +336 -62
  86. package/dist/lib/neutral/execution-graph/index.mjs.map +4 -4
  87. package/dist/lib/neutral/extensions/index.mjs +8 -0
  88. package/dist/lib/neutral/{fork-chat-34KEF4ZJ.mjs → fork-chat-RMAAYYQF.mjs} +16 -19
  89. package/dist/lib/neutral/fork-chat-RMAAYYQF.mjs.map +7 -0
  90. package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs +93 -0
  91. package/dist/lib/neutral/generate-home-suggestions-6MM2XWPV.mjs.map +7 -0
  92. package/dist/lib/neutral/hooks/index.mjs +393 -508
  93. package/dist/lib/neutral/hooks/index.mjs.map +4 -4
  94. package/dist/lib/neutral/index.mjs +14 -10
  95. package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs +41 -0
  96. package/dist/lib/neutral/markdown-extension-R4TKDTIF.mjs.map +7 -0
  97. package/dist/lib/neutral/meta.json +1 -1
  98. package/dist/lib/neutral/meta.mjs +1 -1
  99. package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs +18 -0
  100. package/dist/lib/neutral/navigation-resolver-PYGP2DAW.mjs.map +7 -0
  101. package/dist/lib/neutral/operation-handler-2LEN45GP.mjs +8 -0
  102. package/dist/lib/neutral/operation-handler-2LEN45GP.mjs.map +7 -0
  103. package/dist/lib/neutral/operations/index.mjs +1 -1
  104. package/dist/lib/neutral/plugin.mjs +2 -2
  105. package/dist/lib/neutral/plugin.workerd.mjs +13 -0
  106. package/dist/lib/neutral/plugin.workerd.mjs.map +7 -0
  107. package/dist/lib/neutral/{react-surface-XRTBW5OJ.mjs → react-surface-HEJEK44F.mjs} +42 -45
  108. package/dist/lib/neutral/react-surface-HEJEK44F.mjs.map +7 -0
  109. package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs +28 -0
  110. package/dist/lib/neutral/resolve-navigation-targets-PBQ3OLUE.mjs.map +7 -0
  111. package/dist/lib/neutral/{run-prompt-in-new-chat-D5IIE2C7.mjs → run-prompt-in-new-chat-RNUJE2FM.mjs} +31 -31
  112. package/dist/lib/neutral/run-prompt-in-new-chat-RNUJE2FM.mjs.map +7 -0
  113. package/dist/lib/neutral/{settings-W4BLWQ53.mjs → settings-7Q3RITIT.mjs} +3 -3
  114. package/dist/lib/neutral/{settings-W4BLWQ53.mjs.map → settings-7Q3RITIT.mjs.map} +3 -3
  115. package/dist/lib/neutral/skill-definition-553MQRTR.mjs +8 -0
  116. package/dist/lib/neutral/skill-definition-553MQRTR.mjs.map +7 -0
  117. package/dist/lib/neutral/skills/index.mjs +8 -0
  118. package/dist/lib/neutral/skills/index.mjs.map +7 -0
  119. package/dist/lib/neutral/{state-H3G7QCU6.mjs → state-4LGAKSSD.mjs} +9 -3
  120. package/dist/lib/neutral/state-4LGAKSSD.mjs.map +7 -0
  121. package/dist/lib/neutral/testing.mjs +1 -1
  122. package/dist/lib/neutral/toolkit-ETWLG5NT.mjs +8 -0
  123. package/dist/lib/neutral/toolkit-ETWLG5NT.mjs.map +7 -0
  124. package/dist/lib/neutral/translations.mjs +69 -31
  125. package/dist/lib/neutral/translations.mjs.map +3 -3
  126. package/dist/lib/neutral/types/index.mjs +5 -1
  127. package/dist/lib/neutral/{update-chat-name-Y7JWIP64.mjs → update-chat-name-IJJELRR6.mjs} +3 -3
  128. package/dist/lib/neutral/{update-chat-name-Y7JWIP64.mjs.map → update-chat-name-IJJELRR6.mjs.map} +2 -2
  129. package/dist/types/dx.config.d.ts +28 -0
  130. package/dist/types/dx.config.d.ts.map +1 -0
  131. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  132. package/dist/types/src/AssistantPlugin.workerd.d.ts.map +1 -1
  133. package/dist/types/src/capabilities/agent-hydrator.d.ts +1 -1
  134. package/dist/types/src/capabilities/agent-service.d.ts +1 -2
  135. package/dist/types/src/capabilities/agent-service.d.ts.map +1 -1
  136. package/dist/types/src/capabilities/ai-context.d.ts +1 -2
  137. package/dist/types/src/capabilities/ai-context.d.ts.map +1 -1
  138. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -3
  139. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  140. package/dist/types/src/capabilities/automation-templates.d.ts +1 -2
  141. package/dist/types/src/capabilities/automation-templates.d.ts.map +1 -1
  142. package/dist/types/src/capabilities/companion-chat-provisioner.d.ts +1 -1
  143. package/dist/types/src/capabilities/companion-chat-provisioner.d.ts.map +1 -1
  144. package/dist/types/src/capabilities/{integration-provider.d.ts → connector.d.ts} +2 -2
  145. package/dist/types/src/capabilities/connector.d.ts.map +1 -0
  146. package/dist/types/src/capabilities/create-object.d.ts +1 -27
  147. package/dist/types/src/capabilities/create-object.d.ts.map +1 -1
  148. package/dist/types/src/capabilities/index.d.ts +18 -57
  149. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  150. package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
  151. package/dist/types/src/capabilities/migrations.d.ts +1 -2
  152. package/dist/types/src/capabilities/migrations.d.ts.map +1 -1
  153. package/dist/types/src/capabilities/navigation-resolver.d.ts +5 -0
  154. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
  155. package/dist/types/src/capabilities/react-surface.d.ts +2 -2
  156. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  157. package/dist/types/src/capabilities/settings.d.ts +1 -2
  158. package/dist/types/src/capabilities/settings.d.ts.map +1 -1
  159. package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
  160. package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
  161. package/dist/types/src/capabilities/state.d.ts +1 -17
  162. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  163. package/dist/types/src/capabilities/toolkit.d.ts +1 -2
  164. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  165. package/dist/types/src/components/AgentProperties/AgentProperties.stories.d.ts.map +1 -1
  166. package/dist/types/src/components/Chat/Chat.d.ts +10 -8
  167. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  168. package/dist/types/src/components/Chat/Chat.stories.d.ts +32 -0
  169. package/dist/types/src/components/Chat/Chat.stories.d.ts.map +1 -0
  170. package/dist/types/src/components/Chat/events.d.ts +0 -4
  171. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  172. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +2 -2
  173. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  174. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  175. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts +2 -2
  176. package/dist/types/src/components/ChatPrompt/ChatOptions.stories.d.ts.map +1 -1
  177. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts +5 -5
  178. package/dist/types/src/components/ChatPrompt/ChatPrompt.d.ts.map +1 -1
  179. package/dist/types/src/components/ChatPrompt/useChatVoiceInput.d.ts +9 -0
  180. package/dist/types/src/components/ChatPrompt/useChatVoiceInput.d.ts.map +1 -0
  181. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +4 -4
  182. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  183. package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts +2 -2
  184. package/dist/types/src/components/ChatThread/MarkdownStream.stories.d.ts.map +1 -1
  185. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
  186. package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts +2 -2
  187. package/dist/types/src/components/ChatThread/widgets/ReasoningWidget.stories.d.ts.map +1 -1
  188. package/dist/types/src/components/ChatThread/widgets/SurfaceWidget.d.ts +11 -0
  189. package/dist/types/src/components/ChatThread/widgets/SurfaceWidget.d.ts.map +1 -0
  190. package/dist/types/src/components/ChatThread/widgets/index.d.ts +1 -0
  191. package/dist/types/src/components/ChatThread/widgets/index.d.ts.map +1 -1
  192. package/dist/types/src/components/ProcessTree/ProcessTree.d.ts +6 -0
  193. package/dist/types/src/components/ProcessTree/ProcessTree.d.ts.map +1 -1
  194. package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts +1 -0
  195. package/dist/types/src/components/ProcessTree/ProcessTree.stories.d.ts.map +1 -1
  196. package/dist/types/src/components/TaskList/TaskList.d.ts +8 -0
  197. package/dist/types/src/components/TaskList/TaskList.d.ts.map +1 -1
  198. package/dist/types/src/components/TaskList/TaskList.stories.d.ts +5 -2
  199. package/dist/types/src/components/TaskList/TaskList.stories.d.ts.map +1 -1
  200. package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -3
  201. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  202. package/dist/types/src/components/index.d.ts +1 -4
  203. package/dist/types/src/components/index.d.ts.map +1 -1
  204. package/dist/types/src/constants.d.ts +1 -1
  205. package/dist/types/src/constants.d.ts.map +1 -1
  206. package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts +2 -2
  207. package/dist/types/src/containers/AgentArticle/AgentArticle.stories.d.ts.map +1 -1
  208. package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts +1 -1
  209. package/dist/types/src/containers/AssistantSettings/AssistantSettings.d.ts.map +1 -0
  210. package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.stories.d.ts.map +1 -1
  211. package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts +12 -0
  212. package/dist/types/src/containers/AssistantSettings/OllamaModels.d.ts.map +1 -0
  213. package/dist/types/src/{components/TemplateEditor/TemplateEditor.stories.d.ts → containers/AssistantSettings/OllamaModels.stories.d.ts} +9 -7
  214. package/dist/types/src/containers/AssistantSettings/OllamaModels.stories.d.ts.map +1 -0
  215. package/dist/types/src/{components → containers}/AssistantSettings/index.d.ts.map +1 -1
  216. package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts +3 -10
  217. package/dist/types/src/containers/ChatArticle/ChatArticle.d.ts.map +1 -1
  218. package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts +4 -11
  219. package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -1
  220. package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -1
  221. package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts +13 -0
  222. package/dist/types/src/containers/IntegrationPrompt/IntegrationPrompt.d.ts.map +1 -0
  223. package/dist/types/src/containers/IntegrationPrompt/index.d.ts +2 -0
  224. package/dist/types/src/{components/RoutineProperties → containers/IntegrationPrompt}/index.d.ts.map +1 -1
  225. package/dist/types/src/containers/PlanArticle/PlanArticle.d.ts.map +1 -1
  226. package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts +15 -0
  227. package/dist/types/src/containers/SpaceHomePrompt/SpaceHomePrompt.d.ts.map +1 -0
  228. package/dist/types/src/containers/SpaceHomePrompt/index.d.ts +2 -0
  229. package/dist/types/src/containers/SpaceHomePrompt/index.d.ts.map +1 -0
  230. package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts +13 -0
  231. package/dist/types/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.d.ts.map +1 -0
  232. package/dist/types/src/containers/SpaceHomeSuggestions/index.d.ts +2 -0
  233. package/dist/types/src/containers/SpaceHomeSuggestions/index.d.ts.map +1 -0
  234. package/dist/types/src/containers/TracePanel/TracePanel.d.ts.map +1 -1
  235. package/dist/types/src/containers/TracePanel/TracePanel.stories.d.ts.map +1 -1
  236. package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts +1 -1
  237. package/dist/types/src/containers/TracePanel/testing/simulated-agent.d.ts.map +1 -1
  238. package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts.map +1 -1
  239. package/dist/types/src/containers/index.d.ts +4 -3
  240. package/dist/types/src/containers/index.d.ts.map +1 -1
  241. package/dist/types/src/execution-graph/execution-graph.d.ts +20 -1
  242. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -1
  243. package/dist/types/src/execution-graph/index.d.ts +3 -2
  244. package/dist/types/src/execution-graph/index.d.ts.map +1 -1
  245. package/dist/types/src/execution-graph/pending-block-status.d.ts +26 -0
  246. package/dist/types/src/execution-graph/pending-block-status.d.ts.map +1 -0
  247. package/dist/types/src/execution-graph/pending-block-status.test.d.ts +2 -0
  248. package/dist/types/src/execution-graph/pending-block-status.test.d.ts.map +1 -0
  249. package/dist/types/src/execution-graph/span-tree.d.ts +13 -0
  250. package/dist/types/src/execution-graph/span-tree.d.ts.map +1 -1
  251. package/dist/types/src/extensions/index.d.ts +1 -1
  252. package/dist/types/src/extensions/index.d.ts.map +1 -1
  253. package/dist/types/src/extensions/prompt-extension.d.ts +1 -1
  254. package/dist/types/src/extensions/prompt-extension.d.ts.map +1 -1
  255. package/dist/types/src/feed-logger.d.ts +3 -2
  256. package/dist/types/src/feed-logger.d.ts.map +1 -1
  257. package/dist/types/src/hooks/index.d.ts +4 -2
  258. package/dist/types/src/hooks/index.d.ts.map +1 -1
  259. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  260. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
  261. package/dist/types/src/hooks/useHomeSuggestions.d.ts +8 -0
  262. package/dist/types/src/hooks/useHomeSuggestions.d.ts.map +1 -0
  263. package/dist/types/src/hooks/usePresets.d.ts +6 -2
  264. package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
  265. package/dist/types/src/hooks/useProcessEphemeralStatus.d.ts +10 -0
  266. package/dist/types/src/hooks/useProcessEphemeralStatus.d.ts.map +1 -0
  267. package/dist/types/src/hooks/useSkillRegistry.d.ts +21 -0
  268. package/dist/types/src/hooks/useSkillRegistry.d.ts.map +1 -0
  269. package/dist/types/src/hooks/useTraceMessages.d.ts +12 -0
  270. package/dist/types/src/hooks/useTraceMessages.d.ts.map +1 -0
  271. package/dist/types/src/index.d.ts +1 -1
  272. package/dist/types/src/index.d.ts.map +1 -1
  273. package/dist/types/src/meta.d.ts +32 -2
  274. package/dist/types/src/meta.d.ts.map +1 -1
  275. package/dist/types/src/operations/create-chat.d.ts.map +1 -1
  276. package/dist/types/src/operations/fork-chat.d.ts.map +1 -1
  277. package/dist/types/src/operations/generate-home-suggestions.d.ts +5 -0
  278. package/dist/types/src/operations/generate-home-suggestions.d.ts.map +1 -0
  279. package/dist/types/src/operations/generate-home-suggestions.test.d.ts +2 -0
  280. package/dist/types/src/operations/generate-home-suggestions.test.d.ts.map +1 -0
  281. package/dist/types/src/operations/index.d.ts.map +1 -1
  282. package/dist/types/src/operations/resolve-navigation-targets.d.ts +3 -15
  283. package/dist/types/src/operations/resolve-navigation-targets.d.ts.map +1 -1
  284. package/dist/types/src/operations/run-prompt-in-new-chat.d.ts +2 -2
  285. package/dist/types/src/operations/run-prompt-in-new-chat.d.ts.map +1 -1
  286. package/dist/types/src/paths.d.ts +1 -1
  287. package/dist/types/src/paths.d.ts.map +1 -1
  288. package/dist/types/src/plugin.workerd.d.ts +2 -0
  289. package/dist/types/src/plugin.workerd.d.ts.map +1 -0
  290. package/dist/types/src/processor/presets.d.ts +20 -9
  291. package/dist/types/src/processor/presets.d.ts.map +1 -1
  292. package/dist/types/src/processor/processor.d.ts +33 -209
  293. package/dist/types/src/processor/processor.d.ts.map +1 -1
  294. package/dist/types/src/skills/assistant/index.d.ts +2 -0
  295. package/dist/types/src/skills/assistant/index.d.ts.map +1 -0
  296. package/dist/types/src/skills/assistant/skill.d.ts +4 -0
  297. package/dist/types/src/skills/assistant/skill.d.ts.map +1 -0
  298. package/dist/types/src/skills/assistant/skill.node.test.d.ts +2 -0
  299. package/dist/types/src/skills/assistant/skill.node.test.d.ts.map +1 -0
  300. package/dist/types/src/skills/index.d.ts.map +1 -0
  301. package/dist/types/src/templates/daily-digest.d.ts +2 -2
  302. package/dist/types/src/templates/daily-digest.d.ts.map +1 -1
  303. package/dist/types/src/templates/index.d.ts +3 -3
  304. package/dist/types/src/templates/index.d.ts.map +1 -1
  305. package/dist/types/src/templates/research-brief.d.ts +2 -2
  306. package/dist/types/src/templates/research-brief.d.ts.map +1 -1
  307. package/dist/types/src/templates/routine-templates.test.d.ts +2 -0
  308. package/dist/types/src/templates/routine-templates.test.d.ts.map +1 -0
  309. package/dist/types/src/templates/scaffold.d.ts +9 -9
  310. package/dist/types/src/templates/scaffold.d.ts.map +1 -1
  311. package/dist/types/src/testing/test-generator.d.ts +1 -1
  312. package/dist/types/src/testing/test-generator.d.ts.map +1 -1
  313. package/dist/types/src/testing/test-sequence.d.ts +1 -8
  314. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  315. package/dist/types/src/testing/test-trace.d.ts.map +1 -1
  316. package/dist/types/src/translations.d.ts.map +1 -1
  317. package/dist/types/src/types/Assistant.d.ts +5 -12
  318. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  319. package/dist/types/src/types/AssistantCapabilities.d.ts +21 -0
  320. package/dist/types/src/types/AssistantCapabilities.d.ts.map +1 -1
  321. package/dist/types/src/types/AssistantEvents.d.ts.map +1 -1
  322. package/dist/types/src/types/AssistantOperation.d.ts +17 -110
  323. package/dist/types/src/types/AssistantOperation.d.ts.map +1 -1
  324. package/dist/types/src/types/ChatSurface.d.ts +12 -0
  325. package/dist/types/src/types/ChatSurface.d.ts.map +1 -0
  326. package/dist/types/src/types/Ollama.d.ts +44 -0
  327. package/dist/types/src/types/Ollama.d.ts.map +1 -0
  328. package/dist/types/src/types/Settings.d.ts +5 -4
  329. package/dist/types/src/types/Settings.d.ts.map +1 -1
  330. package/dist/types/src/types/index.d.ts +2 -0
  331. package/dist/types/src/types/index.d.ts.map +1 -1
  332. package/dist/types/src/types/service.d.ts +4 -3
  333. package/dist/types/src/types/service.d.ts.map +1 -1
  334. package/dist/types/src/util/error-cause.d.ts +3 -0
  335. package/dist/types/src/util/error-cause.d.ts.map +1 -0
  336. package/dist/types/src/util/suggestions.d.ts +1 -1
  337. package/dist/types/tsconfig.tsbuildinfo +1 -1
  338. package/dx.config.ts +38 -0
  339. package/package.json +103 -90
  340. package/src/AssistantPlugin.conversations.json +1 -1
  341. package/src/AssistantPlugin.node.ts +5 -5
  342. package/src/AssistantPlugin.test.ts +27 -41
  343. package/src/AssistantPlugin.ts +14 -12
  344. package/src/AssistantPlugin.workerd.ts +15 -6
  345. package/src/capabilities/agent-hydrator.ts +1 -2
  346. package/src/capabilities/agent-service.ts +7 -5
  347. package/src/capabilities/ai-context.ts +7 -32
  348. package/src/capabilities/ai-service.ts +3 -2
  349. package/src/capabilities/app-graph-builder.ts +43 -28
  350. package/src/capabilities/automation-templates.ts +3 -3
  351. package/src/capabilities/companion-chat-provisioner.ts +22 -6
  352. package/src/capabilities/{integration-provider.ts → connector.ts} +7 -12
  353. package/src/capabilities/create-object.ts +9 -26
  354. package/src/capabilities/index.ts +4 -12
  355. package/src/capabilities/markdown-extension.ts +7 -4
  356. package/src/capabilities/navigation-resolver.ts +20 -0
  357. package/src/capabilities/react-surface.tsx +55 -52
  358. package/src/capabilities/settings.ts +2 -2
  359. package/src/capabilities/skill-definition.ts +72 -0
  360. package/src/capabilities/state.ts +8 -1
  361. package/src/components/AgentProperties/AgentProperties.stories.tsx +1 -2
  362. package/src/components/AgentProperties/AgentProperties.tsx +1 -1
  363. package/src/components/Chat/Chat.stories.tsx +94 -0
  364. package/src/components/Chat/Chat.tsx +67 -16
  365. package/src/components/Chat/events.ts +0 -6
  366. package/src/components/ChatPrompt/ChatActions.tsx +185 -20
  367. package/src/components/ChatPrompt/ChatMcpErrors.tsx +1 -1
  368. package/src/components/ChatPrompt/ChatOptions.stories.tsx +3 -3
  369. package/src/components/ChatPrompt/ChatOptions.tsx +43 -50
  370. package/src/components/ChatPrompt/ChatPrompt.tsx +31 -47
  371. package/src/components/ChatPrompt/ChatReferences.tsx +1 -1
  372. package/src/components/ChatPrompt/useChatVoiceInput.ts +103 -0
  373. package/src/components/ChatThread/Anchor.stories.tsx +1 -1
  374. package/src/components/ChatThread/ChatThread.stories.tsx +7 -16
  375. package/src/components/ChatThread/DEBUG.md +23 -0
  376. package/src/components/ChatThread/MarkdownStream.stories.tsx +3 -3
  377. package/src/components/ChatThread/registry.tsx +43 -17
  378. package/src/components/ChatThread/widgets/ReasoningWidget.stories.tsx +2 -2
  379. package/src/components/ChatThread/widgets/SummaryWidget.tsx +1 -1
  380. package/src/components/ChatThread/widgets/SurfaceWidget.tsx +41 -0
  381. package/src/components/ChatThread/widgets/ToolWidget.tsx +1 -1
  382. package/src/components/ChatThread/widgets/index.ts +1 -0
  383. package/src/components/ProcessTree/ProcessTree.stories.tsx +7 -0
  384. package/src/components/ProcessTree/ProcessTree.tsx +183 -88
  385. package/src/components/TaskList/TaskList.stories.tsx +24 -3
  386. package/src/components/TaskList/TaskList.tsx +122 -28
  387. package/src/components/ToolBlock/ToolBlock.tsx +1 -1
  388. package/src/components/Toolbox/Toolbox.tsx +11 -11
  389. package/src/components/index.ts +1 -6
  390. package/src/constants.ts +1 -1
  391. package/src/containers/AgentArticle/AgentArticle.stories.tsx +12 -13
  392. package/src/containers/AgentArticle/AgentArticle.tsx +10 -10
  393. package/src/{components → containers}/AssistantSettings/AssistantSettings.stories.tsx +3 -2
  394. package/src/containers/AssistantSettings/AssistantSettings.tsx +90 -0
  395. package/src/containers/AssistantSettings/OllamaModels.stories.tsx +108 -0
  396. package/src/containers/AssistantSettings/OllamaModels.tsx +255 -0
  397. package/src/containers/ChatArticle/ChatArticle.stories.tsx +3 -3
  398. package/src/containers/ChatArticle/ChatArticle.tsx +25 -28
  399. package/src/containers/ChatCompanion/ChatCompanion.tsx +27 -27
  400. package/src/containers/ChatDialog/ChatDialog.tsx +10 -7
  401. package/src/containers/IntegrationPrompt/IntegrationPrompt.tsx +79 -0
  402. package/src/containers/IntegrationPrompt/index.ts +5 -0
  403. package/src/containers/PlanArticle/PlanArticle.tsx +5 -1
  404. package/src/containers/SpaceHomePrompt/SpaceHomePrompt.tsx +107 -0
  405. package/src/containers/SpaceHomePrompt/index.ts +5 -0
  406. package/src/containers/SpaceHomeSuggestions/SpaceHomeSuggestions.tsx +83 -0
  407. package/src/containers/SpaceHomeSuggestions/index.ts +5 -0
  408. package/src/containers/TracePanel/TracePanel.stories.tsx +89 -47
  409. package/src/containers/TracePanel/TracePanel.tsx +15 -37
  410. package/src/containers/TracePanel/dxn-extractor.test.ts +2 -2
  411. package/src/containers/TriggerStatus/TriggerStatus.tsx +10 -6
  412. package/src/containers/index.ts +4 -3
  413. package/src/execution-graph/SPEC.md +1 -1
  414. package/src/execution-graph/execution-graph.test.ts +213 -25
  415. package/src/execution-graph/execution-graph.ts +337 -70
  416. package/src/execution-graph/index.ts +15 -5
  417. package/src/execution-graph/pending-block-status.test.ts +114 -0
  418. package/src/execution-graph/pending-block-status.ts +88 -0
  419. package/src/execution-graph/span-tree.test.ts +33 -1
  420. package/src/execution-graph/span-tree.ts +43 -2
  421. package/src/execution-graph/sub-agent-delegation.test.ts +34 -19
  422. package/src/extensions/index.ts +1 -1
  423. package/src/extensions/prompt-extension.ts +102 -73
  424. package/src/feed-logger.ts +24 -22
  425. package/src/functions/services.test.ts +4 -4
  426. package/src/hooks/index.ts +4 -2
  427. package/src/hooks/useChatProcessor.ts +12 -16
  428. package/src/hooks/useChatServices.ts +2 -2
  429. package/src/hooks/useChatToolbarActions.ts +5 -5
  430. package/src/hooks/useContextBinder.ts +2 -4
  431. package/src/hooks/useDebug.ts +2 -2
  432. package/src/hooks/useHomeSuggestions.ts +55 -0
  433. package/src/hooks/usePresets.ts +80 -11
  434. package/src/hooks/useProcessEphemeralStatus.ts +192 -0
  435. package/src/hooks/useReferencesProvider.ts +1 -1
  436. package/src/hooks/useSkillRegistry.ts +125 -0
  437. package/src/hooks/useTraceMessages.ts +41 -0
  438. package/src/index.ts +1 -1
  439. package/src/meta.ts +3 -31
  440. package/src/operations/create-chat.ts +11 -12
  441. package/src/operations/fork-chat.ts +15 -20
  442. package/src/operations/generate-home-suggestions.test.ts +103 -0
  443. package/src/operations/generate-home-suggestions.ts +116 -0
  444. package/src/operations/index.ts +1 -0
  445. package/src/operations/prompt.node.test.ts +14 -17
  446. package/src/operations/resolve-navigation-targets.ts +32 -19
  447. package/src/operations/run-prompt-in-new-chat.ts +34 -35
  448. package/src/operations/update-chat-name.ts +2 -2
  449. package/src/paths.ts +5 -3
  450. package/src/plugin.workerd.ts +5 -0
  451. package/src/processor/presets.ts +38 -61
  452. package/src/processor/processor.node.test.ts +72 -2
  453. package/src/processor/processor.ts +91 -21
  454. package/src/skills/assistant/index.ts +5 -0
  455. package/src/{blueprints/assistant/blueprint.node.test.ts → skills/assistant/skill.node.test.ts} +8 -8
  456. package/src/{blueprints/assistant/blueprint.ts → skills/assistant/skill.ts} +9 -9
  457. package/src/templates/daily-digest.ts +10 -12
  458. package/src/templates/index.ts +3 -3
  459. package/src/templates/research-brief.ts +15 -13
  460. package/src/templates/routine-templates.test.ts +55 -0
  461. package/src/templates/scaffold.ts +22 -57
  462. package/src/testing/data/trace-timeline-multiple.dx.json +1 -1
  463. package/src/testing/data/trace-timeline-remote.dx.json +1 -1
  464. package/src/testing/data/trace-timeline.dx.json +3430 -1093
  465. package/src/testing/test-generator.test.ts +26 -22
  466. package/src/testing/test-generator.ts +4 -8
  467. package/src/testing/test-trace.ts +2 -1
  468. package/src/testing/trace-timeline.node.test.ts +14 -14
  469. package/src/translations.ts +74 -31
  470. package/src/types/Assistant.ts +3 -1
  471. package/src/types/AssistantCapabilities.ts +24 -3
  472. package/src/types/AssistantEvents.ts +1 -1
  473. package/src/types/AssistantOperation.ts +22 -33
  474. package/src/types/ChatSurface.ts +16 -0
  475. package/src/types/Ollama.ts +59 -0
  476. package/src/types/Settings.ts +12 -10
  477. package/src/types/index.ts +3 -0
  478. package/src/types/service.ts +14 -14
  479. package/src/util/error-cause.ts +21 -0
  480. package/src/util/suggestions.ts +1 -1
  481. package/dist/lib/neutral/AgentArticle-K7XM46OQ.mjs.map +0 -7
  482. package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs +0 -40
  483. package/dist/lib/neutral/AssistantSettings-GG52BLKS.mjs.map +0 -7
  484. package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs +0 -27
  485. package/dist/lib/neutral/BlueprintArticle-ZBOZNZM7.mjs.map +0 -7
  486. package/dist/lib/neutral/ChatCompanion-LBUHYWQG.mjs.map +0 -7
  487. package/dist/lib/neutral/ChatDialog-DCA6FLOV.mjs.map +0 -7
  488. package/dist/lib/neutral/PlanArticle-TS5ULWYS.mjs.map +0 -7
  489. package/dist/lib/neutral/RoutineArticle-5NYXHRG6.mjs +0 -119
  490. package/dist/lib/neutral/RoutineArticle-5NYXHRG6.mjs.map +0 -7
  491. package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs +0 -48
  492. package/dist/lib/neutral/RoutineList-SO5ETHNT.mjs.map +0 -7
  493. package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs +0 -17
  494. package/dist/lib/neutral/RoutineProperties-FISLMW2R.mjs.map +0 -7
  495. package/dist/lib/neutral/TracePanel-KTZJ6JNR.mjs.map +0 -7
  496. package/dist/lib/neutral/TriggerStatus-X7Y5JFZJ.mjs.map +0 -7
  497. package/dist/lib/neutral/agent-hydrator-PJBYVMBW.mjs.map +0 -7
  498. package/dist/lib/neutral/agent-service-WCAP5MLI.mjs.map +0 -7
  499. package/dist/lib/neutral/ai-context-7WRHWYXY.mjs +0 -42
  500. package/dist/lib/neutral/ai-context-7WRHWYXY.mjs.map +0 -7
  501. package/dist/lib/neutral/ai-service-AADUIKBY.mjs.map +0 -7
  502. package/dist/lib/neutral/app-graph-builder-WUFHQH3Y.mjs.map +0 -7
  503. package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs +0 -115
  504. package/dist/lib/neutral/automation-templates-M2XQWGR6.mjs.map +0 -7
  505. package/dist/lib/neutral/blueprint-definition-MH2QLYQH.mjs +0 -39
  506. package/dist/lib/neutral/blueprint-definition-MH2QLYQH.mjs.map +0 -7
  507. package/dist/lib/neutral/blueprints/index.mjs +0 -8
  508. package/dist/lib/neutral/chunk-5H6UJHLF.mjs.map +0 -7
  509. package/dist/lib/neutral/chunk-HLANPOBA.mjs.map +0 -7
  510. package/dist/lib/neutral/chunk-KLYLW4WH.mjs.map +0 -7
  511. package/dist/lib/neutral/chunk-QAZMOFPI.mjs +0 -130
  512. package/dist/lib/neutral/chunk-QAZMOFPI.mjs.map +0 -7
  513. package/dist/lib/neutral/chunk-RKVVK3R3.mjs.map +0 -7
  514. package/dist/lib/neutral/chunk-SMFJD7BP.mjs +0 -8
  515. package/dist/lib/neutral/chunk-XYHPOGTK.mjs +0 -43
  516. package/dist/lib/neutral/chunk-XYHPOGTK.mjs.map +0 -7
  517. package/dist/lib/neutral/chunk-YXRGZYYH.mjs.map +0 -7
  518. package/dist/lib/neutral/companion-chat-provisioner-YZZ73P6E.mjs.map +0 -7
  519. package/dist/lib/neutral/create-chat-SGGQ6HVN.mjs.map +0 -7
  520. package/dist/lib/neutral/create-object-U2SOFZLR.mjs.map +0 -7
  521. package/dist/lib/neutral/fork-chat-34KEF4ZJ.mjs.map +0 -7
  522. package/dist/lib/neutral/integration-provider-RBD3AFJU.mjs.map +0 -7
  523. package/dist/lib/neutral/markdown-extension-YMIFDMYF.mjs +0 -110
  524. package/dist/lib/neutral/markdown-extension-YMIFDMYF.mjs.map +0 -7
  525. package/dist/lib/neutral/react-surface-XRTBW5OJ.mjs.map +0 -7
  526. package/dist/lib/neutral/resolve-navigation-targets-ZHIMMH7L.mjs +0 -22
  527. package/dist/lib/neutral/resolve-navigation-targets-ZHIMMH7L.mjs.map +0 -7
  528. package/dist/lib/neutral/run-prompt-in-new-chat-D5IIE2C7.mjs.map +0 -7
  529. package/dist/lib/neutral/state-H3G7QCU6.mjs.map +0 -7
  530. package/dist/types/src/blueprints/assistant/blueprint.d.ts +0 -4
  531. package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +0 -1
  532. package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts +0 -2
  533. package/dist/types/src/blueprints/assistant/blueprint.node.test.d.ts.map +0 -1
  534. package/dist/types/src/blueprints/assistant/index.d.ts +0 -2
  535. package/dist/types/src/blueprints/assistant/index.d.ts.map +0 -1
  536. package/dist/types/src/blueprints/index.d.ts.map +0 -1
  537. package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
  538. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
  539. package/dist/types/src/capabilities/integration-provider.d.ts.map +0 -1
  540. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +0 -1
  541. package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts +0 -7
  542. package/dist/types/src/components/RoutineProperties/RoutineProperties.d.ts.map +0 -1
  543. package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts +0 -15
  544. package/dist/types/src/components/RoutineProperties/RoutineProperties.stories.d.ts.map +0 -1
  545. package/dist/types/src/components/RoutineProperties/index.d.ts +0 -2
  546. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -13
  547. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +0 -1
  548. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +0 -1
  549. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +0 -21
  550. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +0 -1
  551. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +0 -16
  552. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +0 -1
  553. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +0 -12
  554. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +0 -1
  555. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +0 -3
  556. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +0 -1
  557. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +0 -8
  558. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +0 -1
  559. package/dist/types/src/components/TemplateEditor/index.d.ts +0 -2
  560. package/dist/types/src/components/TemplateEditor/index.d.ts.map +0 -1
  561. package/dist/types/src/components/TemplateEditor/types.d.ts +0 -18
  562. package/dist/types/src/components/TemplateEditor/types.d.ts.map +0 -1
  563. package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts +0 -6
  564. package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +0 -1
  565. package/dist/types/src/containers/BlueprintArticle/index.d.ts +0 -2
  566. package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +0 -1
  567. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +0 -6
  568. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +0 -1
  569. package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +0 -15
  570. package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +0 -1
  571. package/dist/types/src/containers/RoutineArticle/index.d.ts +0 -2
  572. package/dist/types/src/containers/RoutineArticle/index.d.ts.map +0 -1
  573. package/dist/types/src/containers/RoutineList/RoutineList.d.ts +0 -6
  574. package/dist/types/src/containers/RoutineList/RoutineList.d.ts.map +0 -1
  575. package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts +0 -21
  576. package/dist/types/src/containers/RoutineList/RoutineList.stories.d.ts.map +0 -1
  577. package/dist/types/src/containers/RoutineList/index.d.ts +0 -2
  578. package/dist/types/src/containers/RoutineList/index.d.ts.map +0 -1
  579. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +0 -66
  580. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +0 -1
  581. package/dist/types/src/hooks/useOnline.d.ts +0 -3
  582. package/dist/types/src/hooks/useOnline.d.ts.map +0 -1
  583. package/dist/types/src/templates/automation-templates.test.d.ts +0 -2
  584. package/dist/types/src/templates/automation-templates.test.d.ts.map +0 -1
  585. package/src/blueprints/assistant/index.ts +0 -5
  586. package/src/capabilities/blueprint-definition.ts +0 -65
  587. package/src/components/AssistantSettings/AssistantSettings.tsx +0 -43
  588. package/src/components/RoutineProperties/RoutineProperties.stories.tsx +0 -59
  589. package/src/components/RoutineProperties/RoutineProperties.tsx +0 -23
  590. package/src/components/RoutineProperties/index.ts +0 -5
  591. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +0 -95
  592. package/src/components/TemplateEditor/TemplateEditor.tsx +0 -80
  593. package/src/components/TemplateEditor/TemplateForm.stories.tsx +0 -76
  594. package/src/components/TemplateEditor/TemplateForm.tsx +0 -204
  595. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +0 -274
  596. package/src/components/TemplateEditor/extensions/index.ts +0 -6
  597. package/src/components/TemplateEditor/extensions/xml-extension.ts +0 -64
  598. package/src/components/TemplateEditor/index.ts +0 -5
  599. package/src/components/TemplateEditor/types.tsx +0 -28
  600. package/src/containers/BlueprintArticle/BlueprintArticle.tsx +0 -29
  601. package/src/containers/BlueprintArticle/index.ts +0 -5
  602. package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +0 -75
  603. package/src/containers/RoutineArticle/RoutineArticle.tsx +0 -109
  604. package/src/containers/RoutineArticle/index.ts +0 -5
  605. package/src/containers/RoutineList/RoutineList.stories.tsx +0 -130
  606. package/src/containers/RoutineList/RoutineList.tsx +0 -50
  607. package/src/containers/RoutineList/index.ts +0 -5
  608. package/src/hooks/useBlueprintRegistry.ts +0 -125
  609. package/src/hooks/useOnline.ts +0 -10
  610. package/src/templates/automation-templates.test.ts +0 -66
  611. package/src/testing/trace-timeline.node.conversations.json +0 -1
  612. /package/dist/lib/neutral/{ChatArticle-VNVZCDUR.mjs.map → ChatArticle-OO7GGEFW.mjs.map} +0 -0
  613. /package/dist/lib/neutral/{edge-model-resolver-BBVOJBGJ.mjs.map → edge-model-resolver-WDJWDZTT.mjs.map} +0 -0
  614. /package/dist/lib/neutral/{blueprints → extensions}/index.mjs.map +0 -0
  615. /package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.stories.d.ts +0 -0
  616. /package/dist/types/src/{components → containers}/AssistantSettings/index.d.ts +0 -0
  617. /package/dist/types/src/{blueprints → skills}/index.d.ts +0 -0
  618. /package/src/{components → containers}/AssistantSettings/index.ts +0 -0
  619. /package/src/{blueprints → skills}/index.ts +0 -0
@@ -1,12 +1,15 @@
1
+ import {
2
+ TracePanel
3
+ } from "../chunk-SCTHQVIJ.mjs";
1
4
  import {
2
5
  ChatContextProvider,
3
6
  useChatContext
4
7
  } from "../chunk-VTK5R4H3.mjs";
8
+ import {
9
+ AiUsageQuotaError
10
+ } from "../chunk-BXI2R4OO.mjs";
5
11
  import "../chunk-J5LGTIGS.mjs";
6
12
 
7
- // src/components/index.ts
8
- import { lazy } from "react";
9
-
10
13
  // src/components/AgentProperties/AgentProperties.tsx
11
14
  import { Atom } from "@effect-atom/atom";
12
15
  import { useAtomValue } from "@effect-atom/atom-react";
@@ -19,7 +22,7 @@ import { Form } from "@dxos/react-ui-form";
19
22
  import { FeedAnnotation } from "@dxos/schema";
20
23
  import { meta } from "#meta";
21
24
  var AgentProperties = ({ agent }) => {
22
- const { t } = useTranslation(meta.id);
25
+ const { t } = useTranslation(meta.profile.key);
23
26
  const db = Obj.getDatabase(agent);
24
27
  const feedFilter = useMemo(() => {
25
28
  if (!db) {
@@ -72,51 +75,164 @@ var AgentProperties = ({ agent }) => {
72
75
  };
73
76
 
74
77
  // src/components/Chat/Chat.tsx
78
+ import { Atom as Atom2 } from "@effect-atom/atom";
75
79
  import { useAtomValue as useAtomValue4 } from "@effect-atom/atom-react";
76
- import * as Array from "effect/Array";
80
+ import * as Array2 from "effect/Array";
77
81
  import * as Option3 from "effect/Option";
78
- import React16, { useCallback as useCallback7, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef4, useState as useState7 } from "react";
79
- import { Agent } from "@dxos/assistant-toolkit";
82
+ import React17, { useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo10, useRef as useRef5, useState as useState7 } from "react";
80
83
  import { Event } from "@dxos/async";
84
+ import { getSpace } from "@dxos/client/echo";
81
85
  import { Filter as Filter3, Obj as Obj4, Query } from "@dxos/echo";
82
- import { useQuery as useQuery3 } from "@dxos/react-client/echo";
86
+ import { useObject as useObject3, useQuery as useQuery3 } from "@dxos/react-client/echo";
83
87
  import { useIdentity } from "@dxos/react-client/halo";
84
- import { Toast, composable as composable2, composableProps as composableProps2, useTranslation as useTranslation9 } from "@dxos/react-ui";
88
+ import { Button, Toast, composable as composable2, composableProps as composableProps2, useTranslation as useTranslation10 } from "@dxos/react-ui";
85
89
  import { Menu } from "@dxos/react-ui-menu";
86
90
  import { Message as Message2 } from "@dxos/types";
87
- import { useChatKeymapExtensions as useChatKeymapExtensions2, useChatToolbarActions, useDebug } from "#hooks";
88
- import { meta as meta9 } from "#meta";
91
+ import { useChatKeymapExtensions as useChatKeymapExtensions2, useChatToolbarActions, useDebug, useTraceMessages } from "#hooks";
92
+ import { meta as meta10 } from "#meta";
89
93
 
90
94
  // src/components/ChatPrompt/ChatActions.tsx
91
- import React2 from "react";
92
- import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
95
+ import React2, { useCallback as useCallback2, useEffect, useState } from "react";
96
+ import { useOptionalAtomCapabilityState, useOptionalCapabilities } from "@dxos/app-framework/ui";
97
+ import { TranscriptionCapabilities } from "@dxos/plugin-transcription";
98
+ import { DropdownMenu, Icon, IconButton, MicButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
93
99
  import { mx } from "@dxos/ui-theme";
94
100
  import { meta as meta2 } from "#meta";
95
- var ChatActions = ({ classNames, children, microphone, recording, processing, debug, onEvent }) => {
96
- const { t } = useTranslation2(meta2.id);
101
+ var ChatActions = ({ classNames, children, docId, microphone, processing, debug, onEvent }) => {
102
+ const { t } = useTranslation2(meta2.profile.key);
103
+ const transcriptionAvailable = useOptionalCapabilities(TranscriptionCapabilities.RecordingSession).length > 0;
104
+ const [session, setSession] = useOptionalAtomCapabilityState(TranscriptionCapabilities.RecordingSession);
105
+ const [settings, setSettings] = useOptionalAtomCapabilityState(TranscriptionCapabilities.Settings);
106
+ const recording = !!session?.recording && session.id === docId;
107
+ const recordMode = settings?.recordMode ?? "toggle";
108
+ const entityExtraction = settings?.entityExtraction !== false;
109
+ const selectedDeviceId = settings?.audioDeviceId ?? "";
110
+ const [devices, setDevices] = useState([]);
111
+ useEffect(() => {
112
+ if (!microphone || !transcriptionAvailable || !navigator.mediaDevices?.enumerateDevices) {
113
+ return;
114
+ }
115
+ let cancelled = false;
116
+ const refresh = async () => {
117
+ const all = await navigator.mediaDevices.enumerateDevices();
118
+ if (cancelled) {
119
+ return;
120
+ }
121
+ setDevices(all.filter((device) => device.kind === "audioinput" && device.deviceId).map((device, index) => ({
122
+ deviceId: device.deviceId,
123
+ label: device.label || `Microphone ${index + 1}`
124
+ })));
125
+ };
126
+ void refresh();
127
+ navigator.mediaDevices.addEventListener("devicechange", refresh);
128
+ return () => {
129
+ cancelled = true;
130
+ navigator.mediaDevices.removeEventListener("devicechange", refresh);
131
+ };
132
+ }, [
133
+ microphone,
134
+ transcriptionAvailable
135
+ ]);
136
+ const handleToggle = useCallback2(() => {
137
+ if (!docId) {
138
+ return;
139
+ }
140
+ setSession((current) => current?.recording && current.id === docId ? null : {
141
+ id: docId,
142
+ recording: true
143
+ });
144
+ }, [
145
+ setSession,
146
+ docId
147
+ ]);
148
+ const handlePressStart = useCallback2(() => {
149
+ if (!docId) {
150
+ return;
151
+ }
152
+ setSession(() => ({
153
+ id: docId,
154
+ recording: true
155
+ }));
156
+ }, [
157
+ setSession,
158
+ docId
159
+ ]);
160
+ const handlePressEnd = useCallback2(() => {
161
+ setSession((current) => current?.id === docId ? null : current);
162
+ }, [
163
+ setSession,
164
+ docId
165
+ ]);
166
+ const handleRecordModeChange = useCallback2((mode) => setSettings((current) => ({
167
+ ...current,
168
+ recordMode: mode
169
+ })), [
170
+ setSettings
171
+ ]);
172
+ const handleEntityExtractionChange = useCallback2((value2) => setSettings((current) => ({
173
+ ...current,
174
+ entityExtraction: value2
175
+ })), [
176
+ setSettings
177
+ ]);
178
+ const handleSelectDevice = useCallback2((deviceId) => setSettings((current) => ({
179
+ ...current,
180
+ audioDeviceId: deviceId || void 0
181
+ })), [
182
+ setSettings
183
+ ]);
184
+ const recordLabel = recording ? t("stop-recording.label") : recordMode === "hold" ? t("hold-to-record.label") : t("start-recording.label");
97
185
  return /* @__PURE__ */ React2.createElement("div", {
98
186
  className: mx("flex items-center", classNames)
99
- }, children, microphone && /* @__PURE__ */ React2.createElement(IconButton, {
100
- disabled: !processing,
101
- classNames: mx(recording && "bg-primary-500"),
187
+ }, children, microphone && docId && transcriptionAvailable && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(MicButton, {
188
+ iconOnly: true,
102
189
  variant: "ghost",
103
- icon: "ph--microphone--regular",
190
+ label: recordLabel,
191
+ recording,
192
+ mode: recordMode,
193
+ onToggle: handleToggle,
194
+ onPressStart: handlePressStart,
195
+ onPressEnd: handlePressEnd,
196
+ "data-testid": "assistant.record"
197
+ }), /* @__PURE__ */ React2.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
198
+ asChild: true
199
+ }, /* @__PURE__ */ React2.createElement(IconButton, {
200
+ icon: "ph--caret-down--regular",
104
201
  iconOnly: true,
105
- noTooltip: true,
106
- label: t("microphone.button"),
107
- onMouseDown: () => onEvent?.({
108
- type: "record-start"
109
- }),
110
- onMouseUp: () => onEvent?.({
111
- type: "record-stop"
112
- }),
113
- onTouchStart: () => onEvent?.({
114
- type: "record-start"
115
- }),
116
- onTouchEnd: () => onEvent?.({
117
- type: "record-stop"
118
- })
119
- }), debug && /* @__PURE__ */ React2.createElement(IconButton, {
202
+ label: t("recording-options.label"),
203
+ variant: "ghost",
204
+ classNames: "w-4",
205
+ "data-testid": "assistant.record.options"
206
+ })), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React2.createElement(DropdownMenu.GroupLabel, null, t("record-mode.label")), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
207
+ label: t("record-mode.toggle.label"),
208
+ selected: recordMode === "toggle",
209
+ onSelect: () => handleRecordModeChange("toggle")
210
+ }), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
211
+ label: t("record-mode.hold.label"),
212
+ selected: recordMode === "hold",
213
+ onSelect: () => handleRecordModeChange("hold")
214
+ }), /* @__PURE__ */ React2.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React2.createElement(DropdownMenu.GroupLabel, null, t("audio-device.label")), /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
215
+ label: t("audio-device.default.label"),
216
+ selected: selectedDeviceId === "",
217
+ onSelect: () => handleSelectDevice("")
218
+ }), devices.map((device) => /* @__PURE__ */ React2.createElement(SettingsSelectableItem, {
219
+ key: device.deviceId,
220
+ label: device.label,
221
+ selected: selectedDeviceId === device.deviceId,
222
+ onSelect: () => handleSelectDevice(device.deviceId)
223
+ })), /* @__PURE__ */ React2.createElement(DropdownMenu.Separator, null), /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
224
+ checked: entityExtraction,
225
+ onCheckedChange: handleEntityExtractionChange,
226
+ classNames: "gap-2",
227
+ "data-testid": "assistant.entity-extraction"
228
+ }, /* @__PURE__ */ React2.createElement("span", {
229
+ className: "grow truncate"
230
+ }, t("settings.entity-extraction.label")), /* @__PURE__ */ React2.createElement(DropdownMenu.ItemIndicator, {
231
+ asChild: true
232
+ }, /* @__PURE__ */ React2.createElement(Icon, {
233
+ icon: "ph--check--regular",
234
+ size: 4
235
+ })))), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))))), debug && /* @__PURE__ */ React2.createElement(IconButton, {
120
236
  variant: "ghost",
121
237
  icon: "ph--wrench--regular",
122
238
  iconOnly: true,
@@ -130,21 +246,34 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, de
130
246
  icon: "ph--x--regular",
131
247
  iconOnly: true,
132
248
  label: t("cancel-processing.button"),
133
- onClick: () => onEvent?.({
134
- type: "cancel"
135
- })
249
+ onClick: () => {
250
+ onEvent?.({
251
+ type: "cancel"
252
+ });
253
+ }
136
254
  }));
137
255
  };
256
+ var SettingsSelectableItem = ({ label, selected, onSelect }) => /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
257
+ classNames: "gap-2",
258
+ role: "menuitemradio",
259
+ "aria-checked": selected,
260
+ onSelect
261
+ }, /* @__PURE__ */ React2.createElement("span", {
262
+ className: "grow truncate"
263
+ }, label), selected && /* @__PURE__ */ React2.createElement(Icon, {
264
+ icon: "ph--check--regular",
265
+ size: 4
266
+ }));
138
267
 
139
268
  // src/components/ChatPrompt/ChatMcpErrors.tsx
140
269
  import { useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
141
- import React3, { useCallback as useCallback2 } from "react";
270
+ import React3, { useCallback as useCallback3 } from "react";
142
271
  import { Message, useTranslation as useTranslation3 } from "@dxos/react-ui";
143
272
  import { meta as meta3 } from "#meta";
144
273
  var ChatMcpErrors = ({ classNames, processor }) => {
145
- const { t } = useTranslation3(meta3.id);
274
+ const { t } = useTranslation3(meta3.profile.key);
146
275
  const errors = useAtomValue2(processor.mcpErrors);
147
- const handleDismiss = useCallback2(() => {
276
+ const handleDismiss = useCallback3(() => {
148
277
  processor.dismissMcpErrors();
149
278
  }, [
150
279
  processor
@@ -173,7 +302,7 @@ var ChatMcpErrors = ({ classNames, processor }) => {
173
302
  };
174
303
 
175
304
  // src/components/ChatPrompt/ChatOptions.tsx
176
- import React4, { useCallback as useCallback3, useMemo as useMemo2, useState } from "react";
305
+ import React4, { useCallback as useCallback4, useMemo as useMemo2, useState as useState2 } from "react";
177
306
  import { McpServer } from "@dxos/assistant-toolkit";
178
307
  import { Filter as Filter2, Obj as Obj2, Type as Type2 } from "@dxos/echo";
179
308
  import { useObject, useQuery as useQuery2 } from "@dxos/react-client/echo";
@@ -182,7 +311,7 @@ import { Listbox } from "@dxos/react-ui-list";
182
311
  import { SearchList, useSearchListResults } from "@dxos/react-ui-search";
183
312
  import { Tabs } from "@dxos/react-ui-tabs";
184
313
  import { getStyles, mx as mx2 } from "@dxos/ui-theme";
185
- import { useActiveBlueprints, useBlueprintHandlers, useBlueprints, useContextObjects, useFilteredTypes } from "#hooks";
314
+ import { useActiveSkills, useContextObjects, useFilteredTypes, useSkillHandlers, useSkills } from "#hooks";
186
315
  import { meta as meta4 } from "#meta";
187
316
  import { Assistant } from "#types";
188
317
  var styles = {
@@ -190,7 +319,7 @@ var styles = {
190
319
  toolbar: "p-0! gap-0! border-t border-separator"
191
320
  };
192
321
  var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChange }) => {
193
- const { t } = useTranslation4(meta4.id);
322
+ const { t } = useTranslation4(meta4.profile.key);
194
323
  return /* @__PURE__ */ React4.createElement("div", {
195
324
  className: "flex"
196
325
  }, /* @__PURE__ */ React4.createElement(Popover.Root, null, /* @__PURE__ */ React4.createElement(Popover.Trigger, {
@@ -217,7 +346,7 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
217
346
  side: "top",
218
347
  classNames: styles.panel
219
348
  }, /* @__PURE__ */ React4.createElement(Popover.Viewport, null, /* @__PURE__ */ React4.createElement(Tabs.Root, {
220
- classNames: "flex",
349
+ asChild: true,
221
350
  orientation: "horizontal",
222
351
  defaultValue: "view",
223
352
  defaultActivePart: "list",
@@ -233,8 +362,8 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
233
362
  })), /* @__PURE__ */ React4.createElement(Tabs.Panel, {
234
363
  tabIndex: -1,
235
364
  classNames: "dx-focus-ring-inset overflow-hidden",
236
- value: "blueprints"
237
- }, /* @__PURE__ */ React4.createElement(BlueprintsPanel, {
365
+ value: "skills"
366
+ }, /* @__PURE__ */ React4.createElement(SkillsPanel, {
238
367
  registry,
239
368
  db,
240
369
  context
@@ -261,9 +390,9 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
261
390
  icon: "ph--eye--regular",
262
391
  label: t("chat-view.title")
263
392
  }), /* @__PURE__ */ React4.createElement(Tabs.IconTab, {
264
- value: "blueprints",
393
+ value: "skills",
265
394
  icon: "ph--blueprint--regular",
266
- label: t("options.blueprints.title")
395
+ label: t("options.skills.title")
267
396
  }), /* @__PURE__ */ React4.createElement(Tabs.IconTab, {
268
397
  value: "mcp-servers",
269
398
  icon: "ph--plugs-connected--regular",
@@ -274,38 +403,38 @@ var ChatOptions = ({ chat, db, context, registry, presets, preset, onPresetChang
274
403
  label: t("options.chat-model.title")
275
404
  }))))), /* @__PURE__ */ React4.createElement(Popover.Arrow, null)))));
276
405
  };
277
- var BlueprintsPanel = ({ registry, db, context }) => {
278
- const { t } = useTranslation4(meta4.id);
279
- const blueprints = useBlueprints({
406
+ var SkillsPanel = ({ registry, db, context }) => {
407
+ const { t } = useTranslation4(meta4.profile.key);
408
+ const skills = useSkills({
280
409
  registry,
281
410
  db
282
411
  });
283
- const activeBlueprints = useActiveBlueprints({
412
+ const activeSkills = useActiveSkills({
284
413
  context
285
414
  });
286
- const { onUpdateBlueprint } = useBlueprintHandlers({
415
+ const { onUpdateSkill } = useSkillHandlers({
287
416
  db,
288
417
  context,
289
418
  registry
290
419
  });
291
420
  const { results, handleSearch } = useSearchListResults({
292
- items: blueprints,
293
- extract: (blueprint) => blueprint.name
421
+ items: skills,
422
+ extract: (skill) => skill.name
294
423
  });
295
424
  return /* @__PURE__ */ React4.createElement(SearchList.Root, {
296
425
  onSearch: handleSearch
297
426
  }, /* @__PURE__ */ React4.createElement(SearchList.Content, {
298
427
  classNames: "flex flex-col"
299
- }, /* @__PURE__ */ React4.createElement(SearchList.Viewport, null, results.map((blueprint) => {
300
- const blueprintKey = Obj2.getMeta(blueprint).key ?? blueprint.id;
301
- const isActive = activeBlueprints.has(blueprintKey);
428
+ }, /* @__PURE__ */ React4.createElement(SearchList.Viewport, null, results.map((skill) => {
429
+ const skillKey = Obj2.getMeta(skill).key ?? skill.id;
430
+ const isActive = activeSkills.has(skillKey);
302
431
  return /* @__PURE__ */ React4.createElement(SearchList.Item, {
303
432
  classNames: "flex items-center overflow-hidden",
304
- key: blueprintKey,
305
- value: blueprintKey,
306
- label: blueprint.name,
433
+ key: skillKey,
434
+ value: skillKey,
435
+ label: skill.name,
307
436
  checked: isActive,
308
- onSelect: () => onUpdateBlueprint?.(blueprintKey, !isActive)
437
+ onSelect: () => onUpdateSkill?.(skillKey, !isActive)
309
438
  });
310
439
  })), /* @__PURE__ */ React4.createElement(SearchList.Input, {
311
440
  placeholder: t("search.placeholder"),
@@ -314,37 +443,42 @@ var BlueprintsPanel = ({ registry, db, context }) => {
314
443
  })));
315
444
  };
316
445
  var ViewPanel = ({ chat }) => {
317
- const { t } = useTranslation4(meta4.id);
318
- const [view, setView] = useObject(chat, "view");
446
+ const { t } = useTranslation4(meta4.profile.key);
447
+ const [view, setView] = useObject(chat, "viewType");
319
448
  const value2 = view ?? "normal";
320
449
  return /* @__PURE__ */ React4.createElement(Listbox.Root, {
321
450
  value: value2,
322
451
  onValueChange: setView,
323
452
  autoFocus: true
324
- }, Assistant.ChatViews.map((view2) => /* @__PURE__ */ React4.createElement(Listbox.Option, {
453
+ }, /* @__PURE__ */ React4.createElement(Listbox.Content, {
454
+ "aria-label": t("chat-view.title")
455
+ }, Assistant.ChatViews.map((view2) => /* @__PURE__ */ React4.createElement(Listbox.Item, {
325
456
  key: view2,
326
- value: view2
327
- }, /* @__PURE__ */ React4.createElement(Listbox.OptionLabel, null, t(`chat-view.${view2}.label`, {
457
+ id: view2,
458
+ classNames: "px-2 py-1 dx-focus-ring rounded-xs"
459
+ }, /* @__PURE__ */ React4.createElement(Listbox.ItemLabel, null, t(`chat-view.${view2}.label`, {
328
460
  defaultValue: view2
329
- })), /* @__PURE__ */ React4.createElement(Listbox.OptionIndicator, null))));
461
+ })), /* @__PURE__ */ React4.createElement(Listbox.Indicator, null)))));
330
462
  };
331
463
  var ModelsPanel = ({ presets, preset, onPresetChange }) => {
464
+ const { t } = useTranslation4(meta4.profile.key);
332
465
  return /* @__PURE__ */ React4.createElement(Listbox.Root, {
333
466
  value: preset,
334
467
  onValueChange: onPresetChange,
335
468
  autoFocus: true
336
- }, presets?.map(({ id, label }) => {
337
- return /* @__PURE__ */ React4.createElement(Listbox.Option, {
338
- key: id,
339
- value: id
340
- }, /* @__PURE__ */ React4.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React4.createElement(Listbox.OptionIndicator, null));
341
- }));
469
+ }, /* @__PURE__ */ React4.createElement(Listbox.Content, {
470
+ "aria-label": t("options.chat-model.title")
471
+ }, presets?.map(({ id, label }) => /* @__PURE__ */ React4.createElement(Listbox.Item, {
472
+ key: id,
473
+ id,
474
+ classNames: "px-2 py-1 dx-focus-ring rounded-xs"
475
+ }, /* @__PURE__ */ React4.createElement(Listbox.ItemLabel, null, label), /* @__PURE__ */ React4.createElement(Listbox.Indicator, null)))));
342
476
  };
343
477
  var McpServersPanel = ({ db }) => {
344
- const { t } = useTranslation4(meta4.id);
478
+ const { t } = useTranslation4(meta4.profile.key);
345
479
  const servers = useQuery2(db, Filter2.type(McpServer.McpServer));
346
- const [adding, setAdding] = useState(false);
347
- const handleAdd = useCallback3((name, url, protocol, apiKey) => {
480
+ const [adding, setAdding] = useState2(false);
481
+ const handleAdd = useCallback4((name, url, protocol, apiKey) => {
348
482
  db.add(Obj2.make(McpServer.McpServer, {
349
483
  name,
350
484
  url,
@@ -356,7 +490,7 @@ var McpServersPanel = ({ db }) => {
356
490
  }, [
357
491
  db
358
492
  ]);
359
- const handleRemove = useCallback3((server) => {
493
+ const handleRemove = useCallback4((server) => {
360
494
  db.remove(server);
361
495
  }, [
362
496
  db
@@ -378,7 +512,7 @@ var McpServersPanel = ({ db }) => {
378
512
  })));
379
513
  };
380
514
  var McpServerRow = ({ server, onRemove }) => {
381
- const { t } = useTranslation4(meta4.id);
515
+ const { t } = useTranslation4(meta4.profile.key);
382
516
  const [enabled, setEnabled] = useObject(server, "enabled");
383
517
  return /* @__PURE__ */ React4.createElement("div", {
384
518
  className: "flex items-center gap-2 px-form-chrome"
@@ -400,13 +534,13 @@ var McpServerRow = ({ server, onRemove }) => {
400
534
  }));
401
535
  };
402
536
  var McpServerForm = ({ onSubmit, onCancel }) => {
403
- const { t } = useTranslation4(meta4.id);
404
- const [name, setName] = useState("");
405
- const [url, setUrl] = useState("");
406
- const [protocol, setProtocol] = useState("sse");
407
- const [apiKey, setApiKey] = useState("");
537
+ const { t } = useTranslation4(meta4.profile.key);
538
+ const [name, setName] = useState2("");
539
+ const [url, setUrl] = useState2("");
540
+ const [protocol, setProtocol] = useState2("sse");
541
+ const [apiKey, setApiKey] = useState2("");
408
542
  const canSubmit = name.trim().length > 0 && url.trim().length > 0;
409
- const handleSubmit = useCallback3(() => {
543
+ const handleSubmit = useCallback4(() => {
410
544
  if (canSubmit) {
411
545
  onSubmit(name.trim(), url.trim(), protocol, apiKey.trim() || void 0);
412
546
  }
@@ -468,7 +602,7 @@ var McpServerForm = ({ onSubmit, onCancel }) => {
468
602
  };
469
603
  var ANY = "__any__";
470
604
  var ObjectsPanel = ({ db, context }) => {
471
- const { t } = useTranslation4(meta4.id);
605
+ const { t } = useTranslation4(meta4.profile.key);
472
606
  const types = useFilteredTypes(db);
473
607
  const typeOptions = useMemo2(() => {
474
608
  const options = types.map((type) => {
@@ -487,7 +621,7 @@ var ObjectsPanel = ({ db, context }) => {
487
621
  types,
488
622
  t
489
623
  ]);
490
- const [selectedUri, setSelectedUri] = useState(ANY);
624
+ const [selectedUri, setSelectedUri] = useState2(ANY);
491
625
  const anyFilter = useMemo2(() => Filter2.or(...typeOptions.map(({ uri }) => Filter2.type(uri))), [
492
626
  typeOptions
493
627
  ]);
@@ -549,23 +683,23 @@ import { Select as Select2 } from "@dxos/react-ui";
549
683
  // src/components/ChatPrompt/ChatPrompt.tsx
550
684
  import { useAtomValue as useAtomValue3 } from "@effect-atom/atom-react";
551
685
  import * as Option2 from "effect/Option";
552
- import React8, { useCallback as useCallback4, useEffect as useEffect2, useRef, useState as useState3 } from "react";
553
- import { useVoiceInput } from "@dxos/plugin-transcription";
554
- import { Input as Input3, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
686
+ import React8, { useCallback as useCallback6, useEffect as useEffect4, useId, useMemo as useMemo4, useRef as useRef2 } from "react";
687
+ import { Input as Input3, useDynamicRef, useTranslation as useTranslation7 } from "@dxos/react-ui";
555
688
  import { ChatEditor } from "@dxos/react-ui-chat";
689
+ import { pendingText } from "@dxos/ui-editor";
556
690
  import { mx as mx5 } from "@dxos/ui-theme";
557
691
  import { useChatKeymapExtensions } from "#hooks";
558
- import { meta as meta6 } from "#meta";
692
+ import { meta as meta7 } from "#meta";
559
693
 
560
694
  // src/components/ChatPrompt/ChatReferences.tsx
561
695
  import React6 from "react";
562
696
  import { Obj as Obj3 } from "@dxos/echo";
563
- import { Icon, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
697
+ import { Icon as Icon2, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation5 } from "@dxos/react-ui";
564
698
  import { getStyles as getStyles2, mx as mx3 } from "@dxos/ui-theme";
565
699
  import { useContextObjects as useContextObjects2 } from "#hooks";
566
700
  import { meta as meta5 } from "#meta";
567
701
  var ChatReferences = ({ classNames, context, db }) => {
568
- const { t } = useTranslation5(meta5.id);
702
+ const { t } = useTranslation5(meta5.profile.key);
569
703
  const { objects, onUpdateObject } = useContextObjects2({
570
704
  db,
571
705
  context
@@ -590,7 +724,7 @@ var ChatReferences = ({ classNames, context, db }) => {
590
724
  key: uri.toString(),
591
725
  className: "dx-tag py-0 flex items-center gap-1",
592
726
  "data-hue": "neutral"
593
- }, /* @__PURE__ */ React6.createElement(Icon, {
727
+ }, /* @__PURE__ */ React6.createElement(Icon2, {
594
728
  icon,
595
729
  size: 4
596
730
  }), toLocalizedString(label, t), /* @__PURE__ */ React6.createElement(IconButton3, {
@@ -607,14 +741,14 @@ var ChatReferences = ({ classNames, context, db }) => {
607
741
  var DEFAULT_OBJECT_ICON = "ph--cube--regular";
608
742
 
609
743
  // src/components/ChatPrompt/ChatStatusIndicator.tsx
610
- import React7, { useEffect, useState as useState2 } from "react";
744
+ import React7, { useEffect as useEffect2, useState as useState3 } from "react";
611
745
  import { Tooltip, useTimeout } from "@dxos/react-ui";
612
746
  import { Spinner } from "@dxos/react-ui-components";
613
747
  import { mx as mx4 } from "@dxos/ui-theme";
614
748
  var period = 3e3;
615
749
  var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
616
- const [init, setInit] = useState2(false);
617
- useEffect(() => setInit(false), [
750
+ const [init, setInit] = useState3(false);
751
+ useEffect2(() => setInit(false), [
618
752
  preset
619
753
  ]);
620
754
  useTimeout(async () => {
@@ -636,46 +770,117 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
636
770
  })));
637
771
  };
638
772
 
773
+ // src/components/ChatPrompt/useChatVoiceInput.ts
774
+ import { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useRef } from "react";
775
+ import { useOptionalAtomCapabilityState as useOptionalAtomCapabilityState2 } from "@dxos/app-framework/ui";
776
+ import { TranscriptionCapabilities as TranscriptionCapabilities2 } from "@dxos/plugin-transcription/types";
777
+ import { useTranslation as useTranslation6 } from "@dxos/react-ui";
778
+ import { useAudioTrack, useTranscriber } from "@dxos/react-ui-transcription";
779
+ import { PendingTextStreamer, cancelPendingText, editorPendingTextSink, pendingTextState } from "@dxos/ui-editor";
780
+ import { meta as meta6 } from "#meta";
781
+ var RECORDER_INTERVAL_MS = 200;
782
+ var useChatVoiceInput = (docId, editorRef) => {
783
+ const { t } = useTranslation6(meta6.profile.key);
784
+ const [session] = useOptionalAtomCapabilityState2(TranscriptionCapabilities2.RecordingSession);
785
+ const [settings] = useOptionalAtomCapabilityState2(TranscriptionCapabilities2.Settings);
786
+ const active = !!session?.recording && session.id === docId;
787
+ const streamerRef = useRef(null);
788
+ useEffect3(() => {
789
+ if (!active) {
790
+ return;
791
+ }
792
+ const view = editorRef.current?.view;
793
+ if (!view) {
794
+ return;
795
+ }
796
+ const streamer = new PendingTextStreamer(editorPendingTextSink(view), {
797
+ mode: settings?.streamMode ?? "word",
798
+ wordIntervalMs: settings?.wordIntervalMs ?? 80
799
+ });
800
+ streamer.start({
801
+ anchor: view.state.selection.main.head,
802
+ placeholder: t("recording.placeholder")
803
+ });
804
+ streamerRef.current = streamer;
805
+ return () => {
806
+ streamer.dispose();
807
+ streamerRef.current = null;
808
+ const currentView = editorRef.current?.view;
809
+ if (currentView) {
810
+ const pending = currentView.state.field(pendingTextState, false);
811
+ if (pending && pending.final.length === 0) {
812
+ currentView.dispatch({
813
+ effects: cancelPendingText.of()
814
+ });
815
+ }
816
+ }
817
+ };
818
+ }, [
819
+ active,
820
+ settings?.streamMode,
821
+ settings?.wordIntervalMs
822
+ ]);
823
+ const handleSegments = useCallback5(async (segments) => {
824
+ const text = segments.map((segment) => segment.text).join(" ").trim();
825
+ if (text.length > 0) {
826
+ streamerRef.current?.push(text);
827
+ }
828
+ }, []);
829
+ const transcriberConfig = useMemo3(() => ({
830
+ transcribeAfterChunksAmount: Math.max(1, Math.round((settings?.transcribeAfterMs ?? 4e3) / RECORDER_INTERVAL_MS))
831
+ }), [
832
+ settings?.transcribeAfterMs
833
+ ]);
834
+ const recorderConfig = useMemo3(() => ({
835
+ interval: RECORDER_INTERVAL_MS
836
+ }), []);
837
+ const audioConstraints = useMemo3(() => settings?.audioDeviceId ? {
838
+ deviceId: {
839
+ exact: settings.audioDeviceId
840
+ }
841
+ } : void 0, [
842
+ settings?.audioDeviceId
843
+ ]);
844
+ const track = useAudioTrack(active, audioConstraints);
845
+ useTranscriber({
846
+ audioStreamTrack: track,
847
+ transcriberConfig,
848
+ recorderConfig,
849
+ onSegments: handleSegments
850
+ });
851
+ };
852
+
639
853
  // src/components/ChatPrompt/ChatPrompt.tsx
640
- var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, placeholder, onOnlineChange, onPresetChange, settings = true, presets, preset }) => {
641
- const { t } = useTranslation6(meta6.id);
854
+ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, placeholder, onPresetChange, settings = true, presets, preset }) => {
855
+ const { t } = useTranslation7(meta7.profile.key);
642
856
  const error = useAtomValue3(processor.error).pipe(Option2.getOrUndefined);
643
857
  const streaming = useAtomValue3(processor.streaming);
644
858
  const active = useAtomValue3(processor.active);
645
859
  const activeRef = useDynamicRef(active);
646
- const editorRef = useRef(null);
647
- const [recordingState, setRecordingState] = useState3(false);
648
- useEffect2(() => {
860
+ const editorRef = useRef2(null);
861
+ useEffect4(() => {
649
862
  return event.on((ev) => {
650
- switch (ev.type) {
651
- case "update-prompt":
652
- if (!editorRef.current?.getText()?.length) {
653
- editorRef.current?.setText(ev.text);
654
- editorRef.current?.focus();
655
- }
656
- break;
657
- case "record-start":
658
- setRecordingState(true);
659
- break;
660
- case "record-stop":
661
- setRecordingState(false);
662
- break;
863
+ if (ev.type === "update-prompt" && !editorRef.current?.getText()?.length) {
864
+ editorRef.current?.setText(ev.text);
865
+ editorRef.current?.focus();
663
866
  }
664
867
  });
665
868
  }, [
666
869
  event
667
870
  ]);
668
- const { recording } = useVoiceInput({
669
- active: recordingState,
670
- onUpdate: (text) => {
671
- editorRef.current?.setText(text);
672
- editorRef.current?.focus();
673
- }
674
- });
675
- const extensions = useChatKeymapExtensions({
871
+ const fallbackDocId = useId();
872
+ const docId = chat?.id ?? fallbackDocId;
873
+ useChatVoiceInput(docId, editorRef);
874
+ const keymapExtensions = useChatKeymapExtensions({
676
875
  event
677
876
  });
678
- const handleSubmit = useCallback4((text) => {
877
+ const extensions = useMemo4(() => [
878
+ keymapExtensions,
879
+ pendingText()
880
+ ], [
881
+ keymapExtensions
882
+ ]);
883
+ const handleSubmit = useCallback6((text) => {
679
884
  if (!activeRef.current) {
680
885
  event.emit({
681
886
  type: "submit",
@@ -686,7 +891,7 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
686
891
  }, [
687
892
  event
688
893
  ]);
689
- const handleEvent = useCallback4((ev) => {
894
+ const handleEvent = useCallback6((ev) => {
690
895
  event.emit(ev);
691
896
  }, [
692
897
  event
@@ -729,7 +934,7 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
729
934
  })), /* @__PURE__ */ React8.createElement(ChatActions, {
730
935
  classNames: "col-span-2",
731
936
  microphone: true,
732
- recording,
937
+ docId,
733
938
  processing: streaming,
734
939
  onEvent: handleEvent
735
940
  }, online !== void 0 && /* @__PURE__ */ React8.createElement(Input3.Root, null, /* @__PURE__ */ React8.createElement(Input3.Label, {
@@ -737,13 +942,13 @@ var ChatPrompt = ({ classNames, outline, db, chat, processor, event, online, pla
737
942
  }, t("online-switch.label")), /* @__PURE__ */ React8.createElement(Input3.Switch, {
738
943
  classNames: "mx-1",
739
944
  checked: online,
740
- onCheckedChange: onOnlineChange
945
+ disabled: true
741
946
  })))));
742
947
  };
743
948
  ChatPrompt.displayName = "Chat.Prompt";
744
949
 
745
950
  // src/components/ChatPrompt/ChatStatus.tsx
746
- import React9, { useEffect as useEffect3, useMemo as useMemo3, useState as useState4 } from "react";
951
+ import React9, { useEffect as useEffect5, useMemo as useMemo5, useState as useState4 } from "react";
747
952
  import { ChatStatus as NaturalChatStatus, formatElapsed } from "@dxos/react-ui-chat";
748
953
  import { Matrix } from "@dxos/react-ui-components";
749
954
  import { Unit } from "@dxos/util";
@@ -751,7 +956,7 @@ var CHAT_STREAM_STATUS_NAME = "Chat.StreamStatus";
751
956
  var TICK_MS = 1e3;
752
957
  var ChatStatus = ({ classNames, icon }) => {
753
958
  const { messages, requestTiming } = useChatContext(CHAT_STREAM_STATUS_NAME);
754
- const { lastOutputTokens, sessionTotalTokens } = useMemo3(() => {
959
+ const { lastOutputTokens, sessionTotalTokens } = useMemo5(() => {
755
960
  let last;
756
961
  let total = 0;
757
962
  for (const message of messages) {
@@ -797,7 +1002,7 @@ var ChatStatus = ({ classNames, icon }) => {
797
1002
  var Elapsed = ({ timing }) => {
798
1003
  const isRunning = timing.endedAt == null;
799
1004
  const [now, setNow] = useState4(Date.now());
800
- useEffect3(() => {
1005
+ useEffect5(() => {
801
1006
  if (!isRunning) {
802
1007
  return;
803
1008
  }
@@ -811,16 +1016,16 @@ var Elapsed = ({ timing }) => {
811
1016
  var isStats = (block) => block._tag === "stats";
812
1017
 
813
1018
  // src/components/ChatThread/ChatThread.tsx
814
- import React14, { forwardRef, useCallback as useCallback6, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef3, useState as useState6 } from "react";
1019
+ import React15, { forwardRef, useCallback as useCallback8, useEffect as useEffect7, useMemo as useMemo8, useRef as useRef4, useState as useState6 } from "react";
815
1020
  import { PublicKey } from "@dxos/keys";
816
1021
  import { setRef } from "@dxos/react-ui";
817
1022
  import { MarkdownStream } from "@dxos/react-ui-markdown";
818
1023
  import { keyToFallback } from "@dxos/util";
819
1024
 
820
1025
  // src/components/ChatThread/registry.tsx
821
- import React13 from "react";
822
- import { log } from "@dxos/log";
823
- import { getXmlTextChild } from "@dxos/ui-editor";
1026
+ import React14 from "react";
1027
+ import { log as log2 } from "@dxos/log";
1028
+ import { AnchorWidget, getXmlTextChild as getXmlTextChild2 } from "@dxos/ui-editor";
824
1029
 
825
1030
  // src/components/ChatThread/tool-widget-state.ts
826
1031
  var applyToolBlockToWidgetState = (context, block) => {
@@ -1049,11 +1254,11 @@ var StatusWidget = class extends WidgetType5 {
1049
1254
 
1050
1255
  // src/components/ChatThread/widgets/SummaryWidget.tsx
1051
1256
  import React11 from "react";
1052
- import { useTranslation as useTranslation7 } from "@dxos/react-ui";
1257
+ import { useTranslation as useTranslation8 } from "@dxos/react-ui";
1053
1258
  import { TogglePanel as TogglePanel2 } from "@dxos/react-ui-components";
1054
- import { meta as meta7 } from "#meta";
1259
+ import { meta as meta8 } from "#meta";
1055
1260
  var SummaryWidget = ({ children }) => {
1056
- const { t } = useTranslation7(meta7.id);
1261
+ const { t } = useTranslation8(meta8.profile.key);
1057
1262
  return /* @__PURE__ */ React11.createElement(TogglePanel2.Root, null, /* @__PURE__ */ React11.createElement(TogglePanel2.Content, {
1058
1263
  classNames: styles2.border
1059
1264
  }, /* @__PURE__ */ React11.createElement(TogglePanel2.Header, {
@@ -1063,6 +1268,45 @@ var SummaryWidget = ({ children }) => {
1063
1268
  }, children))));
1064
1269
  };
1065
1270
 
1271
+ // src/components/ChatThread/widgets/SurfaceWidget.tsx
1272
+ import React12, { useMemo as useMemo6 } from "react";
1273
+ import { Surface } from "@dxos/app-framework/ui";
1274
+ import { log } from "@dxos/log";
1275
+ import { getXmlTextChild } from "@dxos/ui-editor";
1276
+ import { ChatSurface } from "#types";
1277
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/widgets/SurfaceWidget.tsx";
1278
+ var SurfaceWidget = ({ role, children }) => {
1279
+ const data = useMemo6(() => {
1280
+ const raw = getXmlTextChild(children ?? []);
1281
+ if (!raw) {
1282
+ return void 0;
1283
+ }
1284
+ try {
1285
+ const parsed = JSON.parse(raw);
1286
+ return parsed != null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
1287
+ } catch (err) {
1288
+ log.warn("failed to parse surface data", {
1289
+ raw,
1290
+ err
1291
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 24, S: void 0 });
1292
+ return void 0;
1293
+ }
1294
+ }, [
1295
+ children
1296
+ ]);
1297
+ if (!role) {
1298
+ return null;
1299
+ }
1300
+ return /* @__PURE__ */ React12.createElement(Surface.Surface, {
1301
+ type: ChatSurface,
1302
+ data: {
1303
+ role,
1304
+ data
1305
+ },
1306
+ limit: 1
1307
+ });
1308
+ };
1309
+
1066
1310
  // src/components/ChatThread/widgets/SuggestionWidget.ts
1067
1311
  import { WidgetType as WidgetType6 } from "@codemirror/view";
1068
1312
  import { Domino as Domino6, mx as mx6 } from "@dxos/ui";
@@ -1086,15 +1330,15 @@ var SuggestionWidget = class extends WidgetType6 {
1086
1330
  };
1087
1331
 
1088
1332
  // src/components/ChatThread/widgets/ToolWidget.tsx
1089
- import React12, { useCallback as useCallback5, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef2, useState as useState5 } from "react";
1090
- import { Icon as Icon2, useTranslation as useTranslation8 } from "@dxos/react-ui";
1333
+ import React13, { useCallback as useCallback7, useEffect as useEffect6, useMemo as useMemo7, useRef as useRef3, useState as useState5 } from "react";
1334
+ import { Icon as Icon3, useTranslation as useTranslation9 } from "@dxos/react-ui";
1091
1335
  import { NumericTabs, TextCrawl, TogglePanel as TogglePanel3 } from "@dxos/react-ui-components";
1092
1336
  import { JsonHighlighter as JsonHighlighter2 } from "@dxos/react-ui-syntax-highlighter";
1093
1337
  import { isNonNullable, safeParseJson } from "@dxos/util";
1094
- import { meta as meta8 } from "#meta";
1338
+ import { meta as meta9 } from "#meta";
1095
1339
  var ToolWidget = ({ view, blocks = [] }) => {
1096
- const { t } = useTranslation8(meta8.id);
1097
- const items = useMemo4(() => {
1340
+ const { t } = useTranslation9(meta9.profile.key);
1341
+ const items = useMemo7(() => {
1098
1342
  let lastToolCall;
1099
1343
  const tools = [];
1100
1344
  return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
@@ -1159,7 +1403,7 @@ var ToolWidget = ({ view, blocks = [] }) => {
1159
1403
  blocks,
1160
1404
  t
1161
1405
  ]);
1162
- const handleChangeOpen = useCallback5(() => {
1406
+ const handleChangeOpen = useCallback7(() => {
1163
1407
  setTimeout(() => {
1164
1408
  view?.requestMeasure();
1165
1409
  }, 1e3);
@@ -1169,22 +1413,22 @@ var ToolWidget = ({ view, blocks = [] }) => {
1169
1413
  if (!items.length) {
1170
1414
  return null;
1171
1415
  }
1172
- return /* @__PURE__ */ React12.createElement(ToolPanel, {
1416
+ return /* @__PURE__ */ React13.createElement(ToolPanel, {
1173
1417
  items,
1174
1418
  onChangeOpen: handleChangeOpen
1175
1419
  });
1176
1420
  };
1177
1421
  var DEFAULT_TOOL_ICON = "ph--wrench--regular";
1178
1422
  var ToolPanel = ({ items, onChangeOpen }) => {
1179
- const tabsRef = useRef2(null);
1423
+ const tabsRef = useRef3(null);
1180
1424
  const [selected, setSelected] = useState5(0);
1181
1425
  const [open, setOpen] = useState5(false);
1182
- useEffect4(() => {
1426
+ useEffect6(() => {
1183
1427
  setSelected((prev) => Math.min(prev, Math.max(0, items.length - 1)));
1184
1428
  }, [
1185
1429
  items.length
1186
1430
  ]);
1187
- useEffect4(() => {
1431
+ useEffect6(() => {
1188
1432
  onChangeOpen?.(open);
1189
1433
  if (open) {
1190
1434
  tabsRef.current?.focus();
@@ -1193,33 +1437,33 @@ var ToolPanel = ({ items, onChangeOpen }) => {
1193
1437
  open,
1194
1438
  onChangeOpen
1195
1439
  ]);
1196
- const handleSelect = useCallback5((index) => {
1440
+ const handleSelect = useCallback7((index) => {
1197
1441
  setSelected(index);
1198
1442
  }, []);
1199
1443
  const headerIcon = items[items.length - 1]?.icon ?? items[0]?.icon ?? DEFAULT_TOOL_ICON;
1200
- return /* @__PURE__ */ React12.createElement(TogglePanel3.Root, {
1444
+ return /* @__PURE__ */ React13.createElement(TogglePanel3.Root, {
1201
1445
  open,
1202
1446
  onChangeOpen: setOpen
1203
- }, /* @__PURE__ */ React12.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React12.createElement(TogglePanel3.Header, {
1447
+ }, /* @__PURE__ */ React13.createElement(TogglePanel3.Content, null, /* @__PURE__ */ React13.createElement(TogglePanel3.Header, {
1204
1448
  classNames: "flex items-center gap-2 text-sm text-placeholder"
1205
- }, /* @__PURE__ */ React12.createElement(Icon2, {
1449
+ }, /* @__PURE__ */ React13.createElement(Icon3, {
1206
1450
  icon: headerIcon,
1207
1451
  size: 4,
1208
1452
  classNames: "shrink-0 opacity-70"
1209
- }), /* @__PURE__ */ React12.createElement(TextCrawl, {
1453
+ }), /* @__PURE__ */ React13.createElement(TextCrawl, {
1210
1454
  key: "status-roll",
1211
1455
  lines: items.map((item) => item.title),
1212
1456
  autoAdvance: true,
1213
1457
  greedy: true
1214
- })), /* @__PURE__ */ React12.createElement(TogglePanel3.Body, null, /* @__PURE__ */ React12.createElement(TogglePanel3.Viewport, {
1458
+ })), /* @__PURE__ */ React13.createElement(TogglePanel3.Body, null, /* @__PURE__ */ React13.createElement(TogglePanel3.Viewport, {
1215
1459
  classNames: "grid grid-cols-[32px_1fr]"
1216
- }, /* @__PURE__ */ React12.createElement(NumericTabs, {
1460
+ }, /* @__PURE__ */ React13.createElement(NumericTabs, {
1217
1461
  ref: tabsRef,
1218
1462
  classNames: "p-1",
1219
1463
  length: items.length,
1220
1464
  selected,
1221
1465
  onSelect: handleSelect
1222
- }), /* @__PURE__ */ React12.createElement(JsonHighlighter2, {
1466
+ }), /* @__PURE__ */ React13.createElement(JsonHighlighter2, {
1223
1467
  data: items[selected]?.content,
1224
1468
  classNames: "p-1 text-xs bg-transparent",
1225
1469
  replacer: {
@@ -1231,93 +1475,105 @@ var ToolPanel = ({ items, onChangeOpen }) => {
1231
1475
  };
1232
1476
 
1233
1477
  // src/components/ChatThread/registry.tsx
1234
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
1478
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
1235
1479
  var componentRegistry = {
1236
1480
  //
1237
1481
  // Block-only (no widget — see note above).
1238
1482
  //
1239
- prompt: {
1483
+ "prompt": {
1240
1484
  block: true
1241
1485
  },
1242
1486
  //
1243
1487
  // DOM Widgets
1244
1488
  //
1245
- synthetic: {
1489
+ "link-preview": {
1490
+ block: false,
1491
+ urlSchemes: [
1492
+ "dxn:",
1493
+ "echo:"
1494
+ ],
1495
+ factory: ({ label, dxn }) => typeof label === "string" && typeof dxn === "string" ? new AnchorWidget(label, dxn) : null
1496
+ },
1497
+ "synthetic": {
1246
1498
  block: true,
1247
1499
  factory: ({ children, range }) => {
1248
- const text = getXmlTextChild(children);
1500
+ const text = getXmlTextChild2(children);
1249
1501
  return text ? new ReasoningWidget(text, range.from) : null;
1250
1502
  }
1251
1503
  },
1252
- reasoning: {
1504
+ "reasoning": {
1253
1505
  block: true,
1254
1506
  streaming: true,
1255
1507
  factory: ({ children, range }) => {
1256
- const text = getXmlTextChild(children);
1508
+ const text = getXmlTextChild2(children);
1257
1509
  return text ? new ReasoningWidget(text, range.from) : null;
1258
1510
  }
1259
1511
  },
1260
- reference: {
1512
+ "reference": {
1261
1513
  block: false,
1262
1514
  factory: ({ children, ref }) => {
1263
- const text = getXmlTextChild(children);
1515
+ const text = getXmlTextChild2(children);
1264
1516
  return text && ref ? new ReferenceWidget(text, ref) : null;
1265
1517
  }
1266
1518
  },
1267
- select: {
1519
+ "select": {
1268
1520
  block: true,
1269
1521
  factory: ({ children }) => {
1270
- const options = children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
1522
+ const options = children?.map((option) => option._tag === "option" && getXmlTextChild2(option.children)).filter(Boolean);
1271
1523
  return options?.length ? new SelectWidget(options) : null;
1272
1524
  }
1273
1525
  },
1274
- suggestion: {
1526
+ "suggestion": {
1275
1527
  block: true,
1276
1528
  factory: ({ children }) => {
1277
- const text = getXmlTextChild(children);
1529
+ const text = getXmlTextChild2(children);
1278
1530
  return text ? new SuggestionWidget(text) : null;
1279
1531
  }
1280
1532
  },
1281
- stats: {
1533
+ "stats": {
1282
1534
  block: true,
1283
1535
  factory: ({ children }) => {
1284
- const text = getXmlTextChild(children);
1536
+ const text = getXmlTextChild2(children);
1285
1537
  return text ? new StatsWidget(text) : null;
1286
1538
  }
1287
1539
  },
1288
- status: {
1540
+ "status": {
1289
1541
  block: true,
1290
1542
  streaming: true,
1291
1543
  factory: ({ children }) => {
1292
- const text = getXmlTextChild(children);
1544
+ const text = getXmlTextChild2(children);
1293
1545
  return text ? new StatusWidget(text) : null;
1294
1546
  }
1295
1547
  },
1296
1548
  //
1297
1549
  // React Widgets (portaled outside of the editor)
1298
1550
  //
1299
- summary: {
1551
+ "summary": {
1300
1552
  block: true,
1301
1553
  Component: SummaryWidget
1302
1554
  },
1303
- toolCall: {
1555
+ "surface": {
1556
+ block: true,
1557
+ Component: SurfaceWidget
1558
+ },
1559
+ "toolCall": {
1304
1560
  block: true,
1305
- Component: (props) => /* @__PURE__ */ React13.createElement("div", {
1561
+ Component: (props) => /* @__PURE__ */ React14.createElement("div", {
1306
1562
  className: "py-2"
1307
- }, /* @__PURE__ */ React13.createElement(ToolWidget, props))
1563
+ }, /* @__PURE__ */ React14.createElement(ToolWidget, props))
1308
1564
  },
1309
- toolResult: {
1565
+ "toolResult": {
1310
1566
  block: true,
1311
1567
  Component: FallbackWidget
1312
1568
  },
1313
- toolkit: {
1569
+ "toolkit": {
1314
1570
  block: true,
1315
1571
  Component: FallbackWidget
1316
1572
  },
1317
1573
  //
1318
1574
  // Fallback
1319
1575
  //
1320
- json: {
1576
+ "json": {
1321
1577
  block: true,
1322
1578
  Component: FallbackWidget
1323
1579
  }
@@ -1349,9 +1605,9 @@ var isBlockVisible = (viewType, message, block) => {
1349
1605
  }
1350
1606
  };
1351
1607
  var blockToMarkdownImpl = (context, message, block) => {
1352
- log("blockToMarkdown", {
1608
+ log2("blockToMarkdown", {
1353
1609
  block: JSON.stringify(block)
1354
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 154, S: void 0 });
1610
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 166, S: void 0 });
1355
1611
  switch (block._tag) {
1356
1612
  case "text": {
1357
1613
  if (message.sender.role === "user") {
@@ -1424,6 +1680,15 @@ var blockToMarkdownImpl = (context, message, block) => {
1424
1680
  pending: block.pending
1425
1681
  });
1426
1682
  }
1683
+ case "surface": {
1684
+ if (block.pending) {
1685
+ return;
1686
+ }
1687
+ return renderXMLBlock("surface", {
1688
+ content: JSON.stringify(block.data ?? {}),
1689
+ attributes: `role="${escapeXmlAttribute(block.role)}"`
1690
+ });
1691
+ }
1427
1692
  default: {
1428
1693
  return `<json id="${message.id}">
1429
1694
  ${JSON.stringify(block)}
@@ -1432,6 +1697,7 @@ ${JSON.stringify(block)}
1432
1697
  }
1433
1698
  };
1434
1699
  var escapeXmlTextContent = (raw) => raw.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1700
+ var escapeXmlAttribute = (raw) => escapeXmlTextContent(raw).replace(/"/g, "&quot;");
1435
1701
  var renderXMLBlock = (tag, opts) => {
1436
1702
  const content = escapeXmlTextContent((opts.content ?? "").replace(/\n\n/g, " ").trim());
1437
1703
  if (opts.pending) {
@@ -1541,17 +1807,17 @@ var defaultOptions = {
1541
1807
  };
1542
1808
  var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, options = defaultOptions, footer, debug = false, extensions, viewType, onEvent }, forwardedRef) => {
1543
1809
  const [controller, setController] = useState6(null);
1544
- const handleMarkdownStreamRef = useCallback6((instance) => {
1810
+ const handleMarkdownStreamRef = useCallback8((instance) => {
1545
1811
  setController(instance);
1546
1812
  setRef(forwardedRef, instance);
1547
1813
  }, [
1548
1814
  forwardedRef
1549
1815
  ]);
1550
- const userHue = useMemo5(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
1816
+ const userHue = useMemo8(() => identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue, [
1551
1817
  identity
1552
1818
  ]);
1553
- const initializedRef = useRef3(false);
1554
- useEffect5(() => {
1819
+ const initializedRef = useRef4(false);
1820
+ useEffect7(() => {
1555
1821
  if (!controller) {
1556
1822
  initializedRef.current = false;
1557
1823
  return;
@@ -1562,14 +1828,14 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1562
1828
  controller,
1563
1829
  error
1564
1830
  ]);
1565
- const renderer = useMemo5(() => createBlockRenderer(viewType), [
1831
+ const renderer = useMemo8(() => createBlockRenderer(viewType), [
1566
1832
  viewType
1567
1833
  ]);
1568
- const syncer = useMemo5(() => controller && new MessageSyncer(controller, renderer), [
1834
+ const syncer = useMemo8(() => controller && new MessageSyncer(controller, renderer), [
1569
1835
  controller,
1570
1836
  renderer
1571
1837
  ]);
1572
- useEffect5(() => {
1838
+ useEffect7(() => {
1573
1839
  if (!syncer) {
1574
1840
  return;
1575
1841
  }
@@ -1581,7 +1847,7 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1581
1847
  syncer,
1582
1848
  messages
1583
1849
  ]);
1584
- const handleEvent = useCallback6(({ type, value: value2 }) => {
1850
+ const handleEvent = useCallback8(({ type, value: value2 }) => {
1585
1851
  switch (type) {
1586
1852
  case "submit": {
1587
1853
  value2 && onEvent?.({
@@ -1594,10 +1860,10 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1594
1860
  }, [
1595
1861
  onEvent
1596
1862
  ]);
1597
- return /* @__PURE__ */ React14.createElement("div", {
1863
+ return /* @__PURE__ */ React15.createElement("div", {
1598
1864
  "data-hue": userHue,
1599
1865
  className: "contents"
1600
- }, /* @__PURE__ */ React14.createElement(MarkdownStream, {
1866
+ }, /* @__PURE__ */ React15.createElement(MarkdownStream, {
1601
1867
  key: viewType,
1602
1868
  classNames,
1603
1869
  registry: componentRegistry,
@@ -1611,54 +1877,142 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1611
1877
  });
1612
1878
 
1613
1879
  // src/components/TaskList/TaskList.tsx
1614
- import React15 from "react";
1880
+ import React16, { useMemo as useMemo9 } from "react";
1881
+ import { Plan } from "@dxos/assistant-toolkit";
1615
1882
  import { useObject as useObject2 } from "@dxos/react-client/echo";
1616
- import { Icon as Icon3, Tag } from "@dxos/react-ui";
1883
+ import { Icon as Icon4, Tag } from "@dxos/react-ui";
1617
1884
  import { composable, composableProps } from "@dxos/react-ui";
1618
- import { Row, RowList } from "@dxos/react-ui-list";
1619
- var TaskList = composable(({ plan, ...props }, forwardedRef) => {
1885
+ import { TextCrawl as TextCrawl2 } from "@dxos/react-ui-components";
1886
+ import { Listbox as Listbox2 } from "@dxos/react-ui-list";
1887
+ import { collectProcessActivityLines, deriveInFlightActivityLine } from "#execution-graph";
1888
+ import { isTerminalActivityLine, useProcessEphemeralStatus } from "#hooks";
1889
+ var TaskList = composable(({ plan, space, conversationId, traceMessages, ...props }, forwardedRef) => {
1620
1890
  const [snapshot] = useObject2(plan);
1621
1891
  const tasks = snapshot?.tasks ?? [];
1622
- return /* @__PURE__ */ React15.createElement(RowList.Root, null, /* @__PURE__ */ React15.createElement(RowList.Viewport, {
1892
+ return /* @__PURE__ */ React16.createElement(Listbox2.Root, null, /* @__PURE__ */ React16.createElement(Listbox2.Viewport, {
1623
1893
  ...composableProps(props, {
1624
1894
  classNames: "dx-container"
1625
1895
  }),
1626
1896
  ref: forwardedRef
1627
- }, /* @__PURE__ */ React15.createElement(RowList.Content, {
1897
+ }, /* @__PURE__ */ React16.createElement(Listbox2.Content, {
1628
1898
  "aria-label": "Tasks"
1629
- }, tasks.map((task) => /* @__PURE__ */ React15.createElement(Row, {
1899
+ }, tasks.map((task) => /* @__PURE__ */ React16.createElement(TaskListItem, {
1630
1900
  key: task.id,
1901
+ task,
1902
+ space,
1903
+ traceMessages,
1904
+ conversationId
1905
+ })))));
1906
+ });
1907
+ var TaskListItem = ({ task, space, traceMessages, conversationId }) => {
1908
+ const durableLines = useMemo9(() => {
1909
+ if (!task.agentPid || !traceMessages?.length) {
1910
+ return [];
1911
+ }
1912
+ const lines = collectProcessActivityLines(traceMessages, String(task.agentPid), {
1913
+ conversationId
1914
+ });
1915
+ if (task.status !== "in-progress") {
1916
+ return lines;
1917
+ }
1918
+ return lines.filter((line) => !isTerminalActivityLine(line));
1919
+ }, [
1920
+ task.agentPid,
1921
+ task.status,
1922
+ traceMessages,
1923
+ conversationId
1924
+ ]);
1925
+ const ephemeralLine = useProcessEphemeralStatus(task.delegated === true && task.status === "in-progress" ? task.agentPid : void 0, space);
1926
+ const inFlightLine = useMemo9(() => {
1927
+ if (ephemeralLine || task.status !== "in-progress" || !task.agentPid || !traceMessages?.length) {
1928
+ return void 0;
1929
+ }
1930
+ return deriveInFlightActivityLine(traceMessages, String(task.agentPid), {
1931
+ conversationId
1932
+ });
1933
+ }, [
1934
+ ephemeralLine,
1935
+ task.status,
1936
+ task.agentPid,
1937
+ traceMessages,
1938
+ conversationId
1939
+ ]);
1940
+ const activityLines = useMemo9(() => {
1941
+ if (ephemeralLine) {
1942
+ return [
1943
+ ephemeralLine
1944
+ ];
1945
+ }
1946
+ if (inFlightLine) {
1947
+ return [
1948
+ inFlightLine
1949
+ ];
1950
+ }
1951
+ return durableLines;
1952
+ }, [
1953
+ durableLines,
1954
+ ephemeralLine,
1955
+ inFlightLine
1956
+ ]);
1957
+ const agentPid = task.agentPid;
1958
+ const showActivity = task.delegated === true && agentPid != null && activityLines.length > 0;
1959
+ return /* @__PURE__ */ React16.createElement(Listbox2.Item, {
1631
1960
  id: task.id,
1632
1961
  classNames: "py-0"
1633
- }, /* @__PURE__ */ React15.createElement("div", {
1634
- className: "flex items-center gap-2"
1635
- }, /* @__PURE__ */ React15.createElement(Icon3, {
1962
+ }, /* @__PURE__ */ React16.createElement("div", {
1963
+ className: "flex flex-col gap-0.5 min-w-0"
1964
+ }, /* @__PURE__ */ React16.createElement("div", {
1965
+ className: "flex items-center gap-2 min-w-0"
1966
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1636
1967
  icon: task.status === "done" ? "ph--check--regular" : "ph--circle--regular",
1637
1968
  classNames: task.status === "done" ? "text-success-text" : void 0,
1638
1969
  size: 4
1639
- }), /* @__PURE__ */ React15.createElement("span", {
1970
+ }), /* @__PURE__ */ React16.createElement("span", {
1640
1971
  className: "sr-only"
1641
- }, task.status === "done" ? "done" : task.status === "in-progress" ? "in progress" : "to do"), /* @__PURE__ */ React15.createElement("span", {
1972
+ }, task.status === "done" ? "done" : task.status === "in-progress" ? "in progress" : "to do"), /* @__PURE__ */ React16.createElement("span", {
1642
1973
  className: "truncate flex-1"
1643
- }, task.title), task.status === "in-progress" && /* @__PURE__ */ React15.createElement(Tag, {
1644
- palette: "info"
1645
- }, "pending")))))));
1646
- });
1974
+ }, task.title), task.status === "in-progress" && /* @__PURE__ */ React16.createElement(Tag, {
1975
+ hue: "info"
1976
+ }, "pending"), task.agentPid && /* @__PURE__ */ React16.createElement(Tag, {
1977
+ hue: "info"
1978
+ }, Plan.formatAgentPidTag(task.agentPid))), showActivity && agentPid != null && /* @__PURE__ */ React16.createElement(DelegatedTaskActivity, {
1979
+ agentPid,
1980
+ lines: activityLines
1981
+ })));
1982
+ };
1983
+ var DelegatedTaskActivity = ({ agentPid, lines }) => {
1984
+ return /* @__PURE__ */ React16.createElement("div", {
1985
+ className: "flex items-center gap-2 ps-6 min-w-0 text-placeholder"
1986
+ }, /* @__PURE__ */ React16.createElement(Icon4, {
1987
+ icon: "ph--brain--regular",
1988
+ size: 3,
1989
+ classNames: "shrink-0 opacity-70"
1990
+ }), /* @__PURE__ */ React16.createElement(TextCrawl2, {
1991
+ key: `${String(agentPid)}:${lines.length}:${lines[lines.length - 1]}`,
1992
+ lines,
1993
+ autoAdvance: true,
1994
+ greedy: true,
1995
+ size: "sm",
1996
+ classNames: "text-xs text-subdued min-w-0 flex-1"
1997
+ }));
1998
+ };
1647
1999
 
1648
2000
  // src/components/Chat/Chat.tsx
1649
- var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSubmit, ...props }) => {
2001
+ var ChatRoot = ({ children, chat, processor, db: dbFallback, onEvent, onSubmit, ...props }) => {
1650
2002
  const [debug, setDebug] = useState7(false);
1651
2003
  const streaming = useAtomValue4(processor.streaming);
1652
2004
  const active = useAtomValue4(processor.active);
1653
2005
  const requestTiming = useRequestTiming({
1654
2006
  active
1655
2007
  });
1656
- const lastPrompt = useRef4(void 0);
2008
+ const lastPrompt = useRef5(void 0);
1657
2009
  const db = chat && Obj4.getDatabase(chat) || dbFallback;
1658
- const event = useMemo6(() => new Event(), []);
2010
+ const [feedSnapshot] = useObject3(chat?.feed);
2011
+ const feed = Obj4.getReactiveOrUndefined(feedSnapshot);
2012
+ const event = useMemo10(() => new Event(), []);
1659
2013
  const feedMessages = useQuery3(db, feed ? Query.select(Filter3.type(Message2.Message)).from(feed) : Query.select(Filter3.nothing()));
1660
2014
  const pendingMessages = useAtomValue4(processor.messages);
1661
- const messages = useMemo6(() => Array.dedupeWith([
2015
+ const messages = useMemo10(() => Array2.dedupeWith([
1662
2016
  ...feedMessages,
1663
2017
  ...pendingMessages
1664
2018
  ], ({ id: a }, { id: b }) => a === b), [
@@ -1669,7 +2023,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
1669
2023
  processor
1670
2024
  });
1671
2025
  const error = useAtomValue4(processor.error);
1672
- useEffect6(() => {
2026
+ useEffect8(() => {
1673
2027
  if (Option3.isSome(error)) {
1674
2028
  event.emit({
1675
2029
  type: "error",
@@ -1680,7 +2034,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
1680
2034
  event,
1681
2035
  error
1682
2036
  ]);
1683
- useEffect6(() => {
2037
+ useEffect8(() => {
1684
2038
  return event.on((ev) => {
1685
2039
  switch (ev.type) {
1686
2040
  case "toggle-debug": {
@@ -1733,7 +2087,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
1733
2087
  onEvent,
1734
2088
  onSubmit
1735
2089
  ]);
1736
- return /* @__PURE__ */ React16.createElement(ChatContextProvider, {
2090
+ return /* @__PURE__ */ React17.createElement(ChatContextProvider, {
1737
2091
  debug,
1738
2092
  event,
1739
2093
  db,
@@ -1747,7 +2101,7 @@ var ChatRoot = ({ children, chat, feed, processor, db: dbFallback, onEvent, onSu
1747
2101
  ChatRoot.displayName = "Chat.Root";
1748
2102
  var useRequestTiming = ({ active }) => {
1749
2103
  const [requestTiming, setRequestTiming] = useState7(null);
1750
- useEffect6(() => {
2104
+ useEffect8(() => {
1751
2105
  if (active) {
1752
2106
  setRequestTiming({
1753
2107
  startedAt: Date.now(),
@@ -1771,11 +2125,11 @@ var ChatToolbar = composable2(({ children, attendableId, alwaysActive, companion
1771
2125
  chat,
1772
2126
  companionTo
1773
2127
  });
1774
- return /* @__PURE__ */ React16.createElement(Menu.Root, {
2128
+ return /* @__PURE__ */ React17.createElement(Menu.Root, {
1775
2129
  ...menuActions,
1776
2130
  attendableId,
1777
2131
  alwaysActive
1778
- }, /* @__PURE__ */ React16.createElement(Menu.Toolbar, {
2132
+ }, /* @__PURE__ */ React17.createElement(Menu.Toolbar, {
1779
2133
  ...composableProps2(props),
1780
2134
  ref: forwardedRef
1781
2135
  }, children));
@@ -1783,7 +2137,7 @@ var ChatToolbar = composable2(({ children, attendableId, alwaysActive, companion
1783
2137
  ChatToolbar.displayName = CHAT_TOOLBAR_NAME;
1784
2138
  var CHAT_CONTENT_NAME = "Chat.Content";
1785
2139
  var ChatContent = composable2(({ children, ...props }, forwardedRef) => {
1786
- return /* @__PURE__ */ React16.createElement("div", {
2140
+ return /* @__PURE__ */ React17.createElement("div", {
1787
2141
  ...composableProps2(props, {
1788
2142
  classNames: "dx-expander flex flex-col"
1789
2143
  }),
@@ -1792,8 +2146,8 @@ var ChatContent = composable2(({ children, ...props }, forwardedRef) => {
1792
2146
  });
1793
2147
  ChatContent.displayName = CHAT_CONTENT_NAME;
1794
2148
  var CHAT_THREAD_NAME = "Chat.Thread";
1795
- var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
1796
- const { t } = useTranslation9(meta9.id);
2149
+ var ChatThread2 = ({ viewType, debug: debugProp, onViewUsage, ...props }) => {
2150
+ const { t } = useTranslation10(meta10.profile.key);
1797
2151
  const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
1798
2152
  const extensions = useChatKeymapExtensions2({
1799
2153
  event
@@ -1801,9 +2155,10 @@ var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
1801
2155
  const identity = useIdentity();
1802
2156
  const error = useAtomValue4(processor.error).pipe(Option3.getOrUndefined);
1803
2157
  const [toastError, setToastError] = useState7(void 0);
2158
+ const toastAction = toastError instanceof AiUsageQuotaError ? toastError.action : void 0;
1804
2159
  const debugView = viewType === "debug";
1805
- const controllerRef = useRef4(null);
1806
- useEffect6(() => {
2160
+ const controllerRef = useRef5(null);
2161
+ useEffect8(() => {
1807
2162
  return event.on((event2) => {
1808
2163
  switch (event2.type) {
1809
2164
  case "submit":
@@ -1824,17 +2179,17 @@ var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
1824
2179
  }, [
1825
2180
  event
1826
2181
  ]);
1827
- const handleEvent = useCallback7((ev) => {
2182
+ const handleEvent = useCallback9((ev) => {
1828
2183
  event.emit(ev);
1829
2184
  }, [
1830
2185
  event
1831
2186
  ]);
1832
2187
  if (!identity) {
1833
- return /* @__PURE__ */ React16.createElement("div", {
2188
+ return /* @__PURE__ */ React17.createElement("div", {
1834
2189
  className: "dx-expander"
1835
2190
  });
1836
2191
  }
1837
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(ChatThread, {
2192
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(ChatThread, {
1838
2193
  ...props,
1839
2194
  identity,
1840
2195
  messages,
@@ -1844,21 +2199,29 @@ var ChatThread2 = ({ viewType, debug: debugProp, ...props }) => {
1844
2199
  extensions,
1845
2200
  onEvent: handleEvent,
1846
2201
  ref: controllerRef
1847
- }), /* @__PURE__ */ React16.createElement(Toast.Root, {
2202
+ }), /* @__PURE__ */ React17.createElement(Toast.Root, {
1848
2203
  type: "foreground",
1849
2204
  open: !!toastError,
1850
2205
  duration: 2e4,
1851
2206
  onOpenChange: (open) => !open && setToastError(void 0)
1852
- }, /* @__PURE__ */ React16.createElement(Toast.Title, {
2207
+ }, /* @__PURE__ */ React17.createElement(Toast.Title, {
1853
2208
  icon: "ph--warning--regular",
1854
2209
  onClose: () => setToastError(void 0)
1855
- }, t("ai-service-error.label")), /* @__PURE__ */ React16.createElement(Toast.Description, null, toastError?.message)));
2210
+ }, t("ai-service-error.label")), /* @__PURE__ */ React17.createElement(Toast.Description, null, toastError?.message), toastAction && onViewUsage && /* @__PURE__ */ React17.createElement(Toast.Actions, null, /* @__PURE__ */ React17.createElement(Toast.Action, {
2211
+ altText: t(toastAction.labelKey),
2212
+ asChild: true
2213
+ }, /* @__PURE__ */ React17.createElement(Button, {
2214
+ onClick: () => {
2215
+ setToastError(void 0);
2216
+ onViewUsage();
2217
+ }
2218
+ }, t(toastAction.labelKey))))));
1856
2219
  };
1857
2220
  ChatThread2.displayName = CHAT_THREAD_NAME;
1858
2221
  var CHAT_PROMPT_NAME = "Chat.Prompt";
1859
2222
  var ChatPrompt2 = (props) => {
1860
2223
  const { chat, db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
1861
- return /* @__PURE__ */ React16.createElement(ChatPrompt, {
2224
+ return /* @__PURE__ */ React17.createElement(ChatPrompt, {
1862
2225
  ...props,
1863
2226
  chat,
1864
2227
  db,
@@ -1870,15 +2233,22 @@ ChatPrompt2.displayName = CHAT_PROMPT_NAME;
1870
2233
  var CHAT_TASK_LIST_NAME = "Chat.TaskList";
1871
2234
  var ChatTaskList = composable2(({ plan: planProp, ...props }, forwardedRef) => {
1872
2235
  const { chat } = useChatContext(CHAT_TASK_LIST_NAME);
1873
- const parent = chat ? Obj4.getParent(chat) : void 0;
1874
- const agent = parent && Obj4.instanceOf(Agent.Agent, parent) ? parent : void 0;
1875
- const plan = planProp ?? agent?.plan.target;
1876
- if (!plan) {
2236
+ const plan = useAtomValue4(useMemo10(() => Atom2.make((get) => planProp ?? Option3.fromNullable(chat).pipe(Option3.map((_) => get(Obj4.atom(_))), Option3.flatMapNullable((_) => _?.plan?.atom), Option3.map(get), Option3.getOrUndefined)), [
2237
+ chat,
2238
+ planProp
2239
+ ]));
2240
+ const space = chat ? getSpace(chat) : void 0;
2241
+ const traceMessages = useTraceMessages(space);
2242
+ const conversationId = chat?.feed?.target?.id;
2243
+ if (!plan || !(plan.tasks?.length ?? 0)) {
1877
2244
  return null;
1878
2245
  }
1879
- return /* @__PURE__ */ React16.createElement(TaskList, {
2246
+ return /* @__PURE__ */ React17.createElement(TaskList, {
1880
2247
  ...props,
1881
2248
  plan,
2249
+ space,
2250
+ traceMessages,
2251
+ conversationId,
1882
2252
  ref: forwardedRef
1883
2253
  });
1884
2254
  });
@@ -1896,14 +2266,90 @@ var Chat = {
1896
2266
  // src/components/ProcessTree/ProcessTree.tsx
1897
2267
  import * as Match from "effect/Match";
1898
2268
  import * as Option4 from "effect/Option";
1899
- import React17 from "react";
2269
+ import React18, { useMemo as useMemo11 } from "react";
1900
2270
  import { Process } from "@dxos/compute";
1901
- import { Icon as Icon4, IconButton as IconButton4, ScrollArea, Tooltip as Tooltip2, Treegrid } from "@dxos/react-ui";
1902
- import { composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
2271
+ import { Icon as Icon5, IconButton as IconButton4, ScrollArea, Tooltip as Tooltip2, composable as composable3, composableProps as composableProps3 } from "@dxos/react-ui";
2272
+ import { Treegrid, TREEGRID_PATH_SEPARATOR } from "@dxos/react-ui-list";
1903
2273
  import { mx as mx7 } from "@dxos/ui-theme";
1904
2274
  import { Unit as Unit2 } from "@dxos/util";
1905
- var ProcessTree = /* @__PURE__ */ React17.memo(composable3(({ processes, onProcessSelect, onProcessTerminate, ...props }, forwardedRef) => {
1906
- const sortedProcesses = [
2275
+ var DEFAULT_DEPTH = 1;
2276
+ var LABEL_INDENT_REM = 0.5;
2277
+ var NESTED_ACTIVE_STATES = /* @__PURE__ */ new Set([
2278
+ Process.State.RUNNING,
2279
+ Process.State.HYBERNATING,
2280
+ Process.State.TERMINATING
2281
+ ]);
2282
+ var ProcessTree = /* @__PURE__ */ React18.memo(composable3(({ processes, depth = DEFAULT_DEPTH, onProcessSelect, onProcessTerminate, ...props }, forwardedRef) => {
2283
+ const rows = useMemo11(() => buildProcessTreeRows(processes, depth), [
2284
+ processes,
2285
+ depth
2286
+ ]);
2287
+ return /* @__PURE__ */ React18.createElement(ScrollArea.Root, {
2288
+ ...composableProps3(props, {
2289
+ classNames: "dx-expander"
2290
+ }),
2291
+ thin: true,
2292
+ ref: forwardedRef
2293
+ }, /* @__PURE__ */ React18.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React18.createElement(Treegrid.Root, {
2294
+ classNames: "grid grid-cols-[min-content_1fr_min-content_min-content]"
2295
+ }, rows.map(({ process, path }) => /* @__PURE__ */ React18.createElement(ProcessTreeRowView, {
2296
+ key: path.join(TREEGRID_PATH_SEPARATOR),
2297
+ process,
2298
+ path,
2299
+ onProcessSelect,
2300
+ onProcessTerminate
2301
+ })))));
2302
+ }));
2303
+ var ProcessTreeRowView = ({ process, path, onProcessSelect, onProcessTerminate }) => {
2304
+ const duration = Unit2.Duration(process.metrics.wallTime);
2305
+ const level = path.length;
2306
+ const nested = level > 1;
2307
+ return /* @__PURE__ */ React18.createElement(Treegrid.Row, {
2308
+ id: path.join(TREEGRID_PATH_SEPARATOR),
2309
+ classNames: mx7("col-span-full grid grid-cols-subgrid gap-2 ps-1", onProcessSelect && "dx-hover")
2310
+ }, /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
2311
+ classNames: "flex items-center gap-0.5"
2312
+ }, nested && /* @__PURE__ */ React18.createElement(Icon5, {
2313
+ icon: "ph--arrow-elbow-down-right--regular",
2314
+ size: 3,
2315
+ classNames: "shrink-0 text-subdued"
2316
+ }), /* @__PURE__ */ React18.createElement(Tooltip2.Trigger, {
2317
+ content: process.state.toString()
2318
+ }, /* @__PURE__ */ React18.createElement(Icon5, {
2319
+ size: 4,
2320
+ synchronized: true,
2321
+ 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"),
2322
+ 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--moon-stars--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"))
2323
+ }))), /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
2324
+ classNames: "flex items-center truncate",
2325
+ style: nested ? {
2326
+ paddingInlineStart: `${(level - 1) * LABEL_INDENT_REM}rem`
2327
+ } : void 0,
2328
+ onClick: () => onProcessSelect?.(process)
2329
+ }, /* @__PURE__ */ React18.createElement("span", {
2330
+ className: mx7("truncate text-sm", level === 1 && "font-medium", process.state !== Process.State.RUNNING && "text-description")
2331
+ }, process.params.name ?? process.pid.toString())), /* @__PURE__ */ React18.createElement(Treegrid.Cell, {
2332
+ classNames: "flex items-center justify-end text-xs text-description tabular-nums"
2333
+ }, [
2334
+ Process.State.FAILED,
2335
+ Process.State.SUCCEEDED
2336
+ ].includes(process.state) && /* @__PURE__ */ React18.createElement("span", {
2337
+ className: "whitespace-nowrap"
2338
+ }, duration.toString())), /* @__PURE__ */ React18.createElement(Treegrid.Cell, null, onProcessTerminate && /* @__PURE__ */ React18.createElement(IconButton4, {
2339
+ classNames: "min-h-0 p-1",
2340
+ icon: "ph--x--regular",
2341
+ iconOnly: true,
2342
+ variant: "ghost",
2343
+ size: 4,
2344
+ label: "Actions",
2345
+ onClick: (event) => {
2346
+ event.stopPropagation();
2347
+ onProcessTerminate?.(process);
2348
+ }
2349
+ })));
2350
+ };
2351
+ var sortProcesses = (processes) => {
2352
+ return [
1907
2353
  ...processes.filter((process) => [
1908
2354
  Process.State.RUNNING,
1909
2355
  Process.State.HYBERNATING
@@ -1916,412 +2362,89 @@ var ProcessTree = /* @__PURE__ */ React17.memo(composable3(({ processes, onProce
1916
2362
  Process.State.FAILED,
1917
2363
  Process.State.TERMINATED
1918
2364
  ].includes(process.state))
1919
- ].sort((a, b) => {
1920
- const aCompletedAt = Option4.getOrElse(a.completedAt, () => Infinity);
1921
- const bCompletedAt = Option4.getOrElse(b.completedAt, () => Infinity);
1922
- return bCompletedAt - aCompletedAt;
2365
+ ].sort((left, right) => {
2366
+ const leftCompletedAt = Option4.getOrElse(left.completedAt, () => Infinity);
2367
+ const rightCompletedAt = Option4.getOrElse(right.completedAt, () => Infinity);
2368
+ return rightCompletedAt - leftCompletedAt;
1923
2369
  });
1924
- return /* @__PURE__ */ React17.createElement(ScrollArea.Root, {
1925
- ...composableProps3(props, {
1926
- classNames: "dx-expander"
1927
- }),
1928
- thin: true,
1929
- ref: forwardedRef
1930
- }, /* @__PURE__ */ React17.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React17.createElement(Treegrid.Root, {
1931
- classNames: "grid grid-cols-[min-content_1fr_min-content_min-content]"
1932
- }, sortedProcesses.filter((process) => process.parentPid === null).map((process) => {
1933
- const t = Unit2.Duration(process.metrics.wallTime);
1934
- return /* @__PURE__ */ React17.createElement(Treegrid.Row, {
1935
- key: process.pid.toString(),
1936
- id: process.pid.toString(),
1937
- parentOf: process.parentPid?.toString(),
1938
- classNames: mx7("col-span-full grid grid-cols-subgrid gap-2 ps-1", onProcessSelect && "dx-hover")
1939
- }, /* @__PURE__ */ React17.createElement(Treegrid.Cell, {
1940
- classNames: "grid place-items-center"
1941
- }, /* @__PURE__ */ React17.createElement(Tooltip2.Trigger, {
1942
- content: process.state.toString()
1943
- }, /* @__PURE__ */ React17.createElement(Icon4, {
1944
- size: 4,
1945
- synchronized: true,
1946
- 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"),
1947
- 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--moon-stars--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"))
1948
- }))), /* @__PURE__ */ React17.createElement(Treegrid.Cell, {
1949
- classNames: "flex items-center truncate",
1950
- onClick: () => onProcessSelect?.(process)
1951
- }, /* @__PURE__ */ React17.createElement("span", {
1952
- className: mx7("truncate text-sm", process.state !== Process.State.RUNNING && "text-description")
1953
- }, process.params.name ?? process.pid.toString())), /* @__PURE__ */ React17.createElement(Treegrid.Cell, {
1954
- classNames: "flex items-center justify-end text-xs text-description tabular-nums"
1955
- }, [
1956
- Process.State.FAILED,
1957
- Process.State.SUCCEEDED
1958
- ].includes(process.state) && /* @__PURE__ */ React17.createElement("span", {
1959
- className: "whitespace-nowrap"
1960
- }, t.toString())), /* @__PURE__ */ React17.createElement(Treegrid.Cell, null, onProcessTerminate && /* @__PURE__ */ React17.createElement(IconButton4, {
1961
- classNames: "min-h-0 p-1",
1962
- icon: "ph--x--regular",
1963
- iconOnly: true,
1964
- variant: "ghost",
1965
- size: 4,
1966
- label: "Actions",
1967
- onClick: (event) => {
1968
- event.stopPropagation();
1969
- onProcessTerminate?.(process);
1970
- }
1971
- })));
1972
- }))));
1973
- }));
1974
-
1975
- // src/components/TemplateEditor/TemplateEditor.tsx
1976
- import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
1977
- import { composeRefs } from "@radix-ui/react-compose-refs";
1978
- import React18 from "react";
1979
- import { createDocAccessor } from "@dxos/echo-client";
1980
- import { useThemeContext, useTranslation as useTranslation10 } from "@dxos/react-ui";
1981
- import { composable as composable4, composableProps as composableProps4 } from "@dxos/react-ui";
1982
- import { useTextEditor } from "@dxos/react-ui-editor";
1983
- import { createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown } from "@dxos/ui-editor";
1984
- import { isNonNullable as isNonNullable2 } from "@dxos/util";
1985
- import { meta as meta10 } from "#meta";
1986
-
1987
- // src/components/TemplateEditor/extensions/handlebars-extension.ts
1988
- import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
1989
- import { RangeSetBuilder } from "@codemirror/state";
1990
- import { Decoration, ViewPlugin, WidgetType as WidgetType7, keymap } from "@codemirror/view";
1991
- import { Domino as Domino7, mx as mx8 } from "@dxos/ui";
1992
- var handlebars = (_ = {}) => {
1993
- return [
1994
- handlebarsHighlightPlugin,
1995
- autocompletion({
1996
- activateOnTyping: true,
1997
- aboveCursor: true,
1998
- closeOnBlur: true,
1999
- override: [
2000
- handlebarsCompletions
2001
- ]
2002
- }),
2003
- keymap.of(completionKeymap)
2004
- ];
2005
2370
  };
2006
- var regex = {
2007
- // {{! comment }}
2008
- comment: /\{\{!\s*[^}]*\}\}/g,
2009
- // {{var}}
2010
- brackets: /\{\{[^}]*\}\}/g,
2011
- // {{#command}} {{/command}}
2012
- command: /\{\{[#/]([^}]+)\}\}/g,
2013
- // {{var}}
2014
- var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
2015
- // @echo://space/id or @dxn:nsid
2016
- dxn: /@?(?:echo:\/{1,3}[\w/]+|dxn:[\w.-]+)/g,
2017
- // example.com/path/xxx
2018
- url: /[\w.-]+\.[\w.-]+\/[\w/]+/g
2019
- };
2020
- var tagPadding = "mx-0.5 px-1 rounded-xs";
2021
- var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
2022
- decorations;
2023
- constructor(view) {
2024
- this.decorations = this.buildDecorations(view);
2025
- }
2026
- update(update) {
2027
- if (update.docChanged || update.viewportChanged || update.selectionSet) {
2028
- this.decorations = this.buildDecorations(update.view);
2371
+ var sortNestedActive = (processes) => processes.filter((process) => NESTED_ACTIVE_STATES.has(process.state)).sort((left, right) => {
2372
+ const priority = (state) => state === Process.State.RUNNING ? 0 : state === Process.State.HYBERNATING ? 1 : 2;
2373
+ return priority(left.state) - priority(right.state);
2374
+ });
2375
+ var buildProcessTreeRows = (processes, maxDepth) => {
2376
+ const pidSet = new Set(processes.map((process) => String(process.pid)));
2377
+ const childrenByParent = /* @__PURE__ */ new Map();
2378
+ const roots = [];
2379
+ for (const process of processes) {
2380
+ const parent = process.parentPid;
2381
+ if (parent === null || !pidSet.has(String(parent))) {
2382
+ roots.push(process);
2383
+ continue;
2029
2384
  }
2385
+ const key = String(parent);
2386
+ const siblings = childrenByParent.get(key) ?? [];
2387
+ siblings.push(process);
2388
+ childrenByParent.set(key, siblings);
2030
2389
  }
2031
- // NOTE: Decorations may clash with other extensions (e.g., markdown).
2032
- buildDecorations(view) {
2033
- const selection = view.state.selection.main;
2034
- const decorations = [];
2035
- for (const { from, to } of view.visibleRanges) {
2036
- const text = view.state.doc.sliceString(from, to);
2037
- {
2038
- let match;
2039
- while ((match = regex.dxn.exec(text)) !== null) {
2040
- const start = from + match.index;
2041
- const end = start + match[0].length;
2042
- const overlaps = selection.to > start && selection.from <= end;
2043
- if (!overlaps) {
2044
- decorations.push({
2045
- from: start,
2046
- to: end,
2047
- decoration: Decoration.widget({
2048
- widget: new DXNWidget(match[0])
2049
- })
2050
- });
2051
- }
2052
- }
2053
- }
2054
- {
2055
- let match;
2056
- while ((match = regex.url.exec(text)) !== null) {
2057
- const start = from + match.index;
2058
- const end = start + match[0].length;
2059
- decorations.push({
2060
- from: start,
2061
- to: end,
2062
- decoration: Decoration.mark({
2063
- class: mx8("dx-tag--blue", tagPadding)
2064
- })
2065
- });
2066
- }
2067
- }
2068
- {
2069
- let match;
2070
- while ((match = regex.brackets.exec(text)) !== null) {
2071
- const start = from + match.index;
2072
- const end = start + match[0].length;
2073
- decorations.push({
2074
- from: start,
2075
- to: end,
2076
- decoration: Decoration.mark({
2077
- class: "text-subdued"
2078
- })
2079
- });
2080
- }
2081
- }
2082
- {
2083
- let match;
2084
- while ((match = regex.command.exec(text)) !== null) {
2085
- const start = from + match.index + 2;
2086
- let end = start + match[0].length - 4;
2087
- const text2 = view.state.doc.sliceString(start, end);
2088
- const parts = text2.split(/\s+/);
2089
- if (parts.length > 1) {
2090
- const idx = start + parts[0].length;
2091
- decorations.push({
2092
- from: idx,
2093
- to: end,
2094
- decoration: Decoration.mark({
2095
- class: "text-green-text"
2096
- })
2097
- });
2098
- end = idx;
2099
- }
2100
- decorations.push({
2101
- from: start,
2102
- to: end,
2103
- decoration: Decoration.mark({
2104
- class: "text-blue-text"
2105
- })
2106
- });
2107
- }
2108
- }
2109
- {
2110
- let match;
2111
- while ((match = regex.var.exec(text)) !== null) {
2112
- const start = from + match.index + 2;
2113
- const end = start + match[0].length - 4;
2114
- decorations.push({
2115
- from: start,
2116
- to: end,
2117
- decoration: Decoration.mark({
2118
- class: "text-green-text"
2119
- })
2120
- });
2121
- }
2122
- }
2390
+ const sortedRoots = sortProcesses(roots);
2391
+ const rows = [];
2392
+ const visit = (process, path, level) => {
2393
+ if (level > maxDepth) {
2394
+ return;
2123
2395
  }
2124
- decorations.sort((a, b) => a.from - b.from || a.to - b.to);
2125
- const builder = new RangeSetBuilder();
2126
- for (const { from, to, decoration } of decorations) {
2127
- builder.add(from, to, decoration);
2396
+ rows.push({
2397
+ process,
2398
+ path
2399
+ });
2400
+ if (level >= maxDepth) {
2401
+ return;
2128
2402
  }
2129
- return builder.finish();
2130
- }
2131
- }, {
2132
- decorations: (v) => v.decorations
2133
- });
2134
- var DXNWidget = class extends WidgetType7 {
2135
- _identifier;
2136
- constructor(_identifier) {
2137
- super(), this._identifier = _identifier;
2138
- }
2139
- ignoreEvent() {
2140
- return false;
2141
- }
2142
- eq(other) {
2143
- return this._identifier === other._identifier;
2144
- }
2145
- toDOM() {
2146
- const text = this._identifier.split(":").map((part) => {
2147
- const len = 16;
2148
- const plen = 4;
2149
- if (part.length > len) {
2150
- return `[${part.slice(0, plen)}\u2026${part.slice(-plen)}]`;
2151
- }
2152
- return part;
2153
- }).join(":");
2154
- return Domino7.of("span").classNames(mx8("font-mono dx-tag--blue", tagPadding)).text(text).root;
2155
- }
2156
- };
2157
- var variables = [
2158
- "this"
2159
- ];
2160
- var commands = [
2161
- "this",
2162
- "each",
2163
- "if",
2164
- "unless",
2165
- "with"
2166
- ];
2167
- function handlebarsCompletions(context) {
2168
- const match = context.matchBefore(/\{\{[^}]*/);
2169
- if (!match || match.from === match.to) {
2170
- return null;
2171
- }
2172
- let type = "variable";
2173
- let text = match.text.slice(2);
2174
- let from = match.from + 2;
2175
- let matches = [];
2176
- if (text.startsWith("#") || text.startsWith("/")) {
2177
- const idx = text.lastIndexOf(" ");
2178
- if (idx !== -1) {
2179
- type = "variable";
2180
- matches = variables;
2181
- text = text.slice(idx + 1);
2182
- from += idx + 1;
2183
- } else {
2184
- type = "command";
2185
- text = text.slice(1);
2186
- matches = commands;
2187
- from += 1;
2403
+ const children = sortNestedActive(childrenByParent.get(String(process.pid)) ?? []);
2404
+ for (const child of children) {
2405
+ visit(child, [
2406
+ ...path,
2407
+ String(child.pid)
2408
+ ], level + 1);
2188
2409
  }
2189
- } else {
2190
- type = "variable";
2191
- matches = variables;
2192
- }
2193
- const options = matches.filter((name) => name.startsWith(text)).map((name) => ({
2194
- type,
2195
- label: name
2196
- }));
2197
- return {
2198
- from,
2199
- options
2200
2410
  };
2201
- }
2202
-
2203
- // src/components/TemplateEditor/extensions/xml-extension.ts
2204
- import { syntaxTree } from "@codemirror/language";
2205
- import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
2206
- import { Decoration as Decoration2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
2207
- var xmlDecorator = (_ = {}) => {
2208
- return [
2209
- xmlDecoratorPlugin
2210
- ];
2211
- };
2212
- var xmlDecoratorPlugin = ViewPlugin2.fromClass(class {
2213
- decorations;
2214
- constructor(view) {
2215
- this.decorations = this.buildDecorations(view);
2216
- }
2217
- update(update) {
2218
- if (update.docChanged || update.viewportChanged) {
2219
- this.decorations = this.buildDecorations(update.view);
2220
- }
2221
- }
2222
- buildDecorations(view) {
2223
- const builder = new RangeSetBuilder2();
2224
- for (const { from, to } of view.visibleRanges) {
2225
- syntaxTree(view.state).iterate({
2226
- from,
2227
- to,
2228
- enter: (node) => {
2229
- if (node.name === "HTMLTag" || node.name === "OpenTag" || node.name === "CloseTag" || node.name === "SelfClosingTag" || node.name === "Element") {
2230
- builder.add(node.from, node.to, Decoration2.mark({
2231
- class: "font-mono text-subdued"
2232
- }));
2233
- }
2234
- }
2235
- });
2236
- }
2237
- return builder.finish();
2411
+ for (const root of sortedRoots) {
2412
+ visit(root, [
2413
+ String(root.pid)
2414
+ ], 1);
2238
2415
  }
2239
- }, {
2240
- decorations: (v) => v.decorations
2241
- });
2242
-
2243
- // src/components/TemplateEditor/TemplateEditor.tsx
2244
- var TemplateEditor = composable4(({ classNames, id, source, lineNumbers = true, ...props }, forwardedRef) => {
2245
- const { t } = useTranslation10(meta10.id);
2246
- const { themeMode } = useThemeContext();
2247
- const { parentRef } = useTextEditor(() => {
2248
- const target = source?.target;
2249
- if (!target) {
2250
- return {};
2251
- }
2252
- return {
2253
- initialValue: target.content ?? "",
2254
- extensions: [
2255
- createDataExtensions({
2256
- id,
2257
- text: createDocAccessor(target, [
2258
- "content"
2259
- ])
2260
- }),
2261
- createBasicExtensions({
2262
- bracketMatching: false,
2263
- lineNumbers,
2264
- lineWrapping: true,
2265
- placeholder: t("template.placeholder")
2266
- }),
2267
- createThemeExtensions({
2268
- themeMode
2269
- }),
2270
- createMarkdownExtensions(),
2271
- decorateMarkdown(),
2272
- handlebars(),
2273
- // xml(),
2274
- // NOTE: Since we're using markdown only HTML nodes are parsed.
2275
- xmlDecorator(),
2276
- syntaxHighlighting(defaultHighlightStyle)
2277
- ].filter(isNonNullable2)
2278
- };
2279
- }, [
2280
- themeMode,
2281
- source?.target,
2282
- lineNumbers
2283
- ]);
2284
- return /* @__PURE__ */ React18.createElement("div", {
2285
- ...composableProps4(props, {
2286
- role: "none",
2287
- classNames: [
2288
- "h-full overflow-hidden",
2289
- classNames
2290
- ]
2291
- }),
2292
- ref: composeRefs(parentRef, forwardedRef)
2293
- });
2294
- });
2416
+ return rows;
2417
+ };
2295
2418
 
2296
2419
  // src/components/Toolbox/Toolbox.tsx
2297
- import React19, { Fragment, useEffect as useEffect7, useState as useState8 } from "react";
2420
+ import React19, { Fragment, useEffect as useEffect9, useState as useState8 } from "react";
2298
2421
  import { Operation } from "@dxos/compute";
2299
2422
  import { Filter as Filter4 } from "@dxos/echo";
2300
- import { log as log2 } from "@dxos/log";
2423
+ import { log as log3 } from "@dxos/log";
2301
2424
  import { useQuery as useQuery4 } from "@dxos/react-client/echo";
2302
2425
  import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
2303
- import { composable as composable5, composableProps as composableProps5 } from "@dxos/react-ui";
2304
- import { mx as mx9 } from "@dxos/ui-theme";
2426
+ import { composable as composable4, composableProps as composableProps4 } from "@dxos/react-ui";
2427
+ import { mx as mx8 } from "@dxos/ui-theme";
2305
2428
  import { ServiceType } from "#types";
2306
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
2307
- var Toolbox = composable5(({ functions, services, blueprints, activeBlueprints, ...props }, forwardedRef) => {
2429
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
2430
+ var Toolbox = composable4(({ functions, services, skills, activeSkills, ...props }, forwardedRef) => {
2308
2431
  return /* @__PURE__ */ React19.createElement(ScrollArea2.Root, {
2309
- ...composableProps5(props),
2432
+ ...composableProps4(props),
2310
2433
  thin: true,
2311
2434
  orientation: "vertical",
2312
2435
  ref: forwardedRef
2313
- }, /* @__PURE__ */ React19.createElement(ScrollArea2.Viewport, null, blueprints && blueprints.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
2314
- title: "Blueprints",
2315
- items: blueprints.map(({ name, description, tools }) => ({
2436
+ }, /* @__PURE__ */ React19.createElement(ScrollArea2.Viewport, null, skills && skills.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
2437
+ title: "Skills",
2438
+ items: skills.map(({ name, description, tools }) => ({
2316
2439
  name,
2317
2440
  description,
2318
2441
  subitems: tools.map((toolId) => ({
2319
2442
  name: `\u2219 ${safeToolId(toolId)}`
2320
2443
  }))
2321
2444
  }))
2322
- }), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
2323
- title: "Blueprints",
2324
- items: activeBlueprints.map(({ target }) => ({
2445
+ }), activeSkills && activeSkills.length > 0 && /* @__PURE__ */ React19.createElement(Section, {
2446
+ title: "Skills",
2447
+ items: activeSkills.map(({ target }) => ({
2325
2448
  name: target?.name ?? "",
2326
2449
  description: target?.description ?? "",
2327
2450
  subitems: target?.tools.map((toolId) => ({
@@ -2346,7 +2469,7 @@ Toolbox.displayName = "Toolbox";
2346
2469
  var Section = ({ title, items, striped }) => {
2347
2470
  const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
2348
2471
  const gridClassNames = "grid grid-cols-[8rem_1fr]";
2349
- const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
2472
+ const subGridClassNames = mx8("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
2350
2473
  return /* @__PURE__ */ React19.createElement("div", null, /* @__PURE__ */ React19.createElement("h1", {
2351
2474
  className: "px-2 text-sm"
2352
2475
  }, title), /* @__PURE__ */ React19.createElement("div", {
@@ -2361,7 +2484,7 @@ var Section = ({ title, items, striped }) => {
2361
2484
  className: "line-clamp-2"
2362
2485
  }, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React19.createElement("div", {
2363
2486
  key: i2,
2364
- className: mx9(subGridClassNames, striped && stripeClassNames)
2487
+ className: mx8(subGridClassNames, striped && stripeClassNames)
2365
2488
  }, /* @__PURE__ */ React19.createElement("div", {
2366
2489
  className: "truncate"
2367
2490
  }, name2), /* @__PURE__ */ React19.createElement("div", {
@@ -2371,10 +2494,10 @@ var Section = ({ title, items, striped }) => {
2371
2494
  var ToolboxPanel = ({ classNames, db, processor }) => {
2372
2495
  const services = useQuery4(db, Filter4.type(ServiceType));
2373
2496
  const [serviceTools, setServiceTools] = useState8([]);
2374
- useEffect7(() => {
2375
- log2("creating service tools...", {
2497
+ useEffect9(() => {
2498
+ log3("creating service tools...", {
2376
2499
  services: services.length
2377
- }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 82, S: void 0 });
2500
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 82, S: void 0 });
2378
2501
  queueMicrotask(async () => {
2379
2502
  });
2380
2503
  }, [
@@ -2383,7 +2506,7 @@ var ToolboxPanel = ({ classNames, db, processor }) => {
2383
2506
  const functions = useQuery4(db, Filter4.type(Operation.PersistentOperation));
2384
2507
  return /* @__PURE__ */ React19.createElement(Toolbox, {
2385
2508
  classNames,
2386
- blueprints: processor?.context.getBlueprints(),
2509
+ skills: processor?.context.getSkills(),
2387
2510
  services: serviceTools,
2388
2511
  functions
2389
2512
  });
@@ -2391,20 +2514,14 @@ var ToolboxPanel = ({ classNames, db, processor }) => {
2391
2514
  var safeToolId = (name) => {
2392
2515
  return name.split("_").pop();
2393
2516
  };
2394
-
2395
- // src/components/index.ts
2396
- var AssistantSettings = lazy(() => import("../AssistantSettings-GG52BLKS.mjs"));
2397
- var RoutineProperties = lazy(() => import("../RoutineProperties-FISLMW2R.mjs"));
2398
2517
  export {
2399
2518
  AgentProperties,
2400
- AssistantSettings,
2401
2519
  Chat,
2402
2520
  ChatPrompt,
2403
2521
  ProcessTree,
2404
- RoutineProperties,
2405
2522
  TaskList,
2406
- TemplateEditor,
2407
2523
  Toolbox,
2408
- ToolboxPanel
2524
+ ToolboxPanel,
2525
+ TracePanel
2409
2526
  };
2410
2527
  //# sourceMappingURL=index.mjs.map