@dxos/plugin-assistant 0.8.4-main.1da679c → 0.8.4-main.21d9917

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 (619) hide show
  1. package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs +31 -0
  2. package/dist/lib/browser/BlueprintArticle-WP3G5GLG.mjs.map +7 -0
  3. package/dist/lib/browser/ChatCompanion-GFSJZTOT.mjs +153 -0
  4. package/dist/lib/browser/ChatCompanion-GFSJZTOT.mjs.map +7 -0
  5. package/dist/lib/browser/ChatContainer-IHAPBIZE.mjs +72 -0
  6. package/dist/lib/browser/ChatContainer-IHAPBIZE.mjs.map +7 -0
  7. package/dist/lib/browser/ChatDialog-EGRMPCTL.mjs +85 -0
  8. package/dist/lib/browser/ChatDialog-EGRMPCTL.mjs.map +7 -0
  9. package/dist/lib/browser/PromptArticle-K362ZPAE.mjs +53 -0
  10. package/dist/lib/browser/PromptArticle-K362ZPAE.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-5GUDOEWF.mjs +21 -0
  12. package/dist/lib/browser/ai-service-5GUDOEWF.mjs.map +7 -0
  13. package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs +212 -0
  14. package/dist/lib/browser/app-graph-builder-DSNH2OMY.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-DGHH7MUU.mjs +14 -0
  16. package/dist/lib/browser/blueprints/index.mjs +12 -0
  17. package/dist/lib/browser/chunk-A75V4MOQ.mjs +1832 -0
  18. package/dist/lib/browser/chunk-A75V4MOQ.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-DKQMSMBN.mjs +326 -0
  20. package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-EXVT7D4B.mjs +23 -0
  22. package/dist/lib/browser/chunk-EXVT7D4B.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-ML3QCFKA.mjs +265 -0
  24. package/dist/lib/browser/chunk-ML3QCFKA.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-MRJVYGLU.mjs +208 -0
  26. package/dist/lib/browser/chunk-MRJVYGLU.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-V772AMZM.mjs +250 -0
  28. package/dist/lib/browser/chunk-V772AMZM.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-WGQTU6UJ.mjs +41 -0
  30. package/dist/lib/browser/chunk-WGQTU6UJ.mjs.map +7 -0
  31. package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs +20 -0
  32. package/dist/lib/browser/edge-model-resolver-26BOY6HY.mjs.map +7 -0
  33. package/dist/lib/browser/index.mjs +229 -216
  34. package/dist/lib/browser/index.mjs.map +4 -4
  35. package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs +19 -0
  36. package/dist/lib/browser/local-model-resolver-ZFIM6GGV.mjs.map +7 -0
  37. package/dist/lib/browser/meta.json +1 -1
  38. package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs +132 -0
  39. package/dist/lib/browser/operation-resolver-7XJLBRQY.mjs.map +7 -0
  40. package/dist/lib/browser/react-surface-S7SBFOSW.mjs +109 -0
  41. package/dist/lib/browser/react-surface-S7SBFOSW.mjs.map +7 -0
  42. package/dist/lib/browser/repair-6QGAKOVM.mjs +54 -0
  43. package/dist/lib/browser/repair-6QGAKOVM.mjs.map +7 -0
  44. package/dist/lib/browser/settings-4ZDLUMYE.mjs +32 -0
  45. package/dist/lib/browser/settings-4ZDLUMYE.mjs.map +7 -0
  46. package/dist/lib/browser/state-AN6336ZX.mjs +26 -0
  47. package/dist/lib/browser/state-AN6336ZX.mjs.map +7 -0
  48. package/dist/lib/browser/toolkit-7AVTEPMA.mjs +18 -0
  49. package/dist/lib/browser/toolkit-7AVTEPMA.mjs.map +7 -0
  50. package/dist/lib/browser/types/index.mjs +8 -4
  51. package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs +32 -0
  52. package/dist/lib/node-esm/BlueprintArticle-WZ76E2C4.mjs.map +7 -0
  53. package/dist/lib/node-esm/ChatCompanion-UR7DXZ54.mjs +154 -0
  54. package/dist/lib/node-esm/ChatCompanion-UR7DXZ54.mjs.map +7 -0
  55. package/dist/lib/node-esm/ChatContainer-YMLLGOZK.mjs +73 -0
  56. package/dist/lib/node-esm/ChatContainer-YMLLGOZK.mjs.map +7 -0
  57. package/dist/lib/node-esm/ChatDialog-D24WJPK4.mjs +86 -0
  58. package/dist/lib/node-esm/ChatDialog-D24WJPK4.mjs.map +7 -0
  59. package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs +54 -0
  60. package/dist/lib/node-esm/PromptArticle-D4HAIIC6.mjs.map +7 -0
  61. package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs +22 -0
  62. package/dist/lib/node-esm/ai-service-PXKKCFIF.mjs.map +7 -0
  63. package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs +213 -0
  64. package/dist/lib/node-esm/app-graph-builder-TJCUEXW5.mjs.map +7 -0
  65. package/dist/lib/node-esm/{blueprint-definition-B6UDX5U3.mjs → blueprint-definition-SEMDEIYG.mjs} +6 -4
  66. package/dist/lib/node-esm/blueprint-definition-SEMDEIYG.mjs.map +7 -0
  67. package/dist/lib/node-esm/blueprints/index.mjs +13 -0
  68. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-355W5B27.mjs +251 -0
  70. package/dist/lib/node-esm/chunk-355W5B27.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-4BERCIES.mjs +1833 -0
  72. package/dist/lib/node-esm/chunk-4BERCIES.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-75PHXBN3.mjs +327 -0
  74. package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-DCA5QWQT.mjs +209 -0
  76. package/dist/lib/node-esm/chunk-DCA5QWQT.mjs.map +7 -0
  77. package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs +42 -0
  78. package/dist/lib/node-esm/chunk-MSBPC4RJ.mjs.map +7 -0
  79. package/dist/lib/node-esm/chunk-POWB2BPC.mjs +25 -0
  80. package/dist/lib/node-esm/chunk-POWB2BPC.mjs.map +7 -0
  81. package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs +267 -0
  82. package/dist/lib/node-esm/chunk-ZRIPP7YF.mjs.map +7 -0
  83. package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs +21 -0
  84. package/dist/lib/node-esm/edge-model-resolver-G5KMODPO.mjs.map +7 -0
  85. package/dist/lib/node-esm/index.mjs +229 -216
  86. package/dist/lib/node-esm/index.mjs.map +4 -4
  87. package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs +20 -0
  88. package/dist/lib/node-esm/local-model-resolver-KDZLYI7Y.mjs.map +7 -0
  89. package/dist/lib/node-esm/meta.json +1 -1
  90. package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs +133 -0
  91. package/dist/lib/node-esm/operation-resolver-SX4WMNA7.mjs.map +7 -0
  92. package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs +110 -0
  93. package/dist/lib/node-esm/react-surface-ZR6FXGLF.mjs.map +7 -0
  94. package/dist/lib/node-esm/repair-QJ7CQDKU.mjs +55 -0
  95. package/dist/lib/node-esm/repair-QJ7CQDKU.mjs.map +7 -0
  96. package/dist/lib/node-esm/settings-CQEOHR3R.mjs +33 -0
  97. package/dist/lib/node-esm/settings-CQEOHR3R.mjs.map +7 -0
  98. package/dist/lib/node-esm/state-HDON4REW.mjs +27 -0
  99. package/dist/lib/node-esm/state-HDON4REW.mjs.map +7 -0
  100. package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs +19 -0
  101. package/dist/lib/node-esm/toolkit-OWGCEKOO.mjs.map +7 -0
  102. package/dist/lib/node-esm/types/index.mjs +8 -4
  103. package/dist/types/src/AssistantPlugin.d.ts +2 -1
  104. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  105. package/dist/types/src/blueprints/assistant-blueprint.d.ts +209 -0
  106. package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +1 -0
  107. package/dist/types/src/blueprints/index.d.ts +7 -0
  108. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  109. package/dist/types/src/capabilities/ai-service/ai-service.d.ts +5 -0
  110. package/dist/types/src/capabilities/ai-service/ai-service.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/ai-service/index.d.ts +3 -0
  112. package/dist/types/src/capabilities/ai-service/index.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  114. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  116. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +21 -0
  118. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +4 -0
  120. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  121. package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +6 -0
  122. package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -0
  123. package/dist/types/src/capabilities/edge-model-resolver/index.d.ts +3 -0
  124. package/dist/types/src/capabilities/edge-model-resolver/index.d.ts.map +1 -0
  125. package/dist/types/src/capabilities/index.d.ts +10 -11
  126. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  127. package/dist/types/src/capabilities/local-model-resolver/index.d.ts +3 -0
  128. package/dist/types/src/capabilities/local-model-resolver/index.d.ts.map +1 -0
  129. package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +12 -0
  130. package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -0
  131. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  132. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  133. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  134. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  135. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  136. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  137. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  138. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  139. package/dist/types/src/capabilities/repair/index.d.ts +3 -0
  140. package/dist/types/src/capabilities/repair/index.d.ts.map +1 -0
  141. package/dist/types/src/capabilities/repair/repair.d.ts +6 -0
  142. package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -0
  143. package/dist/types/src/capabilities/settings/index.d.ts +15 -0
  144. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  145. package/dist/types/src/capabilities/settings/settings.d.ts +17 -0
  146. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  147. package/dist/types/src/capabilities/state/index.d.ts +11 -0
  148. package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
  149. package/dist/types/src/capabilities/state/state.d.ts +13 -0
  150. package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
  151. package/dist/types/src/capabilities/toolkit/index.d.ts +3 -0
  152. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -0
  153. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +5 -0
  154. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -0
  155. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts +4 -2
  156. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  157. package/dist/types/src/components/BlueprintArticle.d.ts +7 -0
  158. package/dist/types/src/components/BlueprintArticle.d.ts.map +1 -0
  159. package/dist/types/src/components/Chat/Chat.d.ts +23 -13
  160. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  161. package/dist/types/src/components/Chat/events.d.ts +5 -1
  162. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  163. package/dist/types/src/components/ChatCompanion.d.ts +2 -2
  164. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -1
  165. package/dist/types/src/components/ChatContainer.d.ts +13 -5
  166. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  167. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  168. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -1
  169. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  170. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +3 -3
  171. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  172. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
  173. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  174. package/dist/types/src/components/ChatThread/ChatThread.d.ts +7 -8
  175. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  176. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +133 -74
  177. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  178. package/dist/types/src/components/ChatThread/reducers.d.ts +5 -5
  179. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -1
  180. package/dist/types/src/components/ChatThread/registry.d.ts +1 -1
  181. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
  182. package/dist/types/src/components/ChatThread/sync.d.ts +12 -6
  183. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
  184. package/dist/types/src/components/PromptArticle.d.ts +7 -0
  185. package/dist/types/src/components/PromptArticle.d.ts.map +1 -0
  186. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
  187. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  188. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +116 -61
  189. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  190. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +12 -2
  191. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  192. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +117 -62
  193. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  194. package/dist/types/src/components/TemplateEditor/extensions/handlebars-extension.d.ts.map +1 -0
  195. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts +3 -0
  196. package/dist/types/src/components/TemplateEditor/extensions/index.d.ts.map +1 -0
  197. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts +8 -0
  198. package/dist/types/src/components/TemplateEditor/extensions/xml-extension.d.ts.map +1 -0
  199. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +10 -8
  200. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -1
  201. package/dist/types/src/components/Toolbox/Toolbox.d.ts +6 -7
  202. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  203. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +116 -61
  204. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  205. package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +12 -0
  206. package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -0
  207. package/dist/types/src/components/Typewriter/Typewriter.d.ts +11 -0
  208. package/dist/types/src/components/Typewriter/Typewriter.d.ts.map +1 -0
  209. package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts +7 -0
  210. package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -0
  211. package/dist/types/src/components/Typewriter/assistant-extension.d.ts +5 -0
  212. package/dist/types/src/components/Typewriter/assistant-extension.d.ts.map +1 -0
  213. package/dist/types/src/components/Typewriter/index.d.ts +2 -0
  214. package/dist/types/src/components/Typewriter/index.d.ts.map +1 -0
  215. package/dist/types/src/components/index.d.ts +10 -9
  216. package/dist/types/src/components/index.d.ts.map +1 -1
  217. package/dist/types/src/functions/index.d.ts +3 -3
  218. package/dist/types/src/functions/index.d.ts.map +1 -1
  219. package/dist/types/src/functions/{list.d.ts → object-list.d.ts} +3 -3
  220. package/dist/types/src/functions/object-list.d.ts.map +1 -0
  221. package/dist/types/src/functions/{load.d.ts → object-load.d.ts} +2 -2
  222. package/dist/types/src/functions/object-load.d.ts.map +1 -0
  223. package/dist/types/src/functions/object-search.d.ts +10 -0
  224. package/dist/types/src/functions/object-search.d.ts.map +1 -0
  225. package/dist/types/src/hooks/index.d.ts +2 -2
  226. package/dist/types/src/hooks/index.d.ts.map +1 -1
  227. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -4
  228. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  229. package/dist/types/src/hooks/useChatProcessor.d.ts +4 -2
  230. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  231. package/dist/types/src/hooks/useChatServices.d.ts +4 -4
  232. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  233. package/dist/types/src/hooks/useChatToolbarActions.d.ts +8 -0
  234. package/dist/types/src/hooks/useChatToolbarActions.d.ts.map +1 -0
  235. package/dist/types/src/hooks/useContextBinder.d.ts +2 -2
  236. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -1
  237. package/dist/types/src/hooks/useContextObjects.d.ts +7 -7
  238. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -1
  239. package/dist/types/src/hooks/useFilteredTypes.d.ts +3 -0
  240. package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -0
  241. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  242. package/dist/types/src/index.d.ts +2 -1
  243. package/dist/types/src/index.d.ts.map +1 -1
  244. package/dist/types/src/meta.d.ts +3 -4
  245. package/dist/types/src/meta.d.ts.map +1 -1
  246. package/dist/types/src/processor/index.d.ts +1 -0
  247. package/dist/types/src/processor/index.d.ts.map +1 -1
  248. package/dist/types/src/processor/presets.d.ts +1 -1
  249. package/dist/types/src/processor/presets.d.ts.map +1 -1
  250. package/dist/types/src/processor/processor.d.ts +19 -17
  251. package/dist/types/src/processor/processor.d.ts.map +1 -1
  252. package/dist/types/src/processor/update-name.d.ts +10 -0
  253. package/dist/types/src/processor/update-name.d.ts.map +1 -0
  254. package/dist/types/src/queue-logger.d.ts.map +1 -1
  255. package/dist/types/src/testing/index.d.ts +0 -2
  256. package/dist/types/src/testing/index.d.ts.map +1 -1
  257. package/dist/types/src/testing/test-generator.d.ts +6 -5
  258. package/dist/types/src/testing/test-generator.d.ts.map +1 -1
  259. package/dist/types/src/testing/test-services.d.ts +2 -2
  260. package/dist/types/src/testing/test-services.d.ts.map +1 -1
  261. package/dist/types/src/translations.d.ts +244 -26
  262. package/dist/types/src/translations.d.ts.map +1 -1
  263. package/dist/types/src/types/Assistant.d.ts +20 -20
  264. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  265. package/dist/types/src/types/AssistantAction.d.ts +89 -101
  266. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  267. package/dist/types/src/types/capabilities.d.ts +33 -0
  268. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  269. package/dist/types/src/types/events.d.ts +5 -0
  270. package/dist/types/src/types/events.d.ts.map +1 -0
  271. package/dist/types/src/types/index.d.ts +3 -1
  272. package/dist/types/src/types/index.d.ts.map +1 -1
  273. package/dist/types/src/types/service.d.ts +14 -216
  274. package/dist/types/src/types/service.d.ts.map +1 -1
  275. package/dist/types/tsconfig.tsbuildinfo +1 -1
  276. package/package.json +118 -117
  277. package/src/AssistantPlugin.tsx +114 -146
  278. package/src/blueprints/assistant-blueprint.ts +62 -0
  279. package/src/blueprints/index.ts +12 -0
  280. package/src/capabilities/ai-service/ai-service.ts +29 -0
  281. package/src/capabilities/ai-service/index.ts +7 -0
  282. package/src/capabilities/app-graph-builder/app-graph-builder.ts +180 -0
  283. package/src/capabilities/app-graph-builder/index.ts +7 -0
  284. package/src/capabilities/blueprint-definition/blueprint-definition.ts +60 -0
  285. package/src/capabilities/blueprint-definition/index.ts +8 -0
  286. package/src/capabilities/edge-model-resolver/edge-model-resolver.ts +32 -0
  287. package/src/capabilities/edge-model-resolver/index.ts +7 -0
  288. package/src/capabilities/index.ts +10 -14
  289. package/src/capabilities/local-model-resolver/index.ts +7 -0
  290. package/src/capabilities/local-model-resolver/local-model-resolver.ts +37 -0
  291. package/src/capabilities/operation-resolver/index.ts +7 -0
  292. package/src/capabilities/operation-resolver/operation-resolver.ts +110 -0
  293. package/src/capabilities/react-surface/index.ts +7 -0
  294. package/src/capabilities/react-surface/react-surface.tsx +95 -0
  295. package/src/capabilities/repair/index.ts +7 -0
  296. package/src/capabilities/repair/repair.ts +63 -0
  297. package/src/capabilities/settings/index.ts +7 -0
  298. package/src/capabilities/settings/settings.ts +30 -0
  299. package/src/capabilities/state/index.ts +7 -0
  300. package/src/capabilities/state/state.ts +27 -0
  301. package/src/capabilities/toolkit/index.ts +7 -0
  302. package/src/capabilities/toolkit/toolkit.ts +26 -0
  303. package/src/components/AssistantSettings/AssistantSettings.tsx +13 -5
  304. package/src/components/BlueprintArticle.tsx +29 -0
  305. package/src/components/Chat/Chat.tsx +193 -151
  306. package/src/components/Chat/events.ts +7 -1
  307. package/src/components/ChatCompanion.tsx +143 -91
  308. package/src/components/ChatContainer.tsx +40 -30
  309. package/src/components/ChatDialog.tsx +13 -7
  310. package/src/components/ChatProgress/ChatProgress.tsx +4 -18
  311. package/src/components/ChatPrompt/ChatActions.tsx +3 -5
  312. package/src/components/ChatPrompt/ChatOptions.tsx +104 -99
  313. package/src/components/ChatPrompt/ChatReferences.tsx +7 -8
  314. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +1 -1
  315. package/src/components/ChatThread/ChatThread.stories.tsx +62 -42
  316. package/src/components/ChatThread/ChatThread.tsx +29 -35
  317. package/src/components/ChatThread/Link.tsx +3 -3
  318. package/src/components/ChatThread/reducers.ts +6 -6
  319. package/src/components/ChatThread/registry.tsx +26 -41
  320. package/src/components/ChatThread/sync.test.ts +33 -18
  321. package/src/components/ChatThread/sync.ts +54 -13
  322. package/src/components/ChatThread/testing/thread.md +37 -0
  323. package/src/components/PromptArticle.tsx +50 -0
  324. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +16 -8
  325. package/src/components/TemplateEditor/TemplateEditor.tsx +24 -12
  326. package/src/components/TemplateEditor/TemplateForm.stories.tsx +17 -11
  327. package/src/components/TemplateEditor/TemplateForm.tsx +77 -30
  328. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +274 -0
  329. package/src/components/TemplateEditor/extensions/index.ts +6 -0
  330. package/src/components/TemplateEditor/extensions/xml-extension.ts +64 -0
  331. package/src/components/ToolBlock/ToolBlock.tsx +40 -49
  332. package/src/components/Toolbox/Toolbox.stories.tsx +11 -15
  333. package/src/components/Toolbox/Toolbox.tsx +18 -19
  334. package/src/components/Typewriter/AssistantToolbar.tsx +161 -0
  335. package/src/components/Typewriter/Typewriter.stories.tsx +83 -0
  336. package/src/components/Typewriter/Typewriter.tsx +54 -0
  337. package/src/components/Typewriter/assistant-extension.tsx +144 -0
  338. package/src/components/Typewriter/index.ts +5 -0
  339. package/src/components/index.ts +2 -5
  340. package/src/functions/index.ts +3 -3
  341. package/src/functions/{list.ts → object-list.ts} +10 -7
  342. package/src/functions/{load.ts → object-load.ts} +15 -10
  343. package/src/functions/object-search.ts +46 -0
  344. package/src/hooks/index.ts +2 -2
  345. package/src/hooks/useBlueprintRegistry.ts +44 -19
  346. package/src/hooks/useChatProcessor.ts +25 -14
  347. package/src/hooks/useChatServices.ts +16 -17
  348. package/src/hooks/useChatToolbarActions.ts +121 -0
  349. package/src/hooks/useContextBinder.ts +21 -7
  350. package/src/hooks/useContextObjects.ts +13 -25
  351. package/src/hooks/useFilteredTypes.ts +37 -0
  352. package/src/hooks/useReferencesProvider.ts +7 -6
  353. package/src/index.ts +2 -1
  354. package/src/meta.ts +11 -8
  355. package/src/processor/index.ts +1 -0
  356. package/src/processor/presets.ts +2 -2
  357. package/src/processor/processor.test.ts +19 -24
  358. package/src/processor/processor.ts +51 -78
  359. package/src/processor/update-name.ts +59 -0
  360. package/src/queue-logger.ts +8 -9
  361. package/src/testing/index.ts +0 -2
  362. package/src/testing/test-generator.ts +19 -14
  363. package/src/testing/test-services.ts +10 -14
  364. package/src/translations.ts +28 -16
  365. package/src/types/Assistant.ts +13 -12
  366. package/src/types/AssistantAction.ts +65 -52
  367. package/src/types/capabilities.ts +27 -0
  368. package/src/types/events.ts +11 -0
  369. package/src/types/index.ts +3 -1
  370. package/src/types/service.ts +25 -14
  371. package/dist/lib/browser/BlueprintContainer-6MZHBQ25.mjs +0 -29
  372. package/dist/lib/browser/BlueprintContainer-6MZHBQ25.mjs.map +0 -7
  373. package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs +0 -124
  374. package/dist/lib/browser/ChatCompanion-B4DLQE6Y.mjs.map +0 -7
  375. package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs +0 -73
  376. package/dist/lib/browser/ChatContainer-Z7A3RKOY.mjs.map +0 -7
  377. package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs +0 -86
  378. package/dist/lib/browser/ChatDialog-PL5TSGD5.mjs.map +0 -7
  379. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs +0 -150
  380. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +0 -7
  381. package/dist/lib/browser/ai-service-4VESSFNB.mjs +0 -18
  382. package/dist/lib/browser/ai-service-4VESSFNB.mjs.map +0 -7
  383. package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs +0 -153
  384. package/dist/lib/browser/app-graph-builder-BBDHBJXA.mjs.map +0 -7
  385. package/dist/lib/browser/blueprint-definition-3SATLYJW.mjs +0 -12
  386. package/dist/lib/browser/chunk-BBT6KNXA.mjs +0 -165
  387. package/dist/lib/browser/chunk-BBT6KNXA.mjs.map +0 -7
  388. package/dist/lib/browser/chunk-JDI4FEKA.mjs +0 -299
  389. package/dist/lib/browser/chunk-JDI4FEKA.mjs.map +0 -7
  390. package/dist/lib/browser/chunk-O4LUJEDV.mjs +0 -20
  391. package/dist/lib/browser/chunk-O4LUJEDV.mjs.map +0 -7
  392. package/dist/lib/browser/chunk-PQI3MGDN.mjs +0 -169
  393. package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +0 -7
  394. package/dist/lib/browser/chunk-SMIVXXAI.mjs +0 -202
  395. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +0 -7
  396. package/dist/lib/browser/chunk-TMKK6VCA.mjs +0 -216
  397. package/dist/lib/browser/chunk-TMKK6VCA.mjs.map +0 -7
  398. package/dist/lib/browser/chunk-YKODYEYR.mjs +0 -16
  399. package/dist/lib/browser/chunk-YKODYEYR.mjs.map +0 -7
  400. package/dist/lib/browser/chunk-YOBHCEEI.mjs +0 -1941
  401. package/dist/lib/browser/chunk-YOBHCEEI.mjs.map +0 -7
  402. package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs +0 -18
  403. package/dist/lib/browser/edge-model-resolver-6YWYDPTS.mjs.map +0 -7
  404. package/dist/lib/browser/intent-resolver-MRZJU255.mjs +0 -112
  405. package/dist/lib/browser/intent-resolver-MRZJU255.mjs.map +0 -7
  406. package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs +0 -17
  407. package/dist/lib/browser/local-model-resolver-QXLLTV2H.mjs.map +0 -7
  408. package/dist/lib/browser/react-surface-UKMOARXR.mjs +0 -107
  409. package/dist/lib/browser/react-surface-UKMOARXR.mjs.map +0 -7
  410. package/dist/lib/browser/settings-4AJ34FKF.mjs +0 -23
  411. package/dist/lib/browser/settings-4AJ34FKF.mjs.map +0 -7
  412. package/dist/lib/browser/state-ABR7YSSA.mjs +0 -21
  413. package/dist/lib/browser/state-ABR7YSSA.mjs.map +0 -7
  414. package/dist/lib/browser/toolkit-U7SKGAIC.mjs +0 -191
  415. package/dist/lib/browser/toolkit-U7SKGAIC.mjs.map +0 -7
  416. package/dist/lib/node-esm/BlueprintContainer-MUHW5HNY.mjs +0 -30
  417. package/dist/lib/node-esm/BlueprintContainer-MUHW5HNY.mjs.map +0 -7
  418. package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs +0 -125
  419. package/dist/lib/node-esm/ChatCompanion-DK6FULBU.mjs.map +0 -7
  420. package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs +0 -74
  421. package/dist/lib/node-esm/ChatContainer-7IN7ZICQ.mjs.map +0 -7
  422. package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs +0 -87
  423. package/dist/lib/node-esm/ChatDialog-LPE653RZ.mjs.map +0 -7
  424. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs +0 -151
  425. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +0 -7
  426. package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs +0 -19
  427. package/dist/lib/node-esm/ai-service-I5JU4JN2.mjs.map +0 -7
  428. package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs +0 -154
  429. package/dist/lib/node-esm/app-graph-builder-EMR5JF6Z.mjs.map +0 -7
  430. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +0 -170
  431. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +0 -7
  432. package/dist/lib/node-esm/chunk-5MYWJPYA.mjs +0 -167
  433. package/dist/lib/node-esm/chunk-5MYWJPYA.mjs.map +0 -7
  434. package/dist/lib/node-esm/chunk-7YOGZI66.mjs +0 -203
  435. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +0 -7
  436. package/dist/lib/node-esm/chunk-FHRJMZ7L.mjs +0 -17
  437. package/dist/lib/node-esm/chunk-FHRJMZ7L.mjs.map +0 -7
  438. package/dist/lib/node-esm/chunk-GCNF3CQU.mjs +0 -217
  439. package/dist/lib/node-esm/chunk-GCNF3CQU.mjs.map +0 -7
  440. package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs +0 -300
  441. package/dist/lib/node-esm/chunk-H3ZC4UL7.mjs.map +0 -7
  442. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +0 -22
  443. package/dist/lib/node-esm/chunk-VFY2JG62.mjs.map +0 -7
  444. package/dist/lib/node-esm/chunk-X2YUKRBE.mjs +0 -1942
  445. package/dist/lib/node-esm/chunk-X2YUKRBE.mjs.map +0 -7
  446. package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs +0 -19
  447. package/dist/lib/node-esm/edge-model-resolver-A7B6QHLL.mjs.map +0 -7
  448. package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs +0 -113
  449. package/dist/lib/node-esm/intent-resolver-CIXO3KMY.mjs.map +0 -7
  450. package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs +0 -18
  451. package/dist/lib/node-esm/local-model-resolver-JCYDHAZY.mjs.map +0 -7
  452. package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs +0 -108
  453. package/dist/lib/node-esm/react-surface-5NDJAWA2.mjs.map +0 -7
  454. package/dist/lib/node-esm/settings-K2QW4ATZ.mjs +0 -24
  455. package/dist/lib/node-esm/settings-K2QW4ATZ.mjs.map +0 -7
  456. package/dist/lib/node-esm/state-6UHESJI5.mjs +0 -22
  457. package/dist/lib/node-esm/state-6UHESJI5.mjs.map +0 -7
  458. package/dist/lib/node-esm/toolkit-LNLRBVDU.mjs +0 -192
  459. package/dist/lib/node-esm/toolkit-LNLRBVDU.mjs.map +0 -7
  460. package/dist/types/src/capabilities/ai-service.d.ts +0 -4
  461. package/dist/types/src/capabilities/ai-service.d.ts.map +0 -1
  462. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  463. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  464. package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -7
  465. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
  466. package/dist/types/src/capabilities/capabilities.d.ts +0 -11
  467. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  468. package/dist/types/src/capabilities/edge-model-resolver.d.ts +0 -4
  469. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +0 -1
  470. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  471. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  472. package/dist/types/src/capabilities/local-model-resolver.d.ts +0 -10
  473. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +0 -1
  474. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  475. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  476. package/dist/types/src/capabilities/settings.d.ts +0 -4
  477. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  478. package/dist/types/src/capabilities/state.d.ts +0 -4
  479. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  480. package/dist/types/src/capabilities/toolkit.d.ts +0 -4
  481. package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
  482. package/dist/types/src/components/BlueprintContainer.d.ts +0 -8
  483. package/dist/types/src/components/BlueprintContainer.d.ts.map +0 -1
  484. package/dist/types/src/components/PromptSettings.d.ts +0 -6
  485. package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
  486. package/dist/types/src/components/SequenceContainer.d.ts +0 -8
  487. package/dist/types/src/components/SequenceContainer.d.ts.map +0 -1
  488. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +0 -13
  489. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +0 -1
  490. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +0 -267
  491. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +0 -1
  492. package/dist/types/src/components/SequenceEditor/index.d.ts +0 -2
  493. package/dist/types/src/components/SequenceEditor/index.d.ts.map +0 -1
  494. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +0 -1
  495. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -5
  496. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  497. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  498. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  499. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +0 -11
  500. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +0 -1
  501. package/dist/types/src/events.d.ts +0 -4
  502. package/dist/types/src/events.d.ts.map +0 -1
  503. package/dist/types/src/execution-graph/execution-graph.d.ts +0 -21
  504. package/dist/types/src/execution-graph/execution-graph.d.ts.map +0 -1
  505. package/dist/types/src/execution-graph/index.d.ts +0 -2
  506. package/dist/types/src/execution-graph/index.d.ts.map +0 -1
  507. package/dist/types/src/functions/analysis.d.ts +0 -5
  508. package/dist/types/src/functions/analysis.d.ts.map +0 -1
  509. package/dist/types/src/functions/list.d.ts.map +0 -1
  510. package/dist/types/src/functions/load.d.ts.map +0 -1
  511. package/dist/types/src/hooks/useExecutionGraph.d.ts +0 -6
  512. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +0 -1
  513. package/dist/types/src/hooks/useItemTypes.d.ts +0 -4
  514. package/dist/types/src/hooks/useItemTypes.d.ts.map +0 -1
  515. package/dist/types/src/stories/Chat.stories.d.ts +0 -31
  516. package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
  517. package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -4
  518. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
  519. package/dist/types/src/stories/components/ChatContainer.d.ts +0 -4
  520. package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
  521. package/dist/types/src/stories/components/ChessContainer.d.ts +0 -4
  522. package/dist/types/src/stories/components/ChessContainer.d.ts.map +0 -1
  523. package/dist/types/src/stories/components/CommentsContainer.d.ts +0 -4
  524. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +0 -1
  525. package/dist/types/src/stories/components/DebugCard.d.ts +0 -8
  526. package/dist/types/src/stories/components/DebugCard.d.ts.map +0 -1
  527. package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
  528. package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
  529. package/dist/types/src/stories/components/InvocationsContainer.d.ts +0 -4
  530. package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +0 -1
  531. package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -7
  532. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
  533. package/dist/types/src/stories/components/MessageContainer.d.ts +0 -4
  534. package/dist/types/src/stories/components/MessageContainer.d.ts.map +0 -1
  535. package/dist/types/src/stories/components/ProjectContainer.d.ts +0 -4
  536. package/dist/types/src/stories/components/ProjectContainer.d.ts.map +0 -1
  537. package/dist/types/src/stories/components/PromptContainer.d.ts +0 -6
  538. package/dist/types/src/stories/components/PromptContainer.d.ts.map +0 -1
  539. package/dist/types/src/stories/components/ResearchInputStack.d.ts +0 -4
  540. package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +0 -1
  541. package/dist/types/src/stories/components/ResearchOutputStack.d.ts +0 -4
  542. package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +0 -1
  543. package/dist/types/src/stories/components/TasksContainer.d.ts +0 -4
  544. package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
  545. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +0 -3
  546. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +0 -1
  547. package/dist/types/src/stories/components/TriggersContainer.d.ts +0 -3
  548. package/dist/types/src/stories/components/TriggersContainer.d.ts.map +0 -1
  549. package/dist/types/src/stories/components/index.d.ts +0 -17
  550. package/dist/types/src/stories/components/index.d.ts.map +0 -1
  551. package/dist/types/src/stories/components/types.d.ts +0 -7
  552. package/dist/types/src/stories/components/types.d.ts.map +0 -1
  553. package/dist/types/src/stories/testing/data.d.ts +0 -9
  554. package/dist/types/src/stories/testing/data.d.ts.map +0 -1
  555. package/dist/types/src/stories/testing/index.d.ts +0 -3
  556. package/dist/types/src/stories/testing/index.d.ts.map +0 -1
  557. package/dist/types/src/stories/testing/schema.d.ts +0 -7
  558. package/dist/types/src/stories/testing/schema.d.ts.map +0 -1
  559. package/dist/types/src/stories/testing/testing.d.ts +0 -48
  560. package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
  561. package/dist/types/src/testing/test-data.d.ts +0 -14
  562. package/dist/types/src/testing/test-data.d.ts.map +0 -1
  563. package/dist/types/src/testing/test-functions.d.ts +0 -6
  564. package/dist/types/src/testing/test-functions.d.ts.map +0 -1
  565. package/src/capabilities/ai-service.ts +0 -26
  566. package/src/capabilities/app-graph-builder.ts +0 -162
  567. package/src/capabilities/blueprint-definition.ts +0 -61
  568. package/src/capabilities/capabilities.ts +0 -18
  569. package/src/capabilities/edge-model-resolver.ts +0 -25
  570. package/src/capabilities/intent-resolver.ts +0 -94
  571. package/src/capabilities/local-model-resolver.ts +0 -30
  572. package/src/capabilities/react-surface.tsx +0 -91
  573. package/src/capabilities/settings.ts +0 -19
  574. package/src/capabilities/state.ts +0 -20
  575. package/src/capabilities/toolkit.ts +0 -163
  576. package/src/components/BlueprintContainer.tsx +0 -24
  577. package/src/components/PromptSettings.tsx +0 -90
  578. package/src/components/SequenceContainer.tsx +0 -131
  579. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +0 -33
  580. package/src/components/SequenceEditor/SequenceEditor.tsx +0 -50
  581. package/src/components/SequenceEditor/index.ts +0 -5
  582. package/src/components/TemplateEditor/handlebars-extension.ts +0 -165
  583. package/src/components/Toolbar/Toolbar.tsx +0 -21
  584. package/src/components/Toolbar/index.ts +0 -5
  585. package/src/components/Toolbar/useChatToolbarActions.ts +0 -126
  586. package/src/events.ts +0 -11
  587. package/src/execution-graph/execution-graph.ts +0 -211
  588. package/src/execution-graph/index.ts +0 -5
  589. package/src/functions/analysis.ts +0 -20
  590. package/src/hooks/useExecutionGraph.ts +0 -20
  591. package/src/hooks/useItemTypes.ts +0 -37
  592. package/src/stories/Chat.stories.tsx +0 -804
  593. package/src/stories/components/BlueprintContainer.tsx +0 -34
  594. package/src/stories/components/ChatContainer.tsx +0 -74
  595. package/src/stories/components/ChessContainer.tsx +0 -17
  596. package/src/stories/components/CommentsContainer.tsx +0 -25
  597. package/src/stories/components/DebugCard.tsx +0 -61
  598. package/src/stories/components/GraphContainer.tsx +0 -119
  599. package/src/stories/components/InvocationsContainer.tsx +0 -17
  600. package/src/stories/components/LoggingContainer.tsx +0 -33
  601. package/src/stories/components/MessageContainer.tsx +0 -22
  602. package/src/stories/components/ProjectContainer.tsx +0 -17
  603. package/src/stories/components/PromptContainer.tsx +0 -52
  604. package/src/stories/components/ResearchInputStack.tsx +0 -30
  605. package/src/stories/components/ResearchOutputStack.tsx +0 -29
  606. package/src/stories/components/TasksContainer.tsx +0 -49
  607. package/src/stories/components/TokenManagerContainer.tsx +0 -14
  608. package/src/stories/components/TriggersContainer.tsx +0 -12
  609. package/src/stories/components/index.ts +0 -21
  610. package/src/stories/components/types.ts +0 -11
  611. package/src/stories/testing/data.ts +0 -142
  612. package/src/stories/testing/index.ts +0 -6
  613. package/src/stories/testing/schema.ts +0 -17
  614. package/src/stories/testing/testing.tsx +0 -284
  615. package/src/testing/test-data.ts +0 -255
  616. package/src/testing/test-functions.ts +0 -16
  617. /package/dist/lib/browser/{blueprint-definition-3SATLYJW.mjs.map → blueprint-definition-DGHH7MUU.mjs.map} +0 -0
  618. /package/dist/lib/{node-esm/blueprint-definition-B6UDX5U3.mjs.map → browser/blueprints/index.mjs.map} +0 -0
  619. /package/dist/types/src/components/TemplateEditor/{handlebars-extension.d.ts → extensions/handlebars-extension.d.ts} +0 -0
@@ -1,1941 +0,0 @@
1
- import {
2
- meta
3
- } from "./chunk-O4LUJEDV.mjs";
4
-
5
- // src/hooks/useBlueprintRegistry.ts
6
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
7
- import { useSignalEffect } from "@preact/signals-react";
8
- import { useCallback, useMemo, useState } from "react";
9
- import { Capabilities, useCapabilities } from "@dxos/app-framework";
10
- import { Blueprint } from "@dxos/blueprints";
11
- import { Filter, Obj, Ref } from "@dxos/echo";
12
- import { isNonNullable } from "@dxos/util";
13
- var useBlueprintRegistry = () => {
14
- const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
15
- return useMemo(() => new Blueprint.Registry(blueprints), [
16
- blueprints
17
- ]);
18
- };
19
- var useBlueprints = ({ blueprintRegistry }) => useMemo(() => blueprintRegistry?.query() ?? [], [
20
- blueprintRegistry
21
- ]);
22
- var useActiveBlueprints = ({ context }) => {
23
- var _effect = _useSignals();
24
- try {
25
- const [active, setActive] = useState(/* @__PURE__ */ new Map());
26
- useSignalEffect(() => {
27
- const refs = [
28
- ...context?.blueprints.value ?? []
29
- ];
30
- const blueprints = refs.map((ref) => ref.target).filter(isNonNullable);
31
- setActive(new Map(blueprints.map((blueprint) => [
32
- blueprint.key,
33
- blueprint
34
- ])));
35
- });
36
- return active;
37
- } finally {
38
- _effect.f();
39
- }
40
- };
41
- var useBlueprintHandlers = ({ space, context, blueprintRegistry }) => {
42
- const onUpdateBlueprint = useCallback(async (key, checked) => {
43
- if (!context || !blueprintRegistry) {
44
- return;
45
- }
46
- const { objects } = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
47
- let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
48
- if (checked) {
49
- if (!storedBlueprint) {
50
- const blueprint = blueprintRegistry.getByKey(key);
51
- if (!blueprint) {
52
- return;
53
- }
54
- storedBlueprint = space.db.add(Obj.clone(blueprint));
55
- }
56
- await context.bind({
57
- blueprints: [
58
- Ref.make(storedBlueprint)
59
- ]
60
- });
61
- } else if (storedBlueprint) {
62
- await context.unbind({
63
- blueprints: [
64
- Ref.make(storedBlueprint)
65
- ]
66
- });
67
- }
68
- }, [
69
- space,
70
- context,
71
- blueprintRegistry
72
- ]);
73
- return {
74
- onUpdateBlueprint
75
- };
76
- };
77
-
78
- // src/hooks/useChatProcessor.ts
79
- import { RegistryContext } from "@effect-rx/rx-react";
80
- import { useContext, useMemo as useMemo2 } from "react";
81
- import { AiConversation } from "@dxos/assistant";
82
- import { log as log2 } from "@dxos/log";
83
-
84
- // src/processor/presets.ts
85
- import { Schema } from "effect";
86
- var ModelProviders = [
87
- "dxos-local",
88
- "dxos-remote",
89
- "lm-studio"
90
- ];
91
- var ModelProvider = Schema.Literal(...ModelProviders);
92
- var createModelLabel = (model) => {
93
- const parts = model.split("/");
94
- return parts[parts.length - 1];
95
- };
96
- var AiServicePresets = [
97
- {
98
- provider: "dxos-remote",
99
- model: "@anthropic/claude-opus-4-0"
100
- },
101
- {
102
- provider: "dxos-remote",
103
- model: "@anthropic/claude-sonnet-4-0"
104
- },
105
- {
106
- provider: "dxos-remote",
107
- model: "@anthropic/claude-3-5-haiku-20241022"
108
- },
109
- {
110
- provider: "lm-studio",
111
- model: "@google/gemma-3-27b"
112
- },
113
- {
114
- provider: "lm-studio",
115
- model: "@mlx-community/llama-3.2-3b-instruct"
116
- },
117
- {
118
- model: "deepseek-r1:latest",
119
- provider: "dxos-local"
120
- }
121
- ].map(({ model, provider }, i) => ({
122
- id: `preset-${i}`,
123
- provider,
124
- model,
125
- label: createModelLabel(model)
126
- }));
127
-
128
- // src/processor/processor.ts
129
- import { Registry, Rx } from "@effect-rx/rx-react";
130
- import { Cause, Effect, Exit, Fiber, Option, Runtime } from "effect";
131
- import { AiService, DEFAULT_EDGE_MODEL } from "@dxos/ai";
132
- import { AiSession, ArtifactDiffResolver, GenerationObserver, createSystemPrompt } from "@dxos/assistant";
133
- import { Obj as Obj2 } from "@dxos/echo";
134
- import { throwCause } from "@dxos/effect";
135
- import { log } from "@dxos/log";
136
- import { DataType } from "@dxos/schema";
137
- import { trim } from "@dxos/util";
138
- function _define_property(obj, key, value) {
139
- if (key in obj) {
140
- Object.defineProperty(obj, key, {
141
- value,
142
- enumerable: true,
143
- configurable: true,
144
- writable: true
145
- });
146
- } else {
147
- obj[key] = value;
148
- }
149
- return obj;
150
- }
151
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/processor/processor.ts";
152
- var defaultOptions = {
153
- model: DEFAULT_EDGE_MODEL
154
- };
155
- var AiChatProcessor = class {
156
- get context() {
157
- return this._conversation.context;
158
- }
159
- get conversation() {
160
- return this._conversation;
161
- }
162
- get blueprintRegistry() {
163
- return this._options.blueprintRegistry;
164
- }
165
- /**
166
- * Initiates a new request.
167
- */
168
- async request(requestParam) {
169
- if (this._fiber) {
170
- await this.cancel();
171
- }
172
- try {
173
- this._lastRequest = requestParam;
174
- this._rx.set(this.error, Option.none());
175
- this._rx.set(this.active, true);
176
- const request = this._conversation.createRequest({
177
- system: this._options.system,
178
- prompt: requestParam.message,
179
- observer: this._observer
180
- });
181
- const runtime = await this._services();
182
- this._fiber = request.pipe(
183
- Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
184
- // TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
185
- Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
186
- Effect.asVoid,
187
- Effect.tapErrorCause((cause) => {
188
- log.error("request failed", {
189
- cause
190
- }, {
191
- F: __dxlog_file,
192
- L: 170,
193
- S: this,
194
- C: (f, a) => f(...a)
195
- });
196
- return Effect.void;
197
- }),
198
- Runtime.runFork(runtime)
199
- );
200
- const response = await this._fiber.pipe(Fiber.join, Effect.runPromiseExit);
201
- if (!Exit.isSuccess(response) && !Cause.isInterruptedOnly(response.cause)) {
202
- throwCause(response.cause);
203
- }
204
- this._rx.set(this.error, Option.none());
205
- this._lastRequest = void 0;
206
- this._fiber = void 0;
207
- } catch (err) {
208
- log.error("request failed", {
209
- err
210
- }, {
211
- F: __dxlog_file,
212
- L: 186,
213
- S: this,
214
- C: (f, a) => f(...a)
215
- });
216
- this._rx.set(this.error, Option.some(new Error("AI service error", {
217
- cause: err
218
- })));
219
- } finally {
220
- this._fiber = void 0;
221
- this._rx.set(this.active, false);
222
- }
223
- }
224
- /**
225
- * Cancels the current request.
226
- */
227
- async cancel() {
228
- await Effect.runPromise(Effect.gen(this, function* () {
229
- if (this._fiber) {
230
- yield* this._fiber.pipe(Fiber.interrupt);
231
- }
232
- }));
233
- this._fiber = void 0;
234
- this._rx.set(this.active, false);
235
- }
236
- /**
237
- * Retry last failed request.
238
- */
239
- async retry() {
240
- if (this._lastRequest) {
241
- return this.request(this._lastRequest);
242
- }
243
- }
244
- /**
245
- * Update the current chat's name.
246
- */
247
- async updateName(chat) {
248
- const runtime = await this._services();
249
- const system = trim`
250
- It is extremely important that you respond only with the title and nothing else.
251
- If you cannot do this effectively respond with "New Chat".
252
- `;
253
- const history = await this._conversation.getHistory();
254
- const fiber = Effect.gen(this, function* () {
255
- const session = new AiSession();
256
- return yield* session.run({
257
- system,
258
- prompt: "Suggest a name for this chat",
259
- history
260
- });
261
- }).pipe(
262
- // TODO(burdon): Use simpler model.
263
- Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
264
- Effect.tap((messages) => {
265
- const message = messages.find((message2) => message2.sender.role === "assistant");
266
- const title = message?.blocks.find((b) => b._tag === "text")?.text;
267
- if (title) {
268
- chat.name = title;
269
- }
270
- }),
271
- Runtime.runFork(runtime)
272
- );
273
- const response = await fiber.pipe(Fiber.join, Effect.runPromiseExit);
274
- if (!Exit.isSuccess(response)) {
275
- throwCause(response.cause);
276
- }
277
- }
278
- constructor(_conversation, _services, _options = defaultOptions) {
279
- _define_property(this, "_conversation", void 0);
280
- _define_property(this, "_services", void 0);
281
- _define_property(this, "_options", void 0);
282
- _define_property(this, "_rx", void 0);
283
- _define_property(this, "_observer", void 0);
284
- _define_property(this, "_fiber", void 0);
285
- _define_property(this, "_lastRequest", void 0);
286
- _define_property(this, "_pending", void 0);
287
- _define_property(this, "_streaming", void 0);
288
- _define_property(this, "streaming", void 0);
289
- _define_property(this, "active", void 0);
290
- _define_property(this, "messages", void 0);
291
- _define_property(this, "error", void 0);
292
- _define_property(this, "_artifactDiffResolver", void 0);
293
- _define_property(this, "_onMessage", void 0);
294
- _define_property(this, "_onBlock", void 0);
295
- this._conversation = _conversation;
296
- this._services = _services;
297
- this._options = _options;
298
- this._pending = Rx.make([]);
299
- this._streaming = Rx.make(Option.none());
300
- this.streaming = Rx.make((get) => Option.isSome(get(this._streaming)));
301
- this.active = Rx.make(false);
302
- this.messages = Rx.make((get) => Option.match(get(this._streaming), {
303
- onNone: () => get(this._pending),
304
- onSome: (streaming) => [
305
- ...get(this._pending),
306
- streaming
307
- ]
308
- }));
309
- this.error = Rx.make(Option.none());
310
- this._artifactDiffResolver = {
311
- resolve: async (_artifacts) => {
312
- const versions = /* @__PURE__ */ new Map();
313
- return versions;
314
- }
315
- };
316
- this._onMessage = Effect.fn((function* (message) {
317
- this._rx.set(this._streaming, Option.none());
318
- this._rx.update(this._pending, (pending) => [
319
- ...pending,
320
- message
321
- ]);
322
- }).bind(this));
323
- this._onBlock = Effect.fn((function* (block) {
324
- this._rx.update(this._streaming, (streaming) => {
325
- const blocks = streaming.pipe(Option.map((streaming2) => streaming2.blocks.filter((b) => !b.pending)), Option.getOrElse(() => []));
326
- return Option.some(Obj2.make(DataType.Message, {
327
- created: (/* @__PURE__ */ new Date()).toISOString(),
328
- sender: {
329
- role: "assistant"
330
- },
331
- blocks: [
332
- ...blocks,
333
- block
334
- ]
335
- }));
336
- });
337
- }).bind(this));
338
- this._rx = this._options.observableRegistry ?? Registry.make();
339
- this._observer = GenerationObserver.make({
340
- onBlock: this._onBlock,
341
- onMessage: this._onMessage
342
- });
343
- if (this._options.model && !this._options.system) {
344
- const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
345
- this._options.system = createSystemPrompt(capabilities);
346
- }
347
- }
348
- };
349
-
350
- // src/hooks/useChatProcessor.ts
351
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
352
- var useChatProcessor = ({ chat, preset, services, blueprintRegistry, settings }) => {
353
- const observableRegistry = useContext(RegistryContext);
354
- const conversation = useMemo2(() => {
355
- if (!chat?.queue.target) {
356
- return;
357
- }
358
- return new AiConversation({
359
- queue: chat.queue.target
360
- });
361
- }, [
362
- chat?.queue.target
363
- ]);
364
- const processor = useMemo2(() => {
365
- if (!services || !conversation) {
366
- return void 0;
367
- }
368
- log2("creating processor", {
369
- preset,
370
- model: preset?.model,
371
- settings
372
- }, {
373
- F: __dxlog_file2,
374
- L: 52,
375
- S: void 0,
376
- C: (f, a) => f(...a)
377
- });
378
- return new AiChatProcessor(conversation, services, {
379
- observableRegistry,
380
- blueprintRegistry,
381
- model: preset?.model
382
- });
383
- }, [
384
- services,
385
- conversation,
386
- blueprintRegistry,
387
- preset
388
- ]);
389
- return processor;
390
- };
391
-
392
- // src/hooks/useChatServices.ts
393
- import { Effect as Effect2 } from "effect";
394
- import { useMemo as useMemo3 } from "react";
395
- import { useCapability } from "@dxos/app-framework";
396
- import { TracingService } from "@dxos/functions";
397
- import { AutomationCapabilities } from "@dxos/plugin-automation";
398
- import { useClient } from "@dxos/react-client";
399
- var useChatServices = ({ space, chat }) => {
400
- const client = useClient();
401
- space ?? (space = client.spaces.default);
402
- const computeRuntimeResolver = useCapability(AutomationCapabilities.ComputeRuntime);
403
- return useMemo3(() => {
404
- const runtime = computeRuntimeResolver.getRuntime(space.id);
405
- return () => runtime.runPromise(Effect2.gen(function* () {
406
- return yield* Effect2.runtime().pipe(Effect2.provide(chat?.traceQueue?.target ? TracingService.layerQueue(chat.traceQueue?.target) : TracingService.layerNoop));
407
- }));
408
- }, [
409
- space,
410
- chat?.traceQueue?.target
411
- ]);
412
- };
413
-
414
- // src/hooks/useContextBinder.ts
415
- import { useMemo as useMemo4 } from "react";
416
- import { AiContextBinder } from "@dxos/assistant";
417
- var useContextBinder = (chat) => {
418
- const binder = useMemo4(() => {
419
- const queue = chat?.queue.target;
420
- return queue && new AiContextBinder(queue);
421
- }, [
422
- chat
423
- ]);
424
- return binder;
425
- };
426
-
427
- // src/hooks/useOnline.ts
428
- import { useState as useState2 } from "react";
429
- var useOnline = () => {
430
- const [online, setOnline] = useState2(true);
431
- return [
432
- online,
433
- setOnline
434
- ];
435
- };
436
-
437
- // src/hooks/usePresets.ts
438
- import { useCallback as useCallback2, useEffect, useMemo as useMemo5, useState as useState3 } from "react";
439
- var usePresets = (online) => {
440
- const [preset, setPreset] = useState3();
441
- const presets = useMemo5(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
442
- online
443
- ]);
444
- const presetOptions = useMemo5(() => presets.map(({ id, model, label }) => ({
445
- id,
446
- label: label ?? model
447
- })), [
448
- presets
449
- ]);
450
- useEffect(() => {
451
- setPreset(presets[0]);
452
- }, [
453
- presets
454
- ]);
455
- const handlePresetChange = useCallback2((id) => {
456
- const preset2 = presets.find((preset3) => preset3.id === id);
457
- if (preset2) {
458
- setPreset(preset2);
459
- }
460
- }, [
461
- presets
462
- ]);
463
- return {
464
- preset,
465
- presets: presetOptions,
466
- onPresetChange: handlePresetChange
467
- };
468
- };
469
-
470
- // src/hooks/useContextObjects.ts
471
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
472
- import { useCallback as useCallback3 } from "react";
473
- import { Ref as Ref2 } from "@dxos/echo";
474
- import { log as log3 } from "@dxos/log";
475
- import { isNonNullable as isNonNullable2 } from "@dxos/util";
476
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useContextObjects.ts";
477
- var useContextObjects = ({ space, context }) => {
478
- var _effect = _useSignals2();
479
- try {
480
- const objects = context?.objects.value.map((ref) => ref.target).filter(isNonNullable2) ?? [];
481
- const handleUpdateObject = useCallback3(async (dxn, checked) => {
482
- if (!space || !context) {
483
- return;
484
- }
485
- const id = dxn.asEchoDXN();
486
- const object = id && await space.db.getObjectById(id.echoId);
487
- if (!object) {
488
- log3.warn("Object not found", {
489
- dxn,
490
- id
491
- }, {
492
- F: __dxlog_file3,
493
- L: 40,
494
- S: void 0,
495
- C: (f, a) => f(...a)
496
- });
497
- return;
498
- }
499
- const ref = Ref2.fromDXN(dxn);
500
- if (checked) {
501
- await context.bind({
502
- objects: [
503
- ref
504
- ]
505
- });
506
- } else {
507
- await context.unbind({
508
- objects: [
509
- ref
510
- ]
511
- });
512
- }
513
- }, [
514
- space,
515
- context
516
- ]);
517
- return {
518
- objects,
519
- onUpdateObject: handleUpdateObject
520
- };
521
- } finally {
522
- _effect.f();
523
- }
524
- };
525
-
526
- // src/hooks/useExecutionGraph.ts
527
- import { useMemo as useMemo6 } from "react";
528
- import { Obj as Obj4 } from "@dxos/echo";
529
- import { useQueue } from "@dxos/react-client/echo";
530
-
531
- // src/execution-graph/execution-graph.ts
532
- import { AgentStatus } from "@dxos/ai";
533
- import { Obj as Obj3 } from "@dxos/echo";
534
- import { MESSAGE_PROPERTY_TOOL_CALL_ID } from "@dxos/functions";
535
- import { LogLevel } from "@dxos/log";
536
- import { ContentBlock, DataType as DataType2 } from "@dxos/schema";
537
- import { isNotFalsy } from "@dxos/util";
538
- function _define_property2(obj, key, value) {
539
- if (key in obj) {
540
- Object.defineProperty(obj, key, {
541
- value,
542
- enumerable: true,
543
- configurable: true,
544
- writable: true
545
- });
546
- } else {
547
- obj[key] = value;
548
- }
549
- return obj;
550
- }
551
- var ExecutionGraph = class {
552
- /**
553
- * Adds events to the graph.
554
- */
555
- addEvents(events) {
556
- for (const event of events) {
557
- if (Obj3.instanceOf(DataType2.Message, event)) {
558
- const messageCommits = messageToCommit(event);
559
- this._commits.push(...messageCommits);
560
- messageCommits.map((c) => c.branch).forEach((branch) => this._branchNames.add(branch));
561
- } else if (Obj3.instanceOf(AgentStatus, event)) {
562
- const branch = getBranchName({
563
- parentMessage: event.parentMessage,
564
- toolCallId: event.toolCallId
565
- });
566
- this._branchNames.add(branch);
567
- this._commits.push({
568
- id: event.id,
569
- branch,
570
- message: event.message,
571
- icon: "ph--flag--regular",
572
- parents: event.parentMessage && event.toolCallId ? [
573
- getToolCallId(event.parentMessage, event.toolCallId)
574
- ] : void 0
575
- });
576
- }
577
- }
578
- }
579
- /**
580
- * Returns the current state of the graph.
581
- */
582
- getGraph(lastRequest = false) {
583
- const idx = lastRequest ? this._commits.findLastIndex((c) => c.tags?.includes("user")) : -1;
584
- const commits = idx === -1 ? this._commits : this._commits.slice(idx);
585
- return {
586
- branches: Array.from(this._branchNames),
587
- commits
588
- };
589
- }
590
- constructor() {
591
- _define_property2(this, "_commits", []);
592
- _define_property2(this, "_branchNames", /* @__PURE__ */ new Set());
593
- }
594
- };
595
- var messageToCommit = (message) => {
596
- return message.blocks.map((block, idx) => {
597
- const branch = getMessageBranch(message);
598
- const parent = getParentId(message);
599
- const parents = parent ? [
600
- parent
601
- ] : [];
602
- switch (block._tag) {
603
- case "text":
604
- if (!block.text.trim().length) {
605
- return null;
606
- }
607
- return {
608
- id: getGenericBlockId(message.id, idx),
609
- branch,
610
- parents,
611
- ...message.sender.role === "user" ? {
612
- icon: "ph--user--regular",
613
- tags: [
614
- "user"
615
- ],
616
- message: "Processing request..."
617
- } : {
618
- icon: "ph--robot--regular",
619
- message: `Response (${block.text.split(" ").length} words)`
620
- }
621
- };
622
- case "toolCall":
623
- return {
624
- id: getToolCallId(message.id, block.toolCallId),
625
- branch,
626
- parents,
627
- icon: "ph--wrench--regular",
628
- level: LogLevel.INFO,
629
- // TODO(burdon): Lookup tool name/description?
630
- message: `Calling tool (${block.name})`
631
- };
632
- case "toolResult":
633
- return {
634
- id: getToolResultId(message.id, block.toolCallId),
635
- branch,
636
- parents,
637
- icon: block.error ? "ph--x-circle--regular" : "ph--check-circle--regular",
638
- level: block.error ? LogLevel.ERROR : LogLevel.INFO,
639
- message: block.error ? "Tool error: " + block.error : "Tool call succeeded"
640
- };
641
- case "summary":
642
- return {
643
- id: getGenericBlockId(message.id, idx),
644
- branch,
645
- parents,
646
- icon: "ph--rocket--regular",
647
- level: LogLevel.INFO,
648
- message: ContentBlock.createSummaryMessage(block)
649
- };
650
- case "status":
651
- return {
652
- id: getGenericBlockId(message.id, idx),
653
- branch,
654
- parents,
655
- message: block.statusText,
656
- level: LogLevel.INFO,
657
- icon: "ph--flag--regular"
658
- };
659
- case "reasoning":
660
- return {
661
- id: getGenericBlockId(message.id, idx),
662
- branch,
663
- parents,
664
- message: block.reasoningText ?? "Thinking...",
665
- icon: "ph--brain--regular"
666
- };
667
- case "reference":
668
- return {
669
- id: getGenericBlockId(message.id, idx),
670
- branch,
671
- parents,
672
- icon: "ph--link--regular",
673
- message: stringifyRef(block.reference)
674
- };
675
- default:
676
- return null;
677
- }
678
- }).filter(isNotFalsy);
679
- };
680
- var getToolCallId = (messageId, toolCallId) => `${messageId}_toolCall_${toolCallId}`;
681
- var getToolResultId = (messageId, toolCallId) => `${messageId}_toolResult_${toolCallId}`;
682
- var getGenericBlockId = (messageId, idx) => `${messageId}_block_${idx}`;
683
- var getBranchName = (options) => {
684
- if (options.parentMessage && options.toolCallId) {
685
- return `${options.parentMessage}_${options.toolCallId}`;
686
- } else if (options.parentMessage) {
687
- return options.parentMessage;
688
- } else {
689
- return "main";
690
- }
691
- };
692
- var getMessageBranch = (message) => {
693
- return getBranchName({
694
- parentMessage: message.parentMessage,
695
- toolCallId: message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]
696
- });
697
- };
698
- var getParentId = (message) => {
699
- if (message.parentMessage && message.properties?.[MESSAGE_PROPERTY_TOOL_CALL_ID]) {
700
- return getToolCallId(message.parentMessage, message.properties[MESSAGE_PROPERTY_TOOL_CALL_ID]);
701
- } else {
702
- return void 0;
703
- }
704
- };
705
- var stringifyRef = (ref) => {
706
- if (ref.target) {
707
- return stringifyObject(ref.target);
708
- }
709
- return ref.dxn.asEchoDXN()?.echoId ?? ref.dxn.asQueueDXN()?.objectId ?? "";
710
- };
711
- var stringifyObject = (obj) => {
712
- return Obj3.getLabel(obj) ?? Obj3.getTypename(obj) ?? obj.id;
713
- };
714
-
715
- // src/hooks/useExecutionGraph.ts
716
- var useExecutionGraph = (queueRef, lastRequest = false) => {
717
- const queue = useQueue(queueRef?.dxn);
718
- return useMemo6(() => {
719
- const graph = new ExecutionGraph();
720
- graph.addEvents(queue?.objects.filter(Obj4.isObject) ?? []);
721
- return graph.getGraph(lastRequest);
722
- }, [
723
- queue?.objects,
724
- lastRequest
725
- ]);
726
- };
727
-
728
- // src/hooks/useFlush.ts
729
- import { useCallback as useCallback4, useRef, useState as useState4 } from "react";
730
-
731
- // src/hooks/useItemTypes.ts
732
- import { Option as Option2 } from "effect";
733
- import { useEffect as useEffect2, useState as useState5 } from "react";
734
- import { ItemAnnotation } from "@dxos/schema";
735
- var useItemTypes = (space) => {
736
- const [types, setTypes] = useState5([]);
737
- useEffect2(() => {
738
- if (!space) {
739
- return;
740
- }
741
- return space.db.schemaRegistry.query().subscribe((query) => {
742
- const types2 = Array.from(new Set([
743
- ...space.db.graph.schemaRegistry.schemas,
744
- ...query.results
745
- ].filter((type) => Option2.isSome(ItemAnnotation.get(type)))));
746
- setTypes(types2);
747
- }, {
748
- fire: true
749
- });
750
- }, [
751
- space
752
- ]);
753
- return types;
754
- };
755
-
756
- // src/hooks/useReferencesProvider.ts
757
- import { useMemo as useMemo7 } from "react";
758
- import { Capabilities as Capabilities2, useCapabilities as useCapabilities2 } from "@dxos/app-framework";
759
- import { Filter as Filter2, Obj as Obj5 } from "@dxos/echo";
760
- var useReferencesProvider = (space) => {
761
- const blueprints = useCapabilities2(Capabilities2.BlueprintDefinition);
762
- return useMemo7(() => {
763
- if (!space) {
764
- return void 0;
765
- }
766
- return {
767
- getReferences: async ({ query }) => {
768
- const { objects } = await space.db.query(Filter2.everything()).run();
769
- return objects.filter((object) => stringMatch(query, Obj5.getLabel(object) ?? "")).filter((object) => !!Obj5.getDXN(object)).map((object) => ({
770
- uri: Obj5.getDXN(object).toString(),
771
- label: Obj5.getLabel(object) ?? ""
772
- }));
773
- },
774
- resolveReference: async ({ uri }) => {
775
- const object = await space.db.query(Filter2.ids(uri)).first();
776
- return {
777
- uri,
778
- label: Obj5.getLabel(object) ?? ""
779
- };
780
- }
781
- };
782
- }, [
783
- space,
784
- blueprints
785
- ]);
786
- };
787
- var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
788
-
789
- // src/components/Chat/Chat.tsx
790
- import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
791
- import { Prec } from "@codemirror/state";
792
- import { keymap } from "@codemirror/view";
793
- import { useRxValue } from "@effect-rx/rx-react";
794
- import { createContext } from "@radix-ui/react-context";
795
- import { Array as Array2, Option as Option3 } from "effect";
796
- import React9, { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo11, useRef as useRef3, useState as useState10 } from "react";
797
- import { Event } from "@dxos/async";
798
- import { Obj as Obj8 } from "@dxos/echo";
799
- import { useVoiceInput } from "@dxos/plugin-transcription";
800
- import { getSpace, useQueue as useQueue2 } from "@dxos/react-client/echo";
801
- import { useIdentity } from "@dxos/react-client/halo";
802
- import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
803
- import { ChatEditor, references } from "@dxos/react-ui-chat";
804
- import { mx as mx5 } from "@dxos/react-ui-theme";
805
- import { DataType as DataType3 } from "@dxos/schema";
806
- import { isNotFalsy as isNotFalsy2 } from "@dxos/util";
807
-
808
- // src/components/ChatPrompt/ChatActions.tsx
809
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
810
- import React from "react";
811
- import { IconButton, useTranslation } from "@dxos/react-ui";
812
- import { mx } from "@dxos/react-ui-theme";
813
- var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
814
- var _effect = _useSignals3();
815
- try {
816
- const { t } = useTranslation(meta.id);
817
- return /* @__PURE__ */ React.createElement("div", {
818
- className: mx("flex items-center mie-1", classNames)
819
- }, children, /* @__PURE__ */ React.createElement(IconButton, {
820
- disabled: !processing,
821
- variant: "ghost",
822
- size: 5,
823
- icon: "ph--x--regular",
824
- iconOnly: true,
825
- label: t("button cancel processing"),
826
- onClick: () => onEvent?.({
827
- type: "cancel"
828
- })
829
- }), microphone && /* @__PURE__ */ React.createElement(IconButton, {
830
- disabled: !processing,
831
- classNames: mx(recording && "bg-primary-500"),
832
- variant: "ghost",
833
- size: 5,
834
- icon: "ph--microphone--regular",
835
- iconOnly: true,
836
- noTooltip: true,
837
- label: t("button microphone"),
838
- onMouseDown: () => onEvent?.({
839
- type: "record-start"
840
- }),
841
- onMouseUp: () => onEvent?.({
842
- type: "record-stop"
843
- }),
844
- onTouchStart: () => onEvent?.({
845
- type: "record-start"
846
- }),
847
- onTouchEnd: () => onEvent?.({
848
- type: "record-stop"
849
- })
850
- }));
851
- } finally {
852
- _effect.f();
853
- }
854
- };
855
-
856
- // src/components/ChatPrompt/ChatOptions.tsx
857
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
858
- import React2, { useMemo as useMemo8, useState as useState6 } from "react";
859
- import { Filter as Filter3, Obj as Obj6, Type } from "@dxos/echo";
860
- import { useQuery } from "@dxos/react-client/echo";
861
- import { Icon, IconButton as IconButton2, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
862
- import { SearchList } from "@dxos/react-ui-searchlist";
863
- import { Tabs } from "@dxos/react-ui-tabs";
864
- var panelClassNames = "is-[calc(100dvw-.5rem)] sm:is-max md:is-[25rem] max-is-[--text-content]";
865
- var ChatOptions = ({ space, context, blueprintRegistry, presets, preset, onPresetChange }) => {
866
- var _effect = _useSignals4();
867
- try {
868
- const { t } = useTranslation2(meta.id);
869
- return /* @__PURE__ */ React2.createElement("div", {
870
- role: "none",
871
- className: "flex gap-0.5"
872
- }, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
873
- asChild: true
874
- }, /* @__PURE__ */ React2.createElement(IconButton2, {
875
- variant: "ghost",
876
- icon: "ph--plus--regular",
877
- iconOnly: true,
878
- size: 5,
879
- label: t("button context objects")
880
- })), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
881
- side: "top",
882
- classNames: panelClassNames
883
- }, /* @__PURE__ */ React2.createElement(ObjectsPanel, {
884
- space,
885
- context
886
- }), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
887
- asChild: true
888
- }, /* @__PURE__ */ React2.createElement(IconButton2, {
889
- variant: "ghost",
890
- icon: "ph--sliders-horizontal--regular",
891
- iconOnly: true,
892
- size: 5,
893
- label: t("button context settings")
894
- })), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
895
- side: "top",
896
- classNames: panelClassNames
897
- }, /* @__PURE__ */ React2.createElement(Tabs.Root, {
898
- orientation: "horizontal",
899
- defaultValue: "blueprints",
900
- defaultActivePart: "list"
901
- }, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
902
- classNames: 'max-bs-[--radix-popover-content-available-height] grid grid-rows-[1fr_min-content] [&_[cmdk-root]]:contents [&_[role="tabpanel"]]:grid [&_[role="tabpanel"]]:grid-rows-[1fr_min-content] [&_[role="listbox"]]:min-bs-0 [&_[role="listbox"]]:overflow-y-auto [&_[role="tabpanel"]]:min-bs-0 [&_[role="tabpanel"]]:pli-cardSpacingChrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden'
903
- }, /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
904
- value: "blueprints"
905
- }, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
906
- blueprintRegistry,
907
- space,
908
- context
909
- })), /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
910
- value: "model"
911
- }, /* @__PURE__ */ React2.createElement(ModelsPanel, {
912
- presets,
913
- preset,
914
- onPresetChange
915
- })), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
916
- classNames: "sm:overflow-x-hidden justify-center p-[--dx-cardSpacingChrome] border-bs border-subduedSeparator order-last"
917
- }, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
918
- value: "blueprints",
919
- icon: "ph--blueprint--regular",
920
- label: t("blueprints in context title")
921
- }), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
922
- value: "model",
923
- label: t("chat model title"),
924
- icon: "ph--cpu--regular"
925
- })))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
926
- } finally {
927
- _effect.f();
928
- }
929
- };
930
- var BlueprintsPanel = ({ blueprintRegistry, space, context }) => {
931
- var _effect = _useSignals4();
932
- try {
933
- const { t } = useTranslation2(meta.id);
934
- const blueprints = useBlueprints({
935
- blueprintRegistry
936
- });
937
- const activeBlueprints = useActiveBlueprints({
938
- context
939
- });
940
- const { onUpdateBlueprint } = useBlueprintHandlers({
941
- space,
942
- context,
943
- blueprintRegistry
944
- });
945
- return /* @__PURE__ */ React2.createElement(SearchList.Root, null, /* @__PURE__ */ React2.createElement(SearchList.Content, {
946
- classNames: "plb-cardSpacingChrome"
947
- }, blueprints.map((blueprint) => {
948
- const isActive = activeBlueprints.has(blueprint.key);
949
- return /* @__PURE__ */ React2.createElement(SearchList.Item, {
950
- classNames: "flex items-center overflow-hidden",
951
- key: blueprint.key,
952
- value: blueprint.name,
953
- onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
954
- }, /* @__PURE__ */ React2.createElement("div", {
955
- className: "grow truncate"
956
- }, blueprint.name), /* @__PURE__ */ React2.createElement(Icon, {
957
- icon: "ph--check--regular",
958
- classNames: [
959
- !isActive && "invisible"
960
- ]
961
- }));
962
- })), /* @__PURE__ */ React2.createElement(SearchList.Input, {
963
- placeholder: t("search placeholder"),
964
- classNames: "mbe-cardSpacingChrome"
965
- }));
966
- } finally {
967
- _effect.f();
968
- }
969
- };
970
- var ModelsPanel = ({ presets, preset, onPresetChange }) => {
971
- var _effect = _useSignals4();
972
- try {
973
- return /* @__PURE__ */ React2.createElement("ul", {
974
- role: "listbox",
975
- className: "plb-cardSpacingChrome"
976
- }, presets?.map(({ id, label }) => {
977
- const isActive = preset === id;
978
- return /* @__PURE__ */ React2.createElement("li", {
979
- role: "option",
980
- key: id,
981
- "aria-selected": isActive,
982
- tabIndex: 0,
983
- className: "overflow-hidden dx-focus-ring flex gap-2 p-1 pis-2 pie-2 items-center rounded-sm select-none cursor-pointer hover:bg-hoverOverlay",
984
- onClick: () => onPresetChange?.(id)
985
- }, /* @__PURE__ */ React2.createElement("div", {
986
- className: "grow truncate"
987
- }, label), /* @__PURE__ */ React2.createElement(Icon, {
988
- icon: "ph--check--regular",
989
- classNames: [
990
- !isActive && "invisible"
991
- ]
992
- }));
993
- }));
994
- } finally {
995
- _effect.f();
996
- }
997
- };
998
- var ANY = "__any__";
999
- var ObjectsPanel = ({ space, context }) => {
1000
- var _effect = _useSignals4();
1001
- try {
1002
- const { t } = useTranslation2(meta.id);
1003
- const types = useItemTypes(space);
1004
- const typenames = useMemo8(() => {
1005
- const typenames2 = types.map((type) => {
1006
- const typename2 = Type.getTypename(type);
1007
- return {
1008
- typename: typename2,
1009
- label: t("typename label", {
1010
- ns: typename2,
1011
- defaultValue: typename2
1012
- })
1013
- };
1014
- });
1015
- typenames2.sort((a, b) => a.label.localeCompare(b.label));
1016
- return typenames2;
1017
- }, [
1018
- types
1019
- ]);
1020
- const [typename, setTypename] = useState6(ANY);
1021
- const anyFilter = useMemo8(() => Filter3.or(...typenames.map(({ typename: typename2 }) => Filter3.typename(typename2))), [
1022
- typenames
1023
- ]);
1024
- const objects = useQuery(space, typename === ANY ? anyFilter : Filter3.typename(typename));
1025
- const { objects: contextObjects, onUpdateObject } = useContextObjects({
1026
- space,
1027
- context
1028
- });
1029
- return /* @__PURE__ */ React2.createElement(SearchList.Root, {
1030
- classNames: "pis-2 pie-2"
1031
- }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
1032
- classNames: "plb-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0"
1033
- }, objects.length ? objects.map((object) => {
1034
- const label = Obj6.getLabel(object) ?? Obj6.getTypename(object) ?? object.id;
1035
- const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
1036
- return /* @__PURE__ */ React2.createElement(SearchList.Item, {
1037
- classNames: "flex items-center overflow-hidden",
1038
- key: object.id,
1039
- value: object.id,
1040
- onSelect: () => onUpdateObject?.(Obj6.getDXN(object), !isActive)
1041
- }, /* @__PURE__ */ React2.createElement("div", {
1042
- className: "grow truncate"
1043
- }, label), /* @__PURE__ */ React2.createElement(Icon, {
1044
- icon: "ph--check--regular",
1045
- classNames: [
1046
- !isActive && "invisible"
1047
- ]
1048
- }));
1049
- }) : /* @__PURE__ */ React2.createElement(SearchList.Item, null, t("no results"))), /* @__PURE__ */ React2.createElement("div", {
1050
- role: "none",
1051
- className: "grid grid-cols-[min-content_1fr] gap-2 mbe-cardSpacingChrome"
1052
- }, /* @__PURE__ */ React2.createElement(Select.Root, {
1053
- value: typename === ANY ? void 0 : typename,
1054
- onValueChange: setTypename
1055
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
1056
- density: "fine",
1057
- placeholder: t("type filter placeholder")
1058
- }), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
1059
- value: ANY
1060
- }, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React2.createElement(Select.Option, {
1061
- key: typename2,
1062
- value: typename2
1063
- }, label))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
1064
- placeholder: t("search placeholder"),
1065
- classNames: "mbe-0"
1066
- })));
1067
- } finally {
1068
- _effect.f();
1069
- }
1070
- };
1071
-
1072
- // src/components/ChatPrompt/ChatPresets.tsx
1073
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
1074
- import React3 from "react";
1075
- import { Select as Select2 } from "@dxos/react-ui";
1076
-
1077
- // src/components/ChatPrompt/ChatReferences.tsx
1078
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
1079
- import React4 from "react";
1080
- import { Obj as Obj7 } from "@dxos/echo";
1081
- import { IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
1082
- import { mx as mx2 } from "@dxos/react-ui-theme";
1083
- var ChatReferences = ({ classNames, context, space }) => {
1084
- var _effect = _useSignals6();
1085
- try {
1086
- const { t } = useTranslation3(meta.id);
1087
- const { objects, onUpdateObject } = useContextObjects({
1088
- space,
1089
- context
1090
- });
1091
- return /* @__PURE__ */ React4.createElement("ul", {
1092
- className: mx2("flex flex-wrap", classNames)
1093
- }, objects.map((obj) => {
1094
- const dxn = Obj7.getDXN(obj);
1095
- const typename = Obj7.getTypename(obj);
1096
- const label = Obj7.getLabel(obj) ?? (typename ? [
1097
- "object name placeholder",
1098
- {
1099
- ns: typename
1100
- }
1101
- ] : obj.id);
1102
- return /* @__PURE__ */ React4.createElement("li", {
1103
- key: dxn.toString(),
1104
- className: "dx-tag plb-0 pis-2 flex items-center",
1105
- "data-hue": "neutral"
1106
- }, toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
1107
- iconOnly: true,
1108
- variant: "ghost",
1109
- label: t("remove object in context label"),
1110
- classNames: "p-0 hover:bg-transparent",
1111
- size: 3,
1112
- icon: "ph--x--bold",
1113
- onClick: () => onUpdateObject?.(dxn, false)
1114
- }));
1115
- }));
1116
- } finally {
1117
- _effect.f();
1118
- }
1119
- };
1120
-
1121
- // src/components/ChatPrompt/ChatStatusIndicator.tsx
1122
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
1123
- import React5, { useEffect as useEffect3, useState as useState7 } from "react";
1124
- import { Tooltip, useTimeout } from "@dxos/react-ui";
1125
- import { Spinner } from "@dxos/react-ui-sfx";
1126
- import { mx as mx3 } from "@dxos/react-ui-theme";
1127
- var period = 3e3;
1128
- var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
1129
- var _effect = _useSignals7();
1130
- try {
1131
- const [init, setInit] = useState7(false);
1132
- useEffect3(() => setInit(false), [
1133
- preset
1134
- ]);
1135
- useTimeout(async () => {
1136
- setInit(true);
1137
- }, period / 2, [
1138
- preset
1139
- ]);
1140
- return /* @__PURE__ */ React5.createElement("div", {
1141
- role: "none",
1142
- className: mx3("relative flex", classNames)
1143
- }, /* @__PURE__ */ React5.createElement(Spinner, {
1144
- duration: period,
1145
- state: !init ? "flash" : error ? "error" : processing ? "spin" : "pulse",
1146
- ...props
1147
- }), error && /* @__PURE__ */ React5.createElement(Tooltip.Trigger, {
1148
- asChild: true,
1149
- content: error.message
1150
- }, /* @__PURE__ */ React5.createElement("div", {
1151
- className: "absolute inset-0"
1152
- })));
1153
- } finally {
1154
- _effect.f();
1155
- }
1156
- };
1157
-
1158
- // src/components/ChatThread/ChatThread.tsx
1159
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1160
- import React8, { forwardRef, useCallback as useCallback5, useEffect as useEffect5, useImperativeHandle, useMemo as useMemo10, useState as useState9 } from "react";
1161
- import { PublicKey } from "@dxos/keys";
1162
- import { MarkdownStream } from "@dxos/react-ui-components";
1163
- import { mx as mx4 } from "@dxos/react-ui-theme";
1164
- import { keyToFallback } from "@dxos/util";
1165
-
1166
- // src/components/ChatThread/registry.tsx
1167
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1168
- import React7 from "react";
1169
- import { log as log4 } from "@dxos/log";
1170
- import { PromptWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget, ToggleContainer as ToggleContainer2 } from "@dxos/react-ui-components";
1171
- import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
1172
- import { ContentBlock as ContentBlock2 } from "@dxos/schema";
1173
-
1174
- // src/components/ToolBlock/ToolBlock.tsx
1175
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
1176
- import React6, { useEffect as useEffect4, useMemo as useMemo9, useRef as useRef2, useState as useState8 } from "react";
1177
- import { useTranslation as useTranslation4 } from "@dxos/react-ui";
1178
- import { NumericTabs, TextCrawl, ToggleContainer, chatMessageJson, chatMessagePanel, chatMessagePanelContent, chatMessagePanelHeader } from "@dxos/react-ui-components";
1179
- import { Json } from "@dxos/react-ui-syntax-highlighter";
1180
- import { isNonNullable as isNonNullable3 } from "@dxos/util";
1181
- import { safeParseJson } from "@dxos/util";
1182
- var ToolBlock = ({ blocks = [] }) => {
1183
- var _effect = _useSignals8();
1184
- try {
1185
- const { t } = useTranslation4(meta.id);
1186
- const getToolCaption = (tool, status) => {
1187
- if (!tool) {
1188
- return t("calling tool label");
1189
- }
1190
- return status?.message ?? tool.description ?? [
1191
- t("calling label"),
1192
- tool.name
1193
- ].join(" ");
1194
- };
1195
- const items = useMemo9(() => {
1196
- let lastToolCall;
1197
- const tools = [];
1198
- return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "summary").map((block) => {
1199
- switch (block._tag) {
1200
- case "toolCall": {
1201
- if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
1202
- return null;
1203
- }
1204
- const tool = tools.find((tool2) => tool2.name === block.name);
1205
- lastToolCall = {
1206
- tool,
1207
- block
1208
- };
1209
- return {
1210
- title: getToolCaption(lastToolCall?.tool),
1211
- content: {
1212
- ...block,
1213
- input: safeParseJson(block.input)
1214
- }
1215
- };
1216
- }
1217
- case "toolResult": {
1218
- if (block.error) {
1219
- return {
1220
- title: t("error label"),
1221
- content: block
1222
- };
1223
- }
1224
- const title = getToolCaption(lastToolCall?.tool ?? t("tool result label"));
1225
- lastToolCall = void 0;
1226
- return {
1227
- title,
1228
- content: {
1229
- ...block,
1230
- result: safeParseJson(block.result)
1231
- }
1232
- };
1233
- }
1234
- case "summary": {
1235
- if (!lastToolCall) {
1236
- return null;
1237
- }
1238
- return {
1239
- title: t("summary label"),
1240
- content: block
1241
- };
1242
- }
1243
- }
1244
- }).filter(isNonNullable3);
1245
- }, [
1246
- blocks
1247
- ]);
1248
- if (!items.length) {
1249
- return null;
1250
- }
1251
- return /* @__PURE__ */ React6.createElement(ToolContainer, {
1252
- items
1253
- });
1254
- } finally {
1255
- _effect.f();
1256
- }
1257
- };
1258
- ToolBlock.displayName = "ToolBlock";
1259
- var ToolContainer = ({ items }) => {
1260
- var _effect = _useSignals8();
1261
- try {
1262
- const tabsRef = useRef2(null);
1263
- const [selected, setSelected] = useState8(0);
1264
- const [open, setOpen] = useState8(false);
1265
- useEffect4(() => {
1266
- if (open) {
1267
- tabsRef.current?.focus();
1268
- }
1269
- }, [
1270
- open
1271
- ]);
1272
- const handleSelect = (index) => {
1273
- setSelected(index);
1274
- };
1275
- const data = items[selected]?.content;
1276
- return /* @__PURE__ */ React6.createElement(ToggleContainer.Root, {
1277
- classNames: chatMessagePanel,
1278
- open,
1279
- onChangeOpen: setOpen
1280
- }, /* @__PURE__ */ React6.createElement(ToggleContainer.Header, {
1281
- classNames: chatMessagePanelHeader
1282
- }, /* @__PURE__ */ React6.createElement(TextCrawl, {
1283
- key: "status-roll",
1284
- lines: items.map((item) => item.title)
1285
- })), /* @__PURE__ */ React6.createElement(ToggleContainer.Content, {
1286
- classNames: [
1287
- "grid grid-cols-[32px_1fr]",
1288
- chatMessagePanelContent
1289
- ]
1290
- }, /* @__PURE__ */ React6.createElement(NumericTabs, {
1291
- ref: tabsRef,
1292
- classNames: "p-1",
1293
- length: items.length,
1294
- selected,
1295
- onSelect: handleSelect
1296
- }), /* @__PURE__ */ React6.createElement(Json, {
1297
- data,
1298
- classNames: chatMessageJson,
1299
- replacer: {
1300
- maxDepth: 3,
1301
- maxArrayLen: 10,
1302
- maxStringLen: 128
1303
- }
1304
- })));
1305
- } finally {
1306
- _effect.f();
1307
- }
1308
- };
1309
-
1310
- // src/components/ChatThread/registry.tsx
1311
- var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
1312
- var Fallback = ({ _tag, ...props }) => {
1313
- var _effect = _useSignals9();
1314
- try {
1315
- return /* @__PURE__ */ React7.createElement(ToggleContainer2.Root, {
1316
- classNames: "rounded-sm"
1317
- }, /* @__PURE__ */ React7.createElement(ToggleContainer2.Header, {
1318
- classNames: "bg-groupSurface"
1319
- }, _tag), /* @__PURE__ */ React7.createElement(ToggleContainer2.Content, {
1320
- classNames: "bg-modalSurface"
1321
- }, /* @__PURE__ */ React7.createElement(Json2, {
1322
- classNames: "!p-2 text-sm",
1323
- data: props
1324
- })));
1325
- } finally {
1326
- _effect.f();
1327
- }
1328
- };
1329
- var getTextChild = (children) => {
1330
- const child = children?.[0];
1331
- return typeof child === "string" ? child : null;
1332
- };
1333
- var componentRegistry = {
1334
- //
1335
- // Widgets
1336
- //
1337
- ["prompt"]: {
1338
- block: true,
1339
- factory: (props) => {
1340
- const text = getTextChild(props.children);
1341
- return text ? new PromptWidget(text) : null;
1342
- }
1343
- },
1344
- ["reference"]: {
1345
- block: false,
1346
- factory: (props) => {
1347
- const text = getTextChild(props.children);
1348
- return text && props.ref ? new ReferenceWidget(text, props.ref) : null;
1349
- }
1350
- },
1351
- ["select"]: {
1352
- block: true,
1353
- factory: (props) => {
1354
- const options = props.children?.map((option) => option._tag === "option" && getTextChild(option.children)).filter(Boolean);
1355
- return options?.length ? new SelectWidget(options) : null;
1356
- }
1357
- },
1358
- ["suggestion"]: {
1359
- block: true,
1360
- factory: (props) => {
1361
- const text = getTextChild(props.children);
1362
- return text ? new SuggestionWidget(text) : null;
1363
- }
1364
- },
1365
- ["summary"]: {
1366
- block: true,
1367
- factory: (props) => {
1368
- const text = getTextChild(props.children);
1369
- return text ? new SummaryWidget(text) : null;
1370
- }
1371
- },
1372
- //
1373
- // React
1374
- //
1375
- ["toolCall"]: {
1376
- block: true,
1377
- Component: ToolBlock
1378
- },
1379
- ["toolResult"]: {
1380
- block: true,
1381
- Component: Fallback
1382
- },
1383
- ["toolkit"]: {
1384
- block: true,
1385
- Component: Fallback
1386
- },
1387
- //
1388
- // Fallback
1389
- //
1390
- ["json"]: {
1391
- block: true,
1392
- Component: Fallback
1393
- }
1394
- };
1395
- var blockToMarkdown = (context, message, block) => {
1396
- let str = _blockToMarkdown(context, message, block);
1397
- if (str && !block.pending) {
1398
- return str += "\n";
1399
- }
1400
- return str;
1401
- };
1402
- var _blockToMarkdown = (context, message, block) => {
1403
- log4("blockToMarkdown", {
1404
- block: JSON.stringify(block)
1405
- }, {
1406
- F: __dxlog_file4,
1407
- L: 130,
1408
- S: void 0,
1409
- C: (f, a) => f(...a)
1410
- });
1411
- switch (block._tag) {
1412
- case "text": {
1413
- if (message.sender.role === "user") {
1414
- return `
1415
- <prompt>${block.text}</prompt>
1416
- `;
1417
- } else {
1418
- const text = block.text.trim();
1419
- if (text.length > 0) {
1420
- return text;
1421
- }
1422
- }
1423
- break;
1424
- }
1425
- case "suggestion": {
1426
- if (block.pending) {
1427
- return;
1428
- }
1429
- return `<suggestion>${block.text}</suggestion>`;
1430
- }
1431
- case "select": {
1432
- if (block.pending || block.options.length === 0) {
1433
- return;
1434
- }
1435
- return `<select>${block.options.map((option) => `<option>${option}</option>`).join("")}</select>`;
1436
- }
1437
- // TODO(burdon): Need label.
1438
- case "reference": {
1439
- return `<reference ref="${block.reference.dxn.toString()}">Ref</reference>`;
1440
- }
1441
- // case 'toolkit': {
1442
- // return `<toolkit />`;
1443
- // }
1444
- case "toolCall": {
1445
- context.updateWidget(block.toolCallId, {
1446
- blocks: [
1447
- block
1448
- ]
1449
- });
1450
- return `<toolCall id="${block.toolCallId}" />`;
1451
- }
1452
- case "toolResult": {
1453
- context.updateWidget(block.toolCallId, ({ blocks = [] }) => ({
1454
- blocks: [
1455
- ...blocks,
1456
- block
1457
- ]
1458
- }));
1459
- break;
1460
- }
1461
- case "summary": {
1462
- return `<summary>${ContentBlock2.createSummaryMessage(block)}</summary>`;
1463
- }
1464
- // TODO(burdon): Need stable ID.
1465
- default: {
1466
- return `<json id="${message.id}">
1467
- ${JSON.stringify(block)}
1468
- </json>`;
1469
- }
1470
- }
1471
- };
1472
-
1473
- // src/components/ChatThread/sync.ts
1474
- import { log as log5 } from "@dxos/log";
1475
- function _define_property3(obj, key, value) {
1476
- if (key in obj) {
1477
- Object.defineProperty(obj, key, {
1478
- value,
1479
- enumerable: true,
1480
- configurable: true,
1481
- writable: true
1482
- });
1483
- } else {
1484
- obj[key] = value;
1485
- }
1486
- return obj;
1487
- }
1488
- var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/sync.ts";
1489
- var MessageThreadContext = class {
1490
- updateWidget(id, value) {
1491
- this._widgetState?.updateWidget(id, value);
1492
- }
1493
- constructor(_widgetState) {
1494
- _define_property3(this, "_widgetState", void 0);
1495
- this._widgetState = _widgetState;
1496
- }
1497
- };
1498
- var MessageSyncer = class {
1499
- get context() {
1500
- return this._context;
1501
- }
1502
- reset() {
1503
- log5("reset", void 0, {
1504
- F: __dxlog_file5,
1505
- L: 58,
1506
- S: this,
1507
- C: (f, a) => f(...a)
1508
- });
1509
- this._initialMessageId = void 0;
1510
- this._currentMessageIndex = 0;
1511
- this._currentBlockIndex = 0;
1512
- this._currentBlockContent = void 0;
1513
- void this._model.reset("");
1514
- }
1515
- sync(messages) {
1516
- log5("sync", {
1517
- messages: messages.map((m) => m.blocks.length),
1518
- currentMessageIndex: this._currentMessageIndex,
1519
- currentBlockIndex: this._currentBlockIndex,
1520
- currentBlockContent: this._currentBlockContent
1521
- }, {
1522
- F: __dxlog_file5,
1523
- L: 67,
1524
- S: this,
1525
- C: (f, a) => f(...a)
1526
- });
1527
- if (this._initialMessageId !== messages[0]?.id) {
1528
- this.reset();
1529
- this._initialMessageId = messages[0]?.id;
1530
- }
1531
- let i = this._currentMessageIndex;
1532
- for (const message of messages.slice(this._currentMessageIndex)) {
1533
- if (i > this._currentMessageIndex) {
1534
- this._currentBlockIndex = 0;
1535
- }
1536
- this._currentMessageIndex = i;
1537
- let j = this._currentBlockIndex;
1538
- for (const block of message.blocks.slice(this._currentBlockIndex)) {
1539
- this._currentBlockIndex = j;
1540
- const currentBlockContent = this._blockRenderer(this._context, message, block);
1541
- if (currentBlockContent) {
1542
- let content = "";
1543
- if (this._currentBlockContent && currentBlockContent.startsWith(this._currentBlockContent)) {
1544
- content = currentBlockContent.slice(this._currentBlockContent.length);
1545
- } else {
1546
- content = currentBlockContent;
1547
- }
1548
- void this._model.append(content);
1549
- this._currentBlockContent = currentBlockContent;
1550
- log5("append", {
1551
- message: i,
1552
- block: j,
1553
- content
1554
- }, {
1555
- F: __dxlog_file5,
1556
- L: 99,
1557
- S: this,
1558
- C: (f, a) => f(...a)
1559
- });
1560
- }
1561
- if (block.pending) {
1562
- return;
1563
- } else {
1564
- this._currentBlockContent = void 0;
1565
- this._currentBlockIndex++;
1566
- }
1567
- j++;
1568
- }
1569
- i++;
1570
- }
1571
- }
1572
- constructor(_model, _blockRenderer) {
1573
- _define_property3(this, "_model", void 0);
1574
- _define_property3(this, "_blockRenderer", void 0);
1575
- _define_property3(this, "_initialMessageId", void 0);
1576
- _define_property3(this, "_currentMessageIndex", void 0);
1577
- _define_property3(this, "_currentBlockIndex", void 0);
1578
- _define_property3(this, "_currentBlockContent", void 0);
1579
- _define_property3(this, "_context", void 0);
1580
- this._model = _model;
1581
- this._blockRenderer = _blockRenderer;
1582
- this._currentMessageIndex = 0;
1583
- this._currentBlockIndex = 0;
1584
- this._context = new MessageThreadContext(this._model);
1585
- }
1586
- };
1587
-
1588
- // src/components/ChatThread/ChatThread.tsx
1589
- var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages = [], error, cursor = false, fadeIn = true, onEvent }, forwardedRef) => {
1590
- var _effect = _useSignals10();
1591
- try {
1592
- const userHue = useMemo10(() => {
1593
- return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
1594
- }, [
1595
- identity
1596
- ]);
1597
- const [controller, setController] = useState9(null);
1598
- useImperativeHandle(forwardedRef, () => controller ? controller : null, [
1599
- controller
1600
- ]);
1601
- useEffect5(() => {
1602
- controller?.scrollToBottom();
1603
- }, [
1604
- controller,
1605
- error
1606
- ]);
1607
- const syncer = useMemo10(() => controller && new MessageSyncer(controller, blockToMarkdown), [
1608
- controller
1609
- ]);
1610
- useEffect5(() => {
1611
- syncer?.sync(messages);
1612
- }, [
1613
- syncer,
1614
- messages
1615
- ]);
1616
- const handleEvent = useCallback5((ev) => {
1617
- switch (ev.type) {
1618
- case "submit": {
1619
- ev.value && onEvent?.({
1620
- type: "submit",
1621
- text: ev.value
1622
- });
1623
- break;
1624
- }
1625
- }
1626
- }, [
1627
- onEvent
1628
- ]);
1629
- return /* @__PURE__ */ React8.createElement("div", {
1630
- className: mx4("flex bs-full is-full justify-center overflow-hidden", classNames),
1631
- style: {
1632
- "--user-fill": `var(--dx-${userHue}Fill)`
1633
- }
1634
- }, /* @__PURE__ */ React8.createElement(MarkdownStream, {
1635
- ref: setController,
1636
- classNames: "bs-full max-is-prose overflow-hidden",
1637
- registry: componentRegistry,
1638
- cursor,
1639
- fadeIn,
1640
- onEvent: handleEvent
1641
- }));
1642
- } finally {
1643
- _effect.f();
1644
- }
1645
- });
1646
-
1647
- // src/components/Chat/Chat.tsx
1648
- var [ChatContextProvider, useChatContext] = createContext("Chat");
1649
- var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) => {
1650
- var _effect = _useSignals11();
1651
- try {
1652
- const [debug, setDebug] = useState10(false);
1653
- const space = getSpace(chat);
1654
- const queue = useQueue2(chat?.queue.dxn);
1655
- const pending = useRxValue(processor.messages);
1656
- const streaming = useRxValue(processor.streaming);
1657
- const lastPrompt = useRef3(void 0);
1658
- const messages = useMemo11(() => {
1659
- const queueMessages = queue?.objects?.filter(Obj8.instanceOf(DataType3.Message)) ?? [];
1660
- return Array2.dedupeWith([
1661
- ...queueMessages,
1662
- ...pending
1663
- ], (a, b) => a.id === b.id);
1664
- }, [
1665
- queue?.objects,
1666
- pending
1667
- ]);
1668
- const event = useMemo11(() => new Event(), []);
1669
- useEffect6(() => {
1670
- return event.on((ev) => {
1671
- switch (ev.type) {
1672
- case "toggle-debug": {
1673
- setDebug((current) => !current);
1674
- break;
1675
- }
1676
- case "submit": {
1677
- const text = ev.text.trim();
1678
- if (!streaming && text.length) {
1679
- lastPrompt.current = ev.text;
1680
- void processor.request({
1681
- message: text
1682
- });
1683
- }
1684
- break;
1685
- }
1686
- case "retry": {
1687
- if (!streaming) {
1688
- void processor.retry();
1689
- }
1690
- break;
1691
- }
1692
- case "cancel": {
1693
- if (streaming) {
1694
- void processor.cancel();
1695
- if (lastPrompt.current) {
1696
- event.emit({
1697
- type: "update-prompt",
1698
- text: lastPrompt.current
1699
- });
1700
- }
1701
- }
1702
- break;
1703
- }
1704
- default: {
1705
- onEvent?.(ev);
1706
- }
1707
- }
1708
- });
1709
- }, [
1710
- event,
1711
- processor,
1712
- streaming,
1713
- onEvent
1714
- ]);
1715
- if (!space) {
1716
- return null;
1717
- }
1718
- return /* @__PURE__ */ React9.createElement(ChatContextProvider, {
1719
- debug,
1720
- event,
1721
- chat,
1722
- space,
1723
- messages,
1724
- processor,
1725
- ...props
1726
- }, /* @__PURE__ */ React9.createElement("div", {
1727
- role: "none",
1728
- className: mx5("flex flex-col h-full overflow-hidden", classNames)
1729
- }, children));
1730
- } finally {
1731
- _effect.f();
1732
- }
1733
- };
1734
- ChatRoot.displayName = "Chat.Root";
1735
- var ChatPrompt = ({ classNames, outline, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
1736
- var _effect = _useSignals11();
1737
- try {
1738
- const { t } = useTranslation5(meta.id);
1739
- const { space, event, processor } = useChatContext(ChatPrompt.displayName);
1740
- const error = useRxValue(processor.error).pipe(Option3.getOrUndefined);
1741
- const streaming = useRxValue(processor.streaming);
1742
- const active = useRxValue(processor.active);
1743
- const activeRef = useDynamicRef(active);
1744
- const editorRef = useRef3(null);
1745
- const [recordingState, setRecordingState] = useState10(false);
1746
- useEffect6(() => {
1747
- return event.on((event2) => {
1748
- switch (event2.type) {
1749
- case "update-prompt":
1750
- if (!editorRef.current?.getText()?.length) {
1751
- editorRef.current?.setText(event2.text);
1752
- editorRef.current?.focus();
1753
- }
1754
- break;
1755
- case "record-start":
1756
- setRecordingState(true);
1757
- break;
1758
- case "record-stop":
1759
- setRecordingState(false);
1760
- break;
1761
- }
1762
- });
1763
- }, [
1764
- event
1765
- ]);
1766
- const { recording } = useVoiceInput({
1767
- active: recordingState,
1768
- onUpdate: (text) => {
1769
- editorRef.current?.setText(text);
1770
- editorRef.current?.focus();
1771
- }
1772
- });
1773
- const referencesProvider = useReferencesProvider(space);
1774
- const extensions = useMemo11(() => {
1775
- return [
1776
- referencesProvider && references({
1777
- provider: referencesProvider
1778
- }),
1779
- Prec.highest(keymap.of([
1780
- {
1781
- key: "cmd-d",
1782
- preventDefault: true,
1783
- run: () => {
1784
- event.emit({
1785
- type: "toggle-debug"
1786
- });
1787
- return true;
1788
- }
1789
- },
1790
- expandable && {
1791
- key: "cmd-ArrowUp",
1792
- preventDefault: true,
1793
- run: () => {
1794
- event.emit({
1795
- type: "thread-open"
1796
- });
1797
- return true;
1798
- }
1799
- },
1800
- expandable && {
1801
- key: "cmd-ArrowDown",
1802
- preventDefault: true,
1803
- run: () => {
1804
- event.emit({
1805
- type: "thread-close"
1806
- });
1807
- return true;
1808
- }
1809
- }
1810
- ].filter(isNotFalsy2)))
1811
- ].filter(isNotFalsy2);
1812
- }, [
1813
- event,
1814
- expandable,
1815
- referencesProvider
1816
- ]);
1817
- const handleSubmit = useCallback6((text) => {
1818
- if (!activeRef.current) {
1819
- event.emit({
1820
- type: "submit",
1821
- text
1822
- });
1823
- return true;
1824
- }
1825
- }, [
1826
- event
1827
- ]);
1828
- const handleEvent = useCallback6((ev) => {
1829
- event.emit(ev);
1830
- }, [
1831
- event
1832
- ]);
1833
- return /* @__PURE__ */ React9.createElement("div", {
1834
- className: mx5("is-full flex flex-col density-fine", outline && [
1835
- "p-2 bg-groupSurface border border-subduedSeparator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded"
1836
- ], classNames)
1837
- }, /* @__PURE__ */ React9.createElement("div", {
1838
- className: "flex gap-2"
1839
- }, /* @__PURE__ */ React9.createElement(ChatStatusIndicator, {
1840
- classNames: "p-1",
1841
- preset,
1842
- error,
1843
- processing: streaming
1844
- }), /* @__PURE__ */ React9.createElement(ChatEditor, {
1845
- ref: editorRef,
1846
- autoFocus: true,
1847
- lineWrapping: true,
1848
- classNames: "col-span-2 pbs-0.5",
1849
- placeholder: placeholder ?? t("prompt placeholder"),
1850
- extensions,
1851
- onSubmit: handleSubmit
1852
- })), /* @__PURE__ */ React9.createElement("div", {
1853
- className: "flex pbs-2 items-center"
1854
- }, /* @__PURE__ */ React9.createElement(ChatOptions, {
1855
- space,
1856
- blueprintRegistry: processor.blueprintRegistry,
1857
- context: processor.context,
1858
- preset,
1859
- presets,
1860
- onPresetChange
1861
- }), /* @__PURE__ */ React9.createElement("div", {
1862
- role: "none",
1863
- className: "pli-cardSpacingChrome grow"
1864
- }, /* @__PURE__ */ React9.createElement(ChatReferences, {
1865
- space,
1866
- context: processor.context
1867
- })), /* @__PURE__ */ React9.createElement(ChatActions, {
1868
- classNames: "col-span-2",
1869
- microphone: true,
1870
- recording,
1871
- processing: streaming,
1872
- onEvent: handleEvent
1873
- }, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Switch, {
1874
- classNames: "mis-2 mie-2",
1875
- checked: online,
1876
- onCheckedChange: onOnlineChange
1877
- })))));
1878
- } finally {
1879
- _effect.f();
1880
- }
1881
- };
1882
- ChatPrompt.displayName = "Chat.Prompt";
1883
- var ChatThread2 = (props) => {
1884
- var _effect = _useSignals11();
1885
- try {
1886
- const { event, messages, processor } = useChatContext(ChatThread2.displayName);
1887
- const identity = useIdentity();
1888
- const error = useRxValue(processor.error).pipe(Option3.getOrUndefined);
1889
- const scrollerRef = useRef3(null);
1890
- useEffect6(() => {
1891
- return event.on((event2) => {
1892
- switch (event2.type) {
1893
- case "submit":
1894
- case "scroll-to-bottom":
1895
- scrollerRef.current?.scrollToBottom();
1896
- break;
1897
- }
1898
- });
1899
- }, [
1900
- event
1901
- ]);
1902
- const handleEvent = useCallback6((ev) => {
1903
- event.emit(ev);
1904
- }, [
1905
- event
1906
- ]);
1907
- if (!identity) {
1908
- return null;
1909
- }
1910
- return /* @__PURE__ */ React9.createElement(ChatThread, {
1911
- ...props,
1912
- ref: scrollerRef,
1913
- identity,
1914
- messages,
1915
- error,
1916
- onEvent: handleEvent
1917
- });
1918
- } finally {
1919
- _effect.f();
1920
- }
1921
- };
1922
- ChatThread2.displayName = "Chat.Thread";
1923
- var Chat = {
1924
- Root: ChatRoot,
1925
- Prompt: ChatPrompt,
1926
- Thread: ChatThread2
1927
- };
1928
-
1929
- export {
1930
- useBlueprintRegistry,
1931
- useChatProcessor,
1932
- useChatServices,
1933
- useContextBinder,
1934
- useExecutionGraph,
1935
- useOnline,
1936
- usePresets,
1937
- ChatContextProvider,
1938
- useChatContext,
1939
- Chat
1940
- };
1941
- //# sourceMappingURL=chunk-YOBHCEEI.mjs.map