@dxos/plugin-automation 0.8.4-main.1da679c → 0.8.4-main.21d9917
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-FAS6ADCW.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs +56 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs +129 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs → FunctionsPanel-ZX4J75UM.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs +84 -0
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-NQGKPPXI.mjs → chunk-54PANILA.mjs} +5 -5
- package/dist/lib/browser/chunk-BFUIVUQH.mjs +102 -0
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs +8 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +83 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +7 -0
- package/dist/lib/browser/chunk-PZNBEKO5.mjs +17 -0
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs +248 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +7 -0
- package/dist/lib/browser/chunk-RAF2FJST.mjs +86 -0
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +7 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs +200 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1107 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs +114 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +5 -4
- package/dist/lib/browser/index.mjs +61 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs +82 -0
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-IYFH2BEM.mjs → react-surface-EV3AC62F.mjs} +14 -13
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/{AutomationPanel-MKOLA2FE.mjs → AutomationPanel-B7NAGDFA.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs +57 -0
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs +130 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs → FunctionsPanel-SS6GIVNU.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs +85 -0
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs +201 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs +19 -0
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UAOO5IZQ.mjs → chunk-7QRUPEHH.mjs} +5 -5
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs +87 -0
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs +10 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs +103 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs +249 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +84 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1108 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs +115 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +5 -4
- package/dist/lib/node-esm/index.mjs +61 -51
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-FDRJ76PK.mjs → react-surface-S6VZJCEZ.mjs} +14 -13
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- package/dist/types/src/AutomationPlugin.d.ts +2 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -3
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +4 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +2 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +11 -8
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +77 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +3 -3
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -4
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +4 -4
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +2 -3
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +31 -2
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +62 -46
- package/src/AutomationPlugin.tsx +18 -37
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +71 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/compute-runtime/compute-runtime.ts +133 -0
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +79 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +60 -0
- package/src/cli/commands/index.ts +5 -0
- package/src/cli/commands/trigger/create/index.ts +14 -0
- package/src/cli/commands/trigger/create/queue.ts +89 -0
- package/src/cli/commands/trigger/create/subscription.ts +128 -0
- package/src/cli/commands/trigger/create/timer.ts +93 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +67 -0
- package/src/cli/commands/trigger/options.ts +59 -0
- package/src/cli/commands/trigger/remove.ts +45 -0
- package/src/cli/commands/trigger/update/index.ts +14 -0
- package/src/cli/commands/trigger/update/queue.ts +195 -0
- package/src/cli/commands/trigger/update/subscription.ts +278 -0
- package/src/cli/commands/trigger/update/timer.ts +193 -0
- package/src/cli/commands/trigger/util.ts +395 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +23 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +7 -11
- package/src/components/AutomationPanel/AutomationPanel.tsx +132 -40
- package/src/components/AutomationSettings.tsx +5 -5
- package/src/components/FunctionsContainer.tsx +11 -4
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +33 -19
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +111 -0
- package/src/components/FunctionsRegistry/index.ts +5 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +33 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +21 -13
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +70 -27
- package/src/components/TriggerEditor/TriggerEditor.tsx +81 -42
- package/src/components/TriggerSettings.tsx +3 -3
- package/src/hooks/useComputeRuntimeCallback.ts +45 -8
- package/src/hooks/useTriggerRuntimeControls.ts +11 -10
- package/src/index.ts +2 -1
- package/src/meta.ts +8 -7
- package/src/testing/test-functions.ts +3 -3
- package/src/translations.ts +5 -0
- package/src/types/capabilities.ts +42 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +24 -3
- package/dist/lib/browser/AutomationPanel-N5HFJJXW.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-S3F2VT7Q.mjs +0 -70
- package/dist/lib/browser/AutomationSettings-S3F2VT7Q.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-U4HASI4P.mjs +0 -36
- package/dist/lib/browser/FunctionsContainer-U4HASI4P.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-SRA3X2GQ.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-SRA3X2GQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-4TWQV33E.mjs +0 -143
- package/dist/lib/browser/chunk-4TWQV33E.mjs.map +0 -7
- package/dist/lib/browser/chunk-CRUNQZ2M.mjs +0 -15
- package/dist/lib/browser/chunk-CRUNQZ2M.mjs.map +0 -7
- package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
- package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
- package/dist/lib/browser/chunk-HN7OHFCB.mjs +0 -38
- package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
- package/dist/lib/browser/chunk-P6YOYDXP.mjs +0 -53
- package/dist/lib/browser/chunk-P6YOYDXP.mjs.map +0 -7
- package/dist/lib/browser/chunk-S4SM663I.mjs +0 -230
- package/dist/lib/browser/chunk-S4SM663I.mjs.map +0 -7
- package/dist/lib/browser/chunk-UHXDXRP4.mjs +0 -14
- package/dist/lib/browser/chunk-UHXDXRP4.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5DT4MHW.mjs +0 -94
- package/dist/lib/browser/chunk-Z5DT4MHW.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-G25R3RSS.mjs +0 -154
- package/dist/lib/browser/compute-runtime-G25R3RSS.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-CMLGPFD6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-CMLGPFD6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-IYFH2BEM.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-C3GNAUYC.mjs +0 -71
- package/dist/lib/node-esm/AutomationSettings-C3GNAUYC.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-VZIVURH6.mjs +0 -37
- package/dist/lib/node-esm/FunctionsContainer-VZIVURH6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-R5XQJKZS.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-R5XQJKZS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AONUBWBE.mjs +0 -144
- package/dist/lib/node-esm/chunk-AONUBWBE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BTD2B4SZ.mjs +0 -16
- package/dist/lib/node-esm/chunk-BTD2B4SZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CTAX6WBZ.mjs +0 -16
- package/dist/lib/node-esm/chunk-CTAX6WBZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CX2AILIS.mjs +0 -95
- package/dist/lib/node-esm/chunk-CX2AILIS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs +0 -39
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XL33Y62M.mjs +0 -54
- package/dist/lib/node-esm/chunk-XL33Y62M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZOJVKPCA.mjs +0 -231
- package/dist/lib/node-esm/chunk-ZOJVKPCA.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-LHO62OVM.mjs +0 -155
- package/dist/lib/node-esm/compute-runtime-LHO62OVM.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-NUPI6NC6.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-NUPI6NC6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FDRJ76PK.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -18
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.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/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -86
- package/src/capabilities/capabilities.ts +0 -52
- package/src/capabilities/compute-runtime.ts +0 -124
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- /package/dist/lib/browser/{AutomationPanel-N5HFJJXW.mjs.map → AutomationPanel-FAS6ADCW.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs.map → FunctionsPanel-ZX4J75UM.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-NQGKPPXI.mjs.map → chunk-54PANILA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-MKOLA2FE.mjs.map → AutomationPanel-B7NAGDFA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs.map → FunctionsPanel-SS6GIVNU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-UAOO5IZQ.mjs.map → chunk-7QRUPEHH.mjs.map} +0 -0
|
@@ -4,28 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Filter, Query } from '@dxos/echo';
|
|
8
|
+
import { Trigger } from '@dxos/functions';
|
|
8
9
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { type
|
|
10
|
+
import { type FormFieldComponentProps, SelectField, useFormFieldState } from '@dxos/react-ui-form';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
12
13
|
|
|
13
|
-
export type SpecSelectorProps =
|
|
14
|
+
export type SpecSelectorProps = FormFieldComponentProps;
|
|
14
15
|
|
|
15
16
|
export const SpecSelector = (props: SpecSelectorProps) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
-
const specProps =
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
const specProps = useFormFieldState(SpecSelector.displayName, ['spec' satisfies keyof Trigger.Trigger]);
|
|
18
19
|
|
|
19
20
|
const handleTypeChange = useCallback(
|
|
20
|
-
(_type: any, value: string):
|
|
21
|
+
(_type: any, value: string): Trigger.Spec | undefined => {
|
|
21
22
|
const getDefaultTriggerSpec = (kind: string) => {
|
|
22
23
|
switch (kind) {
|
|
23
24
|
case 'timer':
|
|
24
25
|
return { kind: 'timer', cron: '' };
|
|
25
26
|
case 'subscription':
|
|
26
|
-
return {
|
|
27
|
+
return {
|
|
28
|
+
kind: 'subscription',
|
|
29
|
+
query: {
|
|
30
|
+
ast: Query.select(Filter.nothing()).ast,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
27
33
|
case 'queue':
|
|
28
|
-
return { kind: 'queue', queue: '' };
|
|
34
|
+
return { kind: 'queue', queue: 'dxn:' };
|
|
29
35
|
case 'email':
|
|
30
36
|
return { kind: 'email' };
|
|
31
37
|
case 'webhook':
|
|
@@ -41,19 +47,21 @@ export const SpecSelector = (props: SpecSelectorProps) => {
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
// Update the entire spec object, not just the `spec.kind`.
|
|
44
|
-
specProps.onValueChange(
|
|
50
|
+
specProps.onValueChange(props.type, defaultSpec);
|
|
45
51
|
},
|
|
46
|
-
[specProps],
|
|
52
|
+
[props.type, specProps],
|
|
47
53
|
);
|
|
48
54
|
|
|
49
55
|
const options = useMemo(
|
|
50
56
|
() =>
|
|
51
|
-
|
|
57
|
+
Trigger.Kinds.map((kind) => ({
|
|
52
58
|
value: kind,
|
|
53
59
|
label: t(`trigger type ${kind}`),
|
|
54
60
|
})),
|
|
55
61
|
[t],
|
|
56
62
|
);
|
|
57
63
|
|
|
58
|
-
return <
|
|
64
|
+
return <SelectField {...props} options={options} onValueChange={handleTypeChange} />;
|
|
59
65
|
};
|
|
66
|
+
|
|
67
|
+
SpecSelector.displayName = 'Form.SpecSelector';
|
|
@@ -2,33 +2,56 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
|
-
import React, {
|
|
6
|
+
import React, { useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
8
|
+
import { Filter, Obj, Ref, Tag, Type } from '@dxos/echo';
|
|
9
|
+
import { Function, Trigger } from '@dxos/functions';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
12
11
|
import { faker } from '@dxos/random';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
13
|
+
import { TestSchema, useClientStory, withClientProvider } from '@dxos/react-client/testing';
|
|
14
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { translations as formTranslations } from '@dxos/react-ui-form';
|
|
17
|
+
import { Employer, Organization, Person, Project } from '@dxos/types';
|
|
16
18
|
|
|
17
19
|
import { functions } from '../../testing';
|
|
18
20
|
import { translations } from '../../translations';
|
|
19
21
|
|
|
20
|
-
import { TriggerEditor } from './TriggerEditor';
|
|
22
|
+
import { TriggerEditor, type TriggerEditorProps } from './TriggerEditor';
|
|
23
|
+
|
|
24
|
+
const types = [
|
|
25
|
+
// TODO(burdon): Get label from annotation.
|
|
26
|
+
{ value: Organization.Organization.typename, label: 'Organization' },
|
|
27
|
+
{ value: Person.Person.typename, label: 'Person' },
|
|
28
|
+
{ value: Type.getTypename(Project.Project), label: 'Project' },
|
|
29
|
+
{ value: Employer.Employer.typename, label: 'Employer' },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const DefaultStory = (props: Partial<TriggerEditorProps>) => {
|
|
33
|
+
const { space } = useClientStory();
|
|
34
|
+
const [trigger, setTrigger] = useState<Trigger.Trigger>();
|
|
35
|
+
const tags = useQuery(space?.db, Filter.type(Tag.Tag));
|
|
21
36
|
|
|
22
|
-
|
|
23
|
-
const spaces = useSpaces();
|
|
24
|
-
const space = spaces[1];
|
|
25
|
-
const [trigger, setTrigger] = useState<FunctionTrigger>();
|
|
26
|
-
useEffect(() => {
|
|
37
|
+
useAsyncEffect(async () => {
|
|
27
38
|
if (!space) {
|
|
28
39
|
return;
|
|
29
40
|
}
|
|
30
41
|
|
|
31
|
-
const
|
|
42
|
+
const functions = await space.db.query(Filter.type(Function.Function)).run();
|
|
43
|
+
const fn = functions.find((fn) => fn.name === 'example.com/function/forex');
|
|
44
|
+
invariant(fn);
|
|
45
|
+
const trigger = space.db.add(
|
|
46
|
+
Trigger.make({
|
|
47
|
+
function: Ref.make(fn),
|
|
48
|
+
spec: { kind: 'webhook' },
|
|
49
|
+
input: {
|
|
50
|
+
from: 'USD',
|
|
51
|
+
to: 'JPY',
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
32
55
|
setTrigger(trigger);
|
|
33
56
|
}, [space]);
|
|
34
57
|
|
|
@@ -37,9 +60,14 @@ const DefaultStory = () => {
|
|
|
37
60
|
}
|
|
38
61
|
|
|
39
62
|
return (
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
<TriggerEditor
|
|
64
|
+
db={space.db}
|
|
65
|
+
trigger={trigger}
|
|
66
|
+
types={types}
|
|
67
|
+
tags={tags}
|
|
68
|
+
onSave={(values) => console.log('on save', values)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
43
71
|
);
|
|
44
72
|
};
|
|
45
73
|
|
|
@@ -48,17 +76,27 @@ const meta = {
|
|
|
48
76
|
component: TriggerEditor as any,
|
|
49
77
|
render: DefaultStory,
|
|
50
78
|
decorators: [
|
|
79
|
+
withTheme,
|
|
80
|
+
withLayout({ layout: 'column' }),
|
|
51
81
|
withClientProvider({
|
|
52
82
|
createIdentity: true,
|
|
53
83
|
createSpace: true,
|
|
54
|
-
types: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
84
|
+
types: [Tag.Tag, Function.Function, Trigger.Trigger, TestSchema.ContactType],
|
|
85
|
+
onCreateSpace: ({ space }) => {
|
|
86
|
+
// Tags.
|
|
87
|
+
['Important', 'Investor', 'New'].forEach((label) => {
|
|
88
|
+
space.db.add(Tag.make({ label }));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Functions.
|
|
92
|
+
functions.forEach((fn) => {
|
|
93
|
+
space.db.add(Function.make(fn));
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Objects.
|
|
59
97
|
Array.from({ length: 10 }).map(() => {
|
|
60
98
|
return space.db.add(
|
|
61
|
-
Obj.make(ContactType, {
|
|
99
|
+
Obj.make(TestSchema.ContactType, {
|
|
62
100
|
name: faker.person.fullName(),
|
|
63
101
|
identifiers: [],
|
|
64
102
|
}),
|
|
@@ -66,11 +104,10 @@ const meta = {
|
|
|
66
104
|
});
|
|
67
105
|
},
|
|
68
106
|
}),
|
|
69
|
-
withLayout({ fullscreen: true, classNames: 'flex justify-center m-2' }),
|
|
70
|
-
withTheme,
|
|
71
107
|
],
|
|
72
108
|
parameters: {
|
|
73
|
-
|
|
109
|
+
layout: 'fullscreen',
|
|
110
|
+
translations: [...formTranslations, ...translations],
|
|
74
111
|
},
|
|
75
112
|
} satisfies Meta<typeof DefaultStory>;
|
|
76
113
|
|
|
@@ -79,3 +116,9 @@ export default meta;
|
|
|
79
116
|
type Story = StoryObj<typeof meta>;
|
|
80
117
|
|
|
81
118
|
export const Default: Story = {};
|
|
119
|
+
|
|
120
|
+
export const ReadonlySpec: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
readonlySpec: true,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -5,51 +5,76 @@
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { ComputeGraph } from '@dxos/conductor';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Filter, Ref,
|
|
11
|
-
import {
|
|
8
|
+
import { DXN, type Database, type Query } from '@dxos/echo';
|
|
9
|
+
import { Function, Script, Trigger } from '@dxos/functions';
|
|
10
|
+
import { Filter, Ref, useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Input } from '@dxos/react-ui';
|
|
12
|
+
import { QueryForm, type QueryFormProps } from '@dxos/react-ui-components';
|
|
13
|
+
import {
|
|
14
|
+
type ExcludeId,
|
|
15
|
+
Form,
|
|
16
|
+
FormFieldLabel,
|
|
17
|
+
type FormFieldMap,
|
|
18
|
+
type FormRootProps,
|
|
19
|
+
SelectField,
|
|
20
|
+
omitId,
|
|
21
|
+
} from '@dxos/react-ui-form';
|
|
12
22
|
|
|
13
|
-
import { FunctionInputEditor
|
|
23
|
+
import { FunctionInputEditor } from './FunctionInputEditor';
|
|
14
24
|
import { SpecSelector } from './SpecSelector';
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
space: Space;
|
|
18
|
-
trigger: FunctionTrigger;
|
|
19
|
-
onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;
|
|
20
|
-
onCancel?: () => void;
|
|
21
|
-
};
|
|
26
|
+
type TriggerFormSchema = ExcludeId<typeof Trigger.Trigger>;
|
|
22
27
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
export type TriggerEditorProps = {
|
|
29
|
+
db: Database.Database;
|
|
30
|
+
trigger: Trigger.Trigger;
|
|
31
|
+
// TODO(wittjosiah): This needs to apply to whole spec but currently only applies to spec.kind & spec.query.
|
|
32
|
+
readonlySpec?: boolean;
|
|
33
|
+
} &
|
|
34
|
+
// prettier-ignore
|
|
35
|
+
Pick<QueryFormProps, 'types' | 'tags'> &
|
|
36
|
+
Pick<FormRootProps<TriggerFormSchema>, 'onSave' | 'onCancel'>;
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
const
|
|
38
|
+
export const TriggerEditor = ({ db, types, tags, readonlySpec, trigger, ...formProps }: TriggerEditorProps) => {
|
|
39
|
+
const fieldMap = useCustomInputs({
|
|
40
|
+
db,
|
|
41
|
+
types,
|
|
42
|
+
tags,
|
|
43
|
+
readonlySpec,
|
|
44
|
+
});
|
|
30
45
|
|
|
31
46
|
return (
|
|
32
|
-
<Form
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
schema={FunctionTrigger}
|
|
47
|
+
<Form.Root<TriggerFormSchema>
|
|
48
|
+
{...formProps}
|
|
49
|
+
schema={omitId(Trigger.Trigger)}
|
|
36
50
|
values={trigger}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
db={db}
|
|
52
|
+
fieldMap={fieldMap}
|
|
53
|
+
>
|
|
54
|
+
<Form.Viewport>
|
|
55
|
+
<Form.Content>
|
|
56
|
+
<Form.FieldSet />
|
|
57
|
+
<Form.Actions />
|
|
58
|
+
</Form.Content>
|
|
59
|
+
</Form.Viewport>
|
|
60
|
+
</Form.Root>
|
|
41
61
|
);
|
|
42
62
|
};
|
|
43
63
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
type UseCustomInputsProps = {
|
|
65
|
+
db: Database.Database;
|
|
66
|
+
readonlySpec?: boolean;
|
|
67
|
+
} & Pick<QueryFormProps, 'types' | 'tags'>;
|
|
68
|
+
|
|
69
|
+
const useCustomInputs = ({ db, readonlySpec, types, tags }: UseCustomInputsProps): FormFieldMap => {
|
|
70
|
+
const functions = useQuery(db, Filter.type(Function.Function));
|
|
71
|
+
const workflows = useQuery(db, Filter.type(ComputeGraph));
|
|
72
|
+
const scripts = useQuery(db, Filter.type(Script.Script));
|
|
48
73
|
|
|
49
74
|
return useMemo(
|
|
50
|
-
():
|
|
75
|
+
(): FormFieldMap => ({
|
|
51
76
|
// Function selector.
|
|
52
|
-
['function' satisfies keyof
|
|
77
|
+
['function' satisfies keyof Trigger.Trigger]: (props) => {
|
|
53
78
|
const getValue = useCallback(() => {
|
|
54
79
|
const formValue = props.getValue();
|
|
55
80
|
if (Ref.isRef(formValue)) {
|
|
@@ -60,17 +85,17 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
60
85
|
|
|
61
86
|
const handleOnValueChange = useCallback(
|
|
62
87
|
(_type: any, dxnString: string) => {
|
|
63
|
-
const dxn =
|
|
88
|
+
const dxn = DXN.parse(dxnString);
|
|
64
89
|
if (dxn) {
|
|
65
90
|
const ref = Ref.fromDXN(dxn);
|
|
66
|
-
props.onValueChange(
|
|
91
|
+
props.onValueChange(props.type, ref);
|
|
67
92
|
}
|
|
68
93
|
},
|
|
69
|
-
[props.onValueChange],
|
|
94
|
+
[props.type, props.onValueChange],
|
|
70
95
|
);
|
|
71
96
|
|
|
72
97
|
return (
|
|
73
|
-
<
|
|
98
|
+
<SelectField
|
|
74
99
|
{...props}
|
|
75
100
|
getValue={getValue as any}
|
|
76
101
|
onValueChange={handleOnValueChange}
|
|
@@ -80,14 +105,28 @@ const useCustomInputs = (space: Space, onQueryRefOptions: FunctionInputEditorPro
|
|
|
80
105
|
},
|
|
81
106
|
|
|
82
107
|
// Spec selector.
|
|
83
|
-
['spec.kind' as const]: SpecSelector
|
|
108
|
+
['spec.kind' as const]: (props) => <SpecSelector {...props} readonly={readonlySpec} />,
|
|
109
|
+
|
|
110
|
+
// TODO(wittjosiah): Copied from ViewEditor.
|
|
111
|
+
// Query input editor.
|
|
112
|
+
['spec.query' as const]: (props) => {
|
|
113
|
+
const handleChange = useCallback(
|
|
114
|
+
(query: Query.Any) => props.onValueChange(props.type, { ast: query.ast }),
|
|
115
|
+
[props.type, props.onValueChange],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Input.Root>
|
|
120
|
+
<FormFieldLabel label={props.label} asChild />
|
|
121
|
+
<QueryForm initialQuery={(props.getValue() as any).ast} types={types} tags={tags} onChange={handleChange} />
|
|
122
|
+
</Input.Root>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
84
125
|
|
|
85
126
|
// Function input editor.
|
|
86
|
-
['input' as const]: (props) =>
|
|
87
|
-
<FunctionInputEditor {...props} functions={functions} onQueryRefOptions={onQueryRefOptions} />
|
|
88
|
-
),
|
|
127
|
+
['input' as const]: (props) => <FunctionInputEditor {...props} functions={functions} db={db} />,
|
|
89
128
|
}),
|
|
90
|
-
[workflows, scripts, functions],
|
|
129
|
+
[workflows, scripts, functions, readonlySpec],
|
|
91
130
|
);
|
|
92
131
|
};
|
|
93
132
|
|
|
@@ -95,7 +134,7 @@ const getWorkflowOptions = (graphs: ComputeGraph[]) => {
|
|
|
95
134
|
return graphs.map((graph) => ({ label: `compute-${graph.id}`, value: `dxn:echo:@:${graph.id}` }));
|
|
96
135
|
};
|
|
97
136
|
|
|
98
|
-
const getFunctionOptions = (scripts:
|
|
99
|
-
const getLabel = (fn:
|
|
137
|
+
const getFunctionOptions = (scripts: Script.Script[], functions: Function.Function[]) => {
|
|
138
|
+
const getLabel = (fn: Function.Function) => scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;
|
|
100
139
|
return functions.map((fn) => ({ label: getLabel(fn), value: `dxn:echo:@:${fn.id}` }));
|
|
101
140
|
};
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Database } from '@dxos/echo';
|
|
8
8
|
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { ControlItemInput } from '@dxos/react-ui-form';
|
|
10
10
|
|
|
11
11
|
import { useTriggerRuntimeControls } from '../hooks';
|
|
12
12
|
import { meta } from '../meta';
|
|
13
13
|
|
|
14
|
-
export const TriggersSettings = ({
|
|
15
|
-
const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(
|
|
14
|
+
export const TriggersSettings = ({ db }: { db: Database.Database }) => {
|
|
15
|
+
const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(db);
|
|
16
16
|
const { t } = useTranslation(meta.id);
|
|
17
17
|
|
|
18
18
|
return (
|
|
@@ -2,29 +2,66 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import * as Cause from 'effect/Cause';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Exit from 'effect/Exit';
|
|
8
|
+
import { type DependencyList, useCallback } from 'react';
|
|
7
9
|
|
|
8
|
-
import { useCapability } from '@dxos/app-framework';
|
|
9
|
-
import type
|
|
10
|
+
import { useCapability } from '@dxos/app-framework/react';
|
|
11
|
+
import { type Key } from '@dxos/echo';
|
|
12
|
+
import { type FunctionDefinition, FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
13
|
+
import { log } from '@dxos/log';
|
|
10
14
|
|
|
11
|
-
import { AutomationCapabilities } from '../
|
|
15
|
+
import { AutomationCapabilities } from '../types';
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Create an effectful function that has access to compute services
|
|
15
19
|
*/
|
|
20
|
+
// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).
|
|
16
21
|
export const useComputeRuntimeCallback = <T>(
|
|
17
|
-
|
|
22
|
+
id: Key.SpaceId | undefined,
|
|
18
23
|
fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,
|
|
19
|
-
deps?:
|
|
24
|
+
deps?: DependencyList,
|
|
20
25
|
): (() => Promise<T>) => {
|
|
21
26
|
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
22
|
-
const runtime =
|
|
27
|
+
const runtime = id !== undefined ? computeRuntime.getRuntime(id) : undefined;
|
|
23
28
|
|
|
24
29
|
return useCallback(() => {
|
|
25
30
|
if (!runtime) {
|
|
26
31
|
throw new TypeError('Space not provided to useComputeRuntimeCallback');
|
|
27
32
|
}
|
|
33
|
+
|
|
28
34
|
return runtime.runPromise(fn());
|
|
29
35
|
}, [runtime, ...(deps ?? [])]);
|
|
30
36
|
};
|
|
37
|
+
|
|
38
|
+
// TODO(wittjosiah): Function invoking should automatically be traced (DX-647).
|
|
39
|
+
export const invokeFunctionWithTracing = <I, O>(functionDef: FunctionDefinition<I, O>, inputData: I) =>
|
|
40
|
+
Effect.gen(function* () {
|
|
41
|
+
const tracer = yield* TracingService;
|
|
42
|
+
const trace = yield* tracer.traceInvocationStart({
|
|
43
|
+
target: undefined,
|
|
44
|
+
payload: {
|
|
45
|
+
data: {},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Invoke the function.
|
|
50
|
+
const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(
|
|
51
|
+
Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),
|
|
52
|
+
Effect.exit,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (Exit.isFailure(result)) {
|
|
56
|
+
const error = Cause.prettyErrors(result.cause)[0];
|
|
57
|
+
log.error(error.message, error.cause ?? error.stack);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
yield* tracer.traceInvocationEnd({
|
|
61
|
+
trace,
|
|
62
|
+
// TODO(dmaretskyi): Might miss errors.
|
|
63
|
+
exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
});
|
|
@@ -2,31 +2,32 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Filter } from '@dxos/echo';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { type Database, Filter } from '@dxos/echo';
|
|
8
|
+
import { Trigger } from '@dxos/functions';
|
|
9
|
+
import { TriggerDispatcher } from '@dxos/functions-runtime';
|
|
10
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
10
11
|
import { useAsyncState } from '@dxos/react-ui';
|
|
11
12
|
|
|
12
13
|
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
13
14
|
|
|
14
15
|
interface TriggerRuntimeControls {
|
|
15
|
-
triggers:
|
|
16
|
+
triggers: Trigger.Trigger[];
|
|
16
17
|
isRunning: boolean;
|
|
17
18
|
start: () => void;
|
|
18
19
|
stop: () => void;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export const useTriggerRuntimeControls = (
|
|
22
|
-
const triggers = useQuery(
|
|
22
|
+
export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
|
|
23
|
+
const triggers = useQuery(db, Filter.type(Trigger.Trigger));
|
|
23
24
|
|
|
24
25
|
const [isRunningState, setIsRunningState] = useAsyncState(
|
|
25
|
-
useComputeRuntimeCallback(
|
|
26
|
+
useComputeRuntimeCallback(db?.spaceId, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),
|
|
26
27
|
);
|
|
27
28
|
|
|
28
29
|
const start = useComputeRuntimeCallback(
|
|
29
|
-
|
|
30
|
+
db?.spaceId,
|
|
30
31
|
Effect.fnUntraced(function* () {
|
|
31
32
|
const dispatcher = yield* TriggerDispatcher;
|
|
32
33
|
yield* dispatcher.start();
|
|
@@ -35,7 +36,7 @@ export const useTriggerRuntimeControls = (space: Space | undefined): TriggerRunt
|
|
|
35
36
|
);
|
|
36
37
|
|
|
37
38
|
const stop = useComputeRuntimeCallback(
|
|
38
|
-
|
|
39
|
+
db?.spaceId,
|
|
39
40
|
Effect.fnUntraced(function* () {
|
|
40
41
|
const dispatcher = yield* TriggerDispatcher;
|
|
41
42
|
yield* dispatcher.stop();
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: AUTOMATION_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/automation',
|
|
11
10
|
name: 'Automation',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
13
|
+
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--robot--regular',
|
|
15
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
|
|
16
17
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { TestSchema } from '@dxos/client/testing';
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
export const functions = [
|
|
@@ -35,7 +35,7 @@ export const functions = [
|
|
|
35
35
|
version: '0.0.1',
|
|
36
36
|
inputSchema: Type.toJsonSchema(
|
|
37
37
|
Schema.Struct({
|
|
38
|
-
contact: Type.Ref(ContactType).annotations({ title: 'Contact' }),
|
|
38
|
+
contact: Type.Ref(TestSchema.ContactType).annotations({ title: 'Contact' }),
|
|
39
39
|
}),
|
|
40
40
|
),
|
|
41
41
|
},
|
package/src/translations.ts
CHANGED
|
@@ -22,10 +22,15 @@ export const translations = [
|
|
|
22
22
|
|
|
23
23
|
'functions panel label': 'Functions',
|
|
24
24
|
'functions verbose label': 'Manage deployed functions',
|
|
25
|
+
'functions registry verbose label': 'Functions registry',
|
|
26
|
+
'functions registry description': 'Import functions from the registry',
|
|
25
27
|
'functions description': 'You can manage all the functions deployed from your space on EDGE here.',
|
|
26
28
|
'function copy id': 'Copy Function ID',
|
|
27
29
|
'no functions found': 'No functions found',
|
|
28
30
|
'go to function source button label': 'Show function source',
|
|
31
|
+
'delete function button label': 'Delete function',
|
|
32
|
+
|
|
33
|
+
'function parameters label': 'Function parameters',
|
|
29
34
|
|
|
30
35
|
'trigger editor title': 'Configure Trigger',
|
|
31
36
|
'new trigger label': 'Add Trigger',
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
6
|
+
|
|
7
|
+
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type Database } from '@dxos/echo';
|
|
10
|
+
import type { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';
|
|
11
|
+
import type { TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';
|
|
12
|
+
import type { SpaceId } from '@dxos/keys';
|
|
13
|
+
|
|
14
|
+
import { meta } from '../meta';
|
|
15
|
+
|
|
16
|
+
export namespace AutomationCapabilities {
|
|
17
|
+
/**
|
|
18
|
+
* Service stack for executing agents, functions, and triggers.
|
|
19
|
+
*/
|
|
20
|
+
export type ComputeServices =
|
|
21
|
+
| TriggerDispatcher
|
|
22
|
+
| TriggerStateStore
|
|
23
|
+
| AiService.AiService
|
|
24
|
+
| Database.Service
|
|
25
|
+
| QueueService
|
|
26
|
+
| CredentialsService
|
|
27
|
+
| FunctionInvocationService
|
|
28
|
+
| TracingService
|
|
29
|
+
// TODO(dmaretskyi): Those should be provided at AI-chat call site.
|
|
30
|
+
| ToolResolverService
|
|
31
|
+
| ToolExecutionService;
|
|
32
|
+
|
|
33
|
+
export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;
|
|
34
|
+
export interface ComputeRuntimeProvider {
|
|
35
|
+
getRuntime(spaceId: SpaceId): ComputeRuntime;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Runtime for executing agents, functions, and triggers.
|
|
40
|
+
*/
|
|
41
|
+
export const ComputeRuntime = Capability.make<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);
|
|
42
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
export namespace AutomationEvents {
|
|
10
|
+
export const ComputeRuntimeReady = ActivationEvent.make(`${meta.id}/event/compute-runtime-ready`);
|
|
11
|
+
}
|