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

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 (559) hide show
  1. package/dist/lib/browser/{TemplateContainer-QQHVOTSI.mjs → BlueprintContainer-H7H4BQ2C.mjs} +11 -10
  2. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
  3. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs +76 -0
  4. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +7 -0
  5. package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs +86 -0
  6. package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +7 -0
  7. package/dist/lib/browser/SequenceContainer-627OQ557.mjs +163 -0
  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-E4H5DCOJ.mjs → app-graph-builder-AVHHQ3KV.mjs} +30 -89
  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-XOZ7YMO3.mjs → chunk-LKP65RPA.mjs} +2 -2
  22. package/dist/lib/browser/{chunk-JQFUME3B.mjs → chunk-NZDCKQ6W.mjs} +36 -34
  23. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
  25. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-VEBVAHNM.mjs +2231 -0
  27. package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +7 -0
  28. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
  29. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
  30. package/dist/lib/browser/index.mjs +141 -128
  31. package/dist/lib/browser/index.mjs.map +3 -3
  32. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs +81 -0
  33. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +7 -0
  34. package/dist/lib/browser/meta.json +1 -1
  35. package/dist/lib/browser/{react-surface-LXCNUSZN.mjs → react-surface-4HXS3YLT.mjs} +66 -62
  36. package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +7 -0
  37. package/dist/lib/browser/{settings-XRHXVWGB.mjs → settings-G2EZXMWT.mjs} +7 -6
  38. package/dist/lib/browser/settings-G2EZXMWT.mjs.map +7 -0
  39. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
  40. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
  41. package/dist/lib/browser/types/index.mjs +7 -20
  42. package/dist/lib/node-esm/{TemplateContainer-SOEWY2ZN.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -10
  43. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
  44. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs +77 -0
  45. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +7 -0
  46. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs +87 -0
  47. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +7 -0
  48. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs +164 -0
  49. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
  50. package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
  51. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
  52. package/dist/lib/node-esm/{app-graph-builder-3SY5MBIK.mjs → app-graph-builder-RMOUJMMG.mjs} +30 -89
  53. package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +7 -0
  54. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
  55. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
  56. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +2232 -0
  57. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs +192 -0
  59. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-OYN6HLXZ.mjs → chunk-GAWXJ7K5.mjs} +36 -34
  61. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs → chunk-KOC6ESG7.mjs} +2 -2
  65. package/dist/lib/node-esm/chunk-RD755HN3.mjs +245 -0
  66. package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
  68. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
  69. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
  70. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
  71. package/dist/lib/node-esm/index.mjs +141 -128
  72. package/dist/lib/node-esm/index.mjs.map +3 -3
  73. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs +82 -0
  74. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +7 -0
  75. package/dist/lib/node-esm/meta.json +1 -1
  76. package/dist/lib/node-esm/{react-surface-7HA5EDWY.mjs → react-surface-V6JNEZVO.mjs} +66 -62
  77. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +7 -0
  78. package/dist/lib/node-esm/{settings-5IAY6BT4.mjs → settings-AIP5FOJG.mjs} +7 -6
  79. package/dist/lib/node-esm/settings-AIP5FOJG.mjs.map +7 -0
  80. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
  81. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
  82. package/dist/lib/node-esm/types/index.mjs +7 -20
  83. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  84. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  85. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  86. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  87. package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
  88. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/capabilities.d.ts +8 -3
  90. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  91. package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
  92. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/index.d.ts +6 -3
  94. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  95. package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
  96. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/toolkit.d.ts +5 -0
  99. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  100. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +2 -2
  101. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  102. package/dist/types/src/components/BlueprintContainer.d.ts +5 -6
  103. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -1
  104. package/dist/types/src/components/Chat/Chat.d.ts +45 -0
  105. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -0
  106. package/dist/types/src/components/Chat/events.d.ts +30 -0
  107. package/dist/types/src/components/Chat/events.d.ts.map +1 -0
  108. package/dist/types/src/components/Chat/index.d.ts +3 -0
  109. package/dist/types/src/components/Chat/index.d.ts.map +1 -0
  110. package/dist/types/src/components/ChatContainer.d.ts +8 -7
  111. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  112. package/dist/types/src/components/ChatDialog.d.ts +8 -0
  113. package/dist/types/src/components/ChatDialog.d.ts.map +1 -0
  114. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts +11 -0
  115. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -0
  116. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
  117. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  118. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts +11 -0
  119. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -0
  120. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +11 -0
  121. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -0
  122. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +8 -0
  123. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -0
  124. package/dist/types/src/components/ChatPrompt/index.d.ts +6 -0
  125. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -0
  126. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +18 -0
  127. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -0
  128. package/dist/types/src/components/ChatThread/ChatThread.d.ts +19 -0
  129. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -0
  130. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +226 -0
  131. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -0
  132. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  133. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  134. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +19 -0
  135. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -0
  136. package/dist/types/src/components/ChatThread/index.d.ts +2 -0
  137. package/dist/types/src/components/ChatThread/index.d.ts.map +1 -0
  138. package/dist/types/src/components/{Thread → ChatThread}/reducer.d.ts +4 -4
  139. package/dist/types/src/components/ChatThread/reducer.d.ts.map +1 -0
  140. package/dist/types/src/components/PromptSettings.d.ts +2 -2
  141. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  142. package/dist/types/src/components/SequenceContainer.d.ts +8 -0
  143. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -0
  144. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +13 -0
  145. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -0
  146. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +8 -0
  147. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -0
  148. package/dist/types/src/components/SequenceEditor/index.d.ts +2 -0
  149. package/dist/types/src/components/SequenceEditor/index.d.ts.map +1 -0
  150. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +4 -3
  151. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  152. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +3 -3
  153. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  154. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +5 -4
  155. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  156. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +1 -1
  157. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/Timeline/Timeline.d.ts +24 -0
  159. package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
  160. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +9 -0
  161. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
  162. package/dist/types/src/components/Timeline/index.d.ts +2 -0
  163. package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
  164. package/dist/types/src/components/Toolbox/Toolbox.d.ts +10 -6
  165. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  166. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +2 -3
  167. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  168. package/dist/types/src/components/index.d.ts +7 -12
  169. package/dist/types/src/components/index.d.ts.map +1 -1
  170. package/dist/types/src/events.d.ts +1 -1
  171. package/dist/types/src/events.d.ts.map +1 -1
  172. package/dist/types/src/functions/analysis.d.ts +5 -0
  173. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  174. package/dist/types/src/functions/index.d.ts +4 -0
  175. package/dist/types/src/functions/index.d.ts.map +1 -0
  176. package/dist/types/src/functions/list.d.ts +10 -0
  177. package/dist/types/src/functions/list.d.ts.map +1 -0
  178. package/dist/types/src/functions/load.d.ts +8 -0
  179. package/dist/types/src/functions/load.d.ts.map +1 -0
  180. package/dist/types/src/hooks/chat-processor.d.ts +72 -0
  181. package/dist/types/src/hooks/chat-processor.d.ts.map +1 -0
  182. package/dist/types/src/hooks/errors.d.ts +4 -0
  183. package/dist/types/src/hooks/errors.d.ts.map +1 -0
  184. package/dist/types/src/hooks/index.d.ts +9 -5
  185. package/dist/types/src/hooks/index.d.ts.map +1 -1
  186. package/dist/types/src/hooks/presets.d.ts +13 -0
  187. package/dist/types/src/hooks/presets.d.ts.map +1 -0
  188. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
  189. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  190. package/dist/types/src/hooks/useChatProcessor.d.ts +16 -11
  191. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  192. package/dist/types/src/hooks/useChatServices.d.ts +13 -0
  193. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -0
  194. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  195. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  196. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  197. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  198. package/dist/types/src/hooks/useReferencesProvider.d.ts +7 -0
  199. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -0
  200. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  201. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  202. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  203. package/dist/types/src/parser/index.d.ts +1 -1
  204. package/dist/types/src/parser/index.d.ts.map +1 -1
  205. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  206. package/dist/types/src/queue-logger.d.ts +5 -5
  207. package/dist/types/src/queue-logger.d.ts.map +1 -1
  208. package/dist/types/src/stories/Chat.stories.d.ts +268 -0
  209. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -0
  210. package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
  211. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  212. package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
  213. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  214. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  215. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  216. package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
  217. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  218. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  219. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  220. package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
  221. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  222. package/dist/types/src/stories/components/index.d.ts +8 -0
  223. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  224. package/dist/types/src/stories/components/types.d.ts +7 -0
  225. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  226. package/dist/types/src/stories/hooks/index.d.ts +3 -0
  227. package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
  228. package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
  229. package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
  230. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
  231. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
  232. package/dist/types/src/stories/testing/data.d.ts +142 -0
  233. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  234. package/dist/types/src/stories/testing/index.d.ts +3 -0
  235. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  236. package/dist/types/src/stories/testing/testing.d.ts +26 -0
  237. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  238. package/dist/types/src/testing/index.d.ts +1 -1
  239. package/dist/types/src/testing/index.d.ts.map +1 -1
  240. package/dist/types/src/testing/test-functions.d.ts +5 -2
  241. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  242. package/dist/types/src/testing/test-sequence.d.ts +8 -0
  243. package/dist/types/src/testing/test-sequence.d.ts.map +1 -0
  244. package/dist/types/src/tools/function.d.ts.map +1 -1
  245. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  246. package/dist/types/src/translations.d.ts +73 -113
  247. package/dist/types/src/translations.d.ts.map +1 -1
  248. package/dist/types/src/types/{chat.d.ts → Assistant.d.ts} +20 -3
  249. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  250. package/dist/types/src/types/AssistantAction.d.ts +90 -0
  251. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  252. package/dist/types/src/types/defs.d.ts +2 -0
  253. package/dist/types/src/types/defs.d.ts.map +1 -0
  254. package/dist/types/src/types/index.d.ts +3 -3
  255. package/dist/types/src/types/index.d.ts.map +1 -1
  256. package/dist/types/src/types/service.d.ts +12 -12
  257. package/dist/types/src/types/service.d.ts.map +1 -1
  258. package/dist/types/tsconfig.tsbuildinfo +1 -1
  259. package/package.json +86 -74
  260. package/src/AssistantPlugin.tsx +63 -43
  261. package/src/capabilities/ai-service.ts +28 -0
  262. package/src/capabilities/app-graph-builder.ts +28 -107
  263. package/src/capabilities/blueprint-definition.ts +32 -0
  264. package/src/capabilities/capabilities.ts +12 -5
  265. package/src/capabilities/edge-model-resolver.ts +29 -0
  266. package/src/capabilities/index.ts +6 -3
  267. package/src/capabilities/intent-resolver.ts +40 -12
  268. package/src/capabilities/react-surface.tsx +54 -46
  269. package/src/capabilities/settings.ts +3 -3
  270. package/src/capabilities/toolkit.ts +106 -0
  271. package/src/components/AssistantSettings/AssistantSettings.tsx +4 -4
  272. package/src/components/BlueprintContainer.tsx +9 -133
  273. package/src/components/Chat/Chat.tsx +401 -0
  274. package/src/components/Chat/events.ts +50 -0
  275. package/src/components/Chat/index.ts +7 -0
  276. package/src/components/ChatContainer.tsx +51 -21
  277. package/src/components/ChatDialog.tsx +68 -0
  278. package/src/components/ChatPrompt/ChatActions.tsx +71 -0
  279. package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
  280. package/src/components/ChatPrompt/ChatPresets.tsx +28 -0
  281. package/src/components/ChatPrompt/ChatReferences.tsx +55 -0
  282. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +39 -0
  283. package/src/components/ChatPrompt/index.ts +9 -0
  284. package/src/components/ChatThread/ChatMessage.tsx +282 -0
  285. package/src/components/ChatThread/ChatThread.stories.tsx +260 -0
  286. package/src/components/ChatThread/ChatThread.tsx +57 -0
  287. package/src/components/ChatThread/Link.tsx +39 -0
  288. package/src/components/ChatThread/ToolBlock.tsx +125 -0
  289. package/src/components/{AmbientDialog → ChatThread}/index.ts +1 -1
  290. package/src/components/{Thread → ChatThread}/reducer.ts +14 -14
  291. package/src/components/PromptSettings.tsx +43 -45
  292. package/src/components/SequenceContainer.tsx +133 -0
  293. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +33 -0
  294. package/src/components/{BlueprintEditor/BlueprintEditor.tsx → SequenceEditor/SequenceEditor.tsx} +8 -8
  295. package/src/components/SequenceEditor/index.ts +5 -0
  296. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +38 -36
  297. package/src/components/TemplateEditor/TemplateEditor.tsx +41 -25
  298. package/src/components/TemplateEditor/TemplateForm.stories.tsx +24 -17
  299. package/src/components/TemplateEditor/TemplateForm.tsx +51 -57
  300. package/src/components/Timeline/Timeline.stories.tsx +53 -0
  301. package/src/components/Timeline/Timeline.tsx +159 -0
  302. package/src/{experimental/transcription → components/Timeline}/index.ts +2 -0
  303. package/src/components/Toolbox/Toolbox.stories.tsx +9 -16
  304. package/src/components/Toolbox/Toolbox.tsx +49 -17
  305. package/src/components/index.ts +4 -8
  306. package/src/events.ts +3 -3
  307. package/src/functions/analysis.ts +20 -0
  308. package/src/functions/index.ts +7 -0
  309. package/src/functions/list.ts +42 -0
  310. package/src/functions/load.ts +43 -0
  311. package/src/hooks/chat-processor.ts +260 -0
  312. package/src/hooks/errors.ts +8 -0
  313. package/src/hooks/index.ts +9 -5
  314. package/src/hooks/presets.ts +53 -0
  315. package/src/hooks/useBlueprintRegistry.ts +79 -0
  316. package/src/hooks/useChatProcessor.ts +81 -0
  317. package/src/hooks/useChatServices.ts +72 -0
  318. package/src/hooks/useOnline.ts +10 -0
  319. package/src/hooks/usePresets.ts +45 -0
  320. package/src/hooks/{useContextProvider.ts → useReferencesProvider.ts} +22 -20
  321. package/src/hooks/useResolveRef.ts +33 -0
  322. package/src/parser/filter-generator.ts +6 -13
  323. package/src/parser/index.ts +1 -1
  324. package/src/parser/query-parser.ts +1 -1
  325. package/src/queue-logger.ts +11 -11
  326. package/src/stories/Chat.stories.tsx +317 -0
  327. package/src/stories/components/BlueprintContainer.tsx +34 -0
  328. package/src/stories/components/ChatContainer.tsx +80 -0
  329. package/src/stories/components/GraphContainer.tsx +118 -0
  330. package/src/stories/components/LoggingContainer.tsx +22 -0
  331. package/src/stories/components/SurfaceContainer.tsx +62 -0
  332. package/src/stories/components/TasksContainer.tsx +51 -0
  333. package/src/stories/components/index.ts +12 -0
  334. package/src/stories/components/types.ts +11 -0
  335. package/src/stories/hooks/index.ts +6 -0
  336. package/src/stories/hooks/useFlush.ts +35 -0
  337. package/src/stories/hooks/useMatcherExtension.ts +45 -0
  338. package/src/stories/{test-data.ts → testing/data.ts} +10 -8
  339. package/src/stories/testing/index.ts +6 -0
  340. package/src/stories/testing/testing.tsx +162 -0
  341. package/src/testing/index.ts +1 -1
  342. package/src/testing/test-functions.ts +9 -4
  343. package/src/testing/test-sequence.ts +51 -0
  344. package/src/tools/function.ts +4 -1
  345. package/src/tools/openapi.test.ts +14 -12
  346. package/src/tools/openapi.ts +4 -1
  347. package/src/translations.ts +46 -28
  348. package/src/types/Assistant.ts +59 -0
  349. package/src/types/AssistantAction.ts +54 -0
  350. package/src/types/defs.ts +5 -0
  351. package/src/types/index.ts +4 -3
  352. package/dist/lib/browser/AssistantDialog-MQOOR364.mjs +0 -47
  353. package/dist/lib/browser/AssistantDialog-MQOOR364.mjs.map +0 -7
  354. package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +0 -321
  355. package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +0 -7
  356. package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs +0 -40
  357. package/dist/lib/browser/ChatContainer-C2NEAS3A.mjs.map +0 -7
  358. package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +0 -7
  359. package/dist/lib/browser/ai-client-MK2ZZII2.mjs +0 -39
  360. package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +0 -7
  361. package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +0 -7
  362. package/dist/lib/browser/chunk-AAOKC2JN.mjs +0 -208
  363. package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +0 -7
  364. package/dist/lib/browser/chunk-BI6AHRNJ.mjs +0 -157
  365. package/dist/lib/browser/chunk-BI6AHRNJ.mjs.map +0 -7
  366. package/dist/lib/browser/chunk-JO4W3MF7.mjs +0 -2101
  367. package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +0 -7
  368. package/dist/lib/browser/chunk-JQFUME3B.mjs.map +0 -7
  369. package/dist/lib/browser/chunk-MEGMOFJB.mjs +0 -16
  370. package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +0 -7
  371. package/dist/lib/browser/chunk-Q6UZ4F3H.mjs +0 -96
  372. package/dist/lib/browser/chunk-Q6UZ4F3H.mjs.map +0 -7
  373. package/dist/lib/browser/chunk-UE3IZ4PN.mjs +0 -15
  374. package/dist/lib/browser/chunk-UE3IZ4PN.mjs.map +0 -7
  375. package/dist/lib/browser/intent-resolver-3UICTGPM.mjs +0 -43
  376. package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +0 -7
  377. package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +0 -7
  378. package/dist/lib/browser/settings-XRHXVWGB.mjs.map +0 -7
  379. package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs +0 -73
  380. package/dist/lib/node/AssistantDialog-AN4Z6YUV.cjs.map +0 -7
  381. package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +0 -344
  382. package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +0 -7
  383. package/dist/lib/node/ChatContainer-VKYBQHUB.cjs +0 -68
  384. package/dist/lib/node/ChatContainer-VKYBQHUB.cjs.map +0 -7
  385. package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs +0 -58
  386. package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +0 -7
  387. package/dist/lib/node/ai-client-7HNSMUMT.cjs +0 -53
  388. package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +0 -7
  389. package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs +0 -235
  390. package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +0 -7
  391. package/dist/lib/node/chunk-4EEWTDQK.cjs +0 -117
  392. package/dist/lib/node/chunk-4EEWTDQK.cjs.map +0 -7
  393. package/dist/lib/node/chunk-FUAGEO7Q.cjs +0 -52
  394. package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +0 -7
  395. package/dist/lib/node/chunk-HRNIUYVQ.cjs +0 -128
  396. package/dist/lib/node/chunk-HRNIUYVQ.cjs.map +0 -7
  397. package/dist/lib/node/chunk-IKZBMHSW.cjs +0 -184
  398. package/dist/lib/node/chunk-IKZBMHSW.cjs.map +0 -7
  399. package/dist/lib/node/chunk-LMDJEGZ2.cjs +0 -233
  400. package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +0 -7
  401. package/dist/lib/node/chunk-NIDICM57.cjs +0 -2080
  402. package/dist/lib/node/chunk-NIDICM57.cjs.map +0 -7
  403. package/dist/lib/node/chunk-P74TWGMG.cjs +0 -44
  404. package/dist/lib/node/chunk-P74TWGMG.cjs.map +0 -7
  405. package/dist/lib/node/chunk-QGPWY6GW.cjs +0 -34
  406. package/dist/lib/node/chunk-QGPWY6GW.cjs.map +0 -7
  407. package/dist/lib/node/index.cjs +0 -289
  408. package/dist/lib/node/index.cjs.map +0 -7
  409. package/dist/lib/node/intent-resolver-QSWGTKON.cjs +0 -58
  410. package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +0 -7
  411. package/dist/lib/node/meta.json +0 -1
  412. package/dist/lib/node/react-surface-D3NBYRZ6.cjs +0 -172
  413. package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +0 -7
  414. package/dist/lib/node/settings-2JXLKYGE.cjs +0 -36
  415. package/dist/lib/node/settings-2JXLKYGE.cjs.map +0 -7
  416. package/dist/lib/node/types/index.cjs +0 -54
  417. package/dist/lib/node/types/index.cjs.map +0 -7
  418. package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs +0 -48
  419. package/dist/lib/node-esm/AssistantDialog-6WEMLUPU.mjs.map +0 -7
  420. package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +0 -322
  421. package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +0 -7
  422. package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs +0 -41
  423. package/dist/lib/node-esm/ChatContainer-3MVBTUJN.mjs.map +0 -7
  424. package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +0 -7
  425. package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs +0 -40
  426. package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +0 -7
  427. package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +0 -7
  428. package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +0 -18
  429. package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +0 -7
  430. package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs +0 -16
  431. package/dist/lib/node-esm/chunk-3UEZLJ2V.mjs.map +0 -7
  432. package/dist/lib/node-esm/chunk-CDAILLCU.mjs +0 -98
  433. package/dist/lib/node-esm/chunk-CDAILLCU.mjs.map +0 -7
  434. package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs +0 -209
  435. package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +0 -7
  436. package/dist/lib/node-esm/chunk-OD574YIU.mjs +0 -2102
  437. package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +0 -7
  438. package/dist/lib/node-esm/chunk-OYN6HLXZ.mjs.map +0 -7
  439. package/dist/lib/node-esm/chunk-UCOFKNKN.mjs +0 -158
  440. package/dist/lib/node-esm/chunk-UCOFKNKN.mjs.map +0 -7
  441. package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs +0 -44
  442. package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +0 -7
  443. package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +0 -7
  444. package/dist/lib/node-esm/settings-5IAY6BT4.mjs.map +0 -7
  445. package/dist/types/src/capabilities/ai-client.d.ts +0 -5
  446. package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
  447. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +0 -10
  448. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
  449. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
  450. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
  451. package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
  452. package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
  453. package/dist/types/src/components/AssistantDialog.d.ts +0 -7
  454. package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
  455. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +0 -13
  456. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +0 -1
  457. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts +0 -8
  458. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.stories.d.ts.map +0 -1
  459. package/dist/types/src/components/BlueprintEditor/index.d.ts +0 -2
  460. package/dist/types/src/components/BlueprintEditor/index.d.ts.map +0 -1
  461. package/dist/types/src/components/Prompt/Prompt.d.ts +0 -23
  462. package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
  463. package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -13
  464. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
  465. package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -16
  466. package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
  467. package/dist/types/src/components/Prompt/PromptBar.stories.d.ts +0 -9
  468. package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +0 -1
  469. package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -25
  470. package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
  471. package/dist/types/src/components/Prompt/index.d.ts +0 -3
  472. package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
  473. package/dist/types/src/components/Prompt/references.d.ts +0 -30
  474. package/dist/types/src/components/Prompt/references.d.ts.map +0 -1
  475. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  476. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  477. package/dist/types/src/components/Thread/Thread.d.ts +0 -28
  478. package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
  479. package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
  480. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
  481. package/dist/types/src/components/Thread/ThreadContainer.d.ts +0 -13
  482. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
  483. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -16
  484. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
  485. package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -16
  486. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
  487. package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
  488. package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
  489. package/dist/types/src/components/Thread/index.d.ts +0 -3
  490. package/dist/types/src/components/Thread/index.d.ts.map +0 -1
  491. package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
  492. package/dist/types/src/experimental/transcription/index.d.ts +0 -1
  493. package/dist/types/src/experimental/transcription/index.d.ts.map +0 -1
  494. package/dist/types/src/hooks/processor.d.ts +0 -72
  495. package/dist/types/src/hooks/processor.d.ts.map +0 -1
  496. package/dist/types/src/hooks/processor.test.d.ts +0 -2
  497. package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
  498. package/dist/types/src/hooks/useContextProvider.d.ts +0 -17
  499. package/dist/types/src/hooks/useContextProvider.d.ts.map +0 -1
  500. package/dist/types/src/hooks/useMessageQueue.d.ts +0 -42
  501. package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
  502. package/dist/types/src/hooks/useServices.d.ts +0 -7
  503. package/dist/types/src/hooks/useServices.d.ts.map +0 -1
  504. package/dist/types/src/hooks/useTextInputEvents.d.ts +0 -13
  505. package/dist/types/src/hooks/useTextInputEvents.d.ts.map +0 -1
  506. package/dist/types/src/stories/Prompt.stories.d.ts +0 -8
  507. package/dist/types/src/stories/Prompt.stories.d.ts.map +0 -1
  508. package/dist/types/src/stories/Query.stories.d.ts +0 -19
  509. package/dist/types/src/stories/Query.stories.d.ts.map +0 -1
  510. package/dist/types/src/stories/Research.stories.d.ts +0 -15
  511. package/dist/types/src/stories/Research.stories.d.ts.map +0 -1
  512. package/dist/types/src/stories/test-data.d.ts +0 -3
  513. package/dist/types/src/stories/test-data.d.ts.map +0 -1
  514. package/dist/types/src/stories/testing.d.ts +0 -12
  515. package/dist/types/src/stories/testing.d.ts.map +0 -1
  516. package/dist/types/src/testing/test-blueprint.d.ts +0 -8
  517. package/dist/types/src/testing/test-blueprint.d.ts.map +0 -1
  518. package/dist/types/src/types/chat.d.ts.map +0 -1
  519. package/dist/types/src/types/template.d.ts +0 -56
  520. package/dist/types/src/types/template.d.ts.map +0 -1
  521. package/dist/types/src/types/types.d.ts +0 -50
  522. package/dist/types/src/types/types.d.ts.map +0 -1
  523. package/src/capabilities/ai-client.ts +0 -42
  524. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -84
  525. package/src/components/AmbientDialog/AmbientDialog.tsx +0 -117
  526. package/src/components/AssistantDialog.tsx +0 -37
  527. package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +0 -32
  528. package/src/components/BlueprintEditor/index.ts +0 -5
  529. package/src/components/Prompt/Prompt.stories.tsx +0 -121
  530. package/src/components/Prompt/Prompt.tsx +0 -124
  531. package/src/components/Prompt/PromptBar.stories.tsx +0 -69
  532. package/src/components/Prompt/PromptBar.tsx +0 -105
  533. package/src/components/Prompt/autocomplete.ts +0 -218
  534. package/src/components/Prompt/index.ts +0 -6
  535. package/src/components/Prompt/references.ts +0 -180
  536. package/src/components/TemplateContainer.tsx +0 -23
  537. package/src/components/Thread/Thread.stories.tsx +0 -201
  538. package/src/components/Thread/Thread.tsx +0 -118
  539. package/src/components/Thread/ThreadContainer.stories.tsx +0 -283
  540. package/src/components/Thread/ThreadContainer.tsx +0 -105
  541. package/src/components/Thread/ThreadMessage.tsx +0 -234
  542. package/src/components/Thread/ToolInvocations.tsx +0 -106
  543. package/src/components/Thread/index.ts +0 -6
  544. package/src/hooks/processor.test.ts +0 -15
  545. package/src/hooks/processor.ts +0 -238
  546. package/src/hooks/useChatProcessor.tsx +0 -97
  547. package/src/hooks/useMessageQueue.ts +0 -22
  548. package/src/hooks/useServices.ts +0 -28
  549. package/src/hooks/useTextInputEvents.ts +0 -49
  550. package/src/stories/Prompt.stories.tsx +0 -60
  551. package/src/stories/Query.stories.tsx +0 -514
  552. package/src/stories/Research.stories.tsx +0 -482
  553. package/src/stories/testing.ts +0 -60
  554. package/src/testing/test-blueprint.ts +0 -58
  555. package/src/types/chat.ts +0 -32
  556. package/src/types/template.ts +0 -66
  557. package/src/types/types.ts +0 -48
  558. /package/dist/lib/browser/{chunk-XOZ7YMO3.mjs.map → chunk-LKP65RPA.mjs.map} +0 -0
  559. /package/dist/lib/node-esm/{chunk-BB2TAT4P.mjs.map → chunk-KOC6ESG7.mjs.map} +0 -0
@@ -0,0 +1,133 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type EditorView } from '@codemirror/view';
6
+ import JSON5 from 'json5';
7
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
+
9
+ import { ToolRegistry } from '@dxos/ai';
10
+ import { getSpace } from '@dxos/client/echo';
11
+ import { type Sequence, type SequenceDefinition } from '@dxos/conductor';
12
+ import { Key } from '@dxos/echo';
13
+ import { Toolbar, useTranslation } from '@dxos/react-ui';
14
+ import { useSelectionManager } from '@dxos/react-ui-attention';
15
+ import { StackItem } from '@dxos/react-ui-stack';
16
+
17
+ import { meta } from '../meta';
18
+
19
+ import { SequenceEditor } from './SequenceEditor';
20
+
21
+ // TODO(burdon): Move to config.
22
+ export const EXA_API_KEY = '9c7e17ff-0c85-4cd5-827a-8b489f139e03';
23
+
24
+ // TODO(burdon): Validate.
25
+ const parseSequence = (text: string): SequenceDefinition | undefined => {
26
+ try {
27
+ const json = JSON5.parse(text);
28
+ const { steps } = json;
29
+ return { steps };
30
+ } catch (error) {
31
+ // Ignore.
32
+ }
33
+ };
34
+
35
+ export const SequenceContainer = ({ sequence }: { sequence: Sequence }) => {
36
+ const { t } = useTranslation(meta.id);
37
+ const selectionManager = useSelectionManager();
38
+ const [definition, setDefinition] = useState<SequenceDefinition>();
39
+ useEffect(() => {
40
+ setDefinition({
41
+ steps: sequence.steps.map(({ instructions, tools }) => ({ instructions, tools })),
42
+ });
43
+ }, [sequence]);
44
+
45
+ const editorRef = useRef<EditorView | undefined>(undefined);
46
+
47
+ // TODO(burdon): Factor out.
48
+ const toolRegistry = useMemo(() => {
49
+ const space = getSpace(sequence);
50
+ if (!space) {
51
+ return;
52
+ }
53
+
54
+ // TODO(burdon): How should the queue be created?
55
+ // eslint-disable-next-line no-unused-vars
56
+ const _queue = space.queues.create();
57
+
58
+ return new ToolRegistry([
59
+ // createExaTool({ apiKey: EXA_API_KEY }),
60
+ // createLocalSearchTool(space.db, queue),
61
+ // createGraphWriterTool({
62
+ // db: space.db,
63
+ // queue,
64
+ // schema: [], // TODO(burdon): Get schema from client/sequence?
65
+ // onDone: async (objects) => {
66
+ // await queue.append(objects);
67
+ // },
68
+ // }),
69
+ ]);
70
+ }, [sequence]);
71
+
72
+ const formatAndSave = useCallback((): SequenceDefinition | undefined => {
73
+ if (!sequence) {
74
+ return;
75
+ }
76
+
77
+ const text = editorRef.current?.state.doc.toString();
78
+ if (!text) {
79
+ return;
80
+ }
81
+
82
+ const definition = parseSequence(text);
83
+ if (!definition) {
84
+ return;
85
+ }
86
+
87
+ setDefinition(definition);
88
+ const formatted = JSON.stringify(definition, null, 2);
89
+ editorRef.current?.dispatch({
90
+ changes: { from: 0, to: text.length, insert: formatted },
91
+ });
92
+
93
+ sequence.steps.length = 0;
94
+ for (const step of definition.steps) {
95
+ sequence.steps.push({
96
+ id: Key.ObjectId.random(),
97
+ instructions: step.instructions,
98
+ tools: step.tools,
99
+ });
100
+ }
101
+
102
+ return sequence;
103
+ }, [sequence]);
104
+
105
+ // TODO(burdon): Save raw sequence separately from parsed sequence? (like Script).
106
+ const handleSave = useCallback(() => formatAndSave(), [formatAndSave]);
107
+
108
+ const handleRun = useCallback(async () => {
109
+ // if (!aiClient?.value || !toolRegistry) {
110
+ // return;
111
+ // }
112
+ // formatAndSave();
113
+ // // Get input from selection.
114
+ // const input = Array.from(getSelectionSet(selectionManager)).map((id) => DXN.fromLocalObjectId(id));
115
+ // if (!input.length) {
116
+ // return;
117
+ // }
118
+ // const machine = new SequenceMachine(toolRegistry, sequence).setLogger(new QueueLogger(sequence));
119
+ // await machine.runToCompletion({ aiClient: aiClient.value, input });
120
+ }, [sequence, formatAndSave, selectionManager, toolRegistry]);
121
+
122
+ return (
123
+ <StackItem.Content toolbar>
124
+ <Toolbar.Root>
125
+ <Toolbar.Button onClick={handleSave}>{t('button save')}</Toolbar.Button>
126
+ <Toolbar.Button onClick={handleRun}>{t('button run')}</Toolbar.Button>
127
+ </Toolbar.Root>
128
+ {definition && <SequenceEditor ref={editorRef} sequence={definition} />}
129
+ </StackItem.Content>
130
+ );
131
+ };
132
+
133
+ export default SequenceContainer;
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
+
9
+ import { withLayout, withTheme } from '@dxos/storybook-utils';
10
+
11
+ import { RESEARCH_SEQUENCE_DEFINITION } from '../../testing';
12
+ import { translations } from '../../translations';
13
+
14
+ import { SequenceEditor } from './SequenceEditor';
15
+
16
+ const meta: Meta<typeof SequenceEditor> = {
17
+ title: 'plugins/plugin-assistant/SequenceEditor',
18
+ component: SequenceEditor,
19
+ decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'mli-auto max-is-[50rem] justify-center' })],
20
+ parameters: {
21
+ translations,
22
+ },
23
+ };
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof SequenceEditor>;
28
+
29
+ export const Default: Story = {
30
+ args: {
31
+ sequence: RESEARCH_SEQUENCE_DEFINITION,
32
+ },
33
+ };
@@ -4,9 +4,9 @@
4
4
 
5
5
  import React, { forwardRef, useImperativeHandle } from 'react';
6
6
 
7
- import { BlueprintDefinition } from '@dxos/assistant';
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,
@@ -16,16 +16,16 @@ import {
16
16
  } from '@dxos/react-ui-editor';
17
17
  import { mx } from '@dxos/react-ui-theme';
18
18
 
19
- export type BlueprintEditorProps = ThemedClassName<{
20
- blueprint: BlueprintDefinition;
19
+ export type SequenceEditorProps = ThemedClassName<{
20
+ sequence: SequenceDefinition;
21
21
  }>;
22
22
 
23
23
  // TODO(burdon): Factor out JsonEditor.
24
- export const BlueprintEditor = forwardRef<EditorView | undefined, BlueprintEditorProps>(
25
- ({ classNames, blueprint }, forwardedRef) => {
24
+ export const SequenceEditor = forwardRef<EditorView | undefined, SequenceEditorProps>(
25
+ ({ classNames, sequence }, forwardedRef) => {
26
26
  const { themeMode } = useThemeContext();
27
27
  const { parentRef, view } = useTextEditor({
28
- initialValue: JSON.stringify(blueprint, null, 2),
28
+ initialValue: JSON.stringify(sequence, null, 2),
29
29
  extensions: [
30
30
  createBasicExtensions({
31
31
  lineNumbers: true,
@@ -38,7 +38,7 @@ export const BlueprintEditor = forwardRef<EditorView | undefined, BlueprintEdito
38
38
  syntaxHighlighting: true,
39
39
  }),
40
40
  createJsonExtensions({
41
- schema: Type.toJsonSchema(BlueprintDefinition, { strict: true }),
41
+ schema: Type.toJsonSchema(SequenceDefinition, { strict: true }),
42
42
  }),
43
43
  ],
44
44
  });
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './SequenceEditor';
@@ -4,48 +4,50 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta } from '@storybook/react';
7
+ import { type Meta } from '@storybook/react-vite';
8
8
  import React, { useState } from 'react';
9
9
 
10
- import { createSystemPrompt } from '@dxos/artifact';
11
- import { Obj } from '@dxos/echo';
10
+ import { createSystemPrompt } from '@dxos/assistant';
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
- import { withLayout, withTheme } from '@dxos/storybook-utils';
14
+ import { ColumnContainer, withLayout, withTheme } from '@dxos/storybook-utils';
15
+ import { trim } from '@dxos/util';
16
+
17
+ import { translations } from '../../translations';
15
18
 
16
19
  import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
17
- import translations from '../../translations';
18
- import { TemplateType } from '../../types';
19
-
20
- const TEMPLATE = [
21
- '{{! System Prompt }}',
22
- '',
23
- 'You are a machine that is an expert chess player.',
24
- 'The move history of the current game is: {{history}}',
25
- 'If asked to suggest a move explain why it is a good move.',
26
- '',
27
- '{{#each artifacts}}',
28
- '- {{this}}',
29
- '{{/each}}',
30
- '',
31
- '---',
32
- '',
33
- '{{input}}',
34
- '',
35
- ].join('\n');
36
-
37
- const DefaultStory = ({ text }: TemplateEditorProps & { text: string }) => {
20
+
21
+ const TEMPLATE = trim`
22
+ {{! System Prompt }}
23
+
24
+ You are a machine that is an expert chess player.
25
+ The move history of the current game is: {{history}}
26
+ If asked to suggest a move explain why it is a good move.
27
+
28
+ {{#each artifacts}}
29
+ - {{this}}
30
+ {{/each}}
31
+
32
+ ---
33
+
34
+ {{input}}
35
+ `;
36
+
37
+ const DefaultStory = ({ source }: TemplateEditorProps & { source: string }) => {
38
38
  const client = useClient();
39
- const [template] = useState(() => {
39
+ const [blueprint] = useState(() => {
40
40
  const space = client.spaces.default;
41
- return space.db.add(Obj.make(TemplateType, { source: text, kind: { include: 'manual' } }));
41
+ return space.db.add(
42
+ Blueprint.make({
43
+ key: 'example.com/blueprint/test',
44
+ name: 'Test',
45
+ instructions: Template.make({ source }),
46
+ }),
47
+ );
42
48
  });
43
49
 
44
- return (
45
- <div role='none' className='flex w-[50rem] overflow-hidden border-x border-separator'>
46
- <TemplateEditor template={template} />
47
- </div>
48
- );
50
+ return <TemplateEditor id={blueprint.id} template={blueprint.instructions} />;
49
51
  };
50
52
 
51
53
  const meta: Meta<typeof DefaultStory> = {
@@ -56,9 +58,9 @@ const meta: Meta<typeof DefaultStory> = {
56
58
  withClientProvider({
57
59
  createIdentity: true,
58
60
  createSpace: true,
59
- types: [TemplateType],
61
+ types: [Template.Template],
60
62
  }),
61
- withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
63
+ withLayout({ fullscreen: true, Container: ColumnContainer }),
62
64
  withTheme,
63
65
  ],
64
66
  parameters: {
@@ -72,12 +74,12 @@ type Story = Meta<typeof DefaultStory>;
72
74
 
73
75
  export const Default: Story = {
74
76
  args: {
75
- text: TEMPLATE,
77
+ source: TEMPLATE,
76
78
  },
77
79
  };
78
80
 
79
81
  export const System: Story = {
80
82
  args: {
81
- text: createSystemPrompt(),
83
+ source: createSystemPrompt({}),
82
84
  },
83
85
  };
@@ -7,8 +7,9 @@ import { styleTags, tags } from '@lezer/highlight';
7
7
  import { handlebarsLanguage } from '@xiechao/codemirror-lang-handlebars';
8
8
  import React from 'react';
9
9
 
10
+ import { type Template } from '@dxos/blueprints';
10
11
  import { createDocAccessor } from '@dxos/react-client/echo';
11
- import { useThemeContext, useTranslation, type ThemedClassName } from '@dxos/react-ui';
12
+ import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
12
13
  import {
13
14
  createBasicExtensions,
14
15
  createDataExtensions,
@@ -16,9 +17,9 @@ import {
16
17
  useTextEditor,
17
18
  } from '@dxos/react-ui-editor';
18
19
  import { mx } from '@dxos/react-ui-theme';
20
+ import { isNotFalsy } from '@dxos/util';
19
21
 
20
- import { ASSISTANT_PLUGIN } from '../../meta';
21
- import { type TemplateType } from '../../types';
22
+ import { meta } from '../../meta';
22
23
 
23
24
  handlebarsLanguage.configure({
24
25
  props: [
@@ -29,48 +30,63 @@ handlebarsLanguage.configure({
29
30
  });
30
31
 
31
32
  export type TemplateEditorProps = ThemedClassName<{
32
- template: TemplateType;
33
+ id: string;
34
+ template: Template.Template;
33
35
  }>;
34
36
 
35
- export const TemplateEditor = ({ classNames, template }: TemplateEditorProps) => {
36
- const { t } = useTranslation(ASSISTANT_PLUGIN);
37
+ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
38
+ const { t } = useTranslation(meta.id);
37
39
  const { themeMode } = useThemeContext();
38
- const { parentRef } = useTextEditor(
39
- () => ({
40
- initialValue: template.source,
40
+ const { parentRef } = useTextEditor(() => {
41
+ const text = template.source?.target;
42
+ return {
43
+ initialValue: text?.content ?? '',
41
44
  extensions: [
42
- createDataExtensions({
43
- id: template.id,
44
- text: template.source !== undefined ? createDocAccessor(template, ['template']) : undefined,
45
- }),
45
+ text &&
46
+ createDataExtensions({
47
+ id,
48
+ text: createDocAccessor(text, ['content']),
49
+ }),
46
50
  createBasicExtensions({
47
51
  bracketMatching: false,
52
+ lineNumbers: true,
48
53
  lineWrapping: true,
54
+ monospace: true,
49
55
  placeholder: t('template placeholder'),
50
56
  }),
51
57
  createThemeExtensions({
52
58
  themeMode,
53
- slots: {
54
- content: { className: '!p-3' },
55
- },
56
59
  }),
57
60
 
58
61
  // https://github.com/xiechao/lang-handlebars
59
62
  new LanguageSupport(handlebarsLanguage, syntaxHighlighting(handlebarsHighlightStyle)),
60
- ],
61
- }),
62
- [themeMode, prompt],
63
- );
63
+ // createMarkdownExtensions({}),
64
+ ].filter(isNotFalsy),
65
+ };
66
+ }, [themeMode, template.source?.target]);
64
67
 
65
- return <div ref={parentRef} className={mx(classNames)} />;
68
+ return <div ref={parentRef} className={mx('h-full overflow-hidden', classNames)} />;
66
69
  };
67
70
 
68
71
  /**
69
72
  * https://github.com/xiechao/lang-handlebars/blob/direct/src/highlight.js
70
73
  */
71
74
  export const handlebarsHighlightStyle = HighlightStyle.define([
72
- { tag: tags.tagName, class: 'text-redText' }, // Braces.
73
- { tag: tags.variableName, class: 'text-blueText' },
74
- { tag: tags.keyword, class: 'text-greenText' },
75
- { tag: tags.comment, class: 'text-subdued' },
75
+ {
76
+ // Braces.
77
+ tag: tags.tagName,
78
+ class: 'text-redText',
79
+ },
80
+ {
81
+ tag: tags.variableName,
82
+ class: 'text-blueText',
83
+ },
84
+ {
85
+ tag: tags.keyword,
86
+ class: 'text-greenText',
87
+ },
88
+ {
89
+ tag: tags.comment,
90
+ class: 'text-subdued',
91
+ },
76
92
  ]);
@@ -4,38 +4,45 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type Meta } from '@storybook/react';
7
+ import { type Meta } from '@storybook/react-vite';
8
8
  import React, { useState } from 'react';
9
9
 
10
- import { Obj } from '@dxos/echo';
10
+ import { Blueprint, Template } from '@dxos/blueprints';
11
11
  import { useClient } from '@dxos/react-client';
12
12
  import { withClientProvider } from '@dxos/react-client/testing';
13
13
  import { withLayout, withTheme } from '@dxos/storybook-utils';
14
+ import { trim } from '@dxos/util';
15
+
16
+ import { translations } from '../../translations';
14
17
 
15
18
  import { TemplateForm } from './TemplateForm';
16
- import translations from '../../translations';
17
- import { TemplateType } from '../../types';
18
19
 
19
- const TEMPLATE = [
20
- 'You are a machine that is an expert chess player.',
21
- 'The move history of the current game is: {{history}}',
22
- 'If asked to suggest a move explain why it is a good move.',
23
- '',
24
- '---',
25
- '',
26
- '{{input}}',
27
- ].join('\n');
20
+ const TEMPLATE = trim`
21
+ You are a machine that is an expert chess player.
22
+ The move history of the current game is: {{history}}
23
+ If asked to suggest a move explain why it is a good move.
24
+
25
+ ---
26
+
27
+ {{input}},
28
+ `;
28
29
 
29
30
  const DefaultStory = () => {
30
31
  const client = useClient();
31
- const [template] = useState(() => {
32
+ const [blueprint] = useState(() => {
32
33
  const space = client.spaces.default;
33
- return space.db.add(Obj.make(TemplateType, { source: TEMPLATE, kind: { include: 'manual' } }));
34
+ return space.db.add(
35
+ Blueprint.make({
36
+ key: 'example.com/blueprint/test',
37
+ name: 'Test',
38
+ instructions: Template.make({ source: TEMPLATE }),
39
+ }),
40
+ );
34
41
  });
35
42
 
36
43
  return (
37
44
  <div role='none' className='flex w-[40rem] border border-separator overflow-hidden'>
38
- <TemplateForm template={template} />
45
+ <TemplateForm id={blueprint.id} template={blueprint.instructions} />
39
46
  </div>
40
47
  );
41
48
  };
@@ -48,7 +55,7 @@ const meta: Meta<typeof TemplateForm> = {
48
55
  withClientProvider({
49
56
  createIdentity: true,
50
57
  createSpace: true,
51
- types: [TemplateType],
58
+ types: [Template.Template],
52
59
  }),
53
60
  withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
54
61
  withTheme,