@dxos/plugin-assistant 0.8.4-main.5acf9ea → 0.8.4-main.5ea62a8

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 (462) hide show
  1. package/dist/lib/browser/{BlueprintContainer-IZ4AK5EO.mjs → BlueprintContainer-OWUSKPRK.mjs} +4 -3
  2. package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs +126 -0
  3. package/dist/lib/browser/ChatCompanion-FRCVSLPP.mjs.map +7 -0
  4. package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-YBJBIVUZ.mjs} +34 -13
  5. package/dist/lib/browser/ChatContainer-YBJBIVUZ.mjs.map +7 -0
  6. package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-MTPJLEHM.mjs} +26 -9
  7. package/dist/lib/browser/ChatDialog-MTPJLEHM.mjs.map +7 -0
  8. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
  9. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
  10. package/dist/lib/browser/ai-service-NRZPTUHO.mjs +22 -0
  11. package/dist/lib/browser/ai-service-NRZPTUHO.mjs.map +7 -0
  12. package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-7AAWTWGA.mjs} +25 -36
  13. package/dist/lib/browser/app-graph-builder-7AAWTWGA.mjs.map +7 -0
  14. package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs +12 -0
  15. package/dist/lib/browser/blueprint-definition-CRZPIA5A.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-6QMISAU6.mjs +167 -0
  17. package/dist/lib/browser/chunk-6QMISAU6.mjs.map +7 -0
  18. package/dist/lib/browser/{chunk-LERGF5YG.mjs → chunk-CFXXQM25.mjs} +96 -22
  19. package/dist/lib/browser/chunk-CFXXQM25.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-IJAJRAR7.mjs +18 -0
  21. package/dist/lib/browser/chunk-IJAJRAR7.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  23. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
  25. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
  26. package/dist/lib/browser/chunk-OYFQS7JM.mjs +157 -0
  27. package/dist/lib/browser/chunk-OYFQS7JM.mjs.map +7 -0
  28. package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
  29. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
  30. package/dist/lib/browser/chunk-V5H5CCZA.mjs +218 -0
  31. package/dist/lib/browser/chunk-V5H5CCZA.mjs.map +7 -0
  32. package/dist/lib/browser/chunk-XL557TXF.mjs +2332 -0
  33. package/dist/lib/browser/chunk-XL557TXF.mjs.map +7 -0
  34. package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs +22 -0
  35. package/dist/lib/browser/edge-model-resolver-E5M3CC46.mjs.map +7 -0
  36. package/dist/lib/browser/index.mjs +134 -59
  37. package/dist/lib/browser/index.mjs.map +4 -4
  38. package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs +112 -0
  39. package/dist/lib/browser/intent-resolver-BQO5SVGI.mjs.map +7 -0
  40. package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs +21 -0
  41. package/dist/lib/browser/local-model-resolver-VZ5WZQIC.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/{react-surface-3GYEHQRP.mjs → react-surface-VNCD2H7C.mjs} +25 -66
  44. package/dist/lib/browser/react-surface-VNCD2H7C.mjs.map +7 -0
  45. package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-36V3VUMW.mjs} +6 -5
  46. package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
  47. package/dist/lib/browser/state-D5IVKNYG.mjs +21 -0
  48. package/dist/lib/browser/state-D5IVKNYG.mjs.map +7 -0
  49. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
  50. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
  51. package/dist/lib/browser/types/index.mjs +7 -4
  52. package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-UFVWCRN6.mjs} +4 -3
  53. package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-UFVWCRN6.mjs.map} +1 -1
  54. package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs +127 -0
  55. package/dist/lib/node-esm/ChatCompanion-ZNRZEKH5.mjs.map +7 -0
  56. package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-TUCITJJW.mjs} +34 -13
  57. package/dist/lib/node-esm/ChatContainer-TUCITJJW.mjs.map +7 -0
  58. package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-JLM7RDZQ.mjs} +26 -9
  59. package/dist/lib/node-esm/ChatDialog-JLM7RDZQ.mjs.map +7 -0
  60. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
  61. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
  62. package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs +23 -0
  63. package/dist/lib/node-esm/ai-service-UDEPIPTO.mjs.map +7 -0
  64. package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-PNAFQUYT.mjs} +25 -36
  65. package/dist/lib/node-esm/app-graph-builder-PNAFQUYT.mjs.map +7 -0
  66. package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs +13 -0
  67. package/dist/lib/node-esm/blueprint-definition-275J3XL2.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-2X6VEO32.mjs +2333 -0
  69. package/dist/lib/node-esm/chunk-2X6VEO32.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
  71. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-CAQKGW3B.mjs +159 -0
  73. package/dist/lib/node-esm/chunk-CAQKGW3B.mjs.map +7 -0
  74. package/dist/lib/node-esm/{chunk-MS3PJARN.mjs → chunk-FNZJJL7G.mjs} +96 -22
  75. package/dist/lib/node-esm/chunk-FNZJJL7G.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  77. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-RLBN4RNR.mjs +168 -0
  79. package/dist/lib/node-esm/chunk-RLBN4RNR.mjs.map +7 -0
  80. package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs +219 -0
  81. package/dist/lib/node-esm/chunk-UWUUZQWJ.mjs.map +7 -0
  82. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
  83. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
  84. package/dist/lib/node-esm/chunk-YPXEA46Q.mjs +19 -0
  85. package/dist/lib/node-esm/chunk-YPXEA46Q.mjs.map +7 -0
  86. package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs +23 -0
  87. package/dist/lib/node-esm/edge-model-resolver-SZHDLXCT.mjs.map +7 -0
  88. package/dist/lib/node-esm/index.mjs +134 -59
  89. package/dist/lib/node-esm/index.mjs.map +4 -4
  90. package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs +113 -0
  91. package/dist/lib/node-esm/intent-resolver-FIS3T5KP.mjs.map +7 -0
  92. package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs +22 -0
  93. package/dist/lib/node-esm/local-model-resolver-2KCBKMYA.mjs.map +7 -0
  94. package/dist/lib/node-esm/meta.json +1 -1
  95. package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-4NLRKNBU.mjs} +25 -66
  96. package/dist/lib/node-esm/react-surface-4NLRKNBU.mjs.map +7 -0
  97. package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7ZCZ6AS5.mjs} +6 -5
  98. package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
  99. package/dist/lib/node-esm/state-4VLKPLW3.mjs +22 -0
  100. package/dist/lib/node-esm/state-4VLKPLW3.mjs.map +7 -0
  101. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
  102. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
  103. package/dist/lib/node-esm/types/index.mjs +7 -4
  104. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  106. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  108. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
  110. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/capabilities.d.ts +19 -0
  112. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  113. package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
  114. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/index.d.ts +11 -3
  116. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  118. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  119. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  120. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  121. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  122. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/settings.d.ts +1 -1
  124. package/dist/types/src/capabilities/state.d.ts +4 -0
  125. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  126. package/dist/types/src/capabilities/toolkit.d.ts +4 -0
  127. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  128. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  129. package/dist/types/src/components/Chat/Chat.d.ts +19 -16
  130. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  131. package/dist/types/src/components/Chat/events.d.ts +5 -0
  132. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  133. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  134. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  135. package/dist/types/src/components/ChatContainer.d.ts +4 -4
  136. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  137. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  138. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  139. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  140. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  141. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  142. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  143. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
  144. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  145. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  146. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
  147. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  148. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  149. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  150. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  151. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  152. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +21 -5
  153. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
  154. package/dist/types/src/components/ChatThread/ChatThread.d.ts +4 -4
  155. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  156. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +108 -30
  157. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  159. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  160. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +12 -12
  161. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
  162. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  163. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  164. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  165. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  166. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  167. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +257 -2
  168. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  169. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
  170. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  171. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +257 -6
  172. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  173. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  174. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +254 -1
  175. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  176. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
  177. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
  178. package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -0
  179. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  180. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  181. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  182. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
  183. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
  184. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
  185. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  186. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +258 -4
  187. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  188. package/dist/types/src/components/index.d.ts +4 -1
  189. package/dist/types/src/components/index.d.ts.map +1 -1
  190. package/dist/types/src/events.d.ts +1 -1
  191. package/dist/types/src/events.d.ts.map +1 -1
  192. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  193. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  194. package/dist/types/src/execution-graph/index.d.ts +2 -0
  195. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  196. package/dist/types/src/functions/analysis.d.ts +5 -0
  197. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  198. package/dist/types/src/functions/index.d.ts +4 -0
  199. package/dist/types/src/functions/index.d.ts.map +1 -0
  200. package/dist/types/src/functions/list.d.ts +10 -0
  201. package/dist/types/src/functions/list.d.ts.map +1 -0
  202. package/dist/types/src/functions/load.d.ts +8 -0
  203. package/dist/types/src/functions/load.d.ts.map +1 -0
  204. package/dist/types/src/hooks/index.d.ts +10 -3
  205. package/dist/types/src/hooks/index.d.ts.map +1 -1
  206. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
  207. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  208. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -20
  209. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  210. package/dist/types/src/hooks/useChatServices.d.ts +4 -5
  211. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  212. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  213. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  214. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  215. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  216. package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
  217. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  218. package/dist/types/src/hooks/useFlush.d.ts +6 -0
  219. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  220. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  221. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  222. package/dist/types/src/hooks/useMatcherExtension.d.ts +3 -0
  223. package/dist/types/src/hooks/useMatcherExtension.d.ts.map +1 -0
  224. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  225. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  226. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  227. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  228. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  229. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  230. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  231. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  232. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  233. package/dist/types/src/parser/types.d.ts.map +1 -1
  234. package/dist/types/src/processor/index.d.ts +3 -0
  235. package/dist/types/src/processor/index.d.ts.map +1 -0
  236. package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
  237. package/dist/types/src/processor/presets.d.ts.map +1 -0
  238. package/dist/types/src/processor/processor.d.ts +80 -0
  239. package/dist/types/src/processor/processor.d.ts.map +1 -0
  240. package/dist/types/src/processor/processor.test.d.ts +2 -0
  241. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  242. package/dist/types/src/stories/Chat.stories.d.ts +22 -203
  243. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  244. package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
  245. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  246. package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
  247. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  248. package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
  249. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
  250. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  251. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  252. package/dist/types/src/stories/components/LoggingContainer.d.ts +4 -0
  253. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  254. package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
  255. package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
  256. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  257. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  258. package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
  259. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  260. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
  261. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
  262. package/dist/types/src/stories/components/index.d.ts +11 -0
  263. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  264. package/dist/types/src/stories/components/types.d.ts +7 -0
  265. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  266. package/dist/types/src/stories/testing/data.d.ts +5 -0
  267. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  268. package/dist/types/src/stories/testing/index.d.ts +3 -0
  269. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  270. package/dist/types/src/stories/testing/testing.d.ts +44 -0
  271. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  272. package/dist/types/src/testing/index.d.ts +2 -1
  273. package/dist/types/src/testing/index.d.ts.map +1 -1
  274. package/dist/types/src/testing/test-data.d.ts +4 -0
  275. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  276. package/dist/types/src/testing/test-functions.d.ts +5 -2
  277. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  278. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  279. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  280. package/dist/types/src/translations.d.ts +26 -11
  281. package/dist/types/src/translations.d.ts.map +1 -1
  282. package/dist/types/src/types/Assistant.d.ts +42 -0
  283. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  284. package/dist/types/src/types/AssistantAction.d.ts +107 -0
  285. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  286. package/dist/types/src/types/defs.d.ts +2 -0
  287. package/dist/types/src/types/defs.d.ts.map +1 -0
  288. package/dist/types/src/types/index.d.ts +3 -1
  289. package/dist/types/src/types/index.d.ts.map +1 -1
  290. package/dist/types/src/types/service.d.ts +9 -6
  291. package/dist/types/src/types/service.d.ts.map +1 -1
  292. package/dist/types/tsconfig.tsbuildinfo +1 -1
  293. package/package.json +99 -81
  294. package/src/AssistantPlugin.tsx +52 -16
  295. package/src/capabilities/ai-service.ts +28 -0
  296. package/src/capabilities/app-graph-builder.ts +41 -48
  297. package/src/capabilities/blueprint-definition.ts +42 -0
  298. package/src/capabilities/capabilities.ts +31 -0
  299. package/src/capabilities/edge-model-resolver.ts +27 -0
  300. package/src/capabilities/index.ts +9 -0
  301. package/src/capabilities/intent-resolver.ts +45 -23
  302. package/src/capabilities/local-model-resolver.ts +32 -0
  303. package/src/capabilities/react-surface.tsx +10 -57
  304. package/src/capabilities/state.ts +20 -0
  305. package/src/capabilities/toolkit.ts +163 -0
  306. package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
  307. package/src/components/Chat/Chat.tsx +171 -165
  308. package/src/components/Chat/events.ts +7 -0
  309. package/src/components/ChatCompanion.tsx +111 -0
  310. package/src/components/ChatContainer.tsx +19 -13
  311. package/src/components/ChatDialog.tsx +11 -7
  312. package/src/components/ChatProgress/ChatProgress.tsx +68 -0
  313. package/src/components/ChatProgress/index.ts +5 -0
  314. package/src/components/ChatPrompt/ChatActions.tsx +10 -24
  315. package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
  316. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  317. package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
  318. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  319. package/src/components/ChatPrompt/index.ts +1 -1
  320. package/src/components/ChatThread/ChatMessage.tsx +214 -148
  321. package/src/components/ChatThread/ChatThread.stories.tsx +244 -104
  322. package/src/components/ChatThread/ChatThread.tsx +44 -22
  323. package/src/components/ChatThread/Link.tsx +23 -0
  324. package/src/components/ChatThread/ToolBlock.tsx +103 -77
  325. package/src/components/ChatThread/reducers.ts +151 -0
  326. package/src/components/PromptSettings.tsx +1 -0
  327. package/src/components/SequenceContainer.tsx +27 -28
  328. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
  329. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  330. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +25 -12
  331. package/src/components/TemplateEditor/TemplateEditor.tsx +14 -47
  332. package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
  333. package/src/components/TemplateEditor/TemplateForm.tsx +3 -1
  334. package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
  335. package/src/components/Toolbar/Toolbar.tsx +20 -0
  336. package/src/components/Toolbar/index.ts +5 -0
  337. package/src/components/Toolbar/useChatToolbarActions.ts +125 -0
  338. package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
  339. package/src/components/Toolbox/Toolbox.tsx +21 -51
  340. package/src/components/index.ts +3 -4
  341. package/src/events.ts +2 -2
  342. package/src/execution-graph/execution-graph.ts +211 -0
  343. package/src/execution-graph/index.ts +5 -0
  344. package/src/functions/analysis.ts +20 -0
  345. package/src/functions/index.ts +7 -0
  346. package/src/functions/list.ts +46 -0
  347. package/src/functions/load.ts +43 -0
  348. package/src/hooks/index.ts +10 -4
  349. package/src/hooks/useBlueprintRegistry.ts +80 -0
  350. package/src/hooks/useChatProcessor.ts +20 -97
  351. package/src/hooks/useChatServices.ts +29 -32
  352. package/src/hooks/useContextBinder.ts +18 -0
  353. package/src/hooks/useContextObjects.ts +58 -0
  354. package/src/hooks/useExecutionGraph.ts +20 -0
  355. package/src/hooks/useFlush.ts +35 -0
  356. package/src/hooks/useItemTypes.ts +37 -0
  357. package/src/hooks/useMatcherExtension.ts +45 -0
  358. package/src/hooks/useOnline.ts +10 -0
  359. package/src/hooks/usePresets.ts +44 -0
  360. package/src/hooks/useReferencesProvider.ts +11 -9
  361. package/src/hooks/useResolveRef.ts +33 -0
  362. package/src/meta.ts +1 -1
  363. package/src/parser/filter-generator.ts +8 -13
  364. package/src/parser/query-parser.ts +1 -1
  365. package/src/parser/types.ts +2 -0
  366. package/src/processor/index.ts +6 -0
  367. package/src/{hooks → processor}/presets.ts +14 -6
  368. package/src/processor/processor.test.ts +77 -0
  369. package/src/processor/processor.ts +304 -0
  370. package/src/queue-logger.ts +5 -5
  371. package/src/stories/Chat.stories.tsx +391 -293
  372. package/src/stories/components/BlueprintContainer.tsx +32 -0
  373. package/src/stories/components/ChatContainer.tsx +57 -0
  374. package/src/stories/components/CommentsContainer.tsx +25 -0
  375. package/src/stories/components/GraphContainer.tsx +118 -0
  376. package/src/stories/components/LoggingContainer.tsx +21 -0
  377. package/src/stories/components/MessageContainer.tsx +27 -0
  378. package/src/stories/components/SurfaceContainer.tsx +52 -0
  379. package/src/stories/components/TasksContainer.tsx +49 -0
  380. package/src/stories/components/TokenManagerContainer.tsx +14 -0
  381. package/src/stories/components/index.ts +15 -0
  382. package/src/stories/components/types.ts +11 -0
  383. package/src/stories/testing/data.ts +142 -0
  384. package/src/stories/testing/index.ts +6 -0
  385. package/src/stories/testing/testing.tsx +254 -0
  386. package/src/testing/index.ts +2 -1
  387. package/src/testing/test-data.ts +109 -0
  388. package/src/testing/test-functions.ts +8 -3
  389. package/src/testing/test-sequence.ts +2 -27
  390. package/src/translations.ts +30 -11
  391. package/src/types/Assistant.ts +61 -0
  392. package/src/types/AssistantAction.ts +62 -0
  393. package/src/types/defs.ts +5 -0
  394. package/src/types/index.ts +4 -1
  395. package/src/vite-env.d.ts +30 -0
  396. package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
  397. package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
  398. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  399. package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
  400. package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
  401. package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
  402. package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
  403. package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
  404. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  405. package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
  406. package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
  407. package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
  408. package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
  409. package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
  410. package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
  411. package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
  412. package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
  413. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  414. package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
  415. package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
  416. package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
  417. package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
  418. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  419. package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
  420. package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
  421. package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
  422. package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
  423. package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
  424. package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
  425. package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
  426. package/dist/types/src/capability-definitions.d.ts +0 -7
  427. package/dist/types/src/capability-definitions.d.ts.map +0 -1
  428. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  429. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  430. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  431. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  432. package/dist/types/src/hooks/chat-processor.d.ts +0 -86
  433. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  434. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  435. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  436. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  437. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  438. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  439. package/dist/types/src/tools/function.d.ts +0 -5
  440. package/dist/types/src/tools/function.d.ts.map +0 -1
  441. package/dist/types/src/tools/index.d.ts +0 -3
  442. package/dist/types/src/tools/index.d.ts.map +0 -1
  443. package/dist/types/src/tools/openapi.d.ts +0 -10
  444. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  445. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  446. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  447. package/dist/types/src/types/schema.d.ts +0 -120
  448. package/dist/types/src/types/schema.d.ts.map +0 -1
  449. package/src/capability-definitions.ts +0 -15
  450. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  451. package/src/components/ChatThread/reducer.ts +0 -52
  452. package/src/hooks/chat-processor.test.ts +0 -16
  453. package/src/hooks/chat-processor.ts +0 -314
  454. package/src/hooks/useBlueprints.ts +0 -57
  455. package/src/shims.d.ts +0 -8
  456. package/src/tools/function.ts +0 -46
  457. package/src/tools/index.ts +0 -6
  458. package/src/tools/openapi.test.ts +0 -217
  459. package/src/tools/openapi.ts +0 -338
  460. package/src/types/schema.ts +0 -108
  461. package/src/typings.d.ts +0 -9
  462. /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-OWUSKPRK.mjs.map} +0 -0
@@ -1,120 +0,0 @@
1
- import { Schema } from 'effect';
2
- import { Queue } from '@dxos/client/echo';
3
- import { Type } from '@dxos/echo';
4
- export declare const LLM_PROVIDERS: readonly ["edge", "ollama", "lmstudio"];
5
- export declare namespace Assistant {
6
- export const Chat: Type.obj<Schema.Struct<{
7
- id: import("@dxos/keys").ObjectIdClass;
8
- name: Schema.optional<typeof Schema.String>;
9
- queue: Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>;
10
- }>>;
11
- export interface Chat extends Schema.Schema.Type<typeof Chat> {
12
- }
13
- export const CompanionTo: Type.relation<Schema.Struct<{
14
- id: import("@dxos/keys").ObjectIdClass;
15
- }>, Type.obj<Schema.Struct<{
16
- id: import("@dxos/keys").ObjectIdClass;
17
- name: Schema.optional<typeof Schema.String>;
18
- queue: Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>;
19
- }>>, Schema.Schema<Type.Expando, {
20
- [x: string]: any;
21
- id: string;
22
- }, never>>;
23
- export interface CompanionTo extends Schema.Schema.Type<typeof CompanionTo> {
24
- }
25
- export const Settings: Schema.mutable<Schema.Struct<{
26
- llmProvider: Schema.optional<Schema.Literal<["edge", "ollama", "lmstudio"]>>;
27
- edgeModel: Schema.optional<typeof Schema.String>;
28
- ollamaModel: Schema.optional<typeof Schema.String>;
29
- lmstudioModel: Schema.optional<typeof Schema.String>;
30
- customPrompts: Schema.optional<typeof Schema.Boolean>;
31
- }>>;
32
- export type Settings = Schema.Schema.Type<typeof Settings>;
33
- const OnSpaceCreated_base: Schema.TaggedClass<OnSpaceCreated, `${string}/on-space-created`, {
34
- readonly _tag: Schema.tag<`${string}/on-space-created`>;
35
- } & {
36
- input: Schema.Struct<{
37
- space: Schema.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
38
- rootCollection: Type.obj<Schema.Struct<{
39
- name: import("effect/Schema").optional<typeof import("effect/Schema").String>;
40
- objects: import("effect/Schema").mutable<import("effect/Schema").Array$<import("@dxos/echo/Type").ref<import("effect/Schema").Schema<import("@dxos/echo/Type").Expando, {
41
- [x: string]: any;
42
- id: string;
43
- }, never>>>>;
44
- }>>;
45
- }>;
46
- output: typeof Schema.Void;
47
- }>;
48
- export class OnSpaceCreated extends OnSpaceCreated_base {
49
- }
50
- const CreateChat_base: Schema.TaggedClass<CreateChat, `${string}/action/create-chat`, {
51
- readonly _tag: Schema.tag<`${string}/action/create-chat`>;
52
- } & {
53
- input: Schema.Struct<{
54
- space: Schema.Schema<import("@dxos/client-protocol").Space, import("@dxos/client-protocol").Space, never>;
55
- name: Schema.optional<typeof Schema.String>;
56
- }>;
57
- output: Schema.Struct<{
58
- object: Type.obj<Schema.Struct<{
59
- id: import("@dxos/keys").ObjectIdClass;
60
- name: Schema.optional<typeof Schema.String>;
61
- queue: Type.ref<Schema.Schema<Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, Queue<import("@dxos/echo/Obj").Any | import("@dxos/echo/Relation").Any>, never>>;
62
- }>>;
63
- }>;
64
- }>;
65
- export class CreateChat extends CreateChat_base {
66
- }
67
- export const BlueprintForm: Schema.Struct<{
68
- name: typeof Schema.String;
69
- description: Schema.optional<typeof Schema.String>;
70
- }>;
71
- const CreateBlueprint_base: Schema.TaggedClass<CreateBlueprint, `${string}/action/create-blueprint`, {
72
- readonly _tag: Schema.tag<`${string}/action/create-blueprint`>;
73
- } & {
74
- input: Schema.Struct<{
75
- name: typeof Schema.String;
76
- description: Schema.optional<typeof Schema.String>;
77
- }>;
78
- output: Schema.Struct<{
79
- object: Type.obj<Schema.Struct<{
80
- key: Schema.SchemaClass<string, string, never>;
81
- name: Schema.SchemaClass<string, string, never>;
82
- description: Schema.optional<typeof Schema.String>;
83
- instructions: Schema.mutable<Schema.Struct<{
84
- source: Schema.SchemaClass<import("@dxos/echo-schema").Ref<Type.OfKind<import("@dxos/echo-schema").EntityKind.Object> & {
85
- content: string;
86
- }>, import("@dxos/echo-protocol").EncodedReference, never>;
87
- inputs: Schema.optional<Schema.mutable<Schema.Array$<Schema.mutable<Schema.Struct<{
88
- name: typeof Schema.String;
89
- kind: Schema.optional<Schema.Literal<["value", "pass-through", "retriever", "function", "query", "resolver", "context", "schema"]>>;
90
- default: Schema.optional<typeof Schema.Any>;
91
- }>>>>>;
92
- }>>;
93
- tools: Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>;
94
- }>>;
95
- }>;
96
- }>;
97
- export class CreateBlueprint extends CreateBlueprint_base {
98
- }
99
- const CreateSequence_base: Schema.TaggedClass<CreateSequence, `${string}/action/create-sequence`, {
100
- readonly _tag: Schema.tag<`${string}/action/create-sequence`>;
101
- } & {
102
- input: Schema.Struct<{
103
- name: Schema.optional<typeof Schema.String>;
104
- }>;
105
- output: Schema.Struct<{
106
- object: Type.obj<Schema.Struct<{
107
- name: Schema.optional<typeof Schema.String>;
108
- steps: Schema.Array$<Schema.Struct<{
109
- id: import("@dxos/keys").ObjectIdClass;
110
- instructions: typeof Schema.String;
111
- tools: Schema.optional<Schema.Array$<Schema.brand<typeof Schema.String, "ToolId">>>;
112
- }>>;
113
- }>>;
114
- }>;
115
- }>;
116
- export class CreateSequence extends CreateSequence_base {
117
- }
118
- export {};
119
- }
120
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/types/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAe,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMlC,eAAO,MAAM,aAAa,yCAA0C,CAAC;AAErE,yBAAiB,SAAS,CAAC;IAKzB,MAAM,CAAC,MAAM,IAAI;;;;OAUhB,CAAC;IAEF,MAAM,WAAW,IAAK,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC;KAAG;IAEhE,MAAM,CAAC,MAAM,WAAW;;;;;;;;;cASvB,CAAC;IAEF,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC;KAAG;IAM9E,MAAM,CAAC,MAAM,QAAQ;;;;;;OAQpB,CAAC;IAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC;;;;;;;;;;;;;;;;IAM3D,MAAM,OAAO,cAAe,SAAQ,mBAMlC;KAAG;;;;;;;;;;;;;;;;IAEL,MAAM,OAAO,UAAW,SAAQ,eAQ9B;KAAG;IAEL,MAAM,CAAC,MAAM,aAAa;;;MAGxB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH,MAAM,OAAO,eAAgB,SAAQ,oBAKnC;KAAG;;;;;;;;;;;;;;;;;;IAEL,MAAM,OAAO,cAAe,SAAQ,mBAOlC;KAAG;;CACN"}
@@ -1,15 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Layer } from 'effect';
6
-
7
- import { type AiService } from '@dxos/ai';
8
- import { defineCapability } from '@dxos/app-framework';
9
-
10
- import { ASSISTANT_PLUGIN } from './meta';
11
-
12
- export namespace AssistantCapabilities {
13
- export type AiServiceLayer = Layer.Layer<AiService>;
14
- export const AiServiceLayer = defineCapability<AiServiceLayer>(`${ASSISTANT_PLUGIN}/capability/ai-service-factory`);
15
- }
@@ -1,52 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { useMemo } from 'react';
6
-
7
- import { type Blueprint } from '@dxos/blueprints';
8
- import { DropdownMenu, IconButton, Input, useTranslation } from '@dxos/react-ui';
9
-
10
- import { meta } from '../../meta';
11
-
12
- export type ChatOptionsMenuProps = {
13
- blueprintRegistry?: Blueprint.Registry;
14
- blueprints?: Blueprint.Blueprint[];
15
- onChange?: (key: string, active: boolean) => void;
16
- };
17
-
18
- export const ChatOptionsMenu = ({ blueprintRegistry, blueprints, onChange }: ChatOptionsMenuProps) => {
19
- const { t } = useTranslation(meta.id);
20
- const blueprintOptions = useMemo(
21
- () => blueprintRegistry?.query().map((blueprint) => ({ key: blueprint.key, label: blueprint.name })),
22
- [blueprintRegistry],
23
- );
24
-
25
- return (
26
- <DropdownMenu.Root>
27
- <DropdownMenu.Trigger asChild disabled={!blueprintOptions?.length}>
28
- <IconButton icon='ph--plus--regular' variant='ghost' size={5} iconOnly label={t('button add blueprint')} />
29
- </DropdownMenu.Trigger>
30
- <DropdownMenu.Portal>
31
- <DropdownMenu.Content side='left'>
32
- <DropdownMenu.Viewport>
33
- {blueprintOptions?.map((option) => (
34
- <DropdownMenu.Item key={option.key}>
35
- <Input.Root>
36
- <Input.Checkbox
37
- checked={!!blueprints?.find((blueprint) => blueprint.key === option.key)}
38
- onCheckedChange={(checked) => onChange?.(option.key, !!checked)}
39
- />
40
- {/* TODO(burdon): Remove need for custom margin. */}
41
- {/* TODO(burdon): Clicking on label doesn't toggle checkbox. */}
42
- <Input.Label classNames='m-0'>{option.label}</Input.Label>
43
- </Input.Root>
44
- </DropdownMenu.Item>
45
- ))}
46
- </DropdownMenu.Viewport>
47
- <DropdownMenu.Arrow />
48
- </DropdownMenu.Content>
49
- </DropdownMenu.Portal>
50
- </DropdownMenu.Root>
51
- );
52
- };
@@ -1,52 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type DataType } from '@dxos/schema';
6
-
7
- // TODO(burdon): Move to util?
8
- type Reducer<R, I> = (acc: R, value: I) => R;
9
-
10
- /**
11
- * Reducer that collapses related message blocks into single messages.
12
- * For example, combines tool request/response pairs into a single message.
13
- */
14
- export const messageReducer: Reducer<{ messages: DataType.Message[]; current?: DataType.Message }, DataType.Message> = (
15
- { current, messages },
16
- message,
17
- ) => {
18
- let i = 0;
19
- for (const block of message.blocks) {
20
- switch (block._tag) {
21
- case 'toolCall':
22
- case 'toolResult': {
23
- if (current) {
24
- current.blocks.push(block);
25
- } else {
26
- current = {
27
- ...message,
28
- id: [message.id, i].join('_'),
29
- blocks: [block],
30
- };
31
- messages.push(current);
32
- }
33
- break;
34
- }
35
-
36
- case 'text':
37
- default: {
38
- current = undefined;
39
- messages.push({
40
- ...message,
41
- id: [message.id, i].join('_'),
42
- blocks: [block],
43
- });
44
- break;
45
- }
46
- }
47
-
48
- i++;
49
- }
50
-
51
- return { current, messages };
52
- };
@@ -1,16 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { describe, it } from 'vitest';
6
-
7
- import { ChatProcessor } from './chat-processor';
8
-
9
- describe('ChatProcessor', () => {
10
- it('should be instantiable', ({ expect }) => {
11
- const services = {} as any; // TODO(burdon): Create mock.
12
- const client = {} as any; // TODO(burdon): Create mock.
13
- const processor = new ChatProcessor(services, client);
14
- expect(processor).toBeDefined();
15
- });
16
- });
@@ -1,314 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type Signal, batch, computed, signal } from '@preact/signals-core';
6
- import { Effect, type Layer } from 'effect';
7
-
8
- import { AiService, DEFAULT_EDGE_MODEL, type ExecutableTool, type GenerateRequest } from '@dxos/ai';
9
- import { type PromiseIntentDispatcher } from '@dxos/app-framework';
10
- import { type AiSession, ArtifactDiffResolver, type ContextBinder, type Conversation } from '@dxos/assistant';
11
- import { type ArtifactDefinition, type Blueprint } from '@dxos/blueprints';
12
- import { Context } from '@dxos/context';
13
- import { Obj } from '@dxos/echo';
14
- import { runAndForwardErrors } from '@dxos/effect';
15
- import { log } from '@dxos/log';
16
- import { Filter, type Space, getVersion } from '@dxos/react-client/echo';
17
- import { DataType } from '@dxos/schema';
18
-
19
- import type { ChatServices } from './useChatServices';
20
-
21
- // TODO(burdon): Factor out.
22
- declare global {
23
- interface ToolContextExtensions {
24
- space?: Space;
25
- dispatch?: PromiseIntentDispatcher;
26
- }
27
- }
28
-
29
- type RequestOptions = {
30
- // Empty for now.
31
- };
32
-
33
- export type ChatProcessorOptions = {
34
- // TODO(burdon): Change to AiToolkit.
35
- tools?: readonly ExecutableTool[];
36
- blueprintRegistry?: Blueprint.Registry;
37
-
38
- // TODO(dmaretskyi): Remove.
39
- artifacts?: readonly ArtifactDefinition[];
40
- extensions?: ToolContextExtensions;
41
- // TODO(burdon): Remove systemPrompt -- should come from blueprint.
42
- } & Pick<GenerateRequest, 'model' | 'systemPrompt'>;
43
-
44
- const defaultOptions: Partial<ChatProcessorOptions> = {
45
- model: DEFAULT_EDGE_MODEL,
46
- systemPrompt: 'you are a helpful assistant',
47
- };
48
-
49
- /**
50
- * Handles interactions with the AI service.
51
- * Maintains a queue of messages and handles streaming responses from the AI service.
52
- * Executes tools based on AI responses.
53
- * Supports cancellation of in-progress requests.
54
- */
55
- // TODO(burdon): Rename ChatContext?
56
- export class ChatProcessor {
57
- /**
58
- * Pending messages (incl. the current user request).
59
- * @reactive
60
- */
61
- private readonly _pending: Signal<DataType.Message[]> = signal([]);
62
-
63
- /**
64
- * Current streaming message (from the AI service).
65
- * @reactive
66
- */
67
- private readonly _streaming: Signal<DataType.Message | undefined> = signal(undefined);
68
-
69
- /**
70
- * Streaming state.
71
- * @reactive
72
- */
73
- public readonly streaming: Signal<boolean> = computed(() => this._streaming.value !== undefined);
74
-
75
- /**
76
- * Last error.
77
- * @reactive
78
- */
79
- public readonly error: Signal<Error | undefined> = signal(undefined);
80
-
81
- /**
82
- * Array of Messages (incl. the current message being streamed).
83
- * @reactive
84
- */
85
- public readonly messages: Signal<DataType.Message[]> = computed(() => {
86
- const messages = [...this._pending.value];
87
- if (this._streaming.value) {
88
- // TODO(dmaretskyi): Replace with Obj.clone.
89
- // NOTE: We have to clone the message here so that react will re-render.
90
- messages.push(Obj.make(DataType.Message, this._streaming.value));
91
- }
92
-
93
- return messages;
94
- });
95
-
96
- // TODO(burdon): Replace with Toolkit.
97
- private _tools?: ExecutableTool[];
98
-
99
- /** Current session. */
100
- private _session: AiSession | undefined = undefined;
101
-
102
- constructor(
103
- // TODO(dmaretskyi): Replace this with effect's ManagedRuntime wrapping this layer.
104
- private readonly _services: Layer.Layer<ChatServices>,
105
- private readonly _conversation: Conversation,
106
- private readonly _options: ChatProcessorOptions = defaultOptions,
107
- ) {
108
- this._tools = [...(_options.tools ?? [])];
109
- }
110
-
111
- get conversation() {
112
- return this._conversation;
113
- }
114
-
115
- get context(): ContextBinder {
116
- return this._conversation.context;
117
- }
118
-
119
- get blueprintRegistry() {
120
- return this._options.blueprintRegistry;
121
- }
122
-
123
- get tools() {
124
- return this._tools;
125
- }
126
-
127
- /**
128
- * @deprecated Replace with blueprints
129
- */
130
- setTools(tools: ExecutableTool[]): void {
131
- this._tools = tools;
132
- }
133
-
134
- /**
135
- * Make GPT request.
136
- */
137
- async request(message: string, options: RequestOptions = {}): Promise<DataType.Message[]> {
138
- await using ctx = Context.default(); // Auto-disposed at the end of this block.
139
-
140
- this._conversation.onBegin.on(ctx, (session) => {
141
- log.info('onBegin', { session, isDisposed: ctx.disposed });
142
-
143
- this._session = session;
144
- ctx.onDispose(() => {
145
- log.info('onDispose', { session, isDisposed: ctx.disposed });
146
- if (this._session === session) {
147
- this._session = undefined;
148
- }
149
- });
150
-
151
- // User message.
152
- session.userMessage.on((message) => {
153
- log.info('userMessage', { message });
154
- this._pending.value = [...this._pending.value, message];
155
- });
156
-
157
- // Message complete.
158
- session.message.on((message) => {
159
- batch(() => {
160
- this._pending.value = [...this._pending.value, message];
161
- this._streaming.value = undefined;
162
- });
163
- });
164
-
165
- // Streaming update (happens before message complete).
166
- session.update.on((block) => {
167
- batch(() => {
168
- if (!this._streaming.value) {
169
- // TODO(burdon): Hack to create temp message; better for session to send initial partial object?
170
- this._streaming.value = Obj.make(DataType.Message, {
171
- created: new Date().toISOString(),
172
- sender: { role: 'assistant' },
173
- blocks: [block],
174
- });
175
- } else if (this._streaming.value.blocks.at(-1)?.pending === true) {
176
- this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
177
- } else {
178
- this._streaming.value.blocks.push(block);
179
- }
180
- });
181
- });
182
-
183
- session.block.on((block) => {
184
- if (!this._streaming.value) {
185
- // TODO(burdon): Hack to create temp message; better for session to send initial partial object?
186
- this._streaming.value = Obj.make(DataType.Message, {
187
- created: new Date().toISOString(),
188
- sender: { role: 'assistant' },
189
- blocks: [block],
190
- });
191
- } else if (this._streaming.value.blocks.at(-1)?.pending === true) {
192
- this._streaming.value.blocks[this._streaming.value.blocks.length - 1] = block;
193
- } else {
194
- this._streaming.value.blocks.push(block);
195
- }
196
- });
197
-
198
- // TODO(dmaretskyi): Handle tool status reports.
199
- // session.toolStatusReport.on(({ message, status }) => {
200
- // const msg = this._pending.peek().find((m) => m.id === message.id);
201
- // const toolUse = msg?.content.find((block) => block.type === 'tool_use');
202
- // if (!toolUse) {
203
- // return;
204
- // }
205
-
206
- // const block = msg?.content.find(
207
- // (block): block is ToolUseContentBlock => block.type === 'tool_use' && block.id === toolUse.id,
208
- // );
209
- // if (block) {
210
- // this._pending.value = this._pending.value.map((m) => {
211
- // if (m.id === message.id) {
212
- // return {
213
- // ...m,
214
- // content: m.content.map((block) =>
215
- // block.type === 'tool_use' && block.id === toolUse.id ? { ...block, currentStatus: status } : block,
216
- // ),
217
- // };
218
- // }
219
-
220
- // return m;
221
- // });
222
- // } else {
223
- // log.warn('no block for status report');
224
- // }
225
- // });
226
- });
227
-
228
- try {
229
- const messages = await runAndForwardErrors(
230
- this._conversation
231
- .run({
232
- prompt: message,
233
- // TODO(burdon): Construct from blueprints?
234
- systemPrompt: this._options.systemPrompt,
235
- })
236
- .pipe(
237
- //
238
- Effect.provide(AiService.model(this._options.model ?? DEFAULT_EDGE_MODEL)),
239
- // TODO(dmaretskyi): Move ArtifactDiffResolver upstream.
240
- Effect.provideService(ArtifactDiffResolver, this._artifactDiffResolver),
241
- Effect.provide(this._services),
242
- Effect.tapErrorCause((cause) => {
243
- log.error('error', { cause });
244
- return Effect.void;
245
- }),
246
- ),
247
- );
248
-
249
- log('completed', { messages });
250
- } catch (err) {
251
- log.catch(err);
252
- if (err instanceof Error && err.message.includes('Overloaded')) {
253
- this.error.value = new AiServiceOverloadedError('AI service overloaded', { cause: err });
254
- } else {
255
- this.error.value = new Error('AI service error', { cause: err });
256
- }
257
- }
258
-
259
- return this._reset();
260
- }
261
-
262
- /**
263
- * Cancel pending requests.
264
- * @returns Pending requests (incl. the request message).
265
- */
266
- async cancel(): Promise<DataType.Message[]> {
267
- log.info('cancelling...');
268
-
269
- // TODO(dmaretskyi): Conversation should handle aborting.
270
- this._session?.abort();
271
- return this._reset();
272
- }
273
-
274
- private async _reset(): Promise<DataType.Message[]> {
275
- const messages = this._pending.value;
276
- batch(() => {
277
- this._pending.value = [];
278
- this._streaming.value = undefined;
279
- });
280
-
281
- return messages;
282
- }
283
-
284
- private _artifactDiffResolver: ArtifactDiffResolver.Service = {
285
- resolve: async (artifacts) => {
286
- const space = this._options.extensions?.space;
287
- if (!space) {
288
- return new Map();
289
- }
290
-
291
- const versions = new Map();
292
- await Promise.all(
293
- artifacts.map(async (artifact) => {
294
- const {
295
- objects: [object],
296
- } = await space.db.query(Filter.ids(artifact.id)).run();
297
- if (!object) {
298
- return;
299
- }
300
- versions.set(artifact.id, {
301
- version: getVersion(object),
302
- diff: `Current state: ${JSON.stringify(object)}`,
303
- });
304
- }),
305
- );
306
- return versions;
307
- },
308
- };
309
- }
310
-
311
- // TODO(wittjosiah): Move to ai-service-client.
312
- export class AiServiceOverloadedError extends Error {
313
- code = 'AI_SERVICE_OVERLOADED';
314
- }
@@ -1,57 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { effect } from '@preact/signals-react';
6
- import { useCallback, useEffect, useState } from 'react';
7
-
8
- import { type ContextBinder } from '@dxos/assistant';
9
- import { Blueprint } from '@dxos/blueprints';
10
- import { type Space } from '@dxos/client/echo';
11
- import { Obj, Ref } from '@dxos/echo';
12
- import { log } from '@dxos/log';
13
- import { isNonNullable } from '@dxos/util';
14
-
15
- export type UpdateCallback = (key: string, active: boolean) => void;
16
-
17
- /**
18
- * Get collection of active blueprints based on the context.
19
- */
20
- export const useBlueprints = (
21
- space: Space,
22
- context: ContextBinder,
23
- blueprintRegistry?: Blueprint.Registry,
24
- ): [Blueprint.Blueprint[], UpdateCallback] => {
25
- const [blueprints, setBlueprints] = useState<Blueprint.Blueprint[]>([]);
26
- useEffect(() => {
27
- let t: NodeJS.Timeout;
28
- effect(() => {
29
- const refs = [...(context.blueprints.value ?? [])];
30
- t = setTimeout(async () => {
31
- const blueprints = (await Ref.Array.loadAll(refs)).filter(isNonNullable);
32
- setBlueprints(blueprints);
33
- });
34
- });
35
-
36
- return () => clearTimeout(t);
37
- }, [context]);
38
-
39
- const handleUpdate = useCallback<UpdateCallback>(
40
- (key: string, active: boolean) => {
41
- log.info('update', { key, active });
42
- if (active) {
43
- // TODO(burdon): Check if already in space.
44
- const blueprint = blueprintRegistry?.getByKey(key);
45
- if (blueprint) {
46
- // TODO(dmaretskyi): This should be done by Obj.clone.
47
- const { id: _id, ...data } = blueprint;
48
- const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
49
- void context.bind({ blueprints: [Ref.make(obj)] });
50
- }
51
- }
52
- },
53
- [space, context],
54
- );
55
-
56
- return [blueprints, handleUpdate] as const;
57
- };
package/src/shims.d.ts DELETED
@@ -1,8 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- declare module '*?raw' {
6
- const content: string;
7
- export default content;
8
- }
@@ -1,46 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { createTool, type ExecutableTool, ToolResult } from '@dxos/ai';
6
- import { Type } from '@dxos/echo';
7
- import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
8
- import { type FunctionType } from '@dxos/functions';
9
- import { log } from '@dxos/log';
10
- import { type SpaceId } from '@dxos/react-client/echo';
11
- import { getMeta } from '@dxos/react-client/echo';
12
-
13
- // TODO(burdon): Move to @dxos/ai.
14
- export const convertFunctionToTool = (
15
- fn: FunctionType,
16
- edgeUrl: string,
17
- spaceId?: SpaceId | undefined,
18
- ): ExecutableTool | undefined => {
19
- if (!fn.description || !fn.inputSchema) {
20
- return undefined;
21
- }
22
- const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));
23
- if (!existingFunctionUrl) {
24
- return undefined;
25
- }
26
-
27
- const url = getInvocationUrl(existingFunctionUrl, edgeUrl, { spaceId });
28
-
29
- return createTool('user-function', {
30
- name: fn.name,
31
- description: fn.description,
32
- schema: Type.toEffectSchema(fn.inputSchema),
33
- execute: async (input) => {
34
- log.info('execute function tool', { name: fn.name, url, input });
35
- const response = await fetch(url, {
36
- method: 'POST',
37
- headers: {
38
- 'Content-Type': 'application/json',
39
- },
40
- body: JSON.stringify(input),
41
- });
42
-
43
- return ToolResult.Success(await response.text());
44
- },
45
- });
46
- };