@dxos/plugin-automation 0.7.5-main.9d2a38b → 0.7.5-main.b19bfc8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/AssistantDialog-V67OWLRP.mjs +116 -0
- package/dist/lib/browser/AssistantDialog-V67OWLRP.mjs.map +7 -0
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs +8 -0
- package/dist/lib/browser/AutomationPanel-NCKK3CFN.mjs.map +7 -0
- package/dist/lib/browser/ChatContainer-5BS6THNV.mjs +33 -0
- package/dist/lib/browser/ChatContainer-5BS6THNV.mjs.map +7 -0
- package/dist/lib/browser/TemplateContainer-HJJV44CE.mjs +23 -0
- package/dist/lib/browser/TemplateContainer-HJJV44CE.mjs.map +7 -0
- package/dist/lib/browser/ai-client-T2PBJISL.mjs +22 -0
- package/dist/lib/browser/ai-client-T2PBJISL.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-IR3CGVM6.mjs +110 -0
- package/dist/lib/browser/app-graph-builder-IR3CGVM6.mjs.map +7 -0
- package/dist/lib/browser/chunk-62E2AEXF.mjs +162 -0
- package/dist/lib/browser/chunk-62E2AEXF.mjs.map +7 -0
- package/dist/lib/browser/chunk-67KDIIM6.mjs +15 -0
- package/dist/lib/browser/chunk-67KDIIM6.mjs.map +7 -0
- package/dist/lib/browser/chunk-BQ4WHY4D.mjs +1818 -0
- package/dist/lib/browser/chunk-BQ4WHY4D.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HKX3D3ZP.mjs → chunk-HZSTXZWK.mjs} +4 -2
- package/dist/lib/browser/chunk-HZSTXZWK.mjs.map +7 -0
- package/dist/lib/{node-esm/AutomationPanel-R3D6CRF5.mjs → browser/chunk-LJ7F4KDM.mjs} +31 -21
- package/dist/lib/browser/chunk-LJ7F4KDM.mjs.map +7 -0
- package/dist/lib/browser/chunk-QH5E22EL.mjs +108 -0
- package/dist/lib/browser/chunk-QH5E22EL.mjs.map +7 -0
- package/dist/lib/browser/chunk-XAIWETH6.mjs +81 -0
- package/dist/lib/browser/chunk-XAIWETH6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +163 -273
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-ICLE6FSI.mjs +44 -0
- package/dist/lib/browser/intent-resolver-ICLE6FSI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-KEKVLCPQ.mjs +80 -0
- package/dist/lib/browser/react-surface-KEKVLCPQ.mjs.map +7 -0
- package/dist/lib/browser/settings-FE5DDWOE.mjs +22 -0
- package/dist/lib/browser/settings-FE5DDWOE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +20 -9
- package/dist/lib/node/AssistantDialog-E62O72KI.cjs +140 -0
- package/dist/lib/node/AssistantDialog-E62O72KI.cjs.map +7 -0
- package/dist/lib/node/AutomationPanel-6COLKRIB.cjs +26 -0
- package/dist/lib/node/AutomationPanel-6COLKRIB.cjs.map +7 -0
- package/dist/lib/node/{react-surface-DVAU4MGD.cjs → ChatContainer-4QTLL7TH.cjs} +30 -26
- package/dist/lib/node/ChatContainer-4QTLL7TH.cjs.map +7 -0
- package/dist/lib/node/{chunk-25AQIF3L.cjs → TemplateContainer-3YCM6XPU.cjs} +21 -11
- package/dist/lib/node/TemplateContainer-3YCM6XPU.cjs.map +7 -0
- package/dist/lib/node/ai-client-L5GUSAER.cjs +38 -0
- package/dist/lib/node/ai-client-L5GUSAER.cjs.map +7 -0
- package/dist/lib/node/app-graph-builder-ECNVGTRT.cjs +122 -0
- package/dist/lib/node/app-graph-builder-ECNVGTRT.cjs.map +7 -0
- package/dist/lib/node/chunk-3QSK6IPK.cjs +133 -0
- package/dist/lib/node/chunk-3QSK6IPK.cjs.map +7 -0
- package/dist/lib/node/chunk-76F5BCJE.cjs +111 -0
- package/dist/lib/node/chunk-76F5BCJE.cjs.map +7 -0
- package/dist/lib/node/chunk-B37JIAOP.cjs +1795 -0
- package/dist/lib/node/chunk-B37JIAOP.cjs.map +7 -0
- package/dist/lib/node/{chunk-5VF5JKUN.cjs → chunk-BAQRBGOJ.cjs} +8 -5
- package/dist/lib/node/chunk-BAQRBGOJ.cjs.map +7 -0
- package/dist/lib/node/chunk-UVWK2XJE.cjs +183 -0
- package/dist/lib/node/chunk-UVWK2XJE.cjs.map +7 -0
- package/dist/lib/node/{AutomationPanel-PPODB5XA.cjs → chunk-V4L7LTWM.cjs} +39 -24
- package/dist/lib/node/chunk-V4L7LTWM.cjs.map +7 -0
- package/dist/lib/node/chunk-VNBYGJ4K.cjs +34 -0
- package/dist/lib/node/chunk-VNBYGJ4K.cjs.map +7 -0
- package/dist/lib/node/index.cjs +166 -292
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-4MQZULXW.cjs +58 -0
- package/dist/lib/node/intent-resolver-4MQZULXW.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-4RVHY6WI.cjs +95 -0
- package/dist/lib/node/react-surface-4RVHY6WI.cjs.map +7 -0
- package/dist/lib/node/settings-GOIB2WJQ.cjs +36 -0
- package/dist/lib/node/settings-GOIB2WJQ.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +20 -9
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/AssistantDialog-IPRBJKWA.mjs +117 -0
- package/dist/lib/node-esm/AssistantDialog-IPRBJKWA.mjs.map +7 -0
- package/dist/lib/node-esm/AutomationPanel-3MPIAO7R.mjs +9 -0
- package/dist/lib/node-esm/AutomationPanel-3MPIAO7R.mjs.map +7 -0
- package/dist/lib/node-esm/ChatContainer-4IWUGMGM.mjs +34 -0
- package/dist/lib/node-esm/ChatContainer-4IWUGMGM.mjs.map +7 -0
- package/dist/lib/node-esm/TemplateContainer-YJIXR24Z.mjs +24 -0
- package/dist/lib/node-esm/TemplateContainer-YJIXR24Z.mjs.map +7 -0
- package/dist/lib/node-esm/ai-client-45LZLW7V.mjs +23 -0
- package/dist/lib/node-esm/ai-client-45LZLW7V.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-HMRKSZ2X.mjs +111 -0
- package/dist/lib/node-esm/app-graph-builder-HMRKSZ2X.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5BKKHYO5.mjs +163 -0
- package/dist/lib/node-esm/chunk-5BKKHYO5.mjs.map +7 -0
- package/dist/lib/{browser/AutomationPanel-IHZ4JKVS.mjs → node-esm/chunk-AWAU4BHR.mjs} +32 -20
- package/dist/lib/node-esm/chunk-AWAU4BHR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CAWPHOY4.mjs +82 -0
- package/dist/lib/node-esm/chunk-CAWPHOY4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-I32H7MCF.mjs +109 -0
- package/dist/lib/node-esm/chunk-I32H7MCF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-X3LPRWIL.mjs → chunk-IG4GSWZN.mjs} +4 -2
- package/dist/lib/node-esm/chunk-IG4GSWZN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QHKP5HT2.mjs +1819 -0
- package/dist/lib/node-esm/chunk-QHKP5HT2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SS7U6GCX.mjs +16 -0
- package/dist/lib/node-esm/chunk-SS7U6GCX.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +163 -273
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-ZS7XTYLG.mjs +45 -0
- package/dist/lib/node-esm/intent-resolver-ZS7XTYLG.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-5ILD642V.mjs +81 -0
- package/dist/lib/node-esm/react-surface-5ILD642V.mjs.map +7 -0
- package/dist/lib/node-esm/settings-ANNQPPRY.mjs +23 -0
- package/dist/lib/node-esm/settings-ANNQPPRY.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +20 -9
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/ai-client.d.ts +5 -0
- package/dist/types/src/capabilities/ai-client.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +111 -110
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +117 -113
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts +7 -0
- package/dist/types/src/components/AmbientDialog/AmbientDialog.d.ts.map +1 -0
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts +8 -0
- package/dist/types/src/components/AmbientDialog/AmbientDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/AmbientDialog/index.d.ts +2 -0
- package/dist/types/src/components/AmbientDialog/index.d.ts.map +1 -0
- package/dist/types/src/components/AssistantDialog.d.ts +7 -0
- package/dist/types/src/components/AssistantDialog.d.ts.map +1 -0
- 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/AutomationSettings/AutomationSettings.d.ts +5 -0
- package/dist/types/src/components/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/components/AutomationSettings/index.d.ts +2 -0
- package/dist/types/src/components/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/ChatContainer.d.ts +7 -0
- package/dist/types/src/components/ChatContainer.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/Prompt.d.ts +17 -0
- package/dist/types/src/components/Prompt/Prompt.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts +9 -0
- package/dist/types/src/components/Prompt/Prompt.stories.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/PromptBar.d.ts +10 -0
- package/dist/types/src/components/Prompt/PromptBar.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/autocomplete.d.ts +21 -0
- package/dist/types/src/components/Prompt/autocomplete.d.ts.map +1 -0
- package/dist/types/src/components/Prompt/index.d.ts +3 -0
- package/dist/types/src/components/Prompt/index.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts +5 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts +8 -0
- package/dist/types/src/components/ServiceRegistry/ServiceRegistry.stories.d.ts.map +1 -0
- package/dist/types/src/components/ServiceRegistry/index.d.ts +2 -0
- package/dist/types/src/components/ServiceRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts +7 -0
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +12 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/TemplateEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts +10 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts +8 -0
- package/dist/types/src/components/TemplateEditor/TemplateForm.stories.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/index.d.ts +2 -0
- package/dist/types/src/components/TemplateEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/TemplateEditor/types.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Thread.d.ts +17 -0
- package/dist/types/src/components/Thread/Thread.d.ts.map +1 -0
- package/dist/types/src/components/Thread/Thread.stories.d.ts +11 -0
- package/dist/types/src/components/Thread/Thread.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ThreadContainer.d.ts +10 -0
- package/dist/types/src/components/Thread/ThreadContainer.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts +15 -0
- package/dist/types/src/components/Thread/ThreadContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ThreadMessage.d.ts +13 -0
- package/dist/types/src/components/Thread/ThreadMessage.d.ts.map +1 -0
- package/dist/types/src/components/Thread/ToolInvocations.d.ts +13 -0
- package/dist/types/src/components/Thread/ToolInvocations.d.ts.map +1 -0
- package/dist/types/src/components/Thread/index.d.ts +3 -0
- package/dist/types/src/components/Thread/index.d.ts.map +1 -0
- package/dist/types/src/components/Thread/reducer.d.ts +12 -0
- package/dist/types/src/components/Thread/reducer.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts +19 -0
- package/dist/types/src/components/Toolbox/Toolbox.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts +8 -0
- package/dist/types/src/components/Toolbox/Toolbox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toolbox/index.d.ts +2 -0
- package/dist/types/src/components/Toolbox/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +19 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/processor.d.ts +75 -0
- package/dist/types/src/hooks/processor.d.ts.map +1 -0
- package/dist/types/src/hooks/processor.test.d.ts +2 -0
- package/dist/types/src/hooks/processor.test.d.ts.map +1 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts +8 -0
- package/dist/types/src/hooks/useChatProcessor.d.ts.map +1 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts +41 -0
- package/dist/types/src/hooks/useMessageQueue.d.ts.map +1 -0
- package/dist/types/src/hooks/useServices.d.ts +7 -0
- package/dist/types/src/hooks/useServices.d.ts.map +1 -0
- package/dist/types/src/hooks/useTextInputEvents.d.ts +13 -0
- package/dist/types/src/hooks/useTextInputEvents.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/{testing.d.ts → test-functions.d.ts} +3 -1
- package/dist/types/src/testing/test-functions.d.ts.map +1 -0
- package/dist/types/src/testing/test-services.d.ts +5 -0
- package/dist/types/src/testing/test-services.d.ts.map +1 -0
- package/dist/types/src/tools/function.d.ts +5 -0
- package/dist/types/src/tools/function.d.ts.map +1 -0
- package/dist/types/src/tools/index.d.ts +3 -0
- package/dist/types/src/tools/index.d.ts.map +1 -0
- package/dist/types/src/tools/openapi.d.ts +10 -0
- package/dist/types/src/tools/openapi.d.ts.map +1 -0
- package/dist/types/src/tools/openapi.test.d.ts +2 -0
- package/dist/types/src/tools/openapi.test.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +110 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/chat.d.ts +12 -0
- package/dist/types/src/types/chat.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/service.d.ts +160 -0
- package/dist/types/src/types/service.d.ts.map +1 -0
- package/dist/types/src/types/template.d.ts +40 -0
- package/dist/types/src/types/template.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +37 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/package.json +62 -40
- package/src/AutomationPlugin.tsx +68 -21
- package/src/capabilities/ai-client.ts +19 -0
- package/src/capabilities/app-graph-builder.ts +82 -110
- package/src/capabilities/capabilities.ts +12 -0
- package/src/capabilities/index.ts +5 -0
- package/src/capabilities/intent-resolver.ts +38 -0
- package/src/capabilities/react-surface.tsx +42 -6
- package/src/capabilities/settings.ts +19 -0
- package/src/components/AmbientDialog/AmbientDialog.stories.tsx +81 -0
- package/src/components/AmbientDialog/AmbientDialog.tsx +103 -0
- package/src/components/AmbientDialog/index.ts +5 -0
- package/src/components/AssistantDialog.tsx +33 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +2 -2
- package/src/components/AutomationSettings/AutomationSettings.tsx +49 -0
- package/src/components/AutomationSettings/index.ts +5 -0
- package/src/components/ChatContainer.tsx +29 -0
- package/src/components/Prompt/Prompt.stories.tsx +79 -0
- package/src/components/Prompt/Prompt.tsx +100 -0
- package/src/components/Prompt/PromptBar.tsx +100 -0
- package/src/components/Prompt/autocomplete.ts +212 -0
- package/src/components/Prompt/index.ts +6 -0
- package/src/components/ServiceRegistry/ServiceRegistry.stories.tsx +49 -0
- package/src/components/ServiceRegistry/ServiceRegistry.tsx +76 -0
- package/src/components/ServiceRegistry/index.ts +5 -0
- package/src/components/TemplateContainer.tsx +21 -0
- package/src/components/TemplateEditor/TemplateEditor.stories.tsx +72 -0
- package/src/components/TemplateEditor/TemplateEditor.tsx +76 -0
- package/src/components/TemplateEditor/TemplateForm.stories.tsx +65 -0
- package/src/components/TemplateEditor/TemplateForm.tsx +184 -0
- package/src/components/{PromptEditor → TemplateEditor}/index.ts +1 -1
- package/src/components/Thread/Thread.stories.tsx +212 -0
- package/src/components/Thread/Thread.tsx +97 -0
- package/src/components/Thread/ThreadContainer.stories.tsx +258 -0
- package/src/components/Thread/ThreadContainer.tsx +78 -0
- package/src/components/Thread/ThreadMessage.tsx +187 -0
- package/src/components/Thread/ToolInvocations.tsx +93 -0
- package/src/components/Thread/index.ts +6 -0
- package/src/components/Thread/reducer.ts +52 -0
- package/src/components/Toolbox/Toolbox.stories.tsx +65 -0
- package/src/components/Toolbox/Toolbox.tsx +117 -0
- package/src/components/Toolbox/index.ts +5 -0
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +2 -2
- package/src/components/TriggerEditor/TriggerEditor.tsx +25 -18
- package/src/components/index.ts +11 -1
- package/src/hooks/index.ts +6 -0
- package/src/hooks/processor.test.ts +15 -0
- package/src/hooks/processor.ts +219 -0
- package/src/hooks/useChatProcessor.tsx +77 -0
- package/src/hooks/useMessageQueue.ts +23 -0
- package/src/hooks/useServices.ts +28 -0
- package/src/hooks/useTextInputEvents.ts +49 -0
- package/src/index.ts +2 -2
- package/src/meta.ts +4 -1
- package/src/testing/index.ts +2 -1
- package/src/testing/{testing.ts → test-functions.ts} +9 -2
- package/src/testing/test-services.ts +131 -0
- package/src/tools/function.ts +47 -0
- package/src/tools/index.ts +6 -0
- package/src/tools/openapi.test.ts +224 -0
- package/src/tools/openapi.ts +331 -0
- package/src/translations.ts +27 -2
- package/src/types/chat.ts +11 -0
- package/src/types/index.ts +4 -1
- package/src/types/service.ts +102 -0
- package/src/types/template.ts +34 -0
- package/src/types/types.ts +41 -0
- package/src/typings.d.ts +9 -0
- package/dist/lib/browser/AssistantPanel-N276BTPV.mjs +0 -339
- package/dist/lib/browser/AssistantPanel-N276BTPV.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-IHZ4JKVS.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-IJTTULDP.mjs +0 -131
- package/dist/lib/browser/app-graph-builder-IJTTULDP.mjs.map +0 -7
- package/dist/lib/browser/chunk-4AIMDHKY.mjs +0 -10
- package/dist/lib/browser/chunk-4AIMDHKY.mjs.map +0 -7
- package/dist/lib/browser/chunk-DL6LB2NI.mjs +0 -43
- package/dist/lib/browser/chunk-DL6LB2NI.mjs.map +0 -7
- package/dist/lib/browser/chunk-HKX3D3ZP.mjs.map +0 -7
- package/dist/lib/browser/react-surface-LL72F3F4.mjs +0 -34
- package/dist/lib/browser/react-surface-LL72F3F4.mjs.map +0 -7
- package/dist/lib/node/AssistantPanel-Z4GVHUF3.cjs +0 -359
- package/dist/lib/node/AssistantPanel-Z4GVHUF3.cjs.map +0 -7
- package/dist/lib/node/AutomationPanel-PPODB5XA.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-MF5M4QRS.cjs +0 -147
- package/dist/lib/node/app-graph-builder-MF5M4QRS.cjs.map +0 -7
- package/dist/lib/node/chunk-25AQIF3L.cjs.map +0 -7
- package/dist/lib/node/chunk-5VF5JKUN.cjs.map +0 -7
- package/dist/lib/node/chunk-JNDMZQH7.cjs +0 -68
- package/dist/lib/node/chunk-JNDMZQH7.cjs.map +0 -7
- package/dist/lib/node/react-surface-DVAU4MGD.cjs.map +0 -7
- package/dist/lib/node-esm/AssistantPanel-DDCQHBJX.mjs +0 -340
- package/dist/lib/node-esm/AssistantPanel-DDCQHBJX.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-R3D6CRF5.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-5N7OK23B.mjs +0 -132
- package/dist/lib/node-esm/app-graph-builder-5N7OK23B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GIAYUM5I.mjs +0 -45
- package/dist/lib/node-esm/chunk-GIAYUM5I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X3LPRWIL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XW7TEQA3.mjs +0 -12
- package/dist/lib/node-esm/chunk-XW7TEQA3.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-4BED2PZ4.mjs +0 -35
- package/dist/lib/node-esm/react-surface-4BED2PZ4.mjs.map +0 -7
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts +0 -8
- package/dist/types/src/components/AssistantPanel/AssistantPanel.d.ts.map +0 -1
- package/dist/types/src/components/AssistantPanel/index.d.ts +0 -3
- package/dist/types/src/components/AssistantPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts +0 -6
- package/dist/types/src/components/AssistantPanel/system-instructions.d.ts.map +0 -1
- package/dist/types/src/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.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/testing.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -63
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/components/AssistantPanel/AssistantPanel.tsx +0 -230
- package/src/components/AssistantPanel/index.ts +0 -7
- package/src/components/AssistantPanel/system-instructions.ts +0 -166
- package/src/components/PromptEditor/PromptEditor.stories.tsx +0 -64
- package/src/components/PromptEditor/PromptEditor.tsx +0 -222
- package/src/components/PromptEditor/prompt-extension.ts +0 -43
- package/src/presets.ts +0 -248
- package/src/types/schema.ts +0 -38
- /package/dist/types/src/components/{PromptEditor → TemplateEditor}/types.d.ts +0 -0
- /package/src/components/{PromptEditor → TemplateEditor}/types.tsx +0 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import jsonpointer from 'jsonpointer';
|
|
6
|
+
import { type OpenAPIV2, type OpenAPIV3_1 } from 'openapi-types';
|
|
7
|
+
|
|
8
|
+
import { ToolResult, type Tool } from '@dxos/artifact';
|
|
9
|
+
import { JsonSchemaType, normalizeSchema, S, toEffectSchema } from '@dxos/echo-schema';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { log } from '@dxos/log';
|
|
12
|
+
import { deepMapValues } from '@dxos/util';
|
|
13
|
+
|
|
14
|
+
import type { ApiAuthorization, ServiceType } from '../types';
|
|
15
|
+
|
|
16
|
+
export type CreateToolsFromApiOptions = {
|
|
17
|
+
authorization?: ApiAuthorization;
|
|
18
|
+
instructions?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const createToolsFromService = async (service: ServiceType): Promise<Tool[]> => {
|
|
22
|
+
invariant(service.interfaces?.length === 1 && service.interfaces[0].kind === 'api');
|
|
23
|
+
const iface = service.interfaces[0];
|
|
24
|
+
invariant(iface.schemaUrl);
|
|
25
|
+
invariant(iface.schemaUrl);
|
|
26
|
+
return createToolsFromApi(iface.schemaUrl, { authorization: iface.authorization });
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const createToolsFromApi = async (url: string, options?: CreateToolsFromApiOptions): Promise<Tool[]> => {
|
|
30
|
+
const res = await fetch(url);
|
|
31
|
+
const spec = (await res.json()) as OpenAPIV2.Document;
|
|
32
|
+
log('spec', { spec });
|
|
33
|
+
|
|
34
|
+
const tools: Tool[] = [];
|
|
35
|
+
for (const [path, pathItem] of Object.entries(spec.paths)) {
|
|
36
|
+
if (typeof pathItem !== 'object') {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// TODO(burdon): ???
|
|
41
|
+
const { ...methods } = pathItem;
|
|
42
|
+
for (const [method, m] of Object.entries(methods)) {
|
|
43
|
+
const methodItem: OpenAPIV2.OperationObject = m as OpenAPIV2.OperationObject;
|
|
44
|
+
log('methodItem', { path, method, methodItem });
|
|
45
|
+
|
|
46
|
+
const parametersResolved: OpenAPIV2.ParameterObject[] =
|
|
47
|
+
methodItem.parameters?.map((parameter: any) => {
|
|
48
|
+
const resolved = resolveJsonSchema(parameter, spec);
|
|
49
|
+
return resolved;
|
|
50
|
+
}) ?? [];
|
|
51
|
+
|
|
52
|
+
const inputSchema: JsonSchemaType = {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const endpointParameters: OpenAPIV2.ParameterObject[] = [];
|
|
58
|
+
for (const parameter of parametersResolved) {
|
|
59
|
+
log('parameter', { parameter });
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
options?.authorization?.type === 'api-key' &&
|
|
63
|
+
options.authorization.placement.type === 'query' &&
|
|
64
|
+
parameter.in === 'query' &&
|
|
65
|
+
parameter.name === options.authorization.placement.name
|
|
66
|
+
) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
endpointParameters.push(parameter);
|
|
71
|
+
|
|
72
|
+
if (parameter.schema) {
|
|
73
|
+
inputSchema.properties![parameter.name] = normalizeSchema(parameter.schema);
|
|
74
|
+
} else if (typeof parameter.type === 'string') {
|
|
75
|
+
const { name, in: _in, required, ...schema } = parameter;
|
|
76
|
+
inputSchema.properties![name] = normalizeSchema(schema);
|
|
77
|
+
if (required) {
|
|
78
|
+
inputSchema.required ??= [];
|
|
79
|
+
inputSchema.required!.push(name);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
log('inputSchema', { inputSchema });
|
|
85
|
+
S.validateSync(JsonSchemaType)(inputSchema);
|
|
86
|
+
|
|
87
|
+
const description = methodItem.description ?? methodItem.summary;
|
|
88
|
+
if (!description) {
|
|
89
|
+
log.warn('no description', { path, method });
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const endpoint: EndpointDescriptor = {
|
|
94
|
+
document: spec,
|
|
95
|
+
path,
|
|
96
|
+
method,
|
|
97
|
+
parameters: endpointParameters,
|
|
98
|
+
authorization: options?.authorization,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
tools.push({
|
|
102
|
+
name: getToolName(path, method, methodItem),
|
|
103
|
+
description: options?.instructions ? `${options.instructions}\n\n${description}` : description,
|
|
104
|
+
parameters: inputSchema,
|
|
105
|
+
execute: async (input) => {
|
|
106
|
+
const response = await callApiEndpoint(endpoint, input);
|
|
107
|
+
return ToolResult.Success(response);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return tools;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const getToolName = (path: string, method: string, methodItem: OpenAPIV2.OperationObject) => {
|
|
117
|
+
if (methodItem.operationId) {
|
|
118
|
+
return methodItem.operationId;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Generate a name from the path and method.
|
|
122
|
+
let name = `${method.toLowerCase()}_${path.replaceAll(/[{}/]/g, '_')}`;
|
|
123
|
+
while (name.length > MAX_TOOL_NAME_LENGTH) {
|
|
124
|
+
const lengthBefore = name.length;
|
|
125
|
+
|
|
126
|
+
for (const word of GENERIC_WORDS) {
|
|
127
|
+
if (name.includes(word)) {
|
|
128
|
+
name = name.replace(word, '');
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
name = name.replaceAll('__', '_').replace(/_$/, '');
|
|
133
|
+
|
|
134
|
+
const lengthAfter = name.length;
|
|
135
|
+
if (lengthBefore === lengthAfter) {
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
name = name.replaceAll('__', '_').replace(/_$/, '').replace(/^_/, '');
|
|
140
|
+
|
|
141
|
+
return name.slice(0, MAX_TOOL_NAME_LENGTH);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const MAX_TOOL_NAME_LENGTH = 64;
|
|
145
|
+
const GENERIC_WORDS = [
|
|
146
|
+
'services',
|
|
147
|
+
'service',
|
|
148
|
+
'api',
|
|
149
|
+
'rest',
|
|
150
|
+
'endpoint',
|
|
151
|
+
'get',
|
|
152
|
+
'post',
|
|
153
|
+
'put',
|
|
154
|
+
'delete',
|
|
155
|
+
'patch',
|
|
156
|
+
'head',
|
|
157
|
+
'options',
|
|
158
|
+
'trace',
|
|
159
|
+
'service',
|
|
160
|
+
'api',
|
|
161
|
+
'endpoint',
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
type EndpointDescriptor = {
|
|
165
|
+
document: OpenAPIV3_1.Document | OpenAPIV2.Document;
|
|
166
|
+
path: string;
|
|
167
|
+
method: string;
|
|
168
|
+
parameters: OpenAPIV2.ParameterObject[];
|
|
169
|
+
authorization?: ApiAuthorization;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const callApiEndpoint = async (endpoint: EndpointDescriptor, input: any) => {
|
|
173
|
+
log.info('endpoint', { method: endpoint.method, name: endpoint.path, input });
|
|
174
|
+
|
|
175
|
+
let url = getEndpointUrl(endpoint);
|
|
176
|
+
const request: RequestInit = {
|
|
177
|
+
method: endpoint.method,
|
|
178
|
+
headers: {},
|
|
179
|
+
};
|
|
180
|
+
const query = new URLSearchParams();
|
|
181
|
+
let body: any;
|
|
182
|
+
for (const parameter of endpoint.parameters) {
|
|
183
|
+
if (input[parameter.name] === undefined) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
switch (parameter.in) {
|
|
188
|
+
case 'header': {
|
|
189
|
+
if (parameter.example) {
|
|
190
|
+
(request.headers as any)[parameter.name] = parameter.default;
|
|
191
|
+
}
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case 'path': {
|
|
195
|
+
url = url.replace(`{${parameter.name}}`, encodeURIComponent(input[parameter.name]));
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case 'body': {
|
|
199
|
+
const value = input[parameter.name];
|
|
200
|
+
|
|
201
|
+
// Client-side validation
|
|
202
|
+
const effectSchema = toEffectSchema(parameter.schema);
|
|
203
|
+
S.validateSync(effectSchema)(value);
|
|
204
|
+
|
|
205
|
+
if (body) {
|
|
206
|
+
throw new Error(`Duplicate body parameter: ${parameter.name}`);
|
|
207
|
+
}
|
|
208
|
+
body = value;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case 'query': {
|
|
212
|
+
query.set(parameter.name, input[parameter.name]);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (
|
|
219
|
+
(endpoint.authorization?.type === 'api-key' && endpoint.authorization.placement.type === 'authorization-header') ||
|
|
220
|
+
endpoint.authorization?.type === 'oauth'
|
|
221
|
+
) {
|
|
222
|
+
(request.headers as any).Authorization = await resolveAuthorization(endpoint.authorization);
|
|
223
|
+
} else if (endpoint.authorization?.type === 'api-key' && endpoint.authorization.placement.type === 'query') {
|
|
224
|
+
query.set(endpoint.authorization.placement.name, endpoint.authorization.key);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (query.size > 0) {
|
|
228
|
+
url += `?${query.toString()}`;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (body) {
|
|
232
|
+
request.body = JSON.stringify(body);
|
|
233
|
+
(request.headers as any)['Content-Type'] = 'application/json';
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
log.info('request', { url, request });
|
|
237
|
+
const response = await fetch(url, request);
|
|
238
|
+
|
|
239
|
+
log.info('response', { ok: response.ok, status: response.status, statusText: response.statusText });
|
|
240
|
+
|
|
241
|
+
if (response.ok) {
|
|
242
|
+
const contentType = response.headers.get('Content-Type');
|
|
243
|
+
if (contentType?.includes('application/json')) {
|
|
244
|
+
return await response.json();
|
|
245
|
+
} else {
|
|
246
|
+
return await response.text();
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
if (response.headers.get('Content-Type')?.includes('application/json')) {
|
|
250
|
+
const responseBody = await response.text();
|
|
251
|
+
let error: any;
|
|
252
|
+
try {
|
|
253
|
+
error = JSON.parse(responseBody);
|
|
254
|
+
} catch {
|
|
255
|
+
error = responseBody;
|
|
256
|
+
}
|
|
257
|
+
log.error('error', { error });
|
|
258
|
+
throw new Error(error.message);
|
|
259
|
+
} else {
|
|
260
|
+
const error = await response.text();
|
|
261
|
+
log.error('error', { error });
|
|
262
|
+
throw new Error(error);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const getEndpointUrl = (endpoint: EndpointDescriptor) => {
|
|
268
|
+
let url = '';
|
|
269
|
+
if (isV3_1(endpoint.document) && endpoint.document.servers && endpoint.document.servers.length > 0) {
|
|
270
|
+
url = endpoint.document.servers[0].url;
|
|
271
|
+
} else {
|
|
272
|
+
invariant(!isV3_1(endpoint.document));
|
|
273
|
+
url = `${endpoint.document.schemes?.[0] ?? 'https'}://${endpoint.document.host}`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (!isV3_1(endpoint.document) && endpoint.document.basePath) {
|
|
277
|
+
url += endpoint.document.basePath;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
url += endpoint.path;
|
|
281
|
+
|
|
282
|
+
return url;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export const resolveAuthorization = async (authorization: ApiAuthorization): Promise<string> => {
|
|
286
|
+
switch (authorization.type) {
|
|
287
|
+
case 'api-key': {
|
|
288
|
+
invariant(authorization.placement.type === 'authorization-header');
|
|
289
|
+
return `Bearer ${authorization.key}`;
|
|
290
|
+
}
|
|
291
|
+
case 'oauth': {
|
|
292
|
+
const response = await fetch(authorization.tokenUrl, {
|
|
293
|
+
method: 'POST',
|
|
294
|
+
headers: {
|
|
295
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
296
|
+
},
|
|
297
|
+
body: `grant_type=${authorization.grantType}&client_id=${authorization.clientId}&client_secret=${authorization.clientSecret}`,
|
|
298
|
+
});
|
|
299
|
+
const data = await response.json();
|
|
300
|
+
return `Bearer ${data.access_token}`;
|
|
301
|
+
}
|
|
302
|
+
default: {
|
|
303
|
+
throw new Error(`Unknown authorization type: ${(authorization as any).type}`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Resolves all $ref properties in a JSON schema.
|
|
310
|
+
* Doesn't assume the structure of the schema.
|
|
311
|
+
* The function looks from $ref properties in the schema and resolves them to their values in the base object.
|
|
312
|
+
*/
|
|
313
|
+
const resolveJsonSchema = (schema: any, base: any) => {
|
|
314
|
+
return deepMapValues(schema, (value, recurse) => {
|
|
315
|
+
if (typeof value === 'object' && value !== null && '$ref' in value && typeof value.$ref === 'string') {
|
|
316
|
+
if (value.$ref.startsWith('#')) {
|
|
317
|
+
const resolved = jsonpointer.get(base, value.$ref.slice(1));
|
|
318
|
+
if (resolved) {
|
|
319
|
+
return recurse(resolved);
|
|
320
|
+
} else {
|
|
321
|
+
log.warn('unresolved', { ref: value.$ref, base });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return recurse(value);
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const isV3_1 = (document: OpenAPIV3_1.Document | OpenAPIV2.Document): document is OpenAPIV3_1.Document => {
|
|
330
|
+
return (document as any).openapi === '3.0.1';
|
|
331
|
+
};
|
package/src/translations.ts
CHANGED
|
@@ -3,11 +3,22 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { AUTOMATION_PLUGIN } from './meta';
|
|
6
|
+
import { AIChatType, TemplateType } from './types';
|
|
6
7
|
|
|
7
8
|
export default [
|
|
8
9
|
{
|
|
9
10
|
'en-US': {
|
|
11
|
+
[AIChatType.typename]: {
|
|
12
|
+
'typename label': 'AI Chat',
|
|
13
|
+
},
|
|
14
|
+
[TemplateType.typename]: {
|
|
15
|
+
'typename label': 'Template',
|
|
16
|
+
},
|
|
10
17
|
[AUTOMATION_PLUGIN]: {
|
|
18
|
+
'chat title placeholder': 'AI Chat',
|
|
19
|
+
'template title placeholder': 'Template',
|
|
20
|
+
|
|
21
|
+
'open ambient chat label': 'Open AI chat',
|
|
11
22
|
'plugin name': 'Automation',
|
|
12
23
|
'object placeholder': 'New prompt',
|
|
13
24
|
'create object label': 'Create prompt',
|
|
@@ -19,10 +30,18 @@ export default [
|
|
|
19
30
|
'select preset template placeholder': 'Select preset',
|
|
20
31
|
'open automation panel label': 'Show Automations',
|
|
21
32
|
'automation panel label': 'Automations',
|
|
33
|
+
'service registry label': 'Service Registry',
|
|
34
|
+
|
|
35
|
+
'assistant dialog title': 'Assistant',
|
|
36
|
+
'open assistant label': 'Open assistant',
|
|
37
|
+
|
|
38
|
+
'chat input placeholder': 'Ask a question...',
|
|
39
|
+
'chat stop': 'Cancel request.',
|
|
22
40
|
|
|
23
41
|
'function select label': 'Function',
|
|
24
42
|
'function select placeholder': 'Select function',
|
|
25
43
|
'function enabled': 'Enabled',
|
|
44
|
+
|
|
26
45
|
'trigger select label': 'Trigger',
|
|
27
46
|
'trigger select placeholder': 'Trigger type',
|
|
28
47
|
|
|
@@ -31,6 +50,7 @@ export default [
|
|
|
31
50
|
'trigger type websocket': 'Websocket',
|
|
32
51
|
'trigger type subscription': 'Subscription',
|
|
33
52
|
'trigger type email': 'Email',
|
|
53
|
+
'trigger type queue': 'Queue',
|
|
34
54
|
|
|
35
55
|
'trigger filter': 'Filter',
|
|
36
56
|
'trigger cron': 'Cron',
|
|
@@ -44,8 +64,13 @@ export default [
|
|
|
44
64
|
'trigger meta remove': 'Remove',
|
|
45
65
|
'trigger meta prop name placeholder': 'New meta property name',
|
|
46
66
|
|
|
47
|
-
'
|
|
48
|
-
'
|
|
67
|
+
'prompt placeholder': 'Ask a question...',
|
|
68
|
+
'microphone button': 'Click to speak',
|
|
69
|
+
'cancel processing button': 'Stop processing',
|
|
70
|
+
|
|
71
|
+
'settings custom prompts label': 'Custom prompts',
|
|
72
|
+
'settings llm model label': 'LLM model',
|
|
73
|
+
'settings default llm model label': 'Default Model',
|
|
49
74
|
},
|
|
50
75
|
},
|
|
51
76
|
},
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Expando, Ref, S, TypedObject } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
export class AIChatType extends TypedObject({ typename: 'dxos.org/type/AIChat', version: '0.1.0' })({
|
|
8
|
+
name: S.optional(S.String),
|
|
9
|
+
// TODO(wittjosiah): Should be a ref to a Queue.
|
|
10
|
+
queue: Ref(Expando),
|
|
11
|
+
}) {}
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ComputeGraph } from '@dxos/conductor';
|
|
6
|
+
import { Ref, S, TypedObject, type Ref$ } from '@dxos/echo-schema';
|
|
7
|
+
import { FunctionType } from '@dxos/functions';
|
|
8
|
+
|
|
9
|
+
const ApiAuthorizationKey = S.Struct({
|
|
10
|
+
type: S.Literal('api-key'),
|
|
11
|
+
key: S.String,
|
|
12
|
+
placement: S.Union(
|
|
13
|
+
S.Struct({
|
|
14
|
+
type: S.Literal('authorization-header'),
|
|
15
|
+
}),
|
|
16
|
+
S.Struct({
|
|
17
|
+
type: S.Literal('query'),
|
|
18
|
+
name: S.String,
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const ApiAuthorizationOauth = S.Struct({
|
|
24
|
+
type: S.Literal('oauth'),
|
|
25
|
+
clientId: S.String,
|
|
26
|
+
clientSecret: S.String,
|
|
27
|
+
tokenUrl: S.String,
|
|
28
|
+
grantType: S.String,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const ApiAuthorization = S.Union(ApiAuthorizationKey, ApiAuthorizationOauth);
|
|
32
|
+
export type ApiAuthorization = S.Schema.Type<typeof ApiAuthorization>;
|
|
33
|
+
|
|
34
|
+
const ServiceInterfaceFunction = S.Struct({
|
|
35
|
+
kind: S.Literal('function'),
|
|
36
|
+
fn: Ref(FunctionType) as Ref$<FunctionType>,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const ServiceInterfaceWorkflow = S.Struct({
|
|
40
|
+
kind: S.Literal('workflow'),
|
|
41
|
+
workflow: Ref(ComputeGraph) as Ref$<ComputeGraph>,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const ServiceInterfaceApi = S.Struct({
|
|
45
|
+
kind: S.Literal('api'),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* URL to fetch the openapi schema.
|
|
49
|
+
*/
|
|
50
|
+
schemaUrl: S.optional(S.String),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Inlined openapi schema.
|
|
54
|
+
*/
|
|
55
|
+
schema: S.optional(S.Any),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Authorization configuration if required.
|
|
59
|
+
*/
|
|
60
|
+
authorization: S.optional(ApiAuthorization),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const ServiceInterface = S.Union(ServiceInterfaceFunction, ServiceInterfaceWorkflow, ServiceInterfaceApi);
|
|
64
|
+
export type ServiceInterface = S.Schema.Type<typeof ServiceInterface>;
|
|
65
|
+
|
|
66
|
+
export class ServiceType extends TypedObject({ typename: 'dxos.org/type/ServiceType', version: '0.1.0' })({
|
|
67
|
+
serviceId: S.String,
|
|
68
|
+
name: S.optional(S.String),
|
|
69
|
+
description: S.optional(S.String),
|
|
70
|
+
category: S.optional(S.String),
|
|
71
|
+
enabled: S.optional(S.Boolean),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Entries exposed: functions, workflows, and APIs.
|
|
75
|
+
*/
|
|
76
|
+
interfaces: S.optional(S.Array(ServiceInterface)),
|
|
77
|
+
}) {}
|
|
78
|
+
|
|
79
|
+
//
|
|
80
|
+
// Service Registry
|
|
81
|
+
//
|
|
82
|
+
|
|
83
|
+
export type ServiceQuery = {
|
|
84
|
+
name?: string;
|
|
85
|
+
category?: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export interface BaseServiceRegistry {
|
|
89
|
+
queryServices(query?: ServiceQuery): Promise<ServiceType[]>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const categoryIcons: Record<string, string> = {
|
|
93
|
+
finance: 'ph--bank--regular',
|
|
94
|
+
health: 'ph--heart--regular',
|
|
95
|
+
geolocation: 'ph--globe-simple--regular',
|
|
96
|
+
education: 'ph--books--regular',
|
|
97
|
+
entertainment: 'ph--music-notes--regular',
|
|
98
|
+
shopping: 'ph--shopping-cart--regular',
|
|
99
|
+
travel: 'ph--airplane-takeoff--regular',
|
|
100
|
+
utilities: 'ph--lightning--regular',
|
|
101
|
+
weather: 'ph--cloud-rain--regular',
|
|
102
|
+
} as const;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { S, TypedObject } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
// TODO(burdon): Change to S.Literal (and discriminated union).
|
|
8
|
+
export enum TemplateInputType {
|
|
9
|
+
VALUE = 0,
|
|
10
|
+
PASS_THROUGH = 1,
|
|
11
|
+
RETRIEVER = 2,
|
|
12
|
+
FUNCTION = 3,
|
|
13
|
+
QUERY = 4,
|
|
14
|
+
RESOLVER = 5,
|
|
15
|
+
CONTEXT = 6,
|
|
16
|
+
SCHEMA = 7,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const TemplateInputSchema = S.mutable(
|
|
20
|
+
S.Struct({
|
|
21
|
+
name: S.String,
|
|
22
|
+
type: S.optional(S.Enums(TemplateInputType)),
|
|
23
|
+
value: S.optional(S.String),
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export type TemplateInput = S.Schema.Type<typeof TemplateInputSchema>;
|
|
28
|
+
|
|
29
|
+
export class TemplateType extends TypedObject({ typename: 'dxos.org/type/Template', version: '0.1.0' })({
|
|
30
|
+
name: S.optional(S.String),
|
|
31
|
+
source: S.String,
|
|
32
|
+
inputs: S.optional(S.mutable(S.Array(TemplateInputSchema))),
|
|
33
|
+
command: S.optional(S.String),
|
|
34
|
+
}) {}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { S } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
import { AIChatType } from './chat';
|
|
8
|
+
import { TemplateType } from './template';
|
|
9
|
+
import { AUTOMATION_PLUGIN } from '../meta';
|
|
10
|
+
|
|
11
|
+
export namespace AutomationAction {
|
|
12
|
+
const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;
|
|
13
|
+
|
|
14
|
+
export class CreateChat extends S.TaggedClass<CreateChat>()(`${AUTOMATION_ACTION}/create-chat`, {
|
|
15
|
+
input: S.Struct({
|
|
16
|
+
spaceId: S.optional(S.String),
|
|
17
|
+
name: S.optional(S.String),
|
|
18
|
+
}),
|
|
19
|
+
output: S.Struct({
|
|
20
|
+
object: AIChatType,
|
|
21
|
+
}),
|
|
22
|
+
}) {}
|
|
23
|
+
|
|
24
|
+
export class CreateTemplate extends S.TaggedClass<CreateTemplate>()(`${AUTOMATION_ACTION}/create-template`, {
|
|
25
|
+
input: S.Struct({
|
|
26
|
+
name: S.optional(S.String),
|
|
27
|
+
}),
|
|
28
|
+
output: S.Struct({
|
|
29
|
+
object: TemplateType,
|
|
30
|
+
}),
|
|
31
|
+
}) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const AutomationSettingsSchema = S.mutable(
|
|
35
|
+
S.Struct({
|
|
36
|
+
llmModel: S.optional(S.String),
|
|
37
|
+
customPrompts: S.optional(S.Boolean),
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export type AutomationSettingsProps = S.Schema.Type<typeof AutomationSettingsSchema>;
|