@dxos/plugin-assistant 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b

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 (344) hide show
  1. package/dist/lib/browser/AssistantSettings-2LFAG5OQ.mjs +93 -0
  2. package/dist/lib/browser/AssistantSettings-2LFAG5OQ.mjs.map +7 -0
  3. package/dist/lib/browser/BlueprintArticle-CCS25MNW.mjs +36 -0
  4. package/dist/lib/browser/BlueprintArticle-CCS25MNW.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatCompanion-CAKFZAWN.mjs → ChatCompanion-UGD4V34A.mjs} +11 -9
  6. package/dist/lib/browser/ChatCompanion-UGD4V34A.mjs.map +7 -0
  7. package/dist/lib/browser/ChatContainer-ZGRSZ5EU.mjs +12 -0
  8. package/dist/lib/browser/{ChatDialog-ASVBLOOS.mjs → ChatDialog-AET7GVIB.mjs} +7 -7
  9. package/dist/lib/browser/ChatDialog-AET7GVIB.mjs.map +7 -0
  10. package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs +91 -0
  11. package/dist/lib/browser/ProjectArticle-QDBTIFNE.mjs.map +7 -0
  12. package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs +194 -0
  13. package/dist/lib/browser/ProjectSettings-R6RRARLO.mjs.map +7 -0
  14. package/dist/lib/browser/PromptArticle-USQO4WX6.mjs +71 -0
  15. package/dist/lib/browser/PromptArticle-USQO4WX6.mjs.map +7 -0
  16. package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs +122 -0
  17. package/dist/lib/browser/TriggerStatus-65X3EUSN.mjs.map +7 -0
  18. package/dist/lib/browser/{app-graph-builder-MUZGUQSC.mjs → app-graph-builder-SFYYUKTT.mjs} +3 -3
  19. package/dist/lib/{node-esm/app-graph-builder-4QN5M6PD.mjs.map → browser/app-graph-builder-SFYYUKTT.mjs.map} +2 -2
  20. package/dist/lib/browser/blueprint-definition-5LQNBZON.mjs +35 -0
  21. package/dist/lib/browser/blueprint-definition-5LQNBZON.mjs.map +7 -0
  22. package/dist/lib/browser/blueprints/index.mjs +3 -7
  23. package/dist/lib/browser/{chunk-6BVCG5SJ.mjs → chunk-7DXYAXLZ.mjs} +8 -8
  24. package/dist/lib/browser/chunk-7DXYAXLZ.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-IJYAKPEU.mjs → chunk-JYY5AD65.mjs} +27 -27
  26. package/dist/lib/browser/chunk-JYY5AD65.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-LEXIQDXZ.mjs +26 -0
  28. package/dist/lib/browser/chunk-LEXIQDXZ.mjs.map +7 -0
  29. package/dist/lib/browser/{ChatContainer-QB37VONJ.mjs → chunk-RU4G5NY4.mjs} +17 -21
  30. package/dist/lib/browser/chunk-RU4G5NY4.mjs.map +7 -0
  31. package/dist/lib/browser/{chunk-JA7PUZC7.mjs → chunk-UUA6GNGG.mjs} +544 -393
  32. package/dist/lib/browser/chunk-UUA6GNGG.mjs.map +7 -0
  33. package/dist/lib/browser/index.mjs +38 -54
  34. package/dist/lib/browser/index.mjs.map +3 -3
  35. package/dist/lib/browser/meta.json +1 -1
  36. package/dist/lib/browser/{operation-resolver-2673CFJS.mjs → operation-resolver-ELXDQZEG.mjs} +23 -20
  37. package/dist/lib/browser/operation-resolver-ELXDQZEG.mjs.map +7 -0
  38. package/dist/lib/browser/{react-surface-T3FN4GVP.mjs → react-surface-KYQSZO2I.mjs} +42 -23
  39. package/dist/lib/browser/react-surface-KYQSZO2I.mjs.map +7 -0
  40. package/dist/lib/browser/{repair-IRXDYF4R.mjs → repair-ZFZWZALX.mjs} +9 -8
  41. package/dist/lib/browser/repair-ZFZWZALX.mjs.map +7 -0
  42. package/dist/lib/browser/{settings-XF6GKHCG.mjs → settings-YREVQAZ5.mjs} +2 -2
  43. package/dist/lib/browser/{state-OYDPWLKA.mjs → state-MPG42ZO4.mjs} +2 -2
  44. package/dist/lib/browser/toolkit-XRSBBB3L.mjs +16 -0
  45. package/dist/lib/browser/toolkit-XRSBBB3L.mjs.map +7 -0
  46. package/dist/lib/browser/types/index.mjs +1 -1
  47. package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs +94 -0
  48. package/dist/lib/node-esm/AssistantSettings-QWFEMJG7.mjs.map +7 -0
  49. package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs +37 -0
  50. package/dist/lib/node-esm/BlueprintArticle-SNEN6LOY.mjs.map +7 -0
  51. package/dist/lib/node-esm/{ChatCompanion-W4PGOCGR.mjs → ChatCompanion-NP4R5BFE.mjs} +11 -9
  52. package/dist/lib/node-esm/ChatCompanion-NP4R5BFE.mjs.map +7 -0
  53. package/dist/lib/node-esm/ChatContainer-IFHDIFJH.mjs +13 -0
  54. package/dist/lib/node-esm/{ChatDialog-AFLPYSIU.mjs → ChatDialog-UZNQBTKZ.mjs} +7 -7
  55. package/dist/lib/node-esm/ChatDialog-UZNQBTKZ.mjs.map +7 -0
  56. package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs +92 -0
  57. package/dist/lib/node-esm/ProjectArticle-BCIBESJN.mjs.map +7 -0
  58. package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs +195 -0
  59. package/dist/lib/node-esm/ProjectSettings-Q5QY6BYS.mjs.map +7 -0
  60. package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs +72 -0
  61. package/dist/lib/node-esm/PromptArticle-PGMJMQK7.mjs.map +7 -0
  62. package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs +123 -0
  63. package/dist/lib/node-esm/TriggerStatus-UR5S7PXJ.mjs.map +7 -0
  64. package/dist/lib/node-esm/{app-graph-builder-4QN5M6PD.mjs → app-graph-builder-E25JXI34.mjs} +3 -3
  65. package/dist/lib/node-esm/app-graph-builder-E25JXI34.mjs.map +7 -0
  66. package/dist/lib/node-esm/blueprint-definition-CMJWGGJO.mjs +36 -0
  67. package/dist/lib/node-esm/blueprint-definition-CMJWGGJO.mjs.map +7 -0
  68. package/dist/lib/node-esm/blueprints/index.mjs +3 -7
  69. package/dist/lib/node-esm/chunk-3QBVFAYO.mjs +28 -0
  70. package/dist/lib/node-esm/chunk-3QBVFAYO.mjs.map +7 -0
  71. package/dist/lib/node-esm/{ChatContainer-ECFQVH6O.mjs → chunk-6NCLKQCL.mjs} +17 -21
  72. package/dist/lib/node-esm/chunk-6NCLKQCL.mjs.map +7 -0
  73. package/dist/lib/node-esm/{chunk-3XC7LQSO.mjs → chunk-GZ4ERNT2.mjs} +544 -393
  74. package/dist/lib/node-esm/chunk-GZ4ERNT2.mjs.map +7 -0
  75. package/dist/lib/node-esm/{chunk-MJD5XWQV.mjs → chunk-JMBYVUD6.mjs} +27 -27
  76. package/dist/lib/node-esm/chunk-JMBYVUD6.mjs.map +7 -0
  77. package/dist/lib/node-esm/{chunk-LB72WG6R.mjs → chunk-MWYYLALM.mjs} +8 -8
  78. package/dist/lib/node-esm/chunk-MWYYLALM.mjs.map +7 -0
  79. package/dist/lib/node-esm/index.mjs +38 -54
  80. package/dist/lib/node-esm/index.mjs.map +3 -3
  81. package/dist/lib/node-esm/meta.json +1 -1
  82. package/dist/lib/node-esm/{operation-resolver-2ZD2DXOU.mjs → operation-resolver-Q5GNP2GH.mjs} +23 -20
  83. package/dist/lib/node-esm/operation-resolver-Q5GNP2GH.mjs.map +7 -0
  84. package/dist/lib/node-esm/{react-surface-T4VMCCKZ.mjs → react-surface-JJRGVGKD.mjs} +42 -23
  85. package/dist/lib/node-esm/react-surface-JJRGVGKD.mjs.map +7 -0
  86. package/dist/lib/node-esm/{repair-DMI55PON.mjs → repair-LXFVOK4B.mjs} +9 -8
  87. package/dist/lib/node-esm/repair-LXFVOK4B.mjs.map +7 -0
  88. package/dist/lib/node-esm/{settings-NGGZA7S7.mjs → settings-N452OW6Y.mjs} +2 -2
  89. package/dist/lib/node-esm/{state-VSCPGN7R.mjs → state-WHZFKIEL.mjs} +2 -2
  90. package/dist/lib/node-esm/{toolkit-JPRJRDDB.mjs → toolkit-5IWGLUF4.mjs} +3 -6
  91. package/dist/lib/node-esm/toolkit-5IWGLUF4.mjs.map +7 -0
  92. package/dist/lib/node-esm/types/index.mjs +1 -1
  93. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  94. package/dist/types/src/blueprints/assistant/blueprint.d.ts +4 -0
  95. package/dist/types/src/blueprints/assistant/blueprint.d.ts.map +1 -0
  96. package/dist/types/src/blueprints/assistant/blueprint.test.d.ts +2 -0
  97. package/dist/types/src/blueprints/assistant/blueprint.test.d.ts.map +1 -0
  98. package/dist/types/src/blueprints/assistant/index.d.ts +2 -0
  99. package/dist/types/src/blueprints/assistant/index.d.ts.map +1 -0
  100. package/dist/types/src/blueprints/index.d.ts +1 -6
  101. package/dist/types/src/blueprints/index.d.ts.map +1 -1
  102. package/dist/types/src/capabilities/ai-service/ai-service.d.ts +1 -1
  103. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
  104. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
  105. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +2 -22
  106. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
  107. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -2
  108. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts +1 -1
  110. package/dist/types/src/capabilities/edge-model-resolver/edge-model-resolver.d.ts.map +1 -1
  111. package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts +1 -1
  112. package/dist/types/src/capabilities/local-model-resolver/local-model-resolver.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +1 -1
  114. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
  115. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
  116. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
  117. package/dist/types/src/capabilities/repair/repair.d.ts +1 -1
  118. package/dist/types/src/capabilities/repair/repair.d.ts.map +1 -1
  119. package/dist/types/src/capabilities/settings/settings.d.ts +1 -1
  120. package/dist/types/src/capabilities/state/state.d.ts +1 -1
  121. package/dist/types/src/capabilities/toolkit/index.d.ts +1 -1
  122. package/dist/types/src/capabilities/toolkit/index.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/toolkit/toolkit.d.ts +1 -1
  124. package/dist/types/src/capabilities/toolkit/toolkit.d.ts.map +1 -1
  125. package/dist/types/src/components/Chat/Chat.d.ts +6 -5
  126. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  127. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -1
  128. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  129. package/dist/types/src/components/ChatThread/ChatThread.d.ts +1 -1
  130. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +15 -15
  131. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -1
  132. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -1
  133. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +14 -14
  134. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  135. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +14 -14
  136. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +14 -14
  137. package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts +2 -2
  138. package/dist/types/src/components/Typewriter/AssistantToolbar.d.ts.map +1 -1
  139. package/dist/types/src/components/Typewriter/Typewriter.stories.d.ts.map +1 -1
  140. package/dist/types/src/components/index.d.ts +0 -11
  141. package/dist/types/src/components/index.d.ts.map +1 -1
  142. package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  143. package/dist/types/src/containers/AssistantSettings/index.d.ts +3 -0
  144. package/dist/types/src/containers/AssistantSettings/index.d.ts.map +1 -0
  145. package/dist/types/src/{components → containers/BlueprintArticle}/BlueprintArticle.d.ts +0 -1
  146. package/dist/types/src/containers/BlueprintArticle/BlueprintArticle.d.ts.map +1 -0
  147. package/dist/types/src/containers/BlueprintArticle/index.d.ts +3 -0
  148. package/dist/types/src/containers/BlueprintArticle/index.d.ts.map +1 -0
  149. package/dist/types/src/{components → containers/ChatCompanion}/ChatCompanion.d.ts +0 -1
  150. package/dist/types/src/containers/ChatCompanion/ChatCompanion.d.ts.map +1 -0
  151. package/dist/types/src/containers/ChatCompanion/index.d.ts +3 -0
  152. package/dist/types/src/containers/ChatCompanion/index.d.ts.map +1 -0
  153. package/dist/types/src/{components → containers/ChatContainer}/ChatContainer.d.ts +2 -3
  154. package/dist/types/src/containers/ChatContainer/ChatContainer.d.ts.map +1 -0
  155. package/dist/types/src/containers/ChatContainer/index.d.ts +3 -0
  156. package/dist/types/src/containers/ChatContainer/index.d.ts.map +1 -0
  157. package/dist/types/src/{components → containers/ChatDialog}/ChatDialog.d.ts +0 -1
  158. package/dist/types/src/containers/ChatDialog/ChatDialog.d.ts.map +1 -0
  159. package/dist/types/src/containers/ChatDialog/index.d.ts +3 -0
  160. package/dist/types/src/containers/ChatDialog/index.d.ts.map +1 -0
  161. package/dist/types/src/containers/Project/ProjectArticle.d.ts +7 -0
  162. package/dist/types/src/containers/Project/ProjectArticle.d.ts.map +1 -0
  163. package/dist/types/src/containers/Project/ProjectSettings.d.ts +6 -0
  164. package/dist/types/src/containers/Project/ProjectSettings.d.ts.map +1 -0
  165. package/dist/types/src/containers/Project/index.d.ts +7 -0
  166. package/dist/types/src/containers/Project/index.d.ts.map +1 -0
  167. package/dist/types/src/containers/Project/triggers.d.ts +6 -0
  168. package/dist/types/src/containers/Project/triggers.d.ts.map +1 -0
  169. package/dist/types/src/{components → containers/PromptArticle}/PromptArticle.d.ts +0 -1
  170. package/dist/types/src/containers/PromptArticle/PromptArticle.d.ts.map +1 -0
  171. package/dist/types/src/containers/PromptArticle/index.d.ts +3 -0
  172. package/dist/types/src/containers/PromptArticle/index.d.ts.map +1 -0
  173. package/dist/types/src/containers/TriggerStatus/TriggerStatus.d.ts +4 -0
  174. package/dist/types/src/{components → containers}/TriggerStatus/TriggerStatus.d.ts.map +1 -1
  175. package/dist/types/src/containers/TriggerStatus/index.d.ts +3 -0
  176. package/dist/types/src/containers/TriggerStatus/index.d.ts.map +1 -0
  177. package/dist/types/src/containers/index.d.ts +10 -0
  178. package/dist/types/src/containers/index.d.ts.map +1 -0
  179. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -1
  180. package/dist/types/src/hooks/useFilteredTypes.d.ts +1 -1
  181. package/dist/types/src/hooks/useFilteredTypes.d.ts.map +1 -1
  182. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  183. package/dist/types/src/index.d.ts +1 -0
  184. package/dist/types/src/index.d.ts.map +1 -1
  185. package/dist/types/src/processor/processor.d.ts +1 -1
  186. package/dist/types/src/processor/processor.d.ts.map +1 -1
  187. package/dist/types/src/translations.d.ts +14 -14
  188. package/dist/types/src/types/AssistantAction.d.ts +7 -11
  189. package/dist/types/src/types/AssistantAction.d.ts.map +1 -1
  190. package/dist/types/src/types/service.d.ts.map +1 -1
  191. package/dist/types/tsconfig.tsbuildinfo +1 -1
  192. package/package.json +82 -82
  193. package/src/AssistantPlugin.tsx +12 -9
  194. package/src/blueprints/assistant/blueprint.conversations.json +1 -0
  195. package/src/blueprints/assistant/blueprint.test.ts +48 -0
  196. package/src/blueprints/assistant/blueprint.ts +27 -0
  197. package/src/blueprints/assistant/index.ts +5 -0
  198. package/src/blueprints/index.ts +1 -8
  199. package/src/capabilities/app-graph-builder/app-graph-builder.ts +1 -3
  200. package/src/capabilities/blueprint-definition/blueprint-definition.ts +25 -49
  201. package/src/capabilities/blueprint-definition/index.ts +0 -1
  202. package/src/capabilities/operation-resolver/operation-resolver.ts +21 -12
  203. package/src/capabilities/react-surface/react-surface.tsx +21 -11
  204. package/src/capabilities/repair/repair.ts +14 -7
  205. package/src/capabilities/toolkit/toolkit.ts +3 -15
  206. package/src/components/Chat/Chat.tsx +25 -15
  207. package/src/components/ChatProgress/ChatProgress.tsx +2 -2
  208. package/src/components/ChatPrompt/ChatActions.tsx +1 -1
  209. package/src/components/ChatPrompt/ChatOptions.tsx +29 -9
  210. package/src/components/ChatPrompt/ChatReferences.tsx +14 -4
  211. package/src/components/ChatThread/ChatThread.stories.tsx +4 -4
  212. package/src/components/ChatThread/ChatThread.tsx +2 -2
  213. package/src/components/ChatThread/registry.tsx +48 -15
  214. package/src/components/ChatThread/sync.test.ts +2 -0
  215. package/src/components/ChatThread/sync.ts +14 -8
  216. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  217. package/src/components/TemplateEditor/TemplateEditor.tsx +2 -2
  218. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  219. package/src/components/TemplateEditor/TemplateForm.tsx +6 -7
  220. package/src/components/TemplateEditor/extensions/handlebars-extension.ts +4 -4
  221. package/src/components/ToolBlock/ToolBlock.tsx +4 -4
  222. package/src/components/Toolbox/Toolbox.stories.tsx +2 -2
  223. package/src/components/Toolbox/Toolbox.tsx +2 -2
  224. package/src/components/Typewriter/AssistantToolbar.tsx +3 -3
  225. package/src/components/Typewriter/Typewriter.stories.tsx +18 -15
  226. package/src/components/Typewriter/Typewriter.tsx +1 -1
  227. package/src/components/Typewriter/assistant-extension.tsx +3 -5
  228. package/src/components/index.ts +0 -18
  229. package/src/containers/AssistantSettings/index.ts +7 -0
  230. package/src/{components → containers/BlueprintArticle}/BlueprintArticle.tsx +10 -8
  231. package/src/containers/BlueprintArticle/index.ts +7 -0
  232. package/src/{components → containers/ChatCompanion}/ChatCompanion.tsx +4 -5
  233. package/src/containers/ChatCompanion/index.ts +7 -0
  234. package/src/{components → containers/ChatContainer}/ChatContainer.tsx +25 -24
  235. package/src/containers/ChatContainer/index.ts +7 -0
  236. package/src/{components → containers/ChatDialog}/ChatDialog.tsx +4 -7
  237. package/src/containers/ChatDialog/index.ts +7 -0
  238. package/src/containers/Project/ProjectArticle.tsx +117 -0
  239. package/src/containers/Project/ProjectSettings.tsx +118 -0
  240. package/src/containers/Project/index.ts +16 -0
  241. package/src/containers/Project/triggers.ts +131 -0
  242. package/src/containers/PromptArticle/PromptArticle.tsx +59 -0
  243. package/src/containers/PromptArticle/index.ts +7 -0
  244. package/src/{components → containers}/TriggerStatus/TriggerStatus.tsx +12 -4
  245. package/src/containers/TriggerStatus/index.ts +7 -0
  246. package/src/containers/index.ts +15 -0
  247. package/src/hooks/useBlueprintRegistry.ts +5 -2
  248. package/src/hooks/useFilteredTypes.ts +2 -2
  249. package/src/hooks/useReferencesProvider.ts +1 -5
  250. package/src/index.ts +1 -0
  251. package/src/processor/processor.test.ts +2 -1
  252. package/src/processor/processor.ts +17 -22
  253. package/src/testing/test-sequence.ts +3 -3
  254. package/src/testing/test-services.ts +1 -1
  255. package/src/translations.ts +11 -11
  256. package/src/types/AssistantAction.ts +3 -3
  257. package/src/types/service.ts +3 -3
  258. package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs +0 -30
  259. package/dist/lib/browser/BlueprintArticle-6SP2ZWJ2.mjs.map +0 -7
  260. package/dist/lib/browser/ChatCompanion-CAKFZAWN.mjs.map +0 -7
  261. package/dist/lib/browser/ChatContainer-QB37VONJ.mjs.map +0 -7
  262. package/dist/lib/browser/ChatDialog-ASVBLOOS.mjs.map +0 -7
  263. package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs +0 -266
  264. package/dist/lib/browser/InitiativeContainer-V522FCYH.mjs.map +0 -7
  265. package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs +0 -52
  266. package/dist/lib/browser/PromptArticle-PK3CBRUB.mjs.map +0 -7
  267. package/dist/lib/browser/app-graph-builder-MUZGUQSC.mjs.map +0 -7
  268. package/dist/lib/browser/blueprint-definition-YAGWYVCL.mjs +0 -14
  269. package/dist/lib/browser/chunk-3ETBCBMH.mjs +0 -47
  270. package/dist/lib/browser/chunk-3ETBCBMH.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-6BVCG5SJ.mjs.map +0 -7
  272. package/dist/lib/browser/chunk-DKQMSMBN.mjs +0 -326
  273. package/dist/lib/browser/chunk-DKQMSMBN.mjs.map +0 -7
  274. package/dist/lib/browser/chunk-IJYAKPEU.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-JA7PUZC7.mjs.map +0 -7
  276. package/dist/lib/browser/chunk-POPBT2AQ.mjs +0 -198
  277. package/dist/lib/browser/chunk-POPBT2AQ.mjs.map +0 -7
  278. package/dist/lib/browser/operation-resolver-2673CFJS.mjs.map +0 -7
  279. package/dist/lib/browser/react-surface-T3FN4GVP.mjs.map +0 -7
  280. package/dist/lib/browser/repair-IRXDYF4R.mjs.map +0 -7
  281. package/dist/lib/browser/toolkit-IDXQCSTX.mjs +0 -19
  282. package/dist/lib/browser/toolkit-IDXQCSTX.mjs.map +0 -7
  283. package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs +0 -31
  284. package/dist/lib/node-esm/BlueprintArticle-7LI6UXKZ.mjs.map +0 -7
  285. package/dist/lib/node-esm/ChatCompanion-W4PGOCGR.mjs.map +0 -7
  286. package/dist/lib/node-esm/ChatContainer-ECFQVH6O.mjs.map +0 -7
  287. package/dist/lib/node-esm/ChatDialog-AFLPYSIU.mjs.map +0 -7
  288. package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs +0 -267
  289. package/dist/lib/node-esm/InitiativeContainer-U4LGO3BW.mjs.map +0 -7
  290. package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs +0 -53
  291. package/dist/lib/node-esm/PromptArticle-BHPABYLT.mjs.map +0 -7
  292. package/dist/lib/node-esm/blueprint-definition-H3LFAEK2.mjs +0 -15
  293. package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs +0 -48
  294. package/dist/lib/node-esm/chunk-2LEN26ZQ.mjs.map +0 -7
  295. package/dist/lib/node-esm/chunk-3XC7LQSO.mjs.map +0 -7
  296. package/dist/lib/node-esm/chunk-75PHXBN3.mjs +0 -327
  297. package/dist/lib/node-esm/chunk-75PHXBN3.mjs.map +0 -7
  298. package/dist/lib/node-esm/chunk-F6LA7XNS.mjs +0 -199
  299. package/dist/lib/node-esm/chunk-F6LA7XNS.mjs.map +0 -7
  300. package/dist/lib/node-esm/chunk-LB72WG6R.mjs.map +0 -7
  301. package/dist/lib/node-esm/chunk-MJD5XWQV.mjs.map +0 -7
  302. package/dist/lib/node-esm/operation-resolver-2ZD2DXOU.mjs.map +0 -7
  303. package/dist/lib/node-esm/react-surface-T4VMCCKZ.mjs.map +0 -7
  304. package/dist/lib/node-esm/repair-DMI55PON.mjs.map +0 -7
  305. package/dist/lib/node-esm/toolkit-JPRJRDDB.mjs.map +0 -7
  306. package/dist/types/src/blueprints/assistant-blueprint.d.ts +0 -11
  307. package/dist/types/src/blueprints/assistant-blueprint.d.ts.map +0 -1
  308. package/dist/types/src/components/AssistantSettings/index.d.ts +0 -2
  309. package/dist/types/src/components/AssistantSettings/index.d.ts.map +0 -1
  310. package/dist/types/src/components/BlueprintArticle.d.ts.map +0 -1
  311. package/dist/types/src/components/ChatCompanion.d.ts.map +0 -1
  312. package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
  313. package/dist/types/src/components/ChatDialog.d.ts.map +0 -1
  314. package/dist/types/src/components/InitiativeContainer.d.ts +0 -9
  315. package/dist/types/src/components/InitiativeContainer.d.ts.map +0 -1
  316. package/dist/types/src/components/PromptArticle.d.ts.map +0 -1
  317. package/dist/types/src/components/TriggerStatus/TriggerStatus.d.ts +0 -4
  318. package/dist/types/src/components/TriggerStatus/index.d.ts +0 -2
  319. package/dist/types/src/components/TriggerStatus/index.d.ts.map +0 -1
  320. package/dist/types/src/functions/index.d.ts +0 -4
  321. package/dist/types/src/functions/index.d.ts.map +0 -1
  322. package/dist/types/src/functions/object-list.d.ts +0 -10
  323. package/dist/types/src/functions/object-list.d.ts.map +0 -1
  324. package/dist/types/src/functions/object-load.d.ts +0 -8
  325. package/dist/types/src/functions/object-load.d.ts.map +0 -1
  326. package/dist/types/src/functions/object-search.d.ts +0 -10
  327. package/dist/types/src/functions/object-search.d.ts.map +0 -1
  328. package/src/blueprints/assistant-blueprint.ts +0 -57
  329. package/src/components/AssistantSettings/index.ts +0 -5
  330. package/src/components/InitiativeContainer.tsx +0 -340
  331. package/src/components/PromptArticle.tsx +0 -49
  332. package/src/components/TriggerStatus/index.ts +0 -5
  333. package/src/functions/index.ts +0 -7
  334. package/src/functions/object-list.ts +0 -49
  335. package/src/functions/object-load.ts +0 -44
  336. package/src/functions/object-search.ts +0 -46
  337. /package/dist/lib/browser/{blueprint-definition-YAGWYVCL.mjs.map → ChatContainer-ZGRSZ5EU.mjs.map} +0 -0
  338. /package/dist/lib/browser/{settings-XF6GKHCG.mjs.map → settings-YREVQAZ5.mjs.map} +0 -0
  339. /package/dist/lib/browser/{state-OYDPWLKA.mjs.map → state-MPG42ZO4.mjs.map} +0 -0
  340. /package/dist/lib/node-esm/{blueprint-definition-H3LFAEK2.mjs.map → ChatContainer-IFHDIFJH.mjs.map} +0 -0
  341. /package/dist/lib/node-esm/{settings-NGGZA7S7.mjs.map → settings-N452OW6Y.mjs.map} +0 -0
  342. /package/dist/lib/node-esm/{state-VSCPGN7R.mjs.map → state-WHZFKIEL.mjs.map} +0 -0
  343. /package/dist/types/src/{components → containers}/AssistantSettings/AssistantSettings.d.ts +0 -0
  344. /package/src/{components → containers}/AssistantSettings/AssistantSettings.tsx +0 -0
@@ -2,95 +2,15 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
  import {
3
3
  AiChatProcessor,
4
4
  AiServicePresets
5
- } from "./chunk-MJD5XWQV.mjs";
5
+ } from "./chunk-JMBYVUD6.mjs";
6
6
  import {
7
7
  AssistantOperation,
8
- LLM_PROVIDERS,
9
8
  ServiceType
10
- } from "./chunk-LB72WG6R.mjs";
9
+ } from "./chunk-MWYYLALM.mjs";
11
10
  import {
12
11
  meta
13
12
  } from "./chunk-POWB2BPC.mjs";
14
13
 
15
- // src/components/AssistantSettings/AssistantSettings.tsx
16
- import React from "react";
17
- import { DEFAULT_EDGE_MODELS, DEFAULT_OLLAMA_MODELS } from "@dxos/ai";
18
- import { Input, Select, useTranslation } from "@dxos/react-ui";
19
- import { Settings } from "@dxos/react-ui-form";
20
- var DEFAULT_VALUE = "__default";
21
- var LLM_PROVIDER_LABELS = {
22
- edge: "DXOS",
23
- ollama: "Ollama",
24
- lmstudio: "LM Studio"
25
- };
26
- var AssistantSettings = ({ settings, onSettingsChange }) => {
27
- const { t } = useTranslation(meta.id);
28
- return /* @__PURE__ */ React.createElement(Settings.Root, null, /* @__PURE__ */ React.createElement(Settings.Section, {
29
- title: t("settings title", {
30
- ns: meta.id
31
- })
32
- }, /* @__PURE__ */ React.createElement(Settings.Group, null, /* @__PURE__ */ React.createElement(Settings.ItemInput, {
33
- title: t("settings custom prompts label")
34
- }, /* @__PURE__ */ React.createElement(Input.Switch, {
35
- checked: !!settings.customPrompts,
36
- onCheckedChange: (checked) => onSettingsChange((s) => ({
37
- ...s,
38
- customPrompts: checked
39
- }))
40
- })), /* @__PURE__ */ React.createElement(Settings.ItemInput, {
41
- title: t("settings llm provider label")
42
- }, /* @__PURE__ */ React.createElement(Select.Root, {
43
- value: settings.llmProvider ?? "edge",
44
- onValueChange: (value) => {
45
- onSettingsChange((s) => ({
46
- ...s,
47
- llmProvider: value === DEFAULT_VALUE ? void 0 : value
48
- }));
49
- }
50
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
51
- placeholder: t("settings llm provider label")
52
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
53
- value: DEFAULT_VALUE
54
- }, t("settings default label")), LLM_PROVIDERS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
55
- key: model,
56
- value: model
57
- }, LLM_PROVIDER_LABELS[model]))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(Settings.ItemInput, {
58
- title: t("settings edge llm model label")
59
- }, /* @__PURE__ */ React.createElement(Select.Root, {
60
- value: settings.edgeModel ?? DEFAULT_VALUE,
61
- onValueChange: (value) => {
62
- onSettingsChange((s) => ({
63
- ...s,
64
- edgeModel: value === DEFAULT_VALUE ? void 0 : value
65
- }));
66
- }
67
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
68
- placeholder: t("settings default llm model label")
69
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
70
- value: DEFAULT_VALUE
71
- }, t("settings default label")), DEFAULT_EDGE_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
72
- key: model,
73
- value: model
74
- }, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))), /* @__PURE__ */ React.createElement(Settings.ItemInput, {
75
- title: t("settings ollama llm model label")
76
- }, /* @__PURE__ */ React.createElement(Select.Root, {
77
- value: settings.ollamaModel ?? DEFAULT_VALUE,
78
- onValueChange: (value) => {
79
- onSettingsChange((s) => ({
80
- ...s,
81
- ollamaModel: value === DEFAULT_VALUE ? void 0 : value
82
- }));
83
- }
84
- }, /* @__PURE__ */ React.createElement(Select.TriggerButton, {
85
- placeholder: t("settings default llm model label")
86
- }), /* @__PURE__ */ React.createElement(Select.Portal, null, /* @__PURE__ */ React.createElement(Select.Content, null, /* @__PURE__ */ React.createElement(Select.Viewport, null, /* @__PURE__ */ React.createElement(Select.Option, {
87
- value: DEFAULT_VALUE
88
- }, t("settings default label")), DEFAULT_OLLAMA_MODELS.map((model) => /* @__PURE__ */ React.createElement(Select.Option, {
89
- key: model,
90
- value: model
91
- }, model))), /* @__PURE__ */ React.createElement(Select.Arrow, null))))))));
92
- };
93
-
94
14
  // src/hooks/useBlueprintRegistry.ts
95
15
  import { useCallback, useEffect, useMemo, useState } from "react";
96
16
  import { useCapabilities } from "@dxos/app-framework/ui";
@@ -100,9 +20,9 @@ import { Filter, Obj, Ref } from "@dxos/echo";
100
20
  import { useQuery } from "@dxos/react-client/echo";
101
21
  import { distinctBy } from "@dxos/util";
102
22
  var useBlueprintRegistry = () => {
103
- const blueprints = useCapabilities(AppCapabilities.BlueprintDefinition);
104
- return useMemo(() => new Blueprint.Registry(blueprints), [
105
- blueprints
23
+ const blueprintDefinitions = useCapabilities(AppCapabilities.BlueprintDefinition);
24
+ return useMemo(() => new Blueprint.Registry(blueprintDefinitions.map((blueprint) => blueprint.make())), [
25
+ blueprintDefinitions
106
26
  ]);
107
27
  };
108
28
  var useBlueprints = ({ blueprintRegistry, db }) => {
@@ -261,7 +181,7 @@ var useChatServices = ({ id, chat }) => {
261
181
  // src/hooks/useChatToolbarActions.ts
262
182
  import { Atom } from "@effect-atom/atom-react";
263
183
  import * as Effect2 from "effect/Effect";
264
- import { useMemo as useMemo11 } from "react";
184
+ import { useMemo as useMemo10 } from "react";
265
185
  import { useOperationInvoker } from "@dxos/app-framework/ui";
266
186
  import { Chat as Chat2 } from "@dxos/assistant-toolkit";
267
187
  import { Filter as Filter6, Obj as Obj6, Query } from "@dxos/echo";
@@ -270,27 +190,24 @@ import { invariant } from "@dxos/invariant";
270
190
  import { useQuery as useQuery5 } from "@dxos/react-client/echo";
271
191
  import { MenuBuilder, useMenuActions } from "@dxos/react-ui-menu";
272
192
 
273
- // src/components/index.ts
274
- import { lazy } from "react";
275
-
276
193
  // src/components/Chat/Chat.tsx
277
194
  import { Prec } from "@codemirror/state";
278
195
  import { keymap } from "@codemirror/view";
279
196
  import { useAtomValue } from "@effect-atom/atom-react";
280
197
  import { createContext } from "@radix-ui/react-context";
281
198
  import * as Array2 from "effect/Array";
282
- import * as Option2 from "effect/Option";
283
- import React10, { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
199
+ import * as Option4 from "effect/Option";
200
+ import React9, { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo9, useRef as useRef3, useState as useState12 } from "react";
284
201
  import { Event } from "@dxos/async";
285
202
  import { Filter as Filter4, Obj as Obj5 } from "@dxos/echo";
286
203
  import { useVoiceInput } from "@dxos/plugin-transcription";
287
204
  import { useQuery as useQuery3 } from "@dxos/react-client/echo";
288
205
  import { useIdentity } from "@dxos/react-client/halo";
289
- import { Input as Input2, useDynamicRef, useTranslation as useTranslation6 } from "@dxos/react-ui";
206
+ import { Input, useDynamicRef, useTranslation as useTranslation5 } from "@dxos/react-ui";
290
207
  import { ChatEditor } from "@dxos/react-ui-chat";
291
- import { MenuProvider, ToolbarMenu } from "@dxos/react-ui-menu";
208
+ import { Menu } from "@dxos/react-ui-menu";
292
209
  import { Message } from "@dxos/types";
293
- import { mx as mx5 } from "@dxos/ui-theme";
210
+ import { mx as mx6 } from "@dxos/ui-theme";
294
211
  import { isTruthy } from "@dxos/util";
295
212
 
296
213
  // src/hooks/useContextBinder.ts
@@ -455,11 +372,8 @@ var usePresets = (online) => {
455
372
 
456
373
  // src/hooks/useReferencesProvider.ts
457
374
  import { useMemo as useMemo5 } from "react";
458
- import { useCapabilities as useCapabilities2 } from "@dxos/app-framework/ui";
459
- import { AppCapabilities as AppCapabilities2 } from "@dxos/app-toolkit";
460
375
  import { Filter as Filter2, Obj as Obj2 } from "@dxos/echo";
461
376
  var useReferencesProvider = (space) => {
462
- const blueprints = useCapabilities2(AppCapabilities2.BlueprintDefinition);
463
377
  return useMemo5(() => {
464
378
  if (!space) {
465
379
  return void 0;
@@ -481,21 +395,20 @@ var useReferencesProvider = (space) => {
481
395
  }
482
396
  };
483
397
  }, [
484
- space,
485
- blueprints
398
+ space
486
399
  ]);
487
400
  };
488
401
  var stringMatch = (query, label) => label.toLowerCase().startsWith(query.toLowerCase());
489
402
 
490
403
  // src/components/ChatPrompt/ChatActions.tsx
491
- import React2 from "react";
492
- import { IconButton, useTranslation as useTranslation2 } from "@dxos/react-ui";
404
+ import React from "react";
405
+ import { IconButton, useTranslation } from "@dxos/react-ui";
493
406
  import { mx } from "@dxos/ui-theme";
494
407
  var ChatActions = ({ classNames, children, microphone, recording, processing, onEvent }) => {
495
- const { t } = useTranslation2(meta.id);
496
- return /* @__PURE__ */ React2.createElement("div", {
497
- className: mx("flex items-center mie-1", classNames)
498
- }, children, /* @__PURE__ */ React2.createElement(IconButton, {
408
+ const { t } = useTranslation(meta.id);
409
+ return /* @__PURE__ */ React.createElement("div", {
410
+ className: mx("flex items-center me-1", classNames)
411
+ }, children, /* @__PURE__ */ React.createElement(IconButton, {
499
412
  disabled: !processing,
500
413
  variant: "ghost",
501
414
  icon: "ph--x--regular",
@@ -504,7 +417,7 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
504
417
  onClick: () => onEvent?.({
505
418
  type: "cancel"
506
419
  })
507
- }), microphone && /* @__PURE__ */ React2.createElement(IconButton, {
420
+ }), microphone && /* @__PURE__ */ React.createElement(IconButton, {
508
421
  disabled: !processing,
509
422
  classNames: mx(recording && "bg-primary-500"),
510
423
  variant: "ghost",
@@ -524,7 +437,7 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
524
437
  onTouchEnd: () => onEvent?.({
525
438
  type: "record-stop"
526
439
  })
527
- }), /* @__PURE__ */ React2.createElement(IconButton, {
440
+ }), /* @__PURE__ */ React.createElement(IconButton, {
528
441
  variant: "ghost",
529
442
  icon: "ph--wrench--regular",
530
443
  iconOnly: true,
@@ -536,78 +449,81 @@ var ChatActions = ({ classNames, children, microphone, recording, processing, on
536
449
  };
537
450
 
538
451
  // src/components/ChatPrompt/ChatOptions.tsx
539
- import React3, { useMemo as useMemo6, useState as useState8 } from "react";
452
+ import * as Option2 from "effect/Option";
453
+ import React2, { useMemo as useMemo6, useState as useState8 } from "react";
540
454
  import { Filter as Filter3, Obj as Obj3, Type } from "@dxos/echo";
455
+ import { Annotation } from "@dxos/echo";
541
456
  import { useQuery as useQuery2 } from "@dxos/react-client/echo";
542
- import { IconButton as IconButton2, Popover, Select as Select2, useTranslation as useTranslation3 } from "@dxos/react-ui";
457
+ import { IconButton as IconButton2, Popover, Select, useTranslation as useTranslation2 } from "@dxos/react-ui";
543
458
  import { Listbox, SearchList, useSearchListResults } from "@dxos/react-ui-searchlist";
544
459
  import { Tabs } from "@dxos/react-ui-tabs";
545
- var panelClassNames = "is-[calc(100dvw-.5rem)] sm:is-max md:is-72 max-is-[--text-content]";
460
+ import { getStyles, mx as mx2 } from "@dxos/ui-theme";
461
+ var panelClassNames = "w-[calc(100dvw-.5rem)] sm:w-max md:w-72 max-w-text-content";
546
462
  var ChatOptions = ({ db, context, blueprintRegistry, presets, preset, onPresetChange }) => {
547
- const { t } = useTranslation3(meta.id);
548
- return /* @__PURE__ */ React3.createElement("div", {
463
+ const { t } = useTranslation2(meta.id);
464
+ return /* @__PURE__ */ React2.createElement("div", {
549
465
  role: "none",
550
466
  className: "flex p-2"
551
- }, /* @__PURE__ */ React3.createElement(Popover.Root, null, /* @__PURE__ */ React3.createElement(Popover.Trigger, {
467
+ }, /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
552
468
  asChild: true
553
- }, /* @__PURE__ */ React3.createElement(IconButton2, {
469
+ }, /* @__PURE__ */ React2.createElement(IconButton2, {
554
470
  variant: "ghost",
555
471
  icon: "ph--plus--regular",
556
472
  iconOnly: true,
557
473
  label: t("context objects button")
558
- })), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(Popover.Content, {
474
+ })), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
559
475
  side: "top",
560
476
  classNames: panelClassNames
561
- }, /* @__PURE__ */ React3.createElement(Popover.Viewport, null, /* @__PURE__ */ React3.createElement(ObjectsPanel, {
477
+ }, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(ObjectsPanel, {
562
478
  db,
563
479
  context
564
- })), /* @__PURE__ */ React3.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React3.createElement(Popover.Root, null, /* @__PURE__ */ React3.createElement(Popover.Trigger, {
480
+ })), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))), /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
565
481
  asChild: true
566
- }, /* @__PURE__ */ React3.createElement(IconButton2, {
482
+ }, /* @__PURE__ */ React2.createElement(IconButton2, {
567
483
  variant: "ghost",
568
484
  icon: "ph--sliders-horizontal--regular",
569
485
  iconOnly: true,
570
486
  label: t("context settings button")
571
- })), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(Popover.Content, {
487
+ })), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
572
488
  side: "top",
573
489
  classNames: panelClassNames
574
- }, /* @__PURE__ */ React3.createElement(Popover.Viewport, null, /* @__PURE__ */ React3.createElement(Tabs.Root, {
490
+ }, /* @__PURE__ */ React2.createElement(Popover.Viewport, null, /* @__PURE__ */ React2.createElement(Tabs.Root, {
575
491
  orientation: "horizontal",
576
492
  defaultValue: "blueprints",
577
493
  defaultActivePart: "list",
578
494
  tabIndex: -1
579
- }, /* @__PURE__ */ React3.createElement(Tabs.Viewport, {
580
- 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'
581
- }, /* @__PURE__ */ React3.createElement(Tabs.Tabpanel, {
495
+ }, /* @__PURE__ */ React2.createElement(Tabs.Viewport, {
496
+ classNames: mx2("max-h-(--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-h-0 [&_[role="listbox"]]:overflow-y-auto', '[&_[role="tabpanel"]]:min-h-0 [&_[role="tabpanel"]]:px-form-chrome [&_[role="tabpanel"][data-state="active"]]:order-first [&_[role="tabpanel"][data-state="inactive"]]:hidden')
497
+ }, /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
582
498
  value: "blueprints",
583
499
  tabIndex: -1,
584
500
  classNames: "dx-focus-ring-inset"
585
- }, /* @__PURE__ */ React3.createElement(BlueprintsPanel, {
501
+ }, /* @__PURE__ */ React2.createElement(BlueprintsPanel, {
586
502
  blueprintRegistry,
587
503
  db,
588
504
  context
589
- })), /* @__PURE__ */ React3.createElement(Tabs.Tabpanel, {
505
+ })), /* @__PURE__ */ React2.createElement(Tabs.Tabpanel, {
590
506
  value: "model",
591
507
  tabIndex: -1,
592
- classNames: "dx-focus-ring-inset !pli-0"
593
- }, /* @__PURE__ */ React3.createElement(ModelsPanel, {
508
+ classNames: "dx-focus-ring-inset px-0!"
509
+ }, /* @__PURE__ */ React2.createElement(ModelsPanel, {
594
510
  presets,
595
511
  preset,
596
512
  onPresetChange
597
- })), /* @__PURE__ */ React3.createElement(Tabs.Tablist, {
598
- classNames: "sm:overflow-x-hidden justify-center p-[--dx-cardSpacingChrome] border-bs border-subduedSeparator order-last"
599
- }, /* @__PURE__ */ React3.createElement(Tabs.IconTab, {
513
+ })), /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
514
+ classNames: "sm:overflow-x-hidden justify-center p-form-chrome border-y border-subdued-separator order-last"
515
+ }, /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
600
516
  value: "blueprints",
601
517
  icon: "ph--blueprint--regular",
602
518
  label: t("blueprints in context title")
603
- }), /* @__PURE__ */ React3.createElement(Tabs.IconTab, {
519
+ }), /* @__PURE__ */ React2.createElement(Tabs.IconTab, {
604
520
  value: "model",
605
521
  label: t("chat model title"),
606
522
  icon: "ph--cpu--regular"
607
- }))))), /* @__PURE__ */ React3.createElement(Popover.Arrow, null)))));
523
+ }))))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null)))));
608
524
  };
609
525
  var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
610
- const { t } = useTranslation3(meta.id);
526
+ const { t } = useTranslation2(meta.id);
611
527
  const blueprints = useBlueprints({
612
528
  blueprintRegistry,
613
529
  db
@@ -624,13 +540,13 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
624
540
  items: blueprints,
625
541
  extract: (blueprint) => blueprint.name
626
542
  });
627
- return /* @__PURE__ */ React3.createElement(SearchList.Root, {
543
+ return /* @__PURE__ */ React2.createElement(SearchList.Root, {
628
544
  onSearch: handleSearch
629
- }, /* @__PURE__ */ React3.createElement(SearchList.Content, {
630
- classNames: "plb-cardSpacingChrome"
631
- }, /* @__PURE__ */ React3.createElement(SearchList.Viewport, null, results.map((blueprint) => {
545
+ }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
546
+ classNames: "py-form-chrome"
547
+ }, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.map((blueprint) => {
632
548
  const isActive = activeBlueprints.has(blueprint.key);
633
- return /* @__PURE__ */ React3.createElement(SearchList.Item, {
549
+ return /* @__PURE__ */ React2.createElement(SearchList.Item, {
634
550
  classNames: "flex items-center overflow-hidden",
635
551
  key: blueprint.key,
636
552
  value: blueprint.key,
@@ -638,27 +554,27 @@ var BlueprintsPanel = ({ blueprintRegistry, db, context }) => {
638
554
  checked: isActive,
639
555
  onSelect: () => onUpdateBlueprint?.(blueprint.key, !isActive)
640
556
  });
641
- }))), /* @__PURE__ */ React3.createElement(SearchList.Input, {
557
+ }))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
642
558
  placeholder: t("search placeholder"),
643
- classNames: "mbe-cardSpacingChrome",
559
+ classNames: "mb-form-chrome",
644
560
  autoFocus: true
645
561
  }));
646
562
  };
647
563
  var ModelsPanel = ({ presets, preset, onPresetChange }) => {
648
- return /* @__PURE__ */ React3.createElement(Listbox.Root, {
564
+ return /* @__PURE__ */ React2.createElement(Listbox.Root, {
649
565
  value: preset,
650
566
  onValueChange: onPresetChange,
651
567
  autoFocus: true
652
568
  }, presets?.map(({ id, label }) => {
653
- return /* @__PURE__ */ React3.createElement(Listbox.Option, {
569
+ return /* @__PURE__ */ React2.createElement(Listbox.Option, {
654
570
  key: id,
655
571
  value: id
656
- }, /* @__PURE__ */ React3.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React3.createElement(Listbox.OptionIndicator, null));
572
+ }, /* @__PURE__ */ React2.createElement(Listbox.OptionLabel, null, label), /* @__PURE__ */ React2.createElement(Listbox.OptionIndicator, null));
657
573
  }));
658
574
  };
659
575
  var ANY = "__any__";
660
576
  var ObjectsPanel = ({ db, context }) => {
661
- const { t } = useTranslation3(meta.id);
577
+ const { t } = useTranslation2(meta.id);
662
578
  const types = useFilteredTypes(db);
663
579
  const typenames = useMemo6(() => {
664
580
  const typenames2 = types.map((type) => {
@@ -689,61 +605,70 @@ var ObjectsPanel = ({ db, context }) => {
689
605
  items: objects,
690
606
  extract: (object) => Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id
691
607
  });
692
- return /* @__PURE__ */ React3.createElement(SearchList.Root, {
608
+ return /* @__PURE__ */ React2.createElement(SearchList.Root, {
693
609
  onSearch: handleSearch
694
- }, /* @__PURE__ */ React3.createElement(SearchList.Content, {
695
- classNames: "p-cardSpacingChrome [&:has([cmdk-list-sizer]:empty)]:plb-0"
696
- }, /* @__PURE__ */ React3.createElement(SearchList.Viewport, null, results.length ? results.map((object) => {
610
+ }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
611
+ classNames: "p-form-chrome [&:has([cmdk-list-sizer]:empty)]:py-0"
612
+ }, /* @__PURE__ */ React2.createElement(SearchList.Viewport, null, results.length ? results.map((object) => {
697
613
  const isActive = contextObjects.findIndex((obj) => obj.id === object.id) !== -1;
698
- return /* @__PURE__ */ React3.createElement(SearchList.Item, {
614
+ const { icon, hue } = Option2.fromNullable(Obj3.getSchema(object)).pipe(Option2.flatMap(Annotation.IconAnnotation.get), Option2.getOrElse(() => ({
615
+ icon: DEFAULT_OBJECT_ICON,
616
+ hue: void 0
617
+ })));
618
+ const styles = hue ? getStyles(hue) : void 0;
619
+ return /* @__PURE__ */ React2.createElement(SearchList.Item, {
699
620
  classNames: "flex items-center overflow-hidden",
700
621
  key: object.id,
701
622
  value: object.id,
623
+ icon,
624
+ iconClassNames: styles?.surfaceText,
702
625
  label: Obj3.getLabel(object) ?? Obj3.getTypename(object) ?? object.id,
703
626
  checked: isActive,
704
627
  onSelect: () => onUpdateObject?.(Obj3.getDXN(object), !isActive)
705
628
  });
706
- }) : /* @__PURE__ */ React3.createElement(SearchList.Item, {
629
+ }) : /* @__PURE__ */ React2.createElement(SearchList.Item, {
707
630
  value: "__empty__",
708
631
  label: t("no results")
709
- }))), /* @__PURE__ */ React3.createElement("div", {
632
+ }))), /* @__PURE__ */ React2.createElement("div", {
710
633
  role: "none",
711
- className: "grid grid-cols-[min-content_1fr] gap-2 pli-cardSpacingChrome mbe-cardSpacingChrome"
712
- }, /* @__PURE__ */ React3.createElement(Select2.Root, {
634
+ className: "grid grid-cols-[min-content_1fr] gap-2 px-form-chrome mb-form-chrome"
635
+ }, /* @__PURE__ */ React2.createElement(Select.Root, {
713
636
  value: typename === ANY ? void 0 : typename,
714
637
  onValueChange: setTypename
715
- }, /* @__PURE__ */ React3.createElement(Select2.TriggerButton, {
638
+ }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
716
639
  density: "fine",
717
640
  placeholder: t("type filter placeholder")
718
- }), /* @__PURE__ */ React3.createElement(Select2.Portal, null, /* @__PURE__ */ React3.createElement(Select2.Content, null, /* @__PURE__ */ React3.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select2.Viewport, null, /* @__PURE__ */ React3.createElement(Select2.Option, {
641
+ }), /* @__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, {
719
642
  value: ANY
720
- }, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React3.createElement(Select2.Option, {
643
+ }, t("any type filter label")), typenames.map(({ typename: typename2, label }) => /* @__PURE__ */ React2.createElement(Select.Option, {
721
644
  key: typename2,
722
645
  value: typename2
723
- }, label))), /* @__PURE__ */ React3.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React3.createElement(Select2.Arrow, null)))), /* @__PURE__ */ React3.createElement(SearchList.Input, {
646
+ }, label))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(SearchList.Input, {
724
647
  placeholder: t("search placeholder"),
725
- classNames: "mbe-0",
648
+ classNames: "mb-0",
726
649
  autoFocus: true
727
650
  })));
728
651
  };
652
+ var DEFAULT_OBJECT_ICON = "ph--cube--regular";
729
653
 
730
654
  // src/components/ChatPrompt/ChatPresets.tsx
731
- import React4 from "react";
732
- import { Select as Select3 } from "@dxos/react-ui";
655
+ import React3 from "react";
656
+ import { Select as Select2 } from "@dxos/react-ui";
733
657
 
734
658
  // src/components/ChatPrompt/ChatReferences.tsx
735
- import React5 from "react";
736
- import { Obj as Obj4 } from "@dxos/echo";
737
- import { IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation4 } from "@dxos/react-ui";
738
- import { mx as mx2 } from "@dxos/ui-theme";
659
+ import * as Option3 from "effect/Option";
660
+ import React4 from "react";
661
+ import { Annotation as Annotation2, Obj as Obj4 } from "@dxos/echo";
662
+ import { Icon, IconButton as IconButton3, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
663
+ import { getStyles as getStyles2, mx as mx3 } from "@dxos/ui-theme";
739
664
  var ChatReferences = ({ classNames, context, db }) => {
740
- const { t } = useTranslation4(meta.id);
665
+ const { t } = useTranslation3(meta.id);
741
666
  const { objects, onUpdateObject } = useContextObjects({
742
667
  db,
743
668
  context
744
669
  });
745
- return /* @__PURE__ */ React5.createElement("ul", {
746
- className: mx2("flex", classNames)
670
+ return /* @__PURE__ */ React4.createElement("ul", {
671
+ className: mx3("flex", classNames)
747
672
  }, objects.map((obj) => {
748
673
  const dxn = Obj4.getDXN(obj);
749
674
  const typename = Obj4.getTypename(obj);
@@ -753,11 +678,20 @@ var ChatReferences = ({ classNames, context, db }) => {
753
678
  ns: typename
754
679
  }
755
680
  ] : obj.id);
756
- return /* @__PURE__ */ React5.createElement("li", {
681
+ const { icon, hue } = Option3.fromNullable(Obj4.getSchema(obj)).pipe(Option3.flatMap(Annotation2.IconAnnotation.get), Option3.getOrElse(() => ({
682
+ icon: DEFAULT_OBJECT_ICON2,
683
+ hue: void 0
684
+ })));
685
+ const styles = hue ? getStyles2(hue) : void 0;
686
+ return /* @__PURE__ */ React4.createElement("li", {
757
687
  key: dxn.toString(),
758
- className: "dx-tag plb-0 pis-2 flex items-center",
688
+ className: "dx-tag py-0 ps-2 flex items-center gap-1",
759
689
  "data-hue": "neutral"
760
- }, toLocalizedString(label, t), /* @__PURE__ */ React5.createElement(IconButton3, {
690
+ }, /* @__PURE__ */ React4.createElement(Icon, {
691
+ icon,
692
+ size: 4,
693
+ classNames: styles?.surfaceText
694
+ }), toLocalizedString(label, t), /* @__PURE__ */ React4.createElement(IconButton3, {
761
695
  icon: "ph--x--bold",
762
696
  iconOnly: true,
763
697
  variant: "ghost",
@@ -768,12 +702,13 @@ var ChatReferences = ({ classNames, context, db }) => {
768
702
  }));
769
703
  }));
770
704
  };
705
+ var DEFAULT_OBJECT_ICON2 = "ph--cube--regular";
771
706
 
772
707
  // src/components/ChatPrompt/ChatStatusIndicator.tsx
773
- import React6, { useEffect as useEffect4, useState as useState9 } from "react";
708
+ import React5, { useEffect as useEffect4, useState as useState9 } from "react";
774
709
  import { Tooltip, useTimeout } from "@dxos/react-ui";
775
710
  import { Spinner } from "@dxos/react-ui-sfx";
776
- import { mx as mx3 } from "@dxos/ui-theme";
711
+ import { mx as mx4 } from "@dxos/ui-theme";
777
712
  var period = 3e3;
778
713
  var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props }) => {
779
714
  const [init, setInit] = useState9(false);
@@ -785,50 +720,50 @@ var ChatStatusIndicator = ({ classNames, preset, processing, error, ...props })
785
720
  }, period / 2, [
786
721
  preset
787
722
  ]);
788
- return /* @__PURE__ */ React6.createElement("div", {
723
+ return /* @__PURE__ */ React5.createElement("div", {
789
724
  role: "none",
790
- className: mx3("relative flex", classNames)
791
- }, /* @__PURE__ */ React6.createElement(Spinner, {
725
+ className: mx4("relative flex", classNames)
726
+ }, /* @__PURE__ */ React5.createElement(Spinner, {
792
727
  duration: period,
793
728
  state: !init ? "flash" : error ? "error" : processing ? "spin" : "pulse",
794
729
  ...props
795
- }), error && /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
730
+ }), error && /* @__PURE__ */ React5.createElement(Tooltip.Trigger, {
796
731
  asChild: true,
797
732
  content: error.message
798
- }, /* @__PURE__ */ React6.createElement("div", {
733
+ }, /* @__PURE__ */ React5.createElement("div", {
799
734
  className: "absolute inset-0"
800
735
  })));
801
736
  };
802
737
 
803
738
  // src/components/ChatThread/ChatThread.tsx
804
- import React9, { forwardRef, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo8, useState as useState11 } from "react";
739
+ import React8, { forwardRef, useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo8, useState as useState11 } from "react";
805
740
  import { PublicKey } from "@dxos/keys";
806
741
  import { useForwardedRef } from "@dxos/react-ui";
807
742
  import { MarkdownStream } from "@dxos/react-ui-components";
808
- import { mx as mx4 } from "@dxos/ui-theme";
743
+ import { mx as mx5 } from "@dxos/ui-theme";
809
744
  import { keyToFallback } from "@dxos/util";
810
745
 
811
746
  // src/components/ChatThread/registry.tsx
812
- import React8 from "react";
747
+ import React7 from "react";
813
748
  import { log as log2 } from "@dxos/log";
814
749
  import { ToggleContainer as ToggleContainer2 } from "@dxos/react-ui-components";
815
- import { PromptWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget } from "@dxos/react-ui-components";
750
+ import { PromptWidget, ReasoningWidget, ReferenceWidget, SelectWidget, SuggestionWidget, SummaryWidget } from "@dxos/react-ui-components";
816
751
  import { Json as Json2 } from "@dxos/react-ui-syntax-highlighter";
817
752
  import { ContentBlock } from "@dxos/types";
818
753
  import { getXmlTextChild } from "@dxos/ui-editor";
819
754
 
820
755
  // src/components/ToolBlock/ToolBlock.tsx
821
- import React7, { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
822
- import { useTranslation as useTranslation5 } from "@dxos/react-ui";
756
+ import React6, { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef2, useState as useState10 } from "react";
757
+ import { useTranslation as useTranslation4 } from "@dxos/react-ui";
823
758
  import { NumericTabs, TextCrawl, ToggleContainer } from "@dxos/react-ui-components";
824
759
  import { Json } from "@dxos/react-ui-syntax-highlighter";
825
760
  import { isNonNullable, safeParseJson } from "@dxos/util";
826
761
  var ToolBlock = ({ view, blocks = [] }) => {
827
- const { t } = useTranslation5(meta.id);
762
+ const { t } = useTranslation4(meta.id);
828
763
  const items = useMemo7(() => {
829
764
  let lastToolCall;
830
765
  const tools = [];
831
- return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "summary").map((block) => {
766
+ return blocks.filter((block) => block._tag === "toolCall" || block._tag === "toolResult" || block._tag === "stats").map((block) => {
832
767
  switch (block._tag) {
833
768
  case "toolCall": {
834
769
  if (block.pending && lastToolCall?.block.toolCallId === block.toolCallId) {
@@ -870,12 +805,12 @@ var ToolBlock = ({ view, blocks = [] }) => {
870
805
  }
871
806
  };
872
807
  }
873
- case "summary": {
808
+ case "stats": {
874
809
  if (!lastToolCall) {
875
810
  return null;
876
811
  }
877
812
  return {
878
- title: t("summary label"),
813
+ title: t("stats label"),
879
814
  content: block
880
815
  };
881
816
  }
@@ -894,7 +829,7 @@ var ToolBlock = ({ view, blocks = [] }) => {
894
829
  if (!items.length) {
895
830
  return null;
896
831
  }
897
- return /* @__PURE__ */ React7.createElement(ToolContainer, {
832
+ return /* @__PURE__ */ React6.createElement(ToolContainer, {
898
833
  items,
899
834
  onChangeOpen: handleChangeOpen
900
835
  });
@@ -916,26 +851,26 @@ var ToolContainer = ({ items, onChangeOpen }) => {
916
851
  const handleSelect = useCallback5((index) => {
917
852
  setSelected(index);
918
853
  }, []);
919
- return /* @__PURE__ */ React7.createElement(ToggleContainer.Root, {
920
- classNames: "mbs-2 is-full rounded-sm",
854
+ return /* @__PURE__ */ React6.createElement(ToggleContainer.Root, {
855
+ classNames: "mt-2 w-full rounded-xs",
921
856
  open,
922
857
  onChangeOpen: setOpen
923
- }, /* @__PURE__ */ React7.createElement(ToggleContainer.Header, {
858
+ }, /* @__PURE__ */ React6.createElement(ToggleContainer.Header, {
924
859
  classNames: "text-sm text-placeholder"
925
- }, /* @__PURE__ */ React7.createElement(TextCrawl, {
860
+ }, /* @__PURE__ */ React6.createElement(TextCrawl, {
926
861
  key: "status-roll",
927
862
  lines: items.map((item) => item.title),
928
863
  autoAdvance: true,
929
864
  greedy: true
930
- })), /* @__PURE__ */ React7.createElement(ToggleContainer.Content, {
865
+ })), /* @__PURE__ */ React6.createElement(ToggleContainer.Content, {
931
866
  classNames: "grid grid-cols-[32px_1fr]"
932
- }, /* @__PURE__ */ React7.createElement(NumericTabs, {
867
+ }, /* @__PURE__ */ React6.createElement(NumericTabs, {
933
868
  ref: tabsRef,
934
869
  classNames: "p-1",
935
870
  length: items.length,
936
871
  selected,
937
872
  onSelect: handleSelect
938
- }), /* @__PURE__ */ React7.createElement(Json, {
873
+ }), /* @__PURE__ */ React6.createElement(Json, {
939
874
  data: items[selected]?.content,
940
875
  classNames: "p-1 text-xs bg-transparent",
941
876
  replacer: {
@@ -949,50 +884,66 @@ var ToolContainer = ({ items, onChangeOpen }) => {
949
884
  // src/components/ChatThread/registry.tsx
950
885
  var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/ChatThread/registry.tsx";
951
886
  var Fallback = ({ _tag, ...props }) => {
952
- return /* @__PURE__ */ React8.createElement(ToggleContainer2.Root, {
953
- classNames: "rounded-sm"
954
- }, /* @__PURE__ */ React8.createElement(ToggleContainer2.Header, {
955
- classNames: "bg-groupSurface"
956
- }, _tag), /* @__PURE__ */ React8.createElement(ToggleContainer2.Content, {
957
- classNames: "bg-modalSurface"
958
- }, /* @__PURE__ */ React8.createElement(Json2, {
959
- classNames: "!p-2 text-sm",
887
+ return /* @__PURE__ */ React7.createElement(ToggleContainer2.Root, {
888
+ classNames: "rounded-xs"
889
+ }, /* @__PURE__ */ React7.createElement(ToggleContainer2.Header, {
890
+ classNames: "bg-group-surface"
891
+ }, _tag), /* @__PURE__ */ React7.createElement(ToggleContainer2.Content, {
892
+ classNames: "bg-modal-surface"
893
+ }, /* @__PURE__ */ React7.createElement(Json2, {
894
+ classNames: "p-2! text-sm",
960
895
  data: props
961
896
  })));
962
897
  };
898
+ var Summary = ({ text }) => {
899
+ return /* @__PURE__ */ React7.createElement(ToggleContainer2.Root, {
900
+ classNames: "rounded-sm"
901
+ }, /* @__PURE__ */ React7.createElement(ToggleContainer2.Header, {
902
+ classNames: "bg-group-surface"
903
+ }, "Conversation summarized"), /* @__PURE__ */ React7.createElement(ToggleContainer2.Content, {
904
+ classNames: "bg-modal-surface"
905
+ }, text));
906
+ };
963
907
  var componentRegistry = {
964
908
  //
965
909
  // Widgets
966
910
  //
967
- ["prompt"]: {
911
+ prompt: {
968
912
  block: true,
969
913
  factory: ({ children }) => {
970
914
  const text = getXmlTextChild(children);
971
915
  return text ? new PromptWidget(text) : null;
972
916
  }
973
917
  },
974
- ["reference"]: {
918
+ reasoning: {
919
+ block: true,
920
+ factory: ({ children }) => {
921
+ const text = getXmlTextChild(children);
922
+ return text ? new ReasoningWidget(text) : null;
923
+ }
924
+ },
925
+ reference: {
975
926
  block: false,
976
927
  factory: ({ children, ref }) => {
977
928
  const text = getXmlTextChild(children);
978
929
  return text && ref ? new ReferenceWidget(text, ref) : null;
979
930
  }
980
931
  },
981
- ["select"]: {
932
+ select: {
982
933
  block: true,
983
934
  factory: ({ children }) => {
984
935
  const options = children?.map((option) => option._tag === "option" && getXmlTextChild(option.children)).filter(Boolean);
985
936
  return options?.length ? new SelectWidget(options) : null;
986
937
  }
987
938
  },
988
- ["suggestion"]: {
939
+ suggestion: {
989
940
  block: true,
990
941
  factory: ({ children }) => {
991
942
  const text = getXmlTextChild(children);
992
943
  return text ? new SuggestionWidget(text) : null;
993
944
  }
994
945
  },
995
- ["summary"]: {
946
+ stats: {
996
947
  block: true,
997
948
  factory: ({ children }) => {
998
949
  const text = getXmlTextChild(children);
@@ -1002,22 +953,26 @@ var componentRegistry = {
1002
953
  //
1003
954
  // React
1004
955
  //
1005
- ["toolCall"]: {
956
+ toolCall: {
1006
957
  block: true,
1007
958
  Component: ToolBlock
1008
959
  },
1009
- ["toolResult"]: {
960
+ toolResult: {
1010
961
  block: true,
1011
962
  Component: Fallback
1012
963
  },
1013
- ["toolkit"]: {
964
+ toolkit: {
1014
965
  block: true,
1015
966
  Component: Fallback
1016
967
  },
968
+ summary: {
969
+ block: true,
970
+ Component: Summary
971
+ },
1017
972
  //
1018
973
  // Fallback
1019
974
  //
1020
- ["json"]: {
975
+ json: {
1021
976
  block: true,
1022
977
  Component: Fallback
1023
978
  }
@@ -1034,7 +989,7 @@ var blockToMarkdownImpl = (context, message, block) => {
1034
989
  block: JSON.stringify(block)
1035
990
  }, {
1036
991
  F: __dxlog_file2,
1037
- L: 125,
992
+ L: 146,
1038
993
  S: void 0,
1039
994
  C: (f, a) => f(...a)
1040
995
  });
@@ -1075,7 +1030,9 @@ var blockToMarkdownImpl = (context, message, block) => {
1075
1030
  return `<toolCall id="${block.toolCallId}" />`;
1076
1031
  }
1077
1032
  case "toolResult": {
1078
- context.updateWidget(block.toolCallId, ({ blocks = [] }) => ({
1033
+ context.updateWidget(block.toolCallId, ({ blocks = [] } = {
1034
+ blocks: []
1035
+ }) => ({
1079
1036
  blocks: [
1080
1037
  ...blocks,
1081
1038
  block
@@ -1083,8 +1040,18 @@ var blockToMarkdownImpl = (context, message, block) => {
1083
1040
  }));
1084
1041
  break;
1085
1042
  }
1043
+ case "stats": {
1044
+ return `<stats>${ContentBlock.createStatsMessage(block)}</stats>`;
1045
+ }
1046
+ case "reasoning": {
1047
+ const text = block.reasoningText ?? block.redactedText;
1048
+ if (!text) {
1049
+ return;
1050
+ }
1051
+ return `<reasoning>${text.replace(/\n/g, " ").trim()}</reasoning>`;
1052
+ }
1086
1053
  case "summary": {
1087
- return `<summary>${ContentBlock.createSummaryMessage(block)}</summary>`;
1054
+ return `<summary>${block.content}</summary>`;
1088
1055
  }
1089
1056
  default: {
1090
1057
  return `<json id="${message.id}">
@@ -1143,6 +1110,10 @@ var MessageSyncer = class {
1143
1110
  * Syncs messages with the editor.
1144
1111
  */
1145
1112
  append(messages, flush = false) {
1113
+ messages = messages.map((message) => ({
1114
+ ...message,
1115
+ blocks: message.blocks.filter((block) => !block.pending || block._tag === "text")
1116
+ }));
1146
1117
  if (this._initialMessageId !== messages[0]?.id) {
1147
1118
  this.reset();
1148
1119
  this._initialMessageId = messages[0]?.id;
@@ -1174,18 +1145,6 @@ var MessageSyncer = class {
1174
1145
  }
1175
1146
  }
1176
1147
  process(messages, append) {
1177
- log3("sync", {
1178
- doc: this._model.view?.state.doc.length,
1179
- messages: messages.map((message) => message.blocks.length),
1180
- currentMessageIndex: this._currentMessageIndex,
1181
- currentBlockIndex: this._currentBlockIndex,
1182
- currentBlockContent: this._currentBlockContent
1183
- }, {
1184
- F: __dxlog_file3,
1185
- L: 111,
1186
- S: this,
1187
- C: (f, a) => f(...a)
1188
- });
1189
1148
  let i = this._currentMessageIndex;
1190
1149
  for (const message of messages.slice(this._currentMessageIndex)) {
1191
1150
  if (i > this._currentMessageIndex) {
@@ -1203,16 +1162,6 @@ var MessageSyncer = class {
1203
1162
  } else {
1204
1163
  content = currentBlockContent;
1205
1164
  }
1206
- log3("append", {
1207
- message: i,
1208
- block: j,
1209
- content
1210
- }, {
1211
- F: __dxlog_file3,
1212
- L: 138,
1213
- S: this,
1214
- C: (f, a) => f(...a)
1215
- });
1216
1165
  this._currentBlockContent = currentBlockContent;
1217
1166
  append(content);
1218
1167
  }
@@ -1273,13 +1222,13 @@ var ChatThread = /* @__PURE__ */ forwardRef(({ classNames, identity, messages =
1273
1222
  }, [
1274
1223
  onEvent
1275
1224
  ]);
1276
- return /* @__PURE__ */ React9.createElement("div", {
1225
+ return /* @__PURE__ */ React8.createElement("div", {
1277
1226
  role: "none",
1278
- className: mx4("flex bs-full is-full justify-center overflow-hidden", classNames),
1227
+ className: mx5("flex h-full w-full justify-center overflow-hidden", classNames),
1279
1228
  style: {
1280
- "--user-fill": `var(--dx-${userHue}Fill)`
1229
+ "--user-fill": `var(--color-${userHue}-fill)`
1281
1230
  }
1282
- }, /* @__PURE__ */ React9.createElement(MarkdownStream, {
1231
+ }, /* @__PURE__ */ React8.createElement(MarkdownStream, {
1283
1232
  ref: refCallback,
1284
1233
  registry: componentRegistry,
1285
1234
  cursor,
@@ -1311,7 +1260,7 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
1311
1260
  return event.on((ev) => {
1312
1261
  switch (ev.type) {
1313
1262
  case "toggle-debug": {
1314
- setDebug((current) => !current);
1263
+ setDebug((debug2) => !debug2);
1315
1264
  queueMicrotask(async () => {
1316
1265
  const objects = processor.context.getObjects();
1317
1266
  const blueprints = processor.context.getBlueprints();
@@ -1368,7 +1317,7 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
1368
1317
  onEvent
1369
1318
  ]);
1370
1319
  const db = props.db ?? (chat && Obj5.getDatabase(chat));
1371
- return /* @__PURE__ */ React10.createElement(ChatContextProvider, {
1320
+ return /* @__PURE__ */ React9.createElement(ChatContextProvider, {
1372
1321
  debug,
1373
1322
  event,
1374
1323
  db,
@@ -1380,10 +1329,11 @@ var ChatRoot = ({ children, chat, processor, onEvent, ...props }) => {
1380
1329
  };
1381
1330
  ChatRoot.displayName = "Chat.Root";
1382
1331
  var CHAT_VIEWPORT_NAME = "Chat.Viewport";
1383
- var ChatViewport = ({ classNames, children }) => {
1384
- return /* @__PURE__ */ React10.createElement("div", {
1332
+ var ChatViewport = ({ classNames, children, ...props }) => {
1333
+ return /* @__PURE__ */ React9.createElement("div", {
1385
1334
  role: "none",
1386
- className: mx5("flex flex-col bs-full is-full", classNames)
1335
+ ...props,
1336
+ className: mx6("flex flex-col h-full w-full", classNames)
1387
1337
  }, children);
1388
1338
  };
1389
1339
  ChatViewport.displayName = CHAT_VIEWPORT_NAME;
@@ -1391,7 +1341,7 @@ var CHAT_THREAD_NAME = "Chat.Thread";
1391
1341
  var ChatThread2 = (props) => {
1392
1342
  const { debug, event, messages, processor } = useChatContext(CHAT_THREAD_NAME);
1393
1343
  const identity = useIdentity();
1394
- const error = useAtomValue(processor.error).pipe(Option2.getOrUndefined);
1344
+ const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
1395
1345
  const controllerRef = useRef3(null);
1396
1346
  useEffect7(() => {
1397
1347
  return event.on((event2) => {
@@ -1419,7 +1369,7 @@ var ChatThread2 = (props) => {
1419
1369
  if (!identity) {
1420
1370
  return null;
1421
1371
  }
1422
- return /* @__PURE__ */ React10.createElement(ChatThread, {
1372
+ return /* @__PURE__ */ React9.createElement(ChatThread, {
1423
1373
  ...props,
1424
1374
  identity,
1425
1375
  messages,
@@ -1432,9 +1382,9 @@ var ChatThread2 = (props) => {
1432
1382
  ChatThread2.displayName = CHAT_THREAD_NAME;
1433
1383
  var CHAT_PROMPT_NAME = "Chat.Prompt";
1434
1384
  var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandable, online, presets, preset, onPresetChange, onOnlineChange }) => {
1435
- const { t } = useTranslation6(meta.id);
1385
+ const { t } = useTranslation5(meta.id);
1436
1386
  const { db, processor, event } = useChatContext(CHAT_PROMPT_NAME);
1437
- const error = useAtomValue(processor.error).pipe(Option2.getOrUndefined);
1387
+ const error = useAtomValue(processor.error).pipe(Option4.getOrUndefined);
1438
1388
  const streaming = useAtomValue(processor.streaming);
1439
1389
  const active = useAtomValue(processor.active);
1440
1390
  const activeRef = useDynamicRef(active);
@@ -1534,67 +1484,68 @@ var ChatPrompt = ({ classNames, outline, settings = true, placeholder, expandabl
1534
1484
  }, [
1535
1485
  event
1536
1486
  ]);
1537
- return /* @__PURE__ */ React10.createElement("div", {
1487
+ return /* @__PURE__ */ React9.createElement("div", {
1538
1488
  role: "group",
1539
- className: mx5("flex flex-col is-full density-fine", outline && "bg-groupSurface border border-subduedSeparator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded", classNames)
1540
- }, /* @__PURE__ */ React10.createElement("div", {
1489
+ className: mx6("flex flex-col w-full dx-density-fine", outline && "bg-group-surface border border-subdued-separator transition transition-border [&:has(.cm-content:focus)]:border-separator rounded-sm", classNames)
1490
+ }, /* @__PURE__ */ React9.createElement("div", {
1541
1491
  role: "none",
1542
1492
  className: "flex p-2 gap-2"
1543
- }, /* @__PURE__ */ React10.createElement(ChatStatusIndicator, {
1493
+ }, /* @__PURE__ */ React9.createElement(ChatStatusIndicator, {
1544
1494
  classNames: "p-1",
1545
1495
  preset,
1546
1496
  error,
1547
1497
  processing: streaming
1548
- }), /* @__PURE__ */ React10.createElement(ChatEditor, {
1498
+ }), /* @__PURE__ */ React9.createElement(ChatEditor, {
1549
1499
  ref: editorRef,
1550
1500
  autoFocus: true,
1551
1501
  lineWrapping: true,
1552
- classNames: "col-span-2 pbs-0.5",
1502
+ classNames: "col-span-2 pt-0.5",
1553
1503
  placeholder: placeholder ?? t("prompt placeholder"),
1554
1504
  extensions,
1555
1505
  onSubmit: handleSubmit
1556
- })), db && settings && /* @__PURE__ */ React10.createElement("div", {
1506
+ })), db && settings && /* @__PURE__ */ React9.createElement("div", {
1557
1507
  role: "none",
1558
1508
  className: "flex items-center overflow-hidden"
1559
- }, /* @__PURE__ */ React10.createElement(ChatOptions, {
1509
+ }, /* @__PURE__ */ React9.createElement(ChatOptions, {
1560
1510
  db,
1561
1511
  blueprintRegistry: processor.blueprintRegistry,
1562
1512
  context: processor.context,
1563
1513
  preset,
1564
1514
  presets,
1565
1515
  onPresetChange
1566
- }), /* @__PURE__ */ React10.createElement("div", {
1516
+ }), /* @__PURE__ */ React9.createElement("div", {
1567
1517
  role: "none",
1568
1518
  className: "flex grow overflow-x-auto scrollbar-none"
1569
- }, /* @__PURE__ */ React10.createElement(ChatReferences, {
1519
+ }, /* @__PURE__ */ React9.createElement(ChatReferences, {
1570
1520
  db,
1571
1521
  context: processor.context
1572
- })), /* @__PURE__ */ React10.createElement(ChatActions, {
1522
+ })), /* @__PURE__ */ React9.createElement(ChatActions, {
1573
1523
  classNames: "col-span-2",
1574
1524
  microphone: true,
1575
1525
  recording,
1576
1526
  processing: streaming,
1577
1527
  onEvent: handleEvent
1578
- }, online !== void 0 && /* @__PURE__ */ React10.createElement(Input2.Root, null, /* @__PURE__ */ React10.createElement(Input2.Label, {
1528
+ }, online !== void 0 && /* @__PURE__ */ React9.createElement(Input.Root, null, /* @__PURE__ */ React9.createElement(Input.Label, {
1579
1529
  srOnly: true
1580
- }, t("online switch label")), /* @__PURE__ */ React10.createElement(Input2.Switch, {
1581
- classNames: "mli-2",
1530
+ }, t("online switch label")), /* @__PURE__ */ React9.createElement(Input.Switch, {
1531
+ classNames: "mx-2",
1582
1532
  checked: online,
1583
1533
  onCheckedChange: onOnlineChange
1584
1534
  })))));
1585
1535
  };
1586
1536
  ChatPrompt.displayName = CHAT_PROMPT_NAME;
1587
1537
  var CHAT_TOOLBAR_NAME = "Chat.Toolbar";
1588
- var ChatToolbar = ({ classNames, companionTo }) => {
1538
+ var ChatToolbar = ({ classNames, companionTo, ...props }) => {
1589
1539
  const { chat } = useChatContext(CHAT_TOOLBAR_NAME);
1590
1540
  const menu = useChatToolbarActions({
1591
1541
  chat,
1592
1542
  companionTo
1593
1543
  });
1594
- return /* @__PURE__ */ React10.createElement(MenuProvider, {
1544
+ return /* @__PURE__ */ React9.createElement(Menu.Root, {
1545
+ ...props,
1595
1546
  ...menu,
1596
1547
  attendableId: companionTo ? Obj5.getDXN(companionTo).toString() : chat ? Obj5.getDXN(chat).toString() : ""
1597
- }, /* @__PURE__ */ React10.createElement(ToolbarMenu, {
1548
+ }, /* @__PURE__ */ React9.createElement(Menu.Toolbar, {
1598
1549
  classNames,
1599
1550
  textBlockWidth: true
1600
1551
  }));
@@ -1608,13 +1559,331 @@ var Chat = {
1608
1559
  Toolbar: ChatToolbar
1609
1560
  };
1610
1561
 
1562
+ // src/components/TemplateEditor/TemplateEditor.tsx
1563
+ import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
1564
+ import React10 from "react";
1565
+ import { createDocAccessor } from "@dxos/echo-db";
1566
+ import { useThemeContext, useTranslation as useTranslation6 } from "@dxos/react-ui";
1567
+ import { useTextEditor } from "@dxos/react-ui-editor";
1568
+ import { createBasicExtensions, createDataExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown } from "@dxos/ui-editor";
1569
+ import { mx as mx8 } from "@dxos/ui-theme";
1570
+ import { isNonNullable as isNonNullable2 } from "@dxos/util";
1571
+
1572
+ // src/components/TemplateEditor/extensions/handlebars-extension.ts
1573
+ import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
1574
+ import { RangeSetBuilder } from "@codemirror/state";
1575
+ import { Decoration, ViewPlugin, WidgetType, keymap as keymap2 } from "@codemirror/view";
1576
+ import { Domino, mx as mx7 } from "@dxos/ui";
1577
+ var handlebars = (_ = {}) => {
1578
+ return [
1579
+ handlebarsHighlightPlugin,
1580
+ autocompletion({
1581
+ activateOnTyping: true,
1582
+ aboveCursor: true,
1583
+ closeOnBlur: true,
1584
+ override: [
1585
+ handlebarsCompletions
1586
+ ]
1587
+ }),
1588
+ keymap2.of(completionKeymap)
1589
+ ];
1590
+ };
1591
+ var regex = {
1592
+ // {{! comment }}
1593
+ comment: /\{\{!\s*[^}]*\}\}/g,
1594
+ // {{var}}
1595
+ brackets: /\{\{[^}]*\}\}/g,
1596
+ // {{#command}} {{/command}}
1597
+ command: /\{\{[#/]([^}]+)\}\}/g,
1598
+ // {{var}}
1599
+ var: /\{\{(?!\s*!)(\w[^}]*)\}\}/g,
1600
+ // @dxn:queue:data:xxx
1601
+ dxn: /@?dxn:[\w@:]+/g,
1602
+ // dxos.org/type/xxx
1603
+ url: /[\w.-]+\.[\w.-]+\/[\w/]+/g
1604
+ };
1605
+ var tagPadding = "mx-0.5 px-1 rounded-xs";
1606
+ var handlebarsHighlightPlugin = ViewPlugin.fromClass(class {
1607
+ decorations;
1608
+ constructor(view) {
1609
+ this.decorations = this.buildDecorations(view);
1610
+ }
1611
+ update(update) {
1612
+ if (update.docChanged || update.viewportChanged || update.selectionSet) {
1613
+ this.decorations = this.buildDecorations(update.view);
1614
+ }
1615
+ }
1616
+ // NOTE: Decorations may clash with other extensions (e.g., markdown).
1617
+ buildDecorations(view) {
1618
+ const selection = view.state.selection.main;
1619
+ const decorations = [];
1620
+ for (const { from, to } of view.visibleRanges) {
1621
+ const text = view.state.doc.sliceString(from, to);
1622
+ {
1623
+ let match;
1624
+ while ((match = regex.dxn.exec(text)) !== null) {
1625
+ const start = from + match.index;
1626
+ const end = start + match[0].length;
1627
+ const overlaps = selection.to > start && selection.from <= end;
1628
+ if (!overlaps) {
1629
+ decorations.push({
1630
+ from: start,
1631
+ to: end,
1632
+ decoration: Decoration.widget({
1633
+ widget: new DXNWidget(match[0])
1634
+ })
1635
+ });
1636
+ }
1637
+ }
1638
+ }
1639
+ {
1640
+ let match;
1641
+ while ((match = regex.url.exec(text)) !== null) {
1642
+ const start = from + match.index;
1643
+ const end = start + match[0].length;
1644
+ decorations.push({
1645
+ from: start,
1646
+ to: end,
1647
+ decoration: Decoration.mark({
1648
+ class: mx7("dx-tag--blue", tagPadding)
1649
+ })
1650
+ });
1651
+ }
1652
+ }
1653
+ {
1654
+ let match;
1655
+ while ((match = regex.brackets.exec(text)) !== null) {
1656
+ const start = from + match.index;
1657
+ const end = start + match[0].length;
1658
+ decorations.push({
1659
+ from: start,
1660
+ to: end,
1661
+ decoration: Decoration.mark({
1662
+ class: "text-subdued"
1663
+ })
1664
+ });
1665
+ }
1666
+ }
1667
+ {
1668
+ let match;
1669
+ while ((match = regex.command.exec(text)) !== null) {
1670
+ const start = from + match.index + 2;
1671
+ let end = start + match[0].length - 4;
1672
+ const text2 = view.state.doc.sliceString(start, end);
1673
+ const parts = text2.split(/\s+/);
1674
+ if (parts.length > 1) {
1675
+ const idx = start + parts[0].length;
1676
+ decorations.push({
1677
+ from: idx,
1678
+ to: end,
1679
+ decoration: Decoration.mark({
1680
+ class: "text-green-text"
1681
+ })
1682
+ });
1683
+ end = idx;
1684
+ }
1685
+ decorations.push({
1686
+ from: start,
1687
+ to: end,
1688
+ decoration: Decoration.mark({
1689
+ class: "text-blue-text"
1690
+ })
1691
+ });
1692
+ }
1693
+ }
1694
+ {
1695
+ let match;
1696
+ while ((match = regex.var.exec(text)) !== null) {
1697
+ const start = from + match.index + 2;
1698
+ const end = start + match[0].length - 4;
1699
+ decorations.push({
1700
+ from: start,
1701
+ to: end,
1702
+ decoration: Decoration.mark({
1703
+ class: "text-green-text"
1704
+ })
1705
+ });
1706
+ }
1707
+ }
1708
+ }
1709
+ decorations.sort((a, b) => a.from - b.from || a.to - b.to);
1710
+ const builder = new RangeSetBuilder();
1711
+ for (const { from, to, decoration } of decorations) {
1712
+ builder.add(from, to, decoration);
1713
+ }
1714
+ return builder.finish();
1715
+ }
1716
+ }, {
1717
+ decorations: (v) => v.decorations
1718
+ });
1719
+ var DXNWidget = class extends WidgetType {
1720
+ _identifier;
1721
+ constructor(_identifier) {
1722
+ super(), this._identifier = _identifier;
1723
+ }
1724
+ ignoreEvent() {
1725
+ return false;
1726
+ }
1727
+ eq(other) {
1728
+ return this._identifier === other._identifier;
1729
+ }
1730
+ toDOM() {
1731
+ const text = this._identifier.split(":").map((part) => {
1732
+ const len = 16;
1733
+ const plen = 4;
1734
+ if (part.length > len) {
1735
+ return `[${part.slice(0, plen)}\u2026${part.slice(-plen)}]`;
1736
+ }
1737
+ return part;
1738
+ }).join(":");
1739
+ return Domino.of("span").classNames(mx7("font-mono dx-tag--blue", tagPadding)).text(text).root;
1740
+ }
1741
+ };
1742
+ var variables = [
1743
+ "this"
1744
+ ];
1745
+ var commands = [
1746
+ "this",
1747
+ "each",
1748
+ "if",
1749
+ "unless",
1750
+ "with"
1751
+ ];
1752
+ function handlebarsCompletions(context) {
1753
+ const match = context.matchBefore(/\{\{[^}]*/);
1754
+ if (!match || match.from === match.to) {
1755
+ return null;
1756
+ }
1757
+ let type = "variable";
1758
+ let text = match.text.slice(2);
1759
+ let from = match.from + 2;
1760
+ let matches = [];
1761
+ if (text.startsWith("#") || text.startsWith("/")) {
1762
+ const idx = text.lastIndexOf(" ");
1763
+ if (idx !== -1) {
1764
+ type = "variable";
1765
+ matches = variables;
1766
+ text = text.slice(idx + 1);
1767
+ from += idx + 1;
1768
+ } else {
1769
+ type = "command";
1770
+ text = text.slice(1);
1771
+ matches = commands;
1772
+ from += 1;
1773
+ }
1774
+ } else {
1775
+ type = "variable";
1776
+ matches = variables;
1777
+ }
1778
+ const options = matches.filter((name) => name.startsWith(text)).map((name) => ({
1779
+ type,
1780
+ label: name
1781
+ }));
1782
+ return {
1783
+ from,
1784
+ options
1785
+ };
1786
+ }
1787
+
1788
+ // src/components/TemplateEditor/extensions/xml-extension.ts
1789
+ import { syntaxTree } from "@codemirror/language";
1790
+ import { RangeSetBuilder as RangeSetBuilder2 } from "@codemirror/state";
1791
+ import { Decoration as Decoration2, ViewPlugin as ViewPlugin2 } from "@codemirror/view";
1792
+ var xmlDecorator = (_ = {}) => {
1793
+ return [
1794
+ xmlDecoratorPlugin
1795
+ ];
1796
+ };
1797
+ var xmlDecoratorPlugin = ViewPlugin2.fromClass(class {
1798
+ decorations;
1799
+ constructor(view) {
1800
+ this.decorations = this.buildDecorations(view);
1801
+ }
1802
+ update(update) {
1803
+ if (update.docChanged || update.viewportChanged) {
1804
+ this.decorations = this.buildDecorations(update.view);
1805
+ }
1806
+ }
1807
+ buildDecorations(view) {
1808
+ const builder = new RangeSetBuilder2();
1809
+ for (const { from, to } of view.visibleRanges) {
1810
+ syntaxTree(view.state).iterate({
1811
+ from,
1812
+ to,
1813
+ enter: (node) => {
1814
+ if (node.name === "HTMLTag" || node.name === "OpenTag" || node.name === "CloseTag" || node.name === "SelfClosingTag" || node.name === "Element") {
1815
+ builder.add(node.from, node.to, Decoration2.mark({
1816
+ class: "font-mono text-subdued"
1817
+ }));
1818
+ }
1819
+ }
1820
+ });
1821
+ }
1822
+ return builder.finish();
1823
+ }
1824
+ }, {
1825
+ decorations: (v) => v.decorations
1826
+ });
1827
+
1828
+ // src/components/TemplateEditor/TemplateEditor.tsx
1829
+ var TemplateEditor = ({ id, classNames, template, lineNumbers = true }) => {
1830
+ const { t } = useTranslation6(meta.id);
1831
+ const { themeMode } = useThemeContext();
1832
+ const { parentRef } = useTextEditor(() => {
1833
+ const text = template.source?.target;
1834
+ if (!text) {
1835
+ return {};
1836
+ }
1837
+ return {
1838
+ initialValue: text.content ?? "",
1839
+ extensions: [
1840
+ createDataExtensions({
1841
+ id,
1842
+ text: createDocAccessor(text, [
1843
+ "content"
1844
+ ])
1845
+ }),
1846
+ createBasicExtensions({
1847
+ bracketMatching: false,
1848
+ lineNumbers,
1849
+ lineWrapping: true,
1850
+ placeholder: t("template placeholder")
1851
+ }),
1852
+ createThemeExtensions({
1853
+ themeMode,
1854
+ slots: {
1855
+ content: {
1856
+ className: "!pe-4"
1857
+ }
1858
+ }
1859
+ }),
1860
+ createMarkdownExtensions(),
1861
+ decorateMarkdown(),
1862
+ handlebars(),
1863
+ // xml(),
1864
+ // NOTE: Since we're using markdown only HTML nodes are parsed.
1865
+ xmlDecorator(),
1866
+ syntaxHighlighting(defaultHighlightStyle)
1867
+ ].filter(isNonNullable2)
1868
+ };
1869
+ }, [
1870
+ themeMode,
1871
+ template.source?.target,
1872
+ lineNumbers
1873
+ ]);
1874
+ return /* @__PURE__ */ React10.createElement("div", {
1875
+ ref: parentRef,
1876
+ className: mx8("h-full overflow-hidden", classNames)
1877
+ });
1878
+ };
1879
+
1611
1880
  // src/components/Toolbox/Toolbox.tsx
1612
1881
  import React11, { Fragment, useEffect as useEffect8, useState as useState13 } from "react";
1613
1882
  import { Function } from "@dxos/functions";
1614
1883
  import { log as log4 } from "@dxos/log";
1615
1884
  import { Filter as Filter5, useQuery as useQuery4 } from "@dxos/react-client/echo";
1616
1885
  import { ScrollArea } from "@dxos/react-ui";
1617
- import { mx as mx6 } from "@dxos/ui-theme";
1886
+ import { mx as mx9 } from "@dxos/ui-theme";
1618
1887
  var __dxlog_file4 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/components/Toolbox/Toolbox.tsx";
1619
1888
  var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }) => {
1620
1889
  return /* @__PURE__ */ React11.createElement(ScrollArea.Root, {
@@ -1657,9 +1926,9 @@ var Toolbox = ({ classNames, functions, services, blueprints, activeBlueprints }
1657
1926
  var Section = ({ title, items, striped }) => {
1658
1927
  const stripeClassNames = "odd:bg-neutral-50 dark:odd:bg-neutral-800";
1659
1928
  const gridClassNames = "grid grid-cols-[8rem_1fr]";
1660
- const subGridClassNames = mx6("col-span-full grid grid-cols-subgrid text-xs pli-2", striped && stripeClassNames);
1929
+ const subGridClassNames = mx9("col-span-full grid grid-cols-subgrid text-xs px-2", striped && stripeClassNames);
1661
1930
  return /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("h1", {
1662
- className: "pli-2 text-sm"
1931
+ className: "px-2 text-sm"
1663
1932
  }, title), /* @__PURE__ */ React11.createElement("div", {
1664
1933
  className: gridClassNames
1665
1934
  }, items.map(({ name, description, subitems }, i) => /* @__PURE__ */ React11.createElement(Fragment, {
@@ -1672,7 +1941,7 @@ var Section = ({ title, items, striped }) => {
1672
1941
  className: "line-clamp-2"
1673
1942
  }, description)), subitems?.map(({ name: name2, description: description2 }, i2) => /* @__PURE__ */ React11.createElement("div", {
1674
1943
  key: i2,
1675
- className: mx6(subGridClassNames, striped && stripeClassNames)
1944
+ className: mx9(subGridClassNames, striped && stripeClassNames)
1676
1945
  }, /* @__PURE__ */ React11.createElement("div", {
1677
1946
  className: "truncate"
1678
1947
  }, name2), /* @__PURE__ */ React11.createElement("div", {
@@ -1708,117 +1977,6 @@ var safeToolId = (name) => {
1708
1977
  return name.split("_").pop();
1709
1978
  };
1710
1979
 
1711
- // src/components/TriggerStatus/TriggerStatus.tsx
1712
- import React12, { useMemo as useMemo10 } from "react";
1713
- import { useCapability as useCapability2 } from "@dxos/app-framework/ui";
1714
- import { useLayout } from "@dxos/app-toolkit/ui";
1715
- import { useTriggerRuntimeControls } from "@dxos/plugin-automation";
1716
- import { ClientCapabilities } from "@dxos/plugin-client/types";
1717
- import { StatusBar } from "@dxos/plugin-status-bar";
1718
- import { parseId } from "@dxos/react-client/echo";
1719
- import { Icon, Input as Input3, Popover as Popover2, useTranslation as useTranslation7 } from "@dxos/react-ui";
1720
- import { Settings as Settings2 } from "@dxos/react-ui-form";
1721
- import { mx as mx7 } from "@dxos/ui-theme";
1722
- var getIcon = (state) => {
1723
- switch (state) {
1724
- case "disabled":
1725
- return "ph--lightning-slash--regular";
1726
- case "idle":
1727
- return "ph--lightning--regular";
1728
- case "running":
1729
- return "ph--lightning--fill";
1730
- case "error":
1731
- return "ph--warning--regular";
1732
- }
1733
- };
1734
- var getIconClassNames = (state) => {
1735
- switch (state) {
1736
- case "running":
1737
- return "animate-pulse text-accentText";
1738
- case "error":
1739
- return "text-errorText";
1740
- default:
1741
- return void 0;
1742
- }
1743
- };
1744
- var useCurrentSpace = () => {
1745
- const layout = useLayout();
1746
- const client = useCapability2(ClientCapabilities.Client);
1747
- const { spaceId } = parseId(layout.workspace);
1748
- const space = spaceId ? client.spaces.get(spaceId) : void 0;
1749
- return space;
1750
- };
1751
- var TriggerStatus = () => {
1752
- const space = useCurrentSpace();
1753
- const db = space?.db;
1754
- const { state, start, stop } = useTriggerRuntimeControls(db);
1755
- const isRunning = state?.enabled ?? false;
1756
- const triggerState = useMemo10(() => {
1757
- if (!isRunning) {
1758
- return "disabled";
1759
- }
1760
- const hasPending = state?.invocations.some((invocation) => invocation.result === null);
1761
- if (hasPending) {
1762
- return "running";
1763
- }
1764
- const lastInvocation = state?.invocations.at(-1);
1765
- if (lastInvocation?.result?._tag === "Failure") {
1766
- return "error";
1767
- }
1768
- return "idle";
1769
- }, [
1770
- isRunning,
1771
- state?.invocations
1772
- ]);
1773
- const { t } = useTranslation7(meta.id);
1774
- const title = t(`trigger status ${triggerState} label`);
1775
- const icon = /* @__PURE__ */ React12.createElement(Icon, {
1776
- icon: getIcon(triggerState),
1777
- classNames: getIconClassNames(triggerState)
1778
- });
1779
- return /* @__PURE__ */ React12.createElement(Popover2.Root, null, /* @__PURE__ */ React12.createElement(Popover2.Trigger, {
1780
- asChild: true
1781
- }, /* @__PURE__ */ React12.createElement(StatusBar.Item, {
1782
- title
1783
- }, icon)), /* @__PURE__ */ React12.createElement(Popover2.Portal, null, /* @__PURE__ */ React12.createElement(Popover2.Content, null, /* @__PURE__ */ React12.createElement(TriggerStatusPopover, {
1784
- isRunning,
1785
- state: triggerState,
1786
- currentFunctionName: state?.invocations.at(-1)?.function?.name ?? state?.invocations.at(-1)?.function?.key,
1787
- lastInvocation: state?.invocations.at(-1),
1788
- onToggle: isRunning ? stop : start
1789
- }), /* @__PURE__ */ React12.createElement(Popover2.Arrow, null))));
1790
- };
1791
- var TriggerStatusPopover = ({ isRunning, state, currentFunctionName, lastInvocation, onToggle }) => {
1792
- const { t } = useTranslation7(meta.id);
1793
- return /* @__PURE__ */ React12.createElement("div", {
1794
- className: "min-is-[240px] p-2 space-y-3"
1795
- }, /* @__PURE__ */ React12.createElement(Settings2.ItemInput, {
1796
- title: t("trigger runtime label"),
1797
- description: t("trigger runtime description")
1798
- }, /* @__PURE__ */ React12.createElement(Input3.Switch, {
1799
- classNames: "justify-self-end",
1800
- checked: isRunning,
1801
- onCheckedChange: onToggle
1802
- })), /* @__PURE__ */ React12.createElement("div", {
1803
- className: "flex items-center gap-2 pt-2 border-t border-separator"
1804
- }, /* @__PURE__ */ React12.createElement(Icon, {
1805
- icon: getIcon(state),
1806
- classNames: mx7(getIconClassNames(state), "shrink-0")
1807
- }), /* @__PURE__ */ React12.createElement("span", {
1808
- className: "text-sm"
1809
- }, t(`trigger status ${state} label`)), currentFunctionName && state === "running" && /* @__PURE__ */ React12.createElement("span", {
1810
- className: "text-xs text-description"
1811
- }, currentFunctionName)));
1812
- };
1813
-
1814
- // src/components/index.ts
1815
- var BlueprintArticle = lazy(() => import("./BlueprintArticle-7LI6UXKZ.mjs"));
1816
- var ChatCompanion = lazy(() => import("./ChatCompanion-W4PGOCGR.mjs"));
1817
- var ChatContainer = lazy(() => import("./ChatContainer-ECFQVH6O.mjs"));
1818
- var ChatDialog = lazy(() => import("./ChatDialog-AFLPYSIU.mjs"));
1819
- var InitiativeContainer = lazy(() => import("./InitiativeContainer-U4LGO3BW.mjs"));
1820
- var PromptArticle = lazy(() => import("./PromptArticle-BHPABYLT.mjs"));
1821
-
1822
1980
  // src/hooks/useChatToolbarActions.ts
1823
1981
  var __dxlog_file5 = "/__w/dxos/dxos/packages/plugins/plugin-assistant/src/hooks/useChatToolbarActions.ts";
1824
1982
  var useChatToolbarActions = ({ chat, companionTo }) => {
@@ -1826,7 +1984,7 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
1826
1984
  const { db } = useChatContext("useChatToolbarActions");
1827
1985
  const query = companionTo ? Query.select(Filter6.id(companionTo.id)).targetOf(Chat2.CompanionTo).source() : Query.select(Filter6.nothing());
1828
1986
  const chats = useQuery5(db, query);
1829
- return useMenuActions(useMemo11(() => {
1987
+ return useMenuActions(useMemo10(() => {
1830
1988
  return Atom.make(() => {
1831
1989
  const builder = MenuBuilder.make().root({
1832
1990
  label: [
@@ -1944,7 +2102,6 @@ var useChatToolbarActions = ({ chat, companionTo }) => {
1944
2102
  };
1945
2103
 
1946
2104
  export {
1947
- AssistantSettings,
1948
2105
  useBlueprintRegistry,
1949
2106
  useBlueprints,
1950
2107
  useActiveBlueprints,
@@ -1962,14 +2119,8 @@ export {
1962
2119
  ChatContextProvider,
1963
2120
  useChatContext,
1964
2121
  Chat,
2122
+ TemplateEditor,
1965
2123
  Toolbox,
1966
- ToolboxContainer,
1967
- TriggerStatus,
1968
- BlueprintArticle,
1969
- ChatCompanion,
1970
- ChatContainer,
1971
- ChatDialog,
1972
- InitiativeContainer,
1973
- PromptArticle
2124
+ ToolboxContainer
1974
2125
  };
1975
- //# sourceMappingURL=chunk-3XC7LQSO.mjs.map
2126
+ //# sourceMappingURL=chunk-GZ4ERNT2.mjs.map