@dxos/plugin-assistant 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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 (226) hide show
  1. package/dist/lib/browser/{AssistantDialog-DTWVEQBB.mjs → AssistantDialog-YSHMAHW5.mjs} +3 -3
  2. package/dist/lib/browser/{ChatContainer-ZNKENYKZ.mjs → ChatContainer-V5GP7DYF.mjs} +3 -3
  3. package/dist/lib/browser/ChatContainer-V5GP7DYF.mjs.map +7 -0
  4. package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs +78 -0
  5. package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs.map +7 -0
  6. package/dist/lib/browser/{ai-client-5PRCXI7N.mjs → ai-client-CDZLSNXE.mjs} +3 -3
  7. package/dist/lib/browser/ai-client-CDZLSNXE.mjs.map +7 -0
  8. package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs +209 -0
  9. package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-OWZHLWW5.mjs → chunk-FMB7RGMP.mjs} +136 -147
  11. package/dist/lib/browser/chunk-FMB7RGMP.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-IAMR2FAE.mjs +183 -0
  13. package/dist/lib/browser/chunk-IAMR2FAE.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-KYMKVE6M.mjs +128 -0
  15. package/dist/lib/browser/chunk-KYMKVE6M.mjs.map +7 -0
  16. package/dist/lib/browser/index.mjs +11 -14
  17. package/dist/lib/browser/index.mjs.map +3 -3
  18. package/dist/lib/browser/{intent-resolver-QV5AAVJZ.mjs → intent-resolver-WJGLKKVO.mjs} +12 -7
  19. package/dist/lib/browser/intent-resolver-WJGLKKVO.mjs.map +7 -0
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/{react-surface-JJPYWEIN.mjs → react-surface-57VRDOQT.mjs} +17 -17
  22. package/dist/lib/browser/react-surface-57VRDOQT.mjs.map +7 -0
  23. package/dist/lib/browser/{settings-OZX7J65A.mjs → settings-U6UFQX32.mjs} +4 -4
  24. package/dist/lib/browser/settings-U6UFQX32.mjs.map +7 -0
  25. package/dist/lib/browser/types/index.mjs +1 -3
  26. package/dist/lib/node/{AssistantDialog-RJJHZI63.cjs → AssistantDialog-YI2BSGSX.cjs} +7 -7
  27. package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs → ChatContainer-ZJ5JXF6A.cjs} +7 -7
  28. package/dist/lib/node/ChatContainer-ZJ5JXF6A.cjs.map +7 -0
  29. package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs +104 -0
  30. package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs.map +7 -0
  31. package/dist/lib/node/{ai-client-OUPSRQT7.cjs → ai-client-URCCYU6B.cjs} +6 -6
  32. package/dist/lib/node/ai-client-URCCYU6B.cjs.map +7 -0
  33. package/dist/lib/node/{app-graph-builder-LEO63CZZ.cjs → app-graph-builder-N5ZUUI2Z.cjs} +94 -74
  34. package/dist/lib/node/app-graph-builder-N5ZUUI2Z.cjs.map +7 -0
  35. package/dist/lib/node/chunk-APRU3QWK.cjs +206 -0
  36. package/dist/lib/node/chunk-APRU3QWK.cjs.map +7 -0
  37. package/dist/lib/node/{chunk-OOHFSPWR.cjs → chunk-RPBKMP2E.cjs} +141 -159
  38. package/dist/lib/node/chunk-RPBKMP2E.cjs.map +7 -0
  39. package/dist/lib/node/{chunk-GQ3XS5FZ.cjs → chunk-ZKOC4ZFY.cjs} +61 -78
  40. package/dist/lib/node/chunk-ZKOC4ZFY.cjs.map +7 -0
  41. package/dist/lib/node/index.cjs +43 -46
  42. package/dist/lib/node/index.cjs.map +3 -3
  43. package/dist/lib/node/{intent-resolver-QDGZMWLY.cjs → intent-resolver-R3OSTIMH.cjs} +15 -10
  44. package/dist/lib/node/intent-resolver-R3OSTIMH.cjs.map +7 -0
  45. package/dist/lib/node/meta.json +1 -1
  46. package/dist/lib/node/{react-surface-XNEIJJYJ.cjs → react-surface-NUQTM6MS.cjs} +25 -25
  47. package/dist/lib/node/react-surface-NUQTM6MS.cjs.map +7 -0
  48. package/dist/lib/node/{settings-WLTC7XO5.cjs → settings-TXGRCYAL.cjs} +7 -7
  49. package/dist/lib/node/settings-TXGRCYAL.cjs.map +7 -0
  50. package/dist/lib/node/types/index.cjs +12 -14
  51. package/dist/lib/node/types/index.cjs.map +2 -2
  52. package/dist/lib/node-esm/{AssistantDialog-D33WZUGR.mjs → AssistantDialog-U2FQX5TD.mjs} +3 -3
  53. package/dist/lib/node-esm/{ChatContainer-FAYGNMQW.mjs → ChatContainer-QW3OOXTT.mjs} +3 -3
  54. package/dist/lib/node-esm/ChatContainer-QW3OOXTT.mjs.map +7 -0
  55. package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs +79 -0
  56. package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs.map +7 -0
  57. package/dist/lib/node-esm/{ai-client-RZQWEDUX.mjs → ai-client-WMHS5EGV.mjs} +3 -3
  58. package/dist/lib/node-esm/ai-client-WMHS5EGV.mjs.map +7 -0
  59. package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs +210 -0
  60. package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-GBBXIW5F.mjs +129 -0
  62. package/dist/lib/node-esm/chunk-GBBXIW5F.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-ED55ZE4G.mjs → chunk-MVDAY3CZ.mjs} +136 -147
  64. package/dist/lib/node-esm/chunk-MVDAY3CZ.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-MXK2EANZ.mjs +184 -0
  66. package/dist/lib/node-esm/chunk-MXK2EANZ.mjs.map +7 -0
  67. package/dist/lib/node-esm/index.mjs +11 -14
  68. package/dist/lib/node-esm/index.mjs.map +3 -3
  69. package/dist/lib/node-esm/{intent-resolver-Q3I6S6HN.mjs → intent-resolver-H32TL4X6.mjs} +12 -7
  70. package/dist/lib/node-esm/intent-resolver-H32TL4X6.mjs.map +7 -0
  71. package/dist/lib/node-esm/meta.json +1 -1
  72. package/dist/lib/node-esm/{react-surface-RI3JONQY.mjs → react-surface-JBVZF6CP.mjs} +17 -17
  73. package/dist/lib/node-esm/react-surface-JBVZF6CP.mjs.map +7 -0
  74. package/dist/lib/node-esm/{settings-CLE57WEP.mjs → settings-DZU5PNXM.mjs} +4 -4
  75. package/dist/lib/node-esm/settings-DZU5PNXM.mjs.map +7 -0
  76. package/dist/lib/node-esm/types/index.mjs +1 -3
  77. package/dist/types/src/capabilities/ai-client.d.ts +2 -2
  78. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/app-graph-builder.d.ts +179 -2
  80. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  81. package/dist/types/src/capabilities/index.d.ts +179 -3
  82. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  84. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  85. package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -1
  86. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  87. package/dist/types/src/components/ChatContainer.d.ts +3 -4
  88. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  89. package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -1
  90. package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -1
  91. package/dist/types/src/components/Prompt/references.d.ts.map +1 -1
  92. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +6 -0
  93. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +1 -0
  94. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +8 -0
  95. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +1 -0
  96. package/dist/types/src/components/ServiceRegistry/index.d.ts +2 -0
  97. package/dist/types/src/components/ServiceRegistry/index.d.ts.map +1 -0
  98. package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
  99. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  100. package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
  101. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -2
  102. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  103. package/dist/types/src/components/Thread/Thread.d.ts.map +1 -1
  104. package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
  105. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
  106. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
  107. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
  108. package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -1
  109. package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -1
  110. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  111. package/dist/types/src/components/index.d.ts +6 -2
  112. package/dist/types/src/components/index.d.ts.map +1 -1
  113. package/dist/types/src/hooks/index.d.ts +1 -0
  114. package/dist/types/src/hooks/index.d.ts.map +1 -1
  115. package/dist/types/src/hooks/invocation-handler.d.ts +5 -0
  116. package/dist/types/src/hooks/invocation-handler.d.ts.map +1 -0
  117. package/dist/types/src/hooks/processor.d.ts.map +1 -1
  118. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  119. package/dist/types/src/hooks/useContextProvider.d.ts +1 -1
  120. package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
  121. package/dist/types/src/hooks/useLocalTriggerManager.d.ts +3 -0
  122. package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +1 -0
  123. package/dist/types/src/hooks/useMessageQueue.d.ts +3 -0
  124. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
  125. package/dist/types/src/hooks/useServices.d.ts.map +1 -1
  126. package/dist/types/src/hooks/useTextInputEvents.d.ts.map +1 -1
  127. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  128. package/dist/types/src/tools/function.d.ts +2 -2
  129. package/dist/types/src/tools/function.d.ts.map +1 -1
  130. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  131. package/dist/types/src/translations.d.ts +58 -7
  132. package/dist/types/src/translations.d.ts.map +1 -1
  133. package/dist/types/src/types/service.d.ts +95 -96
  134. package/dist/types/src/types/service.d.ts.map +1 -1
  135. package/dist/types/src/types/template.d.ts +52 -52
  136. package/dist/types/src/types/template.d.ts.map +1 -1
  137. package/dist/types/src/types/types.d.ts +18 -20
  138. package/dist/types/src/types/types.d.ts.map +1 -1
  139. package/dist/types/tsconfig.tsbuildinfo +1 -1
  140. package/package.json +58 -64
  141. package/src/AssistantPlugin.tsx +2 -2
  142. package/src/capabilities/ai-client.ts +5 -4
  143. package/src/capabilities/app-graph-builder.ts +133 -161
  144. package/src/capabilities/index.ts +1 -1
  145. package/src/capabilities/intent-resolver.ts +8 -5
  146. package/src/capabilities/react-surface.tsx +11 -13
  147. package/src/capabilities/settings.ts +2 -2
  148. package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -1
  149. package/src/components/AssistantSettings/AssistantSettings.tsx +6 -28
  150. package/src/components/ChatContainer.tsx +8 -6
  151. package/src/components/Prompt/Prompt.stories.tsx +1 -1
  152. package/src/components/Prompt/PromptBar.tsx +12 -4
  153. package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +49 -0
  154. package/src/components/ServiceRegistry/ServiceRegistry.tsx +76 -0
  155. package/src/components/ServiceRegistry/index.ts +5 -0
  156. package/src/components/TemplateContainer.tsx +79 -3
  157. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  158. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  159. package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
  160. package/src/components/Thread/Thread.stories.tsx +15 -12
  161. package/src/components/Thread/ThreadContainer.stories.tsx +21 -12
  162. package/src/components/Thread/ThreadContainer.tsx +2 -24
  163. package/src/components/Thread/ThreadMessage.tsx +3 -6
  164. package/src/components/Toolbox/Toolbox.stories.tsx +3 -3
  165. package/src/components/Toolbox/Toolbox.tsx +3 -3
  166. package/src/components/index.ts +1 -1
  167. package/src/hooks/index.ts +1 -0
  168. package/src/hooks/invocation-handler.ts +107 -0
  169. package/src/hooks/processor.ts +4 -26
  170. package/src/hooks/useChatProcessor.tsx +7 -8
  171. package/src/hooks/useContextProvider.ts +16 -20
  172. package/src/hooks/useLocalTriggerManager.ts +82 -0
  173. package/src/hooks/useMessageQueue.ts +2 -2
  174. package/src/testing/test-services.ts +6 -6
  175. package/src/tools/function.ts +6 -4
  176. package/src/tools/openapi.ts +3 -4
  177. package/src/translations.ts +4 -5
  178. package/src/types/service.ts +37 -39
  179. package/src/types/template.ts +25 -27
  180. package/src/types/types.ts +17 -20
  181. package/dist/lib/browser/ChatContainer-ZNKENYKZ.mjs.map +0 -7
  182. package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
  183. package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs.map +0 -7
  184. package/dist/lib/browser/ai-client-5PRCXI7N.mjs.map +0 -7
  185. package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs +0 -189
  186. package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-5P7U35RJ.mjs +0 -192
  188. package/dist/lib/browser/chunk-5P7U35RJ.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-7VDZP5WX.mjs +0 -143
  190. package/dist/lib/browser/chunk-7VDZP5WX.mjs.map +0 -7
  191. package/dist/lib/browser/chunk-OWZHLWW5.mjs.map +0 -7
  192. package/dist/lib/browser/intent-resolver-QV5AAVJZ.mjs.map +0 -7
  193. package/dist/lib/browser/react-surface-JJPYWEIN.mjs.map +0 -7
  194. package/dist/lib/browser/settings-OZX7J65A.mjs.map +0 -7
  195. package/dist/lib/node/ChatContainer-WVAAOEOH.cjs.map +0 -7
  196. package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs +0 -52
  197. package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs.map +0 -7
  198. package/dist/lib/node/ai-client-OUPSRQT7.cjs.map +0 -7
  199. package/dist/lib/node/app-graph-builder-LEO63CZZ.cjs.map +0 -7
  200. package/dist/lib/node/chunk-GQ3XS5FZ.cjs.map +0 -7
  201. package/dist/lib/node/chunk-OOHFSPWR.cjs.map +0 -7
  202. package/dist/lib/node/chunk-VG2UQY4S.cjs +0 -216
  203. package/dist/lib/node/chunk-VG2UQY4S.cjs.map +0 -7
  204. package/dist/lib/node/intent-resolver-QDGZMWLY.cjs.map +0 -7
  205. package/dist/lib/node/react-surface-XNEIJJYJ.cjs.map +0 -7
  206. package/dist/lib/node/settings-WLTC7XO5.cjs.map +0 -7
  207. package/dist/lib/node-esm/ChatContainer-FAYGNMQW.mjs.map +0 -7
  208. package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
  209. package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs.map +0 -7
  210. package/dist/lib/node-esm/ai-client-RZQWEDUX.mjs.map +0 -7
  211. package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs +0 -190
  212. package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs.map +0 -7
  213. package/dist/lib/node-esm/chunk-74GFINWJ.mjs +0 -144
  214. package/dist/lib/node-esm/chunk-74GFINWJ.mjs.map +0 -7
  215. package/dist/lib/node-esm/chunk-ED55ZE4G.mjs.map +0 -7
  216. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs +0 -193
  217. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs.map +0 -7
  218. package/dist/lib/node-esm/intent-resolver-Q3I6S6HN.mjs.map +0 -7
  219. package/dist/lib/node-esm/react-surface-RI3JONQY.mjs.map +0 -7
  220. package/dist/lib/node-esm/settings-CLE57WEP.mjs.map +0 -7
  221. package/dist/types/src/components/PromptSettings.d.ts +0 -6
  222. package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
  223. package/src/components/PromptSettings.tsx +0 -91
  224. /package/dist/lib/browser/{AssistantDialog-DTWVEQBB.mjs.map → AssistantDialog-YSHMAHW5.mjs.map} +0 -0
  225. /package/dist/lib/node/{AssistantDialog-RJJHZI63.cjs.map → AssistantDialog-YI2BSGSX.cjs.map} +0 -0
  226. /package/dist/lib/node-esm/{AssistantDialog-D33WZUGR.mjs.map → AssistantDialog-U2FQX5TD.mjs.map} +0 -0
@@ -0,0 +1,107 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { sleep } from '@dxos/async';
6
+ import { getObjectCore, ResultFormat } from '@dxos/echo-db';
7
+ import { type AnyObjectData } from '@dxos/echo-schema';
8
+ import { FunctionType, getUserFunctionUrlInMetadata } from '@dxos/functions/types';
9
+ import { type FunctionTrigger } from '@dxos/functions/types';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { DXN, LOCAL_SPACE_TAG } from '@dxos/keys';
12
+ import { log } from '@dxos/log';
13
+ import { type Client, type Config } from '@dxos/react-client';
14
+ import { type Space } from '@dxos/react-client/echo';
15
+
16
+ const MAX_RETRIES = 3;
17
+ const RETRY_DELAY = 1_000;
18
+
19
+ const callFunction = async (funcUrl: string, trigger: any, data: any) => {
20
+ const body = { event: 'trigger', trigger, data };
21
+
22
+ let retryCount = 0;
23
+ while (retryCount < MAX_RETRIES) {
24
+ log.info('exec', { funcUrl, body, retryCount });
25
+ const response = await fetch(funcUrl, {
26
+ method: 'POST',
27
+ headers: {
28
+ 'Content-Type': 'application/json',
29
+ },
30
+ body: JSON.stringify(body),
31
+ });
32
+
33
+ const data = await response.text();
34
+ log.info('response', { status: response.status, body: data });
35
+ if (response.status === 409) {
36
+ retryCount++;
37
+ await sleep(RETRY_DELAY * Math.min(retryCount, 2));
38
+ continue;
39
+ }
40
+
41
+ return { status: response.status, data };
42
+ }
43
+ return { status: 500 };
44
+ };
45
+
46
+ export const invokeFunction = async (client: Client, space: Space, trigger: FunctionTrigger, data: any) => {
47
+ try {
48
+ invariant(trigger.spec);
49
+ invariant(trigger.function);
50
+
51
+ const script = await space.db.query({ id: trigger.function }, { format: ResultFormat.Plain }).first();
52
+ const { objects: functions } = await space.db
53
+ .query({ __typename: FunctionType.typename }, { format: ResultFormat.Plain })
54
+ .run();
55
+ const func = functions.find((fn) => referenceEquals(fn.source, trigger.function!)) as AnyObjectData | undefined;
56
+ const funcSlug = func && getUserFunctionUrlInMetadata(func.__meta);
57
+ if (!funcSlug) {
58
+ log.warn('function not deployed', { scriptId: script.id, name: script.name });
59
+ return 404;
60
+ }
61
+
62
+ const funcUrl = getFunctionUrl(client.config, funcSlug, space.id);
63
+ const triggerData: AnyObjectData = {
64
+ ...getObjectCore(trigger).toPlainObject(),
65
+ // TODO: Remove when functions can query by DXN.
66
+ promptId: trigger.meta?.prompt?.id,
67
+ };
68
+ // TODO: Remove when functions can add objects and easily modify collections (push, splice).
69
+ return (await callFunction(funcUrl, triggerData, data)).status;
70
+ } catch (err) {
71
+ return 400;
72
+ }
73
+ };
74
+
75
+ const getFunctionUrl = (config: Config, slug: string, spaceId?: string) => {
76
+ const baseUrl = new URL('functions/', config.values.runtime?.services?.edge?.url);
77
+
78
+ // Leading slashes cause the URL to be treated as an absolute path.
79
+ const relativeUrl = slug.replace(/^\//, '');
80
+ const url = new URL(`./${relativeUrl}`, baseUrl.toString());
81
+ spaceId && url.searchParams.set('spaceId', spaceId);
82
+ url.protocol = 'https';
83
+ return url.toString();
84
+ };
85
+
86
+ // TODO(dmaretskyi): Factor out.
87
+
88
+ type ReferenceLike = { '/': string } | string;
89
+
90
+ const referenceEquals = (a: ReferenceLike, b: ReferenceLike): boolean => {
91
+ const aDXN = toDXN(a);
92
+ const bDXN = toDXN(b);
93
+ return aDXN.toString() === bDXN.toString();
94
+ };
95
+
96
+ const toDXN = (ref: ReferenceLike): DXN => {
97
+ if (typeof ref === 'string') {
98
+ if (ref.startsWith('dxn:')) {
99
+ return DXN.parse(ref);
100
+ } else {
101
+ return new DXN(DXN.kind.ECHO, [LOCAL_SPACE_TAG, ref]);
102
+ }
103
+ }
104
+
105
+ invariant(typeof ref['/'] === 'string');
106
+ return DXN.parse(ref['/']);
107
+ };
@@ -9,7 +9,7 @@ import { type ArtifactDefinition, type Message, type MessageContentBlock, type T
9
9
  import { type AIServiceClient, AISession, DEFAULT_EDGE_MODEL, type GenerateRequest } from '@dxos/assistant';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import { log } from '@dxos/log';
12
- import { getVersion, type Space } from '@dxos/react-client/echo';
12
+ import { type Space } from '@dxos/react-client/echo';
13
13
 
14
14
  // TODO(burdon): Factor out.
15
15
  declare global {
@@ -99,7 +99,7 @@ export class ChatProcessor {
99
99
  * Make GPT request.
100
100
  */
101
101
  async request(message: string, options: RequestOptions = {}): Promise<Message[]> {
102
- this._session = new AISession({ operationModel: 'configured' });
102
+ this._session = new AISession({ operationModel: 'immediate' });
103
103
 
104
104
  // Message complete.
105
105
  this._session.message.on((message) => {
@@ -125,39 +125,17 @@ export class ChatProcessor {
125
125
  client: this._ai,
126
126
  history: options.history ?? [],
127
127
  artifacts: this._artifacts ?? [],
128
- requiredArtifactIds: this._artifacts?.map((artifact) => artifact.id) ?? [],
129
128
  tools: this._tools ?? [],
130
129
  prompt: message,
131
130
  systemPrompt: this._options.systemPrompt,
132
131
  extensions: this._extensions,
133
- artifactDiffResolver: async (artifacts) => {
134
- const space = this._extensions?.space;
135
- if (!space) {
136
- return new Map();
137
- }
138
- const versions = new Map();
139
- await Promise.all(
140
- artifacts.map(async (artifact) => {
141
- const {
142
- objects: [object],
143
- } = await space.db.query({ id: artifact.id }).run();
144
- if (!object) {
145
- return;
146
- }
147
- versions.set(artifact.id, {
148
- version: getVersion(object),
149
- diff: `Current state: ${JSON.stringify(object)}`,
150
- });
151
- }),
152
- );
153
- return versions;
154
- },
155
132
  generationOptions: {
156
133
  model: this._options.model,
157
134
  },
158
135
  });
159
136
 
160
- log('completed', { messages });
137
+ log.info('completed', { messages });
138
+
161
139
  options.onComplete?.(this._pending.value);
162
140
  } catch (err) {
163
141
  log.catch(err);
@@ -7,7 +7,7 @@ import { useEffect, useMemo, useState } from 'react';
7
7
  import { Capabilities, useCapabilities, useCapability, useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { type AssociatedArtifact, createSystemPrompt, type Tool } from '@dxos/artifact';
9
9
  import { DEFAULT_EDGE_MODEL, DEFAULT_OLLAMA_MODEL } from '@dxos/assistant';
10
- import { FunctionType } from '@dxos/functions';
10
+ import { FunctionType } from '@dxos/functions/types';
11
11
  import { log } from '@dxos/log';
12
12
  import { useConfig } from '@dxos/react-client';
13
13
  import { Filter, fullyQualifiedId, type Space, useQuery } from '@dxos/react-client/echo';
@@ -15,7 +15,7 @@ import { isNonNullable } from '@dxos/util';
15
15
 
16
16
  import { AssistantCapabilities } from '../capabilities';
17
17
  import { ChatProcessor, type ChatProcessorOptions } from '../hooks';
18
- import { convertFunctionToTool, createToolsFromService } from '../tools';
18
+ import { covertFunctionToTool, createToolsFromService } from '../tools';
19
19
  import { type AIChatType, type AssistantSettingsProps, ServiceType } from '../types';
20
20
 
21
21
  type UseChatProcessorProps = {
@@ -33,8 +33,7 @@ export const useChatProcessor = ({
33
33
  chat,
34
34
  space,
35
35
  settings,
36
- // part = 'deck',
37
- part,
36
+ part = 'deck',
38
37
  associatedArtifact,
39
38
  }: UseChatProcessorProps): ChatProcessor => {
40
39
  const aiClient = useCapability(AssistantCapabilities.AiClient);
@@ -43,7 +42,7 @@ export const useChatProcessor = ({
43
42
  const { dispatchPromise: dispatch } = useIntentDispatcher();
44
43
 
45
44
  // Services.
46
- const services = useQuery(space, Filter.type(ServiceType));
45
+ const services = useQuery(space, Filter.schema(ServiceType));
47
46
  const [serviceTools, setServiceTools] = useState<Tool[]>([]);
48
47
  useEffect(() => {
49
48
  log('creating service tools...');
@@ -55,7 +54,7 @@ export const useChatProcessor = ({
55
54
 
56
55
  // Tools and context.
57
56
  const config = useConfig();
58
- const functions = useQuery(space, Filter.type(FunctionType));
57
+ const functions = useQuery(space, Filter.schema(FunctionType));
59
58
  const chatId = useMemo(() => (chat ? fullyQualifiedId(chat) : undefined), [chat]);
60
59
  const [tools, extensions] = useMemo(() => {
61
60
  log('creating tools...');
@@ -63,7 +62,7 @@ export const useChatProcessor = ({
63
62
  ...globalTools.flat(),
64
63
  ...serviceTools,
65
64
  ...functions
66
- .map((fn) => convertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
65
+ .map((fn) => covertFunctionToTool(fn, config.values.runtime?.services?.edge?.url ?? '', space?.id))
67
66
  .filter(isNonNullable),
68
67
  ];
69
68
  const extensions = { space, dispatch, pivotId: chatId, part };
@@ -91,7 +90,7 @@ export const useChatProcessor = ({
91
90
  const processor = useMemo(() => {
92
91
  log('creating processor...', { settings });
93
92
  return new ChatProcessor(aiClient.value, tools, artifactDefinitions, extensions, { model, systemPrompt });
94
- }, [aiClient.value, tools, artifactDefinitions, extensions, model, systemPrompt]);
93
+ }, [aiClient.value, tools, extensions, model, systemPrompt]);
95
94
 
96
95
  return processor;
97
96
  };
@@ -2,14 +2,13 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import type { Schema } from 'effect';
6
5
  import { useMemo } from 'react';
7
6
 
8
7
  import { Capabilities, useCapabilities } from '@dxos/app-framework';
9
- import { Filter, type Space } from '@dxos/client/echo';
10
- import { Type } from '@dxos/echo';
11
- import { type BaseEchoObject, getDXN, getLabel } from '@dxos/echo-schema';
8
+ import type { Space } from '@dxos/client/echo';
9
+ import { getDXN, getLabel, getSchema } from '@dxos/echo-schema';
12
10
  import { log } from '@dxos/log';
11
+ import { Filter } from '@dxos/react-client/echo';
13
12
 
14
13
  export type ContextProvider = {
15
14
  query: (params: { query: string }) => Promise<Array<{ uri: string; label: string }>>;
@@ -30,28 +29,25 @@ export const useContextProvider = (space?: Space): ContextProvider | undefined =
30
29
  query: async ({ query }) => {
31
30
  const artifactSchemas = artifactDefinitions.map((artifact) => artifact.schema);
32
31
  const { objects } = await space.db
33
- .query(Filter.or(...artifactSchemas.map((schema) => Filter.type(schema as Schema.Schema<BaseEchoObject>))))
32
+ .query(Filter.or(...artifactSchemas.map((schema) => Filter.schema(schema))))
34
33
  .run();
35
- return (
36
- objects
37
- .map((object) => {
38
- log.info('object', { object, label: getLabel(Type.getSchema(object)!, object) });
39
- return object;
40
- })
41
- .filter((object) => stringMatch(query, getLabel(Type.getSchema(object)!, object) ?? ''))
42
- // TODO(dmaretskyi): `Type.getDXN` (at the point of writing) didn't work here as it was schema-only.
43
- .filter((object) => !!getDXN(object))
44
- .map((object) => ({
45
- uri: getDXN(object as any)!.toString(),
46
- label: getLabel(Type.getSchema(object)!, object) ?? '',
47
- }))
48
- );
34
+ return objects
35
+ .map((object) => {
36
+ log.info('object', { object, label: getLabel(getSchema(object)!, object) });
37
+ return object;
38
+ })
39
+ .filter((object) => stringMatch(query, getLabel(getSchema(object)!, object) ?? ''))
40
+ .filter((object) => !!getDXN(object))
41
+ .map((object) => ({
42
+ uri: getDXN(object)!.toString(),
43
+ label: getLabel(getSchema(object)!, object) ?? '',
44
+ }));
49
45
  },
50
46
  resolveMetadata: async ({ uri }) => {
51
47
  const object = await space.db.query({ id: uri }).first();
52
48
  return {
53
49
  uri,
54
- label: getLabel(Type.getSchema(object)!, object) ?? '',
50
+ label: getLabel(getSchema(object)!, object) ?? '',
55
51
  };
56
52
  },
57
53
  };
@@ -0,0 +1,82 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { useEffect, useState } from 'react';
6
+
7
+ import { Mutex } from '@dxos/async';
8
+ import { Context } from '@dxos/context';
9
+ import { createSubscriptionTrigger, type TriggerFactory } from '@dxos/functions';
10
+ import { FunctionTrigger } from '@dxos/functions/types';
11
+ import { invariant } from '@dxos/invariant';
12
+ import { log } from '@dxos/log';
13
+ import { useClient } from '@dxos/react-client';
14
+ import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
15
+
16
+ import { invokeFunction } from './invocation-handler';
17
+
18
+ const registerTriggersMutex = new Mutex();
19
+
20
+ export const useLocalTriggerManager = (space: Space) => {
21
+ const client = useClient();
22
+
23
+ // TODO(burdon): Factor out, creating context for plugin (runs outside of component).
24
+ const [registry] = useState(new Map<string, Context>());
25
+ const triggers = useQuery(space, Filter.schema(FunctionTrigger));
26
+ useEffect(() => {
27
+ setTimeout(async () => {
28
+ // Mark-and-sweep removing disabled triggers.
29
+ await registerTriggersMutex.executeSynchronized(async () => {
30
+ const deprecated = new Set(Array.from(registry.keys()));
31
+ log('triggers', {
32
+ deprecated,
33
+ all: triggers.map((t) => t.id),
34
+ enabled: triggers.filter((t) => t.enabled).map((t) => t.id),
35
+ });
36
+
37
+ for (const trigger of triggers) {
38
+ if (trigger.enabled) {
39
+ if (registry.has(trigger.id)) {
40
+ deprecated.delete(trigger.id);
41
+ continue;
42
+ }
43
+ log.info('activating trigger', trigger.id);
44
+
45
+ const ctx = new Context();
46
+ registry.set(trigger.id, ctx);
47
+ const triggerSpec = trigger.spec;
48
+ invariant(triggerSpec);
49
+
50
+ let triggerFactory: TriggerFactory<any>;
51
+ if (triggerSpec.type === 'subscription') {
52
+ triggerFactory = createSubscriptionTrigger;
53
+ } else {
54
+ log.info('unsupported trigger', { type: triggerSpec.type });
55
+ continue;
56
+ }
57
+
58
+ await triggerFactory(ctx, space, trigger.spec, (data: any) => {
59
+ return invokeFunction(client, space, trigger, data);
60
+ });
61
+ }
62
+ }
63
+
64
+ for (const id of deprecated) {
65
+ const ctx = registry.get(id);
66
+ if (ctx) {
67
+ await ctx.dispose();
68
+ registry.delete(id);
69
+ }
70
+ }
71
+ });
72
+ });
73
+ }, [JSON.stringify(triggers)]);
74
+
75
+ useEffect(() => {
76
+ return () => {
77
+ for (const ctx of registry.values()) {
78
+ void ctx.dispose();
79
+ }
80
+ };
81
+ }, []);
82
+ };
@@ -5,7 +5,7 @@
5
5
  import { useMemo } from 'react';
6
6
 
7
7
  import { type Message } from '@dxos/artifact';
8
- import { createQueueDxn } from '@dxos/echo-schema';
8
+ import { DXN, QueueSubspaceTags } from '@dxos/keys';
9
9
  import { getSpace, useQueue } from '@dxos/react-client/echo';
10
10
 
11
11
  import { type AIChatType } from '../types';
@@ -14,7 +14,7 @@ export const useMessageQueue = (chat?: AIChatType) => {
14
14
  const space = getSpace(chat);
15
15
  const queueDxn = useMemo(() => {
16
16
  const dxn = space && chat?.assistantChatQueue.dxn;
17
- return dxn ? createQueueDxn(space.id) : undefined;
17
+ return dxn ? new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, space.id, dxn.parts.at(-1)!]) : undefined;
18
18
  }, [space, chat?.assistantChatQueue.dxn]);
19
19
 
20
20
  return useQueue<Message>(queueDxn);
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { create } from '@dxos/echo-schema';
5
+ import { createStatic } from '@dxos/echo-schema';
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
+ createStatic(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
+ createStatic(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
+ createStatic(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
+ createStatic(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
+ createStatic(ServiceType, {
119
119
  serviceId: `example.com/service/test-${i}`,
120
120
  name: `Test ${i}`,
121
121
  description: `Test ${i}`,
@@ -5,13 +5,13 @@
5
5
  import { defineTool, ToolResult } from '@dxos/artifact';
6
6
  import type { Tool } from '@dxos/artifact';
7
7
  import { toEffectSchema } from '@dxos/echo-schema';
8
- import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
9
- import type { FunctionType } from '@dxos/functions';
8
+ import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions/types';
9
+ import type { FunctionType } from '@dxos/functions/types';
10
10
  import { log } from '@dxos/log';
11
11
  import type { SpaceId } from '@dxos/react-client/echo';
12
12
  import { getMeta } from '@dxos/react-client/echo';
13
13
 
14
- export const convertFunctionToTool = (
14
+ export const covertFunctionToTool = (
15
15
  fn: FunctionType,
16
16
  edgeUrl: string,
17
17
  spaceId?: SpaceId | undefined,
@@ -24,7 +24,9 @@ export const convertFunctionToTool = (
24
24
  if (!existingFunctionUrl) {
25
25
  return undefined;
26
26
  }
27
- const url = getInvocationUrl(existingFunctionUrl, edgeUrl, { spaceId });
27
+ const url = getInvocationUrl(existingFunctionUrl, edgeUrl, {
28
+ spaceId,
29
+ });
28
30
 
29
31
  return defineTool('user-function', {
30
32
  name: fn.name,
@@ -2,12 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
6
5
  import jsonpointer from 'jsonpointer';
7
6
  import { type OpenAPIV2, type OpenAPIV3_1 } from 'openapi-types';
8
7
 
9
8
  import { ToolResult, type Tool } from '@dxos/artifact';
10
- import { JsonSchemaType, normalizeSchema, toEffectSchema } from '@dxos/echo-schema';
9
+ import { JsonSchemaType, normalizeSchema, S, toEffectSchema } from '@dxos/echo-schema';
11
10
  import { invariant } from '@dxos/invariant';
12
11
  import { log } from '@dxos/log';
13
12
  import { deepMapValues } from '@dxos/util';
@@ -83,7 +82,7 @@ export const createToolsFromApi = async (url: string, options?: CreateToolsFromA
83
82
  }
84
83
 
85
84
  log('inputSchema', { inputSchema });
86
- Schema.validateSync(JsonSchemaType)(inputSchema);
85
+ S.validateSync(JsonSchemaType)(inputSchema);
87
86
 
88
87
  const description = methodItem.description ?? methodItem.summary;
89
88
  if (!description) {
@@ -201,7 +200,7 @@ const callApiEndpoint = async (endpoint: EndpointDescriptor, input: any) => {
201
200
 
202
201
  // Client-side validation
203
202
  const effectSchema = toEffectSchema(parameter.schema);
204
- Schema.validateSync(effectSchema)(value);
203
+ S.validateSync(effectSchema)(value);
205
204
 
206
205
  if (body) {
207
206
  throw new Error(`Duplicate body parameter: ${parameter.name}`);
@@ -9,7 +9,7 @@ export default [
9
9
  {
10
10
  'en-US': {
11
11
  [AIChatType.typename]: {
12
- 'typename label': 'Assistant',
12
+ 'typename label': 'AI Chat',
13
13
  'object name placeholder': 'AI Chat',
14
14
  },
15
15
  [TemplateType.typename]: {
@@ -19,8 +19,8 @@ export default [
19
19
  [ASSISTANT_PLUGIN]: {
20
20
  'templates label': 'Templates',
21
21
 
22
- 'open ambient chat label': 'Open Assistant',
23
- 'assistant chat label': 'Assistant',
22
+ 'open ambient chat label': 'Open AI chat',
23
+ 'assistant chat label': 'AI chat',
24
24
  'plugin name': 'Assistant',
25
25
  'object placeholder': 'New prompt',
26
26
  'create object label': 'Create prompt',
@@ -29,7 +29,6 @@ export default [
29
29
  'command placeholder': 'Enter slash command...',
30
30
  'template placeholder': 'Enter template...',
31
31
  'value placeholder': 'Enter value...',
32
- 'prompt rules label': 'Prompt Rules',
33
32
  'typename placeholder': 'Enter typename of objects which this template is for',
34
33
  'description placeholder': 'Enter description of when this template should be used',
35
34
  'select preset template placeholder': 'Select preset',
@@ -47,7 +46,7 @@ export default [
47
46
 
48
47
  'settings default label': 'Default',
49
48
  'settings custom prompts label': 'Use custom prompts',
50
- 'settings llm provider label': 'LLM provider',
49
+ 'settings llm provider label': 'Enable Ollama integration',
51
50
  'settings edge llm model label': 'Remote language model',
52
51
  'settings ollama llm model label': 'Ollama language model',
53
52
  },
@@ -2,80 +2,78 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
6
-
7
5
  import { ComputeGraph } from '@dxos/conductor';
8
- import { Ref, TypedObject, type Ref$ } from '@dxos/echo-schema';
9
- import { FunctionType } from '@dxos/functions';
10
-
11
- const ApiAuthorizationKey = Schema.Struct({
12
- type: Schema.Literal('api-key'),
13
- key: Schema.String,
14
- placement: Schema.Union(
15
- Schema.Struct({
16
- type: Schema.Literal('authorization-header'),
6
+ import { Ref, S, TypedObject, type Ref$ } from '@dxos/echo-schema';
7
+ import { FunctionType } from '@dxos/functions/types';
8
+
9
+ const ApiAuthorizationKey = S.Struct({
10
+ type: S.Literal('api-key'),
11
+ key: S.String,
12
+ placement: S.Union(
13
+ S.Struct({
14
+ type: S.Literal('authorization-header'),
17
15
  }),
18
- Schema.Struct({
19
- type: Schema.Literal('query'),
20
- name: Schema.String,
16
+ S.Struct({
17
+ type: S.Literal('query'),
18
+ name: S.String,
21
19
  }),
22
20
  ),
23
21
  });
24
22
 
25
- const ApiAuthorizationOauth = Schema.Struct({
26
- type: Schema.Literal('oauth'),
27
- clientId: Schema.String,
28
- clientSecret: Schema.String,
29
- tokenUrl: Schema.String,
30
- grantType: Schema.String,
23
+ const ApiAuthorizationOauth = S.Struct({
24
+ type: S.Literal('oauth'),
25
+ clientId: S.String,
26
+ clientSecret: S.String,
27
+ tokenUrl: S.String,
28
+ grantType: S.String,
31
29
  });
32
30
 
33
- export const ApiAuthorization = Schema.Union(ApiAuthorizationKey, ApiAuthorizationOauth);
34
- export type ApiAuthorization = Schema.Schema.Type<typeof ApiAuthorization>;
31
+ export const ApiAuthorization = S.Union(ApiAuthorizationKey, ApiAuthorizationOauth);
32
+ export type ApiAuthorization = S.Schema.Type<typeof ApiAuthorization>;
35
33
 
36
- const ServiceInterfaceFunction = Schema.Struct({
37
- kind: Schema.Literal('function'),
34
+ const ServiceInterfaceFunction = S.Struct({
35
+ kind: S.Literal('function'),
38
36
  fn: Ref(FunctionType) as Ref$<FunctionType>,
39
37
  });
40
38
 
41
- const ServiceInterfaceWorkflow = Schema.Struct({
42
- kind: Schema.Literal('workflow'),
39
+ const ServiceInterfaceWorkflow = S.Struct({
40
+ kind: S.Literal('workflow'),
43
41
  workflow: Ref(ComputeGraph) as Ref$<ComputeGraph>,
44
42
  });
45
43
 
46
- const ServiceInterfaceApi = Schema.Struct({
47
- kind: Schema.Literal('api'),
44
+ const ServiceInterfaceApi = S.Struct({
45
+ kind: S.Literal('api'),
48
46
 
49
47
  /**
50
48
  * URL to fetch the openapi schema.
51
49
  */
52
- schemaUrl: Schema.optional(Schema.String),
50
+ schemaUrl: S.optional(S.String),
53
51
 
54
52
  /**
55
53
  * Inlined openapi schema.
56
54
  */
57
- schema: Schema.optional(Schema.Any),
55
+ schema: S.optional(S.Any),
58
56
 
59
57
  /**
60
58
  * Authorization configuration if required.
61
59
  */
62
- authorization: Schema.optional(ApiAuthorization),
60
+ authorization: S.optional(ApiAuthorization),
63
61
  });
64
62
 
65
- const ServiceInterface = Schema.Union(ServiceInterfaceFunction, ServiceInterfaceWorkflow, ServiceInterfaceApi);
66
- export type ServiceInterface = Schema.Schema.Type<typeof ServiceInterface>;
63
+ const ServiceInterface = S.Union(ServiceInterfaceFunction, ServiceInterfaceWorkflow, ServiceInterfaceApi);
64
+ export type ServiceInterface = S.Schema.Type<typeof ServiceInterface>;
67
65
 
68
66
  export class ServiceType extends TypedObject({ typename: 'dxos.org/type/ServiceType', version: '0.1.0' })({
69
- serviceId: Schema.String,
70
- name: Schema.optional(Schema.String),
71
- description: Schema.optional(Schema.String),
72
- category: Schema.optional(Schema.String),
73
- enabled: Schema.optional(Schema.Boolean),
67
+ serviceId: S.String,
68
+ name: S.optional(S.String),
69
+ description: S.optional(S.String),
70
+ category: S.optional(S.String),
71
+ enabled: S.optional(S.Boolean),
74
72
 
75
73
  /**
76
74
  * Entries exposed: functions, workflows, and APIs.
77
75
  */
78
- interfaces: Schema.optional(Schema.Array(ServiceInterface)),
76
+ interfaces: S.optional(S.Array(ServiceInterface)),
79
77
  }) {}
80
78
 
81
79
  //