@dxos/plugin-automation 0.7.5-staging.2ff1350 → 0.7.5-staging.e6154f3
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,82 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useEffect, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Mutex } from '@dxos/async';
|
|
8
|
-
import { Context } from '@dxos/context';
|
|
9
|
-
import { createSubscriptionTrigger, type TriggerFactory } from '@dxos/functions';
|
|
10
|
-
import { FunctionTrigger } from '@dxos/functions';
|
|
11
|
-
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import { log } from '@dxos/log';
|
|
13
|
-
import { useClient } from '@dxos/react-client';
|
|
14
|
-
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
15
|
-
|
|
16
|
-
import { invokeFunction } from './invocation-handler';
|
|
17
|
-
|
|
18
|
-
const registerTriggersMutex = new Mutex();
|
|
19
|
-
|
|
20
|
-
export const useLocalTriggerManager = (space: Space) => {
|
|
21
|
-
const client = useClient();
|
|
22
|
-
|
|
23
|
-
// TODO(burdon): Factor out, creating context for plugin (runs outside of component).
|
|
24
|
-
const [registry] = useState(new Map<string, Context>());
|
|
25
|
-
const triggers = useQuery(space, Filter.schema(FunctionTrigger));
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
setTimeout(async () => {
|
|
28
|
-
// Mark-and-sweep removing disabled triggers.
|
|
29
|
-
await registerTriggersMutex.executeSynchronized(async () => {
|
|
30
|
-
const deprecated = new Set(Array.from(registry.keys()));
|
|
31
|
-
log('triggers', {
|
|
32
|
-
deprecated,
|
|
33
|
-
all: triggers.map((t) => t.id),
|
|
34
|
-
enabled: triggers.filter((t) => t.enabled).map((t) => t.id),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
for (const trigger of triggers) {
|
|
38
|
-
if (trigger.enabled) {
|
|
39
|
-
if (registry.has(trigger.id)) {
|
|
40
|
-
deprecated.delete(trigger.id);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
log.info('activating trigger', trigger.id);
|
|
44
|
-
|
|
45
|
-
const ctx = new Context();
|
|
46
|
-
registry.set(trigger.id, ctx);
|
|
47
|
-
const triggerSpec = trigger.spec;
|
|
48
|
-
invariant(triggerSpec);
|
|
49
|
-
|
|
50
|
-
let triggerFactory: TriggerFactory<any>;
|
|
51
|
-
if (triggerSpec.type === 'subscription') {
|
|
52
|
-
triggerFactory = createSubscriptionTrigger;
|
|
53
|
-
} else {
|
|
54
|
-
log.info('unsupported trigger', { type: triggerSpec.type });
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
await triggerFactory(ctx, space, trigger.spec, (data: any) => {
|
|
59
|
-
return invokeFunction(client, space, trigger, data);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
for (const id of deprecated) {
|
|
65
|
-
const ctx = registry.get(id);
|
|
66
|
-
if (ctx) {
|
|
67
|
-
await ctx.dispose();
|
|
68
|
-
registry.delete(id);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}, [JSON.stringify(triggers)]);
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
return () => {
|
|
77
|
-
for (const ctx of registry.values()) {
|
|
78
|
-
void ctx.dispose();
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}, []);
|
|
82
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Message } from '@dxos/artifact';
|
|
8
|
-
import { DXN, QueueSubspaceTags } from '@dxos/keys';
|
|
9
|
-
import { getSpace } from '@dxos/react-client/echo';
|
|
10
|
-
import { useEdgeClient, useQueue } from '@dxos/react-edge-client';
|
|
11
|
-
|
|
12
|
-
import { type AIChatType } from '../types';
|
|
13
|
-
|
|
14
|
-
export const useMessageQueue = (chat?: AIChatType) => {
|
|
15
|
-
const space = getSpace(chat);
|
|
16
|
-
const queueDxn = useMemo(() => {
|
|
17
|
-
const dxn = space && chat?.queue.dxn;
|
|
18
|
-
return dxn ? new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, space.id, dxn.parts.at(-1)!]) : undefined;
|
|
19
|
-
}, [space, chat?.queue.dxn]);
|
|
20
|
-
|
|
21
|
-
const edgeClient = useEdgeClient();
|
|
22
|
-
return useQueue<Message>(edgeClient, queueDxn);
|
|
23
|
-
};
|
package/src/hooks/useServices.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Space } from '@dxos/client/echo';
|
|
8
|
-
|
|
9
|
-
import { MockServiceRegistry } from '../testing';
|
|
10
|
-
import { type ServiceType, type ServiceQuery } from '../types';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves matching services from the registry.
|
|
14
|
-
*/
|
|
15
|
-
export const useServices = (space: Space, query?: ServiceQuery): ServiceType[] => {
|
|
16
|
-
const registry = useMemo(() => new MockServiceRegistry(), []);
|
|
17
|
-
const [services, setServices] = useState<ServiceType[]>([]);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const t = setTimeout(async () => {
|
|
20
|
-
const services = await registry.queryServices(query);
|
|
21
|
-
setServices(services);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return () => clearTimeout(t);
|
|
25
|
-
}, [query, registry]);
|
|
26
|
-
|
|
27
|
-
return services;
|
|
28
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useState, useCallback, type KeyboardEventHandler, type ChangeEventHandler } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Hook that handles text input events.
|
|
9
|
-
*/
|
|
10
|
-
// TODO(burdon): Factor out.
|
|
11
|
-
export const useTextInputEvents = ({
|
|
12
|
-
onEnter,
|
|
13
|
-
onEscape,
|
|
14
|
-
}: {
|
|
15
|
-
onEnter?: (text: string) => boolean | void;
|
|
16
|
-
onEscape?: () => void;
|
|
17
|
-
}) => {
|
|
18
|
-
const [value, setValue] = useState('');
|
|
19
|
-
|
|
20
|
-
const onKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(
|
|
21
|
-
(ev) => {
|
|
22
|
-
switch (ev.key) {
|
|
23
|
-
case 'Escape': {
|
|
24
|
-
onEscape?.();
|
|
25
|
-
setValue('');
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
case 'Enter': {
|
|
30
|
-
const value = (ev.target as HTMLInputElement).value.trim();
|
|
31
|
-
if (value.length > 0) {
|
|
32
|
-
const reset = onEnter?.(value);
|
|
33
|
-
if (reset) {
|
|
34
|
-
setValue('');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
[onEnter, onEscape],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const onChange = useCallback<ChangeEventHandler<HTMLInputElement>>((ev) => {
|
|
45
|
-
setValue(ev.target.value);
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
|
-
return [{ value, onKeyDown, onChange }, setValue];
|
|
49
|
-
};
|
package/src/presets.ts
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { create } from '@dxos/live-object';
|
|
6
|
-
|
|
7
|
-
import { ChainInputType, ChainPromptType } from './types';
|
|
8
|
-
|
|
9
|
-
export const str = (...text: (string | undefined | boolean)[]): string =>
|
|
10
|
-
text
|
|
11
|
-
.filter((value) => value !== undefined && value !== false)
|
|
12
|
-
.flat()
|
|
13
|
-
.join('\n');
|
|
14
|
-
|
|
15
|
-
export type Preset = {
|
|
16
|
-
id: string;
|
|
17
|
-
title: string;
|
|
18
|
-
createPrompt: () => ChainPromptType;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const chainPresets: Preset[] = [
|
|
22
|
-
{
|
|
23
|
-
id: 'dxos.org/prompt/translate',
|
|
24
|
-
title: 'Translate',
|
|
25
|
-
createPrompt: () =>
|
|
26
|
-
create(ChainPromptType, {
|
|
27
|
-
command: 'say',
|
|
28
|
-
template: str(
|
|
29
|
-
// prettier-ignore
|
|
30
|
-
'Translate the following into {language}:',
|
|
31
|
-
'',
|
|
32
|
-
'---',
|
|
33
|
-
'',
|
|
34
|
-
'{input}',
|
|
35
|
-
),
|
|
36
|
-
inputs: [
|
|
37
|
-
{
|
|
38
|
-
type: ChainInputType.VALUE,
|
|
39
|
-
name: 'language',
|
|
40
|
-
value: 'japanese',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: ChainInputType.PASS_THROUGH,
|
|
44
|
-
name: 'input',
|
|
45
|
-
},
|
|
46
|
-
// TODO(burdon): Message.
|
|
47
|
-
// {
|
|
48
|
-
// type: ChainInputType.CONTEXT,
|
|
49
|
-
// name: 'input',
|
|
50
|
-
// value: 'object.text',
|
|
51
|
-
// },
|
|
52
|
-
],
|
|
53
|
-
}),
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: 'dxos.org/prompt/chess',
|
|
57
|
-
title: 'Chess',
|
|
58
|
-
createPrompt: () =>
|
|
59
|
-
create(ChainPromptType, {
|
|
60
|
-
command: 'hint',
|
|
61
|
-
template: str(
|
|
62
|
-
// prettier-ignore
|
|
63
|
-
'You are a machine that is an expert chess player.',
|
|
64
|
-
'',
|
|
65
|
-
'The move history of the current game is: {history}',
|
|
66
|
-
'',
|
|
67
|
-
'Suggest the next move and very briefly explain your strategy in a couple of sentences.',
|
|
68
|
-
),
|
|
69
|
-
inputs: [
|
|
70
|
-
{
|
|
71
|
-
type: ChainInputType.CONTEXT,
|
|
72
|
-
name: 'history',
|
|
73
|
-
value: 'object.pgn',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
}),
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: 'dxos.org/prompt/mermaid',
|
|
80
|
-
title: 'Mermaid',
|
|
81
|
-
createPrompt: () =>
|
|
82
|
-
create(ChainPromptType, {
|
|
83
|
-
command: 'draw',
|
|
84
|
-
template: str(
|
|
85
|
-
// prettier-ignore
|
|
86
|
-
'Create a simplified mermaid graph representing the text below.',
|
|
87
|
-
'Do not explain anything.',
|
|
88
|
-
'',
|
|
89
|
-
'---',
|
|
90
|
-
'',
|
|
91
|
-
'{input}',
|
|
92
|
-
),
|
|
93
|
-
inputs: [
|
|
94
|
-
{
|
|
95
|
-
type: ChainInputType.PASS_THROUGH,
|
|
96
|
-
name: 'input',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
}),
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: 'dxos.org/prompt/list',
|
|
103
|
-
title: 'List',
|
|
104
|
-
createPrompt: () =>
|
|
105
|
-
create(ChainPromptType, {
|
|
106
|
-
command: 'list',
|
|
107
|
-
template: str(
|
|
108
|
-
// prettier-ignore
|
|
109
|
-
'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',
|
|
110
|
-
'Your entire response should be a single array of JSON objects.',
|
|
111
|
-
'',
|
|
112
|
-
'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',
|
|
113
|
-
'',
|
|
114
|
-
'{schema}',
|
|
115
|
-
'',
|
|
116
|
-
'---',
|
|
117
|
-
'',
|
|
118
|
-
'{question}',
|
|
119
|
-
),
|
|
120
|
-
inputs: [
|
|
121
|
-
{
|
|
122
|
-
type: ChainInputType.SCHEMA,
|
|
123
|
-
name: 'schema',
|
|
124
|
-
value: 'example.com/type/project',
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type: ChainInputType.PASS_THROUGH,
|
|
128
|
-
name: 'question',
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
}),
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
id: 'dxos.org/prompt/base',
|
|
135
|
-
title: 'RAG',
|
|
136
|
-
createPrompt: () =>
|
|
137
|
-
create(ChainPromptType, {
|
|
138
|
-
command: 'rag',
|
|
139
|
-
template: str(
|
|
140
|
-
// prettier-ignore
|
|
141
|
-
"Very briefly answer the question based only on the following context and say if you don't know the answer.",
|
|
142
|
-
// 'answer the question using the following context as well as your training data:',
|
|
143
|
-
'',
|
|
144
|
-
'{context}',
|
|
145
|
-
'',
|
|
146
|
-
'---',
|
|
147
|
-
'',
|
|
148
|
-
'question: {question}',
|
|
149
|
-
),
|
|
150
|
-
inputs: [
|
|
151
|
-
{
|
|
152
|
-
type: ChainInputType.RETRIEVER,
|
|
153
|
-
name: 'context',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
type: ChainInputType.CONTEXT,
|
|
157
|
-
name: 'question',
|
|
158
|
-
value: 'object.text',
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
}),
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: 'dxos.org/prompt/lookup',
|
|
165
|
-
title: 'Lookup',
|
|
166
|
-
createPrompt: () =>
|
|
167
|
-
create(ChainPromptType, {
|
|
168
|
-
command: 'lookup',
|
|
169
|
-
template: str(
|
|
170
|
-
// prettier-ignore
|
|
171
|
-
'Lookup and very briefly summarize the following topic in one or two sentences:',
|
|
172
|
-
'',
|
|
173
|
-
'---',
|
|
174
|
-
'',
|
|
175
|
-
'{input}',
|
|
176
|
-
),
|
|
177
|
-
inputs: [
|
|
178
|
-
{
|
|
179
|
-
type: ChainInputType.CONTEXT,
|
|
180
|
-
name: 'input',
|
|
181
|
-
value: 'text',
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
}),
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
id: 'dxos.org/prompt/extract',
|
|
188
|
-
title: 'Extract',
|
|
189
|
-
createPrompt: () =>
|
|
190
|
-
create(ChainPromptType, {
|
|
191
|
-
command: 'extract',
|
|
192
|
-
template: str(
|
|
193
|
-
// prettier-ignore
|
|
194
|
-
'List all people and companies mentioned in the text below.',
|
|
195
|
-
'',
|
|
196
|
-
'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',
|
|
197
|
-
'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',
|
|
198
|
-
'',
|
|
199
|
-
'{contact}',
|
|
200
|
-
'{company}',
|
|
201
|
-
'',
|
|
202
|
-
'---',
|
|
203
|
-
'',
|
|
204
|
-
'{input}',
|
|
205
|
-
),
|
|
206
|
-
inputs: [
|
|
207
|
-
{
|
|
208
|
-
type: ChainInputType.SCHEMA,
|
|
209
|
-
name: 'contact',
|
|
210
|
-
value: 'example.com/type/contact',
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
type: ChainInputType.SCHEMA,
|
|
214
|
-
name: 'company',
|
|
215
|
-
value: 'example.com/type/organization',
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
type: ChainInputType.CONTEXT,
|
|
219
|
-
name: 'input',
|
|
220
|
-
value: 'text',
|
|
221
|
-
},
|
|
222
|
-
],
|
|
223
|
-
}),
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
id: 'dxos.org/prompt/discord',
|
|
227
|
-
title: 'Summarize',
|
|
228
|
-
createPrompt: () =>
|
|
229
|
-
create(ChainPromptType, {
|
|
230
|
-
command: 'summarize',
|
|
231
|
-
template: str(
|
|
232
|
-
// prettier-ignore
|
|
233
|
-
'Summarize what the team is working on and format it as a markdown table without any explanation.',
|
|
234
|
-
'',
|
|
235
|
-
'---',
|
|
236
|
-
'',
|
|
237
|
-
'{context}',
|
|
238
|
-
),
|
|
239
|
-
inputs: [
|
|
240
|
-
{
|
|
241
|
-
type: ChainInputType.RESOLVER,
|
|
242
|
-
name: 'context',
|
|
243
|
-
value: 'discord.messages.recent',
|
|
244
|
-
},
|
|
245
|
-
],
|
|
246
|
-
}),
|
|
247
|
-
},
|
|
248
|
-
];
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { createStatic } from '@dxos/echo-schema';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type ApiAuthorization,
|
|
9
|
-
type BaseServiceRegistry,
|
|
10
|
-
type ServiceQuery,
|
|
11
|
-
ServiceType,
|
|
12
|
-
categoryIcons,
|
|
13
|
-
} from '../types';
|
|
14
|
-
|
|
15
|
-
export class MockServiceRegistry implements BaseServiceRegistry {
|
|
16
|
-
async queryServices(query?: ServiceQuery): Promise<ServiceType[]> {
|
|
17
|
-
return TEST_SERVICES;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// TODO(burdon): Can we generalize credentials?
|
|
22
|
-
|
|
23
|
-
const AMADEUS_AUTH: ApiAuthorization = {
|
|
24
|
-
type: 'oauth',
|
|
25
|
-
clientId: 'BOEnpLd1sMyKjAPGKYeAPFFy60u53QEG',
|
|
26
|
-
clientSecret: 'n4qldSN7usvD57gm',
|
|
27
|
-
tokenUrl: 'https://test.api.amadeus.com/v1/security/oauth2/token',
|
|
28
|
-
grantType: 'client_credentials',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const VISUAL_CROSSING_CREDENTIALS: ApiAuthorization = {
|
|
32
|
-
type: 'api-key',
|
|
33
|
-
key: 'FDPRVS953KB4GQQLD25GRT975',
|
|
34
|
-
placement: {
|
|
35
|
-
type: 'query',
|
|
36
|
-
name: 'key',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Registries:
|
|
41
|
-
// - https://apis.guru
|
|
42
|
-
// - https://rapidapi.com
|
|
43
|
-
// - https://github.com/konfig-sdks/openapi-examples
|
|
44
|
-
// - https://publicapis.io/?utm_source=chatgpt.com
|
|
45
|
-
|
|
46
|
-
// Examples:
|
|
47
|
-
// - https://petstore.swagger.io/v2/swagger.json (testing)
|
|
48
|
-
// - https://lichess.org/api
|
|
49
|
-
// - https://github.com/konfig-sdks/openapi-examples/tree/main/xkcd
|
|
50
|
-
// - https://api.coindesk.com/v1/bpi/currentprice.json
|
|
51
|
-
// - https://www.coingecko.com/en/api/documentation
|
|
52
|
-
|
|
53
|
-
// TODO(burdon): Support yaml endpoints.
|
|
54
|
-
// - e.g., https://github.com/konfig-sdks/openapi-examples/blob/main/xkcd/openapi.yaml
|
|
55
|
-
|
|
56
|
-
const TEST_SERVICES: ServiceType[] = [
|
|
57
|
-
createStatic(ServiceType, {
|
|
58
|
-
serviceId: 'amadeus.com/service/FlightSearch',
|
|
59
|
-
name: 'Amadeus Flight Search',
|
|
60
|
-
description: 'Search for local and international flights.',
|
|
61
|
-
category: 'travel',
|
|
62
|
-
interfaces: [
|
|
63
|
-
{
|
|
64
|
-
kind: 'api',
|
|
65
|
-
schemaUrl: 'https://api.apis.guru/v2/specs/amadeus.com/amadeus-flight-availabilities-search/1.0.2/swagger.json',
|
|
66
|
-
authorization: AMADEUS_AUTH,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
createStatic(ServiceType, {
|
|
72
|
-
serviceId: 'amadeus.com/service/HotelSearch',
|
|
73
|
-
name: 'Amadeus Hotel Search',
|
|
74
|
-
description: 'Search for local and international hotels.',
|
|
75
|
-
category: 'travel',
|
|
76
|
-
interfaces: [
|
|
77
|
-
{
|
|
78
|
-
kind: 'api',
|
|
79
|
-
schemaUrl: 'https://api.apis.guru/v2/specs/amadeus.com/amadeus-hotel-search/3.0.8/swagger.json',
|
|
80
|
-
authorization: AMADEUS_AUTH,
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
createStatic(ServiceType, {
|
|
86
|
-
serviceId: 'visualcrossing.com/service/Weather',
|
|
87
|
-
name: 'Visual Crossing Weather',
|
|
88
|
-
description: 'Search for global weather forecasts.',
|
|
89
|
-
category: 'weather',
|
|
90
|
-
interfaces: [
|
|
91
|
-
{
|
|
92
|
-
kind: 'api',
|
|
93
|
-
schemaUrl: 'https://api.apis.guru/v2/specs/visualcrossing.com/weather/4.6/openapi.json',
|
|
94
|
-
authorization: VISUAL_CROSSING_CREDENTIALS,
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
// TODO(burdon): Needs auth.
|
|
100
|
-
createStatic(ServiceType, {
|
|
101
|
-
serviceId: 'abstractapi.com/service/GeoLocation',
|
|
102
|
-
name: 'Abstract GeoLocation',
|
|
103
|
-
description: 'Get the location of any IP address.',
|
|
104
|
-
category: 'geolocation',
|
|
105
|
-
interfaces: [
|
|
106
|
-
{
|
|
107
|
-
kind: 'api',
|
|
108
|
-
schemaUrl: 'https://api.apis.guru/v2/specs/abstractapi.com/geolocation/1.0.0/openapi.json',
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
}),
|
|
112
|
-
|
|
113
|
-
//
|
|
114
|
-
// Testing
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
...Array.from({ length: 20 }, (_, i) =>
|
|
118
|
-
createStatic(ServiceType, {
|
|
119
|
-
serviceId: `example.com/service/test-${i}`,
|
|
120
|
-
name: `Test ${i}`,
|
|
121
|
-
description: `Test ${i}`,
|
|
122
|
-
category: Object.keys(categoryIcons)[Math.floor(Math.random() * Object.keys(categoryIcons).length)],
|
|
123
|
-
interfaces: [
|
|
124
|
-
{
|
|
125
|
-
kind: 'api',
|
|
126
|
-
schemaUrl: 'https://petstore.swagger.io/v2/swagger.json',
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
}),
|
|
130
|
-
),
|
|
131
|
-
] as const;
|
package/src/tools/function.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineTool, ToolResult } from '@dxos/artifact';
|
|
6
|
-
import type { Tool } from '@dxos/artifact';
|
|
7
|
-
import { toEffectSchema } from '@dxos/echo-schema';
|
|
8
|
-
import { getInvocationUrl, getUserFunctionUrlInMetadata } from '@dxos/functions';
|
|
9
|
-
import type { FunctionType } from '@dxos/functions';
|
|
10
|
-
import { log } from '@dxos/log';
|
|
11
|
-
import type { SpaceId } from '@dxos/react-client/echo';
|
|
12
|
-
import { getMeta } from '@dxos/react-client/echo';
|
|
13
|
-
|
|
14
|
-
export const covertFunctionToTool = (
|
|
15
|
-
fn: FunctionType,
|
|
16
|
-
edgeUrl: string,
|
|
17
|
-
spaceId?: SpaceId | undefined,
|
|
18
|
-
): Tool | undefined => {
|
|
19
|
-
if (!fn.description || !fn.inputSchema) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const existingFunctionUrl = getUserFunctionUrlInMetadata(getMeta(fn));
|
|
24
|
-
if (!existingFunctionUrl) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const url = getInvocationUrl(existingFunctionUrl, edgeUrl, {
|
|
28
|
-
spaceId,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
return defineTool({
|
|
32
|
-
name: fn.name,
|
|
33
|
-
description: fn.description,
|
|
34
|
-
schema: toEffectSchema(fn.inputSchema),
|
|
35
|
-
execute: async (input) => {
|
|
36
|
-
log.info('execute function tool', { name: fn.name, url, input });
|
|
37
|
-
const response = await fetch(url, {
|
|
38
|
-
method: 'POST',
|
|
39
|
-
headers: {
|
|
40
|
-
'Content-Type': 'application/json',
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify(input),
|
|
43
|
-
});
|
|
44
|
-
return ToolResult.Success(await response.text());
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
};
|