@dxos/plugin-automation 0.7.5-staging.b81e783 → 0.8.0

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 (318) hide show
  1. package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs +132 -0
  2. package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-HZSTXZWK.mjs → chunk-OFDNNRLE.mjs} +3 -8
  4. package/dist/lib/browser/chunk-OFDNNRLE.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-U7QLNY2S.mjs +8 -0
  6. package/dist/lib/browser/chunk-U7QLNY2S.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-WY2C7JY4.mjs +119 -0
  8. package/dist/lib/browser/chunk-WY2C7JY4.mjs.map +7 -0
  9. package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +56 -0
  10. package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +18 -395
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/react-surface-SAPMN4PF.mjs +27 -0
  15. package/dist/lib/browser/react-surface-SAPMN4PF.mjs.map +7 -0
  16. package/dist/lib/node/{chunk-V4L7LTWM.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -132
  17. package/dist/lib/node/AutomationPanel-X33HHDMQ.cjs.map +7 -0
  18. package/dist/lib/node/chunk-7Q5SNGCL.cjs +148 -0
  19. package/dist/lib/node/chunk-7Q5SNGCL.cjs.map +7 -0
  20. package/dist/lib/node/chunk-CB5OB6JH.cjs +40 -0
  21. package/dist/lib/node/chunk-CB5OB6JH.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-BAQRBGOJ.cjs → chunk-ORMEYEBE.cjs} +6 -12
  23. package/dist/lib/node/chunk-ORMEYEBE.cjs.map +7 -0
  24. package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +72 -0
  25. package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +7 -0
  26. package/dist/lib/node/index.cjs +33 -396
  27. package/dist/lib/node/index.cjs.map +4 -4
  28. package/dist/lib/node/meta.json +1 -1
  29. package/dist/lib/node/{react-surface-IXKIJFRP.cjs → react-surface-2WRVAPGR.cjs} +9 -34
  30. package/dist/lib/node/react-surface-2WRVAPGR.cjs.map +7 -0
  31. package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs +133 -0
  32. package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-IG4GSWZN.mjs → chunk-6MUUH67V.mjs} +3 -8
  34. package/dist/lib/node-esm/chunk-6MUUH67V.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs +10 -0
  36. package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-UDD2VA6G.mjs +120 -0
  38. package/dist/lib/node-esm/chunk-UDD2VA6G.mjs.map +7 -0
  39. package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +57 -0
  40. package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +7 -0
  41. package/dist/lib/node-esm/index.mjs +18 -395
  42. package/dist/lib/node-esm/index.mjs.map +4 -4
  43. package/dist/lib/node-esm/meta.json +1 -1
  44. package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs +28 -0
  45. package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs.map +7 -0
  46. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  47. package/dist/types/src/capabilities/{ai-client.d.ts → complementary-panel.d.ts} +2 -3
  48. package/dist/types/src/capabilities/complementary-panel.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/index.d.ts +1 -180
  50. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  51. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  52. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  53. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  55. package/dist/types/src/components/index.d.ts +0 -11
  56. package/dist/types/src/components/index.d.ts.map +1 -1
  57. package/dist/types/src/index.d.ts +1 -3
  58. package/dist/types/src/index.d.ts.map +1 -1
  59. package/dist/types/src/meta.d.ts +0 -2
  60. package/dist/types/src/meta.d.ts.map +1 -1
  61. package/dist/types/src/testing/index.d.ts +0 -1
  62. package/dist/types/src/testing/index.d.ts.map +1 -1
  63. package/dist/types/src/testing/test-functions.d.ts +0 -2
  64. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  65. package/dist/types/src/translations.d.ts +1 -112
  66. package/dist/types/src/translations.d.ts.map +1 -1
  67. package/package.json +21 -74
  68. package/src/AutomationPlugin.tsx +7 -76
  69. package/src/capabilities/complementary-panel.ts +56 -0
  70. package/src/capabilities/index.ts +1 -5
  71. package/src/capabilities/react-surface.tsx +3 -23
  72. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
  73. package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
  74. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
  75. package/src/components/index.ts +0 -8
  76. package/src/index.ts +2 -3
  77. package/src/meta.ts +1 -4
  78. package/src/testing/index.ts +0 -1
  79. package/src/testing/test-functions.ts +0 -7
  80. package/src/translations.ts +1 -37
  81. package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs +0 -8
  82. package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs.map +0 -7
  83. package/dist/lib/browser/ChatContainer-AZPLZJ5H.mjs +0 -12
  84. package/dist/lib/browser/ChatContainer-AZPLZJ5H.mjs.map +0 -7
  85. package/dist/lib/browser/ai-client-T2PBJISL.mjs +0 -22
  86. package/dist/lib/browser/ai-client-T2PBJISL.mjs.map +0 -7
  87. package/dist/lib/browser/app-graph-builder-F22H4YBQ.mjs +0 -111
  88. package/dist/lib/browser/app-graph-builder-F22H4YBQ.mjs.map +0 -7
  89. package/dist/lib/browser/chunk-67KDIIM6.mjs +0 -15
  90. package/dist/lib/browser/chunk-67KDIIM6.mjs.map +0 -7
  91. package/dist/lib/browser/chunk-HZSTXZWK.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-L2YLAKCS.mjs +0 -151
  93. package/dist/lib/browser/chunk-L2YLAKCS.mjs.map +0 -7
  94. package/dist/lib/browser/chunk-LJ7F4KDM.mjs +0 -243
  95. package/dist/lib/browser/chunk-LJ7F4KDM.mjs.map +0 -7
  96. package/dist/lib/browser/chunk-M4MWUOUC.mjs +0 -382
  97. package/dist/lib/browser/chunk-M4MWUOUC.mjs.map +0 -7
  98. package/dist/lib/browser/chunk-U435IUIA.mjs +0 -1775
  99. package/dist/lib/browser/chunk-U435IUIA.mjs.map +0 -7
  100. package/dist/lib/browser/intent-resolver-MONKAKTY.mjs +0 -30
  101. package/dist/lib/browser/intent-resolver-MONKAKTY.mjs.map +0 -7
  102. package/dist/lib/browser/react-surface-7QWCWE4K.mjs +0 -58
  103. package/dist/lib/browser/react-surface-7QWCWE4K.mjs.map +0 -7
  104. package/dist/lib/browser/types/index.mjs +0 -24
  105. package/dist/lib/browser/types/index.mjs.map +0 -7
  106. package/dist/lib/node/AutomationPanel-6COLKRIB.cjs +0 -26
  107. package/dist/lib/node/AutomationPanel-6COLKRIB.cjs.map +0 -7
  108. package/dist/lib/node/ChatContainer-SBEUFMQ3.cjs +0 -33
  109. package/dist/lib/node/ChatContainer-SBEUFMQ3.cjs.map +0 -7
  110. package/dist/lib/node/ai-client-L5GUSAER.cjs +0 -38
  111. package/dist/lib/node/ai-client-L5GUSAER.cjs.map +0 -7
  112. package/dist/lib/node/app-graph-builder-OCSH5R6U.cjs +0 -123
  113. package/dist/lib/node/app-graph-builder-OCSH5R6U.cjs.map +0 -7
  114. package/dist/lib/node/chunk-BAQRBGOJ.cjs.map +0 -7
  115. package/dist/lib/node/chunk-BZFAEBME.cjs +0 -1747
  116. package/dist/lib/node/chunk-BZFAEBME.cjs.map +0 -7
  117. package/dist/lib/node/chunk-K3F5JNZ6.cjs +0 -394
  118. package/dist/lib/node/chunk-K3F5JNZ6.cjs.map +0 -7
  119. package/dist/lib/node/chunk-NUOYHYAF.cjs +0 -174
  120. package/dist/lib/node/chunk-NUOYHYAF.cjs.map +0 -7
  121. package/dist/lib/node/chunk-V4L7LTWM.cjs.map +0 -7
  122. package/dist/lib/node/chunk-VNBYGJ4K.cjs +0 -34
  123. package/dist/lib/node/chunk-VNBYGJ4K.cjs.map +0 -7
  124. package/dist/lib/node/intent-resolver-KQGTYVF2.cjs +0 -45
  125. package/dist/lib/node/intent-resolver-KQGTYVF2.cjs.map +0 -7
  126. package/dist/lib/node/react-surface-IXKIJFRP.cjs.map +0 -7
  127. package/dist/lib/node/types/index.cjs +0 -46
  128. package/dist/lib/node/types/index.cjs.map +0 -7
  129. package/dist/lib/node-esm/AutomationPanel-3MPIAO7R.mjs +0 -9
  130. package/dist/lib/node-esm/AutomationPanel-3MPIAO7R.mjs.map +0 -7
  131. package/dist/lib/node-esm/ChatContainer-JCDLYMDZ.mjs +0 -13
  132. package/dist/lib/node-esm/ChatContainer-JCDLYMDZ.mjs.map +0 -7
  133. package/dist/lib/node-esm/ai-client-45LZLW7V.mjs +0 -23
  134. package/dist/lib/node-esm/ai-client-45LZLW7V.mjs.map +0 -7
  135. package/dist/lib/node-esm/app-graph-builder-XSM7DETF.mjs +0 -112
  136. package/dist/lib/node-esm/app-graph-builder-XSM7DETF.mjs.map +0 -7
  137. package/dist/lib/node-esm/chunk-53FFD4VO.mjs +0 -1776
  138. package/dist/lib/node-esm/chunk-53FFD4VO.mjs.map +0 -7
  139. package/dist/lib/node-esm/chunk-AWAU4BHR.mjs +0 -244
  140. package/dist/lib/node-esm/chunk-AWAU4BHR.mjs.map +0 -7
  141. package/dist/lib/node-esm/chunk-IG4GSWZN.mjs.map +0 -7
  142. package/dist/lib/node-esm/chunk-K5NNSGIV.mjs +0 -152
  143. package/dist/lib/node-esm/chunk-K5NNSGIV.mjs.map +0 -7
  144. package/dist/lib/node-esm/chunk-RAT3GSJP.mjs +0 -383
  145. package/dist/lib/node-esm/chunk-RAT3GSJP.mjs.map +0 -7
  146. package/dist/lib/node-esm/chunk-SS7U6GCX.mjs +0 -16
  147. package/dist/lib/node-esm/chunk-SS7U6GCX.mjs.map +0 -7
  148. package/dist/lib/node-esm/intent-resolver-XSZRLU6V.mjs +0 -31
  149. package/dist/lib/node-esm/intent-resolver-XSZRLU6V.mjs.map +0 -7
  150. package/dist/lib/node-esm/react-surface-FZAAAXGR.mjs +0 -59
  151. package/dist/lib/node-esm/react-surface-FZAAAXGR.mjs.map +0 -7
  152. package/dist/lib/node-esm/types/index.mjs +0 -25
  153. package/dist/lib/node-esm/types/index.mjs.map +0 -7
  154. package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
  155. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -181
  156. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  157. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  158. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  159. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  160. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  161. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -7
  162. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
  163. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
  164. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
  165. package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
  166. package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
  167. package/dist/types/src/components/AssistantDialog/AssistantDialog.d.ts +0 -6
  168. package/dist/types/src/components/AssistantDialog/AssistantDialog.d.ts.map +0 -1
  169. package/dist/types/src/components/AssistantDialog/index.d.ts +0 -2
  170. package/dist/types/src/components/AssistantDialog/index.d.ts.map +0 -1
  171. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -6
  172. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +0 -1
  173. package/dist/types/src/components/ChatContainer/index.d.ts +0 -4
  174. package/dist/types/src/components/ChatContainer/index.d.ts.map +0 -1
  175. package/dist/types/src/components/Prompt/Prompt.d.ts +0 -13
  176. package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
  177. package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -9
  178. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
  179. package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -10
  180. package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
  181. package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -21
  182. package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
  183. package/dist/types/src/components/Prompt/index.d.ts +0 -3
  184. package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
  185. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -9
  186. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
  187. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
  188. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
  189. package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
  190. package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
  191. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
  192. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
  193. package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
  194. package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
  195. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -5
  196. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
  197. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
  198. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
  199. package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
  200. package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
  201. package/dist/types/src/components/Thread/Thread.d.ts +0 -15
  202. package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
  203. package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
  204. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
  205. package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -8
  206. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
  207. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -15
  208. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
  209. package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -13
  210. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
  211. package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
  212. package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
  213. package/dist/types/src/components/Thread/index.d.ts +0 -3
  214. package/dist/types/src/components/Thread/index.d.ts.map +0 -1
  215. package/dist/types/src/components/Thread/reducer.d.ts +0 -12
  216. package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
  217. package/dist/types/src/components/Toolbox/Toolbox.d.ts +0 -19
  218. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +0 -1
  219. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +0 -8
  220. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +0 -1
  221. package/dist/types/src/components/Toolbox/index.d.ts +0 -2
  222. package/dist/types/src/components/Toolbox/index.d.ts.map +0 -1
  223. package/dist/types/src/hooks/email.d.ts +0 -4
  224. package/dist/types/src/hooks/email.d.ts.map +0 -1
  225. package/dist/types/src/hooks/index.d.ts +0 -7
  226. package/dist/types/src/hooks/index.d.ts.map +0 -1
  227. package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
  228. package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
  229. package/dist/types/src/hooks/processor.d.ts +0 -75
  230. package/dist/types/src/hooks/processor.d.ts.map +0 -1
  231. package/dist/types/src/hooks/processor.test.d.ts +0 -2
  232. package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
  233. package/dist/types/src/hooks/useChatProcessor.d.ts +0 -7
  234. package/dist/types/src/hooks/useChatProcessor.d.ts.map +0 -1
  235. package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
  236. package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
  237. package/dist/types/src/hooks/useMessageQueue.d.ts +0 -41
  238. package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
  239. package/dist/types/src/hooks/useServices.d.ts +0 -7
  240. package/dist/types/src/hooks/useServices.d.ts.map +0 -1
  241. package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
  242. package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
  243. package/dist/types/src/presets.d.ts +0 -9
  244. package/dist/types/src/presets.d.ts.map +0 -1
  245. package/dist/types/src/testing/test-services.d.ts +0 -5
  246. package/dist/types/src/testing/test-services.d.ts.map +0 -1
  247. package/dist/types/src/tools/function.d.ts +0 -5
  248. package/dist/types/src/tools/function.d.ts.map +0 -1
  249. package/dist/types/src/tools/index.d.ts +0 -3
  250. package/dist/types/src/tools/index.d.ts.map +0 -1
  251. package/dist/types/src/tools/openapi.d.ts +0 -10
  252. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  253. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  254. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  255. package/dist/types/src/types/index.d.ts +0 -4
  256. package/dist/types/src/types/index.d.ts.map +0 -1
  257. package/dist/types/src/types/registry.d.ts +0 -10
  258. package/dist/types/src/types/registry.d.ts.map +0 -1
  259. package/dist/types/src/types/schema.d.ts +0 -221
  260. package/dist/types/src/types/schema.d.ts.map +0 -1
  261. package/dist/types/src/types/types.d.ts +0 -19
  262. package/dist/types/src/types/types.d.ts.map +0 -1
  263. package/src/capabilities/ai-client.ts +0 -19
  264. package/src/capabilities/app-graph-builder.ts +0 -100
  265. package/src/capabilities/capabilities.ts +0 -12
  266. package/src/capabilities/intent-resolver.ts +0 -26
  267. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -81
  268. package/src/components/AmbientDialog/AmbientDialog.tsx +0 -103
  269. package/src/components/AmbientDialog/index.ts +0 -5
  270. package/src/components/AssistantDialog/AssistantDialog.tsx +0 -23
  271. package/src/components/AssistantDialog/index.ts +0 -5
  272. package/src/components/ChatContainer/ChatContainer.tsx +0 -19
  273. package/src/components/ChatContainer/index.ts +0 -9
  274. package/src/components/Prompt/Prompt.stories.tsx +0 -79
  275. package/src/components/Prompt/Prompt.tsx +0 -79
  276. package/src/components/Prompt/PromptBar.tsx +0 -100
  277. package/src/components/Prompt/autocomplete.ts +0 -212
  278. package/src/components/Prompt/index.ts +0 -6
  279. package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
  280. package/src/components/PromptEditor/PromptEditor.tsx +0 -222
  281. package/src/components/PromptEditor/index.ts +0 -5
  282. package/src/components/PromptEditor/prompt-extension.ts +0 -43
  283. package/src/components/PromptEditor/types.tsx +0 -28
  284. package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
  285. package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -76
  286. package/src/components/ServiceRegistry/index.ts +0 -5
  287. package/src/components/Thread/Thread.stories.tsx +0 -210
  288. package/src/components/Thread/Thread.tsx +0 -106
  289. package/src/components/Thread/ThreadContainer.stories.tsx +0 -245
  290. package/src/components/Thread/ThreadContainer.tsx +0 -67
  291. package/src/components/Thread/ThreadMessage.tsx +0 -187
  292. package/src/components/Thread/ToolInvocations.tsx +0 -86
  293. package/src/components/Thread/index.ts +0 -6
  294. package/src/components/Thread/reducer.ts +0 -52
  295. package/src/components/Toolbox/Toolbox.stories.tsx +0 -66
  296. package/src/components/Toolbox/Toolbox.tsx +0 -89
  297. package/src/components/Toolbox/index.ts +0 -5
  298. package/src/hooks/email.ts +0 -49
  299. package/src/hooks/index.ts +0 -11
  300. package/src/hooks/invocation-handler.ts +0 -109
  301. package/src/hooks/processor.test.ts +0 -15
  302. package/src/hooks/processor.ts +0 -218
  303. package/src/hooks/useChatProcessor.tsx +0 -75
  304. package/src/hooks/useLocalTriggerManager.ts +0 -82
  305. package/src/hooks/useMessageQueue.ts +0 -23
  306. package/src/hooks/useServices.ts +0 -28
  307. package/src/hooks/useTextInputEvents.ts +0 -49
  308. package/src/presets.ts +0 -248
  309. package/src/testing/test-services.ts +0 -131
  310. package/src/tools/function.ts +0 -47
  311. package/src/tools/index.ts +0 -6
  312. package/src/tools/openapi.test.ts +0 -224
  313. package/src/tools/openapi.ts +0 -331
  314. package/src/types/index.ts +0 -7
  315. package/src/types/registry.ts +0 -26
  316. package/src/types/schema.ts +0 -132
  317. package/src/types/types.ts +0 -22
  318. package/src/typings.d.ts +0 -9
@@ -1,52 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Message } from '@dxos/artifact';
6
-
7
- // TODO(burdon): Move to util?
8
- type Reducer<R, I> = (acc: R, value: I) => R;
9
-
10
- /**
11
- * Reducer that collapses related message blocks into single messages.
12
- * For example, combines tool request/response pairs into a single message.
13
- */
14
- export const messageReducer: Reducer<{ messages: Message[]; current?: Message }, Message> = (
15
- { current, messages },
16
- message,
17
- ) => {
18
- let i = 0;
19
- for (const block of message.content) {
20
- switch (block.type) {
21
- case 'tool_use':
22
- case 'tool_result': {
23
- if (current) {
24
- current.content.push(block);
25
- } else {
26
- current = {
27
- id: [message.id, i].join('_'),
28
- role: message.role,
29
- content: [block],
30
- };
31
- messages.push(current);
32
- }
33
- break;
34
- }
35
-
36
- case 'text':
37
- default: {
38
- current = undefined;
39
- messages.push({
40
- id: [message.id, i].join('_'),
41
- role: message.role,
42
- content: [block],
43
- });
44
- break;
45
- }
46
- }
47
-
48
- i++;
49
- }
50
-
51
- return { current, messages };
52
- };
@@ -1,66 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react';
8
- import React from 'react';
9
-
10
- import { IntentPlugin, Capabilities, useCapabilities } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { capabilities } from '@dxos/artifact-testing';
13
- import { ChessPlugin } from '@dxos/plugin-chess';
14
- import { ClientPlugin } from '@dxos/plugin-client';
15
- import { MapPlugin } from '@dxos/plugin-map';
16
- import { SpacePlugin } from '@dxos/plugin-space';
17
- import { TablePlugin } from '@dxos/plugin-table';
18
- import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
19
-
20
- import { Toolbox } from './Toolbox';
21
-
22
- const Render = () => {
23
- const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
24
- return (
25
- <div>
26
- <Toolbox artifacts={artifactDefinitions} classNames='w-[30rem] h-[15rem] rounded-md border border-neutral-500' />
27
- </div>
28
- );
29
- };
30
-
31
- const meta: Meta<typeof Toolbox> = {
32
- title: 'plugins/plugin-automation/Toolbox',
33
- component: Toolbox,
34
- render: Render,
35
- decorators: [
36
- withSignals,
37
- withPluginManager({
38
- plugins: [
39
- ClientPlugin({
40
- onClientInitialized: async (_, client) => {
41
- await client.halo.createIdentity();
42
- },
43
- }),
44
- SpacePlugin({ observability: false }),
45
- IntentPlugin(),
46
- ChessPlugin(),
47
- MapPlugin(),
48
- TablePlugin(),
49
- ],
50
- capabilities,
51
- }),
52
- withTheme,
53
- withLayout({ tooltips: true }),
54
- ],
55
- parameters: {
56
- layout: 'centered',
57
- },
58
- };
59
-
60
- export default meta;
61
-
62
- type Story = Meta<typeof Toolbox>;
63
-
64
- export const Default: Story = {
65
- args: {},
66
- };
@@ -1,89 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useState, useEffect } from 'react';
6
-
7
- import { Capabilities, useCapabilities } from '@dxos/app-framework';
8
- import { type ArtifactDefinition, type Tool } from '@dxos/artifact';
9
- import { FunctionType } from '@dxos/functions';
10
- import { log } from '@dxos/log';
11
- import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
12
- import { type ThemedClassName } from '@dxos/react-ui';
13
- import { mx } from '@dxos/react-ui-theme';
14
-
15
- import { createToolsFromService } from '../../tools';
16
- import { ServiceType } from '../../types';
17
-
18
- export type ToolboxProps = ThemedClassName<{
19
- artifacts?: ArtifactDefinition[];
20
- functions?: FunctionType[];
21
- services?: { service: ServiceType; tools: Tool[] }[];
22
- striped?: boolean;
23
- }>;
24
-
25
- const stripClassNames = 'odd:bg-neutral-50 dark:odd:bg-neutral-800';
26
-
27
- export const Toolbox = ({ classNames, artifacts, functions, services, striped }: ToolboxProps) => {
28
- return (
29
- <div className={mx('flex overflow-hidden box-content py-2', classNames)}>
30
- <div className='grid grid-cols-[6rem_8rem_1fr] overflow-y-auto'>
31
- {artifacts?.map(({ id, tools, ...rest }) =>
32
- tools.map(({ name, description }, i) => (
33
- <div
34
- key={`${id}-${i}`}
35
- className={mx('col-span-full grid grid-cols-subgrid text-xs px-2', striped && stripClassNames)}
36
- >
37
- <div className='text-primary-500 truncate'>{i === 0 && id}</div>
38
- <div className='truncate'>{name}</div>
39
- <div className='text-subdued line-clamp-3'>{description}</div>
40
- </div>
41
- )),
42
- )}
43
- {functions?.map(({ name, description }) => (
44
- <div
45
- key={name}
46
- className={mx('col-span-full grid grid-cols-subgrid text-xs px-2', striped && stripClassNames)}
47
- >
48
- <div className='text-primary-500 truncate'>function</div>
49
- <div className='truncate'>{name}</div>
50
- <div className='truncate'>{description}</div>
51
- </div>
52
- ))}
53
- {services?.map(({ service, tools }) =>
54
- tools.map(({ name, description }, i) => (
55
- <div
56
- key={`${service.id}-${name}`}
57
- className={mx('col-span-full grid grid-cols-subgrid text-xs px-2', striped && stripClassNames)}
58
- >
59
- <div className='text-primary-500 truncate'>{i === 0 && service.serviceId}</div>
60
- <div className='truncate'>{name}</div>
61
- <div className='truncate'>{description}</div>
62
- </div>
63
- )),
64
- )}
65
- </div>
66
- </div>
67
- );
68
- };
69
-
70
- export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?: Space }>) => {
71
- const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
72
- const functions = useQuery(space, Filter.schema(FunctionType));
73
-
74
- const services = useQuery(space, Filter.schema(ServiceType));
75
- const [serviceTools, setServiceTools] = useState<{ service: ServiceType; tools: Tool[] }[]>([]);
76
- useEffect(() => {
77
- log('creating service tools...');
78
- queueMicrotask(async () => {
79
- const tools = await Promise.all(
80
- services.map(async (service) => ({ service, tools: await createToolsFromService(service) })),
81
- );
82
- setServiceTools(tools);
83
- });
84
- }, [services]);
85
-
86
- return (
87
- <Toolbox classNames={classNames} artifacts={artifactDefinitions} functions={functions} services={serviceTools} />
88
- );
89
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './Toolbox';
@@ -1,49 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { findObjectWithForeignKey } from '@dxos/echo-db';
6
- import { foreignKey } from '@dxos/echo-schema';
7
- import { log } from '@dxos/log';
8
- import { MailboxType } from '@dxos/plugin-inbox/types';
9
- import { MessageType } from '@dxos/plugin-space/types';
10
- import { type Space, Filter, create, makeRef } from '@dxos/react-client/echo';
11
-
12
- export const SOURCE_ID = 'hub.dxos.network/api/mailbox';
13
-
14
- export const handleEmail = async (space: Space, data: any) => {
15
- const { messages } = data;
16
-
17
- // Create mailbox if doesn't exist.
18
- const { objects: mailboxes } = await space.db.query(Filter.schema(MailboxType)).run();
19
- const mailbox = mailboxes[0] ?? space.db.add(create(MailboxType, { messages: [] }));
20
-
21
- log.info('messages', { count: messages.length, existingMailbox: mailboxes.length > 0 });
22
-
23
- const { objects } = await space.db.query(Filter.schema(MessageType)).run();
24
- for (const message of messages) {
25
- let object = findObjectWithForeignKey(objects, { source: SOURCE_ID, id: String(message.id) });
26
- if (!object) {
27
- object = space.db.add(
28
- create(
29
- MessageType,
30
- {
31
- sender: { email: message.from },
32
- timestamp: new Date(message.created).toISOString(),
33
- text: message.body,
34
- properties: {
35
- subject: message.subject,
36
- to: [{ email: message.to }],
37
- },
38
- },
39
- {
40
- keys: [foreignKey(SOURCE_ID, String(message.id))],
41
- },
42
- ),
43
- );
44
- mailbox.messages?.push(makeRef(object));
45
- }
46
- }
47
-
48
- return 200;
49
- };
@@ -1,11 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- export * from './processor';
6
-
7
- export * from './useChatProcessor';
8
- export * from './useLocalTriggerManager';
9
- export * from './useMessageQueue';
10
- export * from './useServices';
11
- export * from './useTextInputEvents';
@@ -1,109 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { sleep } from '@dxos/async';
6
- import { getObjectCore, ResultFormat } from '@dxos/echo-db';
7
- import { type AnyObjectData } from '@dxos/echo-schema';
8
- import { FunctionType } from '@dxos/functions';
9
- import { type FunctionTrigger } from '@dxos/functions';
10
- import { invariant } from '@dxos/invariant';
11
- import { DXN, LOCAL_SPACE_TAG } from '@dxos/keys';
12
- import { log } from '@dxos/log';
13
- import { type Client, type Config } from '@dxos/react-client';
14
- import { type Space } from '@dxos/react-client/echo';
15
-
16
- const MAX_RETRIES = 3;
17
- const RETRY_DELAY = 1_000;
18
-
19
- const callFunction = async (funcUrl: string, trigger: any, data: any) => {
20
- const body = { event: 'trigger', trigger, data };
21
-
22
- let retryCount = 0;
23
- while (retryCount < MAX_RETRIES) {
24
- log.info('exec', { funcUrl, body, retryCount });
25
- const response = await fetch(funcUrl, {
26
- method: 'POST',
27
- headers: {
28
- 'Content-Type': 'application/json',
29
- },
30
- body: JSON.stringify(body),
31
- });
32
-
33
- const data = await response.text();
34
- log.info('response', { status: response.status, body: data });
35
- if (response.status === 409) {
36
- retryCount++;
37
- await sleep(RETRY_DELAY * Math.min(retryCount, 2));
38
- continue;
39
- }
40
-
41
- return { status: response.status, data };
42
- }
43
- return { status: 500 };
44
- };
45
-
46
- export const invokeFunction = async (client: Client, space: Space, trigger: FunctionTrigger, data: any) => {
47
- try {
48
- invariant(trigger.spec);
49
- invariant(trigger.function);
50
-
51
- const script = await space.db.query({ id: trigger.function }, { format: ResultFormat.Plain }).first();
52
- const { objects: functions } = await space.db
53
- .query({ __typename: FunctionType.typename }, { format: ResultFormat.Plain })
54
- .run();
55
- const func = functions.find((fn) => referenceEquals(fn.source, trigger.function!)) as AnyObjectData | undefined;
56
- const funcSlug = func?.__meta.keys.find((key) => key.source === USERFUNCTIONS_META_KEY)?.id;
57
- if (!funcSlug) {
58
- log.warn('function not deployed', { scriptId: script.id, name: script.name });
59
- return 404;
60
- }
61
-
62
- const funcUrl = getFunctionUrl(client.config, funcSlug, space.id);
63
- const triggerData: AnyObjectData = {
64
- ...getObjectCore(trigger).toPlainObject(),
65
- // TODO: Remove when functions can query by DXN.
66
- promptId: trigger.meta?.prompt?.id,
67
- };
68
- // TODO: Remove when functions can add objects and easily modify collections (push, splice).
69
- return (await callFunction(funcUrl, triggerData, data)).status;
70
- } catch (err) {
71
- return 400;
72
- }
73
- };
74
-
75
- const USERFUNCTIONS_META_KEY = 'dxos.org/service/function';
76
-
77
- const getFunctionUrl = (config: Config, slug: string, spaceId?: string) => {
78
- const baseUrl = new URL('functions/', config.values.runtime?.services?.edge?.url);
79
-
80
- // Leading slashes cause the URL to be treated as an absolute path.
81
- const relativeUrl = slug.replace(/^\//, '');
82
- const url = new URL(`./${relativeUrl}`, baseUrl.toString());
83
- spaceId && url.searchParams.set('spaceId', spaceId);
84
- url.protocol = 'https';
85
- return url.toString();
86
- };
87
-
88
- // TODO(dmaretskyi): Factor out.
89
-
90
- type ReferenceLike = { '/': string } | string;
91
-
92
- const referenceEquals = (a: ReferenceLike, b: ReferenceLike): boolean => {
93
- const aDXN = toDXN(a);
94
- const bDXN = toDXN(b);
95
- return aDXN.toString() === bDXN.toString();
96
- };
97
-
98
- const toDXN = (ref: ReferenceLike): DXN => {
99
- if (typeof ref === 'string') {
100
- if (ref.startsWith('dxn:')) {
101
- return DXN.parse(ref);
102
- } else {
103
- return new DXN(DXN.kind.ECHO, [LOCAL_SPACE_TAG, ref]);
104
- }
105
- }
106
-
107
- invariant(typeof ref['/'] === 'string');
108
- return DXN.parse(ref['/']);
109
- };
@@ -1,15 +0,0 @@
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
- });
@@ -1,218 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Signal, batch, computed, signal } from '@preact/signals-core';
6
-
7
- import { type PromiseIntentDispatcher } from '@dxos/app-framework';
8
- import { type Tool, Message, type MessageContentBlock } from '@dxos/artifact';
9
- import {
10
- isToolUse,
11
- runTools,
12
- type AIServiceClientImpl,
13
- type GenerateRequest,
14
- type GenerationStream,
15
- MixedStreamParser,
16
- } from '@dxos/assistant';
17
- import { createStatic } from '@dxos/echo-schema';
18
- import { invariant } from '@dxos/invariant';
19
- import { log } from '@dxos/log';
20
- import { type Space } from '@dxos/react-client/echo';
21
-
22
- // TODO(burdon): Factor out.
23
- declare global {
24
- interface ToolContextExtensions {
25
- space?: Space;
26
- dispatch?: PromiseIntentDispatcher;
27
- }
28
- }
29
-
30
- type RequestOptions = {
31
- history?: Message[];
32
- onComplete?: (messages: Message[]) => void;
33
- };
34
-
35
- export type ChatProcessorOptions = Pick<GenerateRequest, 'model' | 'systemPrompt'>;
36
-
37
- const defaultOptions: ChatProcessorOptions = {
38
- model: '@anthropic/claude-3-5-sonnet-20241022',
39
- systemPrompt: 'you are a helpful assistant',
40
- };
41
-
42
- /**
43
- * Handles interactions with the AI service.
44
- * Maintains a queue of messages and handles streaming responses from the AI service.
45
- * Executes tools based on AI responses.
46
- * Supports cancellation of in-progress requests.
47
- */
48
- export class ChatProcessor {
49
- /** SSE stream parser. */
50
- private readonly _parser = new MixedStreamParser();
51
-
52
- /** Current streaming response (iterator). */
53
- private _stream: GenerationStream | undefined;
54
-
55
- /** Pending messages (incl. the user request). */
56
- private readonly _pending: Signal<Message[]> = signal([]);
57
-
58
- /** Current streaming block (from the AI service). */
59
- private readonly _block: Signal<MessageContentBlock | undefined> = signal(undefined);
60
-
61
- /** Prior history from queue. */
62
- private _history: Message[] = [];
63
-
64
- /**
65
- * Streaming state.
66
- * @reactive
67
- */
68
- public readonly streaming: Signal<boolean> = computed(() => this._block.value !== undefined);
69
-
70
- /**
71
- * Last error.
72
- * @reactive
73
- */
74
- public readonly error: Signal<Error | undefined> = signal(undefined);
75
-
76
- /**
77
- * Array of Messages (incl. the current message being streamed).
78
- * @reactive
79
- */
80
- public readonly messages: Signal<Message[]> = computed(() => {
81
- const messages = [...this._pending.value];
82
- if (this._block.value) {
83
- const current = messages.pop();
84
- invariant(current);
85
- const { content, ...rest } = current;
86
- const message = { ...rest, content: [...content, this._block.value] };
87
- messages.push(message);
88
- }
89
-
90
- return messages;
91
- });
92
-
93
- constructor(
94
- private readonly _client: AIServiceClientImpl,
95
- private _tools?: Tool[],
96
- private readonly _extensions?: ToolContextExtensions,
97
- private readonly _options: ChatProcessorOptions = defaultOptions,
98
- ) {
99
- // Message complete.
100
- this._parser.message.on((message) => {
101
- batch(() => {
102
- this._pending.value = [...this._pending.value, message];
103
- this._block.value = undefined;
104
- });
105
- });
106
-
107
- // Streaming update (happens before message complete).
108
- this._parser.update.on((block) => {
109
- batch(() => {
110
- this._block.value = block;
111
- });
112
- });
113
- }
114
-
115
- /**
116
- * Update tools.
117
- */
118
- setTools(tools: Tool[]) {
119
- this._tools = tools;
120
- }
121
-
122
- /**
123
- * Make GPT request.
124
- */
125
- async request(message: string, options: RequestOptions = {}): Promise<Message[]> {
126
- batch(() => {
127
- this._history = options.history ?? [];
128
- this._pending.value = [
129
- createStatic(Message, {
130
- role: 'user',
131
- content: [{ type: 'text', text: message }],
132
- }),
133
- ];
134
- this._block.value = undefined;
135
- });
136
-
137
- await this._generate();
138
- options.onComplete?.(this._pending.value);
139
- return this._reset();
140
- }
141
-
142
- /**
143
- * Cancel pending requests.
144
- * @returns Pending requests (incl. the request message).
145
- */
146
- async cancel(): Promise<Message[]> {
147
- log.info('cancelling...');
148
- this._stream?.abort();
149
- return this._reset();
150
- }
151
-
152
- private async _reset(): Promise<Message[]> {
153
- const messages = this._pending.value;
154
- batch(() => {
155
- this._history = [];
156
- this._pending.value = [];
157
- this._block.value = undefined;
158
- });
159
-
160
- return messages;
161
- }
162
-
163
- /**
164
- * Generate a response from the AI service.
165
- * Iterates over tool requests.
166
- */
167
- private async _generate() {
168
- try {
169
- let more = false;
170
- do {
171
- log.info('requesting', { history: this._history.length, messages: this._pending.value.length });
172
- this._stream = await this._client.generate({
173
- ...this._options,
174
- // TODO(burdon): Rename messages or separate history/message.
175
- history: [...this._history, ...this._pending.value],
176
- tools: this._tools,
177
- });
178
-
179
- // Wait until complete.
180
- await this._parser.parse(this._stream);
181
- await this._stream.complete();
182
-
183
- // Add messages.
184
- log.info('response', { messages: this._pending.value });
185
-
186
- // Resolve tool use locally.
187
- more = false;
188
- const message = this._pending.value.at(-1);
189
- invariant(message);
190
- if (isToolUse(message)) {
191
- log.info('tool request...');
192
- const response = await runTools({
193
- message: this._pending.value.at(-1)!,
194
- tools: this._tools ?? [],
195
- extensions: this._extensions,
196
- });
197
-
198
- log.info('tool response', { response });
199
- switch (response.type) {
200
- case 'continue': {
201
- this._pending.value = [...this._pending.value, response.message];
202
- more = true;
203
- break;
204
- }
205
- }
206
- }
207
- } while (more);
208
-
209
- log.info('done');
210
- } catch (err) {
211
- log.catch(err);
212
- this.error.value = new Error('AI service error', { cause: err });
213
- } finally {
214
- this._stream = undefined;
215
- this.error.value = undefined;
216
- }
217
- }
218
- }
@@ -1,75 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { useEffect, useMemo, useState } from 'react';
6
-
7
- import { Capabilities, useCapabilities, useCapability, useIntentDispatcher } from '@dxos/app-framework';
8
- import { createSystemPrompt, type Tool } from '@dxos/artifact';
9
- import { FunctionType } from '@dxos/functions';
10
- import { log } from '@dxos/log';
11
- import { useConfig } from '@dxos/react-client';
12
- import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
13
- import { isNonNullable } from '@dxos/util';
14
-
15
- import { AutomationCapabilities } from '../capabilities';
16
- import { ChatProcessor } from '../hooks';
17
- import { covertFunctionToTool, createToolsFromService } from '../tools';
18
- import { ServiceType } from '../types';
19
-
20
- /**
21
- * Creates a processor for the chat.
22
- */
23
- export const useChatProcessor = (space?: Space): ChatProcessor => {
24
- const aiClient = useCapability(AutomationCapabilities.AiClient);
25
- const globalTools = useCapabilities(Capabilities.Tools);
26
- const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
27
- const { dispatchPromise: dispatch } = useIntentDispatcher();
28
-
29
- // Services.
30
- const services = useQuery(space, Filter.schema(ServiceType));
31
- const [serviceTools, setServiceTools] = useState<Tool[]>([]);
32
- useEffect(() => {
33
- log('creating service tools...');
34
- queueMicrotask(async () => {
35
- const tools = await Promise.all(services.map((service) => createToolsFromService(service)));
36
- setServiceTools(tools.flat());
37
- });
38
- }, [services]);
39
-
40
- // Tools and context.
41
- const config = useConfig();
42
- const functions = useQuery(space, Filter.schema(FunctionType));
43
- const [tools, extensions] = useMemo(() => {
44
- log('creating tools...');
45
- const tools = [
46
- ...globalTools.flat(),
47
- ...artifactDefinitions.flatMap((definition) => definition.tools),
48
- ...serviceTools,
49
- ...functions
50
- .map((fn) => covertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
51
- .filter(isNonNullable),
52
- ];
53
- const extensions = { space, dispatch };
54
- return [tools, extensions];
55
- }, [dispatch, globalTools, artifactDefinitions, space, serviceTools, functions]);
56
-
57
- // Prompt.
58
- const systemPrompt = useMemo(
59
- () => createSystemPrompt({ artifacts: artifactDefinitions.map((definition) => definition.instructions) }),
60
- [artifactDefinitions],
61
- );
62
-
63
- // Create processor.
64
- // TODO(burdon): Updated on each query update above. Should just update current processor.
65
- const processor = useMemo(() => {
66
- log.info('creating processor...');
67
- return new ChatProcessor(aiClient, tools, extensions, {
68
- // TODO(burdon): Move to settings.
69
- model: '@anthropic/claude-3-5-sonnet-20241022',
70
- systemPrompt,
71
- });
72
- }, [aiClient, tools, extensions, systemPrompt]);
73
-
74
- return processor;
75
- };