@dxos/plugin-assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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 (295) hide show
  1. package/dist/lib/browser/AssistantDialog-K6POM23O.mjs +46 -0
  2. package/dist/lib/browser/AssistantDialog-K6POM23O.mjs.map +7 -0
  3. package/dist/lib/browser/ChatContainer-QTO4LE2C.mjs +39 -0
  4. package/dist/lib/{node-esm/ChatContainer-FAYGNMQW.mjs.map → browser/ChatContainer-QTO4LE2C.mjs.map} +1 -1
  5. package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs +28 -0
  6. package/dist/lib/{node-esm/TemplateContainer-3LEBT5ZC.mjs.map → browser/TemplateContainer-AKUYL4AV.mjs.map} +1 -1
  7. package/dist/lib/browser/{ai-client-5PRCXI7N.mjs → ai-client-COXVUC6V.mjs} +4 -4
  8. package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +7 -0
  9. package/dist/lib/browser/{app-graph-builder-HTK3HFGM.mjs → app-graph-builder-YH4EGNBC.mjs} +45 -28
  10. package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-TXJWGWJ7.mjs → chunk-3F44MBHU.mjs} +3 -3
  12. package/dist/lib/browser/chunk-3F44MBHU.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-IHEBFO5O.mjs +205 -0
  14. package/dist/lib/browser/chunk-IHEBFO5O.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-JQFUME3B.mjs +87 -0
  16. package/dist/lib/{node-esm/chunk-PBZA7XJR.mjs.map → browser/chunk-JQFUME3B.mjs.map} +1 -1
  17. package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +96 -0
  18. package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-OWZHLWW5.mjs → chunk-QTW7KVDO.mjs} +1595 -1452
  20. package/dist/lib/browser/chunk-QTW7KVDO.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-USJBRB3H.mjs +155 -0
  22. package/dist/lib/browser/chunk-USJBRB3H.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-3HCI5FIL.mjs → chunk-XOZ7YMO3.mjs} +3 -3
  24. package/dist/lib/browser/{chunk-3HCI5FIL.mjs.map → chunk-XOZ7YMO3.mjs.map} +1 -1
  25. package/dist/lib/browser/index.mjs +24 -10
  26. package/dist/lib/browser/index.mjs.map +3 -3
  27. package/dist/lib/browser/{intent-resolver-QV5AAVJZ.mjs → intent-resolver-63EAHENI.mjs} +6 -5
  28. package/dist/lib/browser/intent-resolver-63EAHENI.mjs.map +7 -0
  29. package/dist/lib/browser/meta.json +1 -1
  30. package/dist/lib/browser/react-surface-XCV6NR75.mjs +131 -0
  31. package/dist/lib/browser/react-surface-XCV6NR75.mjs.map +7 -0
  32. package/dist/lib/browser/{settings-OZX7J65A.mjs → settings-SHNQ4XXP.mjs} +3 -3
  33. package/dist/lib/browser/types/index.mjs +4 -2
  34. package/dist/lib/node/AssistantDialog-FDATKYE5.cjs +72 -0
  35. package/dist/lib/node/AssistantDialog-FDATKYE5.cjs.map +7 -0
  36. package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs → ChatContainer-5CLHJOIQ.cjs} +25 -19
  37. package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs.map → ChatContainer-5CLHJOIQ.cjs.map} +1 -1
  38. package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs → TemplateContainer-CTG2MB4W.cjs} +18 -12
  39. package/dist/lib/node/{TemplateContainer-EQXKHWTF.cjs.map → TemplateContainer-CTG2MB4W.cjs.map} +1 -1
  40. package/dist/lib/node/{ai-client-OUPSRQT7.cjs → ai-client-R2CGEYZW.cjs} +12 -12
  41. package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +7 -0
  42. package/dist/lib/node/{app-graph-builder-LEO63CZZ.cjs → app-graph-builder-PSHIOW3Q.cjs} +62 -46
  43. package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs.map +7 -0
  44. package/dist/lib/node/{chunk-XI2ARIEO.cjs → chunk-4EEWTDQK.cjs} +45 -39
  45. package/dist/lib/node/{chunk-XI2ARIEO.cjs.map → chunk-4EEWTDQK.cjs.map} +1 -1
  46. package/dist/lib/node/chunk-FLJWJ35M.cjs +181 -0
  47. package/dist/lib/node/chunk-FLJWJ35M.cjs.map +7 -0
  48. package/dist/lib/node/{chunk-OOHFSPWR.cjs → chunk-H4A42LNR.cjs} +1126 -983
  49. package/dist/lib/node/chunk-H4A42LNR.cjs.map +7 -0
  50. package/dist/lib/node/chunk-HRNIUYVQ.cjs +128 -0
  51. package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +7 -0
  52. package/dist/lib/node/{chunk-Q5XWEMHB.cjs → chunk-P74TWGMG.cjs} +6 -6
  53. package/dist/lib/node/{chunk-Q5XWEMHB.cjs.map → chunk-P74TWGMG.cjs.map} +1 -1
  54. package/dist/lib/node/chunk-RXPA2C2A.cjs +230 -0
  55. package/dist/lib/node/chunk-RXPA2C2A.cjs.map +7 -0
  56. package/dist/lib/node/{chunk-GBUNQ257.cjs → chunk-TS3H5OSX.cjs} +7 -7
  57. package/dist/lib/node/chunk-TS3H5OSX.cjs.map +7 -0
  58. package/dist/lib/node/index.cjs +72 -59
  59. package/dist/lib/node/index.cjs.map +3 -3
  60. package/dist/lib/node/{intent-resolver-QDGZMWLY.cjs → intent-resolver-66F7WLW6.cjs} +13 -12
  61. package/dist/lib/node/intent-resolver-66F7WLW6.cjs.map +7 -0
  62. package/dist/lib/node/meta.json +1 -1
  63. package/dist/lib/node/react-surface-TASAPRPQ.cjs +145 -0
  64. package/dist/lib/node/react-surface-TASAPRPQ.cjs.map +7 -0
  65. package/dist/lib/node/{settings-WLTC7XO5.cjs → settings-ERKLO6IO.cjs} +8 -8
  66. package/dist/lib/node/types/index.cjs +16 -14
  67. package/dist/lib/node/types/index.cjs.map +2 -2
  68. package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs +47 -0
  69. package/dist/lib/node-esm/AssistantDialog-PIMYK774.mjs.map +7 -0
  70. package/dist/lib/node-esm/ChatContainer-QTC5NYE2.mjs +40 -0
  71. package/dist/lib/{browser/ChatContainer-ZNKENYKZ.mjs.map → node-esm/ChatContainer-QTC5NYE2.mjs.map} +1 -1
  72. package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs +29 -0
  73. package/dist/lib/{browser/TemplateContainer-WKU5XFSO.mjs.map → node-esm/TemplateContainer-IVDQ4XQG.mjs.map} +1 -1
  74. package/dist/lib/node-esm/{ai-client-RZQWEDUX.mjs → ai-client-I5LXHMOZ.mjs} +4 -4
  75. package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +7 -0
  76. package/dist/lib/node-esm/{app-graph-builder-WXJNZDYB.mjs → app-graph-builder-Z3GMMJMD.mjs} +45 -28
  77. package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs.map +7 -0
  78. package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs → chunk-BB2TAT4P.mjs} +3 -3
  79. package/dist/lib/node-esm/{chunk-ECRK6TUQ.mjs.map → chunk-BB2TAT4P.mjs.map} +1 -1
  80. package/dist/lib/node-esm/chunk-CDAILLCU.mjs +98 -0
  81. package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +7 -0
  82. package/dist/lib/node-esm/{chunk-6JK5HEUQ.mjs → chunk-HLPGKJ7N.mjs} +3 -3
  83. package/dist/lib/node-esm/chunk-HLPGKJ7N.mjs.map +7 -0
  84. package/dist/lib/node-esm/{chunk-PBZA7XJR.mjs → chunk-OYN6HLXZ.mjs} +42 -36
  85. package/dist/lib/{browser/chunk-NFUHCW2J.mjs.map → node-esm/chunk-OYN6HLXZ.mjs.map} +1 -1
  86. package/dist/lib/node-esm/chunk-QU626JMR.mjs +156 -0
  87. package/dist/lib/node-esm/chunk-QU626JMR.mjs.map +7 -0
  88. package/dist/lib/node-esm/{chunk-ED55ZE4G.mjs → chunk-SI5LOQEO.mjs} +1595 -1452
  89. package/dist/lib/node-esm/chunk-SI5LOQEO.mjs.map +7 -0
  90. package/dist/lib/node-esm/chunk-ZKBACPIW.mjs +206 -0
  91. package/dist/lib/node-esm/chunk-ZKBACPIW.mjs.map +7 -0
  92. package/dist/lib/node-esm/index.mjs +24 -10
  93. package/dist/lib/node-esm/index.mjs.map +3 -3
  94. package/dist/lib/node-esm/{intent-resolver-Q3I6S6HN.mjs → intent-resolver-X3PWH7KM.mjs} +6 -5
  95. package/dist/lib/node-esm/intent-resolver-X3PWH7KM.mjs.map +7 -0
  96. package/dist/lib/node-esm/meta.json +1 -1
  97. package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs +132 -0
  98. package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs.map +7 -0
  99. package/dist/lib/node-esm/{settings-CLE57WEP.mjs → settings-IVQRZUCU.mjs} +3 -3
  100. package/dist/lib/node-esm/types/index.mjs +4 -2
  101. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  102. package/dist/types/src/capabilities/ai-client.d.ts +1 -1
  103. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
  104. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/capabilities.d.ts +1 -1
  106. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/index.d.ts +1 -1
  108. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  110. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  111. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +3 -1
  112. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -1
  113. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +8 -0
  114. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +1 -0
  115. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +8 -0
  116. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +1 -0
  117. package/dist/types/src/components/BlueprintEditor/index.d.ts +2 -0
  118. package/dist/types/src/components/BlueprintEditor/index.d.ts.map +1 -0
  119. package/dist/types/src/components/Prompt/Prompt.d.ts +5 -2
  120. package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -1
  121. package/dist/types/src/components/Prompt/Prompt.stories.d.ts +6 -3
  122. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -1
  123. package/dist/types/src/components/Prompt/PromptBar.d.ts +9 -4
  124. package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -1
  125. package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +9 -0
  126. package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +1 -0
  127. package/dist/types/src/components/Prompt/autocomplete.d.ts +5 -1
  128. package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -1
  129. package/dist/types/src/components/Thread/Thread.d.ts +2 -2
  130. package/dist/types/src/components/Thread/Thread.d.ts.map +1 -1
  131. package/dist/types/src/components/Thread/ThreadContainer.d.ts +1 -1
  132. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
  133. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
  134. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
  135. package/dist/types/src/components/Thread/ThreadMessage.d.ts +4 -2
  136. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
  137. package/dist/types/src/components/Thread/ToolInvocations.d.ts +1 -1
  138. package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -1
  139. package/dist/types/src/components/Thread/reducer.d.ts +1 -1
  140. package/dist/types/src/components/Thread/reducer.d.ts.map +1 -1
  141. package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -1
  142. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  143. package/dist/types/src/components/index.d.ts +2 -0
  144. package/dist/types/src/components/index.d.ts.map +1 -1
  145. package/dist/types/src/experimental/transcription/index.d.ts +1 -0
  146. package/dist/types/src/experimental/transcription/index.d.ts.map +1 -0
  147. package/dist/types/src/hooks/processor.d.ts +6 -5
  148. package/dist/types/src/hooks/processor.d.ts.map +1 -1
  149. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  150. package/dist/types/src/hooks/useMessageQueue.d.ts +11 -7
  151. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
  152. package/dist/types/src/parser/filter-generator.d.ts +4 -0
  153. package/dist/types/src/parser/filter-generator.d.ts.map +1 -0
  154. package/dist/types/src/parser/filter-generator.test.d.ts +2 -0
  155. package/dist/types/src/parser/filter-generator.test.d.ts.map +1 -0
  156. package/dist/types/src/parser/index.d.ts +4 -0
  157. package/dist/types/src/parser/index.d.ts.map +1 -0
  158. package/dist/types/src/parser/query-parser.d.ts +15 -0
  159. package/dist/types/src/parser/query-parser.d.ts.map +1 -0
  160. package/dist/types/src/parser/query-parser.test.d.ts +2 -0
  161. package/dist/types/src/parser/query-parser.test.d.ts.map +1 -0
  162. package/dist/types/src/parser/types.d.ts +24 -0
  163. package/dist/types/src/parser/types.d.ts.map +1 -0
  164. package/dist/types/src/stories/Prompt.stories.d.ts +8 -0
  165. package/dist/types/src/stories/Prompt.stories.d.ts.map +1 -0
  166. package/dist/types/src/stories/Query.stories.d.ts +19 -0
  167. package/dist/types/src/stories/Query.stories.d.ts.map +1 -0
  168. package/dist/types/src/stories/Research.stories.d.ts +15 -0
  169. package/dist/types/src/stories/Research.stories.d.ts.map +1 -0
  170. package/dist/types/src/stories/test-data.d.ts +3 -0
  171. package/dist/types/src/stories/test-data.d.ts.map +1 -0
  172. package/dist/types/src/stories/testing.d.ts +12 -0
  173. package/dist/types/src/stories/testing.d.ts.map +1 -0
  174. package/dist/types/src/testing/blueprint.d.ts +7 -0
  175. package/dist/types/src/testing/blueprint.d.ts.map +1 -0
  176. package/dist/types/src/testing/index.d.ts +1 -0
  177. package/dist/types/src/testing/index.d.ts.map +1 -1
  178. package/dist/types/src/testing/test-functions.d.ts +1 -1
  179. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  180. package/dist/types/src/tools/function.d.ts +4 -4
  181. package/dist/types/src/tools/function.d.ts.map +1 -1
  182. package/dist/types/src/tools/openapi.d.ts +3 -3
  183. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  184. package/dist/types/src/translations.d.ts +63 -6
  185. package/dist/types/src/translations.d.ts.map +1 -1
  186. package/dist/types/src/types/chat.d.ts +18 -8
  187. package/dist/types/src/types/chat.d.ts.map +1 -1
  188. package/dist/types/src/types/types.d.ts +6 -3
  189. package/dist/types/src/types/types.d.ts.map +1 -1
  190. package/package.json +73 -61
  191. package/src/AssistantPlugin.tsx +5 -4
  192. package/src/capabilities/ai-client.ts +1 -1
  193. package/src/capabilities/app-graph-builder.ts +34 -24
  194. package/src/capabilities/capabilities.ts +1 -1
  195. package/src/capabilities/intent-resolver.ts +3 -2
  196. package/src/capabilities/react-surface.tsx +58 -13
  197. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -1
  198. package/src/components/AmbientDialog/AmbientDialog.tsx +27 -13
  199. package/src/components/AssistantDialog.tsx +1 -1
  200. package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
  201. package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +32 -0
  202. package/src/components/BlueprintEditor/BlueprintEditor.tsx +41 -0
  203. package/src/components/BlueprintEditor/index.ts +5 -0
  204. package/src/components/Prompt/Prompt.stories.tsx +59 -52
  205. package/src/components/Prompt/Prompt.tsx +24 -10
  206. package/src/components/Prompt/PromptBar.stories.tsx +68 -0
  207. package/src/components/Prompt/PromptBar.tsx +82 -80
  208. package/src/components/Prompt/autocomplete.ts +14 -8
  209. package/src/components/Prompt/references.ts +3 -3
  210. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  211. package/src/components/TemplateEditor/TemplateForm.stories.tsx +1 -1
  212. package/src/components/Thread/Thread.stories.tsx +2 -2
  213. package/src/components/Thread/Thread.tsx +2 -2
  214. package/src/components/Thread/ThreadContainer.stories.tsx +77 -47
  215. package/src/components/Thread/ThreadContainer.tsx +8 -9
  216. package/src/components/Thread/ThreadMessage.tsx +43 -8
  217. package/src/components/Thread/ToolInvocations.tsx +9 -7
  218. package/src/components/Thread/reducer.ts +1 -1
  219. package/src/components/Toolbox/Toolbox.stories.tsx +1 -1
  220. package/src/components/Toolbox/Toolbox.tsx +2 -1
  221. package/src/components/index.ts +2 -0
  222. package/src/experimental/transcription/index.ts +3 -0
  223. package/src/hooks/processor.ts +65 -27
  224. package/src/hooks/useChatProcessor.tsx +4 -4
  225. package/src/hooks/useContextProvider.ts +6 -6
  226. package/src/hooks/useMessageQueue.ts +4 -4
  227. package/src/meta.ts +2 -2
  228. package/src/parser/filter-generator.test.ts +32 -0
  229. package/src/parser/filter-generator.ts +81 -0
  230. package/src/parser/index.ts +7 -0
  231. package/src/parser/query-parser.test.ts +139 -0
  232. package/src/parser/query-parser.ts +199 -0
  233. package/src/parser/types.ts +34 -0
  234. package/src/shims.d.ts +8 -0
  235. package/src/stories/Prompt.stories.tsx +59 -0
  236. package/src/stories/Query.stories.tsx +448 -0
  237. package/src/stories/Research.stories.tsx +495 -0
  238. package/src/stories/test-data.ts +128 -0
  239. package/src/stories/testing.ts +64 -0
  240. package/src/testing/blueprint.ts +47 -0
  241. package/src/testing/index.ts +1 -0
  242. package/src/testing/test-functions.ts +1 -1
  243. package/src/tools/function.ts +8 -7
  244. package/src/tools/openapi.test.ts +18 -19
  245. package/src/tools/openapi.ts +20 -14
  246. package/src/translations.ts +4 -2
  247. package/src/types/chat.ts +27 -4
  248. package/src/types/types.ts +3 -1
  249. package/dist/lib/browser/AssistantDialog-DTWVEQBB.mjs +0 -117
  250. package/dist/lib/browser/AssistantDialog-DTWVEQBB.mjs.map +0 -7
  251. package/dist/lib/browser/ChatContainer-ZNKENYKZ.mjs +0 -33
  252. package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
  253. package/dist/lib/browser/ai-client-5PRCXI7N.mjs.map +0 -7
  254. package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs.map +0 -7
  255. package/dist/lib/browser/chunk-5P7U35RJ.mjs +0 -192
  256. package/dist/lib/browser/chunk-5P7U35RJ.mjs.map +0 -7
  257. package/dist/lib/browser/chunk-7VDZP5WX.mjs +0 -143
  258. package/dist/lib/browser/chunk-7VDZP5WX.mjs.map +0 -7
  259. package/dist/lib/browser/chunk-NFUHCW2J.mjs +0 -81
  260. package/dist/lib/browser/chunk-OWZHLWW5.mjs.map +0 -7
  261. package/dist/lib/browser/chunk-TXJWGWJ7.mjs.map +0 -7
  262. package/dist/lib/browser/intent-resolver-QV5AAVJZ.mjs.map +0 -7
  263. package/dist/lib/browser/react-surface-JJPYWEIN.mjs +0 -90
  264. package/dist/lib/browser/react-surface-JJPYWEIN.mjs.map +0 -7
  265. package/dist/lib/node/AssistantDialog-RJJHZI63.cjs +0 -141
  266. package/dist/lib/node/AssistantDialog-RJJHZI63.cjs.map +0 -7
  267. package/dist/lib/node/ai-client-OUPSRQT7.cjs.map +0 -7
  268. package/dist/lib/node/app-graph-builder-LEO63CZZ.cjs.map +0 -7
  269. package/dist/lib/node/chunk-GBUNQ257.cjs.map +0 -7
  270. package/dist/lib/node/chunk-GQ3XS5FZ.cjs +0 -169
  271. package/dist/lib/node/chunk-GQ3XS5FZ.cjs.map +0 -7
  272. package/dist/lib/node/chunk-OOHFSPWR.cjs.map +0 -7
  273. package/dist/lib/node/chunk-VG2UQY4S.cjs +0 -216
  274. package/dist/lib/node/chunk-VG2UQY4S.cjs.map +0 -7
  275. package/dist/lib/node/intent-resolver-QDGZMWLY.cjs.map +0 -7
  276. package/dist/lib/node/react-surface-XNEIJJYJ.cjs +0 -106
  277. package/dist/lib/node/react-surface-XNEIJJYJ.cjs.map +0 -7
  278. package/dist/lib/node-esm/AssistantDialog-D33WZUGR.mjs +0 -118
  279. package/dist/lib/node-esm/AssistantDialog-D33WZUGR.mjs.map +0 -7
  280. package/dist/lib/node-esm/ChatContainer-FAYGNMQW.mjs +0 -34
  281. package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
  282. package/dist/lib/node-esm/ai-client-RZQWEDUX.mjs.map +0 -7
  283. package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs.map +0 -7
  284. package/dist/lib/node-esm/chunk-6JK5HEUQ.mjs.map +0 -7
  285. package/dist/lib/node-esm/chunk-74GFINWJ.mjs +0 -144
  286. package/dist/lib/node-esm/chunk-74GFINWJ.mjs.map +0 -7
  287. package/dist/lib/node-esm/chunk-ED55ZE4G.mjs.map +0 -7
  288. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs +0 -193
  289. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs.map +0 -7
  290. package/dist/lib/node-esm/intent-resolver-Q3I6S6HN.mjs.map +0 -7
  291. package/dist/lib/node-esm/react-surface-RI3JONQY.mjs +0 -91
  292. package/dist/lib/node-esm/react-surface-RI3JONQY.mjs.map +0 -7
  293. /package/dist/lib/browser/{settings-OZX7J65A.mjs.map → settings-SHNQ4XXP.mjs.map} +0 -0
  294. /package/dist/lib/node/{settings-WLTC7XO5.cjs.map → settings-ERKLO6IO.cjs.map} +0 -0
  295. /package/dist/lib/node-esm/{settings-CLE57WEP.mjs.map → settings-IVQRZUCU.mjs.map} +0 -0
@@ -7,6 +7,7 @@ import '@dxos-theme';
7
7
  import { type StoryObj, type Meta } from '@storybook/react';
8
8
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
9
9
 
10
+ import { AIServiceEdgeClient, Message } from '@dxos/ai';
10
11
  import {
11
12
  Capabilities,
12
13
  Events,
@@ -17,22 +18,22 @@ import {
17
18
  useIntentDispatcher,
18
19
  } from '@dxos/app-framework';
19
20
  import { withPluginManager } from '@dxos/app-framework/testing';
20
- import { Message, type Tool } from '@dxos/artifact';
21
- import { genericTools, localServiceEndpoints } from '@dxos/artifact-testing';
22
- import { AIServiceEdgeClient } from '@dxos/assistant';
23
- import { DXN, Type } from '@dxos/echo';
24
- import { createQueueDxn, create } from '@dxos/echo-schema';
21
+ import { remoteServiceEndpoints } from '@dxos/artifact-testing';
22
+ import { Type, type Obj } from '@dxos/echo';
23
+ import { createQueueDxn, create, Query, Filter } from '@dxos/echo-schema';
25
24
  import { invariant } from '@dxos/invariant';
26
25
  import { ChessPlugin } from '@dxos/plugin-chess';
27
26
  import { ChessType } from '@dxos/plugin-chess/types';
28
27
  import { ClientPlugin } from '@dxos/plugin-client';
29
28
  import { InboxPlugin } from '@dxos/plugin-inbox';
30
29
  import { MapPlugin } from '@dxos/plugin-map';
30
+ import { MarkdownPlugin } from '@dxos/plugin-markdown';
31
31
  import { SpacePlugin } from '@dxos/plugin-space';
32
32
  import { TablePlugin } from '@dxos/plugin-table';
33
- import { useQueue, useSpace } from '@dxos/react-client/echo';
33
+ import { useClient } from '@dxos/react-client';
34
+ import { useQueue, useQuery } from '@dxos/react-client/echo';
34
35
  import { IconButton, Input, Toolbar } from '@dxos/react-ui';
35
- import { mx } from '@dxos/react-ui-theme';
36
+ import { descriptionMessage, mx } from '@dxos/react-ui-theme';
36
37
  import { withLayout, withTheme } from '@dxos/storybook-utils';
37
38
 
38
39
  import { Thread, type ThreadProps } from './Thread';
@@ -40,18 +41,22 @@ import { ChatProcessor } from '../../hooks';
40
41
  import { createProcessorOptions } from '../../testing';
41
42
  import translations from '../../translations';
42
43
 
43
- const endpoints = localServiceEndpoints;
44
+ // TODO(burdon): Configure for local with ollama/LM studio.
45
+ // const endpoints = localServiceEndpoints;
46
+ const endpoints = remoteServiceEndpoints;
44
47
 
45
48
  type RenderProps = {
46
- items?: Type.AnyObject[];
49
+ items?: Obj.Any[];
47
50
  prompts?: string[];
48
51
  } & Pick<ThreadProps, 'debug'>;
49
52
 
50
53
  // TODO(burdon): Use ChatContainer.
51
54
  const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) => {
52
- const space = useSpace();
55
+ const client = useClient();
56
+ const space = client.spaces.default;
57
+
53
58
  const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
54
- const tools = useMemo<Tool[]>(() => [...genericTools], []);
59
+ const tools = useCapabilities(Capabilities.Tools);
55
60
 
56
61
  const [aiClient] = useState(() => new AIServiceEdgeClient({ endpoint: endpoints.ai }));
57
62
  const { dispatchPromise: dispatch } = useIntentDispatcher();
@@ -65,7 +70,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
65
70
 
66
71
  return new ChatProcessor(
67
72
  aiClient,
68
- tools,
73
+ tools.flat(),
69
74
  artifactDefinitions,
70
75
  {
71
76
  space,
@@ -76,11 +81,17 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
76
81
  }, [aiClient, tools, space, dispatch, artifactDefinitions]);
77
82
 
78
83
  // Queue.
79
- const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn().toString());
80
- const queue = useQueue<Message>(DXN.tryParse(queueDxn));
84
+ const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn(space.id).toString());
85
+ const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
86
+
87
+ useEffect(() => {
88
+ if (space) {
89
+ setQueueDxn(createQueueDxn(space.id).toString());
90
+ }
91
+ }, [space]);
81
92
 
82
93
  useEffect(() => {
83
- if (queue?.items.length === 0 && !queue.isLoading && prompts.length > 0) {
94
+ if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
84
95
  queue.append([
85
96
  create(Message, {
86
97
  role: 'assistant',
@@ -95,38 +106,38 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
95
106
  }),
96
107
  ]);
97
108
  }
98
- }, [queueDxn, prompts, queue?.items.length, queue?.isLoading]);
109
+ }, [queueDxn, prompts, queue?.objects.length, queue?.isLoading]);
99
110
 
100
111
  // State.
101
- const artifactItems: any[] = []; // TODO(burdon): Query from space.
102
- const messages = [...(queue?.items ?? []), ...(processor?.messages.value ?? [])];
103
-
104
- const handleSubmit = processor
105
- ? (message: string) => {
106
- requestAnimationFrame(async () => {
107
- invariant(processor);
108
- if (processor.streaming.value) {
109
- await processor.cancel();
110
- }
111
-
112
- invariant(queue);
113
- await processor.request(message, {
114
- history: queue.items,
115
- onComplete: (messages) => {
116
- queue.append(messages);
117
- },
118
- });
119
- });
112
+ const query = useMemo(
113
+ () => Query.select(Filter.or(...artifactDefinitions.map((definition) => Filter.type(definition.schema)))),
114
+ [artifactDefinitions],
115
+ );
116
+ const artifactItems = useQuery(space, query);
117
+ const messages = [...(queue?.objects ?? []), ...(processor?.messages.value ?? [])];
118
+
119
+ const handleSubmit = useCallback(
120
+ (message: string) => {
121
+ requestAnimationFrame(async () => {
122
+ if (!processor || !queue) {
123
+ return;
124
+ }
125
+
126
+ if (processor.streaming.value) {
127
+ await processor.cancel();
128
+ }
120
129
 
121
- return true;
122
- }
123
- : undefined;
130
+ await processor.request(message, {
131
+ history: queue.objects,
132
+ onComplete: (messages) => {
133
+ queue.append(messages);
134
+ },
135
+ });
136
+ });
124
137
 
125
- const handlePrompt = useCallback(
126
- (text: string) => {
127
- void handleSubmit?.(text);
138
+ return true;
128
139
  },
129
- [handleSubmit],
140
+ [processor, queue],
130
141
  );
131
142
 
132
143
  const handleDelete = useCallback(
@@ -137,6 +148,10 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
137
148
  [queue],
138
149
  );
139
150
 
151
+ if (!space) {
152
+ return <></>;
153
+ }
154
+
140
155
  return (
141
156
  <div className='grid grid-cols-2 w-full h-full divide-x divide-separator overflow-hidden'>
142
157
  {/* Thread */}
@@ -159,7 +174,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
159
174
  iconOnly
160
175
  label='Clear history'
161
176
  icon='ph--trash--regular'
162
- onClick={() => setQueueDxn(createQueueDxn().toString())}
177
+ onClick={() => setQueueDxn(createQueueDxn(space.id).toString())}
163
178
  />
164
179
  <IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
165
180
  </Input.Root>
@@ -172,7 +187,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
172
187
  error={processor?.error.value}
173
188
  tools={processor?.tools}
174
189
  onSubmit={processor ? handleSubmit : undefined}
175
- onPrompt={processor ? handlePrompt : undefined}
190
+ onPrompt={processor ? handleSubmit : undefined}
176
191
  onDelete={processor ? handleDelete : undefined}
177
192
  {...props}
178
193
  />
@@ -182,7 +197,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
182
197
  <div className='overflow-hidden grid grid-rows-[2fr_1fr] divide-y divide-separator'>
183
198
  {artifactItems.length > 0 && (
184
199
  <div className={mx('flex grow overflow-hidden', artifactItems.length === 1 && 'row-span-2')}>
185
- <Surface role='canvas-node' limit={1} data={artifactItems[0]} />
200
+ <Surface role='article' limit={1} data={{ subject: artifactItems[0] }} fallback={Fallback} />
186
201
  </div>
187
202
  )}
188
203
 
@@ -190,7 +205,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
190
205
  <div className='flex shrink-0 overflow-hidden divide-x divide-separator'>
191
206
  <div className='flex flex-1 h-full'>
192
207
  {artifactItems.slice(1, 3).map((item, idx) => (
193
- <Surface key={idx} role='canvas-node' limit={1} data={item} />
208
+ <Surface key={idx} role='article' limit={1} data={{ subject: item }} fallback={Fallback} />
194
209
  ))}
195
210
  </div>
196
211
  </div>
@@ -201,7 +216,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
201
216
  };
202
217
 
203
218
  const meta: Meta<typeof DefaultStory> = {
204
- title: 'plugins/plugin-automation/ThreadContainer',
219
+ title: 'plugins/plugin-assistant/ThreadContainer',
205
220
  render: DefaultStory,
206
221
  decorators: [
207
222
  withPluginManager({
@@ -219,6 +234,7 @@ const meta: Meta<typeof DefaultStory> = {
219
234
  ChessPlugin(),
220
235
  InboxPlugin(),
221
236
  MapPlugin(),
237
+ MarkdownPlugin(),
222
238
  TablePlugin(),
223
239
  ],
224
240
  fireEvents: [Events.SetupArtifactDefinition],
@@ -252,3 +268,17 @@ export const WithInitialItems: Story = {
252
268
  ],
253
269
  },
254
270
  };
271
+
272
+ const Fallback = ({ error }: { error?: Error }) => {
273
+ const errorString = error?.toString() ?? '';
274
+ return (
275
+ <div role='none' className='overflow-auto p-8 attention-surface grid place-items-center'>
276
+ <p
277
+ role='alert'
278
+ className={mx(descriptionMessage, 'break-words rounded-lg p-8', errorString.length < 256 && 'text-lg')}
279
+ >
280
+ {error ? errorString : 'error'}
281
+ </p>
282
+ </div>
283
+ );
284
+ };
@@ -8,7 +8,7 @@ import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/a
8
8
  import { type AssociatedArtifact } from '@dxos/artifact';
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { DXN } from '@dxos/keys';
11
- import { makeRef, refFromDXN } from '@dxos/live-object';
11
+ import { refFromDXN } from '@dxos/live-object';
12
12
  import { log } from '@dxos/log';
13
13
  import { getSpace } from '@dxos/react-client/echo';
14
14
  import { type ThemedClassName } from '@dxos/react-ui';
@@ -22,7 +22,7 @@ export type ThreadContainerProps = {
22
22
  settings?: AssistantSettingsProps;
23
23
  part?: 'deck' | 'dialog';
24
24
  associatedArtifact?: AssociatedArtifact;
25
- } & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange'>;
25
+ } & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange' | 'onAddToGraph'>;
26
26
 
27
27
  // TODO(burdon): Since this only wraps Thread, just separate out hook?
28
28
  export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
@@ -40,18 +40,17 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
40
40
  const messageQueue = useMessageQueue(chat);
41
41
  const { dispatchPromise: dispatch } = useIntentDispatcher();
42
42
  // TODO(thure): This will be referentially new on every render, is it causing overreactivity?
43
- const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
43
+ const messages = [...(messageQueue?.objects ?? []), ...processor.messages.value];
44
44
 
45
45
  // Post last message to document.
46
46
  useEffect(() => {
47
- if (!processor.streaming.value && messageQueue?.items) {
48
- const message = messageQueue.items[messageQueue.items.length - 1];
47
+ if (!processor.streaming.value && messageQueue?.objects) {
48
+ const message = messageQueue.objects[messageQueue.objects.length - 1];
49
49
  if (space && chat && message && dispatch && associatedArtifact) {
50
50
  void dispatch(
51
51
  createIntent(CollaborationActions.InsertContent, {
52
- spaceId: space.id,
53
- target: makeRef(associatedArtifact),
54
- object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.assistantChatQueue.dxn.parts, message.id])),
52
+ target: associatedArtifact,
53
+ object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.queue.dxn.parts, message.id])),
55
54
  label: 'View proposal',
56
55
  }),
57
56
  );
@@ -71,7 +70,7 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
71
70
 
72
71
  invariant(messageQueue);
73
72
  void processor.request(text, {
74
- history: messageQueue.items,
73
+ history: messageQueue.objects,
75
74
  onComplete: (messages) => {
76
75
  messageQueue.append(messages);
77
76
  },
@@ -2,9 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { type PropsWithChildren, type FC } from 'react';
5
+ import React, { type FC, type PropsWithChildren } from 'react';
6
6
 
7
- import { type MessageContentBlock, type Message, type ToolType } from '@dxos/artifact';
7
+ import { type MessageContentBlock, type Message, type Tool } from '@dxos/ai';
8
+ import { Surface } from '@dxos/app-framework';
9
+ import type { BaseEchoObject } from '@dxos/echo-schema';
8
10
  import { invariant } from '@dxos/invariant';
9
11
  import { type Space } from '@dxos/react-client/echo';
10
12
  import { Button, Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
@@ -20,7 +22,7 @@ import { safeParseJson } from '@dxos/util';
20
22
  import { ToolBlock, isToolMessage } from './ToolInvocations';
21
23
  import { ToolboxContainer } from '../Toolbox';
22
24
 
23
- const panelClassNames = 'flex flex-col w-full px-2 bg-groupSurface rounded-md';
25
+ const panelClassNames = 'flex flex-col w-full px-2 bg-activeSurface rounded-md';
24
26
  const userClassNames = 'bg-[--user-fill] text-accentSurfaceText';
25
27
 
26
28
  const ToggleContainer = (props: ToggleContainerProps) => {
@@ -43,12 +45,20 @@ export type ThreadMessageProps = ThemedClassName<{
43
45
  space?: Space;
44
46
  message: Message;
45
47
  debug?: boolean;
46
- tools?: ToolType[];
48
+ tools?: Tool[];
47
49
  onPrompt?: (text: string) => void;
48
50
  onDelete?: (id: string) => void;
51
+ onAddToGraph?: (object: BaseEchoObject) => void;
49
52
  }>;
50
53
 
51
- export const ThreadMessage: FC<ThreadMessageProps> = ({ classNames, space, message, tools, onPrompt }) => {
54
+ export const ThreadMessage: FC<ThreadMessageProps> = ({
55
+ classNames,
56
+ space,
57
+ message,
58
+ tools,
59
+ onPrompt,
60
+ onAddToGraph,
61
+ }) => {
52
62
  const { role, content = [] } = message;
53
63
 
54
64
  // TODO(burdon): Restructure types to make check unnecessary.
@@ -74,13 +84,18 @@ export const ThreadMessage: FC<ThreadMessageProps> = ({ classNames, space, messa
74
84
  classNames={mx(classNames, 'animate-[fadeIn_0.5s]')}
75
85
  user={block.type === 'text' && role === 'user'}
76
86
  >
77
- <Component space={space} block={block} onPrompt={onPrompt} />
87
+ <Component space={space} block={block} onPrompt={onPrompt} onAddToGraph={onAddToGraph} />
78
88
  </MessageContainer>
79
89
  );
80
90
  });
81
91
  };
82
92
 
83
- type BlockComponent = FC<{ space?: Space; block: MessageContentBlock; onPrompt?: (text: string) => void }>;
93
+ type BlockComponent = FC<{
94
+ space?: Space;
95
+ block: MessageContentBlock;
96
+ onPrompt?: (text: string) => void;
97
+ onAddToGraph?: (object: BaseEchoObject) => void;
98
+ }>;
84
99
 
85
100
  const components: Record<string, BlockComponent> = {
86
101
  //
@@ -124,7 +139,7 @@ const components: Record<string, BlockComponent> = {
124
139
  //
125
140
  // JSON
126
141
  //
127
- ['json' as const]: ({ space, block, onPrompt }) => {
142
+ ['json' as const]: ({ space, block, onPrompt, onAddToGraph }) => {
128
143
  invariant(block.type === 'json');
129
144
 
130
145
  switch (block.disposition) {
@@ -158,6 +173,26 @@ const components: Record<string, BlockComponent> = {
158
173
  );
159
174
  }
160
175
 
176
+ case 'graph': {
177
+ return (
178
+ <div className='flex flex-wrap gap-1'>
179
+ <Surface
180
+ role='card'
181
+ data={{ subject: JSON.parse(block.json ?? '{}') }}
182
+ limit={1}
183
+ fallback={<div className='font-mono text-xs text-pre'>{block.json}</div>}
184
+ />
185
+ {onAddToGraph && (
186
+ <IconButton
187
+ icon='ph--plus--regular'
188
+ label='Add to graph'
189
+ onClick={() => onAddToGraph?.(JSON.parse(block.json ?? '{}'))}
190
+ />
191
+ )}
192
+ </div>
193
+ );
194
+ }
195
+
161
196
  default: {
162
197
  const title = block.disposition ? titles[block.disposition] : undefined;
163
198
  return (
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
- import { type Message, type ToolType } from '@dxos/artifact';
7
+ import { type AgentStatus, type Message, type Tool } from '@dxos/ai';
8
8
  import { log } from '@dxos/log';
9
9
  import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
@@ -17,22 +17,22 @@ export const isToolMessage = (message: Message) => {
17
17
  return message.content.some((block) => block.type === 'tool_use' || block.type === 'tool_result');
18
18
  };
19
19
 
20
- const getToolName = (tool: ToolType) => {
20
+ const getToolName = (tool: Tool) => {
21
21
  return tool.namespace && tool.function ? `${tool.namespace}:${tool.function}` : tool.name.split('_').pop();
22
22
  };
23
23
 
24
- const getToolCaption = (tool: ToolType | undefined) => {
24
+ const getToolCaption = (tool: Tool | undefined, status: AgentStatus | undefined) => {
25
25
  if (!tool) {
26
26
  return 'Calling tool...';
27
27
  }
28
28
 
29
- return tool.caption ?? `Calling ${getToolName(tool)}...`;
29
+ return status?.message ?? tool.caption ?? `Calling ${getToolName(tool)}...`;
30
30
  };
31
31
 
32
32
  export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames, message, tools }) => {
33
33
  const { content = [] } = message;
34
34
 
35
- let request: { tool: ToolType | undefined; block: any } | undefined;
35
+ let request: { tool: Tool | undefined; block: any } | undefined;
36
36
  const blocks = content.filter((block) => block.type === 'tool_use' || block.type === 'tool_result');
37
37
  const items = blocks
38
38
  .map((block) => {
@@ -43,8 +43,10 @@ export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames,
43
43
  return null;
44
44
  }
45
45
 
46
+ log.info('tool_use', { tool: request?.tool, status: block.currentStatus });
47
+
46
48
  request = { tool: tools?.find((tool) => tool.name === block.name), block };
47
- return { title: getToolCaption(request.tool), block };
49
+ return { title: getToolCaption(request.tool, block.currentStatus), block };
48
50
  }
49
51
 
50
52
  case 'tool_result': {
@@ -53,7 +55,7 @@ export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames,
53
55
  return { title: 'Error', block };
54
56
  }
55
57
 
56
- return { title: `${getToolCaption(request.tool)} (Success)`, block };
58
+ return { title: `${getToolCaption(request.tool, undefined)} (Success)`, block };
57
59
  }
58
60
 
59
61
  default: {
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { type Message } from '@dxos/artifact';
5
+ import { type Message } from '@dxos/ai';
6
6
 
7
7
  // TODO(burdon): Move to util?
8
8
  type Reducer<R, I> = (acc: R, value: I) => R;
@@ -32,7 +32,7 @@ const DefaultStory = (props: ToolboxProps) => {
32
32
  };
33
33
 
34
34
  const meta: Meta<typeof Toolbox> = {
35
- title: 'plugins/plugin-automation/Toolbox',
35
+ title: 'plugins/plugin-assistant/Toolbox',
36
36
  component: Toolbox,
37
37
  render: DefaultStory,
38
38
  decorators: [
@@ -4,8 +4,9 @@
4
4
 
5
5
  import React, { useState, useEffect, Fragment, type FC } from 'react';
6
6
 
7
+ import { parseToolName, type Tool } from '@dxos/ai';
7
8
  import { Capabilities, useCapabilities } from '@dxos/app-framework';
8
- import { parseToolName, type ArtifactDefinition, type Tool } from '@dxos/artifact';
9
+ import { type ArtifactDefinition } from '@dxos/artifact';
9
10
  import { FunctionType } from '@dxos/functions';
10
11
  import { log } from '@dxos/log';
11
12
  import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
@@ -4,7 +4,9 @@
4
4
 
5
5
  import { lazy } from 'react';
6
6
 
7
+ export * from './AmbientDialog';
7
8
  export * from './AssistantSettings';
9
+ export * from './Prompt';
8
10
  export * from './PromptSettings';
9
11
  export * from './TemplateEditor';
10
12
  export * from './Thread';
@@ -0,0 +1,3 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
@@ -4,12 +4,21 @@
4
4
 
5
5
  import { type Signal, batch, computed, signal } from '@preact/signals-core';
6
6
 
7
+ import {
8
+ DEFAULT_EDGE_MODEL,
9
+ type ExecutableTool,
10
+ type AIServiceClient,
11
+ type GenerateRequest,
12
+ type Message,
13
+ type MessageContentBlock,
14
+ type ToolUseContentBlock,
15
+ } from '@dxos/ai';
7
16
  import { type PromiseIntentDispatcher } from '@dxos/app-framework';
8
- import { type ArtifactDefinition, type Message, type MessageContentBlock, type Tool } from '@dxos/artifact';
9
- import { type AIServiceClient, AISession, DEFAULT_EDGE_MODEL, type GenerateRequest } from '@dxos/assistant';
17
+ import { type ArtifactDefinition } from '@dxos/artifact';
18
+ import { AISession, type ArtifactDiffResolver } from '@dxos/assistant';
10
19
  import { invariant } from '@dxos/invariant';
11
20
  import { log } from '@dxos/log';
12
- import { getVersion, type Space } from '@dxos/react-client/echo';
21
+ import { Filter, getVersion, type Space } from '@dxos/react-client/echo';
13
22
 
14
23
  // TODO(burdon): Factor out.
15
24
  declare global {
@@ -78,7 +87,7 @@ export class ChatProcessor {
78
87
 
79
88
  constructor(
80
89
  private readonly _ai: AIServiceClient,
81
- private _tools?: Tool[],
90
+ private _tools?: ExecutableTool[],
82
91
  private _artifacts?: ArtifactDefinition[],
83
92
  private readonly _extensions?: ToolContextExtensions,
84
93
  private readonly _options: ChatProcessorOptions = defaultOptions,
@@ -91,7 +100,7 @@ export class ChatProcessor {
91
100
  /**
92
101
  * Update tools.
93
102
  */
94
- setTools(tools: Tool[]) {
103
+ setTools(tools: ExecutableTool[]): void {
95
104
  this._tools = tools;
96
105
  }
97
106
 
@@ -120,6 +129,33 @@ export class ChatProcessor {
120
129
  this._pending.value = [...this._pending.value, message];
121
130
  });
122
131
 
132
+ this._session.toolStatusReport.on(({ message, status }) => {
133
+ const msg = this._pending.peek().find((m) => m.id === message.id);
134
+ const toolUse = msg?.content.find((block) => block.type === 'tool_use');
135
+ if (!toolUse) {
136
+ return;
137
+ }
138
+
139
+ const block = msg?.content.find(
140
+ (block): block is ToolUseContentBlock => block.type === 'tool_use' && block.id === toolUse.id,
141
+ );
142
+ if (block) {
143
+ this._pending.value = this._pending.value.map((m) => {
144
+ if (m.id === message.id) {
145
+ return {
146
+ ...m,
147
+ content: m.content.map((b) =>
148
+ b.type === 'tool_use' && b.id === toolUse.id ? { ...b, currentStatus: status } : b,
149
+ ),
150
+ };
151
+ }
152
+ return m;
153
+ });
154
+ } else {
155
+ log.warn('no block for status report');
156
+ }
157
+ });
158
+
123
159
  try {
124
160
  const messages = await this._session.run({
125
161
  client: this._ai,
@@ -130,28 +166,7 @@ export class ChatProcessor {
130
166
  prompt: message,
131
167
  systemPrompt: this._options.systemPrompt,
132
168
  extensions: this._extensions,
133
- artifactDiffResolver: async (artifacts) => {
134
- const space = this._extensions?.space;
135
- if (!space) {
136
- return new Map();
137
- }
138
- const versions = new Map();
139
- await Promise.all(
140
- artifacts.map(async (artifact) => {
141
- const {
142
- objects: [object],
143
- } = await space.db.query({ id: artifact.id }).run();
144
- if (!object) {
145
- return;
146
- }
147
- versions.set(artifact.id, {
148
- version: getVersion(object),
149
- diff: `Current state: ${JSON.stringify(object)}`,
150
- });
151
- }),
152
- );
153
- return versions;
154
- },
169
+ artifactDiffResolver: this._artifactDiffResolver,
155
170
  generationOptions: {
156
171
  model: this._options.model,
157
172
  },
@@ -192,6 +207,29 @@ export class ChatProcessor {
192
207
 
193
208
  return messages;
194
209
  }
210
+
211
+ private _artifactDiffResolver: ArtifactDiffResolver = async (artifacts) => {
212
+ const space = this._extensions?.space;
213
+ if (!space) {
214
+ return new Map();
215
+ }
216
+ const versions = new Map();
217
+ await Promise.all(
218
+ artifacts.map(async (artifact) => {
219
+ const {
220
+ objects: [object],
221
+ } = await space.db.query(Filter.ids(artifact.id)).run();
222
+ if (!object) {
223
+ return;
224
+ }
225
+ versions.set(artifact.id, {
226
+ version: getVersion(object),
227
+ diff: `Current state: ${JSON.stringify(object)}`,
228
+ });
229
+ }),
230
+ );
231
+ return versions;
232
+ };
195
233
  }
196
234
 
197
235
  // TODO(wittjosiah): Move to ai-service-client.
@@ -4,9 +4,9 @@
4
4
 
5
5
  import { useEffect, useMemo, useState } from 'react';
6
6
 
7
+ import { DEFAULT_EDGE_MODEL, DEFAULT_OLLAMA_MODEL, type ExecutableTool } from '@dxos/ai';
7
8
  import { Capabilities, useCapabilities, useCapability, useIntentDispatcher } from '@dxos/app-framework';
8
- import { type AssociatedArtifact, createSystemPrompt, type Tool } from '@dxos/artifact';
9
- import { DEFAULT_EDGE_MODEL, DEFAULT_OLLAMA_MODEL } from '@dxos/assistant';
9
+ import { type AssociatedArtifact, createSystemPrompt } from '@dxos/artifact';
10
10
  import { FunctionType } from '@dxos/functions';
11
11
  import { log } from '@dxos/log';
12
12
  import { useConfig } from '@dxos/react-client';
@@ -44,7 +44,7 @@ export const useChatProcessor = ({
44
44
 
45
45
  // Services.
46
46
  const services = useQuery(space, Filter.type(ServiceType));
47
- const [serviceTools, setServiceTools] = useState<Tool[]>([]);
47
+ const [serviceTools, setServiceTools] = useState<ExecutableTool[]>([]);
48
48
  useEffect(() => {
49
49
  log('creating service tools...');
50
50
  queueMicrotask(async () => {
@@ -59,7 +59,7 @@ export const useChatProcessor = ({
59
59
  const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
60
60
  const [tools, extensions] = useMemo(() => {
61
61
  log('creating tools...');
62
- const tools = [
62
+ const tools: ExecutableTool[] = [
63
63
  ...globalTools.flat(),
64
64
  ...serviceTools,
65
65
  ...functions