@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,200 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Prec, type Extension } from '@codemirror/state';
6
+ import {
7
+ EditorView,
8
+ Decoration,
9
+ ViewPlugin,
10
+ keymap,
11
+ type DecorationSet,
12
+ type ViewUpdate,
13
+ WidgetType,
14
+ } from '@codemirror/view';
15
+
16
+ export type AutocompleteOptions = {
17
+ /**
18
+ * Callback triggered when Enter is pressed.
19
+ * @param text The current text in the editor
20
+ */
21
+ onEnter?: (text: string) => void;
22
+
23
+ /**
24
+ * Function that returns a list of suggestions based on the current text.
25
+ * @param text The current text before the cursor
26
+ * @returns Array of suggestion strings
27
+ */
28
+ onSuggest?: (text: string) => string[];
29
+ };
30
+
31
+ class InlineSuggestionWidget extends WidgetType {
32
+ constructor(private suffix: string) {
33
+ super();
34
+ }
35
+
36
+ override toDOM() {
37
+ const span = document.createElement('span');
38
+ span.textContent = this.suffix;
39
+ span.className = 'cm-inline-suggestion';
40
+ return span;
41
+ }
42
+
43
+ override eq(other: InlineSuggestionWidget) {
44
+ return other.suffix === this.suffix;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Creates an autocomplete extension that shows inline suggestions.
50
+ * Pressing Tab will complete the suggestion.
51
+ */
52
+ export const createAutocompleteExtension = ({ onEnter, onSuggest }: AutocompleteOptions): Extension => {
53
+ const suggestionPlugin = ViewPlugin.fromClass(
54
+ class {
55
+ _decorations: DecorationSet;
56
+ _currentSuggestion: string | null = null;
57
+
58
+ constructor(view: EditorView) {
59
+ this._decorations = this.computeDecorations(view);
60
+ }
61
+
62
+ update(update: ViewUpdate) {
63
+ if (update.docChanged || update.selectionSet) {
64
+ this._decorations = this.computeDecorations(update.view);
65
+ }
66
+ }
67
+
68
+ private computeDecorations(view: EditorView): DecorationSet {
69
+ const text = view.state.doc.toString();
70
+ const suggestions = onSuggest?.(text) ?? [];
71
+ if (!suggestions.length) {
72
+ this._currentSuggestion = null;
73
+ return Decoration.none;
74
+ }
75
+
76
+ // Get the first suggestion.
77
+ this._currentSuggestion = suggestions[0];
78
+ const suffix = this._currentSuggestion.slice(text.length);
79
+ if (!suffix) {
80
+ return Decoration.none;
81
+ }
82
+
83
+ // Always show ghost text at the end of the document.
84
+ return Decoration.set([
85
+ Decoration.widget({
86
+ widget: new InlineSuggestionWidget(suffix),
87
+ side: 1,
88
+ }).range(view.state.doc.length),
89
+ ]);
90
+ }
91
+
92
+ completeSuggestion(view: EditorView): boolean {
93
+ if (!this._currentSuggestion) {
94
+ return false;
95
+ }
96
+
97
+ const text = view.state.doc.toString();
98
+ const suffix = this._currentSuggestion.slice(text.length);
99
+ if (!suffix) {
100
+ return false;
101
+ }
102
+
103
+ view.dispatch({
104
+ changes: {
105
+ from: view.state.doc.length,
106
+ insert: suffix,
107
+ },
108
+ selection: {
109
+ anchor: view.state.doc.length + suffix.length,
110
+ },
111
+ });
112
+
113
+ return true;
114
+ }
115
+ },
116
+ {
117
+ decorations: (v) => v._decorations,
118
+ },
119
+ );
120
+
121
+ return [
122
+ suggestionPlugin,
123
+ EditorView.theme({
124
+ '.cm-inline-suggestion': {
125
+ opacity: 0.4,
126
+ },
127
+ }),
128
+
129
+ // Accept the current suggestion.
130
+ Prec.highest(
131
+ keymap.of([
132
+ {
133
+ key: 'Tab',
134
+ run: (view) => {
135
+ const plugin = view.plugin(suggestionPlugin);
136
+ return plugin?.completeSuggestion(view) ?? false;
137
+ },
138
+ },
139
+ {
140
+ key: 'ArrowRight',
141
+ run: (view) => {
142
+ // Only complete if cursor is at the end
143
+ if (view.state.selection.main.head !== view.state.doc.length) {
144
+ return false;
145
+ }
146
+
147
+ const plugin = view.plugin(suggestionPlugin);
148
+ return plugin?.completeSuggestion(view) ?? false;
149
+ },
150
+ },
151
+ {
152
+ key: 'Enter',
153
+ preventDefault: true,
154
+ run: (view) => {
155
+ const text = view.state.doc.toString();
156
+ if (onEnter) {
157
+ onEnter(text);
158
+ // Clear the document after calling onEnter
159
+ view.dispatch({
160
+ changes: {
161
+ from: 0,
162
+ to: view.state.doc.length,
163
+ insert: '',
164
+ },
165
+ });
166
+ return true;
167
+ }
168
+ return false;
169
+ },
170
+ },
171
+ {
172
+ key: 'Shift-Enter',
173
+ run: (view) => {
174
+ view.dispatch({
175
+ changes: {
176
+ from: view.state.selection.main.head,
177
+ insert: '\n',
178
+ },
179
+ });
180
+ return true;
181
+ },
182
+ },
183
+ {
184
+ key: 'Escape',
185
+ run: (view) => {
186
+ // Clear the entire document.
187
+ view.dispatch({
188
+ changes: {
189
+ from: 0,
190
+ to: view.state.doc.length,
191
+ insert: '',
192
+ },
193
+ });
194
+ return true;
195
+ },
196
+ },
197
+ ]),
198
+ ),
199
+ ];
200
+ };
@@ -7,7 +7,7 @@ import '@dxos-theme';
7
7
  import { type Meta } from '@storybook/react';
8
8
  import React, { useState } from 'react';
9
9
 
10
- import { create } from '@dxos/live-object';
10
+ import { create, makeRef } from '@dxos/live-object';
11
11
  import { useClient } from '@dxos/react-client';
12
12
  import { withClientProvider } from '@dxos/react-client/testing';
13
13
  import { withLayout, withTheme } from '@dxos/storybook-utils';
@@ -28,20 +28,20 @@ const template = [
28
28
  '{input}',
29
29
  ].join('\n');
30
30
 
31
- const DefaultStory = () => {
31
+ const Render = () => {
32
32
  const client = useClient();
33
33
  const [chain] = useState(() => {
34
34
  const space = client.spaces.default;
35
35
  return space.db.add(
36
36
  create(ChainType, {
37
- prompts: [create(ChainPromptType, { command: 'test', template, inputs: [] })],
37
+ prompts: [makeRef(create(ChainPromptType, { command: 'test', template, inputs: [] }))],
38
38
  }),
39
39
  );
40
40
  });
41
41
 
42
42
  return (
43
43
  <div role='none' className='flex w-[350px] border border-separator overflow-hidden'>
44
- <PromptEditor prompt={chain.prompts![0]!} />
44
+ <PromptEditor prompt={chain.prompts![0]!.target!} />
45
45
  </div>
46
46
  );
47
47
  };
@@ -49,8 +49,8 @@ const DefaultStory = () => {
49
49
  export const Default = {};
50
50
 
51
51
  const meta: Meta = {
52
- title: 'plugins/plugin-automation/PromptTemplate',
53
- render: DefaultStory,
52
+ title: 'plugins/plugin-automation/PromptEditor',
53
+ render: Render,
54
54
  decorators: [
55
55
  withClientProvider({ createIdentity: true, createSpace: true, types: [ChainType, ChainPromptType] }),
56
56
  withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
@@ -14,7 +14,7 @@ import {
14
14
  useTextEditor,
15
15
  } from '@dxos/react-ui-editor';
16
16
  import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
17
- import { nonNullable } from '@dxos/util';
17
+ import { isNonNullable } from '@dxos/util';
18
18
 
19
19
  import { nameRegex, promptExtension } from './prompt-extension';
20
20
  import { AUTOMATION_PLUGIN } from '../../meta';
@@ -69,7 +69,7 @@ const usePromptInputs = (prompt: ChainPromptType) => {
69
69
 
70
70
  // Create map of unclaimed inputs.
71
71
  const unclaimed = new Map<string, ChainInput>(
72
- prompt.inputs?.filter(nonNullable).map((input) => [input.name, input]),
72
+ prompt.inputs?.filter(isNonNullable).map((input) => [input.name, input]),
73
73
  );
74
74
  const missing: string[] = [];
75
75
  Array.from(variables.values()).forEach((name) => {
@@ -161,7 +161,7 @@ export const PromptEditor = ({ prompt, commandEditable = true }: PromptEditorPro
161
161
  {/* TODO(zan): Improve layout with grid */}
162
162
  <table className='w-full table-fixed border-collapse my-2'>
163
163
  <tbody>
164
- {prompt.inputs?.filter(nonNullable).map((input) => (
164
+ {prompt.inputs?.filter(isNonNullable).map((input) => (
165
165
  <tr key={input.name}>
166
166
  <td className='w-[160px] p-1 font-mono text-sm whitespace-nowrap truncate'>
167
167
  <code className='px-2'>{input.name}</code>
@@ -0,0 +1,49 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import { type Meta, type StoryObj } from '@storybook/react';
8
+ import React from 'react';
9
+
10
+ import { useSpace } from '@dxos/react-client/echo';
11
+ import { withClientProvider } from '@dxos/react-client/testing';
12
+ import { withLayout, withTheme } from '@dxos/storybook-utils';
13
+
14
+ import { ServiceRegistry } from './ServiceRegistry';
15
+ import { ServiceType } from '../../types';
16
+
17
+ const meta: Meta<typeof ServiceRegistry> = {
18
+ title: 'plugins/plugin-automation/ServiceRegistry',
19
+ component: ServiceRegistry,
20
+ render: ({ space: _ignore, ...args }) => {
21
+ const space = useSpace();
22
+ if (!space) {
23
+ return <div />;
24
+ }
25
+
26
+ return (
27
+ <div className='h-full w-[300px] overflow-hidden'>
28
+ <ServiceRegistry space={space} {...args} />
29
+ </div>
30
+ );
31
+ },
32
+ decorators: [
33
+ withClientProvider({
34
+ createIdentity: true,
35
+ createSpace: true,
36
+ types: [ServiceType],
37
+ }),
38
+ withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center' }),
39
+ withTheme,
40
+ ],
41
+ };
42
+
43
+ export default meta;
44
+
45
+ type Story = StoryObj<typeof ServiceRegistry>;
46
+
47
+ export const Default: Story = {
48
+ args: {},
49
+ };
@@ -0,0 +1,76 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useMemo } from 'react';
6
+
7
+ import { Filter, type Space } from '@dxos/client/echo';
8
+ import { useQuery } from '@dxos/react-client/echo';
9
+ import { Icon, Input, List, ListItem } from '@dxos/react-ui';
10
+
11
+ import { useServices } from '../../hooks';
12
+ import { categoryIcons, ServiceType } from '../../types';
13
+
14
+ // TODO(burdon): Option to show all/enabled/filter.
15
+ export const ServiceRegistry = ({ space }: { space: Space }) => {
16
+ const matchingServices = useServices(space);
17
+ const enabledServices = useQuery(space, Filter.schema(ServiceType));
18
+
19
+ // Join matching services with enabled services.
20
+ const services = useMemo(() => {
21
+ return matchingServices.map((service) => enabledServices.find((s) => s.serviceId === service.serviceId) ?? service);
22
+ }, [matchingServices, enabledServices]);
23
+
24
+ // TODO(burdon): Reaplce with SpacePlugin intent.
25
+ const handleSetEnabled = (service: ServiceType, enabled: boolean) => {
26
+ if (enabled) {
27
+ space.db.add(service);
28
+ } else {
29
+ // TODO(burdon): Remove or disable?
30
+ space.db.remove(service);
31
+ }
32
+ };
33
+
34
+ return (
35
+ <List classNames='h-full grid auto-rows-[5rem] gap-2 p-2 pis-2 pie-2 overflow-y-auto scrollbar-thin'>
36
+ {services.map((service) => (
37
+ <ServiceItem
38
+ key={service.serviceId}
39
+ service={service}
40
+ enabled={service.enabled}
41
+ setEnabled={(enabled) => handleSetEnabled(service, enabled)}
42
+ />
43
+ ))}
44
+ </List>
45
+ );
46
+ };
47
+
48
+ const ServiceItem = ({
49
+ service,
50
+ enabled,
51
+ setEnabled,
52
+ }: {
53
+ service: ServiceType;
54
+ enabled?: boolean;
55
+ setEnabled?: (enabled: boolean) => void;
56
+ }) => {
57
+ return (
58
+ <ListItem.Root classNames='flex flex-col gap-1 p-1 overflow-hidden rounded-md border border-separator'>
59
+ <div className='grid grid-cols-[40px_1fr_40px]'>
60
+ <div className='flex gow justify-center items-center'>
61
+ <Icon icon={categoryIcons[service.category ?? 'default'] ?? 'ph--placeholder--regular'} size={6} />
62
+ </div>
63
+ <div className='grow items-center truncate mie-2'>{service.name}</div>
64
+ <div className='flex gow justify-center items-center'>
65
+ <Input.Root>
66
+ <Input.Switch checked={enabled} onClick={() => setEnabled?.(!enabled)} />
67
+ </Input.Root>
68
+ </div>
69
+ </div>
70
+ <div className='grid grid-cols-[40px_1fr]'>
71
+ <div />
72
+ <div className='text-sm text-subdued line-clamp-2 mie-1'>{service.description}</div>
73
+ </div>
74
+ </ListItem.Root>
75
+ );
76
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './ServiceRegistry';
@@ -0,0 +1,197 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import { type StoryObj, type Meta } from '@storybook/react';
8
+ import React, { useCallback, useEffect, useState } from 'react';
9
+
10
+ import { type Message } from '@dxos/artifact';
11
+ import { ObjectId } from '@dxos/echo-schema';
12
+ import { faker } from '@dxos/random';
13
+ import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
14
+
15
+ import { Thread, type ThreadProps } from './Thread';
16
+ import translations from '../../translations';
17
+
18
+ faker.seed(1);
19
+
20
+ const Render = ({ messages: _messages, ...props }: ThreadProps) => {
21
+ const [streaming, setStreaming] = useState(false);
22
+ const [messages, setMessages] = useState<Message[]>(_messages ?? []);
23
+ useEffect(() => {
24
+ setMessages(_messages ?? []);
25
+ }, [_messages]);
26
+
27
+ const handleSubmit = useCallback(
28
+ (text: string) => {
29
+ const request: Message = { id: ObjectId.random(), role: 'user', content: [{ type: 'text', text }] };
30
+ const response: Message = {
31
+ id: ObjectId.random(),
32
+ role: 'assistant',
33
+ content: [{ type: 'text', disposition: 'cot', pending: true, text: faker.lorem.paragraphs(1) }],
34
+ };
35
+ setMessages([...messages, request, response]);
36
+ setStreaming(true);
37
+ setTimeout(() => {
38
+ response.content[0].pending = false;
39
+ setMessages([
40
+ ...messages,
41
+ request,
42
+ response,
43
+ {
44
+ id: ObjectId.random(),
45
+ role: 'assistant',
46
+ content: [{ type: 'text', text: faker.lorem.paragraphs(1) }],
47
+ },
48
+ ]);
49
+ setStreaming(false);
50
+ }, 3_000);
51
+ },
52
+ [messages],
53
+ );
54
+
55
+ return (
56
+ <div className='flex grow justify-center overflow-center bg-baseSurface'>
57
+ <div className='flex w-[500px] bg-white dark:bg-black'>
58
+ <Thread {...props} messages={messages} streaming={streaming} onSubmit={handleSubmit} onStop={() => {}} />
59
+ </div>
60
+ </div>
61
+ );
62
+ };
63
+
64
+ const meta: Meta<ThreadProps> = {
65
+ title: 'plugins/plugin-automation/Thread',
66
+ render: Render,
67
+ component: Thread,
68
+ decorators: [withSignals, withTheme, withLayout({ fullscreen: true, tooltips: true })],
69
+ parameters: {
70
+ translations,
71
+ },
72
+ };
73
+
74
+ export default meta;
75
+
76
+ type Story = StoryObj<ThreadProps>;
77
+
78
+ const TEST_MESSAGES: Message[] = [
79
+ {
80
+ id: ObjectId.random(),
81
+ role: 'user',
82
+ content: [
83
+ {
84
+ type: 'text',
85
+ text: faker.lorem.sentence(5),
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ id: ObjectId.random(),
91
+ role: 'assistant',
92
+ content: [
93
+ {
94
+ type: 'text',
95
+ disposition: 'cot',
96
+ text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
97
+ .map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
98
+ .join('\n'),
99
+ },
100
+ {
101
+ type: 'text',
102
+ text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
103
+ .map(() => faker.lorem.paragraphs())
104
+ .join('\n\n'),
105
+ },
106
+ {
107
+ type: 'tool_use',
108
+ id: '1234',
109
+ name: 'search',
110
+ input: {},
111
+ },
112
+ ],
113
+ },
114
+ {
115
+ id: ObjectId.random(),
116
+ role: 'user',
117
+ content: [
118
+ {
119
+ type: 'tool_result',
120
+ toolUseId: '1234',
121
+ content: 'This is a tool result.',
122
+ },
123
+ ],
124
+ },
125
+ {
126
+ id: ObjectId.random(),
127
+ role: 'assistant',
128
+ content: [
129
+ {
130
+ type: 'tool_use',
131
+ id: '4567',
132
+ name: 'create',
133
+ input: {},
134
+ },
135
+ ],
136
+ },
137
+ {
138
+ id: ObjectId.random(),
139
+ role: 'user',
140
+ content: [
141
+ {
142
+ type: 'tool_result',
143
+ toolUseId: '4567',
144
+ content: 'This is a tool result.',
145
+ },
146
+ ],
147
+ },
148
+ {
149
+ id: ObjectId.random(),
150
+ role: 'assistant',
151
+ content: [
152
+ {
153
+ type: 'text',
154
+ text: faker.lorem.paragraphs(1),
155
+ },
156
+ ],
157
+ },
158
+ ];
159
+
160
+ export const Default: Story = {
161
+ args: {
162
+ // debug: true,
163
+ messages: TEST_MESSAGES,
164
+ },
165
+ };
166
+
167
+ export const Input: Story = {
168
+ args: {
169
+ streaming: true,
170
+ },
171
+ };
172
+
173
+ export const Collapse: Story = {
174
+ args: {
175
+ collapse: true,
176
+ messages: TEST_MESSAGES,
177
+ },
178
+ };
179
+
180
+ export const Incremental: Story = {
181
+ render: () => {
182
+ const [messages, setMessages] = useState<Message[]>([]);
183
+ useEffect(() => {
184
+ let i = 0;
185
+ const interval = setInterval(() => {
186
+ setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
187
+ if (i >= TEST_MESSAGES.length) {
188
+ clearInterval(interval);
189
+ }
190
+ }, 2_000);
191
+
192
+ return () => clearInterval(interval);
193
+ }, []);
194
+
195
+ return <Render messages={messages} collapse />;
196
+ },
197
+ };