@dxos/plugin-automation 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/PLUGIN.mdl +428 -0
- package/README.md +1 -1
- package/dist/lib/neutral/AutomationArticle-GN36NUX2.mjs +17 -0
- package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs +165 -0
- package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1132 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs +36 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs +27 -0
- package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs +102 -0
- package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +25 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +19 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-24JKY6NU.mjs +21 -0
- package/dist/lib/neutral/chunk-24JKY6NU.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
- package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DUGOIM7G.mjs +36 -0
- package/dist/lib/neutral/chunk-DUGOIM7G.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FE7YFBX7.mjs +486 -0
- package/dist/lib/neutral/chunk-FE7YFBX7.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GARB7S5R.mjs +157 -0
- package/dist/lib/neutral/chunk-GARB7S5R.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HPUHQ3L6.mjs +64 -0
- package/dist/lib/neutral/chunk-HPUHQ3L6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-SONGOJRB.mjs +8 -0
- package/dist/lib/neutral/chunk-SONGOJRB.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +48 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +15 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-automation-OE3TNXYE.mjs +41 -0
- package/dist/lib/neutral/create-automation-OE3TNXYE.mjs.map +7 -0
- package/dist/lib/neutral/create-object-MEJOWGMH.mjs +25 -0
- package/dist/lib/neutral/create-object-MEJOWGMH.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +47 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +22 -0
- package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs +137 -0
- package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs +14 -0
- package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
- package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-IBRWUKPC.mjs +54 -0
- package/dist/lib/neutral/react-surface-IBRWUKPC.mjs.map +7 -0
- package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs +86 -0
- package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs.map +7 -0
- package/dist/lib/neutral/templates-ETXVD3VE.mjs +16 -0
- package/dist/lib/neutral/templates-ETXVD3VE.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/translations.mjs +64 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs +77 -0
- package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +18 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts +3 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/AutomationPlugin.node.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
- package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
- package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.test.d.ts +2 -0
- package/dist/types/src/capabilities/create-object.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +16 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +6 -0
- package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +9 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/registry-sync.d.ts +21 -0
- package/dist/types/src/capabilities/registry-sync.d.ts.map +1 -0
- package/dist/types/src/capabilities/templates.d.ts +6 -0
- package/dist/types/src/capabilities/templates.d.ts.map +1 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +5 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.d.ts.map +1 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts +2 -0
- package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts.map +1 -0
- package/dist/types/src/commands/index.d.ts +2 -0
- package/dist/types/src/commands/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/options.d.ts +10 -0
- package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts +11 -0
- package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/commands/trigger/util.d.ts +85 -0
- package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts +14 -0
- package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts.map +1 -0
- package/dist/types/src/components/CreateAutomationPanel/index.d.ts +2 -0
- package/dist/types/src/components/CreateAutomationPanel/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -7
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts +35 -0
- package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationArticle/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts +13 -0
- package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationCompanion/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationCompanion/index.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +10 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +5 -4
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-automation.d.ts +5 -0
- package/dist/types/src/operations/create-automation.d.ts.map +1 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/paths.d.ts +3 -0
- package/dist/types/src/paths.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/templates/index.d.ts +10 -0
- package/dist/types/src/templates/index.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +318 -3
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +90 -31
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Automation.d.ts +41 -0
- package/dist/types/src/types/Automation.d.ts.map +1 -0
- package/dist/types/src/types/Automation.test.d.ts +2 -0
- package/dist/types/src/types/Automation.test.d.ts.map +1 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts +42 -0
- package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/AutomationOperation.d.ts +31 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/Runnable.d.ts +14 -0
- package/dist/types/src/types/Runnable.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +13 -5
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/util/automations-for-object.d.ts +20 -0
- package/dist/types/src/util/automations-for-object.d.ts.map +1 -0
- package/dist/types/src/util/automations-for-object.test.d.ts +2 -0
- package/dist/types/src/util/automations-for-object.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +136 -71
- package/src/AutomationPlugin.node.ts +48 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +47 -35
- package/src/AutomationPlugin.workerd.ts +24 -0
- package/src/capabilities/app-graph-builder.ts +81 -78
- package/src/capabilities/create-object.test.ts +18 -0
- package/src/capabilities/create-object.ts +26 -0
- package/src/capabilities/index.ts +17 -7
- package/src/capabilities/layer-specs.ts +196 -0
- package/src/capabilities/navigation-resolver.ts +19 -0
- package/src/capabilities/node.ts +19 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +45 -46
- package/src/capabilities/registry-sync.ts +114 -0
- package/src/capabilities/templates.ts +17 -0
- package/src/capabilities/trigger-runtime-controller.test.ts +107 -0
- package/src/capabilities/trigger-runtime-controller.ts +126 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/trigger/create/index.ts +14 -0
- package/src/commands/trigger/create/queue.ts +87 -0
- package/src/commands/trigger/create/subscription.ts +126 -0
- package/src/commands/trigger/create/timer.ts +90 -0
- package/src/commands/trigger/index.ts +16 -0
- package/src/commands/trigger/list.ts +69 -0
- package/src/commands/trigger/options.ts +47 -0
- package/src/commands/trigger/remove.ts +45 -0
- package/src/commands/trigger/update/index.ts +14 -0
- package/src/commands/trigger/update/queue.ts +191 -0
- package/src/commands/trigger/update/subscription.ts +279 -0
- package/src/commands/trigger/update/timer.ts +195 -0
- package/src/commands/trigger/util.ts +410 -0
- package/src/components/CreateAutomationPanel/CreateAutomationPanel.tsx +68 -0
- package/src/components/CreateAutomationPanel/index.ts +5 -0
- package/src/components/index.ts +1 -8
- package/src/containers/AutomationArticle/AutomationArticle.tsx +586 -0
- package/src/containers/AutomationArticle/index.ts +6 -0
- package/src/containers/AutomationCompanion/AutomationCompanion.tsx +183 -0
- package/src/containers/AutomationCompanion/index.ts +6 -0
- package/src/containers/AutomationSettings/AutomationSettings.tsx +34 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +10 -0
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useTriggerRuntimeControls.ts +38 -19
- package/src/index.ts +1 -6
- package/src/meta.ts +23 -7
- package/src/operations/create-automation.ts +38 -0
- package/src/operations/create-trigger-from-template.ts +70 -0
- package/src/operations/index.ts +10 -0
- package/src/paths.ts +13 -0
- package/src/plugin.ts +11 -0
- package/src/templates/index.ts +22 -0
- package/src/testing/test-functions.ts +43 -9
- package/src/testing.ts +7 -0
- package/src/translations.ts +49 -33
- package/src/types/Automation.test.ts +37 -0
- package/src/types/Automation.ts +45 -0
- package/src/types/AutomationCapabilities.ts +52 -0
- package/src/types/AutomationOperation.ts +61 -0
- package/src/types/Runnable.ts +14 -0
- package/src/types/index.ts +5 -0
- package/src/types/schema.ts +6 -6
- package/src/util/automations-for-object.test.ts +86 -0
- package/src/util/automations-for-object.ts +72 -0
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/AutomationPanel-7OECLR5N.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-KCZISXI6.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs +0 -151
- package/dist/lib/browser/FunctionsContainer-MIWEISRR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-CRW6SJUN.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-EPEXQP45.mjs +0 -14
- package/dist/lib/browser/chunk-EPEXQP45.mjs.map +0 -7
- package/dist/lib/browser/chunk-JW7XSPYW.mjs +0 -267
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs +0 -17
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-NAPXRXTY.mjs +0 -100
- package/dist/lib/browser/chunk-NAPXRXTY.mjs.map +0 -7
- package/dist/lib/browser/chunk-QKFBHAGN.mjs +0 -184
- package/dist/lib/browser/chunk-QKFBHAGN.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +0 -113
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +0 -7
- package/dist/lib/browser/hooks/index.mjs +0 -13
- package/dist/lib/browser/index.mjs +0 -130
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-YQW7WCFW.mjs +0 -64
- package/dist/lib/browser/react-surface-YQW7WCFW.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationPanel-HCVFNHGQ.mjs +0 -12
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-UUUPVNUJ.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs +0 -152
- package/dist/lib/node-esm/FunctionsContainer-6OB3JN5O.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-RVVCS6VH.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6YRKST6M.mjs +0 -185
- package/dist/lib/node-esm/chunk-6YRKST6M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs +0 -19
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CPP35BE6.mjs +0 -16
- package/dist/lib/node-esm/chunk-CPP35BE6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PICJ2REN.mjs +0 -101
- package/dist/lib/node-esm/chunk-PICJ2REN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs +0 -268
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -14
- package/dist/lib/node-esm/index.mjs +0 -131
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs +0 -65
- package/dist/lib/node-esm/react-surface-NNHYNBO6.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/types/src/capabilities/capabilities.d.ts +0 -20
- 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/components/AutomationPanel/AutomationPanel.d.ts +0 -13
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +0 -50
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/index.d.ts +0 -4
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts +0 -7
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts +0 -4
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +0 -8
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +0 -2
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +0 -12
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +0 -5
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +0 -13
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +0 -51
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/index.d.ts +0 -2
- package/dist/types/src/components/TriggerEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +0 -12
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -41
- package/src/capabilities/compute-runtime.ts +0 -127
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +0 -56
- package/src/components/AutomationPanel/AutomationPanel.tsx +0 -223
- package/src/components/AutomationPanel/index.ts +0 -9
- package/src/components/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -36
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -116
- package/src/components/FunctionsPanel/index.ts +0 -8
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +0 -135
- package/src/components/FunctionsRegistry/index.ts +0 -5
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +0 -84
- package/src/components/TriggerEditor/SpecSelector.tsx +0 -65
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +0 -121
- package/src/components/TriggerEditor/TriggerEditor.tsx +0 -127
- package/src/components/TriggerEditor/index.ts +0 -5
- package/src/components/TriggerSettings.tsx +0 -25
- package/src/events.ts +0 -11
- package/src/hooks/useComputeRuntimeCallback.ts +0 -68
- /package/dist/lib/{browser/AutomationPanel-7OECLR5N.mjs.map → neutral/AutomationArticle-GN36NUX2.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-CRW6SJUN.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/hooks/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/hooks → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-HCVFNHGQ.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → neutral/testing.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type Database, Filter, Obj, Type } from '@dxos/echo';
|
|
9
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
10
|
+
import { DropdownMenu, Icon, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { Accordion } from '@dxos/react-ui-list';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { Automation, AutomationCapabilities, AutomationOperation } from '#types';
|
|
15
|
+
|
|
16
|
+
import { AutomationInlineForm } from '../../containers/AutomationArticle';
|
|
17
|
+
import { connectedAutomationsQuery } from '../../util/automations-for-object';
|
|
18
|
+
|
|
19
|
+
export type AutomationCompanionProps = {
|
|
20
|
+
db: Database.Database;
|
|
21
|
+
object: Obj.Unknown;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Association state of a row relative to the companion's object. */
|
|
25
|
+
type Status = 'associated' | 'pending' | 'detached';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Renders the automations connected to an object as an accordion (see `useConnectedAutomations` for the
|
|
29
|
+
* session-stable list it draws from), flagging non-associated rows with a warning badge. New automations are
|
|
30
|
+
* created from a template dropdown (no dialog).
|
|
31
|
+
*/
|
|
32
|
+
export const AutomationCompanion = ({ db, object }: AutomationCompanionProps) => {
|
|
33
|
+
const { t } = useTranslation(meta.id);
|
|
34
|
+
const templates = useCapabilities(AutomationCapabilities.Template);
|
|
35
|
+
// Only offer templates applicable to this companion's subject (e.g. a CRM template needs a Mailbox).
|
|
36
|
+
const applicableTemplates = useMemo(
|
|
37
|
+
() => templates.filter((template) => template.appliesTo?.(object) ?? true),
|
|
38
|
+
[templates, object],
|
|
39
|
+
);
|
|
40
|
+
const { items, statusFor, open, setOpen, handleCreate } = useConnectedAutomations(db, object);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className='flex flex-col'>
|
|
44
|
+
{items.length === 0 ? (
|
|
45
|
+
<p className='text-sm text-description p-2'>{t('no-automations.message')}</p>
|
|
46
|
+
) : (
|
|
47
|
+
<Accordion.Root<Automation.Automation> items={items} value={open} onValueChange={setOpen}>
|
|
48
|
+
{({ items }) => (
|
|
49
|
+
<div className='flex flex-col divide-y divide-separator'>
|
|
50
|
+
{items.map((automation) => {
|
|
51
|
+
const status = statusFor(automation.id);
|
|
52
|
+
return (
|
|
53
|
+
<Accordion.Item key={automation.id} item={automation}>
|
|
54
|
+
<Accordion.ItemHeader>
|
|
55
|
+
<Icon icon='ph--lightning--regular' size={4} classNames='mr-2 shrink-0' />
|
|
56
|
+
<span className='flex-1 truncate'>
|
|
57
|
+
{Obj.getLabel(automation) ??
|
|
58
|
+
t('object-name.placeholder', { ns: Type.getTypename(Automation.Automation) })}
|
|
59
|
+
</span>
|
|
60
|
+
{status !== 'associated' && (
|
|
61
|
+
<Tooltip.Trigger
|
|
62
|
+
asChild
|
|
63
|
+
side='bottom'
|
|
64
|
+
content={t(
|
|
65
|
+
status === 'pending' ? 'automation-not-associated.message' : 'automation-detached.message',
|
|
66
|
+
)}
|
|
67
|
+
>
|
|
68
|
+
<Icon icon='ph--warning--regular' size={4} classNames='text-warning-text shrink-0 mr-2' />
|
|
69
|
+
</Tooltip.Trigger>
|
|
70
|
+
)}
|
|
71
|
+
</Accordion.ItemHeader>
|
|
72
|
+
<Accordion.ItemBody>
|
|
73
|
+
<AutomationInlineForm automation={automation} db={db} />
|
|
74
|
+
</Accordion.ItemBody>
|
|
75
|
+
</Accordion.Item>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
</Accordion.Root>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
<div className='border-t border-separator'>
|
|
84
|
+
<DropdownMenu.Root>
|
|
85
|
+
<DropdownMenu.Trigger asChild>
|
|
86
|
+
{/* Mirror the accordion item header layout (p-2 + icon mr-2) so the icon aligns with the rows above. */}
|
|
87
|
+
<button type='button' className='group flex items-center p-2 dx-focus-ring-inset w-full text-start'>
|
|
88
|
+
<Icon icon='ph--plus--regular' size={4} classNames='mr-2 shrink-0' />
|
|
89
|
+
<span className='flex-1 truncate'>
|
|
90
|
+
{t('add-object.label', { ns: Type.getTypename(Automation.Automation) })}
|
|
91
|
+
</span>
|
|
92
|
+
</button>
|
|
93
|
+
</DropdownMenu.Trigger>
|
|
94
|
+
<DropdownMenu.Portal>
|
|
95
|
+
<DropdownMenu.Content>
|
|
96
|
+
<DropdownMenu.Viewport>
|
|
97
|
+
{applicableTemplates.map((template) => (
|
|
98
|
+
<DropdownMenu.Item key={template.id} onClick={() => void handleCreate(template.id)}>
|
|
99
|
+
<Icon icon={template.icon ?? 'ph--lightning--regular'} size={4} />
|
|
100
|
+
<span>{template.label}</span>
|
|
101
|
+
</DropdownMenu.Item>
|
|
102
|
+
))}
|
|
103
|
+
</DropdownMenu.Viewport>
|
|
104
|
+
<DropdownMenu.Arrow />
|
|
105
|
+
</DropdownMenu.Content>
|
|
106
|
+
</DropdownMenu.Portal>
|
|
107
|
+
</DropdownMenu.Root>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//
|
|
114
|
+
// Hooks
|
|
115
|
+
//
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Owns the companion's session-stable automation list. A reactive reverse-ref query supplies the live
|
|
119
|
+
* connected set, accumulated into an append-only ordering so rows never reorder or disappear while mounted;
|
|
120
|
+
* a row that loses its association (or a freshly-created one not yet connected) is surfaced via `statusFor`
|
|
121
|
+
* rather than dropped. Also holds the accordion open state and a create handler that appends the new
|
|
122
|
+
* automation and auto-expands it for immediate configuration.
|
|
123
|
+
*/
|
|
124
|
+
const useConnectedAutomations = (db: Database.Database, object: Obj.Unknown) => {
|
|
125
|
+
const { invokePromise } = useOperationInvoker();
|
|
126
|
+
|
|
127
|
+
// Live connected set (reactive reverse-ref query) + a by-id map for resolving rows that have left it.
|
|
128
|
+
const connected = useQuery(db, connectedAutomationsQuery(object));
|
|
129
|
+
const all = useQuery(db, Filter.type(Automation.Automation));
|
|
130
|
+
const connectedIds = useMemo(() => new Set(connected.map((automation) => automation.id)), [connected]);
|
|
131
|
+
const byId = useMemo(() => new Map(all.map((automation) => [automation.id, automation])), [all]);
|
|
132
|
+
|
|
133
|
+
// Session-stable bookkeeping (held for the component lifetime).
|
|
134
|
+
const seenOrder = useRef<string[]>([]);
|
|
135
|
+
const everConnected = useRef<Set<string>>(new Set());
|
|
136
|
+
const [createdIds, setCreatedIds] = useState<ReadonlySet<string>>(() => new Set());
|
|
137
|
+
const [open, setOpen] = useState<string[]>([]);
|
|
138
|
+
|
|
139
|
+
// Accumulate first-seen order and "was ever connected" — append-only, so rows never reorder or drop.
|
|
140
|
+
for (const id of connectedIds) {
|
|
141
|
+
everConnected.current.add(id);
|
|
142
|
+
}
|
|
143
|
+
for (const id of [...connectedIds, ...createdIds]) {
|
|
144
|
+
if (!seenOrder.current.includes(id)) {
|
|
145
|
+
seenOrder.current.push(id);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Resolve to live objects in stable order, dropping ids whose object was hard-deleted.
|
|
150
|
+
const items = useMemo(
|
|
151
|
+
() =>
|
|
152
|
+
seenOrder.current.flatMap((id) => {
|
|
153
|
+
const automation = byId.get(id);
|
|
154
|
+
return automation ? [automation] : [];
|
|
155
|
+
}),
|
|
156
|
+
[byId, connectedIds, createdIds],
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const statusFor = useCallback(
|
|
160
|
+
(id: string): Status =>
|
|
161
|
+
connectedIds.has(id) ? 'associated' : everConnected.current.has(id) ? 'detached' : 'pending',
|
|
162
|
+
[connectedIds],
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const handleCreate = useCallback(
|
|
166
|
+
async (templateId: string) => {
|
|
167
|
+
const { data, error } = await invokePromise(AutomationOperation.CreateAutomation, {
|
|
168
|
+
db,
|
|
169
|
+
templateId,
|
|
170
|
+
subject: object,
|
|
171
|
+
});
|
|
172
|
+
if (error || !data) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setCreatedIds((prev) => new Set(prev).add(data.object.id));
|
|
177
|
+
setOpen((prev) => (prev.includes(data.object.id) ? prev : [...prev, data.object.id]));
|
|
178
|
+
},
|
|
179
|
+
[invokePromise, db, object],
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
return { items, statusFor, open, setOpen, handleCreate };
|
|
183
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { TriggersSettings } from '../TriggerSettings';
|
|
14
|
+
|
|
15
|
+
export type AutomationSettingsProps = AppSurface.SpaceArticleProps;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Space-level automation settings. Individual automations are now first-class objects (configured in their
|
|
19
|
+
* article + per-object companion), so this page is focused on runtime management — where the space's
|
|
20
|
+
* automations execute.
|
|
21
|
+
*/
|
|
22
|
+
export const AutomationSettings = ({ space }: AutomationSettingsProps) => {
|
|
23
|
+
const { t } = useTranslation(meta.id);
|
|
24
|
+
return (
|
|
25
|
+
<Settings.Viewport>
|
|
26
|
+
<Settings.Section
|
|
27
|
+
title={t('automation-verbose.label', { ns: meta.id })}
|
|
28
|
+
description={t('automation.description', { ns: meta.id })}
|
|
29
|
+
>
|
|
30
|
+
<TriggersSettings space={space} />
|
|
31
|
+
</Settings.Section>
|
|
32
|
+
</Settings.Viewport>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ComputeEnvironment } from '@dxos/client-protocol';
|
|
8
|
+
import { useObject } from '@dxos/echo-react';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { DropdownMenu, IconButton, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
export const TriggersSettings = ({ space }: { space: Space }) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
const [properties, changeProperties] = useObject(space.properties);
|
|
18
|
+
const selected = properties.computeEnvironment ?? 'local';
|
|
19
|
+
|
|
20
|
+
const handleUpdate = (option: ComputeEnvironment) => {
|
|
21
|
+
changeProperties((draft) => {
|
|
22
|
+
draft.computeEnvironment = option;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
28
|
+
<Settings.Item title={t('runtime.label')} description={t('runtime.description')}>
|
|
29
|
+
<DropdownMenu.Root>
|
|
30
|
+
<DropdownMenu.Trigger asChild>
|
|
31
|
+
<IconButton iconEnd icon='ph--caret-down--regular' size={4} label={t(`runtime.${selected}.label`)} />
|
|
32
|
+
</DropdownMenu.Trigger>
|
|
33
|
+
<DropdownMenu.Portal>
|
|
34
|
+
<DropdownMenu.Content side='bottom'>
|
|
35
|
+
<DropdownMenu.Viewport>
|
|
36
|
+
<DropdownMenu.Item onClick={() => handleUpdate('disabled')}>
|
|
37
|
+
{t(`runtime.disabled.label`)}
|
|
38
|
+
</DropdownMenu.Item>
|
|
39
|
+
<DropdownMenu.Item onClick={() => handleUpdate('local')}>{t(`runtime.local.label`)}</DropdownMenu.Item>
|
|
40
|
+
<DropdownMenu.Item onClick={() => handleUpdate('edge')}>{t(`runtime.edge.label`)}</DropdownMenu.Item>
|
|
41
|
+
</DropdownMenu.Viewport>
|
|
42
|
+
</DropdownMenu.Content>
|
|
43
|
+
</DropdownMenu.Portal>
|
|
44
|
+
</DropdownMenu.Root>
|
|
45
|
+
</Settings.Item>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const AutomationArticle: ComponentType<any> = lazy(() => import('./AutomationArticle'));
|
|
8
|
+
export const AutomationSettings: ComponentType<any> = lazy(() => import('./AutomationSettings'));
|
|
9
|
+
export const AutomationCompanion: ComponentType<any> = lazy(() => import('./AutomationCompanion'));
|
|
10
|
+
export const TriggerSettings: ComponentType<any> = lazy(() => import('./TriggerSettings'));
|
package/src/hooks/index.ts
CHANGED
|
@@ -2,51 +2,70 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Context from 'effect/Context';
|
|
5
7
|
import * as Effect from 'effect/Effect';
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
6
9
|
|
|
7
|
-
import {
|
|
8
|
-
import { Trigger } from '@dxos/
|
|
9
|
-
import {
|
|
10
|
-
import { type
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
10
|
+
import { useSpaceCallback } from '@dxos/app-framework/ui';
|
|
11
|
+
import { Trigger } from '@dxos/compute';
|
|
12
|
+
import { type Database, Filter, Query } from '@dxos/echo';
|
|
13
|
+
import { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';
|
|
14
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
15
|
|
|
15
16
|
interface TriggerRuntimeControls {
|
|
16
17
|
triggers: Trigger.Trigger[];
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
state: TriggerDispatcherState | undefined;
|
|
20
|
+
|
|
18
21
|
start: () => void;
|
|
19
22
|
stop: () => void;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export const useTriggerRuntimeControls = (
|
|
23
|
-
const triggers = useQuery(
|
|
25
|
+
export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
|
|
26
|
+
const triggers = useQuery(
|
|
27
|
+
db,
|
|
28
|
+
Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.useTriggerRuntimeControls'),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);
|
|
24
32
|
|
|
25
|
-
const
|
|
26
|
-
|
|
33
|
+
const init = useSpaceCallback(
|
|
34
|
+
db?.spaceId,
|
|
35
|
+
[TriggerDispatcher],
|
|
36
|
+
Effect.fnUntraced(function* () {
|
|
37
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
38
|
+
setDispatcher(dispatcher);
|
|
39
|
+
}),
|
|
27
40
|
);
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
void init();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));
|
|
47
|
+
|
|
48
|
+
const start = useSpaceCallback(
|
|
49
|
+
db?.spaceId,
|
|
50
|
+
[TriggerDispatcher],
|
|
31
51
|
Effect.fnUntraced(function* () {
|
|
32
52
|
const dispatcher = yield* TriggerDispatcher;
|
|
33
53
|
yield* dispatcher.start();
|
|
34
|
-
setIsRunningState(true);
|
|
35
54
|
}),
|
|
36
55
|
);
|
|
37
56
|
|
|
38
|
-
const stop =
|
|
39
|
-
|
|
57
|
+
const stop = useSpaceCallback(
|
|
58
|
+
db?.spaceId,
|
|
59
|
+
[TriggerDispatcher],
|
|
40
60
|
Effect.fnUntraced(function* () {
|
|
41
61
|
const dispatcher = yield* TriggerDispatcher;
|
|
42
62
|
yield* dispatcher.stop();
|
|
43
|
-
setIsRunningState(false);
|
|
44
63
|
}),
|
|
45
64
|
);
|
|
46
65
|
|
|
47
66
|
return {
|
|
48
67
|
triggers,
|
|
49
|
-
|
|
68
|
+
state,
|
|
50
69
|
start: () => void start(),
|
|
51
70
|
stop: () => void stop(),
|
|
52
71
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { AutomationCapabilities } from './capabilities';
|
|
6
|
-
export * from './components';
|
|
7
5
|
export * from './meta';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './hooks';
|
|
10
|
-
|
|
11
|
-
export * from './AutomationPlugin';
|
|
6
|
+
export * from './types';
|
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,32 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.automation'),
|
|
10
11
|
name: 'Automation',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Event-driven workflow automation engine for DXOS Composer.
|
|
15
|
+
An Automation is a user-facing object pairing a trigger ("when" — a timer schedule or an
|
|
16
|
+
incoming feed) with an action ("then" — a persistent compute operation or routine), enabling
|
|
17
|
+
automated pipelines that react to changes in real time without manual intervention.
|
|
18
|
+
|
|
19
|
+
Automations are configured in their own article and surfaced on a per-object "Automations"
|
|
20
|
+
companion that lists the automations connected to each object. A per-space TriggerDispatcher
|
|
21
|
+
manages execution: running locally in the browser when computeEnvironment is "local", or
|
|
22
|
+
delegating to the DXOS edge for server-side reliability; the space settings page chooses the
|
|
23
|
+
runtime location.
|
|
24
|
+
|
|
25
|
+
Operation handlers and blueprints contributed by any plugin in the application are
|
|
26
|
+
automatically merged and made available to every space's OperationRegistry, so new
|
|
27
|
+
capabilities registered by other plugins become instantly invocable from automations.
|
|
14
28
|
`,
|
|
15
|
-
icon: 'ph--
|
|
29
|
+
icon: 'ph--atom--regular',
|
|
16
30
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
|
|
17
|
-
|
|
31
|
+
spec: 'PLUGIN.mdl',
|
|
32
|
+
tags: ['system'],
|
|
33
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Database } from '@dxos/echo';
|
|
10
|
+
import { invariant } from '@dxos/invariant';
|
|
11
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
12
|
+
|
|
13
|
+
import { getAutomationsPath } from '../paths';
|
|
14
|
+
import { AutomationCapabilities, AutomationOperation } from '../types';
|
|
15
|
+
|
|
16
|
+
const handler: Operation.WithHandler<typeof AutomationOperation.CreateAutomation> =
|
|
17
|
+
AutomationOperation.CreateAutomation.pipe(
|
|
18
|
+
Operation.withHandler(
|
|
19
|
+
Effect.fnUntraced(function* ({ db, templateId, name, subject }) {
|
|
20
|
+
const templates = yield* Capability.getAll(AutomationCapabilities.Template);
|
|
21
|
+
const template = templates.find((entry) => entry.id === templateId);
|
|
22
|
+
invariant(template, `Unknown automation template: ${templateId}`);
|
|
23
|
+
|
|
24
|
+
const object = yield* template
|
|
25
|
+
.scaffold({ name, subject })
|
|
26
|
+
.pipe(Effect.provideService(Database.Service, Database.makeService(db)));
|
|
27
|
+
|
|
28
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
29
|
+
object,
|
|
30
|
+
target: db,
|
|
31
|
+
hidden: true,
|
|
32
|
+
targetNodeId: getAutomationsPath(db.spaceId),
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export default handler;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation, getSpacePath } from '@dxos/app-toolkit';
|
|
8
|
+
import { Operation, Script, Trigger } from '@dxos/compute';
|
|
9
|
+
import { type Feed, Filter, Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
import { AutomationOperation } from '../types';
|
|
15
|
+
|
|
16
|
+
const handler: Operation.WithHandler<typeof AutomationOperation.CreateTriggerFromTemplate> =
|
|
17
|
+
AutomationOperation.CreateTriggerFromTemplate.pipe(
|
|
18
|
+
Operation.withHandler(
|
|
19
|
+
Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
|
|
20
|
+
const trigger = Trigger.make({ enabled, input });
|
|
21
|
+
|
|
22
|
+
// TODO(wittjosiah): Factor out function lookup by script name?
|
|
23
|
+
if (scriptName) {
|
|
24
|
+
const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, { name: scriptName })).run());
|
|
25
|
+
const [script] = scripts;
|
|
26
|
+
if (script) {
|
|
27
|
+
const functions = yield* Effect.promise(() =>
|
|
28
|
+
db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(script) })).run(),
|
|
29
|
+
);
|
|
30
|
+
const [fn] = functions;
|
|
31
|
+
if (fn) {
|
|
32
|
+
Obj.update(trigger, (trigger) => {
|
|
33
|
+
trigger.function = Ref.make(fn);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
switch (template.type) {
|
|
40
|
+
case 'timer': {
|
|
41
|
+
Obj.update(trigger, (trigger) => {
|
|
42
|
+
trigger.spec = Trigger.specTimer(template.cron);
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'feed': {
|
|
47
|
+
Obj.update(trigger, (trigger) => {
|
|
48
|
+
trigger.spec = Trigger.specFeed(template.feed as Feed.Feed);
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
default: {
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
58
|
+
object: trigger,
|
|
59
|
+
target: db,
|
|
60
|
+
hidden: true,
|
|
61
|
+
});
|
|
62
|
+
yield* Operation.invoke(LayoutOperation.Open, {
|
|
63
|
+
subject: [`${getSpacePath(db.spaceId)}/settings/${meta.id}.automations`],
|
|
64
|
+
workspace: getSpacePath(db.spaceId),
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
export default handler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export const AutomationOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
+
() => import('./create-trigger-from-template'),
|
|
9
|
+
() => import('./create-automation'),
|
|
10
|
+
);
|
package/src/paths.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createTypeSectionPaths } from '@dxos/app-toolkit';
|
|
6
|
+
|
|
7
|
+
import { Automation } from '#types';
|
|
8
|
+
|
|
9
|
+
const { getSectionPath: getAutomationsPath, getObjectPath: getAutomationPath } = createTypeSectionPaths(
|
|
10
|
+
Automation.Automation,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export { getAutomationsPath, getAutomationPath };
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const AutomationPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { AutomationOperationHandlerSet } from './operations';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Automation, type AutomationCapabilities } from '#types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Blank template: mints an empty automation with no runnable and no triggers; the action and trigger are
|
|
11
|
+
* configured in the automation article. This is the no-op template (the create dialog's default), so the
|
|
12
|
+
* create flow has a single resolve→scaffold path with no special-casing.
|
|
13
|
+
*/
|
|
14
|
+
export const blank: AutomationCapabilities.Template = {
|
|
15
|
+
id: 'org.dxos.automation.blank',
|
|
16
|
+
label: 'Blank',
|
|
17
|
+
icon: 'ph--lightning--regular',
|
|
18
|
+
scaffold: ({ name }) => Effect.succeed(Automation.make({ name, triggers: [] })),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Templates contributed by plugin-automation itself. */
|
|
22
|
+
export const defaultTemplates: AutomationCapabilities.Template[] = [blank];
|