@dxos/plugin-assistant 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe

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 (465) hide show
  1. package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs +36 -0
  2. package/dist/lib/browser/BlueprintArticle-IMCR3642.mjs.map +7 -0
  3. package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs +158 -0
  4. package/dist/lib/browser/ChatCompanion-JYD2RIBJ.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-XIVJTCC2.mjs → ChatContainer-XCPBWYIR.mjs} +22 -20
  6. package/dist/lib/browser/ChatContainer-XCPBWYIR.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-EJJMK3WL.mjs → ChatDialog-DT7KFCRL.mjs} +8 -6
  8. package/dist/lib/browser/ChatDialog-DT7KFCRL.mjs.map +7 -0
  9. package/dist/lib/browser/PromptArticle-45QX25Y5.mjs +59 -0
  10. package/dist/lib/browser/PromptArticle-45QX25Y5.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
  12. package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-3C43MLCD.mjs → app-graph-builder-VZEXMDTY.mjs} +67 -21
  14. package/dist/lib/browser/app-graph-builder-VZEXMDTY.mjs.map +7 -0
  15. package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs → blueprint-definition-5FT5JGPY.mjs} +4 -4
  16. package/dist/lib/browser/chunk-2BOE3OTW.mjs +262 -0
  17. package/dist/lib/browser/chunk-2BOE3OTW.mjs.map +7 -0
  18. package/dist/lib/browser/{chunk-SMIVXXAI.mjs → chunk-BNTPFZ7O.mjs} +51 -24
  19. package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
  21. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-GLWD66TA.mjs → chunk-IXIIS4QA.mjs} +53 -38
  23. package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-EZUSNS2J.mjs → chunk-LRE4VEZV.mjs} +2 -5
  25. package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-U62BTGDF.mjs +1929 -0
  27. package/dist/lib/browser/chunk-U62BTGDF.mjs.map +7 -0
  28. package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
  29. package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
  30. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
  31. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
  32. package/dist/lib/browser/index.mjs +117 -82
  33. package/dist/lib/browser/index.mjs.map +4 -4
  34. package/dist/lib/browser/{intent-resolver-I6M3ZDAS.mjs → intent-resolver-AK5O4GUW.mjs} +55 -24
  35. package/dist/lib/browser/intent-resolver-AK5O4GUW.mjs.map +7 -0
  36. package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs +17 -0
  37. package/dist/lib/browser/local-model-resolver-34MVHRKD.mjs.map +7 -0
  38. package/dist/lib/browser/meta.json +1 -1
  39. package/dist/lib/browser/{react-surface-E4NAGB6R.mjs → react-surface-YCSR2MSR.mjs} +24 -35
  40. package/dist/lib/browser/react-surface-YCSR2MSR.mjs.map +7 -0
  41. package/dist/lib/browser/{settings-36V3VUMW.mjs → settings-NYJGNQ5I.mjs} +5 -5
  42. package/dist/lib/browser/{settings-36V3VUMW.mjs.map → settings-NYJGNQ5I.mjs.map} +1 -1
  43. package/dist/lib/browser/{state-AINRYS5W.mjs → state-GG7Z3NB7.mjs} +9 -5
  44. package/dist/lib/browser/{state-AINRYS5W.mjs.map → state-GG7Z3NB7.mjs.map} +3 -3
  45. package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
  46. package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
  47. package/dist/lib/browser/types/index.mjs +2 -2
  48. package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs +37 -0
  49. package/dist/lib/node-esm/BlueprintArticle-OL2HUY6Q.mjs.map +7 -0
  50. package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs +159 -0
  51. package/dist/lib/node-esm/ChatCompanion-AHKJS25S.mjs.map +7 -0
  52. package/dist/lib/node-esm/{ChatContainer-LMMMQD4K.mjs → ChatContainer-K7OGPE3G.mjs} +22 -20
  53. package/dist/lib/node-esm/ChatContainer-K7OGPE3G.mjs.map +7 -0
  54. package/dist/lib/node-esm/{ChatDialog-UUE3F7BT.mjs → ChatDialog-QT6ZBX45.mjs} +8 -6
  55. package/dist/lib/node-esm/ChatDialog-QT6ZBX45.mjs.map +7 -0
  56. package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs +60 -0
  57. package/dist/lib/node-esm/PromptArticle-OUKFSJQV.mjs.map +7 -0
  58. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
  59. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
  60. package/dist/lib/node-esm/{app-graph-builder-NM3JDLQ2.mjs → app-graph-builder-VRN6ESRR.mjs} +67 -21
  61. package/dist/lib/node-esm/app-graph-builder-VRN6ESRR.mjs.map +7 -0
  62. package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs → blueprint-definition-XW6QQVLV.mjs} +4 -4
  63. package/dist/lib/node-esm/chunk-3Q22TTXW.mjs +264 -0
  64. package/dist/lib/node-esm/chunk-3Q22TTXW.mjs.map +7 -0
  65. package/dist/lib/node-esm/{chunk-7YOGZI66.mjs → chunk-AB74FOA2.mjs} +51 -24
  66. package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-BHS747K7.mjs +1930 -0
  68. package/dist/lib/node-esm/chunk-BHS747K7.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
  70. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
  71. package/dist/lib/node-esm/{chunk-QG2KT3AT.mjs → chunk-UXTUHH24.mjs} +53 -38
  72. package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-WE6KTH72.mjs +25 -0
  74. package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
  75. package/dist/lib/node-esm/{chunk-XD4CDA4R.mjs → chunk-YWFWT57N.mjs} +2 -5
  76. package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
  77. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
  78. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
  79. package/dist/lib/node-esm/index.mjs +117 -82
  80. package/dist/lib/node-esm/index.mjs.map +4 -4
  81. package/dist/lib/node-esm/{intent-resolver-VIINHFMT.mjs → intent-resolver-L2F3N45L.mjs} +55 -24
  82. package/dist/lib/node-esm/intent-resolver-L2F3N45L.mjs.map +7 -0
  83. package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs +18 -0
  84. package/dist/lib/node-esm/local-model-resolver-TP2NTSAX.mjs.map +7 -0
  85. package/dist/lib/node-esm/meta.json +1 -1
  86. package/dist/lib/node-esm/{react-surface-5WQLRTCH.mjs → react-surface-CTW44GEM.mjs} +24 -35
  87. package/dist/lib/node-esm/react-surface-CTW44GEM.mjs.map +7 -0
  88. package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs → settings-RRHYI5KO.mjs} +5 -5
  89. package/dist/lib/node-esm/{settings-7ZCZ6AS5.mjs.map → settings-RRHYI5KO.mjs.map} +1 -1
  90. package/dist/lib/node-esm/{state-EQS5KP6M.mjs → state-FSUHFMDM.mjs} +9 -5
  91. package/dist/lib/node-esm/{state-EQS5KP6M.mjs.map → state-FSUHFMDM.mjs.map} +3 -3
  92. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
  93. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
  94. package/dist/lib/node-esm/types/index.mjs +2 -2
  95. package/dist/types/src/AssistantPlugin.d.ts +1 -1
  96. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/ai-service.d.ts +2 -3
  98. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  100. package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
  101. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  102. package/dist/types/src/capabilities/capabilities.d.ts +2 -24
  103. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  104. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/index.d.ts +0 -1
  106. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  108. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  110. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/toolkit.d.ts +1 -1
  112. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  113. package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
  114. package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
  115. package/dist/types/src/components/Chat/Chat.d.ts +20 -9
  116. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  117. package/dist/types/src/components/Chat/events.d.ts +4 -0
  118. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  119. package/dist/types/src/components/ChatCompanion.d.ts +2 -2
  120. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
  121. package/dist/types/src/components/ChatContainer.d.ts +7 -4
  122. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  123. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  124. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
  125. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  126. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  127. package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -7
  128. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  129. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +124 -71
  130. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  131. package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
  132. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
  133. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
  134. package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
  135. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
  136. package/dist/types/src/components/PromptArticle.d.ts +7 -0
  137. package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
  138. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
  139. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  140. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +111 -61
  141. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  142. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
  143. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  144. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +111 -61
  145. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  146. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
  147. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
  148. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
  149. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
  150. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
  151. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +9 -7
  152. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
  153. package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
  154. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  155. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +111 -61
  156. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  157. package/dist/types/src/components/index.d.ts +4 -9
  158. package/dist/types/src/components/index.d.ts.map +1 -1
  159. package/dist/types/src/functions/analysis.d.ts +1 -1
  160. package/dist/types/src/functions/analysis.d.ts.map +1 -1
  161. package/dist/types/src/functions/index.d.ts +2 -2
  162. package/dist/types/src/functions/index.d.ts.map +1 -1
  163. package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +2 -2
  164. package/dist/types/src/functions/object-list.d.ts.map +1 -0
  165. package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +2 -2
  166. package/dist/types/src/functions/object-load.d.ts.map +1 -0
  167. package/dist/types/src/hooks/index.d.ts +1 -2
  168. package/dist/types/src/hooks/index.d.ts.map +1 -1
  169. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +2 -1
  170. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  171. package/dist/types/src/hooks/useChatProcessor.d.ts +4 -2
  172. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  173. package/dist/types/src/hooks/useChatServices.d.ts +1 -1
  174. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  175. package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
  176. package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
  177. package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
  178. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
  179. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  180. package/dist/types/src/index.d.ts +2 -0
  181. package/dist/types/src/index.d.ts.map +1 -1
  182. package/dist/types/src/meta.d.ts +1 -2
  183. package/dist/types/src/meta.d.ts.map +1 -1
  184. package/dist/types/src/processor/index.d.ts +1 -0
  185. package/dist/types/src/processor/index.d.ts.map +1 -1
  186. package/dist/types/src/processor/presets.d.ts +1 -1
  187. package/dist/types/src/processor/presets.d.ts.map +1 -1
  188. package/dist/types/src/processor/processor.d.ts +11 -10
  189. package/dist/types/src/processor/processor.d.ts.map +1 -1
  190. package/dist/types/src/processor/update-name.d.ts +10 -0
  191. package/dist/types/src/processor/update-name.d.ts.map +1 -0
  192. package/dist/types/src/queue-logger.d.ts.map +1 -1
  193. package/dist/types/src/testing/index.d.ts +0 -2
  194. package/dist/types/src/testing/index.d.ts.map +1 -1
  195. package/dist/types/src/testing/test-generator.d.ts +3 -3
  196. package/dist/types/src/testing/test-generator.d.ts.map +1 -1
  197. package/dist/types/src/testing/test-services.d.ts +2 -2
  198. package/dist/types/src/testing/test-services.d.ts.map +1 -1
  199. package/dist/types/src/translations.d.ts +239 -26
  200. package/dist/types/src/translations.d.ts.map +1 -1
  201. package/dist/types/src/types/Assistant.d.ts +15 -9
  202. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  203. package/dist/types/src/types/AssistantAction.d.ts +33 -8
  204. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  205. package/dist/types/src/types/service.d.ts +24 -18
  206. package/dist/types/src/types/service.d.ts.map +1 -1
  207. package/dist/types/tsconfig.tsbuildinfo +1 -1
  208. package/package.json +94 -113
  209. package/src/AssistantPlugin.tsx +154 -138
  210. package/src/capabilities/ai-service.ts +6 -7
  211. package/src/capabilities/app-graph-builder.ts +69 -21
  212. package/src/capabilities/blueprint-definition.ts +38 -30
  213. package/src/capabilities/capabilities.ts +2 -56
  214. package/src/capabilities/edge-model-resolver.ts +5 -7
  215. package/src/capabilities/index.ts +0 -1
  216. package/src/capabilities/intent-resolver.ts +69 -16
  217. package/src/capabilities/local-model-resolver.ts +7 -9
  218. package/src/capabilities/react-surface.tsx +16 -20
  219. package/src/capabilities/state.ts +2 -0
  220. package/src/capabilities/toolkit.ts +9 -155
  221. package/src/components/BlueprintArticle.tsx +29 -0
  222. package/src/components/Chat/Chat.tsx +155 -113
  223. package/src/components/Chat/events.ts +6 -0
  224. package/src/components/ChatCompanion.tsx +93 -49
  225. package/src/components/ChatContainer.tsx +27 -17
  226. package/src/components/ChatDialog.tsx +9 -2
  227. package/src/components/ChatProgress/ChatProgress.tsx +2 -3
  228. package/src/components/ChatPrompt/ChatActions.tsx +2 -4
  229. package/src/components/ChatPrompt/ChatOptions.tsx +40 -45
  230. package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
  231. package/src/components/ChatThread/ChatThread.stories.tsx +52 -34
  232. package/src/components/ChatThread/ChatThread.tsx +28 -34
  233. package/src/components/ChatThread/reducers.ts +6 -6
  234. package/src/components/ChatThread/registry.tsx +25 -40
  235. package/src/components/ChatThread/sync.test.ts +21 -13
  236. package/src/components/ChatThread/sync.ts +48 -13
  237. package/src/components/ChatThread/testing/thread.md +37 -0
  238. package/src/components/PromptArticle.tsx +51 -0
  239. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +15 -7
  240. package/src/components/TemplateEditor/TemplateEditor.tsx +19 -10
  241. package/src/components/TemplateEditor/TemplateForm.stories.tsx +4 -6
  242. package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
  243. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
  244. package/src/components/TemplateEditor/extensions/index.ts +6 -0
  245. package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
  246. package/src/components/ToolBlock/ToolBlock.tsx +37 -46
  247. package/src/components/Toolbox/Toolbox.stories.tsx +5 -8
  248. package/src/components/Toolbox/Toolbox.tsx +5 -5
  249. package/src/components/index.ts +2 -5
  250. package/src/functions/analysis.ts +5 -3
  251. package/src/functions/index.ts +2 -2
  252. package/src/functions/{list.ts → object-list.ts} +6 -4
  253. package/src/functions/{load.ts → object-load.ts} +8 -5
  254. package/src/hooks/index.ts +1 -2
  255. package/src/hooks/useBlueprintRegistry.ts +19 -4
  256. package/src/hooks/useChatProcessor.ts +22 -14
  257. package/src/hooks/useChatServices.ts +10 -7
  258. package/src/hooks/useChatToolbarActions.ts +122 -0
  259. package/src/hooks/useContextBinder.ts +19 -7
  260. package/src/hooks/useItemTypes.ts +1 -1
  261. package/src/hooks/useReferencesProvider.ts +2 -1
  262. package/src/index.ts +2 -0
  263. package/src/meta.ts +9 -6
  264. package/src/processor/index.ts +1 -0
  265. package/src/processor/presets.ts +2 -2
  266. package/src/processor/processor.test.ts +18 -24
  267. package/src/processor/processor.ts +35 -60
  268. package/src/processor/update-name.ts +56 -0
  269. package/src/queue-logger.ts +4 -8
  270. package/src/testing/index.ts +0 -2
  271. package/src/testing/test-generator.ts +15 -11
  272. package/src/testing/test-services.ts +2 -8
  273. package/src/translations.ts +24 -16
  274. package/src/types/Assistant.ts +10 -8
  275. package/src/types/AssistantAction.ts +23 -6
  276. package/src/types/service.ts +17 -9
  277. package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs +0 -29
  278. package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs.map +0 -7
  279. package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs +0 -126
  280. package/dist/lib/browser/ChatCompanion-DOVN34C7.mjs.map +0 -7
  281. package/dist/lib/browser/ChatContainer-XIVJTCC2.mjs.map +0 -7
  282. package/dist/lib/browser/ChatDialog-EJJMK3WL.mjs.map +0 -7
  283. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
  284. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
  285. package/dist/lib/browser/ai-service-YC2EQPHA.mjs +0 -22
  286. package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +0 -7
  287. package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +0 -7
  288. package/dist/lib/browser/chunk-C4Q2RYQM.mjs +0 -1974
  289. package/dist/lib/browser/chunk-C4Q2RYQM.mjs.map +0 -7
  290. package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +0 -7
  291. package/dist/lib/browser/chunk-GLWD66TA.mjs.map +0 -7
  292. package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
  293. package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
  294. package/dist/lib/browser/chunk-PQI3MGDN.mjs +0 -169
  295. package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
  296. package/dist/lib/browser/chunk-QD4UUISH.mjs +0 -299
  297. package/dist/lib/browser/chunk-QD4UUISH.mjs.map +0 -7
  298. package/dist/lib/browser/chunk-R6LRGW3I.mjs +0 -216
  299. package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +0 -7
  300. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
  301. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +0 -155
  302. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +0 -7
  303. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +0 -22
  304. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +0 -7
  305. package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +0 -7
  306. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +0 -21
  307. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +0 -7
  308. package/dist/lib/browser/react-surface-E4NAGB6R.mjs.map +0 -7
  309. package/dist/lib/browser/toolkit-MPUS3U64.mjs +0 -191
  310. package/dist/lib/browser/toolkit-MPUS3U64.mjs.map +0 -7
  311. package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs +0 -30
  312. package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs.map +0 -7
  313. package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs +0 -127
  314. package/dist/lib/node-esm/ChatCompanion-ICWYVPRD.mjs.map +0 -7
  315. package/dist/lib/node-esm/ChatContainer-LMMMQD4K.mjs.map +0 -7
  316. package/dist/lib/node-esm/ChatDialog-UUE3F7BT.mjs.map +0 -7
  317. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
  318. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
  319. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +0 -23
  320. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +0 -7
  321. package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +0 -7
  322. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +0 -170
  323. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
  324. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
  325. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +0 -217
  326. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +0 -7
  327. package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-V44ZG7CU.mjs +0 -1975
  329. package/dist/lib/node-esm/chunk-V44ZG7CU.mjs.map +0 -7
  330. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
  331. package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
  332. package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-YU62ZWJN.mjs +0 -300
  334. package/dist/lib/node-esm/chunk-YU62ZWJN.mjs.map +0 -7
  335. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +0 -156
  336. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +0 -7
  337. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +0 -23
  338. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +0 -7
  339. package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +0 -7
  340. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +0 -22
  341. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +0 -7
  342. package/dist/lib/node-esm/react-surface-5WQLRTCH.mjs.map +0 -7
  343. package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs +0 -192
  344. package/dist/lib/node-esm/toolkit-PKVYDZ4H.mjs.map +0 -7
  345. package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
  346. package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
  347. package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
  348. package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
  349. package/dist/types/src/components/PromptSettings.d.ts +0 -6
  350. package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
  351. package/dist/types/src/components/SequenceContainer.d.ts +0 -8
  352. package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
  353. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
  354. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
  355. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -267
  356. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
  357. package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
  358. package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
  359. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
  360. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
  361. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  362. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  363. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  364. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
  365. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
  366. package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
  367. package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
  368. package/dist/types/src/execution-graph/index.d.ts +0 -2
  369. package/dist/types/src/execution-graph/index.d.ts.map +0 -1
  370. package/dist/types/src/functions/list.d.ts.map +0 -1
  371. package/dist/types/src/functions/load.d.ts.map +0 -1
  372. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -8
  373. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
  374. package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -6
  375. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
  376. package/dist/types/src/stories/Chat.stories.d.ts +0 -30
  377. package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
  378. package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
  379. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
  380. package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
  381. package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
  382. package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
  383. package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
  384. package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
  385. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
  386. package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
  387. package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
  388. package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
  389. package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
  390. package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
  391. package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
  392. package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
  393. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
  394. package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
  395. package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
  396. package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
  397. package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
  398. package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
  399. package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
  400. package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
  401. package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
  402. package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
  403. package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
  404. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
  405. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
  406. package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -14
  407. package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
  408. package/dist/types/src/stories/components/index.d.ts +0 -16
  409. package/dist/types/src/stories/components/index.d.ts.map +0 -1
  410. package/dist/types/src/stories/components/types.d.ts +0 -7
  411. package/dist/types/src/stories/components/types.d.ts.map +0 -1
  412. package/dist/types/src/stories/testing/data.d.ts +0 -9
  413. package/dist/types/src/stories/testing/data.d.ts.map +0 -1
  414. package/dist/types/src/stories/testing/index.d.ts +0 -3
  415. package/dist/types/src/stories/testing/index.d.ts.map +0 -1
  416. package/dist/types/src/stories/testing/schema.d.ts +0 -7
  417. package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
  418. package/dist/types/src/stories/testing/testing.d.ts +0 -48
  419. package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
  420. package/dist/types/src/testing/test-data.d.ts +0 -14
  421. package/dist/types/src/testing/test-data.d.ts.map +0 -1
  422. package/dist/types/src/testing/test-functions.d.ts +0 -6
  423. package/dist/types/src/testing/test-functions.d.ts.map +0 -1
  424. package/src/capabilities/compute-runtime.ts +0 -124
  425. package/src/components/BlueprintContainer.tsx +0 -24
  426. package/src/components/PromptSettings.tsx +0 -90
  427. package/src/components/SequenceContainer.tsx +0 -131
  428. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
  429. package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
  430. package/src/components/SequenceEditor/index.ts +0 -5
  431. package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
  432. package/src/components/Toolbar/Toolbar.tsx +0 -21
  433. package/src/components/Toolbar/index.ts +0 -5
  434. package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
  435. package/src/execution-graph/execution-graph.ts +0 -211
  436. package/src/execution-graph/index.ts +0 -5
  437. package/src/hooks/useComputeRuntimeCallback.ts +0 -25
  438. package/src/hooks/useExecutionGraph.ts +0 -20
  439. package/src/stories/Chat.stories.tsx +0 -657
  440. package/src/stories/components/BlueprintContainer.tsx +0 -34
  441. package/src/stories/components/ChatContainer.tsx +0 -74
  442. package/src/stories/components/ChessContainer.tsx +0 -17
  443. package/src/stories/components/CommentsContainer.tsx +0 -25
  444. package/src/stories/components/DebugCard.tsx +0 -61
  445. package/src/stories/components/GraphContainer.tsx +0 -119
  446. package/src/stories/components/InvocationsContainer.tsx +0 -17
  447. package/src/stories/components/LoggingContainer.tsx +0 -33
  448. package/src/stories/components/MessageContainer.tsx +0 -22
  449. package/src/stories/components/PromptContainer.tsx +0 -52
  450. package/src/stories/components/ResearchInputStack.tsx +0 -30
  451. package/src/stories/components/ResearchOutputStack.tsx +0 -29
  452. package/src/stories/components/TasksContainer.tsx +0 -49
  453. package/src/stories/components/TokenManagerContainer.tsx +0 -14
  454. package/src/stories/components/TriggersContainer.tsx +0 -75
  455. package/src/stories/components/index.ts +0 -20
  456. package/src/stories/components/types.ts +0 -11
  457. package/src/stories/testing/data.ts +0 -142
  458. package/src/stories/testing/index.ts +0 -6
  459. package/src/stories/testing/schema.ts +0 -17
  460. package/src/stories/testing/testing.tsx +0 -279
  461. package/src/testing/test-data.ts +0 -245
  462. package/src/testing/test-functions.ts +0 -16
  463. /package/dist/lib/browser/{blueprint-definition-VHFSRTEJ.mjs.map → blueprint-definition-5FT5JGPY.mjs.map} +0 -0
  464. /package/dist/lib/node-esm/{blueprint-definition-4E6XTLVN.mjs.map → blueprint-definition-XW6QQVLV.mjs.map} +0 -0
  465. /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ <prompt>hi</prompt>
2
+ Hi! I'm Kai, your AI assistant powered by DXOS. I see you have a document in your context. Let me take a look at it to see how I can help you.
3
+ <toolCall id="toolu_012MB5XWrQhsyjUBoBCr7jXB" />
4
+
5
+ <summary>OK (1 tool uses · 2.62k tokens · 4.8s)</summary>
6
+ I can see you have a comprehensive welcome document for Composer by DXOS. This document explains what Composer is - an extensible collaborative application with features like documents, diagrams, tables, and sheets.
7
+
8
+ Here are some suggestions based on what's available:
9
+ <suggestion>Create a new document</suggestion>
10
+ <suggestion>Edit the welcome document</suggestion>
11
+ <suggestion>Create a table to organize information</suggestion>
12
+ <suggestion>Create a sketch for diagrams</suggestion>
13
+ <suggestion>Learn about collaboration features</suggestion>
14
+
15
+ Is there something specific you'd like to do with this document or would you like to explore other features of Composer?
16
+
17
+ <summary>OK (3.91k tokens · 7.0s)</summary>
18
+ <prompt>Create a table to organize information</prompt>
19
+ I'll help you create a table to organize information. Let me check what table creation tools are available.
20
+ <toolCall id="toolu_01Gk8ZNGYQEczAjGkbDZ9n1D" />
21
+ <summary>OK (1 tool uses · 3.99k tokens · 3.4s)</summary>
22
+ I need to check what artifact definitions are available for creating tables. Based on the blueprint instructions, I should first query for available artifact definitions to see what table-related tools I can use.
23
+
24
+ However, I notice that the function definitions provided don't include the artifact-related tools mentioned in the blueprint (like `require_artifact_definitions` or table creation tools). The available functions are focused on document operations (open, diff, add-to-context, open-item) and analysis mode.
25
+
26
+ Let me work with what's available. Since I can't directly create a table artifact with the current tools, I can help you create a table structure within a markdown document instead.
27
+
28
+ Would you like me to:
29
+
30
+ 1. Create a simple markdown table structure in a new document that you can use to organize your information?
31
+ 2. Or would you prefer to use Composer's built-in Tables plugin (as mentioned in the welcome document) by creating one through the Composer interface?
32
+
33
+ What kind of information are you looking to organize? This will help me suggest the best table structure for your needs.
34
+ <toolCall id="toolu_01CQXUsyLw2uoV3k1mPLqFee" />
35
+
36
+ <summary>OK (1 tool uses · 4.28k tokens · 11.1s)</summary>
37
+ <summary>OK (4.30k tokens · 1.6s)</summary>
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { useMemo } from 'react';
6
+
7
+ import { type SurfaceComponentProps } from '@dxos/app-framework/react';
8
+ import { Agent } from '@dxos/assistant-toolkit';
9
+ import { type Prompt } from '@dxos/blueprints';
10
+ import { Obj } from '@dxos/echo';
11
+ import { invokeFunctionWithTracing, useComputeRuntimeCallback } from '@dxos/plugin-automation';
12
+ import { getSpace } from '@dxos/react-client/echo';
13
+ import { Toolbar, useTranslation } from '@dxos/react-ui';
14
+ import { useAttention } from '@dxos/react-ui-attention';
15
+ import { StackItem } from '@dxos/react-ui-stack';
16
+
17
+ import { meta } from '../meta';
18
+
19
+ import { TemplateEditor } from './TemplateEditor';
20
+
21
+ export type PromptArticleProps = SurfaceComponentProps<Prompt.Prompt>;
22
+
23
+ export const PromptArticle = ({ subject }: PromptArticleProps) => {
24
+ const { t } = useTranslation(meta.id);
25
+ const space = getSpace(subject);
26
+ const { hasAttention } = useAttention(Obj.getDXN(subject).toString());
27
+
28
+ const inputData = useMemo(
29
+ () =>
30
+ subject && {
31
+ prompt: space?.db.ref(Obj.getDXN(subject)),
32
+ input: {},
33
+ },
34
+ [subject, space],
35
+ );
36
+
37
+ const handleRun = useComputeRuntimeCallback(space, () => invokeFunctionWithTracing(Agent.prompt, inputData), [
38
+ inputData,
39
+ ]);
40
+
41
+ return (
42
+ <StackItem.Content toolbar>
43
+ <Toolbar.Root disabled={!hasAttention} onClick={handleRun}>
44
+ <Toolbar.IconButton iconOnly icon='ph--play--regular' label={t('run prompt label')} onClick={handleRun} />
45
+ </Toolbar.Root>
46
+ <TemplateEditor id={subject.id} template={subject.instructions} classNames='container-max-width' />
47
+ </StackItem.Content>
48
+ );
49
+ };
50
+
51
+ export default PromptArticle;
@@ -2,8 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React, { useState } from 'react';
9
7
 
@@ -11,26 +9,36 @@ import { createSystemPrompt } from '@dxos/assistant';
11
9
  import { Blueprint, Template } from '@dxos/blueprints';
12
10
  import { useClient } from '@dxos/react-client';
13
11
  import { withClientProvider } from '@dxos/react-client/testing';
14
- import { withLayout, withTheme } from '@dxos/storybook-utils';
12
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
15
13
  import { trim } from '@dxos/util';
16
14
 
17
15
  import { translations } from '../../translations';
18
16
 
19
17
  import { TemplateEditor, type TemplateEditorProps } from './TemplateEditor';
20
18
 
19
+ const FENCE = '```';
20
+
21
21
  const TEMPLATE = trim`
22
22
  {{! System Prompt }}
23
23
 
24
- You are a machine that is an expert chess player.
24
+ You are an expert chess player.
25
25
  The move history of the current game is: {{history}}.
26
26
  If asked to suggest a move explain why it is a good move.
27
27
 
28
28
  {{#each artifacts}}
29
- - {{this}}
29
+ {{this}}
30
30
  {{/each}}
31
31
 
32
+ Reponse in the format: <suggestion>SUGGESTION</suggestion>
33
+
34
+ @dxn:queue:data:B6INSIBY3CBEF4M5VZRYBCMAHQMPYK5AJ:01K24XMVHSZHS97SG1VTVQDM5Z:01K24XPK464FSCKVQJAB2H662M
35
+
32
36
  ---
33
37
 
38
+ ${FENCE}ts
39
+ const x = 100;
40
+ ${FENCE}
41
+
34
42
  {{input}}
35
43
  `;
36
44
 
@@ -61,13 +69,13 @@ const meta = {
61
69
  component: TemplateEditor as any,
62
70
  render: DefaultStory,
63
71
  decorators: [
72
+ withTheme,
73
+ withLayout({ container: 'column' }),
64
74
  withClientProvider({
65
75
  types: [Blueprint.Blueprint],
66
76
  createIdentity: true,
67
77
  createSpace: true,
68
78
  }),
69
- withLayout({ fullscreen: true, classNames: 'justify-center bg-deckSurface' }),
70
- withTheme,
71
79
  ],
72
80
  parameters: {
73
81
  translations,
@@ -2,6 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
5
6
  import React from 'react';
6
7
 
7
8
  import { type Template } from '@dxos/blueprints';
@@ -12,21 +13,23 @@ import {
12
13
  createDataExtensions,
13
14
  createMarkdownExtensions,
14
15
  createThemeExtensions,
16
+ decorateMarkdown,
15
17
  useTextEditor,
16
18
  } from '@dxos/react-ui-editor';
17
19
  import { mx } from '@dxos/react-ui-theme';
18
- import { isNotFalsy } from '@dxos/util';
20
+ import { isNonNullable } from '@dxos/util';
19
21
 
20
22
  import { meta } from '../../meta';
21
23
 
22
- import { handlebars } from './handlebars-extension';
24
+ import { handlebars, xmlDecorator } from './extensions';
23
25
 
24
26
  export type TemplateEditorProps = ThemedClassName<{
25
27
  id: string;
26
28
  template: Template.Template;
29
+ lineNumbers?: boolean;
27
30
  }>;
28
31
 
29
- export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps) => {
32
+ export const TemplateEditor = ({ id, classNames, template, lineNumbers = true }: TemplateEditorProps) => {
30
33
  const { t } = useTranslation(meta.id);
31
34
  const { themeMode } = useThemeContext();
32
35
  const { parentRef } = useTextEditor(() => {
@@ -38,21 +41,27 @@ export const TemplateEditor = ({ id, classNames, template }: TemplateEditorProps
38
41
  return {
39
42
  initialValue: text.content ?? '',
40
43
  extensions: [
41
- createDataExtensions({ id, text: createDocAccessor(text, ['content']) }),
44
+ createDataExtensions({
45
+ id,
46
+ text: createDocAccessor(text, ['content']),
47
+ }),
42
48
  createBasicExtensions({
43
49
  bracketMatching: false,
44
- lineNumbers: true,
50
+ lineNumbers,
45
51
  lineWrapping: true,
46
52
  placeholder: t('template placeholder'),
47
53
  }),
48
- createThemeExtensions({ themeMode }),
49
-
50
- // Extend markdown with handlebars support.
54
+ createThemeExtensions({ themeMode, slots: { content: { className: '!pie-4' } } }),
51
55
  createMarkdownExtensions(),
56
+ decorateMarkdown(),
52
57
  handlebars(),
53
- ].filter(isNotFalsy),
58
+ // xml(),
59
+ // NOTE: Since we're using markdown only HTML nodes are parsed.
60
+ xmlDecorator(),
61
+ syntaxHighlighting(defaultHighlightStyle),
62
+ ].filter(isNonNullable),
54
63
  };
55
- }, [themeMode, template.source?.target]);
64
+ }, [themeMode, template.source?.target, lineNumbers]);
56
65
 
57
66
  return <div ref={parentRef} className={mx('bs-full overflow-hidden', classNames)} />;
58
67
  };
@@ -2,15 +2,13 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta } from '@storybook/react-vite';
8
6
  import React, { useState } from 'react';
9
7
 
10
8
  import { Blueprint, Template } from '@dxos/blueprints';
11
9
  import { useClient } from '@dxos/react-client';
12
10
  import { withClientProvider } from '@dxos/react-client/testing';
13
- import { withLayout, withTheme } from '@dxos/storybook-utils';
11
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
12
  import { trim } from '@dxos/util';
15
13
 
16
14
  import { translations } from '../../translations';
@@ -41,7 +39,7 @@ const DefaultStory = () => {
41
39
  });
42
40
 
43
41
  return (
44
- <div role='none' className='flex w-[40rem] border border-separator overflow-hidden'>
42
+ <div role='none' className='flex is-[40rem] border border-separator overflow-hidden'>
45
43
  <TemplateForm id={blueprint.id} template={blueprint.instructions} />
46
44
  </div>
47
45
  );
@@ -52,13 +50,13 @@ const meta = {
52
50
  component: TemplateForm,
53
51
  render: DefaultStory,
54
52
  decorators: [
53
+ withTheme,
54
+ withLayout({ container: 'column' }),
55
55
  withClientProvider({
56
56
  types: [Blueprint.Blueprint],
57
57
  createIdentity: true,
58
58
  createSpace: true,
59
59
  }),
60
- withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
61
- withTheme,
62
60
  ],
63
61
  parameters: {
64
62
  translations,
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Schema } from 'effect';
5
+ import type * as Schema from 'effect/Schema';
6
6
  import React, { Fragment, useEffect } from 'react';
7
7
 
8
8
  import { type Template } from '@dxos/blueprints';
@@ -26,7 +26,7 @@ export const TemplateForm = ({ id, template, commandEditable = true }: TemplateF
26
26
  usePromptInputs(template);
27
27
 
28
28
  return (
29
- <div className={mx('flex flex-col w-full overflow-hidden gap-4', groupBorder)}>
29
+ <div className={mx('flex flex-col is-full overflow-hidden gap-4', groupBorder)}>
30
30
  {/* {commandEditable && (
31
31
  <div className='flex items-center pl-4'>
32
32
  <span className='text-neutral-500'>/</span>
@@ -0,0 +1,269 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import {
6
+ type CompletionContext,
7
+ type CompletionResult,
8
+ autocompletion,
9
+ completionKeymap,
10
+ } from '@codemirror/autocomplete';
11
+ import { type Extension, RangeSetBuilder } from '@codemirror/state';
12
+ import {
13
+ Decoration,
14
+ type DecorationSet,
15
+ type EditorView,
16
+ ViewPlugin,
17
+ type ViewUpdate,
18
+ WidgetType,
19
+ keymap,
20
+ } from '@codemirror/view';
21
+
22
+ import { Domino } from '@dxos/react-ui';
23
+ import { mx } from '@dxos/react-ui-theme';
24
+
25
+ export type HandlebarsOptions = {};
26
+
27
+ /**
28
+ * Simple Handlebars plugin for CodeMirror.
29
+ * Supports:
30
+ * - Comments: {{! comment }}
31
+ * - Commands: {{#command}} {{/command}}
32
+ * - Variables: {{var}}
33
+ * - Commands with variables: {{#each items}} {{/each}}
34
+ */
35
+ export const handlebars = (_: HandlebarsOptions = {}): Extension => {
36
+ return [
37
+ handlebarsHighlightPlugin,
38
+ autocompletion({
39
+ activateOnTyping: true,
40
+ aboveCursor: true,
41
+ closeOnBlur: true,
42
+ override: [handlebarsCompletions],
43
+ }),
44
+ keymap.of(completionKeymap),
45
+ ];
46
+ };
47
+
48
+ const regex = {
49
+ // {{! comment }}
50
+ comment: /\{\{!\s*[^}]*\}\}/g,
51
+
52
+ // {{var}}
53
+ brackets: /\{\{[^}]*\}\}/g,
54
+
55
+ // {{#command}} {{/command}}
56
+ command: /\{\{[#/]([^}]+)\}\}/g,
57
+
58
+ // {{var}}
59
+ var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
60
+
61
+ // @dxn:queue:data:xxx
62
+ dxn: /@?dxn:[\w@:]+/g,
63
+
64
+ // dxos.org/type/xxx
65
+ url: /[\w.-]+\.[\w.-]+\/[\w/]+/g,
66
+ };
67
+
68
+ const tagPadding = 'mli-0.5 pli-1 rounded-sm';
69
+
70
+ /**
71
+ * ViewPlugin that decorates Handlebars syntax.
72
+ */
73
+ const handlebarsHighlightPlugin = ViewPlugin.fromClass(
74
+ class {
75
+ decorations: DecorationSet;
76
+
77
+ constructor(view: EditorView) {
78
+ this.decorations = this.buildDecorations(view);
79
+ }
80
+
81
+ update(update: ViewUpdate) {
82
+ if (update.docChanged || update.viewportChanged || update.selectionSet) {
83
+ this.decorations = this.buildDecorations(update.view);
84
+ }
85
+ }
86
+
87
+ // NOTE: Decorations may clash with other extensions (e.g., markdown).
88
+ buildDecorations(view: EditorView) {
89
+ const selection = view.state.selection.main;
90
+ const decorations: Array<{ from: number; to: number; decoration: Decoration }> = [];
91
+
92
+ for (const { from, to } of view.visibleRanges) {
93
+ const text = view.state.doc.sliceString(from, to);
94
+
95
+ // Match DXN.
96
+ {
97
+ let match;
98
+ while ((match = regex.dxn.exec(text)) !== null) {
99
+ const start = from + match.index;
100
+ const end = start + match[0].length;
101
+ // Only show widget if selection doesn't overlap with the match range.
102
+ const overlaps = selection.to > start && selection.from <= end;
103
+ if (!overlaps) {
104
+ decorations.push({
105
+ from: start,
106
+ to: end,
107
+ decoration: Decoration.widget({
108
+ widget: new DXNWidget(match[0]),
109
+ }),
110
+ });
111
+ }
112
+ }
113
+ }
114
+
115
+ // Match URLs.
116
+ {
117
+ let match;
118
+ while ((match = regex.url.exec(text)) !== null) {
119
+ const start = from + match.index;
120
+ const end = start + match[0].length;
121
+ decorations.push({
122
+ from: start,
123
+ to: end,
124
+ decoration: Decoration.mark({ class: mx('dx-tag--blue', tagPadding) }),
125
+ });
126
+ }
127
+ }
128
+
129
+ // Match brackets: {{ and }}.
130
+ {
131
+ let match;
132
+ while ((match = regex.brackets.exec(text)) !== null) {
133
+ const start = from + match.index;
134
+ const end = start + match[0].length;
135
+ decorations.push({
136
+ from: start,
137
+ to: end,
138
+ decoration: Decoration.mark({ class: 'text-subdued' }),
139
+ });
140
+ }
141
+ }
142
+
143
+ // Match commands: {{#command}} and {{/command}}.
144
+ {
145
+ let match;
146
+ while ((match = regex.command.exec(text)) !== null) {
147
+ const start = from + match.index + 2;
148
+ let end = start + match[0].length - 4;
149
+ const text = view.state.doc.sliceString(start, end);
150
+ const parts = text.split(/\s+/);
151
+ if (parts.length > 1) {
152
+ const idx = start + parts[0].length;
153
+ decorations.push({
154
+ from: idx,
155
+ to: end,
156
+ decoration: Decoration.mark({ class: 'text-greenText' }),
157
+ });
158
+ end = idx;
159
+ }
160
+ decorations.push({
161
+ from: start,
162
+ to: end,
163
+ decoration: Decoration.mark({ class: 'text-blueText' }),
164
+ });
165
+ }
166
+ }
167
+
168
+ // Match variables: {{var}}.
169
+ {
170
+ let match;
171
+ while ((match = regex.var.exec(text)) !== null) {
172
+ const start = from + match.index + 2;
173
+ const end = start + match[0].length - 4;
174
+ decorations.push({
175
+ from: start,
176
+ to: end,
177
+ decoration: Decoration.mark({ class: 'text-greenText' }),
178
+ });
179
+ }
180
+ }
181
+ }
182
+
183
+ // Sort decorations by position to satisfy RangeSetBuilder requirements.
184
+ decorations.sort((a, b) => a.from - b.from || a.to - b.to);
185
+
186
+ // Add sorted decorations to builder.
187
+ const builder = new RangeSetBuilder<Decoration>();
188
+ for (const { from, to, decoration } of decorations) {
189
+ builder.add(from, to, decoration);
190
+ }
191
+
192
+ return builder.finish();
193
+ }
194
+ },
195
+ {
196
+ decorations: (v) => v.decorations,
197
+ },
198
+ );
199
+
200
+ class DXNWidget extends WidgetType {
201
+ constructor(private readonly _identifier: string) {
202
+ super();
203
+ }
204
+
205
+ override ignoreEvent() {
206
+ return false;
207
+ }
208
+
209
+ override eq(other: this) {
210
+ return this._identifier === other._identifier;
211
+ }
212
+
213
+ override toDOM() {
214
+ const text = this._identifier
215
+ .split(':')
216
+ .map((part) => {
217
+ const len = 16;
218
+ const plen = 4;
219
+ if (part.length > len) {
220
+ return `[${part.slice(0, plen)}…${part.slice(-plen)}]`;
221
+ }
222
+ return part;
223
+ })
224
+ .join(':');
225
+ return Domino.of('span').classNames(['font-mono dx-tag--blue', tagPadding]).text(text).build();
226
+ }
227
+ }
228
+
229
+ // TODO(burdon): Pass in variables.
230
+ const variables = ['this'];
231
+ const commands = ['this', 'each', 'if', 'unless', 'with'];
232
+
233
+ /**
234
+ * Provides completions for Handlebars variables.
235
+ */
236
+ function handlebarsCompletions(context: CompletionContext): CompletionResult | null {
237
+ const match = context.matchBefore(/\{\{[^}]*/);
238
+ if (!match || match.from === match.to) {
239
+ return null;
240
+ }
241
+
242
+ let type = 'variable';
243
+ let text = match.text.slice(2);
244
+ let from = match.from + 2;
245
+ let matches = [];
246
+ if (text.startsWith('#') || text.startsWith('/')) {
247
+ const idx = text.lastIndexOf(' ');
248
+ if (idx !== -1) {
249
+ type = 'variable';
250
+ matches = variables;
251
+ text = text.slice(idx + 1);
252
+ from += idx + 1;
253
+ } else {
254
+ type = 'command';
255
+ text = text.slice(1);
256
+ matches = commands;
257
+ from += 1;
258
+ }
259
+ } else {
260
+ type = 'variable';
261
+ matches = variables;
262
+ }
263
+
264
+ const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));
265
+ return {
266
+ from,
267
+ options,
268
+ };
269
+ }
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './handlebars-extension';
6
+ export * from './xml-extension';
@@ -0,0 +1,64 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { syntaxTree } from '@codemirror/language';
6
+ import { type Extension, RangeSetBuilder } from '@codemirror/state';
7
+ import { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';
8
+
9
+ export type XmlOptions = {};
10
+
11
+ /**
12
+ * XML decorator plugin for CodeMirror.
13
+ * Decorates XML tags with monospace font using the XML language grammar.
14
+ */
15
+ export const xmlDecorator = (_: XmlOptions = {}): Extension => {
16
+ return [xmlDecoratorPlugin];
17
+ };
18
+
19
+ /**
20
+ * ViewPlugin that decorates XML tags using syntax tree.
21
+ */
22
+ const xmlDecoratorPlugin = ViewPlugin.fromClass(
23
+ class {
24
+ decorations: DecorationSet;
25
+
26
+ constructor(view: EditorView) {
27
+ this.decorations = this.buildDecorations(view);
28
+ }
29
+
30
+ update(update: ViewUpdate) {
31
+ if (update.docChanged || update.viewportChanged) {
32
+ this.decorations = this.buildDecorations(update.view);
33
+ }
34
+ }
35
+
36
+ buildDecorations(view: EditorView) {
37
+ const builder = new RangeSetBuilder<Decoration>();
38
+
39
+ for (const { from, to } of view.visibleRanges) {
40
+ syntaxTree(view.state).iterate({
41
+ from,
42
+ to,
43
+ enter: (node) => {
44
+ // Decorate XML elements (opening tags, closing tags, self-closing tags).
45
+ if (
46
+ node.name === 'HTMLTag' ||
47
+ node.name === 'OpenTag' ||
48
+ node.name === 'CloseTag' ||
49
+ node.name === 'SelfClosingTag' ||
50
+ node.name === 'Element'
51
+ ) {
52
+ builder.add(node.from, node.to, Decoration.mark({ class: 'font-mono text-subdued' }));
53
+ }
54
+ },
55
+ });
56
+ }
57
+
58
+ return builder.finish();
59
+ }
60
+ },
61
+ {
62
+ decorations: (v) => v.decorations,
63
+ },
64
+ );