@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.f5c0578

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 (359) hide show
  1. package/dist/lib/browser/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-H7H4BQ2C.mjs} +11 -9
  2. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
  3. package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-SB7YC2XP.mjs} +37 -14
  4. package/dist/lib/browser/ChatContainer-SB7YC2XP.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-X6PFOQSQ.mjs} +23 -8
  6. package/dist/lib/browser/ChatDialog-X6PFOQSQ.mjs.map +7 -0
  7. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-627OQ557.mjs} +3 -2
  8. package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
  9. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
  10. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
  11. package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-ERU5XY2S.mjs} +17 -74
  12. package/dist/lib/browser/app-graph-builder-ERU5XY2S.mjs.map +7 -0
  13. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
  14. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-OWY4CUQY.mjs → chunk-BVH6VK6Q.mjs} +816 -807
  16. package/dist/lib/browser/chunk-BVH6VK6Q.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  18. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-JBFDQMUJ.mjs +193 -0
  20. package/dist/lib/browser/chunk-JBFDQMUJ.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-LKP65RPA.mjs +20 -0
  22. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-LKP65RPA.mjs.map} +1 -1
  23. package/dist/lib/browser/{chunk-AEAEKWOC.mjs → chunk-NZDCKQ6W.mjs} +12 -21
  24. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
  26. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-Y66UJUHV.mjs +280 -0
  28. package/dist/lib/browser/chunk-Y66UJUHV.mjs.map +7 -0
  29. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
  30. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
  31. package/dist/lib/browser/index.mjs +98 -51
  32. package/dist/lib/browser/index.mjs.map +4 -4
  33. package/dist/lib/browser/{intent-resolver-5RMMCMXG.mjs → intent-resolver-DGRO2XSG.mjs} +33 -12
  34. package/dist/lib/browser/intent-resolver-DGRO2XSG.mjs.map +7 -0
  35. package/dist/lib/browser/meta.json +1 -1
  36. package/dist/lib/browser/{react-surface-66VY37YQ.mjs → react-surface-LPSIBHEJ.mjs} +45 -32
  37. package/dist/lib/browser/react-surface-LPSIBHEJ.mjs.map +7 -0
  38. package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-ZFNQYSYP.mjs} +6 -5
  39. package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-ZFNQYSYP.mjs.map} +1 -1
  40. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
  41. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
  42. package/dist/lib/browser/types/index.mjs +7 -4
  43. package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -9
  44. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
  45. package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-7JLMWHMX.mjs} +37 -14
  46. package/dist/lib/node-esm/ChatContainer-7JLMWHMX.mjs.map +7 -0
  47. package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-QDD722F2.mjs} +23 -8
  48. package/dist/lib/node-esm/ChatDialog-QDD722F2.mjs.map +7 -0
  49. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-EQ5NP2PG.mjs} +3 -2
  50. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
  51. package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
  52. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
  53. package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-RCT4ANP2.mjs} +17 -74
  54. package/dist/lib/node-esm/app-graph-builder-RCT4ANP2.mjs.map +7 -0
  55. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
  56. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-SENTQAEO.mjs → chunk-ETS2CIDF.mjs} +816 -807
  58. package/dist/lib/node-esm/chunk-ETS2CIDF.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-2XL6MNPE.mjs → chunk-GAWXJ7K5.mjs} +12 -21
  60. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-GENVBE3B.mjs +194 -0
  62. package/dist/lib/node-esm/chunk-GENVBE3B.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  64. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +22 -0
  66. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-KOC6ESG7.mjs.map} +1 -1
  67. package/dist/lib/node-esm/chunk-QS6GWTVA.mjs +281 -0
  68. package/dist/lib/node-esm/chunk-QS6GWTVA.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
  70. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
  71. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
  72. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
  73. package/dist/lib/node-esm/index.mjs +98 -51
  74. package/dist/lib/node-esm/index.mjs.map +4 -4
  75. package/dist/lib/node-esm/{intent-resolver-YPPYELY3.mjs → intent-resolver-7CKWG7TZ.mjs} +33 -12
  76. package/dist/lib/node-esm/intent-resolver-7CKWG7TZ.mjs.map +7 -0
  77. package/dist/lib/node-esm/meta.json +1 -1
  78. package/dist/lib/node-esm/{react-surface-RJMRBR2M.mjs → react-surface-3EPAE4I4.mjs} +45 -32
  79. package/dist/lib/node-esm/react-surface-3EPAE4I4.mjs.map +7 -0
  80. package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-UI4VQCWW.mjs} +6 -5
  81. package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-UI4VQCWW.mjs.map} +1 -1
  82. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
  83. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
  84. package/dist/lib/node-esm/types/index.mjs +7 -4
  85. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  87. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
  90. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/capabilities.d.ts +11 -0
  92. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
  94. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/index.d.ts +5 -0
  96. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/toolkit.d.ts +5 -0
  100. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  101. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  102. package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
  103. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  104. package/dist/types/src/components/Chat/Chat.d.ts +6 -8
  105. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  106. package/dist/types/src/components/ChatContainer.d.ts +5 -4
  107. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  108. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  109. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
  110. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  111. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
  112. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  113. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  114. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  115. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +4 -3
  116. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
  117. package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
  118. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  119. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +33 -48
  120. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  121. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  122. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  123. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
  124. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  125. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  126. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +1 -1
  127. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  128. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
  129. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  130. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  131. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
  132. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  133. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  134. package/dist/types/src/components/Timeline/Timeline.d.ts +42 -0
  135. package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
  136. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +11 -0
  137. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
  138. package/dist/types/src/components/Timeline/index.d.ts +2 -0
  139. package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
  140. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -7
  141. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  142. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
  143. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  144. package/dist/types/src/components/index.d.ts +3 -2
  145. package/dist/types/src/components/index.d.ts.map +1 -1
  146. package/dist/types/src/events.d.ts +1 -1
  147. package/dist/types/src/events.d.ts.map +1 -1
  148. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  149. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  150. package/dist/types/src/execution-graph/index.d.ts +2 -0
  151. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  152. package/dist/types/src/functions/analysis.d.ts +5 -0
  153. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  154. package/dist/types/src/functions/index.d.ts +4 -0
  155. package/dist/types/src/functions/index.d.ts.map +1 -0
  156. package/dist/types/src/functions/list.d.ts +10 -0
  157. package/dist/types/src/functions/list.d.ts.map +1 -0
  158. package/dist/types/src/functions/load.d.ts +8 -0
  159. package/dist/types/src/functions/load.d.ts.map +1 -0
  160. package/dist/types/src/hooks/chat-processor.d.ts +28 -42
  161. package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
  162. package/dist/types/src/hooks/errors.d.ts +4 -0
  163. package/dist/types/src/hooks/errors.d.ts.map +1 -0
  164. package/dist/types/src/hooks/index.d.ts +6 -1
  165. package/dist/types/src/hooks/index.d.ts.map +1 -1
  166. package/dist/types/src/hooks/presets.d.ts +2 -2
  167. package/dist/types/src/hooks/presets.d.ts.map +1 -1
  168. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
  169. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  170. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -14
  171. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  172. package/dist/types/src/hooks/useChatServices.d.ts +5 -4
  173. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  174. package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
  175. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  176. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  177. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  178. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  179. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  180. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  181. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  182. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  183. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  184. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  185. package/dist/types/src/stories/Chat.stories.d.ts +68 -49
  186. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  187. package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
  188. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  189. package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
  190. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  191. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  192. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  193. package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
  194. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  195. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  196. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  197. package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
  198. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  199. package/dist/types/src/stories/components/index.d.ts +8 -0
  200. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  201. package/dist/types/src/stories/components/types.d.ts +7 -0
  202. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  203. package/dist/types/src/stories/hooks/index.d.ts +3 -0
  204. package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
  205. package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
  206. package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
  207. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
  208. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
  209. package/dist/types/src/stories/testing/data.d.ts +142 -0
  210. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  211. package/dist/types/src/stories/testing/index.d.ts +3 -0
  212. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  213. package/dist/types/src/stories/testing/testing.d.ts +26 -0
  214. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  215. package/dist/types/src/testing/test-functions.d.ts +5 -2
  216. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  217. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  218. package/dist/types/src/tools/function.d.ts.map +1 -1
  219. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  220. package/dist/types/src/translations.d.ts +6 -10
  221. package/dist/types/src/translations.d.ts.map +1 -1
  222. package/dist/types/src/types/Assistant.d.ts +42 -0
  223. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  224. package/dist/types/src/types/AssistantAction.d.ts +91 -0
  225. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  226. package/dist/types/src/types/defs.d.ts +2 -0
  227. package/dist/types/src/types/defs.d.ts.map +1 -0
  228. package/dist/types/src/types/index.d.ts +3 -1
  229. package/dist/types/src/types/index.d.ts.map +1 -1
  230. package/dist/types/src/types/service.d.ts +6 -6
  231. package/dist/types/src/types/service.d.ts.map +1 -1
  232. package/dist/types/tsconfig.tsbuildinfo +1 -1
  233. package/package.json +83 -75
  234. package/src/AssistantPlugin.tsx +59 -12
  235. package/src/capabilities/ai-service.ts +28 -0
  236. package/src/capabilities/app-graph-builder.ts +9 -93
  237. package/src/capabilities/blueprint-definition.ts +32 -0
  238. package/src/capabilities/capabilities.ts +22 -0
  239. package/src/capabilities/edge-model-resolver.ts +29 -0
  240. package/src/capabilities/index.ts +6 -0
  241. package/src/capabilities/intent-resolver.ts +24 -9
  242. package/src/capabilities/react-surface.tsx +29 -22
  243. package/src/capabilities/toolkit.ts +106 -0
  244. package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
  245. package/src/components/BlueprintContainer.tsx +24 -0
  246. package/src/components/Chat/Chat.tsx +77 -64
  247. package/src/components/ChatContainer.tsx +38 -14
  248. package/src/components/ChatDialog.tsx +10 -6
  249. package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
  250. package/src/components/ChatPrompt/ChatReferences.tsx +11 -9
  251. package/src/components/ChatPrompt/index.ts +1 -1
  252. package/src/components/ChatThread/ChatMessage.tsx +141 -118
  253. package/src/components/ChatThread/ChatThread.stories.tsx +236 -104
  254. package/src/components/ChatThread/ChatThread.tsx +2 -2
  255. package/src/components/ChatThread/Link.tsx +23 -0
  256. package/src/components/ChatThread/ToolBlock.tsx +20 -16
  257. package/src/components/SequenceContainer.tsx +2 -1
  258. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
  259. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  260. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -5
  261. package/src/components/TemplateEditor/TemplateEditor.tsx +15 -12
  262. package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
  263. package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
  264. package/src/components/Timeline/Timeline.stories.tsx +144 -0
  265. package/src/components/Timeline/Timeline.tsx +202 -0
  266. package/src/components/Timeline/index.ts +5 -0
  267. package/src/components/Toolbox/Toolbox.stories.tsx +6 -12
  268. package/src/components/Toolbox/Toolbox.tsx +16 -40
  269. package/src/components/index.ts +2 -5
  270. package/src/events.ts +2 -2
  271. package/src/execution-graph/execution-graph.ts +184 -0
  272. package/src/execution-graph/index.ts +5 -0
  273. package/src/functions/analysis.ts +20 -0
  274. package/src/functions/index.ts +7 -0
  275. package/src/functions/list.ts +42 -0
  276. package/src/functions/load.ts +43 -0
  277. package/src/hooks/chat-processor.ts +123 -177
  278. package/src/hooks/errors.ts +8 -0
  279. package/src/hooks/index.ts +6 -1
  280. package/src/hooks/presets.ts +6 -5
  281. package/src/hooks/useBlueprintRegistry.ts +79 -0
  282. package/src/hooks/useChatProcessor.ts +21 -83
  283. package/src/hooks/useChatServices.ts +37 -54
  284. package/src/hooks/useExecutionGraph.ts +16 -0
  285. package/src/hooks/useOnline.ts +10 -0
  286. package/src/hooks/usePresets.ts +45 -0
  287. package/src/hooks/useReferencesProvider.ts +11 -9
  288. package/src/hooks/useResolveRef.ts +33 -0
  289. package/src/parser/filter-generator.ts +6 -13
  290. package/src/parser/query-parser.ts +1 -1
  291. package/src/queue-logger.ts +5 -5
  292. package/src/stories/Chat.stories.tsx +238 -299
  293. package/src/stories/components/BlueprintContainer.tsx +34 -0
  294. package/src/stories/components/ChatContainer.tsx +80 -0
  295. package/src/stories/components/GraphContainer.tsx +118 -0
  296. package/src/stories/components/LoggingContainer.tsx +29 -0
  297. package/src/stories/components/SurfaceContainer.tsx +62 -0
  298. package/src/stories/components/TasksContainer.tsx +51 -0
  299. package/src/stories/components/index.ts +12 -0
  300. package/src/stories/components/types.ts +11 -0
  301. package/src/stories/hooks/index.ts +6 -0
  302. package/src/stories/hooks/useFlush.ts +35 -0
  303. package/src/stories/hooks/useMatcherExtension.ts +45 -0
  304. package/src/stories/testing/data.ts +130 -0
  305. package/src/stories/testing/index.ts +6 -0
  306. package/src/stories/testing/testing.tsx +163 -0
  307. package/src/testing/test-functions.ts +8 -3
  308. package/src/testing/test-sequence.ts +1 -1
  309. package/src/tools/function.ts +4 -1
  310. package/src/tools/openapi.test.ts +7 -5
  311. package/src/tools/openapi.ts +4 -1
  312. package/src/translations.ts +8 -10
  313. package/src/types/Assistant.ts +62 -0
  314. package/src/types/AssistantAction.ts +54 -0
  315. package/src/types/defs.ts +5 -0
  316. package/src/types/index.ts +4 -1
  317. package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
  318. package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
  319. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  320. package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
  321. package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
  322. package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
  323. package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
  324. package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
  325. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  326. package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
  327. package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
  328. package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
  329. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
  330. package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
  331. package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
  332. package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
  333. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  334. package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
  335. package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
  336. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
  338. package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
  339. package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
  340. package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
  341. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  342. package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
  343. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
  344. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
  345. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  346. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  347. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  348. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  349. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  350. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  351. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  352. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  353. package/dist/types/src/types/schema.d.ts +0 -88
  354. package/dist/types/src/types/schema.d.ts.map +0 -1
  355. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  356. package/src/components/TemplateContainer.tsx +0 -24
  357. package/src/hooks/chat-processor.test.ts +0 -16
  358. package/src/hooks/useBlueprints.ts +0 -57
  359. package/src/types/schema.ts +0 -95
@@ -4,20 +4,61 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react-vite';
8
- import React, { useEffect, useState } from 'react';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
+ import { Effect, Layer } from 'effect';
9
+ import React, { useEffect, useMemo } from 'react';
9
10
 
11
+ import { IntentPlugin } from '@dxos/app-framework';
12
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
13
  import { Obj } from '@dxos/echo';
14
+ import { ContextQueueService, DatabaseService } from '@dxos/functions';
15
+ import { ClientPlugin } from '@dxos/plugin-client';
16
+ import { PreviewPlugin } from '@dxos/plugin-preview';
17
+ import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
18
+ import { ThemePlugin } from '@dxos/plugin-theme';
11
19
  import { faker } from '@dxos/random';
12
- import { withClientProvider } from '@dxos/react-client/testing';
13
- import { DataType, type ContentBlock } from '@dxos/schema';
14
- import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
20
+ import { useQueue, useSpace } from '@dxos/react-client/echo';
21
+ import { defaultTx } from '@dxos/react-ui-theme';
22
+ import { type ContentBlock, DataType } from '@dxos/schema';
23
+ import { ColumnContainer, render, withLayout } from '@dxos/storybook-utils';
15
24
 
16
- import { ChatThread } from './ChatThread';
17
25
  import { translations } from '../../translations';
18
26
 
27
+ import { renderObjectLink } from './ChatMessage';
28
+ import { ChatThread, type ChatThreadProps } from './ChatThread';
29
+
19
30
  faker.seed(1);
20
31
 
32
+ const StoryContainer = ({ delay = 0, ...props }: ChatThreadProps & { delay?: number }) => {
33
+ const space = useSpace();
34
+ const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
35
+ const queue = useQueue<DataType.Message>(queueDxn);
36
+ useEffect(() => {
37
+ if (!space || !queue) {
38
+ return;
39
+ }
40
+
41
+ void Effect.runPromise(
42
+ Effect.gen(function* () {
43
+ for (const step of MESSAGES) {
44
+ yield* step;
45
+ yield* Effect.sleep(delay);
46
+ }
47
+
48
+ return queue;
49
+ }).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
50
+ );
51
+ }, [space, queue]);
52
+
53
+ if (!space) {
54
+ return null;
55
+ }
56
+
57
+ return (
58
+ <ChatThread {...props} space={space} messages={queue?.objects ?? []} onEvent={(event) => console.log(event)} />
59
+ );
60
+ };
61
+
21
62
  const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): DataType.Message => {
22
63
  return Obj.make(DataType.Message, {
23
64
  created: new Date().toISOString(),
@@ -26,88 +67,196 @@ const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): Da
26
67
  });
27
68
  };
28
69
 
29
- const TEST_MESSAGES: DataType.Message[] = [
30
- createMessage('user', [
31
- {
32
- _tag: 'text',
33
- text: faker.lorem.sentence(5),
34
- } satisfies ContentBlock.Text,
35
- ]),
36
-
37
- createMessage('assistant', [
38
- {
39
- _tag: 'text',
40
- disposition: 'cot',
41
- text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
42
- .map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
43
- .join('\n'),
44
- },
45
- {
46
- _tag: 'text',
47
- text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
48
- .map(() => faker.lorem.paragraphs())
49
- .join('\n\n'),
50
- },
51
- {
52
- _tag: 'toolCall',
53
- toolCallId: '1234',
54
- name: 'search',
55
- input: {},
56
- } satisfies ContentBlock.ToolCall,
57
- ]),
58
-
59
- createMessage('user', [
60
- {
61
- _tag: 'toolResult',
62
- toolCallId: '1234',
63
- name: 'search',
64
- result: 'This is a tool result.',
65
- } satisfies ContentBlock.ToolResult,
66
- ]),
67
-
68
- createMessage('assistant', [
69
- {
70
- _tag: 'toolCall',
71
- toolCallId: '4567',
72
- name: 'create',
73
- input: {},
74
- } satisfies ContentBlock.ToolCall,
75
- ]),
76
-
77
- createMessage('user', [
78
- {
79
- _tag: 'toolResult',
80
- toolCallId: '4567',
81
- name: 'create',
82
- result: 'This is a tool result.',
83
- } satisfies ContentBlock.ToolResult,
84
- ]),
85
-
86
- createMessage('assistant', [
87
- {
88
- _tag: 'text',
89
- text: faker.lorem.paragraphs(1),
90
- } satisfies ContentBlock.Text,
91
- ]),
92
-
93
- createMessage('assistant', [
94
- {
95
- _tag: 'json',
96
- disposition: 'suggest',
97
- data: JSON.stringify({ text: 'Search...' }),
98
- },
99
- {
100
- _tag: 'json',
101
- disposition: 'suggest',
102
- data: JSON.stringify({ text: faker.lorem.paragraphs(1) }),
103
- } satisfies ContentBlock.Json,
104
- ]),
70
+ const MESSAGES: Effect.Effect<void, never, DatabaseService | ContextQueueService>[] = [
71
+ Effect.gen(function* () {
72
+ const { queue } = yield* ContextQueueService;
73
+ yield* Effect.promise(() =>
74
+ queue.append([
75
+ createMessage('user', [
76
+ {
77
+ _tag: 'text',
78
+ text: faker.lorem.sentence(5),
79
+ },
80
+ ]),
81
+ ]),
82
+ );
83
+ }),
84
+
85
+ Effect.gen(function* () {
86
+ const { queue } = yield* ContextQueueService;
87
+ yield* Effect.promise(() =>
88
+ queue.append([
89
+ createMessage('assistant', [
90
+ {
91
+ _tag: 'suggest',
92
+ text: 'Search...',
93
+ },
94
+ {
95
+ _tag: 'suggest',
96
+ text: faker.lorem.paragraphs(1),
97
+ },
98
+ ]),
99
+ createMessage('assistant', [
100
+ {
101
+ _tag: 'text',
102
+ text: 'Select an option:',
103
+ },
104
+ {
105
+ _tag: 'select',
106
+ options: ['Option 1', 'Option 2', 'Option 3'],
107
+ },
108
+ ]),
109
+ ]),
110
+ );
111
+ }),
112
+
113
+ Effect.gen(function* () {
114
+ const { queue } = yield* ContextQueueService;
115
+ const { db } = yield* DatabaseService;
116
+ const obj1 = db.add(Obj.make(DataType.Organization, { name: 'DXOS' }));
117
+ const obj2 = db.add(Obj.make(DataType.Person, { fullName: 'Alice' }));
118
+ const obj3 = db.add(Obj.make(DataType.Person, { fullName: 'Bob' }));
119
+ const obj4 = db.add(Obj.make(DataType.Person, { fullName: 'Charlie' }));
120
+ yield* Effect.promise(() =>
121
+ queue.append([
122
+ createMessage('assistant', [
123
+ // Inline tag.
124
+ {
125
+ _tag: 'text',
126
+ text: [faker.lorem.paragraph(), renderObjectLink(obj1), faker.lorem.paragraph()].join(' '),
127
+ },
128
+ // Inline cards.
129
+ ...[obj2, obj3, obj4].map(
130
+ (obj) =>
131
+ ({
132
+ _tag: 'text',
133
+ text: renderObjectLink(obj, true),
134
+ }) satisfies ContentBlock.Text,
135
+ ),
136
+ ]),
137
+ ]),
138
+ );
139
+ }),
140
+
141
+ Effect.gen(function* () {
142
+ const { queue } = yield* ContextQueueService;
143
+ yield* Effect.promise(() =>
144
+ queue.append([
145
+ createMessage('assistant', [
146
+ {
147
+ _tag: 'text',
148
+ text: faker.lorem.paragraphs(1),
149
+ },
150
+ {
151
+ _tag: 'toolkit',
152
+ },
153
+ ]),
154
+ ]),
155
+ );
156
+ }),
157
+
158
+ Effect.gen(function* () {
159
+ const { queue } = yield* ContextQueueService;
160
+ yield* Effect.promise(() =>
161
+ queue.append([
162
+ createMessage('assistant', [
163
+ {
164
+ _tag: 'text',
165
+ disposition: 'cot',
166
+ text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
167
+ .map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
168
+ .join('\n'),
169
+ },
170
+ {
171
+ _tag: 'toolCall',
172
+ toolCallId: '1234',
173
+ name: 'search',
174
+ input: JSON.stringify({}),
175
+ },
176
+ ]),
177
+ createMessage('user', [
178
+ {
179
+ _tag: 'toolResult',
180
+ toolCallId: '1234',
181
+ name: 'search',
182
+ result: 'This is a tool result.',
183
+ },
184
+ ]),
185
+ ]),
186
+ );
187
+ }),
188
+
189
+ Effect.gen(function* () {
190
+ const { queue } = yield* ContextQueueService;
191
+ yield* Effect.promise(() =>
192
+ queue.append([
193
+ createMessage('assistant', [
194
+ {
195
+ _tag: 'toolCall',
196
+ toolCallId: '4567',
197
+ name: 'create',
198
+ input: JSON.stringify({}),
199
+ },
200
+ ]),
201
+ createMessage('user', [
202
+ {
203
+ _tag: 'toolResult',
204
+ toolCallId: '4567',
205
+ name: 'create',
206
+ result: 'This is a tool result.',
207
+ },
208
+ ]),
209
+ createMessage('assistant', [
210
+ {
211
+ _tag: 'text',
212
+ text: Array.from({ length: faker.number.int({ min: 2, max: 3 }) })
213
+ .map(() => faker.lorem.paragraphs())
214
+ .join('\n\n'),
215
+ },
216
+ ]),
217
+ ]),
218
+ );
219
+ }),
220
+
221
+ Effect.gen(function* () {
222
+ const { queue } = yield* ContextQueueService;
223
+ yield* Effect.promise(() =>
224
+ queue.append([
225
+ createMessage('assistant', [
226
+ {
227
+ _tag: 'text',
228
+ text: faker.lorem.paragraphs(2),
229
+ },
230
+ ]),
231
+ ]),
232
+ );
233
+ }),
105
234
  ];
106
235
 
107
236
  const meta = {
108
237
  title: 'plugins/plugin-assistant/ChatThread',
109
238
  component: ChatThread,
110
- decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout({ Container: ColumnContainer })],
239
+ render: render(StoryContainer),
240
+ decorators: [
241
+ withPluginManager({
242
+ plugins: [
243
+ ClientPlugin({
244
+ onClientInitialized: async ({ client }) => {
245
+ await client.halo.createIdentity();
246
+ },
247
+ types: [DataType.Organization, DataType.Person],
248
+ }),
249
+ ThemePlugin({ tx: defaultTx }),
250
+ StorybookLayoutPlugin(),
251
+ IntentPlugin(),
252
+ PreviewPlugin(),
253
+ ],
254
+ }),
255
+ withLayout({
256
+ Container: ColumnContainer,
257
+ classNames: 'is-[40rem]',
258
+ }),
259
+ ],
111
260
  parameters: {
112
261
  translations,
113
262
  },
@@ -117,27 +266,10 @@ export default meta;
117
266
 
118
267
  type Story = StoryObj<typeof meta>;
119
268
 
120
- export const Default = {
121
- args: {
122
- messages: TEST_MESSAGES,
123
- },
124
- } satisfies Story;
125
-
126
- export const Incremental = {
127
- render: () => {
128
- const [messages, setMessages] = useState<DataType.Message[]>([]);
129
- useEffect(() => {
130
- let i = 0;
131
- const interval = setInterval(() => {
132
- setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
133
- if (i >= TEST_MESSAGES.length) {
134
- clearInterval(interval);
135
- }
136
- }, 2_000);
269
+ export const Default = {} satisfies Story;
137
270
 
138
- return () => clearInterval(interval);
139
- }, []);
140
-
141
- return <ChatThread messages={messages} collapse />;
271
+ export const Delayed = {
272
+ args: {
273
+ delay: 2_000,
142
274
  },
143
275
  } satisfies Story;
@@ -20,7 +20,7 @@ export type ChatThreadProps = ThemedClassName<
20
20
  identity?: Identity;
21
21
  messages?: DataType.Message[];
22
22
  collapse?: boolean;
23
- } & Pick<ChatMessageProps, 'debug' | 'space' | 'processor' | 'tools' | 'onEvent'>
23
+ } & Pick<ChatMessageProps, 'debug' | 'space' | 'tools' | 'onEvent'>
24
24
  >;
25
25
 
26
26
  export const ChatThread = forwardRef<ScrollController, ChatThreadProps>(
@@ -44,7 +44,7 @@ export const ChatThread = forwardRef<ScrollController, ChatThreadProps>(
44
44
  <ScrollContainer ref={forwardedRef} classNames={classNames} fade>
45
45
  <div
46
46
  role='none'
47
- className={mx(filteredMessages.length > 0 && 'pbs-4 pbe-4')}
47
+ className={mx('flex flex-col gap-2', filteredMessages.length > 0 && 'pbs-4 pbe-4')}
48
48
  style={{ '--user-fill': `var(--dx-${userHue}Fill)` } as CSSProperties}
49
49
  >
50
50
  {filteredMessages.map((message) => (
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type Space } from '@dxos/client/echo';
8
+ import { Obj, Ref } from '@dxos/echo';
9
+ import { type DXN } from '@dxos/keys';
10
+ import { DxRefTag } from '@dxos/lit-ui/react';
11
+
12
+ import { useResolvedRef } from '../../hooks';
13
+
14
+ export type ObjectLinkProps = {
15
+ space: Space;
16
+ dxn: DXN;
17
+ };
18
+
19
+ export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
20
+ const object = useResolvedRef(space, Ref.fromDXN(dxn));
21
+ const title = Obj.getLabel(object) ?? object?.id ?? dxn.toString();
22
+ return <DxRefTag refid={dxn.toString()}>{title}</DxRefTag>;
23
+ };
@@ -5,13 +5,14 @@
5
5
  import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
7
  import { type AgentStatus, type Tool } from '@dxos/ai';
8
- import { log } from '@dxos/log';
9
- import { type ThemedClassName } from '@dxos/react-ui';
8
+ import { type ThemedClassName, useTranslation } from '@dxos/react-ui';
10
9
  import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
11
10
  import { type JsonProps, Json as NativeJson } from '@dxos/react-ui-syntax-highlighter';
12
11
  import { type DataType } from '@dxos/schema';
13
12
  import { isNonNullable, isNotFalsy } from '@dxos/util';
14
13
 
14
+ import { meta } from '../../meta';
15
+
15
16
  export const isToolMessage = (message: DataType.Message) => {
16
17
  return message.blocks.some((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
17
18
  };
@@ -20,22 +21,23 @@ const getToolName = (tool: Tool) => {
20
21
  return tool.namespace && tool.function ? `${tool.namespace}:${tool.function}` : tool.name.split('_').pop();
21
22
  };
22
23
 
23
- const getToolCaption = (tool: Tool | undefined, status: AgentStatus | undefined) => {
24
- if (!tool) {
25
- return 'Calling tool...';
26
- }
27
-
28
- return status?.message ?? tool.caption ?? `Calling ${getToolName(tool)}...`;
29
- };
30
-
31
24
  export type ToolBlockProps = ThemedClassName<{
32
25
  message: DataType.Message;
33
26
  tools?: Tool[];
34
27
  }>;
35
28
 
36
29
  export const ToolBlock: FC<ToolBlockProps> = ({ classNames, message, tools }) => {
30
+ const { t } = useTranslation(meta.id);
37
31
  const { blocks = [] } = message;
38
32
 
33
+ const getToolCaption = (tool?: Tool, status?: AgentStatus) => {
34
+ if (!tool) {
35
+ return t('calling tool label');
36
+ }
37
+
38
+ return status?.message ?? tool.caption ?? [t('calling label') + getToolName(tool)].join(' ');
39
+ };
40
+
39
41
  let request: { tool: Tool | undefined; block: any } | undefined;
40
42
  const toolBlocks = blocks.filter((block) => block._tag === 'toolCall' || block._tag === 'toolResult');
41
43
  const items = toolBlocks
@@ -49,19 +51,21 @@ export const ToolBlock: FC<ToolBlockProps> = ({ classNames, message, tools }) =>
49
51
 
50
52
  request = { tool: tools?.find((tool) => tool.name === block.name), block };
51
53
  return {
52
- title: getToolCaption(request.tool, undefined), // block.status), // TODO(burdon): Get status?
54
+ title: getToolCaption(request.tool, request.block.status),
53
55
  block,
54
56
  };
55
57
  }
56
58
 
57
59
  case 'toolResult': {
58
- if (!request) {
59
- log.warn('unexpected message', { block });
60
- return { title: 'Error', block };
60
+ if (!request || block.error) {
61
+ return {
62
+ title: t('error label'),
63
+ block,
64
+ };
61
65
  }
62
66
 
63
67
  return {
64
- title: `${getToolCaption(request.tool, undefined)} (Success)`,
68
+ title: getToolCaption(request.tool, request.block.status),
65
69
  block,
66
70
  };
67
71
  }
@@ -69,7 +73,7 @@ export const ToolBlock: FC<ToolBlockProps> = ({ classNames, message, tools }) =>
69
73
  default: {
70
74
  request = undefined;
71
75
  return {
72
- title: 'Error',
76
+ title: t('error label'),
73
77
  block,
74
78
  };
75
79
  }
@@ -14,9 +14,10 @@ import { Toolbar, useTranslation } from '@dxos/react-ui';
14
14
  import { useSelectionManager } from '@dxos/react-ui-attention';
15
15
  import { StackItem } from '@dxos/react-ui-stack';
16
16
 
17
- import { SequenceEditor } from './SequenceEditor';
18
17
  import { meta } from '../meta';
19
18
 
19
+ import { SequenceEditor } from './SequenceEditor';
20
+
20
21
  // TODO(burdon): Move to config.
21
22
  export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
22
23
 
@@ -4,14 +4,15 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react-vite';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
8
 
9
9
  import { withLayout, withTheme } from '@dxos/storybook-utils';
10
10
 
11
- import { SequenceEditor } from './SequenceEditor';
12
11
  import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
13
12
  import { translations } from '../../translations';
14
13
 
14
+ import { SequenceEditor } from './SequenceEditor';
15
+
15
16
  const meta: Meta<typeof SequenceEditor> = {
16
17
  title: 'plugins/plugin-assistant/SequenceEditor',
17
18
  component: SequenceEditor,
@@ -6,7 +6,7 @@ import React, { forwardRef, useImperativeHandle } from 'react';
6
6
 
7
7
  import { SequenceDefinition } from '@dxos/conductor';
8
8
  import { Type } from '@dxos/echo';
9
- import { useThemeContext, type ThemedClassName } from '@dxos/react-ui';
9
+ import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
10
10
  import {
11
11
  type EditorView,
12
12
  createBasicExtensions,
@@ -8,15 +8,16 @@ import { type Meta } from '@storybook/react-vite';
8
8
  import React, { useState } from 'react';
9
9
 
10
10
  import { createSystemPrompt } from '@dxos/assistant';
11
- import { Template } from '@dxos/blueprints';
11
+ import { Blueprint, Template } from '@dxos/blueprints';
12
12
  import { useClient } from '@dxos/react-client';
13
13
  import { withClientProvider } from '@dxos/react-client/testing';
14
14
  import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
15
15
  import { trim } from '@dxos/util';
16
16
 
17
- import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
18
17
  import { translations } from '../../translations';
19
18
 
19
+ import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
20
+
20
21
  const TEMPLATE = trim`
21
22
  {{! System Prompt }}
22
23
 
@@ -35,12 +36,18 @@ const TEMPLATE = trim`
35
36
 
36
37
  const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
37
38
  const client = useClient();
38
- const [template] = useState(() => {
39
+ const [blueprint] = useState(() => {
39
40
  const space = client.spaces.default;
40
- return space.db.add(Template.make({ source }));
41
+ return space.db.add(
42
+ Blueprint.make({
43
+ key: 'example.com/blueprint/test',
44
+ name: 'Test',
45
+ instructions: Template.make({ source }),
46
+ }),
47
+ );
41
48
  });
42
49
 
43
- return <TemplateEditor template={template} />;
50
+ return <TemplateEditor id={blueprint.id} template={blueprint.instructions} />;
44
51
  };
45
52
 
46
53
  const meta: Meta<typeof DefaultStory> = {
@@ -8,9 +8,8 @@ import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
8
8
  import React from 'react';
9
9
 
10
10
  import { type Template } from '@dxos/blueprints';
11
- import { invariant } from '@dxos/invariant';
12
11
  import { createDocAccessor } from '@dxos/react-client/echo';
13
- import { useThemeContext, useTranslation, type ThemedClassName } from '@dxos/react-ui';
12
+ import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
14
13
  import {
15
14
  createBasicExtensions,
16
15
  createDataExtensions,
@@ -18,6 +17,7 @@ import {
18
17
  useTextEditor,
19
18
  } from '@dxos/react-ui-editor';
20
19
  import { mx } from '@dxos/react-ui-theme';
20
+ import { isNotFalsy } from '@dxos/util';
21
21
 
22
22
  import { meta } from '../../meta';
23
23
 
@@ -30,21 +30,23 @@ handlebarsLanguage.configure({
30
30
  });
31
31
 
32
32
  export type TemplateEditorProps = ThemedClassName<{
33
+ id: string;
33
34
  template: Template.Template;
34
35
  }>;
35
36
 
36
- export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) => {
37
+ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
37
38
  const { t } = useTranslation(meta.id);
38
39
  const { themeMode } = useThemeContext();
39
40
  const { parentRef } = useTextEditor(() => {
40
- invariant(template.source.target);
41
+ const text = template.source?.target;
41
42
  return {
42
- initialValue: template.source.target.content,
43
+ initialValue: text?.content ?? '',
43
44
  extensions: [
44
- createDataExtensions({
45
- id: template.id,
46
- text: createDocAccessor(template.source.target, ['content']),
47
- }),
45
+ text &&
46
+ createDataExtensions({
47
+ id,
48
+ text: createDocAccessor(text, ['content']),
49
+ }),
48
50
  createBasicExtensions({
49
51
  bracketMatching: false,
50
52
  lineNumbers: true,
@@ -58,11 +60,12 @@ export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) =>
58
60
 
59
61
  // https://github.com/xiechao/lang-handlebars
60
62
  new LanguageSupport(handlebarsLanguage, syntaxHighlighting(handlebarsHighlightStyle)),
61
- ],
63
+ // createMarkdownExtensions({}),
64
+ ].filter(isNotFalsy),
62
65
  };
63
- }, [themeMode, template]);
66
+ }, [themeMode, template.source?.target]);
64
67
 
65
- return <div ref={parentRef} className={mx('h-full', classNames)} />;
68
+ return <div ref={parentRef} className={mx('h-full overflow-hidden', classNames)} />;
66
69
  };
67
70
 
68
71
  /**