@dxos/plugin-automation 0.8.3 → 0.8.4-main.1da679c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/AutomationPanel-N5HFJJXW.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-S3F2VT7Q.mjs +70 -0
- package/dist/lib/browser/AutomationSettings-S3F2VT7Q.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsContainer-JY7V7PLF.mjs → FunctionsContainer-U4HASI4P.mjs} +6 -9
- package/dist/lib/browser/FunctionsContainer-U4HASI4P.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs → FunctionsPanel-I443Y6KB.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-T34RV5UA.mjs → app-graph-builder-SRA3X2GQ.mjs} +6 -6
- package/dist/lib/{node-esm/app-graph-builder-DYWAKQM3.mjs.map → browser/app-graph-builder-SRA3X2GQ.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-C5VOC5EE.mjs → chunk-4TWQV33E.mjs} +14 -18
- package/dist/lib/browser/chunk-4TWQV33E.mjs.map +7 -0
- package/dist/lib/browser/chunk-CRUNQZ2M.mjs +15 -0
- package/dist/lib/browser/chunk-CRUNQZ2M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IHAKPP5A.mjs → chunk-GW5U2DGT.mjs} +2 -2
- package/dist/lib/browser/{chunk-4E2KPMLB.mjs → chunk-HN7OHFCB.mjs} +5 -6
- package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +7 -0
- package/dist/lib/browser/chunk-NQGKPPXI.mjs +14 -0
- package/dist/lib/browser/chunk-NQGKPPXI.mjs.map +7 -0
- package/dist/lib/browser/chunk-P6YOYDXP.mjs +53 -0
- package/dist/lib/browser/chunk-P6YOYDXP.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N5VLW7UZ.mjs → chunk-S4SM663I.mjs} +20 -20
- package/dist/lib/browser/chunk-S4SM663I.mjs.map +7 -0
- package/dist/lib/browser/chunk-UHXDXRP4.mjs +14 -0
- package/dist/lib/browser/chunk-UHXDXRP4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RHSCK7AU.mjs → chunk-Z5DT4MHW.mjs} +5 -5
- package/dist/lib/{node-esm/chunk-2IH4VB3R.mjs.map → browser/chunk-Z5DT4MHW.mjs.map} +3 -3
- package/dist/lib/browser/compute-runtime-G25R3RSS.mjs +154 -0
- package/dist/lib/browser/compute-runtime-G25R3RSS.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +12 -0
- package/dist/lib/browser/index.mjs +30 -19
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-AX46HSU7.mjs → intent-resolver-CMLGPFD6.mjs} +12 -11
- package/dist/lib/browser/intent-resolver-CMLGPFD6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-Z7A272CA.mjs → react-surface-IYFH2BEM.mjs} +18 -18
- package/dist/lib/browser/react-surface-IYFH2BEM.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -0
- package/dist/lib/node-esm/{AutomationPanel-Y3ODAHH7.mjs → AutomationPanel-MKOLA2FE.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-C3GNAUYC.mjs +71 -0
- package/dist/lib/node-esm/AutomationSettings-C3GNAUYC.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsContainer-25M5VT3J.mjs → FunctionsContainer-VZIVURH6.mjs} +6 -9
- package/dist/lib/node-esm/FunctionsContainer-VZIVURH6.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs → FunctionsPanel-ELINCXPW.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-DYWAKQM3.mjs → app-graph-builder-R5XQJKZS.mjs} +6 -6
- package/dist/lib/{browser/app-graph-builder-T34RV5UA.mjs.map → node-esm/app-graph-builder-R5XQJKZS.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-2T2OZC3A.mjs → chunk-AONUBWBE.mjs} +14 -18
- package/dist/lib/node-esm/chunk-AONUBWBE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BTD2B4SZ.mjs +16 -0
- package/dist/lib/node-esm/chunk-BTD2B4SZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CTAX6WBZ.mjs +16 -0
- package/dist/lib/node-esm/chunk-CTAX6WBZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2IH4VB3R.mjs → chunk-CX2AILIS.mjs} +5 -5
- package/dist/lib/{browser/chunk-RHSCK7AU.mjs.map → node-esm/chunk-CX2AILIS.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-HCCLRNMJ.mjs → chunk-NK5N3QKD.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-6JOJ2NN4.mjs → chunk-OEZNHUL2.mjs} +5 -6
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UAOO5IZQ.mjs +16 -0
- package/dist/lib/node-esm/chunk-UAOO5IZQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XL33Y62M.mjs +54 -0
- package/dist/lib/node-esm/chunk-XL33Y62M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UFHDB2OA.mjs → chunk-ZOJVKPCA.mjs} +20 -20
- package/dist/lib/node-esm/chunk-ZOJVKPCA.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-LHO62OVM.mjs +155 -0
- package/dist/lib/node-esm/compute-runtime-LHO62OVM.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +13 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +30 -19
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-WXHFNJJI.mjs → intent-resolver-NUPI6NC6.mjs} +12 -11
- package/dist/lib/node-esm/intent-resolver-NUPI6NC6.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-TP6IYSR4.mjs → react-surface-FDRJ76PK.mjs} +18 -18
- package/dist/lib/node-esm/react-surface-FDRJ76PK.mjs.map +7 -0
- package/dist/lib/node-esm/{types.mjs → types/index.mjs} +3 -3
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +18 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -5
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +45 -3
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/AutomationSettings.d.ts +5 -0
- package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +45 -3
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +6 -0
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +11 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +31 -29
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +3 -3
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -34
- package/src/AutomationPlugin.tsx +9 -4
- package/src/capabilities/app-graph-builder.ts +2 -2
- package/src/capabilities/capabilities.ts +52 -0
- package/src/capabilities/compute-runtime.ts +124 -0
- package/src/capabilities/index.ts +3 -0
- package/src/capabilities/intent-resolver.ts +7 -7
- package/src/capabilities/react-surface.tsx +11 -11
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +11 -8
- package/src/components/AutomationPanel/AutomationPanel.tsx +15 -27
- package/src/components/AutomationSettings.tsx +30 -0
- package/src/components/FunctionsContainer.tsx +10 -12
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +2 -2
- package/src/components/TriggerEditor/SpecSelector.tsx +14 -14
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +12 -9
- package/src/components/TriggerEditor/TriggerEditor.tsx +6 -12
- package/src/components/TriggerSettings.tsx +25 -0
- package/src/components/index.ts +1 -1
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useComputeRuntimeCallback.ts +30 -0
- package/src/hooks/useTriggerRuntimeControls.ts +52 -0
- package/src/index.ts +1 -0
- package/src/translations.ts +10 -4
- package/src/types/index.ts +5 -0
- package/src/{types.ts → types/schema.ts} +2 -4
- package/dist/lib/browser/AutomationContainer-OGNK3HD5.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-OGNK3HD5.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-PRIIAXD5.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-JY7V7PLF.mjs.map +0 -7
- package/dist/lib/browser/chunk-4E2KPMLB.mjs.map +0 -7
- package/dist/lib/browser/chunk-C5VOC5EE.mjs.map +0 -7
- package/dist/lib/browser/chunk-N5VLW7UZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-VQWJ5UYA.mjs +0 -14
- package/dist/lib/browser/chunk-VQWJ5UYA.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AX46HSU7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-Z7A272CA.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -8
- package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs +0 -66
- package/dist/lib/node/AutomationContainer-B7PSJFIS.cjs.map +0 -7
- package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs +0 -32
- package/dist/lib/node/AutomationPanel-XYLZU4MI.cjs.map +0 -7
- package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs +0 -67
- package/dist/lib/node/FunctionsContainer-4FGOQW5X.cjs.map +0 -7
- package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs +0 -31
- package/dist/lib/node/FunctionsPanel-EWWAZK3W.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs +0 -96
- package/dist/lib/node/app-graph-builder-5XRIIV7E.cjs.map +0 -7
- package/dist/lib/node/chunk-3EF7MLFX.cjs +0 -38
- package/dist/lib/node/chunk-3EF7MLFX.cjs.map +0 -7
- package/dist/lib/node/chunk-6X3XJ4VI.cjs +0 -122
- package/dist/lib/node/chunk-6X3XJ4VI.cjs.map +0 -7
- package/dist/lib/node/chunk-GIIVTK4O.cjs +0 -58
- package/dist/lib/node/chunk-GIIVTK4O.cjs.map +0 -7
- package/dist/lib/node/chunk-IXUCZ3YY.cjs +0 -173
- package/dist/lib/node/chunk-IXUCZ3YY.cjs.map +0 -7
- package/dist/lib/node/chunk-LQ6XK4N5.cjs +0 -253
- package/dist/lib/node/chunk-LQ6XK4N5.cjs.map +0 -7
- package/dist/lib/node/chunk-TH4XDKAY.cjs +0 -49
- package/dist/lib/node/chunk-TH4XDKAY.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -124
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-EAREQZFE.cjs +0 -92
- package/dist/lib/node/intent-resolver-EAREQZFE.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-OI6CDHEI.cjs +0 -87
- package/dist/lib/node/react-surface-OI6CDHEI.cjs.map +0 -7
- package/dist/lib/node/types.cjs +0 -30
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-ANCUYDDA.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-ANCUYDDA.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-25M5VT3J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2T2OZC3A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JOJ2NN4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UFHDB2OA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WJHKFPX2.mjs +0 -16
- package/dist/lib/node-esm/chunk-WJHKFPX2.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-WXHFNJJI.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TP6IYSR4.mjs.map +0 -7
- 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/types.d.ts.map +0 -1
- package/src/components/AutomationContainer.tsx +0 -30
- /package/dist/lib/browser/{AutomationPanel-PRIIAXD5.mjs.map → AutomationPanel-N5HFJJXW.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-LY4IFKR7.mjs.map → FunctionsPanel-I443Y6KB.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-IHAKPP5A.mjs.map → chunk-GW5U2DGT.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → hooks/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/AutomationPanel-Y3ODAHH7.mjs.map → browser/types/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-HVGF5AJP.mjs.map → AutomationPanel-MKOLA2FE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{types.mjs.map → FunctionsPanel-ELINCXPW.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HCCLRNMJ.mjs.map → chunk-NK5N3QKD.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-automation",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.1da679c",
|
|
4
4
|
"description": "Prompt chain plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,19 +10,34 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
18
|
+
"./hooks": {
|
|
19
|
+
"source": "./src/hooks/index.ts",
|
|
20
|
+
"types": "./dist/types/src/hooks/index.d.ts",
|
|
21
|
+
"browser": "./dist/lib/browser/hooks/index.mjs",
|
|
22
|
+
"node": "./dist/lib/node-esm/hooks/index.mjs"
|
|
23
|
+
},
|
|
17
24
|
"./types": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
25
|
+
"source": "./src/types/index.ts",
|
|
26
|
+
"types": "./dist/types/src/types/index.d.ts",
|
|
27
|
+
"browser": "./dist/lib/browser/types/index.mjs",
|
|
28
|
+
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
21
29
|
}
|
|
22
30
|
},
|
|
23
31
|
"types": "dist/types/src/index.d.ts",
|
|
24
32
|
"typesVersions": {
|
|
25
|
-
"*": {
|
|
33
|
+
"*": {
|
|
34
|
+
"hooks": [
|
|
35
|
+
"dist/types/src/hooks/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"types": [
|
|
38
|
+
"dist/types/src/types/index.d.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
26
41
|
},
|
|
27
42
|
"files": [
|
|
28
43
|
"assets",
|
|
@@ -30,49 +45,55 @@
|
|
|
30
45
|
"src"
|
|
31
46
|
],
|
|
32
47
|
"dependencies": {
|
|
48
|
+
"@effect/ai": "0.25.2",
|
|
49
|
+
"@effect/platform-browser": "0.70.0",
|
|
33
50
|
"@preact-signals/safe-react": "^0.9.0",
|
|
34
51
|
"@preact/signals-core": "^1.9.0",
|
|
35
|
-
"@dxos/app-framework": "0.8.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/react-ui-
|
|
52
|
+
"@dxos/app-framework": "0.8.4-main.1da679c",
|
|
53
|
+
"@dxos/ai": "0.8.4-main.1da679c",
|
|
54
|
+
"@dxos/assistant": "0.8.4-main.1da679c",
|
|
55
|
+
"@dxos/async": "0.8.4-main.1da679c",
|
|
56
|
+
"@dxos/conductor": "0.8.4-main.1da679c",
|
|
57
|
+
"@dxos/context": "0.8.4-main.1da679c",
|
|
58
|
+
"@dxos/echo": "0.8.4-main.1da679c",
|
|
59
|
+
"@dxos/echo-schema": "0.8.4-main.1da679c",
|
|
60
|
+
"@dxos/functions": "0.8.4-main.1da679c",
|
|
61
|
+
"@dxos/log": "0.8.4-main.1da679c",
|
|
62
|
+
"@dxos/live-object": "0.8.4-main.1da679c",
|
|
63
|
+
"@dxos/plugin-client": "0.8.4-main.1da679c",
|
|
64
|
+
"@dxos/invariant": "0.8.4-main.1da679c",
|
|
65
|
+
"@dxos/plugin-deck": "0.8.4-main.1da679c",
|
|
66
|
+
"@dxos/plugin-graph": "0.8.4-main.1da679c",
|
|
67
|
+
"@dxos/plugin-space": "0.8.4-main.1da679c",
|
|
68
|
+
"@dxos/random": "0.8.4-main.1da679c",
|
|
69
|
+
"@dxos/react-client": "0.8.4-main.1da679c",
|
|
70
|
+
"@dxos/react-ui-form": "0.8.4-main.1da679c",
|
|
71
|
+
"@dxos/keys": "0.8.4-main.1da679c",
|
|
72
|
+
"@dxos/react-ui-list": "0.8.4-main.1da679c",
|
|
73
|
+
"@dxos/react-ui-stack": "0.8.4-main.1da679c",
|
|
74
|
+
"@dxos/util": "0.8.4-main.1da679c"
|
|
54
75
|
},
|
|
55
76
|
"devDependencies": {
|
|
56
|
-
"@effect-rx/rx-react": "
|
|
57
|
-
"@effect/platform": "0.
|
|
77
|
+
"@effect-rx/rx-react": "0.38.0",
|
|
78
|
+
"@effect/platform": "0.90.2",
|
|
58
79
|
"@types/react": "~18.2.0",
|
|
59
80
|
"@types/react-dom": "~18.2.0",
|
|
60
|
-
"effect": "3.
|
|
81
|
+
"effect": "3.17.7",
|
|
61
82
|
"react": "~18.2.0",
|
|
62
83
|
"react-dom": "~18.2.0",
|
|
63
|
-
"vite": "
|
|
64
|
-
"@dxos/react-ui
|
|
65
|
-
"@dxos/react-ui": "0.8.
|
|
66
|
-
"@dxos/storybook-utils": "0.8.
|
|
84
|
+
"vite": "7.1.1",
|
|
85
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
86
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c",
|
|
87
|
+
"@dxos/storybook-utils": "0.8.4-main.1da679c"
|
|
67
88
|
},
|
|
68
89
|
"peerDependencies": {
|
|
69
90
|
"@effect-rx/rx-react": "^0.34.1",
|
|
70
|
-
"@effect/platform": "0.80.12",
|
|
91
|
+
"@effect/platform": "^0.80.12",
|
|
71
92
|
"effect": "^3.13.3",
|
|
72
93
|
"react": "~18.2.0",
|
|
73
94
|
"react-dom": "~18.2.0",
|
|
74
|
-
"@dxos/react-ui": "0.8.
|
|
75
|
-
"@dxos/react-ui-theme": "0.8.
|
|
95
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
96
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c"
|
|
76
97
|
},
|
|
77
98
|
"publishConfig": {
|
|
78
99
|
"access": "public"
|
package/src/AutomationPlugin.tsx
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities, contributes, defineModule, definePlugin
|
|
6
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
|
+
import { FunctionTrigger, FunctionType } from '@dxos/functions';
|
|
7
7
|
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
8
8
|
|
|
9
|
-
import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
|
|
9
|
+
import { AppGraphBuilder, ComputeRuntime, IntentResolver, ReactSurface } from './capabilities';
|
|
10
10
|
import { meta } from './meta';
|
|
11
|
-
import translations from './translations';
|
|
11
|
+
import { translations } from './translations';
|
|
12
12
|
|
|
13
13
|
export const AutomationPlugin = () =>
|
|
14
14
|
definePlugin(meta, [
|
|
@@ -37,4 +37,9 @@ export const AutomationPlugin = () =>
|
|
|
37
37
|
activatesOn: Events.SetupReactSurface,
|
|
38
38
|
activate: ReactSurface,
|
|
39
39
|
}),
|
|
40
|
+
defineModule({
|
|
41
|
+
id: `${meta.id}/module/compute-runtime`,
|
|
42
|
+
activatesOn: ClientEvents.ClientReady,
|
|
43
|
+
activate: ComputeRuntime,
|
|
44
|
+
}),
|
|
40
45
|
]);
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import { Capabilities,
|
|
8
|
+
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { ScriptType } from '@dxos/functions';
|
|
11
|
-
import {
|
|
11
|
+
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
12
12
|
import { createExtension } from '@dxos/plugin-graph';
|
|
13
13
|
import { SPACE_PLUGIN } from '@dxos/plugin-space';
|
|
14
14
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ManagedRuntime } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
8
|
+
import { defineCapability } from '@dxos/app-framework';
|
|
9
|
+
import type {
|
|
10
|
+
CredentialsService,
|
|
11
|
+
DatabaseService,
|
|
12
|
+
FunctionImplementationResolver,
|
|
13
|
+
InvocationTracer,
|
|
14
|
+
LocalFunctionExecutionService,
|
|
15
|
+
QueueService,
|
|
16
|
+
RemoteFunctionExecutionService,
|
|
17
|
+
TriggerDispatcher,
|
|
18
|
+
TriggerStateStore,
|
|
19
|
+
} from '@dxos/functions';
|
|
20
|
+
import type { SpaceId } from '@dxos/keys';
|
|
21
|
+
|
|
22
|
+
import { meta } from '../meta';
|
|
23
|
+
|
|
24
|
+
export namespace AutomationCapabilities {
|
|
25
|
+
/**
|
|
26
|
+
* Service stack for executing agents, functions, and triggers.
|
|
27
|
+
*/
|
|
28
|
+
export type ComputeServices =
|
|
29
|
+
| TriggerDispatcher
|
|
30
|
+
| AiService.AiService
|
|
31
|
+
| DatabaseService
|
|
32
|
+
| QueueService
|
|
33
|
+
| CredentialsService
|
|
34
|
+
| LocalFunctionExecutionService
|
|
35
|
+
| RemoteFunctionExecutionService
|
|
36
|
+
// TODO(dmaretskyi): This service is private and shouldn't be exposed as a part of public API.
|
|
37
|
+
| FunctionImplementationResolver
|
|
38
|
+
| InvocationTracer
|
|
39
|
+
| TriggerStateStore
|
|
40
|
+
// TODO(dmaretskyi): Those should be provided at AI-chat call site.
|
|
41
|
+
| ToolResolverService
|
|
42
|
+
| ToolExecutionService;
|
|
43
|
+
|
|
44
|
+
export interface ComputeRuntimeProvider {
|
|
45
|
+
getRuntime(spaceId: SpaceId): ManagedRuntime.ManagedRuntime<ComputeServices, never>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Runtime for executing agents, functions, and triggers.
|
|
50
|
+
*/
|
|
51
|
+
export const ComputeRuntime = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);
|
|
52
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type AiTool, AiToolkit } from '@effect/ai';
|
|
6
|
+
import { BrowserKeyValueStore } from '@effect/platform-browser';
|
|
7
|
+
import { Effect, Layer, ManagedRuntime } from 'effect';
|
|
8
|
+
|
|
9
|
+
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
10
|
+
import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
11
|
+
import { Resource } from '@dxos/context';
|
|
12
|
+
import { Query, Ref } from '@dxos/echo';
|
|
13
|
+
import {
|
|
14
|
+
CredentialsService,
|
|
15
|
+
DatabaseService,
|
|
16
|
+
FunctionImplementationResolver,
|
|
17
|
+
InvocationTracer,
|
|
18
|
+
LocalFunctionExecutionService,
|
|
19
|
+
QueueService,
|
|
20
|
+
RemoteFunctionExecutionService,
|
|
21
|
+
TriggerDispatcher,
|
|
22
|
+
} from '@dxos/functions';
|
|
23
|
+
import { TriggerStateStore } from '@dxos/functions';
|
|
24
|
+
import { invariant } from '@dxos/invariant';
|
|
25
|
+
import { type SpaceId } from '@dxos/keys';
|
|
26
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
27
|
+
import { PropertiesType } from '@dxos/react-client/echo';
|
|
28
|
+
|
|
29
|
+
import { AutomationCapabilities } from './capabilities';
|
|
30
|
+
|
|
31
|
+
export default async (context: PluginContext) => {
|
|
32
|
+
const provider = await new ComputeRuntimeProviderImpl(context).open();
|
|
33
|
+
return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {
|
|
34
|
+
await provider.close();
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
class ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {
|
|
39
|
+
readonly #runtimes = new Map<SpaceId, ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>>();
|
|
40
|
+
readonly #context: PluginContext;
|
|
41
|
+
|
|
42
|
+
constructor(context: PluginContext) {
|
|
43
|
+
super();
|
|
44
|
+
this.#context = context;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected override async _open() {}
|
|
48
|
+
|
|
49
|
+
protected override async _close() {
|
|
50
|
+
await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));
|
|
51
|
+
this.#runtimes.clear();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getRuntime(spaceId: SpaceId): ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never> {
|
|
55
|
+
if (this.#runtimes.has(spaceId)) {
|
|
56
|
+
return this.#runtimes.get(spaceId)!;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const layer = Layer.unwrapEffect(
|
|
60
|
+
Effect.gen(this, function* () {
|
|
61
|
+
const client = this.#context.getCapability(ClientCapabilities.Client);
|
|
62
|
+
const serviceLayer =
|
|
63
|
+
this.#context.getCapability(Capabilities.AiServiceLayer) ?? Layer.die('AiService not found');
|
|
64
|
+
|
|
65
|
+
// TODO(dmaretskyi): Make those reactive.
|
|
66
|
+
const functions = this.#context.getCapabilities(Capabilities.Functions);
|
|
67
|
+
const toolkits = this.#context.getCapabilities(Capabilities.Toolkit);
|
|
68
|
+
const handlers = this.#context.getCapabilities(Capabilities.ToolkitHandler);
|
|
69
|
+
|
|
70
|
+
const allFunctions = functions.flat();
|
|
71
|
+
// TODO(wittjosiah): Don't cast.
|
|
72
|
+
const toolkit = AiToolkit.merge(...toolkits) as AiToolkit.Any as AiToolkit.AiToolkit<AiTool.Any>;
|
|
73
|
+
const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
|
|
74
|
+
|
|
75
|
+
const space = client.spaces.get(spaceId);
|
|
76
|
+
invariant(space);
|
|
77
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
78
|
+
|
|
79
|
+
return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(
|
|
80
|
+
Layer.provideMerge(
|
|
81
|
+
Layer.mergeAll(
|
|
82
|
+
InvocationTracerLive,
|
|
83
|
+
TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),
|
|
84
|
+
serviceLayer,
|
|
85
|
+
makeToolResolverFromFunctions(allFunctions, toolkit),
|
|
86
|
+
makeToolExecutionServiceFromFunctions(allFunctions, toolkit, handlersLayer),
|
|
87
|
+
CredentialsService.layerFromDatabase(),
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
Layer.provideMerge(
|
|
91
|
+
Layer.mergeAll(
|
|
92
|
+
space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable,
|
|
93
|
+
space ? QueueService.layer(space.queues) : QueueService.notAvailable,
|
|
94
|
+
LocalFunctionExecutionService.layerLive,
|
|
95
|
+
RemoteFunctionExecutionService.mockLayer,
|
|
96
|
+
),
|
|
97
|
+
),
|
|
98
|
+
Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions: allFunctions })),
|
|
99
|
+
);
|
|
100
|
+
}),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const runtime = ManagedRuntime.make(layer);
|
|
104
|
+
this.#runtimes.set(spaceId, runtime);
|
|
105
|
+
|
|
106
|
+
return runtime;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const InvocationTracerLive = Layer.unwrapEffect(
|
|
111
|
+
Effect.gen(function* () {
|
|
112
|
+
const {
|
|
113
|
+
objects: [properties],
|
|
114
|
+
} = yield* DatabaseService.runQuery(Query.type(PropertiesType));
|
|
115
|
+
invariant(properties);
|
|
116
|
+
if (!properties.invocationTraceQueue) {
|
|
117
|
+
const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });
|
|
118
|
+
properties.invocationTraceQueue = Ref.fromDXN(queue.dxn);
|
|
119
|
+
}
|
|
120
|
+
const queue = properties.invocationTraceQueue.target;
|
|
121
|
+
invariant(queue);
|
|
122
|
+
return InvocationTracer.layerLive({ invocationTraceQueue: queue });
|
|
123
|
+
}),
|
|
124
|
+
);
|
|
@@ -5,5 +5,8 @@
|
|
|
5
5
|
import { lazy } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
|
|
8
|
+
export const ComputeRuntime = lazy(() => import('./compute-runtime'));
|
|
8
9
|
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
10
|
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
11
|
+
|
|
12
|
+
export * from './capabilities';
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
contributes,
|
|
7
6
|
Capabilities,
|
|
8
|
-
|
|
7
|
+
LayoutAction,
|
|
9
8
|
type PluginContext,
|
|
9
|
+
contributes,
|
|
10
10
|
createIntent,
|
|
11
|
-
|
|
11
|
+
createResolver,
|
|
12
12
|
} from '@dxos/app-framework';
|
|
13
13
|
import { Obj, Ref } from '@dxos/echo';
|
|
14
|
-
import { FunctionTrigger, FunctionType, ScriptType
|
|
14
|
+
import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
|
|
15
15
|
import { type DXN } from '@dxos/keys';
|
|
16
16
|
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';
|
|
17
17
|
import { SpaceAction } from '@dxos/plugin-space/types';
|
|
@@ -43,11 +43,11 @@ export default (context: PluginContext) =>
|
|
|
43
43
|
|
|
44
44
|
switch (template.type) {
|
|
45
45
|
case 'timer': {
|
|
46
|
-
trigger.spec = { kind:
|
|
46
|
+
trigger.spec = { kind: 'timer', cron: template.cron };
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case 'queue': {
|
|
50
|
-
trigger.spec = { kind:
|
|
50
|
+
trigger.spec = { kind: 'queue', queue: (template.queueDXN as DXN).toString() };
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
default: {
|
|
@@ -57,7 +57,7 @@ export default (context: PluginContext) =>
|
|
|
57
57
|
|
|
58
58
|
return {
|
|
59
59
|
intents: [
|
|
60
|
-
createIntent(SpaceAction.AddObject, { object: trigger, target: space }),
|
|
60
|
+
createIntent(SpaceAction.AddObject, { object: trigger, target: space, hidden: true }),
|
|
61
61
|
createIntent(LayoutAction.Open, {
|
|
62
62
|
part: 'main',
|
|
63
63
|
subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],
|
|
@@ -9,39 +9,39 @@ import { Obj } from '@dxos/echo';
|
|
|
9
9
|
import { ScriptType } from '@dxos/functions';
|
|
10
10
|
import { getSpace, parseId, useSpace } from '@dxos/react-client/echo';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { AutomationSettings, FunctionsContainer } from '../components';
|
|
13
13
|
import { meta } from '../meta';
|
|
14
14
|
|
|
15
15
|
export default () =>
|
|
16
16
|
contributes(Capabilities.ReactSurface, [
|
|
17
17
|
createSurface({
|
|
18
|
-
id: `${meta.id}/space-settings-
|
|
18
|
+
id: `${meta.id}/space-settings-functions`,
|
|
19
19
|
role: 'article',
|
|
20
|
-
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-
|
|
20
|
+
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,
|
|
21
21
|
component: () => {
|
|
22
22
|
const layout = useLayout();
|
|
23
23
|
const { spaceId } = parseId(layout.workspace);
|
|
24
24
|
const space = useSpace(spaceId);
|
|
25
|
-
if (!space
|
|
25
|
+
if (!space) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return <
|
|
29
|
+
return <FunctionsContainer space={space} />;
|
|
30
30
|
},
|
|
31
31
|
}),
|
|
32
32
|
createSurface({
|
|
33
|
-
id: `${meta.id}/space-settings-
|
|
33
|
+
id: `${meta.id}/space-settings-automation`,
|
|
34
34
|
role: 'article',
|
|
35
|
-
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-
|
|
35
|
+
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,
|
|
36
36
|
component: () => {
|
|
37
37
|
const layout = useLayout();
|
|
38
38
|
const { spaceId } = parseId(layout.workspace);
|
|
39
39
|
const space = useSpace(spaceId);
|
|
40
|
-
if (!space
|
|
40
|
+
if (!space) {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return <
|
|
44
|
+
return <AutomationSettings space={space} />;
|
|
45
45
|
},
|
|
46
46
|
}),
|
|
47
47
|
createSurface({
|
|
@@ -49,8 +49,8 @@ export default () =>
|
|
|
49
49
|
role: 'article',
|
|
50
50
|
filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>
|
|
51
51
|
Obj.instanceOf(ScriptType, data.companionTo) && data.subject === 'automation',
|
|
52
|
-
component: ({ data
|
|
53
|
-
return <
|
|
52
|
+
component: ({ data }) => {
|
|
53
|
+
return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;
|
|
54
54
|
},
|
|
55
55
|
}),
|
|
56
56
|
]);
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type Meta } from '@storybook/react';
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
11
|
+
import { FunctionTrigger, FunctionType } from '@dxos/functions';
|
|
12
12
|
import { useSpaces } from '@dxos/react-client/echo';
|
|
13
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
14
14
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
15
|
|
|
16
|
-
import { AutomationPanel } from './AutomationPanel';
|
|
17
16
|
import { functions } from '../../testing';
|
|
18
|
-
import translations from '../../translations';
|
|
17
|
+
import { translations } from '../../translations';
|
|
18
|
+
|
|
19
|
+
import { AutomationPanel } from './AutomationPanel';
|
|
19
20
|
|
|
20
21
|
const DefaultStory = () => {
|
|
21
22
|
const spaces = useSpaces();
|
|
@@ -28,9 +29,9 @@ const DefaultStory = () => {
|
|
|
28
29
|
);
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
const meta
|
|
32
|
+
const meta = {
|
|
32
33
|
title: 'plugins/plugin-automation/AutomationPanel',
|
|
33
|
-
component: AutomationPanel,
|
|
34
|
+
component: AutomationPanel as any,
|
|
34
35
|
render: DefaultStory,
|
|
35
36
|
decorators: [
|
|
36
37
|
withClientProvider({
|
|
@@ -50,8 +51,10 @@ const meta: Meta = {
|
|
|
50
51
|
layout: 'centered',
|
|
51
52
|
translations,
|
|
52
53
|
},
|
|
53
|
-
}
|
|
54
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
54
55
|
|
|
55
56
|
export default meta;
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
type Story = StoryObj<typeof meta>;
|
|
59
|
+
|
|
60
|
+
export const Default: Story = {};
|
|
@@ -6,17 +6,10 @@ import { Schema } from 'effect';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Filter, Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
FunctionType,
|
|
11
|
-
FunctionTrigger,
|
|
12
|
-
FunctionTriggerSchema,
|
|
13
|
-
type FunctionTriggerType,
|
|
14
|
-
ScriptType,
|
|
15
|
-
TriggerKind,
|
|
16
|
-
} from '@dxos/functions';
|
|
9
|
+
import { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';
|
|
17
10
|
import { type Client, useClient } from '@dxos/react-client';
|
|
18
|
-
import {
|
|
19
|
-
import { Clipboard, IconButton, Input, Separator, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { type Space, getSpace, useQuery } from '@dxos/react-client/echo';
|
|
12
|
+
import { Clipboard, IconButton, Input, Separator, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
20
13
|
import { ControlItem, controlItemClasses } from '@dxos/react-ui-form';
|
|
21
14
|
import { List } from '@dxos/react-ui-list';
|
|
22
15
|
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
@@ -26,32 +19,31 @@ import { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';
|
|
|
26
19
|
|
|
27
20
|
const grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';
|
|
28
21
|
|
|
29
|
-
export type AutomationPanelProps = {
|
|
22
|
+
export type AutomationPanelProps = ThemedClassName<{
|
|
30
23
|
space: Space;
|
|
31
24
|
object?: Obj.Any;
|
|
32
|
-
initialTrigger?:
|
|
25
|
+
initialTrigger?: FunctionTrigger;
|
|
33
26
|
onDone?: () => void;
|
|
34
|
-
}
|
|
27
|
+
}>;
|
|
35
28
|
|
|
36
29
|
// TODO(burdon): Factor out common layout with ViewEditor.
|
|
37
|
-
export const AutomationPanel = ({ space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
30
|
+
export const AutomationPanel = ({ classNames, space, object, initialTrigger, onDone }: AutomationPanelProps) => {
|
|
38
31
|
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
39
32
|
const client = useClient();
|
|
40
33
|
const triggers = useQuery(space, Filter.type(FunctionTrigger));
|
|
41
34
|
const functions = useQuery(space, Filter.type(FunctionType));
|
|
42
35
|
const scripts = useQuery(space, Filter.type(ScriptType));
|
|
43
36
|
|
|
44
|
-
const [trigger, setTrigger] = useState<
|
|
37
|
+
const [trigger, setTrigger] = useState<FunctionTrigger | undefined>(initialTrigger);
|
|
45
38
|
const [selected, setSelected] = useState<FunctionTrigger>();
|
|
46
39
|
|
|
47
40
|
const handleSelect = (trigger: FunctionTrigger) => {
|
|
48
|
-
|
|
49
|
-
setTrigger(values);
|
|
41
|
+
setTrigger(trigger);
|
|
50
42
|
setSelected(trigger);
|
|
51
43
|
};
|
|
52
44
|
|
|
53
45
|
const handleAdd = () => {
|
|
54
|
-
setTrigger(Obj.make(
|
|
46
|
+
setTrigger(Obj.make(FunctionTrigger, {}));
|
|
55
47
|
setSelected(undefined);
|
|
56
48
|
};
|
|
57
49
|
|
|
@@ -87,7 +79,7 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
87
79
|
}
|
|
88
80
|
|
|
89
81
|
return (
|
|
90
|
-
<div className={controlItemClasses}>
|
|
82
|
+
<div className={mx(controlItemClasses, classNames)}>
|
|
91
83
|
{triggers.length > 0 && (
|
|
92
84
|
<List.Root<FunctionTrigger> items={triggers} isItem={Schema.is(FunctionTrigger)} getId={(field) => field.id}>
|
|
93
85
|
{({ items: triggers }) => (
|
|
@@ -139,11 +131,11 @@ export const AutomationPanel = ({ space, object, initialTrigger, onDone }: Autom
|
|
|
139
131
|
};
|
|
140
132
|
|
|
141
133
|
const getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {
|
|
142
|
-
if (trigger?.spec?.kind ===
|
|
134
|
+
if (trigger?.spec?.kind === 'email') {
|
|
143
135
|
return { translationKey: 'trigger copy email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };
|
|
144
136
|
}
|
|
145
137
|
|
|
146
|
-
if (trigger?.spec?.kind ===
|
|
138
|
+
if (trigger?.spec?.kind === 'webhook') {
|
|
147
139
|
return { translationKey: 'trigger copy url', contentProvider: () => getWebhookUrl(client, trigger) };
|
|
148
140
|
}
|
|
149
141
|
|
|
@@ -158,14 +150,10 @@ const getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {
|
|
|
158
150
|
return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();
|
|
159
151
|
};
|
|
160
152
|
|
|
161
|
-
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger:
|
|
153
|
+
const getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTrigger) => {
|
|
162
154
|
// TODO(wittjosiah): Truncation should be done in the UI.
|
|
163
155
|
// Warning that the List component is currently a can of worms.
|
|
164
156
|
const shortId = trigger.function && `${trigger.function.dxn.toString().slice(0, 16)}…`;
|
|
165
157
|
const functionObject = functions.find((fn) => fn === trigger.function?.target);
|
|
166
|
-
|
|
167
|
-
return shortId;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? shortId;
|
|
158
|
+
return functionObject?.name ?? shortId;
|
|
171
159
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
|
+
|
|
10
|
+
import { AUTOMATION_PLUGIN } from '../meta';
|
|
11
|
+
|
|
12
|
+
import { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';
|
|
13
|
+
import { TriggersSettings } from './TriggerSettings';
|
|
14
|
+
|
|
15
|
+
export const AutomationSettings = (props: AutomationPanelProps) => {
|
|
16
|
+
const { t } = useTranslation(AUTOMATION_PLUGIN);
|
|
17
|
+
return (
|
|
18
|
+
<ControlPage>
|
|
19
|
+
<ControlSection
|
|
20
|
+
title={t('automation verbose label', { ns: AUTOMATION_PLUGIN })}
|
|
21
|
+
description={t('automation description', { ns: AUTOMATION_PLUGIN })}
|
|
22
|
+
>
|
|
23
|
+
<AutomationPanel {...props} />
|
|
24
|
+
<TriggersSettings space={props.space} />
|
|
25
|
+
</ControlSection>
|
|
26
|
+
</ControlPage>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default AutomationSettings;
|