@dxos/plugin-assistant 0.8.4-main.c1de068 → 0.8.4-main.f5c0578

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 (359) hide show
  1. package/dist/lib/browser/{TemplateContainer-RPJ2LBOB.mjs → BlueprintContainer-H7H4BQ2C.mjs} +11 -9
  2. package/dist/lib/browser/BlueprintContainer-H7H4BQ2C.mjs.map +7 -0
  3. package/dist/lib/browser/{ChatContainer-M3IHQLRS.mjs → ChatContainer-SB7YC2XP.mjs} +37 -14
  4. package/dist/lib/browser/ChatContainer-SB7YC2XP.mjs.map +7 -0
  5. package/dist/lib/browser/{ChatDialog-X6VN6QZI.mjs → ChatDialog-X6PFOQSQ.mjs} +23 -8
  6. package/dist/lib/browser/ChatDialog-X6PFOQSQ.mjs.map +7 -0
  7. package/dist/lib/browser/{SequenceContainer-3UDVKWPA.mjs → SequenceContainer-627OQ557.mjs} +3 -2
  8. package/dist/lib/browser/SequenceContainer-627OQ557.mjs.map +7 -0
  9. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs +22 -0
  10. package/dist/lib/browser/ai-service-7KJ5LXBT.mjs.map +7 -0
  11. package/dist/lib/browser/{app-graph-builder-JTXBKE7O.mjs → app-graph-builder-ERU5XY2S.mjs} +17 -74
  12. package/dist/lib/browser/app-graph-builder-ERU5XY2S.mjs.map +7 -0
  13. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs +146 -0
  14. package/dist/lib/browser/blueprint-definition-CMGIZAOW.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-OWY4CUQY.mjs → chunk-BVH6VK6Q.mjs} +816 -807
  16. package/dist/lib/browser/chunk-BVH6VK6Q.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  18. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-JBFDQMUJ.mjs +193 -0
  20. package/dist/lib/browser/chunk-JBFDQMUJ.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-LKP65RPA.mjs +20 -0
  22. package/dist/lib/browser/{chunk-FDCJSQYF.mjs.map → chunk-LKP65RPA.mjs.map} +1 -1
  23. package/dist/lib/browser/{chunk-AEAEKWOC.mjs → chunk-NZDCKQ6W.mjs} +12 -21
  24. package/dist/lib/browser/chunk-NZDCKQ6W.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-QB7OVS6Z.mjs +16 -0
  26. package/dist/lib/browser/chunk-QB7OVS6Z.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-Y66UJUHV.mjs +280 -0
  28. package/dist/lib/browser/chunk-Y66UJUHV.mjs.map +7 -0
  29. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs +24 -0
  30. package/dist/lib/browser/edge-model-resolver-2HB4PCWH.mjs.map +7 -0
  31. package/dist/lib/browser/index.mjs +98 -51
  32. package/dist/lib/browser/index.mjs.map +4 -4
  33. package/dist/lib/browser/{intent-resolver-5RMMCMXG.mjs → intent-resolver-DGRO2XSG.mjs} +33 -12
  34. package/dist/lib/browser/intent-resolver-DGRO2XSG.mjs.map +7 -0
  35. package/dist/lib/browser/meta.json +1 -1
  36. package/dist/lib/browser/{react-surface-66VY37YQ.mjs → react-surface-LPSIBHEJ.mjs} +45 -32
  37. package/dist/lib/browser/react-surface-LPSIBHEJ.mjs.map +7 -0
  38. package/dist/lib/browser/{settings-2DGP3UTS.mjs → settings-ZFNQYSYP.mjs} +6 -5
  39. package/dist/lib/{node-esm/settings-47RYZOU4.mjs.map → browser/settings-ZFNQYSYP.mjs.map} +1 -1
  40. package/dist/lib/browser/toolkit-IW4FBLLB.mjs +105 -0
  41. package/dist/lib/browser/toolkit-IW4FBLLB.mjs.map +7 -0
  42. package/dist/lib/browser/types/index.mjs +7 -4
  43. package/dist/lib/node-esm/{TemplateContainer-A3NAQCZE.mjs → BlueprintContainer-VH4EE4CM.mjs} +11 -9
  44. package/dist/lib/node-esm/BlueprintContainer-VH4EE4CM.mjs.map +7 -0
  45. package/dist/lib/node-esm/{ChatContainer-VZT74PO2.mjs → ChatContainer-7JLMWHMX.mjs} +37 -14
  46. package/dist/lib/node-esm/ChatContainer-7JLMWHMX.mjs.map +7 -0
  47. package/dist/lib/node-esm/{ChatDialog-RJ6FDX4Q.mjs → ChatDialog-QDD722F2.mjs} +23 -8
  48. package/dist/lib/node-esm/ChatDialog-QDD722F2.mjs.map +7 -0
  49. package/dist/lib/node-esm/{SequenceContainer-RQQH5XOC.mjs → SequenceContainer-EQ5NP2PG.mjs} +3 -2
  50. package/dist/lib/node-esm/SequenceContainer-EQ5NP2PG.mjs.map +7 -0
  51. package/dist/lib/node-esm/ai-service-LDD32477.mjs +23 -0
  52. package/dist/lib/node-esm/ai-service-LDD32477.mjs.map +7 -0
  53. package/dist/lib/node-esm/{app-graph-builder-OWSOXFTD.mjs → app-graph-builder-RCT4ANP2.mjs} +17 -74
  54. package/dist/lib/node-esm/app-graph-builder-RCT4ANP2.mjs.map +7 -0
  55. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs +147 -0
  56. package/dist/lib/node-esm/blueprint-definition-AEWYMW6I.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-SENTQAEO.mjs → chunk-ETS2CIDF.mjs} +816 -807
  58. package/dist/lib/node-esm/chunk-ETS2CIDF.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-2XL6MNPE.mjs → chunk-GAWXJ7K5.mjs} +12 -21
  60. package/dist/lib/node-esm/chunk-GAWXJ7K5.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-GENVBE3B.mjs +194 -0
  62. package/dist/lib/node-esm/chunk-GENVBE3B.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  64. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-KOC6ESG7.mjs +22 -0
  66. package/dist/lib/node-esm/{chunk-QN2H2EHV.mjs.map → chunk-KOC6ESG7.mjs.map} +1 -1
  67. package/dist/lib/node-esm/chunk-QS6GWTVA.mjs +281 -0
  68. package/dist/lib/node-esm/chunk-QS6GWTVA.mjs.map +7 -0
  69. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs +17 -0
  70. package/dist/lib/node-esm/chunk-X6AANUHZ.mjs.map +7 -0
  71. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs +25 -0
  72. package/dist/lib/node-esm/edge-model-resolver-UDDR2IA6.mjs.map +7 -0
  73. package/dist/lib/node-esm/index.mjs +98 -51
  74. package/dist/lib/node-esm/index.mjs.map +4 -4
  75. package/dist/lib/node-esm/{intent-resolver-YPPYELY3.mjs → intent-resolver-7CKWG7TZ.mjs} +33 -12
  76. package/dist/lib/node-esm/intent-resolver-7CKWG7TZ.mjs.map +7 -0
  77. package/dist/lib/node-esm/meta.json +1 -1
  78. package/dist/lib/node-esm/{react-surface-RJMRBR2M.mjs → react-surface-3EPAE4I4.mjs} +45 -32
  79. package/dist/lib/node-esm/react-surface-3EPAE4I4.mjs.map +7 -0
  80. package/dist/lib/node-esm/{settings-47RYZOU4.mjs → settings-UI4VQCWW.mjs} +6 -5
  81. package/dist/lib/{browser/settings-2DGP3UTS.mjs.map → node-esm/settings-UI4VQCWW.mjs.map} +1 -1
  82. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs +106 -0
  83. package/dist/lib/node-esm/toolkit-2VNUL77B.mjs.map +7 -0
  84. package/dist/lib/node-esm/types/index.mjs +7 -4
  85. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/ai-service.d.ts +5 -0
  87. package/dist/types/src/capabilities/ai-service.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/blueprint-definition.d.ts +3 -0
  90. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/capabilities.d.ts +11 -0
  92. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/edge-model-resolver.d.ts +5 -0
  94. package/dist/types/src/capabilities/edge-model-resolver.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/index.d.ts +5 -0
  96. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/toolkit.d.ts +5 -0
  100. package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
  101. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  102. package/dist/types/src/components/BlueprintContainer.d.ts +8 -0
  103. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  104. package/dist/types/src/components/Chat/Chat.d.ts +6 -8
  105. package/dist/types/src/components/Chat/Chat.d.ts.map +1 -1
  106. package/dist/types/src/components/ChatContainer.d.ts +5 -4
  107. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  108. package/dist/types/src/components/ChatDialog.d.ts.map +1 -1
  109. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts +13 -0
  110. package/dist/types/src/components/ChatPrompt/ChatOptions.d.ts.map +1 -0
  111. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts +3 -3
  112. package/dist/types/src/components/ChatPrompt/ChatReferences.d.ts.map +1 -1
  113. package/dist/types/src/components/ChatPrompt/index.d.ts +1 -1
  114. package/dist/types/src/components/ChatPrompt/index.d.ts.map +1 -1
  115. package/dist/types/src/components/ChatThread/ChatMessage.d.ts +4 -3
  116. package/dist/types/src/components/ChatThread/ChatMessage.d.ts.map +1 -1
  117. package/dist/types/src/components/ChatThread/ChatThread.d.ts +2 -2
  118. package/dist/types/src/components/ChatThread/ChatThread.d.ts.map +1 -1
  119. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts +33 -48
  120. package/dist/types/src/components/ChatThread/ChatThread.stories.d.ts.map +1 -1
  121. package/dist/types/src/components/ChatThread/Link.d.ts +9 -0
  122. package/dist/types/src/components/ChatThread/Link.d.ts.map +1 -0
  123. package/dist/types/src/components/ChatThread/ToolBlock.d.ts.map +1 -1
  124. package/dist/types/src/components/SequenceContainer.d.ts.map +1 -1
  125. package/dist/types/src/components/SequenceEditor/SequenceEditor.d.ts.map +1 -1
  126. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts +1 -1
  127. package/dist/types/src/components/SequenceEditor/SequenceEditor.stories.d.ts.map +1 -1
  128. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +2 -1
  129. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  130. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  131. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -1
  132. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  133. package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -1
  134. package/dist/types/src/components/Timeline/Timeline.d.ts +42 -0
  135. package/dist/types/src/components/Timeline/Timeline.d.ts.map +1 -0
  136. package/dist/types/src/components/Timeline/Timeline.stories.d.ts +11 -0
  137. package/dist/types/src/components/Timeline/Timeline.stories.d.ts.map +1 -0
  138. package/dist/types/src/components/Timeline/index.d.ts +2 -0
  139. package/dist/types/src/components/Timeline/index.d.ts.map +1 -0
  140. package/dist/types/src/components/Toolbox/Toolbox.d.ts +4 -7
  141. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  142. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +1 -2
  143. package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -1
  144. package/dist/types/src/components/index.d.ts +3 -2
  145. package/dist/types/src/components/index.d.ts.map +1 -1
  146. package/dist/types/src/events.d.ts +1 -1
  147. package/dist/types/src/events.d.ts.map +1 -1
  148. package/dist/types/src/execution-graph/execution-graph.d.ts +21 -0
  149. package/dist/types/src/execution-graph/execution-graph.d.ts.map +1 -0
  150. package/dist/types/src/execution-graph/index.d.ts +2 -0
  151. package/dist/types/src/execution-graph/index.d.ts.map +1 -0
  152. package/dist/types/src/functions/analysis.d.ts +5 -0
  153. package/dist/types/src/functions/analysis.d.ts.map +1 -0
  154. package/dist/types/src/functions/index.d.ts +4 -0
  155. package/dist/types/src/functions/index.d.ts.map +1 -0
  156. package/dist/types/src/functions/list.d.ts +10 -0
  157. package/dist/types/src/functions/list.d.ts.map +1 -0
  158. package/dist/types/src/functions/load.d.ts +8 -0
  159. package/dist/types/src/functions/load.d.ts.map +1 -0
  160. package/dist/types/src/hooks/chat-processor.d.ts +28 -42
  161. package/dist/types/src/hooks/chat-processor.d.ts.map +1 -1
  162. package/dist/types/src/hooks/errors.d.ts +4 -0
  163. package/dist/types/src/hooks/errors.d.ts.map +1 -0
  164. package/dist/types/src/hooks/index.d.ts +6 -1
  165. package/dist/types/src/hooks/index.d.ts.map +1 -1
  166. package/dist/types/src/hooks/presets.d.ts +2 -2
  167. package/dist/types/src/hooks/presets.d.ts.map +1 -1
  168. package/dist/types/src/hooks/useBlueprintRegistry.d.ts +21 -0
  169. package/dist/types/src/hooks/useBlueprintRegistry.d.ts.map +1 -0
  170. package/dist/types/src/hooks/useChatProcessor.d.ts +7 -14
  171. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  172. package/dist/types/src/hooks/useChatServices.d.ts +5 -4
  173. package/dist/types/src/hooks/useChatServices.d.ts.map +1 -1
  174. package/dist/types/src/hooks/useExecutionGraph.d.ts +7 -0
  175. package/dist/types/src/hooks/useExecutionGraph.d.ts.map +1 -0
  176. package/dist/types/src/hooks/useOnline.d.ts +3 -0
  177. package/dist/types/src/hooks/useOnline.d.ts.map +1 -0
  178. package/dist/types/src/hooks/usePresets.d.ts +7 -0
  179. package/dist/types/src/hooks/usePresets.d.ts.map +1 -0
  180. package/dist/types/src/hooks/useReferencesProvider.d.ts.map +1 -1
  181. package/dist/types/src/hooks/useResolveRef.d.ts +4 -0
  182. package/dist/types/src/hooks/useResolveRef.d.ts.map +1 -0
  183. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  184. package/dist/types/src/parser/query-parser.d.ts.map +1 -1
  185. package/dist/types/src/stories/Chat.stories.d.ts +68 -49
  186. package/dist/types/src/stories/Chat.stories.d.ts.map +1 -1
  187. package/dist/types/src/stories/components/BlueprintContainer.d.ts +5 -0
  188. package/dist/types/src/stories/components/BlueprintContainer.d.ts.map +1 -0
  189. package/dist/types/src/stories/components/ChatContainer.d.ts +5 -0
  190. package/dist/types/src/stories/components/ChatContainer.d.ts.map +1 -0
  191. package/dist/types/src/stories/components/GraphContainer.d.ts +6 -0
  192. package/dist/types/src/stories/components/GraphContainer.d.ts.map +1 -0
  193. package/dist/types/src/stories/components/LoggingContainer.d.ts +5 -0
  194. package/dist/types/src/stories/components/LoggingContainer.d.ts.map +1 -0
  195. package/dist/types/src/stories/components/SurfaceContainer.d.ts +8 -0
  196. package/dist/types/src/stories/components/SurfaceContainer.d.ts.map +1 -0
  197. package/dist/types/src/stories/components/TasksContainer.d.ts +5 -0
  198. package/dist/types/src/stories/components/TasksContainer.d.ts.map +1 -0
  199. package/dist/types/src/stories/components/index.d.ts +8 -0
  200. package/dist/types/src/stories/components/index.d.ts.map +1 -0
  201. package/dist/types/src/stories/components/types.d.ts +7 -0
  202. package/dist/types/src/stories/components/types.d.ts.map +1 -0
  203. package/dist/types/src/stories/hooks/index.d.ts +3 -0
  204. package/dist/types/src/stories/hooks/index.d.ts.map +1 -0
  205. package/dist/types/src/stories/hooks/useFlush.d.ts +6 -0
  206. package/dist/types/src/stories/hooks/useFlush.d.ts.map +1 -0
  207. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts +3 -0
  208. package/dist/types/src/stories/hooks/useMatcherExtension.d.ts.map +1 -0
  209. package/dist/types/src/stories/testing/data.d.ts +142 -0
  210. package/dist/types/src/stories/testing/data.d.ts.map +1 -0
  211. package/dist/types/src/stories/testing/index.d.ts +3 -0
  212. package/dist/types/src/stories/testing/index.d.ts.map +1 -0
  213. package/dist/types/src/stories/testing/testing.d.ts +26 -0
  214. package/dist/types/src/stories/testing/testing.d.ts.map +1 -0
  215. package/dist/types/src/testing/test-functions.d.ts +5 -2
  216. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  217. package/dist/types/src/testing/test-sequence.d.ts.map +1 -1
  218. package/dist/types/src/tools/function.d.ts.map +1 -1
  219. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  220. package/dist/types/src/translations.d.ts +6 -10
  221. package/dist/types/src/translations.d.ts.map +1 -1
  222. package/dist/types/src/types/Assistant.d.ts +42 -0
  223. package/dist/types/src/types/Assistant.d.ts.map +1 -0
  224. package/dist/types/src/types/AssistantAction.d.ts +91 -0
  225. package/dist/types/src/types/AssistantAction.d.ts.map +1 -0
  226. package/dist/types/src/types/defs.d.ts +2 -0
  227. package/dist/types/src/types/defs.d.ts.map +1 -0
  228. package/dist/types/src/types/index.d.ts +3 -1
  229. package/dist/types/src/types/index.d.ts.map +1 -1
  230. package/dist/types/src/types/service.d.ts +6 -6
  231. package/dist/types/src/types/service.d.ts.map +1 -1
  232. package/dist/types/tsconfig.tsbuildinfo +1 -1
  233. package/package.json +83 -75
  234. package/src/AssistantPlugin.tsx +59 -12
  235. package/src/capabilities/ai-service.ts +28 -0
  236. package/src/capabilities/app-graph-builder.ts +9 -93
  237. package/src/capabilities/blueprint-definition.ts +32 -0
  238. package/src/capabilities/capabilities.ts +22 -0
  239. package/src/capabilities/edge-model-resolver.ts +29 -0
  240. package/src/capabilities/index.ts +6 -0
  241. package/src/capabilities/intent-resolver.ts +24 -9
  242. package/src/capabilities/react-surface.tsx +29 -22
  243. package/src/capabilities/toolkit.ts +106 -0
  244. package/src/components/AssistantSettings/AssistantSettings.tsx +1 -1
  245. package/src/components/BlueprintContainer.tsx +24 -0
  246. package/src/components/Chat/Chat.tsx +77 -64
  247. package/src/components/ChatContainer.tsx +38 -14
  248. package/src/components/ChatDialog.tsx +10 -6
  249. package/src/components/ChatPrompt/ChatOptions.tsx +59 -0
  250. package/src/components/ChatPrompt/ChatReferences.tsx +11 -9
  251. package/src/components/ChatPrompt/index.ts +1 -1
  252. package/src/components/ChatThread/ChatMessage.tsx +141 -118
  253. package/src/components/ChatThread/ChatThread.stories.tsx +236 -104
  254. package/src/components/ChatThread/ChatThread.tsx +2 -2
  255. package/src/components/ChatThread/Link.tsx +23 -0
  256. package/src/components/ChatThread/ToolBlock.tsx +20 -16
  257. package/src/components/SequenceContainer.tsx +2 -1
  258. package/src/components/SequenceEditor/SequenceEditor.stories.tsx +3 -2
  259. package/src/components/SequenceEditor/SequenceEditor.tsx +1 -1
  260. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +12 -5
  261. package/src/components/TemplateEditor/TemplateEditor.tsx +15 -12
  262. package/src/components/TemplateEditor/TemplateForm.stories.tsx +12 -5
  263. package/src/components/TemplateEditor/TemplateForm.tsx +5 -3
  264. package/src/components/Timeline/Timeline.stories.tsx +144 -0
  265. package/src/components/Timeline/Timeline.tsx +202 -0
  266. package/src/components/Timeline/index.ts +5 -0
  267. package/src/components/Toolbox/Toolbox.stories.tsx +6 -12
  268. package/src/components/Toolbox/Toolbox.tsx +16 -40
  269. package/src/components/index.ts +2 -5
  270. package/src/events.ts +2 -2
  271. package/src/execution-graph/execution-graph.ts +184 -0
  272. package/src/execution-graph/index.ts +5 -0
  273. package/src/functions/analysis.ts +20 -0
  274. package/src/functions/index.ts +7 -0
  275. package/src/functions/list.ts +42 -0
  276. package/src/functions/load.ts +43 -0
  277. package/src/hooks/chat-processor.ts +123 -177
  278. package/src/hooks/errors.ts +8 -0
  279. package/src/hooks/index.ts +6 -1
  280. package/src/hooks/presets.ts +6 -5
  281. package/src/hooks/useBlueprintRegistry.ts +79 -0
  282. package/src/hooks/useChatProcessor.ts +21 -83
  283. package/src/hooks/useChatServices.ts +37 -54
  284. package/src/hooks/useExecutionGraph.ts +16 -0
  285. package/src/hooks/useOnline.ts +10 -0
  286. package/src/hooks/usePresets.ts +45 -0
  287. package/src/hooks/useReferencesProvider.ts +11 -9
  288. package/src/hooks/useResolveRef.ts +33 -0
  289. package/src/parser/filter-generator.ts +6 -13
  290. package/src/parser/query-parser.ts +1 -1
  291. package/src/queue-logger.ts +5 -5
  292. package/src/stories/Chat.stories.tsx +238 -299
  293. package/src/stories/components/BlueprintContainer.tsx +34 -0
  294. package/src/stories/components/ChatContainer.tsx +80 -0
  295. package/src/stories/components/GraphContainer.tsx +118 -0
  296. package/src/stories/components/LoggingContainer.tsx +29 -0
  297. package/src/stories/components/SurfaceContainer.tsx +62 -0
  298. package/src/stories/components/TasksContainer.tsx +51 -0
  299. package/src/stories/components/index.ts +12 -0
  300. package/src/stories/components/types.ts +11 -0
  301. package/src/stories/hooks/index.ts +6 -0
  302. package/src/stories/hooks/useFlush.ts +35 -0
  303. package/src/stories/hooks/useMatcherExtension.ts +45 -0
  304. package/src/stories/testing/data.ts +130 -0
  305. package/src/stories/testing/index.ts +6 -0
  306. package/src/stories/testing/testing.tsx +163 -0
  307. package/src/testing/test-functions.ts +8 -3
  308. package/src/testing/test-sequence.ts +1 -1
  309. package/src/tools/function.ts +4 -1
  310. package/src/tools/openapi.test.ts +7 -5
  311. package/src/tools/openapi.ts +4 -1
  312. package/src/translations.ts +8 -10
  313. package/src/types/Assistant.ts +62 -0
  314. package/src/types/AssistantAction.ts +54 -0
  315. package/src/types/defs.ts +5 -0
  316. package/src/types/index.ts +4 -1
  317. package/dist/lib/browser/ChatContainer-M3IHQLRS.mjs.map +0 -7
  318. package/dist/lib/browser/ChatDialog-X6VN6QZI.mjs.map +0 -7
  319. package/dist/lib/browser/SequenceContainer-3UDVKWPA.mjs.map +0 -7
  320. package/dist/lib/browser/TemplateContainer-RPJ2LBOB.mjs.map +0 -7
  321. package/dist/lib/browser/app-graph-builder-JTXBKE7O.mjs.map +0 -7
  322. package/dist/lib/browser/chunk-AEAEKWOC.mjs.map +0 -7
  323. package/dist/lib/browser/chunk-EQDW6BYQ.mjs +0 -108
  324. package/dist/lib/browser/chunk-EQDW6BYQ.mjs.map +0 -7
  325. package/dist/lib/browser/chunk-FDCJSQYF.mjs +0 -40
  326. package/dist/lib/browser/chunk-JQBVLTM5.mjs +0 -158
  327. package/dist/lib/browser/chunk-JQBVLTM5.mjs.map +0 -7
  328. package/dist/lib/browser/chunk-OWY4CUQY.mjs.map +0 -7
  329. package/dist/lib/browser/intent-resolver-5RMMCMXG.mjs.map +0 -7
  330. package/dist/lib/browser/react-surface-66VY37YQ.mjs.map +0 -7
  331. package/dist/lib/node-esm/ChatContainer-VZT74PO2.mjs.map +0 -7
  332. package/dist/lib/node-esm/ChatDialog-RJ6FDX4Q.mjs.map +0 -7
  333. package/dist/lib/node-esm/SequenceContainer-RQQH5XOC.mjs.map +0 -7
  334. package/dist/lib/node-esm/TemplateContainer-A3NAQCZE.mjs.map +0 -7
  335. package/dist/lib/node-esm/app-graph-builder-OWSOXFTD.mjs.map +0 -7
  336. package/dist/lib/node-esm/chunk-2XL6MNPE.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-BISJDTBK.mjs +0 -159
  338. package/dist/lib/node-esm/chunk-BISJDTBK.mjs.map +0 -7
  339. package/dist/lib/node-esm/chunk-E33DNNDW.mjs +0 -109
  340. package/dist/lib/node-esm/chunk-E33DNNDW.mjs.map +0 -7
  341. package/dist/lib/node-esm/chunk-QN2H2EHV.mjs +0 -41
  342. package/dist/lib/node-esm/chunk-SENTQAEO.mjs.map +0 -7
  343. package/dist/lib/node-esm/intent-resolver-YPPYELY3.mjs.map +0 -7
  344. package/dist/lib/node-esm/react-surface-RJMRBR2M.mjs.map +0 -7
  345. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts +0 -9
  346. package/dist/types/src/components/ChatPrompt/ChatOptionsMenu.d.ts.map +0 -1
  347. package/dist/types/src/components/TemplateContainer.d.ts +0 -8
  348. package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
  349. package/dist/types/src/hooks/chat-processor.test.d.ts +0 -2
  350. package/dist/types/src/hooks/chat-processor.test.d.ts.map +0 -1
  351. package/dist/types/src/hooks/useBlueprints.d.ts +0 -9
  352. package/dist/types/src/hooks/useBlueprints.d.ts.map +0 -1
  353. package/dist/types/src/types/schema.d.ts +0 -88
  354. package/dist/types/src/types/schema.d.ts.map +0 -1
  355. package/src/components/ChatPrompt/ChatOptionsMenu.tsx +0 -52
  356. package/src/components/TemplateContainer.tsx +0 -24
  357. package/src/hooks/chat-processor.test.ts +0 -16
  358. package/src/hooks/useBlueprints.ts +0 -57
  359. package/src/types/schema.ts +0 -95
@@ -0,0 +1,80 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React, { useCallback, useEffect, useState } from 'react';
8
+
9
+ import { Filter, Obj, Ref } from '@dxos/echo';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { log } from '@dxos/log';
12
+ import { useQuery } from '@dxos/react-client/echo';
13
+ import { Toolbar, useTranslation } from '@dxos/react-ui';
14
+
15
+ import { Chat } from '../../components';
16
+ import { useBlueprintRegistry, useChatProcessor, useChatServices } from '../../hooks';
17
+ import { useOnline, usePresets } from '../../hooks';
18
+ import { meta } from '../../meta';
19
+ import { Assistant } from '../../types';
20
+
21
+ import { type ComponentProps } from './types';
22
+
23
+ export const ChatContainer = ({ space, onEvent }: ComponentProps) => {
24
+ const { t } = useTranslation(meta.id);
25
+ const [online, setOnline] = useOnline();
26
+ const { preset, ...chatProps } = usePresets(online);
27
+
28
+ const chats = useQuery(space, Filter.type(Assistant.Chat));
29
+ const [chat, setChat] = useState<Assistant.Chat>();
30
+ useEffect(() => {
31
+ setChat((currentChat) => currentChat ?? chats[0]);
32
+ }, [chat, chats]);
33
+
34
+ const blueprintRegistry = useBlueprintRegistry();
35
+ const services = useChatServices({ space, chat });
36
+ const processor = useChatProcessor({ space, chat, preset, services, blueprintRegistry });
37
+
38
+ const handleNewChat = useCallback(() => {
39
+ invariant(space);
40
+ const chat = space.db.add(
41
+ Obj.make(Assistant.Chat, {
42
+ queue: Ref.fromDXN(space.queues.create().dxn),
43
+ }),
44
+ );
45
+ setChat(chat);
46
+ }, [space]);
47
+
48
+ const handleBranchChat = useCallback(() => {}, [space]);
49
+
50
+ return (
51
+ <>
52
+ <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
53
+ <Toolbar.IconButton icon='ph--plus--regular' iconOnly label={t('button new thread')} onClick={handleNewChat} />
54
+ <Toolbar.IconButton
55
+ disabled
56
+ icon='ph--git-branch--regular'
57
+ iconOnly
58
+ label={t('button branch thread')}
59
+ onClick={handleBranchChat}
60
+ />
61
+ <div className='flex-1' />
62
+ <Toolbar.IconButton icon='ph--trash--regular' iconOnly label='Reset' onClick={() => onEvent?.('reset')} />
63
+ </Toolbar.Root>
64
+ {!chat || !processor ? null : (
65
+ <Chat.Root chat={chat} processor={processor} onEvent={(event) => log.info('event', { event })}>
66
+ <Chat.Thread />
67
+ <div className='p-4'>
68
+ <Chat.Prompt
69
+ {...chatProps}
70
+ classNames='p-2 border border-transparent rounded focus-within:outline focus-within:border-transparent outline-primary-500'
71
+ preset={preset?.id}
72
+ online={online}
73
+ onChangeOnline={setOnline}
74
+ />
75
+ </div>
76
+ </Chat.Root>
77
+ )}
78
+ </>
79
+ );
80
+ };
@@ -0,0 +1,118 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Match } from 'effect';
6
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
7
+
8
+ import { ResearchGraph } from '@dxos/assistant-testing';
9
+ import { Filter, Query } from '@dxos/echo';
10
+ import { D3ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
11
+ import { useQuery } from '@dxos/react-client/echo';
12
+ import { IconButton, Toolbar } from '@dxos/react-ui';
13
+ import { ChatEditor, type ChatEditorController, type ChatEditorProps } from '@dxos/react-ui-chat';
14
+ import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
15
+ import { mx } from '@dxos/react-ui-theme';
16
+
17
+ import { type Expression, QueryParser, createFilter } from '../../parser';
18
+ import { useFlush, useMatcherExtension } from '../hooks';
19
+
20
+ import { type ComponentProps } from './types';
21
+
22
+ export const GraphContainer = ({ space }: ComponentProps) => {
23
+ const [ast, setAst] = useState<Expression | undefined>();
24
+ const [filter, setFilter] = useState<Filter.Any>();
25
+ const [open, setOpen] = useState(false);
26
+
27
+ const [researchGraph] = useQuery(space, Query.type(ResearchGraph));
28
+ const queue = researchGraph?.queue.target;
29
+
30
+ const model = useGraphModel(space, undefined, undefined, queue);
31
+ useEffect(() => {
32
+ model?.setFilter(filter ?? Filter.everything());
33
+ }, [model, filter]);
34
+
35
+ const handleSubmit = useCallback<NonNullable<ChatEditorProps['onSubmit']>>(
36
+ (text) => {
37
+ try {
38
+ const parser = new QueryParser(text);
39
+ const ast = parser.parse();
40
+ setAst(ast);
41
+ const filter = createFilter(ast);
42
+ setFilter(filter);
43
+ setOpen(true);
44
+ } catch {
45
+ // TODO(mykola): Make hybrid search.
46
+ const filter = Filter.text(text, { type: 'vector' });
47
+ setFilter(filter);
48
+ }
49
+ },
50
+ [space],
51
+ );
52
+
53
+ return (
54
+ <div className={mx('relative grid h-full', open && 'grid-rows-[min-content_1fr]')}>
55
+ <SearchBar space={space} onSubmit={handleSubmit} />
56
+ <D3ForceGraph model={model} />
57
+
58
+ {/* TODO(burdon): Create component with context state for story. */}
59
+ {(open && (
60
+ <div className='absolute left-2 right-2 bottom-2 h-[8rem] flex overflow-hidden bg-baseSurface border border-subduedSeparator'>
61
+ <SyntaxHighlighter language='json' classNames='text-sm'>
62
+ {JSON.stringify({ ast, filter }, null, 2)}
63
+ </SyntaxHighlighter>
64
+ <div className='absolute bottom-1 right-1'>
65
+ <IconButton variant='ghost' icon='ph--x--regular' iconOnly label='Close' onClick={() => setOpen(false)} />
66
+ </div>
67
+ </div>
68
+ )) || (
69
+ <div className='absolute bottom-3 right-3'>
70
+ <IconButton
71
+ variant='ghost'
72
+ icon='ph--arrow-line-up--regular'
73
+ iconOnly
74
+ label='Open'
75
+ onClick={() => setOpen(true)}
76
+ />
77
+ </div>
78
+ )}
79
+ </div>
80
+ );
81
+ };
82
+
83
+ export const SearchBar = ({ space, onSubmit }: ComponentProps & Pick<ChatEditorProps, 'onSubmit'>) => {
84
+ const { state: flushState, handleFlush } = useFlush(space);
85
+ const extensions = useMatcherExtension(space);
86
+ const editorRef = useRef<ChatEditorController>(null);
87
+
88
+ return (
89
+ <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>
90
+ <ChatEditor
91
+ ref={editorRef}
92
+ autoFocus
93
+ placeholder='Search'
94
+ extensions={extensions}
95
+ fireIfEmpty
96
+ onSubmit={onSubmit}
97
+ />
98
+ <Toolbar.IconButton
99
+ icon='ph--magnifying-glass--regular'
100
+ iconOnly
101
+ label='Search'
102
+ onClick={() => onSubmit?.(editorRef.current?.getText() ?? '')}
103
+ />
104
+ <Toolbar.IconButton
105
+ disabled={flushState === 'flushing'}
106
+ icon={Match.value(flushState).pipe(
107
+ Match.when('idle', () => 'ph--floppy-disk--regular'),
108
+ Match.when('flushing', () => 'ph--spinner--regular'),
109
+ Match.when('flushed', () => 'ph--check--regular'),
110
+ Match.exhaustive,
111
+ )}
112
+ iconOnly
113
+ label='flush'
114
+ onClick={handleFlush}
115
+ />
116
+ </Toolbar.Root>
117
+ );
118
+ };
@@ -0,0 +1,29 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React from 'react';
8
+
9
+ import { Filter } from '@dxos/echo';
10
+ import { useQuery } from '@dxos/react-client/echo';
11
+ import { Toolbar } from '@dxos/react-ui';
12
+
13
+ import { Timeline } from '../../components';
14
+ import { useExecutionGraph } from '../../hooks';
15
+ import { Assistant } from '../../types';
16
+
17
+ import { type ComponentProps } from './types';
18
+
19
+ export const LoggingContainer = ({ space }: ComponentProps) => {
20
+ const [chat] = useQuery(space, Filter.type(Assistant.Chat));
21
+ const { branches, commits } = useExecutionGraph(chat?.traceQueue);
22
+
23
+ return (
24
+ <div className='flex flex-col h-full'>
25
+ <Toolbar.Root classNames='density-coarse border-b border-subduedSeparator'>Timeline</Toolbar.Root>
26
+ <Timeline branches={branches} commits={commits} />
27
+ </div>
28
+ );
29
+ };
@@ -0,0 +1,62 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React from 'react';
8
+
9
+ import { Surface } from '@dxos/app-framework';
10
+ import { AiContextBinder } from '@dxos/assistant';
11
+ import { Filter, Obj, Ref, type Type } from '@dxos/echo';
12
+ import { log } from '@dxos/log';
13
+ import { useQuery } from '@dxos/react-client/echo';
14
+ import { useAsyncState } from '@dxos/react-ui';
15
+ import { mx } from '@dxos/react-ui-theme';
16
+
17
+ import { Assistant } from '../../types';
18
+
19
+ import { type ComponentProps } from './types';
20
+
21
+ /**
22
+ * Shows the surface relating to the first bound object to the curent chat.
23
+ */
24
+ export const SurfaceContainer = ({ space, debug }: ComponentProps) => {
25
+ const chats = useQuery(space, Filter.type(Assistant.Chat));
26
+ const [objects] = useAsyncState<Type.Expando[]>(async () => {
27
+ if (!chats.length) {
28
+ return [];
29
+ }
30
+
31
+ // Get the latest chat (is this deterministic?)
32
+ const chat = chats[chats.length - 1];
33
+ const binder = new AiContextBinder(chat.queue.target!);
34
+ const refs = binder.objects.value;
35
+ const objects = await Ref.Array.loadAll(refs);
36
+ // TODO(burdon): Auto log meta for ECHO objects?
37
+ log('loaded', { objects: objects.map((obj) => ({ typename: Obj.getTypename(obj), id: obj.id })) });
38
+ return objects;
39
+ }, [chats]);
40
+
41
+ // TODO(burdon): Specify role hint to hide toolbar.
42
+ return (
43
+ <div className='flex flex-col bs-full overflow-y-auto divide-y divide-separator'>
44
+ {objects?.map((object) => (
45
+ <div key={object.id} className='group contents'>
46
+ {debug && (
47
+ <div
48
+ className={mx(
49
+ 'flex gap-2 items-center text-xs justify-center',
50
+ 'text-subdued group-first:border-none border-t border-subduedSeparator',
51
+ )}
52
+ >
53
+ <span>{Obj.getTypename(object)}</span>
54
+ <span>{object.id}</span>
55
+ </div>
56
+ )}
57
+ <Surface role='section' limit={1} data={{ subject: object }} />
58
+ </div>
59
+ ))}
60
+ </div>
61
+ );
62
+ };
@@ -0,0 +1,51 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React from 'react';
8
+
9
+ import { Filter, Obj } from '@dxos/echo';
10
+ import { Markdown } from '@dxos/plugin-markdown/types';
11
+ import { createDocAccessor, useQuery } from '@dxos/react-client/echo';
12
+ import { Toolbar, useThemeContext } from '@dxos/react-ui';
13
+ import {
14
+ Editor,
15
+ createBasicExtensions,
16
+ createDataExtensions,
17
+ createMarkdownExtensions,
18
+ createThemeExtensions,
19
+ outliner,
20
+ } from '@dxos/react-ui-editor';
21
+
22
+ import { type ComponentProps } from './types';
23
+
24
+ export const TasksContainer = ({ space }: ComponentProps) => {
25
+ const { themeMode } = useThemeContext();
26
+ const [document] = useQuery(space, Filter.type(Markdown.Document));
27
+ if (!document?.content.target) {
28
+ return null;
29
+ }
30
+
31
+ return (
32
+ <>
33
+ <Toolbar.Root classNames='border-b border-subduedSeparator'>
34
+ <h2>{Obj.getLabel(document)}</h2>
35
+ </Toolbar.Root>
36
+ <Editor
37
+ id={document.id}
38
+ text={document.content.target}
39
+ classNames='h-full p-2 overflow-hidden'
40
+ extensions={[
41
+ // TODO(burdon): Create util.
42
+ createDataExtensions({ id: document.id, text: createDocAccessor(document.content.target, ['content']) }),
43
+ createBasicExtensions({ readOnly: false }),
44
+ createMarkdownExtensions({ themeMode }),
45
+ createThemeExtensions({ themeMode }),
46
+ outliner(),
47
+ ]}
48
+ />
49
+ </>
50
+ );
51
+ };
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './types';
6
+
7
+ export * from './BlueprintContainer';
8
+ export * from './ChatContainer';
9
+ export * from './GraphContainer';
10
+ export * from './LoggingContainer';
11
+ export * from './SurfaceContainer';
12
+ export * from './TasksContainer';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Space } from '@dxos/client/echo';
6
+
7
+ export type ComponentProps = {
8
+ space: Space;
9
+ debug?: boolean;
10
+ onEvent?: (event: string) => void;
11
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './useFlush';
6
+ export * from './useMatcherExtension';
@@ -0,0 +1,35 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useCallback, useRef, useState } from 'react';
6
+
7
+ import { type Space } from '@dxos/client/echo';
8
+
9
+ export const useFlush = (space?: Space) => {
10
+ const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
11
+ const resetTimer = useRef<NodeJS.Timeout | null>(null);
12
+
13
+ const handleFlush = useCallback(() => {
14
+ if (!space) {
15
+ return;
16
+ }
17
+
18
+ queueMicrotask(async () => {
19
+ if (resetTimer.current) {
20
+ clearTimeout(resetTimer.current);
21
+ }
22
+
23
+ setState('flushing');
24
+ await space.db.flush();
25
+ setState('flushed');
26
+
27
+ resetTimer.current = setTimeout(() => {
28
+ setState('idle');
29
+ resetTimer.current = null;
30
+ }, 1_000);
31
+ });
32
+ }, [space]);
33
+
34
+ return { state, handleFlush };
35
+ };
@@ -0,0 +1,45 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // TODO(burdon): Move def to @dxos/echo.
6
+ import { useMemo } from 'react';
7
+
8
+ import { type Space } from '@dxos/client/echo';
9
+ import { Type } from '@dxos/echo';
10
+ import { type TypeaheadContext, matchCompletion, staticCompletion, typeahead } from '@dxos/react-ui-editor';
11
+
12
+ export const useMatcherExtension = (space: Space) => {
13
+ return useMemo(() => {
14
+ const handleComplete = ({ line }: TypeaheadContext) => {
15
+ const words = line.split(/\s+/).filter(Boolean);
16
+ if (words.length > 0) {
17
+ const word = words.at(-1)!;
18
+
19
+ // Match type.
20
+ const match = word.match(/^type:(.+)/);
21
+ if (match) {
22
+ const part = match[1];
23
+ for (const schema of space?.db.graph.schemaRegistry.schemas ?? []) {
24
+ const typename = Type.getTypename(schema);
25
+ if (typename) {
26
+ const completion = matchCompletion(typename, part);
27
+ if (completion) {
28
+ return completion;
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ // Match static.
35
+ return staticCompletion(['type:', 'AND', 'OR', 'NOT'])({ line });
36
+ }
37
+ };
38
+
39
+ return [
40
+ typeahead({
41
+ onComplete: handleComplete,
42
+ }),
43
+ ];
44
+ }, [space]);
45
+ };
@@ -0,0 +1,130 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Live, type Space } from '@dxos/client/echo';
6
+ import { Obj, Relation, type Type } from '@dxos/echo';
7
+ import { invariant } from '@dxos/invariant';
8
+ import { DataType } from '@dxos/schema';
9
+
10
+ export const testTypes = [DataType.Organization, DataType.Person, DataType.Employer, DataType.HasConnection];
11
+
12
+ const organizations: (Type.Properties<DataType.Organization> & { id: string })[] = [
13
+ { id: 'dxos', name: 'DXOS', website: 'https://dxos.org' },
14
+ { id: 'socket_supply', name: 'Socket Supply', website: 'https://socketsupply.com' },
15
+ { id: 'ink_and_switch', name: 'Ink & Switch', website: 'https://inkandswitch.com' },
16
+ { id: 'effectful', name: 'Effectful', website: 'https://effect.co' },
17
+ { id: 'blueyard', name: 'Blue Yard', website: 'https://blueyard.com' },
18
+ { id: 'backed', name: 'Backed', website: 'https://backed.vc' },
19
+ { id: 'protocol_labs', name: 'Protocol Labs', website: 'https://protocol.ai' },
20
+ { id: 'newlab', name: 'Newlab', website: 'https://newlab.com' },
21
+ { id: 'google', name: 'Google', website: 'https://google.com' },
22
+ { id: 'microsoft', name: 'Microsoft', website: 'https://microsoft.com' },
23
+ { id: 'openai', name: 'OpenAI', website: 'https://openai.com' },
24
+ { id: 'anthropic', name: 'Anthropic', website: 'https://anthropic.com' },
25
+ { id: 'amazon', name: 'Amazon', website: 'https://amazon.com' },
26
+ { id: 'deshaw', name: 'D. E. Shaw & Co.', website: 'https://deshaw.com' },
27
+ ];
28
+
29
+ const people: (Type.Properties<DataType.Person> & { id: string })[] = [
30
+ { id: 'rich_burdon', fullName: 'Rich Burdon' },
31
+ { id: 'josiah_witt', fullName: 'Josiah Witt' },
32
+ { id: 'dima_dmaretskyi', fullName: 'Dima Maretskyi' },
33
+ { id: 'chad_fowler', fullName: 'Chad Fowler' },
34
+ { id: 'ciaran_oleary', fullName: "Ciarán O'Leary" },
35
+ { id: 'jason_whitmire', fullName: 'Jason Whitmire' },
36
+ { id: 'alex_brunicki', fullName: 'Alex Brunicki' },
37
+ { id: 'andre_de_haes', fullName: 'Andre de Haes' },
38
+ { id: 'scott_cohen', fullName: 'Scott Cohen' },
39
+ { id: 'juan_benet', fullName: 'Juan Benet' },
40
+ { id: 'satya_nadella', fullName: 'Satya Nadella' },
41
+ { id: 'kevin_scott', fullName: 'Kevin Scott' },
42
+ { id: 'jeff_bezos', fullName: 'Jeff Bezos' },
43
+ ];
44
+
45
+ const testObjects: Record<string, any[]> = {
46
+ [DataType.Organization.typename]: organizations,
47
+ [DataType.Person.typename]: people,
48
+ };
49
+
50
+ const testRelationships: Record<
51
+ string,
52
+ ({
53
+ source: string;
54
+ target: string;
55
+ } & Record<string, any>)[]
56
+ > = {
57
+ [DataType.Employer.typename]: [
58
+ // prettier-ignore
59
+ { source: 'rich_burdon', target: 'dxos' },
60
+ { source: 'rich_burdon', target: 'google', active: false }, // TODO(burdon): Should not contribute to force.
61
+ { source: 'rich_burdon', target: 'deshaw', active: false },
62
+ { source: 'josiah_witt', target: 'dxos' },
63
+ { source: 'dima_dmaretskyi', target: 'dxos' },
64
+ { source: 'chad_fowler', target: 'blueyard' },
65
+ { source: 'chad_fowler', target: 'microsoft', active: false },
66
+ { source: 'ciaran_oleary', target: 'blueyard' },
67
+ { source: 'jason_whitmire', target: 'blueyard' },
68
+ { source: 'juan_benet', target: 'protocol_labs' },
69
+ { source: 'alex_brunicki', target: 'backed' },
70
+ { source: 'andre_de_haes', target: 'backed' },
71
+ { source: 'scott_cohen', target: 'newlab' },
72
+ { source: 'satya_nadella', target: 'microsoft' },
73
+ { source: 'kevin_scott', target: 'microsoft' },
74
+ { source: 'kevin_scott', target: 'google', active: false },
75
+ { source: 'jeff_bezos', target: 'amazon' },
76
+ { source: 'jeff_bezos', target: 'deshaw', active: false },
77
+ ],
78
+
79
+ // TODO(burdon): Limit graph view to selected relationship types.
80
+ [DataType.HasConnection.typename]: [
81
+ // prettier-ignore
82
+ { kind: 'partner', source: 'dxos', target: 'ink_and_switch' },
83
+ { kind: 'partner', source: 'dxos', target: 'effectful' },
84
+ { kind: 'partner', source: 'dxos', target: 'socket_supply' },
85
+
86
+ // prettier-ignore
87
+ { kind: 'investor', source: 'blueyard', target: 'dxos' },
88
+ { kind: 'investor', source: 'blueyard', target: 'protocol_labs' },
89
+ { kind: 'investor', source: 'protocol_labs', target: 'dxos' },
90
+ { kind: 'investor', source: 'backed', target: 'dxos' },
91
+ { kind: 'investor', source: 'newlab', target: 'dxos' },
92
+ { kind: 'investor', source: 'microsoft', target: 'openai' },
93
+ { kind: 'investor', source: 'google', target: 'anthropic' },
94
+ { kind: 'investor', source: 'amazon', target: 'anthropic' },
95
+ ],
96
+ };
97
+
98
+ export const addTestData = async (space: Space): Promise<void> => {
99
+ const objectMap = new Map<string, Live<any>>();
100
+
101
+ for (const [typename, objects] of Object.entries(testObjects)) {
102
+ const schema = space.db.graph.schemaRegistry.getSchema(typename);
103
+ invariant(schema, `Schema not found: ${typename}`);
104
+ for (const { id, ...data } of objects) {
105
+ const object = space.db.add(Obj.make(schema, data));
106
+ objectMap.set(id, object);
107
+ }
108
+ }
109
+
110
+ for (const [typename, relationships] of Object.entries(testRelationships)) {
111
+ const schema = space.db.graph.schemaRegistry.getSchema(typename);
112
+ invariant(schema, `Schema not found: ${typename}`);
113
+
114
+ for (const { source, target, ...data } of relationships) {
115
+ const sourceObject = objectMap.get(source);
116
+ const targetObject = objectMap.get(target);
117
+ invariant(sourceObject, `Source object not found: ${source}`);
118
+ invariant(targetObject, `Target object not found: ${target}`);
119
+
120
+ space.db.add(
121
+ Relation.make(schema, {
122
+ // TODO(burdon): Test source/target types match.
123
+ [Relation.Source]: sourceObject,
124
+ [Relation.Target]: targetObject,
125
+ ...data,
126
+ }),
127
+ );
128
+ }
129
+ }
130
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './data';
6
+ export * from './testing';