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