@dxos/plugin-automation 0.7.5-labs.e27f9b9 → 0.7.5-labs.f400bbc

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 (288) 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-HKX3D3ZP.mjs → chunk-OFDNNRLE.mjs} +4 -7
  4. package/dist/lib/browser/{chunk-HKX3D3ZP.mjs.map → chunk-OFDNNRLE.mjs.map} +3 -3
  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 +22 -372
  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-WWU5FVAO.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -131
  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-5VF5JKUN.cjs → chunk-ORMEYEBE.cjs} +7 -10
  23. package/dist/lib/node/{chunk-5VF5JKUN.cjs.map → chunk-ORMEYEBE.cjs.map} +3 -3
  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 +37 -373
  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-5HYLBDC3.cjs → react-surface-2WRVAPGR.cjs} +9 -28
  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-X3LPRWIL.mjs → chunk-6MUUH67V.mjs} +4 -7
  34. package/dist/lib/node-esm/{chunk-X3LPRWIL.mjs.map → chunk-6MUUH67V.mjs.map} +3 -3
  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 +22 -372
  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-SS5WCRJ2.mjs → react-surface-QWLPOYXO.mjs} +5 -28
  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 +1 -2
  53. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  54. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  55. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
  56. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  57. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  58. package/dist/types/src/components/index.d.ts +1 -11
  59. package/dist/types/src/components/index.d.ts.map +1 -1
  60. package/dist/types/src/index.d.ts +1 -3
  61. package/dist/types/src/index.d.ts.map +1 -1
  62. package/dist/types/src/meta.d.ts +0 -1
  63. package/dist/types/src/meta.d.ts.map +1 -1
  64. package/dist/types/src/testing/index.d.ts +1 -1
  65. package/dist/types/src/testing/index.d.ts.map +1 -1
  66. package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +1 -3
  67. package/dist/types/src/testing/test-functions.d.ts.map +1 -0
  68. package/dist/types/src/translations.d.ts +2 -92
  69. package/dist/types/src/translations.d.ts.map +1 -1
  70. package/package.json +23 -71
  71. package/src/AutomationPlugin.tsx +9 -64
  72. package/src/capabilities/complementary-panel.ts +56 -0
  73. package/src/capabilities/index.ts +1 -5
  74. package/src/capabilities/react-surface.tsx +1 -13
  75. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
  76. package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
  77. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
  78. package/src/components/TriggerEditor/TriggerEditor.tsx +8 -5
  79. package/src/components/index.ts +0 -7
  80. package/src/index.ts +2 -3
  81. package/src/meta.ts +3 -3
  82. package/src/testing/index.ts +1 -1
  83. package/src/testing/{testing.ts → test-functions.ts} +0 -7
  84. package/src/translations.ts +2 -29
  85. package/dist/lib/browser/AutomationPanel-WFJZAW4F.mjs +0 -8
  86. package/dist/lib/browser/AutomationPanel-WFJZAW4F.mjs.map +0 -7
  87. package/dist/lib/browser/ChatContainer-OFCOZ5T2.mjs +0 -12
  88. package/dist/lib/browser/ChatContainer-OFCOZ5T2.mjs.map +0 -7
  89. package/dist/lib/browser/ai-client-AARXEMMJ.mjs +0 -22
  90. package/dist/lib/browser/ai-client-AARXEMMJ.mjs.map +0 -7
  91. package/dist/lib/browser/app-graph-builder-B4U34VSR.mjs +0 -162
  92. package/dist/lib/browser/app-graph-builder-B4U34VSR.mjs.map +0 -7
  93. package/dist/lib/browser/chunk-5SLV6AUA.mjs +0 -1367
  94. package/dist/lib/browser/chunk-5SLV6AUA.mjs.map +0 -7
  95. package/dist/lib/browser/chunk-7XADMUOW.mjs +0 -205
  96. package/dist/lib/browser/chunk-7XADMUOW.mjs.map +0 -7
  97. package/dist/lib/browser/chunk-HZ4TA7HY.mjs +0 -15
  98. package/dist/lib/browser/chunk-HZ4TA7HY.mjs.map +0 -7
  99. package/dist/lib/browser/chunk-IYSMXX6Q.mjs +0 -283
  100. package/dist/lib/browser/chunk-IYSMXX6Q.mjs.map +0 -7
  101. package/dist/lib/browser/chunk-RAVNWHNE.mjs +0 -242
  102. package/dist/lib/browser/chunk-RAVNWHNE.mjs.map +0 -7
  103. package/dist/lib/browser/intent-resolver-754MPV7H.mjs +0 -29
  104. package/dist/lib/browser/intent-resolver-754MPV7H.mjs.map +0 -7
  105. package/dist/lib/browser/react-surface-4QZ6AKBF.mjs +0 -50
  106. package/dist/lib/browser/react-surface-4QZ6AKBF.mjs.map +0 -7
  107. package/dist/lib/browser/types/index.mjs +0 -24
  108. package/dist/lib/browser/types/index.mjs.map +0 -7
  109. package/dist/lib/node/AutomationPanel-LRDEDGXI.cjs +0 -26
  110. package/dist/lib/node/AutomationPanel-LRDEDGXI.cjs.map +0 -7
  111. package/dist/lib/node/ChatContainer-6LZX4K2Z.cjs +0 -33
  112. package/dist/lib/node/ChatContainer-6LZX4K2Z.cjs.map +0 -7
  113. package/dist/lib/node/ai-client-SA35GN5Q.cjs +0 -38
  114. package/dist/lib/node/ai-client-SA35GN5Q.cjs.map +0 -7
  115. package/dist/lib/node/app-graph-builder-ENVDOPS4.cjs +0 -178
  116. package/dist/lib/node/app-graph-builder-ENVDOPS4.cjs.map +0 -7
  117. package/dist/lib/node/chunk-6VMSH4P6.cjs +0 -1364
  118. package/dist/lib/node/chunk-6VMSH4P6.cjs.map +0 -7
  119. package/dist/lib/node/chunk-HEYQONXC.cjs +0 -302
  120. package/dist/lib/node/chunk-HEYQONXC.cjs.map +0 -7
  121. package/dist/lib/node/chunk-LU4HQWJD.cjs +0 -226
  122. package/dist/lib/node/chunk-LU4HQWJD.cjs.map +0 -7
  123. package/dist/lib/node/chunk-WWU5FVAO.cjs.map +0 -7
  124. package/dist/lib/node/chunk-ZS5RZ7RM.cjs +0 -34
  125. package/dist/lib/node/chunk-ZS5RZ7RM.cjs.map +0 -7
  126. package/dist/lib/node/intent-resolver-CNVBSG4E.cjs +0 -44
  127. package/dist/lib/node/intent-resolver-CNVBSG4E.cjs.map +0 -7
  128. package/dist/lib/node/react-surface-5HYLBDC3.cjs.map +0 -7
  129. package/dist/lib/node/types/index.cjs +0 -46
  130. package/dist/lib/node/types/index.cjs.map +0 -7
  131. package/dist/lib/node-esm/AutomationPanel-ZV7VEEPP.mjs +0 -9
  132. package/dist/lib/node-esm/AutomationPanel-ZV7VEEPP.mjs.map +0 -7
  133. package/dist/lib/node-esm/ChatContainer-PPVMC2FC.mjs +0 -13
  134. package/dist/lib/node-esm/ChatContainer-PPVMC2FC.mjs.map +0 -7
  135. package/dist/lib/node-esm/ai-client-2ZA4TYFZ.mjs +0 -23
  136. package/dist/lib/node-esm/ai-client-2ZA4TYFZ.mjs.map +0 -7
  137. package/dist/lib/node-esm/app-graph-builder-IYOUCQZT.mjs +0 -163
  138. package/dist/lib/node-esm/app-graph-builder-IYOUCQZT.mjs.map +0 -7
  139. package/dist/lib/node-esm/chunk-3KB5HRXA.mjs +0 -284
  140. package/dist/lib/node-esm/chunk-3KB5HRXA.mjs.map +0 -7
  141. package/dist/lib/node-esm/chunk-EVTLHDM2.mjs +0 -206
  142. package/dist/lib/node-esm/chunk-EVTLHDM2.mjs.map +0 -7
  143. package/dist/lib/node-esm/chunk-ISYLEDVU.mjs +0 -16
  144. package/dist/lib/node-esm/chunk-ISYLEDVU.mjs.map +0 -7
  145. package/dist/lib/node-esm/chunk-MS7OIGVR.mjs +0 -243
  146. package/dist/lib/node-esm/chunk-MS7OIGVR.mjs.map +0 -7
  147. package/dist/lib/node-esm/chunk-WISKXX7U.mjs +0 -1368
  148. package/dist/lib/node-esm/chunk-WISKXX7U.mjs.map +0 -7
  149. package/dist/lib/node-esm/intent-resolver-RQBXW442.mjs +0 -30
  150. package/dist/lib/node-esm/intent-resolver-RQBXW442.mjs.map +0 -7
  151. package/dist/lib/node-esm/react-surface-SS5WCRJ2.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/artifacts.stories.d.ts +0 -16
  155. package/dist/types/src/artifacts.stories.d.ts.map +0 -1
  156. package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
  157. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -180
  158. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  159. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  160. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  161. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  162. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  163. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -8
  164. package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +0 -1
  165. package/dist/types/src/components/ChatContainer/index.d.ts +0 -4
  166. package/dist/types/src/components/ChatContainer/index.d.ts.map +0 -1
  167. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +0 -14
  168. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +0 -1
  169. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +0 -8
  170. package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +0 -1
  171. package/dist/types/src/components/MarkdownViewer/index.d.ts +0 -2
  172. package/dist/types/src/components/MarkdownViewer/index.d.ts.map +0 -1
  173. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -10
  174. package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
  175. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
  176. package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
  177. package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
  178. package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
  179. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
  180. package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
  181. package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
  182. package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
  183. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
  184. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
  185. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
  186. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
  187. package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
  188. package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
  189. package/dist/types/src/components/Thread/ScrollContainer.d.ts +0 -15
  190. package/dist/types/src/components/Thread/ScrollContainer.d.ts.map +0 -1
  191. package/dist/types/src/components/Thread/StatusLine.d.ts +0 -11
  192. package/dist/types/src/components/Thread/StatusLine.d.ts.map +0 -1
  193. package/dist/types/src/components/Thread/StatusLine.stories.d.ts +0 -9
  194. package/dist/types/src/components/Thread/StatusLine.stories.d.ts.map +0 -1
  195. package/dist/types/src/components/Thread/Tabbed.d.ts +0 -9
  196. package/dist/types/src/components/Thread/Tabbed.d.ts.map +0 -1
  197. package/dist/types/src/components/Thread/Tabbed.stories.d.ts +0 -8
  198. package/dist/types/src/components/Thread/Tabbed.stories.d.ts.map +0 -1
  199. package/dist/types/src/components/Thread/Thread.d.ts +0 -11
  200. package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
  201. package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -10
  202. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
  203. package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -12
  204. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
  205. package/dist/types/src/components/Thread/ToggleContainer.d.ts +0 -13
  206. package/dist/types/src/components/Thread/ToggleContainer.d.ts.map +0 -1
  207. package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts +0 -9
  208. package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts.map +0 -1
  209. package/dist/types/src/components/Thread/index.d.ts +0 -2
  210. package/dist/types/src/components/Thread/index.d.ts.map +0 -1
  211. package/dist/types/src/hooks/email.d.ts +0 -4
  212. package/dist/types/src/hooks/email.d.ts.map +0 -1
  213. package/dist/types/src/hooks/index.d.ts +0 -4
  214. package/dist/types/src/hooks/index.d.ts.map +0 -1
  215. package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
  216. package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
  217. package/dist/types/src/hooks/processor.d.ts +0 -65
  218. package/dist/types/src/hooks/processor.d.ts.map +0 -1
  219. package/dist/types/src/hooks/processor.test.d.ts +0 -2
  220. package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
  221. package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
  222. package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
  223. package/dist/types/src/hooks/useServiceRegistry.d.ts +0 -3
  224. package/dist/types/src/hooks/useServiceRegistry.d.ts.map +0 -1
  225. package/dist/types/src/presets.d.ts +0 -9
  226. package/dist/types/src/presets.d.ts.map +0 -1
  227. package/dist/types/src/testing/testing.d.ts.map +0 -1
  228. package/dist/types/src/tools/function.d.ts +0 -5
  229. package/dist/types/src/tools/function.d.ts.map +0 -1
  230. package/dist/types/src/tools/index.d.ts +0 -3
  231. package/dist/types/src/tools/index.d.ts.map +0 -1
  232. package/dist/types/src/tools/openapi.d.ts +0 -10
  233. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  234. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  235. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  236. package/dist/types/src/types/index.d.ts +0 -4
  237. package/dist/types/src/types/index.d.ts.map +0 -1
  238. package/dist/types/src/types/registry.d.ts +0 -9
  239. package/dist/types/src/types/registry.d.ts.map +0 -1
  240. package/dist/types/src/types/schema.d.ts +0 -196
  241. package/dist/types/src/types/schema.d.ts.map +0 -1
  242. package/dist/types/src/types/types.d.ts +0 -18
  243. package/dist/types/src/types/types.d.ts.map +0 -1
  244. package/src/artifacts.stories.tsx +0 -241
  245. package/src/capabilities/ai-client.ts +0 -19
  246. package/src/capabilities/app-graph-builder.ts +0 -156
  247. package/src/capabilities/capabilities.ts +0 -12
  248. package/src/capabilities/intent-resolver.ts +0 -27
  249. package/src/components/ChatContainer/ChatContainer.tsx +0 -117
  250. package/src/components/ChatContainer/index.ts +0 -8
  251. package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +0 -56
  252. package/src/components/MarkdownViewer/MarkdownViewer.tsx +0 -79
  253. package/src/components/MarkdownViewer/index.ts +0 -5
  254. package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
  255. package/src/components/PromptEditor/PromptEditor.tsx +0 -222
  256. package/src/components/PromptEditor/index.ts +0 -5
  257. package/src/components/PromptEditor/prompt-extension.ts +0 -43
  258. package/src/components/PromptEditor/types.tsx +0 -28
  259. package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -48
  260. package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -75
  261. package/src/components/ServiceRegistry/index.ts +0 -5
  262. package/src/components/Thread/ScrollContainer.tsx +0 -92
  263. package/src/components/Thread/StatusLine.stories.tsx +0 -52
  264. package/src/components/Thread/StatusLine.tsx +0 -76
  265. package/src/components/Thread/Tabbed.stories.tsx +0 -52
  266. package/src/components/Thread/Tabbed.tsx +0 -72
  267. package/src/components/Thread/Thread.stories.tsx +0 -190
  268. package/src/components/Thread/Thread.tsx +0 -156
  269. package/src/components/Thread/ThreadMessage.tsx +0 -195
  270. package/src/components/Thread/ToggleContainer.stories.tsx +0 -111
  271. package/src/components/Thread/ToggleContainer.tsx +0 -103
  272. package/src/components/Thread/index.ts +0 -5
  273. package/src/hooks/email.ts +0 -49
  274. package/src/hooks/index.ts +0 -8
  275. package/src/hooks/invocation-handler.ts +0 -109
  276. package/src/hooks/processor.test.ts +0 -15
  277. package/src/hooks/processor.ts +0 -201
  278. package/src/hooks/useLocalTriggerManager.ts +0 -82
  279. package/src/hooks/useServiceRegistry.ts +0 -22
  280. package/src/presets.ts +0 -248
  281. package/src/tools/function.ts +0 -47
  282. package/src/tools/index.ts +0 -6
  283. package/src/tools/openapi.test.ts +0 -227
  284. package/src/tools/openapi.ts +0 -331
  285. package/src/types/index.ts +0 -7
  286. package/src/types/registry.ts +0 -89
  287. package/src/types/schema.ts +0 -120
  288. package/src/types/types.ts +0 -21
@@ -1,117 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
6
-
7
- import { Capabilities, useCapabilities, useCapability, useIntentDispatcher } from '@dxos/app-framework';
8
- import { createSystemPrompt, type Message, type Tool } from '@dxos/artifact';
9
- import { FunctionType } from '@dxos/functions';
10
- import { invariant } from '@dxos/invariant';
11
- import { DXN, QueueSubspaceTags } from '@dxos/keys';
12
- import { useConfig } from '@dxos/react-client';
13
- import { Filter, getSpace, useQuery } from '@dxos/react-client/echo';
14
- import { useEdgeClient, useQueue } from '@dxos/react-edge-client';
15
- import { StackItem } from '@dxos/react-ui-stack';
16
- import { isNotNullOrUndefined } from '@dxos/util';
17
-
18
- import { AutomationCapabilities } from '../../capabilities';
19
- import { ChatProcessor } from '../../hooks';
20
- import { covertFunctionToTool, createToolsFromService } from '../../tools';
21
- import { MockServiceRegistry, type AIChatType } from '../../types';
22
- import { Thread } from '../Thread';
23
-
24
- export const ChatContainer = ({ chat, role }: { chat: AIChatType; role: string }) => {
25
- const config = useConfig();
26
- const space = getSpace(chat);
27
- const aiClient = useCapability(AutomationCapabilities.AiClient);
28
-
29
- const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
30
- const globalTools = useCapabilities(Capabilities.Tools);
31
- const functions = useQuery(space, Filter.schema(FunctionType));
32
- const serviceRegistry = useMemo(() => new MockServiceRegistry(), []);
33
-
34
- const [serviceTools, setServiceTools] = useState<Tool[]>([]);
35
- useEffect(() => {
36
- queueMicrotask(async () => {
37
- const services = await serviceRegistry.queryServices({});
38
- const tools = await Promise.all(services.map((service) => createToolsFromService(service)));
39
- setServiceTools(tools.flat());
40
- });
41
- }, []);
42
-
43
- const tools = useMemo(
44
- () => [
45
- ...globalTools.flat(),
46
- ...artifactDefinitions.flatMap((definition) => definition.tools),
47
- ...functions
48
- .map((fn) => covertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
49
- .filter(isNotNullOrUndefined),
50
- ...serviceTools,
51
- ],
52
- [globalTools, artifactDefinitions, functions, serviceTools, space?.id],
53
- );
54
- const systemPrompt = useMemo(
55
- () => createSystemPrompt({ artifacts: artifactDefinitions.map((definition) => definition.instructions) }),
56
- [artifactDefinitions],
57
- );
58
-
59
- // TODO(burdon): Create hook.
60
- // TODO(wittjosiah): Should these be created in the component?
61
- // TODO(zan): Combine with ai service client?
62
- const { dispatchPromise: dispatch } = useIntentDispatcher();
63
- const processor = useMemo(
64
- () =>
65
- new ChatProcessor(
66
- aiClient,
67
- tools,
68
- {
69
- space,
70
- dispatch,
71
- },
72
- {
73
- model: '@anthropic/claude-3-5-sonnet-20241022',
74
- systemPrompt,
75
- },
76
- ),
77
- [aiClient, tools, space, dispatch, systemPrompt],
78
- );
79
-
80
- // TODO(wittjosiah): Remove transformation.
81
- const queueDxn = useMemo(
82
- () => new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, space!.id, chat.queue.dxn.parts.at(-1)!]),
83
- [chat.queue.dxn],
84
- );
85
- const edgeClient = useEdgeClient();
86
- const messageQueue = useQueue<Message>(edgeClient, queueDxn);
87
- const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
88
-
89
- const handleSubmit = useCallback(
90
- async (message: string) => {
91
- if (processor.streaming.value) {
92
- await processor.cancel();
93
- }
94
-
95
- invariant(messageQueue);
96
- await processor.request(message, {
97
- history: messageQueue.items,
98
- onComplete: (messages) => messageQueue.append(messages),
99
- });
100
- },
101
- [processor, messageQueue],
102
- );
103
-
104
- const handleStop = useCallback(() => {
105
- if (processor.streaming.value) {
106
- void processor.cancel();
107
- }
108
- }, [processor]);
109
-
110
- return (
111
- <StackItem.Content toolbar={false} role={role}>
112
- <Thread messages={messages} streaming={processor.streaming.value} onSubmit={handleSubmit} onStop={handleStop} />
113
- </StackItem.Content>
114
- );
115
- };
116
-
117
- export default ChatContainer;
@@ -1,8 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { ChatContainer } from './ChatContainer';
6
-
7
- export * from './ChatContainer';
8
- export default ChatContainer;
@@ -1,56 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type StoryObj, type Meta } from '@storybook/react';
8
-
9
- import { faker } from '@dxos/random';
10
- import { withLayout, withTheme } from '@dxos/storybook-utils';
11
-
12
- import { MarkdownViewer } from './MarkdownViewer';
13
-
14
- faker.seed(0);
15
-
16
- const meta: Meta<typeof MarkdownViewer> = {
17
- title: 'plugins/plugin-automation/MarkdownViewer',
18
- component: MarkdownViewer,
19
- decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
20
- };
21
-
22
- export default meta;
23
-
24
- type Story = StoryObj<typeof MarkdownViewer>;
25
-
26
- const content = `
27
- # Hello, world!
28
-
29
- ${faker.lorem.paragraphs(1)}
30
-
31
- Here's a JSON block:
32
-
33
- ~~~json
34
- {
35
- "hello": "world"
36
- }
37
- ~~~
38
-
39
- And some code:
40
-
41
- ~~~ts
42
- const App = () => {
43
- const title = 'Hello, world!';
44
- return <div>{title}</div>;
45
- };
46
- ~~~
47
-
48
- ${faker.lorem.paragraphs(1)}
49
- `;
50
-
51
- export const Default: Story = {
52
- args: {
53
- classNames: 'w-[500px] border border-border rounded-md p-4',
54
- content,
55
- },
56
- };
@@ -1,79 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { type FC } from 'react';
6
- import ReactMarkdown from 'react-markdown';
7
-
8
- import { type ThemedClassName } from '@dxos/react-ui';
9
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
10
- import { mx } from '@dxos/react-ui-theme';
11
- import { omit } from '@dxos/util';
12
-
13
- type MarkdownViewerProps = ThemedClassName<{
14
- content?: string;
15
- }>;
16
-
17
- /**
18
- * Transform text into react elements.
19
- *
20
- * https://github.com/remarkjs/react-markdown
21
- * markdown -> remark -> [mdast -> remark plugins] -> [hast -> rehype plugins] -> components -> react elements.
22
- */
23
- // TODO(burdon): Styles.
24
- // TODO(burdon): Factor out (react-ui-syntax-highlighter).
25
- export const MarkdownViewer: FC<MarkdownViewerProps> = ({ classNames, content = '' }) => {
26
- return (
27
- <div className={mx('space-y-2', classNames)}>
28
- <ReactMarkdown
29
- components={{
30
- a: ({ node, children, href, ...props }) => (
31
- <a
32
- href={href}
33
- className='text-primary-500 hover:text-primary-500'
34
- target='_blank'
35
- rel='noopener noreferrer'
36
- {...props}
37
- >
38
- {children}
39
- </a>
40
- ),
41
- ol: ({ node, children, ...props }) => (
42
- <ol className='leading-tight list-decimal pl-6' {...omit(props, ['ordered'])}>
43
- {children}
44
- </ol>
45
- ),
46
- ul: ({ node, children, ...props }) => (
47
- <ul className='leading-tight list-disc pl-6' {...omit(props, ['ordered'])}>
48
- {children}
49
- </ul>
50
- ),
51
- li: ({ node, children, ...props }) => (
52
- <li className='' {...omit(props, ['ordered'])}>
53
- {children}
54
- </li>
55
- ),
56
- blockquote: ({ node, children, ...props }) => (
57
- <blockquote className='border-l-4 border-primary-500 pl-4 my-4 text-primary-500' {...props}>
58
- {children}
59
- </blockquote>
60
- ),
61
- code: ({ children, className }) => {
62
- const [_, language] = /language-(\w+)/.exec(className || '') || [];
63
- return (
64
- <SyntaxHighlighter PreTag='div' language={language} className='p-0'>
65
- {children}
66
- </SyntaxHighlighter>
67
- );
68
- },
69
- }}
70
- >
71
- {content}
72
- </ReactMarkdown>
73
- </div>
74
- );
75
- };
76
-
77
- // const Cursor = () => {
78
- // return <span className='animate-[pulse_1s_steps(1)_infinite] text-primary-500'>▊</span>;
79
- // };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './MarkdownViewer';
@@ -1,64 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react';
8
- import React, { useState } from 'react';
9
-
10
- import { create, makeRef } from '@dxos/live-object';
11
- import { useClient } from '@dxos/react-client';
12
- import { withClientProvider } from '@dxos/react-client/testing';
13
- import { withLayout, withTheme } from '@dxos/storybook-utils';
14
-
15
- import { PromptEditor } from './PromptEditor';
16
- import translations from '../../translations';
17
- import { ChainPromptType, ChainType } from '../../types';
18
-
19
- const template = [
20
- '# Comment',
21
- '',
22
- 'You are a machine that is an expert chess player.',
23
- 'The move history of the current game is: {history}',
24
- 'If asked to suggest a move explain why it is a good move.',
25
- '',
26
- '---',
27
- '',
28
- '{input}',
29
- ].join('\n');
30
-
31
- const DefaultStory = () => {
32
- const client = useClient();
33
- const [chain] = useState(() => {
34
- const space = client.spaces.default;
35
- return space.db.add(
36
- create(ChainType, {
37
- prompts: [makeRef(create(ChainPromptType, { command: 'test', template, inputs: [] }))],
38
- }),
39
- );
40
- });
41
-
42
- return (
43
- <div role='none' className='flex w-[350px] border border-separator overflow-hidden'>
44
- <PromptEditor prompt={chain.prompts![0]!.target!} />
45
- </div>
46
- );
47
- };
48
-
49
- export const Default = {};
50
-
51
- const meta: Meta = {
52
- title: 'plugins/plugin-automation/PromptTemplate',
53
- render: DefaultStory,
54
- decorators: [
55
- withClientProvider({ createIdentity: true, createSpace: true, types: [ChainType, ChainPromptType] }),
56
- withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
57
- withTheme,
58
- ],
59
- parameters: {
60
- translations,
61
- },
62
- };
63
-
64
- export default meta;
@@ -1,222 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { type Schema as S } from '@effect/schema';
6
- import React, { useEffect } from 'react';
7
-
8
- import { createDocAccessor } from '@dxos/react-client/echo';
9
- import { Input, Select, useThemeContext, useTranslation } from '@dxos/react-ui';
10
- import {
11
- createBasicExtensions,
12
- createDataExtensions,
13
- createThemeExtensions,
14
- useTextEditor,
15
- } from '@dxos/react-ui-editor';
16
- import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
17
- import { nonNullable } from '@dxos/util';
18
-
19
- import { nameRegex, promptExtension } from './prompt-extension';
20
- import { AUTOMATION_PLUGIN } from '../../meta';
21
- import { type ChainInput, ChainInputType, type ChainPromptType } from '../../types';
22
-
23
- const inputTypes = [
24
- {
25
- value: ChainInputType.VALUE,
26
- label: 'Value',
27
- },
28
- {
29
- value: ChainInputType.PASS_THROUGH,
30
- label: 'Pass through',
31
- },
32
- {
33
- value: ChainInputType.RETRIEVER,
34
- label: 'Retriever',
35
- },
36
- // {
37
- // value: ChainInputType.FUNCTION,
38
- // label: 'Function',
39
- // },
40
- // {
41
- // value: ChainInputType.QUERY,
42
- // label: 'Query',
43
- // },
44
- {
45
- value: ChainInputType.RESOLVER,
46
- label: 'Resolver',
47
- },
48
- {
49
- value: ChainInputType.CONTEXT,
50
- label: 'Context',
51
- },
52
- {
53
- value: ChainInputType.SCHEMA,
54
- label: 'Schema',
55
- },
56
- ];
57
-
58
- const getInputType = (type: string) => inputTypes.find(({ value }) => String(value) === type)?.value;
59
-
60
- const usePromptInputs = (prompt: ChainPromptType) => {
61
- useEffect(() => {
62
- const text = prompt.template ?? '';
63
- if (!prompt.inputs) {
64
- prompt.inputs = []; // TODO(burdon): Required?
65
- }
66
-
67
- const regex = new RegExp(nameRegex, 'g');
68
- const variables = new Set<string>([...text.matchAll(regex)].map((m) => m[1]));
69
-
70
- // Create map of unclaimed inputs.
71
- const unclaimed = new Map<string, ChainInput>(
72
- prompt.inputs?.filter(nonNullable).map((input) => [input.name, input]),
73
- );
74
- const missing: string[] = [];
75
- Array.from(variables.values()).forEach((name) => {
76
- if (unclaimed.has(name)) {
77
- unclaimed.delete(name);
78
- } else {
79
- missing.push(name);
80
- }
81
- });
82
-
83
- // Match or create new inputs.
84
- const values = unclaimed.values();
85
- missing.forEach((name) => {
86
- const next = values.next().value;
87
- if (next) {
88
- next.name = name;
89
- } else {
90
- prompt.inputs?.push({ name });
91
- }
92
- });
93
-
94
- // Remove unclaimed (deleted) inputs.
95
- // TODO(burdon): If user types incorrect name value, it will be deleted. Garbage collect?
96
- for (const input of values) {
97
- prompt.inputs.splice(prompt.inputs.indexOf(input), 1);
98
- }
99
- }, [prompt.template]);
100
- };
101
-
102
- export type PromptEditorProps = {
103
- prompt: ChainPromptType;
104
- commandEditable?: boolean;
105
- schema?: S.Schema<any, any, any>;
106
- };
107
-
108
- export const PromptEditor = ({ prompt, commandEditable = true }: PromptEditorProps) => {
109
- const { t } = useTranslation(AUTOMATION_PLUGIN);
110
- const { themeMode } = useThemeContext();
111
-
112
- const { parentRef } = useTextEditor(
113
- () => ({
114
- initialValue: prompt.template,
115
- extensions: [
116
- createDataExtensions({
117
- id: prompt.id,
118
- text: prompt.template !== undefined ? createDocAccessor(prompt, ['template']) : undefined,
119
- }),
120
- createBasicExtensions({
121
- bracketMatching: false,
122
- lineWrapping: true,
123
- placeholder: t('template placeholder'),
124
- }),
125
- createThemeExtensions({
126
- themeMode,
127
- slots: {
128
- content: { className: '!p-3' },
129
- },
130
- }),
131
- promptExtension,
132
- ],
133
- }),
134
- [themeMode, prompt],
135
- );
136
-
137
- usePromptInputs(prompt);
138
-
139
- return (
140
- <div className={mx('flex flex-col w-full overflow-hidden gap-4', groupBorder)}>
141
- {commandEditable && (
142
- <div className='flex items-center pl-4'>
143
- <span className='text-neutral-500'>/</span>
144
- <Input.Root>
145
- <Input.TextInput
146
- placeholder={t('command placeholder')}
147
- classNames={mx('is-full bg-transparent m-2')}
148
- value={prompt.command ?? ''}
149
- onChange={(event) => {
150
- prompt.command = event.target.value.replace(/\w/g, '');
151
- }}
152
- />
153
- </Input.Root>
154
- </div>
155
- )}
156
-
157
- <div ref={parentRef} className={mx(attentionSurface, 'rounded', 'min-h-[120px]')} />
158
-
159
- {(prompt.inputs?.length ?? 0) > 0 && (
160
- <div className='flex flex-col'>
161
- {/* TODO(zan): Improve layout with grid */}
162
- <table className='w-full table-fixed border-collapse my-2'>
163
- <tbody>
164
- {prompt.inputs?.filter(nonNullable).map((input) => (
165
- <tr key={input.name}>
166
- <td className='w-[160px] p-1 font-mono text-sm whitespace-nowrap truncate'>
167
- <code className='px-2'>{input.name}</code>
168
- </td>
169
- <td className='w-[120px] p-1'>
170
- <Input.Root>
171
- <Select.Root
172
- value={String(input.type)}
173
- onValueChange={(type) => {
174
- input.type = getInputType(type) ?? ChainInputType.VALUE;
175
- }}
176
- >
177
- <Select.TriggerButton placeholder='Type' classNames='is-full' />
178
- <Select.Portal>
179
- <Select.Content>
180
- <Select.Viewport>
181
- {inputTypes.map(({ value, label }) => (
182
- <Select.Option key={value} value={String(value)}>
183
- {label}
184
- </Select.Option>
185
- ))}
186
- </Select.Viewport>
187
- </Select.Content>
188
- </Select.Portal>
189
- </Select.Root>
190
- </Input.Root>
191
- </td>
192
- <td className='p-1 pr-2'>
193
- {input.type !== undefined &&
194
- [
195
- ChainInputType.VALUE,
196
- ChainInputType.CONTEXT,
197
- ChainInputType.RESOLVER,
198
- ChainInputType.SCHEMA,
199
- ].includes(input.type) && (
200
- <div>
201
- <Input.Root>
202
- <Input.TextInput
203
- placeholder={t('command placeholder')}
204
- classNames={mx('is-full bg-transparent')}
205
- value={input.value ?? ''}
206
- onChange={(event) => {
207
- input.value = event.target.value;
208
- }}
209
- />
210
- </Input.Root>
211
- </div>
212
- )}
213
- </td>
214
- </tr>
215
- ))}
216
- </tbody>
217
- </table>
218
- </div>
219
- )}
220
- </div>
221
- );
222
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- export * from './PromptEditor';
@@ -1,43 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { HighlightStyle, StreamLanguage, syntaxHighlighting } from '@codemirror/language';
6
- import { type Extension } from '@codemirror/state';
7
-
8
- import { tags } from '@dxos/react-ui-editor';
9
- import { mx } from '@dxos/react-ui-theme';
10
-
11
- export const nameRegex = /\{([\w-]+)}/;
12
-
13
- const parser = StreamLanguage.define({
14
- token: (stream) => {
15
- if (stream.eatSpace()) {
16
- return null;
17
- }
18
- if (stream.match(/^#.*/)) {
19
- return 'lineComment';
20
- }
21
- if (stream.match(/^-+$/)) {
22
- return 'lineComment';
23
- }
24
- if (stream.match(nameRegex)) {
25
- return 'variableName';
26
- }
27
- stream.next();
28
- return null;
29
- },
30
- });
31
-
32
- /**
33
- * https://codemirror.net/examples/styling
34
- * https://lezer.codemirror.net/docs/ref/#highlight
35
- */
36
- const highlightStyles = HighlightStyle.define([
37
- {
38
- tag: tags.variableName,
39
- class: mx('rounded border border-yellow-500 bg-yellow-100 text-black font-mono text-sm'),
40
- },
41
- ]);
42
-
43
- export const promptExtension: Extension = [parser, syntaxHighlighting(highlightStyles)];
@@ -1,28 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- // TODO(burdon): Factor out (shared with backend). core/chain (@dxos/chain).
6
- // TODO(burdon): Agent/plan-and-execute (with tools). Create design doc/ontology of sequence/agent.
7
-
8
- export type Step = {
9
- id: string;
10
- };
11
-
12
- export type Variable = {
13
- name: string;
14
- type: 'value' | 'function' | 'query' | 'retriever' | 'pass-through';
15
- };
16
-
17
- export type Prompt = Step & {
18
- title?: string;
19
- description?: string;
20
- template: string;
21
- variables: Variable[];
22
- };
23
-
24
- export type Sequence = Step & {
25
- runnable: Step[];
26
- };
27
-
28
- export type Chain = {};
@@ -1,48 +0,0 @@
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
-
16
- const meta: Meta<typeof ServiceRegistry> = {
17
- title: 'plugins/plugin-automation/ServiceRegistry',
18
- component: ServiceRegistry,
19
- render: ({ space: _ignore, ...args }) => {
20
- const space = useSpace();
21
- if (!space) {
22
- return <div />;
23
- }
24
-
25
- return (
26
- <div className='h-full w-[300px] overflow-hidden'>
27
- <ServiceRegistry space={space} {...args} />
28
- </div>
29
- );
30
- },
31
- decorators: [
32
- withClientProvider({
33
- createIdentity: true,
34
- createSpace: true,
35
- // types: [ServiceType], // TODO(burdon): Doesn't fit type constraint???
36
- }),
37
- withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center' }),
38
- withTheme,
39
- ],
40
- };
41
-
42
- export default meta;
43
-
44
- type Story = StoryObj<typeof ServiceRegistry>;
45
-
46
- export const Default: Story = {
47
- args: {},
48
- };