@dxos/plugin-automation 0.8.4-main.fd6878d → 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/operations/index.mjs.map +7 -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/testing.mjs.map +7 -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 -3
- 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 +6 -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 +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +12 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- 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 -26
- 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 +14 -6
- 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 +140 -52
- package/src/AutomationPlugin.node.ts +48 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +52 -34
- package/src/AutomationPlugin.workerd.ts +24 -0
- package/src/capabilities/app-graph-builder.ts +82 -78
- package/src/capabilities/create-object.test.ts +18 -0
- package/src/capabilities/create-object.ts +26 -0
- package/src/capabilities/index.ts +17 -4
- 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 +6 -0
- package/src/hooks/useTriggerRuntimeControls.ts +72 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +26 -9
- 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 +44 -10
- package/src/testing.ts +7 -0
- package/src/translations.ts +49 -26
- 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 +7 -7
- 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/AutomationContainer-5UYKI7EG.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-5UYKI7EG.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-YYERBNYJ.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs +0 -39
- package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-I443Y6KB.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs.map +0 -7
- package/dist/lib/browser/chunk-7EE4SA6M.mjs +0 -230
- package/dist/lib/browser/chunk-7EE4SA6M.mjs.map +0 -7
- package/dist/lib/browser/chunk-CHENFUQ6.mjs +0 -14
- package/dist/lib/browser/chunk-CHENFUQ6.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-OX6OW6XP.mjs +0 -147
- package/dist/lib/browser/chunk-OX6OW6XP.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/index.mjs +0 -101
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs +0 -76
- package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-WNOIIT4O.mjs +0 -64
- package/dist/lib/browser/react-surface-WNOIIT4O.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-5EQQF5S2.mjs +0 -12
- package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs +0 -40
- package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-ELINCXPW.mjs +0 -11
- package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-555IHYOB.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-D4VWZD53.mjs +0 -16
- package/dist/lib/node-esm/chunk-D4VWZD53.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GHRG4NQV.mjs +0 -148
- package/dist/lib/node-esm/chunk-GHRG4NQV.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-YPUO4IVX.mjs +0 -231
- package/dist/lib/node-esm/chunk-YPUO4IVX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -102
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs +0 -77
- package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs +0 -65
- package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- 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/AutomationContainer.d.ts +0 -5
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +0 -12
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +0 -6
- 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/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/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 -11
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +0 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +0 -6
- 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/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationContainer.tsx +0 -31
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +0 -58
- package/src/components/AutomationPanel/AutomationPanel.tsx +0 -171
- package/src/components/AutomationPanel/index.ts +0 -9
- package/src/components/FunctionsContainer.tsx +0 -32
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -97
- package/src/components/FunctionsPanel/index.ts +0 -8
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +0 -78
- package/src/components/TriggerEditor/SpecSelector.tsx +0 -59
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +0 -79
- package/src/components/TriggerEditor/TriggerEditor.tsx +0 -107
- package/src/components/TriggerEditor/index.ts +0 -5
- /package/dist/lib/{browser/AutomationPanel-YYERBNYJ.mjs.map → neutral/AutomationArticle-GN36NUX2.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-I443Y6KB.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-5EQQF5S2.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-ELINCXPW.mjs.map → neutral/meta.mjs.map} +0 -0
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { TestSchema } from '@dxos/client/testing';
|
|
8
|
+
import { JsonSchema, Ref, DXN } from '@dxos/echo';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Operations seeded into the local space in stories.
|
|
12
|
+
*/
|
|
10
13
|
export const functions = [
|
|
11
14
|
{
|
|
12
|
-
|
|
15
|
+
key: DXN.make('com.example.function.chess'),
|
|
16
|
+
name: 'com.example.function.chess',
|
|
13
17
|
version: '0.1.0',
|
|
14
|
-
inputSchema:
|
|
18
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
15
19
|
Schema.Struct({
|
|
16
20
|
level: Schema.Number.annotations({
|
|
17
21
|
title: 'Level',
|
|
@@ -20,10 +24,11 @@ export const functions = [
|
|
|
20
24
|
),
|
|
21
25
|
},
|
|
22
26
|
{
|
|
23
|
-
|
|
27
|
+
key: DXN.make('com.example.function.forex'),
|
|
28
|
+
name: 'com.example.function.forex',
|
|
24
29
|
version: '0.1.0',
|
|
25
30
|
binding: 'FOREX',
|
|
26
|
-
inputSchema:
|
|
31
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
27
32
|
Schema.Struct({
|
|
28
33
|
from: Schema.String.annotations({ title: 'Currency from' }),
|
|
29
34
|
to: Schema.String.annotations({ title: 'Currency to' }),
|
|
@@ -31,11 +36,40 @@ export const functions = [
|
|
|
31
36
|
),
|
|
32
37
|
},
|
|
33
38
|
{
|
|
34
|
-
|
|
39
|
+
key: DXN.make('com.example.function.pingContact'),
|
|
40
|
+
name: 'com.example.function.ping-contact',
|
|
35
41
|
version: '0.0.1',
|
|
36
|
-
inputSchema:
|
|
42
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
37
43
|
Schema.Struct({
|
|
38
|
-
contact:
|
|
44
|
+
contact: Ref.Ref(TestSchema.ContactType).annotations({ title: 'Contact' }),
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Operations seeded into the registry (not the local space) in stories.
|
|
52
|
+
* Simulates built-in or plugin-provided operations available globally.
|
|
53
|
+
*/
|
|
54
|
+
export const registryFunctions = [
|
|
55
|
+
{
|
|
56
|
+
key: 'com.example.function.translate',
|
|
57
|
+
name: 'com.example.function.translate',
|
|
58
|
+
version: '0.1.0',
|
|
59
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
60
|
+
Schema.Struct({
|
|
61
|
+
text: Schema.String.annotations({ title: 'Text' }),
|
|
62
|
+
targetLanguage: Schema.String.annotations({ title: 'Target language' }),
|
|
63
|
+
}),
|
|
64
|
+
),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: 'com.example.function.summarize',
|
|
68
|
+
name: 'com.example.function.summarize',
|
|
69
|
+
version: '0.1.0',
|
|
70
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
71
|
+
Schema.Struct({
|
|
72
|
+
content: Schema.String.annotations({ title: 'Content' }),
|
|
39
73
|
}),
|
|
40
74
|
),
|
|
41
75
|
},
|
package/src/testing.ts
ADDED
package/src/translations.ts
CHANGED
|
@@ -2,42 +2,65 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
5
6
|
import { type Resource } from '@dxos/react-ui';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
|
+
import { Automation } from '#types';
|
|
8
10
|
|
|
9
11
|
export const translations = [
|
|
10
12
|
{
|
|
11
13
|
'en-US': {
|
|
14
|
+
[Type.getTypename(Automation.Automation)]: {
|
|
15
|
+
'typename.label': 'Automation',
|
|
16
|
+
'typename.label_zero': 'Automations',
|
|
17
|
+
'typename.label_one': 'Automation',
|
|
18
|
+
'typename.label_other': 'Automations',
|
|
19
|
+
'object-name.placeholder': 'New automation',
|
|
20
|
+
'add-object.label': 'Add automation',
|
|
21
|
+
'rename-object.label': 'Rename automation',
|
|
22
|
+
'delete-object.label': 'Delete automation',
|
|
23
|
+
},
|
|
12
24
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'automation
|
|
15
|
-
'
|
|
16
|
-
'automation verbose label': 'Manage automations',
|
|
17
|
-
'automation description': 'You can manage all the triggers which automate your space here.',
|
|
18
|
-
|
|
19
|
-
'functions panel label': 'Functions',
|
|
20
|
-
'functions verbose label': 'Manage deployed functions',
|
|
21
|
-
'functions description': 'You can manage all the functions deployed from your space on EDGE here.',
|
|
22
|
-
'function copy id': 'Copy Function ID',
|
|
23
|
-
'no functions found': 'No functions found',
|
|
24
|
-
'go to function source button label': 'Show function source',
|
|
25
|
+
'plugin.name': 'Automation',
|
|
26
|
+
'automation-panel.label': 'Automations',
|
|
27
|
+
'create-panel.template.placeholder': 'Search templates...',
|
|
25
28
|
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
29
|
+
'automation-name.label': 'Name',
|
|
30
|
+
'general.title': 'General',
|
|
31
|
+
'general.description': 'Name and status.',
|
|
32
|
+
'action.title': 'Action',
|
|
33
|
+
'action.description': 'What this automation runs.',
|
|
34
|
+
'action.placeholder': 'Select an operation or routine',
|
|
35
|
+
'action-input.label': 'Input',
|
|
36
|
+
'action-kind.operation.label': 'Operation',
|
|
37
|
+
'action-kind.routine.label': 'Routine',
|
|
38
|
+
'trigger-picker.title': 'Trigger',
|
|
39
|
+
'trigger-picker.description': 'When this automation runs.',
|
|
40
|
+
'trigger-kind.placeholder': 'Select trigger type',
|
|
41
|
+
'trigger-kind.timer.label': 'Schedule (cron)',
|
|
42
|
+
'trigger-kind.feed.label': 'Feed',
|
|
43
|
+
'cron.placeholder': '0 0 * * *',
|
|
44
|
+
'feed.placeholder': 'Select a feed',
|
|
45
|
+
'enabled.label': 'Enabled',
|
|
46
|
+
'enabled.description': 'Turn this automation on or off.',
|
|
47
|
+
'add-trigger.label': 'Add trigger',
|
|
48
|
+
'add-trigger-first.message': 'Add a trigger to enable.',
|
|
49
|
+
'remove-trigger.label': 'Remove',
|
|
50
|
+
'select-action-first.message': 'Select an action first.',
|
|
51
|
+
'automation-companion.label': 'Automation',
|
|
52
|
+
'no-automations.message': 'No automations for this object.',
|
|
53
|
+
'automation-not-associated.message': 'Not yet associated with this object.',
|
|
54
|
+
'automation-detached.message': 'No longer associated with this object.',
|
|
34
55
|
|
|
35
|
-
'
|
|
36
|
-
'
|
|
56
|
+
'automation-verbose.label': 'Manage automations',
|
|
57
|
+
'automation.description': 'Manage where automations in this space run.',
|
|
37
58
|
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
59
|
+
'runtime.label': 'Runtime location',
|
|
60
|
+
'runtime.description': 'Determines where automations in this space run.',
|
|
61
|
+
'runtime.disabled.label': 'Disabled',
|
|
62
|
+
'runtime.local.label': 'Local',
|
|
63
|
+
'runtime.edge.label': 'EDGE (experimental)',
|
|
41
64
|
},
|
|
42
65
|
},
|
|
43
66
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Obj, Type } from '@dxos/echo';
|
|
9
|
+
|
|
10
|
+
import { blank } from '../templates';
|
|
11
|
+
import * as Automation from './Automation';
|
|
12
|
+
import * as Runnable from './Runnable';
|
|
13
|
+
|
|
14
|
+
describe('Automation', () => {
|
|
15
|
+
test('make produces a typed Automation', ({ expect }) => {
|
|
16
|
+
const automation = Automation.make({ name: 'Test', triggers: [] });
|
|
17
|
+
expect(Automation.instanceOf(automation)).toBe(true);
|
|
18
|
+
expect(Obj.instanceOf(Automation.Automation, automation)).toBe(true);
|
|
19
|
+
expect(Type.getTypename(Automation.Automation)).toBe('org.dxos.type.automation');
|
|
20
|
+
expect(Obj.getLabel(automation)).toBe('Test');
|
|
21
|
+
expect(automation.triggers).toEqual([]);
|
|
22
|
+
expect(automation.runnable).toBeUndefined();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('Runnable seam is currently the Operation type', ({ expect }) => {
|
|
26
|
+
// MVP: Runnable === Operation. Widening this to a union is the documented next step.
|
|
27
|
+
expect(Runnable.Runnable).toBe(Operation.PersistentOperation);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('blank template', () => {
|
|
31
|
+
test('is the default no-op template', ({ expect }) => {
|
|
32
|
+
expect(blank.id).toBe('org.dxos.automation.blank');
|
|
33
|
+
expect(blank.label).toBe('Blank');
|
|
34
|
+
expect(typeof blank.scaffold).toBe('function');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { DXN, Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { LabelAnnotation } from '@dxos/echo/internal';
|
|
11
|
+
|
|
12
|
+
import * as Runnable from './Runnable';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* User-facing automation: a thin aggregate of an action (`runnable`) and the triggers that fire it.
|
|
16
|
+
* App-level only — EDGE stays unaware of it (triggers point directly at the runnable).
|
|
17
|
+
*/
|
|
18
|
+
export const Automation = Schema.Struct({
|
|
19
|
+
name: Schema.String.pipe(Schema.optional),
|
|
20
|
+
description: Schema.String.pipe(Schema.optional),
|
|
21
|
+
/**
|
|
22
|
+
* The action to run. A trigger's `function` Ref points directly at this (so EDGE/the dispatcher can run
|
|
23
|
+
* it). `Runnable` is the type seam — currently just Operation; see Runnable.ts.
|
|
24
|
+
*/
|
|
25
|
+
runnable: Ref.Ref(Runnable.Runnable).pipe(Schema.optional),
|
|
26
|
+
/**
|
|
27
|
+
* Explicit membership, bi-directional with `trigger.function → runnable`. Required (not derived by query)
|
|
28
|
+
* because the runnable may be a shared registry operation referenced by multiple automations, which would
|
|
29
|
+
* conflate triggers. MVP enforces length <= 1.
|
|
30
|
+
*
|
|
31
|
+
* Typed as `Obj.Unknown` (not `Trigger`) to avoid pulling query-AST types into the emitted declaration —
|
|
32
|
+
* the same reason `Trigger.function` uses `Obj.Unknown`. Resolve and narrow with `Obj.instanceOf(Trigger)`.
|
|
33
|
+
*/
|
|
34
|
+
triggers: Schema.Array(Ref.Ref(Obj.Unknown)),
|
|
35
|
+
}).pipe(
|
|
36
|
+
LabelAnnotation.set(['name']),
|
|
37
|
+
Annotation.IconAnnotation.set({ icon: 'ph--lightning--regular', hue: 'amber' }),
|
|
38
|
+
Type.makeObject(DXN.make('org.dxos.type.automation', '0.1.0')),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export type Automation = Type.InstanceType<typeof Automation>;
|
|
42
|
+
|
|
43
|
+
export const instanceOf = (value: unknown): value is Automation => Obj.instanceOf(Automation, value);
|
|
44
|
+
|
|
45
|
+
export const make = (props: Obj.MakeProps<typeof Automation>) => Obj.make(Automation, props);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import type { Database, Obj } from '@dxos/echo';
|
|
9
|
+
import { type DelegationStrategy } from '@dxos/functions-runtime';
|
|
10
|
+
|
|
11
|
+
import * as Automation from './Automation';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Optional supervisor strategy for the agent chat service. When contributed (by a plugin that knows
|
|
15
|
+
* the agent/plan model, e.g. plugin-assistant), the conversational agent delegates outstanding work
|
|
16
|
+
* to sub-agents and folds their results back into the conversation. Consumed by the AgentService
|
|
17
|
+
* LayerSpec; absent by default (a plain conversational agent).
|
|
18
|
+
*/
|
|
19
|
+
export const AgentDelegationStrategy = Capability.make<DelegationStrategy>(
|
|
20
|
+
'org.dxos.plugin.automation.capability.agentDelegationStrategy',
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An automation template contributed by a plugin. The create dialog and the per-object "Automations"
|
|
25
|
+
* companion list contributed templates (`Capability.getAll(AutomationCapabilities.Template)`) and run the
|
|
26
|
+
* chosen template's `scaffold` to build the automation.
|
|
27
|
+
*/
|
|
28
|
+
export type Template = {
|
|
29
|
+
/** Stable id (e.g. 'org.dxos.automation.blank'). */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Human-readable label shown in the picker. */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Optional Phosphor icon name. */
|
|
34
|
+
icon?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether this template applies to the given companion subject. The subject is the object whose
|
|
37
|
+
* "Automations" companion is open, or undefined in the global create dialog. Templates that need a
|
|
38
|
+
* specific subject (e.g. a feed-bearing Mailbox) gate themselves here. Defaults to always-applies.
|
|
39
|
+
*/
|
|
40
|
+
appliesTo?: (subject?: Obj.Unknown) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Build the Automation from the user's input. The returned Automation is added to the database by the
|
|
43
|
+
* create flow; any auxiliary objects (runnable, triggers) must be added by the scaffold itself via
|
|
44
|
+
* Database.Service. `subject` is set when scaffolding from an object's companion.
|
|
45
|
+
*/
|
|
46
|
+
scaffold: (ctx: {
|
|
47
|
+
name?: string;
|
|
48
|
+
subject?: Obj.Unknown;
|
|
49
|
+
}) => Effect.Effect<Automation.Automation, Error, Database.Service>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Template = Capability.make<Template>('org.dxos.plugin.automation.capability.template');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Database, DXN, Obj } from '@dxos/echo';
|
|
12
|
+
// Value-side `EID` import keeps TS declaration emit portable — `TriggerTemplate`
|
|
13
|
+
// references `EID.Schema` and the inferred `CreateTriggerFromTemplate` type
|
|
14
|
+
// otherwise needs a transitive `@dxos/keys` import that's hard for d.ts emit to surface.
|
|
15
|
+
import { EID as _EchoURIReference } from '@dxos/keys';
|
|
16
|
+
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
|
|
19
|
+
import { TriggerTemplate } from './schema';
|
|
20
|
+
export { _EchoURIReference };
|
|
21
|
+
|
|
22
|
+
const makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);
|
|
23
|
+
|
|
24
|
+
export const CreateTriggerFromTemplate = Operation.make({
|
|
25
|
+
meta: {
|
|
26
|
+
key: makeKey('createTriggerFromTemplate'),
|
|
27
|
+
name: 'Create Trigger From Template',
|
|
28
|
+
icon: 'ph--lightning--regular',
|
|
29
|
+
},
|
|
30
|
+
services: [Capability.Service],
|
|
31
|
+
input: Schema.Struct({
|
|
32
|
+
db: Database.Database,
|
|
33
|
+
template: TriggerTemplate,
|
|
34
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
35
|
+
scriptName: Schema.optional(Schema.String),
|
|
36
|
+
input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
37
|
+
}),
|
|
38
|
+
output: Schema.Void,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// The single creation entrypoint for every path (create dialog, companion, sidebar) so placement and
|
|
42
|
+
// ownership are established in one place. Output mirrors `SpaceCapabilities.CreateObjectResult`.
|
|
43
|
+
export const CreateAutomation = Operation.make({
|
|
44
|
+
meta: {
|
|
45
|
+
key: makeKey('createAutomation'),
|
|
46
|
+
name: 'Create Automation',
|
|
47
|
+
icon: 'ph--lightning--regular',
|
|
48
|
+
},
|
|
49
|
+
services: [Capability.Service],
|
|
50
|
+
input: Schema.Struct({
|
|
51
|
+
db: Database.Database,
|
|
52
|
+
templateId: Schema.String,
|
|
53
|
+
name: Schema.optional(Schema.String),
|
|
54
|
+
subject: Schema.optional(Obj.Unknown),
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Struct({
|
|
57
|
+
id: Schema.String,
|
|
58
|
+
subject: Schema.Array(Schema.String),
|
|
59
|
+
object: Obj.Unknown,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
// TODO(wittjosiah): Currently just Operation. Widen to a union (Operation | ComputeGraph | …) once the
|
|
10
|
+
// dispatcher/EDGE can run non-Operation runnables as a Process; factor down to @dxos/compute once
|
|
11
|
+
// ComputeGraph's type moves there. Routines are NOT a direct member — they run via the AgentPrompt
|
|
12
|
+
// operation (bound as input).
|
|
13
|
+
export type Runnable = Operation.PersistentOperation;
|
|
14
|
+
export const Runnable = Operation.PersistentOperation;
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Database } from '@dxos/echo';
|
|
8
8
|
|
|
9
|
-
import { meta } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
10
|
|
|
11
|
-
const TriggerTemplate = Schema.Union(
|
|
11
|
+
export const TriggerTemplate = Schema.Union(
|
|
12
12
|
Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),
|
|
13
|
-
Schema.Struct({ type: Schema.Literal('
|
|
13
|
+
Schema.Struct({ type: Schema.Literal('feed'), feed: Schema.Any }),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
export namespace AutomationAction {
|
|
17
17
|
export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(
|
|
18
|
-
`${meta.id}
|
|
18
|
+
`${meta.id}.action.create-trigger-from-template`,
|
|
19
19
|
{
|
|
20
20
|
input: Schema.Struct({
|
|
21
|
-
|
|
21
|
+
db: Database.Database,
|
|
22
22
|
template: TriggerTemplate,
|
|
23
23
|
enabled: Schema.optional(Schema.Boolean),
|
|
24
24
|
// TODO(wittjosiah): Improve how this lookup is done.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import { describe, test } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { Trigger } from '@dxos/compute';
|
|
9
|
+
import { type Database, DXN, Feed, Obj, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { EffectEx } from '@dxos/effect';
|
|
11
|
+
import { EID, URI } from '@dxos/keys';
|
|
12
|
+
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
13
|
+
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
14
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
15
|
+
|
|
16
|
+
import { Automation } from '#types';
|
|
17
|
+
|
|
18
|
+
import { automationsForObject, connectedAutomationsQuery } from './automations-for-object';
|
|
19
|
+
|
|
20
|
+
// A minimal feed-annotated host (like a mailbox): an object holding a `feed` ref.
|
|
21
|
+
const FeedHost = Schema.Struct({
|
|
22
|
+
name: Schema.optional(Schema.String),
|
|
23
|
+
feed: Ref.Ref(Feed.Feed),
|
|
24
|
+
}).pipe(Type.makeObject(DXN.make('org.dxos.test.feedHost', '0.1.0')));
|
|
25
|
+
|
|
26
|
+
const types = [Automation.Automation, Trigger.Trigger, Feed.Feed, FeedHost];
|
|
27
|
+
|
|
28
|
+
const initSpace = async (harness: Awaited<ReturnType<typeof createComposerTestApp>>) => {
|
|
29
|
+
const { personalSpace } = await EffectEx.runAndForwardErrors(
|
|
30
|
+
initializeIdentity(harness.get(ClientCapabilities.Client)),
|
|
31
|
+
);
|
|
32
|
+
await harness.waitForEvent(ClientEvents.SpacesReady);
|
|
33
|
+
return personalSpace.db;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const connectedIds = (db: Database.Database, object: Obj.Unknown) =>
|
|
37
|
+
db
|
|
38
|
+
.query(connectedAutomationsQuery(object))
|
|
39
|
+
.run()
|
|
40
|
+
.then((automations) => automations.map((automation) => automation.id).sort());
|
|
41
|
+
|
|
42
|
+
// Build a space-qualified ref like the RefField object picker does (from the entity's fully-qualified URI),
|
|
43
|
+
// rather than the bare ref `Ref.make` produces — this is the encoding real triggers carry, and it exercises
|
|
44
|
+
// the reverse-ref EID normalization that lets qualified refs match a space-less anchor.
|
|
45
|
+
const qualifiedRef = (db: Database.Database, object: Obj.Unknown) =>
|
|
46
|
+
Ref.fromURI(URI.make(EID.make({ spaceId: db.spaceId, entityId: object.id })));
|
|
47
|
+
|
|
48
|
+
describe('automations connected to an object', () => {
|
|
49
|
+
test('input-ref: trigger whose nested input references the object', async ({ expect }) => {
|
|
50
|
+
await using harness = await createComposerTestApp({ plugins: [ClientPlugin({ types })] });
|
|
51
|
+
const db = await initSpace(harness);
|
|
52
|
+
|
|
53
|
+
const target = db.add(Automation.make({ name: 'target', triggers: [] }));
|
|
54
|
+
const other = db.add(Automation.make({ name: 'other', triggers: [] }));
|
|
55
|
+
// The target ref is nested in the trigger's untyped `input` record, and is space-qualified like a
|
|
56
|
+
// picker-created ref.
|
|
57
|
+
const trigger = db.add(Trigger.make({ input: { subject: qualifiedRef(db, target) } }));
|
|
58
|
+
const owner = db.add(Automation.make({ name: 'owner', triggers: [Ref.make(trigger)] }));
|
|
59
|
+
await db.flush();
|
|
60
|
+
|
|
61
|
+
expect(automationsForObject(target, [owner, other]).map((automation) => automation.id)).toEqual([owner.id]);
|
|
62
|
+
expect(automationsForObject(other, [owner])).toEqual([]);
|
|
63
|
+
|
|
64
|
+
// Poll to absorb index latency; the query resolves via the reverse-ref index.
|
|
65
|
+
await expect.poll(() => connectedIds(db, target), { timeout: 5_000 }).toEqual([owner.id]);
|
|
66
|
+
await expect.poll(() => connectedIds(db, other), { timeout: 5_000 }).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('feed-ref: feed trigger bound to the object’s feed', async ({ expect }) => {
|
|
70
|
+
await using harness = await createComposerTestApp({ plugins: [ClientPlugin({ types })] });
|
|
71
|
+
const db = await initSpace(harness);
|
|
72
|
+
|
|
73
|
+
const feed = db.add(Feed.make());
|
|
74
|
+
const host = db.add(Obj.make(FeedHost, { name: 'mailbox', feed: Ref.make(feed) }));
|
|
75
|
+
const other = db.add(Automation.make({ name: 'other', triggers: [] }));
|
|
76
|
+
// Picker-created feed refs are space-qualified (unlike `Trigger.specFeed`'s bare `Ref.make`); the host's
|
|
77
|
+
// own feed ref is bare (code-created). They must still match through the reverse-ref index.
|
|
78
|
+
const feedTrigger = db.add(Trigger.make({ spec: { kind: 'feed', feed: qualifiedRef(db, feed) } }));
|
|
79
|
+
const owner = db.add(Automation.make({ name: 'feed-owner', triggers: [Ref.make(feedTrigger)] }));
|
|
80
|
+
await db.flush();
|
|
81
|
+
|
|
82
|
+
expect(automationsForObject(host, [owner, other]).map((automation) => automation.id)).toEqual([owner.id]);
|
|
83
|
+
|
|
84
|
+
await expect.poll(() => connectedIds(db, host), { timeout: 5_000 }).toEqual([owner.id]);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Trigger } from '@dxos/compute';
|
|
6
|
+
import { Filter, Obj, Query, Ref } from '@dxos/echo';
|
|
7
|
+
|
|
8
|
+
import { Automation } from '#types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Reactive query for the automations connected to an object O — without a stored association field.
|
|
12
|
+
*
|
|
13
|
+
* Association is derived: an automation is connected when one of its triggers references O, either via a
|
|
14
|
+
* `Ref` anywhere in the trigger's `input` (e.g. a magazine passed into AgentPrompt's input) or via a feed
|
|
15
|
+
* trigger whose `spec.feed` resolves to `O.feed` (feed-annotated hosts like mailboxes). Both are reachable
|
|
16
|
+
* by reverse-reference traversal because ECHO's reverse-ref index is structural — it records every ref in a
|
|
17
|
+
* document regardless of schema path (incl. untyped records and union-nested fields). The traversal is two
|
|
18
|
+
* hops: O ← Trigger ← Automation.
|
|
19
|
+
*/
|
|
20
|
+
export const connectedAutomationsQuery = (object: Obj.Unknown): Query.Query<Automation.Automation> => {
|
|
21
|
+
// Triggers referencing O directly (any path, incl. nested in the untyped `input` record).
|
|
22
|
+
const byInput = Query.select(Filter.id(object.id)).referencedBy(Trigger.Trigger);
|
|
23
|
+
// Triggers referencing O's feed; `.reference('feed')` reads the path structurally and is empty for objects
|
|
24
|
+
// without a feed prop, so this branch contributes nothing for non-feed objects.
|
|
25
|
+
const byFeed = Query.select(Filter.id(object.id)).reference('feed').referencedBy(Trigger.Trigger);
|
|
26
|
+
return Query.all(byInput, byFeed).referencedBy(Automation.Automation, 'triggers');
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Pure predicate equivalent of {@link connectedAutomationsQuery}, over a pre-queried list of automations.
|
|
31
|
+
* Kept for unit tests (asserting the query and predicate agree) and the deferred quick-association check.
|
|
32
|
+
*/
|
|
33
|
+
export const automationsForObject = (
|
|
34
|
+
object: Obj.Unknown,
|
|
35
|
+
automations: Automation.Automation[],
|
|
36
|
+
): Automation.Automation[] => automations.filter((automation) => automationReferencesObject(automation, object));
|
|
37
|
+
|
|
38
|
+
export const automationReferencesObject = (automation: Automation.Automation, object: Obj.Unknown): boolean => {
|
|
39
|
+
const objectFeedId = getFeedId(object);
|
|
40
|
+
return automation.triggers.some((ref) => {
|
|
41
|
+
const trigger = ref.target;
|
|
42
|
+
if (!Obj.instanceOf(Trigger.Trigger, trigger)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (trigger.spec?.kind === 'feed' && objectFeedId && trigger.spec.feed?.target?.id === objectFeedId) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return trigger.input != null && referencesId(trigger.input, object.id);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** The feed id a feed-annotated object points at (e.g. `mailbox.feed`), if any. */
|
|
55
|
+
const getFeedId = (object: Obj.Unknown): string | undefined => {
|
|
56
|
+
const feedRef = (object as { feed?: Ref.Ref<unknown> }).feed;
|
|
57
|
+
return Ref.isRef(feedRef) ? feedRef.target?.id : undefined;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** Recursively scan a value for a Ref whose target is the given object id. */
|
|
61
|
+
const referencesId = (value: unknown, id: string): boolean => {
|
|
62
|
+
if (Ref.isRef(value)) {
|
|
63
|
+
return value.target?.id === id;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
return value.some((entry) => referencesId(entry, id));
|
|
67
|
+
}
|
|
68
|
+
if (value && typeof value === 'object') {
|
|
69
|
+
return Object.values(value).some((entry) => referencesId(entry, id));
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel
|
|
3
|
-
} from "./chunk-OX6OW6XP.mjs";
|
|
4
|
-
import "./chunk-7EE4SA6M.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AUTOMATION_PLUGIN
|
|
7
|
-
} from "./chunk-GW5U2DGT.mjs";
|
|
8
|
-
|
|
9
|
-
// src/components/AutomationContainer.tsx
|
|
10
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
11
|
-
import React from "react";
|
|
12
|
-
import { useTranslation } from "@dxos/react-ui";
|
|
13
|
-
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
14
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
15
|
-
var AutomationContainer = (props) => {
|
|
16
|
-
var _effect = _useSignals();
|
|
17
|
-
try {
|
|
18
|
-
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
19
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
20
|
-
classNames: "block overflow-y-auto"
|
|
21
|
-
}, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
|
|
22
|
-
title: t("automation verbose label", {
|
|
23
|
-
ns: AUTOMATION_PLUGIN
|
|
24
|
-
}),
|
|
25
|
-
description: t("automation description", {
|
|
26
|
-
ns: AUTOMATION_PLUGIN
|
|
27
|
-
})
|
|
28
|
-
}, /* @__PURE__ */ React.createElement(AutomationPanel, props))));
|
|
29
|
-
} finally {
|
|
30
|
-
_effect.f();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var AutomationContainer_default = AutomationContainer;
|
|
34
|
-
export {
|
|
35
|
-
AutomationContainer,
|
|
36
|
-
AutomationContainer_default as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=AutomationContainer-5UYKI7EG.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AutomationContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { AUTOMATION_PLUGIN } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\n\nexport const AutomationContainer = (props: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n return (\n <StackItem.Content classNames='block overflow-y-auto'>\n <ControlPage>\n <ControlSection\n title={t('automation verbose label', { ns: AUTOMATION_PLUGIN })}\n description={t('automation description', { ns: AUTOMATION_PLUGIN })}\n >\n <AutomationPanel {...props} />\n </ControlSection>\n </ControlPage>\n </StackItem.Content>\n );\n};\n\nexport default AutomationContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,sBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;AAC5C,SAASC,iBAAiB;AAMnB,IAAMC,sBAAsB,CAACC,UAAAA;;;AAClC,UAAM,EAAEC,EAAC,IAAKC,eAAeC,iBAAAA;AAC7B,WACE,sBAAA,cAACC,UAAUC,SAAO;MAACC,YAAW;OAC5B,sBAAA,cAACC,aAAAA,MACC,sBAAA,cAACC,gBAAAA;MACCC,OAAOR,EAAE,4BAA4B;QAAES,IAAIP;MAAkB,CAAA;MAC7DQ,aAAaV,EAAE,0BAA0B;QAAES,IAAIP;MAAkB,CAAA;OAEjE,sBAAA,cAACS,iBAAoBZ,KAAAA,CAAAA,CAAAA,CAAAA;;;;AAK/B;AAEA,IAAA,8BAAeD;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "StackItem", "AutomationContainer", "props", "t", "useTranslation", "AUTOMATION_PLUGIN", "StackItem", "Content", "classNames", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel"]
|
|
7
|
-
}
|