@dxos/plugin-automation 0.7.4 → 0.7.5-labs.071a3e2
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/AutomationPanel-YPD3AGQN.mjs +8 -0
- package/dist/lib/browser/ChatContainer-ODZECATM.mjs +12 -0
- package/dist/lib/browser/ai-client-UJLNYP7B.mjs +22 -0
- package/dist/lib/browser/ai-client-UJLNYP7B.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-3H5TCRG4.mjs +162 -0
- package/dist/lib/browser/app-graph-builder-3H5TCRG4.mjs.map +7 -0
- package/dist/lib/browser/chunk-43WRHV2L.mjs +150 -0
- package/dist/lib/browser/chunk-43WRHV2L.mjs.map +7 -0
- package/dist/lib/browser/chunk-BQHXJZ4K.mjs +15 -0
- package/dist/lib/browser/chunk-BQHXJZ4K.mjs.map +7 -0
- package/dist/lib/browser/chunk-DL7XA62G.mjs +1531 -0
- package/dist/lib/browser/chunk-DL7XA62G.mjs.map +7 -0
- package/dist/lib/browser/{chunk-X5KMOH3I.mjs → chunk-DQ7ZSYJJ.mjs} +4 -4
- package/dist/lib/browser/chunk-DQ7ZSYJJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-PQGFC2ZO.mjs +284 -0
- package/dist/lib/browser/chunk-PQGFC2ZO.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z54KIF6H.mjs +242 -0
- package/dist/lib/browser/chunk-Z54KIF6H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +152 -252
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-5YVZJFS3.mjs +29 -0
- package/dist/lib/browser/intent-resolver-5YVZJFS3.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-WRHRCEV5.mjs +50 -0
- package/dist/lib/browser/react-surface-WRHRCEV5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +12 -3
- package/dist/lib/node/{meta.cjs → AutomationPanel-CO26O75P.cjs} +7 -11
- package/dist/lib/node/AutomationPanel-CO26O75P.cjs.map +7 -0
- package/dist/lib/node/ChatContainer-5URBEXQD.cjs +33 -0
- package/dist/lib/node/ChatContainer-5URBEXQD.cjs.map +7 -0
- package/dist/lib/node/ai-client-AOB6TLNW.cjs +38 -0
- package/dist/lib/node/ai-client-AOB6TLNW.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-CDEQJEHY.cjs +178 -0
- package/dist/lib/node/app-graph-builder-CDEQJEHY.cjs.map +7 -0
- package/dist/lib/node/chunk-AWZVJZ2I.cjs +34 -0
- package/dist/lib/node/chunk-AWZVJZ2I.cjs.map +7 -0
- package/dist/lib/node/chunk-D2QQXWOY.cjs +302 -0
- package/dist/lib/node/chunk-D2QQXWOY.cjs.map +7 -0
- package/dist/lib/node/chunk-H3RSMGJG.cjs +173 -0
- package/dist/lib/node/chunk-H3RSMGJG.cjs.map +7 -0
- package/dist/lib/node/chunk-NH7STAX6.cjs +1515 -0
- package/dist/lib/node/chunk-NH7STAX6.cjs.map +7 -0
- package/dist/lib/node/chunk-OCW5GAVZ.cjs +266 -0
- package/dist/lib/node/chunk-OCW5GAVZ.cjs.map +7 -0
- package/dist/lib/node/{chunk-DTJ7XVO2.cjs → chunk-TQEDPRY5.cjs} +8 -8
- package/dist/lib/node/chunk-TQEDPRY5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +169 -282
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-MJFZT5IU.cjs +44 -0
- package/dist/lib/node/intent-resolver-MJFZT5IU.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-HDAVE6NU.cjs +70 -0
- package/dist/lib/node/react-surface-HDAVE6NU.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +16 -7
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/AutomationPanel-VQZUKPK2.mjs +9 -0
- package/dist/lib/node-esm/AutomationPanel-VQZUKPK2.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-23QIVDG5.mjs +13 -0
- package/dist/lib/node-esm/ChatContainer-23QIVDG5.mjs.map +7 -0
- package/dist/lib/node-esm/ai-client-RUCCJ7JZ.mjs +23 -0
- package/dist/lib/node-esm/ai-client-RUCCJ7JZ.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-GR3URVNX.mjs +163 -0
- package/dist/lib/node-esm/app-graph-builder-GR3URVNX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7JO77AAS.mjs +151 -0
- package/dist/lib/node-esm/chunk-7JO77AAS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HNOBZHWK.mjs → chunk-JFHI22MF.mjs} +4 -4
- package/dist/lib/node-esm/chunk-JFHI22MF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JJFWFS6P.mjs +1532 -0
- package/dist/lib/node-esm/chunk-JJFWFS6P.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LSSWQIQD.mjs +16 -0
- package/dist/lib/node-esm/chunk-LSSWQIQD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NSVQZ3EH.mjs +243 -0
- package/dist/lib/node-esm/chunk-NSVQZ3EH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VN2AFV25.mjs +285 -0
- package/dist/lib/node-esm/chunk-VN2AFV25.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +152 -252
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-FCKNRTKQ.mjs +30 -0
- package/dist/lib/node-esm/intent-resolver-FCKNRTKQ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-FZ5OFRDE.mjs +51 -0
- package/dist/lib/node-esm/react-surface-FZ5OFRDE.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +12 -3
- package/dist/types/src/AutomationPlugin.d.ts +1 -3
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/artifacts.stories.d.ts +16 -0
- package/dist/types/src/artifacts.stories.d.ts.map +1 -0
- package/dist/types/src/capabilities/ai-client.d.ts +5 -0
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +180 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +182 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +7 -0
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer/index.d.ts +4 -0
- package/dist/types/src/components/ChatContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +14 -0
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +8 -0
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownViewer/index.d.ts +2 -0
- package/dist/types/src/components/MarkdownViewer/index.d.ts.map +1 -0
- 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/Thread/ScrollContainer.d.ts +15 -0
- package/dist/types/src/components/Thread/ScrollContainer.d.ts.map +1 -0
- package/dist/types/src/components/Thread/StatusLine.d.ts +11 -0
- package/dist/types/src/components/Thread/StatusLine.d.ts.map +1 -0
- package/dist/types/src/components/Thread/StatusLine.stories.d.ts +9 -0
- package/dist/types/src/components/Thread/StatusLine.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Tabbed.d.ts +9 -0
- package/dist/types/src/components/Thread/Tabbed.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Tabbed.stories.d.ts +8 -0
- package/dist/types/src/components/Thread/Tabbed.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Thread.d.ts +11 -0
- package/dist/types/src/components/Thread/Thread.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Thread.stories.d.ts +10 -0
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +12 -0
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ToggleContainer.d.ts +13 -0
- package/dist/types/src/components/Thread/ToggleContainer.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts +9 -0
- package/dist/types/src/components/Thread/ToggleContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/index.d.ts +2 -0
- package/dist/types/src/components/Thread/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +12 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/email.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +4 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/invocation-handler.d.ts.map +1 -1
- package/dist/types/src/hooks/processor.d.ts +70 -0
- package/dist/types/src/hooks/processor.d.ts.map +1 -0
- package/dist/types/src/hooks/processor.test.d.ts +2 -0
- package/dist/types/src/hooks/processor.test.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +7 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts +41 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -0
- package/dist/types/src/hooks/useServices.d.ts +7 -0
- package/dist/types/src/hooks/useServices.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +3 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +5 -0
- package/dist/types/src/testing/test-services.d.ts.map +1 -0
- package/dist/types/src/tools/function.d.ts +5 -0
- package/dist/types/src/tools/function.d.ts.map +1 -0
- package/dist/types/src/tools/index.d.ts +3 -0
- package/dist/types/src/tools/index.d.ts.map +1 -0
- package/dist/types/src/tools/openapi.d.ts +10 -0
- package/dist/types/src/tools/openapi.d.ts.map +1 -0
- package/dist/types/src/tools/openapi.test.d.ts +2 -0
- package/dist/types/src/tools/openapi.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +81 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/registry.d.ts +10 -0
- package/dist/types/src/types/registry.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +189 -39
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +16 -5
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -48
- package/src/AutomationPlugin.tsx +77 -194
- package/src/artifacts.stories.tsx +241 -0
- package/src/capabilities/ai-client.ts +19 -0
- package/src/capabilities/app-graph-builder.ts +156 -0
- package/src/capabilities/capabilities.ts +12 -0
- package/src/capabilities/index.ts +12 -0
- package/src/capabilities/intent-resolver.ts +27 -0
- package/src/capabilities/react-surface.tsx +36 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +61 -39
- package/src/components/ChatContainer/ChatContainer.tsx +52 -0
- package/src/components/ChatContainer/index.ts +8 -0
- package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +56 -0
- package/src/components/MarkdownViewer/MarkdownViewer.tsx +79 -0
- package/src/components/MarkdownViewer/index.ts +5 -0
- package/src/components/PromptEditor/PromptEditor.stories.tsx +3 -3
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +49 -0
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +75 -0
- package/src/components/ServiceRegistry/index.ts +5 -0
- package/src/components/Thread/ScrollContainer.tsx +92 -0
- package/src/components/Thread/StatusLine.stories.tsx +52 -0
- package/src/components/Thread/StatusLine.tsx +76 -0
- package/src/components/Thread/Tabbed.stories.tsx +52 -0
- package/src/components/Thread/Tabbed.tsx +72 -0
- package/src/components/Thread/Thread.stories.tsx +190 -0
- package/src/components/Thread/Thread.tsx +156 -0
- package/src/components/Thread/ThreadMessage.tsx +203 -0
- package/src/components/Thread/ToggleContainer.stories.tsx +111 -0
- package/src/components/Thread/ToggleContainer.tsx +103 -0
- package/src/components/Thread/index.ts +5 -0
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
- package/src/components/TriggerEditor/TriggerEditor.tsx +81 -16
- package/src/components/index.ts +9 -1
- package/src/hooks/email.ts +2 -2
- package/src/hooks/index.ts +5 -0
- package/src/hooks/invocation-handler.ts +2 -2
- package/src/hooks/processor.test.ts +15 -0
- package/src/hooks/processor.ts +210 -0
- package/src/hooks/useChatProcessor.tsx +86 -0
- package/src/hooks/useMessageQueue.ts +23 -0
- package/src/hooks/useServices.ts +28 -0
- package/src/index.ts +1 -4
- package/src/meta.ts +3 -2
- package/src/testing/index.ts +2 -1
- package/src/testing/{testing.ts → test-functions.ts} +9 -2
- package/src/testing/test-services.ts +131 -0
- package/src/tools/function.ts +47 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/openapi.test.ts +227 -0
- package/src/tools/openapi.ts +331 -0
- package/src/translations.ts +17 -2
- package/src/types/index.ts +1 -0
- package/src/types/registry.ts +26 -0
- package/src/types/schema.ts +96 -2
- package/src/types/types.ts +15 -21
- package/dist/lib/browser/AssistantPanel-N3QSALKY.mjs +0 -341
- package/dist/lib/browser/AssistantPanel-N3QSALKY.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs +0 -153
- package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs.map +0 -7
- package/dist/lib/browser/chunk-7KB4UMXO.mjs +0 -49
- package/dist/lib/browser/chunk-7KB4UMXO.mjs.map +0 -7
- package/dist/lib/browser/chunk-X5KMOH3I.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/node/AssistantPanel-RIA4TI3B.cjs +0 -361
- package/dist/lib/node/AssistantPanel-RIA4TI3B.cjs.map +0 -7
- package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs +0 -173
- package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs.map +0 -7
- package/dist/lib/node/chunk-CUCUWUAF.cjs +0 -73
- package/dist/lib/node/chunk-CUCUWUAF.cjs.map +0 -7
- package/dist/lib/node/chunk-DTJ7XVO2.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantPanel-72YH43CH.mjs +0 -342
- package/dist/lib/node-esm/AssistantPanel-72YH43CH.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs +0 -154
- package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-23LY7DYS.mjs +0 -51
- package/dist/lib/node-esm/chunk-23LY7DYS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HNOBZHWK.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +0 -8
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +0 -1
- package/dist/types/src/components/AssistantPanel/index.d.ts +0 -3
- package/dist/types/src/components/AssistantPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +0 -6
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +0 -1
- package/dist/types/src/testing/testing.d.ts.map +0 -1
- package/src/components/AssistantPanel/AssistantPanel.tsx +0 -230
- package/src/components/AssistantPanel/index.ts +0 -7
- package/src/components/AssistantPanel/system-instructions.ts +0 -166
- /package/dist/lib/browser/{meta.mjs.map → AutomationPanel-YPD3AGQN.mjs.map} +0 -0
- /package/dist/lib/{node-esm/meta.mjs.map → browser/ChatContainer-ODZECATM.mjs.map} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type KeyboardEventHandler, useCallback, useMemo, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Message } from '@dxos/artifact';
|
|
8
|
+
import { IconButton, Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Spinner } from '@dxos/react-ui-sfx';
|
|
10
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
+
|
|
12
|
+
import { ScrollContainer, type ScrollController } from './ScrollContainer';
|
|
13
|
+
import { ThreadMessage, type ThreadMessageProps } from './ThreadMessage';
|
|
14
|
+
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
15
|
+
|
|
16
|
+
export type ThreadProps = {
|
|
17
|
+
messages?: Message[];
|
|
18
|
+
streaming?: boolean;
|
|
19
|
+
onSubmit?: (message: string) => void;
|
|
20
|
+
onStop?: () => void;
|
|
21
|
+
} & Pick<ThreadMessageProps, 'collapse' | 'debug' | 'onSuggest' | 'onDelete'>;
|
|
22
|
+
|
|
23
|
+
// TODO(burdon): Factor out scroll logic.
|
|
24
|
+
export const Thread = ({
|
|
25
|
+
messages,
|
|
26
|
+
streaming,
|
|
27
|
+
collapse,
|
|
28
|
+
debug,
|
|
29
|
+
onSubmit,
|
|
30
|
+
onStop,
|
|
31
|
+
onSuggest,
|
|
32
|
+
onDelete,
|
|
33
|
+
}: ThreadProps) => {
|
|
34
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
35
|
+
const scroller = useRef<ScrollController>(null);
|
|
36
|
+
|
|
37
|
+
const [text, setText] = useState('');
|
|
38
|
+
const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(
|
|
39
|
+
(ev) => {
|
|
40
|
+
switch (ev.key) {
|
|
41
|
+
case 'Escape': {
|
|
42
|
+
setText('');
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
case 'Enter': {
|
|
47
|
+
const value = text.trim();
|
|
48
|
+
if (value.length > 0) {
|
|
49
|
+
scroller.current?.scrollToBottom();
|
|
50
|
+
onSubmit?.(value);
|
|
51
|
+
setText('');
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[text],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Reduce message blocks into collections of messages that contain related contiguous blocks.
|
|
62
|
+
* For example, collapse all tool request/response pairs into a single message.
|
|
63
|
+
*/
|
|
64
|
+
// TODO(dmaretskyi): This needs to be a separate type: `id` is not a valid ObjectId, this needs to accommodate messageId for deletion.
|
|
65
|
+
const { messages: lines = [] } = useMemo(() => {
|
|
66
|
+
if (!collapse) {
|
|
67
|
+
return { messages: messages ?? [] };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (messages ?? []).reduce<{ messages: Message[]; current?: Message }>(
|
|
71
|
+
({ current, messages }, message) => {
|
|
72
|
+
let i = 0;
|
|
73
|
+
for (const block of message.content) {
|
|
74
|
+
switch (block.type) {
|
|
75
|
+
case 'tool_use':
|
|
76
|
+
case 'tool_result': {
|
|
77
|
+
if (current) {
|
|
78
|
+
current.content.push(block);
|
|
79
|
+
} else {
|
|
80
|
+
current = {
|
|
81
|
+
id: [message.id, i].join('_'),
|
|
82
|
+
role: message.role,
|
|
83
|
+
content: [block],
|
|
84
|
+
};
|
|
85
|
+
messages.push(current);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
case 'text':
|
|
91
|
+
default: {
|
|
92
|
+
current = undefined;
|
|
93
|
+
messages.push({
|
|
94
|
+
id: [message.id, i].join('_'),
|
|
95
|
+
role: message.role,
|
|
96
|
+
content: [block],
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
i++;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return { current, messages };
|
|
106
|
+
},
|
|
107
|
+
{ messages: [] as Message[] },
|
|
108
|
+
);
|
|
109
|
+
}, [messages, collapse]);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className='flex flex-col grow overflow-hidden'>
|
|
113
|
+
<ScrollContainer ref={scroller} classNames='py-2 gap-2 overflow-x-hidden'>
|
|
114
|
+
{lines.map((message) => (
|
|
115
|
+
<ThreadMessage
|
|
116
|
+
key={message.id}
|
|
117
|
+
classNames='px-4'
|
|
118
|
+
message={message}
|
|
119
|
+
collapse={collapse}
|
|
120
|
+
debug={debug}
|
|
121
|
+
onSuggest={onSuggest}
|
|
122
|
+
onDelete={onDelete}
|
|
123
|
+
/>
|
|
124
|
+
))}
|
|
125
|
+
</ScrollContainer>
|
|
126
|
+
|
|
127
|
+
{onSubmit && (
|
|
128
|
+
<div className='flex p-4 gap-3 items-center'>
|
|
129
|
+
<Spinner active={streaming} />
|
|
130
|
+
<Input.Root>
|
|
131
|
+
<Input.TextInput
|
|
132
|
+
autoFocus
|
|
133
|
+
classNames='px-2 baseSurface rounded'
|
|
134
|
+
placeholder={t('chat input placeholder')}
|
|
135
|
+
value={text}
|
|
136
|
+
onChange={(ev) => setText(ev.target.value)}
|
|
137
|
+
onKeyDown={handleKeyDown}
|
|
138
|
+
/>
|
|
139
|
+
</Input.Root>
|
|
140
|
+
{onStop && (
|
|
141
|
+
<IconButton
|
|
142
|
+
disabled={!streaming}
|
|
143
|
+
classNames={mx('!p-1 !opacity-20 transition', streaming && '!opacity-80')}
|
|
144
|
+
variant='ghost'
|
|
145
|
+
size={5}
|
|
146
|
+
onClick={onStop}
|
|
147
|
+
icon='ph--x--regular'
|
|
148
|
+
label={t('chat stop')}
|
|
149
|
+
iconOnly
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type FC } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type MessageContentBlock, type Message } from '@dxos/artifact';
|
|
8
|
+
import { invariant } from '@dxos/invariant';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { Button, ButtonGroup, Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
+
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
13
|
+
import { safeParseJson } from '@dxos/util';
|
|
14
|
+
|
|
15
|
+
import { StatusLine } from './StatusLine';
|
|
16
|
+
import { ToggleContainer } from './ToggleContainer';
|
|
17
|
+
import { MarkdownViewer } from '../MarkdownViewer';
|
|
18
|
+
|
|
19
|
+
export type ThreadMessageProps = ThemedClassName<{
|
|
20
|
+
message: Message;
|
|
21
|
+
collapse?: boolean;
|
|
22
|
+
debug?: boolean;
|
|
23
|
+
onSuggest?: (text: string) => void;
|
|
24
|
+
onDelete?: (id: string) => void;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
export const ThreadMessage: FC<ThreadMessageProps> = ({
|
|
28
|
+
classNames,
|
|
29
|
+
message,
|
|
30
|
+
collapse,
|
|
31
|
+
debug,
|
|
32
|
+
onSuggest,
|
|
33
|
+
onDelete,
|
|
34
|
+
}) => {
|
|
35
|
+
if (typeof message !== 'object') {
|
|
36
|
+
return <div className={mx(classNames)}>{message}</div>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { role, content = [] } = message;
|
|
40
|
+
|
|
41
|
+
// TODO(burdon): Factor out tool blocks.
|
|
42
|
+
const toolBlocks = content.filter((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
43
|
+
if (collapse && toolBlocks.length > 0) {
|
|
44
|
+
let request: (MessageContentBlock & { type: 'tool_use' }) | undefined;
|
|
45
|
+
const json: any[] = [];
|
|
46
|
+
const lines = toolBlocks.map((block) => {
|
|
47
|
+
switch (block.type) {
|
|
48
|
+
case 'tool_use': {
|
|
49
|
+
request = block;
|
|
50
|
+
json.push(block);
|
|
51
|
+
// TODO(burdon): Get plugin name.
|
|
52
|
+
return `Calling ${block.name}...`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
case 'tool_result': {
|
|
56
|
+
if (!request) {
|
|
57
|
+
log.warn('unexpected message', { tool: block });
|
|
58
|
+
return 'Error';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
json.push(block);
|
|
62
|
+
return `Processed ${request.name}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
default: {
|
|
66
|
+
request = undefined;
|
|
67
|
+
return 'Error';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div className={mx('flex', classNames)}>
|
|
74
|
+
<div className='w-full p-1 px-2 overflow-hidden rounded-md bg-baseSurface'>
|
|
75
|
+
<ToggleContainer title={<StatusLine lines={lines} autoAdvance />} toggle>
|
|
76
|
+
<Json data={json} classNames='!p-1 text-xs' />
|
|
77
|
+
</ToggleContainer>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className={mx('flex flex-col shrink-0 gap-2')}>
|
|
85
|
+
{debug && (
|
|
86
|
+
<div className='text-xs text-subdued'>
|
|
87
|
+
{message.id}{' '}
|
|
88
|
+
{onDelete && (
|
|
89
|
+
<span className='cursor-pointer underline' onClick={() => onDelete(message.id)}>
|
|
90
|
+
delete
|
|
91
|
+
</span>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
)}
|
|
95
|
+
{content.map((block, idx) => (
|
|
96
|
+
<div key={idx} className={mx('flex', classNames, block.type === 'text' && role === 'user' && 'justify-end')}>
|
|
97
|
+
<Block role={role} block={block} onSuggest={onSuggest ?? (() => {})} />
|
|
98
|
+
</div>
|
|
99
|
+
))}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const Block = ({
|
|
105
|
+
block,
|
|
106
|
+
role,
|
|
107
|
+
onSuggest,
|
|
108
|
+
}: Pick<Message, 'role'> & { block: MessageContentBlock; onSuggest: (text: string) => void }) => {
|
|
109
|
+
const Component = componentMap[block.type] ?? componentMap.default;
|
|
110
|
+
return (
|
|
111
|
+
<div
|
|
112
|
+
className={mx(
|
|
113
|
+
'p-1 px-2 overflow-hidden rounded-md',
|
|
114
|
+
(block.type !== 'text' || block.disposition) && 'w-full bg-baseSurface',
|
|
115
|
+
block.type === 'text' && role === 'user' && 'bg-primary-200 dark:bg-primary-500',
|
|
116
|
+
)}
|
|
117
|
+
>
|
|
118
|
+
<Component block={block} onSuggest={onSuggest} />
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const titles: Record<string, string> = {
|
|
124
|
+
['cot' as const]: 'Chain of thought',
|
|
125
|
+
['artifact' as const]: 'Artifact',
|
|
126
|
+
['tool_use' as const]: 'Tool request',
|
|
127
|
+
['tool_result' as const]: 'Tool result',
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type BlockComponent = FC<{ block: MessageContentBlock; onSuggest: (text: string) => void }>;
|
|
131
|
+
|
|
132
|
+
const componentMap: Record<string, BlockComponent> = {
|
|
133
|
+
text: ({ block }) => {
|
|
134
|
+
invariant(block.type === 'text');
|
|
135
|
+
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
136
|
+
if (!title) {
|
|
137
|
+
return (
|
|
138
|
+
<MarkdownViewer content={block.text} classNames={[block.disposition === 'cot' && 'text-sm text-subdued']} />
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<ToggleContainer
|
|
144
|
+
title={title}
|
|
145
|
+
icon={
|
|
146
|
+
block.pending ? (
|
|
147
|
+
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
|
|
148
|
+
) : undefined
|
|
149
|
+
}
|
|
150
|
+
defaultOpen={block.disposition === 'cot'}
|
|
151
|
+
toggle
|
|
152
|
+
>
|
|
153
|
+
<MarkdownViewer content={block.text} classNames={[block.disposition === 'cot' && 'text-sm text-subdued']} />
|
|
154
|
+
</ToggleContainer>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
json: ({ block, onSuggest }) => {
|
|
159
|
+
invariant(block.type === 'json');
|
|
160
|
+
|
|
161
|
+
switch (block.disposition) {
|
|
162
|
+
case 'suggest': {
|
|
163
|
+
const { text = '' }: { text: string } = safeParseJson(block.json ?? '{}') ?? ({} as any);
|
|
164
|
+
return <Button onClick={() => onSuggest(text)}>{text}</Button>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
case 'select': {
|
|
168
|
+
const { options = [] }: { options: string[] } = safeParseJson(block.json ?? '{}') ?? ({} as any);
|
|
169
|
+
return (
|
|
170
|
+
<ButtonGroup>
|
|
171
|
+
{options.map((option) => (
|
|
172
|
+
<Button key={option} onClick={() => onSuggest(option)}>
|
|
173
|
+
{option}
|
|
174
|
+
</Button>
|
|
175
|
+
))}
|
|
176
|
+
</ButtonGroup>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
default: {
|
|
181
|
+
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
182
|
+
return (
|
|
183
|
+
<ToggleContainer title={title ?? 'JSON'} toggle>
|
|
184
|
+
<Json data={safeParseJson(block.json ?? block)} classNames='!p-1 text-xs' />
|
|
185
|
+
</ToggleContainer>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
default: ({ block }) => {
|
|
192
|
+
let title = titles[block.type];
|
|
193
|
+
if (block.type === 'tool_use') {
|
|
194
|
+
title = `Tool [${block.name}]`; // TODO(burdon): Get label from tool.
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<ToggleContainer title={title ?? 'JSON'} toggle>
|
|
199
|
+
<Json data={block} classNames='!p-1 text-xs' />
|
|
200
|
+
</ToggleContainer>
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import { computed, type ReadonlySignal, signal } from '@preact/signals-core';
|
|
8
|
+
import { type StoryObj, type Meta } from '@storybook/react';
|
|
9
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
import { faker } from '@dxos/random';
|
|
12
|
+
import { Icon, Input, Toolbar } from '@dxos/react-ui';
|
|
13
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
14
|
+
import { withLayout, withTheme, withSignals } from '@dxos/storybook-utils';
|
|
15
|
+
|
|
16
|
+
import { ToggleContainer, type ToggleContainerProps } from './ToggleContainer';
|
|
17
|
+
import { MarkdownViewer } from '../MarkdownViewer';
|
|
18
|
+
|
|
19
|
+
class Generator {
|
|
20
|
+
private readonly _current = signal<string>(faker.lorem.sentence(5));
|
|
21
|
+
private readonly _lines = signal<string[]>([]);
|
|
22
|
+
private _running: NodeJS.Timeout | undefined;
|
|
23
|
+
|
|
24
|
+
readonly count = computed(() => this._lines.value.length);
|
|
25
|
+
readonly text: ReadonlySignal<string[]> = computed(() => [...this._lines.value, this._current.value]);
|
|
26
|
+
|
|
27
|
+
start() {
|
|
28
|
+
this.stop();
|
|
29
|
+
this._running = setInterval(() => {
|
|
30
|
+
if (this._current.value.length > 0) {
|
|
31
|
+
this._current.value += ' ';
|
|
32
|
+
}
|
|
33
|
+
this._current.value += faker.lorem.words(Math.ceil(Math.random() * 2));
|
|
34
|
+
if (Math.random() > 0.95) {
|
|
35
|
+
this._lines.value = [...this._lines.value, this._current.value + '.'];
|
|
36
|
+
this._current.value = '';
|
|
37
|
+
}
|
|
38
|
+
}, 100);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
stop() {
|
|
42
|
+
if (this._running) {
|
|
43
|
+
clearInterval(this._running);
|
|
44
|
+
this._running = undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const Render = ({ shrinkX, ...props }: ToggleContainerProps) => {
|
|
50
|
+
const generator = useMemo(() => new Generator(), []);
|
|
51
|
+
const [running, setRunning] = useState(false);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (running) {
|
|
54
|
+
generator.start();
|
|
55
|
+
} else {
|
|
56
|
+
generator.stop();
|
|
57
|
+
}
|
|
58
|
+
}, [running]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className='flex flex-col w-[500px]'>
|
|
62
|
+
<Toolbar.Root classNames='p-4'>
|
|
63
|
+
<Input.Root>
|
|
64
|
+
<Input.Switch checked={running} onCheckedChange={(checked) => setRunning(checked)} />
|
|
65
|
+
</Input.Root>
|
|
66
|
+
<div className='grow' />
|
|
67
|
+
<div>{generator.count.value}</div>
|
|
68
|
+
</Toolbar.Root>
|
|
69
|
+
<div className='flex p-4'>
|
|
70
|
+
<div className={mx('border border-border rounded-md p-2', !shrinkX && 'w-full')}>
|
|
71
|
+
<ToggleContainer
|
|
72
|
+
{...props}
|
|
73
|
+
shrinkX={shrinkX}
|
|
74
|
+
toggle
|
|
75
|
+
icon={
|
|
76
|
+
running ? (
|
|
77
|
+
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
|
|
78
|
+
) : undefined
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
<MarkdownViewer classNames='text-sm' content={generator.text.value.join('\n\n')} />
|
|
82
|
+
</ToggleContainer>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const meta: Meta<typeof ToggleContainer> = {
|
|
90
|
+
title: 'plugins/plugin-automation/ToggleContainer',
|
|
91
|
+
component: ToggleContainer,
|
|
92
|
+
render: Render,
|
|
93
|
+
decorators: [withSignals, withTheme, withLayout({ fullscreen: true, classNames: 'justify-center bg-baseSurface' })],
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default meta;
|
|
97
|
+
|
|
98
|
+
type Story = StoryObj<typeof ToggleContainer>;
|
|
99
|
+
|
|
100
|
+
export const Default: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
title: 'Markdown',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Shrink: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
title: 'Markdown',
|
|
109
|
+
shrinkX: true,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Icon, type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
+
|
|
10
|
+
export type ToggleContainerProps = ThemedClassName<
|
|
11
|
+
PropsWithChildren<{
|
|
12
|
+
title?: string | JSX.Element;
|
|
13
|
+
icon?: JSX.Element;
|
|
14
|
+
toggle?: boolean;
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
duration?: number;
|
|
17
|
+
/** Should shrink the width when closed. */
|
|
18
|
+
shrinkX?: boolean;
|
|
19
|
+
}>
|
|
20
|
+
>;
|
|
21
|
+
|
|
22
|
+
// TODO(burdon): Externalize toggle state.
|
|
23
|
+
export const ToggleContainer = ({
|
|
24
|
+
title,
|
|
25
|
+
icon,
|
|
26
|
+
toggle,
|
|
27
|
+
defaultOpen,
|
|
28
|
+
duration = 400,
|
|
29
|
+
shrinkX = false,
|
|
30
|
+
children,
|
|
31
|
+
classNames,
|
|
32
|
+
}: ToggleContainerProps) => {
|
|
33
|
+
const [expand, setExpand] = useState(defaultOpen || !toggle);
|
|
34
|
+
const [expandX, setExpandX] = useState(shrinkX ? expand : true);
|
|
35
|
+
const [expandY, setExpandY] = useState(expand);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let t: NodeJS.Timeout;
|
|
39
|
+
if (expand) {
|
|
40
|
+
if (shrinkX) {
|
|
41
|
+
setExpandX(true);
|
|
42
|
+
}
|
|
43
|
+
t = setTimeout(
|
|
44
|
+
() => {
|
|
45
|
+
setExpandY(true);
|
|
46
|
+
},
|
|
47
|
+
shrinkX ? duration : 0,
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
setExpandY(false);
|
|
51
|
+
if (shrinkX) {
|
|
52
|
+
t = setTimeout(() => {
|
|
53
|
+
setExpandX(false);
|
|
54
|
+
}, duration);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return () => clearTimeout(t);
|
|
59
|
+
}, [expand]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className={mx('overflow-hidden', classNames)}>
|
|
63
|
+
{title && (
|
|
64
|
+
<div
|
|
65
|
+
className='flex gap-1 py-1 items-center text-sm text-subdued cursor-pointer select-none'
|
|
66
|
+
onClick={toggle ? () => setExpand((open) => !open) : undefined}
|
|
67
|
+
>
|
|
68
|
+
{toggle && (
|
|
69
|
+
<div className='flex w-[24px] h-[24px] items-center justify-center'>
|
|
70
|
+
<Icon
|
|
71
|
+
size={4}
|
|
72
|
+
icon={'ph--caret-right--regular'}
|
|
73
|
+
style={{ transitionDuration: `${shrinkX ? duration * 2 : duration}ms` }}
|
|
74
|
+
classNames={['transition transition-transform ease-in-out', expand ? 'rotate-90' : 'transform-none']}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
<div className='flex-1 pis-1 pie-1 truncate'>{title}</div>
|
|
79
|
+
{icon}
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
<div
|
|
83
|
+
style={{ transitionDuration: `${duration}ms` }}
|
|
84
|
+
className={mx(
|
|
85
|
+
'grid transition-[grid-template-columns] ease-in-out',
|
|
86
|
+
expandX ? 'grid-cols-[1fr]' : 'grid-cols-[0fr]',
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
<div className='overflow-hidden'>
|
|
90
|
+
<div
|
|
91
|
+
style={{ transitionDuration: `${duration}ms` }}
|
|
92
|
+
className={mx(
|
|
93
|
+
'grid transition-[grid-template-rows] ease-in-out',
|
|
94
|
+
expandY ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',
|
|
95
|
+
)}
|
|
96
|
+
>
|
|
97
|
+
<div className={mx('flex overflow-hidden transition-opacity')}>{children}</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
@@ -7,9 +7,8 @@ import '@dxos-theme';
|
|
|
7
7
|
import { type Meta } from '@storybook/react';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { FunctionTrigger, TriggerKind } from '@dxos/functions';
|
|
10
|
+
import { FunctionType, FunctionTrigger, TriggerKind } from '@dxos/functions';
|
|
11
11
|
import { create } from '@dxos/live-object';
|
|
12
|
-
import { FunctionType } from '@dxos/plugin-script/types';
|
|
13
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
14
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
14
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|