@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.
- package/dist/lib/browser/{AssistantDialog-DTWVEQBB.mjs → AssistantDialog-YSHMAHW5.mjs} +3 -3
- package/dist/lib/browser/{ChatContainer-ZNKENYKZ.mjs → ChatContainer-V5GP7DYF.mjs} +3 -3
- package/dist/lib/browser/ChatContainer-V5GP7DYF.mjs.map +7 -0
- package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs +78 -0
- package/dist/lib/browser/TemplateContainer-K4EJNGIL.mjs.map +7 -0
- package/dist/lib/browser/{ai-client-5PRCXI7N.mjs → ai-client-CDZLSNXE.mjs} +3 -3
- package/dist/lib/browser/ai-client-CDZLSNXE.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs +209 -0
- package/dist/lib/browser/app-graph-builder-MF5EVDWW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OWZHLWW5.mjs → chunk-FMB7RGMP.mjs} +136 -147
- package/dist/lib/browser/chunk-FMB7RGMP.mjs.map +7 -0
- package/dist/lib/browser/chunk-IAMR2FAE.mjs +183 -0
- package/dist/lib/browser/chunk-IAMR2FAE.mjs.map +7 -0
- package/dist/lib/browser/chunk-KYMKVE6M.mjs +128 -0
- package/dist/lib/browser/chunk-KYMKVE6M.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-QV5AAVJZ.mjs → intent-resolver-WJGLKKVO.mjs} +12 -7
- package/dist/lib/browser/intent-resolver-WJGLKKVO.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-JJPYWEIN.mjs → react-surface-57VRDOQT.mjs} +17 -17
- package/dist/lib/browser/react-surface-57VRDOQT.mjs.map +7 -0
- package/dist/lib/browser/{settings-OZX7J65A.mjs → settings-U6UFQX32.mjs} +4 -4
- package/dist/lib/browser/settings-U6UFQX32.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -3
- package/dist/lib/node/{AssistantDialog-RJJHZI63.cjs → AssistantDialog-YI2BSGSX.cjs} +7 -7
- package/dist/lib/node/{ChatContainer-WVAAOEOH.cjs → ChatContainer-ZJ5JXF6A.cjs} +7 -7
- package/dist/lib/node/ChatContainer-ZJ5JXF6A.cjs.map +7 -0
- package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs +104 -0
- package/dist/lib/node/TemplateContainer-XWFYJB4T.cjs.map +7 -0
- package/dist/lib/node/{ai-client-OUPSRQT7.cjs → ai-client-URCCYU6B.cjs} +6 -6
- package/dist/lib/node/ai-client-URCCYU6B.cjs.map +7 -0
- package/dist/lib/node/{app-graph-builder-LEO63CZZ.cjs → app-graph-builder-N5ZUUI2Z.cjs} +94 -74
- package/dist/lib/node/app-graph-builder-N5ZUUI2Z.cjs.map +7 -0
- package/dist/lib/node/chunk-APRU3QWK.cjs +206 -0
- package/dist/lib/node/chunk-APRU3QWK.cjs.map +7 -0
- package/dist/lib/node/{chunk-OOHFSPWR.cjs → chunk-RPBKMP2E.cjs} +141 -159
- package/dist/lib/node/chunk-RPBKMP2E.cjs.map +7 -0
- package/dist/lib/node/{chunk-GQ3XS5FZ.cjs → chunk-ZKOC4ZFY.cjs} +61 -78
- package/dist/lib/node/chunk-ZKOC4ZFY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +43 -46
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-QDGZMWLY.cjs → intent-resolver-R3OSTIMH.cjs} +15 -10
- package/dist/lib/node/intent-resolver-R3OSTIMH.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-XNEIJJYJ.cjs → react-surface-NUQTM6MS.cjs} +25 -25
- package/dist/lib/node/react-surface-NUQTM6MS.cjs.map +7 -0
- package/dist/lib/node/{settings-WLTC7XO5.cjs → settings-TXGRCYAL.cjs} +7 -7
- package/dist/lib/node/settings-TXGRCYAL.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +12 -14
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{AssistantDialog-D33WZUGR.mjs → AssistantDialog-U2FQX5TD.mjs} +3 -3
- package/dist/lib/node-esm/{ChatContainer-FAYGNMQW.mjs → ChatContainer-QW3OOXTT.mjs} +3 -3
- package/dist/lib/node-esm/ChatContainer-QW3OOXTT.mjs.map +7 -0
- package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs +79 -0
- package/dist/lib/node-esm/TemplateContainer-EUM2X65J.mjs.map +7 -0
- package/dist/lib/node-esm/{ai-client-RZQWEDUX.mjs → ai-client-WMHS5EGV.mjs} +3 -3
- package/dist/lib/node-esm/ai-client-WMHS5EGV.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs +210 -0
- package/dist/lib/node-esm/app-graph-builder-DWBNIMHM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GBBXIW5F.mjs +129 -0
- package/dist/lib/node-esm/chunk-GBBXIW5F.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ED55ZE4G.mjs → chunk-MVDAY3CZ.mjs} +136 -147
- package/dist/lib/node-esm/chunk-MVDAY3CZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MXK2EANZ.mjs +184 -0
- package/dist/lib/node-esm/chunk-MXK2EANZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +11 -14
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-Q3I6S6HN.mjs → intent-resolver-H32TL4X6.mjs} +12 -7
- package/dist/lib/node-esm/intent-resolver-H32TL4X6.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-RI3JONQY.mjs → react-surface-JBVZF6CP.mjs} +17 -17
- package/dist/lib/node-esm/react-surface-JBVZF6CP.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-CLE57WEP.mjs → settings-DZU5PNXM.mjs} +4 -4
- package/dist/lib/node-esm/settings-DZU5PNXM.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -3
- package/dist/types/src/capabilities/ai-client.d.ts +2 -2
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +179 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +179 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -1
- package/dist/types/src/components/AssistantSettings/AssistantSettings.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer.d.ts +3 -4
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -1
- package/dist/types/src/components/Prompt/references.d.ts.map +1 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +6 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +8 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/index.d.ts +2 -0
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +2 -2
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.d.ts.map +1 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +2 -2
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +1 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +6 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/invocation-handler.d.ts +5 -0
- package/dist/types/src/hooks/invocation-handler.d.ts.map +1 -0
- package/dist/types/src/hooks/processor.d.ts.map +1 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts +1 -1
- package/dist/types/src/hooks/useContextProvider.d.ts.map +1 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +3 -0
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +1 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts +3 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -1
- package/dist/types/src/hooks/useServices.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/tools/function.d.ts +2 -2
- package/dist/types/src/tools/function.d.ts.map +1 -1
- package/dist/types/src/tools/openapi.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +58 -7
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +95 -96
- package/dist/types/src/types/service.d.ts.map +1 -1
- package/dist/types/src/types/template.d.ts +52 -52
- package/dist/types/src/types/template.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +18 -20
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +58 -64
- package/src/AssistantPlugin.tsx +2 -2
- package/src/capabilities/ai-client.ts +5 -4
- package/src/capabilities/app-graph-builder.ts +133 -161
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/intent-resolver.ts +8 -5
- package/src/capabilities/react-surface.tsx +11 -13
- package/src/capabilities/settings.ts +2 -2
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +1 -1
- package/src/components/AssistantSettings/AssistantSettings.tsx +6 -28
- package/src/components/ChatContainer.tsx +8 -6
- package/src/components/Prompt/Prompt.stories.tsx +1 -1
- package/src/components/Prompt/PromptBar.tsx +12 -4
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +49 -0
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +76 -0
- package/src/components/ServiceRegistry/index.ts +5 -0
- package/src/components/TemplateContainer.tsx +79 -3
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +2 -2
- package/src/components/TemplateEditor/TemplateForm.tsx +2 -2
- package/src/components/Thread/Thread.stories.tsx +15 -12
- package/src/components/Thread/ThreadContainer.stories.tsx +21 -12
- package/src/components/Thread/ThreadContainer.tsx +2 -24
- package/src/components/Thread/ThreadMessage.tsx +3 -6
- package/src/components/Toolbox/Toolbox.stories.tsx +3 -3
- package/src/components/Toolbox/Toolbox.tsx +3 -3
- package/src/components/index.ts +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/invocation-handler.ts +107 -0
- package/src/hooks/processor.ts +4 -26
- package/src/hooks/useChatProcessor.tsx +7 -8
- package/src/hooks/useContextProvider.ts +16 -20
- package/src/hooks/useLocalTriggerManager.ts +82 -0
- package/src/hooks/useMessageQueue.ts +2 -2
- package/src/testing/test-services.ts +6 -6
- package/src/tools/function.ts +6 -4
- package/src/tools/openapi.ts +3 -4
- package/src/translations.ts +4 -5
- package/src/types/service.ts +37 -39
- package/src/types/template.ts +25 -27
- package/src/types/types.ts +17 -20
- package/dist/lib/browser/ChatContainer-ZNKENYKZ.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs +0 -22
- package/dist/lib/browser/TemplateContainer-WKU5XFSO.mjs.map +0 -7
- package/dist/lib/browser/ai-client-5PRCXI7N.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs +0 -189
- package/dist/lib/browser/app-graph-builder-HTK3HFGM.mjs.map +0 -7
- package/dist/lib/browser/chunk-5P7U35RJ.mjs +0 -192
- package/dist/lib/browser/chunk-5P7U35RJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-7VDZP5WX.mjs +0 -143
- package/dist/lib/browser/chunk-7VDZP5WX.mjs.map +0 -7
- package/dist/lib/browser/chunk-OWZHLWW5.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-QV5AAVJZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JJPYWEIN.mjs.map +0 -7
- package/dist/lib/browser/settings-OZX7J65A.mjs.map +0 -7
- package/dist/lib/node/ChatContainer-WVAAOEOH.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs +0 -52
- package/dist/lib/node/TemplateContainer-EQXKHWTF.cjs.map +0 -7
- package/dist/lib/node/ai-client-OUPSRQT7.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-LEO63CZZ.cjs.map +0 -7
- package/dist/lib/node/chunk-GQ3XS5FZ.cjs.map +0 -7
- package/dist/lib/node/chunk-OOHFSPWR.cjs.map +0 -7
- package/dist/lib/node/chunk-VG2UQY4S.cjs +0 -216
- package/dist/lib/node/chunk-VG2UQY4S.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-QDGZMWLY.cjs.map +0 -7
- package/dist/lib/node/react-surface-XNEIJJYJ.cjs.map +0 -7
- package/dist/lib/node/settings-WLTC7XO5.cjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-FAYGNMQW.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs +0 -23
- package/dist/lib/node-esm/TemplateContainer-3LEBT5ZC.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-RZQWEDUX.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs +0 -190
- package/dist/lib/node-esm/app-graph-builder-WXJNZDYB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-74GFINWJ.mjs +0 -144
- package/dist/lib/node-esm/chunk-74GFINWJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ED55ZE4G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UZWYXNR5.mjs +0 -193
- package/dist/lib/node-esm/chunk-UZWYXNR5.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-Q3I6S6HN.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RI3JONQY.mjs.map +0 -7
- package/dist/lib/node-esm/settings-CLE57WEP.mjs.map +0 -7
- package/dist/types/src/components/PromptSettings.d.ts +0 -6
- package/dist/types/src/components/PromptSettings.d.ts.map +0 -1
- package/src/components/PromptSettings.tsx +0 -91
- /package/dist/lib/browser/{AssistantDialog-DTWVEQBB.mjs.map → AssistantDialog-YSHMAHW5.mjs.map} +0 -0
- /package/dist/lib/node/{AssistantDialog-RJJHZI63.cjs.map → AssistantDialog-YI2BSGSX.cjs.map} +0 -0
- /package/dist/lib/node-esm/{AssistantDialog-D33WZUGR.mjs.map → AssistantDialog-U2FQX5TD.mjs.map} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Filter, type Space } from '@dxos/client/echo';
|
|
8
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
9
|
+
import { Icon, Input, List, ListItem } from '@dxos/react-ui';
|
|
10
|
+
|
|
11
|
+
import { useServices } from '../../hooks';
|
|
12
|
+
import { categoryIcons, ServiceType } from '../../types';
|
|
13
|
+
|
|
14
|
+
// TODO(burdon): Option to show all/enabled/filter.
|
|
15
|
+
export const ServiceRegistry = ({ space }: { space: Space }) => {
|
|
16
|
+
const matchingServices = useServices(space);
|
|
17
|
+
const enabledServices = useQuery(space, Filter.schema(ServiceType));
|
|
18
|
+
|
|
19
|
+
// Join matching services with enabled services.
|
|
20
|
+
const services = useMemo(() => {
|
|
21
|
+
return matchingServices.map((service) => enabledServices.find((s) => s.serviceId === service.serviceId) ?? service);
|
|
22
|
+
}, [matchingServices, enabledServices]);
|
|
23
|
+
|
|
24
|
+
// TODO(burdon): Reaplce with SpacePlugin intent.
|
|
25
|
+
const handleSetEnabled = (service: ServiceType, enabled: boolean) => {
|
|
26
|
+
if (enabled) {
|
|
27
|
+
space.db.add(service);
|
|
28
|
+
} else {
|
|
29
|
+
// TODO(burdon): Remove or disable?
|
|
30
|
+
space.db.remove(service);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<List classNames='h-full grid auto-rows-[5rem] gap-2 p-2 pis-2 pie-2 overflow-y-auto scrollbar-thin'>
|
|
36
|
+
{services.map((service) => (
|
|
37
|
+
<ServiceItem
|
|
38
|
+
key={service.serviceId}
|
|
39
|
+
service={service}
|
|
40
|
+
enabled={service.enabled}
|
|
41
|
+
setEnabled={(enabled) => handleSetEnabled(service, enabled)}
|
|
42
|
+
/>
|
|
43
|
+
))}
|
|
44
|
+
</List>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const ServiceItem = ({
|
|
49
|
+
service,
|
|
50
|
+
enabled,
|
|
51
|
+
setEnabled,
|
|
52
|
+
}: {
|
|
53
|
+
service: ServiceType;
|
|
54
|
+
enabled?: boolean;
|
|
55
|
+
setEnabled?: (enabled: boolean) => void;
|
|
56
|
+
}) => {
|
|
57
|
+
return (
|
|
58
|
+
<ListItem.Root classNames='flex flex-col gap-1 p-1 overflow-hidden rounded-md border border-separator'>
|
|
59
|
+
<div className='grid grid-cols-[40px_1fr_40px]'>
|
|
60
|
+
<div className='flex gow justify-center items-center'>
|
|
61
|
+
<Icon icon={categoryIcons[service.category ?? 'default'] ?? 'ph--placeholder--regular'} size={6} />
|
|
62
|
+
</div>
|
|
63
|
+
<div className='grow items-center truncate mie-2'>{service.name}</div>
|
|
64
|
+
<div className='flex gow justify-center items-center'>
|
|
65
|
+
<Input.Root>
|
|
66
|
+
<Input.Switch checked={enabled} onClick={() => setEnabled?.(!enabled)} />
|
|
67
|
+
</Input.Root>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div className='grid grid-cols-[40px_1fr]'>
|
|
71
|
+
<div />
|
|
72
|
+
<div className='text-sm text-subdued line-clamp-2 mie-1'>{service.description}</div>
|
|
73
|
+
</div>
|
|
74
|
+
</ListItem.Root>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -2,16 +2,92 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Match, type Schema as S } from 'effect';
|
|
6
|
+
import React, { type ChangeEvent, useCallback } from 'react';
|
|
6
7
|
|
|
8
|
+
import { debounce } from '@dxos/async';
|
|
9
|
+
import { Input, Select, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
7
10
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
8
11
|
|
|
9
12
|
import { TemplateEditor } from './TemplateEditor';
|
|
10
|
-
import {
|
|
13
|
+
import { ASSISTANT_PLUGIN } from '../meta';
|
|
14
|
+
import { TemplateKinds, type TemplateKindSchema, type TemplateType } from '../types';
|
|
11
15
|
|
|
12
16
|
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
|
+
|
|
13
52
|
return (
|
|
14
|
-
<StackItem.Content role={role} classNames='container-max-width'>
|
|
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>
|
|
15
91
|
<TemplateEditor template={template} />
|
|
16
92
|
</StackItem.Content>
|
|
17
93
|
);
|
|
@@ -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 {
|
|
11
|
+
import { create } 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(
|
|
41
|
+
return space.db.add(create(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 {
|
|
10
|
+
import { create } 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(
|
|
33
|
+
return space.db.add(create(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 } from 'effect';
|
|
5
|
+
import { type Schema as S } 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?:
|
|
18
|
+
schema?: S.Schema<any, any, any>;
|
|
19
19
|
commandEditable?: boolean;
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -10,7 +10,7 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|
|
10
10
|
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
12
|
import { type Message } from '@dxos/artifact';
|
|
13
|
-
import {
|
|
13
|
+
import { ObjectId } from '@dxos/echo-schema';
|
|
14
14
|
import { faker } from '@dxos/random';
|
|
15
15
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
16
|
import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
|
|
@@ -29,9 +29,9 @@ const DefaultStory = ({ messages: _messages, ...props }: ThreadProps) => {
|
|
|
29
29
|
|
|
30
30
|
const handleSubmit = useCallback(
|
|
31
31
|
(text: string) => {
|
|
32
|
-
const request: Message = { id:
|
|
32
|
+
const request: Message = { id: ObjectId.random(), role: 'user', content: [{ type: 'text', text }] };
|
|
33
33
|
const response: Message = {
|
|
34
|
-
id:
|
|
34
|
+
id: ObjectId.random(),
|
|
35
35
|
role: 'assistant',
|
|
36
36
|
content: [{ type: 'text', disposition: 'cot', pending: true, text: faker.lorem.paragraphs(1) }],
|
|
37
37
|
};
|
|
@@ -44,7 +44,7 @@ const DefaultStory = ({ messages: _messages, ...props }: ThreadProps) => {
|
|
|
44
44
|
request,
|
|
45
45
|
response,
|
|
46
46
|
{
|
|
47
|
-
id:
|
|
47
|
+
id: ObjectId.random(),
|
|
48
48
|
role: 'assistant',
|
|
49
49
|
content: [{ type: 'text', text: faker.lorem.paragraphs(1) }],
|
|
50
50
|
},
|
|
@@ -74,10 +74,13 @@ const meta: Meta<ThreadProps> = {
|
|
|
74
74
|
component: Thread,
|
|
75
75
|
decorators: [
|
|
76
76
|
withSignals,
|
|
77
|
-
withClientProvider({
|
|
77
|
+
withClientProvider({
|
|
78
|
+
createIdentity: true,
|
|
79
|
+
createSpace: true,
|
|
80
|
+
}),
|
|
78
81
|
withPluginManager({ plugins: [IntentPlugin()] }),
|
|
79
82
|
withTheme,
|
|
80
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center' }),
|
|
83
|
+
withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center' }),
|
|
81
84
|
],
|
|
82
85
|
parameters: {
|
|
83
86
|
translations,
|
|
@@ -90,7 +93,7 @@ type Story = StoryObj<ThreadProps>;
|
|
|
90
93
|
|
|
91
94
|
const TEST_MESSAGES: Message[] = [
|
|
92
95
|
{
|
|
93
|
-
id:
|
|
96
|
+
id: ObjectId.random(),
|
|
94
97
|
role: 'user',
|
|
95
98
|
content: [
|
|
96
99
|
{
|
|
@@ -100,7 +103,7 @@ const TEST_MESSAGES: Message[] = [
|
|
|
100
103
|
],
|
|
101
104
|
},
|
|
102
105
|
{
|
|
103
|
-
id:
|
|
106
|
+
id: ObjectId.random(),
|
|
104
107
|
role: 'assistant',
|
|
105
108
|
content: [
|
|
106
109
|
{
|
|
@@ -125,7 +128,7 @@ const TEST_MESSAGES: Message[] = [
|
|
|
125
128
|
],
|
|
126
129
|
},
|
|
127
130
|
{
|
|
128
|
-
id:
|
|
131
|
+
id: ObjectId.random(),
|
|
129
132
|
role: 'user',
|
|
130
133
|
content: [
|
|
131
134
|
{
|
|
@@ -136,7 +139,7 @@ const TEST_MESSAGES: Message[] = [
|
|
|
136
139
|
],
|
|
137
140
|
},
|
|
138
141
|
{
|
|
139
|
-
id:
|
|
142
|
+
id: ObjectId.random(),
|
|
140
143
|
role: 'assistant',
|
|
141
144
|
content: [
|
|
142
145
|
{
|
|
@@ -148,7 +151,7 @@ const TEST_MESSAGES: Message[] = [
|
|
|
148
151
|
],
|
|
149
152
|
},
|
|
150
153
|
{
|
|
151
|
-
id:
|
|
154
|
+
id: ObjectId.random(),
|
|
152
155
|
role: 'user',
|
|
153
156
|
content: [
|
|
154
157
|
{
|
|
@@ -159,7 +162,7 @@ const TEST_MESSAGES: Message[] = [
|
|
|
159
162
|
],
|
|
160
163
|
},
|
|
161
164
|
{
|
|
162
|
-
id:
|
|
165
|
+
id: ObjectId.random(),
|
|
163
166
|
role: 'assistant',
|
|
164
167
|
content: [
|
|
165
168
|
{
|
|
@@ -18,11 +18,11 @@ 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 } from '@dxos/artifact-testing';
|
|
21
|
+
import { genericTools, localServiceEndpoints, type IsObject } from '@dxos/artifact-testing';
|
|
22
22
|
import { AIServiceEdgeClient } from '@dxos/assistant';
|
|
23
|
-
import {
|
|
24
|
-
import { createQueueDxn, create } from '@dxos/echo-schema';
|
|
23
|
+
import { createStatic, ObjectId } from '@dxos/echo-schema';
|
|
25
24
|
import { invariant } from '@dxos/invariant';
|
|
25
|
+
import { DXN, QueueSubspaceTags, SpaceId } from '@dxos/keys';
|
|
26
26
|
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
27
27
|
import { ChessType } from '@dxos/plugin-chess/types';
|
|
28
28
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
@@ -31,9 +31,10 @@ import { MapPlugin } from '@dxos/plugin-map';
|
|
|
31
31
|
import { SpacePlugin } from '@dxos/plugin-space';
|
|
32
32
|
import { TablePlugin } from '@dxos/plugin-table';
|
|
33
33
|
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
34
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
34
35
|
import { IconButton, Input, Toolbar } from '@dxos/react-ui';
|
|
35
36
|
import { mx } from '@dxos/react-ui-theme';
|
|
36
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
37
|
+
import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
|
|
37
38
|
|
|
38
39
|
import { Thread, type ThreadProps } from './Thread';
|
|
39
40
|
import { ChatProcessor } from '../../hooks';
|
|
@@ -43,7 +44,7 @@ import translations from '../../translations';
|
|
|
43
44
|
const endpoints = localServiceEndpoints;
|
|
44
45
|
|
|
45
46
|
type RenderProps = {
|
|
46
|
-
items?:
|
|
47
|
+
items?: IsObject[];
|
|
47
48
|
prompts?: string[];
|
|
48
49
|
} & Pick<ThreadProps, 'debug'>;
|
|
49
50
|
|
|
@@ -76,13 +77,13 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
76
77
|
}, [aiClient, tools, space, dispatch, artifactDefinitions]);
|
|
77
78
|
|
|
78
79
|
// Queue.
|
|
79
|
-
const [queueDxn, setQueueDxn] = useState<string>(() =>
|
|
80
|
+
const [queueDxn, setQueueDxn] = useState<string>(() => randomQueueDxn());
|
|
80
81
|
const queue = useQueue<Message>(DXN.tryParse(queueDxn));
|
|
81
82
|
|
|
82
83
|
useEffect(() => {
|
|
83
84
|
if (queue?.items.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
84
85
|
queue.append([
|
|
85
|
-
|
|
86
|
+
createStatic(Message, {
|
|
86
87
|
role: 'assistant',
|
|
87
88
|
content: prompts.map(
|
|
88
89
|
(prompt) =>
|
|
@@ -131,7 +132,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
131
132
|
|
|
132
133
|
const handleDelete = useCallback(
|
|
133
134
|
(id: string) => {
|
|
134
|
-
invariant(
|
|
135
|
+
invariant(ObjectId.isValid(id), 'Invalid message id');
|
|
135
136
|
void queue?.delete([id]);
|
|
136
137
|
},
|
|
137
138
|
[queue],
|
|
@@ -159,7 +160,7 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
159
160
|
iconOnly
|
|
160
161
|
label='Clear history'
|
|
161
162
|
icon='ph--trash--regular'
|
|
162
|
-
onClick={() => setQueueDxn(
|
|
163
|
+
onClick={() => setQueueDxn(randomQueueDxn())}
|
|
163
164
|
/>
|
|
164
165
|
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
165
166
|
</Input.Root>
|
|
@@ -200,10 +201,18 @@ const DefaultStory = ({ items: _items, prompts = [], ...props }: RenderProps) =>
|
|
|
200
201
|
);
|
|
201
202
|
};
|
|
202
203
|
|
|
204
|
+
const randomQueueDxn = () =>
|
|
205
|
+
new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, SpaceId.random(), ObjectId.random()]).toString();
|
|
206
|
+
|
|
203
207
|
const meta: Meta<typeof DefaultStory> = {
|
|
204
208
|
title: 'plugins/plugin-automation/ThreadContainer',
|
|
205
209
|
render: DefaultStory,
|
|
206
210
|
decorators: [
|
|
211
|
+
withSignals,
|
|
212
|
+
withClientProvider({
|
|
213
|
+
createIdentity: true,
|
|
214
|
+
createSpace: true,
|
|
215
|
+
}),
|
|
207
216
|
withPluginManager({
|
|
208
217
|
plugins: [
|
|
209
218
|
ClientPlugin({
|
|
@@ -211,7 +220,7 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
211
220
|
await client.halo.createIdentity();
|
|
212
221
|
},
|
|
213
222
|
}),
|
|
214
|
-
SpacePlugin(),
|
|
223
|
+
SpacePlugin({ observability: false }),
|
|
215
224
|
SettingsPlugin(),
|
|
216
225
|
IntentPlugin(),
|
|
217
226
|
|
|
@@ -224,7 +233,7 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
224
233
|
fireEvents: [Events.SetupArtifactDefinition],
|
|
225
234
|
}),
|
|
226
235
|
withTheme,
|
|
227
|
-
withLayout({ fullscreen: true }),
|
|
236
|
+
withLayout({ fullscreen: true, tooltips: true }),
|
|
228
237
|
],
|
|
229
238
|
parameters: {
|
|
230
239
|
translations,
|
|
@@ -246,7 +255,7 @@ export const WithInitialItems: Story = {
|
|
|
246
255
|
args: {
|
|
247
256
|
debug: true,
|
|
248
257
|
items: [
|
|
249
|
-
|
|
258
|
+
createStatic(ChessType, {
|
|
250
259
|
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
|
|
251
260
|
}),
|
|
252
261
|
],
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, type FC
|
|
5
|
+
import React, { useCallback, type FC } from 'react';
|
|
6
6
|
|
|
7
|
-
import { CollaborationActions, createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
7
|
import { type AssociatedArtifact } from '@dxos/artifact';
|
|
9
8
|
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { DXN } from '@dxos/keys';
|
|
11
|
-
import { makeRef, refFromDXN } from '@dxos/live-object';
|
|
12
9
|
import { log } from '@dxos/log';
|
|
13
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
14
11
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
@@ -38,27 +35,8 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
38
35
|
const contextProvider = useContextProvider(space);
|
|
39
36
|
const processor = useChatProcessor({ chat, space, settings, part, associatedArtifact });
|
|
40
37
|
const messageQueue = useMessageQueue(chat);
|
|
41
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
42
|
-
// TODO(thure): This will be referentially new on every render, is it causing overreactivity?
|
|
43
38
|
const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
|
|
44
39
|
|
|
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
|
-
|
|
62
40
|
const handleSubmit = useCallback(
|
|
63
41
|
(text: string) => {
|
|
64
42
|
// Don't accept input if still processing.
|
|
@@ -96,11 +74,11 @@ export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
|
96
74
|
processing={processor.streaming.value}
|
|
97
75
|
error={processor.error.value}
|
|
98
76
|
tools={processor.tools}
|
|
99
|
-
contextProvider={contextProvider}
|
|
100
77
|
onSubmit={handleSubmit}
|
|
101
78
|
onCancel={handleCancel}
|
|
102
79
|
onPrompt={handleSubmit}
|
|
103
80
|
onOpenChange={onOpenChange}
|
|
81
|
+
contextProvider={contextProvider}
|
|
104
82
|
{...props}
|
|
105
83
|
/>
|
|
106
84
|
);
|
|
@@ -21,7 +21,7 @@ import { ToolBlock, isToolMessage } from './ToolInvocations';
|
|
|
21
21
|
import { ToolboxContainer } from '../Toolbox';
|
|
22
22
|
|
|
23
23
|
const panelClassNames = 'flex flex-col w-full px-2 bg-groupSurface rounded-md';
|
|
24
|
-
const userClassNames = 'bg-[--user-fill] text-
|
|
24
|
+
const userClassNames = 'bg-[--user-fill] text-inverse';
|
|
25
25
|
|
|
26
26
|
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
27
27
|
return <NativeToggleContainer {...props} classNames={mx(panelClassNames, props.classNames)} />;
|
|
@@ -105,7 +105,7 @@ const components: Record<string, BlockComponent> = {
|
|
|
105
105
|
return (
|
|
106
106
|
<ToggleContainer
|
|
107
107
|
// open={open}
|
|
108
|
-
defaultOpen={
|
|
108
|
+
defaultOpen={block.disposition === 'cot' && 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',
|
|
118
|
+
classNames={['pbe-2', block.disposition === 'cot' && 'text-sm text-subdued']}
|
|
119
119
|
/>
|
|
120
120
|
</ToggleContainer>
|
|
121
121
|
);
|
|
@@ -193,7 +193,4 @@ 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',
|
|
197
196
|
};
|
|
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(),
|
|
47
|
+
SpacePlugin({ observability: false }),
|
|
48
48
|
SettingsPlugin(),
|
|
49
49
|
IntentPlugin(),
|
|
50
50
|
ChessPlugin(),
|
|
@@ -54,11 +54,11 @@ const meta: Meta<typeof Toolbox> = {
|
|
|
54
54
|
capabilities,
|
|
55
55
|
}),
|
|
56
56
|
withTheme,
|
|
57
|
-
withLayout(),
|
|
57
|
+
withLayout({ tooltips: true }),
|
|
58
58
|
],
|
|
59
59
|
parameters: {
|
|
60
|
-
layout: 'centered',
|
|
61
60
|
translations,
|
|
61
|
+
layout: 'centered',
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
|
|
@@ -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';
|
|
9
|
+
import { FunctionType } from '@dxos/functions/types';
|
|
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';
|
|
@@ -93,7 +93,7 @@ export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?
|
|
|
93
93
|
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
94
94
|
|
|
95
95
|
// Registered services.
|
|
96
|
-
const services = useQuery(space, Filter.
|
|
96
|
+
const services = useQuery(space, Filter.schema(ServiceType));
|
|
97
97
|
const [serviceTools, setServiceTools] = useState<{ service: ServiceType; tools: Tool[] }[]>([]);
|
|
98
98
|
useEffect(() => {
|
|
99
99
|
log('creating service tools...', { services: services.length });
|
|
@@ -107,7 +107,7 @@ export const ToolboxContainer = ({ classNames, space }: ThemedClassName<{ space?
|
|
|
107
107
|
}, [services]);
|
|
108
108
|
|
|
109
109
|
// Deployed functions.
|
|
110
|
-
const functions = useQuery(space, Filter.
|
|
110
|
+
const functions = useQuery(space, Filter.schema(FunctionType));
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
113
|
<Toolbox classNames={classNames} artifacts={artifactDefinitions} services={serviceTools} functions={functions} />
|
package/src/components/index.ts
CHANGED