@dxos/plugin-automation 0.7.4 → 0.7.5-labs.401163d

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 (302) hide show
  1. package/dist/lib/browser/AutomationPanel-VW2XIUPU.mjs +8 -0
  2. package/dist/lib/browser/ChatContainer-OLRZNGWK.mjs +12 -0
  3. package/dist/lib/browser/ai-client-5CNY6JBF.mjs +22 -0
  4. package/dist/lib/browser/ai-client-5CNY6JBF.mjs.map +7 -0
  5. package/dist/lib/browser/app-graph-builder-6H7MDCXE.mjs +197 -0
  6. package/dist/lib/browser/app-graph-builder-6H7MDCXE.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-2H2EUYXL.mjs +15 -0
  8. package/dist/lib/browser/chunk-2H2EUYXL.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-ITG6CBKL.mjs +1602 -0
  10. package/dist/lib/browser/chunk-ITG6CBKL.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-MRBC5J4T.mjs +518 -0
  12. package/dist/lib/browser/chunk-MRBC5J4T.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-NQFZ6XRX.mjs +243 -0
  14. package/dist/lib/browser/chunk-NQFZ6XRX.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-Q4IMHYGH.mjs +150 -0
  16. package/dist/lib/browser/chunk-Q4IMHYGH.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-X5KMOH3I.mjs → chunk-R4JH4TLE.mjs} +6 -4
  18. package/dist/lib/browser/chunk-R4JH4TLE.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +157 -252
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/intent-resolver-BWAXKT27.mjs +29 -0
  22. package/dist/lib/browser/intent-resolver-BWAXKT27.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/react-surface-O6SHIBCA.mjs +58 -0
  25. package/dist/lib/browser/react-surface-O6SHIBCA.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +12 -3
  27. package/dist/lib/node/{meta.cjs → AutomationPanel-G6EDDYWW.cjs} +7 -11
  28. package/dist/lib/node/AutomationPanel-G6EDDYWW.cjs.map +7 -0
  29. package/dist/lib/node/ChatContainer-GRZDJIG5.cjs +33 -0
  30. package/dist/lib/node/ChatContainer-GRZDJIG5.cjs.map +7 -0
  31. package/dist/lib/node/ai-client-FKLPDELV.cjs +38 -0
  32. package/dist/lib/node/ai-client-FKLPDELV.cjs.map +7 -0
  33. package/dist/lib/node/app-graph-builder-7JMJLZIE.cjs +212 -0
  34. package/dist/lib/node/app-graph-builder-7JMJLZIE.cjs.map +7 -0
  35. package/dist/lib/node/chunk-CFBERLTN.cjs +1586 -0
  36. package/dist/lib/node/chunk-CFBERLTN.cjs.map +7 -0
  37. package/dist/lib/node/{chunk-DTJ7XVO2.cjs → chunk-EQYHOTGG.cjs} +11 -8
  38. package/dist/lib/node/chunk-EQYHOTGG.cjs.map +7 -0
  39. package/dist/lib/node/chunk-FQUY77HT.cjs +527 -0
  40. package/dist/lib/node/chunk-FQUY77HT.cjs.map +7 -0
  41. package/dist/lib/node/chunk-GB7245FH.cjs +173 -0
  42. package/dist/lib/node/chunk-GB7245FH.cjs.map +7 -0
  43. package/dist/lib/node/chunk-QXIHYOMF.cjs +267 -0
  44. package/dist/lib/node/chunk-QXIHYOMF.cjs.map +7 -0
  45. package/dist/lib/node/chunk-U5Z7LFWB.cjs +34 -0
  46. package/dist/lib/node/chunk-U5Z7LFWB.cjs.map +7 -0
  47. package/dist/lib/node/index.cjs +174 -282
  48. package/dist/lib/node/index.cjs.map +4 -4
  49. package/dist/lib/node/intent-resolver-C6OKFVEW.cjs +44 -0
  50. package/dist/lib/node/intent-resolver-C6OKFVEW.cjs.map +7 -0
  51. package/dist/lib/node/meta.json +1 -1
  52. package/dist/lib/node/react-surface-JT6SVCPK.cjs +76 -0
  53. package/dist/lib/node/react-surface-JT6SVCPK.cjs.map +7 -0
  54. package/dist/lib/node/types/index.cjs +16 -7
  55. package/dist/lib/node/types/index.cjs.map +2 -2
  56. package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs +9 -0
  57. package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs.map +7 -0
  58. package/dist/lib/node-esm/ChatContainer-ORVWQPJO.mjs +13 -0
  59. package/dist/lib/node-esm/ChatContainer-ORVWQPJO.mjs.map +7 -0
  60. package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs +23 -0
  61. package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs.map +7 -0
  62. package/dist/lib/node-esm/app-graph-builder-C6NUQGCU.mjs +198 -0
  63. package/dist/lib/node-esm/app-graph-builder-C6NUQGCU.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-2OKJZ4ZW.mjs +519 -0
  65. package/dist/lib/node-esm/chunk-2OKJZ4ZW.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-6HLBYDUI.mjs +244 -0
  67. package/dist/lib/node-esm/chunk-6HLBYDUI.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-7VPT3OO3.mjs +1603 -0
  69. package/dist/lib/node-esm/chunk-7VPT3OO3.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-DNCXRGAF.mjs +151 -0
  71. package/dist/lib/node-esm/chunk-DNCXRGAF.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-HNOBZHWK.mjs → chunk-EMVA6QUT.mjs} +6 -4
  73. package/dist/lib/node-esm/chunk-EMVA6QUT.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-IJRTDSKN.mjs +16 -0
  75. package/dist/lib/node-esm/chunk-IJRTDSKN.mjs.map +7 -0
  76. package/dist/lib/node-esm/index.mjs +157 -252
  77. package/dist/lib/node-esm/index.mjs.map +4 -4
  78. package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs +30 -0
  79. package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs.map +7 -0
  80. package/dist/lib/node-esm/meta.json +1 -1
  81. package/dist/lib/node-esm/react-surface-DSVM33SA.mjs +59 -0
  82. package/dist/lib/node-esm/react-surface-DSVM33SA.mjs.map +7 -0
  83. package/dist/lib/node-esm/types/index.mjs +12 -3
  84. package/dist/types/src/AutomationPlugin.d.ts +1 -3
  85. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  86. package/dist/types/src/artifacts.stories.d.ts +16 -0
  87. package/dist/types/src/artifacts.stories.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/ai-client.d.ts +5 -0
  89. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  91. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/capabilities.d.ts +5 -0
  93. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  94. package/dist/types/src/capabilities/index.d.ts +182 -0
  95. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  97. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  99. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  100. package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts +3 -0
  101. package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts.map +1 -0
  102. package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.stories.d.ts +8 -0
  103. package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.stories.d.ts.map +1 -0
  104. package/dist/types/src/components/AmbientChatDialog/index.d.ts +2 -0
  105. package/dist/types/src/components/AmbientChatDialog/index.d.ts.map +1 -0
  106. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
  107. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  108. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  109. package/dist/types/src/components/Box/StatusLine.d.ts +11 -0
  110. package/dist/types/src/components/Box/StatusLine.d.ts.map +1 -0
  111. package/dist/types/src/components/Box/StatusLine.stories.d.ts +9 -0
  112. package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +1 -0
  113. package/dist/types/src/components/Box/Tabbed.d.ts +15 -0
  114. package/dist/types/src/components/Box/Tabbed.d.ts.map +1 -0
  115. package/dist/types/src/components/Box/Tabbed.stories.d.ts +8 -0
  116. package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +1 -0
  117. package/dist/types/src/components/Box/ToggleContainer.d.ts +13 -0
  118. package/dist/types/src/components/Box/ToggleContainer.d.ts.map +1 -0
  119. package/dist/types/src/components/Box/ToggleContainer.stories.d.ts +9 -0
  120. package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +1 -0
  121. package/dist/types/src/components/Box/index.d.ts +4 -0
  122. package/dist/types/src/components/Box/index.d.ts.map +1 -0
  123. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +7 -0
  124. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +1 -0
  125. package/dist/types/src/components/ChatContainer/index.d.ts +4 -0
  126. package/dist/types/src/components/ChatContainer/index.d.ts.map +1 -0
  127. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +14 -0
  128. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +1 -0
  129. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +8 -0
  130. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +1 -0
  131. package/dist/types/src/components/MarkdownViewer/index.d.ts +2 -0
  132. package/dist/types/src/components/MarkdownViewer/index.d.ts.map +1 -0
  133. package/dist/types/src/components/Prompt/Prompt.d.ts +7 -0
  134. package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -0
  135. package/dist/types/src/components/Prompt/Prompt.stories.d.ts +8 -0
  136. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -0
  137. package/dist/types/src/components/Prompt/index.d.ts +2 -0
  138. package/dist/types/src/components/Prompt/index.d.ts.map +1 -0
  139. package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +20 -0
  140. package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +1 -0
  141. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +6 -0
  142. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +1 -0
  143. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +8 -0
  144. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +1 -0
  145. package/dist/types/src/components/ServiceRegistry/index.d.ts +2 -0
  146. package/dist/types/src/components/ServiceRegistry/index.d.ts.map +1 -0
  147. package/dist/types/src/components/Thread/Thread.d.ts +11 -0
  148. package/dist/types/src/components/Thread/Thread.d.ts.map +1 -0
  149. package/dist/types/src/components/Thread/Thread.stories.d.ts +11 -0
  150. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -0
  151. package/dist/types/src/components/Thread/ThreadMessage.d.ts +12 -0
  152. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -0
  153. package/dist/types/src/components/Thread/index.d.ts +2 -0
  154. package/dist/types/src/components/Thread/index.d.ts.map +1 -0
  155. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
  156. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  157. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/index.d.ts +13 -2
  159. package/dist/types/src/components/index.d.ts.map +1 -1
  160. package/dist/types/src/hooks/email.d.ts.map +1 -1
  161. package/dist/types/src/hooks/index.d.ts +4 -0
  162. package/dist/types/src/hooks/index.d.ts.map +1 -1
  163. package/dist/types/src/hooks/invocation-handler.d.ts.map +1 -1
  164. package/dist/types/src/hooks/processor.d.ts +70 -0
  165. package/dist/types/src/hooks/processor.d.ts.map +1 -0
  166. package/dist/types/src/hooks/processor.test.d.ts +2 -0
  167. package/dist/types/src/hooks/processor.test.d.ts.map +1 -0
  168. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -0
  169. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -0
  170. package/dist/types/src/hooks/useMessageQueue.d.ts +41 -0
  171. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -0
  172. package/dist/types/src/hooks/useServices.d.ts +7 -0
  173. package/dist/types/src/hooks/useServices.d.ts.map +1 -0
  174. package/dist/types/src/index.d.ts +1 -2
  175. package/dist/types/src/index.d.ts.map +1 -1
  176. package/dist/types/src/meta.d.ts +2 -2
  177. package/dist/types/src/meta.d.ts.map +1 -1
  178. package/dist/types/src/testing/index.d.ts +2 -1
  179. package/dist/types/src/testing/index.d.ts.map +1 -1
  180. package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +3 -1
  181. package/dist/types/src/testing/test-functions.d.ts.map +1 -0
  182. package/dist/types/src/testing/test-services.d.ts +5 -0
  183. package/dist/types/src/testing/test-services.d.ts.map +1 -0
  184. package/dist/types/src/tools/function.d.ts +5 -0
  185. package/dist/types/src/tools/function.d.ts.map +1 -0
  186. package/dist/types/src/tools/index.d.ts +3 -0
  187. package/dist/types/src/tools/index.d.ts.map +1 -0
  188. package/dist/types/src/tools/openapi.d.ts +10 -0
  189. package/dist/types/src/tools/openapi.d.ts.map +1 -0
  190. package/dist/types/src/tools/openapi.test.d.ts +2 -0
  191. package/dist/types/src/tools/openapi.test.d.ts.map +1 -0
  192. package/dist/types/src/translations.d.ts +84 -2
  193. package/dist/types/src/translations.d.ts.map +1 -1
  194. package/dist/types/src/types/index.d.ts +1 -0
  195. package/dist/types/src/types/index.d.ts.map +1 -1
  196. package/dist/types/src/types/registry.d.ts +10 -0
  197. package/dist/types/src/types/registry.d.ts.map +1 -0
  198. package/dist/types/src/types/schema.d.ts +189 -39
  199. package/dist/types/src/types/schema.d.ts.map +1 -1
  200. package/dist/types/src/types/types.d.ts +16 -5
  201. package/dist/types/src/types/types.d.ts.map +1 -1
  202. package/dist/types/tsconfig.tsbuildinfo +1 -0
  203. package/package.json +57 -48
  204. package/src/AutomationPlugin.tsx +77 -194
  205. package/src/artifacts.stories.tsx +241 -0
  206. package/src/capabilities/ai-client.ts +19 -0
  207. package/src/capabilities/app-graph-builder.ts +187 -0
  208. package/src/capabilities/capabilities.ts +12 -0
  209. package/src/capabilities/index.ts +12 -0
  210. package/src/capabilities/intent-resolver.ts +27 -0
  211. package/src/capabilities/react-surface.tsx +42 -0
  212. package/src/components/AmbientChatDialog/AmbientChatDialog.stories.tsx +44 -0
  213. package/src/components/AmbientChatDialog/AmbientChatDialog.tsx +63 -0
  214. package/src/components/AmbientChatDialog/index.ts +5 -0
  215. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
  216. package/src/components/AutomationPanel/AutomationPanel.tsx +61 -39
  217. package/src/components/Box/StatusLine.stories.tsx +52 -0
  218. package/src/components/Box/StatusLine.tsx +76 -0
  219. package/src/components/Box/Tabbed.stories.tsx +51 -0
  220. package/src/components/Box/Tabbed.tsx +89 -0
  221. package/src/components/Box/ToggleContainer.stories.tsx +110 -0
  222. package/src/components/Box/ToggleContainer.tsx +108 -0
  223. package/src/components/Box/index.ts +7 -0
  224. package/src/components/ChatContainer/ChatContainer.tsx +52 -0
  225. package/src/components/ChatContainer/index.ts +8 -0
  226. package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +56 -0
  227. package/src/components/MarkdownViewer/MarkdownViewer.tsx +79 -0
  228. package/src/components/MarkdownViewer/index.ts +5 -0
  229. package/src/components/Prompt/Prompt.stories.tsx +50 -0
  230. package/src/components/Prompt/Prompt.tsx +39 -0
  231. package/src/components/Prompt/index.ts +5 -0
  232. package/src/components/Prompt/prompt-autocomplete.ts +200 -0
  233. package/src/components/PromptEditor/PromptEditor.stories.tsx +6 -6
  234. package/src/components/PromptEditor/PromptEditor.tsx +3 -3
  235. package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +49 -0
  236. package/src/components/ServiceRegistry/ServiceRegistry.tsx +76 -0
  237. package/src/components/ServiceRegistry/index.ts +5 -0
  238. package/src/components/Thread/Thread.stories.tsx +197 -0
  239. package/src/components/Thread/Thread.tsx +156 -0
  240. package/src/components/Thread/ThreadMessage.tsx +225 -0
  241. package/src/components/Thread/index.ts +5 -0
  242. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
  243. package/src/components/TriggerEditor/TriggerEditor.tsx +86 -16
  244. package/src/components/index.ts +10 -1
  245. package/src/hooks/email.ts +2 -2
  246. package/src/hooks/index.ts +5 -0
  247. package/src/hooks/invocation-handler.ts +2 -2
  248. package/src/hooks/processor.test.ts +15 -0
  249. package/src/hooks/processor.ts +210 -0
  250. package/src/hooks/useChatProcessor.tsx +86 -0
  251. package/src/hooks/useMessageQueue.ts +23 -0
  252. package/src/hooks/useServices.ts +28 -0
  253. package/src/index.ts +1 -4
  254. package/src/meta.ts +5 -2
  255. package/src/testing/index.ts +2 -1
  256. package/src/testing/{testing.ts → test-functions.ts} +9 -2
  257. package/src/testing/test-services.ts +131 -0
  258. package/src/tools/function.ts +47 -0
  259. package/src/tools/index.ts +6 -0
  260. package/src/tools/openapi.test.ts +224 -0
  261. package/src/tools/openapi.ts +331 -0
  262. package/src/translations.ts +18 -2
  263. package/src/types/index.ts +1 -0
  264. package/src/types/registry.ts +26 -0
  265. package/src/types/schema.ts +96 -2
  266. package/src/types/types.ts +15 -21
  267. package/dist/lib/browser/AssistantPanel-N3QSALKY.mjs +0 -341
  268. package/dist/lib/browser/AssistantPanel-N3QSALKY.mjs.map +0 -7
  269. package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs +0 -153
  270. package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-7KB4UMXO.mjs +0 -49
  272. package/dist/lib/browser/chunk-7KB4UMXO.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-X5KMOH3I.mjs.map +0 -7
  274. package/dist/lib/browser/meta.mjs +0 -9
  275. package/dist/lib/node/AssistantPanel-RIA4TI3B.cjs +0 -361
  276. package/dist/lib/node/AssistantPanel-RIA4TI3B.cjs.map +0 -7
  277. package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs +0 -173
  278. package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs.map +0 -7
  279. package/dist/lib/node/chunk-CUCUWUAF.cjs +0 -73
  280. package/dist/lib/node/chunk-CUCUWUAF.cjs.map +0 -7
  281. package/dist/lib/node/chunk-DTJ7XVO2.cjs.map +0 -7
  282. package/dist/lib/node/meta.cjs.map +0 -7
  283. package/dist/lib/node-esm/AssistantPanel-72YH43CH.mjs +0 -342
  284. package/dist/lib/node-esm/AssistantPanel-72YH43CH.mjs.map +0 -7
  285. package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs +0 -154
  286. package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs.map +0 -7
  287. package/dist/lib/node-esm/chunk-23LY7DYS.mjs +0 -51
  288. package/dist/lib/node-esm/chunk-23LY7DYS.mjs.map +0 -7
  289. package/dist/lib/node-esm/chunk-HNOBZHWK.mjs.map +0 -7
  290. package/dist/lib/node-esm/meta.mjs +0 -10
  291. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +0 -8
  292. package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +0 -1
  293. package/dist/types/src/components/AssistantPanel/index.d.ts +0 -3
  294. package/dist/types/src/components/AssistantPanel/index.d.ts.map +0 -1
  295. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +0 -6
  296. package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +0 -1
  297. package/dist/types/src/testing/testing.d.ts.map +0 -1
  298. package/src/components/AssistantPanel/AssistantPanel.tsx +0 -230
  299. package/src/components/AssistantPanel/index.ts +0 -7
  300. package/src/components/AssistantPanel/system-instructions.ts +0 -166
  301. /package/dist/lib/browser/{meta.mjs.map → AutomationPanel-VW2XIUPU.mjs.map} +0 -0
  302. /package/dist/lib/{node-esm/meta.mjs.map → browser/ChatContainer-OLRZNGWK.mjs.map} +0 -0
@@ -0,0 +1,156 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { type KeyboardEventHandler, useCallback, useMemo, useRef, useState } from 'react';
6
+
7
+ import { type Message } from '@dxos/artifact';
8
+ import { IconButton, Input, useTranslation } from '@dxos/react-ui';
9
+ import { ScrollContainer, type ScrollController } from '@dxos/react-ui-components';
10
+ import { Spinner } from '@dxos/react-ui-sfx';
11
+ import { mx } from '@dxos/react-ui-theme';
12
+
13
+ import { ThreadMessage, type ThreadMessageProps } from './ThreadMessage';
14
+ import { AUTOMATION_PLUGIN } from '../../meta';
15
+
16
+ export type ThreadProps = {
17
+ messages?: Message[];
18
+ streaming?: boolean;
19
+ onSubmit?: (message: string) => void;
20
+ onStop?: () => void;
21
+ } & Pick<ThreadMessageProps, 'collapse' | 'debug' | 'onSuggest' | 'onDelete'>;
22
+
23
+ // TODO(burdon): Factor out scroll logic.
24
+ export const Thread = ({
25
+ messages,
26
+ streaming,
27
+ collapse,
28
+ debug,
29
+ onSubmit,
30
+ onStop,
31
+ onSuggest,
32
+ onDelete,
33
+ }: ThreadProps) => {
34
+ const { t } = useTranslation(AUTOMATION_PLUGIN);
35
+ const scroller = useRef<ScrollController>(null);
36
+
37
+ const [text, setText] = useState('');
38
+ const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(
39
+ (ev) => {
40
+ switch (ev.key) {
41
+ case 'Escape': {
42
+ setText('');
43
+ break;
44
+ }
45
+
46
+ case 'Enter': {
47
+ const value = text.trim();
48
+ if (value.length > 0) {
49
+ scroller.current?.scrollToBottom();
50
+ onSubmit?.(value);
51
+ setText('');
52
+ }
53
+ break;
54
+ }
55
+ }
56
+ },
57
+ [text],
58
+ );
59
+
60
+ /**
61
+ * Reduce message blocks into collections of messages that contain related contiguous blocks.
62
+ * For example, collapse all tool request/response pairs into a single message.
63
+ */
64
+ // TODO(dmaretskyi): This needs to be a separate type: `id` is not a valid ObjectId, this needs to accommodate messageId for deletion.
65
+ const { messages: lines = [] } = useMemo(() => {
66
+ if (!collapse) {
67
+ return { messages: messages ?? [] };
68
+ }
69
+
70
+ return (messages ?? []).reduce<{ messages: Message[]; current?: Message }>(
71
+ ({ current, messages }, message) => {
72
+ let i = 0;
73
+ for (const block of message.content) {
74
+ switch (block.type) {
75
+ case 'tool_use':
76
+ case 'tool_result': {
77
+ if (current) {
78
+ current.content.push(block);
79
+ } else {
80
+ current = {
81
+ id: [message.id, i].join('_'),
82
+ role: message.role,
83
+ content: [block],
84
+ };
85
+ messages.push(current);
86
+ }
87
+ break;
88
+ }
89
+
90
+ case 'text':
91
+ default: {
92
+ current = undefined;
93
+ messages.push({
94
+ id: [message.id, i].join('_'),
95
+ role: message.role,
96
+ content: [block],
97
+ });
98
+ break;
99
+ }
100
+ }
101
+
102
+ i++;
103
+ }
104
+
105
+ return { current, messages };
106
+ },
107
+ { messages: [] as Message[] },
108
+ );
109
+ }, [messages, collapse]);
110
+
111
+ return (
112
+ <div className='flex flex-col grow overflow-hidden'>
113
+ <ScrollContainer ref={scroller} classNames='py-2 gap-2 overflow-x-hidden'>
114
+ {lines.map((message) => (
115
+ <ThreadMessage
116
+ key={message.id}
117
+ classNames='px-4'
118
+ message={message}
119
+ collapse={collapse}
120
+ debug={debug}
121
+ onSuggest={onSuggest}
122
+ onDelete={onDelete}
123
+ />
124
+ ))}
125
+ </ScrollContainer>
126
+
127
+ {onSubmit && (
128
+ <div className='flex p-4 gap-3 items-center'>
129
+ <Spinner active={streaming} />
130
+ <Input.Root>
131
+ <Input.TextInput
132
+ autoFocus
133
+ classNames='px-2 baseSurface rounded'
134
+ placeholder={t('chat input placeholder')}
135
+ value={text}
136
+ onChange={(ev) => setText(ev.target.value)}
137
+ onKeyDown={handleKeyDown}
138
+ />
139
+ </Input.Root>
140
+ {onStop && (
141
+ <IconButton
142
+ disabled={!streaming}
143
+ classNames={mx('!p-1 !opacity-20 transition', streaming && '!opacity-80')}
144
+ variant='ghost'
145
+ size={5}
146
+ onClick={onStop}
147
+ icon='ph--x--regular'
148
+ label={t('chat stop')}
149
+ iconOnly
150
+ />
151
+ )}
152
+ </div>
153
+ )}
154
+ </div>
155
+ );
156
+ };
@@ -0,0 +1,225 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useEffect, useRef, useState, type FC } from 'react';
6
+
7
+ import { type MessageContentBlock, type Message } from '@dxos/artifact';
8
+ import { invariant } from '@dxos/invariant';
9
+ import { log } from '@dxos/log';
10
+ import { Button, ButtonGroup, Icon, type ThemedClassName } from '@dxos/react-ui';
11
+ import { Json } from '@dxos/react-ui-syntax-highlighter';
12
+ import { mx } from '@dxos/react-ui-theme';
13
+ import { safeParseJson } from '@dxos/util';
14
+
15
+ import { ToggleContainer, StatusLine, Tabs } from '../Box';
16
+ import { MarkdownViewer } from '../MarkdownViewer';
17
+
18
+ export type ThreadMessageProps = ThemedClassName<{
19
+ message: Message;
20
+ collapse?: boolean;
21
+ debug?: boolean;
22
+ onSuggest?: (text: string) => void;
23
+ onDelete?: (id: string) => void;
24
+ }>;
25
+
26
+ export const ThreadMessage: FC<ThreadMessageProps> = ({
27
+ classNames,
28
+ message,
29
+ collapse,
30
+ debug,
31
+ onSuggest,
32
+ onDelete,
33
+ }) => {
34
+ if (typeof message !== 'object') {
35
+ return <div className={mx(classNames)}>{message}</div>;
36
+ }
37
+
38
+ const { role, content = [] } = message;
39
+
40
+ // TODO(burdon): Factor out tool blocks.
41
+ const toolBlocks = content.filter((block) => block.type === 'tool_use' || block.type === 'tool_result');
42
+ if (collapse && toolBlocks.length > 0) {
43
+ let request: (MessageContentBlock & { type: 'tool_use' }) | undefined;
44
+ const items = toolBlocks.map((block) => {
45
+ switch (block.type) {
46
+ case 'tool_use': {
47
+ request = block;
48
+ // TODO(burdon): Get plugin name.
49
+ return { title: `Calling ${block.name}...`, block };
50
+ }
51
+
52
+ case 'tool_result': {
53
+ if (!request) {
54
+ log.warn('unexpected message', { block });
55
+ return { title: 'Error', block };
56
+ }
57
+
58
+ return { title: `Processed ${request.name}`, block };
59
+ }
60
+
61
+ default: {
62
+ request = undefined;
63
+ return { title: 'Error', block };
64
+ }
65
+ }
66
+ });
67
+
68
+ return (
69
+ <div className={mx('flex', classNames)}>
70
+ <div className='w-full p-1 px-2 overflow-hidden rounded-md bg-baseSurface'>
71
+ <TabbedContainer items={items} />
72
+ </div>
73
+ </div>
74
+ );
75
+ }
76
+
77
+ return (
78
+ <div className={mx('flex flex-col shrink-0 gap-2')}>
79
+ {debug && (
80
+ <div className='text-xs text-subdued'>
81
+ {message.id}{' '}
82
+ {onDelete && (
83
+ <span className='cursor-pointer underline' onClick={() => onDelete(message.id)}>
84
+ delete
85
+ </span>
86
+ )}
87
+ </div>
88
+ )}
89
+ {content.map((block, idx) => (
90
+ <div key={idx} className={mx('flex', classNames, block.type === 'text' && role === 'user' && 'justify-end')}>
91
+ <Block role={role} block={block} onSuggest={onSuggest ?? (() => {})} />
92
+ </div>
93
+ ))}
94
+ </div>
95
+ );
96
+ };
97
+
98
+ const Block = ({
99
+ block,
100
+ role,
101
+ onSuggest,
102
+ }: Pick<Message, 'role'> & { block: MessageContentBlock; onSuggest: (text: string) => void }) => {
103
+ const Component = componentMap[block.type] ?? componentMap.default;
104
+ return (
105
+ <div
106
+ className={mx(
107
+ 'p-1 px-2 overflow-hidden rounded-md',
108
+ (block.type !== 'text' || block.disposition) && 'w-full bg-baseSurface',
109
+ block.type === 'text' && role === 'user' && 'bg-primary-200 dark:bg-primary-500',
110
+ )}
111
+ >
112
+ <Component block={block} onSuggest={onSuggest} />
113
+ </div>
114
+ );
115
+ };
116
+
117
+ const titles: Record<string, string> = {
118
+ ['cot' as const]: 'Chain of thought',
119
+ ['artifact' as const]: 'Artifact',
120
+ ['tool_use' as const]: 'Tool request',
121
+ ['tool_result' as const]: 'Tool result',
122
+ };
123
+
124
+ type BlockComponent = FC<{ block: MessageContentBlock; onSuggest: (text: string) => void }>;
125
+
126
+ const componentMap: Record<string, BlockComponent> = {
127
+ text: ({ block }) => {
128
+ invariant(block.type === 'text');
129
+ const title = block.disposition ? titles[block.disposition] : undefined;
130
+ if (!title) {
131
+ return (
132
+ <MarkdownViewer content={block.text} classNames={[block.disposition === 'cot' && 'text-sm text-subdued']} />
133
+ );
134
+ }
135
+
136
+ return (
137
+ <ToggleContainer
138
+ title={title}
139
+ icon={
140
+ block.pending ? (
141
+ <Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
142
+ ) : undefined
143
+ }
144
+ open={block.disposition === 'cot'}
145
+ >
146
+ <MarkdownViewer content={block.text} classNames={[block.disposition === 'cot' && 'text-sm text-subdued']} />
147
+ </ToggleContainer>
148
+ );
149
+ },
150
+
151
+ json: ({ block, onSuggest }) => {
152
+ invariant(block.type === 'json');
153
+
154
+ switch (block.disposition) {
155
+ case 'suggest': {
156
+ const { text = '' }: { text: string } = safeParseJson(block.json ?? '{}') ?? ({} as any);
157
+ return <Button onClick={() => onSuggest(text)}>{text}</Button>;
158
+ }
159
+
160
+ case 'select': {
161
+ const { options = [] }: { options: string[] } = safeParseJson(block.json ?? '{}') ?? ({} as any);
162
+ return (
163
+ <ButtonGroup>
164
+ {options.map((option) => (
165
+ <Button key={option} onClick={() => onSuggest(option)}>
166
+ {option}
167
+ </Button>
168
+ ))}
169
+ </ButtonGroup>
170
+ );
171
+ }
172
+
173
+ default: {
174
+ const title = block.disposition ? titles[block.disposition] : undefined;
175
+ return (
176
+ <ToggleContainer title={title ?? 'JSON'}>
177
+ <Json data={safeParseJson(block.json ?? block)} classNames='!p-1 text-xs' />
178
+ </ToggleContainer>
179
+ );
180
+ }
181
+ }
182
+ },
183
+
184
+ default: ({ block }) => {
185
+ let title = titles[block.type];
186
+ if (block.type === 'tool_use') {
187
+ title = `Tool [${block.name}]`; // TODO(burdon): Get label from tool.
188
+ }
189
+
190
+ return (
191
+ <ToggleContainer title={title ?? 'JSON'}>
192
+ <Json data={block} classNames='!p-1 text-xs' />
193
+ </ToggleContainer>
194
+ );
195
+ },
196
+ };
197
+
198
+ const TabbedContainer = ({ items }: { items: { title: string; block: any }[] }) => {
199
+ const lines = items.map((item) => item.title);
200
+ const tabsRef = useRef<HTMLDivElement>(null);
201
+ const [selected, setSelected] = useState(0);
202
+ const [open, setOpen] = useState(false);
203
+ useEffect(() => {
204
+ if (open) {
205
+ tabsRef.current?.focus();
206
+ }
207
+ }, [open]);
208
+
209
+ const handleSelect = (index: number) => {
210
+ if (index === selected) {
211
+ setOpen(false);
212
+ } else {
213
+ setSelected(index);
214
+ }
215
+ };
216
+
217
+ return (
218
+ <ToggleContainer title={<StatusLine lines={lines} autoAdvance />} open={open} onChangeOpen={setOpen}>
219
+ <div className='flex gap-2 w-full'>
220
+ <Tabs ref={tabsRef} length={items.length} selected={selected} onSelect={handleSelect} />
221
+ <Json data={items[selected].block} classNames='!p-1 text-xs' />
222
+ </div>
223
+ </ToggleContainer>
224
+ );
225
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './Thread';
@@ -7,9 +7,8 @@ import '@dxos-theme';
7
7
  import { type Meta } from '@storybook/react';
8
8
  import React, { useEffect, useState } from 'react';
9
9
 
10
- import { FunctionTrigger, TriggerKind } from '@dxos/functions';
10
+ import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions';
11
11
  import { create } from '@dxos/live-object';
12
- import { FunctionType } from '@dxos/plugin-script/types';
13
12
  import { useSpaces } from '@dxos/react-client/echo';
14
13
  import { withClientProvider } from '@dxos/react-client/testing';
15
14
  import { withLayout, withTheme } from '@dxos/storybook-utils';
@@ -2,27 +2,35 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import React, { useEffect, useState } from 'react';
6
6
 
7
- import { FunctionTriggerSchema, type FunctionTriggerType, type FunctionTrigger, TriggerKind } from '@dxos/functions';
8
- import { FunctionType, ScriptType } from '@dxos/plugin-script/types';
7
+ import { ComputeGraph } from '@dxos/conductor';
8
+ import {
9
+ FunctionType,
10
+ FunctionTriggerSchema,
11
+ type FunctionTriggerType,
12
+ type FunctionTrigger,
13
+ ScriptType,
14
+ TriggerKind,
15
+ } from '@dxos/functions';
9
16
  import { Filter, useQuery, type Space } from '@dxos/react-client/echo';
10
- import { useTranslation } from '@dxos/react-ui';
11
- import { Form, SelectInput } from '@dxos/react-ui-form';
17
+ import { IconButton, Input, useTranslation } from '@dxos/react-ui';
18
+ import { Form, SelectInput, TextInput } from '@dxos/react-ui-form';
12
19
 
13
20
  import { AUTOMATION_PLUGIN } from '../../meta';
14
21
 
15
22
  export type TriggerEditorProps = {
16
23
  space: Space;
17
24
  trigger: FunctionTriggerType;
18
- storedTrigger?: FunctionTrigger;
19
25
  onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
20
26
  onCancel?: () => void;
21
27
  };
22
28
 
23
- export const TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger }: TriggerEditorProps) => {
29
+ export const TriggerEditor = ({ space, trigger, onSave, onCancel }: TriggerEditorProps) => {
24
30
  const { t } = useTranslation(AUTOMATION_PLUGIN);
31
+
25
32
  const functions = useQuery(space, Filter.schema(FunctionType));
33
+ const workflows = useQuery(space, Filter.schema(ComputeGraph));
26
34
  const scripts = useQuery(space, Filter.schema(ScriptType));
27
35
 
28
36
  const handleSave = (values: FunctionTriggerType) => {
@@ -33,21 +41,17 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger
33
41
  <Form<FunctionTriggerType>
34
42
  schema={FunctionTriggerSchema}
35
43
  values={trigger}
36
- filter={(props) => props.filter((p) => p.name !== 'meta')}
37
44
  onSave={handleSave}
38
45
  onCancel={onCancel}
39
46
  Custom={{
40
47
  ['function' satisfies keyof FunctionTriggerType]: (props) => (
41
- <SelectInput<FunctionTriggerType>
48
+ <SelectInput
42
49
  {...props}
43
- options={functions.map((fn) => ({
44
- value: fn.name,
45
- label: getFunctionName(scripts, fn),
46
- }))}
50
+ options={getWorkflowOptions(workflows).concat(getFunctionOptions(scripts, functions))}
47
51
  />
48
52
  ),
49
53
  ['spec.type' as const]: (props) => (
50
- <SelectInput<FunctionTriggerType>
54
+ <SelectInput
51
55
  {...props}
52
56
  options={Object.values(TriggerKind).map((kind) => ({
53
57
  value: kind,
@@ -55,11 +59,77 @@ export const TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger
55
59
  }))}
56
60
  />
57
61
  ),
62
+ ['meta' as const]: (props) => {
63
+ const meta = props.getValue()!;
64
+ useEffect(() => props.onValueChange('object', { ...meta }), []);
65
+ const [newMetaFieldName, setNewMetaFieldName] = useState('');
66
+
67
+ return (
68
+ <>
69
+ <div>{props.label}</div>
70
+ {[...Object.keys(meta)].map((key) => {
71
+ const compositeKey: any = `meta.${key}`;
72
+ return (
73
+ <div key={compositeKey} role='none' className='flex items-center mt-2 gap-1'>
74
+ <div role='none' className='flex-1'>
75
+ <TextInput
76
+ {...props}
77
+ getValue={() => (props.getValue() as any)[key]}
78
+ type={'string'}
79
+ label={key}
80
+ />
81
+ </div>
82
+ <IconButton
83
+ icon='ph--trash--regular'
84
+ iconOnly
85
+ classNames={'mt-6'}
86
+ label={t('trigger meta remove')}
87
+ onClick={() => {
88
+ const newValues: any = { ...props.getValue() };
89
+ delete newValues[key];
90
+ props.onValueChange('object', newValues);
91
+ }}
92
+ />
93
+ </div>
94
+ );
95
+ })}
96
+ <div role='none' className='flex items-center mt-2 gap-1 plb-1'>
97
+ <div role='none' className='flex-1'>
98
+ <Input.Root>
99
+ <Input.TextInput
100
+ placeholder={t('trigger meta prop name placeholder')}
101
+ value={newMetaFieldName}
102
+ onChange={(event) => setNewMetaFieldName(event.target.value)}
103
+ />
104
+ </Input.Root>
105
+ </div>
106
+ <IconButton
107
+ icon='ph--plus--regular'
108
+ iconOnly
109
+ label={t('trigger meta add')}
110
+ onClick={() => {
111
+ if (newMetaFieldName.length) {
112
+ const meta = props.getValue() ?? {};
113
+ const metaWithNewProp = { ...meta, [newMetaFieldName]: '' };
114
+ setNewMetaFieldName('');
115
+ props.onValueChange('object', metaWithNewProp);
116
+ }
117
+ }}
118
+ />
119
+ </div>
120
+ </>
121
+ );
122
+ },
58
123
  }}
59
124
  />
60
125
  );
61
126
  };
62
127
 
63
- const getFunctionName = (scripts: ScriptType[], fn: FunctionType) => {
64
- return scripts.find((s) => fn.source?.id === s.id)?.name ?? fn.name;
128
+ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
129
+ return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
130
+ };
131
+
132
+ const getFunctionOptions = (scripts: ScriptType[], functions: FunctionType[]) => {
133
+ const getLabel = (fn: FunctionType) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
134
+ return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:worker:${fn.name}` }));
65
135
  };
@@ -4,5 +4,14 @@
4
4
 
5
5
  import { lazy } from 'react';
6
6
 
7
- export const AssistantPanel = lazy(() => import('./AssistantPanel'));
7
+ export * from './AmbientChatDialog';
8
+ export * from './AutomationPanel';
9
+ export * from './ChatContainer';
10
+ export * from './MarkdownViewer';
11
+ export * from './PromptEditor';
12
+ export * from './ServiceRegistry';
13
+ export * from './Thread';
14
+ export * from './TriggerEditor';
15
+
8
16
  export const AutomationPanel = lazy(() => import('./AutomationPanel'));
17
+ export const ChatContainer = lazy(() => import('./ChatContainer'));
@@ -7,7 +7,7 @@ import { foreignKey } from '@dxos/echo-schema';
7
7
  import { log } from '@dxos/log';
8
8
  import { MailboxType } from '@dxos/plugin-inbox/types';
9
9
  import { MessageType } from '@dxos/plugin-space/types';
10
- import { type Space, Filter, create } from '@dxos/react-client/echo';
10
+ import { type Space, Filter, create, makeRef } from '@dxos/react-client/echo';
11
11
 
12
12
  export const SOURCE_ID = 'hub.dxos.network/api/mailbox';
13
13
 
@@ -41,7 +41,7 @@ export const handleEmail = async (space: Space, data: any) => {
41
41
  },
42
42
  ),
43
43
  );
44
- mailbox.messages?.push(object);
44
+ mailbox.messages?.push(makeRef(object));
45
45
  }
46
46
  }
47
47
 
@@ -2,4 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ export * from './processor';
6
+
7
+ export * from './useChatProcessor';
5
8
  export * from './useLocalTriggerManager';
9
+ export * from './useMessageQueue';
10
+ export * from './useServices';
@@ -4,12 +4,12 @@
4
4
 
5
5
  import { sleep } from '@dxos/async';
6
6
  import { getObjectCore, ResultFormat } from '@dxos/echo-db';
7
- import type { AnyObjectData } from '@dxos/echo-schema';
7
+ import { type AnyObjectData } from '@dxos/echo-schema';
8
+ import { FunctionType } from '@dxos/functions';
8
9
  import { type FunctionTrigger } from '@dxos/functions';
9
10
  import { invariant } from '@dxos/invariant';
10
11
  import { DXN, LOCAL_SPACE_TAG } from '@dxos/keys';
11
12
  import { log } from '@dxos/log';
12
- import { FunctionType } from '@dxos/plugin-script';
13
13
  import { type Client, type Config } from '@dxos/react-client';
14
14
  import { type Space } from '@dxos/react-client/echo';
15
15
 
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { describe, it } from 'vitest';
6
+
7
+ import { ChatProcessor } from './processor';
8
+
9
+ describe('ChatProcessor', () => {
10
+ it('should be instantiable', ({ expect }) => {
11
+ const client = {} as any; // TODO(burdon): Create mock.
12
+ const processor = new ChatProcessor(client);
13
+ expect(processor).toBeDefined();
14
+ });
15
+ });