@dxos/plugin-automation 0.8.4-main.e8ec1fe → 0.8.4-main.effb148878
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/README.md +1 -1
- package/dist/lib/neutral/AutomationPanel-OS3ZWYJK.mjs +12 -0
- package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs +1118 -0
- package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs +23 -0
- package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/AutomationSettings-CAFY3J7H.mjs +32 -0
- package/dist/lib/neutral/AutomationSettings-CAFY3J7H.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsContainer-V5AM45ZI.mjs +38 -0
- package/dist/lib/neutral/FunctionsContainer-V5AM45ZI.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs +97 -0
- package/dist/lib/neutral/FunctionsPanel-L32Z67B7.mjs.map +7 -0
- package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.mjs +95 -0
- package/dist/lib/neutral/FunctionsRegistry-RTCY3LXE.mjs.map +7 -0
- package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
- package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-4QOUKY5L.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +15 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2H6X4VQY.mjs +435 -0
- package/dist/lib/neutral/chunk-2H6X4VQY.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-33VXVTV4.mjs +38 -0
- package/dist/lib/neutral/chunk-33VXVTV4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ARUHHM4Q.mjs +12 -0
- package/dist/lib/neutral/chunk-ARUHHM4Q.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CMM3AFHR.mjs +111 -0
- package/dist/lib/neutral/chunk-CMM3AFHR.mjs.map +7 -0
- package/dist/lib/neutral/chunk-EBSOLOP6.mjs +8 -0
- package/dist/lib/neutral/chunk-EBSOLOP6.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KV7RZLFS.mjs +344 -0
- package/dist/lib/neutral/chunk-KV7RZLFS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-QLBA6Y46.mjs +39 -0
- package/dist/lib/neutral/chunk-QLBA6Y46.mjs.map +7 -0
- package/dist/lib/neutral/chunk-XC5EPVE3.mjs +76 -0
- package/dist/lib/neutral/chunk-XC5EPVE3.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +16 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-trigger-from-template-IOQZDDSH.mjs +68 -0
- package/dist/lib/neutral/create-trigger-from-template-IOQZDDSH.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +10 -0
- package/dist/lib/neutral/index.mjs +16 -0
- package/dist/lib/neutral/layer-specs-B22CIT3U.mjs +160 -0
- package/dist/lib/neutral/layer-specs-B22CIT3U.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -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-3OGMAMKV.mjs +57 -0
- package/dist/lib/neutral/react-surface-3OGMAMKV.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 +60 -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 +12 -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/index.d.ts +7 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/layer-specs.d.ts +5 -0
- package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +7 -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/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/AutomationPanel/AutomationPanel.d.ts +5 -6
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -30
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts +18 -0
- package/dist/types/src/components/AutomationPanel/TriggerEdgeMetadata.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +3 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +8 -7
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +118 -32
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -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/FunctionsContainer/FunctionsContainer.d.ts +4 -0
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
- package/dist/types/src/containers/FunctionsContainer/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 +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts +13 -0
- package/dist/types/src/hooks/useEdgeTriggersDispatcherStatus.d.ts.map +1 -0
- 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-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/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +204 -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 +45 -31
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/AutomationOperation.d.ts +21 -0
- package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -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/tsconfig.tsbuildinfo +1 -1
- package/package.json +145 -70
- package/src/AutomationPlugin.node.ts +32 -0
- package/src/AutomationPlugin.test.ts +27 -0
- package/src/AutomationPlugin.tsx +24 -38
- package/src/AutomationPlugin.workerd.ts +18 -0
- package/src/capabilities/app-graph-builder.ts +59 -80
- package/src/capabilities/index.ts +13 -7
- package/src/capabilities/layer-specs.ts +230 -0
- package/src/capabilities/node.ts +17 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -46
- package/src/capabilities/trigger-runtime-controller.test.ts +103 -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 +125 -0
- package/src/commands/trigger/create/timer.ts +90 -0
- package/src/commands/trigger/index.ts +16 -0
- package/src/commands/trigger/list.ts +70 -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/AutomationPanel/AutomationPanel.stories.tsx +15 -8
- package/src/components/AutomationPanel/AutomationPanel.tsx +245 -86
- package/src/components/AutomationPanel/TriggerEdgeMetadata.tsx +148 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +43 -42
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +38 -54
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +36 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +26 -20
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +92 -39
- package/src/components/TriggerEditor/TriggerEditor.tsx +171 -54
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
- package/src/containers/FunctionsContainer/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 +9 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useEdgeTriggersDispatcherStatus.ts +78 -0
- package/src/hooks/useTriggerRuntimeControls.ts +38 -19
- package/src/index.ts +1 -6
- package/src/meta.ts +25 -6
- package/src/operations/create-trigger-from-template.ts +70 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/test-functions.ts +12 -9
- package/src/testing.ts +7 -0
- package/src/translations.ts +53 -36
- package/src/types/AutomationOperation.ts +39 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +6 -6
- 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/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/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/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -36
- 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/AutomationPanel-OS3ZWYJK.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/components}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-HCVFNHGQ.mjs.map → neutral/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/FunctionsPanel-RVVCS6VH.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Registry } from '@effect-atom/atom';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
|
|
9
|
+
import { OpaqueToolkit } from '@dxos/ai';
|
|
10
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
11
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
12
|
+
import { ClientService } from '@dxos/client';
|
|
13
|
+
import { Blueprint, LayerSpec, OperationHandlerSet, OperationRegistry } from '@dxos/compute';
|
|
14
|
+
import { ProcessManager } from '@dxos/compute-runtime';
|
|
15
|
+
import { Database, Feed } from '@dxos/echo';
|
|
16
|
+
import {
|
|
17
|
+
AgentService,
|
|
18
|
+
FeedTraceSink,
|
|
19
|
+
RemoteFunctionExecutionService,
|
|
20
|
+
TriggerDispatcher,
|
|
21
|
+
TriggerStateStore,
|
|
22
|
+
} from '@dxos/functions-runtime';
|
|
23
|
+
import { invariant } from '@dxos/invariant';
|
|
24
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
25
|
+
|
|
26
|
+
//
|
|
27
|
+
// Capability Module
|
|
28
|
+
//
|
|
29
|
+
// Contributes application- and space-affinity `Capabilities.LayerSpec` entries
|
|
30
|
+
// that together replace the former monolithic `AutomationCapabilities.ComputeRuntime`.
|
|
31
|
+
//
|
|
32
|
+
// Specs are declared at module level; runtime state (the `Client`, contributed
|
|
33
|
+
// capability lists, etc.) is resolved via Effect-level requirements rather
|
|
34
|
+
// than captured from an outer scope.
|
|
35
|
+
//
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Default application-affinity `RemoteFunctionExecutionService`. Space specs
|
|
39
|
+
* (see {@link RemoteFunctionExecutionOverrideSpec}) can override this with a
|
|
40
|
+
* space-scoped client.
|
|
41
|
+
*/
|
|
42
|
+
const RemoteFunctionExecutionSpec = LayerSpec.make(
|
|
43
|
+
{
|
|
44
|
+
affinity: 'application',
|
|
45
|
+
requires: [ClientService],
|
|
46
|
+
provides: [RemoteFunctionExecutionService],
|
|
47
|
+
},
|
|
48
|
+
() =>
|
|
49
|
+
Layer.unwrapEffect(
|
|
50
|
+
Effect.gen(function* () {
|
|
51
|
+
const client = yield* ClientService;
|
|
52
|
+
return RemoteFunctionExecutionService.fromClient(client);
|
|
53
|
+
}),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Gathers contributed {@link Capabilities.OperationHandler} sets from the
|
|
59
|
+
* {@link Capability.Service} and exposes them through the
|
|
60
|
+
* {@link OperationHandlerSet.OperationHandlerProvider} tag so space-affinity
|
|
61
|
+
* specs (e.g. {@link OperationRegistrySpec}) can consume them through the
|
|
62
|
+
* normal LayerStack resolution path.
|
|
63
|
+
*/
|
|
64
|
+
const OperationHandlerProviderSpec = LayerSpec.make(
|
|
65
|
+
{
|
|
66
|
+
affinity: 'application',
|
|
67
|
+
requires: [Capability.Service],
|
|
68
|
+
provides: [OperationHandlerSet.OperationHandlerProvider],
|
|
69
|
+
},
|
|
70
|
+
() =>
|
|
71
|
+
Layer.unwrapEffect(
|
|
72
|
+
Effect.gen(function* () {
|
|
73
|
+
const operationHandlerSets = yield* Capability.getAll(Capabilities.OperationHandler);
|
|
74
|
+
const mergedOperationHandlers =
|
|
75
|
+
operationHandlerSets.length === 0
|
|
76
|
+
? OperationHandlerSet.empty
|
|
77
|
+
: OperationHandlerSet.merge(...operationHandlerSets);
|
|
78
|
+
return OperationHandlerSet.provide(mergedOperationHandlers);
|
|
79
|
+
}),
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const BlueprintRegistrySpec = LayerSpec.make(
|
|
84
|
+
{
|
|
85
|
+
affinity: 'application',
|
|
86
|
+
requires: [Capability.Service],
|
|
87
|
+
provides: [Blueprint.RegistryService],
|
|
88
|
+
},
|
|
89
|
+
() =>
|
|
90
|
+
Layer.unwrapEffect(
|
|
91
|
+
Effect.gen(function* () {
|
|
92
|
+
const capabilities = yield* Capability.Service;
|
|
93
|
+
const blueprints = capabilities
|
|
94
|
+
.getAll(AppCapabilities.BlueprintDefinition)
|
|
95
|
+
.flatMap((blueprint) => blueprint.make());
|
|
96
|
+
return Layer.succeed(Blueprint.RegistryService, new Blueprint.Registry(blueprints));
|
|
97
|
+
}),
|
|
98
|
+
),
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const OpaqueToolkitSpec = LayerSpec.make(
|
|
102
|
+
{
|
|
103
|
+
affinity: 'application',
|
|
104
|
+
requires: [Capability.Service],
|
|
105
|
+
provides: [OpaqueToolkit.OpaqueToolkitProvider],
|
|
106
|
+
},
|
|
107
|
+
() =>
|
|
108
|
+
Layer.unwrapEffect(
|
|
109
|
+
Effect.gen(function* () {
|
|
110
|
+
const capabilities = yield* Capability.Service;
|
|
111
|
+
return Layer.succeed(OpaqueToolkit.OpaqueToolkitProvider, {
|
|
112
|
+
getToolkit: () => {
|
|
113
|
+
const toolkits = capabilities.getAll(AppCapabilities.Toolkit);
|
|
114
|
+
return OpaqueToolkit.merge(...toolkits);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}),
|
|
118
|
+
),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const AgentServiceSpec = LayerSpec.make(
|
|
122
|
+
{
|
|
123
|
+
affinity: 'application',
|
|
124
|
+
requires: [ProcessManager.ProcessManagerService],
|
|
125
|
+
provides: [AgentService.AgentService],
|
|
126
|
+
},
|
|
127
|
+
() => AgentService.layer(),
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const OperationRegistrySpec = LayerSpec.make(
|
|
131
|
+
{
|
|
132
|
+
affinity: 'space',
|
|
133
|
+
requires: [Database.Service, OperationHandlerSet.OperationHandlerProvider],
|
|
134
|
+
provides: [OperationRegistry.Service],
|
|
135
|
+
},
|
|
136
|
+
() => OperationRegistry.layer,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* In-memory trigger state. Loses state across restarts but works in both
|
|
141
|
+
* browser and CLI/Node contexts. Hosts that need durable storage should
|
|
142
|
+
* contribute a replacement LayerSpec that provides {@link TriggerStateStore}
|
|
143
|
+
* backed by a persistent `KeyValueStore` (e.g. `BrowserKeyValueStore` or
|
|
144
|
+
* `BunKeyValueStore`).
|
|
145
|
+
*/
|
|
146
|
+
const TriggerStateStoreSpec = LayerSpec.make(
|
|
147
|
+
{
|
|
148
|
+
affinity: 'application',
|
|
149
|
+
requires: [],
|
|
150
|
+
provides: [TriggerStateStore],
|
|
151
|
+
},
|
|
152
|
+
() => TriggerStateStore.layerMemory,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
//
|
|
156
|
+
// Space-affinity specs.
|
|
157
|
+
//
|
|
158
|
+
|
|
159
|
+
const FeedTraceSinkSpec = LayerSpec.make(
|
|
160
|
+
{
|
|
161
|
+
affinity: 'space',
|
|
162
|
+
requires: [Database.Service, Feed.FeedService],
|
|
163
|
+
provides: [FeedTraceSink.FeedTraceSink],
|
|
164
|
+
},
|
|
165
|
+
() => FeedTraceSink.layerLive,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Space-scoped override of {@link RemoteFunctionExecutionService}. Activated
|
|
170
|
+
* only when the client's `runtime.client.edgeFeatures.agents` config is set;
|
|
171
|
+
* falls back to the application-level spec otherwise.
|
|
172
|
+
*/
|
|
173
|
+
const RemoteFunctionExecutionOverrideSpec = LayerSpec.make(
|
|
174
|
+
{
|
|
175
|
+
affinity: 'space',
|
|
176
|
+
requires: [ClientService],
|
|
177
|
+
provides: [RemoteFunctionExecutionService],
|
|
178
|
+
},
|
|
179
|
+
(context) =>
|
|
180
|
+
Layer.unwrapEffect(
|
|
181
|
+
Effect.gen(function* () {
|
|
182
|
+
invariant(context.space, 'space context required for RemoteFunctionExecutionService override');
|
|
183
|
+
const client = yield* ClientService;
|
|
184
|
+
return RemoteFunctionExecutionService.fromClient(client, context.space);
|
|
185
|
+
}),
|
|
186
|
+
),
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
const TriggerDispatcherSpec = LayerSpec.make(
|
|
190
|
+
{
|
|
191
|
+
affinity: 'space',
|
|
192
|
+
requires: [
|
|
193
|
+
Database.Service,
|
|
194
|
+
Feed.FeedService,
|
|
195
|
+
TriggerStateStore,
|
|
196
|
+
ProcessManager.ProcessManagerService,
|
|
197
|
+
Registry.AtomRegistry,
|
|
198
|
+
],
|
|
199
|
+
provides: [TriggerDispatcher],
|
|
200
|
+
},
|
|
201
|
+
() => TriggerDispatcher.layer({ timeControl: 'natural' }),
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
export default Capability.makeModule(
|
|
205
|
+
Effect.fnUntraced(function* () {
|
|
206
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
207
|
+
|
|
208
|
+
const contributions: Capability.Any[] = [
|
|
209
|
+
Capability.contributes(Capabilities.LayerSpec, OperationHandlerProviderSpec),
|
|
210
|
+
Capability.contributes(Capabilities.LayerSpec, BlueprintRegistrySpec),
|
|
211
|
+
Capability.contributes(Capabilities.LayerSpec, OpaqueToolkitSpec),
|
|
212
|
+
Capability.contributes(Capabilities.LayerSpec, AgentServiceSpec),
|
|
213
|
+
Capability.contributes(Capabilities.LayerSpec, OperationRegistrySpec),
|
|
214
|
+
Capability.contributes(Capabilities.LayerSpec, TriggerStateStoreSpec),
|
|
215
|
+
Capability.contributes(Capabilities.LayerSpec, FeedTraceSinkSpec),
|
|
216
|
+
Capability.contributes(Capabilities.LayerSpec, TriggerDispatcherSpec),
|
|
217
|
+
Capability.contributes(Capabilities.TraceSink, ({ resolver }) => FeedTraceSink.makeRoutingSink({ resolver })),
|
|
218
|
+
// Edge-mode override is conditional on runtime config, so it stays in the
|
|
219
|
+
// activation block.
|
|
220
|
+
Capability.contributes(
|
|
221
|
+
Capabilities.LayerSpec,
|
|
222
|
+
client.config.get('runtime.client.edgeFeatures.agents')
|
|
223
|
+
? RemoteFunctionExecutionSpec
|
|
224
|
+
: RemoteFunctionExecutionOverrideSpec,
|
|
225
|
+
),
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
return contributions;
|
|
229
|
+
}),
|
|
230
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
9
|
+
export const LayerSpecs = Capability.lazy<void, Capability.Any[]>('LayerSpecs', () => import('./layer-specs'));
|
|
10
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
11
|
+
'OperationHandler',
|
|
12
|
+
() => import('./operation-handler'),
|
|
13
|
+
);
|
|
14
|
+
export const TriggerRuntimeController = Capability.lazy(
|
|
15
|
+
'TriggerRuntimeController',
|
|
16
|
+
() => import('./trigger-runtime-controller'),
|
|
17
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { AutomationOperationHandlerSet } from '#operations';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(Capabilities.OperationHandler, AutomationOperationHandlerSet);
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
@@ -2,55 +2,58 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { getSpace
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppSurface, useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { getSpace } from '@dxos/react-client/echo';
|
|
11
12
|
|
|
12
|
-
import { AutomationSettings, FunctionsContainer } from '
|
|
13
|
-
import { meta } from '
|
|
13
|
+
import { AutomationSettings, FunctionsContainer } from '#containers';
|
|
14
|
+
import { meta } from '#meta';
|
|
14
15
|
|
|
15
|
-
export default () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
+
Surface.create({
|
|
20
|
+
id: 'space-settings-functions',
|
|
21
|
+
filter: AppSurface.literal(AppSurface.Article, `${meta.id}.space-settings-functions`),
|
|
22
|
+
component: () => {
|
|
23
|
+
const space = useActiveSpace();
|
|
24
|
+
if (!space) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!space) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
28
|
+
return <FunctionsContainer space={space} />;
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
Surface.create({
|
|
32
|
+
id: 'space-settings-automation',
|
|
33
|
+
filter: AppSurface.literal(AppSurface.Article, `${meta.id}.space-settings-automation`),
|
|
34
|
+
component: () => {
|
|
35
|
+
const space = useActiveSpace();
|
|
36
|
+
if (!space) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
return <AutomationSettings space={space} />;
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
Surface.create({
|
|
44
|
+
id: 'companion.automation',
|
|
45
|
+
filter: AppSurface.allOf(
|
|
46
|
+
AppSurface.literal(AppSurface.Article, 'automation'),
|
|
47
|
+
AppSurface.companion(AppSurface.Article),
|
|
48
|
+
),
|
|
49
|
+
component: ({ data }) => {
|
|
50
|
+
const space = getSpace(data.companionTo);
|
|
51
|
+
if (!space) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return <AutomationSettings space={space} object={data.companionTo} />;
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
]),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import { describe, test } from 'vitest';
|
|
7
|
+
|
|
8
|
+
import { ServiceResolver } from '@dxos/compute';
|
|
9
|
+
import { Feed, Obj } from '@dxos/echo';
|
|
10
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
11
|
+
import { TriggerDispatcher } from '@dxos/functions-runtime';
|
|
12
|
+
import type { SpaceId } from '@dxos/keys';
|
|
13
|
+
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
14
|
+
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
15
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
16
|
+
|
|
17
|
+
import { AutomationPlugin } from '#plugin';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the per-space {@link TriggerDispatcher} from the harness'
|
|
21
|
+
* process-manager runtime. The `LayerStack` caches dispatchers per
|
|
22
|
+
* `{ space }` context, so the returned instance is the same one the
|
|
23
|
+
* controller is driving.
|
|
24
|
+
*/
|
|
25
|
+
const getDispatcher = (harness: Awaited<ReturnType<typeof createComposerTestApp>>, spaceId: SpaceId) =>
|
|
26
|
+
harness.runPromise(
|
|
27
|
+
Effect.flatMap(TriggerDispatcher, Effect.succeed).pipe(
|
|
28
|
+
Effect.provide(ServiceResolver.provide({ space: spaceId }, TriggerDispatcher)),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
describe('TriggerRuntimeController', () => {
|
|
33
|
+
test('toggles the per-space TriggerDispatcher as computeEnvironment changes', async ({ expect }) => {
|
|
34
|
+
await using harness = await createComposerTestApp({
|
|
35
|
+
plugins: [ClientPlugin({ types: [Feed.Feed] }), AutomationPlugin()],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Creating identity also creates the personal space and emits SpacesReady,
|
|
39
|
+
// which is what gates the TriggerRuntimeController module's activation.
|
|
40
|
+
const { personalSpace } = await runAndForwardErrors(initializeIdentity(harness.get(ClientCapabilities.Client)));
|
|
41
|
+
await harness.waitForEvent(ClientEvents.SpacesReady);
|
|
42
|
+
|
|
43
|
+
const dispatcher = await getDispatcher(harness, personalSpace.id);
|
|
44
|
+
|
|
45
|
+
// Observe the dispatcher's `state` atom (the same surface the UI hook
|
|
46
|
+
// exposes through `useTriggerRuntimeControls`).
|
|
47
|
+
const observedStates: boolean[] = [];
|
|
48
|
+
const unsubscribe = harness.registry.subscribe(dispatcher.state, (state) => observedStates.push(state.enabled), {
|
|
49
|
+
immediate: true,
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
// Default `computeEnvironment` is `local`, so the controller should
|
|
53
|
+
// start the dispatcher shortly after the space becomes ready.
|
|
54
|
+
await expect.poll(() => harness.registry.get(dispatcher.state).enabled, { timeout: 5_000 }).toBe(true);
|
|
55
|
+
|
|
56
|
+
// `disabled` → dispatcher should stop.
|
|
57
|
+
Obj.update(personalSpace.properties, (properties) => {
|
|
58
|
+
properties.computeEnvironment = 'disabled';
|
|
59
|
+
});
|
|
60
|
+
await expect.poll(() => harness.registry.get(dispatcher.state).enabled, { timeout: 5_000 }).toBe(false);
|
|
61
|
+
|
|
62
|
+
// Back to `local` → dispatcher should start again.
|
|
63
|
+
Obj.update(personalSpace.properties, (properties) => {
|
|
64
|
+
properties.computeEnvironment = 'local';
|
|
65
|
+
});
|
|
66
|
+
await expect.poll(() => harness.registry.get(dispatcher.state).enabled, { timeout: 5_000 }).toBe(true);
|
|
67
|
+
|
|
68
|
+
// `edge` → dispatcher should stop (triggers run on the edge instead).
|
|
69
|
+
Obj.update(personalSpace.properties, (properties) => {
|
|
70
|
+
properties.computeEnvironment = 'edge';
|
|
71
|
+
});
|
|
72
|
+
await expect.poll(() => harness.registry.get(dispatcher.state).enabled, { timeout: 5_000 }).toBe(false);
|
|
73
|
+
|
|
74
|
+
// The atom subscription should have witnessed every transition.
|
|
75
|
+
expect(observedStates).toEqual(expect.arrayContaining([true, false, true, false]));
|
|
76
|
+
} finally {
|
|
77
|
+
unsubscribe();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('does not re-issue start when computeEnvironment is reasserted to the same value', async ({ expect }) => {
|
|
82
|
+
await using harness = await createComposerTestApp({
|
|
83
|
+
plugins: [ClientPlugin({ types: [Feed.Feed] }), AutomationPlugin()],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const { personalSpace } = await runAndForwardErrors(initializeIdentity(harness.get(ClientCapabilities.Client)));
|
|
87
|
+
await harness.waitForEvent(ClientEvents.SpacesReady);
|
|
88
|
+
|
|
89
|
+
const dispatcher = await getDispatcher(harness, personalSpace.id);
|
|
90
|
+
|
|
91
|
+
await expect.poll(() => harness.registry.get(dispatcher.state).enabled, { timeout: 5_000 }).toBe(true);
|
|
92
|
+
|
|
93
|
+
// Writing the same `local` value should be a no-op: the controller
|
|
94
|
+
// dedupes via its `lastEnvironment` tracker so the dispatcher stays
|
|
95
|
+
// running without an intervening stop/start flicker.
|
|
96
|
+
Obj.update(personalSpace.properties, (properties) => {
|
|
97
|
+
properties.computeEnvironment = 'local';
|
|
98
|
+
});
|
|
99
|
+
// Give any spurious transition a chance to land before we check.
|
|
100
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
101
|
+
expect(harness.registry.get(dispatcher.state).enabled).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Fiber from 'effect/Fiber';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type ComputeEnvironment } from '@dxos/client-protocol';
|
|
10
|
+
import { ServiceResolver } from '@dxos/compute';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { TriggerDispatcher } from '@dxos/functions-runtime';
|
|
13
|
+
import { type SpaceId } from '@dxos/keys';
|
|
14
|
+
import { log } from '@dxos/log';
|
|
15
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
16
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
17
|
+
|
|
18
|
+
//
|
|
19
|
+
// Capability Module
|
|
20
|
+
//
|
|
21
|
+
// Watches `space.properties.computeEnvironment` for every space and toggles
|
|
22
|
+
// the per-space {@link TriggerDispatcher} accordingly:
|
|
23
|
+
//
|
|
24
|
+
// - `local` → `dispatcher.start()`
|
|
25
|
+
// - `edge` / `disabled` → `dispatcher.stop()`
|
|
26
|
+
//
|
|
27
|
+
// Replaces the in-line watcher that used to live inside the removed
|
|
28
|
+
// `compute-runtime.ts` per-space layer. The dispatcher itself is now
|
|
29
|
+
// contributed unconditionally via `TriggerDispatcherSpec` in `layer-specs.ts`,
|
|
30
|
+
// so this capability is only responsible for driving its lifecycle.
|
|
31
|
+
//
|
|
32
|
+
|
|
33
|
+
/** Trigger execution location the dispatcher should run locally. */
|
|
34
|
+
const LOCAL_ENVIRONMENT: ComputeEnvironment = 'local';
|
|
35
|
+
|
|
36
|
+
export default Capability.makeModule(
|
|
37
|
+
Effect.fnUntraced(function* () {
|
|
38
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
39
|
+
const runtime = yield* Capability.get(Capabilities.ProcessManagerRuntime);
|
|
40
|
+
|
|
41
|
+
/** Per-space property-subscription unsubscribe, last-seen environment, and in-flight transition fiber. */
|
|
42
|
+
type Tracker = {
|
|
43
|
+
unsubscribe: () => void;
|
|
44
|
+
lastEnvironment?: ComputeEnvironment;
|
|
45
|
+
inFlight?: Fiber.RuntimeFiber<unknown, unknown>;
|
|
46
|
+
};
|
|
47
|
+
const trackers = new Map<SpaceId, Tracker>();
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Resolve the per-space `TriggerDispatcher` from the process-manager
|
|
51
|
+
* runtime and invoke `start()` / `stop()` according to the requested
|
|
52
|
+
* environment. Returns a fiber so the caller can cancel a pending
|
|
53
|
+
* transition when a new one supersedes it.
|
|
54
|
+
*/
|
|
55
|
+
const transition = (spaceId: SpaceId, environment: ComputeEnvironment) =>
|
|
56
|
+
runtime.runFork(
|
|
57
|
+
Effect.gen(function* () {
|
|
58
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
59
|
+
yield* environment === LOCAL_ENVIRONMENT ? dispatcher.start() : dispatcher.stop();
|
|
60
|
+
}).pipe(
|
|
61
|
+
Effect.provide(ServiceResolver.provide({ space: spaceId }, TriggerDispatcher)),
|
|
62
|
+
Effect.tapErrorCause((cause) =>
|
|
63
|
+
Effect.sync(() => log.warn('trigger dispatcher transition failed', { spaceId, environment, cause })),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const apply = (tracker: Tracker, spaceId: SpaceId, environment: ComputeEnvironment): void => {
|
|
69
|
+
if (tracker.lastEnvironment === environment) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
tracker.lastEnvironment = environment;
|
|
73
|
+
if (tracker.inFlight) {
|
|
74
|
+
runtime.runFork(Fiber.interrupt(tracker.inFlight));
|
|
75
|
+
}
|
|
76
|
+
tracker.inFlight = transition(spaceId, environment);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const install = (space: Space): void => {
|
|
80
|
+
if (trackers.has(space.id)) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// Reserve the slot synchronously so concurrent `client.spaces.subscribe`
|
|
84
|
+
// notifications (e.g. spaces array churn while we await readiness) don't
|
|
85
|
+
// wire a second subscriber for the same space.
|
|
86
|
+
const tracker: Tracker = { unsubscribe: () => {} };
|
|
87
|
+
trackers.set(space.id, tracker);
|
|
88
|
+
|
|
89
|
+
void space
|
|
90
|
+
.waitUntilReady()
|
|
91
|
+
.then(() => {
|
|
92
|
+
// The capability could have been torn down between `set` and the
|
|
93
|
+
// promise resolving; bail out without subscribing in that case.
|
|
94
|
+
if (trackers.get(space.id) !== tracker) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const readEnvironment = (): ComputeEnvironment => space.properties.computeEnvironment ?? LOCAL_ENVIRONMENT;
|
|
98
|
+
tracker.unsubscribe = Obj.subscribe(space.properties, () => apply(tracker, space.id, readEnvironment()));
|
|
99
|
+
apply(tracker, space.id, readEnvironment());
|
|
100
|
+
})
|
|
101
|
+
.catch((err) => log.catch(err));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const installAll = (spaces: readonly Space[]): void => {
|
|
105
|
+
for (const space of spaces) {
|
|
106
|
+
install(space);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const spacesSubscription = client.spaces.subscribe(installAll);
|
|
111
|
+
installAll(client.spaces.get());
|
|
112
|
+
|
|
113
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
114
|
+
Effect.sync(() => {
|
|
115
|
+
spacesSubscription.unsubscribe();
|
|
116
|
+
for (const tracker of trackers.values()) {
|
|
117
|
+
tracker.unsubscribe();
|
|
118
|
+
if (tracker.inFlight) {
|
|
119
|
+
runtime.runFork(Fiber.interrupt(tracker.inFlight));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
trackers.clear();
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Command from '@effect/cli/Command';
|
|
6
|
+
|
|
7
|
+
import { queue } from './queue';
|
|
8
|
+
import { subscription } from './subscription';
|
|
9
|
+
import { timer } from './timer';
|
|
10
|
+
|
|
11
|
+
export const create = Command.make('create').pipe(
|
|
12
|
+
Command.withDescription('Create a trigger.'),
|
|
13
|
+
Command.withSubcommands([subscription, timer, queue]),
|
|
14
|
+
);
|