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