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

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 (476) hide show
  1. package/dist/lib/browser/{BlueprintContainer-H7H4BQ2C.mjs → BlueprintContainer-WX2SSDVI.mjs} +6 -7
  2. package/dist/lib/browser/{BlueprintContainer-H7H4BQ2C.mjs.map → BlueprintContainer-WX2SSDVI.mjs.map} +3 -3
  3. package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs +150 -0
  4. package/dist/lib/browser/ChatCompanion-BDZ55ZRF.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-OUVSX5V5.mjs → ChatContainer-RYGNN73X.mjs} +20 -23
  6. package/dist/lib/browser/ChatContainer-RYGNN73X.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-P4FLEOHG.mjs → ChatDialog-MVHH2U66.mjs} +12 -12
  8. package/dist/lib/browser/ChatDialog-MVHH2U66.mjs.map +7 -0
  9. package/dist/lib/browser/{SequenceContainer-627OQ557.mjs → SequenceContainer-2FEWMQGW.mjs} +6 -19
  10. package/dist/lib/browser/SequenceContainer-2FEWMQGW.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-ERTZBTP3.mjs +19 -0
  12. package/dist/lib/browser/ai-service-ERTZBTP3.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-AVHHQ3KV.mjs → app-graph-builder-2U7SLCRX.mjs} +22 -34
  14. package/dist/lib/browser/app-graph-builder-2U7SLCRX.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs +12 -0
  16. package/dist/lib/browser/blueprint-definition-NSJARW5U.mjs.map +7 -0
  17. package/dist/lib/browser/{blueprint-definition-CMGIZAOW.mjs → chunk-2CE2KPKZ.mjs} +69 -40
  18. package/dist/lib/browser/chunk-2CE2KPKZ.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-43I2LR6O.mjs +216 -0
  20. package/dist/lib/browser/chunk-43I2LR6O.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-5EGXHCAZ.mjs +16 -0
  22. package/dist/lib/browser/chunk-5EGXHCAZ.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-5RICKAMN.mjs +18 -0
  24. package/dist/lib/browser/chunk-5RICKAMN.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-CQ7UHYTT.mjs +296 -0
  26. package/dist/lib/browser/chunk-CQ7UHYTT.mjs.map +7 -0
  27. package/dist/lib/browser/{chunk-HRLMD35M.mjs → chunk-FP56WB24.mjs} +36 -15
  28. package/dist/lib/browser/chunk-FP56WB24.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-JZRZVB2A.mjs +170 -0
  30. package/dist/lib/browser/chunk-JZRZVB2A.mjs.map +7 -0
  31. package/dist/lib/browser/chunk-WRJGOT5P.mjs +1794 -0
  32. package/dist/lib/browser/chunk-WRJGOT5P.mjs.map +7 -0
  33. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs +18 -0
  34. package/dist/lib/browser/edge-model-resolver-O6OFYIO2.mjs.map +7 -0
  35. package/dist/lib/browser/index.mjs +127 -54
  36. package/dist/lib/browser/index.mjs.map +4 -4
  37. package/dist/lib/browser/{intent-resolver-MVOIEJXZ.mjs → intent-resolver-3GOJMBXJ.mjs} +48 -15
  38. package/dist/lib/browser/intent-resolver-3GOJMBXJ.mjs.map +7 -0
  39. package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs +17 -0
  40. package/dist/lib/browser/local-model-resolver-GO6ZEMLL.mjs.map +7 -0
  41. package/dist/lib/browser/meta.json +1 -1
  42. package/dist/lib/browser/{react-surface-4HXS3YLT.mjs → react-surface-FTKCE6GG.mjs} +20 -76
  43. package/dist/lib/browser/react-surface-FTKCE6GG.mjs.map +7 -0
  44. package/dist/lib/browser/{settings-G2EZXMWT.mjs → settings-HBF32KV6.mjs} +5 -5
  45. package/dist/lib/browser/{settings-G2EZXMWT.mjs.map → settings-HBF32KV6.mjs.map} +1 -1
  46. package/dist/lib/browser/state-LXTS54DI.mjs +21 -0
  47. package/dist/lib/browser/state-LXTS54DI.mjs.map +7 -0
  48. package/dist/lib/browser/toolkit-NQ2GXCF5.mjs +199 -0
  49. package/dist/lib/browser/toolkit-NQ2GXCF5.mjs.map +7 -0
  50. package/dist/lib/browser/types/index.mjs +2 -2
  51. package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs → BlueprintContainer-4MKN6ZRB.mjs} +6 -7
  52. package/dist/lib/node-esm/{BlueprintContainer-VH4EE4CM.mjs.map → BlueprintContainer-4MKN6ZRB.mjs.map} +3 -3
  53. package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs +151 -0
  54. package/dist/lib/node-esm/ChatCompanion-XFNXVZIP.mjs.map +7 -0
  55. package/dist/lib/node-esm/{ChatContainer-D5FABDNE.mjs → ChatContainer-UTJGCQXF.mjs} +20 -23
  56. package/dist/lib/node-esm/ChatContainer-UTJGCQXF.mjs.map +7 -0
  57. package/dist/lib/node-esm/{ChatDialog-NKWVXHJP.mjs → ChatDialog-QEYZ4IOV.mjs} +12 -12
  58. package/dist/lib/node-esm/ChatDialog-QEYZ4IOV.mjs.map +7 -0
  59. package/dist/lib/node-esm/{SequenceContainer-EQ5NP2PG.mjs → SequenceContainer-PGGJUQ46.mjs} +6 -19
  60. package/dist/lib/node-esm/SequenceContainer-PGGJUQ46.mjs.map +7 -0
  61. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs +20 -0
  62. package/dist/lib/node-esm/ai-service-MUYLV3NT.mjs.map +7 -0
  63. package/dist/lib/node-esm/{app-graph-builder-RMOUJMMG.mjs → app-graph-builder-OKNLR7H2.mjs} +22 -34
  64. package/dist/lib/node-esm/app-graph-builder-OKNLR7H2.mjs.map +7 -0
  65. package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs +13 -0
  66. package/dist/lib/node-esm/blueprint-definition-WD2IVMAI.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-73ABYRYX.mjs +20 -0
  68. package/dist/lib/node-esm/chunk-73ABYRYX.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-DSE2IILK.mjs +217 -0
  70. package/dist/lib/node-esm/chunk-DSE2IILK.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-E2WXZND7.mjs +297 -0
  72. package/dist/lib/node-esm/chunk-E2WXZND7.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-HXIBCBH4.mjs +171 -0
  74. package/dist/lib/node-esm/chunk-HXIBCBH4.mjs.map +7 -0
  75. package/dist/lib/node-esm/{chunk-F7RXCX5Y.mjs → chunk-TNR46C3L.mjs} +36 -15
  76. package/dist/lib/node-esm/chunk-TNR46C3L.mjs.map +7 -0
  77. package/dist/lib/node-esm/{blueprint-definition-AEWYMW6I.mjs → chunk-U2NYUS2N.mjs} +69 -39
  78. package/dist/lib/node-esm/chunk-U2NYUS2N.mjs.map +7 -0
  79. package/dist/lib/node-esm/chunk-UFKLCEAE.mjs +1795 -0
  80. package/dist/lib/node-esm/chunk-UFKLCEAE.mjs.map +7 -0
  81. package/dist/lib/node-esm/{chunk-X6AANUHZ.mjs → chunk-XQGWSZ4T.mjs} +4 -4
  82. package/dist/lib/node-esm/chunk-XQGWSZ4T.mjs.map +7 -0
  83. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs +19 -0
  84. package/dist/lib/node-esm/edge-model-resolver-2ARXDOYS.mjs.map +7 -0
  85. package/dist/lib/node-esm/index.mjs +127 -54
  86. package/dist/lib/node-esm/index.mjs.map +4 -4
  87. package/dist/lib/node-esm/{intent-resolver-DTDNCX3C.mjs → intent-resolver-6XLVTRDJ.mjs} +48 -15
  88. package/dist/lib/node-esm/intent-resolver-6XLVTRDJ.mjs.map +7 -0
  89. package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs +18 -0
  90. package/dist/lib/node-esm/local-model-resolver-WOQ2D2R2.mjs.map +7 -0
  91. package/dist/lib/node-esm/meta.json +1 -1
  92. package/dist/lib/node-esm/{react-surface-V6JNEZVO.mjs → react-surface-K7ZXQLAP.mjs} +20 -76
  93. package/dist/lib/node-esm/react-surface-K7ZXQLAP.mjs.map +7 -0
  94. package/dist/lib/node-esm/{settings-AIP5FOJG.mjs → settings-CWP6MTWP.mjs} +5 -5
  95. package/dist/lib/node-esm/{settings-AIP5FOJG.mjs.map → settings-CWP6MTWP.mjs.map} +1 -1
  96. package/dist/lib/node-esm/state-BO6GUFLB.mjs +22 -0
  97. package/dist/lib/node-esm/state-BO6GUFLB.mjs.map +7 -0
  98. package/dist/lib/node-esm/toolkit-V57PRJNG.mjs +200 -0
  99. package/dist/lib/node-esm/toolkit-V57PRJNG.mjs.map +7 -0
  100. package/dist/lib/node-esm/types/index.mjs +2 -2
  101. package/dist/types/src/AssistantPlugin.d.ts +1 -1
  102. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  103. package/dist/types/src/capabilities/ai-service.d.ts +2 -3
  104. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  106. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -1
  108. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/capabilities.d.ts +8 -8
  110. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/edge-model-resolver.d.ts +2 -3
  112. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/index.d.ts +7 -4
  114. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  115. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  116. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  118. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  120. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  121. package/dist/types/src/capabilities/settings.d.ts +1 -1
  122. package/dist/types/src/capabilities/state.d.ts +4 -0
  123. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  124. package/dist/types/src/capabilities/toolkit.d.ts +2 -3
  125. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -1
  126. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  127. package/dist/types/src/components/Chat/Chat.d.ts +16 -10
  128. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  129. package/dist/types/src/components/Chat/events.d.ts +5 -0
  130. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  131. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  132. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  133. package/dist/types/src/components/ChatContainer.d.ts +3 -4
  134. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  135. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  136. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  137. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  138. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  139. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  140. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +11 -4
  141. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  142. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  143. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -4
  144. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  145. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  146. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  147. package/dist/types/src/components/ChatThread/ChatThread.d.ts +12 -7
  148. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  149. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +112 -56
  150. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  151. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -1
  152. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  153. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  154. package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
  155. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
  156. package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
  157. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
  158. package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
  159. package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
  160. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  161. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  162. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts +1 -1
  163. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  164. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +264 -3
  165. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  166. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
  167. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  168. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +262 -7
  169. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  170. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +1 -1
  171. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  172. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +259 -2
  173. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  174. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
  175. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
  176. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
  177. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
  178. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
  179. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
  180. package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
  181. package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
  182. package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
  183. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  184. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  185. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  186. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
  187. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
  188. package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -3
  189. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  190. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +263 -5
  191. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  192. package/dist/types/src/components/index.d.ts +4 -2
  193. package/dist/types/src/components/index.d.ts.map +1 -1
  194. package/dist/types/src/functions/analysis.d.ts.map +1 -1
  195. package/dist/types/src/functions/list.d.ts.map +1 -1
  196. package/dist/types/src/functions/load.d.ts +1 -1
  197. package/dist/types/src/functions/load.d.ts.map +1 -1
  198. package/dist/types/src/hooks/index.d.ts +4 -4
  199. package/dist/types/src/hooks/index.d.ts.map +1 -1
  200. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +5 -1
  201. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  202. package/dist/types/src/hooks/useChatProcessor.d.ts +4 -10
  203. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  204. package/dist/types/src/hooks/useChatServices.d.ts +5 -5
  205. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  206. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  207. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  208. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  209. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  210. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  211. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  212. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  213. package/dist/types/src/hooks/usePresets.d.ts +2 -2
  214. package/dist/types/src/hooks/usePresets.d.ts.map +1 -1
  215. package/dist/types/src/index.d.ts +2 -0
  216. package/dist/types/src/index.d.ts.map +1 -1
  217. package/dist/types/src/meta.d.ts +1 -2
  218. package/dist/types/src/meta.d.ts.map +1 -1
  219. package/dist/types/src/processor/index.d.ts +3 -0
  220. package/dist/types/src/processor/index.d.ts.map +1 -0
  221. package/dist/types/src/{hooks → processor}/presets.d.ts +1 -1
  222. package/dist/types/src/processor/presets.d.ts.map +1 -0
  223. package/dist/types/src/processor/processor.d.ts +74 -0
  224. package/dist/types/src/processor/processor.d.ts.map +1 -0
  225. package/dist/types/src/processor/processor.test.d.ts +2 -0
  226. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  227. package/dist/types/src/testing/index.d.ts +1 -1
  228. package/dist/types/src/testing/index.d.ts.map +1 -1
  229. package/dist/types/src/testing/test-generator.d.ts +7 -0
  230. package/dist/types/src/testing/test-generator.d.ts.map +1 -0
  231. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  232. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  233. package/dist/types/src/testing/test-services.d.ts +2 -2
  234. package/dist/types/src/testing/test-services.d.ts.map +1 -1
  235. package/dist/types/src/translations.d.ts +27 -16
  236. package/dist/types/src/translations.d.ts.map +1 -1
  237. package/dist/types/src/types/Assistant.d.ts +16 -5
  238. package/dist/types/src/types/Assistant.d.ts.map +1 -1
  239. package/dist/types/src/types/AssistantAction.d.ts +23 -6
  240. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  241. package/dist/types/src/types/service.d.ts +21 -18
  242. package/dist/types/src/types/service.d.ts.map +1 -1
  243. package/dist/types/tsconfig.tsbuildinfo +1 -1
  244. package/package.json +90 -96
  245. package/src/AssistantPlugin.tsx +138 -116
  246. package/src/capabilities/ai-service.ts +6 -7
  247. package/src/capabilities/app-graph-builder.ts +39 -45
  248. package/src/capabilities/blueprint-definition.ts +51 -19
  249. package/src/capabilities/capabilities.ts +8 -12
  250. package/src/capabilities/edge-model-resolver.ts +17 -21
  251. package/src/capabilities/index.ts +5 -2
  252. package/src/capabilities/intent-resolver.ts +38 -15
  253. package/src/capabilities/local-model-resolver.ts +30 -0
  254. package/src/capabilities/react-surface.tsx +9 -63
  255. package/src/capabilities/state.ts +20 -0
  256. package/src/capabilities/toolkit.ts +93 -31
  257. package/src/components/AssistantSettings/AssistantSettings.tsx +82 -75
  258. package/src/components/BlueprintContainer.tsx +2 -2
  259. package/src/components/Chat/Chat.tsx +167 -172
  260. package/src/components/Chat/events.ts +7 -0
  261. package/src/components/ChatCompanion.tsx +136 -0
  262. package/src/components/ChatContainer.tsx +13 -31
  263. package/src/components/ChatDialog.tsx +11 -11
  264. package/src/components/ChatProgress/ChatProgress.tsx +67 -0
  265. package/src/components/ChatProgress/index.ts +5 -0
  266. package/src/components/ChatPrompt/ChatActions.tsx +10 -24
  267. package/src/components/ChatPrompt/ChatOptions.tsx +200 -34
  268. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  269. package/src/components/ChatPrompt/ChatReferences.tsx +29 -36
  270. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  271. package/src/components/ChatThread/ChatThread.stories.tsx +74 -205
  272. package/src/components/ChatThread/ChatThread.tsx +69 -29
  273. package/src/components/ChatThread/Link.tsx +8 -21
  274. package/src/components/ChatThread/reducers.ts +151 -0
  275. package/src/components/ChatThread/registry.tsx +184 -0
  276. package/src/components/ChatThread/sync.test.ts +81 -0
  277. package/src/components/ChatThread/sync.ts +113 -0
  278. package/src/components/PromptSettings.tsx +1 -0
  279. package/src/components/SequenceContainer.tsx +27 -29
  280. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +8 -6
  281. package/src/components/SequenceEditor/SequenceEditor.tsx +2 -2
  282. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +17 -13
  283. package/src/components/TemplateEditor/TemplateEditor.tsx +16 -50
  284. package/src/components/TemplateEditor/TemplateForm.stories.tsx +6 -8
  285. package/src/components/TemplateEditor/TemplateForm.tsx +2 -1
  286. package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
  287. package/src/components/ToolBlock/ToolBlock.tsx +152 -0
  288. package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
  289. package/src/components/ToolBlock/index.ts +6 -0
  290. package/src/components/Toolbar/Toolbar.tsx +21 -0
  291. package/src/components/{Timeline → Toolbar}/index.ts +1 -1
  292. package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
  293. package/src/components/Toolbox/Toolbox.stories.tsx +9 -12
  294. package/src/components/Toolbox/Toolbox.tsx +10 -16
  295. package/src/components/index.ts +3 -1
  296. package/src/functions/analysis.ts +6 -4
  297. package/src/functions/list.ts +9 -3
  298. package/src/functions/load.ts +8 -5
  299. package/src/hooks/index.ts +4 -5
  300. package/src/hooks/useBlueprintRegistry.ts +24 -9
  301. package/src/hooks/useChatProcessor.ts +19 -26
  302. package/src/hooks/useChatServices.ts +30 -53
  303. package/src/hooks/useContextBinder.ts +30 -0
  304. package/src/hooks/useContextObjects.ts +58 -0
  305. package/src/hooks/useItemTypes.ts +37 -0
  306. package/src/hooks/usePresets.ts +4 -5
  307. package/src/index.ts +2 -0
  308. package/src/meta.ts +4 -6
  309. package/src/processor/index.ts +6 -0
  310. package/src/{hooks → processor}/presets.ts +10 -3
  311. package/src/processor/processor.test.ts +81 -0
  312. package/src/processor/processor.ts +302 -0
  313. package/src/queue-logger.ts +5 -5
  314. package/src/testing/index.ts +1 -1
  315. package/src/testing/test-generator.ts +261 -0
  316. package/src/testing/test-sequence.ts +1 -26
  317. package/src/testing/test-services.ts +2 -8
  318. package/src/translations.ts +29 -17
  319. package/src/types/Assistant.ts +9 -4
  320. package/src/types/AssistantAction.ts +11 -3
  321. package/src/types/service.ts +15 -7
  322. package/src/vite-env.d.ts +30 -0
  323. package/dist/lib/browser/ChatContainer-OUVSX5V5.mjs.map +0 -7
  324. package/dist/lib/browser/ChatDialog-P4FLEOHG.mjs.map +0 -7
  325. package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +0 -7
  326. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +0 -22
  327. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +0 -7
  328. package/dist/lib/browser/app-graph-builder-AVHHQ3KV.mjs.map +0 -7
  329. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +0 -7
  330. package/dist/lib/browser/chunk-BRLHDHOF.mjs +0 -244
  331. package/dist/lib/browser/chunk-BRLHDHOF.mjs.map +0 -7
  332. package/dist/lib/browser/chunk-HRLMD35M.mjs.map +0 -7
  333. package/dist/lib/browser/chunk-LKP65RPA.mjs +0 -20
  334. package/dist/lib/browser/chunk-LKP65RPA.mjs.map +0 -7
  335. package/dist/lib/browser/chunk-NZDCKQ6W.mjs +0 -89
  336. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +0 -7
  337. package/dist/lib/browser/chunk-QB7OVS6Z.mjs +0 -16
  338. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +0 -7
  339. package/dist/lib/browser/chunk-VEBVAHNM.mjs +0 -2231
  340. package/dist/lib/browser/chunk-VEBVAHNM.mjs.map +0 -7
  341. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +0 -24
  342. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +0 -7
  343. package/dist/lib/browser/intent-resolver-MVOIEJXZ.mjs.map +0 -7
  344. package/dist/lib/browser/react-surface-4HXS3YLT.mjs.map +0 -7
  345. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +0 -105
  346. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +0 -7
  347. package/dist/lib/node-esm/ChatContainer-D5FABDNE.mjs.map +0 -7
  348. package/dist/lib/node-esm/ChatDialog-NKWVXHJP.mjs.map +0 -7
  349. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +0 -7
  350. package/dist/lib/node-esm/ai-service-LDD32477.mjs +0 -23
  351. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +0 -7
  352. package/dist/lib/node-esm/app-graph-builder-RMOUJMMG.mjs.map +0 -7
  353. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +0 -7
  354. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs +0 -2232
  355. package/dist/lib/node-esm/chunk-3SOC5GOP.mjs.map +0 -7
  356. package/dist/lib/node-esm/chunk-F7RXCX5Y.mjs.map +0 -7
  357. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs +0 -90
  358. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +0 -7
  359. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +0 -22
  360. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs.map +0 -7
  361. package/dist/lib/node-esm/chunk-RD755HN3.mjs +0 -245
  362. package/dist/lib/node-esm/chunk-RD755HN3.mjs.map +0 -7
  363. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +0 -7
  364. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +0 -25
  365. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +0 -7
  366. package/dist/lib/node-esm/intent-resolver-DTDNCX3C.mjs.map +0 -7
  367. package/dist/lib/node-esm/react-surface-V6JNEZVO.mjs.map +0 -7
  368. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +0 -106
  369. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +0 -7
  370. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -18
  371. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
  372. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
  373. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
  374. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  375. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  376. package/dist/types/src/components/Timeline/Timeline.d.ts +0 -24
  377. package/dist/types/src/components/Timeline/Timeline.d.ts.map +0 -1
  378. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +0 -9
  379. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +0 -1
  380. package/dist/types/src/components/Timeline/index.d.ts +0 -2
  381. package/dist/types/src/components/Timeline/index.d.ts.map +0 -1
  382. package/dist/types/src/hooks/chat-processor.d.ts +0 -72
  383. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  384. package/dist/types/src/hooks/errors.d.ts +0 -4
  385. package/dist/types/src/hooks/errors.d.ts.map +0 -1
  386. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  387. package/dist/types/src/hooks/useResolveRef.d.ts +0 -4
  388. package/dist/types/src/hooks/useResolveRef.d.ts.map +0 -1
  389. package/dist/types/src/parser/filter-generator.d.ts +0 -4
  390. package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
  391. package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
  392. package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
  393. package/dist/types/src/parser/index.d.ts +0 -4
  394. package/dist/types/src/parser/index.d.ts.map +0 -1
  395. package/dist/types/src/parser/query-parser.d.ts +0 -15
  396. package/dist/types/src/parser/query-parser.d.ts.map +0 -1
  397. package/dist/types/src/parser/query-parser.test.d.ts +0 -2
  398. package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
  399. package/dist/types/src/parser/types.d.ts +0 -24
  400. package/dist/types/src/parser/types.d.ts.map +0 -1
  401. package/dist/types/src/stories/Chat.stories.d.ts +0 -268
  402. package/dist/types/src/stories/Chat.stories.d.ts.map +0 -1
  403. package/dist/types/src/stories/components/BlueprintContainer.d.ts +0 -5
  404. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +0 -1
  405. package/dist/types/src/stories/components/ChatContainer.d.ts +0 -5
  406. package/dist/types/src/stories/components/ChatContainer.d.ts.map +0 -1
  407. package/dist/types/src/stories/components/GraphContainer.d.ts +0 -6
  408. package/dist/types/src/stories/components/GraphContainer.d.ts.map +0 -1
  409. package/dist/types/src/stories/components/LoggingContainer.d.ts +0 -5
  410. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +0 -1
  411. package/dist/types/src/stories/components/SurfaceContainer.d.ts +0 -8
  412. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +0 -1
  413. package/dist/types/src/stories/components/TasksContainer.d.ts +0 -5
  414. package/dist/types/src/stories/components/TasksContainer.d.ts.map +0 -1
  415. package/dist/types/src/stories/components/index.d.ts +0 -8
  416. package/dist/types/src/stories/components/index.d.ts.map +0 -1
  417. package/dist/types/src/stories/components/types.d.ts +0 -7
  418. package/dist/types/src/stories/components/types.d.ts.map +0 -1
  419. package/dist/types/src/stories/hooks/index.d.ts +0 -3
  420. package/dist/types/src/stories/hooks/index.d.ts.map +0 -1
  421. package/dist/types/src/stories/hooks/useFlush.d.ts.map +0 -1
  422. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +0 -3
  423. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +0 -1
  424. package/dist/types/src/stories/testing/data.d.ts +0 -142
  425. package/dist/types/src/stories/testing/data.d.ts.map +0 -1
  426. package/dist/types/src/stories/testing/index.d.ts +0 -3
  427. package/dist/types/src/stories/testing/index.d.ts.map +0 -1
  428. package/dist/types/src/stories/testing/testing.d.ts +0 -26
  429. package/dist/types/src/stories/testing/testing.d.ts.map +0 -1
  430. package/dist/types/src/testing/test-functions.d.ts +0 -6
  431. package/dist/types/src/testing/test-functions.d.ts.map +0 -1
  432. package/dist/types/src/tools/function.d.ts +0 -5
  433. package/dist/types/src/tools/function.d.ts.map +0 -1
  434. package/dist/types/src/tools/index.d.ts +0 -3
  435. package/dist/types/src/tools/index.d.ts.map +0 -1
  436. package/dist/types/src/tools/openapi.d.ts +0 -10
  437. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  438. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  439. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  440. package/src/components/ChatThread/ChatMessage.tsx +0 -282
  441. package/src/components/ChatThread/ToolBlock.tsx +0 -125
  442. package/src/components/ChatThread/reducer.ts +0 -52
  443. package/src/components/Timeline/Timeline.stories.tsx +0 -53
  444. package/src/components/Timeline/Timeline.tsx +0 -159
  445. package/src/hooks/chat-processor.ts +0 -260
  446. package/src/hooks/errors.ts +0 -8
  447. package/src/hooks/useResolveRef.ts +0 -33
  448. package/src/parser/filter-generator.test.ts +0 -32
  449. package/src/parser/filter-generator.ts +0 -74
  450. package/src/parser/index.ts +0 -7
  451. package/src/parser/query-parser.test.ts +0 -139
  452. package/src/parser/query-parser.ts +0 -199
  453. package/src/parser/types.ts +0 -34
  454. package/src/shims.d.ts +0 -8
  455. package/src/stories/Chat.stories.tsx +0 -317
  456. package/src/stories/components/BlueprintContainer.tsx +0 -34
  457. package/src/stories/components/ChatContainer.tsx +0 -80
  458. package/src/stories/components/GraphContainer.tsx +0 -118
  459. package/src/stories/components/LoggingContainer.tsx +0 -22
  460. package/src/stories/components/SurfaceContainer.tsx +0 -62
  461. package/src/stories/components/TasksContainer.tsx +0 -51
  462. package/src/stories/components/index.ts +0 -12
  463. package/src/stories/components/types.ts +0 -11
  464. package/src/stories/hooks/index.ts +0 -6
  465. package/src/stories/hooks/useMatcherExtension.ts +0 -45
  466. package/src/stories/testing/data.ts +0 -130
  467. package/src/stories/testing/index.ts +0 -6
  468. package/src/stories/testing/testing.tsx +0 -162
  469. package/src/testing/test-functions.ts +0 -16
  470. package/src/tools/function.ts +0 -49
  471. package/src/tools/index.ts +0 -6
  472. package/src/tools/openapi.test.ts +0 -219
  473. package/src/tools/openapi.ts +0 -341
  474. package/src/typings.d.ts +0 -9
  475. /package/dist/types/src/{stories/hooks → hooks}/useFlush.d.ts +0 -0
  476. /package/src/{stories/hooks → hooks}/useFlush.ts +0 -0
@@ -1,2232 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AssistantCapabilities
4
- } from "./chunk-X6AANUHZ.mjs";
5
- import {
6
- ServiceType
7
- } from "./chunk-F7RXCX5Y.mjs";
8
- import {
9
- meta
10
- } from "./chunk-KOC6ESG7.mjs";
11
-
12
- // src/hooks/useBlueprintRegistry.ts
13
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
14
- import { useSignalEffect } from "@preact/signals-react";
15
- import { useCallback, useMemo, useState } from "react";
16
- import { Capabilities, useCapabilities } from "@dxos/app-framework";
17
- import { Blueprint } from "@dxos/blueprints";
18
- import { Filter, Obj, Ref } from "@dxos/echo";
19
- import { isNonNullable } from "@dxos/util";
20
- var useBlueprintRegistry = () => {
21
- const blueprints = useCapabilities(Capabilities.BlueprintDefinition);
22
- return useMemo(() => new Blueprint.Registry(blueprints), [
23
- blueprints
24
- ]);
25
- };
26
- var useBlueprints = ({ context }) => {
27
- var _effect = _useSignals();
28
- try {
29
- const [active, setActive] = useState(/* @__PURE__ */ new Map());
30
- useSignalEffect(() => {
31
- const refs = [
32
- ...context?.blueprints.value ?? []
33
- ];
34
- const t = setTimeout(async () => {
35
- const blueprints = (await Ref.Array.loadAll(refs)).filter(isNonNullable);
36
- setActive(new Map(blueprints.map((blueprint) => [
37
- blueprint.key,
38
- blueprint
39
- ])));
40
- });
41
- return () => clearTimeout(t);
42
- });
43
- return active;
44
- } finally {
45
- _effect.f();
46
- }
47
- };
48
- var useBlueprintHandlers = ({ space, context, blueprintRegistry }) => {
49
- const onUpdateBlueprint = useCallback(async (key, checked) => {
50
- if (!context || !blueprintRegistry) {
51
- return;
52
- }
53
- const { objects } = await space.db.query(Filter.type(Blueprint.Blueprint)).run();
54
- let storedBlueprint = objects.find((blueprint) => blueprint.key === key);
55
- if (checked) {
56
- if (!storedBlueprint) {
57
- const blueprint = blueprintRegistry.getByKey(key);
58
- if (!blueprint) {
59
- return;
60
- }
61
- storedBlueprint = space.db.add(Obj.clone(blueprint));
62
- }
63
- await context.bind({
64
- blueprints: [
65
- Ref.make(storedBlueprint)
66
- ]
67
- });
68
- } else if (storedBlueprint) {
69
- await context.unbind({
70
- blueprints: [
71
- Ref.make(storedBlueprint)
72
- ]
73
- });
74
- }
75
- }, [
76
- space,
77
- context,
78
- blueprintRegistry
79
- ]);
80
- return {
81
- onUpdateBlueprint
82
- };
83
- };
84
-
85
- // src/hooks/useChatProcessor.ts
86
- import { RegistryContext } from "@effect-rx/rx-react";
87
- import { useContext, useMemo as useMemo6 } from "react";
88
- import { useIntentDispatcher } from "@dxos/app-framework";
89
- import { AiConversation } from "@dxos/assistant";
90
- import { log as log2 } from "@dxos/log";
91
- import { fullyQualifiedId } from "@dxos/react-client/echo";
92
-
93
- // src/hooks/chat-processor.ts
94
- import { Registry, Result, Rx } from "@effect-rx/rx-react";
95
- import { Effect, Option, Stream, pipe } from "effect";
96
- import { AiService, DEFAULT_EDGE_MODEL } from "@dxos/ai";
97
- import { AiSession, ArtifactDiffResolver, createSystemPrompt } from "@dxos/assistant";
98
- import { Context } from "@dxos/context";
99
- import { Obj as Obj2 } from "@dxos/echo";
100
- import { runAndForwardErrors } from "@dxos/effect";
101
- import { log } from "@dxos/log";
102
- import { Filter as Filter2, getVersion } from "@dxos/react-client/echo";
103
- import { DataType } from "@dxos/schema";
104
-
105
- // src/hooks/errors.ts
106
- var AiServiceOverloadedError = class extends Error {
107
- code = "AI_SERVICE_OVERLOADED";
108
- };
109
-
110
- // src/hooks/chat-processor.ts
111
- function _ts_add_disposable_resource(env, value, async) {
112
- if (value !== null && value !== void 0) {
113
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
114
- var dispose, inner;
115
- if (async) {
116
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
117
- dispose = value[Symbol.asyncDispose];
118
- }
119
- if (dispose === void 0) {
120
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
121
- dispose = value[Symbol.dispose];
122
- if (async) inner = dispose;
123
- }
124
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
125
- if (inner) dispose = function() {
126
- try {
127
- inner.call(this);
128
- } catch (e) {
129
- return Promise.reject(e);
130
- }
131
- };
132
- env.stack.push({
133
- value,
134
- dispose,
135
- async
136
- });
137
- } else if (async) {
138
- env.stack.push({
139
- async: true
140
- });
141
- }
142
- return value;
143
- }
144
- function _ts_dispose_resources(env) {
145
- var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
146
- var e = new Error(message);
147
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
148
- };
149
- return (_ts_dispose_resources = function _ts_dispose_resources2(env2) {
150
- function fail(e) {
151
- env2.error = env2.hasError ? new _SuppressedError(e, env2.error, "An error was suppressed during disposal.") : e;
152
- env2.hasError = true;
153
- }
154
- var r, s = 0;
155
- function next() {
156
- while (r = env2.stack.pop()) {
157
- try {
158
- if (!r.async && s === 1) return s = 0, env2.stack.push(r), Promise.resolve().then(next);
159
- if (r.dispose) {
160
- var result = r.dispose.call(r.value);
161
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
162
- fail(e);
163
- return next();
164
- });
165
- } else s |= 1;
166
- } catch (e) {
167
- fail(e);
168
- }
169
- }
170
- if (s === 1) return env2.hasError ? Promise.reject(env2.error) : Promise.resolve();
171
- if (env2.hasError) throw env2.error;
172
- }
173
- return next();
174
- })(env);
175
- }
176
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/chat-processor.ts";
177
- var defaultOptions = {
178
- model: DEFAULT_EDGE_MODEL
179
- };
180
- var AiChatProcessor = class {
181
- _services;
182
- _conversation;
183
- _options;
184
- /**
185
- * Last error.
186
- */
187
- // TODO(wittjosiah): Error should come from the message stream.
188
- error;
189
- /** Rx registry. */
190
- _observableRegistry;
191
- /** Current session. */
192
- _session;
193
- /**
194
- * Current streaming message (from the AI service).
195
- */
196
- _streaming;
197
- /**
198
- * Streaming state.
199
- */
200
- streaming;
201
- /**
202
- * Pending messages (incl. the current user request).
203
- */
204
- _pending;
205
- /**
206
- * Array of Messages (incl. the current message being streamed).
207
- */
208
- messages;
209
- constructor(_services, _conversation, _options = defaultOptions) {
210
- this._services = _services;
211
- this._conversation = _conversation;
212
- this._options = _options;
213
- this.error = Rx.make(Option.none());
214
- this._session = Rx.make(Option.none());
215
- this._streaming = Rx.make((get) => {
216
- return pipe(get(this._session), Option.map((session) => Stream.fromQueue(session.blockQueue)), Option.getOrElse(() => Stream.make()), Stream.scan(Option.none(), (acc, blockOption) => Option.flatMap(blockOption, (block) => acc.pipe(Option.match({
217
- onNone: () => [
218
- block
219
- ],
220
- onSome: (message) => [
221
- ...message.blocks.filter((b) => !b.pending),
222
- block
223
- ]
224
- }), Option.some, Option.map((blocks) => Obj2.make(DataType.Message, {
225
- created: (/* @__PURE__ */ new Date()).toISOString(),
226
- sender: {
227
- role: "assistant"
228
- },
229
- blocks
230
- }))))));
231
- });
232
- this.streaming = Rx.make((get) => {
233
- return pipe(get(this._streaming), Result.map((streaming) => Option.isSome(streaming)), Result.getOrElse(() => false));
234
- });
235
- this._pending = Rx.make((get) => {
236
- const session = get(this._session);
237
- return Option.isSome(session) ? pipe(session.value.messageQueue, Stream.fromQueue, Stream.scan([], (acc, message) => [
238
- ...acc,
239
- message
240
- ])) : Stream.make();
241
- });
242
- this.messages = Rx.make((get) => {
243
- const streaming = get(this._streaming);
244
- return Result.map(get(this._pending), (pending) => Result.match(streaming, {
245
- onInitial: () => pending,
246
- onSuccess: (streaming2) => Option.match(streaming2.value, {
247
- onNone: () => pending,
248
- onSome: (message) => [
249
- ...pending,
250
- message
251
- ]
252
- }),
253
- onFailure: () => pending
254
- }));
255
- });
256
- this._artifactDiffResolver = {
257
- resolve: async (artifacts) => {
258
- const space = this._options.extensions?.space;
259
- if (!space) {
260
- return /* @__PURE__ */ new Map();
261
- }
262
- const versions = /* @__PURE__ */ new Map();
263
- await Promise.all(artifacts.map(async (artifact) => {
264
- const { objects: [object] } = await space.db.query(Filter2.ids(artifact.id)).run();
265
- if (!object) {
266
- return;
267
- }
268
- versions.set(artifact.id, {
269
- version: getVersion(object),
270
- diff: `Current state: ${JSON.stringify(object)}`
271
- });
272
- }));
273
- return versions;
274
- }
275
- };
276
- this._observableRegistry = this._options.observableRegistry ?? Registry.make();
277
- if (this._options.model && !this._options.system) {
278
- const capabilities = this._options.modelRegistry?.getCapabilities(this._options.model) ?? {};
279
- this._options.system = createSystemPrompt(capabilities);
280
- }
281
- }
282
- get context() {
283
- return this._conversation.context;
284
- }
285
- get conversation() {
286
- return this._conversation;
287
- }
288
- get blueprintRegistry() {
289
- return this._options.blueprintRegistry;
290
- }
291
- /**
292
- * Make GPT request.
293
- */
294
- async request(message, _options = {}) {
295
- const env = {
296
- stack: [],
297
- error: void 0,
298
- hasError: false
299
- };
300
- try {
301
- const ctx = _ts_add_disposable_resource(env, Context.default(void 0, {
302
- F: __dxlog_file,
303
- L: 174
304
- }), true);
305
- const session = new AiSession();
306
- this._observableRegistry.set(this._session, Option.some(session));
307
- ctx.onDispose(() => {
308
- log.info("onDispose", {
309
- session,
310
- isDisposed: ctx.disposed
311
- }, {
312
- F: __dxlog_file,
313
- L: 180,
314
- S: this,
315
- C: (f, a) => f(...a)
316
- });
317
- Option.match(this._observableRegistry.get(this._session), {
318
- onSome: (s) => {
319
- if (s === session) {
320
- this._observableRegistry.set(this._session, Option.none());
321
- }
322
- },
323
- onNone: () => {
324
- }
325
- });
326
- });
327
- try {
328
- const messages = await runAndForwardErrors(this._conversation.run({
329
- session,
330
- prompt: message,
331
- system: this._options.system
332
- }).pipe(
333
- Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
334
- // TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
335
- Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
336
- Effect.provide(this._services),
337
- Effect.tapErrorCause((cause) => {
338
- log.error("error", {
339
- cause
340
- }, {
341
- F: __dxlog_file,
342
- L: 205,
343
- S: this,
344
- C: (f, a) => f(...a)
345
- });
346
- return Effect.void;
347
- })
348
- ));
349
- log("completed", {
350
- messages
351
- }, {
352
- F: __dxlog_file,
353
- L: 211,
354
- S: this,
355
- C: (f, a) => f(...a)
356
- });
357
- } catch (err) {
358
- log.catch(err, void 0, {
359
- F: __dxlog_file,
360
- L: 213,
361
- S: this,
362
- C: (f, a) => f(...a)
363
- });
364
- if (err instanceof Error && err.message.includes("Overloaded")) {
365
- this._observableRegistry.set(this.error, Option.some(new AiServiceOverloadedError("AI service overloaded", {
366
- cause: err
367
- })));
368
- } else {
369
- this._observableRegistry.set(this.error, Option.some(new Error("AI service error", {
370
- cause: err
371
- })));
372
- }
373
- }
374
- } catch (e) {
375
- env.error = e;
376
- env.hasError = true;
377
- } finally {
378
- const result = _ts_dispose_resources(env);
379
- if (result) await result;
380
- }
381
- }
382
- /**
383
- * Cancel pending requests.
384
- */
385
- async cancel() {
386
- log.info("cancelling...", void 0, {
387
- F: __dxlog_file,
388
- L: 229,
389
- S: this,
390
- C: (f, a) => f(...a)
391
- });
392
- }
393
- _artifactDiffResolver;
394
- };
395
-
396
- // src/hooks/presets.ts
397
- import { Schema } from "effect";
398
- var ModelProviders = [
399
- "dxos-local",
400
- "dxos-remote",
401
- "lm-studio"
402
- ];
403
- var ModelProvider = Schema.Literal(...ModelProviders);
404
- var createModelLabel = (model) => {
405
- const parts = model.split("/");
406
- return parts[parts.length - 1];
407
- };
408
- var AiServicePresets = [
409
- {
410
- provider: "dxos-remote",
411
- model: "@anthropic/claude-opus-4-0"
412
- },
413
- {
414
- provider: "dxos-remote",
415
- model: "@anthropic/claude-3-5-haiku-20241022"
416
- },
417
- {
418
- provider: "lm-studio",
419
- model: "@google/gemma-3-12b"
420
- },
421
- {
422
- provider: "lm-studio",
423
- model: "@mlx-community/llama-3.2-3b-instruct"
424
- },
425
- {
426
- model: "deepseek-r1:latest",
427
- provider: "dxos-local"
428
- }
429
- ].map(({ model, provider }, i) => ({
430
- id: `preset-${i}`,
431
- provider,
432
- model,
433
- label: createModelLabel(model)
434
- }));
435
-
436
- // src/hooks/useChatServices.ts
437
- import { AiToolkit } from "@effect/ai";
438
- import { Layer } from "effect";
439
- import { useMemo as useMemo2 } from "react";
440
- import { Capabilities as Capabilities2, useCapabilities as useCapabilities2 } from "@dxos/app-framework";
441
- import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
442
- import { ComputeEventLogger, CredentialsService, DatabaseService, LocalFunctionExecutionService, QueueService, RemoteFunctionExecutionService, TracingService } from "@dxos/functions";
443
-
444
- // src/capabilities/index.ts
445
- import { lazy } from "@dxos/app-framework";
446
- var AiService2 = lazy(() => import("./ai-service-LDD32477.mjs"));
447
- var AppGraphBuilder = lazy(() => import("./app-graph-builder-RMOUJMMG.mjs"));
448
- var BlueprintDefinition = lazy(() => import("./blueprint-definition-AEWYMW6I.mjs"));
449
- var EdgeModelResolver = lazy(() => import("./edge-model-resolver-UDDR2IA6.mjs"));
450
- var IntentResolver = lazy(() => import("./intent-resolver-DTDNCX3C.mjs"));
451
- var ReactSurface = lazy(() => import("./react-surface-V6JNEZVO.mjs"));
452
- var Settings = lazy(() => import("./settings-AIP5FOJG.mjs"));
453
- var Toolkit = lazy(() => import("./toolkit-2VNUL77B.mjs"));
454
-
455
- // src/hooks/useChatServices.ts
456
- var useChatServices = ({ space }) => {
457
- const serviceLayer = useCapabilities2(AssistantCapabilities.AiServiceLayer).at(0) ?? Layer.die("AiService not found");
458
- const functions = useCapabilities2(Capabilities2.Functions);
459
- const toolkits = useCapabilities2(Capabilities2.Toolkit);
460
- const handlers = useCapabilities2(Capabilities2.ToolkitHandler);
461
- return useMemo2(() => {
462
- const allFunctions = functions.flat();
463
- const toolkit = AiToolkit.merge(...toolkits);
464
- const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
465
- return Layer.mergeAll(serviceLayer, makeToolResolverFromFunctions(allFunctions, toolkit), makeToolExecutionServiceFromFunctions(allFunctions, toolkit, handlersLayer), CredentialsService.layerFromDatabase(), ComputeEventLogger.layerFromTracing).pipe(Layer.provideMerge(Layer.mergeAll(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable, space ? QueueService.layer(space.queues) : QueueService.notAvailable, TracingService.layerNoop, LocalFunctionExecutionService.layer, RemoteFunctionExecutionService.mockLayer)));
466
- }, [
467
- space,
468
- functions,
469
- toolkits,
470
- handlers
471
- ]);
472
- };
473
-
474
- // src/hooks/useOnline.ts
475
- import { useState as useState2 } from "react";
476
- var useOnline = () => {
477
- const [online, setOnline] = useState2(true);
478
- return [
479
- online,
480
- setOnline
481
- ];
482
- };
483
-
484
- // src/hooks/usePresets.ts
485
- import { useCallback as useCallback2, useEffect, useMemo as useMemo3, useState as useState3 } from "react";
486
- var usePresets = (online) => {
487
- const [preset, setPreset] = useState3();
488
- const presets = useMemo3(() => AiServicePresets.filter((preset2) => online === (preset2.provider === "dxos-remote")), [
489
- online
490
- ]);
491
- const presetOptions = useMemo3(() => presets.map(({ id, model, label }) => ({
492
- id,
493
- label: label ?? model
494
- })), [
495
- presets
496
- ]);
497
- useEffect(() => {
498
- setPreset(presets[0]);
499
- }, [
500
- presets
501
- ]);
502
- const handleChangePreset = useCallback2((id) => {
503
- const preset2 = presets.find((preset3) => preset3.id === id);
504
- if (preset2) {
505
- setPreset(preset2);
506
- }
507
- }, [
508
- presets
509
- ]);
510
- return {
511
- preset,
512
- presets: presetOptions,
513
- onChangePreset: handleChangePreset
514
- };
515
- };
516
-
517
- // src/hooks/useReferencesProvider.ts
518
- import { useMemo as useMemo4 } from "react";
519
- import { Capabilities as Capabilities3, useCapabilities as useCapabilities3 } from "@dxos/app-framework";
520
- import { Filter as Filter3, Obj as Obj3 } from "@dxos/echo";
521
- var useReferencesProvider = (space) => {
522
- const blueprints = useCapabilities3(Capabilities3.BlueprintDefinition);
523
- return useMemo4(() => {
524
- if (!space) {
525
- return void 0;
526
- }
527
- return {
528
- getReferences: async ({ query }) => {
529
- const { objects } = await space.db.query(Filter3.everything()).run();
530
- return objects.filter((object) => stringMatch(query, Obj3.getLabel(object) ?? "")).filter((object) => !!Obj3.getDXN(object)).map((object) => ({
531
- uri: Obj3.getDXN(object).toString(),
532
- label: Obj3.getLabel(object) ?? ""
533
- }));
534
- },
535
- resolveReference: async ({ uri }) => {
536
- const object = await space.db.query(Filter3.ids(uri)).first();
537
- return {
538
- uri,
539
- label: Obj3.getLabel(object) ?? ""
540
- };
541
- }
542
- };
543
- }, [
544
- space,
545
- blueprints
546
- ]);
547
- };
548
- var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
549
-
550
- // src/hooks/useResolveRef.ts
551
- import { useMemo as useMemo5, useSyncExternalStore } from "react";
552
- var useResolvedRef = (space, ref) => {
553
- const { subscribe, getSnapshot } = useMemo5(() => {
554
- const resolver = space.db.graph.createRefResolver({});
555
- let currentCallback = void 0;
556
- return {
557
- subscribe: (cb) => {
558
- currentCallback = cb;
559
- return () => {
560
- if (currentCallback === cb) {
561
- currentCallback = void 0;
562
- }
563
- };
564
- },
565
- getSnapshot: () => resolver?.resolveSync(ref.dxn, true, () => {
566
- currentCallback?.();
567
- })
568
- };
569
- }, [
570
- space,
571
- ref.dxn.toString()
572
- ]);
573
- return useSyncExternalStore(subscribe, getSnapshot);
574
- };
575
-
576
- // src/hooks/useChatProcessor.ts
577
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatProcessor.ts";
578
- var useChatProcessor = ({ space, chat, preset, services, blueprintRegistry, settings }) => {
579
- const observableRegistry = useContext(RegistryContext);
580
- const { dispatchPromise: dispatch } = useIntentDispatcher();
581
- const chatId = useMemo6(() => chat ? fullyQualifiedId(chat) : void 0, [
582
- chat
583
- ]);
584
- const extensions = useMemo6(() => ({
585
- space,
586
- dispatch,
587
- pivotId: chatId
588
- }), [
589
- dispatch,
590
- space,
591
- chatId
592
- ]);
593
- const conversation = useMemo6(() => {
594
- if (!chat?.queue.target) {
595
- return;
596
- }
597
- return new AiConversation({
598
- queue: chat.queue.target
599
- });
600
- }, [
601
- chat?.queue.target
602
- ]);
603
- const processor = useMemo6(() => {
604
- if (!services || !conversation) {
605
- return void 0;
606
- }
607
- log2("creating processor", {
608
- preset,
609
- model: preset?.model,
610
- settings
611
- }, {
612
- F: __dxlog_file2,
613
- L: 60,
614
- S: void 0,
615
- C: (f, a) => f(...a)
616
- });
617
- return new AiChatProcessor(services, conversation, {
618
- extensions,
619
- blueprintRegistry,
620
- observableRegistry,
621
- model: preset?.model
622
- });
623
- }, [
624
- services,
625
- conversation,
626
- blueprintRegistry,
627
- extensions,
628
- preset
629
- ]);
630
- return processor;
631
- };
632
- var Stable = Object.freeze({
633
- array: [],
634
- object: {}
635
- });
636
-
637
- // src/components/Toolbox/Toolbox.tsx
638
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
639
- import React, { Fragment, useEffect as useEffect2, useState as useState4 } from "react";
640
- import { FunctionType } from "@dxos/functions";
641
- import { log as log5 } from "@dxos/log";
642
- import { Filter as Filter4, useQuery } from "@dxos/react-client/echo";
643
- import { useTranslation } from "@dxos/react-ui";
644
- import { mx } from "@dxos/react-ui-theme";
645
-
646
- // src/tools/function.ts
647
- import { ToolResult, createTool } from "@dxos/ai";
648
- import { Type } from "@dxos/echo";
649
- import { getInvocationUrl, getUserFunctionUrlInMetadata } from "@dxos/functions";
650
- import { log as log3 } from "@dxos/log";
651
- import { getMeta } from "@dxos/react-client/echo";
652
-
653
- // src/tools/openapi.ts
654
- import { Schema as Schema2 } from "effect";
655
- import jsonpointer from "jsonpointer";
656
- import { ToolResult as ToolResult2, createRawTool } from "@dxos/ai";
657
- import { Type as Type2 } from "@dxos/echo";
658
- import { normalizeSchema } from "@dxos/echo-schema";
659
- import { invariant } from "@dxos/invariant";
660
- import { log as log4 } from "@dxos/log";
661
- import { deepMapValues } from "@dxos/util";
662
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/tools/openapi.ts";
663
- var createToolsFromService = async (service) => {
664
- invariant(service.interfaces?.length === 1 && service.interfaces[0].kind === "api", void 0, {
665
- F: __dxlog_file3,
666
- L: 27,
667
- S: void 0,
668
- A: [
669
- "service.interfaces?.length === 1 && service.interfaces[0].kind === 'api'",
670
- ""
671
- ]
672
- });
673
- const iface = service.interfaces[0];
674
- invariant(iface.schemaUrl, void 0, {
675
- F: __dxlog_file3,
676
- L: 29,
677
- S: void 0,
678
- A: [
679
- "iface.schemaUrl",
680
- ""
681
- ]
682
- });
683
- invariant(iface.schemaUrl, void 0, {
684
- F: __dxlog_file3,
685
- L: 30,
686
- S: void 0,
687
- A: [
688
- "iface.schemaUrl",
689
- ""
690
- ]
691
- });
692
- return createToolsFromApi(iface.schemaUrl, {
693
- authorization: iface.authorization
694
- });
695
- };
696
- var createToolsFromApi = async (url, options) => {
697
- const res = await fetch(url);
698
- const spec = await res.json();
699
- log4("spec", {
700
- spec
701
- }, {
702
- F: __dxlog_file3,
703
- L: 40,
704
- S: void 0,
705
- C: (f, a) => f(...a)
706
- });
707
- const tools = [];
708
- for (const [path, pathItem] of Object.entries(spec.paths)) {
709
- if (typeof pathItem !== "object") {
710
- continue;
711
- }
712
- const { ...methods } = pathItem;
713
- for (const [method, m] of Object.entries(methods)) {
714
- const methodItem = m;
715
- log4("methodItem", {
716
- path,
717
- method,
718
- methodItem
719
- }, {
720
- F: __dxlog_file3,
721
- L: 51,
722
- S: void 0,
723
- C: (f, a) => f(...a)
724
- });
725
- const parametersResolved = methodItem.parameters?.map((parameter) => {
726
- const resolved = resolveJsonSchema(parameter, spec);
727
- return resolved;
728
- }) ?? [];
729
- const inputSchema = {
730
- type: "object",
731
- properties: {}
732
- };
733
- const endpointParameters = [];
734
- for (const parameter of parametersResolved) {
735
- log4("parameter", {
736
- parameter
737
- }, {
738
- F: __dxlog_file3,
739
- L: 66,
740
- S: void 0,
741
- C: (f, a) => f(...a)
742
- });
743
- if (options?.authorization?.type === "api-key" && options.authorization.placement.type === "query" && parameter.in === "query" && parameter.name === options.authorization.placement.name) {
744
- continue;
745
- }
746
- endpointParameters.push(parameter);
747
- if (parameter.schema) {
748
- inputSchema.properties[parameter.name] = normalizeSchema(parameter.schema);
749
- } else if (typeof parameter.type === "string") {
750
- const { name, in: _in, required, ...schema } = parameter;
751
- inputSchema.properties[name] = normalizeSchema(schema);
752
- if (required) {
753
- inputSchema.required ??= [];
754
- inputSchema.required.push(name);
755
- }
756
- }
757
- }
758
- log4("inputSchema", {
759
- inputSchema
760
- }, {
761
- F: __dxlog_file3,
762
- L: 91,
763
- S: void 0,
764
- C: (f, a) => f(...a)
765
- });
766
- Schema2.validateSync(Type2.JsonSchema)(inputSchema);
767
- const description = methodItem.description ?? methodItem.summary;
768
- if (!description) {
769
- log4.warn("no description", {
770
- path,
771
- method
772
- }, {
773
- F: __dxlog_file3,
774
- L: 96,
775
- S: void 0,
776
- C: (f, a) => f(...a)
777
- });
778
- continue;
779
- }
780
- const endpoint = {
781
- document: spec,
782
- path,
783
- method,
784
- parameters: endpointParameters,
785
- authorization: options?.authorization
786
- };
787
- tools.push(
788
- // TODO(burdon): Namespace?
789
- createRawTool("openapi", {
790
- name: getToolName(path, method, methodItem),
791
- description: options?.instructions ? `${options.instructions}
792
-
793
- ${description}` : description,
794
- parameters: inputSchema,
795
- execute: async (input) => {
796
- const response = await callApiEndpoint(endpoint, input);
797
- return ToolResult2.Success(response);
798
- }
799
- })
800
- );
801
- }
802
- }
803
- return tools;
804
- };
805
- var getToolName = (path, method, methodItem) => {
806
- if (methodItem.operationId) {
807
- return methodItem.operationId;
808
- }
809
- let name = `${method.toLowerCase()}_${path.replaceAll(/[{}/]/g, "_")}`;
810
- while (name.length > MAX_TOOL_NAME_LENGTH) {
811
- const lengthBefore = name.length;
812
- for (const word of GENERIC_WORDS) {
813
- if (name.includes(word)) {
814
- name = name.replace(word, "");
815
- break;
816
- }
817
- }
818
- name = name.replaceAll("__", "_").replace(/_$/, "");
819
- const lengthAfter = name.length;
820
- if (lengthBefore === lengthAfter) {
821
- break;
822
- }
823
- }
824
- name = name.replaceAll("__", "_").replace(/_$/, "").replace(/^_/, "");
825
- return name.slice(0, MAX_TOOL_NAME_LENGTH);
826
- };
827
- var MAX_TOOL_NAME_LENGTH = 64;
828
- var GENERIC_WORDS = [
829
- "services",
830
- "service",
831
- "api",
832
- "rest",
833
- "endpoint",
834
- "get",
835
- "post",
836
- "put",
837
- "delete",
838
- "patch",
839
- "head",
840
- "options",
841
- "trace",
842
- "service",
843
- "api",
844
- "endpoint"
845
- ];
846
- var callApiEndpoint = async (endpoint, input) => {
847
- log4.info("endpoint", {
848
- method: endpoint.method,
849
- name: endpoint.path,
850
- input
851
- }, {
852
- F: __dxlog_file3,
853
- L: 183,
854
- S: void 0,
855
- C: (f, a) => f(...a)
856
- });
857
- let url = getEndpointUrl(endpoint);
858
- const request = {
859
- method: endpoint.method,
860
- headers: {}
861
- };
862
- const query = new URLSearchParams();
863
- let body;
864
- for (const parameter of endpoint.parameters) {
865
- if (input[parameter.name] === void 0) {
866
- continue;
867
- }
868
- switch (parameter.in) {
869
- case "header": {
870
- if (parameter.example) {
871
- request.headers[parameter.name] = parameter.default;
872
- }
873
- break;
874
- }
875
- case "path": {
876
- url = url.replace(`{${parameter.name}}`, encodeURIComponent(input[parameter.name]));
877
- break;
878
- }
879
- case "body": {
880
- const value = input[parameter.name];
881
- const effectSchema = Type2.toEffectSchema(parameter.schema);
882
- Schema2.validateSync(effectSchema)(value);
883
- if (body) {
884
- throw new Error(`Duplicate body parameter: ${parameter.name}`);
885
- }
886
- body = value;
887
- break;
888
- }
889
- case "query": {
890
- query.set(parameter.name, input[parameter.name]);
891
- break;
892
- }
893
- }
894
- }
895
- if (endpoint.authorization?.type === "api-key" && endpoint.authorization.placement.type === "authorization-header" || endpoint.authorization?.type === "oauth") {
896
- request.headers.Authorization = await resolveAuthorization(endpoint.authorization);
897
- } else if (endpoint.authorization?.type === "api-key" && endpoint.authorization.placement.type === "query") {
898
- query.set(endpoint.authorization.placement.name, endpoint.authorization.key);
899
- }
900
- if (query.size > 0) {
901
- url += `?${query.toString()}`;
902
- }
903
- if (body) {
904
- request.body = JSON.stringify(body);
905
- request.headers["Content-Type"] = "application/json";
906
- }
907
- log4.info("request", {
908
- url,
909
- request
910
- }, {
911
- F: __dxlog_file3,
912
- L: 246,
913
- S: void 0,
914
- C: (f, a) => f(...a)
915
- });
916
- const response = await fetch(url, request);
917
- log4.info("response", {
918
- ok: response.ok,
919
- status: response.status,
920
- statusText: response.statusText
921
- }, {
922
- F: __dxlog_file3,
923
- L: 249,
924
- S: void 0,
925
- C: (f, a) => f(...a)
926
- });
927
- if (response.ok) {
928
- const contentType = response.headers.get("Content-Type");
929
- if (contentType?.includes("application/json")) {
930
- return await response.json();
931
- } else {
932
- return await response.text();
933
- }
934
- } else {
935
- if (response.headers.get("Content-Type")?.includes("application/json")) {
936
- const responseBody = await response.text();
937
- let error;
938
- try {
939
- error = JSON.parse(responseBody);
940
- } catch {
941
- error = responseBody;
942
- }
943
- log4.error("error", {
944
- error
945
- }, {
946
- F: __dxlog_file3,
947
- L: 267,
948
- S: void 0,
949
- C: (f, a) => f(...a)
950
- });
951
- throw new Error(error.message);
952
- } else {
953
- const error = await response.text();
954
- log4.error("error", {
955
- error
956
- }, {
957
- F: __dxlog_file3,
958
- L: 271,
959
- S: void 0,
960
- C: (f, a) => f(...a)
961
- });
962
- throw new Error(error);
963
- }
964
- }
965
- };
966
- var getEndpointUrl = (endpoint) => {
967
- let url = "";
968
- if (isV3_1(endpoint.document) && endpoint.document.servers && endpoint.document.servers.length > 0) {
969
- url = endpoint.document.servers[0].url;
970
- } else {
971
- invariant(!isV3_1(endpoint.document), void 0, {
972
- F: __dxlog_file3,
973
- L: 282,
974
- S: void 0,
975
- A: [
976
- "!isV3_1(endpoint.document)",
977
- ""
978
- ]
979
- });
980
- url = `${endpoint.document.schemes?.[0] ?? "https"}://${endpoint.document.host}`;
981
- }
982
- if (!isV3_1(endpoint.document) && endpoint.document.basePath) {
983
- url += endpoint.document.basePath;
984
- }
985
- url += endpoint.path;
986
- return url;
987
- };
988
- var resolveAuthorization = async (authorization) => {
989
- switch (authorization.type) {
990
- case "api-key": {
991
- invariant(authorization.placement.type === "authorization-header", void 0, {
992
- F: __dxlog_file3,
993
- L: 298,
994
- S: void 0,
995
- A: [
996
- "authorization.placement.type === 'authorization-header'",
997
- ""
998
- ]
999
- });
1000
- return `Bearer ${authorization.key}`;
1001
- }
1002
- case "oauth": {
1003
- const response = await fetch(authorization.tokenUrl, {
1004
- method: "POST",
1005
- headers: {
1006
- "Content-Type": "application/x-www-form-urlencoded"
1007
- },
1008
- body: `grant_type=${authorization.grantType}&client_id=${authorization.clientId}&client_secret=${authorization.clientSecret}`
1009
- });
1010
- const data = await response.json();
1011
- return `Bearer ${data.access_token}`;
1012
- }
1013
- default: {
1014
- throw new Error(`Unknown authorization type: ${authorization.type}`);
1015
- }
1016
- }
1017
- };
1018
- var resolveJsonSchema = (schema, base) => {
1019
- return deepMapValues(schema, (value, recurse) => {
1020
- if (typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "string") {
1021
- if (value.$ref.startsWith("#")) {
1022
- const resolved = jsonpointer.get(base, value.$ref.slice(1));
1023
- if (resolved) {
1024
- return recurse(resolved);
1025
- } else {
1026
- log4.warn("unresolved", {
1027
- ref: value.$ref,
1028
- base
1029
- }, {
1030
- F: __dxlog_file3,
1031
- L: 331,
1032
- S: void 0,
1033
- C: (f, a) => f(...a)
1034
- });
1035
- }
1036
- }
1037
- }
1038
- return recurse(value);
1039
- });
1040
- };
1041
- var isV3_1 = (document) => {
1042
- return document.openapi === "3.0.1";
1043
- };
1044
-
1045
- // src/components/Toolbox/Toolbox.tsx
1046
- var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
1047
- var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }) => {
1048
- var _effect = _useSignals2();
1049
- try {
1050
- const { t } = useTranslation(meta.id);
1051
- return /* @__PURE__ */ React.createElement("div", {
1052
- className: mx("flex flex-col overflow-y-auto box-content", classNames)
1053
- }, blueprints && blueprints.length > 0 && /* @__PURE__ */ React.createElement(Section, {
1054
- title: "Blueprints",
1055
- items: blueprints.map(({ target }) => ({
1056
- name: target?.name ?? "",
1057
- description: target?.description ?? "",
1058
- subitems: target?.tools.map((toolId) => ({
1059
- name: `\u2219 ${safeToolId(toolId)}`
1060
- }))
1061
- }))
1062
- }), activeBlueprints && activeBlueprints.length > 0 && /* @__PURE__ */ React.createElement(Section, {
1063
- title: "Blueprints",
1064
- items: activeBlueprints.map(({ target }) => ({
1065
- name: target?.name ?? "",
1066
- description: target?.description ?? "",
1067
- subitems: target?.tools.map((toolId) => ({
1068
- name: `\u2219 ${safeToolId(toolId)}`
1069
- }))
1070
- }))
1071
- }), services && services.length > 0 && /* @__PURE__ */ React.createElement(Section, {
1072
- title: "Services",
1073
- items: services.map(({ service: { serviceId, name, description }, tools }) => ({
1074
- name: name ?? serviceId,
1075
- description,
1076
- subitems: tools.map(({ name: name2, description: description2 }) => ({
1077
- name: `\u2219 ${name2}`,
1078
- description: description2
1079
- }))
1080
- }))
1081
- }), functions && functions.length > 0 && /* @__PURE__ */ React.createElement(Section, {
1082
- title: "Functions",
1083
- items: functions.map(({ name, description }) => ({
1084
- name,
1085
- description
1086
- }))
1087
- }), !blueprints?.length && !activeBlueprints?.length && !services?.length && !functions?.length && /* @__PURE__ */ React.createElement("div", null, t("no tools")));
1088
- } finally {
1089
- _effect.f();
1090
- }
1091
- };
1092
- var Section = ({ title, items, striped }) => {
1093
- var _effect = _useSignals2();
1094
- try {
1095
- const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
1096
- const gridClassNames = "grid grid-cols-[8rem_1fr]";
1097
- const subGridClassNames = mx("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
1098
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h1", {
1099
- className: "px-2 text-sm"
1100
- }, title), /* @__PURE__ */ React.createElement("div", {
1101
- className: gridClassNames
1102
- }, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React.createElement(Fragment, {
1103
- key: i
1104
- }, name && /* @__PURE__ */ React.createElement("div", {
1105
- className: subGridClassNames
1106
- }, /* @__PURE__ */ React.createElement("div", {
1107
- className: "truncate text-primary-500"
1108
- }, name), /* @__PURE__ */ React.createElement("div", {
1109
- className: "line-clamp-2"
1110
- }, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React.createElement("div", {
1111
- key: i2,
1112
- className: mx(subGridClassNames, striped && stripeClassNames)
1113
- }, /* @__PURE__ */ React.createElement("div", {
1114
- className: "truncate"
1115
- }, name2), /* @__PURE__ */ React.createElement("div", {
1116
- className: "line-clamp-3 text-subdued"
1117
- }, description2)))))));
1118
- } finally {
1119
- _effect.f();
1120
- }
1121
- };
1122
- var ToolboxContainer = ({ classNames, space, processor }) => {
1123
- var _effect = _useSignals2();
1124
- try {
1125
- const services = useQuery(space, Filter4.type(ServiceType));
1126
- const [serviceTools, setServiceTools] = useState4([]);
1127
- useEffect2(() => {
1128
- log5("creating service tools...", {
1129
- services: services.length
1130
- }, {
1131
- F: __dxlog_file4,
1132
- L: 123,
1133
- S: void 0,
1134
- C: (f, a) => f(...a)
1135
- });
1136
- queueMicrotask(async () => {
1137
- const tools = await Promise.all(services.map(async (service) => ({
1138
- service,
1139
- tools: await createToolsFromService(service)
1140
- })));
1141
- setServiceTools(tools);
1142
- });
1143
- }, [
1144
- services
1145
- ]);
1146
- const functions = useQuery(space, Filter4.type(FunctionType));
1147
- return /* @__PURE__ */ React.createElement(Toolbox, {
1148
- classNames,
1149
- blueprints: processor?.context.blueprints.value,
1150
- services: serviceTools,
1151
- functions
1152
- });
1153
- } finally {
1154
- _effect.f();
1155
- }
1156
- };
1157
- var safeToolId = (name) => {
1158
- return name.split("_").pop();
1159
- };
1160
-
1161
- // src/components/Chat/Chat.tsx
1162
- import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
1163
- import { Prec } from "@codemirror/state";
1164
- import { keymap } from "@codemirror/view";
1165
- import { Result as Result2, useRxValue } from "@effect-rx/rx-react";
1166
- import { createContext } from "@radix-ui/react-context";
1167
- import { Array, Option as Option2 } from "effect";
1168
- import React11, { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo10, useRef as useRef2, useState as useState7 } from "react";
1169
- import { Event } from "@dxos/async";
1170
- import { DXN as DXN2, Obj as Obj7, Ref as Ref4 } from "@dxos/echo";
1171
- import { log as log6 } from "@dxos/log";
1172
- import { useVoiceInput } from "@dxos/plugin-transcription";
1173
- import { getSpace, useQueue } from "@dxos/react-client/echo";
1174
- import { useIdentity } from "@dxos/react-client/halo";
1175
- import { Input, useTranslation as useTranslation7 } from "@dxos/react-ui";
1176
- import { ChatEditor, references } from "@dxos/react-ui-chat";
1177
- import { mx as mx7 } from "@dxos/react-ui-theme";
1178
- import { DataType as DataType2 } from "@dxos/schema";
1179
- import { isNotFalsy as isNotFalsy2 } from "@dxos/util";
1180
-
1181
- // src/components/ChatPrompt/ChatActions.tsx
1182
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
1183
- import React2 from "react";
1184
- import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
1185
- import { mx as mx2 } from "@dxos/react-ui-theme";
1186
- var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
1187
- var _effect = _useSignals3();
1188
- try {
1189
- const { t } = useTranslation2(meta.id);
1190
- return /* @__PURE__ */ React2.createElement("div", {
1191
- className: mx2("flex items-center mie-1", classNames)
1192
- }, children, processing && /* @__PURE__ */ React2.createElement(IconButton, {
1193
- disabled: !processing,
1194
- classNames: "px-1.5",
1195
- variant: "ghost",
1196
- size: 5,
1197
- icon: "ph--x--regular",
1198
- iconOnly: true,
1199
- label: t("button cancel processing"),
1200
- onClick: () => onEvent?.({
1201
- type: "cancel"
1202
- })
1203
- }) || /* @__PURE__ */ React2.createElement(IconButton, {
1204
- disabled: true,
1205
- classNames: "px-1.5",
1206
- variant: "ghost",
1207
- size: 5,
1208
- icon: "ph--arrow-down--regular",
1209
- iconOnly: true,
1210
- label: t("button scroll down"),
1211
- onClick: () => onEvent?.({
1212
- type: "scroll-to-bottom"
1213
- })
1214
- }), microphone && /* @__PURE__ */ React2.createElement(IconButton, {
1215
- disabled: !processing,
1216
- classNames: mx2("px-1.5", recording && "bg-primary-500"),
1217
- variant: "ghost",
1218
- size: 5,
1219
- icon: "ph--microphone--regular",
1220
- iconOnly: true,
1221
- noTooltip: true,
1222
- label: t("button microphone"),
1223
- onMouseDown: () => onEvent?.({
1224
- type: "record-start"
1225
- }),
1226
- onMouseUp: () => onEvent?.({
1227
- type: "record-stop"
1228
- }),
1229
- onTouchStart: () => onEvent?.({
1230
- type: "record-start"
1231
- }),
1232
- onTouchEnd: () => onEvent?.({
1233
- type: "record-stop"
1234
- })
1235
- }));
1236
- } finally {
1237
- _effect.f();
1238
- }
1239
- };
1240
-
1241
- // src/components/ChatPrompt/ChatOptions.tsx
1242
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
1243
- import React3, { useMemo as useMemo7 } from "react";
1244
- import { DropdownMenu, Icon, IconButton as IconButton2, useTranslation as useTranslation3 } from "@dxos/react-ui";
1245
- var ChatOptions = ({ context, blueprintRegistry, onUpdateBlueprint }) => {
1246
- var _effect = _useSignals4();
1247
- try {
1248
- const { t } = useTranslation3(meta.id);
1249
- const blueprints = useMemo7(() => blueprintRegistry?.query() ?? [], [
1250
- blueprintRegistry
1251
- ]);
1252
- const activeBlueprints = useBlueprints({
1253
- context
1254
- });
1255
- return /* @__PURE__ */ React3.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Trigger, {
1256
- asChild: true
1257
- }, /* @__PURE__ */ React3.createElement(IconButton2, {
1258
- icon: "ph--plus--regular",
1259
- variant: "ghost",
1260
- size: 5,
1261
- iconOnly: true,
1262
- label: t("button add blueprint")
1263
- })), /* @__PURE__ */ React3.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React3.createElement(DropdownMenu.Content, {
1264
- side: "left"
1265
- }, /* @__PURE__ */ React3.createElement(DropdownMenu.Viewport, null, blueprints.map((blueprint) => /* @__PURE__ */ React3.createElement(DropdownMenu.CheckboxItem, {
1266
- key: blueprint.key,
1267
- checked: activeBlueprints?.get(blueprint.key) !== void 0,
1268
- onCheckedChange: (checked) => onUpdateBlueprint?.(blueprint.key, !!checked),
1269
- classNames: "gap-2"
1270
- }, /* @__PURE__ */ React3.createElement("div", {
1271
- className: "flex-1 min-is-0"
1272
- }, blueprint.name), /* @__PURE__ */ React3.createElement(DropdownMenu.ItemIndicator, {
1273
- asChild: true
1274
- }, /* @__PURE__ */ React3.createElement(Icon, {
1275
- icon: "ph--check--regular",
1276
- size: 4
1277
- }))))), /* @__PURE__ */ React3.createElement(DropdownMenu.Arrow, null))));
1278
- } finally {
1279
- _effect.f();
1280
- }
1281
- };
1282
-
1283
- // src/components/ChatPrompt/ChatPresets.tsx
1284
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
1285
- import React4 from "react";
1286
- import { Select } from "@dxos/react-ui";
1287
- var ChatPresets = ({ presets, preset, onChange }) => {
1288
- var _effect = _useSignals5();
1289
- try {
1290
- return /* @__PURE__ */ React4.createElement(Select.Root, {
1291
- value: preset,
1292
- onValueChange: onChange
1293
- }, /* @__PURE__ */ React4.createElement(Select.TriggerButton, {
1294
- classNames: "text-sm"
1295
- }), /* @__PURE__ */ React4.createElement(Select.Content, null, presets?.map(({ id, label }) => /* @__PURE__ */ React4.createElement(Select.Option, {
1296
- key: id,
1297
- value: id,
1298
- classNames: "text-sm"
1299
- }, label))));
1300
- } finally {
1301
- _effect.f();
1302
- }
1303
- };
1304
-
1305
- // src/components/ChatPrompt/ChatReferences.tsx
1306
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
1307
- import React5, { useCallback as useCallback3 } from "react";
1308
- import { Filter as Filter5, Obj as Obj4, Ref as Ref2 } from "@dxos/echo";
1309
- import { useAsyncState, useTranslation as useTranslation4 } from "@dxos/react-ui";
1310
- import { TagPicker } from "@dxos/react-ui-tag-picker";
1311
- import { mx as mx3 } from "@dxos/react-ui-theme";
1312
- import { isNonNullable as isNonNullable2 } from "@dxos/util";
1313
- var ChatReferences = ({ classNames, space, context, onUpdate }) => {
1314
- var _effect = _useSignals6();
1315
- try {
1316
- const { t } = useTranslation4(meta.id);
1317
- const [items] = useAsyncState(async () => {
1318
- const objects = await Ref2.Array.loadAll(context.objects.value ?? []);
1319
- return objects.filter(isNonNullable2).map((obj) => ({
1320
- id: Obj4.getDXN(obj).toString(),
1321
- label: Obj4.getLabel(obj) ?? Obj4.getTypename(obj) ?? obj.id
1322
- }));
1323
- }, [
1324
- context
1325
- ]);
1326
- const handleSearch = useCallback3((text, dxns) => {
1327
- const objects = space.db.query(Filter5.everything()).runSync();
1328
- return objects.map(({ object }) => ({
1329
- id: Obj4.getDXN(object).toString(),
1330
- label: Obj4.getLabel(object) ?? ""
1331
- })).filter(({ id, label }) => !dxns.includes(id) && label.toLocaleLowerCase().includes(text.toLocaleLowerCase()));
1332
- }, [
1333
- space
1334
- ]);
1335
- return /* @__PURE__ */ React5.createElement(TagPicker, {
1336
- classNames: mx3("h-[1.75rem] text-sm", classNames),
1337
- mode: "multi-select",
1338
- placeholder: t("context objects placeholder"),
1339
- items,
1340
- onSearch: handleSearch,
1341
- onUpdate
1342
- });
1343
- } finally {
1344
- _effect.f();
1345
- }
1346
- };
1347
-
1348
- // src/components/ChatPrompt/ChatStatusIndicator.tsx
1349
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
1350
- import React6, { useEffect as useEffect3, useState as useState5 } from "react";
1351
- import { Icon as Icon2, Tooltip, useTimeout } from "@dxos/react-ui";
1352
- import { Spinner } from "@dxos/react-ui-sfx";
1353
- import { errorText } from "@dxos/react-ui-theme";
1354
- var ChatStatusIndicator = ({ preset, error, processing }) => {
1355
- var _effect = _useSignals7();
1356
- try {
1357
- const [init, setInit] = useState5(false);
1358
- useEffect3(() => {
1359
- setInit(false);
1360
- }, [
1361
- preset
1362
- ]);
1363
- useTimeout(async () => {
1364
- setInit(true);
1365
- }, 1500, [
1366
- preset
1367
- ]);
1368
- if (error) {
1369
- return /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
1370
- content: error.message,
1371
- delayDuration: 0
1372
- }, /* @__PURE__ */ React6.createElement(Icon2, {
1373
- icon: "ph--warning-circle--regular",
1374
- classNames: errorText,
1375
- size: 5
1376
- }));
1377
- }
1378
- return /* @__PURE__ */ React6.createElement(Spinner, {
1379
- state: !init ? "flash" : processing ? "spin" : "pulse"
1380
- });
1381
- } finally {
1382
- _effect.f();
1383
- }
1384
- };
1385
-
1386
- // src/components/ChatThread/ChatThread.tsx
1387
- import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
1388
- import React10, { forwardRef, useMemo as useMemo9 } from "react";
1389
- import { PublicKey } from "@dxos/keys";
1390
- import { ScrollContainer } from "@dxos/react-ui-components";
1391
- import { mx as mx6 } from "@dxos/react-ui-theme";
1392
- import { keyToFallback } from "@dxos/util";
1393
-
1394
- // src/components/ChatThread/ChatMessage.tsx
1395
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1396
- import React9, { Fragment as Fragment2 } from "react";
1397
- import { ErrorBoundary, Surface } from "@dxos/app-framework";
1398
- import { Obj as Obj6 } from "@dxos/echo";
1399
- import { invariant as invariant2 } from "@dxos/invariant";
1400
- import { DXN, DXN_ECHO_REGEXP } from "@dxos/keys";
1401
- import { Button, IconButton as IconButton3, useTranslation as useTranslation6 } from "@dxos/react-ui";
1402
- import { MarkdownViewer, ToggleContainer as NativeToggleContainer } from "@dxos/react-ui-components";
1403
- import { mx as mx5 } from "@dxos/react-ui-theme";
1404
- import { safeParseJson } from "@dxos/util";
1405
-
1406
- // src/components/ChatThread/Link.tsx
1407
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
1408
- import React7 from "react";
1409
- import { Obj as Obj5, Ref as Ref3 } from "@dxos/echo";
1410
- import { mx as mx4 } from "@dxos/react-ui-theme";
1411
- var ObjectLink = ({ space, dxn }) => {
1412
- var _effect = _useSignals8();
1413
- try {
1414
- const object = useResolvedRef(space, Ref3.fromDXN(dxn));
1415
- const title = Obj5.getLabel(object) ?? object?.id ?? dxn.toString();
1416
- return /* @__PURE__ */ React7.createElement("a", {
1417
- // href={dxn.toString()}
1418
- title,
1419
- className: mx4(
1420
- // TODO(burdon): Use style for tags.
1421
- "inline-flex items-center max-w-[16rem] px-1.5 overflow-hidden",
1422
- "border border-separator rounded whitespace-nowrap text-ellipsis text-primary-500 hover:text-primary-500 hover:border-primary-500 cursor-pointer"
1423
- ),
1424
- target: "_blank",
1425
- rel: "noopener noreferrer"
1426
- }, /* @__PURE__ */ React7.createElement("span", {
1427
- className: "truncate"
1428
- }, title));
1429
- } finally {
1430
- _effect.f();
1431
- }
1432
- };
1433
-
1434
- // src/components/ChatThread/ToolBlock.tsx
1435
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1436
- import React8, { useEffect as useEffect4, useMemo as useMemo8, useRef, useState as useState6 } from "react";
1437
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
1438
- import { NumericTabs, StatusRoll, ToggleContainer } from "@dxos/react-ui-components";
1439
- import { Json as NativeJson } from "@dxos/react-ui-syntax-highlighter";
1440
- import { isNonNullable as isNonNullable3, isNotFalsy } from "@dxos/util";
1441
- var isToolMessage = (message) => {
1442
- return message.blocks.some((block) => block._tag === "toolCall" || block._tag === "toolResult");
1443
- };
1444
- var getToolName2 = (tool) => {
1445
- return tool.namespace && tool.function ? `${tool.namespace}:${tool.function}` : tool.name.split("_").pop();
1446
- };
1447
- var ToolBlock = ({ classNames, message, tools }) => {
1448
- var _effect = _useSignals9();
1449
- try {
1450
- const { t } = useTranslation5(meta.id);
1451
- const { blocks = [] } = message;
1452
- const getToolCaption = (tool, status) => {
1453
- if (!tool) {
1454
- return t("calling tool label");
1455
- }
1456
- return status?.message ?? tool.caption ?? [
1457
- t("calling label") + getToolName2(tool)
1458
- ].join(" ");
1459
- };
1460
- let request;
1461
- const toolBlocks = blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult");
1462
- const items = toolBlocks.map((block) => {
1463
- switch (block._tag) {
1464
- case "toolCall": {
1465
- if (block.pending && request?.block.toolCallId === block.toolCallId) {
1466
- return null;
1467
- }
1468
- request = {
1469
- tool: tools?.find((tool) => tool.name === block.name),
1470
- block
1471
- };
1472
- return {
1473
- title: getToolCaption(request.tool, request.block.status),
1474
- block
1475
- };
1476
- }
1477
- case "toolResult": {
1478
- if (!request || block.error) {
1479
- return {
1480
- title: t("error label"),
1481
- block
1482
- };
1483
- }
1484
- return {
1485
- title: getToolCaption(request.tool, request.block.status),
1486
- block
1487
- };
1488
- }
1489
- default: {
1490
- request = void 0;
1491
- return {
1492
- title: t("error label"),
1493
- block
1494
- };
1495
- }
1496
- }
1497
- }).filter(isNonNullable3);
1498
- return /* @__PURE__ */ React8.createElement(ToolContainer, {
1499
- classNames,
1500
- items
1501
- });
1502
- } finally {
1503
- _effect.f();
1504
- }
1505
- };
1506
- var ToolContainer = ({ classNames, items }) => {
1507
- var _effect = _useSignals9();
1508
- try {
1509
- const tabsRef = useRef(null);
1510
- const [selected, setSelected] = useState6(0);
1511
- const [open, setOpen] = useState6(false);
1512
- useEffect4(() => {
1513
- if (open) {
1514
- tabsRef.current?.focus();
1515
- }
1516
- }, [
1517
- open
1518
- ]);
1519
- const handleSelect = (index) => {
1520
- if (index === selected) {
1521
- setOpen(false);
1522
- } else {
1523
- setSelected(index);
1524
- }
1525
- };
1526
- const title = useMemo8(() => {
1527
- const lines = items.map((item) => item.title).filter(isNotFalsy);
1528
- return /* @__PURE__ */ React8.createElement(StatusRoll, {
1529
- key: "status-roll",
1530
- lines,
1531
- duration: 1e3,
1532
- autoAdvance: true
1533
- });
1534
- }, [
1535
- items
1536
- ]);
1537
- return /* @__PURE__ */ React8.createElement(ToggleContainer, {
1538
- classNames: [
1539
- "flex flex-col",
1540
- classNames
1541
- ],
1542
- title,
1543
- open,
1544
- onChangeOpen: setOpen
1545
- }, /* @__PURE__ */ React8.createElement("div", {
1546
- className: "w-full grid grid-cols-[32px_1fr]"
1547
- }, /* @__PURE__ */ React8.createElement(NumericTabs, {
1548
- ref: tabsRef,
1549
- length: items.length,
1550
- selected,
1551
- onSelect: handleSelect
1552
- }), /* @__PURE__ */ React8.createElement(Json, {
1553
- data: items[selected].block
1554
- })));
1555
- } finally {
1556
- _effect.f();
1557
- }
1558
- };
1559
- var Json = ({ data }) => {
1560
- var _effect = _useSignals9();
1561
- try {
1562
- return /* @__PURE__ */ React8.createElement(NativeJson, {
1563
- data,
1564
- classNames: "!p-1 text-xs bg-transparent"
1565
- });
1566
- } finally {
1567
- _effect.f();
1568
- }
1569
- };
1570
-
1571
- // src/components/ChatThread/ChatMessage.tsx
1572
- var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/ChatMessage.tsx";
1573
- var panelClasses = "flex flex-col is-full bg-activeSurface rounded-sm";
1574
- var marginClasses = "pie-4 pis-4";
1575
- var paddingClasses = "pis-2 pie-2 pbs-0.5 pbe-0.5";
1576
- var ChatMessage = ({ classNames, debug, space, message, tools, onEvent, onDelete }) => {
1577
- var _effect = _useSignals10();
1578
- try {
1579
- const { t } = useTranslation6(meta.id);
1580
- const { sender: { role }, blocks } = message;
1581
- if (isToolMessage(message)) {
1582
- return /* @__PURE__ */ React9.createElement(MessageItem, {
1583
- classNames: mx5(classNames, "animate-[fadeIn_0.5s]")
1584
- }, /* @__PURE__ */ React9.createElement(ToolBlock, {
1585
- classNames: panelClasses,
1586
- message,
1587
- tools
1588
- }));
1589
- }
1590
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, debug && /* @__PURE__ */ React9.createElement("div", {
1591
- className: mx5("flex justify-end text-subdued", marginClasses)
1592
- }, /* @__PURE__ */ React9.createElement("pre", {
1593
- className: "text-xs"
1594
- }, JSON.stringify({
1595
- created: message.created
1596
- }))), blocks.map((block, idx) => {
1597
- if (block._tag === "text" && block.text.replaceAll(/\s+/g, "").length === 0) {
1598
- return null;
1599
- }
1600
- const Component = components[block._tag] ?? components.default;
1601
- if (!Component) {
1602
- return null;
1603
- }
1604
- return /* @__PURE__ */ React9.createElement(Fragment2, {
1605
- key: idx
1606
- }, /* @__PURE__ */ React9.createElement(MessageItem, {
1607
- classNames,
1608
- user: block._tag === "text" && role === "user"
1609
- }, /* @__PURE__ */ React9.createElement(ErrorBoundary, {
1610
- data: block
1611
- }, /* @__PURE__ */ React9.createElement(Component, {
1612
- space,
1613
- block,
1614
- onEvent
1615
- }))), debug && /* @__PURE__ */ React9.createElement("div", {
1616
- className: mx5("flex justify-end text-subdued", marginClasses)
1617
- }, /* @__PURE__ */ React9.createElement("pre", {
1618
- className: "text-xs"
1619
- }, JSON.stringify({
1620
- block: block._tag
1621
- }))));
1622
- }), onDelete && /* @__PURE__ */ React9.createElement("div", {
1623
- className: mx5("flex justify-end pbs-2 pbe-2 opacity-50 hover:opacity-100", marginClasses)
1624
- }, /* @__PURE__ */ React9.createElement(IconButton3, {
1625
- classNames: "animate-[fadeIn_0.5s]",
1626
- icon: "ph--trash--regular",
1627
- iconOnly: true,
1628
- label: t("button delete message"),
1629
- onClick: () => onDelete()
1630
- })));
1631
- } finally {
1632
- _effect.f();
1633
- }
1634
- };
1635
- var components = {
1636
- //
1637
- // Text
1638
- //
1639
- ["text"]: ({ space, block }) => {
1640
- invariant2(block._tag === "text", void 0, {
1641
- F: __dxlog_file5,
1642
- L: 125,
1643
- S: void 0,
1644
- A: [
1645
- "block._tag === 'text'",
1646
- ""
1647
- ]
1648
- });
1649
- return /* @__PURE__ */ React9.createElement(MarkdownViewer, {
1650
- content: preprocessTextContent(block.text),
1651
- components: {
1652
- a: ({ node: { properties }, children, href, ...props }) => {
1653
- if (space && typeof properties?.href === "string" && properties?.href?.startsWith("dxn")) {
1654
- try {
1655
- const dxn = DXN.parse(properties.href);
1656
- return /* @__PURE__ */ React9.createElement(ObjectLink, {
1657
- space,
1658
- dxn
1659
- });
1660
- } catch {
1661
- }
1662
- }
1663
- return /* @__PURE__ */ React9.createElement("a", {
1664
- href,
1665
- className: "text-primary-500 hover:text-primary-500",
1666
- target: "_blank",
1667
- rel: "noopener noreferrer",
1668
- ...props
1669
- }, children);
1670
- }
1671
- }
1672
- });
1673
- },
1674
- //
1675
- // Suggest
1676
- //
1677
- ["suggest"]: ({ block, onEvent }) => {
1678
- const { t } = useTranslation6(meta.id);
1679
- invariant2(block._tag === "suggest", void 0, {
1680
- F: __dxlog_file5,
1681
- L: 162,
1682
- S: void 0,
1683
- A: [
1684
- "block._tag === 'suggest'",
1685
- ""
1686
- ]
1687
- });
1688
- return /* @__PURE__ */ React9.createElement(IconButton3, {
1689
- icon: "ph--lightning--regular",
1690
- label: block.text,
1691
- title: t("button suggest"),
1692
- onClick: () => onEvent?.({
1693
- type: "submit",
1694
- text: block.text
1695
- })
1696
- });
1697
- },
1698
- //
1699
- // Select
1700
- //
1701
- ["select"]: ({ block, onEvent }) => {
1702
- const { t } = useTranslation6(meta.id);
1703
- invariant2(block._tag === "select", void 0, {
1704
- F: __dxlog_file5,
1705
- L: 178,
1706
- S: void 0,
1707
- A: [
1708
- "block._tag === 'select'",
1709
- ""
1710
- ]
1711
- });
1712
- return /* @__PURE__ */ React9.createElement("div", {
1713
- className: "flex flex-wrap gap-1"
1714
- }, block.options.map((option, idx) => /* @__PURE__ */ React9.createElement(Button, {
1715
- classNames: "animate-[fadeIn_0.5s] rounded-sm text-sm",
1716
- key: idx,
1717
- onClick: () => onEvent?.({
1718
- type: "submit",
1719
- text: option
1720
- }),
1721
- title: t("button select option")
1722
- }, option)));
1723
- },
1724
- //
1725
- // Toolkit
1726
- //
1727
- ["toolkit"]: ({ block }) => {
1728
- invariant2(block._tag === "toolkit", void 0, {
1729
- F: __dxlog_file5,
1730
- L: 199,
1731
- S: void 0,
1732
- A: [
1733
- "block._tag === 'toolkit'",
1734
- ""
1735
- ]
1736
- });
1737
- return /* @__PURE__ */ React9.createElement(ToggleContainer2, {
1738
- title: "Toolbox",
1739
- classNames: panelClasses,
1740
- defaultOpen: true
1741
- }, /* @__PURE__ */ React9.createElement(Toolbox, {
1742
- classNames: marginClasses
1743
- }));
1744
- },
1745
- //
1746
- // JSON
1747
- //
1748
- ["json"]: ({ block, onEvent }) => {
1749
- invariant2(block._tag === "json", void 0, {
1750
- F: __dxlog_file5,
1751
- L: 211,
1752
- S: void 0,
1753
- A: [
1754
- "block._tag === 'json'",
1755
- ""
1756
- ]
1757
- });
1758
- switch (block.disposition) {
1759
- case "graph": {
1760
- return /* @__PURE__ */ React9.createElement("div", {
1761
- className: "flex flex-wrap gap-1"
1762
- }, /* @__PURE__ */ React9.createElement(Surface, {
1763
- role: "card",
1764
- data: {
1765
- subject: JSON.parse(block.data ?? "{}")
1766
- },
1767
- limit: 1,
1768
- fallback: /* @__PURE__ */ React9.createElement("div", {
1769
- className: "font-mono text-xs text-pre"
1770
- }, block.data)
1771
- }), onEvent && /* @__PURE__ */ React9.createElement(IconButton3, {
1772
- icon: "ph--plus--regular",
1773
- label: "Add to graph",
1774
- onClick: () => onEvent?.({
1775
- type: "add",
1776
- object: JSON.parse(block.data ?? "{}")
1777
- })
1778
- }));
1779
- }
1780
- default: {
1781
- return /* @__PURE__ */ React9.createElement(ToggleContainer2, {
1782
- title: block.disposition ?? block._tag
1783
- }, /* @__PURE__ */ React9.createElement(Json, {
1784
- data: safeParseJson(block.data ?? block)
1785
- }));
1786
- }
1787
- }
1788
- },
1789
- //
1790
- // Fallback
1791
- //
1792
- default: ({ block }) => {
1793
- return /* @__PURE__ */ React9.createElement(ToggleContainer2, {
1794
- title: block._tag
1795
- }, /* @__PURE__ */ React9.createElement(Json, {
1796
- data: block
1797
- }));
1798
- }
1799
- };
1800
- var MessageItem = ({ classNames, children, user }) => {
1801
- var _effect = _useSignals10();
1802
- try {
1803
- if (!children) {
1804
- return null;
1805
- }
1806
- return /* @__PURE__ */ React9.createElement("div", {
1807
- role: "list-item",
1808
- className: mx5("flex is-full", user && "justify-end", marginClasses, classNames)
1809
- }, /* @__PURE__ */ React9.createElement("div", {
1810
- className: mx5(user ? [
1811
- "rounded-sm",
1812
- "bg-[--user-fill] text-accentSurfaceText",
1813
- paddingClasses
1814
- ] : "is-full")
1815
- }, children));
1816
- } finally {
1817
- _effect.f();
1818
- }
1819
- };
1820
- var ToggleContainer2 = (props) => {
1821
- var _effect = _useSignals10();
1822
- try {
1823
- return /* @__PURE__ */ React9.createElement(NativeToggleContainer, {
1824
- ...props,
1825
- classNames: mx5(panelClasses, props.classNames)
1826
- });
1827
- } finally {
1828
- _effect.f();
1829
- }
1830
- };
1831
- var preprocessTextContent = (content) => content.replaceAll(new RegExp(DXN_ECHO_REGEXP, "g"), (_, dxn) => `<${dxn}>`);
1832
-
1833
- // src/components/ChatThread/reducer.ts
1834
- var messageReducer = ({ current, messages }, message) => {
1835
- let i = 0;
1836
- for (const block of message.blocks) {
1837
- switch (block._tag) {
1838
- case "toolCall":
1839
- case "toolResult": {
1840
- if (current) {
1841
- current.blocks.push(block);
1842
- } else {
1843
- current = {
1844
- ...message,
1845
- id: [
1846
- message.id,
1847
- i
1848
- ].join("_"),
1849
- blocks: [
1850
- block
1851
- ]
1852
- };
1853
- messages.push(current);
1854
- }
1855
- break;
1856
- }
1857
- case "text":
1858
- default: {
1859
- current = void 0;
1860
- messages.push({
1861
- ...message,
1862
- id: [
1863
- message.id,
1864
- i
1865
- ].join("_"),
1866
- blocks: [
1867
- block
1868
- ]
1869
- });
1870
- break;
1871
- }
1872
- }
1873
- i++;
1874
- }
1875
- return {
1876
- current,
1877
- messages
1878
- };
1879
- };
1880
-
1881
- // src/components/ChatThread/ChatThread.tsx
1882
- var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages, collapse = true, ...props }, forwardedRef) => {
1883
- var _effect = _useSignals11();
1884
- try {
1885
- const userHue = useMemo9(() => {
1886
- return identity?.profile?.data?.hue || keyToFallback(identity?.identityKey ?? PublicKey.random()).hue;
1887
- }, [
1888
- identity
1889
- ]);
1890
- const { messages: filteredMessages = [] } = useMemo9(() => {
1891
- if (collapse) {
1892
- return (messages ?? []).reduce(messageReducer, {
1893
- messages: []
1894
- });
1895
- } else {
1896
- return {
1897
- messages: messages ?? []
1898
- };
1899
- }
1900
- }, [
1901
- messages,
1902
- collapse
1903
- ]);
1904
- return /* @__PURE__ */ React10.createElement(ScrollContainer, {
1905
- ref: forwardedRef,
1906
- classNames,
1907
- fade: true
1908
- }, /* @__PURE__ */ React10.createElement("div", {
1909
- role: "none",
1910
- className: mx6("flex flex-col gap-2", filteredMessages.length > 0 && "pbs-4 pbe-4"),
1911
- style: {
1912
- "--user-fill": `var(--dx-${userHue}Fill)`
1913
- }
1914
- }, filteredMessages.map((message) => /* @__PURE__ */ React10.createElement(ChatMessage, {
1915
- key: message.id,
1916
- message,
1917
- ...props
1918
- }))));
1919
- } finally {
1920
- _effect.f();
1921
- }
1922
- });
1923
-
1924
- // src/components/Chat/Chat.tsx
1925
- var __dxlog_file6 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Chat/Chat.tsx";
1926
- var Endcap = ({ children }) => {
1927
- var _effect = _useSignals12();
1928
- try {
1929
- return /* @__PURE__ */ React11.createElement("div", {
1930
- className: "grid w-[var(--rail-action)] h-[var(--rail-action)] items-center justify-center"
1931
- }, children);
1932
- } finally {
1933
- _effect.f();
1934
- }
1935
- };
1936
- var [ChatContextProvider, useChatContext] = createContext("Chat");
1937
- var ChatRoot = ({ classNames, children, chat, processor, onEvent, ...props }) => {
1938
- var _effect = _useSignals12();
1939
- try {
1940
- const [debug, setDebug] = useState7(false);
1941
- const space = getSpace(chat);
1942
- const queue = useQueue(chat?.queue.dxn);
1943
- const pending = useRxValue(processor.messages);
1944
- const streaming = useRxValue(processor.streaming);
1945
- const messages = useMemo10(() => {
1946
- const queueMessages = queue?.objects?.filter(Obj7.instanceOf(DataType2.Message)) ?? [];
1947
- return Result2.match(pending, {
1948
- onInitial: () => queueMessages,
1949
- onSuccess: (pending2) => Array.dedupeWith([
1950
- ...queueMessages,
1951
- ...pending2.value
1952
- ], (a, b) => a.id === b.id),
1953
- onFailure: () => queueMessages
1954
- });
1955
- }, [
1956
- queue?.objects,
1957
- pending
1958
- ]);
1959
- const event = useMemo10(() => new Event(), []);
1960
- useEffect5(() => {
1961
- return event.on((event2) => {
1962
- switch (event2.type) {
1963
- case "toggle-debug": {
1964
- setDebug((current) => {
1965
- const debug2 = !current;
1966
- log6.info("toggle-debug", {
1967
- debug: debug2
1968
- }, {
1969
- F: __dxlog_file6,
1970
- L: 123,
1971
- S: void 0,
1972
- C: (f, a) => f(...a)
1973
- });
1974
- return debug2;
1975
- });
1976
- break;
1977
- }
1978
- case "submit": {
1979
- if (!streaming) {
1980
- void processor.request(event2.text);
1981
- }
1982
- break;
1983
- }
1984
- case "cancel": {
1985
- void processor.cancel();
1986
- break;
1987
- }
1988
- default: {
1989
- onEvent?.(event2);
1990
- }
1991
- }
1992
- });
1993
- }, [
1994
- event,
1995
- onEvent,
1996
- processor,
1997
- streaming
1998
- ]);
1999
- if (!space) {
2000
- return null;
2001
- }
2002
- return /* @__PURE__ */ React11.createElement(ChatContextProvider, {
2003
- debug,
2004
- event,
2005
- chat,
2006
- space,
2007
- processor,
2008
- messages,
2009
- ...props
2010
- }, /* @__PURE__ */ React11.createElement("div", {
2011
- role: "none",
2012
- className: mx7("flex flex-col h-full overflow-hidden", classNames)
2013
- }, children));
2014
- } finally {
2015
- _effect.f();
2016
- }
2017
- };
2018
- ChatRoot.displayName = "Chat.Root";
2019
- var ChatThread2 = (props) => {
2020
- var _effect = _useSignals12();
2021
- try {
2022
- const { debug, event, space, messages } = useChatContext(ChatThread2.displayName);
2023
- const identity = useIdentity();
2024
- const scrollerRef = useRef2(null);
2025
- useEffect5(() => {
2026
- return event.on((event2) => {
2027
- switch (event2.type) {
2028
- case "submit":
2029
- case "scroll-to-bottom":
2030
- scrollerRef.current?.scrollToBottom("smooth");
2031
- break;
2032
- }
2033
- });
2034
- }, [
2035
- event
2036
- ]);
2037
- if (!identity) {
2038
- return null;
2039
- }
2040
- return /* @__PURE__ */ React11.createElement(ChatThread, {
2041
- ...props,
2042
- ref: scrollerRef,
2043
- debug,
2044
- identity,
2045
- space,
2046
- messages,
2047
- onEvent: (ev) => event.emit(ev)
2048
- });
2049
- } finally {
2050
- _effect.f();
2051
- }
2052
- };
2053
- ChatThread2.displayName = "Chat.Thread";
2054
- var ChatPrompt = ({ classNames, placeholder, expandable, online, presets, preset, onChangePreset, onChangeOnline }) => {
2055
- var _effect = _useSignals12();
2056
- try {
2057
- const { t } = useTranslation7(meta.id);
2058
- const { space, event, processor } = useChatContext(ChatPrompt.displayName);
2059
- const streaming = useRxValue(processor.streaming);
2060
- const error = useRxValue(processor.error).pipe(Option2.getOrUndefined);
2061
- const [active, setActive] = useState7(false);
2062
- useEffect5(() => {
2063
- return event.on((event2) => {
2064
- switch (event2.type) {
2065
- case "record-start":
2066
- setActive(true);
2067
- break;
2068
- case "record-stop":
2069
- setActive(false);
2070
- break;
2071
- }
2072
- });
2073
- }, [
2074
- event
2075
- ]);
2076
- const editorRef = useRef2(null);
2077
- const { recording } = useVoiceInput({
2078
- active,
2079
- onUpdate: (text) => {
2080
- editorRef.current?.setText(text);
2081
- editorRef.current?.focus();
2082
- }
2083
- });
2084
- const referencesProvider = useReferencesProvider(space);
2085
- const extensions = useMemo10(() => {
2086
- return [
2087
- referencesProvider && references({
2088
- provider: referencesProvider
2089
- }),
2090
- Prec.highest(keymap.of([
2091
- {
2092
- key: "cmd-d",
2093
- preventDefault: true,
2094
- run: () => {
2095
- event.emit({
2096
- type: "toggle-debug"
2097
- });
2098
- return true;
2099
- }
2100
- },
2101
- expandable && {
2102
- key: "cmd-ArrowUp",
2103
- preventDefault: true,
2104
- run: () => {
2105
- event.emit({
2106
- type: "thread-open"
2107
- });
2108
- return true;
2109
- }
2110
- },
2111
- expandable && {
2112
- key: "cmd-ArrowDown",
2113
- preventDefault: true,
2114
- run: () => {
2115
- event.emit({
2116
- type: "thread-close"
2117
- });
2118
- return true;
2119
- }
2120
- }
2121
- ].filter(isNotFalsy2)))
2122
- ].filter(isNotFalsy2);
2123
- }, [
2124
- event,
2125
- expandable,
2126
- referencesProvider
2127
- ]);
2128
- const handleSubmit = useCallback4((text) => {
2129
- if (!streaming) {
2130
- event.emit({
2131
- type: "submit",
2132
- text
2133
- });
2134
- return true;
2135
- }
2136
- }, [
2137
- streaming,
2138
- event
2139
- ]);
2140
- const handleEvent = useCallback4((ev) => {
2141
- event.emit(ev);
2142
- }, [
2143
- event
2144
- ]);
2145
- const handleUpdateReferences = useCallback4((dxns) => {
2146
- log6.info("update", {
2147
- dxns
2148
- }, {
2149
- F: __dxlog_file6,
2150
- L: 323,
2151
- S: void 0,
2152
- C: (f, a) => f(...a)
2153
- });
2154
- void processor.context.bind({
2155
- objects: dxns.map((dxn) => Ref4.fromDXN(DXN2.parse(dxn)))
2156
- });
2157
- }, []);
2158
- const { onUpdateBlueprint } = useBlueprintHandlers({
2159
- space,
2160
- context: processor.context,
2161
- blueprintRegistry: processor.blueprintRegistry
2162
- });
2163
- return /* @__PURE__ */ React11.createElement("div", {
2164
- className: mx7("is-full grid grid-cols-[var(--rail-action)_1fr_var(--rail-action)] grid-rows-[min-content_min-content_min-content]", classNames)
2165
- }, /* @__PURE__ */ React11.createElement(Endcap, null, /* @__PURE__ */ React11.createElement(ChatStatusIndicator, {
2166
- preset,
2167
- error,
2168
- processing: streaming
2169
- })), /* @__PURE__ */ React11.createElement(ChatEditor, {
2170
- ref: editorRef,
2171
- autoFocus: true,
2172
- lineWrapping: true,
2173
- classNames: "col-span-2 pis-1 pbs-2",
2174
- placeholder: placeholder ?? t("prompt placeholder"),
2175
- extensions,
2176
- onSubmit: handleSubmit
2177
- }), /* @__PURE__ */ React11.createElement("div", null), /* @__PURE__ */ React11.createElement(ChatReferences, {
2178
- classNames: "col-span-2 flex pis-1 items-center",
2179
- space,
2180
- context: processor.context,
2181
- onUpdate: handleUpdateReferences
2182
- }), /* @__PURE__ */ React11.createElement(ChatOptions, {
2183
- blueprintRegistry: processor.blueprintRegistry,
2184
- context: processor.context,
2185
- onUpdateBlueprint
2186
- }), /* @__PURE__ */ React11.createElement(ChatActions, {
2187
- classNames: "col-span-2",
2188
- microphone: true,
2189
- recording,
2190
- processing: streaming,
2191
- onEvent: handleEvent
2192
- }, /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("div", {
2193
- className: "grow"
2194
- }), presets && /* @__PURE__ */ React11.createElement(ChatPresets, {
2195
- preset,
2196
- presets,
2197
- onChange: onChangePreset
2198
- }), online !== void 0 && /* @__PURE__ */ React11.createElement(Input.Root, null, /* @__PURE__ */ React11.createElement(Input.Switch, {
2199
- classNames: "mis-2 mie-2",
2200
- checked: online,
2201
- onCheckedChange: onChangeOnline
2202
- })))));
2203
- } finally {
2204
- _effect.f();
2205
- }
2206
- };
2207
- ChatPrompt.displayName = "Chat.Prompt";
2208
- var Chat = {
2209
- Root: ChatRoot,
2210
- Thread: ChatThread2,
2211
- Prompt: ChatPrompt
2212
- };
2213
-
2214
- export {
2215
- useBlueprintRegistry,
2216
- useChatProcessor,
2217
- useChatServices,
2218
- useOnline,
2219
- usePresets,
2220
- Toolbox,
2221
- ToolboxContainer,
2222
- Chat,
2223
- AiService2 as AiService,
2224
- AppGraphBuilder,
2225
- BlueprintDefinition,
2226
- EdgeModelResolver,
2227
- IntentResolver,
2228
- ReactSurface,
2229
- Settings,
2230
- Toolkit
2231
- };
2232
- //# sourceMappingURL=chunk-3SOC5GOP.mjs.map