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

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 (350) 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-OUVSX5V5.mjs} +35 -13
  4. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-P4FLEOHG.mjs} +21 -7
  6. package/dist/lib/browser/ChatDialog-P4FLEOHG.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-AVHHQ3KV.mjs} +17 -74
  12. package/dist/lib/browser/app-graph-builder-AVHHQ3KV.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-BRLHDHOF.mjs +244 -0
  16. package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-HRLMD35M.mjs +191 -0
  18. package/dist/lib/browser/chunk-HRLMD35M.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  20. package/dist/lib/browser/chunk-J5LGTIGS.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-OWY4CUQY.mjs → chunk-VEBVAHNM.mjs} +799 -813
  28. package/dist/lib/browser/chunk-VEBVAHNM.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 +96 -51
  32. package/dist/lib/browser/index.mjs.map +4 -4
  33. package/dist/lib/browser/{intent-resolver-5RMMCMXG.mjs → intent-resolver-MVOIEJXZ.mjs} +33 -12
  34. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
  35. package/dist/lib/browser/meta.json +1 -1
  36. package/dist/lib/browser/{react-surface-66VY37YQ.mjs → react-surface-4HXS3YLT.mjs} +45 -32
  37. package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
  38. package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-G2EZXMWT.mjs} +6 -5
  39. package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-G2EZXMWT.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-D5FABDNE.mjs} +35 -13
  46. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
  47. package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-NKWVXHJP.mjs} +21 -7
  48. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.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-RMOUJMMG.mjs} +17 -74
  54. package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.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-3SOC5GOP.mjs} +799 -813
  58. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
  60. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-2XL6MNPE.mjs → chunk-GAWXJ7K5.mjs} +12 -21
  62. package/dist/lib/node-esm/chunk-GAWXJ7K5.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-RD755HN3.mjs +245 -0
  68. package/dist/lib/node-esm/chunk-RD755HN3.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 +96 -51
  74. package/dist/lib/node-esm/index.mjs.map +4 -4
  75. package/dist/lib/node-esm/{intent-resolver-YPPYELY3.mjs → intent-resolver-DTDNCX3C.mjs} +33 -12
  76. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.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-V6JNEZVO.mjs} +45 -32
  79. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
  80. package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-AIP5FOJG.mjs} +6 -5
  81. package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-AIP5FOJG.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 +24 -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 +9 -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/functions/analysis.d.ts +5 -0
  149. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  150. package/dist/types/src/functions/index.d.ts +4 -0
  151. package/dist/types/src/functions/index.d.ts.map +1 -0
  152. package/dist/types/src/functions/list.d.ts +10 -0
  153. package/dist/types/src/functions/list.d.ts.map +1 -0
  154. package/dist/types/src/functions/load.d.ts +8 -0
  155. package/dist/types/src/functions/load.d.ts.map +1 -0
  156. package/dist/types/src/hooks/chat-processor.d.ts +28 -42
  157. package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
  158. package/dist/types/src/hooks/errors.d.ts +4 -0
  159. package/dist/types/src/hooks/errors.d.ts.map +1 -0
  160. package/dist/types/src/hooks/index.d.ts +5 -1
  161. package/dist/types/src/hooks/index.d.ts.map +1 -1
  162. package/dist/types/src/hooks/presets.d.ts +2 -2
  163. package/dist/types/src/hooks/presets.d.ts.map +1 -1
  164. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
  165. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  166. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -14
  167. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  168. package/dist/types/src/hooks/useChatServices.d.ts +3 -4
  169. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  170. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  171. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  172. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  173. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  174. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  175. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  176. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  177. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  178. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  179. package/dist/types/src/stories/Chat.stories.d.ts +68 -49
  180. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  181. package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
  182. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  183. package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
  184. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  185. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  186. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  187. package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
  188. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  189. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  190. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  191. package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
  192. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  193. package/dist/types/src/stories/components/index.d.ts +8 -0
  194. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  195. package/dist/types/src/stories/components/types.d.ts +7 -0
  196. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  197. package/dist/types/src/stories/hooks/index.d.ts +3 -0
  198. package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
  199. package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
  200. package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
  201. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
  202. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
  203. package/dist/types/src/stories/testing/data.d.ts +142 -0
  204. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  205. package/dist/types/src/stories/testing/index.d.ts +3 -0
  206. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  207. package/dist/types/src/stories/testing/testing.d.ts +26 -0
  208. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  209. package/dist/types/src/testing/test-functions.d.ts +5 -2
  210. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  211. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  212. package/dist/types/src/tools/function.d.ts.map +1 -1
  213. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  214. package/dist/types/src/translations.d.ts +6 -10
  215. package/dist/types/src/translations.d.ts.map +1 -1
  216. package/dist/types/src/types/Assistant.d.ts +40 -0
  217. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  218. package/dist/types/src/types/AssistantAction.d.ts +90 -0
  219. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  220. package/dist/types/src/types/defs.d.ts +2 -0
  221. package/dist/types/src/types/defs.d.ts.map +1 -0
  222. package/dist/types/src/types/index.d.ts +3 -1
  223. package/dist/types/src/types/index.d.ts.map +1 -1
  224. package/dist/types/src/types/service.d.ts +6 -6
  225. package/dist/types/src/types/service.d.ts.map +1 -1
  226. package/dist/types/tsconfig.tsbuildinfo +1 -1
  227. package/package.json +81 -75
  228. package/src/AssistantPlugin.tsx +59 -12
  229. package/src/capabilities/ai-service.ts +28 -0
  230. package/src/capabilities/app-graph-builder.ts +9 -93
  231. package/src/capabilities/blueprint-definition.ts +32 -0
  232. package/src/capabilities/capabilities.ts +22 -0
  233. package/src/capabilities/edge-model-resolver.ts +29 -0
  234. package/src/capabilities/index.ts +6 -0
  235. package/src/capabilities/intent-resolver.ts +24 -9
  236. package/src/capabilities/react-surface.tsx +29 -22
  237. package/src/capabilities/toolkit.ts +106 -0
  238. package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
  239. package/src/components/BlueprintContainer.tsx +24 -0
  240. package/src/components/Chat/Chat.tsx +77 -64
  241. package/src/components/ChatContainer.tsx +37 -13
  242. package/src/components/ChatDialog.tsx +9 -5
  243. package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
  244. package/src/components/ChatPrompt/ChatReferences.tsx +11 -9
  245. package/src/components/ChatPrompt/index.ts +1 -1
  246. package/src/components/ChatThread/ChatMessage.tsx +132 -118
  247. package/src/components/ChatThread/ChatThread.stories.tsx +220 -103
  248. package/src/components/ChatThread/ChatThread.tsx +2 -2
  249. package/src/components/ChatThread/Link.tsx +39 -0
  250. package/src/components/ChatThread/ToolBlock.tsx +20 -16
  251. package/src/components/SequenceContainer.tsx +2 -1
  252. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
  253. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  254. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -5
  255. package/src/components/TemplateEditor/TemplateEditor.tsx +15 -12
  256. package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
  257. package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
  258. package/src/components/Timeline/Timeline.stories.tsx +53 -0
  259. package/src/components/Timeline/Timeline.tsx +159 -0
  260. package/src/components/Timeline/index.ts +5 -0
  261. package/src/components/Toolbox/Toolbox.stories.tsx +6 -12
  262. package/src/components/Toolbox/Toolbox.tsx +16 -40
  263. package/src/components/index.ts +2 -5
  264. package/src/events.ts +2 -2
  265. package/src/functions/analysis.ts +20 -0
  266. package/src/functions/index.ts +7 -0
  267. package/src/functions/list.ts +42 -0
  268. package/src/functions/load.ts +43 -0
  269. package/src/hooks/chat-processor.ts +123 -177
  270. package/src/hooks/errors.ts +8 -0
  271. package/src/hooks/index.ts +5 -1
  272. package/src/hooks/presets.ts +6 -5
  273. package/src/hooks/useBlueprintRegistry.ts +79 -0
  274. package/src/hooks/useChatProcessor.ts +21 -83
  275. package/src/hooks/useChatServices.ts +35 -54
  276. package/src/hooks/useOnline.ts +10 -0
  277. package/src/hooks/usePresets.ts +45 -0
  278. package/src/hooks/useReferencesProvider.ts +11 -9
  279. package/src/hooks/useResolveRef.ts +33 -0
  280. package/src/parser/filter-generator.ts +6 -13
  281. package/src/parser/query-parser.ts +1 -1
  282. package/src/queue-logger.ts +5 -5
  283. package/src/stories/Chat.stories.tsx +238 -299
  284. package/src/stories/components/BlueprintContainer.tsx +34 -0
  285. package/src/stories/components/ChatContainer.tsx +80 -0
  286. package/src/stories/components/GraphContainer.tsx +118 -0
  287. package/src/stories/components/LoggingContainer.tsx +22 -0
  288. package/src/stories/components/SurfaceContainer.tsx +62 -0
  289. package/src/stories/components/TasksContainer.tsx +51 -0
  290. package/src/stories/components/index.ts +12 -0
  291. package/src/stories/components/types.ts +11 -0
  292. package/src/stories/hooks/index.ts +6 -0
  293. package/src/stories/hooks/useFlush.ts +35 -0
  294. package/src/stories/hooks/useMatcherExtension.ts +45 -0
  295. package/src/stories/testing/data.ts +130 -0
  296. package/src/stories/testing/index.ts +6 -0
  297. package/src/stories/testing/testing.tsx +162 -0
  298. package/src/testing/test-functions.ts +8 -3
  299. package/src/testing/test-sequence.ts +1 -1
  300. package/src/tools/function.ts +4 -1
  301. package/src/tools/openapi.test.ts +7 -5
  302. package/src/tools/openapi.ts +4 -1
  303. package/src/translations.ts +8 -10
  304. package/src/types/Assistant.ts +59 -0
  305. package/src/types/AssistantAction.ts +54 -0
  306. package/src/types/defs.ts +5 -0
  307. package/src/types/index.ts +4 -1
  308. package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
  309. package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
  310. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  311. package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
  312. package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
  313. package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
  314. package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
  315. package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
  316. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  317. package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
  318. package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
  319. package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
  320. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
  321. package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
  322. package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
  323. package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
  324. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  325. package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
  326. package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
  327. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
  329. package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
  330. package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
  331. package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
  332. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  333. package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
  334. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
  335. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
  336. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  337. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  338. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  339. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  340. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  341. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  342. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  343. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  344. package/dist/types/src/types/schema.d.ts +0 -88
  345. package/dist/types/src/types/schema.d.ts.map +0 -1
  346. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  347. package/src/components/TemplateContainer.tsx +0 -24
  348. package/src/hooks/chat-processor.test.ts +0 -16
  349. package/src/hooks/useBlueprints.ts +0 -57
  350. package/src/types/schema.ts +0 -95
@@ -4,20 +4,55 @@
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
 
10
11
  import { Obj } from '@dxos/echo';
12
+ import { ContextQueueService, DatabaseService } from '@dxos/functions';
11
13
  import { faker } from '@dxos/random';
14
+ import { useQueue, useSpace } from '@dxos/react-client/echo';
12
15
  import { withClientProvider } from '@dxos/react-client/testing';
13
- import { DataType, type ContentBlock } from '@dxos/schema';
14
- import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
16
+ import { type ContentBlock, DataType } from '@dxos/schema';
17
+ import { ColumnContainer, render, withLayout, withTheme } from '@dxos/storybook-utils';
15
18
 
16
- import { ChatThread } from './ChatThread';
17
19
  import { translations } from '../../translations';
18
20
 
21
+ import { renderObjectLink } from './ChatMessage';
22
+ import { ChatThread, type ChatThreadProps } from './ChatThread';
23
+
19
24
  faker.seed(1);
20
25
 
26
+ const StoryContainer = ({ delay = 0, ...props }: ChatThreadProps & { delay?: number }) => {
27
+ const space = useSpace();
28
+ const queueDxn = useMemo(() => space?.queues.create().dxn, [space]);
29
+ const queue = useQueue<DataType.Message>(queueDxn);
30
+ useEffect(() => {
31
+ if (!space || !queue) {
32
+ return;
33
+ }
34
+
35
+ void Effect.runPromise(
36
+ Effect.gen(function* () {
37
+ for (const step of MESSAGES) {
38
+ yield* step;
39
+ yield* Effect.sleep(delay);
40
+ }
41
+
42
+ return queue;
43
+ }).pipe(Effect.provide(Layer.mergeAll(DatabaseService.layer(space.db), ContextQueueService.layer(queue)))),
44
+ );
45
+ }, [space, queue]);
46
+
47
+ if (!space) {
48
+ return null;
49
+ }
50
+
51
+ return (
52
+ <ChatThread {...props} space={space} messages={queue?.objects ?? []} onEvent={(event) => console.log(event)} />
53
+ );
54
+ };
55
+
21
56
  const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): DataType.Message => {
22
57
  return Obj.make(DataType.Message, {
23
58
  created: new Date().toISOString(),
@@ -26,88 +61,187 @@ const createMessage = (role: DataType.ActorRole, blocks: ContentBlock.Any[]): Da
26
61
  });
27
62
  };
28
63
 
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
- ]),
64
+ const MESSAGES: Effect.Effect<void, never, DatabaseService | ContextQueueService>[] = [
65
+ Effect.gen(function* () {
66
+ const { queue } = yield* ContextQueueService;
67
+ yield* Effect.promise(() =>
68
+ queue.append([
69
+ createMessage('user', [
70
+ {
71
+ _tag: 'text',
72
+ text: faker.lorem.sentence(5),
73
+ },
74
+ ]),
75
+ ]),
76
+ );
77
+ }),
78
+
79
+ Effect.gen(function* () {
80
+ const { queue } = yield* ContextQueueService;
81
+ yield* Effect.promise(() =>
82
+ queue.append([
83
+ createMessage('assistant', [
84
+ {
85
+ _tag: 'suggest',
86
+ text: 'Search...',
87
+ },
88
+ {
89
+ _tag: 'suggest',
90
+ text: faker.lorem.paragraphs(1),
91
+ },
92
+ ]),
93
+ createMessage('assistant', [
94
+ {
95
+ _tag: 'text',
96
+ text: 'Select an option:',
97
+ },
98
+ {
99
+ _tag: 'select',
100
+ options: ['Option 1', 'Option 2', 'Option 3'],
101
+ },
102
+ ]),
103
+ ]),
104
+ );
105
+ }),
106
+
107
+ Effect.gen(function* () {
108
+ const { queue } = yield* ContextQueueService;
109
+ const { db } = yield* DatabaseService;
110
+ const obj1 = db.add(Obj.make(DataType.Organization, { name: 'DXOS' }));
111
+ const obj2 = db.add(Obj.make(DataType.Person, { fullName: 'Alice' }));
112
+ const obj3 = db.add(Obj.make(DataType.Person, { fullName: 'Bob' }));
113
+ const obj4 = db.add(Obj.make(DataType.Person, { fullName: 'Charlie' }));
114
+ yield* Effect.promise(() =>
115
+ queue.append([
116
+ createMessage('assistant', [
117
+ // Inline tag.
118
+ {
119
+ _tag: 'text',
120
+ text: [faker.lorem.paragraph(), renderObjectLink(obj1), faker.lorem.paragraph()].join(' '),
121
+ },
122
+ // Inline cards.
123
+ ...[obj2, obj3, obj4].map(
124
+ (obj) =>
125
+ ({
126
+ _tag: 'text',
127
+ text: renderObjectLink(obj),
128
+ }) satisfies ContentBlock.Text,
129
+ ),
130
+ ]),
131
+ ]),
132
+ );
133
+ }),
134
+
135
+ Effect.gen(function* () {
136
+ const { queue } = yield* ContextQueueService;
137
+ yield* Effect.promise(() =>
138
+ queue.append([
139
+ createMessage('assistant', [
140
+ {
141
+ _tag: 'text',
142
+ text: faker.lorem.paragraphs(1),
143
+ },
144
+ {
145
+ _tag: 'toolkit',
146
+ },
147
+ ]),
148
+ ]),
149
+ );
150
+ }),
151
+
152
+ Effect.gen(function* () {
153
+ const { queue } = yield* ContextQueueService;
154
+ yield* Effect.promise(() =>
155
+ queue.append([
156
+ createMessage('assistant', [
157
+ {
158
+ _tag: 'text',
159
+ disposition: 'cot',
160
+ text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
161
+ .map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
162
+ .join('\n'),
163
+ },
164
+ {
165
+ _tag: 'toolCall',
166
+ toolCallId: '1234',
167
+ name: 'search',
168
+ input: {},
169
+ },
170
+ ]),
171
+ createMessage('user', [
172
+ {
173
+ _tag: 'toolResult',
174
+ toolCallId: '1234',
175
+ name: 'search',
176
+ result: 'This is a tool result.',
177
+ },
178
+ ]),
179
+ ]),
180
+ );
181
+ }),
182
+
183
+ Effect.gen(function* () {
184
+ const { queue } = yield* ContextQueueService;
185
+ yield* Effect.promise(() =>
186
+ queue.append([
187
+ createMessage('assistant', [
188
+ {
189
+ _tag: 'toolCall',
190
+ toolCallId: '4567',
191
+ name: 'create',
192
+ input: {},
193
+ },
194
+ ]),
195
+ createMessage('user', [
196
+ {
197
+ _tag: 'toolResult',
198
+ toolCallId: '4567',
199
+ name: 'create',
200
+ result: 'This is a tool result.',
201
+ },
202
+ ]),
203
+ createMessage('assistant', [
204
+ {
205
+ _tag: 'text',
206
+ text: Array.from({ length: faker.number.int({ min: 2, max: 3 }) })
207
+ .map(() => faker.lorem.paragraphs())
208
+ .join('\n\n'),
209
+ },
210
+ ]),
211
+ ]),
212
+ );
213
+ }),
214
+
215
+ Effect.gen(function* () {
216
+ const { queue } = yield* ContextQueueService;
217
+ yield* Effect.promise(() =>
218
+ queue.append([
219
+ createMessage('assistant', [
220
+ {
221
+ _tag: 'text',
222
+ text: faker.lorem.paragraphs(2),
223
+ },
224
+ ]),
225
+ ]),
226
+ );
227
+ }),
105
228
  ];
106
229
 
107
230
  const meta = {
108
231
  title: 'plugins/plugin-assistant/ChatThread',
109
232
  component: ChatThread,
110
- decorators: [withClientProvider({ createIdentity: true }), withTheme, withLayout({ Container: ColumnContainer })],
233
+ render: render(StoryContainer),
234
+ decorators: [
235
+ withClientProvider({
236
+ createIdentity: true,
237
+ types: [DataType.Organization, DataType.Person],
238
+ }),
239
+ withTheme,
240
+ withLayout({
241
+ Container: ColumnContainer,
242
+ classNames: 'is-[40rem]',
243
+ }),
244
+ ],
111
245
  parameters: {
112
246
  translations,
113
247
  },
@@ -117,27 +251,10 @@ export default meta;
117
251
 
118
252
  type Story = StoryObj<typeof meta>;
119
253
 
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);
254
+ export const Default = {} satisfies Story;
137
255
 
138
- return () => clearInterval(interval);
139
- }, []);
140
-
141
- return <ChatThread messages={messages} collapse />;
256
+ export const Delayed = {
257
+ args: {
258
+ delay: 2_000,
142
259
  },
143
260
  } 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,39 @@
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 { mx } from '@dxos/react-ui-theme';
11
+
12
+ import { useResolvedRef } from '../../hooks';
13
+
14
+ export type ObjectLinkProps = {
15
+ space: Space;
16
+ dxn: DXN;
17
+ };
18
+
19
+ // TODO(burdon): Factor out.
20
+ export const ObjectLink = ({ space, dxn }: ObjectLinkProps) => {
21
+ const object = useResolvedRef(space, Ref.fromDXN(dxn));
22
+ const title = Obj.getLabel(object) ?? object?.id ?? dxn.toString();
23
+
24
+ return (
25
+ <a
26
+ // href={dxn.toString()}
27
+ title={title}
28
+ className={mx(
29
+ // TODO(burdon): Use style for tags.
30
+ 'inline-flex items-center max-w-[16rem] px-1.5 overflow-hidden',
31
+ 'border border-separator rounded whitespace-nowrap text-ellipsis text-primary-500 hover:text-primary-500 hover:border-primary-500 cursor-pointer',
32
+ )}
33
+ target='_blank'
34
+ rel='noopener noreferrer'
35
+ >
36
+ <span className='truncate'>{title}</span>
37
+ </a>
38
+ );
39
+ };
@@ -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
  /**