@dxos/plugin-assistant 0.8.4-main.406dc2a → 0.8.4-main.548089c

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 (318) hide show
  1. package/dist/lib/browser/BlueprintArticle-UGPRZRBG.mjs +36 -0
  2. package/dist/lib/browser/BlueprintArticle-UGPRZRBG.mjs.map +7 -0
  3. package/dist/lib/browser/{ChatCompanion-BDZ55ZRF.mjs → ChatCompanion-BZGANK56.mjs} +58 -50
  4. package/dist/lib/browser/ChatCompanion-BZGANK56.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-RYGNN73X.mjs → ChatContainer-OG6Y3NHI.mjs} +22 -18
  6. package/dist/lib/browser/ChatContainer-OG6Y3NHI.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-MVHH2U66.mjs → ChatDialog-NKNUCC3R.mjs} +8 -4
  8. package/dist/lib/browser/ChatDialog-NKNUCC3R.mjs.map +7 -0
  9. package/dist/lib/browser/PromptArticle-QNJAXD5Y.mjs +89 -0
  10. package/dist/lib/browser/PromptArticle-QNJAXD5Y.mjs.map +7 -0
  11. package/dist/lib/browser/{app-graph-builder-2U7SLCRX.mjs → app-graph-builder-CJ5ZUG5I.mjs} +62 -17
  12. package/dist/lib/browser/app-graph-builder-CJ5ZUG5I.mjs.map +7 -0
  13. package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs → blueprint-definition-5FT5JGPY.mjs} +4 -4
  14. package/dist/lib/browser/chunk-AO6XHMQ7.mjs +262 -0
  15. package/dist/lib/browser/chunk-AO6XHMQ7.mjs.map +7 -0
  16. package/dist/lib/browser/{chunk-FP56WB24.mjs → chunk-BNTPFZ7O.mjs} +30 -13
  17. package/dist/lib/browser/chunk-BNTPFZ7O.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs +335 -0
  19. package/dist/lib/browser/chunk-FJQ4ZRYJ.mjs.map +7 -0
  20. package/dist/lib/browser/{chunk-2CE2KPKZ.mjs → chunk-IXIIS4QA.mjs} +37 -36
  21. package/dist/lib/browser/chunk-IXIIS4QA.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-5EGXHCAZ.mjs → chunk-LRE4VEZV.mjs} +2 -2
  23. package/dist/lib/browser/chunk-LRE4VEZV.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-WBG5PTSX.mjs +23 -0
  25. package/dist/lib/browser/chunk-WBG5PTSX.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-WRJGOT5P.mjs → chunk-Y4C2CMME.mjs} +772 -620
  27. package/dist/lib/browser/chunk-Y4C2CMME.mjs.map +7 -0
  28. package/dist/lib/browser/index.mjs +78 -62
  29. package/dist/lib/browser/index.mjs.map +3 -3
  30. package/dist/lib/browser/{intent-resolver-3GOJMBXJ.mjs → intent-resolver-42A4SLIQ.mjs} +49 -20
  31. package/dist/lib/browser/intent-resolver-42A4SLIQ.mjs.map +7 -0
  32. package/dist/lib/browser/{local-model-resolver-GO6ZEMLL.mjs → local-model-resolver-34MVHRKD.mjs} +2 -2
  33. package/dist/lib/browser/{local-model-resolver-GO6ZEMLL.mjs.map → local-model-resolver-34MVHRKD.mjs.map} +2 -2
  34. package/dist/lib/browser/meta.json +1 -1
  35. package/dist/lib/browser/{react-surface-FTKCE6GG.mjs → react-surface-TULJF2Y3.mjs} +22 -31
  36. package/dist/lib/browser/react-surface-TULJF2Y3.mjs.map +7 -0
  37. package/dist/lib/browser/{settings-HBF32KV6.mjs → settings-NYJGNQ5I.mjs} +3 -3
  38. package/dist/lib/browser/{state-LXTS54DI.mjs → state-GG7Z3NB7.mjs} +7 -3
  39. package/dist/lib/browser/{state-LXTS54DI.mjs.map → state-GG7Z3NB7.mjs.map} +3 -3
  40. package/dist/lib/browser/toolkit-VYDAWNE4.mjs +17 -0
  41. package/dist/lib/browser/toolkit-VYDAWNE4.mjs.map +7 -0
  42. package/dist/lib/browser/types/index.mjs +2 -2
  43. package/dist/lib/node-esm/BlueprintArticle-RPZ2363K.mjs +37 -0
  44. package/dist/lib/node-esm/BlueprintArticle-RPZ2363K.mjs.map +7 -0
  45. package/dist/lib/node-esm/{ChatCompanion-XFNXVZIP.mjs → ChatCompanion-LKWZTSCI.mjs} +58 -50
  46. package/dist/lib/node-esm/ChatCompanion-LKWZTSCI.mjs.map +7 -0
  47. package/dist/lib/node-esm/{ChatContainer-UTJGCQXF.mjs → ChatContainer-HGAAKVB3.mjs} +22 -18
  48. package/dist/lib/node-esm/ChatContainer-HGAAKVB3.mjs.map +7 -0
  49. package/dist/lib/node-esm/{ChatDialog-QEYZ4IOV.mjs → ChatDialog-QA545GGB.mjs} +8 -4
  50. package/dist/lib/node-esm/ChatDialog-QA545GGB.mjs.map +7 -0
  51. package/dist/lib/node-esm/PromptArticle-JW46XL4M.mjs +90 -0
  52. package/dist/lib/node-esm/PromptArticle-JW46XL4M.mjs.map +7 -0
  53. package/dist/lib/node-esm/{app-graph-builder-OKNLR7H2.mjs → app-graph-builder-XPQLG755.mjs} +62 -17
  54. package/dist/lib/node-esm/app-graph-builder-XPQLG755.mjs.map +7 -0
  55. package/dist/lib/node-esm/{blueprint-definition-WD2IVMAI.mjs → blueprint-definition-XW6QQVLV.mjs} +4 -4
  56. package/dist/lib/node-esm/chunk-3YVWS6OI.mjs +264 -0
  57. package/dist/lib/node-esm/chunk-3YVWS6OI.mjs.map +7 -0
  58. package/dist/lib/node-esm/{chunk-TNR46C3L.mjs → chunk-AB74FOA2.mjs} +30 -13
  59. package/dist/lib/node-esm/chunk-AB74FOA2.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs +336 -0
  61. package/dist/lib/node-esm/chunk-KJGD4EBJ.mjs.map +7 -0
  62. package/dist/lib/node-esm/{chunk-U2NYUS2N.mjs → chunk-UXTUHH24.mjs} +37 -36
  63. package/dist/lib/node-esm/chunk-UXTUHH24.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-UFKLCEAE.mjs → chunk-VI6S3Q5H.mjs} +772 -620
  65. package/dist/lib/node-esm/chunk-VI6S3Q5H.mjs.map +7 -0
  66. package/dist/lib/node-esm/{chunk-73ABYRYX.mjs → chunk-WE6KTH72.mjs} +7 -2
  67. package/dist/lib/node-esm/chunk-WE6KTH72.mjs.map +7 -0
  68. package/dist/lib/node-esm/{chunk-XQGWSZ4T.mjs → chunk-YWFWT57N.mjs} +2 -2
  69. package/dist/lib/node-esm/chunk-YWFWT57N.mjs.map +7 -0
  70. package/dist/lib/node-esm/index.mjs +78 -62
  71. package/dist/lib/node-esm/index.mjs.map +3 -3
  72. package/dist/lib/node-esm/{intent-resolver-6XLVTRDJ.mjs → intent-resolver-Y6I3IDSI.mjs} +49 -20
  73. package/dist/lib/node-esm/intent-resolver-Y6I3IDSI.mjs.map +7 -0
  74. package/dist/lib/node-esm/{local-model-resolver-WOQ2D2R2.mjs → local-model-resolver-TP2NTSAX.mjs} +2 -2
  75. package/dist/lib/node-esm/{local-model-resolver-WOQ2D2R2.mjs.map → local-model-resolver-TP2NTSAX.mjs.map} +2 -2
  76. package/dist/lib/node-esm/meta.json +1 -1
  77. package/dist/lib/node-esm/{react-surface-K7ZXQLAP.mjs → react-surface-C4WY3WRR.mjs} +22 -31
  78. package/dist/lib/node-esm/react-surface-C4WY3WRR.mjs.map +7 -0
  79. package/dist/lib/node-esm/{settings-CWP6MTWP.mjs → settings-RRHYI5KO.mjs} +3 -3
  80. package/dist/lib/node-esm/{state-BO6GUFLB.mjs → state-FSUHFMDM.mjs} +7 -3
  81. package/dist/lib/node-esm/{state-BO6GUFLB.mjs.map → state-FSUHFMDM.mjs.map} +3 -3
  82. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs +18 -0
  83. package/dist/lib/node-esm/toolkit-HFJZLVIR.mjs.map +7 -0
  84. package/dist/lib/node-esm/types/index.mjs +2 -2
  85. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  87. package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
  88. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/capabilities.d.ts +2 -3
  90. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  91. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  92. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  94. package/dist/types/src/capabilities/toolkit.d.ts +1 -1
  95. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  96. package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
  97. package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
  98. package/dist/types/src/components/Chat/Chat.d.ts +18 -8
  99. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  100. package/dist/types/src/components/Chat/events.d.ts +4 -0
  101. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  102. package/dist/types/src/components/ChatCompanion.d.ts +2 -2
  103. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
  104. package/dist/types/src/components/ChatContainer.d.ts +7 -4
  105. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  106. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  107. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  108. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  109. package/dist/types/src/components/ChatThread/ChatThread.d.ts +6 -9
  110. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  111. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +123 -70
  112. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  113. package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
  114. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
  115. package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
  116. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
  117. package/dist/types/src/components/PromptArticle.d.ts +7 -0
  118. package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
  119. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
  120. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  121. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +111 -61
  122. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  123. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +111 -61
  124. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  125. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
  126. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
  127. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
  128. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
  129. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
  130. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +9 -7
  131. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
  132. package/dist/types/src/components/Toolbox/Toolbox.d.ts +2 -2
  133. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  134. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +111 -60
  135. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  136. package/dist/types/src/components/index.d.ts +4 -9
  137. package/dist/types/src/components/index.d.ts.map +1 -1
  138. package/dist/types/src/functions/index.d.ts +2 -2
  139. package/dist/types/src/functions/index.d.ts.map +1 -1
  140. package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +1 -1
  141. package/dist/types/src/functions/object-list.d.ts.map +1 -0
  142. package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +1 -1
  143. package/dist/types/src/functions/object-load.d.ts.map +1 -0
  144. package/dist/types/src/hooks/index.d.ts +1 -0
  145. package/dist/types/src/hooks/index.d.ts.map +1 -1
  146. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  147. package/dist/types/src/hooks/useChatProcessor.d.ts +3 -1
  148. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  149. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  150. package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
  151. package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
  152. package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
  153. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
  154. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  155. package/dist/types/src/meta.d.ts.map +1 -1
  156. package/dist/types/src/processor/index.d.ts +1 -0
  157. package/dist/types/src/processor/index.d.ts.map +1 -1
  158. package/dist/types/src/processor/processor.d.ts +6 -6
  159. package/dist/types/src/processor/processor.d.ts.map +1 -1
  160. package/dist/types/src/processor/update-name.d.ts +10 -0
  161. package/dist/types/src/processor/update-name.d.ts.map +1 -0
  162. package/dist/types/src/queue-logger.d.ts.map +1 -1
  163. package/dist/types/src/testing/test-generator.d.ts +2 -2
  164. package/dist/types/src/testing/test-generator.d.ts.map +1 -1
  165. package/dist/types/src/translations.d.ts +239 -26
  166. package/dist/types/src/translations.d.ts.map +1 -1
  167. package/dist/types/src/types/Assistant.d.ts +0 -3
  168. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  169. package/dist/types/src/types/AssistantAction.d.ts +29 -4
  170. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  171. package/dist/types/src/types/service.d.ts +9 -6
  172. package/dist/types/src/types/service.d.ts.map +1 -1
  173. package/dist/types/tsconfig.tsbuildinfo +1 -1
  174. package/package.json +78 -73
  175. package/src/AssistantPlugin.tsx +20 -2
  176. package/src/capabilities/app-graph-builder.ts +62 -15
  177. package/src/capabilities/blueprint-definition.ts +38 -36
  178. package/src/capabilities/capabilities.ts +2 -3
  179. package/src/capabilities/intent-resolver.ts +66 -15
  180. package/src/capabilities/local-model-resolver.ts +1 -1
  181. package/src/capabilities/react-surface.tsx +16 -20
  182. package/src/capabilities/state.ts +2 -0
  183. package/src/capabilities/toolkit.ts +9 -160
  184. package/src/components/BlueprintArticle.tsx +29 -0
  185. package/src/components/Chat/Chat.tsx +112 -58
  186. package/src/components/Chat/events.ts +6 -0
  187. package/src/components/ChatCompanion.tsx +62 -43
  188. package/src/components/ChatContainer.tsx +27 -17
  189. package/src/components/ChatDialog.tsx +9 -2
  190. package/src/components/ChatProgress/ChatProgress.tsx +1 -1
  191. package/src/components/ChatPrompt/ChatActions.tsx +2 -4
  192. package/src/components/ChatPrompt/ChatOptions.tsx +26 -23
  193. package/src/components/ChatPrompt/ChatReferences.tsx +2 -2
  194. package/src/components/ChatThread/ChatThread.stories.tsx +45 -26
  195. package/src/components/ChatThread/ChatThread.tsx +25 -35
  196. package/src/components/ChatThread/reducers.ts +6 -6
  197. package/src/components/ChatThread/registry.tsx +23 -33
  198. package/src/components/ChatThread/sync.test.ts +20 -12
  199. package/src/components/ChatThread/sync.ts +47 -12
  200. package/src/components/ChatThread/testing/thread.md +37 -0
  201. package/src/components/PromptArticle.tsx +85 -0
  202. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +14 -4
  203. package/src/components/TemplateEditor/TemplateEditor.tsx +17 -8
  204. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  205. package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
  206. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +269 -0
  207. package/src/components/TemplateEditor/extensions/index.ts +6 -0
  208. package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
  209. package/src/components/ToolBlock/ToolBlock.tsx +33 -42
  210. package/src/components/Toolbox/Toolbox.stories.tsx +2 -2
  211. package/src/components/Toolbox/Toolbox.tsx +5 -5
  212. package/src/components/index.ts +2 -5
  213. package/src/functions/analysis.ts +1 -1
  214. package/src/functions/index.ts +2 -2
  215. package/src/functions/{list.ts → object-list.ts} +4 -4
  216. package/src/functions/{load.ts → object-load.ts} +3 -4
  217. package/src/hooks/index.ts +1 -0
  218. package/src/hooks/useBlueprintRegistry.ts +2 -1
  219. package/src/hooks/useChatProcessor.ts +12 -12
  220. package/src/hooks/useChatServices.ts +7 -5
  221. package/src/hooks/useChatToolbarActions.ts +122 -0
  222. package/src/hooks/useContextBinder.ts +6 -6
  223. package/src/hooks/useReferencesProvider.ts +2 -1
  224. package/src/meta.ts +6 -1
  225. package/src/processor/index.ts +1 -0
  226. package/src/processor/presets.ts +1 -1
  227. package/src/processor/processor.test.ts +8 -18
  228. package/src/processor/processor.ts +14 -39
  229. package/src/processor/update-name.ts +56 -0
  230. package/src/queue-logger.ts +4 -8
  231. package/src/testing/test-generator.ts +10 -10
  232. package/src/translations.ts +24 -16
  233. package/src/types/Assistant.ts +4 -5
  234. package/src/types/AssistantAction.ts +21 -4
  235. package/src/types/service.ts +2 -2
  236. package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs +0 -28
  237. package/dist/lib/browser/BlueprintContainer-WX2SSDVI.mjs.map +0 -7
  238. package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +0 -7
  239. package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +0 -7
  240. package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +0 -7
  241. package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs +0 -150
  242. package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +0 -7
  243. package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +0 -7
  244. package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +0 -7
  245. package/dist/lib/browser/chunk-43I2LR6O.mjs +0 -216
  246. package/dist/lib/browser/chunk-43I2LR6O.mjs.map +0 -7
  247. package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +0 -7
  248. package/dist/lib/browser/chunk-5RICKAMN.mjs +0 -18
  249. package/dist/lib/browser/chunk-5RICKAMN.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-CQ7UHYTT.mjs +0 -296
  251. package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +0 -7
  252. package/dist/lib/browser/chunk-FP56WB24.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-JZRZVB2A.mjs +0 -170
  254. package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +0 -7
  255. package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +0 -7
  256. package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +0 -7
  257. package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +0 -7
  258. package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +0 -199
  259. package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +0 -7
  260. package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs +0 -29
  261. package/dist/lib/node-esm/BlueprintContainer-4MKN6ZRB.mjs.map +0 -7
  262. package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +0 -7
  263. package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +0 -7
  264. package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +0 -7
  265. package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs +0 -151
  266. package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +0 -7
  267. package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +0 -7
  268. package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +0 -7
  269. package/dist/lib/node-esm/chunk-DSE2IILK.mjs +0 -217
  270. package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +0 -7
  271. package/dist/lib/node-esm/chunk-E2WXZND7.mjs +0 -297
  272. package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +0 -7
  273. package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +0 -171
  274. package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +0 -7
  275. package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +0 -7
  276. package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +0 -7
  277. package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +0 -7
  278. package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +0 -7
  279. package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +0 -7
  280. package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +0 -7
  281. package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +0 -200
  282. package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +0 -7
  283. package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
  284. package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
  285. package/dist/types/src/components/PromptSettings.d.ts +0 -6
  286. package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
  287. package/dist/types/src/components/SequenceContainer.d.ts +0 -8
  288. package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
  289. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
  290. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
  291. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -269
  292. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
  293. package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
  294. package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
  295. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
  296. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
  297. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  298. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  299. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  300. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
  301. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
  302. package/dist/types/src/functions/list.d.ts.map +0 -1
  303. package/dist/types/src/functions/load.d.ts.map +0 -1
  304. package/src/components/BlueprintContainer.tsx +0 -24
  305. package/src/components/PromptSettings.tsx +0 -90
  306. package/src/components/SequenceContainer.tsx +0 -131
  307. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -35
  308. package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
  309. package/src/components/SequenceEditor/index.ts +0 -5
  310. package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
  311. package/src/components/Toolbar/Toolbar.tsx +0 -21
  312. package/src/components/Toolbar/index.ts +0 -5
  313. package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
  314. /package/dist/lib/browser/{blueprint-definition-NSJARW5U.mjs.map → blueprint-definition-5FT5JGPY.mjs.map} +0 -0
  315. /package/dist/lib/browser/{settings-HBF32KV6.mjs.map → settings-NYJGNQ5I.mjs.map} +0 -0
  316. /package/dist/lib/node-esm/{blueprint-definition-WD2IVMAI.mjs.map → blueprint-definition-XW6QQVLV.mjs.map} +0 -0
  317. /package/dist/lib/node-esm/{settings-CWP6MTWP.mjs.map → settings-RRHYI5KO.mjs.map} +0 -0
  318. /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
@@ -5,7 +5,7 @@
5
5
  import React from 'react';
6
6
 
7
7
  import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
- import { Blueprint } from '@dxos/blueprints';
8
+ import { Blueprint, Prompt } from '@dxos/blueprints';
9
9
  import { getSpace } from '@dxos/client/echo';
10
10
  import { Sequence } from '@dxos/conductor';
11
11
  import { InvocationTraceContainer } from '@dxos/devtools';
@@ -15,12 +15,11 @@ import { StackItem } from '@dxos/react-ui-stack';
15
15
 
16
16
  import {
17
17
  AssistantSettings,
18
- BlueprintContainer,
18
+ BlueprintArticle,
19
19
  ChatCompanion,
20
20
  ChatContainer,
21
21
  ChatDialog,
22
- PromptSettings,
23
- SequenceContainer,
22
+ PromptArticle,
24
23
  } from '../components';
25
24
  import { ASSISTANT_DIALOG, meta } from '../meta';
26
25
  import { Assistant } from '../types';
@@ -41,6 +40,7 @@ export default () =>
41
40
  Obj.instanceOf(Assistant.Chat, data.subject) && data.variant !== 'assistant-chat',
42
41
  component: ({ data, role }) => <ChatContainer role={role} chat={data.subject} />,
43
42
  }),
43
+ // TODO(wittjosiah): This is flashing when chat changes.
44
44
  createSurface({
45
45
  id: `${meta.id}/companion-chat`,
46
46
  role: 'article',
@@ -50,22 +50,18 @@ export default () =>
50
50
  component: ({ data, role }) => <ChatCompanion role={role} data={data} />,
51
51
  }),
52
52
  createSurface({
53
- id: `${meta.id}/sequence`,
54
- role: 'article',
55
- filter: (data): data is { subject: Sequence } => Obj.instanceOf(Sequence, data.subject),
56
- component: ({ data }) => <SequenceContainer sequence={data.subject} />,
57
- }),
58
- createSurface({
59
- id: `${meta.id}/companion-logs`,
53
+ id: `${meta.id}/companion-invocations`,
60
54
  role: 'article',
61
55
  filter: (data): data is { companionTo: Sequence } =>
62
- Obj.instanceOf(Sequence, data.companionTo) && data.subject === 'logs',
63
- // eslint-disable-next-line unused-imports/no-unused-vars
64
- component: ({ data, role }) => {
56
+ (Obj.instanceOf(Sequence, data.companionTo) || Obj.instanceOf(Prompt.Prompt, data.companionTo)) &&
57
+ data.subject === 'invocations',
58
+ component: ({ data }) => {
65
59
  const space = getSpace(data.companionTo);
60
+ // TODO(wittjosiah): Support invocation filtering for prompts.
61
+ const target = Obj.instanceOf(Prompt.Prompt, data.companionTo) ? undefined : data.companionTo;
66
62
  return (
67
63
  <StackItem.Content>
68
- <InvocationTraceContainer space={space} target={data.companionTo} detailAxis='block' />
64
+ <InvocationTraceContainer space={space} target={target} detailAxis='block' />
69
65
  </StackItem.Content>
70
66
  );
71
67
  },
@@ -74,13 +70,13 @@ export default () =>
74
70
  id: `${meta.id}/blueprint`,
75
71
  role: 'article',
76
72
  filter: (data): data is { subject: Blueprint.Blueprint } => Obj.instanceOf(Blueprint.Blueprint, data.subject),
77
- component: ({ data }) => <BlueprintContainer blueprint={data.subject} />,
73
+ component: ({ data }) => <BlueprintArticle object={data.subject} />,
78
74
  }),
79
75
  createSurface({
80
- id: `${meta.id}/prompt-settings`,
81
- role: 'object-settings',
82
- filter: (data): data is { subject: Blueprint.Blueprint } => Obj.instanceOf(Blueprint.Blueprint, data.subject),
83
- component: ({ data }) => <PromptSettings template={data.subject.instructions} />,
76
+ id: `${meta.id}/prompt`,
77
+ role: 'article',
78
+ filter: (data): data is { subject: Prompt.Prompt } => Obj.instanceOf(Prompt.Prompt, data.subject),
79
+ component: ({ data }) => <PromptArticle object={data.subject} />,
84
80
  }),
85
81
  createSurface({
86
82
  id: ASSISTANT_DIALOG,
@@ -16,5 +16,7 @@ export default () => {
16
16
  currentChat: {},
17
17
  });
18
18
 
19
+ state.prop({ key: 'currentChat', type: LocalStorageStore.json<Record<string, string | undefined>>() });
20
+
19
21
  return contributes(AssistantCapabilities.State, state.values, () => state.close());
20
22
  };
@@ -2,167 +2,16 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Tool from '@effect/ai/Tool';
6
- import * as Toolkit from '@effect/ai/Toolkit';
7
- import * as Effect from 'effect/Effect';
8
- import * as Schema from 'effect/Schema';
5
+ import * as Layer from 'effect/Layer';
9
6
 
10
- import { Capabilities, type Capability, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
11
- import { AiContextService, ArtifactId } from '@dxos/assistant';
12
- import { WebSearchToolkit } from '@dxos/assistant-testing';
13
- import { Filter, Obj, Ref, SchemaNotFoundError, Type } from '@dxos/echo';
14
- import { DatabaseService } from '@dxos/functions';
15
- import { invariant } from '@dxos/invariant';
16
- import { ClientCapabilities } from '@dxos/plugin-client';
17
- import { SpaceCapabilities, getActiveSpace } from '@dxos/plugin-space';
18
- import { SpaceAction } from '@dxos/plugin-space/types';
19
- import { DataType } from '@dxos/schema';
20
- import { trim } from '@dxos/util';
7
+ import { Capabilities, type Capability, type PluginContext, contributes } from '@dxos/app-framework';
8
+ import { GenericToolkit } from '@dxos/assistant';
9
+ import { AssistantToolkit, SystemToolkit, WebSearchToolkit } from '@dxos/assistant-toolkit';
21
10
 
22
- // TODO(burdon): Reconcile with functions (currently reuses plugin framework intents).
23
- class AssistantToolkit extends Toolkit.make(
24
- Tool.make('add-to-context', {
25
- description: trim`
26
- Adds the object to the chat context.
27
- `,
28
- parameters: {
29
- id: ArtifactId.annotations({
30
- description: 'The ID of the document to read.',
31
- }),
32
- },
33
- success: Schema.Void,
34
- failure: Schema.Never,
35
- dependencies: [AiContextService, DatabaseService],
36
- }),
11
+ export default (_context: PluginContext): Capability<any>[] => [
12
+ contributes(Capabilities.Toolkit, GenericToolkit.make(AssistantToolkit.AssistantToolkit, AssistantToolkit.layer())),
37
13
 
38
- Tool.make('get-schemas', {
39
- description: trim`
40
- Retrieves schemas definitions.
41
- `,
42
- parameters: {
43
- // TODO(wittjosiah): Remove this once parameter-less tools are fixed.
44
- limit: Schema.Number,
45
- },
46
- // TODO(dmaretskyi): Effect returns ({ result, encodedResult })
47
- success: Schema.Any,
48
- failure: Schema.Never,
49
- }),
50
-
51
- Tool.make('add-schema', {
52
- description: trim`
53
- Adds a schema to the space.
54
- The name will be used when displayed to the user.
55
- The typename must be in the format of "example.com/type/Type".
56
- `,
57
- parameters: {
58
- name: Schema.String,
59
- typename: Schema.String,
60
- jsonSchema: Schema.Any,
61
- },
62
- success: Schema.Any,
63
- failure: Schema.Never,
64
- }),
65
-
66
- Tool.make('create-record', {
67
- description: trim`
68
- Creates a new record and adds it to the current space.
69
- Get the schema from the get-schemas tool and ensure that the data matches the corresponding schema.
70
- Note that only record schemas are supported.
71
- `,
72
- parameters: {
73
- typename: Schema.String,
74
- data: Schema.Any,
75
- },
76
- success: Schema.Any,
77
- failure: Schema.Never,
78
- }),
79
- ) {
80
- static layer = (context: PluginContext) =>
81
- AssistantToolkit.toLayer({
82
- 'add-to-context': Effect.fnUntraced(function* ({ id }) {
83
- const { binder } = yield* AiContextService;
84
- const { db } = yield* DatabaseService;
85
- const ref = Ref.fromDXN(ArtifactId.toDXN(id, db.spaceId));
86
- yield* Effect.promise(() =>
87
- binder.bind({
88
- blueprints: [],
89
- objects: [ref],
90
- }),
91
- );
92
- }),
93
-
94
- 'get-schemas': () => {
95
- const space = getActiveSpace(context);
96
- invariant(space, 'No active space');
97
-
98
- return Effect.gen(function* () {
99
- const whitelist = context
100
- .getCapabilities(ClientCapabilities.SchemaWhiteList)
101
- .flat()
102
- .map((schema) => ({
103
- typename: Type.getTypename(schema),
104
- jsonSchema: Type.toJsonSchema(schema),
105
- kind: 'record',
106
- }));
107
-
108
- // TODO(burdon): Why ObjectForm (bad name for data capability; UI term)?
109
- const forms = context.getCapabilities(SpaceCapabilities.ObjectForm).map((form) => ({
110
- typename: Type.getTypename(form.objectSchema),
111
- jsonSchema: Type.toJsonSchema(form.objectSchema),
112
- kind: 'item',
113
- }));
114
-
115
- const schemas = [...whitelist, ...forms];
116
- if (space) {
117
- const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
118
- schemas.push(
119
- ...objects.map((object) => ({
120
- typename: object.typename,
121
- jsonSchema: object.jsonSchema,
122
- kind: 'record',
123
- })),
124
- );
125
- }
126
-
127
- return schemas;
128
- }).pipe(Effect.provide(DatabaseService.layer(space.db)));
129
- },
130
-
131
- 'add-schema': ({ name, typename, jsonSchema }) => {
132
- return Effect.gen(function* () {
133
- const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
134
- const space = getActiveSpace(context);
135
- invariant(space, 'No active space');
136
-
137
- const schema = Type.toEffectSchema(jsonSchema).pipe(Type.Obj({ typename, version: '0.1.0' }));
138
- yield* dispatch(createIntent(SpaceAction.AddSchema, { space, name, typename, schema }));
139
- }).pipe(Effect.orDie);
140
- },
141
-
142
- 'create-record': ({ typename, data }) => {
143
- const { dispatch } = context.getCapability(Capabilities.IntentDispatcher);
144
- const space = getActiveSpace(context);
145
- invariant(space, 'No active space');
146
-
147
- return Effect.gen(function* () {
148
- const schemas = context.getCapabilities(ClientCapabilities.SchemaWhiteList).flat();
149
- const { objects } = yield* DatabaseService.runQuery(Filter.type(DataType.StoredSchema));
150
- schemas.push(...objects.map((object) => Type.toEffectSchema(object.jsonSchema)));
151
- const schema = schemas.find((schema) => Type.getTypename(schema) === typename);
152
- if (!schema) {
153
- throw new SchemaNotFoundError(typename);
154
- }
155
-
156
- const object = Obj.make(schema, data);
157
- yield* dispatch(createIntent(SpaceAction.AddObject, { object, target: space, hidden: true }));
158
- return object;
159
- }).pipe(Effect.provide(DatabaseService.layer(space.db)), Effect.orDie);
160
- },
161
- });
162
- }
163
-
164
- export default (context: PluginContext): Capability<any>[] => [
165
- contributes(Capabilities.Toolkit, AssistantToolkit),
166
- contributes(Capabilities.ToolkitHandler, AssistantToolkit.layer(context)),
167
- contributes(Capabilities.Toolkit, WebSearchToolkit),
14
+ // TODO(burdon): How to manage dependencies across blueprints.
15
+ contributes(Capabilities.Toolkit, GenericToolkit.make(SystemToolkit.SystemToolkit, SystemToolkit.layer())),
16
+ contributes(Capabilities.Toolkit, GenericToolkit.make(WebSearchToolkit, Layer.empty)),
168
17
  ];
@@ -0,0 +1,29 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type SurfaceComponentProps } from '@dxos/app-framework/react';
8
+ import { type Blueprint } from '@dxos/blueprints';
9
+ import { Obj } from '@dxos/echo';
10
+ import { Toolbar } from '@dxos/react-ui';
11
+ import { useAttention } from '@dxos/react-ui-attention';
12
+ import { StackItem } from '@dxos/react-ui-stack';
13
+
14
+ import { TemplateEditor } from './TemplateEditor';
15
+
16
+ export type BlueprintArticleProps = SurfaceComponentProps<Blueprint.Blueprint>;
17
+
18
+ export const BlueprintArticle = ({ object }: BlueprintArticleProps) => {
19
+ const { hasAttention } = useAttention(Obj.getDXN(object).toString());
20
+
21
+ return (
22
+ <StackItem.Content toolbar>
23
+ <Toolbar.Root disabled={!hasAttention} />
24
+ <TemplateEditor id={object.id} template={object.instructions} classNames='container-max-width' />
25
+ </StackItem.Content>
26
+ );
27
+ };
28
+
29
+ export default BlueprintArticle;
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { type Extension, Prec } from '@codemirror/state';
6
6
  import { keymap } from '@codemirror/view';
7
- import { useRxValue } from '@effect-rx/rx-react';
7
+ import { useAtomValue } from '@effect-atom/atom-react';
8
8
  import { createContext } from '@radix-ui/react-context';
9
9
  import * as Array from 'effect/Array';
10
10
  import * as Option from 'effect/Option';
@@ -17,11 +17,13 @@ import { type Space, getSpace, useQueue } from '@dxos/react-client/echo';
17
17
  import { useIdentity } from '@dxos/react-client/halo';
18
18
  import { Input, type ThemedClassName, useDynamicRef, useTranslation } from '@dxos/react-ui';
19
19
  import { ChatEditor, type ChatEditorController, type ChatEditorProps, references } from '@dxos/react-ui-chat';
20
+ import { type MarkdownStreamController } from '@dxos/react-ui-components';
21
+ import { MenuProvider, ToolbarMenu } from '@dxos/react-ui-menu';
20
22
  import { mx } from '@dxos/react-ui-theme';
21
- import { DataType } from '@dxos/schema';
23
+ import { Message } from '@dxos/types';
22
24
  import { isTruthy } from '@dxos/util';
23
25
 
24
- import { useReferencesProvider } from '../../hooks';
26
+ import { useChatToolbarActions, useReferencesProvider } from '../../hooks';
25
27
  import { meta } from '../../meta';
26
28
  import { type AiChatProcessor } from '../../processor';
27
29
  import { type Assistant } from '../../types';
@@ -33,11 +35,7 @@ import {
33
35
  ChatReferences,
34
36
  ChatStatusIndicator,
35
37
  } from '../ChatPrompt';
36
- import {
37
- type ChatThreadController,
38
- ChatThread as NaturalChatThread,
39
- type ChatThreadProps as NaturalChatThreadProps,
40
- } from '../ChatThread';
38
+ import { ChatThread as NaturalChatThread, type ChatThreadProps as NaturalChatThreadProps } from '../ChatThread';
41
39
 
42
40
  import { type ChatEvent } from './events';
43
41
 
@@ -50,9 +48,9 @@ import { type ChatEvent } from './events';
50
48
  type ChatContextValue = {
51
49
  debug?: boolean;
52
50
  event: Event<ChatEvent>;
53
- space: Space;
54
- chat: Assistant.Chat;
55
- messages: DataType.Message[];
51
+ space?: Space;
52
+ chat?: Assistant.Chat;
53
+ messages: Message.Message[];
56
54
  processor: AiChatProcessor;
57
55
  };
58
56
 
@@ -62,27 +60,23 @@ export const [ChatContextProvider, useChatContext] = createContext<ChatContextVa
62
60
  // Root
63
61
  //
64
62
 
65
- type ChatRootProps = ThemedClassName<
66
- PropsWithChildren<
67
- Pick<ChatContextValue, 'chat' | 'processor'> & {
68
- onEvent?: (event: ChatEvent) => void;
69
- }
70
- >
63
+ type ChatRootProps = PropsWithChildren<
64
+ Pick<ChatContextValue, 'space' | 'chat' | 'processor'> & {
65
+ onEvent?: (event: ChatEvent) => void;
66
+ }
71
67
  >;
72
68
 
73
- const ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }: ChatRootProps) => {
69
+ const ChatRoot = ({ children, chat, processor, onEvent, ...props }: ChatRootProps) => {
74
70
  const [debug, setDebug] = useState(false);
75
- const space = getSpace(chat);
76
-
77
- // Messages.
78
- const queue = useQueue<DataType.Message>(chat?.queue.dxn);
79
- const pending = useRxValue(processor.messages);
80
- const streaming = useRxValue(processor.streaming);
71
+ const pending = useAtomValue(processor.messages);
72
+ const streaming = useAtomValue(processor.streaming);
81
73
  const lastPrompt = useRef<string | undefined>(undefined);
82
74
 
75
+ // Messages.
76
+ const queue = useQueue<Message.Message>(chat?.queue.dxn);
83
77
  const messages = useMemo(() => {
84
- const queueMessages = queue?.objects?.filter(Obj.instanceOf(DataType.Message)) ?? [];
85
- return Array.dedupeWith([...queueMessages, ...pending], (a, b) => a.id === b.id);
78
+ const queueMessages = queue?.objects?.filter(Obj.instanceOf(Message.Message)) ?? [];
79
+ return Array.dedupeWith([...queueMessages, ...pending], ({ id: a }, { id: b }) => a === b);
86
80
  }, [queue?.objects, pending]);
87
81
 
88
82
  // Events.
@@ -120,37 +114,45 @@ const ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }:
120
114
  }
121
115
  break;
122
116
  }
123
-
124
- default: {
125
- onEvent?.(ev);
126
- }
127
117
  }
118
+
119
+ onEvent?.(ev);
128
120
  });
129
121
  }, [event, processor, streaming, onEvent]);
130
122
 
131
- if (!space) {
132
- return null;
133
- }
123
+ const space = props.space ?? getSpace(chat);
134
124
 
135
125
  return (
136
126
  <ChatContextProvider
137
127
  debug={debug}
138
128
  event={event}
139
- chat={chat}
140
129
  space={space}
130
+ chat={chat}
141
131
  messages={messages}
142
132
  processor={processor}
143
133
  {...props}
144
134
  >
145
- <div role='none' className={mx('flex flex-col bs-full is-full', classNames)}>
146
- {children}
147
- </div>
135
+ {children}
148
136
  </ChatContextProvider>
149
137
  );
150
138
  };
151
139
 
152
140
  ChatRoot.displayName = 'Chat.Root';
153
141
 
142
+ //
143
+ // Viewport
144
+ //
145
+
146
+ type ChatViewportProps = ThemedClassName<PropsWithChildren>;
147
+
148
+ const ChatViewport = ({ classNames, children }: ChatViewportProps) => {
149
+ return (
150
+ <div role='none' className={mx('flex flex-col bs-full is-full', classNames)}>
151
+ {children}
152
+ </div>
153
+ );
154
+ };
155
+
154
156
  //
155
157
  // Prompt
156
158
  //
@@ -181,11 +183,11 @@ const ChatPrompt = ({
181
183
  onOnlineChange,
182
184
  }: ChatPromptProps) => {
183
185
  const { t } = useTranslation(meta.id);
184
- const { space, event, processor } = useChatContext(ChatPrompt.displayName);
186
+ const { space, processor, event } = useChatContext(ChatPrompt.displayName);
185
187
 
186
- const error = useRxValue(processor.error).pipe(Option.getOrUndefined);
187
- const streaming = useRxValue(processor.streaming);
188
- const active = useRxValue(processor.active);
188
+ const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
189
+ const streaming = useAtomValue(processor.streaming);
190
+ const active = useAtomValue(processor.active);
189
191
  const activeRef = useDynamicRef(active);
190
192
 
191
193
  const editorRef = useRef<ChatEditorController>(null);
@@ -227,29 +229,49 @@ const ChatPrompt = ({
227
229
  keymap.of(
228
230
  [
229
231
  {
230
- key: 'cmd-d',
232
+ key: 'Mod-d',
231
233
  preventDefault: true,
232
234
  run: () => {
233
235
  event.emit({ type: 'toggle-debug' });
234
236
  return true;
235
237
  },
236
238
  },
237
- expandable && {
238
- key: 'cmd-ArrowUp',
239
+ {
240
+ key: 'Mod-ArrowUp',
239
241
  preventDefault: true,
240
242
  run: () => {
241
- event.emit({ type: 'thread-open' });
243
+ event.emit({ type: 'nav-previous' });
242
244
  return true;
243
245
  },
244
246
  },
245
- expandable && {
246
- key: 'cmd-ArrowDown',
247
+ {
248
+ key: 'Mod-ArrowDown',
247
249
  preventDefault: true,
248
250
  run: () => {
249
- event.emit({ type: 'thread-close' });
251
+ event.emit({ type: 'nav-next' });
250
252
  return true;
251
253
  },
252
254
  },
255
+ ...(expandable
256
+ ? [
257
+ {
258
+ key: 'Shift-Mod-ArrowUp',
259
+ preventDefault: true,
260
+ run: () => {
261
+ event.emit({ type: 'thread-open' });
262
+ return true;
263
+ },
264
+ },
265
+ {
266
+ key: 'Shift-Mod-ArrowDown',
267
+ preventDefault: true,
268
+ run: () => {
269
+ event.emit({ type: 'thread-close' });
270
+ return true;
271
+ },
272
+ },
273
+ ]
274
+ : []),
253
275
  ].filter(isTruthy),
254
276
  ),
255
277
  ),
@@ -298,8 +320,8 @@ const ChatPrompt = ({
298
320
  />
299
321
  </div>
300
322
 
301
- {settings && (
302
- <div role='none' className='flex pbs-2 items-center'>
323
+ {space && settings && (
324
+ <div role='none' className='flex pbs-2 items-center overflow-hidden'>
303
325
  <ChatOptions
304
326
  space={space}
305
327
  blueprintRegistry={processor.blueprintRegistry}
@@ -309,7 +331,7 @@ const ChatPrompt = ({
309
331
  onPresetChange={onPresetChange}
310
332
  />
311
333
 
312
- <div role='none' className='pli-cardSpacingChrome grow'>
334
+ <div role='none' className='flex grow overflow-x-auto scrollbar-none'>
313
335
  <ChatReferences space={space} context={processor.context} />
314
336
  </div>
315
337
 
@@ -320,10 +342,11 @@ const ChatPrompt = ({
320
342
  processing={streaming}
321
343
  onEvent={handleEvent}
322
344
  >
345
+ {/* TODO(burdon): Move switch into dialog. */}
323
346
  {online !== undefined && (
324
347
  <Input.Root>
325
348
  <Input.Label srOnly>{t('online switch label')}</Input.Label>
326
- <Input.Switch classNames='mis-2 mie-2' checked={online} onCheckedChange={onOnlineChange} />
349
+ <Input.Switch classNames='mli-2' checked={online} onCheckedChange={onOnlineChange} />
327
350
  </Input.Root>
328
351
  )}
329
352
  </ChatActions>
@@ -342,17 +365,23 @@ ChatPrompt.displayName = 'Chat.Prompt';
342
365
  type ChatThreadProps = Omit<NaturalChatThreadProps, 'identity' | 'messages' | 'tools'>;
343
366
 
344
367
  const ChatThread = (props: ChatThreadProps) => {
345
- const { event, messages, processor } = useChatContext(ChatThread.displayName);
368
+ const { debug, event, messages, processor } = useChatContext(ChatThread.displayName);
346
369
  const identity = useIdentity();
347
- const error = useRxValue(processor.error).pipe(Option.getOrUndefined);
370
+ const error = useAtomValue(processor.error).pipe(Option.getOrUndefined);
348
371
 
349
- const scrollerRef = useRef<ChatThreadController | null>(null);
372
+ const controllerRef = useRef<MarkdownStreamController | null>(null);
350
373
  useEffect(() => {
351
374
  return event.on((event) => {
352
375
  switch (event.type) {
353
376
  case 'submit':
354
377
  case 'scroll-to-bottom':
355
- scrollerRef.current?.scrollToBottom();
378
+ controllerRef.current?.scrollToBottom();
379
+ break;
380
+ case 'nav-previous':
381
+ controllerRef.current?.navigatePrevious();
382
+ break;
383
+ case 'nav-next':
384
+ controllerRef.current?.navigateNext();
356
385
  break;
357
386
  }
358
387
  });
@@ -372,25 +401,50 @@ const ChatThread = (props: ChatThreadProps) => {
372
401
  return (
373
402
  <NaturalChatThread
374
403
  {...props}
375
- ref={scrollerRef}
376
404
  identity={identity}
377
405
  messages={messages}
378
406
  error={error}
407
+ debug={debug}
379
408
  onEvent={handleEvent}
409
+ ref={controllerRef}
380
410
  />
381
411
  );
382
412
  };
383
413
 
384
414
  ChatThread.displayName = 'Chat.Thread';
385
415
 
416
+ //
417
+ // Toolbar
418
+ //
419
+
420
+ type ChatToolbarProps = ThemedClassName<{ companionTo?: Obj.Any }>;
421
+
422
+ const ChatToolbar = ({ classNames, companionTo }: ChatToolbarProps) => {
423
+ const { chat } = useChatContext(ChatToolbar.displayName);
424
+ const menu = useChatToolbarActions({ chat, companionTo });
425
+
426
+ return (
427
+ <MenuProvider
428
+ {...menu}
429
+ attendableId={companionTo ? Obj.getDXN(companionTo).toString() : chat ? Obj.getDXN(chat).toString() : ''}
430
+ >
431
+ <ToolbarMenu classNames={classNames} textBlockWidth />
432
+ </MenuProvider>
433
+ );
434
+ };
435
+
436
+ ChatToolbar.displayName = 'Chat.Toolbar';
437
+
386
438
  //
387
439
  // Chat
388
440
  //
389
441
 
390
442
  export const Chat = {
391
443
  Root: ChatRoot,
444
+ Viewport: ChatViewport,
392
445
  Prompt: ChatPrompt,
393
446
  Thread: ChatThread,
447
+ Toolbar: ChatToolbar,
394
448
  };
395
449
 
396
- export type { ChatRootProps, ChatThreadProps, ChatPromptProps, ChatEvent };
450
+ export type { ChatRootProps, ChatViewportProps, ChatThreadProps, ChatPromptProps, ChatToolbarProps, ChatEvent };
@@ -43,6 +43,12 @@ export type ChatEvent =
43
43
  | {
44
44
  type: 'scroll-to-bottom';
45
45
  }
46
+ | {
47
+ type: 'nav-previous';
48
+ }
49
+ | {
50
+ type: 'nav-next';
51
+ }
46
52
  | {
47
53
  type: 'thread-open';
48
54
  }