@dxos/plugin-automation 0.7.5-main.b19bfc8 → 0.7.5-main.d9d2d4e
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 +17 -199
- 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/{TemplateContainer-3YCM6XPU.cjs → chunk-CB5OB6JH.cjs} +8 -21
- 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 +32 -198
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{ChatContainer-4QTLL7TH.cjs → react-surface-2WRVAPGR.cjs} +20 -30
- 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 +17 -199
- 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 -181
- 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 -17
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- 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 -127
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +21 -77
- package/src/AutomationPlugin.tsx +7 -86
- package/src/capabilities/complementary-panel.ts +56 -0
- package/src/capabilities/index.ts +1 -6
- package/src/capabilities/react-surface.tsx +3 -44
- 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 -9
- package/src/index.ts +0 -1
- 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 -47
- package/dist/lib/browser/AssistantDialog-V67OWLRP.mjs +0 -116
- package/dist/lib/browser/AssistantDialog-V67OWLRP.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs +0 -8
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs.map +0 -7
- package/dist/lib/browser/ChatContainer-5BS6THNV.mjs +0 -33
- package/dist/lib/browser/ChatContainer-5BS6THNV.mjs.map +0 -7
- package/dist/lib/browser/TemplateContainer-HJJV44CE.mjs +0 -23
- package/dist/lib/browser/TemplateContainer-HJJV44CE.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-IR3CGVM6.mjs +0 -110
- package/dist/lib/browser/app-graph-builder-IR3CGVM6.mjs.map +0 -7
- package/dist/lib/browser/chunk-62E2AEXF.mjs +0 -162
- package/dist/lib/browser/chunk-62E2AEXF.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-BQ4WHY4D.mjs +0 -1818
- package/dist/lib/browser/chunk-BQ4WHY4D.mjs.map +0 -7
- package/dist/lib/browser/chunk-HZSTXZWK.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-QH5E22EL.mjs +0 -108
- package/dist/lib/browser/chunk-QH5E22EL.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAIWETH6.mjs +0 -81
- package/dist/lib/browser/chunk-XAIWETH6.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ICLE6FSI.mjs +0 -44
- package/dist/lib/browser/intent-resolver-ICLE6FSI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KEKVLCPQ.mjs +0 -80
- package/dist/lib/browser/react-surface-KEKVLCPQ.mjs.map +0 -7
- package/dist/lib/browser/settings-FE5DDWOE.mjs +0 -22
- package/dist/lib/browser/settings-FE5DDWOE.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/AssistantDialog-E62O72KI.cjs +0 -140
- package/dist/lib/node/AssistantDialog-E62O72KI.cjs.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-4QTLL7TH.cjs.map +0 -7
- package/dist/lib/node/TemplateContainer-3YCM6XPU.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-ECNVGTRT.cjs +0 -122
- package/dist/lib/node/app-graph-builder-ECNVGTRT.cjs.map +0 -7
- package/dist/lib/node/chunk-3QSK6IPK.cjs +0 -133
- package/dist/lib/node/chunk-3QSK6IPK.cjs.map +0 -7
- package/dist/lib/node/chunk-76F5BCJE.cjs +0 -111
- package/dist/lib/node/chunk-76F5BCJE.cjs.map +0 -7
- package/dist/lib/node/chunk-B37JIAOP.cjs +0 -1795
- package/dist/lib/node/chunk-B37JIAOP.cjs.map +0 -7
- package/dist/lib/node/chunk-BAQRBGOJ.cjs.map +0 -7
- package/dist/lib/node/chunk-UVWK2XJE.cjs +0 -183
- package/dist/lib/node/chunk-UVWK2XJE.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-4MQZULXW.cjs +0 -58
- package/dist/lib/node/intent-resolver-4MQZULXW.cjs.map +0 -7
- package/dist/lib/node/react-surface-4RVHY6WI.cjs +0 -95
- package/dist/lib/node/react-surface-4RVHY6WI.cjs.map +0 -7
- package/dist/lib/node/settings-GOIB2WJQ.cjs +0 -36
- package/dist/lib/node/settings-GOIB2WJQ.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/AssistantDialog-IPRBJKWA.mjs +0 -117
- package/dist/lib/node-esm/AssistantDialog-IPRBJKWA.mjs.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-4IWUGMGM.mjs +0 -34
- package/dist/lib/node-esm/ChatContainer-4IWUGMGM.mjs.map +0 -7
- package/dist/lib/node-esm/TemplateContainer-YJIXR24Z.mjs +0 -24
- package/dist/lib/node-esm/TemplateContainer-YJIXR24Z.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-HMRKSZ2X.mjs +0 -111
- package/dist/lib/node-esm/app-graph-builder-HMRKSZ2X.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5BKKHYO5.mjs +0 -163
- package/dist/lib/node-esm/chunk-5BKKHYO5.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-CAWPHOY4.mjs +0 -82
- package/dist/lib/node-esm/chunk-CAWPHOY4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-I32H7MCF.mjs +0 -109
- package/dist/lib/node-esm/chunk-I32H7MCF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IG4GSWZN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QHKP5HT2.mjs +0 -1819
- package/dist/lib/node-esm/chunk-QHKP5HT2.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-ZS7XTYLG.mjs +0 -45
- package/dist/lib/node-esm/intent-resolver-ZS7XTYLG.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-5ILD642V.mjs +0 -81
- package/dist/lib/node-esm/react-surface-5ILD642V.mjs.map +0 -7
- package/dist/lib/node-esm/settings-ANNQPPRY.mjs +0 -23
- package/dist/lib/node-esm/settings-ANNQPPRY.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/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.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.d.ts +0 -7
- package/dist/types/src/components/AssistantDialog.d.ts.map +0 -1
- package/dist/types/src/components/AutomationSettings/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings/AutomationSettings.d.ts.map +0 -1
- package/dist/types/src/components/AutomationSettings/index.d.ts +0 -2
- package/dist/types/src/components/AutomationSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/ChatContainer.d.ts +0 -7
- package/dist/types/src/components/ChatContainer.d.ts.map +0 -1
- package/dist/types/src/components/Prompt/Prompt.d.ts +0 -17
- 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/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/TemplateContainer.d.ts +0 -7
- package/dist/types/src/components/TemplateContainer.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +0 -12
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +0 -8
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +0 -10
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +0 -8
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/index.d.ts +0 -2
- package/dist/types/src/components/TemplateEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TemplateEditor/types.d.ts +0 -18
- package/dist/types/src/components/TemplateEditor/types.d.ts.map +0 -1
- package/dist/types/src/components/Thread/Thread.d.ts +0 -17
- 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 -10
- 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 -8
- 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/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/chat.d.ts +0 -12
- package/dist/types/src/types/chat.d.ts.map +0 -1
- package/dist/types/src/types/index.d.ts +0 -5
- package/dist/types/src/types/index.d.ts.map +0 -1
- package/dist/types/src/types/service.d.ts +0 -160
- package/dist/types/src/types/service.d.ts.map +0 -1
- package/dist/types/src/types/template.d.ts +0 -40
- package/dist/types/src/types/template.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -37
- 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 -99
- package/src/capabilities/capabilities.ts +0 -12
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/capabilities/settings.ts +0 -19
- 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.tsx +0 -33
- package/src/components/AutomationSettings/AutomationSettings.tsx +0 -49
- package/src/components/AutomationSettings/index.ts +0 -5
- package/src/components/ChatContainer.tsx +0 -29
- package/src/components/Prompt/Prompt.stories.tsx +0 -79
- package/src/components/Prompt/Prompt.tsx +0 -100
- 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/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/TemplateContainer.tsx +0 -21
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +0 -72
- package/src/components/TemplateEditor/TemplateEditor.tsx +0 -76
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +0 -65
- package/src/components/TemplateEditor/TemplateForm.tsx +0 -184
- package/src/components/TemplateEditor/index.ts +0 -5
- package/src/components/TemplateEditor/types.tsx +0 -28
- package/src/components/Thread/Thread.stories.tsx +0 -212
- package/src/components/Thread/Thread.tsx +0 -97
- package/src/components/Thread/ThreadContainer.stories.tsx +0 -258
- package/src/components/Thread/ThreadContainer.tsx +0 -78
- package/src/components/Thread/ThreadMessage.tsx +0 -187
- package/src/components/Thread/ToolInvocations.tsx +0 -93
- package/src/components/Thread/index.ts +0 -6
- package/src/components/Thread/reducer.ts +0 -52
- package/src/components/Toolbox/Toolbox.stories.tsx +0 -65
- package/src/components/Toolbox/Toolbox.tsx +0 -117
- 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 -219
- package/src/hooks/useChatProcessor.tsx +0 -77
- 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/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/chat.ts +0 -11
- package/src/types/index.ts +0 -8
- package/src/types/service.ts +0 -102
- package/src/types/template.ts +0 -34
- package/src/types/types.ts +0 -41
- package/src/typings.d.ts +0 -9
|
@@ -1,258 +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, useMemo, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
Capabilities,
|
|
12
|
-
IntentPlugin,
|
|
13
|
-
SettingsPlugin,
|
|
14
|
-
Surface,
|
|
15
|
-
useCapabilities,
|
|
16
|
-
useIntentDispatcher,
|
|
17
|
-
} from '@dxos/app-framework';
|
|
18
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
19
|
-
import { Message, type Tool } from '@dxos/artifact';
|
|
20
|
-
import { capabilities, genericTools, localServiceEndpoints, type IsObject } from '@dxos/artifact-testing';
|
|
21
|
-
import { AIServiceClientImpl } from '@dxos/assistant';
|
|
22
|
-
import { createStatic, ObjectId } from '@dxos/echo-schema';
|
|
23
|
-
import { EdgeHttpClient } from '@dxos/edge-client';
|
|
24
|
-
import { invariant } from '@dxos/invariant';
|
|
25
|
-
import { DXN, QueueSubspaceTags, SpaceId } from '@dxos/keys';
|
|
26
|
-
import { ChessPlugin } from '@dxos/plugin-chess';
|
|
27
|
-
import { ChessType } from '@dxos/plugin-chess/types';
|
|
28
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
29
|
-
import { MapPlugin } from '@dxos/plugin-map';
|
|
30
|
-
import { SpacePlugin } from '@dxos/plugin-space';
|
|
31
|
-
import { TablePlugin } from '@dxos/plugin-table';
|
|
32
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
33
|
-
import { withClientProvider } from '@dxos/react-client/testing';
|
|
34
|
-
import { useQueue } from '@dxos/react-edge-client';
|
|
35
|
-
import { IconButton, Input, Toolbar } from '@dxos/react-ui';
|
|
36
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
37
|
-
import { withLayout, withSignals, withTheme } from '@dxos/storybook-utils';
|
|
38
|
-
|
|
39
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
40
|
-
import { ChatProcessor } from '../../hooks';
|
|
41
|
-
import { createProcessorOptions } from '../../testing';
|
|
42
|
-
import translations from '../../translations';
|
|
43
|
-
|
|
44
|
-
const endpoints = localServiceEndpoints;
|
|
45
|
-
|
|
46
|
-
type RenderProps = {
|
|
47
|
-
items?: IsObject[];
|
|
48
|
-
prompts?: string[];
|
|
49
|
-
} & Pick<ThreadProps, 'debug'>;
|
|
50
|
-
|
|
51
|
-
// TODO(burdon): Use ChatContainer.
|
|
52
|
-
const Render = ({ items: _items, prompts = [], ...props }: RenderProps) => {
|
|
53
|
-
const space = useSpace();
|
|
54
|
-
const artifactDefinitions = useCapabilities(Capabilities.ArtifactDefinition);
|
|
55
|
-
const tools = useMemo<Tool[]>(
|
|
56
|
-
() => [...genericTools, ...artifactDefinitions.flatMap((definition) => definition.tools)],
|
|
57
|
-
[genericTools, artifactDefinitions],
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const [aiClient] = useState(() => new AIServiceClientImpl({ endpoint: endpoints.ai }));
|
|
61
|
-
const [edgeClient] = useState(() => new EdgeHttpClient(endpoints.edge));
|
|
62
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
63
|
-
const processor = useMemo<ChatProcessor | undefined>(() => {
|
|
64
|
-
if (!space) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return new ChatProcessor(
|
|
69
|
-
aiClient,
|
|
70
|
-
tools,
|
|
71
|
-
{
|
|
72
|
-
space,
|
|
73
|
-
dispatch,
|
|
74
|
-
},
|
|
75
|
-
createProcessorOptions(artifactDefinitions.map((definition) => definition.instructions)),
|
|
76
|
-
);
|
|
77
|
-
}, [aiClient, tools, space, dispatch, artifactDefinitions]);
|
|
78
|
-
|
|
79
|
-
// Queue.
|
|
80
|
-
const [queueDxn, setQueueDxn] = useState(() => randomQueueDxn());
|
|
81
|
-
const queue = useQueue<Message>(edgeClient, DXN.tryParse(queueDxn));
|
|
82
|
-
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
if (queue?.items.length === 0 && !queue.isLoading && prompts.length > 0) {
|
|
85
|
-
queue.append([
|
|
86
|
-
createStatic(Message, {
|
|
87
|
-
role: 'assistant',
|
|
88
|
-
content: prompts.map(
|
|
89
|
-
(prompt) =>
|
|
90
|
-
({
|
|
91
|
-
type: 'json',
|
|
92
|
-
disposition: 'suggest',
|
|
93
|
-
json: JSON.stringify({ text: prompt }),
|
|
94
|
-
}) as const,
|
|
95
|
-
),
|
|
96
|
-
}),
|
|
97
|
-
]);
|
|
98
|
-
}
|
|
99
|
-
}, [queueDxn, prompts, queue?.items.length, queue?.isLoading]);
|
|
100
|
-
|
|
101
|
-
// State.
|
|
102
|
-
const artifactItems: any[] = []; // TODO(burdon): Query from space.
|
|
103
|
-
const messages = [...(queue?.items ?? []), ...(processor?.messages.value ?? [])];
|
|
104
|
-
|
|
105
|
-
const handleSubmit = processor
|
|
106
|
-
? (message: string) => {
|
|
107
|
-
requestAnimationFrame(async () => {
|
|
108
|
-
invariant(processor);
|
|
109
|
-
if (processor.streaming.value) {
|
|
110
|
-
await processor.cancel();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
invariant(queue);
|
|
114
|
-
await processor.request(message, {
|
|
115
|
-
history: queue.items,
|
|
116
|
-
onComplete: (messages) => {
|
|
117
|
-
queue.append(messages);
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return true;
|
|
123
|
-
}
|
|
124
|
-
: undefined;
|
|
125
|
-
|
|
126
|
-
const handlePrompt = useCallback(
|
|
127
|
-
(text: string) => {
|
|
128
|
-
void handleSubmit?.(text);
|
|
129
|
-
},
|
|
130
|
-
[handleSubmit],
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const handleDelete = useCallback(
|
|
134
|
-
(id: string) => {
|
|
135
|
-
invariant(ObjectId.isValid(id), 'Invalid message id');
|
|
136
|
-
void queue?.delete([id]);
|
|
137
|
-
},
|
|
138
|
-
[queue],
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<div className='grid grid-cols-2 w-full h-full divide-x divide-separator overflow-hidden'>
|
|
143
|
-
{/* Thread */}
|
|
144
|
-
<div className='flex flex-col gap-4 overflow-hidden'>
|
|
145
|
-
<Toolbar.Root classNames='p-2'>
|
|
146
|
-
<Input.Root>
|
|
147
|
-
<Input.TextInput
|
|
148
|
-
spellCheck={false}
|
|
149
|
-
placeholder='Queue DXN'
|
|
150
|
-
value={queueDxn}
|
|
151
|
-
onChange={(ev) => setQueueDxn(ev.target.value)}
|
|
152
|
-
/>
|
|
153
|
-
<IconButton
|
|
154
|
-
iconOnly
|
|
155
|
-
label='Copy DXN'
|
|
156
|
-
icon='ph--copy--regular'
|
|
157
|
-
onClick={() => navigator.clipboard.writeText(queueDxn)}
|
|
158
|
-
/>
|
|
159
|
-
<IconButton
|
|
160
|
-
iconOnly
|
|
161
|
-
label='Clear history'
|
|
162
|
-
icon='ph--trash--regular'
|
|
163
|
-
onClick={() => setQueueDxn(randomQueueDxn())}
|
|
164
|
-
/>
|
|
165
|
-
<IconButton iconOnly label='Stop' icon='ph--stop--regular' onClick={() => processor?.cancel()} />
|
|
166
|
-
</Input.Root>
|
|
167
|
-
</Toolbar.Root>
|
|
168
|
-
|
|
169
|
-
{/* TODO(burdon): Replace with ThreadContainer. */}
|
|
170
|
-
<Thread
|
|
171
|
-
messages={messages}
|
|
172
|
-
processing={processor?.streaming.value}
|
|
173
|
-
onSubmit={processor ? handleSubmit : undefined}
|
|
174
|
-
onPrompt={processor ? handlePrompt : undefined}
|
|
175
|
-
onDelete={processor ? handleDelete : undefined}
|
|
176
|
-
{...props}
|
|
177
|
-
/>
|
|
178
|
-
</div>
|
|
179
|
-
|
|
180
|
-
{/* Artifacts Deck/Mosaic */}
|
|
181
|
-
<div className='overflow-hidden grid grid-rows-[2fr_1fr] divide-y divide-separator'>
|
|
182
|
-
{artifactItems.length > 0 && (
|
|
183
|
-
<div className={mx('flex grow overflow-hidden', artifactItems.length === 1 && 'row-span-2')}>
|
|
184
|
-
<Surface role='canvas-node' limit={1} data={artifactItems[0]} />
|
|
185
|
-
</div>
|
|
186
|
-
)}
|
|
187
|
-
|
|
188
|
-
{artifactItems.length > 1 && (
|
|
189
|
-
<div className='flex shrink-0 overflow-hidden divide-x divide-separator'>
|
|
190
|
-
<div className='flex flex-1 h-full'>
|
|
191
|
-
{artifactItems.slice(1, 3).map((item, idx) => (
|
|
192
|
-
<Surface key={idx} role='canvas-node' limit={1} data={item} />
|
|
193
|
-
))}
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
)}
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
);
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const randomQueueDxn = () =>
|
|
203
|
-
new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, SpaceId.random(), ObjectId.random()]).toString();
|
|
204
|
-
|
|
205
|
-
const meta: Meta<typeof Render> = {
|
|
206
|
-
title: 'plugins/plugin-automation/ThreadContainer',
|
|
207
|
-
render: Render,
|
|
208
|
-
decorators: [
|
|
209
|
-
withSignals,
|
|
210
|
-
withClientProvider({
|
|
211
|
-
createIdentity: true,
|
|
212
|
-
createSpace: true,
|
|
213
|
-
}),
|
|
214
|
-
withPluginManager({
|
|
215
|
-
plugins: [
|
|
216
|
-
ClientPlugin({
|
|
217
|
-
onClientInitialized: async (_, client) => {
|
|
218
|
-
await client.halo.createIdentity();
|
|
219
|
-
},
|
|
220
|
-
}),
|
|
221
|
-
SpacePlugin({ observability: false }),
|
|
222
|
-
SettingsPlugin(),
|
|
223
|
-
IntentPlugin(),
|
|
224
|
-
ChessPlugin(),
|
|
225
|
-
MapPlugin(),
|
|
226
|
-
TablePlugin(),
|
|
227
|
-
],
|
|
228
|
-
capabilities,
|
|
229
|
-
}),
|
|
230
|
-
withTheme,
|
|
231
|
-
withLayout({ fullscreen: true, tooltips: true }),
|
|
232
|
-
],
|
|
233
|
-
parameters: {
|
|
234
|
-
translations,
|
|
235
|
-
},
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
export default meta;
|
|
239
|
-
|
|
240
|
-
type Story = StoryObj<typeof Render>;
|
|
241
|
-
|
|
242
|
-
export const Default: Story = {
|
|
243
|
-
args: {
|
|
244
|
-
debug: true,
|
|
245
|
-
prompts: ['Ask me a question', 'Show me a chess puzzle'],
|
|
246
|
-
},
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
export const WithInitialItems: Story = {
|
|
250
|
-
args: {
|
|
251
|
-
debug: true,
|
|
252
|
-
items: [
|
|
253
|
-
createStatic(ChessType, {
|
|
254
|
-
fen: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1',
|
|
255
|
-
}),
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC, useCallback } from 'react';
|
|
6
|
-
|
|
7
|
-
import { invariant } from '@dxos/invariant';
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
10
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
-
|
|
12
|
-
import { Thread, type ThreadProps } from './Thread';
|
|
13
|
-
import { useChatProcessor, useMessageQueue } from '../../hooks';
|
|
14
|
-
import { type AIChatType, type AutomationSettingsProps } from '../../types';
|
|
15
|
-
|
|
16
|
-
export type ThreadContainerProps = {
|
|
17
|
-
chat?: AIChatType;
|
|
18
|
-
settings?: AutomationSettingsProps;
|
|
19
|
-
} & Pick<ThreadProps, 'debug' | 'transcription' | 'onOpenChange'>;
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Since this only wraps Thread, just separate out hook?
|
|
22
|
-
export const ThreadContainer: FC<ThemedClassName<ThreadContainerProps>> = ({
|
|
23
|
-
classNames,
|
|
24
|
-
chat,
|
|
25
|
-
settings,
|
|
26
|
-
onOpenChange,
|
|
27
|
-
...props
|
|
28
|
-
}) => {
|
|
29
|
-
// Push up capabilities hooks out of components.
|
|
30
|
-
const space = getSpace(chat);
|
|
31
|
-
const processor = useChatProcessor(space, settings);
|
|
32
|
-
const messageQueue = useMessageQueue(chat);
|
|
33
|
-
const messages = [...(messageQueue?.items ?? []), ...processor.messages.value];
|
|
34
|
-
|
|
35
|
-
const handleSubmit = useCallback(
|
|
36
|
-
(text: string) => {
|
|
37
|
-
// Don't accept input if still processing.
|
|
38
|
-
if (processor.streaming.value) {
|
|
39
|
-
log.warn('ignoring submit; still processing.');
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
onOpenChange?.(true);
|
|
44
|
-
|
|
45
|
-
invariant(messageQueue);
|
|
46
|
-
void processor.request(text, {
|
|
47
|
-
history: messageQueue.items,
|
|
48
|
-
onComplete: (messages) => {
|
|
49
|
-
messageQueue.append(messages);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return true;
|
|
54
|
-
},
|
|
55
|
-
[processor, messageQueue, onOpenChange],
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const handleCancel = useCallback(() => {
|
|
59
|
-
if (processor.streaming.value) {
|
|
60
|
-
void processor.cancel();
|
|
61
|
-
}
|
|
62
|
-
}, [processor]);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Thread
|
|
66
|
-
classNames={classNames}
|
|
67
|
-
space={space}
|
|
68
|
-
messages={messages}
|
|
69
|
-
processing={processor.streaming.value}
|
|
70
|
-
error={processor.error.value}
|
|
71
|
-
onSubmit={handleSubmit}
|
|
72
|
-
onCancel={handleCancel}
|
|
73
|
-
onPrompt={handleSubmit}
|
|
74
|
-
onOpenChange={onOpenChange}
|
|
75
|
-
{...props}
|
|
76
|
-
/>
|
|
77
|
-
);
|
|
78
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type PropsWithChildren, type FC } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type MessageContentBlock, type Message } from '@dxos/artifact';
|
|
8
|
-
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
-
import { Button, ButtonGroup, Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
12
|
-
MarkdownViewer,
|
|
13
|
-
ToggleContainer as NativeToggleContainer,
|
|
14
|
-
type ToggleContainerProps,
|
|
15
|
-
} from '@dxos/react-ui-components';
|
|
16
|
-
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
17
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
18
|
-
import { safeParseJson } from '@dxos/util';
|
|
19
|
-
|
|
20
|
-
import { ToolBlock, isToolMessage } from './ToolInvocations';
|
|
21
|
-
import { ToolboxContainer } from '../Toolbox';
|
|
22
|
-
|
|
23
|
-
const panelClassNames = 'flex flex-col w-full px-2 bg-groupSurface rounded-md';
|
|
24
|
-
const userClassNames = 'bg-[--user-fill]';
|
|
25
|
-
|
|
26
|
-
const ToggleContainer = (props: ToggleContainerProps) => {
|
|
27
|
-
return <NativeToggleContainer {...props} classNames={mx(panelClassNames, props.classNames)} />;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const MessageContainer = ({ children, classNames, user }: ThemedClassName<PropsWithChildren<{ user?: boolean }>>) => {
|
|
31
|
-
if (!children) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<div role='list-item' className={mx('flex w-full', user && 'justify-end', classNames)}>
|
|
37
|
-
<div className={mx(user ? ['px-2 py-1 rounded-md', userClassNames] : 'w-full')}>{children}</div>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type ThreadMessageProps = ThemedClassName<{
|
|
43
|
-
space?: Space;
|
|
44
|
-
message: Message;
|
|
45
|
-
debug?: boolean;
|
|
46
|
-
onPrompt?: (text: string) => void;
|
|
47
|
-
onDelete?: (id: string) => void;
|
|
48
|
-
}>;
|
|
49
|
-
|
|
50
|
-
export const ThreadMessage: FC<ThreadMessageProps> = ({ classNames, space, message, onPrompt }) => {
|
|
51
|
-
const { role, content = [] } = message;
|
|
52
|
-
|
|
53
|
-
// TODO(burdon): Restructure types to make check unnecessary.
|
|
54
|
-
if (isToolMessage(message)) {
|
|
55
|
-
return (
|
|
56
|
-
<MessageContainer classNames={classNames}>
|
|
57
|
-
<ToolBlock space={space} classNames={panelClassNames} message={message} />
|
|
58
|
-
</MessageContainer>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return content.map((block, idx) => {
|
|
63
|
-
// TODO(burdon): Filter empty messages.
|
|
64
|
-
if (block.type === 'text' && block.text.replaceAll(/\s+/g, '').length === 0) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const Component = components[block.type] ?? components.default;
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<MessageContainer key={idx} classNames={classNames} user={block.type === 'text' && role === 'user'}>
|
|
72
|
-
<Component space={space} block={block} onPrompt={onPrompt} />
|
|
73
|
-
</MessageContainer>
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type BlockComponent = FC<{ space?: Space; block: MessageContentBlock; onPrompt?: (text: string) => void }>;
|
|
79
|
-
|
|
80
|
-
const components: Record<string, BlockComponent> = {
|
|
81
|
-
//
|
|
82
|
-
// Text
|
|
83
|
-
//
|
|
84
|
-
['text' as const]: ({ block }) => {
|
|
85
|
-
invariant(block.type === 'text');
|
|
86
|
-
// const [open, setOpen] = useState(block.disposition === 'cot' && block.pending);
|
|
87
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
88
|
-
if (!title) {
|
|
89
|
-
return <MarkdownViewer content={block.text} />;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// TOOD(burdon): Store last time user opened/closed COT.
|
|
93
|
-
// Autoclose when streaming ends.
|
|
94
|
-
// useEffect(() => {
|
|
95
|
-
// if (block.disposition === 'cot' && !block.pending) {
|
|
96
|
-
// setOpen(false);
|
|
97
|
-
// }
|
|
98
|
-
// }, [block.disposition, block.pending]);
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<ToggleContainer
|
|
102
|
-
// open={open}
|
|
103
|
-
defaultOpen={block.disposition === 'cot' && block.pending}
|
|
104
|
-
title={title}
|
|
105
|
-
icon={
|
|
106
|
-
block.pending ? (
|
|
107
|
-
<Icon icon={'ph--circle-notch--regular'} classNames='text-subdued ml-2 animate-spin' size={4} />
|
|
108
|
-
) : undefined
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
<MarkdownViewer
|
|
112
|
-
content={block.text}
|
|
113
|
-
classNames={['pbe-2', block.disposition === 'cot' && 'text-sm text-subdued']}
|
|
114
|
-
/>
|
|
115
|
-
</ToggleContainer>
|
|
116
|
-
);
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
// JSON
|
|
121
|
-
//
|
|
122
|
-
['json' as const]: ({ space, block, onPrompt }) => {
|
|
123
|
-
invariant(block.type === 'json');
|
|
124
|
-
|
|
125
|
-
switch (block.disposition) {
|
|
126
|
-
case 'tool_list': {
|
|
127
|
-
return (
|
|
128
|
-
<ToggleContainer title={titles[block.disposition]} defaultOpen={true}>
|
|
129
|
-
<ToolboxContainer space={space} classNames='pbe-2' />
|
|
130
|
-
</ToggleContainer>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
case 'suggest': {
|
|
135
|
-
const { text = '' }: { text: string } = safeParseJson(block.json ?? '{}') ?? ({} as any);
|
|
136
|
-
return <IconButton icon='ph--lightning--regular' label={text} onClick={() => onPrompt?.(text)} />;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
case 'select': {
|
|
140
|
-
const { options = [] }: { options: string[] } = safeParseJson(block.json ?? '{}') ?? ({} as any);
|
|
141
|
-
return (
|
|
142
|
-
<ButtonGroup>
|
|
143
|
-
{options.map((option) => (
|
|
144
|
-
<Button key={option} onClick={() => onPrompt?.(option)}>
|
|
145
|
-
{option}
|
|
146
|
-
</Button>
|
|
147
|
-
))}
|
|
148
|
-
</ButtonGroup>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
default: {
|
|
153
|
-
const title = block.disposition ? titles[block.disposition] : undefined;
|
|
154
|
-
return (
|
|
155
|
-
<ToggleContainer title={title ?? 'JSON'}>
|
|
156
|
-
<Json data={safeParseJson(block.json ?? block)} classNames='!p-1 text-xs' />
|
|
157
|
-
</ToggleContainer>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
//
|
|
164
|
-
// Default
|
|
165
|
-
//
|
|
166
|
-
default: ({ block }) => {
|
|
167
|
-
let title = titles[block.type];
|
|
168
|
-
if (block.type === 'tool_use') {
|
|
169
|
-
title = `Tool [${block.name}]`; // TODO(burdon): Get label from tool.
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<ToggleContainer title={title ?? 'JSON'}>
|
|
174
|
-
<Json data={block} classNames='!p-1 text-xs' />
|
|
175
|
-
</ToggleContainer>
|
|
176
|
-
);
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
// TODO(burdon): Translations.
|
|
181
|
-
const titles: Record<string, string> = {
|
|
182
|
-
['cot' as const]: 'Chain of thought',
|
|
183
|
-
['artifact' as const]: 'Artifact',
|
|
184
|
-
['tool_use' as const]: 'Tool request',
|
|
185
|
-
['tool_result' as const]: 'Tool result',
|
|
186
|
-
['tool_list' as const]: 'Tools',
|
|
187
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Message, type MessageContentBlock } from '@dxos/artifact';
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
import { type ThemedClassName } from '@dxos/react-ui';
|
|
10
|
-
import { NumericTabs, StatusRoll, ToggleContainer } from '@dxos/react-ui-components';
|
|
11
|
-
import { Json } from '@dxos/react-ui-syntax-highlighter';
|
|
12
|
-
import { isNonNullable, isNotFalsy } from '@dxos/util';
|
|
13
|
-
|
|
14
|
-
import { type ThreadMessageProps } from './ThreadMessage';
|
|
15
|
-
|
|
16
|
-
export const isToolMessage = (message: Message) => {
|
|
17
|
-
return message.content.some((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const ToolBlock: FC<ThemedClassName<ThreadMessageProps>> = ({ classNames, message }) => {
|
|
21
|
-
const { content = [] } = message;
|
|
22
|
-
|
|
23
|
-
let request: (MessageContentBlock & { type: 'tool_use' }) | undefined;
|
|
24
|
-
const blocks = content.filter((block) => block.type === 'tool_use' || block.type === 'tool_result');
|
|
25
|
-
const items = blocks
|
|
26
|
-
.map((block, i) => {
|
|
27
|
-
switch (block.type) {
|
|
28
|
-
case 'tool_use': {
|
|
29
|
-
// TODO(burdon): Skip these updates?
|
|
30
|
-
if (block.id === request?.id && block.pending) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
request = block;
|
|
35
|
-
// TODO(burdon): Get plugin name.
|
|
36
|
-
return { title: `Calling ${block.name}...`, block };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
case 'tool_result': {
|
|
40
|
-
if (!request) {
|
|
41
|
-
log.warn('unexpected message', { block });
|
|
42
|
-
return { title: 'Error', block };
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return { title: `Processed ${request.name}`, block };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
default: {
|
|
49
|
-
request = undefined;
|
|
50
|
-
return { title: 'Error', block };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
.filter(isNonNullable);
|
|
55
|
-
|
|
56
|
-
return <ToolContainer classNames={classNames} items={items} />;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const ToolContainer: FC<ThemedClassName<{ items: { title: string; block: any }[] }>> = ({
|
|
60
|
-
classNames,
|
|
61
|
-
items,
|
|
62
|
-
}) => {
|
|
63
|
-
const tabsRef = useRef<HTMLDivElement>(null);
|
|
64
|
-
const [selected, setSelected] = useState(0);
|
|
65
|
-
const [open, setOpen] = useState(false);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (open) {
|
|
68
|
-
tabsRef.current?.focus();
|
|
69
|
-
}
|
|
70
|
-
}, [open]);
|
|
71
|
-
|
|
72
|
-
const handleSelect = (index: number) => {
|
|
73
|
-
if (index === selected) {
|
|
74
|
-
setOpen(false);
|
|
75
|
-
} else {
|
|
76
|
-
setSelected(index);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const title = useMemo(() => {
|
|
81
|
-
const lines = items.map((item) => item.title).filter(isNotFalsy);
|
|
82
|
-
return <StatusRoll key='status-roll' lines={lines} autoAdvance />;
|
|
83
|
-
}, [items]);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<ToggleContainer classNames={['flex flex-col', classNames]} title={title} open={open} onChangeOpen={setOpen}>
|
|
87
|
-
<div className='grid grid-cols-[32px_1fr]'>
|
|
88
|
-
<NumericTabs ref={tabsRef} length={items.length} selected={selected} onSelect={handleSelect} />
|
|
89
|
-
<Json data={items[selected].block} classNames='!p-1 text-xs' />
|
|
90
|
-
</div>
|
|
91
|
-
</ToggleContainer>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Message } from '@dxos/artifact';
|
|
6
|
-
|
|
7
|
-
// TODO(burdon): Move to util?
|
|
8
|
-
type Reducer<R, I> = (acc: R, value: I) => R;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Reducer that collapses related message blocks into single messages.
|
|
12
|
-
* For example, combines tool request/response pairs into a single message.
|
|
13
|
-
*/
|
|
14
|
-
export const messageReducer: Reducer<{ messages: Message[]; current?: Message }, Message> = (
|
|
15
|
-
{ current, messages },
|
|
16
|
-
message,
|
|
17
|
-
) => {
|
|
18
|
-
let i = 0;
|
|
19
|
-
for (const block of message.content) {
|
|
20
|
-
switch (block.type) {
|
|
21
|
-
case 'tool_use':
|
|
22
|
-
case 'tool_result': {
|
|
23
|
-
if (current) {
|
|
24
|
-
current.content.push(block);
|
|
25
|
-
} else {
|
|
26
|
-
current = {
|
|
27
|
-
id: [message.id, i].join('_'),
|
|
28
|
-
role: message.role,
|
|
29
|
-
content: [block],
|
|
30
|
-
};
|
|
31
|
-
messages.push(current);
|
|
32
|
-
}
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
case 'text':
|
|
37
|
-
default: {
|
|
38
|
-
current = undefined;
|
|
39
|
-
messages.push({
|
|
40
|
-
id: [message.id, i].join('_'),
|
|
41
|
-
role: message.role,
|
|
42
|
-
content: [block],
|
|
43
|
-
});
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
i++;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return { current, messages };
|
|
52
|
-
};
|