@dxos/plugin-assistant 0.8.4-main.c1de068 → 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 (530) hide show
  1. package/dist/lib/browser/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-BFNN6K46.mjs} +11 -9
  2. package/dist/lib/browser/BlueprintContainer-BFNN6K46.mjs.map +7 -0
  3. package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs +126 -0
  4. package/dist/lib/browser/ChatCompanion-YYYCHZYV.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-G6YHR6GJ.mjs} +34 -13
  6. package/dist/lib/browser/ChatContainer-G6YHR6GJ.mjs.map +7 -0
  7. package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-HJ7VDRQO.mjs} +28 -12
  8. package/dist/lib/browser/ChatDialog-HJ7VDRQO.mjs.map +7 -0
  9. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-TF5QNXYM.mjs} +5 -17
  10. package/dist/lib/browser/SequenceContainer-TF5QNXYM.mjs.map +7 -0
  11. package/dist/lib/browser/ai-service-YC2EQPHA.mjs +22 -0
  12. package/dist/lib/browser/ai-service-YC2EQPHA.mjs.map +7 -0
  13. package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-3C43MLCD.mjs} +26 -96
  14. package/dist/lib/browser/app-graph-builder-3C43MLCD.mjs.map +7 -0
  15. package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs +12 -0
  16. package/dist/lib/browser/blueprint-definition-VHFSRTEJ.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-EZUSNS2J.mjs +19 -0
  18. package/dist/lib/browser/chunk-EZUSNS2J.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-GLWD66TA.mjs +161 -0
  20. package/dist/lib/browser/chunk-GLWD66TA.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  22. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-O4LUJEDV.mjs +20 -0
  24. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-O4LUJEDV.mjs.map} +2 -2
  25. package/dist/lib/browser/chunk-PL4O4ZJU.mjs +1974 -0
  26. package/dist/lib/browser/chunk-PL4O4ZJU.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-PPJAIE2T.mjs +299 -0
  28. package/dist/lib/browser/chunk-PPJAIE2T.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-PQI3MGDN.mjs +169 -0
  30. package/dist/lib/browser/chunk-PQI3MGDN.mjs.map +7 -0
  31. package/dist/lib/browser/chunk-R6LRGW3I.mjs +216 -0
  32. package/dist/lib/browser/chunk-R6LRGW3I.mjs.map +7 -0
  33. package/dist/lib/browser/chunk-SMIVXXAI.mjs +202 -0
  34. package/dist/lib/browser/chunk-SMIVXXAI.mjs.map +7 -0
  35. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs +155 -0
  36. package/dist/lib/browser/compute-runtime-X6IREJN3.mjs.map +7 -0
  37. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs +22 -0
  38. package/dist/lib/browser/edge-model-resolver-JNEB355N.mjs.map +7 -0
  39. package/dist/lib/browser/index.mjs +166 -68
  40. package/dist/lib/browser/index.mjs.map +4 -4
  41. package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs +112 -0
  42. package/dist/lib/browser/intent-resolver-I6M3ZDAS.mjs.map +7 -0
  43. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs +21 -0
  44. package/dist/lib/browser/local-model-resolver-EUXSRZ7X.mjs.map +7 -0
  45. package/dist/lib/browser/meta.json +1 -1
  46. package/dist/lib/browser/react-surface-WNLA2636.mjs +109 -0
  47. package/dist/lib/browser/react-surface-WNLA2636.mjs.map +7 -0
  48. package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-36V3VUMW.mjs} +6 -5
  49. package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-36V3VUMW.mjs.map} +1 -1
  50. package/dist/lib/browser/state-AINRYS5W.mjs +21 -0
  51. package/dist/lib/browser/state-AINRYS5W.mjs.map +7 -0
  52. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs +191 -0
  53. package/dist/lib/browser/toolkit-Y5OYX5PO.mjs.map +7 -0
  54. package/dist/lib/browser/types/index.mjs +7 -4
  55. package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-X4MRBKDR.mjs} +11 -9
  56. package/dist/lib/node-esm/BlueprintContainer-X4MRBKDR.mjs.map +7 -0
  57. package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs +127 -0
  58. package/dist/lib/node-esm/ChatCompanion-PUAFRIEC.mjs.map +7 -0
  59. package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-EZZF7RSQ.mjs} +34 -13
  60. package/dist/lib/node-esm/ChatContainer-EZZF7RSQ.mjs.map +7 -0
  61. package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-PTQLZNJU.mjs} +28 -12
  62. package/dist/lib/node-esm/ChatDialog-PTQLZNJU.mjs.map +7 -0
  63. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-UXOVZPZO.mjs} +5 -17
  64. package/dist/lib/node-esm/SequenceContainer-UXOVZPZO.mjs.map +7 -0
  65. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs +23 -0
  66. package/dist/lib/node-esm/ai-service-XUMZVFCK.mjs.map +7 -0
  67. package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-NM3JDLQ2.mjs} +26 -96
  68. package/dist/lib/node-esm/app-graph-builder-NM3JDLQ2.mjs.map +7 -0
  69. package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs +13 -0
  70. package/dist/lib/node-esm/blueprint-definition-4E6XTLVN.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs +170 -0
  72. package/dist/lib/node-esm/chunk-4WLFSXZG.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-7YOGZI66.mjs +203 -0
  74. package/dist/lib/node-esm/chunk-7YOGZI66.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  76. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  77. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs +217 -0
  78. package/dist/lib/node-esm/chunk-LVTG5JTW.mjs.map +7 -0
  79. package/dist/lib/node-esm/chunk-QG2KT3AT.mjs +163 -0
  80. package/dist/lib/node-esm/chunk-QG2KT3AT.mjs.map +7 -0
  81. package/dist/lib/node-esm/chunk-VFY2JG62.mjs +22 -0
  82. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-VFY2JG62.mjs.map} +2 -2
  83. package/dist/lib/node-esm/chunk-VH3LTD76.mjs +300 -0
  84. package/dist/lib/node-esm/chunk-VH3LTD76.mjs.map +7 -0
  85. package/dist/lib/node-esm/chunk-XD4CDA4R.mjs +20 -0
  86. package/dist/lib/node-esm/chunk-XD4CDA4R.mjs.map +7 -0
  87. package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs +1975 -0
  88. package/dist/lib/node-esm/chunk-ZIDP7HBI.mjs.map +7 -0
  89. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs +156 -0
  90. package/dist/lib/node-esm/compute-runtime-NRHLLTSC.mjs.map +7 -0
  91. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs +23 -0
  92. package/dist/lib/node-esm/edge-model-resolver-UE5TLLJZ.mjs.map +7 -0
  93. package/dist/lib/node-esm/index.mjs +166 -68
  94. package/dist/lib/node-esm/index.mjs.map +4 -4
  95. package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs +113 -0
  96. package/dist/lib/node-esm/intent-resolver-VIINHFMT.mjs.map +7 -0
  97. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs +22 -0
  98. package/dist/lib/node-esm/local-model-resolver-JBEFVVZA.mjs.map +7 -0
  99. package/dist/lib/node-esm/meta.json +1 -1
  100. package/dist/lib/node-esm/react-surface-GP3LU6DX.mjs +110 -0
  101. package/dist/lib/node-esm/react-surface-GP3LU6DX.mjs.map +7 -0
  102. package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-7ZCZ6AS5.mjs} +6 -5
  103. package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-7ZCZ6AS5.mjs.map} +1 -1
  104. package/dist/lib/node-esm/state-EQS5KP6M.mjs +22 -0
  105. package/dist/lib/node-esm/state-EQS5KP6M.mjs.map +7 -0
  106. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs +192 -0
  107. package/dist/lib/node-esm/toolkit-2F2OL6WB.mjs.map +7 -0
  108. package/dist/lib/node-esm/types/index.mjs +7 -4
  109. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  110. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  111. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  112. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  113. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  114. package/dist/types/src/capabilities/blueprint-definition.d.ts +7 -0
  115. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  116. package/dist/types/src/capabilities/capabilities.d.ts +32 -0
  117. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  118. package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
  119. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  120. package/dist/types/src/capabilities/edge-model-resolver.d.ts +4 -0
  121. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  122. package/dist/types/src/capabilities/index.d.ts +12 -3
  123. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  124. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  125. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  126. package/dist/types/src/capabilities/local-model-resolver.d.ts +10 -0
  127. package/dist/types/src/capabilities/local-model-resolver.d.ts.map +1 -0
  128. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  129. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  130. package/dist/types/src/capabilities/settings.d.ts +1 -1
  131. package/dist/types/src/capabilities/state.d.ts +4 -0
  132. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  133. package/dist/types/src/capabilities/toolkit.d.ts +4 -0
  134. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  135. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  136. package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
  137. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  138. package/dist/types/src/components/Chat/Chat.d.ts +20 -17
  139. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  140. package/dist/types/src/components/Chat/events.d.ts +5 -0
  141. package/dist/types/src/components/Chat/events.d.ts.map +1 -1
  142. package/dist/types/src/components/ChatCompanion.d.ts +13 -0
  143. package/dist/types/src/components/ChatCompanion.d.ts.map +1 -0
  144. package/dist/types/src/components/ChatContainer.d.ts +4 -4
  145. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  146. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  147. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts +7 -0
  148. package/dist/types/src/components/ChatProgress/ChatProgress.d.ts.map +1 -0
  149. package/dist/types/src/components/ChatProgress/index.d.ts +2 -0
  150. package/dist/types/src/components/ChatProgress/index.d.ts.map +1 -0
  151. package/dist/types/src/components/ChatPrompt/ChatActions.d.ts.map +1 -1
  152. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +20 -0
  153. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  154. package/dist/types/src/components/ChatPrompt/ChatPresets.d.ts.map +1 -1
  155. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +4 -5
  156. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  157. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts +6 -4
  158. package/dist/types/src/components/ChatPrompt/ChatStatusIndicator.d.ts.map +1 -1
  159. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  160. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  161. package/dist/types/src/components/ChatThread/ChatThread.d.ts +10 -7
  162. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  163. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +115 -74
  164. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  165. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  166. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  167. package/dist/types/src/components/ChatThread/reducers.d.ts +40 -0
  168. package/dist/types/src/components/ChatThread/reducers.d.ts.map +1 -0
  169. package/dist/types/src/components/ChatThread/registry.d.ts +11 -0
  170. package/dist/types/src/components/ChatThread/registry.d.ts.map +1 -0
  171. package/dist/types/src/components/ChatThread/sync.d.ts +36 -0
  172. package/dist/types/src/components/ChatThread/sync.d.ts.map +1 -0
  173. package/dist/types/src/components/ChatThread/sync.test.d.ts +2 -0
  174. package/dist/types/src/components/ChatThread/sync.test.d.ts.map +1 -0
  175. package/dist/types/src/components/PromptSettings.d.ts.map +1 -1
  176. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  177. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  178. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +261 -2
  179. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  180. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -6
  181. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  182. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +261 -6
  183. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  184. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
  185. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  186. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +258 -1
  187. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  188. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts +12 -0
  189. package/dist/types/src/components/TemplateEditor/handlebars-extension.d.ts.map +1 -0
  190. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts +19 -0
  191. package/dist/types/src/components/ToolBlock/ToolBlock.d.ts.map +1 -0
  192. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts +2 -0
  193. package/dist/types/src/components/ToolBlock/ToolBlockWidget.d.ts.map +1 -0
  194. package/dist/types/src/components/ToolBlock/index.d.ts +3 -0
  195. package/dist/types/src/components/ToolBlock/index.d.ts.map +1 -0
  196. package/dist/types/src/components/Toolbar/Toolbar.d.ts +5 -0
  197. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -0
  198. package/dist/types/src/components/Toolbar/index.d.ts +2 -0
  199. package/dist/types/src/components/Toolbar/index.d.ts.map +1 -0
  200. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts +11 -0
  201. package/dist/types/src/components/Toolbar/useChatToolbarActions.d.ts.map +1 -0
  202. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -9
  203. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  204. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +262 -4
  205. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  206. package/dist/types/src/components/index.d.ts +5 -2
  207. package/dist/types/src/components/index.d.ts.map +1 -1
  208. package/dist/types/src/events.d.ts +1 -1
  209. package/dist/types/src/events.d.ts.map +1 -1
  210. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  211. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  212. package/dist/types/src/execution-graph/index.d.ts +2 -0
  213. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  214. package/dist/types/src/functions/analysis.d.ts +5 -0
  215. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  216. package/dist/types/src/functions/index.d.ts +4 -0
  217. package/dist/types/src/functions/index.d.ts.map +1 -0
  218. package/dist/types/src/functions/list.d.ts +10 -0
  219. package/dist/types/src/functions/list.d.ts.map +1 -0
  220. package/dist/types/src/functions/load.d.ts +8 -0
  221. package/dist/types/src/functions/load.d.ts.map +1 -0
  222. package/dist/types/src/hooks/index.d.ts +9 -3
  223. package/dist/types/src/hooks/index.d.ts.map +1 -1
  224. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +24 -0
  225. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  226. package/dist/types/src/hooks/useChatProcessor.d.ts +8 -21
  227. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  228. package/dist/types/src/hooks/useChatServices.d.ts +5 -6
  229. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  230. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
  231. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  232. package/dist/types/src/hooks/useContextBinder.d.ts +4 -0
  233. package/dist/types/src/hooks/useContextBinder.d.ts.map +1 -0
  234. package/dist/types/src/hooks/useContextObjects.d.ts +15 -0
  235. package/dist/types/src/hooks/useContextObjects.d.ts.map +1 -0
  236. package/dist/types/src/hooks/useExecutionGraph.d.ts +6 -0
  237. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  238. package/dist/types/src/hooks/useFlush.d.ts +6 -0
  239. package/dist/types/src/hooks/useFlush.d.ts.map +1 -0
  240. package/dist/types/src/hooks/useItemTypes.d.ts +4 -0
  241. package/dist/types/src/hooks/useItemTypes.d.ts.map +1 -0
  242. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  243. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  244. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  245. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  246. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  247. package/dist/types/src/processor/index.d.ts +3 -0
  248. package/dist/types/src/processor/index.d.ts.map +1 -0
  249. package/dist/types/src/{hooks → processor}/presets.d.ts +2 -2
  250. package/dist/types/src/processor/presets.d.ts.map +1 -0
  251. package/dist/types/src/processor/processor.d.ts +73 -0
  252. package/dist/types/src/processor/processor.d.ts.map +1 -0
  253. package/dist/types/src/processor/processor.test.d.ts +2 -0
  254. package/dist/types/src/processor/processor.test.d.ts.map +1 -0
  255. package/dist/types/src/stories/Chat.stories.d.ts +26 -245
  256. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  257. package/dist/types/src/stories/components/BlueprintContainer.d.ts +4 -0
  258. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  259. package/dist/types/src/stories/components/ChatContainer.d.ts +4 -0
  260. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  261. package/dist/types/src/stories/components/ChessContainer.d.ts +4 -0
  262. package/dist/types/src/stories/components/ChessContainer.d.ts.map +1 -0
  263. package/dist/types/src/stories/components/CommentsContainer.d.ts +4 -0
  264. package/dist/types/src/stories/components/CommentsContainer.d.ts.map +1 -0
  265. package/dist/types/src/stories/components/DebugCard.d.ts +8 -0
  266. package/dist/types/src/stories/components/DebugCard.d.ts.map +1 -0
  267. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  268. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  269. package/dist/types/src/stories/components/InvocationsContainer.d.ts +4 -0
  270. package/dist/types/src/stories/components/InvocationsContainer.d.ts.map +1 -0
  271. package/dist/types/src/stories/components/LoggingContainer.d.ts +7 -0
  272. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  273. package/dist/types/src/stories/components/MessageContainer.d.ts +4 -0
  274. package/dist/types/src/stories/components/MessageContainer.d.ts.map +1 -0
  275. package/dist/types/src/stories/components/PromptContainer.d.ts +6 -0
  276. package/dist/types/src/stories/components/PromptContainer.d.ts.map +1 -0
  277. package/dist/types/src/stories/components/ResearchInputStack.d.ts +4 -0
  278. package/dist/types/src/stories/components/ResearchInputStack.d.ts.map +1 -0
  279. package/dist/types/src/stories/components/ResearchOutputStack.d.ts +4 -0
  280. package/dist/types/src/stories/components/ResearchOutputStack.d.ts.map +1 -0
  281. package/dist/types/src/stories/components/TasksContainer.d.ts +4 -0
  282. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  283. package/dist/types/src/stories/components/TokenManagerContainer.d.ts +3 -0
  284. package/dist/types/src/stories/components/TokenManagerContainer.d.ts.map +1 -0
  285. package/dist/types/src/stories/components/TriggersContainer.d.ts +14 -0
  286. package/dist/types/src/stories/components/TriggersContainer.d.ts.map +1 -0
  287. package/dist/types/src/stories/components/index.d.ts +16 -0
  288. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  289. package/dist/types/src/stories/components/types.d.ts +7 -0
  290. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  291. package/dist/types/src/stories/testing/data.d.ts +9 -0
  292. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  293. package/dist/types/src/stories/testing/index.d.ts +3 -0
  294. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  295. package/dist/types/src/stories/testing/schema.d.ts +7 -0
  296. package/dist/types/src/stories/testing/schema.d.ts.map +1 -0
  297. package/dist/types/src/stories/testing/testing.d.ts +48 -0
  298. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  299. package/dist/types/src/testing/index.d.ts +3 -1
  300. package/dist/types/src/testing/index.d.ts.map +1 -1
  301. package/dist/types/src/testing/test-data.d.ts +14 -0
  302. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  303. package/dist/types/src/testing/test-functions.d.ts +5 -2
  304. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  305. package/dist/types/src/testing/test-generator.d.ts +7 -0
  306. package/dist/types/src/testing/test-generator.d.ts.map +1 -0
  307. package/dist/types/src/testing/test-sequence.d.ts +0 -4
  308. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  309. package/dist/types/src/translations.d.ts +29 -22
  310. package/dist/types/src/translations.d.ts.map +1 -1
  311. package/dist/types/src/types/Assistant.d.ts +42 -0
  312. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  313. package/dist/types/src/types/AssistantAction.d.ts +107 -0
  314. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  315. package/dist/types/src/types/defs.d.ts +2 -0
  316. package/dist/types/src/types/defs.d.ts.map +1 -0
  317. package/dist/types/src/types/index.d.ts +3 -1
  318. package/dist/types/src/types/index.d.ts.map +1 -1
  319. package/dist/types/src/types/service.d.ts +6 -3
  320. package/dist/types/src/types/service.d.ts.map +1 -1
  321. package/dist/types/tsconfig.tsbuildinfo +1 -1
  322. package/package.json +106 -82
  323. package/src/AssistantPlugin.tsx +82 -12
  324. package/src/capabilities/ai-service.ts +28 -0
  325. package/src/capabilities/app-graph-builder.ts +43 -134
  326. package/src/capabilities/blueprint-definition.ts +58 -0
  327. package/src/capabilities/capabilities.ts +71 -0
  328. package/src/capabilities/compute-runtime.ts +124 -0
  329. package/src/capabilities/edge-model-resolver.ts +27 -0
  330. package/src/capabilities/index.ts +10 -0
  331. package/src/capabilities/intent-resolver.ts +50 -14
  332. package/src/capabilities/local-model-resolver.ts +32 -0
  333. package/src/capabilities/react-surface.tsx +17 -64
  334. package/src/capabilities/state.ts +20 -0
  335. package/src/capabilities/toolkit.ts +163 -0
  336. package/src/components/AssistantSettings/AssistantSettings.tsx +83 -76
  337. package/src/components/BlueprintContainer.tsx +24 -0
  338. package/src/components/Chat/Chat.tsx +175 -174
  339. package/src/components/Chat/events.ts +7 -0
  340. package/src/components/ChatCompanion.tsx +111 -0
  341. package/src/components/ChatContainer.tsx +19 -13
  342. package/src/components/ChatDialog.tsx +18 -14
  343. package/src/components/ChatProgress/ChatProgress.tsx +68 -0
  344. package/src/components/ChatProgress/index.ts +5 -0
  345. package/src/components/ChatPrompt/ChatActions.tsx +10 -24
  346. package/src/components/ChatPrompt/ChatOptions.tsx +233 -0
  347. package/src/components/ChatPrompt/ChatPresets.tsx +1 -0
  348. package/src/components/ChatPrompt/ChatReferences.tsx +31 -36
  349. package/src/components/ChatPrompt/ChatStatusIndicator.tsx +25 -22
  350. package/src/components/ChatPrompt/index.ts +1 -1
  351. package/src/components/ChatThread/ChatThread.stories.tsx +97 -110
  352. package/src/components/ChatThread/ChatThread.tsx +65 -29
  353. package/src/components/ChatThread/Link.tsx +26 -0
  354. package/src/components/ChatThread/reducers.ts +151 -0
  355. package/src/components/ChatThread/registry.tsx +189 -0
  356. package/src/components/ChatThread/sync.test.ts +81 -0
  357. package/src/components/ChatThread/sync.ts +113 -0
  358. package/src/components/PromptSettings.tsx +1 -0
  359. package/src/components/SequenceContainer.tsx +27 -28
  360. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +5 -4
  361. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  362. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +27 -14
  363. package/src/components/TemplateEditor/TemplateEditor.tsx +20 -51
  364. package/src/components/TemplateEditor/TemplateForm.stories.tsx +15 -8
  365. package/src/components/TemplateEditor/TemplateForm.tsx +6 -3
  366. package/src/components/TemplateEditor/handlebars-extension.ts +165 -0
  367. package/src/components/ToolBlock/ToolBlock.tsx +152 -0
  368. package/src/components/ToolBlock/ToolBlockWidget.tsx +5 -0
  369. package/src/components/ToolBlock/index.ts +6 -0
  370. package/src/components/Toolbar/Toolbar.tsx +21 -0
  371. package/src/components/Toolbar/index.ts +5 -0
  372. package/src/components/Toolbar/useChatToolbarActions.ts +126 -0
  373. package/src/components/Toolbox/Toolbox.stories.tsx +10 -16
  374. package/src/components/Toolbox/Toolbox.tsx +21 -51
  375. package/src/components/index.ts +4 -5
  376. package/src/events.ts +2 -2
  377. package/src/execution-graph/execution-graph.ts +211 -0
  378. package/src/execution-graph/index.ts +5 -0
  379. package/src/functions/analysis.ts +20 -0
  380. package/src/functions/index.ts +7 -0
  381. package/src/functions/list.ts +46 -0
  382. package/src/functions/load.ts +42 -0
  383. package/src/hooks/index.ts +9 -4
  384. package/src/hooks/useBlueprintRegistry.ts +80 -0
  385. package/src/hooks/useChatProcessor.ts +21 -98
  386. package/src/hooks/useChatServices.ts +28 -71
  387. package/src/hooks/useComputeRuntimeCallback.ts +25 -0
  388. package/src/hooks/useContextBinder.ts +18 -0
  389. package/src/hooks/useContextObjects.ts +58 -0
  390. package/src/hooks/useExecutionGraph.ts +20 -0
  391. package/src/hooks/useFlush.ts +35 -0
  392. package/src/hooks/useItemTypes.ts +37 -0
  393. package/src/hooks/useOnline.ts +10 -0
  394. package/src/hooks/usePresets.ts +44 -0
  395. package/src/hooks/useReferencesProvider.ts +11 -9
  396. package/src/meta.ts +1 -1
  397. package/src/processor/index.ts +6 -0
  398. package/src/{hooks → processor}/presets.ts +14 -6
  399. package/src/processor/processor.test.ts +77 -0
  400. package/src/processor/processor.ts +302 -0
  401. package/src/queue-logger.ts +10 -10
  402. package/src/stories/Chat.stories.tsx +594 -315
  403. package/src/stories/components/BlueprintContainer.tsx +34 -0
  404. package/src/stories/components/ChatContainer.tsx +74 -0
  405. package/src/stories/components/ChessContainer.tsx +17 -0
  406. package/src/stories/components/CommentsContainer.tsx +25 -0
  407. package/src/stories/components/DebugCard.tsx +61 -0
  408. package/src/stories/components/GraphContainer.tsx +119 -0
  409. package/src/stories/components/InvocationsContainer.tsx +17 -0
  410. package/src/stories/components/LoggingContainer.tsx +33 -0
  411. package/src/stories/components/MessageContainer.tsx +22 -0
  412. package/src/stories/components/PromptContainer.tsx +52 -0
  413. package/src/stories/components/ResearchInputStack.tsx +30 -0
  414. package/src/stories/components/ResearchOutputStack.tsx +29 -0
  415. package/src/stories/components/TasksContainer.tsx +49 -0
  416. package/src/stories/components/TokenManagerContainer.tsx +14 -0
  417. package/src/stories/components/TriggersContainer.tsx +75 -0
  418. package/src/stories/components/index.ts +20 -0
  419. package/src/stories/components/types.ts +11 -0
  420. package/src/stories/testing/data.ts +142 -0
  421. package/src/stories/testing/index.ts +6 -0
  422. package/src/stories/testing/schema.ts +17 -0
  423. package/src/stories/testing/testing.tsx +279 -0
  424. package/src/testing/index.ts +3 -1
  425. package/src/testing/test-data.ts +245 -0
  426. package/src/testing/test-functions.ts +8 -3
  427. package/src/testing/test-generator.ts +257 -0
  428. package/src/testing/test-sequence.ts +2 -27
  429. package/src/translations.ts +32 -22
  430. package/src/types/Assistant.ts +61 -0
  431. package/src/types/AssistantAction.ts +62 -0
  432. package/src/types/defs.ts +5 -0
  433. package/src/types/index.ts +4 -1
  434. package/src/vite-env.d.ts +30 -0
  435. package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
  436. package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
  437. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  438. package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
  439. package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
  440. package/dist/lib/browser/chunk-AEAEKWOC.mjs +0 -98
  441. package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
  442. package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
  443. package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
  444. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  445. package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
  446. package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
  447. package/dist/lib/browser/chunk-OWY4CUQY.mjs +0 -2245
  448. package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
  449. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs +0 -60
  450. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
  451. package/dist/lib/browser/react-surface-66VY37YQ.mjs +0 -150
  452. package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
  453. package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
  454. package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
  455. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  456. package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
  457. package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
  458. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs +0 -99
  459. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
  460. package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
  461. package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
  462. package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
  463. package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
  464. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  465. package/dist/lib/node-esm/chunk-SENTQAEO.mjs +0 -2246
  466. package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
  467. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs +0 -61
  468. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
  469. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs +0 -151
  470. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
  471. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  472. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  473. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +0 -17
  474. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +0 -1
  475. package/dist/types/src/components/ChatThread/ToolBlock.d.ts +0 -19
  476. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +0 -1
  477. package/dist/types/src/components/ChatThread/reducer.d.ts +0 -12
  478. package/dist/types/src/components/ChatThread/reducer.d.ts.map +0 -1
  479. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  480. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  481. package/dist/types/src/hooks/chat-processor.d.ts +0 -86
  482. package/dist/types/src/hooks/chat-processor.d.ts.map +0 -1
  483. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  484. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  485. package/dist/types/src/hooks/presets.d.ts.map +0 -1
  486. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  487. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  488. package/dist/types/src/parser/filter-generator.d.ts +0 -4
  489. package/dist/types/src/parser/filter-generator.d.ts.map +0 -1
  490. package/dist/types/src/parser/filter-generator.test.d.ts +0 -2
  491. package/dist/types/src/parser/filter-generator.test.d.ts.map +0 -1
  492. package/dist/types/src/parser/index.d.ts +0 -4
  493. package/dist/types/src/parser/index.d.ts.map +0 -1
  494. package/dist/types/src/parser/query-parser.d.ts +0 -15
  495. package/dist/types/src/parser/query-parser.d.ts.map +0 -1
  496. package/dist/types/src/parser/query-parser.test.d.ts +0 -2
  497. package/dist/types/src/parser/query-parser.test.d.ts.map +0 -1
  498. package/dist/types/src/parser/types.d.ts +0 -24
  499. package/dist/types/src/parser/types.d.ts.map +0 -1
  500. package/dist/types/src/tools/function.d.ts +0 -5
  501. package/dist/types/src/tools/function.d.ts.map +0 -1
  502. package/dist/types/src/tools/index.d.ts +0 -3
  503. package/dist/types/src/tools/index.d.ts.map +0 -1
  504. package/dist/types/src/tools/openapi.d.ts +0 -10
  505. package/dist/types/src/tools/openapi.d.ts.map +0 -1
  506. package/dist/types/src/tools/openapi.test.d.ts +0 -2
  507. package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
  508. package/dist/types/src/types/schema.d.ts +0 -88
  509. package/dist/types/src/types/schema.d.ts.map +0 -1
  510. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  511. package/src/components/ChatThread/ChatMessage.tsx +0 -268
  512. package/src/components/ChatThread/ToolBlock.tsx +0 -121
  513. package/src/components/ChatThread/reducer.ts +0 -52
  514. package/src/components/TemplateContainer.tsx +0 -24
  515. package/src/hooks/chat-processor.test.ts +0 -16
  516. package/src/hooks/chat-processor.ts +0 -314
  517. package/src/hooks/useBlueprints.ts +0 -57
  518. package/src/parser/filter-generator.test.ts +0 -32
  519. package/src/parser/filter-generator.ts +0 -81
  520. package/src/parser/index.ts +0 -7
  521. package/src/parser/query-parser.test.ts +0 -139
  522. package/src/parser/query-parser.ts +0 -199
  523. package/src/parser/types.ts +0 -34
  524. package/src/shims.d.ts +0 -8
  525. package/src/tools/function.ts +0 -46
  526. package/src/tools/index.ts +0 -6
  527. package/src/tools/openapi.test.ts +0 -217
  528. package/src/tools/openapi.ts +0 -338
  529. package/src/types/schema.ts +0 -95
  530. package/src/typings.d.ts +0 -9
@@ -4,375 +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
- TASK_BLUEPRINT,
16
- readDocument,
17
- remoteServiceEndpoints,
18
- writeDocument,
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 { DocumentType } 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';
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';
45
38
  import { DataType } from '@dxos/schema';
46
- import { render, withLayout, withTheme } from '@dxos/storybook-utils';
39
+ import { render } from '@dxos/storybook-utils';
40
+ import { isNonNullable, trim } from '@dxos/util';
47
41
 
48
- import { AssistantPlugin } from '../AssistantPlugin';
49
- import { Chat, TemplateEditor, type ChatPromptProps } from '../components';
50
- import { type AiServicePreset, AiServicePresets } from '../hooks';
51
- import { useChatProcessor, useChatServices } from '../hooks';
52
- import { meta as AssistantMeta } from '../meta';
42
+ import { BLUEPRINT_KEY } from '../capabilities';
43
+ import { useContextBinder } from '../hooks';
44
+ import { addTestData, createTestMailbox, createTestTranscription, organizations, testTypes } from '../testing';
53
45
  import { translations } from '../translations';
54
46
  import { Assistant } from '../types';
55
47
 
56
- //
57
- // Story container
58
- //
59
-
60
- const DefaultStory = ({ components }: { components: (FC | FC[])[] }) => {
61
- return (
62
- <div
63
- className={mx('grid grid-cols gap-2 m-2')}
64
- style={{ gridTemplateColumns: `repeat(${components.length}, minmax(0, 40rem))` }}
65
- >
66
- {components.map((Component, index) =>
67
- Array.isArray(Component) ? (
68
- <div
69
- key={index}
70
- className='grid grid-rows gap-2 overflow-hidden'
71
- style={{ gridTemplateRows: `repeat(${Component.length}, 1fr)` }}
72
- >
73
- {Component.map((Component, index) => (
74
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
75
- <Component />
76
- </div>
77
- ))}
78
- </div>
79
- ) : (
80
- <div key={index} className='flex flex-col overflow-hidden bg-baseSurface border border-separator'>
81
- <Component />
82
- </div>
83
- ),
84
- )}
85
- </div>
86
- );
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[];
87
73
  };
88
74
 
89
- //
90
- // Components
91
- //
92
-
93
- const ChatContainer = () => {
94
- const { t } = useTranslation(AssistantMeta.id);
75
+ const DefaultStory = ({ debug = true, deckComponents, blueprints = [] }: StoryProps) => {
76
+ const client = useClient();
95
77
  const space = useSpace();
96
78
 
97
- const [chat, setChat] = useState<Assistant.Chat>();
98
- useEffect(() => {
99
- const results = space?.db.query(Filter.type(Assistant.Chat)).runSync();
100
- if (results?.length) {
101
- 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;
102
88
  }
103
- }, [space]);
104
-
105
- // TODO(burdon): Memo preset for provider.
106
- const [online, setOnline] = useState(true);
107
- const [preset, setPreset] = useState<AiServicePreset>();
108
- const presets = useMemo(
109
- () => AiServicePresets.filter((preset) => online === (preset.provider === 'dxos-remote')),
110
- [online],
111
- );
112
- useEffect(() => {
113
- setPreset(presets[0]);
114
- }, [presets]);
115
-
116
- const services = useChatServices({ space });
117
- const blueprintRegistry = useMemo(() => new Blueprint.Registry([DESIGN_BLUEPRINT, TASK_BLUEPRINT]), []);
118
- const processor = useChatProcessor({
119
- preset,
120
- chat,
121
- space,
122
- services,
123
- blueprintRegistry,
124
- noPluginArtifacts: true,
125
- });
126
-
127
- const handleChangePreset = useCallback<NonNullable<ChatPromptProps['onChangePreset']>>(
128
- (id) => {
129
- const preset = presets.find((preset) => preset.id === id);
130
- if (preset) {
131
- setPreset(preset);
132
- }
133
- },
134
- [presets],
135
- );
136
-
137
- const handleNewChat = useCallback(() => {
138
- invariant(space);
139
- const chat = space.db.add(
140
- Obj.make(Assistant.Chat, {
141
- queue: Ref.fromDXN(space.queues.create().dxn),
142
- }),
143
- );
144
- setChat(chat);
145
- }, [space]);
146
-
147
- const handleBranchChat = useCallback(() => {}, [space]);
148
-
149
- if (!chat || !processor) {
150
- return null;
151
- }
152
-
153
- return (
154
- <Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
155
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
156
- <Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
157
- <Toolbar.IconButton
158
- disabled
159
- icon='ph--git-branch--regular'
160
- iconOnly
161
- label={t('button branch thread')}
162
- onClick={handleBranchChat}
163
- />
164
- </Toolbar.Root>
165
- <Chat.Thread />
166
- <div className='p-4'>
167
- <Chat.Prompt
168
- classNames='p-2 border border-subduedSeparator rounded focus-within:outline focus-within:border-transparent outline-primary-500'
169
- expandable
170
- online={online}
171
- presets={presets.map(({ id, model, label }) => ({ id, label: label ?? model }))}
172
- preset={preset?.id}
173
- onChangeOnline={setOnline}
174
- onChangePreset={handleChangePreset}
175
- />
176
- </div>
177
- </Chat.Root>
178
- );
179
- };
180
89
 
181
- const DocumentContainer = () => {
182
- const { themeMode } = useThemeContext();
183
- const space = useSpace();
184
- const [document] = useQuery(space, Filter.type(DocumentType));
185
- if (!document?.content.target) {
186
- return null;
187
- }
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
+ }, []);
188
115
 
189
- return (
190
- <>
191
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
192
- <h2>{Obj.getLabel(document)}</h2>
193
- </Toolbar.Root>
194
- <Editor
195
- id={document.id}
196
- text={document.content.target}
197
- classNames='h-full p-2 overflow-hidden'
198
- extensions={[
199
- // TODO(burdon): Create util.
200
- createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
201
- createBasicExtensions({ readOnly: false }),
202
- createMarkdownExtensions({ themeMode }),
203
- createThemeExtensions({ themeMode }),
204
- outliner(),
205
- ]}
206
- />
207
- </>
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],
208
121
  );
209
- };
210
122
 
211
- // TODO(burdon): Show all active blueprints from context?
212
- const BlueprintContainer = () => {
213
- const space = useSpace();
214
- const [blueprint] = useQuery(space, Filter.type(Blueprint.Blueprint));
215
- if (!blueprint?.instructions.target) {
123
+ if (!space) {
216
124
  return null;
217
125
  }
218
126
 
219
127
  return (
220
- <div className='flex flex-col h-full'>
221
- <Toolbar.Root classNames='border-b border-subduedSeparator'>
222
- <h2>{Obj.getLabel(blueprint)}</h2>
223
- </Toolbar.Root>
224
- <TemplateEditor template={blueprint.instructions.target} />
225
- </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>
226
177
  );
227
178
  };
228
179
 
229
- //
230
- // Configuration
231
- //
232
-
233
- const meta = {
180
+ const storybook: Meta<typeof DefaultStory> = {
234
181
  title: 'plugins/plugin-assistant/Chat',
235
182
  render: render(DefaultStory),
236
- decorators: [],
237
183
  parameters: {
238
184
  translations,
239
185
  controls: { disable: true },
240
186
  },
241
- } satisfies Meta<typeof DefaultStory>;
187
+ };
242
188
 
243
- export default meta;
189
+ export default storybook;
244
190
 
245
- type Story = StoryObj<typeof meta>;
191
+ type Story = StoryObj<typeof storybook>;
246
192
 
247
193
  //
248
- // Decorators
194
+ // Stories
249
195
  //
250
196
 
251
- const remoteConfig = new Config({
252
- runtime: {
253
- services: {
254
- ai: {
255
- // TODO(burdon): 'url'?
256
- server: remoteServiceEndpoints.ai,
257
- },
258
- edge: {
259
- url: remoteServiceEndpoints.edge,
260
- },
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
+ );
261
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'],
262
268
  },
263
- });
264
-
265
- const getDecorators = ({
266
- config,
267
- plugins = [],
268
- blueprints = [],
269
- context = false,
270
- }: {
271
- config: Config;
272
- plugins?: Plugin[];
273
- blueprints?: Blueprint.Blueprint[];
274
- context?: boolean;
275
- }) => [
276
- withPluginManager({
277
- fireEvents: [Events.SetupArtifactDefinition],
278
- plugins: [
279
- ClientPlugin({
280
- config,
281
- types: [Assistant.Chat, DocumentType, Blueprint.Blueprint],
282
- onClientInitialized: async (_, client) => {
283
- await client.halo.createIdentity();
284
- await client.spaces.waitUntilReady();
285
- const space = client.spaces.default;
286
- // ISSUE(burdon): Should not require this.
287
- // ERROR: invariant violation: Database was not initialized with root object.
288
- await space.waitUntilReady();
289
-
290
- // TODO(burdon): Remove need for this boilerplate. Namespace for types?
291
- const chat = space.db.add(
292
- Obj.make(Assistant.Chat, {
293
- queue: Ref.fromDXN(space.queues.create().dxn),
294
- }),
295
- );
296
- const binder = new ContextBinder(await chat.queue.load());
297
-
298
- const doc = space.db.add(
299
- Obj.make(DocumentType, {
300
- name: 'Tasks',
301
- content: Ref.make(Obj.make(DataType.Text, { content: '' })),
302
- }),
303
- );
304
- if (context) {
305
- await binder.bind({ objects: [Ref.make(doc)] });
306
- }
307
-
308
- for (const blueprint of blueprints) {
309
- // Clone blueprints and bind to conversation.
310
- // TODO(dmaretskyi): This should be done by Obj.clone.
311
- const { id: _id, ...data } = blueprint;
312
- const obj = space.db.add(Obj.make(Blueprint.Blueprint, data));
313
- await binder.bind({ blueprints: [Ref.make(obj)] });
314
- }
315
- },
316
- }),
317
- IntentPlugin(),
318
- SettingsPlugin(),
319
- SpacePlugin(),
320
-
321
- TranscriptionPlugin(),
322
- AssistantPlugin(),
323
-
324
- ...plugins,
325
- ],
326
- capabilities: [contributes(Capabilities.Functions, [readDocument, writeDocument])],
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
+ },
327
282
  }),
328
- withTheme,
329
- withLayout({
330
- fullscreen: true,
331
- 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
+ },
332
321
  }),
333
- ];
322
+ args: {
323
+ deckComponents: [[ChatContainer], ['surfaces']],
324
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/chess'],
325
+ },
326
+ };
334
327
 
335
- //
336
- // Stories
337
- //
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
+ };
338
350
 
339
- export const Default = {
351
+ // Test with prompt: Sync my email.
352
+ export const WithGmail: Story = {
340
353
  decorators: getDecorators({
341
- 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
+ },
342
365
  }),
343
366
  args: {
344
- components: [ChatContainer],
367
+ deckComponents: [[ChatContainer], ['surfaces', MessageContainer, TokenManagerContainer]],
368
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/inbox'],
345
369
  },
346
- } satisfies Story;
370
+ };
347
371
 
348
- export const WithDocument = {
372
+ // Test with prompt: Create 10 locations.
373
+ export const WithMap: Story = {
349
374
  decorators: getDecorators({
350
- config: remoteConfig,
351
- 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
+ },
352
489
  }),
353
490
  args: {
354
- components: [ChatContainer, DocumentContainer],
491
+ deckComponents: [[ChatContainer], [GraphContainer]],
355
492
  },
356
- } satisfies Story;
493
+ };
357
494
 
358
- export const WithBlueprints = {
495
+ export const WithTranscription: Story = {
359
496
  decorators: getDecorators({
360
- config: remoteConfig,
361
- plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
362
- blueprints: [TASK_BLUEPRINT],
363
- 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
+ },
364
510
  }),
365
511
  args: {
366
- components: [ChatContainer, [DocumentContainer, BlueprintContainer]],
512
+ deckComponents: [[ChatContainer], ['surfaces']],
513
+ blueprints: [BLUEPRINT_KEY, 'dxos.org/blueprint/transcription'],
367
514
  },
368
- } satisfies Story;
369
-
370
- // export const WithArtifacts = {
371
- // decorators: getDecorators({
372
- // config: remoteConfig,
373
- // plugins: [ChessPlugin(), InboxPlugin(), MapPlugin(), MarkdownPlugin(), TablePlugin()],
374
- // }),
375
- // args: {
376
- // components: [ChatContainer],
377
- // },
378
- // } 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
+ };