@dxos/plugin-assistant 0.8.4-main.67995b8 → 0.8.4-main.dedc0f3

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 (522) hide show
  1. package/dist/lib/browser/{BlueprintContainer-IZ4AK5EO.mjs → BlueprintContainer-BFNN6K46.mjs} +4 -3
  2. package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs +126 -0
  3. package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs.map +7 -0
  4. package/dist/lib/browser/{ChatContainer-RP3QEXYX.mjs → ChatContainer-G6YHR6GJ.mjs} +34 -13
  5. package/dist/lib/browser/ChatContainer-G6YHR6GJ.mjs.map +7 -0
  6. package/dist/lib/browser/{ChatDialog-ZVLXFHEY.mjs → ChatDialog-HJ7VDRQO.mjs} +28 -12
  7. package/dist/lib/browser/ChatDialog-HJ7VDRQO.mjs.map +7 -0
  8. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
  9. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
  10. package/dist/lib/browser/ai-service-YC2EQPHA.mjs +22 -0
  11. package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +7 -0
  12. package/dist/lib/browser/{app-graph-builder-XSEOKJLG.mjs → app-graph-builder-3C43MLCD.mjs} +25 -36
  13. package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +7 -0
  14. package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs +12 -0
  15. package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-EZUSNS2J.mjs +19 -0
  17. package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-GLWD66TA.mjs +161 -0
  19. package/dist/lib/browser/chunk-GLWD66TA.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  21. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
  23. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
  24. package/dist/lib/browser/chunk-PL4O4ZJU.mjs +1974 -0
  25. package/dist/lib/browser/chunk-PL4O4ZJU.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-PPJAIE2T.mjs +299 -0
  27. package/dist/lib/browser/chunk-PPJAIE2T.mjs.map +7 -0
  28. package/dist/lib/browser/chunk-PQI3MGDN.mjs +169 -0
  29. package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +7 -0
  30. package/dist/lib/browser/chunk-R6LRGW3I.mjs +216 -0
  31. package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +7 -0
  32. package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
  33. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
  34. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +155 -0
  35. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +7 -0
  36. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +22 -0
  37. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +7 -0
  38. package/dist/lib/browser/index.mjs +148 -62
  39. package/dist/lib/browser/index.mjs.map +4 -4
  40. package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs +112 -0
  41. package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +7 -0
  42. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +21 -0
  43. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +7 -0
  44. package/dist/lib/browser/meta.json +1 -1
  45. package/dist/lib/browser/{react-surface-3GYEHQRP.mjs → react-surface-WNLA2636.mjs} +25 -66
  46. package/dist/lib/browser/react-surface-WNLA2636.mjs.map +7 -0
  47. package/dist/lib/browser/{settings-5GTTCVGD.mjs → settings-36V3VUMW.mjs} +6 -5
  48. package/dist/lib/{node-esm/settings-J2EXEM5H.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
  49. package/dist/lib/browser/state-AINRYS5W.mjs +21 -0
  50. package/dist/lib/browser/state-AINRYS5W.mjs.map +7 -0
  51. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
  52. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
  53. package/dist/lib/browser/types/index.mjs +7 -4
  54. package/dist/lib/node-esm/{BlueprintContainer-RGTMNLNX.mjs → BlueprintContainer-X4MRBKDR.mjs} +4 -3
  55. package/dist/lib/{browser/BlueprintContainer-IZ4AK5EO.mjs.map → node-esm/BlueprintContainer-X4MRBKDR.mjs.map} +1 -1
  56. package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs +127 -0
  57. package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs.map +7 -0
  58. package/dist/lib/node-esm/{ChatContainer-W3W6FWV3.mjs → ChatContainer-EZZF7RSQ.mjs} +34 -13
  59. package/dist/lib/node-esm/ChatContainer-EZZF7RSQ.mjs.map +7 -0
  60. package/dist/lib/node-esm/{ChatDialog-QW4JRKVO.mjs → ChatDialog-PTQLZNJU.mjs} +28 -12
  61. package/dist/lib/node-esm/ChatDialog-PTQLZNJU.mjs.map +7 -0
  62. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
  63. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
  64. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +23 -0
  65. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +7 -0
  66. package/dist/lib/node-esm/{app-graph-builder-PANCJUHV.mjs → app-graph-builder-NM3JDLQ2.mjs} +25 -36
  67. package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +7 -0
  68. package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs +13 -0
  69. package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +170 -0
  71. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
  73. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  75. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +217 -0
  77. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-QG2KT3AT.mjs +163 -0
  79. package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +7 -0
  80. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
  81. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
  82. package/dist/lib/node-esm/chunk-VH3LTD76.mjs +300 -0
  83. package/dist/lib/node-esm/chunk-VH3LTD76.mjs.map +7 -0
  84. package/dist/lib/node-esm/chunk-XD4CDA4R.mjs +20 -0
  85. package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +7 -0
  86. package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs +1975 -0
  87. package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs.map +7 -0
  88. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +156 -0
  89. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +7 -0
  90. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +23 -0
  91. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +7 -0
  92. package/dist/lib/node-esm/index.mjs +148 -62
  93. package/dist/lib/node-esm/index.mjs.map +4 -4
  94. package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs +113 -0
  95. package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +7 -0
  96. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +22 -0
  97. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +7 -0
  98. package/dist/lib/node-esm/meta.json +1 -1
  99. package/dist/lib/node-esm/{react-surface-QDQWJ7FZ.mjs → react-surface-GP3LU6DX.mjs} +25 -66
  100. package/dist/lib/node-esm/react-surface-GP3LU6DX.mjs.map +7 -0
  101. package/dist/lib/node-esm/{settings-J2EXEM5H.mjs → settings-7ZCZ6AS5.mjs} +6 -5
  102. package/dist/lib/{browser/settings-5GTTCVGD.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
  103. package/dist/lib/node-esm/state-EQS5KP6M.mjs +22 -0
  104. package/dist/lib/node-esm/state-EQS5KP6M.mjs.map +7 -0
  105. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
  106. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
  107. package/dist/lib/node-esm/types/index.mjs +7 -4
  108. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  109. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  110. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  111. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  112. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  113. package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
  114. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  115. package/dist/types/src/capabilities/capabilities.d.ts +32 -0
  116. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  117. package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
  118. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  119. package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
  120. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  121. package/dist/types/src/capabilities/index.d.ts +12 -3
  122. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  123. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  124. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  125. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  126. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  127. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  128. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  129. package/dist/types/src/capabilities/settings.d.ts +1 -1
  130. package/dist/types/src/capabilities/state.d.ts +4 -0
  131. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  132. package/dist/types/src/capabilities/toolkit.d.ts +4 -0
  133. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  134. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  135. package/dist/types/src/components/Chat/Chat.d.ts +20 -17
  136. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  137. package/dist/types/src/components/Chat/events.d.ts +5 -0
  138. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  139. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  140. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  141. package/dist/types/src/components/ChatContainer.d.ts +4 -4
  142. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  143. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  144. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  145. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  146. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  147. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  148. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  149. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
  150. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  151. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  152. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
  153. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  154. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  155. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  156. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  157. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  158. package/dist/types/src/components/ChatThread/ChatThread.d.ts +10 -7
  159. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  160. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +115 -32
  161. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  162. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  163. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  164. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  165. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  166. package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
  167. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
  168. package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
  169. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
  170. package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
  171. package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
  172. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  173. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  174. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  175. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +261 -2
  176. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  177. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -5
  178. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  179. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +261 -6
  180. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  181. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  182. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +258 -1
  183. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  184. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
  185. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
  186. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
  187. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
  188. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
  189. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
  190. package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
  191. package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
  192. package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
  193. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  194. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  195. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  196. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
  197. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
  198. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
  199. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  200. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +262 -4
  201. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  202. package/dist/types/src/components/index.d.ts +4 -1
  203. package/dist/types/src/components/index.d.ts.map +1 -1
  204. package/dist/types/src/events.d.ts +1 -1
  205. package/dist/types/src/events.d.ts.map +1 -1
  206. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  207. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  208. package/dist/types/src/execution-graph/index.d.ts +2 -0
  209. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  210. package/dist/types/src/functions/analysis.d.ts +5 -0
  211. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  212. package/dist/types/src/functions/index.d.ts +4 -0
  213. package/dist/types/src/functions/index.d.ts.map +1 -0
  214. package/dist/types/src/functions/list.d.ts +10 -0
  215. package/dist/types/src/functions/list.d.ts.map +1 -0
  216. package/dist/types/src/functions/load.d.ts +8 -0
  217. package/dist/types/src/functions/load.d.ts.map +1 -0
  218. package/dist/types/src/hooks/index.d.ts +9 -3
  219. package/dist/types/src/hooks/index.d.ts.map +1 -1
  220. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
  221. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  222. package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
  223. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  224. package/dist/types/src/hooks/useChatServices.d.ts +5 -6
  225. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  226. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
  227. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  228. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  229. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  230. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  231. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  232. package/dist/types/src/hooks/useExecutionGraph.d.ts +6 -0
  233. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  234. package/dist/types/src/hooks/useFlush.d.ts +6 -0
  235. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  236. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  237. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  238. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  239. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  240. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  241. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  242. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  243. package/dist/types/src/processor/index.d.ts +3 -0
  244. package/dist/types/src/processor/index.d.ts.map +1 -0
  245. package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
  246. package/dist/types/src/processor/presets.d.ts.map +1 -0
  247. package/dist/types/src/processor/processor.d.ts +73 -0
  248. package/dist/types/src/processor/processor.d.ts.map +1 -0
  249. package/dist/types/src/processor/processor.test.d.ts +2 -0
  250. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  251. package/dist/types/src/stories/Chat.stories.d.ts +25 -202
  252. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  253. package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
  254. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  255. package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
  256. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  257. package/dist/types/src/stories/components/ChessContainer.d.ts +4 -0
  258. package/dist/types/src/stories/components/ChessContainer.d.ts.map +1 -0
  259. package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
  260. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
  261. package/dist/types/src/stories/components/DebugCard.d.ts +8 -0
  262. package/dist/types/src/stories/components/DebugCard.d.ts.map +1 -0
  263. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  264. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  265. package/dist/types/src/stories/components/InvocationsContainer.d.ts +4 -0
  266. package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +1 -0
  267. package/dist/types/src/stories/components/LoggingContainer.d.ts +7 -0
  268. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  269. package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
  270. package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
  271. package/dist/types/src/stories/components/PromptContainer.d.ts +6 -0
  272. package/dist/types/src/stories/components/PromptContainer.d.ts.map +1 -0
  273. package/dist/types/src/stories/components/ResearchInputStack.d.ts +4 -0
  274. package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +1 -0
  275. package/dist/types/src/stories/components/ResearchOutputStack.d.ts +4 -0
  276. package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +1 -0
  277. package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
  278. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  279. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
  280. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
  281. package/dist/types/src/stories/components/TriggersContainer.d.ts +14 -0
  282. package/dist/types/src/stories/components/TriggersContainer.d.ts.map +1 -0
  283. package/dist/types/src/stories/components/index.d.ts +16 -0
  284. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  285. package/dist/types/src/stories/components/types.d.ts +7 -0
  286. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  287. package/dist/types/src/stories/testing/data.d.ts +9 -0
  288. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  289. package/dist/types/src/stories/testing/index.d.ts +3 -0
  290. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  291. package/dist/types/src/stories/testing/schema.d.ts +7 -0
  292. package/dist/types/src/stories/testing/schema.d.ts.map +1 -0
  293. package/dist/types/src/stories/testing/testing.d.ts +48 -0
  294. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  295. package/dist/types/src/testing/index.d.ts +3 -1
  296. package/dist/types/src/testing/index.d.ts.map +1 -1
  297. package/dist/types/src/testing/test-data.d.ts +14 -0
  298. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  299. package/dist/types/src/testing/test-functions.d.ts +5 -2
  300. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  301. package/dist/types/src/testing/test-generator.d.ts +7 -0
  302. package/dist/types/src/testing/test-generator.d.ts.map +1 -0
  303. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  304. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  305. package/dist/types/src/translations.d.ts +28 -12
  306. package/dist/types/src/translations.d.ts.map +1 -1
  307. package/dist/types/src/types/Assistant.d.ts +42 -0
  308. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  309. package/dist/types/src/types/AssistantAction.d.ts +107 -0
  310. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  311. package/dist/types/src/types/defs.d.ts +2 -0
  312. package/dist/types/src/types/defs.d.ts.map +1 -0
  313. package/dist/types/src/types/index.d.ts +3 -1
  314. package/dist/types/src/types/index.d.ts.map +1 -1
  315. package/dist/types/src/types/service.d.ts +6 -3
  316. package/dist/types/src/types/service.d.ts.map +1 -1
  317. package/dist/types/tsconfig.tsbuildinfo +1 -1
  318. package/package.json +108 -86
  319. package/src/AssistantPlugin.tsx +61 -17
  320. package/src/capabilities/ai-service.ts +28 -0
  321. package/src/capabilities/app-graph-builder.ts +41 -48
  322. package/src/capabilities/blueprint-definition.ts +58 -0
  323. package/src/capabilities/capabilities.ts +71 -0
  324. package/src/capabilities/compute-runtime.ts +124 -0
  325. package/src/capabilities/edge-model-resolver.ts +27 -0
  326. package/src/capabilities/index.ts +10 -0
  327. package/src/capabilities/intent-resolver.ts +45 -23
  328. package/src/capabilities/local-model-resolver.ts +32 -0
  329. package/src/capabilities/react-surface.tsx +10 -57
  330. package/src/capabilities/state.ts +20 -0
  331. package/src/capabilities/toolkit.ts +163 -0
  332. package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
  333. package/src/components/Chat/Chat.tsx +175 -174
  334. package/src/components/Chat/events.ts +7 -0
  335. package/src/components/ChatCompanion.tsx +111 -0
  336. package/src/components/ChatContainer.tsx +19 -13
  337. package/src/components/ChatDialog.tsx +18 -14
  338. package/src/components/ChatProgress/ChatProgress.tsx +68 -0
  339. package/src/components/ChatProgress/index.ts +5 -0
  340. package/src/components/ChatPrompt/ChatActions.tsx +10 -24
  341. package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
  342. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  343. package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
  344. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  345. package/src/components/ChatPrompt/index.ts +1 -1
  346. package/src/components/ChatThread/ChatThread.stories.tsx +97 -110
  347. package/src/components/ChatThread/ChatThread.tsx +65 -29
  348. package/src/components/ChatThread/Link.tsx +26 -0
  349. package/src/components/ChatThread/reducers.ts +151 -0
  350. package/src/components/ChatThread/registry.tsx +189 -0
  351. package/src/components/ChatThread/sync.test.ts +81 -0
  352. package/src/components/ChatThread/sync.ts +113 -0
  353. package/src/components/PromptSettings.tsx +1 -0
  354. package/src/components/SequenceContainer.tsx +27 -28
  355. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
  356. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  357. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +25 -12
  358. package/src/components/TemplateEditor/TemplateEditor.tsx +14 -47
  359. package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
  360. package/src/components/TemplateEditor/TemplateForm.tsx +3 -1
  361. package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
  362. package/src/components/ToolBlock/ToolBlock.tsx +152 -0
  363. package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
  364. package/src/components/ToolBlock/index.ts +6 -0
  365. package/src/components/Toolbar/Toolbar.tsx +21 -0
  366. package/src/components/Toolbar/index.ts +5 -0
  367. package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
  368. package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
  369. package/src/components/Toolbox/Toolbox.tsx +21 -51
  370. package/src/components/index.ts +3 -4
  371. package/src/events.ts +2 -2
  372. package/src/execution-graph/execution-graph.ts +211 -0
  373. package/src/execution-graph/index.ts +5 -0
  374. package/src/functions/analysis.ts +20 -0
  375. package/src/functions/index.ts +7 -0
  376. package/src/functions/list.ts +46 -0
  377. package/src/functions/load.ts +42 -0
  378. package/src/hooks/index.ts +9 -4
  379. package/src/hooks/useBlueprintRegistry.ts +80 -0
  380. package/src/hooks/useChatProcessor.ts +21 -98
  381. package/src/hooks/useChatServices.ts +29 -48
  382. package/src/hooks/useComputeRuntimeCallback.ts +25 -0
  383. package/src/hooks/useContextBinder.ts +18 -0
  384. package/src/hooks/useContextObjects.ts +58 -0
  385. package/src/hooks/useExecutionGraph.ts +20 -0
  386. package/src/hooks/useFlush.ts +35 -0
  387. package/src/hooks/useItemTypes.ts +37 -0
  388. package/src/hooks/useOnline.ts +10 -0
  389. package/src/hooks/usePresets.ts +44 -0
  390. package/src/hooks/useReferencesProvider.ts +11 -9
  391. package/src/meta.ts +1 -1
  392. package/src/processor/index.ts +6 -0
  393. package/src/{hooks → processor}/presets.ts +14 -6
  394. package/src/processor/processor.test.ts +77 -0
  395. package/src/processor/processor.ts +302 -0
  396. package/src/queue-logger.ts +10 -10
  397. package/src/stories/Chat.stories.tsx +594 -308
  398. package/src/stories/components/BlueprintContainer.tsx +34 -0
  399. package/src/stories/components/ChatContainer.tsx +74 -0
  400. package/src/stories/components/ChessContainer.tsx +17 -0
  401. package/src/stories/components/CommentsContainer.tsx +25 -0
  402. package/src/stories/components/DebugCard.tsx +61 -0
  403. package/src/stories/components/GraphContainer.tsx +119 -0
  404. package/src/stories/components/InvocationsContainer.tsx +17 -0
  405. package/src/stories/components/LoggingContainer.tsx +33 -0
  406. package/src/stories/components/MessageContainer.tsx +22 -0
  407. package/src/stories/components/PromptContainer.tsx +52 -0
  408. package/src/stories/components/ResearchInputStack.tsx +30 -0
  409. package/src/stories/components/ResearchOutputStack.tsx +29 -0
  410. package/src/stories/components/TasksContainer.tsx +49 -0
  411. package/src/stories/components/TokenManagerContainer.tsx +14 -0
  412. package/src/stories/components/TriggersContainer.tsx +75 -0
  413. package/src/stories/components/index.ts +20 -0
  414. package/src/stories/components/types.ts +11 -0
  415. package/src/stories/testing/data.ts +142 -0
  416. package/src/stories/testing/index.ts +6 -0
  417. package/src/stories/testing/schema.ts +17 -0
  418. package/src/stories/testing/testing.tsx +279 -0
  419. package/src/testing/index.ts +3 -1
  420. package/src/testing/test-data.ts +245 -0
  421. package/src/testing/test-functions.ts +8 -3
  422. package/src/testing/test-generator.ts +257 -0
  423. package/src/testing/test-sequence.ts +2 -27
  424. package/src/translations.ts +31 -12
  425. package/src/types/Assistant.ts +61 -0
  426. package/src/types/AssistantAction.ts +62 -0
  427. package/src/types/defs.ts +5 -0
  428. package/src/types/index.ts +4 -1
  429. package/src/vite-env.d.ts +30 -0
  430. package/dist/lib/browser/ChatContainer-RP3QEXYX.mjs.map +0 -7
  431. package/dist/lib/browser/ChatDialog-ZVLXFHEY.mjs.map +0 -7
  432. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  433. package/dist/lib/browser/app-graph-builder-XSEOKJLG.mjs.map +0 -7
  434. package/dist/lib/browser/chunk-63GG6U6D.mjs +0 -2226
  435. package/dist/lib/browser/chunk-63GG6U6D.mjs.map +0 -7
  436. package/dist/lib/browser/chunk-7W7LHTRH.mjs +0 -171
  437. package/dist/lib/browser/chunk-7W7LHTRH.mjs.map +0 -7
  438. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  439. package/dist/lib/browser/chunk-KFXSBNZR.mjs +0 -89
  440. package/dist/lib/browser/chunk-KFXSBNZR.mjs.map +0 -7
  441. package/dist/lib/browser/chunk-LERGF5YG.mjs +0 -108
  442. package/dist/lib/browser/chunk-LERGF5YG.mjs.map +0 -7
  443. package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs +0 -75
  444. package/dist/lib/browser/intent-resolver-MV3VSZLS.mjs.map +0 -7
  445. package/dist/lib/browser/react-surface-3GYEHQRP.mjs.map +0 -7
  446. package/dist/lib/node-esm/ChatContainer-W3W6FWV3.mjs.map +0 -7
  447. package/dist/lib/node-esm/ChatDialog-QW4JRKVO.mjs.map +0 -7
  448. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  449. package/dist/lib/node-esm/app-graph-builder-PANCJUHV.mjs.map +0 -7
  450. package/dist/lib/node-esm/chunk-BFO3KHYL.mjs +0 -2227
  451. package/dist/lib/node-esm/chunk-BFO3KHYL.mjs.map +0 -7
  452. package/dist/lib/node-esm/chunk-MS3PJARN.mjs +0 -109
  453. package/dist/lib/node-esm/chunk-MS3PJARN.mjs.map +0 -7
  454. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  455. package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs +0 -90
  456. package/dist/lib/node-esm/chunk-VIIMA3XQ.mjs.map +0 -7
  457. package/dist/lib/node-esm/chunk-Z7PUODRT.mjs +0 -172
  458. package/dist/lib/node-esm/chunk-Z7PUODRT.mjs.map +0 -7
  459. package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs +0 -76
  460. package/dist/lib/node-esm/intent-resolver-3FMC3GHC.mjs.map +0 -7
  461. package/dist/lib/node-esm/react-surface-QDQWJ7FZ.mjs.map +0 -7
  462. package/dist/types/src/capability-definitions.d.ts +0 -7
  463. package/dist/types/src/capability-definitions.d.ts.map +0 -1
  464. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  465. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  466. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
  467. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
  468. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
  469. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
  470. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  471. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  472. package/dist/types/src/hooks/chat-processor.d.ts +0 -86
  473. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  474. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  475. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  476. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  477. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  478. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  479. package/dist/types/src/parser/filter-generator.d.ts +0 -4
  480. package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
  481. package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
  482. package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
  483. package/dist/types/src/parser/index.d.ts +0 -4
  484. package/dist/types/src/parser/index.d.ts.map +0 -1
  485. package/dist/types/src/parser/query-parser.d.ts +0 -15
  486. package/dist/types/src/parser/query-parser.d.ts.map +0 -1
  487. package/dist/types/src/parser/query-parser.test.d.ts +0 -2
  488. package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
  489. package/dist/types/src/parser/types.d.ts +0 -24
  490. package/dist/types/src/parser/types.d.ts.map +0 -1
  491. package/dist/types/src/tools/function.d.ts +0 -5
  492. package/dist/types/src/tools/function.d.ts.map +0 -1
  493. package/dist/types/src/tools/index.d.ts +0 -3
  494. package/dist/types/src/tools/index.d.ts.map +0 -1
  495. package/dist/types/src/tools/openapi.d.ts +0 -10
  496. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  497. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  498. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  499. package/dist/types/src/types/schema.d.ts +0 -120
  500. package/dist/types/src/types/schema.d.ts.map +0 -1
  501. package/src/capability-definitions.ts +0 -15
  502. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  503. package/src/components/ChatThread/ChatMessage.tsx +0 -268
  504. package/src/components/ChatThread/ToolBlock.tsx +0 -121
  505. package/src/components/ChatThread/reducer.ts +0 -52
  506. package/src/hooks/chat-processor.test.ts +0 -16
  507. package/src/hooks/chat-processor.ts +0 -314
  508. package/src/hooks/useBlueprints.ts +0 -57
  509. package/src/parser/filter-generator.test.ts +0 -32
  510. package/src/parser/filter-generator.ts +0 -81
  511. package/src/parser/index.ts +0 -7
  512. package/src/parser/query-parser.test.ts +0 -139
  513. package/src/parser/query-parser.ts +0 -199
  514. package/src/parser/types.ts +0 -34
  515. package/src/shims.d.ts +0 -8
  516. package/src/tools/function.ts +0 -46
  517. package/src/tools/index.ts +0 -6
  518. package/src/tools/openapi.test.ts +0 -217
  519. package/src/tools/openapi.ts +0 -338
  520. package/src/types/schema.ts +0 -108
  521. package/src/typings.d.ts +0 -9
  522. /package/dist/lib/{node-esm/BlueprintContainer-RGTMNLNX.mjs.map → browser/BlueprintContainer-BFNN6K46.mjs.map} +0 -0
@@ -4,368 +4,654 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react-vite';
8
- import React, { useCallback, useEffect, useMemo, useState, type FC } from 'react';
9
-
10
- import { Capabilities, contributes, Events, IntentPlugin, type Plugin, SettingsPlugin } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { ContextBinder } from '@dxos/assistant';
13
- import {
14
- DESIGN_BLUEPRINT,
15
- PLANNING_BLUEPRINT,
16
- readDocument,
17
- remoteServiceEndpoints,
18
- updateDocument,
19
- } from '@dxos/assistant-testing';
20
- import { Blueprint } from '@dxos/blueprints';
21
- import { Filter, Obj, Ref } from '@dxos/echo';
22
- import { invariant } from '@dxos/invariant';
7
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
+ import { Schema } from 'effect';
9
+ import React, { type FC, useCallback } from 'react';
10
+
11
+ import { EXA_API_KEY } from '@dxos/ai/testing';
12
+ import { Capabilities, Surface, useCapabilities } from '@dxos/app-framework';
13
+ import { AiContextBinder } from '@dxos/assistant';
14
+ import { LINEAR_BLUEPRINT, RESEARCH_BLUEPRINT, ResearchDataTypes, ResearchGraph, agent } from '@dxos/assistant-testing';
15
+ import { Blueprint, Prompt } from '@dxos/blueprints';
16
+ import { Filter, Obj, Query, Ref } from '@dxos/echo';
17
+ import { FunctionTrigger, exampleFunctions, serializeFunction } from '@dxos/functions';
23
18
  import { log } from '@dxos/log';
24
- import { ChessPlugin } from '@dxos/plugin-chess';
25
- import { ClientPlugin } from '@dxos/plugin-client';
19
+ import { Board, BoardPlugin } from '@dxos/plugin-board';
20
+ import { Chess, ChessPlugin } from '@dxos/plugin-chess';
21
+ import * as chessFunctions from '@dxos/plugin-chess/functions';
26
22
  import { InboxPlugin } from '@dxos/plugin-inbox';
27
- import { MapPlugin } from '@dxos/plugin-map';
28
- import { MarkdownPlugin } from '@dxos/plugin-markdown';
29
- import { Markdown } from '@dxos/plugin-markdown/types';
30
- import { SpacePlugin } from '@dxos/plugin-space';
23
+ import { Mailbox } from '@dxos/plugin-inbox/types';
24
+ import { Map, MapPlugin } from '@dxos/plugin-map';
25
+ import { createLocationSchema } from '@dxos/plugin-map/testing';
26
+ import { Markdown, MarkdownPlugin } from '@dxos/plugin-markdown';
27
+ import { PreviewPlugin } from '@dxos/plugin-preview';
31
28
  import { TablePlugin } from '@dxos/plugin-table';
29
+ import { ThreadPlugin } from '@dxos/plugin-thread';
30
+ import { TokenManagerPlugin } from '@dxos/plugin-token-manager';
32
31
  import { TranscriptionPlugin } from '@dxos/plugin-transcription';
33
- import { Config } from '@dxos/react-client';
34
- import { createDocAccessor, useQuery, useSpace } from '@dxos/react-client/echo';
35
- import { Toolbar, useThemeContext, useTranslation } from '@dxos/react-ui';
36
- import {
37
- Editor,
38
- createBasicExtensions,
39
- createDataExtensions,
40
- createMarkdownExtensions,
41
- createThemeExtensions,
42
- outliner,
43
- } from '@dxos/react-ui-editor';
44
- import { mx } from '@dxos/react-ui-theme';
45
- import { render, withLayout, withTheme } from '@dxos/storybook-utils';
46
-
47
- import { AssistantPlugin } from '../AssistantPlugin';
48
- import { Chat, TemplateEditor, type ChatPromptProps } from '../components';
49
- import { type AiServicePreset, AiServicePresets } from '../hooks';
50
- import { useChatProcessor, useChatServices } from '../hooks';
51
- import { meta } from '../meta';
32
+ import { Transcript } from '@dxos/plugin-transcription/types';
33
+ import { useClient } from '@dxos/react-client';
34
+ import { useQuery, useSpace } from '@dxos/react-client/echo';
35
+ import { useAsyncEffect, useSignalsMemo } from '@dxos/react-ui';
36
+ import { Stack, StackItem } from '@dxos/react-ui-stack';
37
+ import { Table } from '@dxos/react-ui-table/types';
38
+ import { DataType } from '@dxos/schema';
39
+ import { render } from '@dxos/storybook-utils';
40
+ import { isNonNullable, trim } from '@dxos/util';
41
+
42
+ import { BLUEPRINT_KEY } from '../capabilities';
43
+ import { useContextBinder } from '../hooks';
44
+ import { addTestData, createTestMailbox, createTestTranscription, organizations, testTypes } from '../testing';
52
45
  import { translations } from '../translations';
53
46
  import { Assistant } from '../types';
54
47
 
55
- //
56
- // Story container
57
- //
58
-
59
- const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
60
- return (
61
- <div
62
- className={mx('grid grid-cols gap-2 m-2')}
63
- style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
64
- >
65
- {components.map((Component, index) =>
66
- Array.isArray(Component) ? (
67
- <div
68
- key={index}
69
- className='grid grid-rows gap-2 overflow-hidden'
70
- style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
71
- >
72
- {Component.map((Component, index) => (
73
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
74
- <Component />
75
- </div>
76
- ))}
77
- </div>
78
- ) : (
79
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
80
- <Component />
81
- </div>
82
- ),
83
- )}
84
- </div>
85
- );
48
+ import {
49
+ BlueprintContainer,
50
+ ChatContainer,
51
+ ChessContainer,
52
+ CommentsContainer,
53
+ type ComponentProps,
54
+ GraphContainer,
55
+ InvocationsContainer,
56
+ LoggingContainer,
57
+ MessageContainer,
58
+ PromptContainer,
59
+ ResearchInputStack,
60
+ ResearchOutputStack,
61
+ TasksContainer,
62
+ TokenManagerContainer,
63
+ TriggersContainer,
64
+ } from './components';
65
+ import { ResearchInputQueue, accessTokensFromEnv, config, getDecorators } from './testing';
66
+
67
+ const panelClassNames = 'bg-baseSurface rounded border border-separator overflow-hidden mbe-[--stack-gap] last:mbe-0';
68
+
69
+ type StoryProps = {
70
+ debug?: boolean;
71
+ deckComponents: (FC<ComponentProps> | 'surfaces')[][];
72
+ blueprints?: string[];
86
73
  };
87
74
 
88
- //
89
- // Components
90
- //
91
-
92
- const ChatContainer = () => {
93
- const { t } = useTranslation(meta.id);
75
+ const DefaultStory = ({ debug = true, deckComponents, blueprints = [] }: StoryProps) => {
76
+ const client = useClient();
94
77
  const space = useSpace();
95
78
 
96
- const [chat, setChat] = useState<Assistant.Chat>();
97
- useEffect(() => {
98
- const results = space?.db.query(Filter.type(Assistant.Chat)).runSync();
99
- if (results?.length) {
100
- setChat(results[0].object);
79
+ const blueprintsDefinitions = useCapabilities(Capabilities.BlueprintDefinition);
80
+ useAsyncEffect(async () => {
81
+ if (!space) {
82
+ return;
83
+ }
84
+ const { objects: chats = [] } = await space.db.query(Filter.type(Assistant.Chat)).run();
85
+ const chat = chats[0];
86
+ if (!chat) {
87
+ return;
101
88
  }
102
- }, [space]);
103
-
104
- // TODO(burdon): Memo preset for provider.
105
- const [online, setOnline] = useState(true);
106
- const [preset, setPreset] = useState<AiServicePreset>();
107
- const presets = useMemo(
108
- () => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
109
- [online],
110
- );
111
- useEffect(() => {
112
- setPreset(presets[0]);
113
- }, [presets]);
114
-
115
- const services = useChatServices({ space });
116
- const blueprintRegistry = useMemo(() => new Blueprint.Registry([DESIGN_BLUEPRINT, PLANNING_BLUEPRINT]), []);
117
- const processor = useChatProcessor({
118
- preset,
119
- chat,
120
- space,
121
- services,
122
- blueprintRegistry,
123
- noPluginArtifacts: true,
124
- });
125
-
126
- const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
127
- (id) => {
128
- const preset = presets.find((preset) => preset.id === id);
129
- if (preset) {
130
- setPreset(preset);
131
- }
132
- },
133
- [presets],
134
- );
135
-
136
- const handleNewChat = useCallback(() => {
137
- invariant(space);
138
- const chat = space.db.add(
139
- Obj.make(Assistant.Chat, {
140
- queue: Ref.fromDXN(space.queues.create().dxn),
141
- }),
142
- );
143
- setChat(chat);
144
- }, [space]);
145
-
146
- const handleBranchChat = useCallback(() => {}, [space]);
147
-
148
- if (!chat || !processor) {
149
- return null;
150
- }
151
-
152
- return (
153
- <Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
154
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
155
- <Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
156
- <Toolbar.IconButton
157
- disabled
158
- icon='ph--git-branch--regular'
159
- iconOnly
160
- label={t('button branch thread')}
161
- onClick={handleBranchChat}
162
- />
163
- </Toolbar.Root>
164
- <Chat.Thread />
165
- <div className='p-4'>
166
- <Chat.Prompt
167
- classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
168
- expandable
169
- online={online}
170
- presets={presets.map(({ id, model, label }) => ({ id, label: label ?? model }))}
171
- preset={preset?.id}
172
- onChangeOnline={setOnline}
173
- onChangePreset={handleChangePreset}
174
- />
175
- </div>
176
- </Chat.Root>
177
- );
178
- };
179
89
 
180
- const DocumentContainer = () => {
181
- const { themeMode } = useThemeContext();
182
- const space = useSpace();
183
- const [document] = useQuery(space, Filter.type(Markdown.Document));
184
- if (!document?.content.target) {
185
- return null;
186
- }
90
+ // Add blueprints to context.
91
+ const binder = new AiContextBinder(await chat.queue.load());
92
+ const registry = new Blueprint.Registry(blueprintsDefinitions);
93
+ const blueprintObjects = blueprints
94
+ .map((key) => {
95
+ const blueprint = registry.getByKey(key);
96
+ if (blueprint) {
97
+ return space.db.add(Obj.clone(blueprint));
98
+ }
99
+ })
100
+ .filter(isNonNullable);
101
+ await binder.bind({ blueprints: blueprintObjects.map((blueprint) => Ref.make(blueprint)) });
102
+ }, [space, blueprints, blueprintsDefinitions]);
103
+
104
+ const handleEvent = useCallback<NonNullable<ComponentProps['onEvent']>>((event) => {
105
+ log.info('event', { event });
106
+ switch (event) {
107
+ case 'reset': {
108
+ void client?.reset().then(() => {
109
+ document.location.reload();
110
+ });
111
+ break;
112
+ }
113
+ }
114
+ }, []);
187
115
 
188
- return (
189
- <>
190
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
191
- <h2>{Obj.getLabel(document)}</h2>
192
- </Toolbar.Root>
193
- <Editor
194
- id={document.id}
195
- text={document.content.target}
196
- classNames='h-full p-2 overflow-hidden'
197
- extensions={[
198
- // TODO(burdon): Create util.
199
- createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
200
- createBasicExtensions({ readOnly: false }),
201
- createMarkdownExtensions({ themeMode }),
202
- createThemeExtensions({ themeMode }),
203
- outliner(),
204
- ]}
205
- />
206
- </>
116
+ const chats = useQuery(space, Filter.type(Assistant.Chat));
117
+ const binder = useContextBinder(chats.at(-1));
118
+ const objects = useSignalsMemo(
119
+ () => binder?.objects.value.map((ref) => ref.target).filter(isNonNullable) ?? [],
120
+ [binder],
207
121
  );
208
- };
209
122
 
210
- // TODO(burdon): Show all active blueprints from context?
211
- const BlueprintContainer = () => {
212
- const space = useSpace();
213
- const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
214
- if (!blueprint?.instructions) {
123
+ if (!space) {
215
124
  return null;
216
125
  }
217
126
 
218
127
  return (
219
- <div className='flex flex-col h-full'>
220
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
221
- <h2>{Obj.getLabel(blueprint)}</h2>
222
- </Toolbar.Root>
223
- <TemplateEditor id={blueprint.id} template={blueprint.instructions} />
224
- </div>
128
+ <Stack
129
+ orientation='horizontal'
130
+ size='split'
131
+ rail={false}
132
+ itemsCount={deckComponents.length}
133
+ classNames='absolute inset-0 gap-[--stack-gap]'
134
+ >
135
+ {deckComponents.map((plankComponents, i) => {
136
+ const Components: FC<ComponentProps>[] = plankComponents.filter((item) => item !== 'surfaces');
137
+ const renderSurfaces = plankComponents.includes('surfaces');
138
+ let j = 0;
139
+ return (
140
+ <StackItem.Root order={i + 1} item={{ id: `${i}` }} key={i}>
141
+ <Stack
142
+ orientation='vertical'
143
+ size={i > 0 ? 'contain' : 'split'}
144
+ rail={false}
145
+ itemsCount={plankComponents.length + (i > 0 ? objects.length : 0)}
146
+ >
147
+ {Components.map((Component) => {
148
+ const item = (
149
+ <StackItem.Root key={j} order={j + 1} item={{ id: `${i}:${j}` }} classNames={panelClassNames}>
150
+ <Component space={space} debug={debug} onEvent={handleEvent} />
151
+ </StackItem.Root>
152
+ );
153
+ j += 1;
154
+ return item;
155
+ })}
156
+
157
+ {renderSurfaces &&
158
+ objects.map((object, index) => {
159
+ const k = index + j;
160
+ return (
161
+ <StackItem.Root key={k} order={k + 1} item={{ id: `${k}` }} classNames={panelClassNames}>
162
+ {debug && (
163
+ <div role='heading' className='flex gap-2 items-center text-xs justify-center text-subdued'>
164
+ <span>{Obj.getTypename(object)}</span>
165
+ <span>{object.id}</span>
166
+ </div>
167
+ )}
168
+ <Surface role='section' limit={1} data={{ subject: object }} />
169
+ </StackItem.Root>
170
+ );
171
+ })}
172
+ </Stack>
173
+ </StackItem.Root>
174
+ );
175
+ })}
176
+ </Stack>
225
177
  );
226
178
  };
227
179
 
228
- //
229
- // Configuration
230
- //
231
-
232
- const storybook = {
180
+ const storybook: Meta<typeof DefaultStory> = {
233
181
  title: 'plugins/plugin-assistant/Chat',
234
182
  render: render(DefaultStory),
235
- decorators: [],
236
183
  parameters: {
237
184
  translations,
238
185
  controls: { disable: true },
239
186
  },
240
- } satisfies Meta<typeof DefaultStory>;
187
+ };
241
188
 
242
189
  export default storybook;
243
190
 
244
191
  type Story = StoryObj<typeof storybook>;
245
192
 
246
193
  //
247
- // Decorators
194
+ // Stories
248
195
  //
249
196
 
250
- const remoteConfig = new Config({
251
- runtime: {
252
- services: {
253
- ai: {
254
- // TODO(burdon): 'url'?
255
- server: remoteServiceEndpoints.ai,
256
- },
257
- edge: {
258
- url: remoteServiceEndpoints.edge,
259
- },
197
+ const MARKDOWN_DOCUMENT = trim`
198
+ # Hello, world!
199
+
200
+ This is a test document that contains Markdown content. Markdown is a lightweight markup language for writing formatted text in plain text form. Its goal is to be easy to read and write in raw form, easy to convert to HTML.
201
+
202
+ Markdown’s simplicity makes it highly adaptable: it can be written in any text editor, stored in plain .md files, and rendered into HTML, PDF, or other formats with converters. Because of this portability, it’s widely used in software documentation, static site generators, technical blogging, and collaborative platforms like GitHub and Notion.
203
+
204
+ Many applications extend the core syntax with extras (e.g., tables, task lists, math notation), but the core idea remains the same—clean, minimal markup that stays readable even without rendering.
205
+ `;
206
+
207
+ const STYLE_GUIDE = trim`
208
+ # Style Guide
209
+ - Use short, simple sentences.
210
+ - Organize content with headings and bullet points.
211
+ - Avoid jargon and explain technical terms.
212
+ - Use active voice whenever possible.
213
+ - Highlight key points in bold.
214
+ - Keep paragraphs brief and focused on one idea.
215
+ - Proofread for clarity and correctness.
216
+ `;
217
+
218
+ const addSpellingMistakes = (text: string, n: number): string => {
219
+ const words = text.split(' ');
220
+ for (let i = 0; i < n; i++) {
221
+ const idx = Math.floor(Math.random() * words.length);
222
+ const word = words[idx];
223
+ const charIdx = Math.floor(Math.random() * word.length);
224
+ const typoChar = String.fromCharCode(word.charCodeAt(charIdx) + 1);
225
+ words[idx] = word.slice(0, charIdx) + typoChar + word.slice(charIdx + 1);
226
+ }
227
+
228
+ return words.join(' ');
229
+ };
230
+
231
+ export const Default: Story = {
232
+ decorators: getDecorators({
233
+ plugins: [MarkdownPlugin()],
234
+ config: config.remote,
235
+ }),
236
+ args: {
237
+ deckComponents: [[ChatContainer]],
238
+ },
239
+ };
240
+
241
+ // Test with prompt: Propose changes to my document based on the style guide.
242
+ export const WithDocument: Story = {
243
+ decorators: getDecorators({
244
+ plugins: [MarkdownPlugin(), ThreadPlugin()],
245
+ config: config.remote, // TODO(burdon): Issue making persistent.
246
+ onInit: async ({ space }) => {
247
+ space.db.add(
248
+ Markdown.makeDocument({
249
+ name: 'My Document',
250
+ content: addSpellingMistakes(MARKDOWN_DOCUMENT, 2),
251
+ }),
252
+ );
253
+ space.db.add(
254
+ Markdown.makeDocument({
255
+ name: 'Style Guide',
256
+ content: STYLE_GUIDE,
257
+ }),
258
+ );
260
259
  },
260
+ onChatCreated: async ({ space, binder }) => {
261
+ const { objects } = await space.db.query(Filter.type(Markdown.Document)).run();
262
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
263
+ },
264
+ }),
265
+ args: {
266
+ deckComponents: [[ChatContainer], ['surfaces', CommentsContainer]],
267
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/markdown'],
261
268
  },
262
- });
263
-
264
- const getDecorators = ({
265
- config,
266
- plugins = [],
267
- blueprints = [],
268
- context = false,
269
- }: {
270
- config: Config;
271
- plugins?: Plugin[];
272
- blueprints?: Blueprint.Blueprint[];
273
- context?: boolean;
274
- }) => [
275
- withPluginManager({
276
- fireEvents: [Events.SetupArtifactDefinition],
277
- plugins: [
278
- ClientPlugin({
279
- config,
280
- types: [Markdown.Document, Assistant.Chat, Blueprint.Blueprint],
281
- onClientInitialized: async (_, client) => {
282
- await client.halo.createIdentity();
283
- await client.spaces.waitUntilReady();
284
- const space = client.spaces.default;
285
- // ISSUE(burdon): Should not require this.
286
- // ERROR: invariant violation: Database was not initialized with root object.
287
- await space.waitUntilReady();
288
-
289
- const chat = space.db.add(
290
- // TODO(burdon): Assistant.makeChat()
291
- Obj.make(Assistant.Chat, {
292
- queue: Ref.fromDXN(space.queues.create().dxn),
293
- }),
294
- );
295
- const binder = new ContextBinder(await chat.queue.load());
296
- const doc = space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
297
- if (context) {
298
- await binder.bind({ objects: [Ref.make(doc)] });
299
- }
300
-
301
- for (const blueprint of blueprints) {
302
- // Clone blueprints and bind to conversation.
303
- // TODO(dmaretskyi): This should be done by Obj.clone.
304
- const { id: _id, ...data } = blueprint;
305
- const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
306
- await binder.bind({ blueprints: [Ref.make(obj)] });
307
- }
308
- },
309
- }),
310
- IntentPlugin(),
311
- SettingsPlugin(),
312
- SpacePlugin(),
313
-
314
- TranscriptionPlugin(),
315
- AssistantPlugin(),
316
-
317
- ...plugins,
318
- ],
319
- capabilities: [contributes(Capabilities.Functions, [readDocument, updateDocument])],
269
+ };
270
+
271
+ export const WithBlueprints: Story = {
272
+ decorators: getDecorators({
273
+ plugins: [InboxPlugin(), MarkdownPlugin(), TablePlugin()],
274
+ config: config.remote,
275
+ onInit: async ({ space }) => {
276
+ space.db.add(Markdown.makeDocument({ name: 'Tasks' }));
277
+ },
278
+ onChatCreated: async ({ space, binder }) => {
279
+ const { objects } = await space.db.query(Filter.type(Markdown.Document)).run();
280
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
281
+ },
320
282
  }),
321
- withTheme,
322
- withLayout({
323
- fullscreen: true,
324
- classNames: 'bg-deckSurface justify-center',
283
+ args: {
284
+ deckComponents: [[ChatContainer], [TasksContainer, BlueprintContainer]],
285
+ },
286
+ };
287
+
288
+ export const WithChess: Story = {
289
+ decorators: getDecorators({
290
+ plugins: [ChessPlugin()],
291
+ config: config.remote,
292
+ types: [Chess.Game],
293
+ onInit: async ({ space }) => {
294
+ // TODO(burdon): Add player DID (for user and assistant).
295
+ space.db.add(
296
+ Chess.makeGame({
297
+ name: 'Challenge',
298
+ pgn: [
299
+ '1. e4 e5',
300
+ '2. Nf3 Nc6',
301
+ '3. Bc4 Bc5',
302
+ '4. c3 Nf6',
303
+ '5. d4 exd4',
304
+ '6. cxd4 Bb4+',
305
+ '7. Nc3 d5',
306
+ '8. exd5 Nxd5',
307
+ '9. O-O Be6',
308
+ '10. Qb3 Na5',
309
+ '11. Qa4+ c6',
310
+ '12. Bxd5 Bxc3',
311
+ '13. Bxe6 fxe6',
312
+ '*',
313
+ ].join(' '),
314
+ }),
315
+ );
316
+ },
317
+ onChatCreated: async ({ space, binder }) => {
318
+ const { objects } = await space.db.query(Filter.type(Chess.Game)).run();
319
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
320
+ },
325
321
  }),
326
- ];
322
+ args: {
323
+ deckComponents: [[ChatContainer], ['surfaces']],
324
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/chess'],
325
+ },
326
+ };
327
327
 
328
- //
329
- // Stories
330
- //
328
+ // Test with prompt: Summarize my mailbox and write the summary in a new document.
329
+ export const WithMail: Story = {
330
+ decorators: getDecorators({
331
+ plugins: [InboxPlugin(), MarkdownPlugin(), ThreadPlugin()],
332
+ config: config.remote,
333
+ types: [Mailbox.Mailbox],
334
+ onInit: async ({ space }) => {
335
+ const queue = space.queues.create();
336
+ const messages = createTestMailbox();
337
+ await queue.append(messages);
338
+ space.db.add(Mailbox.make({ name: 'Mailbox', queue: queue.dxn }));
339
+ },
340
+ onChatCreated: async ({ space, binder }) => {
341
+ const { objects } = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
342
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
343
+ },
344
+ }),
345
+ args: {
346
+ deckComponents: [[ChatContainer], ['surfaces', MessageContainer]],
347
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox', 'dxos.org/blueprint/markdown'],
348
+ },
349
+ };
331
350
 
332
- export const Default = {
351
+ // Test with prompt: Sync my email.
352
+ export const WithGmail: Story = {
333
353
  decorators: getDecorators({
334
- config: remoteConfig,
354
+ plugins: [InboxPlugin(), TokenManagerPlugin()],
355
+ config: config.remote,
356
+ types: [Mailbox.Mailbox],
357
+ onInit: async ({ space }) => {
358
+ const queue = space.queues.create();
359
+ space.db.add(Mailbox.make({ name: 'Mailbox', queue: queue.dxn }));
360
+ },
361
+ onChatCreated: async ({ space, binder }) => {
362
+ const { objects } = await space.db.query(Filter.type(Mailbox.Mailbox)).run();
363
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
364
+ },
335
365
  }),
336
366
  args: {
337
- components: [ChatContainer],
367
+ deckComponents: [[ChatContainer], ['surfaces', MessageContainer, TokenManagerContainer]],
368
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox'],
338
369
  },
339
- } satisfies Story;
370
+ };
340
371
 
341
- export const WithDocument = {
372
+ // Test with prompt: Create 10 locations.
373
+ export const WithMap: Story = {
342
374
  decorators: getDecorators({
343
- config: remoteConfig,
344
- plugins: [MarkdownPlugin()],
375
+ plugins: [MapPlugin(), TablePlugin()],
376
+ config: config.remote,
377
+ types: [DataType.View, Map.Map, Table.Table],
378
+ onInit: async ({ space }) => {
379
+ const [schema] = await space.db.schemaRegistry.register([createLocationSchema()]);
380
+ const { view: tableView } = await Table.makeView({ name: 'Table', space, typename: schema.typename });
381
+ const { view: mapView } = await Map.makeView({
382
+ name: 'Map',
383
+ space,
384
+ typename: schema.typename,
385
+ pivotFieldName: 'location',
386
+ });
387
+ space.db.add(tableView);
388
+ space.db.add(mapView);
389
+ },
390
+ onChatCreated: async ({ space, binder }) => {
391
+ const { objects } = await space.db.query(Filter.type(DataType.View)).run();
392
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
393
+ },
394
+ }),
395
+ args: {
396
+ deckComponents: [[ChatContainer], ['surfaces']],
397
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/map'],
398
+ },
399
+ };
400
+
401
+ export const WithTrip: Story = {
402
+ decorators: getDecorators({
403
+ plugins: [MarkdownPlugin(), MapPlugin()],
404
+ config: config.remote,
405
+ types: [Map.Map],
406
+ onInit: async ({ space }) => {
407
+ // TODO(burdon): Table.
408
+ space.db.add(Map.make({ name: 'Trip' }));
409
+ space.db.add(
410
+ Markdown.makeDocument({
411
+ name: 'Itinerary',
412
+ content: trim`
413
+ # Itinerary
414
+
415
+ ## Day 1
416
+ - Visit the Sagrada Familia
417
+ - Visit the Park Güell
418
+ - Visit the Casa Batlló
419
+
420
+ ## Day 2
421
+ - Visit the Eiffel Tower
422
+ - Visit the Louvre
423
+ - Visit the Musée d'Orsay
424
+ `,
425
+ }),
426
+ );
427
+ space.db.add(
428
+ Markdown.makeDocument({
429
+ name: 'Barcelona',
430
+ content: trim`
431
+ # Barcelona
432
+
433
+ Barcelona is the capital and most populous city of Catalonia, an autonomous community in northeastern Spain.
434
+ It is located on the Mediterranean coast, on the banks of the Llobregat River, in the comarca of the Baix Llobregat.
435
+ The city is known for its rich history, vibrant culture, and stunning architecture, including the Sagrada Familia, Park Güell, and Casa Batlló.
436
+ `,
437
+ }),
438
+ );
439
+ },
440
+ onChatCreated: async ({ space, binder }) => {
441
+ const { objects } = await space.db.query(Filter.or(Filter.type(Map.Map), Filter.type(Markdown.Document))).run();
442
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
443
+ },
444
+ }),
445
+ args: {
446
+ deckComponents: [[ChatContainer], ['surfaces']],
447
+ },
448
+ };
449
+
450
+ export const WithBoard: Story = {
451
+ decorators: getDecorators({
452
+ plugins: [BoardPlugin()],
453
+ config: config.remote,
454
+ types: [Board.Board],
455
+ onInit: async ({ space }) => {
456
+ space.db.add(Board.makeBoard());
457
+ },
458
+ onChatCreated: async ({ space, binder }) => {
459
+ const { objects } = await space.db.query(Filter.type(Board.Board)).run();
460
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
461
+ },
462
+ }),
463
+ args: {
464
+ debug: true,
465
+ deckComponents: [[ChatContainer], ['surfaces']],
466
+ },
467
+ };
468
+
469
+ export const WithResearch: Story = {
470
+ decorators: getDecorators({
471
+ plugins: [MarkdownPlugin(), TablePlugin()],
472
+ config: config.persistent,
473
+ types: [...ResearchDataTypes, ResearchGraph],
474
+ accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
475
+ }),
476
+ args: {
477
+ deckComponents: [[ChatContainer], [GraphContainer, LoggingContainer]],
478
+ blueprints: [RESEARCH_BLUEPRINT.key],
479
+ },
480
+ };
481
+
482
+ export const WithSearch: Story = {
483
+ decorators: getDecorators({
484
+ config: config.remote,
485
+ types: testTypes,
486
+ onInit: async ({ space }) => {
487
+ await addTestData(space);
488
+ },
345
489
  }),
346
490
  args: {
347
- components: [ChatContainer, DocumentContainer],
491
+ deckComponents: [[ChatContainer], [GraphContainer]],
348
492
  },
349
- } satisfies Story;
493
+ };
350
494
 
351
- export const WithBlueprints = {
495
+ export const WithTranscription: Story = {
352
496
  decorators: getDecorators({
353
- config: remoteConfig,
354
- plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
355
- blueprints: [PLANNING_BLUEPRINT],
356
- context: true,
497
+ plugins: [TranscriptionPlugin(), PreviewPlugin()],
498
+ config: config.remote,
499
+ types: [Transcript.Transcript],
500
+ onInit: async ({ space }) => {
501
+ const queue = space.queues.create();
502
+ const messages = createTestTranscription();
503
+ await queue.append(messages);
504
+ space.db.add(Transcript.makeTranscript(queue.dxn));
505
+ },
506
+ onChatCreated: async ({ space, binder }) => {
507
+ const { objects } = await space.db.query(Filter.type(Transcript.Transcript)).run();
508
+ await binder.bind({ objects: objects.map((object) => Ref.make(object)) });
509
+ },
357
510
  }),
358
511
  args: {
359
- components: [ChatContainer, [DocumentContainer, BlueprintContainer]],
512
+ deckComponents: [[ChatContainer], ['surfaces']],
513
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/transcription'],
360
514
  },
361
- } satisfies Story;
362
-
363
- // export const WithArtifacts = {
364
- // decorators: getDecorators({
365
- // config: remoteConfig,
366
- // plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
367
- // }),
368
- // args: {
369
- // components: [ChatContainer],
370
- // },
371
- // } satisfies Story;
515
+ };
516
+
517
+ export const WithLinearSync: Story = {
518
+ decorators: getDecorators({
519
+ plugins: [],
520
+ config: config.remote,
521
+ types: [DataType.Task, DataType.Person, DataType.Project],
522
+ accessTokens: accessTokensFromEnv({
523
+ 'linear.app': import.meta.env.VITE_LINEAR_API_KEY,
524
+ }),
525
+ }),
526
+ args: {
527
+ deckComponents: [[ChatContainer], [GraphContainer]],
528
+ blueprints: [LINEAR_BLUEPRINT.key],
529
+ },
530
+ };
531
+
532
+ export const WithTriggers: Story = {
533
+ decorators: getDecorators({
534
+ plugins: [],
535
+ config: config.remote,
536
+ onInit: async ({ space }) => {
537
+ space.db.add(
538
+ Obj.make(FunctionTrigger, {
539
+ function: Ref.make(serializeFunction(exampleFunctions.reply)),
540
+ enabled: true,
541
+ spec: {
542
+ kind: 'timer',
543
+ cron: '*/5 * * * * *', // Every 5 seconds
544
+ },
545
+ }),
546
+ );
547
+ },
548
+ }),
549
+ args: {
550
+ deckComponents: [[ChatContainer], [TriggersContainer, InvocationsContainer]],
551
+ blueprints: [],
552
+ },
553
+ };
554
+
555
+ export const WithChessTrigger: Story = {
556
+ decorators: getDecorators({
557
+ plugins: [ChessPlugin()],
558
+ config: config.remote,
559
+ types: [Chess.Game],
560
+ onInit: async ({ space }) => {
561
+ // TODO(burdon): Add player DID (for user and assistant).
562
+ space.db.add(
563
+ Chess.makeGame({
564
+ name: 'Challenge',
565
+ pgn: [
566
+ '1. e4 e5',
567
+ '2. Nf3 Nc6',
568
+ '3. Bc4 Bc5',
569
+ '4. c3 Nf6',
570
+ '5. d4 exd4',
571
+ '6. cxd4 Bb4+',
572
+ '7. Nc3 d5',
573
+ '8. exd5 Nxd5',
574
+ '9. O-O Be6',
575
+ '10. Qb3 Na5',
576
+ '11. Qa4+ c6',
577
+ '12. Bxd5 Bxc3',
578
+ '13. Bxe6 fxe6',
579
+ '*',
580
+ ].join(' '),
581
+ }),
582
+ );
583
+
584
+ space.db.add(
585
+ Obj.make(FunctionTrigger, {
586
+ function: Ref.make(serializeFunction(chessFunctions.play)),
587
+ enabled: true,
588
+ spec: {
589
+ kind: 'subscription',
590
+ query: Query.select(Filter.type(Chess.Game)).ast,
591
+ },
592
+ input: {
593
+ id: '{{event.changedObjectId}}',
594
+ side: 'black', // NOTE: Removing it makes the bot play itself.
595
+ },
596
+ }),
597
+ );
598
+ },
599
+ }),
600
+ args: {
601
+ deckComponents: [[ChessContainer], [TriggersContainer, InvocationsContainer]],
602
+ blueprints: [],
603
+ },
604
+ };
605
+
606
+ export const WithResearchQueue: Story = {
607
+ decorators: getDecorators({
608
+ plugins: [],
609
+ config: config.local,
610
+ types: [...ResearchDataTypes, ResearchGraph, ResearchInputQueue],
611
+ accessTokens: [Obj.make(DataType.AccessToken, { source: 'exa.ai', token: EXA_API_KEY })],
612
+ onInit: async ({ space }) => {
613
+ const researchInputQueue = space.db.add(
614
+ Obj.make(ResearchInputQueue, { queue: Ref.fromDXN(space.queues.create().dxn) }),
615
+ );
616
+ const orgs = organizations.map(({ id: _, ...org }) => Obj.make(DataType.Organization, org));
617
+ await researchInputQueue.queue.target!.append(orgs);
618
+
619
+ const researchPrompt = space.db.add(
620
+ Prompt.make({
621
+ name: 'Research',
622
+ description: 'Research organization',
623
+ input: Schema.Struct({
624
+ org: Schema.Any,
625
+ }),
626
+ output: Schema.Any,
627
+
628
+ instructions: 'Research the organization provided as input.',
629
+ blueprints: [Ref.make(RESEARCH_BLUEPRINT)],
630
+ }),
631
+ );
632
+
633
+ space.db.add(
634
+ Obj.make(FunctionTrigger, {
635
+ function: Ref.make(serializeFunction(agent)),
636
+ enabled: true,
637
+ spec: {
638
+ kind: 'queue',
639
+ queue: researchInputQueue.queue.dxn.toString(),
640
+ },
641
+ input: {
642
+ prompt: Ref.make(researchPrompt),
643
+ input: '{{event.item}}',
644
+ },
645
+ }),
646
+ );
647
+ },
648
+ }),
649
+ args: {
650
+ deckComponents: [
651
+ [ResearchInputStack],
652
+ [TriggersContainer, PromptContainer, InvocationsContainer, LoggingContainer, GraphContainer],
653
+ [ResearchOutputStack],
654
+ ],
655
+ blueprints: [RESEARCH_BLUEPRINT.key],
656
+ },
657
+ };