@dxos/plugin-assistant 0.8.4-main.28f8d3d → 0.8.4-main.2c6827d

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 (510) hide show
  1. package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs +36 -0
  2. package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs.map +7 -0
  3. package/dist/lib/browser/ChatCompanion-4MS4NMZY.mjs +158 -0
  4. package/dist/lib/browser/ChatCompanion-4MS4NMZY.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-OUVSX5V5.mjs → ChatContainer-GJZN3SIJ.mjs} +27 -26
  6. package/dist/lib/browser/ChatContainer-GJZN3SIJ.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-P4FLEOHG.mjs → ChatDialog-E2X6DTDX.mjs} +17 -13
  8. package/dist/lib/browser/ChatDialog-E2X6DTDX.mjs.map +7 -0
  9. package/dist/lib/browser/PromptArticle-45QX25Y5.mjs +59 -0
  10. package/dist/lib/browser/PromptArticle-45QX25Y5.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
  12. package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-AVHHQ3KV.mjs → app-graph-builder-VZEXMDTY.mjs} +72 -39
  14. package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-5FT5JGPY.mjs +12 -0
  16. package/dist/lib/browser/blueprint-definition-5FT5JGPY.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
  18. package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-HRLMD35M.mjs → chunk-BNTPFZ7O.mjs} +60 -22
  20. package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
  22. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
  23. package/dist/lib/browser/{blueprint-definition-CMGIZAOW.mjs → chunk-IXIIS4QA.mjs} +78 -48
  24. package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-LRE4VEZV.mjs +16 -0
  26. package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-TCAQJ26D.mjs +1929 -0
  28. package/dist/lib/browser/chunk-TCAQJ26D.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
  30. package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
  31. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
  32. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
  33. package/dist/lib/browser/index.mjs +162 -73
  34. package/dist/lib/browser/index.mjs.map +4 -4
  35. package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs +143 -0
  36. package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs.map +7 -0
  37. package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +17 -0
  38. package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +7 -0
  39. package/dist/lib/browser/meta.json +1 -1
  40. package/dist/lib/browser/react-surface-XWAR5ZVL.mjs +98 -0
  41. package/dist/lib/browser/react-surface-XWAR5ZVL.mjs.map +7 -0
  42. package/dist/lib/browser/{settings-G2EZXMWT.mjs → settings-NYJGNQ5I.mjs} +5 -5
  43. package/dist/lib/browser/{settings-G2EZXMWT.mjs.map → settings-NYJGNQ5I.mjs.map} +1 -1
  44. package/dist/lib/browser/state-GG7Z3NB7.mjs +25 -0
  45. package/dist/lib/browser/state-GG7Z3NB7.mjs.map +7 -0
  46. package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
  47. package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
  48. package/dist/lib/browser/types/index.mjs +2 -2
  49. package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs +37 -0
  50. package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs.map +7 -0
  51. package/dist/lib/node-esm/ChatCompanion-TYRR7BXD.mjs +159 -0
  52. package/dist/lib/node-esm/ChatCompanion-TYRR7BXD.mjs.map +7 -0
  53. package/dist/lib/node-esm/{ChatContainer-D5FABDNE.mjs → ChatContainer-MT4INE7Z.mjs} +27 -26
  54. package/dist/lib/node-esm/ChatContainer-MT4INE7Z.mjs.map +7 -0
  55. package/dist/lib/node-esm/{ChatDialog-NKWVXHJP.mjs → ChatDialog-G4EWBIJM.mjs} +17 -13
  56. package/dist/lib/node-esm/ChatDialog-G4EWBIJM.mjs.map +7 -0
  57. package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs +60 -0
  58. package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs.map +7 -0
  59. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
  60. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
  61. package/dist/lib/node-esm/{app-graph-builder-RMOUJMMG.mjs → app-graph-builder-VRN6ESRR.mjs} +72 -39
  62. package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs.map +7 -0
  63. package/dist/lib/node-esm/blueprint-definition-XW6QQVLV.mjs +13 -0
  64. package/dist/lib/node-esm/blueprint-definition-XW6QQVLV.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-3Q22TTXW.mjs +264 -0
  66. package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +7 -0
  67. package/dist/lib/node-esm/{chunk-F7RXCX5Y.mjs → chunk-AB74FOA2.mjs} +60 -22
  68. package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
  70. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-KM24SYPM.mjs +1930 -0
  72. package/dist/lib/node-esm/chunk-KM24SYPM.mjs.map +7 -0
  73. package/dist/lib/node-esm/{blueprint-definition-AEWYMW6I.mjs → chunk-UXTUHH24.mjs} +78 -47
  74. package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
  76. package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
  77. package/dist/lib/node-esm/{chunk-X6AANUHZ.mjs → chunk-YWFWT57N.mjs} +4 -4
  78. package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
  79. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
  80. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
  81. package/dist/lib/node-esm/index.mjs +162 -73
  82. package/dist/lib/node-esm/index.mjs.map +4 -4
  83. package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs +144 -0
  84. package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs.map +7 -0
  85. package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +18 -0
  86. package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +7 -0
  87. package/dist/lib/node-esm/meta.json +1 -1
  88. package/dist/lib/node-esm/react-surface-JXB7Q6QR.mjs +99 -0
  89. package/dist/lib/node-esm/react-surface-JXB7Q6QR.mjs.map +7 -0
  90. package/dist/lib/node-esm/{settings-AIP5FOJG.mjs → settings-RRHYI5KO.mjs} +5 -5
  91. package/dist/lib/node-esm/{settings-AIP5FOJG.mjs.map → settings-RRHYI5KO.mjs.map} +1 -1
  92. package/dist/lib/node-esm/state-FSUHFMDM.mjs +26 -0
  93. package/dist/lib/node-esm/state-FSUHFMDM.mjs.map +7 -0
  94. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
  95. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
  96. package/dist/lib/node-esm/types/index.mjs +2 -2
  97. package/dist/types/src/AssistantPlugin.d.ts +1 -1
  98. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/ai-service.d.ts +2 -3
  100. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
  101. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  102. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  103. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -1
  104. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/capabilities.d.ts +7 -8
  106. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/edge-model-resolver.d.ts +2 -3
  108. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/index.d.ts +7 -4
  110. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  112. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  114. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  116. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/settings.d.ts +1 -1
  118. package/dist/types/src/capabilities/state.d.ts +4 -0
  119. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  120. package/dist/types/src/capabilities/toolkit.d.ts +2 -3
  121. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  122. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  123. package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
  124. package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
  125. package/dist/types/src/components/Chat/Chat.d.ts +32 -16
  126. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  127. package/dist/types/src/components/Chat/events.d.ts +9 -0
  128. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  129. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  130. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  131. package/dist/types/src/components/ChatContainer.d.ts +8 -6
  132. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  133. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  134. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  135. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  136. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  137. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  138. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  139. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +11 -4
  140. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  141. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  142. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
  143. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  144. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  145. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  146. package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -10
  147. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  148. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +191 -82
  149. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  150. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
  151. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  152. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  153. package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
  154. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
  155. package/dist/types/src/components/ChatThread/sync.d.ts +42 -0
  156. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
  157. package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
  158. package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
  159. package/dist/types/src/components/PromptArticle.d.ts +7 -0
  160. package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
  161. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
  162. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  163. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +312 -7
  164. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  165. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
  166. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  167. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +309 -2
  168. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  169. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts +12 -0
  170. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
  171. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
  172. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
  173. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
  174. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
  175. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +21 -0
  176. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
  177. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
  178. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
  179. package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
  180. package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
  181. package/dist/types/src/components/Toolbox/Toolbox.d.ts +3 -5
  182. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  183. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +314 -5
  184. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  185. package/dist/types/src/components/index.d.ts +4 -7
  186. package/dist/types/src/components/index.d.ts.map +1 -1
  187. package/dist/types/src/functions/analysis.d.ts +1 -1
  188. package/dist/types/src/functions/analysis.d.ts.map +1 -1
  189. package/dist/types/src/functions/index.d.ts +2 -2
  190. package/dist/types/src/functions/index.d.ts.map +1 -1
  191. package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +2 -2
  192. package/dist/types/src/functions/object-list.d.ts.map +1 -0
  193. package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +3 -3
  194. package/dist/types/src/functions/object-load.d.ts.map +1 -0
  195. package/dist/types/src/hooks/index.d.ts +5 -4
  196. package/dist/types/src/hooks/index.d.ts.map +1 -1
  197. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -1
  198. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  199. package/dist/types/src/hooks/useChatProcessor.d.ts +3 -7
  200. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  201. package/dist/types/src/hooks/useChatServices.d.ts +5 -5
  202. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  203. package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
  204. package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
  205. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  206. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  207. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  208. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  209. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  210. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  211. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  212. package/dist/types/src/hooks/usePresets.d.ts +2 -2
  213. package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
  214. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  215. package/dist/types/src/index.d.ts +2 -0
  216. package/dist/types/src/index.d.ts.map +1 -1
  217. package/dist/types/src/meta.d.ts +1 -2
  218. package/dist/types/src/meta.d.ts.map +1 -1
  219. package/dist/types/src/processor/index.d.ts +4 -0
  220. package/dist/types/src/processor/index.d.ts.map +1 -0
  221. package/dist/types/src/{hooks → processor}/presets.d.ts +1 -1
  222. package/dist/types/src/processor/presets.d.ts.map +1 -0
  223. package/dist/types/src/processor/processor.d.ts +74 -0
  224. package/dist/types/src/processor/processor.d.ts.map +1 -0
  225. package/dist/types/src/processor/processor.test.d.ts +2 -0
  226. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  227. package/dist/types/src/processor/update-name.d.ts +10 -0
  228. package/dist/types/src/processor/update-name.d.ts.map +1 -0
  229. package/dist/types/src/queue-logger.d.ts.map +1 -1
  230. package/dist/types/src/testing/index.d.ts +1 -1
  231. package/dist/types/src/testing/index.d.ts.map +1 -1
  232. package/dist/types/src/testing/test-generator.d.ts +7 -0
  233. package/dist/types/src/testing/test-generator.d.ts.map +1 -0
  234. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  235. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  236. package/dist/types/src/testing/test-services.d.ts +2 -2
  237. package/dist/types/src/testing/test-services.d.ts.map +1 -1
  238. package/dist/types/src/translations.d.ts +257 -33
  239. package/dist/types/src/translations.d.ts.map +1 -1
  240. package/dist/types/src/types/Assistant.d.ts +15 -7
  241. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  242. package/dist/types/src/types/AssistantAction.d.ts +49 -7
  243. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  244. package/dist/types/src/types/service.d.ts +21 -12
  245. package/dist/types/src/types/service.d.ts.map +1 -1
  246. package/dist/types/tsconfig.tsbuildinfo +1 -1
  247. package/package.json +96 -97
  248. package/src/AssistantPlugin.tsx +156 -116
  249. package/src/capabilities/ai-service.ts +6 -7
  250. package/src/capabilities/app-graph-builder.ts +95 -54
  251. package/src/capabilities/blueprint-definition.ts +56 -22
  252. package/src/capabilities/capabilities.ts +7 -12
  253. package/src/capabilities/edge-model-resolver.ts +17 -21
  254. package/src/capabilities/index.ts +5 -2
  255. package/src/capabilities/intent-resolver.ts +91 -17
  256. package/src/capabilities/local-model-resolver.ts +30 -0
  257. package/src/capabilities/react-surface.tsx +23 -81
  258. package/src/capabilities/state.ts +22 -0
  259. package/src/capabilities/toolkit.ts +9 -98
  260. package/src/components/AssistantSettings/AssistantSettings.tsx +82 -75
  261. package/src/components/BlueprintArticle.tsx +29 -0
  262. package/src/components/Chat/Chat.tsx +252 -222
  263. package/src/components/Chat/events.ts +13 -0
  264. package/src/components/ChatCompanion.tsx +155 -0
  265. package/src/components/ChatContainer.tsx +33 -41
  266. package/src/components/ChatDialog.tsx +19 -12
  267. package/src/components/ChatProgress/ChatProgress.tsx +67 -0
  268. package/src/components/{Timeline → ChatProgress}/index.ts +1 -1
  269. package/src/components/ChatPrompt/ChatActions.tsx +10 -26
  270. package/src/components/ChatPrompt/ChatOptions.tsx +203 -34
  271. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  272. package/src/components/ChatPrompt/ChatReferences.tsx +29 -36
  273. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  274. package/src/components/ChatThread/ChatThread.stories.tsx +92 -204
  275. package/src/components/ChatThread/ChatThread.tsx +65 -35
  276. package/src/components/ChatThread/Link.tsx +8 -21
  277. package/src/components/ChatThread/reducers.ts +151 -0
  278. package/src/components/ChatThread/registry.tsx +174 -0
  279. package/src/components/ChatThread/sync.test.ts +89 -0
  280. package/src/components/ChatThread/sync.ts +148 -0
  281. package/src/components/ChatThread/testing/thread.md +37 -0
  282. package/src/components/PromptArticle.tsx +51 -0
  283. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +29 -15
  284. package/src/components/TemplateEditor/TemplateEditor.tsx +28 -53
  285. package/src/components/TemplateEditor/TemplateForm.stories.tsx +7 -9
  286. package/src/components/TemplateEditor/TemplateForm.tsx +3 -2
  287. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
  288. package/src/components/TemplateEditor/extensions/index.ts +6 -0
  289. package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
  290. package/src/components/ToolBlock/ToolBlock.tsx +143 -0
  291. package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
  292. package/src/components/ToolBlock/index.ts +6 -0
  293. package/src/components/Toolbox/Toolbox.stories.tsx +11 -14
  294. package/src/components/Toolbox/Toolbox.tsx +15 -21
  295. package/src/components/index.ts +3 -4
  296. package/src/functions/analysis.ts +5 -3
  297. package/src/functions/index.ts +2 -2
  298. package/src/functions/{list.ts → object-list.ts} +11 -5
  299. package/src/functions/{load.ts → object-load.ts} +9 -7
  300. package/src/hooks/index.ts +5 -5
  301. package/src/hooks/useBlueprintRegistry.ts +26 -10
  302. package/src/hooks/useChatProcessor.ts +26 -33
  303. package/src/hooks/useChatServices.ts +32 -53
  304. package/src/hooks/useChatToolbarActions.ts +122 -0
  305. package/src/hooks/useContextBinder.ts +30 -0
  306. package/src/hooks/useContextObjects.ts +58 -0
  307. package/src/hooks/useItemTypes.ts +37 -0
  308. package/src/hooks/usePresets.ts +4 -5
  309. package/src/hooks/useReferencesProvider.ts +2 -1
  310. package/src/index.ts +2 -0
  311. package/src/meta.ts +9 -6
  312. package/src/processor/index.ts +7 -0
  313. package/src/{hooks → processor}/presets.ts +11 -4
  314. package/src/processor/processor.test.ts +71 -0
  315. package/src/processor/processor.ts +277 -0
  316. package/src/processor/update-name.ts +56 -0
  317. package/src/queue-logger.ts +9 -13
  318. package/src/testing/index.ts +1 -1
  319. package/src/testing/test-generator.ts +261 -0
  320. package/src/testing/test-sequence.ts +1 -26
  321. package/src/testing/test-services.ts +2 -8
  322. package/src/translations.ts +44 -24
  323. package/src/types/Assistant.ts +11 -7
  324. package/src/types/AssistantAction.ts +31 -6
  325. package/src/types/service.ts +17 -9
  326. package/src/vite-env.d.ts +30 -0
  327. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs +0 -29
  328. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +0 -7
  329. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +0 -7
  330. package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +0 -7
  331. package/dist/lib/browser/SequenceContainer-627OQ557.mjs +0 -163
  332. package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
  333. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
  334. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
  335. package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +0 -7
  336. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
  337. package/dist/lib/browser/chunk-BRLHDHOF.mjs +0 -244
  338. package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +0 -7
  339. package/dist/lib/browser/chunk-HRLMD35M.mjs.map +0 -7
  340. package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
  341. package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
  342. package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
  343. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
  344. package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
  345. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
  346. package/dist/lib/browser/chunk-VEBVAHNM.mjs +0 -2231
  347. package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +0 -7
  348. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
  349. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
  350. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs +0 -81
  351. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +0 -7
  352. package/dist/lib/browser/react-surface-4HXS3YLT.mjs +0 -163
  353. package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +0 -7
  354. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
  355. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
  356. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs +0 -30
  357. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +0 -7
  358. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +0 -7
  359. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +0 -7
  360. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +0 -164
  361. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
  362. package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
  363. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
  364. package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +0 -7
  365. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
  366. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +0 -2232
  367. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +0 -7
  368. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +0 -7
  369. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
  370. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
  371. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
  372. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
  373. package/dist/lib/node-esm/chunk-RD755HN3.mjs +0 -245
  374. package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +0 -7
  375. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
  376. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
  377. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
  378. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs +0 -82
  379. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +0 -7
  380. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs +0 -164
  381. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +0 -7
  382. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
  383. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
  384. package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
  385. package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
  386. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
  387. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
  388. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
  389. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
  390. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  391. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  392. package/dist/types/src/components/PromptSettings.d.ts +0 -6
  393. package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
  394. package/dist/types/src/components/SequenceContainer.d.ts +0 -8
  395. package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
  396. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
  397. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
  398. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -8
  399. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
  400. package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
  401. package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
  402. package/dist/types/src/components/Timeline/Timeline.d.ts +0 -24
  403. package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
  404. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -9
  405. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
  406. package/dist/types/src/components/Timeline/index.d.ts +0 -2
  407. package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
  408. package/dist/types/src/functions/list.d.ts.map +0 -1
  409. package/dist/types/src/functions/load.d.ts.map +0 -1
  410. package/dist/types/src/hooks/chat-processor.d.ts +0 -72
  411. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  412. package/dist/types/src/hooks/errors.d.ts +0 -4
  413. package/dist/types/src/hooks/errors.d.ts.map +0 -1
  414. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  415. package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
  416. package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
  417. package/dist/types/src/parser/filter-generator.d.ts +0 -4
  418. package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
  419. package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
  420. package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
  421. package/dist/types/src/parser/index.d.ts +0 -4
  422. package/dist/types/src/parser/index.d.ts.map +0 -1
  423. package/dist/types/src/parser/query-parser.d.ts +0 -15
  424. package/dist/types/src/parser/query-parser.d.ts.map +0 -1
  425. package/dist/types/src/parser/query-parser.test.d.ts +0 -2
  426. package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
  427. package/dist/types/src/parser/types.d.ts +0 -24
  428. package/dist/types/src/parser/types.d.ts.map +0 -1
  429. package/dist/types/src/stories/Chat.stories.d.ts +0 -268
  430. package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
  431. package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
  432. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
  433. package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
  434. package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
  435. package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
  436. package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
  437. package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
  438. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
  439. package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
  440. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
  441. package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
  442. package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
  443. package/dist/types/src/stories/components/index.d.ts +0 -8
  444. package/dist/types/src/stories/components/index.d.ts.map +0 -1
  445. package/dist/types/src/stories/components/types.d.ts +0 -7
  446. package/dist/types/src/stories/components/types.d.ts.map +0 -1
  447. package/dist/types/src/stories/hooks/index.d.ts +0 -3
  448. package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
  449. package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
  450. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
  451. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
  452. package/dist/types/src/stories/testing/data.d.ts +0 -142
  453. package/dist/types/src/stories/testing/data.d.ts.map +0 -1
  454. package/dist/types/src/stories/testing/index.d.ts +0 -3
  455. package/dist/types/src/stories/testing/index.d.ts.map +0 -1
  456. package/dist/types/src/stories/testing/testing.d.ts +0 -26
  457. package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
  458. package/dist/types/src/testing/test-functions.d.ts +0 -6
  459. package/dist/types/src/testing/test-functions.d.ts.map +0 -1
  460. package/dist/types/src/tools/function.d.ts +0 -5
  461. package/dist/types/src/tools/function.d.ts.map +0 -1
  462. package/dist/types/src/tools/index.d.ts +0 -3
  463. package/dist/types/src/tools/index.d.ts.map +0 -1
  464. package/dist/types/src/tools/openapi.d.ts +0 -10
  465. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  466. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  467. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  468. package/src/components/BlueprintContainer.tsx +0 -24
  469. package/src/components/ChatThread/ChatMessage.tsx +0 -282
  470. package/src/components/ChatThread/ToolBlock.tsx +0 -125
  471. package/src/components/ChatThread/reducer.ts +0 -52
  472. package/src/components/PromptSettings.tsx +0 -89
  473. package/src/components/SequenceContainer.tsx +0 -133
  474. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
  475. package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
  476. package/src/components/SequenceEditor/index.ts +0 -5
  477. package/src/components/Timeline/Timeline.stories.tsx +0 -53
  478. package/src/components/Timeline/Timeline.tsx +0 -159
  479. package/src/hooks/chat-processor.ts +0 -260
  480. package/src/hooks/errors.ts +0 -8
  481. package/src/hooks/useResolveRef.ts +0 -33
  482. package/src/parser/filter-generator.test.ts +0 -32
  483. package/src/parser/filter-generator.ts +0 -74
  484. package/src/parser/index.ts +0 -7
  485. package/src/parser/query-parser.test.ts +0 -139
  486. package/src/parser/query-parser.ts +0 -199
  487. package/src/parser/types.ts +0 -34
  488. package/src/shims.d.ts +0 -8
  489. package/src/stories/Chat.stories.tsx +0 -317
  490. package/src/stories/components/BlueprintContainer.tsx +0 -34
  491. package/src/stories/components/ChatContainer.tsx +0 -80
  492. package/src/stories/components/GraphContainer.tsx +0 -118
  493. package/src/stories/components/LoggingContainer.tsx +0 -22
  494. package/src/stories/components/SurfaceContainer.tsx +0 -62
  495. package/src/stories/components/TasksContainer.tsx +0 -51
  496. package/src/stories/components/index.ts +0 -12
  497. package/src/stories/components/types.ts +0 -11
  498. package/src/stories/hooks/index.ts +0 -6
  499. package/src/stories/hooks/useMatcherExtension.ts +0 -45
  500. package/src/stories/testing/data.ts +0 -130
  501. package/src/stories/testing/index.ts +0 -6
  502. package/src/stories/testing/testing.tsx +0 -162
  503. package/src/testing/test-functions.ts +0 -16
  504. package/src/tools/function.ts +0 -49
  505. package/src/tools/index.ts +0 -6
  506. package/src/tools/openapi.test.ts +0 -219
  507. package/src/tools/openapi.ts +0 -341
  508. package/src/typings.d.ts +0 -9
  509. /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
  510. /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
@@ -1,317 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta, type StoryObj } from '@storybook/react-vite';
8
- import React, { type FC, useCallback } from 'react';
9
-
10
- import { EXA_API_KEY } from '@dxos/ai/testing';
11
- import { Capabilities, useCapabilities } from '@dxos/app-framework';
12
- import { RESEARCH_BLUEPRINT, ResearchDataTypes, ResearchGraph } from '@dxos/assistant-testing';
13
- import { Filter, Obj, Ref } from '@dxos/echo';
14
- import { log } from '@dxos/log';
15
- import { Board, BoardPlugin } from '@dxos/plugin-board';
16
- import { Chess, ChessPlugin } from '@dxos/plugin-chess';
17
- import { InboxPlugin } from '@dxos/plugin-inbox';
18
- import { Map, MapPlugin } from '@dxos/plugin-map';
19
- import { MarkdownPlugin } from '@dxos/plugin-markdown';
20
- import { Markdown } from '@dxos/plugin-markdown';
21
- import { TablePlugin } from '@dxos/plugin-table';
22
- import { useClient } from '@dxos/react-client';
23
- import { useSpace } from '@dxos/react-client/echo';
24
- import { useAsyncEffect } from '@dxos/react-ui';
25
- import { DataType } from '@dxos/schema';
26
- import { render } from '@dxos/storybook-utils';
27
- import { trim } from '@dxos/util';
28
-
29
- import { translations } from '../translations';
30
- import { Assistant } from '../types';
31
-
32
- import {
33
- BlueprintContainer,
34
- ChatContainer,
35
- type ComponentProps,
36
- GraphContainer,
37
- LoggingContainer,
38
- SurfaceContainer,
39
- TasksContainer,
40
- } from './components';
41
- import { addTestData, config, getDecorators, testTypes } from './testing';
42
-
43
- const DefaultStory = ({
44
- debug = true,
45
- components,
46
- blueprints = [],
47
- }: {
48
- debug?: boolean;
49
- components: (FC<ComponentProps> | FC<ComponentProps>[])[];
50
- blueprints?: string[];
51
- }) => {
52
- const client = useClient();
53
- const space = useSpace();
54
-
55
- const blueprintsDefinitions = useCapabilities(Capabilities.BlueprintDefinition);
56
- useAsyncEffect(async () => {
57
- if (!space) {
58
- return;
59
- }
60
- const { objects: chats = [] } = await space.db.query(Filter.type(Assistant.Chat)).run();
61
- const chat = chats[0];
62
- if (!chat) {
63
- return;
64
- }
65
-
66
- // TODO(burdon): Active should be ephemeral state of AiProcessor; write on edit/prompt.
67
-
68
- // TODO(burdon): RACE CONDITION; must handle concurrently adding multiple blueprints instances with same key.
69
- // Add blueprints to context.
70
- // const binder = new AiContextBinder(await chat.queue.load());
71
- // for (const key of blueprints) {
72
- // const blueprint = blueprintsDefinitions.find((blueprint) => blueprint.key === key);
73
- // if (blueprint) {
74
- // const obj = space.db.add(Obj.clone(blueprint));
75
- // await binder.bind({ blueprints: [Ref.make(obj)] });
76
- // }
77
- // }
78
- }, [space, blueprints, blueprintsDefinitions]);
79
-
80
- const handleEvent = useCallback<NonNullable<ComponentProps['onEvent']>>((event) => {
81
- log.info('event', { event });
82
- switch (event) {
83
- case 'reset': {
84
- void client?.reset().then(() => {
85
- document.location.reload();
86
- });
87
- break;
88
- }
89
- }
90
- }, []);
91
-
92
- if (!space) {
93
- return null;
94
- }
95
-
96
- return (
97
- <div
98
- className='grid grid-cols gap-2 m-2'
99
- style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
100
- >
101
- {components.map((Component, index) =>
102
- Array.isArray(Component) ? (
103
- <div
104
- key={index}
105
- className='grid grid-rows gap-2 overflow-hidden'
106
- style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
107
- >
108
- {Component.map((Component, index) => (
109
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface rounded border border-separator'>
110
- <Component space={space} debug={debug} onEvent={handleEvent} />
111
- </div>
112
- ))}
113
- </div>
114
- ) : (
115
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface rounded border border-separator'>
116
- <Component space={space} debug={debug} onEvent={handleEvent} />
117
- </div>
118
- ),
119
- )}
120
- </div>
121
- );
122
- };
123
-
124
- const storybook = {
125
- title: 'plugins/plugin-assistant/Chat',
126
- render: render(DefaultStory),
127
- parameters: {
128
- translations,
129
- controls: { disable: true },
130
- },
131
- } satisfies Meta<typeof DefaultStory>;
132
-
133
- export default storybook;
134
-
135
- type Story = StoryObj<typeof storybook>;
136
-
137
- //
138
- // Stories
139
- //
140
-
141
- export const Default = {
142
- decorators: getDecorators({
143
- config: config.remote,
144
- }),
145
- args: {
146
- components: [ChatContainer],
147
- },
148
- } satisfies Story;
149
-
150
- export const WithDocument = {
151
- decorators: getDecorators({
152
- plugins: [MarkdownPlugin()],
153
- config: config.remote,
154
- onInit: async ({ space, binder }) => {
155
- const object = space.db.add(
156
- Markdown.makeDocument({
157
- name: 'Document',
158
- content: trim`
159
- # Hello, world!
160
- This is a test.
161
- `,
162
- }),
163
- );
164
- await binder.bind({ objects: [Ref.make(object)] });
165
- },
166
- }),
167
- args: {
168
- components: [ChatContainer, SurfaceContainer],
169
- },
170
- } satisfies Story;
171
-
172
- export const WithBlueprints = {
173
- decorators: getDecorators({
174
- plugins: [InboxPlugin(), MarkdownPlugin(), TablePlugin()],
175
- config: config.remote,
176
- onInit: async ({ space, binder }) => {
177
- const object = space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
178
- await binder.bind({ objects: [Ref.make(object)] });
179
- },
180
- }),
181
- args: {
182
- components: [ChatContainer, [TasksContainer, BlueprintContainer]],
183
- },
184
- } satisfies Story;
185
-
186
- export const WithChess = {
187
- decorators: getDecorators({
188
- plugins: [ChessPlugin()],
189
- config: config.remote,
190
- types: [Chess.Game],
191
- onInit: async ({ space, binder }) => {
192
- // TODO(burdon): Add player DID (for user and assistant).
193
- const object = space.db.add(
194
- Chess.makeGame({
195
- name: 'Challenge',
196
- pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
197
- }),
198
- );
199
- await binder.bind({ objects: [Ref.make(object)] });
200
- },
201
- }),
202
- args: {
203
- components: [ChatContainer, SurfaceContainer],
204
- blueprints: ['dxos.org/blueprint/assistant', 'dxos.org/blueprint/chess'],
205
- },
206
- } satisfies Story;
207
-
208
- export const WithMap = {
209
- decorators: getDecorators({
210
- plugins: [MapPlugin()],
211
- config: config.remote,
212
- types: [Map.Map],
213
- onInit: async ({ space, binder }) => {
214
- const object = space.db.add(Map.makeMap());
215
- await binder.bind({ objects: [Ref.make(object)] });
216
- },
217
- }),
218
- args: {
219
- components: [ChatContainer, SurfaceContainer],
220
- },
221
- } satisfies Story;
222
-
223
- export const WithTrip = {
224
- decorators: getDecorators({
225
- plugins: [MarkdownPlugin(), MapPlugin()],
226
- config: config.remote,
227
- types: [Map.Map],
228
- onInit: async ({ space, binder }) => {
229
- // TODO(burdon): Table.
230
- {
231
- const object = space.db.add(Map.makeMap({ name: 'Trip' }));
232
- await binder.bind({ objects: [Ref.make(object)] });
233
- }
234
- {
235
- const object = space.db.add(
236
- Markdown.makeDocument({
237
- name: 'Itinerary',
238
- content: trim`
239
- # Itinerary
240
-
241
- ## Day 1
242
- - Visit the Sagrada Familia
243
- - Visit the Park Güell
244
- - Visit the Casa Batlló
245
-
246
- ## Day 2
247
- - Visit the Eiffel Tower
248
- - Visit the Louvre
249
- - Visit the Musée d'Orsay
250
- `,
251
- }),
252
- );
253
- await binder.bind({ objects: [Ref.make(object)] });
254
- }
255
- {
256
- const object = space.db.add(
257
- Markdown.makeDocument({
258
- name: 'Barcelona',
259
- content: trim`
260
- # Barcelona
261
-
262
- Barcelona is the capital and most populous city of Catalonia, an autonomous community in northeastern Spain.
263
- It is located on the Mediterranean coast, on the banks of the Llobregat River, in the comarca of the Baix Llobregat.
264
- The city is known for its rich history, vibrant culture, and stunning architecture, including the Sagrada Familia, Park Güell, and Casa Batlló.
265
- `,
266
- }),
267
- );
268
- await binder.bind({ objects: [Ref.make(object)] });
269
- }
270
- },
271
- }),
272
- args: {
273
- components: [ChatContainer, SurfaceContainer],
274
- },
275
- } satisfies Story;
276
-
277
- export const WithBoard = {
278
- decorators: getDecorators({
279
- plugins: [BoardPlugin()],
280
- config: config.remote,
281
- types: [Board.Board],
282
- onInit: async ({ space, binder }) => {
283
- const object = space.db.add(Board.makeBoard());
284
- await binder.bind({ objects: [Ref.make(object)] });
285
- },
286
- }),
287
- args: {
288
- debug: true,
289
- components: [ChatContainer, SurfaceContainer],
290
- },
291
- } satisfies Story;
292
-
293
- export const WithResearch = {
294
- decorators: getDecorators({
295
- plugins: [MarkdownPlugin(), TablePlugin()],
296
- config: config.persistent,
297
- types: [...ResearchDataTypes, ResearchGraph, DataType.AccessToken],
298
- accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
299
- }),
300
- args: {
301
- components: [ChatContainer, [GraphContainer, BlueprintContainer, LoggingContainer]],
302
- blueprints: [RESEARCH_BLUEPRINT.key],
303
- },
304
- } satisfies Story;
305
-
306
- export const WithSearch = {
307
- decorators: getDecorators({
308
- config: config.remote,
309
- types: testTypes,
310
- onInit: async ({ space }) => {
311
- await addTestData(space);
312
- },
313
- }),
314
- args: {
315
- components: [ChatContainer, [GraphContainer]],
316
- },
317
- } satisfies Story;
@@ -1,34 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React from 'react';
8
-
9
- import { Blueprint } from '@dxos/blueprints';
10
- import { Filter, Obj } from '@dxos/echo';
11
- import { useQuery } from '@dxos/react-client/echo';
12
- import { Toolbar } from '@dxos/react-ui';
13
-
14
- import { TemplateEditor } from '../../components';
15
-
16
- import { type ComponentProps } from './types';
17
-
18
- export const BlueprintContainer = ({ space }: ComponentProps) => {
19
- const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
20
- if (!blueprint?.instructions) {
21
- return null;
22
- }
23
-
24
- return (
25
- <div className='flex flex-col h-full'>
26
- <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
27
- <h2>{Obj.getLabel(blueprint)}</h2>
28
- <div className='flex-1' />
29
- <Toolbar.IconButton icon='ph--arrow-clockwise--regular' iconOnly label='Refresh' />
30
- </Toolbar.Root>
31
- <TemplateEditor id={blueprint.id} template={blueprint.instructions} />
32
- </div>
33
- );
34
- };
@@ -1,80 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React, { useCallback, useEffect, useState } from 'react';
8
-
9
- import { Filter, Obj, Ref } from '@dxos/echo';
10
- import { invariant } from '@dxos/invariant';
11
- import { log } from '@dxos/log';
12
- import { useQuery } from '@dxos/react-client/echo';
13
- import { Toolbar, useTranslation } from '@dxos/react-ui';
14
-
15
- import { Chat } from '../../components';
16
- import { useBlueprintRegistry, useChatProcessor, useChatServices } from '../../hooks';
17
- import { useOnline, usePresets } from '../../hooks';
18
- import { meta } from '../../meta';
19
- import { Assistant } from '../../types';
20
-
21
- import { type ComponentProps } from './types';
22
-
23
- export const ChatContainer = ({ space, onEvent }: ComponentProps) => {
24
- const { t } = useTranslation(meta.id);
25
- const [online, setOnline] = useOnline();
26
- const { preset, ...chatProps } = usePresets(online);
27
-
28
- const chats = useQuery(space, Filter.type(Assistant.Chat));
29
- const [chat, setChat] = useState<Assistant.Chat>();
30
- useEffect(() => {
31
- setChat((currentChat) => currentChat ?? chats[0]);
32
- }, [chat, chats]);
33
-
34
- const blueprintRegistry = useBlueprintRegistry();
35
- const services = useChatServices({ space });
36
- const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry });
37
-
38
- const handleNewChat = useCallback(() => {
39
- invariant(space);
40
- const chat = space.db.add(
41
- Obj.make(Assistant.Chat, {
42
- queue: Ref.fromDXN(space.queues.create().dxn),
43
- }),
44
- );
45
- setChat(chat);
46
- }, [space]);
47
-
48
- const handleBranchChat = useCallback(() => {}, [space]);
49
-
50
- return (
51
- <>
52
- <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
53
- <Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
54
- <Toolbar.IconButton
55
- disabled
56
- icon='ph--git-branch--regular'
57
- iconOnly
58
- label={t('button branch thread')}
59
- onClick={handleBranchChat}
60
- />
61
- <div className='flex-1' />
62
- <Toolbar.IconButton icon='ph--trash--regular' iconOnly label='Reset' onClick={() => onEvent?.('reset')} />
63
- </Toolbar.Root>
64
- {!chat || !processor ? null : (
65
- <Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
66
- <Chat.Thread />
67
- <div className='p-4'>
68
- <Chat.Prompt
69
- {...chatProps}
70
- classNames='p-2 border border-transparent rounded focus-within:outline focus-within:border-transparent outline-primary-500'
71
- preset={preset?.id}
72
- online={online}
73
- onChangeOnline={setOnline}
74
- />
75
- </div>
76
- </Chat.Root>
77
- )}
78
- </>
79
- );
80
- };
@@ -1,118 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Match } from 'effect';
6
- import React, { useCallback, useEffect, useRef, useState } from 'react';
7
-
8
- import { ResearchGraph } from '@dxos/assistant-testing';
9
- import { Filter, Query } from '@dxos/echo';
10
- import { D3ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
11
- import { useQuery } from '@dxos/react-client/echo';
12
- import { IconButton, Toolbar } from '@dxos/react-ui';
13
- import { ChatEditor, type ChatEditorController, type ChatEditorProps } from '@dxos/react-ui-chat';
14
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
15
- import { mx } from '@dxos/react-ui-theme';
16
-
17
- import { type Expression, QueryParser, createFilter } from '../../parser';
18
- import { useFlush, useMatcherExtension } from '../hooks';
19
-
20
- import { type ComponentProps } from './types';
21
-
22
- export const GraphContainer = ({ space }: ComponentProps) => {
23
- const [ast, setAst] = useState<Expression | undefined>();
24
- const [filter, setFilter] = useState<Filter.Any>();
25
- const [open, setOpen] = useState(false);
26
-
27
- const [researchGraph] = useQuery(space, Query.type(ResearchGraph));
28
- const queue = researchGraph?.queue.target;
29
-
30
- const model = useGraphModel(space, undefined, undefined, queue);
31
- useEffect(() => {
32
- model?.setFilter(filter ?? Filter.everything());
33
- }, [model, filter]);
34
-
35
- const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
36
- (text) => {
37
- try {
38
- const parser = new QueryParser(text);
39
- const ast = parser.parse();
40
- setAst(ast);
41
- const filter = createFilter(ast);
42
- setFilter(filter);
43
- setOpen(true);
44
- } catch {
45
- // TODO(mykola): Make hybrid search.
46
- const filter = Filter.text(text, { type: 'vector' });
47
- setFilter(filter);
48
- }
49
- },
50
- [space],
51
- );
52
-
53
- return (
54
- <div className={mx('relative grid h-full', open && 'grid-rows-[min-content_1fr]')}>
55
- <SearchBar space={space} onSubmit={handleSubmit} />
56
- <D3ForceGraph model={model} />
57
-
58
- {/* TODO(burdon): Create component with context state for story. */}
59
- {(open && (
60
- <div className='absolute left-2 right-2 bottom-2 h-[8rem] flex overflow-hidden bg-baseSurface border border-subduedSeparator'>
61
- <SyntaxHighlighter language='json' classNames='text-sm'>
62
- {JSON.stringify({ ast, filter }, null, 2)}
63
- </SyntaxHighlighter>
64
- <div className='absolute bottom-1 right-1'>
65
- <IconButton variant='ghost' icon='ph--x--regular' iconOnly label='Close' onClick={() => setOpen(false)} />
66
- </div>
67
- </div>
68
- )) || (
69
- <div className='absolute bottom-3 right-3'>
70
- <IconButton
71
- variant='ghost'
72
- icon='ph--arrow-line-up--regular'
73
- iconOnly
74
- label='Open'
75
- onClick={() => setOpen(true)}
76
- />
77
- </div>
78
- )}
79
- </div>
80
- );
81
- };
82
-
83
- export const SearchBar = ({ space, onSubmit }: ComponentProps & Pick<ChatEditorProps, 'onSubmit'>) => {
84
- const { state: flushState, handleFlush } = useFlush(space);
85
- const extensions = useMatcherExtension(space);
86
- const editorRef = useRef<ChatEditorController>(null);
87
-
88
- return (
89
- <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
90
- <ChatEditor
91
- ref={editorRef}
92
- autoFocus
93
- placeholder='Search'
94
- extensions={extensions}
95
- fireIfEmpty
96
- onSubmit={onSubmit}
97
- />
98
- <Toolbar.IconButton
99
- icon='ph--magnifying-glass--regular'
100
- iconOnly
101
- label='Search'
102
- onClick={() => onSubmit?.(editorRef.current?.getText() ?? '')}
103
- />
104
- <Toolbar.IconButton
105
- disabled={flushState === 'flushing'}
106
- icon={Match.value(flushState).pipe(
107
- Match.when('idle', () => 'ph--floppy-disk--regular'),
108
- Match.when('flushing', () => 'ph--spinner--regular'),
109
- Match.when('flushed', () => 'ph--check--regular'),
110
- Match.exhaustive,
111
- )}
112
- iconOnly
113
- label='flush'
114
- onClick={handleFlush}
115
- />
116
- </Toolbar.Root>
117
- );
118
- };
@@ -1,22 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React from 'react';
8
-
9
- import { Toolbar } from '@dxos/react-ui';
10
-
11
- import { Timeline } from '../../components';
12
-
13
- import { type ComponentProps } from './types';
14
-
15
- export const LoggingContainer = (_: ComponentProps) => {
16
- return (
17
- <div className='flex flex-col h-full'>
18
- <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>Timeline</Toolbar.Root>
19
- <Timeline branches={[]} commits={[]} />
20
- </div>
21
- );
22
- };
@@ -1,62 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React from 'react';
8
-
9
- import { Surface } from '@dxos/app-framework';
10
- import { AiContextBinder } from '@dxos/assistant';
11
- import { Filter, Obj, Ref, type Type } from '@dxos/echo';
12
- import { log } from '@dxos/log';
13
- import { useQuery } from '@dxos/react-client/echo';
14
- import { useAsyncState } from '@dxos/react-ui';
15
- import { mx } from '@dxos/react-ui-theme';
16
-
17
- import { Assistant } from '../../types';
18
-
19
- import { type ComponentProps } from './types';
20
-
21
- /**
22
- * Shows the surface relating to the first bound object to the curent chat.
23
- */
24
- export const SurfaceContainer = ({ space, debug }: ComponentProps) => {
25
- const chats = useQuery(space, Filter.type(Assistant.Chat));
26
- const [objects] = useAsyncState<Type.Expando[]>(async () => {
27
- if (!chats.length) {
28
- return [];
29
- }
30
-
31
- // Get the latest chat (is this deterministic?)
32
- const chat = chats[chats.length - 1];
33
- const binder = new AiContextBinder(chat.queue.target!);
34
- const refs = binder.objects.value;
35
- const objects = await Ref.Array.loadAll(refs);
36
- // TODO(burdon): Auto log meta for ECHO objects?
37
- log('loaded', { objects: objects.map((obj) => ({ typename: Obj.getTypename(obj), id: obj.id })) });
38
- return objects;
39
- }, [chats]);
40
-
41
- // TODO(burdon): Specify role hint to hide toolbar.
42
- return (
43
- <div className='flex flex-col bs-full overflow-y-auto divide-y divide-separator'>
44
- {objects?.map((object) => (
45
- <div key={object.id} className='group contents'>
46
- {debug && (
47
- <div
48
- className={mx(
49
- 'flex gap-2 items-center text-xs justify-center',
50
- 'text-subdued group-first:border-none border-t border-subduedSeparator',
51
- )}
52
- >
53
- <span>{Obj.getTypename(object)}</span>
54
- <span>{object.id}</span>
55
- </div>
56
- )}
57
- <Surface role='section' limit={1} data={{ subject: object }} />
58
- </div>
59
- ))}
60
- </div>
61
- );
62
- };
@@ -1,51 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React from 'react';
8
-
9
- import { Filter, Obj } from '@dxos/echo';
10
- import { Markdown } from '@dxos/plugin-markdown/types';
11
- import { createDocAccessor, useQuery } from '@dxos/react-client/echo';
12
- import { Toolbar, useThemeContext } from '@dxos/react-ui';
13
- import {
14
- Editor,
15
- createBasicExtensions,
16
- createDataExtensions,
17
- createMarkdownExtensions,
18
- createThemeExtensions,
19
- outliner,
20
- } from '@dxos/react-ui-editor';
21
-
22
- import { type ComponentProps } from './types';
23
-
24
- export const TasksContainer = ({ space }: ComponentProps) => {
25
- const { themeMode } = useThemeContext();
26
- const [document] = useQuery(space, Filter.type(Markdown.Document));
27
- if (!document?.content.target) {
28
- return null;
29
- }
30
-
31
- return (
32
- <>
33
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
34
- <h2>{Obj.getLabel(document)}</h2>
35
- </Toolbar.Root>
36
- <Editor
37
- id={document.id}
38
- text={document.content.target}
39
- classNames='h-full p-2 overflow-hidden'
40
- extensions={[
41
- // TODO(burdon): Create util.
42
- createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
43
- createBasicExtensions({ readOnly: false }),
44
- createMarkdownExtensions({ themeMode }),
45
- createThemeExtensions({ themeMode }),
46
- outliner(),
47
- ]}
48
- />
49
- </>
50
- );
51
- };
@@ -1,12 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- export * from './types';
6
-
7
- export * from './BlueprintContainer';
8
- export * from './ChatContainer';
9
- export * from './GraphContainer';
10
- export * from './LoggingContainer';
11
- export * from './SurfaceContainer';
12
- export * from './TasksContainer';