@dxos/plugin-assistant 0.8.2 → 0.8.3-main.7f5a14c

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 (213) hide show
  1. package/dist/lib/browser/{AssistantDialog-K6POM23O.mjs → AssistantDialog-YCPMFK7Y.mjs} +5 -4
  2. package/dist/lib/browser/BlueprintContainer-4MEK52NT.mjs +204 -0
  3. package/dist/lib/browser/BlueprintContainer-4MEK52NT.mjs.map +7 -0
  4. package/dist/lib/browser/{ChatContainer-QTO4LE2C.mjs → ChatContainer-RYFYYEWI.mjs} +5 -4
  5. package/dist/lib/browser/{TemplateContainer-AKUYL4AV.mjs → TemplateContainer-QQHVOTSI.mjs} +2 -2
  6. package/dist/lib/browser/TemplateContainer-QQHVOTSI.mjs.map +7 -0
  7. package/dist/lib/browser/{ai-client-COXVUC6V.mjs → ai-client-MTCTMJ5N.mjs} +11 -7
  8. package/dist/lib/browser/ai-client-MTCTMJ5N.mjs.map +7 -0
  9. package/dist/lib/browser/{app-graph-builder-YH4EGNBC.mjs → app-graph-builder-DBCVARVI.mjs} +20 -14
  10. package/dist/lib/browser/app-graph-builder-DBCVARVI.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-3F44MBHU.mjs → chunk-3TIEETB2.mjs} +1 -1
  12. package/dist/lib/browser/{chunk-3F44MBHU.mjs.map → chunk-3TIEETB2.mjs.map} +2 -2
  13. package/dist/lib/browser/chunk-AKYSTUBJ.mjs +16 -0
  14. package/dist/lib/browser/chunk-AKYSTUBJ.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-QTW7KVDO.mjs → chunk-DLWFPGZE.mjs} +65 -70
  16. package/dist/lib/browser/chunk-DLWFPGZE.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-USJBRB3H.mjs → chunk-WFZ4EPPI.mjs} +7 -5
  18. package/dist/lib/browser/{chunk-USJBRB3H.mjs.map → chunk-WFZ4EPPI.mjs.map} +3 -3
  19. package/dist/lib/browser/{chunk-IHEBFO5O.mjs → chunk-ZVHA24BL.mjs} +12 -11
  20. package/dist/lib/browser/chunk-ZVHA24BL.mjs.map +7 -0
  21. package/dist/lib/browser/index.mjs +37 -19
  22. package/dist/lib/browser/index.mjs.map +3 -3
  23. package/dist/lib/browser/{intent-resolver-63EAHENI.mjs → intent-resolver-ID5NOIIJ.mjs} +15 -14
  24. package/dist/lib/browser/intent-resolver-ID5NOIIJ.mjs.map +7 -0
  25. package/dist/lib/browser/meta.json +1 -1
  26. package/dist/lib/browser/{react-surface-XCV6NR75.mjs → react-surface-OD23FVUD.mjs} +26 -15
  27. package/dist/lib/browser/react-surface-OD23FVUD.mjs.map +7 -0
  28. package/dist/lib/browser/{settings-SHNQ4XXP.mjs → settings-FUYUBGSQ.mjs} +4 -4
  29. package/dist/lib/browser/settings-FUYUBGSQ.mjs.map +7 -0
  30. package/dist/lib/browser/types/index.mjs +1 -1
  31. package/dist/lib/node/{AssistantDialog-FDATKYE5.cjs → AssistantDialog-B5YKJOAF.cjs} +9 -8
  32. package/dist/lib/node/{AssistantDialog-FDATKYE5.cjs.map → AssistantDialog-B5YKJOAF.cjs.map} +1 -1
  33. package/dist/lib/node/BlueprintContainer-VD6EIWH7.cjs +229 -0
  34. package/dist/lib/node/BlueprintContainer-VD6EIWH7.cjs.map +7 -0
  35. package/dist/lib/node/{ChatContainer-5CLHJOIQ.cjs → ChatContainer-WFLTSAFA.cjs} +9 -8
  36. package/dist/lib/node/{ChatContainer-5CLHJOIQ.cjs.map → ChatContainer-WFLTSAFA.cjs.map} +1 -1
  37. package/dist/lib/node/{TemplateContainer-CTG2MB4W.cjs → TemplateContainer-JZF2DCCG.cjs} +5 -5
  38. package/dist/lib/node/TemplateContainer-JZF2DCCG.cjs.map +7 -0
  39. package/dist/lib/node/{ai-client-R2CGEYZW.cjs → ai-client-3XNIFMJX.cjs} +14 -10
  40. package/dist/lib/node/ai-client-3XNIFMJX.cjs.map +7 -0
  41. package/dist/lib/node/{app-graph-builder-PSHIOW3Q.cjs → app-graph-builder-VEPLBTML.cjs} +34 -28
  42. package/dist/lib/node/app-graph-builder-VEPLBTML.cjs.map +7 -0
  43. package/dist/lib/node/{chunk-RXPA2C2A.cjs → chunk-7TQAIKE2.cjs} +25 -24
  44. package/dist/lib/node/chunk-7TQAIKE2.cjs.map +7 -0
  45. package/dist/lib/node/chunk-BGRQNE3L.cjs +52 -0
  46. package/dist/lib/node/chunk-BGRQNE3L.cjs.map +7 -0
  47. package/dist/lib/node/{chunk-FLJWJ35M.cjs → chunk-DXBAFX6M.cjs} +13 -10
  48. package/dist/lib/node/{chunk-FLJWJ35M.cjs.map → chunk-DXBAFX6M.cjs.map} +3 -3
  49. package/dist/lib/node/{chunk-H4A42LNR.cjs → chunk-WR5L3TVB.cjs} +86 -92
  50. package/dist/lib/node/chunk-WR5L3TVB.cjs.map +7 -0
  51. package/dist/lib/node/{chunk-TS3H5OSX.cjs → chunk-ZP732NHS.cjs} +4 -4
  52. package/dist/lib/node/{chunk-TS3H5OSX.cjs.map → chunk-ZP732NHS.cjs.map} +2 -2
  53. package/dist/lib/node/index.cjs +69 -48
  54. package/dist/lib/node/index.cjs.map +3 -3
  55. package/dist/lib/node/{intent-resolver-66F7WLW6.cjs → intent-resolver-SDO4YKJK.cjs} +18 -16
  56. package/dist/lib/node/intent-resolver-SDO4YKJK.cjs.map +7 -0
  57. package/dist/lib/node/meta.json +1 -1
  58. package/dist/lib/node/{react-surface-TASAPRPQ.cjs → react-surface-FANQXIRI.cjs} +37 -27
  59. package/dist/lib/node/react-surface-FANQXIRI.cjs.map +7 -0
  60. package/dist/lib/node/{settings-ERKLO6IO.cjs → settings-PXPIPYJN.cjs} +7 -7
  61. package/dist/lib/node/settings-PXPIPYJN.cjs.map +7 -0
  62. package/dist/lib/node/types/index.cjs +14 -14
  63. package/dist/lib/node/types/index.cjs.map +1 -1
  64. package/dist/lib/node-esm/{AssistantDialog-PIMYK774.mjs → AssistantDialog-KPZZD7XC.mjs} +5 -4
  65. package/dist/lib/{browser/AssistantDialog-K6POM23O.mjs.map → node-esm/AssistantDialog-KPZZD7XC.mjs.map} +1 -1
  66. package/dist/lib/node-esm/BlueprintContainer-SVOKCRCP.mjs +205 -0
  67. package/dist/lib/node-esm/BlueprintContainer-SVOKCRCP.mjs.map +7 -0
  68. package/dist/lib/node-esm/{ChatContainer-QTC5NYE2.mjs → ChatContainer-WSMKUGS6.mjs} +5 -4
  69. package/dist/lib/{browser/ChatContainer-QTO4LE2C.mjs.map → node-esm/ChatContainer-WSMKUGS6.mjs.map} +1 -1
  70. package/dist/lib/node-esm/{TemplateContainer-IVDQ4XQG.mjs → TemplateContainer-SOEWY2ZN.mjs} +2 -2
  71. package/dist/lib/node-esm/TemplateContainer-SOEWY2ZN.mjs.map +7 -0
  72. package/dist/lib/node-esm/{ai-client-I5LXHMOZ.mjs → ai-client-YIP44I4D.mjs} +11 -7
  73. package/dist/lib/node-esm/ai-client-YIP44I4D.mjs.map +7 -0
  74. package/dist/lib/node-esm/{app-graph-builder-Z3GMMJMD.mjs → app-graph-builder-WJXDXLBQ.mjs} +20 -14
  75. package/dist/lib/node-esm/app-graph-builder-WJXDXLBQ.mjs.map +7 -0
  76. package/dist/lib/node-esm/{chunk-ZKBACPIW.mjs → chunk-24LIHQST.mjs} +12 -11
  77. package/dist/lib/node-esm/chunk-24LIHQST.mjs.map +7 -0
  78. package/dist/lib/node-esm/{chunk-QU626JMR.mjs → chunk-QFX6SFFZ.mjs} +7 -5
  79. package/dist/lib/node-esm/{chunk-QU626JMR.mjs.map → chunk-QFX6SFFZ.mjs.map} +3 -3
  80. package/dist/lib/node-esm/{chunk-SI5LOQEO.mjs → chunk-TTSMEWR6.mjs} +65 -70
  81. package/dist/lib/node-esm/chunk-TTSMEWR6.mjs.map +7 -0
  82. package/dist/lib/node-esm/{chunk-HLPGKJ7N.mjs → chunk-VXGO6Q2L.mjs} +1 -1
  83. package/dist/lib/node-esm/{chunk-HLPGKJ7N.mjs.map → chunk-VXGO6Q2L.mjs.map} +2 -2
  84. package/dist/lib/node-esm/chunk-ZKTIHNT7.mjs +18 -0
  85. package/dist/lib/node-esm/chunk-ZKTIHNT7.mjs.map +7 -0
  86. package/dist/lib/node-esm/index.mjs +37 -19
  87. package/dist/lib/node-esm/index.mjs.map +3 -3
  88. package/dist/lib/node-esm/{intent-resolver-X3PWH7KM.mjs → intent-resolver-75REJDDQ.mjs} +15 -14
  89. package/dist/lib/node-esm/intent-resolver-75REJDDQ.mjs.map +7 -0
  90. package/dist/lib/node-esm/meta.json +1 -1
  91. package/dist/lib/node-esm/{react-surface-QMIQCXUM.mjs → react-surface-NAN4SDCE.mjs} +26 -15
  92. package/dist/lib/node-esm/react-surface-NAN4SDCE.mjs.map +7 -0
  93. package/dist/lib/node-esm/{settings-IVQRZUCU.mjs → settings-JHMKX3UV.mjs} +4 -4
  94. package/dist/lib/node-esm/settings-JHMKX3UV.mjs.map +7 -0
  95. package/dist/lib/node-esm/types/index.mjs +1 -1
  96. package/dist/types/src/AssistantPlugin.d.ts.map +1 -1
  97. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
  98. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  100. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  101. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  102. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/BlueprintContainer.d.ts +9 -0
  104. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  105. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +8 -3
  106. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +1 -1
  107. package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -1
  108. package/dist/types/src/components/Prompt/PromptBar.stories.d.ts.map +1 -1
  109. package/dist/types/src/components/TemplateContainer.d.ts +2 -2
  110. package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
  111. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
  112. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +1 -1
  113. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
  114. package/dist/types/src/components/Thread/ThreadMessage.d.ts +2 -2
  115. package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -1
  116. package/dist/types/src/components/index.d.ts +4 -2
  117. package/dist/types/src/components/index.d.ts.map +1 -1
  118. package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
  119. package/dist/types/src/hooks/useMessageQueue.d.ts +6 -6
  120. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
  121. package/dist/types/src/index.d.ts +1 -0
  122. package/dist/types/src/index.d.ts.map +1 -1
  123. package/dist/types/src/parser/filter-generator.d.ts +1 -1
  124. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  125. package/dist/types/src/stories/Prompt.stories.d.ts.map +1 -1
  126. package/dist/types/src/stories/Query.stories.d.ts.map +1 -1
  127. package/dist/types/src/stories/Research.stories.d.ts +1 -1
  128. package/dist/types/src/stories/Research.stories.d.ts.map +1 -1
  129. package/dist/types/src/stories/testing.d.ts.map +1 -1
  130. package/dist/types/src/testing/index.d.ts +1 -1
  131. package/dist/types/src/testing/index.d.ts.map +1 -1
  132. package/dist/types/src/testing/test-blueprint.d.ts +8 -0
  133. package/dist/types/src/testing/test-blueprint.d.ts.map +1 -0
  134. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  135. package/dist/types/src/translations.d.ts +13 -62
  136. package/dist/types/src/translations.d.ts.map +1 -1
  137. package/dist/types/src/types/chat.d.ts +3 -3
  138. package/dist/types/src/types/chat.d.ts.map +1 -1
  139. package/dist/types/src/types/service.d.ts +139 -9
  140. package/dist/types/src/types/service.d.ts.map +1 -1
  141. package/dist/types/src/types/template.d.ts.map +1 -1
  142. package/dist/types/src/types/types.d.ts +12 -6
  143. package/dist/types/src/types/types.d.ts.map +1 -1
  144. package/package.json +70 -68
  145. package/src/AssistantPlugin.tsx +9 -9
  146. package/src/capabilities/ai-client.ts +10 -5
  147. package/src/capabilities/app-graph-builder.ts +38 -35
  148. package/src/capabilities/capabilities.ts +1 -0
  149. package/src/capabilities/intent-resolver.ts +15 -7
  150. package/src/capabilities/react-surface.tsx +27 -20
  151. package/src/capabilities/settings.ts +2 -2
  152. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -0
  153. package/src/components/BlueprintContainer.tsx +160 -0
  154. package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +2 -2
  155. package/src/components/BlueprintEditor/BlueprintEditor.tsx +31 -22
  156. package/src/components/Prompt/Prompt.stories.tsx +1 -0
  157. package/src/components/Prompt/PromptBar.stories.tsx +1 -0
  158. package/src/components/TemplateContainer.tsx +5 -2
  159. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  160. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  161. package/src/components/Thread/ThreadContainer.stories.tsx +7 -8
  162. package/src/components/Thread/ThreadContainer.tsx +2 -3
  163. package/src/components/Thread/ThreadMessage.tsx +3 -3
  164. package/src/components/index.ts +1 -0
  165. package/src/hooks/useContextProvider.ts +14 -18
  166. package/src/hooks/useMessageQueue.ts +3 -2
  167. package/src/index.ts +1 -0
  168. package/src/parser/filter-generator.test.ts +1 -1
  169. package/src/parser/filter-generator.ts +1 -1
  170. package/src/stories/Prompt.stories.tsx +1 -0
  171. package/src/stories/Query.stories.tsx +116 -50
  172. package/src/stories/Research.stories.tsx +26 -39
  173. package/src/stories/test-data.ts +9 -9
  174. package/src/stories/testing.ts +1 -5
  175. package/src/testing/index.ts +1 -1
  176. package/src/testing/{blueprint.ts → test-blueprint.ts} +28 -17
  177. package/src/testing/test-services.ts +6 -6
  178. package/src/tools/function.ts +2 -2
  179. package/src/tools/openapi.test.ts +6 -12
  180. package/src/tools/openapi.ts +5 -5
  181. package/src/translations.ts +9 -2
  182. package/src/types/chat.ts +3 -4
  183. package/src/types/service.ts +8 -4
  184. package/src/types/template.ts +4 -1
  185. package/src/types/types.ts +3 -3
  186. package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs.map +0 -7
  187. package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +0 -7
  188. package/dist/lib/browser/app-graph-builder-YH4EGNBC.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-IHEBFO5O.mjs.map +0 -7
  190. package/dist/lib/browser/chunk-QTW7KVDO.mjs.map +0 -7
  191. package/dist/lib/browser/intent-resolver-63EAHENI.mjs.map +0 -7
  192. package/dist/lib/browser/react-surface-XCV6NR75.mjs.map +0 -7
  193. package/dist/lib/browser/settings-SHNQ4XXP.mjs.map +0 -7
  194. package/dist/lib/node/TemplateContainer-CTG2MB4W.cjs.map +0 -7
  195. package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +0 -7
  196. package/dist/lib/node/app-graph-builder-PSHIOW3Q.cjs.map +0 -7
  197. package/dist/lib/node/chunk-H4A42LNR.cjs.map +0 -7
  198. package/dist/lib/node/chunk-RXPA2C2A.cjs.map +0 -7
  199. package/dist/lib/node/intent-resolver-66F7WLW6.cjs.map +0 -7
  200. package/dist/lib/node/react-surface-TASAPRPQ.cjs.map +0 -7
  201. package/dist/lib/node/settings-ERKLO6IO.cjs.map +0 -7
  202. package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs.map +0 -7
  203. package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +0 -7
  204. package/dist/lib/node-esm/app-graph-builder-Z3GMMJMD.mjs.map +0 -7
  205. package/dist/lib/node-esm/chunk-SI5LOQEO.mjs.map +0 -7
  206. package/dist/lib/node-esm/chunk-ZKBACPIW.mjs.map +0 -7
  207. package/dist/lib/node-esm/intent-resolver-X3PWH7KM.mjs.map +0 -7
  208. package/dist/lib/node-esm/react-surface-QMIQCXUM.mjs.map +0 -7
  209. package/dist/lib/node-esm/settings-IVQRZUCU.mjs.map +0 -7
  210. package/dist/types/src/testing/blueprint.d.ts +0 -7
  211. package/dist/types/src/testing/blueprint.d.ts.map +0 -1
  212. /package/dist/lib/{node-esm/AssistantDialog-PIMYK774.mjs.map → browser/AssistantDialog-YCPMFK7Y.mjs.map} +0 -0
  213. /package/dist/lib/{node-esm/ChatContainer-QTC5NYE2.mjs.map → browser/ChatContainer-RYFYYEWI.mjs.map} +0 -0
@@ -5,7 +5,7 @@
5
5
  import { useMemo } from 'react';
6
6
 
7
7
  import { type Message } from '@dxos/ai';
8
- import { createQueueDxn } from '@dxos/echo-schema';
8
+ import { createQueueDXN } from '@dxos/echo-schema';
9
9
  import { getSpace, useQueue } from '@dxos/react-client/echo';
10
10
 
11
11
  import { type AIChatType } from '../types';
@@ -13,8 +13,9 @@ import { type AIChatType } from '../types';
13
13
  export const useMessageQueue = (chat?: AIChatType) => {
14
14
  const space = getSpace(chat);
15
15
  const queueDxn = useMemo(() => {
16
+ // TODO(dmaretskyi): Chat.queue.dxn should be a valid DXN already.
16
17
  const dxn = space && chat?.queue.dxn;
17
- return dxn ? createQueueDxn(space.id, dxn.parts.at(-1)) : undefined;
18
+ return dxn ? createQueueDXN(space.id, dxn.parts.at(-1)) : undefined;
18
19
  }, [space, chat?.queue.dxn]);
19
20
 
20
21
  return useQueue<Message>(queueDxn);
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ export * from './capabilities';
5
6
  export * from './components';
6
7
  export * from './meta';
7
8
  export * from './types';
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { describe, test } from 'vitest';
6
6
 
7
- import { Filter } from '@dxos/echo-schema';
7
+ import { Filter } from '@dxos/echo';
8
8
 
9
9
  import { createFilter } from './filter-generator';
10
10
  import { QueryParser } from './query-parser';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Filter } from '@dxos/echo-schema';
5
+ import { Filter } from '@dxos/echo';
6
6
 
7
7
  import {
8
8
  type BinaryExpression,
@@ -47,6 +47,7 @@ const meta: Meta<typeof PromptBar> = {
47
47
  parameters: {
48
48
  translations,
49
49
  layout: 'centered',
50
+ controls: { disable: true },
50
51
  },
51
52
  };
52
53
 
@@ -5,18 +5,18 @@
5
5
  import '@dxos-theme';
6
6
 
7
7
  import { type Meta, type StoryObj } from '@storybook/react';
8
- import { Schema } from 'effect';
9
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
+ import { Match, Schema } from 'effect';
9
+ import React, { useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';
10
10
 
11
11
  import { AIServiceEdgeClient, type AIServiceEdgeClientOptions } from '@dxos/ai';
12
12
  import { SpyAIService } from '@dxos/ai/testing';
13
13
  import { Events } from '@dxos/app-framework';
14
14
  import { withPluginManager } from '@dxos/app-framework/testing';
15
15
  import { localServiceEndpoints, remoteServiceEndpoints } from '@dxos/artifact-testing';
16
- import { BlueprintParser, BlueprintMachine, setConsolePrinter } from '@dxos/assistant';
17
- import { Filter, Queue, type Space } from '@dxos/client/echo';
18
- import { Type } from '@dxos/echo';
19
- import { type AnyEchoObject, create, getLabelForObject, getTypename, Ref } from '@dxos/echo-schema';
16
+ import { BlueprintMachine, BlueprintParser, BufferedLogger, setConsolePrinter, setLogger } from '@dxos/assistant';
17
+ import { combine } from '@dxos/async';
18
+ import { Queue, type Space } from '@dxos/client/echo';
19
+ import { DXN, Filter, Obj, Ref, Type } from '@dxos/echo';
20
20
  import { SelectionModel } from '@dxos/graph';
21
21
  import { log } from '@dxos/log';
22
22
  import { D3ForceGraph, type D3ForceGraphProps } from '@dxos/plugin-explorer';
@@ -26,24 +26,24 @@ import { useQueue } from '@dxos/react-client/echo';
26
26
  import { Dialog, IconButton, Toolbar, useAsyncState, useTranslation } from '@dxos/react-ui';
27
27
  import {
28
28
  matchCompletion,
29
- staticCompletion,
30
29
  typeahead,
30
+ staticCompletion,
31
31
  type TypeaheadContext,
32
32
  type TypeaheadOptions,
33
33
  } from '@dxos/react-ui-editor';
34
34
  import { List } from '@dxos/react-ui-list';
35
35
  import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
36
36
  import { getHashColor, mx } from '@dxos/react-ui-theme';
37
- import { DataType, SpaceGraphModel } from '@dxos/schema';
37
+ import { DataType, DataTypes, SpaceGraphModel } from '@dxos/schema';
38
38
  import { createObjectFactory, type TypeSpec, type ValueGenerator } from '@dxos/schema/testing';
39
39
  import { withLayout, withTheme } from '@dxos/storybook-utils';
40
40
 
41
41
  import { addTestData } from './test-data';
42
42
  import { testPlugins } from './testing';
43
- import { AmbientDialog, PromptBar, type PromptController, type PromptBarProps } from '../components';
43
+ import { AmbientDialog, PromptBar, type PromptBarProps, type PromptController } from '../components';
44
44
  import { ASSISTANT_PLUGIN } from '../meta';
45
- import { createFilter, type Expression, QueryParser } from '../parser';
46
- import { RESEARCH_BLUEPRINT, createTools } from '../testing';
45
+ import { QueryParser, createFilter, type Expression } from '../parser';
46
+ import { createToolRegistry, RESEARCH_BLUEPRINT } from '../testing';
47
47
  import translations from '../translations';
48
48
 
49
49
  faker.seed(1);
@@ -63,6 +63,18 @@ const aiConfig: AIServiceEdgeClientOptions = {
63
63
  },
64
64
  };
65
65
 
66
+ /**
67
+ * Container for a set of ephemeral research results.
68
+ */
69
+ const ResearchGraph = Schema.Struct({
70
+ queue: Type.Ref(Queue),
71
+ }).pipe(
72
+ Type.Obj({
73
+ typename: 'dxos.org/type/ResearchGraph',
74
+ version: '0.1.0',
75
+ }),
76
+ );
77
+
66
78
  type Mode = 'graph' | 'list';
67
79
 
68
80
  type StoryProps = { mode?: Mode; spec?: TypeSpec[] } & D3ForceGraphProps;
@@ -116,8 +128,7 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
116
128
  } else {
117
129
  const queue = space.queues.create();
118
130
  return space.db.add(
119
- create(ResearchGraph, {
120
- // TODO(dmaretskyi): Ref.make(queue)
131
+ Obj.make(ResearchGraph, {
121
132
  queue: Ref.fromDXN(queue.dxn),
122
133
  }),
123
134
  );
@@ -145,30 +156,29 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
145
156
  model?.nodes
146
157
  .filter((node) => {
147
158
  try {
148
- getTypename(node.data.object as AnyEchoObject);
159
+ Obj.getTypename(node.data.object as Obj.Any);
149
160
  return true;
150
161
  } catch {
151
162
  return false;
152
163
  }
153
164
  })
154
- .map((node) => node.data.object as AnyEchoObject) ?? [];
165
+ .map((node) => node.data.object as Obj.Any) ?? [];
155
166
 
156
167
  //
157
168
  // AI
158
169
  //
159
170
 
160
171
  const aiClient = useMemo(() => new SpyAIService(new AIServiceEdgeClient(aiConfig)), []);
172
+ const tools = useMemo(
173
+ () => space && researchGraph && createToolRegistry(space, researchGraph.queue.dxn),
174
+ [space, researchGraph?.queue.dxn],
175
+ );
161
176
 
162
177
  const researchQueue = useQueue(researchGraph?.queue.dxn, { pollInterval: 1_000 });
163
178
 
164
- const researchBlueprint = useMemo(() => {
165
- if (!space || !researchGraph) {
166
- return undefined;
167
- }
179
+ const researchBlueprint = useMemo(() => BlueprintParser.create().parse(RESEARCH_BLUEPRINT), []);
168
180
 
169
- const tools = createTools(space, researchGraph?.queue.dxn);
170
- return BlueprintParser.create(tools).parse(RESEARCH_BLUEPRINT);
171
- }, [space, researchGraph?.queue.dxn]);
181
+ const logger = useMemo(() => new BufferedLogger(), []);
172
182
 
173
183
  //
174
184
  // Handlers
@@ -179,17 +189,27 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
179
189
  }, [model]);
180
190
 
181
191
  const handleResearch = useCallback(async () => {
182
- if (!space || !researchBlueprint) {
192
+ if (!space || !tools || !researchBlueprint) {
183
193
  return;
184
194
  }
185
195
 
196
+ const resolver = space.db.graph.createRefResolver({
197
+ context: {
198
+ space: space.db.spaceId,
199
+ queue: researchGraph?.queue.dxn,
200
+ },
201
+ });
202
+
186
203
  const selected = selection.selected.value;
204
+ const objects = await Promise.all(selected.map((id) => resolver.resolve(DXN.fromLocalObjectId(id))));
205
+ const machine = new BlueprintMachine(tools, researchBlueprint);
206
+ const cleanup = combine(setConsolePrinter(machine, true), setLogger(machine, logger));
207
+
187
208
  log.info('starting research...', { selected });
188
- const { objects } = await space.db.query(Filter.ids(...selected)).run();
189
- const machine = new BlueprintMachine(researchBlueprint);
190
- setConsolePrinter(machine, true);
191
- await machine.runToCompletion({ aiService: aiClient, input: objects });
192
- }, [space, aiClient, researchBlueprint, selection]);
209
+ await machine.runToCompletion({ aiClient, input: objects });
210
+
211
+ cleanup();
212
+ }, [space, aiClient, tools, researchBlueprint, selection]);
193
213
 
194
214
  const handleGenerate = useCallback(async () => {
195
215
  if (!space) {
@@ -202,9 +222,6 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
202
222
  } else {
203
223
  await addTestData(space);
204
224
  }
205
-
206
- // TODO(burdon): BUG: objects are not persisted unless this is called.
207
- await space.db.flush({ indexes: true });
208
225
  }, [space, generator, spec]);
209
226
 
210
227
  const handleReset = useCallback(
@@ -262,6 +279,8 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
262
279
 
263
280
  const extensions = useMemo(() => [typeahead({ onComplete: handleMatch })], [handleMatch]);
264
281
 
282
+ const { state: flushState, handleFlush } = useFlush(space);
283
+
265
284
  return (
266
285
  <div className='grow grid overflow-hidden'>
267
286
  <div className={mx('grow grid overflow-hidden', !mode && 'grid-cols-[1fr_30rem]')}>
@@ -270,7 +289,7 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
270
289
  )}
271
290
 
272
291
  {showList && (
273
- <div className='grow grid grid-rows-[min-content_1fr_1fr] overflow-hidden divide-y divide-separator'>
292
+ <div className='grow grid grid-rows-[min-content_1fr_1fr_1fr] overflow-hidden divide-y divide-separator'>
274
293
  <Toolbar.Root>
275
294
  <IconButton icon='ph--arrow-clockwise--regular' iconOnly label='refresh' onClick={handleRefresh} />
276
295
  <IconButton icon='ph--sparkle--regular' iconOnly label='research' onClick={handleResearch} />
@@ -281,13 +300,29 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
281
300
  label='reset'
282
301
  onClick={(event) => handleReset(event.shiftKey)}
283
302
  />
303
+ <IconButton
304
+ disabled={flushState === 'flushing'}
305
+ icon={Match.value(flushState).pipe(
306
+ Match.when('idle', () => 'ph--floppy-disk--regular'),
307
+ Match.when('flushing', () => 'ph--spinner--regular'),
308
+ Match.when('flushed', () => 'ph--check--regular'),
309
+ Match.exhaustive,
310
+ )}
311
+ iconOnly
312
+ label='flush'
313
+ onClick={handleFlush}
314
+ />
284
315
  </Toolbar.Root>
285
316
  <ItemList items={objects} />
317
+ <Log logger={logger} />
286
318
  <JsonFilter
287
319
  data={{
288
320
  space: client.spaces.get().length,
289
321
  db: space?.db.toJSON(),
290
- queue: researchQueue?.toJSON(),
322
+ queue: {
323
+ dxn: researchQueue?.dxn.toString(),
324
+ objects: researchQueue?.objects.length,
325
+ },
291
326
  model: model?.toJSON(),
292
327
  selection: selection.toJSON(),
293
328
  ast,
@@ -340,20 +375,8 @@ const createMatcher =
340
375
  }
341
376
  };
342
377
 
343
- /**
344
- * Container for a set of ephemeral research results.
345
- */
346
- const ResearchGraph = Schema.Struct({
347
- queue: Ref(Queue),
348
- }).pipe(
349
- Type.Obj({
350
- typename: 'dxos.org/type/ResearchGraph',
351
- version: '0.1.0',
352
- }),
353
- );
354
-
355
378
  // TODO(burdon): Replace with card list.
356
- const ItemList = <T extends AnyEchoObject>({ items = [] }: { items?: T[] }) => {
379
+ const ItemList = <T extends Obj.Any>({ items = [] }: { items?: T[] }) => {
357
380
  return (
358
381
  <List.Root<T> items={items}>
359
382
  {({ items }) => (
@@ -366,10 +389,12 @@ const ItemList = <T extends AnyEchoObject>({ items = [] }: { items?: T[] }) => {
366
389
  classNames='grid grid-cols-[4rem_16rem_1fr] min-h-[32px] items-center'
367
390
  >
368
391
  <div className='text-xs font-mono font-thin px-1 text-subdued'>{item.id.slice(-6)}</div>
369
- <div className={mx('text-xs font-mono font-thin truncate px-1', getHashColor(getTypename(item))?.text)}>
370
- {getTypename(item)}
392
+ <div
393
+ className={mx('text-xs font-mono font-thin truncate px-1', getHashColor(Obj.getTypename(item))?.text)}
394
+ >
395
+ {Obj.getTypename(item)}
371
396
  </div>
372
- <List.ItemTitle>{getLabelForObject(item)}</List.ItemTitle>
397
+ <List.ItemTitle>{Obj.getLabel(item)}</List.ItemTitle>
373
398
  </List.Item>
374
399
  ))}
375
400
  </div>
@@ -378,6 +403,46 @@ const ItemList = <T extends AnyEchoObject>({ items = [] }: { items?: T[] }) => {
378
403
  );
379
404
  };
380
405
 
406
+ const useFlush = (space?: Space) => {
407
+ const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');
408
+ const resetTimer = useRef<NodeJS.Timeout | null>(null);
409
+
410
+ const handleFlush = useCallback(() => {
411
+ if (!space) {
412
+ return;
413
+ }
414
+
415
+ queueMicrotask(async () => {
416
+ if (resetTimer.current) {
417
+ clearTimeout(resetTimer.current);
418
+ }
419
+
420
+ setState('flushing');
421
+ await space.db.flush();
422
+ setState('flushed');
423
+
424
+ resetTimer.current = setTimeout(() => {
425
+ setState('idle');
426
+ resetTimer.current = null;
427
+ }, 1_000);
428
+ });
429
+ }, [space]);
430
+
431
+ return { state, handleFlush };
432
+ };
433
+
434
+ const Log: FC<{ logger: BufferedLogger }> = ({ logger }) => {
435
+ return (
436
+ <div className='grow flex flex-col p-1 overflow-y-auto text-sm'>
437
+ {logger.messages.value.map((message, index) => (
438
+ <div key={index} className='text-subdued'>
439
+ {message}
440
+ </div>
441
+ ))}
442
+ </div>
443
+ );
444
+ };
445
+
381
446
  const meta: Meta<typeof DefaultStory> = {
382
447
  title: 'plugins/plugin-assistant/Query',
383
448
  render: DefaultStory,
@@ -385,7 +450,7 @@ const meta: Meta<typeof DefaultStory> = {
385
450
  withPluginManager({
386
451
  fireEvents: [Events.SetupArtifactDefinition],
387
452
  plugins: testPlugins({
388
- types: [ResearchGraph],
453
+ types: [...DataTypes, ResearchGraph],
389
454
  config: {
390
455
  runtime: {
391
456
  client: {
@@ -403,6 +468,7 @@ const meta: Meta<typeof DefaultStory> = {
403
468
  ],
404
469
  parameters: {
405
470
  translations,
471
+ controls: { disable: true },
406
472
  },
407
473
  };
408
474
 
@@ -16,38 +16,24 @@ import { withPluginManager } from '@dxos/app-framework/testing';
16
16
  import { localServiceEndpoints, remoteServiceEndpoints } from '@dxos/artifact-testing';
17
17
  import { findRelatedSchema, researchFn, type RelatedSchema } from '@dxos/assistant';
18
18
  import { raise } from '@dxos/debug';
19
- import { Type, type Obj } from '@dxos/echo';
20
- import {
21
- ATTR_RELATION_SOURCE,
22
- ATTR_RELATION_TARGET,
23
- create,
24
- createQueueDxn,
25
- getSchema,
26
- getSchemaDXN,
27
- getTypename,
28
- isInstanceOf,
29
- toJsonSchema,
30
- type BaseObject,
31
- Filter,
32
- RelationSourceId,
33
- RelationTargetId,
34
- } from '@dxos/echo-schema';
19
+ import { Type, Filter, Obj, Relation } from '@dxos/echo';
20
+ import { ATTR_RELATION_SOURCE, ATTR_RELATION_TARGET } from '@dxos/echo-schema';
35
21
  import { ConfiguredCredentialsService, FunctionExecutor, ServiceContainer, TracingService } from '@dxos/functions';
36
22
  import { invariant } from '@dxos/invariant';
37
23
  import { log } from '@dxos/log';
38
24
  import { ForceGraph, useGraphModel } from '@dxos/plugin-explorer';
39
25
  import { useClient } from '@dxos/react-client';
40
- import { getSpace, live, useQuery, useQueue, type EchoDatabase, type Live } from '@dxos/react-client/echo';
26
+ import { getSpace, useQuery, useQueue, type EchoDatabase, type Live } from '@dxos/react-client/echo';
41
27
  import { IconButton, Input, Toolbar, useAsyncState } from '@dxos/react-ui';
42
28
  import {
43
29
  createMenuAction,
44
30
  createMenuItemGroup,
45
- MenuProvider,
46
- ToolbarMenu,
31
+ rxFromSignal,
47
32
  useMenuActions,
48
33
  type ActionGraphProps,
34
+ MenuProvider,
35
+ ToolbarMenu,
49
36
  type ToolbarMenuActionGroupProperties,
50
- rxFromSignal,
51
37
  } from '@dxos/react-ui-menu';
52
38
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
53
39
  import { mx } from '@dxos/react-ui-theme';
@@ -73,8 +59,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
73
59
  const [, forceUpdate] = useState({});
74
60
 
75
61
  const client = useClient();
76
- // TODO(burdon): Hook.
77
- const [aiClient] = useState(
62
+ const aiClient = useMemo(
78
63
  () =>
79
64
  new SpyAIService(
80
65
  new AIServiceEdgeClient({
@@ -85,6 +70,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
85
70
  },
86
71
  }),
87
72
  ),
73
+ [],
88
74
  );
89
75
 
90
76
  const space = client.spaces.default;
@@ -94,7 +80,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
94
80
  const menuProps = useMenuActions(actionCreator);
95
81
 
96
82
  // Queue.
97
- const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn(space.id).toString());
83
+ const [queueDxn, setQueueDxn] = useState<string>(() => space.queues.create().dxn.toString());
98
84
  const queue = useQueue<Message>(Type.DXN.tryParse(queueDxn));
99
85
 
100
86
  // Function executor.
@@ -148,7 +134,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
148
134
  useEffect(() => {
149
135
  if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
150
136
  queue.append([
151
- create(Message, {
137
+ Obj.make(Message, {
152
138
  role: 'assistant',
153
139
  content: prompts.map(
154
140
  (prompt) =>
@@ -166,7 +152,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
166
152
  // State.
167
153
  const objects = useQuery(space, Filter.or(...DataTypes.map((type) => Filter.type(type))));
168
154
  const messages = [
169
- ...(queue?.objects.filter((item) => isInstanceOf(Message, item)) ?? []),
155
+ ...(queue?.objects.filter((item) => Obj.instanceOf(Message, item)) ?? []),
170
156
  ...(processor?.messages.value ?? []),
171
157
  ];
172
158
 
@@ -210,20 +196,20 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
210
196
  );
211
197
 
212
198
  // TODO(dmaretskyi): Pull in relations automatically.
213
- const handleAddToGraph = useCallback(async (object: BaseObject) => {
199
+ const handleAddToGraph = useCallback(async (object: Obj.Any) => {
214
200
  space.db.add(instantiate(space.db, object));
215
201
  await space.db.flush({ indexes: true });
216
202
  forceUpdate({});
217
203
  }, []);
218
204
 
219
- const handleResearchMore = useCallback((object: BaseObject, relatedSchema: RelatedSchema) => {
205
+ const handleResearchMore = useCallback((object: Obj.Any, relatedSchema: RelatedSchema) => {
220
206
  const prompt = `
221
207
  Research more about objects related to the object in terms of the by the specific relation schema:
222
208
  <object>${JSON.stringify(object, null, 2)}</object>
223
209
  <schema>
224
210
  <description>${SchemaAST.getDescriptionAnnotation(relatedSchema.schema.ast).pipe(Option.getOrElse(() => ''))}</description>
225
211
  <json>
226
- ${JSON.stringify(toJsonSchema(relatedSchema.schema), null, 2)}
212
+ ${JSON.stringify(Type.toJsonSchema(relatedSchema.schema), null, 2)}
227
213
  </json>
228
214
  </schema>
229
215
  `;
@@ -254,7 +240,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
254
240
  iconOnly
255
241
  label='Clear history'
256
242
  icon='ph--trash--regular'
257
- onClick={() => setQueueDxn(createQueueDxn().toString())}
243
+ onClick={() => setQueueDxn(space.queues.create().dxn.toString())}
258
244
  />
259
245
  <IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
260
246
  </Input.Root>
@@ -308,20 +294,20 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
308
294
  };
309
295
 
310
296
  type ResearchPromptsProps = {
311
- object: BaseObject;
312
- onResearch: (object: BaseObject, relatedSchema: RelatedSchema) => void;
297
+ object: Obj.Any;
298
+ onResearch: (object: Obj.Any, relatedSchema: RelatedSchema) => void;
313
299
  };
314
300
 
315
301
  const ResearchPrompts = ({ object, onResearch }: ResearchPromptsProps) => {
316
302
  const [relatedSchemas = []] = useAsyncState(
317
- async () => findRelatedSchema(getSpace(object)!.db, getSchema(object)!),
303
+ async () => findRelatedSchema(getSpace(object)!.db, Obj.getSchema(object)!),
318
304
  [object],
319
305
  );
320
306
  return (
321
307
  <div>
322
308
  {relatedSchemas.map((schema) => (
323
309
  <button
324
- key={getSchemaDXN(schema.schema)?.toString()}
310
+ key={Type.getDXN(schema.schema)?.toString()}
325
311
  onClick={() => onResearch(object, schema)}
326
312
  className='border border-separator rounded px-2 py-1 m-1'
327
313
  >
@@ -342,7 +328,7 @@ const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn
342
328
  serviceContainer.clone().setServices({
343
329
  tracing: {
344
330
  write: (event) => {
345
- if (isInstanceOf(AgentStatusReport, event)) {
331
+ if (Obj.instanceOf(AgentStatusReport, event)) {
346
332
  log.info('[too] report status', { status: event });
347
333
  reportStatus?.(event);
348
334
  }
@@ -352,7 +338,7 @@ const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn
352
338
  );
353
339
 
354
340
  reportStatus?.(
355
- create(AgentStatusReport, {
341
+ Obj.make(AgentStatusReport, {
356
342
  message: 'Researching...',
357
343
  }),
358
344
  );
@@ -382,7 +368,7 @@ const createResearchTool = (serviceContainer: ServiceContainer, name: string, fn
382
368
  // TODO(dmaretskyi): Move into core.
383
369
  const instantiate = (db: EchoDatabase, object: unknown): Live<any> => {
384
370
  const schema =
385
- db.graph.schemaRegistry.getSchemaByDXN(Type.DXN.parse(getTypename(object as any)!)) ??
371
+ db.graph.schemaRegistry.getSchemaByDXN(Type.DXN.parse(Obj.getTypename(object as any)!)) ??
386
372
  raise(new Error('Schema not found'));
387
373
 
388
374
  let { id, [ATTR_RELATION_SOURCE]: source, [ATTR_RELATION_TARGET]: target, ...props } = object as any;
@@ -393,11 +379,11 @@ const instantiate = (db: EchoDatabase, object: unknown): Live<any> => {
393
379
  target = db.getObjectById(Type.DXN.parse(target).asEchoDXN()!.echoId) ?? raise(new Error('Target not found'));
394
380
  }
395
381
 
396
- return live(schema, {
382
+ return Relation.make(schema, {
397
383
  id,
398
384
  ...props,
399
- [RelationSourceId]: source,
400
- [RelationTargetId]: target,
385
+ [Relation.Source]: source,
386
+ [Relation.Target]: target,
401
387
  });
402
388
  };
403
389
 
@@ -476,6 +462,7 @@ const meta: Meta<typeof DefaultStory> = {
476
462
  ],
477
463
  parameters: {
478
464
  translations,
465
+ controls: { disable: true },
479
466
  },
480
467
  };
481
468
 
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Live, type Space } from '@dxos/client/echo';
6
- import { create, getSchemaTypename, RelationSourceId, RelationTargetId } from '@dxos/echo-schema';
6
+ import { Obj, Type, Relation } from '@dxos/echo';
7
7
  import { invariant } from '@dxos/invariant';
8
8
  import { DataType } from '@dxos/schema';
9
9
 
@@ -41,8 +41,8 @@ const people: DataType.Person[] = [
41
41
  ];
42
42
 
43
43
  const testObjects: Record<string, any[]> = {
44
- [getSchemaTypename(DataType.Organization)!]: organizations,
45
- [getSchemaTypename(DataType.Person)!]: people,
44
+ [Type.getTypename(DataType.Organization)!]: organizations,
45
+ [Type.getTypename(DataType.Person)!]: people,
46
46
  };
47
47
 
48
48
  const testRelationships: Record<
@@ -52,7 +52,7 @@ const testRelationships: Record<
52
52
  target: string;
53
53
  } & Record<string, any>)[]
54
54
  > = {
55
- [getSchemaTypename(DataType.Employer)!]: [
55
+ [Type.getTypename(DataType.Employer)!]: [
56
56
  // @eslint-disable-next-line
57
57
  { source: 'rich_burdon', target: 'dxos' },
58
58
  { source: 'rich_burdon', target: 'google', active: false }, // TODO(burdon): Should not contribute to force.
@@ -75,7 +75,7 @@ const testRelationships: Record<
75
75
  ],
76
76
 
77
77
  // TODO(burdon): Limit graph view to selected relationship types.
78
- [getSchemaTypename(DataType.HasConnection)!]: [
78
+ [Type.getTypename(DataType.HasConnection)!]: [
79
79
  //
80
80
  { kind: 'partner', source: 'dxos', target: 'ink_and_switch' },
81
81
  { kind: 'partner', source: 'dxos', target: 'effectful' },
@@ -100,7 +100,7 @@ export const addTestData = async (space: Space): Promise<void> => {
100
100
  const schema = space.db.graph.schemaRegistry.getSchema(typename);
101
101
  invariant(schema, `Schema not found: ${typename}`);
102
102
  for (const { id, ...data } of objects) {
103
- const object = space.db.add(create(schema, data));
103
+ const object = space.db.add(Obj.make(schema, data));
104
104
  objectMap.set(id, object);
105
105
  }
106
106
  }
@@ -116,11 +116,11 @@ export const addTestData = async (space: Space): Promise<void> => {
116
116
  invariant(targetObject, `Target object not found: ${target}`);
117
117
 
118
118
  space.db.add(
119
- create(schema, {
119
+ Obj.make(schema, {
120
120
  ...data,
121
121
  // TODO(burdon): Test source/target types match.
122
- [RelationSourceId]: sourceObject,
123
- [RelationTargetId]: targetObject,
122
+ [Relation.Source]: sourceObject,
123
+ [Relation.Target]: targetObject,
124
124
  }),
125
125
  );
126
126
  }
@@ -20,11 +20,7 @@ import { type IndexConfig } from '@dxos/protocols/proto/dxos/echo/indexing';
20
20
  import { Config } from '@dxos/react-client';
21
21
  import { DataTypes } from '@dxos/schema';
22
22
 
23
- type TestPluginsOptions = {
24
- config?: ConfigProto;
25
- types?: Schema.Schema.AnyNoContext[];
26
- indexConfig?: IndexConfig;
27
- };
23
+ type TestPluginsOptions = { config?: ConfigProto; types?: Schema.Schema.AnyNoContext[]; indexConfig?: IndexConfig };
28
24
 
29
25
  export const testPlugins = ({ config, types = DataTypes, indexConfig }: TestPluginsOptions = {}) => [
30
26
  ClientPlugin({
@@ -2,6 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './blueprint';
5
+ export * from './test-blueprint';
6
6
  export * from './test-functions';
7
7
  export * from './test-services';