@dxos/plugin-assistant 0.8.4-main.1f223c7 → 0.8.4-main.2244d791bb

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