@dxos/plugin-assistant 0.8.3-main.672df60 → 0.8.3-staging.0fa589b

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 (220) hide show
  1. package/dist/lib/browser/{AssistantDialog-UAZSN6GT.mjs → AssistantDialog-MQOOR364.mjs} +5 -4
  2. package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs +321 -0
  3. package/dist/lib/browser/BlueprintContainer-AT5Y7EXG.mjs.map +7 -0
  4. package/dist/lib/browser/{ChatContainer-UTN3AO5U.mjs → ChatContainer-C2NEAS3A.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-MK2ZZII2.mjs} +12 -8
  8. package/dist/lib/browser/ai-client-MK2ZZII2.mjs.map +7 -0
  9. package/dist/lib/browser/{app-graph-builder-56OZ5RW4.mjs → app-graph-builder-E4H5DCOJ.mjs} +52 -33
  10. package/dist/lib/browser/app-graph-builder-E4H5DCOJ.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-NBSPGIHL.mjs → chunk-AAOKC2JN.mjs} +17 -15
  12. package/dist/lib/browser/chunk-AAOKC2JN.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-6SD7S7W5.mjs → chunk-BI6AHRNJ.mjs} +8 -8
  14. package/dist/lib/browser/{chunk-6SD7S7W5.mjs.map → chunk-BI6AHRNJ.mjs.map} +3 -3
  15. package/dist/lib/browser/{chunk-Q6XE3O3E.mjs → chunk-JO4W3MF7.mjs} +44 -73
  16. package/dist/lib/browser/chunk-JO4W3MF7.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-MEGMOFJB.mjs +16 -0
  18. package/dist/lib/browser/chunk-MEGMOFJB.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-3F44MBHU.mjs → chunk-UE3IZ4PN.mjs} +1 -1
  20. package/dist/lib/browser/{chunk-3F44MBHU.mjs.map → chunk-UE3IZ4PN.mjs.map} +2 -2
  21. package/dist/lib/browser/index.mjs +84 -30
  22. package/dist/lib/browser/index.mjs.map +4 -4
  23. package/dist/lib/browser/{intent-resolver-GWELYIX2.mjs → intent-resolver-3UICTGPM.mjs} +12 -8
  24. package/dist/lib/browser/intent-resolver-3UICTGPM.mjs.map +7 -0
  25. package/dist/lib/browser/meta.json +1 -1
  26. package/dist/lib/browser/{react-surface-DGS34EON.mjs → react-surface-LXCNUSZN.mjs} +29 -14
  27. package/dist/lib/browser/react-surface-LXCNUSZN.mjs.map +7 -0
  28. package/dist/lib/browser/{settings-BTFB7IQ6.mjs → settings-XRHXVWGB.mjs} +4 -4
  29. package/dist/lib/browser/settings-XRHXVWGB.mjs.map +7 -0
  30. package/dist/lib/browser/types/index.mjs +1 -1
  31. package/dist/lib/node/{AssistantDialog-RTB5Q7FP.cjs → AssistantDialog-AN4Z6YUV.cjs} +9 -8
  32. package/dist/lib/node/{AssistantDialog-RTB5Q7FP.cjs.map → AssistantDialog-AN4Z6YUV.cjs.map} +1 -1
  33. package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs +344 -0
  34. package/dist/lib/node/BlueprintContainer-NOWLDYCZ.cjs.map +7 -0
  35. package/dist/lib/node/{ChatContainer-P3JL4VZ7.cjs → ChatContainer-VKYBQHUB.cjs} +9 -8
  36. package/dist/lib/node/{ChatContainer-P3JL4VZ7.cjs.map → ChatContainer-VKYBQHUB.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-7HNSMUMT.cjs} +14 -10
  40. package/dist/lib/node/ai-client-7HNSMUMT.cjs.map +7 -0
  41. package/dist/lib/node/{app-graph-builder-QLF353LH.cjs → app-graph-builder-PPR5B5KU.cjs} +63 -44
  42. package/dist/lib/node/app-graph-builder-PPR5B5KU.cjs.map +7 -0
  43. package/dist/lib/node/chunk-FUAGEO7Q.cjs +52 -0
  44. package/dist/lib/node/chunk-FUAGEO7Q.cjs.map +7 -0
  45. package/dist/lib/node/{chunk-BWL5A3O5.cjs → chunk-IKZBMHSW.cjs} +14 -14
  46. package/dist/lib/node/{chunk-BWL5A3O5.cjs.map → chunk-IKZBMHSW.cjs.map} +3 -3
  47. package/dist/lib/node/{chunk-UNVDZOLA.cjs → chunk-LMDJEGZ2.cjs} +28 -26
  48. package/dist/lib/node/chunk-LMDJEGZ2.cjs.map +7 -0
  49. package/dist/lib/node/{chunk-PG7YNQ4R.cjs → chunk-NIDICM57.cjs} +66 -96
  50. package/dist/lib/node/chunk-NIDICM57.cjs.map +7 -0
  51. package/dist/lib/node/{chunk-TS3H5OSX.cjs → chunk-QGPWY6GW.cjs} +4 -4
  52. package/dist/lib/node/{chunk-TS3H5OSX.cjs.map → chunk-QGPWY6GW.cjs.map} +2 -2
  53. package/dist/lib/node/index.cjs +129 -73
  54. package/dist/lib/node/index.cjs.map +4 -4
  55. package/dist/lib/node/{intent-resolver-U7663JU7.cjs → intent-resolver-QSWGTKON.cjs} +17 -13
  56. package/dist/lib/node/intent-resolver-QSWGTKON.cjs.map +7 -0
  57. package/dist/lib/node/meta.json +1 -1
  58. package/dist/lib/node/{react-surface-QXZTILW6.cjs → react-surface-D3NBYRZ6.cjs} +41 -26
  59. package/dist/lib/node/react-surface-D3NBYRZ6.cjs.map +7 -0
  60. package/dist/lib/node/{settings-LBJMT6YB.cjs → settings-2JXLKYGE.cjs} +7 -7
  61. package/dist/lib/node/settings-2JXLKYGE.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-DONAO6SA.mjs → AssistantDialog-6WEMLUPU.mjs} +5 -4
  65. package/dist/lib/{browser/AssistantDialog-UAZSN6GT.mjs.map → node-esm/AssistantDialog-6WEMLUPU.mjs.map} +1 -1
  66. package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs +322 -0
  67. package/dist/lib/node-esm/BlueprintContainer-STOJAVML.mjs.map +7 -0
  68. package/dist/lib/node-esm/{ChatContainer-FVIGCDIG.mjs → ChatContainer-3MVBTUJN.mjs} +5 -4
  69. package/dist/lib/{browser/ChatContainer-UTN3AO5U.mjs.map → node-esm/ChatContainer-3MVBTUJN.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-XGZBJ6BE.mjs} +12 -8
  73. package/dist/lib/node-esm/ai-client-XGZBJ6BE.mjs.map +7 -0
  74. package/dist/lib/node-esm/{app-graph-builder-5YX5TKKT.mjs → app-graph-builder-3SY5MBIK.mjs} +52 -33
  75. package/dist/lib/node-esm/app-graph-builder-3SY5MBIK.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-34EX6E5Q.mjs +18 -0
  77. package/dist/lib/node-esm/chunk-34EX6E5Q.mjs.map +7 -0
  78. package/dist/lib/node-esm/{chunk-HLPGKJ7N.mjs → chunk-3UEZLJ2V.mjs} +1 -1
  79. package/dist/lib/node-esm/{chunk-HLPGKJ7N.mjs.map → chunk-3UEZLJ2V.mjs.map} +2 -2
  80. package/dist/lib/node-esm/{chunk-TQYSF2GS.mjs → chunk-J6UXXZGJ.mjs} +17 -15
  81. package/dist/lib/node-esm/chunk-J6UXXZGJ.mjs.map +7 -0
  82. package/dist/lib/node-esm/{chunk-MNH6E6EB.mjs → chunk-OD574YIU.mjs} +44 -73
  83. package/dist/lib/node-esm/chunk-OD574YIU.mjs.map +7 -0
  84. package/dist/lib/node-esm/{chunk-GJE4WCUJ.mjs → chunk-UCOFKNKN.mjs} +8 -8
  85. package/dist/lib/node-esm/{chunk-GJE4WCUJ.mjs.map → chunk-UCOFKNKN.mjs.map} +3 -3
  86. package/dist/lib/node-esm/index.mjs +84 -30
  87. package/dist/lib/node-esm/index.mjs.map +4 -4
  88. package/dist/lib/node-esm/{intent-resolver-N5TM3RTL.mjs → intent-resolver-E6MXTYAU.mjs} +12 -8
  89. package/dist/lib/node-esm/intent-resolver-E6MXTYAU.mjs.map +7 -0
  90. package/dist/lib/node-esm/meta.json +1 -1
  91. package/dist/lib/node-esm/{react-surface-FTKGQQD2.mjs → react-surface-7HA5EDWY.mjs} +29 -14
  92. package/dist/lib/node-esm/react-surface-7HA5EDWY.mjs.map +7 -0
  93. package/dist/lib/node-esm/{settings-TGCCAH5D.mjs → settings-5IAY6BT4.mjs} +4 -4
  94. package/dist/lib/node-esm/settings-5IAY6BT4.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 +2 -2
  98. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
  99. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  100. package/dist/types/src/capabilities/capabilities.d.ts +2 -2
  101. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  102. package/dist/types/src/capabilities/index.d.ts +1 -1
  103. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  104. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  105. package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +1 -1
  106. package/dist/types/src/components/BlueprintContainer.d.ts +9 -0
  107. package/dist/types/src/components/BlueprintContainer.d.ts.map +1 -0
  108. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts +8 -3
  109. package/dist/types/src/components/BlueprintEditor/BlueprintEditor.d.ts.map +1 -1
  110. package/dist/types/src/components/BlueprintEditor/index.d.ts +1 -2
  111. package/dist/types/src/components/BlueprintEditor/index.d.ts.map +1 -1
  112. package/dist/types/src/components/TemplateContainer.d.ts +2 -2
  113. package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
  114. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
  115. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
  116. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +1 -1
  117. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
  118. package/dist/types/src/components/index.d.ts +4 -3
  119. package/dist/types/src/components/index.d.ts.map +1 -1
  120. package/dist/types/src/events.d.ts +4 -0
  121. package/dist/types/src/events.d.ts.map +1 -0
  122. package/dist/types/src/hooks/processor.d.ts +3 -3
  123. package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
  124. package/dist/types/src/hooks/useMessageQueue.d.ts +8 -8
  125. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
  126. package/dist/types/src/index.d.ts +2 -0
  127. package/dist/types/src/index.d.ts.map +1 -1
  128. package/dist/types/src/parser/filter-generator.d.ts +1 -1
  129. package/dist/types/src/parser/filter-generator.d.ts.map +1 -1
  130. package/dist/types/src/queue-logger.d.ts +11 -0
  131. package/dist/types/src/queue-logger.d.ts.map +1 -0
  132. package/dist/types/src/stories/Query.stories.d.ts.map +1 -1
  133. package/dist/types/src/stories/Research.stories.d.ts +1 -1
  134. package/dist/types/src/stories/Research.stories.d.ts.map +1 -1
  135. package/dist/types/src/testing/test-blueprint.d.ts +4 -10
  136. package/dist/types/src/testing/test-blueprint.d.ts.map +1 -1
  137. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  138. package/dist/types/src/translations.d.ts +15 -0
  139. package/dist/types/src/translations.d.ts.map +1 -1
  140. package/dist/types/src/types/chat.d.ts +13 -10
  141. package/dist/types/src/types/chat.d.ts.map +1 -1
  142. package/dist/types/src/types/service.d.ts +88 -9
  143. package/dist/types/src/types/service.d.ts.map +1 -1
  144. package/dist/types/src/types/template.d.ts +3 -23
  145. package/dist/types/src/types/template.d.ts.map +1 -1
  146. package/dist/types/src/types/types.d.ts +6 -6
  147. package/package.json +71 -68
  148. package/src/AssistantPlugin.tsx +30 -7
  149. package/src/capabilities/ai-client.ts +11 -6
  150. package/src/capabilities/app-graph-builder.ts +69 -54
  151. package/src/capabilities/capabilities.ts +3 -2
  152. package/src/capabilities/intent-resolver.ts +12 -5
  153. package/src/capabilities/react-surface.tsx +23 -19
  154. package/src/capabilities/settings.ts +2 -2
  155. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -0
  156. package/src/components/BlueprintContainer.tsx +148 -0
  157. package/src/components/BlueprintEditor/BlueprintEditor.stories.tsx +2 -2
  158. package/src/components/BlueprintEditor/BlueprintEditor.tsx +31 -21
  159. package/src/components/BlueprintEditor/index.ts +1 -3
  160. package/src/components/PromptSettings.tsx +1 -1
  161. package/src/components/TemplateContainer.tsx +5 -2
  162. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  163. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  164. package/src/components/Thread/Thread.stories.tsx +19 -27
  165. package/src/components/Thread/ThreadContainer.stories.tsx +11 -12
  166. package/src/components/Thread/ThreadContainer.tsx +3 -4
  167. package/src/components/Thread/reducer.ts +3 -3
  168. package/src/components/index.ts +1 -1
  169. package/src/events.ts +11 -0
  170. package/src/hooks/processor.ts +4 -4
  171. package/src/hooks/useContextProvider.ts +13 -16
  172. package/src/hooks/useMessageQueue.ts +3 -2
  173. package/src/index.ts +2 -0
  174. package/src/parser/filter-generator.test.ts +1 -1
  175. package/src/parser/filter-generator.ts +1 -1
  176. package/src/queue-logger.ts +125 -0
  177. package/src/stories/Query.stories.tsx +28 -29
  178. package/src/stories/Research.stories.tsx +32 -46
  179. package/src/stories/test-data.ts +12 -12
  180. package/src/testing/test-blueprint.ts +14 -6
  181. package/src/testing/test-services.ts +6 -6
  182. package/src/tools/function.ts +2 -2
  183. package/src/tools/openapi.test.ts +7 -13
  184. package/src/tools/openapi.ts +5 -5
  185. package/src/translations.ts +19 -5
  186. package/src/types/chat.ts +3 -4
  187. package/src/types/service.ts +8 -4
  188. package/src/types/template.ts +11 -3
  189. package/dist/lib/browser/BlueprintEditor-DGV4KJDM.mjs +0 -45
  190. package/dist/lib/browser/BlueprintEditor-DGV4KJDM.mjs.map +0 -7
  191. package/dist/lib/browser/TemplateContainer-AKUYL4AV.mjs.map +0 -7
  192. package/dist/lib/browser/ai-client-COXVUC6V.mjs.map +0 -7
  193. package/dist/lib/browser/app-graph-builder-56OZ5RW4.mjs.map +0 -7
  194. package/dist/lib/browser/chunk-NBSPGIHL.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-Q6XE3O3E.mjs.map +0 -7
  196. package/dist/lib/browser/intent-resolver-GWELYIX2.mjs.map +0 -7
  197. package/dist/lib/browser/react-surface-DGS34EON.mjs.map +0 -7
  198. package/dist/lib/browser/settings-BTFB7IQ6.mjs.map +0 -7
  199. package/dist/lib/node/BlueprintEditor-43VM3XPO.cjs +0 -72
  200. package/dist/lib/node/BlueprintEditor-43VM3XPO.cjs.map +0 -7
  201. package/dist/lib/node/TemplateContainer-CTG2MB4W.cjs.map +0 -7
  202. package/dist/lib/node/ai-client-R2CGEYZW.cjs.map +0 -7
  203. package/dist/lib/node/app-graph-builder-QLF353LH.cjs.map +0 -7
  204. package/dist/lib/node/chunk-PG7YNQ4R.cjs.map +0 -7
  205. package/dist/lib/node/chunk-UNVDZOLA.cjs.map +0 -7
  206. package/dist/lib/node/intent-resolver-U7663JU7.cjs.map +0 -7
  207. package/dist/lib/node/react-surface-QXZTILW6.cjs.map +0 -7
  208. package/dist/lib/node/settings-LBJMT6YB.cjs.map +0 -7
  209. package/dist/lib/node-esm/BlueprintEditor-CTARB2FO.mjs +0 -47
  210. package/dist/lib/node-esm/BlueprintEditor-CTARB2FO.mjs.map +0 -7
  211. package/dist/lib/node-esm/TemplateContainer-IVDQ4XQG.mjs.map +0 -7
  212. package/dist/lib/node-esm/ai-client-I5LXHMOZ.mjs.map +0 -7
  213. package/dist/lib/node-esm/app-graph-builder-5YX5TKKT.mjs.map +0 -7
  214. package/dist/lib/node-esm/chunk-MNH6E6EB.mjs.map +0 -7
  215. package/dist/lib/node-esm/chunk-TQYSF2GS.mjs.map +0 -7
  216. package/dist/lib/node-esm/intent-resolver-N5TM3RTL.mjs.map +0 -7
  217. package/dist/lib/node-esm/react-surface-FTKGQQD2.mjs.map +0 -7
  218. package/dist/lib/node-esm/settings-TGCCAH5D.mjs.map +0 -7
  219. /package/dist/lib/{node-esm/AssistantDialog-DONAO6SA.mjs.map → browser/AssistantDialog-MQOOR364.mjs.map} +0 -0
  220. /package/dist/lib/{node-esm/ChatContainer-FVIGCDIG.mjs.map → browser/ChatContainer-C2NEAS3A.mjs.map} +0 -0
@@ -8,18 +8,16 @@ import { type Meta, type StoryObj } from '@storybook/react';
8
8
  import { Match, Schema } from 'effect';
9
9
  import React, { useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';
10
10
 
11
- import { AIServiceEdgeClient, type AIServiceEdgeClientOptions } from '@dxos/ai';
12
- import { SpyAIService } from '@dxos/ai/testing';
11
+ import { EdgeAiServiceClient, type AiServiceEdgeClientOptions } from '@dxos/ai';
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 { BlueprintMachine, BlueprintParser, Logger, setConsolePrinter, setLogger } from '@dxos/assistant';
16
+ import { BlueprintMachine, BlueprintParser, BufferedLogger, setConsolePrinter, setLogger } from '@dxos/assistant';
17
17
  import { combine } from '@dxos/async';
18
- import { Filter, Queue, type Space } from '@dxos/client/echo';
19
- import { type Obj, Type } from '@dxos/echo';
20
- import { Ref, create, getLabelForObject, getTypename, type AnyEchoObject } from '@dxos/echo-schema';
18
+ import { Queue, type Space } from '@dxos/client/echo';
19
+ import { DXN, Filter, Obj, Ref, Type } from '@dxos/echo';
21
20
  import { SelectionModel } from '@dxos/graph';
22
- import { DXN } from '@dxos/keys';
23
21
  import { log } from '@dxos/log';
24
22
  import { D3ForceGraph, type D3ForceGraphProps } from '@dxos/plugin-explorer';
25
23
  import { faker } from '@dxos/random';
@@ -28,8 +26,8 @@ import { useQueue } from '@dxos/react-client/echo';
28
26
  import { Dialog, IconButton, Toolbar, useAsyncState, useTranslation } from '@dxos/react-ui';
29
27
  import {
30
28
  matchCompletion,
31
- staticCompletion,
32
29
  typeahead,
30
+ staticCompletion,
33
31
  type TypeaheadContext,
34
32
  type TypeaheadOptions,
35
33
  } from '@dxos/react-ui-editor';
@@ -45,7 +43,7 @@ import { testPlugins } from './testing';
45
43
  import { AmbientDialog, PromptBar, type PromptBarProps, type PromptController } from '../components';
46
44
  import { ASSISTANT_PLUGIN } from '../meta';
47
45
  import { QueryParser, createFilter, type Expression } from '../parser';
48
- import { RESEARCH_BLUEPRINT, createRegistry } from '../testing';
46
+ import { createToolRegistry, RESEARCH_BLUEPRINT } from '../testing';
49
47
  import translations from '../translations';
50
48
 
51
49
  faker.seed(1);
@@ -57,7 +55,7 @@ const LOCAL = false;
57
55
  const endpoints = LOCAL ? localServiceEndpoints : remoteServiceEndpoints;
58
56
 
59
57
  // TODO(burdon) Move to story args.
60
- const aiConfig: AIServiceEdgeClientOptions = {
58
+ const aiConfig: AiServiceEdgeClientOptions = {
61
59
  endpoint: endpoints.ai,
62
60
  defaultGenerationOptions: {
63
61
  model: '@anthropic/claude-3-5-sonnet-20241022',
@@ -69,7 +67,7 @@ const aiConfig: AIServiceEdgeClientOptions = {
69
67
  * Container for a set of ephemeral research results.
70
68
  */
71
69
  const ResearchGraph = Schema.Struct({
72
- queue: Ref(Queue),
70
+ queue: Type.Ref(Queue),
73
71
  }).pipe(
74
72
  Type.Obj({
75
73
  typename: 'dxos.org/type/ResearchGraph',
@@ -130,8 +128,7 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
130
128
  } else {
131
129
  const queue = space.queues.create();
132
130
  return space.db.add(
133
- create(ResearchGraph, {
134
- // TODO(dmaretskyi): Ref.make(queue)
131
+ Obj.make(ResearchGraph, {
135
132
  queue: Ref.fromDXN(queue.dxn),
136
133
  }),
137
134
  );
@@ -159,21 +156,21 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
159
156
  model?.nodes
160
157
  .filter((node) => {
161
158
  try {
162
- getTypename(node.data.object as AnyEchoObject);
159
+ Obj.getTypename(node.data.object as Obj.Any);
163
160
  return true;
164
161
  } catch {
165
162
  return false;
166
163
  }
167
164
  })
168
- .map((node) => node.data.object as AnyEchoObject) ?? [];
165
+ .map((node) => node.data.object as Obj.Any) ?? [];
169
166
 
170
167
  //
171
168
  // AI
172
169
  //
173
170
 
174
- const aiClient = useMemo(() => new SpyAIService(new AIServiceEdgeClient(aiConfig)), []);
175
- const registry = useMemo(
176
- () => space && researchGraph && createRegistry(space, researchGraph.queue.dxn),
171
+ const aiClient = useMemo(() => new SpyAiService(new EdgeAiServiceClient(aiConfig)), []);
172
+ const tools = useMemo(
173
+ () => space && researchGraph && createToolRegistry(space, researchGraph.queue.dxn),
177
174
  [space, researchGraph?.queue.dxn],
178
175
  );
179
176
 
@@ -181,7 +178,7 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
181
178
 
182
179
  const researchBlueprint = useMemo(() => BlueprintParser.create().parse(RESEARCH_BLUEPRINT), []);
183
180
 
184
- const logger = useMemo(() => new Logger(), []);
181
+ const logger = useMemo(() => new BufferedLogger(), []);
185
182
 
186
183
  //
187
184
  // Handlers
@@ -192,27 +189,27 @@ const DefaultStory = ({ mode, spec, ...props }: StoryProps) => {
192
189
  }, [model]);
193
190
 
194
191
  const handleResearch = useCallback(async () => {
195
- if (!space || !registry || !researchBlueprint) {
192
+ if (!space || !tools || !researchBlueprint) {
196
193
  return;
197
194
  }
198
195
 
199
- const selected = selection.selected.value;
200
- log.info('starting research...', { selected });
201
196
  const resolver = space.db.graph.createRefResolver({
202
197
  context: {
203
198
  space: space.db.spaceId,
204
199
  queue: researchGraph?.queue.dxn,
205
200
  },
206
201
  });
202
+
203
+ const selected = selection.selected.value;
207
204
  const objects = await Promise.all(selected.map((id) => resolver.resolve(DXN.fromLocalObjectId(id))));
208
- const machine = new BlueprintMachine(registry, researchBlueprint);
205
+ const machine = new BlueprintMachine(tools, researchBlueprint);
209
206
  const cleanup = combine(setConsolePrinter(machine, true), setLogger(machine, logger));
210
207
 
211
208
  log.info('starting research...', { selected });
212
- await machine.runToCompletion({ aiService: aiClient, input: objects });
209
+ await machine.runToCompletion({ aiClient, input: objects });
213
210
 
214
211
  cleanup();
215
- }, [space, aiClient, registry, researchBlueprint, selection]);
212
+ }, [space, aiClient, tools, researchBlueprint, selection]);
216
213
 
217
214
  const handleGenerate = useCallback(async () => {
218
215
  if (!space) {
@@ -392,10 +389,12 @@ const ItemList = <T extends Obj.Any>({ items = [] }: { items?: T[] }) => {
392
389
  classNames='grid grid-cols-[4rem_16rem_1fr] min-h-[32px] items-center'
393
390
  >
394
391
  <div className='text-xs font-mono font-thin px-1 text-subdued'>{item.id.slice(-6)}</div>
395
- <div className={mx('text-xs font-mono font-thin truncate px-1', getHashColor(getTypename(item))?.text)}>
396
- {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)}
397
396
  </div>
398
- <List.ItemTitle>{getLabelForObject(item)}</List.ItemTitle>
397
+ <List.ItemTitle>{Obj.getLabel(item)}</List.ItemTitle>
399
398
  </List.Item>
400
399
  ))}
401
400
  </div>
@@ -432,7 +431,7 @@ const useFlush = (space?: Space) => {
432
431
  return { state, handleFlush };
433
432
  };
434
433
 
435
- const Log: FC<{ logger: Logger }> = ({ logger }) => {
434
+ const Log: FC<{ logger: BufferedLogger }> = ({ logger }) => {
436
435
  return (
437
436
  <div className='grow flex flex-col p-1 overflow-y-auto text-sm'>
438
437
  {logger.messages.value.map((message, index) => (
@@ -9,45 +9,31 @@ import { type Meta, type StoryObj } from '@storybook/react';
9
9
  import { Option, SchemaAST } from 'effect';
10
10
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
11
11
 
12
- import { AgentStatusReport, AIServiceEdgeClient, createTool, type ExecutableTool, Message, ToolResult } from '@dxos/ai';
13
- import { EXA_API_KEY, SpyAIService } from '@dxos/ai/testing';
12
+ import { AgentStatusReport, EdgeAiServiceClient, createTool, type ExecutableTool, Message, ToolResult } from '@dxos/ai';
13
+ import { EXA_API_KEY, SpyAiService } from '@dxos/ai/testing';
14
14
  import { Capabilities, contributes, createSurface, Events, Surface, useIntentDispatcher } from '@dxos/app-framework';
15
15
  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,11 +59,10 @@ 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
- new SpyAIService(
80
- new AIServiceEdgeClient({
64
+ new SpyAiService(
65
+ new EdgeAiServiceClient({
81
66
  endpoint: endpoints.ai,
82
67
  defaultGenerationOptions: {
83
68
  // model: '@anthropic/claude-sonnet-4-20250514',
@@ -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.
@@ -147,8 +133,8 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
147
133
 
148
134
  useEffect(() => {
149
135
  if (queue?.objects.length === 0 && !queue.isLoading && prompts.length > 0) {
150
- queue.append([
151
- create(Message, {
136
+ void queue.append([
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
 
@@ -185,7 +171,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
185
171
  await processor.request(message, {
186
172
  history: queue.objects,
187
173
  onComplete: (messages) => {
188
- queue.append(messages);
174
+ void queue.append(messages);
189
175
  },
190
176
  });
191
177
  });
@@ -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 | Relation.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 | Relation.Any;
298
+ onResearch: (object: Obj.Any | Relation.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,15 +379,15 @@ 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,
384
+ [Relation.Source]: source,
385
+ [Relation.Target]: target,
398
386
  ...props,
399
- [RelationSourceId]: source,
400
- [RelationTargetId]: target,
401
387
  });
402
388
  };
403
389
 
404
- const createToolbar = (aiClient: SpyAIService) =>
390
+ const createToolbar = (aiClient: SpyAiService) =>
405
391
  Rx.make((get) => {
406
392
  const result: ActionGraphProps = { nodes: [], edges: [] };
407
393
  const save = createMenuAction('save', () => aiClient.saveEvents(), {
@@ -3,11 +3,11 @@
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
 
10
- const organizations: DataType.Organization[] = [
10
+ const organizations: (Type.Properties<DataType.Organization> & { id: string })[] = [
11
11
  { id: 'dxos', name: 'DXOS', website: 'https://dxos.org' },
12
12
  { id: 'socket_supply', name: 'Socket Supply', website: 'https://socketsupply.com' },
13
13
  { id: 'ink_and_switch', name: 'Ink & Switch', website: 'https://inkandswitch.com' },
@@ -24,7 +24,7 @@ const organizations: DataType.Organization[] = [
24
24
  { id: 'deshaw', name: 'D. E. Shaw & Co.', website: 'https://deshaw.com' },
25
25
  ];
26
26
 
27
- const people: DataType.Person[] = [
27
+ const people: (Type.Properties<DataType.Person> & { id: string })[] = [
28
28
  { id: 'rich_burdon', fullName: 'Rich Burdon' },
29
29
  { id: 'josiah_witt', fullName: 'Josiah Witt' },
30
30
  { id: 'dima_dmaretskyi', fullName: 'Dima Maretskyi' },
@@ -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, {
120
- ...data,
119
+ Relation.make(schema, {
121
120
  // TODO(burdon): Test source/target types match.
122
- [RelationSourceId]: sourceObject,
123
- [RelationTargetId]: targetObject,
121
+ [Relation.Source]: sourceObject,
122
+ [Relation.Target]: targetObject,
123
+ ...data,
124
124
  }),
125
125
  );
126
126
  }
@@ -4,7 +4,13 @@
4
4
 
5
5
  import { ToolRegistry } from '@dxos/ai';
6
6
  import { EXA_API_KEY } from '@dxos/ai/testing';
7
- import { BlueprintParser, createExaTool, createGraphWriterTool, createLocalSearchTool } from '@dxos/assistant';
7
+ import {
8
+ type BlueprintDefinition,
9
+ BlueprintParser,
10
+ createExaTool,
11
+ createGraphWriterTool,
12
+ createLocalSearchTool,
13
+ } from '@dxos/assistant';
8
14
  import { type Space } from '@dxos/client/echo';
9
15
  import { type DXN } from '@dxos/keys';
10
16
  import { DataTypes } from '@dxos/schema';
@@ -12,7 +18,7 @@ import { isNonNullable } from '@dxos/util';
12
18
 
13
19
  // TODO(dmaretskyi): make db available through services (same as function executor).
14
20
  // TODO(burdon): Can tools implement "aspects" so that variants can be used rather than an explicit reference?
15
- export const createRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
21
+ export const createToolRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
16
22
  return new ToolRegistry(
17
23
  [
18
24
  createExaTool({ apiKey: EXA_API_KEY }),
@@ -21,17 +27,17 @@ export const createRegistry = (space: Space, queueDxn?: DXN): ToolRegistry => {
21
27
  createGraphWriterTool({
22
28
  db: space.db,
23
29
  queue: space.queues.get(queueDxn),
24
- schemaTypes: DataTypes,
30
+ schema: DataTypes,
25
31
  onDone: async (objects) => {
26
32
  const queue = space.queues.get(queueDxn);
27
- queue.append(objects);
33
+ await queue.append(objects);
28
34
  },
29
35
  }),
30
36
  ].filter(isNonNullable),
31
37
  );
32
38
  };
33
39
 
34
- export const RESEARCH_BLUEPRINT = BlueprintParser.create().parse({
40
+ export const RESEARCH_BLUEPRINT_DEFINITION: BlueprintDefinition = {
35
41
  steps: [
36
42
  {
37
43
  instructions: 'Research information and entities related to the selected objects.',
@@ -47,4 +53,6 @@ export const RESEARCH_BLUEPRINT = BlueprintParser.create().parse({
47
53
  tools: ['search/local_search', 'graph/writer'],
48
54
  },
49
55
  ],
50
- });
56
+ };
57
+
58
+ export const RESEARCH_BLUEPRINT = BlueprintParser.create().parse(RESEARCH_BLUEPRINT_DEFINITION);
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { create } from '@dxos/echo-schema';
5
+ import { Obj } from '@dxos/echo';
6
6
 
7
7
  import {
8
8
  type ApiAuthorization,
@@ -54,7 +54,7 @@ const VISUAL_CROSSING_CREDENTIALS: ApiAuthorization = {
54
54
  // - e.g., https://github.com/konfig-sdks/openapi-examples/blob/main/xkcd/openapi.yaml
55
55
 
56
56
  const TEST_SERVICES: ServiceType[] = [
57
- create(ServiceType, {
57
+ Obj.make(ServiceType, {
58
58
  serviceId: 'amadeus.com/service/FlightSearch',
59
59
  name: 'Amadeus Flight Search',
60
60
  description: 'Search for local and international flights.',
@@ -68,7 +68,7 @@ const TEST_SERVICES: ServiceType[] = [
68
68
  ],
69
69
  }),
70
70
 
71
- create(ServiceType, {
71
+ Obj.make(ServiceType, {
72
72
  serviceId: 'amadeus.com/service/HotelSearch',
73
73
  name: 'Amadeus Hotel Search',
74
74
  description: 'Search for local and international hotels.',
@@ -82,7 +82,7 @@ const TEST_SERVICES: ServiceType[] = [
82
82
  ],
83
83
  }),
84
84
 
85
- create(ServiceType, {
85
+ Obj.make(ServiceType, {
86
86
  serviceId: 'visualcrossing.com/service/Weather',
87
87
  name: 'Visual Crossing Weather',
88
88
  description: 'Search for global weather forecasts.',
@@ -97,7 +97,7 @@ const TEST_SERVICES: ServiceType[] = [
97
97
  }),
98
98
 
99
99
  // TODO(burdon): Needs auth.
100
- create(ServiceType, {
100
+ Obj.make(ServiceType, {
101
101
  serviceId: 'abstractapi.com/service/GeoLocation',
102
102
  name: 'Abstract GeoLocation',
103
103
  description: 'Get the location of any IP address.',
@@ -115,7 +115,7 @@ const TEST_SERVICES: ServiceType[] = [
115
115
  //
116
116
 
117
117
  ...Array.from({ length: 20 }, (_, i) =>
118
- create(ServiceType, {
118
+ Obj.make(ServiceType, {
119
119
  serviceId: `example.com/service/test-${i}`,
120
120
  name: `Test ${i}`,
121
121
  description: `Test ${i}`,
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { createTool, type ExecutableTool, ToolResult } from '@dxos/ai';
6
- import { toEffectSchema } from '@dxos/echo-schema';
6
+ import { Type } from '@dxos/echo';
7
7
  import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
8
8
  import { type FunctionType } from '@dxos/functions';
9
9
  import { log } from '@dxos/log';
@@ -29,7 +29,7 @@ export const convertFunctionToTool = (
29
29
  return createTool('user-function', {
30
30
  name: fn.name,
31
31
  description: fn.description,
32
- schema: toEffectSchema(fn.inputSchema),
32
+ schema: Type.toEffectSchema(fn.inputSchema),
33
33
  execute: async (input) => {
34
34
  log.info('execute function tool', { name: fn.name, url, input });
35
35
  const response = await fetch(url, {
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { describe, expect, test } from 'vitest';
6
6
 
7
- import { AIServiceEdgeClient } from '@dxos/ai';
7
+ import { EdgeAiServiceClient } from '@dxos/ai';
8
8
  import { AI_SERVICE_ENDPOINT } from '@dxos/ai/testing';
9
9
  import { log } from '@dxos/log';
10
10
 
@@ -73,10 +73,8 @@ describe.skip('openapi', () => {
73
73
  describe.skip('AI uses tools', () => {
74
74
  test('amadeus flight availabilities', { timeout: 60_000 }, async () => {
75
75
  const tools = await createToolsFromApi(FLIGHT_SEARCH_API, { authorization: AMADEUS_AUTH });
76
- const client = new AIServiceEdgeClient({
77
- endpoint: AI_SERVICE_ENDPOINT.LOCAL,
78
- });
79
- const processor = new ChatProcessor(client, tools);
76
+ const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
77
+ const processor = new ChatProcessor(aiClient, tools);
80
78
  const reply = await processor.request(
81
79
  `What is the cheapest flight from New York to Paris? going on ${new Date().toISOString()} and returning after a week. 1 adult traveler`,
82
80
  );
@@ -87,10 +85,8 @@ describe.skip('openapi', () => {
87
85
  // TODO(dmaretskyi): Doesn't work.
88
86
  test('amadeus hotel name autocomplete', { timeout: 60_000 }, async () => {
89
87
  const tools = await createToolsFromApi(HOTEL_NAME_AUTOCOMPLETE_API, { authorization: AMADEUS_AUTH });
90
- const client = new AIServiceEdgeClient({
91
- endpoint: AI_SERVICE_ENDPOINT.LOCAL,
92
- });
93
- const processor = new ChatProcessor(client, tools);
88
+ const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
89
+ const processor = new ChatProcessor(aiClient, tools);
94
90
  const reply = await processor.request('Find me the William Wale in Brooklyn New York');
95
91
 
96
92
  log.info('reply', { reply });
@@ -101,10 +97,8 @@ describe.skip('openapi', () => {
101
97
  authorization: VISUAL_CROSSING_CREDENTIALS,
102
98
  instructions: WEATHER_INSTRUCTIONS,
103
99
  });
104
- const client = new AIServiceEdgeClient({
105
- endpoint: AI_SERVICE_ENDPOINT.LOCAL,
106
- });
107
- const processor = new ChatProcessor(client, tools);
100
+ const aiClient = new EdgeAiServiceClient({ endpoint: AI_SERVICE_ENDPOINT.LOCAL });
101
+ const processor = new ChatProcessor(aiClient, tools);
108
102
  const reply = await processor.request(
109
103
  `Today's date is ${new Date().toISOString().split('T')[0]}. Give me weather forecast for Warsaw for next 5 days.`,
110
104
  );
@@ -7,7 +7,8 @@ import jsonpointer from 'jsonpointer';
7
7
  import { type OpenAPIV2, type OpenAPIV3_1 } from 'openapi-types';
8
8
 
9
9
  import { type ExecutableTool, ToolResult, createRawTool } from '@dxos/ai';
10
- import { JsonSchemaType, normalizeSchema, toEffectSchema } from '@dxos/echo-schema';
10
+ import { Type } from '@dxos/echo';
11
+ import { normalizeSchema } from '@dxos/echo-schema';
11
12
  import { invariant } from '@dxos/invariant';
12
13
  import { log } from '@dxos/log';
13
14
  import { deepMapValues } from '@dxos/util';
@@ -52,8 +53,7 @@ export const createToolsFromApi = async (
52
53
  return resolved;
53
54
  }) ?? [];
54
55
 
55
- // TODO(burdon): Reconcile with toFunctionParameterSchema.
56
- const inputSchema: JsonSchemaType = {
56
+ const inputSchema: Type.JsonSchema = {
57
57
  type: 'object',
58
58
  properties: {},
59
59
  };
@@ -86,7 +86,7 @@ export const createToolsFromApi = async (
86
86
  }
87
87
 
88
88
  log('inputSchema', { inputSchema });
89
- Schema.validateSync(JsonSchemaType)(inputSchema);
89
+ Schema.validateSync(Type.JsonSchema)(inputSchema);
90
90
 
91
91
  const description = methodItem.description ?? methodItem.summary;
92
92
  if (!description) {
@@ -206,7 +206,7 @@ const callApiEndpoint = async (endpoint: EndpointDescriptor, input: any) => {
206
206
  const value = input[parameter.name];
207
207
 
208
208
  // Client-side validation
209
- const effectSchema = toEffectSchema(parameter.schema);
209
+ const effectSchema = Type.toEffectSchema(parameter.schema);
210
210
  Schema.validateSync(effectSchema)(value);
211
211
 
212
212
  if (body) {