@dxos/plugin-assistant 0.8.1 → 0.8.2-main.2f9c567

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 (197) hide show
  1. package/dist/lib/browser/{AssistantDialog-YSHMAHW5.mjs → AssistantDialog-WX6EKSXI.mjs} +3 -3
  2. package/dist/lib/browser/{ChatContainer-V5GP7DYF.mjs → ChatContainer-HMNWYDQ5.mjs} +3 -3
  3. package/dist/lib/browser/ChatContainer-HMNWYDQ5.mjs.map +7 -0
  4. package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +22 -0
  5. package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs.map +7 -0
  6. package/dist/lib/browser/{ai-client-CDZLSNXE.mjs → ai-client-OK5SMYJC.mjs} +1 -1
  7. package/dist/lib/browser/{ai-client-CDZLSNXE.mjs.map → ai-client-OK5SMYJC.mjs.map} +2 -2
  8. package/dist/lib/browser/{app-graph-builder-MF5EVDWW.mjs → app-graph-builder-J5ISIFTE.mjs} +9 -39
  9. package/dist/lib/browser/app-graph-builder-J5ISIFTE.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-FMB7RGMP.mjs → chunk-4EXBK6UE.mjs} +127 -112
  11. package/dist/lib/browser/chunk-4EXBK6UE.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-5P7U35RJ.mjs +192 -0
  13. package/dist/lib/browser/chunk-5P7U35RJ.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-J3V74ZRF.mjs +143 -0
  15. package/dist/lib/browser/chunk-J3V74ZRF.mjs.map +7 -0
  16. package/dist/lib/browser/index.mjs +14 -11
  17. package/dist/lib/browser/index.mjs.map +3 -3
  18. package/dist/lib/browser/{intent-resolver-WJGLKKVO.mjs → intent-resolver-MGHOSZY3.mjs} +5 -5
  19. package/dist/lib/browser/intent-resolver-MGHOSZY3.mjs.map +7 -0
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/{react-surface-57VRDOQT.mjs → react-surface-VP4ABBMH.mjs} +15 -15
  22. package/dist/lib/browser/react-surface-VP4ABBMH.mjs.map +7 -0
  23. package/dist/lib/browser/{settings-U6UFQX32.mjs → settings-OZX7J65A.mjs} +4 -4
  24. package/dist/lib/browser/settings-OZX7J65A.mjs.map +7 -0
  25. package/dist/lib/browser/types/index.mjs +3 -1
  26. package/dist/lib/node/{AssistantDialog-YI2BSGSX.cjs → AssistantDialog-2OTAZADX.cjs} +7 -7
  27. package/dist/lib/node/{ChatContainer-ZJ5JXF6A.cjs → ChatContainer-3CTBKBS2.cjs} +7 -7
  28. package/dist/lib/node/ChatContainer-3CTBKBS2.cjs.map +7 -0
  29. package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs +52 -0
  30. package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs.map +7 -0
  31. package/dist/lib/node/{ai-client-URCCYU6B.cjs → ai-client-3EVTLXTT.cjs} +4 -4
  32. package/dist/lib/node/{ai-client-URCCYU6B.cjs.map → ai-client-3EVTLXTT.cjs.map} +2 -2
  33. package/dist/lib/node/{app-graph-builder-N5ZUUI2Z.cjs → app-graph-builder-BBNLIGYJ.cjs} +14 -44
  34. package/dist/lib/node/app-graph-builder-BBNLIGYJ.cjs.map +7 -0
  35. package/dist/lib/node/chunk-VG2UQY4S.cjs +216 -0
  36. package/dist/lib/node/chunk-VG2UQY4S.cjs.map +7 -0
  37. package/dist/lib/node/{chunk-ZKOC4ZFY.cjs → chunk-WFSXNO4H.cjs} +78 -61
  38. package/dist/lib/node/chunk-WFSXNO4H.cjs.map +7 -0
  39. package/dist/lib/node/{chunk-RPBKMP2E.cjs → chunk-XC7A3KUG.cjs} +138 -116
  40. package/dist/lib/node/chunk-XC7A3KUG.cjs.map +7 -0
  41. package/dist/lib/node/index.cjs +46 -43
  42. package/dist/lib/node/index.cjs.map +3 -3
  43. package/dist/lib/node/{intent-resolver-R3OSTIMH.cjs → intent-resolver-Z2NTL2FV.cjs} +9 -9
  44. package/dist/lib/node/intent-resolver-Z2NTL2FV.cjs.map +7 -0
  45. package/dist/lib/node/meta.json +1 -1
  46. package/dist/lib/node/{react-surface-NUQTM6MS.cjs → react-surface-HNXDAZ7C.cjs} +22 -22
  47. package/dist/lib/node/react-surface-HNXDAZ7C.cjs.map +7 -0
  48. package/dist/lib/node/{settings-TXGRCYAL.cjs → settings-WLTC7XO5.cjs} +7 -7
  49. package/dist/lib/node/settings-WLTC7XO5.cjs.map +7 -0
  50. package/dist/lib/node/types/index.cjs +14 -12
  51. package/dist/lib/node/types/index.cjs.map +2 -2
  52. package/dist/lib/node-esm/{AssistantDialog-U2FQX5TD.mjs → AssistantDialog-GNLPYXY4.mjs} +3 -3
  53. package/dist/lib/node-esm/{ChatContainer-QW3OOXTT.mjs → ChatContainer-FGHDDORQ.mjs} +3 -3
  54. package/dist/lib/node-esm/ChatContainer-FGHDDORQ.mjs.map +7 -0
  55. package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +23 -0
  56. package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs.map +7 -0
  57. package/dist/lib/node-esm/{ai-client-WMHS5EGV.mjs → ai-client-LYCBXZI7.mjs} +1 -1
  58. package/dist/lib/node-esm/{ai-client-WMHS5EGV.mjs.map → ai-client-LYCBXZI7.mjs.map} +2 -2
  59. package/dist/lib/node-esm/{app-graph-builder-DWBNIMHM.mjs → app-graph-builder-245AWCPJ.mjs} +9 -39
  60. package/dist/lib/node-esm/app-graph-builder-245AWCPJ.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-G5LUEW72.mjs +144 -0
  62. package/dist/lib/node-esm/chunk-G5LUEW72.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-MVDAY3CZ.mjs → chunk-JX73NOSL.mjs} +127 -112
  64. package/dist/lib/node-esm/chunk-JX73NOSL.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs +193 -0
  66. package/dist/lib/node-esm/chunk-UZWYXNR5.mjs.map +7 -0
  67. package/dist/lib/node-esm/index.mjs +14 -11
  68. package/dist/lib/node-esm/index.mjs.map +3 -3
  69. package/dist/lib/node-esm/{intent-resolver-H32TL4X6.mjs → intent-resolver-DMQXPV2H.mjs} +5 -5
  70. package/dist/lib/node-esm/intent-resolver-DMQXPV2H.mjs.map +7 -0
  71. package/dist/lib/node-esm/meta.json +1 -1
  72. package/dist/lib/node-esm/{react-surface-JBVZF6CP.mjs → react-surface-NYXMBFPY.mjs} +15 -15
  73. package/dist/lib/node-esm/react-surface-NYXMBFPY.mjs.map +7 -0
  74. package/dist/lib/node-esm/{settings-DZU5PNXM.mjs → settings-CLE57WEP.mjs} +4 -4
  75. package/dist/lib/node-esm/settings-CLE57WEP.mjs.map +7 -0
  76. package/dist/lib/node-esm/types/index.mjs +3 -1
  77. package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/index.d.ts +1 -1
  80. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  81. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  82. package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
  83. package/dist/types/src/components/ChatContainer.d.ts +4 -3
  84. package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
  85. package/dist/types/src/components/PromptSettings.d.ts +6 -0
  86. package/dist/types/src/components/PromptSettings.d.ts.map +1 -0
  87. package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
  88. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -2
  89. package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
  90. package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
  91. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
  92. package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -1
  94. package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
  95. package/dist/types/src/components/index.d.ts +2 -6
  96. package/dist/types/src/components/index.d.ts.map +1 -1
  97. package/dist/types/src/hooks/index.d.ts +0 -1
  98. package/dist/types/src/hooks/index.d.ts.map +1 -1
  99. package/dist/types/src/hooks/processor.d.ts.map +1 -1
  100. package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
  101. package/dist/types/src/hooks/useMessageQueue.d.ts +0 -3
  102. package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
  103. package/dist/types/src/tools/function.d.ts +1 -1
  104. package/dist/types/src/tools/function.d.ts.map +1 -1
  105. package/dist/types/src/tools/openapi.d.ts.map +1 -1
  106. package/dist/types/src/translations.d.ts +3 -0
  107. package/dist/types/src/translations.d.ts.map +1 -1
  108. package/dist/types/src/types/service.d.ts +96 -95
  109. package/dist/types/src/types/service.d.ts.map +1 -1
  110. package/dist/types/src/types/template.d.ts +52 -52
  111. package/dist/types/src/types/template.d.ts.map +1 -1
  112. package/dist/types/src/types/types.d.ts +20 -18
  113. package/dist/types/src/types/types.d.ts.map +1 -1
  114. package/package.json +61 -58
  115. package/src/AssistantPlugin.tsx +2 -2
  116. package/src/capabilities/ai-client.ts +0 -1
  117. package/src/capabilities/app-graph-builder.ts +6 -38
  118. package/src/capabilities/index.ts +1 -1
  119. package/src/capabilities/intent-resolver.ts +3 -3
  120. package/src/capabilities/react-surface.tsx +11 -9
  121. package/src/capabilities/settings.ts +2 -2
  122. package/src/components/AssistantSettings/AssistantSettings.tsx +28 -6
  123. package/src/components/ChatContainer.tsx +6 -8
  124. package/src/components/PromptSettings.tsx +91 -0
  125. package/src/components/TemplateContainer.tsx +3 -79
  126. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
  127. package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
  128. package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
  129. package/src/components/Thread/ThreadContainer.stories.tsx +12 -20
  130. package/src/components/Thread/ThreadContainer.tsx +24 -2
  131. package/src/components/Thread/ThreadMessage.tsx +5 -2
  132. package/src/components/Toolbox/Toolbox.stories.tsx +1 -1
  133. package/src/components/Toolbox/Toolbox.tsx +1 -1
  134. package/src/components/index.ts +1 -1
  135. package/src/hooks/index.ts +0 -1
  136. package/src/hooks/processor.ts +26 -4
  137. package/src/hooks/useChatProcessor.tsx +4 -3
  138. package/src/testing/test-services.ts +6 -6
  139. package/src/tools/function.ts +2 -2
  140. package/src/tools/openapi.ts +4 -3
  141. package/src/translations.ts +5 -4
  142. package/src/types/service.ts +39 -37
  143. package/src/types/template.ts +27 -25
  144. package/src/types/types.ts +20 -17
  145. package/dist/lib/browser/ChatContainer-V5GP7DYF.mjs.map +0 -7
  146. package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs +0 -78
  147. package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs.map +0 -7
  148. package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs.map +0 -7
  149. package/dist/lib/browser/chunk-FMB7RGMP.mjs.map +0 -7
  150. package/dist/lib/browser/chunk-IAMR2FAE.mjs +0 -183
  151. package/dist/lib/browser/chunk-IAMR2FAE.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-KYMKVE6M.mjs +0 -128
  153. package/dist/lib/browser/chunk-KYMKVE6M.mjs.map +0 -7
  154. package/dist/lib/browser/intent-resolver-WJGLKKVO.mjs.map +0 -7
  155. package/dist/lib/browser/react-surface-57VRDOQT.mjs.map +0 -7
  156. package/dist/lib/browser/settings-U6UFQX32.mjs.map +0 -7
  157. package/dist/lib/node/ChatContainer-ZJ5JXF6A.cjs.map +0 -7
  158. package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs +0 -104
  159. package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs.map +0 -7
  160. package/dist/lib/node/app-graph-builder-N5ZUUI2Z.cjs.map +0 -7
  161. package/dist/lib/node/chunk-APRU3QWK.cjs +0 -206
  162. package/dist/lib/node/chunk-APRU3QWK.cjs.map +0 -7
  163. package/dist/lib/node/chunk-RPBKMP2E.cjs.map +0 -7
  164. package/dist/lib/node/chunk-ZKOC4ZFY.cjs.map +0 -7
  165. package/dist/lib/node/intent-resolver-R3OSTIMH.cjs.map +0 -7
  166. package/dist/lib/node/react-surface-NUQTM6MS.cjs.map +0 -7
  167. package/dist/lib/node/settings-TXGRCYAL.cjs.map +0 -7
  168. package/dist/lib/node-esm/ChatContainer-QW3OOXTT.mjs.map +0 -7
  169. package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs +0 -79
  170. package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs.map +0 -7
  171. package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs.map +0 -7
  172. package/dist/lib/node-esm/chunk-GBBXIW5F.mjs +0 -129
  173. package/dist/lib/node-esm/chunk-GBBXIW5F.mjs.map +0 -7
  174. package/dist/lib/node-esm/chunk-MVDAY3CZ.mjs.map +0 -7
  175. package/dist/lib/node-esm/chunk-MXK2EANZ.mjs +0 -184
  176. package/dist/lib/node-esm/chunk-MXK2EANZ.mjs.map +0 -7
  177. package/dist/lib/node-esm/intent-resolver-H32TL4X6.mjs.map +0 -7
  178. package/dist/lib/node-esm/react-surface-JBVZF6CP.mjs.map +0 -7
  179. package/dist/lib/node-esm/settings-DZU5PNXM.mjs.map +0 -7
  180. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
  181. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
  182. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
  183. package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
  184. package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
  185. package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
  186. package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
  187. package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
  188. package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
  189. package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
  190. package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
  191. package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -76
  192. package/src/components/ServiceRegistry/index.ts +0 -5
  193. package/src/hooks/invocation-handler.ts +0 -107
  194. package/src/hooks/useLocalTriggerManager.ts +0 -82
  195. /package/dist/lib/browser/{AssistantDialog-YSHMAHW5.mjs.map → AssistantDialog-WX6EKSXI.mjs.map} +0 -0
  196. /package/dist/lib/node/{AssistantDialog-YI2BSGSX.cjs.map → AssistantDialog-2OTAZADX.cjs.map} +0 -0
  197. /package/dist/lib/node-esm/{AssistantDialog-U2FQX5TD.mjs.map → AssistantDialog-GNLPYXY4.mjs.map} +0 -0
@@ -0,0 +1,91 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Match, type Schema } from 'effect';
6
+ import React, { type ChangeEvent, useCallback } from 'react';
7
+
8
+ import { debounce } from '@dxos/async';
9
+ import { Input, Select, Toolbar, useTranslation } from '@dxos/react-ui';
10
+
11
+ import { ASSISTANT_PLUGIN } from '../meta';
12
+ import { TemplateKinds, type TemplateType, type TemplateKindSchema } from '../types';
13
+
14
+ export const PromptSettings = ({ template }: { template: TemplateType }) => {
15
+ const { t } = useTranslation(ASSISTANT_PLUGIN);
16
+
17
+ const handleKindChange = useCallback(
18
+ (value: string) => {
19
+ const kind = Match.type<string>().pipe(
20
+ Match.withReturnType<Schema.Schema.Type<typeof TemplateKindSchema>>(),
21
+ Match.when('always', () => ({ include: 'always' })),
22
+ Match.when('schema-matching', () => ({ include: 'schema-matching', typename: '' })),
23
+ Match.when('automatically', () => ({ include: 'automatically', description: '' })),
24
+ Match.orElse(() => ({ include: 'manual' })),
25
+ )(value);
26
+
27
+ template.kind = kind;
28
+ },
29
+ [template],
30
+ );
31
+
32
+ const handleTypenameChange = useCallback(
33
+ debounce((event: ChangeEvent<HTMLInputElement>) => {
34
+ if (template.kind.include === 'schema-matching') {
35
+ template.kind.typename = event.target.value;
36
+ }
37
+ }, 300),
38
+ [template.kind.include],
39
+ );
40
+
41
+ const handleDescriptionChange = useCallback(
42
+ debounce((event: ChangeEvent<HTMLInputElement>) => {
43
+ if (template.kind.include === 'automatically') {
44
+ template.kind.description = event.target.value;
45
+ }
46
+ }, 300),
47
+ [template.kind.include],
48
+ );
49
+
50
+ return (
51
+ <div className='p-2 flex flex-col gap-4'>
52
+ <h2>{t('prompt rules label')}</h2>
53
+ <Toolbar.Root>
54
+ <Select.Root value={template.kind.include} onValueChange={handleKindChange}>
55
+ <Toolbar.Button asChild>
56
+ <Select.TriggerButton />
57
+ </Toolbar.Button>
58
+ <Select.Portal>
59
+ <Select.Content>
60
+ <Select.Viewport>
61
+ {TemplateKinds.map((kind) => (
62
+ <Select.Option key={kind} value={kind}>
63
+ {kind}
64
+ </Select.Option>
65
+ ))}
66
+ </Select.Viewport>
67
+ </Select.Content>
68
+ </Select.Portal>
69
+ </Select.Root>
70
+ {template.kind.include === 'schema-matching' && (
71
+ <Input.Root>
72
+ <Input.TextInput
73
+ placeholder={t('typename placeholder')}
74
+ defaultValue={template.kind.typename}
75
+ onChange={handleTypenameChange}
76
+ />
77
+ </Input.Root>
78
+ )}
79
+ {template.kind.include === 'automatically' && (
80
+ <Input.Root>
81
+ <Input.TextInput
82
+ placeholder={t('description placeholder')}
83
+ defaultValue={template.kind.description}
84
+ onChange={handleDescriptionChange}
85
+ />
86
+ </Input.Root>
87
+ )}
88
+ </Toolbar.Root>
89
+ </div>
90
+ );
91
+ };
@@ -2,92 +2,16 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Match, type Schema as S } from 'effect';
6
- import React, { type ChangeEvent, useCallback } from 'react';
5
+ import React from 'react';
7
6
 
8
- import { debounce } from '@dxos/async';
9
- import { Input, Select, Toolbar, useTranslation } from '@dxos/react-ui';
10
7
  import { StackItem } from '@dxos/react-ui-stack';
11
8
 
12
9
  import { TemplateEditor } from './TemplateEditor';
13
- import { ASSISTANT_PLUGIN } from '../meta';
14
- import { TemplateKinds, type TemplateKindSchema, type TemplateType } from '../types';
10
+ import { type TemplateType } from '../types';
15
11
 
16
12
  export const TemplateContainer = ({ template, role }: { template: TemplateType; role: string }) => {
17
- const { t } = useTranslation(ASSISTANT_PLUGIN);
18
-
19
- const handleKindChange = useCallback(
20
- (value: string) => {
21
- const kind = Match.type<string>().pipe(
22
- Match.withReturnType<S.Schema.Type<typeof TemplateKindSchema>>(),
23
- Match.when('always', () => ({ include: 'always' })),
24
- Match.when('schema-matching', () => ({ include: 'schema-matching', typename: '' })),
25
- Match.when('automatically', () => ({ include: 'automatically', description: '' })),
26
- Match.orElse(() => ({ include: 'manual' })),
27
- )(value);
28
-
29
- template.kind = kind;
30
- },
31
- [template],
32
- );
33
-
34
- const handleTypenameChange = useCallback(
35
- debounce((event: ChangeEvent<HTMLInputElement>) => {
36
- if (template.kind.include === 'schema-matching') {
37
- template.kind.typename = event.target.value;
38
- }
39
- }, 300),
40
- [template.kind.include],
41
- );
42
-
43
- const handleDescriptionChange = useCallback(
44
- debounce((event: ChangeEvent<HTMLInputElement>) => {
45
- if (template.kind.include === 'automatically') {
46
- template.kind.description = event.target.value;
47
- }
48
- }, 300),
49
- [template.kind.include],
50
- );
51
-
52
13
  return (
53
- <StackItem.Content role={role} toolbar classNames='container-max-width'>
54
- {/* TODO(wittjosiah): Move this toolbar into c11y sidebar. */}
55
- <Toolbar.Root>
56
- <Select.Root value={template.kind.include} onValueChange={handleKindChange}>
57
- <Toolbar.Button asChild>
58
- <Select.TriggerButton />
59
- </Toolbar.Button>
60
- <Select.Portal>
61
- <Select.Content>
62
- <Select.Viewport>
63
- {TemplateKinds.map((kind) => (
64
- <Select.Option key={kind} value={kind}>
65
- {kind}
66
- </Select.Option>
67
- ))}
68
- </Select.Viewport>
69
- </Select.Content>
70
- </Select.Portal>
71
- </Select.Root>
72
- {template.kind.include === 'schema-matching' && (
73
- <Input.Root>
74
- <Input.TextInput
75
- placeholder={t('typename placeholder')}
76
- defaultValue={template.kind.typename}
77
- onChange={handleTypenameChange}
78
- />
79
- </Input.Root>
80
- )}
81
- {template.kind.include === 'automatically' && (
82
- <Input.Root>
83
- <Input.TextInput
84
- placeholder={t('description placeholder')}
85
- defaultValue={template.kind.description}
86
- onChange={handleDescriptionChange}
87
- />
88
- </Input.Root>
89
- )}
90
- </Toolbar.Root>
14
+ <StackItem.Content role={role} classNames='container-max-width'>
91
15
  <TemplateEditor template={template} />
92
16
  </StackItem.Content>
93
17
  );
@@ -8,7 +8,7 @@ import { type Meta } from '@storybook/react';
8
8
  import React, { useState } from 'react';
9
9
 
10
10
  import { createSystemPrompt } from '@dxos/artifact';
11
- import { create } from '@dxos/live-object';
11
+ import { live } from '@dxos/live-object';
12
12
  import { useClient } from '@dxos/react-client';
13
13
  import { withClientProvider } from '@dxos/react-client/testing';
14
14
  import { withLayout, withTheme } from '@dxos/storybook-utils';
@@ -38,7 +38,7 @@ const DefaultStory = ({ text }: TemplateEditorProps & { text: string }) => {
38
38
  const client = useClient();
39
39
  const [template] = useState(() => {
40
40
  const space = client.spaces.default;
41
- return space.db.add(create(TemplateType, { source: text, kind: { include: 'manual' } }));
41
+ return space.db.add(live(TemplateType, { source: text, kind: { include: 'manual' } }));
42
42
  });
43
43
 
44
44
  return (
@@ -7,7 +7,7 @@ import '@dxos-theme';
7
7
  import { type Meta } from '@storybook/react';
8
8
  import React, { useState } from 'react';
9
9
 
10
- import { create } from '@dxos/live-object';
10
+ import { live } from '@dxos/live-object';
11
11
  import { useClient } from '@dxos/react-client';
12
12
  import { withClientProvider } from '@dxos/react-client/testing';
13
13
  import { withLayout, withTheme } from '@dxos/storybook-utils';
@@ -30,7 +30,7 @@ const DefaultStory = () => {
30
30
  const client = useClient();
31
31
  const [template] = useState(() => {
32
32
  const space = client.spaces.default;
33
- return space.db.add(create(TemplateType, { source: TEMPLATE, kind: { include: 'manual' } }));
33
+ return space.db.add(live(TemplateType, { source: TEMPLATE, kind: { include: 'manual' } }));
34
34
  });
35
35
 
36
36
  return (
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Schema as S } from 'effect';
5
+ import { type Schema } from 'effect';
6
6
  import React, { Fragment, useEffect } from 'react';
7
7
 
8
8
  import { Input, Select, useTranslation } from '@dxos/react-ui';
@@ -15,7 +15,7 @@ import { type TemplateInput, TemplateInputType, type TemplateType } from '../../
15
15
 
16
16
  export type TemplateFormProps = {
17
17
  template: TemplateType;
18
- schema?: S.Schema<any, any, any>;
18
+ schema?: Schema.Schema<any, any, any>;
19
19
  commandEditable?: boolean;
20
20
  };
21
21
 
@@ -18,11 +18,12 @@ import {
18
18
  } from '@dxos/app-framework';
19
19
  import { withPluginManager } from '@dxos/app-framework/testing';
20
20
  import { Message, type Tool } from '@dxos/artifact';
21
- import { genericTools, localServiceEndpoints, type IsObject } from '@dxos/artifact-testing';
21
+ import { genericTools, localServiceEndpoints } from '@dxos/artifact-testing';
22
22
  import { AIServiceEdgeClient } from '@dxos/assistant';
23
- import { createStatic, ObjectId } from '@dxos/echo-schema';
23
+ import { type Type } from '@dxos/echo';
24
+ import { create, ObjectId } from '@dxos/echo-schema';
24
25
  import { invariant } from '@dxos/invariant';
25
- import { DXN, QueueSubspaceTags, SpaceId } from '@dxos/keys';
26
+ import { DXN } from '@dxos/keys';
26
27
  import { ChessPlugin } from '@dxos/plugin-chess';
27
28
  import { ChessType } from '@dxos/plugin-chess/types';
28
29
  import { ClientPlugin } from '@dxos/plugin-client';
@@ -30,11 +31,10 @@ import { InboxPlugin } from '@dxos/plugin-inbox';
30
31
  import { MapPlugin } from '@dxos/plugin-map';
31
32
  import { SpacePlugin } from '@dxos/plugin-space';
32
33
  import { TablePlugin } from '@dxos/plugin-table';
33
- import { useQueue, useSpace } from '@dxos/react-client/echo';
34
- import { withClientProvider } from '@dxos/react-client/testing';
34
+ import { createQueueDxn, useQueue, useSpace } from '@dxos/react-client/echo';
35
35
  import { IconButton, Input, Toolbar } from '@dxos/react-ui';
36
36
  import { mx } from '@dxos/react-ui-theme';
37
- import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
37
+ import { withLayout, withTheme } from '@dxos/storybook-utils';
38
38
 
39
39
  import { Thread, type ThreadProps } from './Thread';
40
40
  import { ChatProcessor } from '../../hooks';
@@ -44,7 +44,7 @@ import translations from '../../translations';
44
44
  const endpoints = localServiceEndpoints;
45
45
 
46
46
  type RenderProps = {
47
- items?: IsObject[];
47
+ items?: Type.AnyObject[];
48
48
  prompts?: string[];
49
49
  } & Pick<ThreadProps, 'debug'>;
50
50
 
@@ -77,13 +77,13 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
77
77
  }, [aiClient, tools, space, dispatch, artifactDefinitions]);
78
78
 
79
79
  // Queue.
80
- const [queueDxn, setQueueDxn] = useState<string>(() => randomQueueDxn());
80
+ const [queueDxn, setQueueDxn] = useState<string>(() => createQueueDxn().toString());
81
81
  const queue = useQueue<Message>(DXN.tryParse(queueDxn));
82
82
 
83
83
  useEffect(() => {
84
84
  if (queue?.items.length === 0 && !queue.isLoading && prompts.length > 0) {
85
85
  queue.append([
86
- createStatic(Message, {
86
+ create(Message, {
87
87
  role: 'assistant',
88
88
  content: prompts.map(
89
89
  (prompt) =>
@@ -160,7 +160,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
160
160
  iconOnly
161
161
  label='Clear history'
162
162
  icon='ph--trash--regular'
163
- onClick={() => setQueueDxn(randomQueueDxn())}
163
+ onClick={() => setQueueDxn(createQueueDxn().toString())}
164
164
  />
165
165
  <IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
166
166
  </Input.Root>
@@ -201,18 +201,10 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
201
201
  );
202
202
  };
203
203
 
204
- const randomQueueDxn = () =>
205
- new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, SpaceId.random(), ObjectId.random()]).toString();
206
-
207
204
  const meta: Meta<typeof DefaultStory> = {
208
205
  title: 'plugins/plugin-automation/ThreadContainer',
209
206
  render: DefaultStory,
210
207
  decorators: [
211
- withSignals,
212
- withClientProvider({
213
- createIdentity: true,
214
- createSpace: true,
215
- }),
216
208
  withPluginManager({
217
209
  plugins: [
218
210
  ClientPlugin({
@@ -220,7 +212,7 @@ const meta: Meta<typeof DefaultStory> = {
220
212
  await client.halo.createIdentity();
221
213
  },
222
214
  }),
223
- SpacePlugin({ observability: false }),
215
+ SpacePlugin(),
224
216
  SettingsPlugin(),
225
217
  IntentPlugin(),
226
218
 
@@ -255,7 +247,7 @@ export const WithInitialItems: Story = {
255
247
  args: {
256
248
  debug: true,
257
249
  items: [
258
- createStatic(ChessType, {
250
+ create(ChessType, {
259
251
  fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
260
252
  }),
261
253
  ],
@@ -2,10 +2,13 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { useCallback, type FC } from 'react';
5
+ import React, { useCallback, type FC, useEffect } from 'react';
6
6
 
7
+ import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
7
8
  import { type AssociatedArtifact } from '@dxos/artifact';
8
9
  import { invariant } from '@dxos/invariant';
10
+ import { DXN } from '@dxos/keys';
11
+ import { makeRef, refFromDXN } from '@dxos/live-object';
9
12
  import { log } from '@dxos/log';
10
13
  import { getSpace } from '@dxos/react-client/echo';
11
14
  import { type ThemedClassName } from '@dxos/react-ui';
@@ -35,8 +38,27 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
35
38
  const contextProvider = useContextProvider(space);
36
39
  const processor = useChatProcessor({ chat, space, settings, part, associatedArtifact });
37
40
  const messageQueue = useMessageQueue(chat);
41
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
42
+ // TODO(thure): This will be referentially new on every render, is it causing overreactivity?
38
43
  const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
39
44
 
45
+ // Post last message to document.
46
+ useEffect(() => {
47
+ if (!processor.streaming.value && messageQueue?.items) {
48
+ const message = messageQueue.items[messageQueue.items.length - 1];
49
+ if (space && chat && message && dispatch && associatedArtifact) {
50
+ void dispatch(
51
+ createIntent(CollaborationActions.InsertContent, {
52
+ spaceId: space.id,
53
+ target: makeRef(associatedArtifact),
54
+ object: refFromDXN(new DXN(DXN.kind.QUEUE, [...chat.assistantChatQueue.dxn.parts, message.id])),
55
+ label: 'View proposal',
56
+ }),
57
+ );
58
+ }
59
+ }
60
+ }, [messageQueue, associatedArtifact, processor.streaming.value]);
61
+
40
62
  const handleSubmit = useCallback(
41
63
  (text: string) => {
42
64
  // Don't accept input if still processing.
@@ -74,11 +96,11 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
74
96
  processing={processor.streaming.value}
75
97
  error={processor.error.value}
76
98
  tools={processor.tools}
99
+ contextProvider={contextProvider}
77
100
  onSubmit={handleSubmit}
78
101
  onCancel={handleCancel}
79
102
  onPrompt={handleSubmit}
80
103
  onOpenChange={onOpenChange}
81
- contextProvider={contextProvider}
82
104
  {...props}
83
105
  />
84
106
  );
@@ -105,7 +105,7 @@ const components: Record<string, BlockComponent> = {
105
105
  return (
106
106
  <ToggleContainer
107
107
  // open={open}
108
- defaultOpen={block.disposition === 'cot' && block.pending}
108
+ defaultOpen={systemDispositions.includes(block.disposition ?? '') && block.pending}
109
109
  title={title}
110
110
  icon={
111
111
  block.pending ? (
@@ -115,7 +115,7 @@ const components: Record<string, BlockComponent> = {
115
115
  >
116
116
  <MarkdownViewer
117
117
  content={block.text}
118
- classNames={['pbe-2', block.disposition === 'cot' && 'text-sm text-subdued']}
118
+ classNames={['pbe-2', systemDispositions.includes(block.disposition ?? '') && 'text-sm text-subdued']}
119
119
  />
120
120
  </ToggleContainer>
121
121
  );
@@ -193,4 +193,7 @@ const titles: Record<string, string> = {
193
193
  ['tool_use' as const]: 'Tool request',
194
194
  ['tool_result' as const]: 'Tool result',
195
195
  ['tool_list' as const]: 'Tools',
196
+ ['artifact-update' as const]: 'Artifact(s) changed',
196
197
  };
198
+
199
+ const systemDispositions: string[] = ['cot', 'artifact-update'];
@@ -44,7 +44,7 @@ const meta: Meta<typeof Toolbox> = {
44
44
  await client.halo.createIdentity();
45
45
  },
46
46
  }),
47
- SpacePlugin({ observability: false }),
47
+ SpacePlugin(),
48
48
  SettingsPlugin(),
49
49
  IntentPlugin(),
50
50
  ChessPlugin(),
@@ -6,7 +6,7 @@ import React, { useState, useEffect, Fragment, type FC } from 'react';
6
6
 
7
7
  import { Capabilities, useCapabilities } from '@dxos/app-framework';
8
8
  import { parseToolName, type ArtifactDefinition, type Tool } from '@dxos/artifact';
9
- import { FunctionType } from '@dxos/functions/types';
9
+ import { FunctionType } from '@dxos/functions';
10
10
  import { log } from '@dxos/log';
11
11
  import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
12
12
  import { type ThemedClassName } from '@dxos/react-ui';
@@ -5,7 +5,7 @@
5
5
  import { lazy } from 'react';
6
6
 
7
7
  export * from './AssistantSettings';
8
- export * from './ServiceRegistry';
8
+ export * from './PromptSettings';
9
9
  export * from './TemplateEditor';
10
10
  export * from './Thread';
11
11
  export * from './Toolbox';
@@ -5,7 +5,6 @@
5
5
  export * from './processor';
6
6
 
7
7
  export * from './useChatProcessor';
8
- export * from './useLocalTriggerManager';
9
8
  export * from './useMessageQueue';
10
9
  export * from './useServices';
11
10
  export * from './useTextInputEvents';
@@ -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 { type Space } from '@dxos/react-client/echo';
12
+ import { getVersion, 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: 'immediate' });
102
+ this._session = new AISession({ operationModel: 'configured' });
103
103
 
104
104
  // Message complete.
105
105
  this._session.message.on((message) => {
@@ -125,17 +125,39 @@ 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) ?? [],
128
129
  tools: this._tools ?? [],
129
130
  prompt: message,
130
131
  systemPrompt: this._options.systemPrompt,
131
132
  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
+ },
132
155
  generationOptions: {
133
156
  model: this._options.model,
134
157
  },
135
158
  });
136
159
 
137
- log.info('completed', { messages });
138
-
160
+ log('completed', { messages });
139
161
  options.onComplete?.(this._pending.value);
140
162
  } catch (err) {
141
163
  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/types';
10
+ import { FunctionType } from '@dxos/functions';
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';
@@ -33,7 +33,8 @@ export const useChatProcessor = ({
33
33
  chat,
34
34
  space,
35
35
  settings,
36
- part = 'deck',
36
+ // part = 'deck',
37
+ part,
37
38
  associatedArtifact,
38
39
  }: UseChatProcessorProps): ChatProcessor => {
39
40
  const aiClient = useCapability(AssistantCapabilities.AiClient);
@@ -90,7 +91,7 @@ export const useChatProcessor = ({
90
91
  const processor = useMemo(() => {
91
92
  log('creating processor...', { settings });
92
93
  return new ChatProcessor(aiClient.value, tools, artifactDefinitions, extensions, { model, systemPrompt });
93
- }, [aiClient.value, tools, extensions, model, systemPrompt]);
94
+ }, [aiClient.value, tools, artifactDefinitions, extensions, model, systemPrompt]);
94
95
 
95
96
  return processor;
96
97
  };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { createStatic } from '@dxos/echo-schema';
5
+ import { create } 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
- createStatic(ServiceType, {
57
+ create(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
- createStatic(ServiceType, {
71
+ create(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
- createStatic(ServiceType, {
85
+ create(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
- createStatic(ServiceType, {
100
+ create(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
- createStatic(ServiceType, {
118
+ create(ServiceType, {
119
119
  serviceId: `example.com/service/test-${i}`,
120
120
  name: `Test ${i}`,
121
121
  description: `Test ${i}`,
@@ -5,8 +5,8 @@
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/types';
9
- import type { FunctionType } from '@dxos/functions/types';
8
+ import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
9
+ import type { FunctionType } from '@dxos/functions';
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';
@@ -2,11 +2,12 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema } from 'effect';
5
6
  import jsonpointer from 'jsonpointer';
6
7
  import { type OpenAPIV2, type OpenAPIV3_1 } from 'openapi-types';
7
8
 
8
9
  import { ToolResult, type Tool } from '@dxos/artifact';
9
- import { JsonSchemaType, normalizeSchema, S, toEffectSchema } from '@dxos/echo-schema';
10
+ import { JsonSchemaType, normalizeSchema, toEffectSchema } from '@dxos/echo-schema';
10
11
  import { invariant } from '@dxos/invariant';
11
12
  import { log } from '@dxos/log';
12
13
  import { deepMapValues } from '@dxos/util';
@@ -82,7 +83,7 @@ export const createToolsFromApi = async (url: string, options?: CreateToolsFromA
82
83
  }
83
84
 
84
85
  log('inputSchema', { inputSchema });
85
- S.validateSync(JsonSchemaType)(inputSchema);
86
+ Schema.validateSync(JsonSchemaType)(inputSchema);
86
87
 
87
88
  const description = methodItem.description ?? methodItem.summary;
88
89
  if (!description) {
@@ -200,7 +201,7 @@ const callApiEndpoint = async (endpoint: EndpointDescriptor, input: any) => {
200
201
 
201
202
  // Client-side validation
202
203
  const effectSchema = toEffectSchema(parameter.schema);
203
- S.validateSync(effectSchema)(value);
204
+ Schema.validateSync(effectSchema)(value);
204
205
 
205
206
  if (body) {
206
207
  throw new Error(`Duplicate body parameter: ${parameter.name}`);