@dxos/plugin-automation 0.7.5-staging.b81e783 → 0.8.0
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-HZSTXZWK.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 +18 -395
- 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-V4L7LTWM.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-BAQRBGOJ.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 +33 -396
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-IXKIJFRP.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-IG4GSWZN.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 +18 -395
- 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.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.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 +0 -11
- 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 -112
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +21 -74
- package/src/AutomationPlugin.tsx +7 -76
- 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 -37
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs +0 -8
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-AZPLZJ5H.mjs +0 -12
- package/dist/lib/browser/ChatContainer-AZPLZJ5H.mjs.map +0 -7
- package/dist/lib/browser/ai-client-T2PBJISL.mjs +0 -22
- package/dist/lib/browser/ai-client-T2PBJISL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-F22H4YBQ.mjs +0 -111
- package/dist/lib/browser/app-graph-builder-F22H4YBQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-67KDIIM6.mjs +0 -15
- package/dist/lib/browser/chunk-67KDIIM6.mjs.map +0 -7
- package/dist/lib/browser/chunk-HZSTXZWK.mjs.map +0 -7
- package/dist/lib/browser/chunk-L2YLAKCS.mjs +0 -151
- package/dist/lib/browser/chunk-L2YLAKCS.mjs.map +0 -7
- package/dist/lib/browser/chunk-LJ7F4KDM.mjs +0 -243
- package/dist/lib/browser/chunk-LJ7F4KDM.mjs.map +0 -7
- package/dist/lib/browser/chunk-M4MWUOUC.mjs +0 -382
- package/dist/lib/browser/chunk-M4MWUOUC.mjs.map +0 -7
- package/dist/lib/browser/chunk-U435IUIA.mjs +0 -1775
- package/dist/lib/browser/chunk-U435IUIA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-MONKAKTY.mjs +0 -30
- package/dist/lib/browser/intent-resolver-MONKAKTY.mjs.map +0 -7
- package/dist/lib/browser/react-surface-7QWCWE4K.mjs +0 -58
- package/dist/lib/browser/react-surface-7QWCWE4K.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-6COLKRIB.cjs +0 -26
- package/dist/lib/node/AutomationPanel-6COLKRIB.cjs.map +0 -7
- package/dist/lib/node/ChatContainer-SBEUFMQ3.cjs +0 -33
- package/dist/lib/node/ChatContainer-SBEUFMQ3.cjs.map +0 -7
- package/dist/lib/node/ai-client-L5GUSAER.cjs +0 -38
- package/dist/lib/node/ai-client-L5GUSAER.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-OCSH5R6U.cjs +0 -123
- package/dist/lib/node/app-graph-builder-OCSH5R6U.cjs.map +0 -7
- package/dist/lib/node/chunk-BAQRBGOJ.cjs.map +0 -7
- package/dist/lib/node/chunk-BZFAEBME.cjs +0 -1747
- package/dist/lib/node/chunk-BZFAEBME.cjs.map +0 -7
- package/dist/lib/node/chunk-K3F5JNZ6.cjs +0 -394
- package/dist/lib/node/chunk-K3F5JNZ6.cjs.map +0 -7
- package/dist/lib/node/chunk-NUOYHYAF.cjs +0 -174
- package/dist/lib/node/chunk-NUOYHYAF.cjs.map +0 -7
- package/dist/lib/node/chunk-V4L7LTWM.cjs.map +0 -7
- package/dist/lib/node/chunk-VNBYGJ4K.cjs +0 -34
- package/dist/lib/node/chunk-VNBYGJ4K.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-KQGTYVF2.cjs +0 -45
- package/dist/lib/node/intent-resolver-KQGTYVF2.cjs.map +0 -7
- package/dist/lib/node/react-surface-IXKIJFRP.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-3MPIAO7R.mjs +0 -9
- package/dist/lib/node-esm/AutomationPanel-3MPIAO7R.mjs.map +0 -7
- package/dist/lib/node-esm/ChatContainer-JCDLYMDZ.mjs +0 -13
- package/dist/lib/node-esm/ChatContainer-JCDLYMDZ.mjs.map +0 -7
- package/dist/lib/node-esm/ai-client-45LZLW7V.mjs +0 -23
- package/dist/lib/node-esm/ai-client-45LZLW7V.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-XSM7DETF.mjs +0 -112
- package/dist/lib/node-esm/app-graph-builder-XSM7DETF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-53FFD4VO.mjs +0 -1776
- package/dist/lib/node-esm/chunk-53FFD4VO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AWAU4BHR.mjs +0 -244
- package/dist/lib/node-esm/chunk-AWAU4BHR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IG4GSWZN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K5NNSGIV.mjs +0 -152
- package/dist/lib/node-esm/chunk-K5NNSGIV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RAT3GSJP.mjs +0 -383
- package/dist/lib/node-esm/chunk-RAT3GSJP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SS7U6GCX.mjs +0 -16
- package/dist/lib/node-esm/chunk-SS7U6GCX.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-XSZRLU6V.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-XSZRLU6V.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FZAAAXGR.mjs +0 -59
- package/dist/lib/node-esm/react-surface-FZAAAXGR.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/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/AmbientDialog/AmbientDialog.d.ts +0 -7
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +0 -8
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/AmbientDialog/index.d.ts +0 -2
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog/AssistantDialog.d.ts +0 -6
- package/dist/types/src/components/AssistantDialog/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/AssistantDialog/index.d.ts +0 -2
- package/dist/types/src/components/AssistantDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer/ChatContainer.d.ts +0 -6
- 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/Prompt/Prompt.d.ts +0 -13
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +0 -9
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/PromptBar.d.ts +0 -10
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/autocomplete.d.ts +0 -21
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/index.d.ts +0 -3
- package/dist/types/src/components/Prompt/index.d.ts.map +0 -1
- package/dist/types/src/components/PromptEditor/PromptEditor.d.ts +0 -9
- 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 -5
- 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 -15
- 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/ThreadContainer.d.ts +0 -8
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +0 -15
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +0 -13
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +0 -1
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +0 -13
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +0 -1
- package/dist/types/src/components/Thread/index.d.ts +0 -3
- package/dist/types/src/components/Thread/index.d.ts.map +0 -1
- package/dist/types/src/components/Thread/reducer.d.ts +0 -12
- package/dist/types/src/components/Thread/reducer.d.ts.map +0 -1
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +0 -19
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +0 -1
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +0 -8
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbox/index.d.ts +0 -2
- package/dist/types/src/components/Toolbox/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 -7
- 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 -75
- 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/hooks/useTextInputEvents.d.ts +0 -13
- package/dist/types/src/hooks/useTextInputEvents.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 -19
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/ai-client.ts +0 -19
- package/src/capabilities/app-graph-builder.ts +0 -100
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -26
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +0 -81
- package/src/components/AmbientDialog/AmbientDialog.tsx +0 -103
- package/src/components/AmbientDialog/index.ts +0 -5
- package/src/components/AssistantDialog/AssistantDialog.tsx +0 -23
- package/src/components/AssistantDialog/index.ts +0 -5
- package/src/components/ChatContainer/ChatContainer.tsx +0 -19
- package/src/components/ChatContainer/index.ts +0 -9
- package/src/components/Prompt/Prompt.stories.tsx +0 -79
- package/src/components/Prompt/Prompt.tsx +0 -79
- package/src/components/Prompt/PromptBar.tsx +0 -100
- package/src/components/Prompt/autocomplete.ts +0 -212
- package/src/components/Prompt/index.ts +0 -6
- 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 -76
- package/src/components/ServiceRegistry/index.ts +0 -5
- package/src/components/Thread/Thread.stories.tsx +0 -210
- package/src/components/Thread/Thread.tsx +0 -106
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -245
- package/src/components/Thread/ThreadContainer.tsx +0 -67
- package/src/components/Thread/ThreadMessage.tsx +0 -187
- package/src/components/Thread/ToolInvocations.tsx +0 -86
- package/src/components/Thread/index.ts +0 -6
- package/src/components/Thread/reducer.ts +0 -52
- package/src/components/Toolbox/Toolbox.stories.tsx +0 -66
- package/src/components/Toolbox/Toolbox.tsx +0 -89
- package/src/components/Toolbox/index.ts +0 -5
- package/src/hooks/email.ts +0 -49
- package/src/hooks/index.ts +0 -11
- package/src/hooks/invocation-handler.ts +0 -109
- package/src/hooks/processor.test.ts +0 -15
- package/src/hooks/processor.ts +0 -218
- package/src/hooks/useChatProcessor.tsx +0 -75
- package/src/hooks/useLocalTriggerManager.ts +0 -82
- package/src/hooks/useMessageQueue.ts +0 -23
- package/src/hooks/useServices.ts +0 -28
- package/src/hooks/useTextInputEvents.ts +0 -49
- 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 -224
- 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 -22
- package/src/typings.d.ts +0 -9
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Schema as S } from '@effect/schema';
|
|
6
|
-
import React, { useEffect } from 'react';
|
|
7
|
-
|
|
8
|
-
import { createDocAccessor } from '@dxos/react-client/echo';
|
|
9
|
-
import { Input, Select, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
createBasicExtensions,
|
|
12
|
-
createDataExtensions,
|
|
13
|
-
createThemeExtensions,
|
|
14
|
-
useTextEditor,
|
|
15
|
-
} from '@dxos/react-ui-editor';
|
|
16
|
-
import { attentionSurface, groupBorder, mx } from '@dxos/react-ui-theme';
|
|
17
|
-
import { isNonNullable } from '@dxos/util';
|
|
18
|
-
|
|
19
|
-
import { nameRegex, promptExtension } from './prompt-extension';
|
|
20
|
-
import { AUTOMATION_PLUGIN } from '../../meta';
|
|
21
|
-
import { type ChainInput, ChainInputType, type ChainPromptType } from '../../types';
|
|
22
|
-
|
|
23
|
-
const inputTypes = [
|
|
24
|
-
{
|
|
25
|
-
value: ChainInputType.VALUE,
|
|
26
|
-
label: 'Value',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
value: ChainInputType.PASS_THROUGH,
|
|
30
|
-
label: 'Pass through',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
value: ChainInputType.RETRIEVER,
|
|
34
|
-
label: 'Retriever',
|
|
35
|
-
},
|
|
36
|
-
// {
|
|
37
|
-
// value: ChainInputType.FUNCTION,
|
|
38
|
-
// label: 'Function',
|
|
39
|
-
// },
|
|
40
|
-
// {
|
|
41
|
-
// value: ChainInputType.QUERY,
|
|
42
|
-
// label: 'Query',
|
|
43
|
-
// },
|
|
44
|
-
{
|
|
45
|
-
value: ChainInputType.RESOLVER,
|
|
46
|
-
label: 'Resolver',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
value: ChainInputType.CONTEXT,
|
|
50
|
-
label: 'Context',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
value: ChainInputType.SCHEMA,
|
|
54
|
-
label: 'Schema',
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
const getInputType = (type: string) => inputTypes.find(({ value }) => String(value) === type)?.value;
|
|
59
|
-
|
|
60
|
-
const usePromptInputs = (prompt: ChainPromptType) => {
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
const text = prompt.template ?? '';
|
|
63
|
-
if (!prompt.inputs) {
|
|
64
|
-
prompt.inputs = []; // TODO(burdon): Required?
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const regex = new RegExp(nameRegex, 'g');
|
|
68
|
-
const variables = new Set<string>([...text.matchAll(regex)].map((m) => m[1]));
|
|
69
|
-
|
|
70
|
-
// Create map of unclaimed inputs.
|
|
71
|
-
const unclaimed = new Map<string, ChainInput>(
|
|
72
|
-
prompt.inputs?.filter(isNonNullable).map((input) => [input.name, input]),
|
|
73
|
-
);
|
|
74
|
-
const missing: string[] = [];
|
|
75
|
-
Array.from(variables.values()).forEach((name) => {
|
|
76
|
-
if (unclaimed.has(name)) {
|
|
77
|
-
unclaimed.delete(name);
|
|
78
|
-
} else {
|
|
79
|
-
missing.push(name);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// Match or create new inputs.
|
|
84
|
-
const values = unclaimed.values();
|
|
85
|
-
missing.forEach((name) => {
|
|
86
|
-
const next = values.next().value;
|
|
87
|
-
if (next) {
|
|
88
|
-
next.name = name;
|
|
89
|
-
} else {
|
|
90
|
-
prompt.inputs?.push({ name });
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// Remove unclaimed (deleted) inputs.
|
|
95
|
-
// TODO(burdon): If user types incorrect name value, it will be deleted. Garbage collect?
|
|
96
|
-
for (const input of values) {
|
|
97
|
-
prompt.inputs.splice(prompt.inputs.indexOf(input), 1);
|
|
98
|
-
}
|
|
99
|
-
}, [prompt.template]);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type PromptEditorProps = {
|
|
103
|
-
prompt: ChainPromptType;
|
|
104
|
-
commandEditable?: boolean;
|
|
105
|
-
schema?: S.Schema<any, any, any>;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export const PromptEditor = ({ prompt, commandEditable = true }: PromptEditorProps) => {
|
|
109
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
110
|
-
const { themeMode } = useThemeContext();
|
|
111
|
-
|
|
112
|
-
const { parentRef } = useTextEditor(
|
|
113
|
-
() => ({
|
|
114
|
-
initialValue: prompt.template,
|
|
115
|
-
extensions: [
|
|
116
|
-
createDataExtensions({
|
|
117
|
-
id: prompt.id,
|
|
118
|
-
text: prompt.template !== undefined ? createDocAccessor(prompt, ['template']) : undefined,
|
|
119
|
-
}),
|
|
120
|
-
createBasicExtensions({
|
|
121
|
-
bracketMatching: false,
|
|
122
|
-
lineWrapping: true,
|
|
123
|
-
placeholder: t('template placeholder'),
|
|
124
|
-
}),
|
|
125
|
-
createThemeExtensions({
|
|
126
|
-
themeMode,
|
|
127
|
-
slots: {
|
|
128
|
-
content: { className: '!p-3' },
|
|
129
|
-
},
|
|
130
|
-
}),
|
|
131
|
-
promptExtension,
|
|
132
|
-
],
|
|
133
|
-
}),
|
|
134
|
-
[themeMode, prompt],
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
usePromptInputs(prompt);
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<div className={mx('flex flex-col w-full overflow-hidden gap-4', groupBorder)}>
|
|
141
|
-
{commandEditable && (
|
|
142
|
-
<div className='flex items-center pl-4'>
|
|
143
|
-
<span className='text-neutral-500'>/</span>
|
|
144
|
-
<Input.Root>
|
|
145
|
-
<Input.TextInput
|
|
146
|
-
placeholder={t('command placeholder')}
|
|
147
|
-
classNames={mx('is-full bg-transparent m-2')}
|
|
148
|
-
value={prompt.command ?? ''}
|
|
149
|
-
onChange={(event) => {
|
|
150
|
-
prompt.command = event.target.value.replace(/\w/g, '');
|
|
151
|
-
}}
|
|
152
|
-
/>
|
|
153
|
-
</Input.Root>
|
|
154
|
-
</div>
|
|
155
|
-
)}
|
|
156
|
-
|
|
157
|
-
<div ref={parentRef} className={mx(attentionSurface, 'rounded', 'min-h-[120px]')} />
|
|
158
|
-
|
|
159
|
-
{(prompt.inputs?.length ?? 0) > 0 && (
|
|
160
|
-
<div className='flex flex-col'>
|
|
161
|
-
{/* TODO(zan): Improve layout with grid */}
|
|
162
|
-
<table className='w-full table-fixed border-collapse my-2'>
|
|
163
|
-
<tbody>
|
|
164
|
-
{prompt.inputs?.filter(isNonNullable).map((input) => (
|
|
165
|
-
<tr key={input.name}>
|
|
166
|
-
<td className='w-[160px] p-1 font-mono text-sm whitespace-nowrap truncate'>
|
|
167
|
-
<code className='px-2'>{input.name}</code>
|
|
168
|
-
</td>
|
|
169
|
-
<td className='w-[120px] p-1'>
|
|
170
|
-
<Input.Root>
|
|
171
|
-
<Select.Root
|
|
172
|
-
value={String(input.type)}
|
|
173
|
-
onValueChange={(type) => {
|
|
174
|
-
input.type = getInputType(type) ?? ChainInputType.VALUE;
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
<Select.TriggerButton placeholder='Type' classNames='is-full' />
|
|
178
|
-
<Select.Portal>
|
|
179
|
-
<Select.Content>
|
|
180
|
-
<Select.Viewport>
|
|
181
|
-
{inputTypes.map(({ value, label }) => (
|
|
182
|
-
<Select.Option key={value} value={String(value)}>
|
|
183
|
-
{label}
|
|
184
|
-
</Select.Option>
|
|
185
|
-
))}
|
|
186
|
-
</Select.Viewport>
|
|
187
|
-
</Select.Content>
|
|
188
|
-
</Select.Portal>
|
|
189
|
-
</Select.Root>
|
|
190
|
-
</Input.Root>
|
|
191
|
-
</td>
|
|
192
|
-
<td className='p-1 pr-2'>
|
|
193
|
-
{input.type !== undefined &&
|
|
194
|
-
[
|
|
195
|
-
ChainInputType.VALUE,
|
|
196
|
-
ChainInputType.CONTEXT,
|
|
197
|
-
ChainInputType.RESOLVER,
|
|
198
|
-
ChainInputType.SCHEMA,
|
|
199
|
-
].includes(input.type) && (
|
|
200
|
-
<div>
|
|
201
|
-
<Input.Root>
|
|
202
|
-
<Input.TextInput
|
|
203
|
-
placeholder={t('command placeholder')}
|
|
204
|
-
classNames={mx('is-full bg-transparent')}
|
|
205
|
-
value={input.value ?? ''}
|
|
206
|
-
onChange={(event) => {
|
|
207
|
-
input.value = event.target.value;
|
|
208
|
-
}}
|
|
209
|
-
/>
|
|
210
|
-
</Input.Root>
|
|
211
|
-
</div>
|
|
212
|
-
)}
|
|
213
|
-
</td>
|
|
214
|
-
</tr>
|
|
215
|
-
))}
|
|
216
|
-
</tbody>
|
|
217
|
-
</table>
|
|
218
|
-
</div>
|
|
219
|
-
)}
|
|
220
|
-
</div>
|
|
221
|
-
);
|
|
222
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { HighlightStyle, StreamLanguage, syntaxHighlighting } from '@codemirror/language';
|
|
6
|
-
import { type Extension } from '@codemirror/state';
|
|
7
|
-
|
|
8
|
-
import { tags } from '@dxos/react-ui-editor';
|
|
9
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
-
|
|
11
|
-
export const nameRegex = /\{([\w-]+)}/;
|
|
12
|
-
|
|
13
|
-
const parser = StreamLanguage.define({
|
|
14
|
-
token: (stream) => {
|
|
15
|
-
if (stream.eatSpace()) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
if (stream.match(/^#.*/)) {
|
|
19
|
-
return 'lineComment';
|
|
20
|
-
}
|
|
21
|
-
if (stream.match(/^-+$/)) {
|
|
22
|
-
return 'lineComment';
|
|
23
|
-
}
|
|
24
|
-
if (stream.match(nameRegex)) {
|
|
25
|
-
return 'variableName';
|
|
26
|
-
}
|
|
27
|
-
stream.next();
|
|
28
|
-
return null;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* https://codemirror.net/examples/styling
|
|
34
|
-
* https://lezer.codemirror.net/docs/ref/#highlight
|
|
35
|
-
*/
|
|
36
|
-
const highlightStyles = HighlightStyle.define([
|
|
37
|
-
{
|
|
38
|
-
tag: tags.variableName,
|
|
39
|
-
class: mx('rounded border border-yellow-500 bg-yellow-100 text-black font-mono text-sm'),
|
|
40
|
-
},
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
export const promptExtension: Extension = [parser, syntaxHighlighting(highlightStyles)];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// TODO(burdon): Factor out (shared with backend). core/chain (@dxos/chain).
|
|
6
|
-
// TODO(burdon): Agent/plan-and-execute (with tools). Create design doc/ontology of sequence/agent.
|
|
7
|
-
|
|
8
|
-
export type Step = {
|
|
9
|
-
id: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type Variable = {
|
|
13
|
-
name: string;
|
|
14
|
-
type: 'value' | 'function' | 'query' | 'retriever' | 'pass-through';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type Prompt = Step & {
|
|
18
|
-
title?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
template: string;
|
|
21
|
-
variables: Variable[];
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type Sequence = Step & {
|
|
25
|
-
runnable: Step[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type Chain = {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
|
|
10
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
11
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
13
|
-
|
|
14
|
-
import { ServiceRegistry } from './ServiceRegistry';
|
|
15
|
-
import { ServiceType } from '../../types';
|
|
16
|
-
|
|
17
|
-
const meta: Meta<typeof ServiceRegistry> = {
|
|
18
|
-
title: 'plugins/plugin-automation/ServiceRegistry',
|
|
19
|
-
component: ServiceRegistry,
|
|
20
|
-
render: ({ space: _ignore, ...args }) => {
|
|
21
|
-
const space = useSpace();
|
|
22
|
-
if (!space) {
|
|
23
|
-
return <div />;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className='h-full w-[300px] overflow-hidden'>
|
|
28
|
-
<ServiceRegistry space={space} {...args} />
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
},
|
|
32
|
-
decorators: [
|
|
33
|
-
withClientProvider({
|
|
34
|
-
createIdentity: true,
|
|
35
|
-
createSpace: true,
|
|
36
|
-
types: [ServiceType],
|
|
37
|
-
}),
|
|
38
|
-
withLayout({ fullscreen: true, tooltips: true, classNames: 'flex justify-center' }),
|
|
39
|
-
withTheme,
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default meta;
|
|
44
|
-
|
|
45
|
-
type Story = StoryObj<typeof ServiceRegistry>;
|
|
46
|
-
|
|
47
|
-
export const Default: Story = {
|
|
48
|
-
args: {},
|
|
49
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,210 +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
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
11
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { type Message } from '@dxos/artifact';
|
|
13
|
-
import { ObjectId } from '@dxos/echo-schema';
|
|
14
|
-
import { faker } from '@dxos/random';
|
|
15
|
-
import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
|
|
16
|
-
|
|
17
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
18
|
-
import translations from '../../translations';
|
|
19
|
-
|
|
20
|
-
faker.seed(1);
|
|
21
|
-
|
|
22
|
-
const Render = ({ messages: _messages, ...props }: ThreadProps) => {
|
|
23
|
-
const [processing, setProcessing] = useState(false);
|
|
24
|
-
const [messages, setMessages] = useState<Message[]>(_messages ?? []);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
setMessages(_messages ?? []);
|
|
27
|
-
}, [_messages]);
|
|
28
|
-
|
|
29
|
-
const handleSubmit = useCallback(
|
|
30
|
-
(text: string) => {
|
|
31
|
-
const request: Message = { id: ObjectId.random(), role: 'user', content: [{ type: 'text', text }] };
|
|
32
|
-
const response: Message = {
|
|
33
|
-
id: ObjectId.random(),
|
|
34
|
-
role: 'assistant',
|
|
35
|
-
content: [{ type: 'text', disposition: 'cot', pending: true, text: faker.lorem.paragraphs(1) }],
|
|
36
|
-
};
|
|
37
|
-
setMessages([...messages, request, response]);
|
|
38
|
-
setProcessing(true);
|
|
39
|
-
setTimeout(() => {
|
|
40
|
-
response.content[0].pending = false;
|
|
41
|
-
setMessages([
|
|
42
|
-
...messages,
|
|
43
|
-
request,
|
|
44
|
-
response,
|
|
45
|
-
{
|
|
46
|
-
id: ObjectId.random(),
|
|
47
|
-
role: 'assistant',
|
|
48
|
-
content: [{ type: 'text', text: faker.lorem.paragraphs(1) }],
|
|
49
|
-
},
|
|
50
|
-
]);
|
|
51
|
-
setProcessing(false);
|
|
52
|
-
}, 3_000);
|
|
53
|
-
},
|
|
54
|
-
[messages],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div className='flex grow justify-center overflow-center bg-baseSurface'>
|
|
59
|
-
<div className='flex w-[30rem] bg-white dark:bg-black'>
|
|
60
|
-
<Thread
|
|
61
|
-
{...props}
|
|
62
|
-
messages={messages}
|
|
63
|
-
processing={processing}
|
|
64
|
-
onSubmit={handleSubmit}
|
|
65
|
-
onCancel={() => setProcessing(false)}
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const meta: Meta<ThreadProps> = {
|
|
73
|
-
title: 'plugins/plugin-automation/Thread',
|
|
74
|
-
render: Render,
|
|
75
|
-
component: Thread,
|
|
76
|
-
decorators: [
|
|
77
|
-
withSignals,
|
|
78
|
-
withTheme,
|
|
79
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
80
|
-
withPluginManager({ plugins: [IntentPlugin()] }),
|
|
81
|
-
],
|
|
82
|
-
parameters: {
|
|
83
|
-
translations,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export default meta;
|
|
88
|
-
|
|
89
|
-
type Story = StoryObj<ThreadProps>;
|
|
90
|
-
|
|
91
|
-
const TEST_MESSAGES: Message[] = [
|
|
92
|
-
{
|
|
93
|
-
id: ObjectId.random(),
|
|
94
|
-
role: 'user',
|
|
95
|
-
content: [
|
|
96
|
-
{
|
|
97
|
-
type: 'text',
|
|
98
|
-
text: faker.lorem.sentence(5),
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: ObjectId.random(),
|
|
104
|
-
role: 'assistant',
|
|
105
|
-
content: [
|
|
106
|
-
{
|
|
107
|
-
type: 'text',
|
|
108
|
-
disposition: 'cot',
|
|
109
|
-
text: Array.from({ length: faker.number.int({ min: 3, max: 5 }) })
|
|
110
|
-
.map((_, idx) => `${idx + 1}. ${faker.lorem.paragraph()}`)
|
|
111
|
-
.join('\n'),
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
type: 'text',
|
|
115
|
-
text: Array.from({ length: faker.number.int({ min: 2, max: 5 }) })
|
|
116
|
-
.map(() => faker.lorem.paragraphs())
|
|
117
|
-
.join('\n\n'),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
type: 'tool_use',
|
|
121
|
-
id: '1234',
|
|
122
|
-
name: 'search',
|
|
123
|
-
input: {},
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: ObjectId.random(),
|
|
129
|
-
role: 'user',
|
|
130
|
-
content: [
|
|
131
|
-
{
|
|
132
|
-
type: 'tool_result',
|
|
133
|
-
toolUseId: '1234',
|
|
134
|
-
content: 'This is a tool result.',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: ObjectId.random(),
|
|
140
|
-
role: 'assistant',
|
|
141
|
-
content: [
|
|
142
|
-
{
|
|
143
|
-
type: 'tool_use',
|
|
144
|
-
id: '4567',
|
|
145
|
-
name: 'create',
|
|
146
|
-
input: {},
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: ObjectId.random(),
|
|
152
|
-
role: 'user',
|
|
153
|
-
content: [
|
|
154
|
-
{
|
|
155
|
-
type: 'tool_result',
|
|
156
|
-
toolUseId: '4567',
|
|
157
|
-
content: 'This is a tool result.',
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: ObjectId.random(),
|
|
163
|
-
role: 'assistant',
|
|
164
|
-
content: [
|
|
165
|
-
{
|
|
166
|
-
type: 'text',
|
|
167
|
-
text: faker.lorem.paragraphs(1),
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
},
|
|
171
|
-
];
|
|
172
|
-
|
|
173
|
-
export const Default: Story = {
|
|
174
|
-
args: {
|
|
175
|
-
// debug: true,
|
|
176
|
-
messages: TEST_MESSAGES,
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export const Input: Story = {
|
|
181
|
-
args: {
|
|
182
|
-
processing: true,
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export const Collapse: Story = {
|
|
187
|
-
args: {
|
|
188
|
-
collapse: true,
|
|
189
|
-
messages: TEST_MESSAGES,
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export const Incremental: Story = {
|
|
194
|
-
render: () => {
|
|
195
|
-
const [messages, setMessages] = useState<Message[]>([]);
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
let i = 0;
|
|
198
|
-
const interval = setInterval(() => {
|
|
199
|
-
setMessages((messages) => [...messages, TEST_MESSAGES[i++]]);
|
|
200
|
-
if (i >= TEST_MESSAGES.length) {
|
|
201
|
-
clearInterval(interval);
|
|
202
|
-
}
|
|
203
|
-
}, 2_000);
|
|
204
|
-
|
|
205
|
-
return () => clearInterval(interval);
|
|
206
|
-
}, []);
|
|
207
|
-
|
|
208
|
-
return <Render messages={messages} collapse />;
|
|
209
|
-
},
|
|
210
|
-
};
|