@dxos/plugin-automation 0.7.5-labs.ea4b4c2 → 0.7.5-labs.f400bbc
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-ITYXSN5Z.mjs +132 -0
- package/dist/lib/browser/AutomationPanel-ITYXSN5Z.mjs.map +7 -0
- package/dist/lib/browser/{chunk-R4JH4TLE.mjs → chunk-OFDNNRLE.mjs} +3 -8
- package/dist/lib/browser/chunk-OFDNNRLE.mjs.map +7 -0
- package/dist/lib/browser/chunk-U7QLNY2S.mjs +8 -0
- package/dist/lib/browser/chunk-U7QLNY2S.mjs.map +7 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs +119 -0
- package/dist/lib/browser/chunk-WY2C7JY4.mjs.map +7 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs +56 -0
- package/dist/lib/browser/complementary-panel-4CPOJL4Y.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +21 -377
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs +27 -0
- package/dist/lib/browser/react-surface-SAPMN4PF.mjs.map +7 -0
- package/dist/lib/node/{chunk-QXIHYOMF.cjs → AutomationPanel-X33HHDMQ.cjs} +19 -132
- package/dist/lib/node/AutomationPanel-X33HHDMQ.cjs.map +7 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs +148 -0
- package/dist/lib/node/chunk-7Q5SNGCL.cjs.map +7 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs +40 -0
- package/dist/lib/node/chunk-CB5OB6JH.cjs.map +7 -0
- package/dist/lib/node/{chunk-EQYHOTGG.cjs → chunk-ORMEYEBE.cjs} +6 -12
- package/dist/lib/node/chunk-ORMEYEBE.cjs.map +7 -0
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs +72 -0
- package/dist/lib/node/complementary-panel-ZYJJ42ZU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +36 -378
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-LWDY7SQG.cjs → react-surface-2WRVAPGR.cjs} +9 -34
- package/dist/lib/node/react-surface-2WRVAPGR.cjs.map +7 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs +133 -0
- package/dist/lib/node-esm/AutomationPanel-HY3GB4BT.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EMVA6QUT.mjs → chunk-6MUUH67V.mjs} +3 -8
- package/dist/lib/node-esm/chunk-6MUUH67V.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs +10 -0
- package/dist/lib/node-esm/chunk-R3P2WPBQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs +120 -0
- package/dist/lib/node-esm/chunk-UDD2VA6G.mjs.map +7 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs +57 -0
- package/dist/lib/node-esm/complementary-panel-S42RIIAY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +21 -377
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs +28 -0
- package/dist/lib/node-esm/react-surface-QWLPOYXO.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/{ai-client.d.ts → complementary-panel.d.ts} +2 -3
- package/dist/types/src/capabilities/complementary-panel.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +1 -180
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -2
- 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/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 +1 -12
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +0 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -94
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +23 -73
- package/src/AutomationPlugin.tsx +9 -64
- package/src/capabilities/complementary-panel.ts +56 -0
- package/src/capabilities/index.ts +1 -5
- package/src/capabilities/react-surface.tsx +3 -23
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +56 -49
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
- package/src/components/index.ts +0 -8
- package/src/index.ts +2 -3
- package/src/meta.ts +1 -4
- package/src/testing/index.ts +0 -1
- package/src/testing/test-functions.ts +0 -7
- package/src/translations.ts +1 -29
- package/dist/lib/browser/AutomationPanel-VW2XIUPU.mjs +0 -8
- package/dist/lib/browser/AutomationPanel-VW2XIUPU.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-5TAVTN3T.mjs +0 -12
- package/dist/lib/browser/ChatContainer-5TAVTN3T.mjs.map +0 -7
- package/dist/lib/browser/ai-client-5CNY6JBF.mjs +0 -22
- package/dist/lib/browser/ai-client-5CNY6JBF.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-FZGK55G7.mjs +0 -197
- package/dist/lib/browser/app-graph-builder-FZGK55G7.mjs.map +0 -7
- package/dist/lib/browser/chunk-2H2EUYXL.mjs +0 -15
- package/dist/lib/browser/chunk-2H2EUYXL.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVE33EZL.mjs +0 -1602
- package/dist/lib/browser/chunk-DVE33EZL.mjs.map +0 -7
- package/dist/lib/browser/chunk-MJK7GL5P.mjs +0 -307
- package/dist/lib/browser/chunk-MJK7GL5P.mjs.map +0 -7
- package/dist/lib/browser/chunk-NQFZ6XRX.mjs +0 -243
- package/dist/lib/browser/chunk-NQFZ6XRX.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q4IMHYGH.mjs +0 -150
- package/dist/lib/browser/chunk-Q4IMHYGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-R4JH4TLE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BWAXKT27.mjs +0 -29
- package/dist/lib/browser/intent-resolver-BWAXKT27.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ILBDBZCN.mjs +0 -58
- package/dist/lib/browser/react-surface-ILBDBZCN.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -24
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-G6EDDYWW.cjs +0 -26
- package/dist/lib/node/AutomationPanel-G6EDDYWW.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-EN24W3K4.cjs +0 -33
- package/dist/lib/node/ChatContainer-EN24W3K4.cjs.map +0 -7
- package/dist/lib/node/ai-client-FKLPDELV.cjs +0 -38
- package/dist/lib/node/ai-client-FKLPDELV.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-T76NYV42.cjs +0 -212
- package/dist/lib/node/app-graph-builder-T76NYV42.cjs.map +0 -7
- package/dist/lib/node/chunk-CJGJXNY3.cjs +0 -1586
- package/dist/lib/node/chunk-CJGJXNY3.cjs.map +0 -7
- package/dist/lib/node/chunk-EQYHOTGG.cjs.map +0 -7
- package/dist/lib/node/chunk-GB7245FH.cjs +0 -173
- package/dist/lib/node/chunk-GB7245FH.cjs.map +0 -7
- package/dist/lib/node/chunk-HMBKP6VG.cjs +0 -324
- package/dist/lib/node/chunk-HMBKP6VG.cjs.map +0 -7
- package/dist/lib/node/chunk-QXIHYOMF.cjs.map +0 -7
- package/dist/lib/node/chunk-U5Z7LFWB.cjs +0 -34
- package/dist/lib/node/chunk-U5Z7LFWB.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-C6OKFVEW.cjs +0 -44
- package/dist/lib/node/intent-resolver-C6OKFVEW.cjs.map +0 -7
- package/dist/lib/node/react-surface-LWDY7SQG.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -46
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs +0 -9
- package/dist/lib/node-esm/AutomationPanel-V3IWQAMO.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-CNTY3C2D.mjs +0 -13
- package/dist/lib/node-esm/ChatContainer-CNTY3C2D.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs +0 -23
- package/dist/lib/node-esm/ai-client-XGNA6SJ5.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-IJQEN7WT.mjs +0 -198
- package/dist/lib/node-esm/app-graph-builder-IJQEN7WT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6HLBYDUI.mjs +0 -244
- package/dist/lib/node-esm/chunk-6HLBYDUI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DNCXRGAF.mjs +0 -151
- package/dist/lib/node-esm/chunk-DNCXRGAF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EMVA6QUT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IJRTDSKN.mjs +0 -16
- package/dist/lib/node-esm/chunk-IJRTDSKN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QP47VJT6.mjs +0 -1603
- package/dist/lib/node-esm/chunk-QP47VJT6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZLIAMW45.mjs +0 -308
- package/dist/lib/node-esm/chunk-ZLIAMW45.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs +0 -30
- package/dist/lib/node-esm/intent-resolver-DCP4ZDBA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SBDXFVIN.mjs +0 -59
- package/dist/lib/node-esm/react-surface-SBDXFVIN.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -25
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/artifacts.stories.d.ts +0 -16
- package/dist/types/src/artifacts.stories.d.ts.map +0 -1
- package/dist/types/src/capabilities/ai-client.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts +0 -3
- package/dist/types/src/components/AmbientChatDialog/AmbientChatDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientChatDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientChatDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.d.ts +0 -11
- package/dist/types/src/components/Box/StatusLine.d.ts.map +0 -1
- package/dist/types/src/components/Box/StatusLine.stories.d.ts +0 -9
- package/dist/types/src/components/Box/StatusLine.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.d.ts +0 -15
- package/dist/types/src/components/Box/Tabbed.d.ts.map +0 -1
- package/dist/types/src/components/Box/Tabbed.stories.d.ts +0 -8
- package/dist/types/src/components/Box/Tabbed.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.d.ts +0 -13
- package/dist/types/src/components/Box/ToggleContainer.d.ts.map +0 -1
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts +0 -9
- package/dist/types/src/components/Box/ToggleContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Box/index.d.ts +0 -4
- package/dist/types/src/components/Box/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -7
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/index.d.ts +0 -4
- package/dist/types/src/components/ChatContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts +0 -14
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts +0 -8
- package/dist/types/src/components/MarkdownViewer/MarkdownViewer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownViewer/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownViewer/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -7
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -8
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -2
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts +0 -20
- package/dist/types/src/components/Prompt/prompt-autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -10
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts +0 -6
- package/dist/types/src/components/PromptEditor/PromptEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/index.d.ts +0 -2
- package/dist/types/src/components/PromptEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts +0 -4
- package/dist/types/src/components/PromptEditor/prompt-extension.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/types.d.ts +0 -18
- package/dist/types/src/components/PromptEditor/types.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +0 -6
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +0 -8
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +0 -1
- package/dist/types/src/components/ServiceRegistry/index.d.ts +0 -2
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.stories.d.ts +0 -11
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -12
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -2
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/hooks/email.d.ts +0 -4
- package/dist/types/src/hooks/email.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -6
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/invocation-handler.d.ts +0 -5
- package/dist/types/src/hooks/invocation-handler.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.d.ts +0 -70
- package/dist/types/src/hooks/processor.d.ts.map +0 -1
- package/dist/types/src/hooks/processor.test.d.ts +0 -2
- package/dist/types/src/hooks/processor.test.d.ts.map +0 -1
- package/dist/types/src/hooks/useChatProcessor.d.ts +0 -7
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +0 -1
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts +0 -3
- package/dist/types/src/hooks/useLocalTriggerManager.d.ts.map +0 -1
- package/dist/types/src/hooks/useMessageQueue.d.ts +0 -41
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +0 -1
- package/dist/types/src/hooks/useServices.d.ts +0 -7
- package/dist/types/src/hooks/useServices.d.ts.map +0 -1
- package/dist/types/src/presets.d.ts +0 -9
- package/dist/types/src/presets.d.ts.map +0 -1
- package/dist/types/src/testing/test-services.d.ts +0 -5
- package/dist/types/src/testing/test-services.d.ts.map +0 -1
- package/dist/types/src/tools/function.d.ts +0 -5
- package/dist/types/src/tools/function.d.ts.map +0 -1
- package/dist/types/src/tools/index.d.ts +0 -3
- package/dist/types/src/tools/index.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.d.ts +0 -10
- package/dist/types/src/tools/openapi.d.ts.map +0 -1
- package/dist/types/src/tools/openapi.test.d.ts +0 -2
- package/dist/types/src/tools/openapi.test.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -4
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/registry.d.ts +0 -10
- package/dist/types/src/types/registry.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -221
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -18
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/artifacts.stories.tsx +0 -241
- package/src/capabilities/ai-client.ts +0 -19
- package/src/capabilities/app-graph-builder.ts +0 -187
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/components/AmbientChatDialog/AmbientChatDialog.tsx +0 -26
- package/src/components/AmbientChatDialog/index.ts +0 -5
- package/src/components/Box/StatusLine.stories.tsx +0 -52
- package/src/components/Box/StatusLine.tsx +0 -76
- package/src/components/Box/Tabbed.stories.tsx +0 -51
- package/src/components/Box/Tabbed.tsx +0 -89
- package/src/components/Box/ToggleContainer.stories.tsx +0 -110
- package/src/components/Box/ToggleContainer.tsx +0 -108
- package/src/components/Box/index.ts +0 -7
- package/src/components/ChatContainer/ChatContainer.tsx +0 -52
- package/src/components/ChatContainer/index.ts +0 -8
- package/src/components/MarkdownViewer/MarkdownViewer.stories.tsx +0 -56
- package/src/components/MarkdownViewer/MarkdownViewer.tsx +0 -79
- package/src/components/MarkdownViewer/index.ts +0 -5
- package/src/components/Prompt/Prompt.stories.tsx +0 -50
- package/src/components/Prompt/Prompt.tsx +0 -36
- package/src/components/Prompt/index.ts +0 -5
- package/src/components/Prompt/prompt-autocomplete.ts +0 -200
- package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
- package/src/components/PromptEditor/PromptEditor.tsx +0 -222
- package/src/components/PromptEditor/index.ts +0 -5
- package/src/components/PromptEditor/prompt-extension.ts +0 -43
- package/src/components/PromptEditor/types.tsx +0 -28
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +0 -49
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +0 -75
- package/src/components/ServiceRegistry/index.ts +0 -5
- package/src/components/Thread/Thread.stories.tsx +0 -197
- package/src/components/Thread/Thread.tsx +0 -156
- package/src/components/Thread/ThreadMessage.tsx +0 -225
- package/src/components/Thread/index.ts +0 -5
- package/src/hooks/email.ts +0 -49
- package/src/hooks/index.ts +0 -10
- package/src/hooks/invocation-handler.ts +0 -109
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -210
- package/src/hooks/useChatProcessor.tsx +0 -86
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- package/src/hooks/useMessageQueue.ts +0 -23
- package/src/hooks/useServices.ts +0 -28
- package/src/presets.ts +0 -248
- package/src/testing/test-services.ts +0 -131
- package/src/tools/function.ts +0 -47
- package/src/tools/index.ts +0 -6
- package/src/tools/openapi.test.ts +0 -227
- package/src/tools/openapi.ts +0 -331
- package/src/types/index.ts +0 -7
- package/src/types/registry.ts +0 -26
- package/src/types/schema.ts +0 -132
- package/src/types/types.ts +0 -21
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type JSX, type PropsWithChildren, useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Icon, useControlledState, 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
|
-
open?: boolean;
|
|
15
|
-
duration?: number;
|
|
16
|
-
/** Should shrink the width when closed. */
|
|
17
|
-
shrinkX?: boolean;
|
|
18
|
-
onChangeOpen?: (open: boolean) => void;
|
|
19
|
-
}>
|
|
20
|
-
>;
|
|
21
|
-
|
|
22
|
-
export const ToggleContainer = ({
|
|
23
|
-
classNames,
|
|
24
|
-
title,
|
|
25
|
-
icon,
|
|
26
|
-
open: _open,
|
|
27
|
-
duration = 400,
|
|
28
|
-
shrinkX = false,
|
|
29
|
-
children,
|
|
30
|
-
onChangeOpen,
|
|
31
|
-
}: ToggleContainerProps) => {
|
|
32
|
-
const [open, setOpen] = useControlledState(_open);
|
|
33
|
-
const [expandX, setExpandX] = useState(shrinkX ? open : true);
|
|
34
|
-
const [expandY, setExpandY] = useState(open);
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
let t: NodeJS.Timeout;
|
|
38
|
-
if (open) {
|
|
39
|
-
if (shrinkX) {
|
|
40
|
-
setExpandX(true);
|
|
41
|
-
}
|
|
42
|
-
t = setTimeout(
|
|
43
|
-
() => {
|
|
44
|
-
setExpandY(true);
|
|
45
|
-
},
|
|
46
|
-
shrinkX ? duration : 0,
|
|
47
|
-
);
|
|
48
|
-
} else {
|
|
49
|
-
setExpandY(false);
|
|
50
|
-
if (shrinkX) {
|
|
51
|
-
t = setTimeout(() => {
|
|
52
|
-
setExpandX(false);
|
|
53
|
-
}, duration);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return () => clearTimeout(t);
|
|
58
|
-
}, [open]);
|
|
59
|
-
|
|
60
|
-
const handleToggle = () => {
|
|
61
|
-
if (onChangeOpen) {
|
|
62
|
-
onChangeOpen(!open);
|
|
63
|
-
} else {
|
|
64
|
-
setOpen((open) => !open);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className={mx('overflow-hidden', classNames)}>
|
|
70
|
-
{title && (
|
|
71
|
-
<div
|
|
72
|
-
className='flex gap-1 py-1 items-center text-sm text-subdued cursor-pointer select-none'
|
|
73
|
-
onClick={handleToggle}
|
|
74
|
-
>
|
|
75
|
-
<div className='flex w-[24px] h-[24px] items-center justify-center'>
|
|
76
|
-
<Icon
|
|
77
|
-
size={4}
|
|
78
|
-
icon={'ph--caret-right--regular'}
|
|
79
|
-
style={{ transitionDuration: `${shrinkX ? duration * 2 : duration}ms` }}
|
|
80
|
-
classNames={['transition transition-transform ease-in-out', open ? 'rotate-90' : 'transform-none']}
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
<div className='flex-1 pis-1 pie-1 truncate'>{title}</div>
|
|
84
|
-
{icon}
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
|
-
<div
|
|
88
|
-
style={{ transitionDuration: `${duration}ms` }}
|
|
89
|
-
className={mx(
|
|
90
|
-
'grid transition-[grid-template-columns] ease-in-out',
|
|
91
|
-
expandX ? 'grid-cols-[1fr]' : 'grid-cols-[0fr]',
|
|
92
|
-
)}
|
|
93
|
-
>
|
|
94
|
-
<div className='overflow-hidden'>
|
|
95
|
-
<div
|
|
96
|
-
style={{ transitionDuration: `${duration}ms` }}
|
|
97
|
-
className={mx(
|
|
98
|
-
'grid transition-[grid-template-rows] ease-in-out',
|
|
99
|
-
expandY ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]',
|
|
100
|
-
)}
|
|
101
|
-
>
|
|
102
|
-
<div className={mx('flex overflow-hidden transition-opacity')}>{children}</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
|
-
|
|
10
|
-
import { useChatProcessor, useMessageQueue } from '../../hooks';
|
|
11
|
-
import { type AIChatType } from '../../types';
|
|
12
|
-
import { Thread } from '../Thread';
|
|
13
|
-
|
|
14
|
-
export const ChatContainer = ({ chat, role }: { chat: AIChatType; role: string }) => {
|
|
15
|
-
const processor = useChatProcessor(chat);
|
|
16
|
-
const messageQueue = useMessageQueue(chat);
|
|
17
|
-
const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
|
|
18
|
-
|
|
19
|
-
const handleSubmit = useCallback(
|
|
20
|
-
async (text: string) => {
|
|
21
|
-
if (processor.streaming.value) {
|
|
22
|
-
await processor.cancel();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
invariant(messageQueue);
|
|
26
|
-
await processor.request(text, {
|
|
27
|
-
history: messageQueue.items,
|
|
28
|
-
onComplete: (messages) => messageQueue.append(messages),
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
[processor, messageQueue],
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const handleStop = useCallback(() => {
|
|
35
|
-
if (processor.streaming.value) {
|
|
36
|
-
void processor.cancel();
|
|
37
|
-
}
|
|
38
|
-
}, [processor]);
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<StackItem.Content toolbar={false} role={role}>
|
|
42
|
-
<Thread
|
|
43
|
-
messages={messages}
|
|
44
|
-
streaming={processor.streaming.value}
|
|
45
|
-
collapse={true}
|
|
46
|
-
onSubmit={handleSubmit}
|
|
47
|
-
onSuggest={handleSubmit}
|
|
48
|
-
onStop={handleStop}
|
|
49
|
-
/>
|
|
50
|
-
</StackItem.Content>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
11
|
-
|
|
12
|
-
import { MarkdownViewer } from './MarkdownViewer';
|
|
13
|
-
|
|
14
|
-
faker.seed(0);
|
|
15
|
-
|
|
16
|
-
const meta: Meta<typeof MarkdownViewer> = {
|
|
17
|
-
title: 'plugins/plugin-automation/MarkdownViewer',
|
|
18
|
-
component: MarkdownViewer,
|
|
19
|
-
decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof MarkdownViewer>;
|
|
25
|
-
|
|
26
|
-
const content = `
|
|
27
|
-
# Hello, world!
|
|
28
|
-
|
|
29
|
-
${faker.lorem.paragraphs(1)}
|
|
30
|
-
|
|
31
|
-
Here's a JSON block:
|
|
32
|
-
|
|
33
|
-
~~~json
|
|
34
|
-
{
|
|
35
|
-
"hello": "world"
|
|
36
|
-
}
|
|
37
|
-
~~~
|
|
38
|
-
|
|
39
|
-
And some code:
|
|
40
|
-
|
|
41
|
-
~~~ts
|
|
42
|
-
const App = () => {
|
|
43
|
-
const title = 'Hello, world!';
|
|
44
|
-
return <div>{title}</div>;
|
|
45
|
-
};
|
|
46
|
-
~~~
|
|
47
|
-
|
|
48
|
-
${faker.lorem.paragraphs(1)}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
export const Default: Story = {
|
|
52
|
-
args: {
|
|
53
|
-
classNames: 'w-[500px] border border-border rounded-md p-4',
|
|
54
|
-
content,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC } from 'react';
|
|
6
|
-
import ReactMarkdown from 'react-markdown';
|
|
7
|
-
|
|
8
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
10
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
11
|
-
import { omit } from '@dxos/util';
|
|
12
|
-
|
|
13
|
-
type MarkdownViewerProps = ThemedClassName<{
|
|
14
|
-
content?: string;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Transform text into react elements.
|
|
19
|
-
*
|
|
20
|
-
* https://github.com/remarkjs/react-markdown
|
|
21
|
-
* markdown -> remark -> [mdast -> remark plugins] -> [hast -> rehype plugins] -> components -> react elements.
|
|
22
|
-
*/
|
|
23
|
-
// TODO(burdon): Styles.
|
|
24
|
-
// TODO(burdon): Factor out (react-ui-syntax-highlighter).
|
|
25
|
-
export const MarkdownViewer: FC<MarkdownViewerProps> = ({ classNames, content = '' }) => {
|
|
26
|
-
return (
|
|
27
|
-
<div className={mx('space-y-2', classNames)}>
|
|
28
|
-
<ReactMarkdown
|
|
29
|
-
components={{
|
|
30
|
-
a: ({ node, children, href, ...props }) => (
|
|
31
|
-
<a
|
|
32
|
-
href={href}
|
|
33
|
-
className='text-primary-500 hover:text-primary-500'
|
|
34
|
-
target='_blank'
|
|
35
|
-
rel='noopener noreferrer'
|
|
36
|
-
{...props}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</a>
|
|
40
|
-
),
|
|
41
|
-
ol: ({ node, children, ...props }) => (
|
|
42
|
-
<ol className='leading-tight list-decimal pl-6' {...omit(props, ['ordered'])}>
|
|
43
|
-
{children}
|
|
44
|
-
</ol>
|
|
45
|
-
),
|
|
46
|
-
ul: ({ node, children, ...props }) => (
|
|
47
|
-
<ul className='leading-tight list-disc pl-6' {...omit(props, ['ordered'])}>
|
|
48
|
-
{children}
|
|
49
|
-
</ul>
|
|
50
|
-
),
|
|
51
|
-
li: ({ node, children, ...props }) => (
|
|
52
|
-
<li className='' {...omit(props, ['ordered'])}>
|
|
53
|
-
{children}
|
|
54
|
-
</li>
|
|
55
|
-
),
|
|
56
|
-
blockquote: ({ node, children, ...props }) => (
|
|
57
|
-
<blockquote className='border-l-4 border-primary-500 pl-4 my-4 text-primary-500' {...props}>
|
|
58
|
-
{children}
|
|
59
|
-
</blockquote>
|
|
60
|
-
),
|
|
61
|
-
code: ({ children, className }) => {
|
|
62
|
-
const [_, language] = /language-(\w+)/.exec(className || '') || [];
|
|
63
|
-
return (
|
|
64
|
-
<SyntaxHighlighter PreTag='div' language={language} className='p-0'>
|
|
65
|
-
{children}
|
|
66
|
-
</SyntaxHighlighter>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{content}
|
|
72
|
-
</ReactMarkdown>
|
|
73
|
-
</div>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// const Cursor = () => {
|
|
78
|
-
// return <span className='animate-[pulse_1s_steps(1)_infinite] text-primary-500'>▊</span>;
|
|
79
|
-
// };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
10
|
-
|
|
11
|
-
import { Prompt } from './Prompt';
|
|
12
|
-
|
|
13
|
-
const meta: Meta<typeof Prompt> = {
|
|
14
|
-
title: 'plugins/plugin-automation/Prompt',
|
|
15
|
-
component: Prompt,
|
|
16
|
-
decorators: [withTheme],
|
|
17
|
-
parameters: {
|
|
18
|
-
layout: 'centered',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof Prompt>;
|
|
25
|
-
|
|
26
|
-
export const Default: Story = {
|
|
27
|
-
args: {
|
|
28
|
-
classNames: 'w-96 p-4 rounded outline outline-gray-200',
|
|
29
|
-
autoFocus: true,
|
|
30
|
-
onEnter: (text) => {
|
|
31
|
-
console.log('onEnter', text);
|
|
32
|
-
},
|
|
33
|
-
onSuggest: (text) => {
|
|
34
|
-
const trimmed = text.trim().toLowerCase();
|
|
35
|
-
if (trimmed.length < 2) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const suggestions = [
|
|
40
|
-
'Create a CRM',
|
|
41
|
-
'Create a new project',
|
|
42
|
-
'Find flights to Tokyo',
|
|
43
|
-
"Let's play chess",
|
|
44
|
-
'Show me Paris on a map',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
return suggestions.filter((s) => s.toLowerCase().startsWith(text));
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
9
|
-
createBasicExtensions,
|
|
10
|
-
createThemeExtensions,
|
|
11
|
-
useTextEditor,
|
|
12
|
-
type UseTextEditorProps,
|
|
13
|
-
} from '@dxos/react-ui-editor';
|
|
14
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
15
|
-
|
|
16
|
-
import { createAutocompleteExtension, type AutocompleteOptions } from './prompt-autocomplete';
|
|
17
|
-
|
|
18
|
-
export type PromptProps = ThemedClassName<AutocompleteOptions & Pick<UseTextEditorProps, 'autoFocus'>>;
|
|
19
|
-
|
|
20
|
-
export const Prompt = ({ classNames, autoFocus, onEnter, onSuggest }: PromptProps) => {
|
|
21
|
-
const { themeMode } = useThemeContext();
|
|
22
|
-
const { parentRef } = useTextEditor({
|
|
23
|
-
autoFocus,
|
|
24
|
-
extensions: [
|
|
25
|
-
createBasicExtensions({
|
|
26
|
-
bracketMatching: false,
|
|
27
|
-
lineWrapping: false,
|
|
28
|
-
placeholder: 'Ask a question...',
|
|
29
|
-
}),
|
|
30
|
-
createThemeExtensions({ themeMode }),
|
|
31
|
-
createAutocompleteExtension({ onEnter, onSuggest }),
|
|
32
|
-
],
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return <div ref={parentRef} className={mx(classNames)} />;
|
|
36
|
-
};
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Prec, type Extension } from '@codemirror/state';
|
|
6
|
-
import {
|
|
7
|
-
EditorView,
|
|
8
|
-
Decoration,
|
|
9
|
-
ViewPlugin,
|
|
10
|
-
keymap,
|
|
11
|
-
type DecorationSet,
|
|
12
|
-
type ViewUpdate,
|
|
13
|
-
WidgetType,
|
|
14
|
-
} from '@codemirror/view';
|
|
15
|
-
|
|
16
|
-
export type AutocompleteOptions = {
|
|
17
|
-
/**
|
|
18
|
-
* Callback triggered when Enter is pressed.
|
|
19
|
-
* @param text The current text in the editor
|
|
20
|
-
*/
|
|
21
|
-
onEnter?: (text: string) => void;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Function that returns a list of suggestions based on the current text.
|
|
25
|
-
* @param text The current text before the cursor
|
|
26
|
-
* @returns Array of suggestion strings
|
|
27
|
-
*/
|
|
28
|
-
onSuggest: (text: string) => string[];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
class InlineSuggestionWidget extends WidgetType {
|
|
32
|
-
constructor(private suffix: string) {
|
|
33
|
-
super();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
override toDOM() {
|
|
37
|
-
const span = document.createElement('span');
|
|
38
|
-
span.textContent = this.suffix;
|
|
39
|
-
span.className = 'cm-inline-suggestion';
|
|
40
|
-
return span;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override eq(other: InlineSuggestionWidget) {
|
|
44
|
-
return other.suffix === this.suffix;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Creates an autocomplete extension that shows inline suggestions.
|
|
50
|
-
* Pressing Tab will complete the suggestion.
|
|
51
|
-
*/
|
|
52
|
-
export const createAutocompleteExtension = ({ onEnter, onSuggest }: AutocompleteOptions): Extension => {
|
|
53
|
-
const suggestionPlugin = ViewPlugin.fromClass(
|
|
54
|
-
class {
|
|
55
|
-
_decorations: DecorationSet;
|
|
56
|
-
_currentSuggestion: string | null = null;
|
|
57
|
-
|
|
58
|
-
constructor(view: EditorView) {
|
|
59
|
-
this._decorations = this.computeDecorations(view);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
update(update: ViewUpdate) {
|
|
63
|
-
if (update.docChanged || update.selectionSet) {
|
|
64
|
-
this._decorations = this.computeDecorations(update.view);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
private computeDecorations(view: EditorView): DecorationSet {
|
|
69
|
-
const text = view.state.doc.toString();
|
|
70
|
-
const suggestions = onSuggest(text);
|
|
71
|
-
if (!suggestions.length) {
|
|
72
|
-
this._currentSuggestion = null;
|
|
73
|
-
return Decoration.none;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Get the first suggestion.
|
|
77
|
-
this._currentSuggestion = suggestions[0];
|
|
78
|
-
const suffix = this._currentSuggestion.slice(text.length);
|
|
79
|
-
if (!suffix) {
|
|
80
|
-
return Decoration.none;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Always show ghost text at the end of the document.
|
|
84
|
-
return Decoration.set([
|
|
85
|
-
Decoration.widget({
|
|
86
|
-
widget: new InlineSuggestionWidget(suffix),
|
|
87
|
-
side: 1,
|
|
88
|
-
}).range(view.state.doc.length),
|
|
89
|
-
]);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
completeSuggestion(view: EditorView): boolean {
|
|
93
|
-
if (!this._currentSuggestion) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const text = view.state.doc.toString();
|
|
98
|
-
const suffix = this._currentSuggestion.slice(text.length);
|
|
99
|
-
if (!suffix) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
view.dispatch({
|
|
104
|
-
changes: {
|
|
105
|
-
from: view.state.doc.length,
|
|
106
|
-
insert: suffix,
|
|
107
|
-
},
|
|
108
|
-
selection: {
|
|
109
|
-
anchor: view.state.doc.length + suffix.length,
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
decorations: (v) => v._decorations,
|
|
118
|
-
},
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
return [
|
|
122
|
-
suggestionPlugin,
|
|
123
|
-
EditorView.theme({
|
|
124
|
-
'.cm-inline-suggestion': {
|
|
125
|
-
opacity: 0.4,
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
128
|
-
|
|
129
|
-
// Accept the current suggestion.
|
|
130
|
-
Prec.highest(
|
|
131
|
-
keymap.of([
|
|
132
|
-
{
|
|
133
|
-
key: 'Tab',
|
|
134
|
-
run: (view) => {
|
|
135
|
-
const plugin = view.plugin(suggestionPlugin);
|
|
136
|
-
return plugin?.completeSuggestion(view) ?? false;
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
key: 'ArrowRight',
|
|
141
|
-
run: (view) => {
|
|
142
|
-
// Only complete if cursor is at the end
|
|
143
|
-
if (view.state.selection.main.head !== view.state.doc.length) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const plugin = view.plugin(suggestionPlugin);
|
|
148
|
-
return plugin?.completeSuggestion(view) ?? false;
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
key: 'Enter',
|
|
153
|
-
preventDefault: true,
|
|
154
|
-
run: (view) => {
|
|
155
|
-
const text = view.state.doc.toString();
|
|
156
|
-
if (onEnter) {
|
|
157
|
-
onEnter(text);
|
|
158
|
-
// Clear the document after calling onEnter
|
|
159
|
-
view.dispatch({
|
|
160
|
-
changes: {
|
|
161
|
-
from: 0,
|
|
162
|
-
to: view.state.doc.length,
|
|
163
|
-
insert: '',
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
return false;
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
key: 'Shift-Enter',
|
|
173
|
-
run: (view) => {
|
|
174
|
-
view.dispatch({
|
|
175
|
-
changes: {
|
|
176
|
-
from: view.state.selection.main.head,
|
|
177
|
-
insert: '\n',
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
return true;
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
key: 'Escape',
|
|
185
|
-
run: (view) => {
|
|
186
|
-
// Clear the entire document.
|
|
187
|
-
view.dispatch({
|
|
188
|
-
changes: {
|
|
189
|
-
from: 0,
|
|
190
|
-
to: view.state.doc.length,
|
|
191
|
-
insert: '',
|
|
192
|
-
},
|
|
193
|
-
});
|
|
194
|
-
return true;
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
]),
|
|
198
|
-
),
|
|
199
|
-
];
|
|
200
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
8
|
-
import React, { useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { create, makeRef } from '@dxos/live-object';
|
|
11
|
-
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
14
|
-
|
|
15
|
-
import { PromptEditor } from './PromptEditor';
|
|
16
|
-
import translations from '../../translations';
|
|
17
|
-
import { ChainPromptType, ChainType } from '../../types';
|
|
18
|
-
|
|
19
|
-
const template = [
|
|
20
|
-
'# Comment',
|
|
21
|
-
'',
|
|
22
|
-
'You are a machine that is an expert chess player.',
|
|
23
|
-
'The move history of the current game is: {history}',
|
|
24
|
-
'If asked to suggest a move explain why it is a good move.',
|
|
25
|
-
'',
|
|
26
|
-
'---',
|
|
27
|
-
'',
|
|
28
|
-
'{input}',
|
|
29
|
-
].join('\n');
|
|
30
|
-
|
|
31
|
-
const Render = () => {
|
|
32
|
-
const client = useClient();
|
|
33
|
-
const [chain] = useState(() => {
|
|
34
|
-
const space = client.spaces.default;
|
|
35
|
-
return space.db.add(
|
|
36
|
-
create(ChainType, {
|
|
37
|
-
prompts: [makeRef(create(ChainPromptType, { command: 'test', template, inputs: [] }))],
|
|
38
|
-
}),
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div role='none' className='flex w-[350px] border border-separator overflow-hidden'>
|
|
44
|
-
<PromptEditor prompt={chain.prompts![0]!.target!} />
|
|
45
|
-
</div>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const Default = {};
|
|
50
|
-
|
|
51
|
-
const meta: Meta = {
|
|
52
|
-
title: 'plugins/plugin-automation/PromptEditor',
|
|
53
|
-
render: Render,
|
|
54
|
-
decorators: [
|
|
55
|
-
withClientProvider({ createIdentity: true, createSpace: true, types: [ChainType, ChainPromptType] }),
|
|
56
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
57
|
-
withTheme,
|
|
58
|
-
],
|
|
59
|
-
parameters: {
|
|
60
|
-
translations,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default meta;
|