@dxos/plugin-assistant 0.8.4-main.2e9d522 → 0.8.4-main.5ea62a8

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 (472) hide show
  1. package/dist/lib/browser/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-OWUSKPRK.mjs} +11 -9
  2. package/dist/lib/browser/BlueprintContainer-OWUSKPRK.mjs.map +7 -0
  3. package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
  4. package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
  6. package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-MTPJLEHM.mjs} +26 -9
  8. package/dist/lib/browser/ChatDialog-MTPJLEHM.mjs.map +7 -0
  9. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
  10. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-NRZPTUHO.mjs +22 -0
  12. package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-7AAWTWGA.mjs} +26 -96
  14. package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +12 -0
  16. package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-6QMISAU6.mjs +167 -0
  18. package/dist/lib/browser/chunk-6QMISAU6.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-CFXXQM25.mjs +182 -0
  20. package/dist/lib/browser/chunk-CFXXQM25.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-IJAJRAR7.mjs +18 -0
  22. package/dist/lib/browser/chunk-IJAJRAR7.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  24. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
  26. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
  27. package/dist/lib/browser/chunk-OYFQS7JM.mjs +157 -0
  28. package/dist/lib/browser/chunk-OYFQS7JM.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
  30. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
  31. package/dist/lib/browser/chunk-V5H5CCZA.mjs +218 -0
  32. package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +7 -0
  33. package/dist/lib/browser/chunk-XL557TXF.mjs +2332 -0
  34. package/dist/lib/browser/chunk-XL557TXF.mjs.map +7 -0
  35. package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +22 -0
  36. package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +7 -0
  37. package/dist/lib/browser/index.mjs +154 -67
  38. package/dist/lib/browser/index.mjs.map +4 -4
  39. package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs +112 -0
  40. package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +7 -0
  41. package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +21 -0
  42. package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +7 -0
  43. package/dist/lib/browser/meta.json +1 -1
  44. package/dist/lib/browser/react-surface-VNCD2H7C.mjs +109 -0
  45. package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +7 -0
  46. package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-36V3VUMW.mjs} +6 -5
  47. package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
  48. package/dist/lib/browser/state-D5IVKNYG.mjs +21 -0
  49. package/dist/lib/browser/state-D5IVKNYG.mjs.map +7 -0
  50. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
  51. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
  52. package/dist/lib/browser/types/index.mjs +7 -4
  53. package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-UFVWCRN6.mjs} +11 -9
  54. package/dist/lib/node-esm/BlueprintContainer-UFVWCRN6.mjs.map +7 -0
  55. package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +127 -0
  56. package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +7 -0
  57. package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
  58. package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
  59. package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-JLM7RDZQ.mjs} +26 -9
  60. package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.mjs.map +7 -0
  61. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
  62. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
  63. package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs +23 -0
  64. package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +7 -0
  65. package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-PNAFQUYT.mjs} +26 -96
  66. package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +7 -0
  67. package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs +13 -0
  68. package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-2X6VEO32.mjs +2333 -0
  70. package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
  72. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-CAQKGW3B.mjs +159 -0
  74. package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-FNZJJL7G.mjs +183 -0
  76. package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +7 -0
  77. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  78. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  79. package/dist/lib/node-esm/chunk-RLBN4RNR.mjs +168 -0
  80. package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +7 -0
  81. package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +219 -0
  82. package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs.map +7 -0
  83. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
  84. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
  85. package/dist/lib/node-esm/chunk-YPXEA46Q.mjs +19 -0
  86. package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +7 -0
  87. package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +23 -0
  88. package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +7 -0
  89. package/dist/lib/node-esm/index.mjs +154 -67
  90. package/dist/lib/node-esm/index.mjs.map +4 -4
  91. package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs +113 -0
  92. package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +7 -0
  93. package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +22 -0
  94. package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +7 -0
  95. package/dist/lib/node-esm/meta.json +1 -1
  96. package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs +110 -0
  97. package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +7 -0
  98. package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-7ZCZ6AS5.mjs} +6 -5
  99. package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
  100. package/dist/lib/node-esm/state-4VLKPLW3.mjs +22 -0
  101. package/dist/lib/node-esm/state-4VLKPLW3.mjs.map +7 -0
  102. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
  103. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
  104. package/dist/lib/node-esm/types/index.mjs +7 -4
  105. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  106. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  107. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  108. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  109. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  110. package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
  111. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  112. package/dist/types/src/capabilities/capabilities.d.ts +19 -0
  113. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  114. package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
  115. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  116. package/dist/types/src/capabilities/index.d.ts +11 -3
  117. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  118. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  119. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  120. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  121. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  122. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  123. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  124. package/dist/types/src/capabilities/settings.d.ts +1 -1
  125. package/dist/types/src/capabilities/state.d.ts +4 -0
  126. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  127. package/dist/types/src/capabilities/toolkit.d.ts +4 -0
  128. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  129. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  130. package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
  131. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  132. package/dist/types/src/components/Chat/Chat.d.ts +19 -16
  133. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  134. package/dist/types/src/components/Chat/events.d.ts +5 -0
  135. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  136. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  137. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  138. package/dist/types/src/components/ChatContainer.d.ts +4 -4
  139. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  140. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  141. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  142. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  143. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  144. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  145. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  146. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
  147. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  148. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  149. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
  150. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  151. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  152. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  153. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  154. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  155. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +21 -5
  156. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
  157. package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -4
  158. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  159. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +108 -72
  160. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  161. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  162. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  163. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +12 -12
  164. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
  165. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  166. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  167. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  168. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  169. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  170. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +257 -2
  171. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  172. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
  173. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  174. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +257 -6
  175. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  176. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
  177. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  178. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +254 -1
  179. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  180. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
  181. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
  182. package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -0
  183. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  184. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  185. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  186. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
  187. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
  188. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
  189. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  190. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +258 -4
  191. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  192. package/dist/types/src/components/index.d.ts +5 -2
  193. package/dist/types/src/components/index.d.ts.map +1 -1
  194. package/dist/types/src/events.d.ts +1 -1
  195. package/dist/types/src/events.d.ts.map +1 -1
  196. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  197. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  198. package/dist/types/src/execution-graph/index.d.ts +2 -0
  199. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  200. package/dist/types/src/functions/analysis.d.ts +5 -0
  201. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  202. package/dist/types/src/functions/index.d.ts +4 -0
  203. package/dist/types/src/functions/index.d.ts.map +1 -0
  204. package/dist/types/src/functions/list.d.ts +10 -0
  205. package/dist/types/src/functions/list.d.ts.map +1 -0
  206. package/dist/types/src/functions/load.d.ts +8 -0
  207. package/dist/types/src/functions/load.d.ts.map +1 -0
  208. package/dist/types/src/hooks/index.d.ts +10 -3
  209. package/dist/types/src/hooks/index.d.ts.map +1 -1
  210. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
  211. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  212. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -20
  213. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  214. package/dist/types/src/hooks/useChatServices.d.ts +4 -5
  215. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  216. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  217. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  218. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  219. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  220. package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
  221. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  222. package/dist/types/src/hooks/useFlush.d.ts +6 -0
  223. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  224. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  225. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  226. package/dist/types/src/hooks/useMatcherExtension.d.ts +3 -0
  227. package/dist/types/src/hooks/useMatcherExtension.d.ts.map +1 -0
  228. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  229. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  230. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  231. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  232. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  233. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  234. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  235. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  236. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  237. package/dist/types/src/parser/types.d.ts.map +1 -1
  238. package/dist/types/src/processor/index.d.ts +3 -0
  239. package/dist/types/src/processor/index.d.ts.map +1 -0
  240. package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
  241. package/dist/types/src/processor/presets.d.ts.map +1 -0
  242. package/dist/types/src/processor/processor.d.ts +80 -0
  243. package/dist/types/src/processor/processor.d.ts.map +1 -0
  244. package/dist/types/src/processor/processor.test.d.ts +2 -0
  245. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  246. package/dist/types/src/stories/Chat.stories.d.ts +23 -246
  247. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  248. package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
  249. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  250. package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
  251. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  252. package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
  253. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
  254. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  255. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  256. package/dist/types/src/stories/components/LoggingContainer.d.ts +4 -0
  257. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  258. package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
  259. package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
  260. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  261. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  262. package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
  263. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  264. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
  265. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
  266. package/dist/types/src/stories/components/index.d.ts +11 -0
  267. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  268. package/dist/types/src/stories/components/types.d.ts +7 -0
  269. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  270. package/dist/types/src/stories/testing/data.d.ts +5 -0
  271. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  272. package/dist/types/src/stories/testing/index.d.ts +3 -0
  273. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  274. package/dist/types/src/stories/testing/testing.d.ts +44 -0
  275. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  276. package/dist/types/src/testing/index.d.ts +2 -1
  277. package/dist/types/src/testing/index.d.ts.map +1 -1
  278. package/dist/types/src/testing/test-data.d.ts +4 -0
  279. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  280. package/dist/types/src/testing/test-functions.d.ts +5 -2
  281. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  282. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  283. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  284. package/dist/types/src/translations.d.ts +27 -21
  285. package/dist/types/src/translations.d.ts.map +1 -1
  286. package/dist/types/src/types/Assistant.d.ts +42 -0
  287. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  288. package/dist/types/src/types/AssistantAction.d.ts +107 -0
  289. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  290. package/dist/types/src/types/defs.d.ts +2 -0
  291. package/dist/types/src/types/defs.d.ts.map +1 -0
  292. package/dist/types/src/types/index.d.ts +3 -1
  293. package/dist/types/src/types/index.d.ts.map +1 -1
  294. package/dist/types/src/types/service.d.ts +9 -6
  295. package/dist/types/src/types/service.d.ts.map +1 -1
  296. package/dist/types/tsconfig.tsbuildinfo +1 -1
  297. package/package.json +97 -77
  298. package/src/AssistantPlugin.tsx +74 -12
  299. package/src/capabilities/ai-service.ts +28 -0
  300. package/src/capabilities/app-graph-builder.ts +43 -134
  301. package/src/capabilities/blueprint-definition.ts +42 -0
  302. package/src/capabilities/capabilities.ts +31 -0
  303. package/src/capabilities/edge-model-resolver.ts +27 -0
  304. package/src/capabilities/index.ts +9 -0
  305. package/src/capabilities/intent-resolver.ts +50 -14
  306. package/src/capabilities/local-model-resolver.ts +32 -0
  307. package/src/capabilities/react-surface.tsx +17 -64
  308. package/src/capabilities/state.ts +20 -0
  309. package/src/capabilities/toolkit.ts +163 -0
  310. package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
  311. package/src/components/BlueprintContainer.tsx +24 -0
  312. package/src/components/Chat/Chat.tsx +171 -165
  313. package/src/components/Chat/events.ts +7 -0
  314. package/src/components/ChatCompanion.tsx +111 -0
  315. package/src/components/ChatContainer.tsx +19 -13
  316. package/src/components/ChatDialog.tsx +11 -7
  317. package/src/components/ChatProgress/ChatProgress.tsx +68 -0
  318. package/src/components/ChatProgress/index.ts +5 -0
  319. package/src/components/ChatPrompt/ChatActions.tsx +10 -24
  320. package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
  321. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  322. package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
  323. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  324. package/src/components/ChatPrompt/index.ts +1 -1
  325. package/src/components/ChatThread/ChatMessage.tsx +214 -148
  326. package/src/components/ChatThread/ChatThread.stories.tsx +244 -104
  327. package/src/components/ChatThread/ChatThread.tsx +44 -22
  328. package/src/components/ChatThread/Link.tsx +23 -0
  329. package/src/components/ChatThread/ToolBlock.tsx +103 -77
  330. package/src/components/ChatThread/reducers.ts +151 -0
  331. package/src/components/PromptSettings.tsx +1 -0
  332. package/src/components/SequenceContainer.tsx +27 -28
  333. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
  334. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  335. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +27 -14
  336. package/src/components/TemplateEditor/TemplateEditor.tsx +20 -51
  337. package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -8
  338. package/src/components/TemplateEditor/TemplateForm.tsx +6 -3
  339. package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
  340. package/src/components/Toolbar/Toolbar.tsx +20 -0
  341. package/src/components/Toolbar/index.ts +5 -0
  342. package/src/components/Toolbar/useChatToolbarActions.ts +125 -0
  343. package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
  344. package/src/components/Toolbox/Toolbox.tsx +21 -51
  345. package/src/components/index.ts +4 -5
  346. package/src/events.ts +2 -2
  347. package/src/execution-graph/execution-graph.ts +211 -0
  348. package/src/execution-graph/index.ts +5 -0
  349. package/src/functions/analysis.ts +20 -0
  350. package/src/functions/index.ts +7 -0
  351. package/src/functions/list.ts +46 -0
  352. package/src/functions/load.ts +43 -0
  353. package/src/hooks/index.ts +10 -4
  354. package/src/hooks/useBlueprintRegistry.ts +80 -0
  355. package/src/hooks/useChatProcessor.ts +20 -97
  356. package/src/hooks/useChatServices.ts +34 -61
  357. package/src/hooks/useContextBinder.ts +18 -0
  358. package/src/hooks/useContextObjects.ts +58 -0
  359. package/src/hooks/useExecutionGraph.ts +20 -0
  360. package/src/hooks/useFlush.ts +35 -0
  361. package/src/hooks/useItemTypes.ts +37 -0
  362. package/src/hooks/useMatcherExtension.ts +45 -0
  363. package/src/hooks/useOnline.ts +10 -0
  364. package/src/hooks/usePresets.ts +44 -0
  365. package/src/hooks/useReferencesProvider.ts +11 -9
  366. package/src/hooks/useResolveRef.ts +33 -0
  367. package/src/meta.ts +1 -1
  368. package/src/parser/filter-generator.ts +8 -13
  369. package/src/parser/query-parser.ts +1 -1
  370. package/src/parser/types.ts +2 -0
  371. package/src/processor/index.ts +6 -0
  372. package/src/{hooks → processor}/presets.ts +14 -6
  373. package/src/processor/processor.test.ts +77 -0
  374. package/src/processor/processor.ts +304 -0
  375. package/src/queue-logger.ts +5 -5
  376. package/src/stories/Chat.stories.tsx +389 -298
  377. package/src/stories/components/BlueprintContainer.tsx +32 -0
  378. package/src/stories/components/ChatContainer.tsx +57 -0
  379. package/src/stories/components/CommentsContainer.tsx +25 -0
  380. package/src/stories/components/GraphContainer.tsx +118 -0
  381. package/src/stories/components/LoggingContainer.tsx +21 -0
  382. package/src/stories/components/MessageContainer.tsx +27 -0
  383. package/src/stories/components/SurfaceContainer.tsx +52 -0
  384. package/src/stories/components/TasksContainer.tsx +49 -0
  385. package/src/stories/components/TokenManagerContainer.tsx +14 -0
  386. package/src/stories/components/index.ts +15 -0
  387. package/src/stories/components/types.ts +11 -0
  388. package/src/stories/testing/data.ts +142 -0
  389. package/src/stories/testing/index.ts +6 -0
  390. package/src/stories/testing/testing.tsx +254 -0
  391. package/src/testing/index.ts +2 -1
  392. package/src/testing/test-data.ts +109 -0
  393. package/src/testing/test-functions.ts +8 -3
  394. package/src/testing/test-sequence.ts +2 -27
  395. package/src/translations.ts +31 -21
  396. package/src/types/Assistant.ts +61 -0
  397. package/src/types/AssistantAction.ts +62 -0
  398. package/src/types/defs.ts +5 -0
  399. package/src/types/index.ts +4 -1
  400. package/src/vite-env.d.ts +30 -0
  401. package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
  402. package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
  403. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  404. package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
  405. package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
  406. package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
  407. package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
  408. package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
  409. package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
  410. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  411. package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
  412. package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
  413. package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
  414. package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
  415. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
  416. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
  417. package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
  418. package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
  419. package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
  420. package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
  421. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  422. package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
  423. package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
  424. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
  425. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
  426. package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
  427. package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
  428. package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
  429. package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
  430. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  431. package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
  432. package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
  433. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
  434. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
  435. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
  436. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
  437. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  438. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  439. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  440. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  441. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  442. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  443. package/dist/types/src/hooks/chat-processor.d.ts +0 -86
  444. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  445. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  446. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  447. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  448. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  449. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  450. package/dist/types/src/tools/function.d.ts +0 -5
  451. package/dist/types/src/tools/function.d.ts.map +0 -1
  452. package/dist/types/src/tools/index.d.ts +0 -3
  453. package/dist/types/src/tools/index.d.ts.map +0 -1
  454. package/dist/types/src/tools/openapi.d.ts +0 -10
  455. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  456. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  457. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  458. package/dist/types/src/types/schema.d.ts +0 -88
  459. package/dist/types/src/types/schema.d.ts.map +0 -1
  460. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  461. package/src/components/ChatThread/reducer.ts +0 -52
  462. package/src/components/TemplateContainer.tsx +0 -24
  463. package/src/hooks/chat-processor.test.ts +0 -16
  464. package/src/hooks/chat-processor.ts +0 -314
  465. package/src/hooks/useBlueprints.ts +0 -57
  466. package/src/shims.d.ts +0 -8
  467. package/src/tools/function.ts +0 -46
  468. package/src/tools/index.ts +0 -6
  469. package/src/tools/openapi.test.ts +0 -217
  470. package/src/tools/openapi.ts +0 -338
  471. package/src/types/schema.ts +0 -95
  472. package/src/typings.d.ts +0 -9
@@ -4,63 +4,113 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react-vite';
8
- import React, { useCallback, useEffect, useMemo, useState, type FC } from 'react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
+ import React, { type FC, useCallback } from 'react';
9
9
 
10
- import { Capabilities, contributes, Events, IntentPlugin, type Plugin, SettingsPlugin } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { ContextBinder } from '@dxos/assistant';
13
- import {
14
- DESIGN_BLUEPRINT,
15
- TASK_BLUEPRINT,
16
- readDocument,
17
- remoteServiceEndpoints,
18
- writeDocument,
19
- } from '@dxos/assistant-testing';
10
+ import { EXA_API_KEY } from '@dxos/ai/testing';
11
+ import { Capabilities, useCapabilities } from '@dxos/app-framework';
12
+ import { AiContextBinder } from '@dxos/assistant';
13
+ import { LINEAR_BLUEPRINT, RESEARCH_BLUEPRINT, ResearchDataTypes, ResearchGraph } from '@dxos/assistant-testing';
20
14
  import { Blueprint } from '@dxos/blueprints';
21
15
  import { Filter, Obj, Ref } from '@dxos/echo';
22
- import { invariant } from '@dxos/invariant';
23
16
  import { log } from '@dxos/log';
24
- import { ChessPlugin } from '@dxos/plugin-chess';
25
- import { ClientPlugin } from '@dxos/plugin-client';
17
+ import { Board, BoardPlugin } from '@dxos/plugin-board';
18
+ import { Chess, ChessPlugin } from '@dxos/plugin-chess';
26
19
  import { InboxPlugin } from '@dxos/plugin-inbox';
27
- import { MapPlugin } from '@dxos/plugin-map';
28
- import { MarkdownPlugin } from '@dxos/plugin-markdown';
29
- import { DocumentType } from '@dxos/plugin-markdown/types';
30
- import { SpacePlugin } from '@dxos/plugin-space';
20
+ import { Mailbox } from '@dxos/plugin-inbox/types';
21
+ import { Map, MapPlugin } from '@dxos/plugin-map';
22
+ import { createLocationSchema } from '@dxos/plugin-map/testing';
23
+ import { Markdown, MarkdownPlugin } from '@dxos/plugin-markdown';
31
24
  import { TablePlugin } from '@dxos/plugin-table';
25
+ import { ThreadPlugin } from '@dxos/plugin-thread';
26
+ import { TokenManagerPlugin } from '@dxos/plugin-token-manager';
32
27
  import { TranscriptionPlugin } from '@dxos/plugin-transcription';
33
- import { Config } from '@dxos/react-client';
34
- import { createDocAccessor, useQuery, useSpace } from '@dxos/react-client/echo';
35
- import { Toolbar, useThemeContext, useTranslation } from '@dxos/react-ui';
36
- import {
37
- Editor,
38
- createBasicExtensions,
39
- createDataExtensions,
40
- createMarkdownExtensions,
41
- createThemeExtensions,
42
- outliner,
43
- } from '@dxos/react-ui-editor';
44
- import { mx } from '@dxos/react-ui-theme';
28
+ import { Transcript } from '@dxos/plugin-transcription/types';
29
+ import { useClient } from '@dxos/react-client';
30
+ import { useSpace } from '@dxos/react-client/echo';
31
+ import { useAsyncEffect } from '@dxos/react-ui';
32
+ import { Table } from '@dxos/react-ui-table/types';
45
33
  import { DataType } from '@dxos/schema';
46
- import { render, withLayout, withTheme } from '@dxos/storybook-utils';
34
+ import { render } from '@dxos/storybook-utils';
35
+ import { isNonNullable, trim } from '@dxos/util';
47
36
 
48
- import { AssistantPlugin } from '../AssistantPlugin';
49
- import { Chat, TemplateEditor, type ChatPromptProps } from '../components';
50
- import { type AiServicePreset, AiServicePresets } from '../hooks';
51
- import { useChatProcessor, useChatServices } from '../hooks';
52
- import { meta as AssistantMeta } from '../meta';
37
+ import { BLUEPRINT_KEY } from '../capabilities';
38
+ import { createTestMailbox, createTestTranscription } from '../testing';
53
39
  import { translations } from '../translations';
54
40
  import { Assistant } from '../types';
55
41
 
56
- //
57
- // Story container
58
- //
42
+ import {
43
+ BlueprintContainer,
44
+ ChatContainer,
45
+ CommentsContainer,
46
+ type ComponentProps,
47
+ GraphContainer,
48
+ LoggingContainer,
49
+ MessageContainer,
50
+ SurfaceContainer,
51
+ TasksContainer,
52
+ TokenManagerContainer,
53
+ } from './components';
54
+ import { accessTokensFromEnv, addTestData, config, getDecorators, testTypes } from './testing';
55
+
56
+ const panelClassNames = 'flex flex-col overflow-hidden bg-baseSurface rounded border border-separator';
57
+
58
+ const DefaultStory = ({
59
+ debug = true,
60
+ components,
61
+ blueprints = [],
62
+ }: {
63
+ debug?: boolean;
64
+ components: (FC<ComponentProps> | FC<ComponentProps>[])[];
65
+ blueprints?: string[];
66
+ }) => {
67
+ const client = useClient();
68
+ const space = useSpace();
69
+
70
+ const blueprintsDefinitions = useCapabilities(Capabilities.BlueprintDefinition);
71
+ useAsyncEffect(async () => {
72
+ if (!space) {
73
+ return;
74
+ }
75
+ const { objects: chats = [] } = await space.db.query(Filter.type(Assistant.Chat)).run();
76
+ const chat = chats[0];
77
+ if (!chat) {
78
+ return;
79
+ }
80
+
81
+ // Add blueprints to context.
82
+ const binder = new AiContextBinder(await chat.queue.load());
83
+ const registry = new Blueprint.Registry(blueprintsDefinitions);
84
+ const blueprintObjects = blueprints
85
+ .map((key) => {
86
+ const blueprint = registry.getByKey(key);
87
+ if (blueprint) {
88
+ return space.db.add(Obj.clone(blueprint));
89
+ }
90
+ })
91
+ .filter(isNonNullable);
92
+ await binder.bind({ blueprints: blueprintObjects.map((blueprint) => Ref.make(blueprint)) });
93
+ }, [space, blueprints, blueprintsDefinitions]);
94
+
95
+ const handleEvent = useCallback<NonNullable<ComponentProps['onEvent']>>((event) => {
96
+ log.info('event', { event });
97
+ switch (event) {
98
+ case 'reset': {
99
+ void client?.reset().then(() => {
100
+ document.location.reload();
101
+ });
102
+ break;
103
+ }
104
+ }
105
+ }, []);
106
+
107
+ if (!space) {
108
+ return null;
109
+ }
59
110
 
60
- const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
61
111
  return (
62
112
  <div
63
- className={mx('grid grid-cols gap-2 m-2')}
113
+ className='grid grid-cols gap-2 m-2'
64
114
  style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
65
115
  >
66
116
  {components.map((Component, index) =>
@@ -71,14 +121,14 @@ const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
71
121
  style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
72
122
  >
73
123
  {Component.map((Component, index) => (
74
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
75
- <Component />
124
+ <div key={index} className={panelClassNames}>
125
+ <Component space={space} debug={debug} onEvent={handleEvent} />
76
126
  </div>
77
127
  ))}
78
128
  </div>
79
129
  ) : (
80
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
81
- <Component />
130
+ <div key={index} className={panelClassNames}>
131
+ <Component space={space} debug={debug} onEvent={handleEvent} />
82
132
  </div>
83
133
  ),
84
134
  )}
@@ -86,293 +136,334 @@ const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
86
136
  );
87
137
  };
88
138
 
89
- //
90
- // Components
91
- //
92
-
93
- const ChatContainer = () => {
94
- const { t } = useTranslation(AssistantMeta.id);
95
- const space = useSpace();
139
+ const storybook: Meta<typeof DefaultStory> = {
140
+ title: 'plugins/plugin-assistant/Chat',
141
+ render: render(DefaultStory),
142
+ parameters: {
143
+ translations,
144
+ controls: { disable: true },
145
+ },
146
+ };
96
147
 
97
- const [chat, setChat] = useState<Assistant.Chat>();
98
- useEffect(() => {
99
- const results = space?.db.query(Filter.type(Assistant.Chat)).runSync();
100
- if (results?.length) {
101
- setChat(results[0].object);
102
- }
103
- }, [space]);
104
-
105
- // TODO(burdon): Memo preset for provider.
106
- const [online, setOnline] = useState(true);
107
- const [preset, setPreset] = useState<AiServicePreset>();
108
- const presets = useMemo(
109
- () => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
110
- [online],
111
- );
112
- useEffect(() => {
113
- setPreset(presets[0]);
114
- }, [presets]);
115
-
116
- const services = useChatServices({ space });
117
- const blueprintRegistry = useMemo(() => new Blueprint.Registry([DESIGN_BLUEPRINT, TASK_BLUEPRINT]), []);
118
- const processor = useChatProcessor({
119
- preset,
120
- chat,
121
- space,
122
- services,
123
- blueprintRegistry,
124
- noPluginArtifacts: true,
125
- });
126
-
127
- const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
128
- (id) => {
129
- const preset = presets.find((preset) => preset.id === id);
130
- if (preset) {
131
- setPreset(preset);
132
- }
133
- },
134
- [presets],
135
- );
148
+ export default storybook;
136
149
 
137
- const handleNewChat = useCallback(() => {
138
- invariant(space);
139
- const chat = space.db.add(
140
- Obj.make(Assistant.Chat, {
141
- queue: Ref.fromDXN(space.queues.create().dxn),
142
- }),
143
- );
144
- setChat(chat);
145
- }, [space]);
150
+ type Story = StoryObj<typeof storybook>;
146
151
 
147
- const handleBranchChat = useCallback(() => {}, [space]);
152
+ //
153
+ // Stories
154
+ //
148
155
 
149
- if (!chat || !processor) {
150
- return null;
156
+ const MARKDOWN_DOCUMENT = trim`
157
+ # Hello, world!
158
+
159
+ This is a test document that contains Markdown content. Markdown is a lightweight markup language for writing formatted text in plain text form. Its goal is to be easy to read and write in raw form, easy to convert to HTML.
160
+
161
+ Markdown’s simplicity makes it highly adaptable: it can be written in any text editor, stored in plain .md files, and rendered into HTML, PDF, or other formats with converters. Because of this portability, it’s widely used in software documentation, static site generators, technical blogging, and collaborative platforms like GitHub and Notion.
162
+
163
+ Many applications extend the core syntax with extras (e.g., tables, task lists, math notation), but the core idea remains the same—clean, minimal markup that stays readable even without rendering.
164
+ `;
165
+
166
+ const STYLE_GUIDE = trim`
167
+ # Style Guide
168
+ - Use short, simple sentences.
169
+ - Organize content with headings and bullet points.
170
+ - Avoid jargon and explain technical terms.
171
+ - Use active voice whenever possible.
172
+ - Highlight key points in bold.
173
+ - Keep paragraphs brief and focused on one idea.
174
+ - Proofread for clarity and correctness.
175
+ `;
176
+
177
+ const addSpellingMistakes = (text: string, n: number): string => {
178
+ const words = text.split(' ');
179
+ for (let i = 0; i < n; i++) {
180
+ const idx = Math.floor(Math.random() * words.length);
181
+ const word = words[idx];
182
+ const charIdx = Math.floor(Math.random() * word.length);
183
+ const typoChar = String.fromCharCode(word.charCodeAt(charIdx) + 1);
184
+ words[idx] = word.slice(0, charIdx) + typoChar + word.slice(charIdx + 1);
151
185
  }
152
186
 
153
- return (
154
- <Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
155
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
156
- <Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
157
- <Toolbar.IconButton
158
- disabled
159
- icon='ph--git-branch--regular'
160
- iconOnly
161
- label={t('button branch thread')}
162
- onClick={handleBranchChat}
163
- />
164
- </Toolbar.Root>
165
- <Chat.Thread />
166
- <div className='p-4'>
167
- <Chat.Prompt
168
- classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
169
- expandable
170
- online={online}
171
- presets={presets.map(({ id, model, label }) => ({ id, label: label ?? model }))}
172
- preset={preset?.id}
173
- onChangeOnline={setOnline}
174
- onChangePreset={handleChangePreset}
175
- />
176
- </div>
177
- </Chat.Root>
178
- );
187
+ return words.join(' ');
179
188
  };
180
189
 
181
- const DocumentContainer = () => {
182
- const { themeMode } = useThemeContext();
183
- const space = useSpace();
184
- const [document] = useQuery(space, Filter.type(DocumentType));
185
- if (!document?.content.target) {
186
- return null;
187
- }
188
-
189
- return (
190
- <>
191
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
192
- <h2>{Obj.getLabel(document)}</h2>
193
- </Toolbar.Root>
194
- <Editor
195
- id={document.id}
196
- text={document.content.target}
197
- classNames='h-full p-2 overflow-hidden'
198
- extensions={[
199
- // TODO(burdon): Create util.
200
- createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
201
- createBasicExtensions({ readOnly: false }),
202
- createMarkdownExtensions({ themeMode }),
203
- createThemeExtensions({ themeMode }),
204
- outliner(),
205
- ]}
206
- />
207
- </>
208
- );
190
+ export const Default: Story = {
191
+ decorators: getDecorators({
192
+ plugins: [MarkdownPlugin()],
193
+ config: config.remote,
194
+ }),
195
+ args: {
196
+ components: [ChatContainer, SurfaceContainer],
197
+ },
209
198
  };
210
199
 
211
- // TODO(burdon): Show all active blueprints from context?
212
- const BlueprintContainer = () => {
213
- const space = useSpace();
214
- const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
215
- if (!blueprint?.instructions.target) {
216
- return null;
217
- }
218
-
219
- return (
220
- <div className='flex flex-col h-full'>
221
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
222
- <h2>{Obj.getLabel(blueprint)}</h2>
223
- </Toolbar.Root>
224
- <TemplateEditor template={blueprint.instructions.target} />
225
- </div>
226
- );
200
+ // Test with prompt: Propose changes to my document based on the style guide.
201
+ export const WithDocument: Story = {
202
+ decorators: getDecorators({
203
+ plugins: [MarkdownPlugin(), ThreadPlugin()],
204
+ config: config.remote, // TODO(burdon): Issue making persistent.
205
+ onInit: async ({ space, binder }) => {
206
+ const doc = space.db.add(
207
+ Markdown.makeDocument({
208
+ name: 'My Document',
209
+ content: addSpellingMistakes(MARKDOWN_DOCUMENT, 2),
210
+ }),
211
+ );
212
+ const styleGuide = space.db.add(
213
+ Markdown.makeDocument({
214
+ name: 'Style Guide',
215
+ content: STYLE_GUIDE,
216
+ }),
217
+ );
218
+ await binder.bind({ objects: [Ref.make(doc), Ref.make(styleGuide)] });
219
+ },
220
+ }),
221
+ args: {
222
+ components: [ChatContainer, [SurfaceContainer, CommentsContainer, LoggingContainer]],
223
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/markdown'],
224
+ },
227
225
  };
228
226
 
229
- //
230
- // Configuration
231
- //
232
-
233
- const meta = {
234
- title: 'plugins/plugin-assistant/Chat',
235
- render: render(DefaultStory),
236
- decorators: [],
237
- parameters: {
238
- translations,
239
- controls: { disable: true },
227
+ export const WithBlueprints: Story = {
228
+ decorators: getDecorators({
229
+ plugins: [InboxPlugin(), MarkdownPlugin(), TablePlugin()],
230
+ config: config.remote,
231
+ onInit: async ({ space, binder }) => {
232
+ const object = space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
233
+ await binder.bind({ objects: [Ref.make(object)] });
234
+ },
235
+ }),
236
+ args: {
237
+ components: [ChatContainer, [TasksContainer, BlueprintContainer]],
240
238
  },
241
- } satisfies Meta<typeof DefaultStory>;
239
+ };
242
240
 
243
- export default meta;
241
+ export const WithChess: Story = {
242
+ decorators: getDecorators({
243
+ plugins: [ChessPlugin()],
244
+ config: config.remote,
245
+ types: [Chess.Game],
246
+ onInit: async ({ space, binder }) => {
247
+ // TODO(burdon): Add player DID (for user and assistant).
248
+ const object = space.db.add(
249
+ Chess.makeGame({
250
+ name: 'Challenge',
251
+ pgn: [
252
+ '1. e4 e5',
253
+ '2. Nf3 Nc6',
254
+ '3. Bc4 Bc5',
255
+ '4. c3 Nf6',
256
+ '5. d4 exd4',
257
+ '6. cxd4 Bb4+',
258
+ '7. Nc3 d5',
259
+ '8. exd5 Nxd5',
260
+ '9. O-O Be6',
261
+ '10. Qb3 Na5',
262
+ '11. Qa4+ c6',
263
+ '12. Bxd5 Bxc3',
264
+ '13. Bxe6 fxe6',
265
+ '*',
266
+ ].join(' '),
267
+ }),
268
+ );
269
+ await binder.bind({ objects: [Ref.make(object)] });
270
+ },
271
+ }),
272
+ args: {
273
+ components: [ChatContainer, [SurfaceContainer, LoggingContainer]],
274
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/chess'],
275
+ },
276
+ };
244
277
 
245
- type Story = StoryObj<typeof meta>;
278
+ // Test with prompt: Summarize my mailbox and write the summary in a new document.
279
+ export const WithMail: Story = {
280
+ decorators: getDecorators({
281
+ plugins: [InboxPlugin(), MarkdownPlugin(), ThreadPlugin()],
282
+ config: config.remote,
283
+ types: [Mailbox.Mailbox],
284
+ onInit: async ({ space, binder }) => {
285
+ const queue = space.queues.create();
286
+ const messages = createTestMailbox();
287
+ await queue.append(messages);
288
+ const mailbox = space.db.add(Mailbox.make({ name: 'Mailbox', queue: queue.dxn }));
289
+ await binder.bind({ objects: [Ref.make(mailbox)] });
290
+ },
291
+ }),
292
+ args: {
293
+ components: [ChatContainer, [SurfaceContainer, MessageContainer]],
294
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox'],
295
+ },
296
+ };
246
297
 
247
- //
248
- // Decorators
249
- //
298
+ export const WithGmail: Story = {
299
+ decorators: getDecorators({
300
+ plugins: [InboxPlugin(), TokenManagerPlugin()],
301
+ config: config.remote,
302
+ types: [Mailbox.Mailbox],
303
+ onInit: async ({ space, binder }) => {
304
+ const queue = space.queues.create();
305
+ const mailbox = space.db.add(Mailbox.make({ name: 'Mailbox', queue: queue.dxn }));
306
+ await binder.bind({ objects: [Ref.make(mailbox)] });
307
+ },
308
+ }),
309
+ args: {
310
+ components: [ChatContainer, [SurfaceContainer, MessageContainer, TokenManagerContainer]],
311
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox'],
312
+ },
313
+ };
250
314
 
251
- const remoteConfig = new Config({
252
- runtime: {
253
- services: {
254
- ai: {
255
- // TODO(burdon): 'url'?
256
- server: remoteServiceEndpoints.ai,
257
- },
258
- edge: {
259
- url: remoteServiceEndpoints.edge,
260
- },
315
+ // Test with prompt: Create 10 locations.
316
+ export const WithMap: Story = {
317
+ decorators: getDecorators({
318
+ plugins: [MapPlugin(), TablePlugin()],
319
+ config: config.remote,
320
+ types: [DataType.View, Map.Map, Table.Table],
321
+ onInit: async ({ space, binder }) => {
322
+ const [schema] = await space.db.schemaRegistry.register([createLocationSchema()]);
323
+ const { view: tableView } = await Table.makeView({ name: 'Table', space, typename: schema.typename });
324
+ const { view: mapView } = await Map.makeView({
325
+ name: 'Map',
326
+ space,
327
+ typename: schema.typename,
328
+ pivotFieldName: 'location',
329
+ });
330
+ space.db.add(tableView);
331
+ space.db.add(mapView);
332
+ await binder.bind({ objects: [Ref.make(tableView), Ref.make(mapView)] });
261
333
  },
334
+ }),
335
+ args: {
336
+ components: [ChatContainer, SurfaceContainer],
337
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/map'],
262
338
  },
263
- });
339
+ };
264
340
 
265
- const getDecorators = ({
266
- config,
267
- plugins = [],
268
- blueprints = [],
269
- context = false,
270
- }: {
271
- config: Config;
272
- plugins?: Plugin[];
273
- blueprints?: Blueprint.Blueprint[];
274
- context?: boolean;
275
- }) => [
276
- withPluginManager({
277
- fireEvents: [Events.SetupArtifactDefinition],
278
- plugins: [
279
- ClientPlugin({
280
- config,
281
- types: [Assistant.Chat, DocumentType, Blueprint.Blueprint],
282
- onClientInitialized: async (_, client) => {
283
- await client.halo.createIdentity();
284
- await client.spaces.waitUntilReady();
285
- const space = client.spaces.default;
286
- // ISSUE(burdon): Should not require this.
287
- // ERROR: invariant violation: Database was not initialized with root object.
288
- await space.waitUntilReady();
289
-
290
- // TODO(burdon): Remove need for this boilerplate. Namespace for types?
291
- const chat = space.db.add(
292
- Obj.make(Assistant.Chat, {
293
- queue: Ref.fromDXN(space.queues.create().dxn),
294
- }),
295
- );
296
- const binder = new ContextBinder(await chat.queue.load());
297
-
298
- const doc = space.db.add(
299
- Obj.make(DocumentType, {
300
- name: 'Tasks',
301
- content: Ref.make(Obj.make(DataType.Text, { content: '' })),
302
- }),
303
- );
304
- if (context) {
305
- await binder.bind({ objects: [Ref.make(doc)] });
306
- }
307
-
308
- for (const blueprint of blueprints) {
309
- // Clone blueprints and bind to conversation.
310
- // TODO(dmaretskyi): This should be done by Obj.clone.
311
- const { id: _id, ...data } = blueprint;
312
- const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
313
- await binder.bind({ blueprints: [Ref.make(obj)] });
314
- }
315
- },
316
- }),
317
- IntentPlugin(),
318
- SettingsPlugin(),
319
- SpacePlugin(),
320
-
321
- TranscriptionPlugin(),
322
- AssistantPlugin(),
323
-
324
- ...plugins,
325
- ],
326
- capabilities: [contributes(Capabilities.Functions, [readDocument, writeDocument])],
341
+ export const WithTrip: Story = {
342
+ decorators: getDecorators({
343
+ plugins: [MarkdownPlugin(), MapPlugin()],
344
+ config: config.remote,
345
+ types: [Map.Map],
346
+ onInit: async ({ space, binder }) => {
347
+ // TODO(burdon): Table.
348
+ {
349
+ const object = space.db.add(Map.make({ name: 'Trip' }));
350
+ await binder.bind({ objects: [Ref.make(object)] });
351
+ }
352
+ {
353
+ const object = space.db.add(
354
+ Markdown.makeDocument({
355
+ name: 'Itinerary',
356
+ content: trim`
357
+ # Itinerary
358
+
359
+ ## Day 1
360
+ - Visit the Sagrada Familia
361
+ - Visit the Park Güell
362
+ - Visit the Casa Batlló
363
+
364
+ ## Day 2
365
+ - Visit the Eiffel Tower
366
+ - Visit the Louvre
367
+ - Visit the Musée d'Orsay
368
+ `,
369
+ }),
370
+ );
371
+ await binder.bind({ objects: [Ref.make(object)] });
372
+ }
373
+ {
374
+ const object = space.db.add(
375
+ Markdown.makeDocument({
376
+ name: 'Barcelona',
377
+ content: trim`
378
+ # Barcelona
379
+
380
+ Barcelona is the capital and most populous city of Catalonia, an autonomous community in northeastern Spain.
381
+ It is located on the Mediterranean coast, on the banks of the Llobregat River, in the comarca of the Baix Llobregat.
382
+ The city is known for its rich history, vibrant culture, and stunning architecture, including the Sagrada Familia, Park Güell, and Casa Batlló.
383
+ `,
384
+ }),
385
+ );
386
+ await binder.bind({ objects: [Ref.make(object)] });
387
+ }
388
+ },
327
389
  }),
328
- withTheme,
329
- withLayout({
330
- fullscreen: true,
331
- classNames: 'bg-deckSurface justify-center',
390
+ args: {
391
+ components: [ChatContainer, SurfaceContainer],
392
+ },
393
+ };
394
+
395
+ export const WithBoard: Story = {
396
+ decorators: getDecorators({
397
+ plugins: [BoardPlugin()],
398
+ config: config.remote,
399
+ types: [Board.Board],
400
+ onInit: async ({ space, binder }) => {
401
+ const object = space.db.add(Board.makeBoard());
402
+ await binder.bind({ objects: [Ref.make(object)] });
403
+ },
332
404
  }),
333
- ];
405
+ args: {
406
+ debug: true,
407
+ components: [ChatContainer, SurfaceContainer],
408
+ },
409
+ };
334
410
 
335
- //
336
- // Stories
337
- //
411
+ export const WithResearch: Story = {
412
+ decorators: getDecorators({
413
+ plugins: [MarkdownPlugin(), TablePlugin()],
414
+ config: config.persistent,
415
+ types: [...ResearchDataTypes, ResearchGraph],
416
+ accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
417
+ }),
418
+ args: {
419
+ components: [ChatContainer, [GraphContainer, LoggingContainer]],
420
+ blueprints: [RESEARCH_BLUEPRINT.key],
421
+ },
422
+ };
338
423
 
339
- export const Default = {
424
+ export const WithSearch: Story = {
340
425
  decorators: getDecorators({
341
- config: remoteConfig,
426
+ config: config.remote,
427
+ types: testTypes,
428
+ onInit: async ({ space }) => {
429
+ await addTestData(space);
430
+ },
342
431
  }),
343
432
  args: {
344
- components: [ChatContainer],
433
+ components: [ChatContainer, [GraphContainer, LoggingContainer]],
345
434
  },
346
- } satisfies Story;
435
+ };
347
436
 
348
- export const WithDocument = {
437
+ export const WithTranscription: Story = {
349
438
  decorators: getDecorators({
350
- config: remoteConfig,
351
- plugins: [MarkdownPlugin()],
439
+ plugins: [TranscriptionPlugin()],
440
+ config: config.remote,
441
+ types: [Transcript.Transcript],
442
+ onInit: async ({ space, binder }) => {
443
+ const queue = space.queues.create();
444
+ const messages = createTestTranscription();
445
+ await queue.append(messages);
446
+ const transcript = space.db.add(Transcript.makeTranscript(queue.dxn));
447
+ await binder.bind({ objects: [Ref.make(transcript)] });
448
+ },
352
449
  }),
353
450
  args: {
354
- components: [ChatContainer, DocumentContainer],
451
+ components: [ChatContainer, [SurfaceContainer, LoggingContainer]],
452
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/transcription'],
355
453
  },
356
- } satisfies Story;
454
+ };
357
455
 
358
- export const WithBlueprints = {
456
+ export const WithLinearSync: Story = {
359
457
  decorators: getDecorators({
360
- config: remoteConfig,
361
- plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
362
- blueprints: [TASK_BLUEPRINT],
363
- context: true,
458
+ plugins: [],
459
+ config: config.remote,
460
+ types: [DataType.Task, DataType.Person, DataType.Project],
461
+ accessTokens: accessTokensFromEnv({
462
+ 'linear.app': import.meta.env.VITE_LINEAR_API_KEY,
463
+ }),
364
464
  }),
365
465
  args: {
366
- components: [ChatContainer, [DocumentContainer, BlueprintContainer]],
466
+ components: [ChatContainer, [GraphContainer]],
467
+ blueprints: [LINEAR_BLUEPRINT.key],
367
468
  },
368
- } satisfies Story;
369
-
370
- // export const WithArtifacts = {
371
- // decorators: getDecorators({
372
- // config: remoteConfig,
373
- // plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
374
- // }),
375
- // args: {
376
- // components: [ChatContainer],
377
- // },
378
- // } satisfies Story;
469
+ };