@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.548089c
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-W6K45EP4.mjs +11 -0
- package/dist/lib/browser/{AutomationSettings-3EYSPFKB.mjs → AutomationSettings-YGXYZZEU.mjs} +6 -7
- package/dist/lib/{node-esm/AutomationSettings-WKSMWITV.mjs.map → browser/AutomationSettings-YGXYZZEU.mjs.map} +1 -1
- package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs +151 -0
- package/dist/lib/browser/FunctionsContainer-JIFRD7DW.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs → FunctionsPanel-CRW6SJUN.mjs} +3 -3
- package/dist/lib/browser/{app-graph-builder-DV5HMFX4.mjs → app-graph-builder-W7LLC6XW.mjs} +7 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VL3KSDVL.mjs → chunk-DLZNSNOV.mjs} +18 -17
- package/dist/lib/browser/chunk-DLZNSNOV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DK7BLEKU.mjs → chunk-HUHVG4BU.mjs} +5 -5
- package/dist/lib/browser/{chunk-SUKAEYF3.mjs → chunk-JW7XSPYW.mjs} +8 -8
- package/dist/lib/browser/chunk-JW7XSPYW.mjs.map +7 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs +17 -0
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MVPRI3DB.mjs → chunk-RYEK6OMM.mjs} +20 -6
- package/dist/lib/browser/chunk-RYEK6OMM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DLLE4FKP.mjs → chunk-TWWFNOIR.mjs} +27 -12
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5ARH77PV.mjs → chunk-XAKZ4ANY.mjs} +2 -2
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VGBZKM3O.mjs → chunk-YBPJCY3F.mjs} +2 -2
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs +113 -0
- package/dist/lib/browser/compute-runtime-EIQTHJFZ.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -4
- package/dist/lib/browser/index.mjs +17 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-D2OHKQRR.mjs → intent-resolver-5HR7M7T6.mjs} +8 -8
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-G7CG7BML.mjs → react-surface-LXPASRXE.mjs} +6 -5
- package/dist/lib/browser/react-surface-LXPASRXE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{AutomationPanel-EETYIR35.mjs → AutomationPanel-NI6EHUWH.mjs} +4 -4
- package/dist/lib/node-esm/{AutomationSettings-WKSMWITV.mjs → AutomationSettings-3BAIEDRA.mjs} +6 -7
- package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs +152 -0
- package/dist/lib/node-esm/FunctionsContainer-MK76KBEW.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs → FunctionsPanel-RVVCS6VH.mjs} +3 -3
- package/dist/lib/node-esm/{app-graph-builder-TR2WXPX2.mjs → app-graph-builder-SLQOO7GH.mjs} +7 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-5MQJPJR2.mjs → chunk-CEVIVRTY.mjs} +6 -2
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B7N3H45O.mjs → chunk-CPJ33QGN.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs → chunk-ECJKIUBO.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-WHCSOUNN.mjs → chunk-KB7NFEYY.mjs} +2 -2
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-QCA543ZR.mjs → chunk-LMTQG3PX.mjs} +20 -6
- package/dist/lib/node-esm/chunk-LMTQG3PX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AKHETVIQ.mjs → chunk-O4KCL7XS.mjs} +18 -17
- package/dist/lib/node-esm/chunk-O4KCL7XS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YQXW3JXD.mjs → chunk-RVK52XGK.mjs} +27 -12
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J3XEBEIE.mjs → chunk-W76WUTZY.mjs} +8 -8
- package/dist/lib/node-esm/chunk-W76WUTZY.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs +114 -0
- package/dist/lib/node-esm/compute-runtime-URROOC34.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -4
- package/dist/lib/node-esm/index.mjs +17 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-2LGBVXT5.mjs → intent-resolver-KDRYB5BC.mjs} +8 -8
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-OMZSBDHS.mjs → react-surface-AFCHOTCJ.mjs} +6 -5
- package/dist/lib/node-esm/react-surface-AFCHOTCJ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/capabilities/capabilities.d.ts +2 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +2 -2
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +3 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsContainer.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +2 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +3 -3
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +3 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -2
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -34
- package/src/AutomationPlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +6 -6
- package/src/capabilities/capabilities.ts +2 -9
- package/src/capabilities/compute-runtime.ts +22 -33
- package/src/capabilities/intent-resolver.ts +5 -5
- package/src/capabilities/react-surface.tsx +2 -1
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -4
- package/src/components/AutomationPanel/AutomationPanel.tsx +31 -30
- package/src/components/FunctionsContainer.tsx +7 -0
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +32 -13
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +135 -0
- package/src/components/FunctionsRegistry/index.ts +5 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +2 -2
- package/src/components/TriggerEditor/SpecSelector.tsx +4 -4
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +14 -13
- package/src/components/TriggerEditor/TriggerEditor.tsx +10 -10
- package/src/hooks/useComputeRuntimeCallback.ts +3 -1
- package/src/hooks/useTriggerRuntimeControls.ts +4 -3
- package/src/index.ts +1 -0
- package/src/meta.ts +5 -2
- package/src/translations.ts +3 -0
- package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
- package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
- package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
- package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
- package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
- package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
- package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
- package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
- package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
- package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
- package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
- package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
- package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
- package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
- package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
- package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
- /package/dist/lib/browser/{AutomationPanel-3PHA5FTJ.mjs.map → AutomationPanel-W6K45EP4.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-NRIKAPQV.mjs.map → FunctionsPanel-CRW6SJUN.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-DK7BLEKU.mjs.map → chunk-HUHVG4BU.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-VGBZKM3O.mjs.map → chunk-YBPJCY3F.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-EETYIR35.mjs.map → AutomationPanel-NI6EHUWH.mjs.map} +0 -0
- /package/dist/lib/{browser/AutomationSettings-3EYSPFKB.mjs.map → node-esm/AutomationSettings-3BAIEDRA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-SAMRTELO.mjs.map → FunctionsPanel-RVVCS6VH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-B7N3H45O.mjs.map → chunk-CPJ33QGN.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs.map → chunk-ECJKIUBO.mjs.map} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
|
+
var meta = {
|
|
4
|
+
id: "dxos.org/plugin/automation",
|
|
5
|
+
name: "Automation",
|
|
6
|
+
description: trim`
|
|
7
|
+
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
8
|
+
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
9
|
+
`,
|
|
10
|
+
icon: "ph--robot--regular",
|
|
11
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
meta
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-LZQFZO3B.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/automation',\n name: 'Automation',\n description: trim`\n Workflow automation engine that triggers custom actions based on object events and conditions.\n Create automated pipelines that respond to changes and streamline repetitive tasks.\n `,\n icon: 'ph--robot--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,QAAQ;AACV;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "source"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutomationCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XAKZ4ANY.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/useComputeRuntimeCallback.ts
|
|
6
6
|
import { useCallback } from "react";
|
|
7
|
-
import { useCapability } from "@dxos/app-framework";
|
|
7
|
+
import { useCapability } from "@dxos/app-framework/react";
|
|
8
|
+
|
|
9
|
+
// src/capabilities/index.ts
|
|
10
|
+
import { lazy } from "@dxos/app-framework";
|
|
11
|
+
var AppGraphBuilder = lazy(() => import("./app-graph-builder-W7LLC6XW.mjs"));
|
|
12
|
+
var ComputeRuntime = lazy(() => import("./compute-runtime-EIQTHJFZ.mjs"));
|
|
13
|
+
var IntentResolver = lazy(() => import("./intent-resolver-5HR7M7T6.mjs"));
|
|
14
|
+
var ReactSurface = lazy(() => import("./react-surface-LXPASRXE.mjs"));
|
|
15
|
+
|
|
16
|
+
// src/hooks/useComputeRuntimeCallback.ts
|
|
8
17
|
var useComputeRuntimeCallback = (space, fn, deps) => {
|
|
9
18
|
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
10
19
|
const runtime = space !== void 0 ? computeRuntime.getRuntime(space.id) : void 0;
|
|
@@ -22,11 +31,12 @@ var useComputeRuntimeCallback = (space, fn, deps) => {
|
|
|
22
31
|
// src/hooks/useTriggerRuntimeControls.ts
|
|
23
32
|
import * as Effect from "effect/Effect";
|
|
24
33
|
import { Filter } from "@dxos/echo";
|
|
25
|
-
import {
|
|
34
|
+
import { Trigger } from "@dxos/functions";
|
|
35
|
+
import { TriggerDispatcher } from "@dxos/functions-runtime";
|
|
26
36
|
import { useQuery } from "@dxos/react-client/echo";
|
|
27
37
|
import { useAsyncState } from "@dxos/react-ui";
|
|
28
38
|
var useTriggerRuntimeControls = (space) => {
|
|
29
|
-
const triggers = useQuery(space, Filter.type(
|
|
39
|
+
const triggers = useQuery(space, Filter.type(Trigger.Trigger));
|
|
30
40
|
const [isRunningState, setIsRunningState] = useAsyncState(useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))));
|
|
31
41
|
const start = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
|
|
32
42
|
const dispatcher = yield* TriggerDispatcher;
|
|
@@ -48,6 +58,10 @@ var useTriggerRuntimeControls = (space) => {
|
|
|
48
58
|
|
|
49
59
|
export {
|
|
50
60
|
useComputeRuntimeCallback,
|
|
51
|
-
useTriggerRuntimeControls
|
|
61
|
+
useTriggerRuntimeControls,
|
|
62
|
+
AppGraphBuilder,
|
|
63
|
+
ComputeRuntime,
|
|
64
|
+
IntentResolver,
|
|
65
|
+
ReactSurface
|
|
52
66
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-RYEK6OMM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/capabilities/index.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Effect from 'effect/Effect';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/react';\nimport type { Space } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from '../capabilities';\n\n/**\n * Create an effectful function that has access to compute services\n */\n// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).\nexport const useComputeRuntimeCallback = <T>(\n space: Space | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: React.DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = space !== undefined ? computeRuntime.getRuntime(space.id) : undefined;\n\n return useCallback(() => {\n if (!runtime) {\n throw new TypeError('Space not provided to useComputeRuntimeCallback');\n }\n\n return runtime.runPromise(fn());\n }, [runtime, ...(deps ?? [])]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const AppGraphBuilder = lazy(() => import('./app-graph-builder'));\nexport const ComputeRuntime = lazy(() => import('./compute-runtime'));\nexport const IntentResolver = lazy(() => import('./intent-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Filter } from '@dxos/echo';\nimport { Trigger } from '@dxos/functions';\nimport { TriggerDispatcher } from '@dxos/functions-runtime';\nimport { type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: Trigger.Trigger[];\n isRunning: boolean;\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(space, Filter.type(Trigger.Trigger));\n\n const [isRunningState, setIsRunningState] = useAsyncState(\n useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),\n );\n\n const start = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n setIsRunningState(true);\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n setIsRunningState(false);\n }),\n );\n\n return {\n triggers,\n isRunning: isRunningState ?? false,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
|
|
5
|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OAAOP;AAC1B,WAAOO,WAAWC,KAAI;AACtBX,sBAAkB,KAAA;EACpB,CAAA,CAAA;AAGF,SAAO;IACLN;IACAkB,WAAWb,kBAAkB;IAC7BS,OAAO,MAAM,KAAKA,MAAAA;IAClBG,MAAM,MAAM,KAAKA,KAAAA;EACnB;AACF;",
|
|
6
|
+
"names": ["useCallback", "useCapability", "lazy", "AppGraphBuilder", "lazy", "ComputeRuntime", "IntentResolver", "ReactSurface", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "Effect", "Filter", "Trigger", "TriggerDispatcher", "useQuery", "useAsyncState", "useTriggerRuntimeControls", "space", "triggers", "useQuery", "Filter", "type", "Trigger", "isRunningState", "setIsRunningState", "useAsyncState", "useComputeRuntimeCallback", "TriggerDispatcher", "pipe", "map", "t", "running", "start", "fnUntraced", "dispatcher", "stop", "isRunning"]
|
|
7
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
meta
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LZQFZO3B.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/FunctionsPanel/FunctionsPanel.tsx
|
|
6
6
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
8
|
import React, { useCallback, useMemo } from "react";
|
|
9
|
-
import { LayoutAction, createIntent
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { LayoutAction, createIntent } from "@dxos/app-framework";
|
|
10
|
+
import { useIntentDispatcher } from "@dxos/app-framework/react";
|
|
11
|
+
import { Obj } from "@dxos/echo";
|
|
12
|
+
import { Function, Script } from "@dxos/functions";
|
|
13
|
+
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
14
|
+
import { Filter, useQuery } from "@dxos/react-client/echo";
|
|
15
|
+
import { Button, IconButton, useTranslation } from "@dxos/react-ui";
|
|
13
16
|
import { controlItemClasses } from "@dxos/react-ui-form";
|
|
14
17
|
import { List } from "@dxos/react-ui-list";
|
|
15
18
|
import { ghostHover, mx } from "@dxos/react-ui-theme";
|
|
@@ -18,8 +21,8 @@ var FunctionsPanel = ({ space }) => {
|
|
|
18
21
|
var _effect = _useSignals();
|
|
19
22
|
try {
|
|
20
23
|
const { t } = useTranslation(meta.id);
|
|
21
|
-
const functions = useQuery(space, Filter.type(
|
|
22
|
-
const scripts = useQuery(space, Filter.type(
|
|
24
|
+
const functions = useQuery(space, Filter.type(Function.Function));
|
|
25
|
+
const scripts = useQuery(space, Filter.type(Script.Script));
|
|
23
26
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
24
27
|
const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
|
|
25
28
|
const scriptId = func.source?.target?.id;
|
|
@@ -46,7 +49,7 @@ var FunctionsPanel = ({ space }) => {
|
|
|
46
49
|
void dispatch(createIntent(LayoutAction.Open, {
|
|
47
50
|
part: "main",
|
|
48
51
|
subject: [
|
|
49
|
-
|
|
52
|
+
Obj.getDXN(script).toString()
|
|
50
53
|
]
|
|
51
54
|
}));
|
|
52
55
|
}
|
|
@@ -54,16 +57,23 @@ var FunctionsPanel = ({ space }) => {
|
|
|
54
57
|
functionToScriptMap,
|
|
55
58
|
dispatch
|
|
56
59
|
]);
|
|
60
|
+
const handleDelete = useCallback((func) => dispatch(createIntent(SpaceAction.RemoveObjects, {
|
|
61
|
+
objects: [
|
|
62
|
+
func
|
|
63
|
+
]
|
|
64
|
+
})), [
|
|
65
|
+
dispatch
|
|
66
|
+
]);
|
|
57
67
|
return /* @__PURE__ */ React.createElement("div", {
|
|
58
68
|
role: "none",
|
|
59
69
|
className: mx(controlItemClasses)
|
|
60
70
|
}, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
61
71
|
items: functions,
|
|
62
|
-
isItem: Schema.is(
|
|
72
|
+
isItem: Schema.is(Function.Function),
|
|
63
73
|
getId: (func) => func.id
|
|
64
74
|
}, ({ items }) => /* @__PURE__ */ React.createElement("div", {
|
|
65
75
|
role: "list",
|
|
66
|
-
className: "flex flex-col
|
|
76
|
+
className: "flex flex-col is-full"
|
|
67
77
|
}, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
68
78
|
key: func.id,
|
|
69
79
|
item: func,
|
|
@@ -76,7 +86,12 @@ var FunctionsPanel = ({ space }) => {
|
|
|
76
86
|
className: "text-xs text-description truncate"
|
|
77
87
|
}, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
|
|
78
88
|
onClick: () => handleGoToScript(func)
|
|
79
|
-
}, t("go to function source button label"))
|
|
89
|
+
}, t("go to function source button label")), /* @__PURE__ */ React.createElement(IconButton, {
|
|
90
|
+
iconOnly: true,
|
|
91
|
+
icon: "ph--trash--regular",
|
|
92
|
+
label: t("delete function button label"),
|
|
93
|
+
onClick: () => handleDelete(func)
|
|
94
|
+
}))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
|
|
80
95
|
className: "text-center plb-4 text-gray-500"
|
|
81
96
|
}, t("no functions found")));
|
|
82
97
|
} finally {
|
|
@@ -91,4 +106,4 @@ export {
|
|
|
91
106
|
FunctionsPanel,
|
|
92
107
|
FunctionsPanel_default
|
|
93
108
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-TWWFNOIR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent } from '@dxos/app-framework';\nimport { useIntentDispatcher } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\nimport { Function, Script } from '@dxos/functions';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter, type Space, useQuery } from '@dxos/react-client/echo';\nimport { Button, IconButton, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(meta.id);\n const functions = useQuery(space, Filter.type(Function.Function));\n const scripts = useQuery(space, Filter.type(Script.Script));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, Script.Script>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: Function.Function) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [Obj.getDXN(script).toString()],\n }),\n );\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n const handleDelete = useCallback(\n (func: Function.Function) => dispatch(createIntent(SpaceAction.RemoveObjects, { objects: [func] })),\n [dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<Function.Function> items={functions} isItem={Schema.is(Function.Function)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col is-full'>\n {items?.map((func) => (\n <List.Item<Function.Function>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n <IconButton\n iconOnly\n icon='ph--trash--regular'\n label={t('delete function button label')}\n onClick={() => handleDelete(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,oBAAoB;AAC3C,SAASC,2BAA2B;AACpC,SAASC,WAAW;AACpB,SAASC,UAAUC,cAAc;AACjC,SAASC,mBAAmB;AAC5B,SAASC,QAAoBC,gBAAgB;AAC7C,SAASC,QAAQC,YAAYC,sBAAsB;AACnD,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;;;AAC3D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAMC,YAAYC,SAASN,OAAOO,OAAOC,KAAKC,SAASA,QAAQ,CAAA;AAC/D,UAAMC,UAAUJ,SAASN,OAAOO,OAAOC,KAAKG,OAAOA,MAAM,CAAA;AACzD,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,o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MACRC,KAAKpC,KAAKf;MACVoD,MAAMrC;MACNsC,YAAYZ,GAAG/C,MAAM4D,YAAY,gBAAgB,SAAS,eAAA;OAE1D,sBAAA,cAAChB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKW,WAAS;MAACF,YAAW;OAAYtC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAACuB,OAAAA;MAAIE,WAAU;OAAqClB,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACwD,QAAAA;MAAOC,SAAS,MAAMhC,iBAAiBV,IAAAA;OAAQlB,EAAE,oCAAA,CAAA,GAEpD,sBAAA,cAAC6D,YAAAA;MACCC,UAAAA;MACAC,MAAK;MACLC,OAAOhE,EAAE,8BAAA;MACT4D,SAAS,MAAMvB,aAAanB,IAAAA;YASzCd,UAAU0C,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmC3C,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;AC5GA,IAAA,yBAAeiE;",
|
|
6
|
+
"names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "Obj", "Function", "Script", "SpaceAction", "Filter", "useQuery", "Button", "IconButton", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "Filter", "type", "Function", "scripts", "Script", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "Obj", "getDXN", "toString", "handleDelete", "SpaceAction", "RemoveObjects", "objects", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "IconButton", "iconOnly", "icon", "label", "FunctionsPanel"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
meta
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LZQFZO3B.mjs";
|
|
4
4
|
|
|
5
5
|
// src/capabilities/capabilities.ts
|
|
6
6
|
import { defineCapability } from "@dxos/app-framework";
|
|
@@ -12,4 +12,4 @@ var AutomationCapabilities;
|
|
|
12
12
|
export {
|
|
13
13
|
AutomationCapabilities
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-XAKZ4ANY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';\nimport { defineCapability } from '@dxos/app-framework';\nimport type { CredentialsService, DatabaseService, FunctionInvocationService, QueueService } from '@dxos/functions';\nimport type { InvocationTracer, TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';\nimport type { SpaceId } from '@dxos/keys';\n\nimport { meta } from '../meta';\n\nexport namespace AutomationCapabilities {\n /**\n * Service stack for executing agents, functions, and triggers.\n */\n export type ComputeServices =\n | TriggerDispatcher\n | AiService.AiService\n | DatabaseService\n | QueueService\n | CredentialsService\n | FunctionInvocationService\n | InvocationTracer\n | TriggerStateStore\n // TODO(dmaretskyi): Those should be provided at AI-chat call site.\n | ToolResolverService\n | ToolExecutionService;\n\n export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;\n export interface ComputeRuntimeProvider {\n getRuntime(spaceId: SpaceId): ComputeRuntime;\n }\n\n /**\n * Runtime for executing agents, functions, and triggers.\n */\n export const ComputeRuntime = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAOA,SAASA,wBAAwB;UAOhBC,yBAAAA;0BAyBFC,iBAAiBC,iBAAyC,GAAGC,KAAKC,EAAE,6BAA6B;AAChH,GA1BiBJ,2BAAAA,yBAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["defineCapability", "AutomationCapabilities", "ComputeRuntime", "defineCapability", "meta", "id"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
meta
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LZQFZO3B.mjs";
|
|
4
4
|
|
|
5
5
|
// src/types/schema.ts
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
@@ -35,4 +35,4 @@ var AutomationAction;
|
|
|
35
35
|
export {
|
|
36
36
|
AutomationAction
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-YBPJCY3F.mjs.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutomationCapabilities
|
|
3
|
+
} from "./chunk-XAKZ4ANY.mjs";
|
|
4
|
+
import "./chunk-LZQFZO3B.mjs";
|
|
5
|
+
|
|
6
|
+
// src/capabilities/compute-runtime.ts
|
|
7
|
+
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
11
|
+
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
12
|
+
import { GenericToolkit, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
|
|
13
|
+
import { Resource } from "@dxos/context";
|
|
14
|
+
import { Query, Ref } from "@dxos/echo";
|
|
15
|
+
import { CredentialsService, DatabaseService, QueueService } from "@dxos/functions";
|
|
16
|
+
import { FunctionImplementationResolver, FunctionInvocationServiceLayerWithLocalLoopbackExecutor, InvocationTracer, RemoteFunctionExecutionService, TriggerDispatcher } from "@dxos/functions-runtime";
|
|
17
|
+
import { TriggerStateStore } from "@dxos/functions-runtime";
|
|
18
|
+
import { invariant } from "@dxos/invariant";
|
|
19
|
+
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
20
|
+
import { PropertiesType } from "@dxos/react-client/echo";
|
|
21
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/capabilities/compute-runtime.ts";
|
|
22
|
+
var compute_runtime_default = (async (context) => {
|
|
23
|
+
const provider = await new ComputeRuntimeProviderImpl(context).open();
|
|
24
|
+
return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {
|
|
25
|
+
await provider.close();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var ComputeRuntimeProviderImpl = class extends Resource {
|
|
29
|
+
#runtimes = /* @__PURE__ */ new Map();
|
|
30
|
+
#context;
|
|
31
|
+
constructor(context) {
|
|
32
|
+
super();
|
|
33
|
+
this.#context = context;
|
|
34
|
+
}
|
|
35
|
+
async _open() {
|
|
36
|
+
}
|
|
37
|
+
async _close() {
|
|
38
|
+
await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));
|
|
39
|
+
this.#runtimes.clear();
|
|
40
|
+
}
|
|
41
|
+
getRuntime(spaceId) {
|
|
42
|
+
if (this.#runtimes.has(spaceId)) {
|
|
43
|
+
return this.#runtimes.get(spaceId);
|
|
44
|
+
}
|
|
45
|
+
const layer = Layer.unwrapEffect(Effect.gen(this, function* () {
|
|
46
|
+
const client = this.#context.getCapability(ClientCapabilities.Client);
|
|
47
|
+
const serviceLayer = this.#context.getCapability(Capabilities.AiServiceLayer) ?? Layer.die("AiService not found");
|
|
48
|
+
const functions = this.#context.getCapabilities(Capabilities.Functions).flat();
|
|
49
|
+
const toolkits = this.#context.getCapabilities(Capabilities.Toolkit);
|
|
50
|
+
const mergedToolkit = GenericToolkit.merge(...toolkits);
|
|
51
|
+
const toolkit = mergedToolkit.toolkit;
|
|
52
|
+
const toolkitLayer = mergedToolkit.layer;
|
|
53
|
+
const space = client.spaces.get(spaceId);
|
|
54
|
+
invariant(space, void 0, {
|
|
55
|
+
F: __dxlog_file,
|
|
56
|
+
L: 72,
|
|
57
|
+
S: this,
|
|
58
|
+
A: [
|
|
59
|
+
"space",
|
|
60
|
+
""
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
64
|
+
return Layer.mergeAll(TriggerDispatcher.layer({
|
|
65
|
+
timeControl: "natural"
|
|
66
|
+
})).pipe(Layer.provideMerge(Layer.mergeAll(InvocationTracerLive, TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)), makeToolResolverFromFunctions(functions, toolkit), makeToolExecutionServiceFromFunctions(toolkit, toolkitLayer))), Layer.provideMerge(Layer.mergeAll(FunctionInvocationServiceLayerWithLocalLoopbackExecutor.pipe(Layer.provideMerge(FunctionImplementationResolver.layerTest({
|
|
67
|
+
functions
|
|
68
|
+
})), Layer.provideMerge(RemoteFunctionExecutionService.fromClient(
|
|
69
|
+
client,
|
|
70
|
+
// If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.
|
|
71
|
+
client.config.get("runtime.client.edgeFeatures.agents") ? spaceId : void 0
|
|
72
|
+
)), Layer.provideMerge(serviceLayer), Layer.provideMerge(CredentialsService.layerFromDatabase()), Layer.provideMerge(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable), Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable)))));
|
|
73
|
+
}));
|
|
74
|
+
const runtime = ManagedRuntime.make(layer);
|
|
75
|
+
this.#runtimes.set(spaceId, runtime);
|
|
76
|
+
return runtime;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var InvocationTracerLive = Layer.unwrapEffect(Effect.gen(function* () {
|
|
80
|
+
const { objects: [properties] } = yield* DatabaseService.runQuery(Query.type(PropertiesType));
|
|
81
|
+
invariant(properties, void 0, {
|
|
82
|
+
F: __dxlog_file,
|
|
83
|
+
L: 118,
|
|
84
|
+
S: this,
|
|
85
|
+
A: [
|
|
86
|
+
"properties",
|
|
87
|
+
""
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
if (!properties.invocationTraceQueue) {
|
|
91
|
+
const queue2 = yield* QueueService.createQueue({
|
|
92
|
+
subspaceTag: "trace"
|
|
93
|
+
});
|
|
94
|
+
properties.invocationTraceQueue = Ref.fromDXN(queue2.dxn);
|
|
95
|
+
}
|
|
96
|
+
const queue = properties.invocationTraceQueue.target;
|
|
97
|
+
invariant(queue, void 0, {
|
|
98
|
+
F: __dxlog_file,
|
|
99
|
+
L: 124,
|
|
100
|
+
S: this,
|
|
101
|
+
A: [
|
|
102
|
+
"queue",
|
|
103
|
+
""
|
|
104
|
+
]
|
|
105
|
+
});
|
|
106
|
+
return InvocationTracer.layerLive({
|
|
107
|
+
invocationTraceQueue: queue
|
|
108
|
+
});
|
|
109
|
+
}));
|
|
110
|
+
export {
|
|
111
|
+
compute_runtime_default as default
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=compute-runtime-EIQTHJFZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/compute-runtime.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as BrowserKeyValueStore from '@effect/platform-browser/BrowserKeyValueStore';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { GenericToolkit, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';\nimport { Resource } from '@dxos/context';\nimport { Query, Ref } from '@dxos/echo';\nimport { CredentialsService, DatabaseService, QueueService } from '@dxos/functions';\nimport {\n FunctionImplementationResolver,\n FunctionInvocationServiceLayerWithLocalLoopbackExecutor,\n InvocationTracer,\n RemoteFunctionExecutionService,\n TriggerDispatcher,\n} from '@dxos/functions-runtime';\nimport { TriggerStateStore } from '@dxos/functions-runtime';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceId } from '@dxos/keys';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { PropertiesType } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from './capabilities';\n\nexport default async (context: PluginContext) => {\n const provider = await new ComputeRuntimeProviderImpl(context).open();\n return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {\n await provider.close();\n });\n};\n\nclass ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {\n readonly #runtimes = new Map<SpaceId, AutomationCapabilities.ComputeRuntime>();\n readonly #context: PluginContext;\n\n constructor(context: PluginContext) {\n super();\n this.#context = context;\n }\n\n protected override async _open() {}\n\n protected override async _close() {\n await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));\n this.#runtimes.clear();\n }\n\n getRuntime(spaceId: SpaceId): AutomationCapabilities.ComputeRuntime {\n if (this.#runtimes.has(spaceId)) {\n return this.#runtimes.get(spaceId)!;\n }\n\n const layer = Layer.unwrapEffect(\n Effect.gen(this, function* () {\n const client = this.#context.getCapability(ClientCapabilities.Client);\n const serviceLayer =\n this.#context.getCapability(Capabilities.AiServiceLayer) ?? Layer.die('AiService not found');\n\n // TODO(dmaretskyi): Make these reactive.\n const functions = this.#context.getCapabilities(Capabilities.Functions).flat();\n const toolkits = this.#context.getCapabilities(Capabilities.Toolkit);\n const mergedToolkit = GenericToolkit.merge(...toolkits);\n const toolkit = mergedToolkit.toolkit;\n const toolkitLayer = mergedToolkit.layer;\n\n const space = client.spaces.get(spaceId);\n invariant(space);\n yield* Effect.promise(() => space.waitUntilReady());\n\n return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n InvocationTracerLive,\n TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),\n makeToolResolverFromFunctions(functions, toolkit),\n makeToolExecutionServiceFromFunctions(toolkit, toolkitLayer),\n ),\n ),\n Layer.provideMerge(\n Layer.mergeAll(\n FunctionInvocationServiceLayerWithLocalLoopbackExecutor.pipe(\n Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions })),\n Layer.provideMerge(\n RemoteFunctionExecutionService.fromClient(\n client,\n // If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.\n client.config.get('runtime.client.edgeFeatures.agents') ? spaceId : undefined,\n ),\n ),\n Layer.provideMerge(serviceLayer),\n Layer.provideMerge(CredentialsService.layerFromDatabase()),\n Layer.provideMerge(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable),\n Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable),\n ),\n ),\n ),\n );\n }),\n );\n\n const runtime = ManagedRuntime.make(layer);\n this.#runtimes.set(spaceId, runtime);\n\n return runtime;\n }\n}\n\nconst InvocationTracerLive = Layer.unwrapEffect(\n Effect.gen(function* () {\n const {\n objects: [properties],\n } = yield* DatabaseService.runQuery(Query.type(PropertiesType));\n invariant(properties);\n if (!properties.invocationTraceQueue) {\n const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });\n properties.invocationTraceQueue = Ref.fromDXN(queue.dxn);\n }\n const queue = properties.invocationTraceQueue.target;\n invariant(queue);\n return InvocationTracer.layerLive({ invocationTraceQueue: queue });\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,YAAYA,0BAA0B;AACtC,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,oBAAoB;AAEhC,SAASC,cAAkCC,mBAAmB;AAC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MC,SAAQ,OAAOZ,aAAaa,YAAY;MAAEC,aAAa;IAAQ,CAAA;AACrER,eAAWK,uBAAuBI,IAAIC,QAAQJ,OAAMK,GAAG;EACzD;AACA,QAAML,QAAQN,WAAWK,qBAAqBO;AAC9C7C,YAAUuC,OAAAA,QAAAA;;;;;;;;;AACV,SAAOO,iBAAiBC,UAAU;IAAET,sBAAsBC;EAAM,CAAA;AAClE,CAAA,CAAA;",
|
|
6
|
+
"names": ["BrowserKeyValueStore", "Effect", "Layer", "ManagedRuntime", "Capabilities", "contributes", "GenericToolkit", "makeToolExecutionServiceFromFunctions", "makeToolResolverFromFunctions", "Resource", "Query", "Ref", "CredentialsService", "DatabaseService", "QueueService", "FunctionImplementationResolver", "FunctionInvocationServiceLayerWithLocalLoopbackExecutor", "InvocationTracer", "RemoteFunctionExecutionService", "TriggerDispatcher", "TriggerStateStore", "invariant", "ClientCapabilities", "PropertiesType", "context", "provider", "ComputeRuntimeProviderImpl", "open", "contributes", "AutomationCapabilities", "ComputeRuntime", "close", "Resource", "Map", "_open", "_close", "Promise", "all", "Array", "from", "values", "map", "rt", "dispose", "clear", "getRuntime", "spaceId", "has", "get", "layer", "unwrapEffect", "gen", "client", "getCapability", "ClientCapabilities", "Client", "serviceLayer", "Capabilities", "AiServiceLayer", "die", "functions", "getCapabilities", "Functions", "flat", "toolkits", "Toolkit", "mergedToolkit", "GenericToolkit", "merge", "toolkit", "toolkitLayer", "space", "spaces", "invariant", "promise", "waitUntilReady", "mergeAll", "TriggerDispatcher", "timeControl", "pipe", "provideMerge", "InvocationTracerLive", "TriggerStateStore", "layerKv", "provide", "layerLocalStorage", "makeToolResolverFromFunctions", "makeToolExecutionServiceFromFunctions", "FunctionInvocationServiceLayerWithLocalLoopbackExecutor", "FunctionImplementationResolver", "layerTest", "RemoteFunctionExecutionService", "fromClient", "config", "undefined", "CredentialsService", "layerFromDatabase", "DatabaseService", "db", "notAvailable", "QueueService", "queues", "runtime", "make", "set", "objects", "properties", "runQuery", "Query", "type", "PropertiesType", "invocationTraceQueue", "queue", "createQueue", "subspaceTag", "Ref", "fromDXN", "dxn", "target", "InvocationTracer", "layerLive"]
|
|
7
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useComputeRuntimeCallback,
|
|
3
3
|
useTriggerRuntimeControls
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-WWURMV25.mjs";
|
|
4
|
+
} from "../chunk-RYEK6OMM.mjs";
|
|
5
|
+
import "../chunk-XAKZ4ANY.mjs";
|
|
6
|
+
import "../chunk-LZQFZO3B.mjs";
|
|
8
7
|
export {
|
|
9
8
|
useComputeRuntimeCallback,
|
|
10
9
|
useTriggerRuntimeControls
|
|
@@ -3,22 +3,24 @@ import {
|
|
|
3
3
|
AutomationSettings,
|
|
4
4
|
FunctionsContainer,
|
|
5
5
|
FunctionsPanel
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HUHVG4BU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
AppGraphBuilder,
|
|
9
9
|
ComputeRuntime,
|
|
10
10
|
IntentResolver,
|
|
11
|
-
ReactSurface
|
|
12
|
-
|
|
11
|
+
ReactSurface,
|
|
12
|
+
useComputeRuntimeCallback,
|
|
13
|
+
useTriggerRuntimeControls
|
|
14
|
+
} from "./chunk-RYEK6OMM.mjs";
|
|
13
15
|
import {
|
|
14
16
|
AutomationCapabilities
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XAKZ4ANY.mjs";
|
|
16
18
|
import {
|
|
17
19
|
TriggerEditor
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-JW7XSPYW.mjs";
|
|
19
21
|
import {
|
|
20
22
|
meta
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LZQFZO3B.mjs";
|
|
22
24
|
|
|
23
25
|
// src/events.ts
|
|
24
26
|
import { defineEvent } from "@dxos/app-framework";
|
|
@@ -29,7 +31,7 @@ var AutomationEvents;
|
|
|
29
31
|
|
|
30
32
|
// src/AutomationPlugin.tsx
|
|
31
33
|
import { Capabilities, Events, contributes, defineModule, definePlugin } from "@dxos/app-framework";
|
|
32
|
-
import {
|
|
34
|
+
import { Function, Trigger } from "@dxos/functions";
|
|
33
35
|
import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
|
|
34
36
|
|
|
35
37
|
// src/translations.ts
|
|
@@ -46,10 +48,13 @@ var translations = [
|
|
|
46
48
|
"runtime description": "This will start a trigger dispatcher locally for this space to run triggers on your device while Composer is running.",
|
|
47
49
|
"functions panel label": "Functions",
|
|
48
50
|
"functions verbose label": "Manage deployed functions",
|
|
51
|
+
"functions registry verbose label": "Functions registry",
|
|
52
|
+
"functions registry description": "Import functions from the registry",
|
|
49
53
|
"functions description": "You can manage all the functions deployed from your space on EDGE here.",
|
|
50
54
|
"function copy id": "Copy Function ID",
|
|
51
55
|
"no functions found": "No functions found",
|
|
52
56
|
"go to function source button label": "Show function source",
|
|
57
|
+
"delete function button label": "Delete function",
|
|
53
58
|
"trigger editor title": "Configure Trigger",
|
|
54
59
|
"new trigger label": "Add Trigger",
|
|
55
60
|
"trigger type timer": "Timer",
|
|
@@ -79,8 +84,8 @@ var AutomationPlugin = definePlugin(meta, () => [
|
|
|
79
84
|
id: `${meta.id}/module/schema`,
|
|
80
85
|
activatesOn: ClientEvents.SetupSchema,
|
|
81
86
|
activate: () => contributes(ClientCapabilities.Schema, [
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
Function.Function,
|
|
88
|
+
Trigger.Trigger
|
|
84
89
|
])
|
|
85
90
|
}),
|
|
86
91
|
defineModule({
|
|
@@ -116,6 +121,8 @@ export {
|
|
|
116
121
|
FunctionsContainer,
|
|
117
122
|
FunctionsPanel,
|
|
118
123
|
TriggerEditor,
|
|
119
|
-
meta
|
|
124
|
+
meta,
|
|
125
|
+
useComputeRuntimeCallback,
|
|
126
|
+
useTriggerRuntimeControls
|
|
120
127
|
};
|
|
121
128
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/events.ts", "../../../src/AutomationPlugin.tsx", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineEvent } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport namespace AutomationEvents {\n export const ComputeRuntimeReady = defineEvent(`${meta.id}/event/compute-runtime-ready`);\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["defineEvent", "AutomationEvents", "ComputeRuntimeReady", "defineEvent", "meta", "id", "Capabilities", "Events", "contributes", "defineModule", "definePlugin", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineEvent } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nexport namespace AutomationEvents {\n export const ComputeRuntimeReady = defineEvent(`${meta.id}/event/compute-runtime-ready`);\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';\nimport { Function, Trigger } from '@dxos/functions';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\n\nimport { AppGraphBuilder, ComputeRuntime, IntentResolver, ReactSurface } from './capabilities';\nimport { AutomationEvents } from './events';\nimport { meta } from './meta';\nimport { translations } from './translations';\n\nexport const AutomationPlugin = definePlugin(meta, () => [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () => contributes(ClientCapabilities.Schema, [Function.Function, Trigger.Trigger]),\n }),\n defineModule({\n id: `${meta.id}/module/app-graph-builder`,\n activatesOn: Events.SetupAppGraph,\n activate: AppGraphBuilder,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: IntentResolver,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/compute-runtime`,\n activatesOn: ClientEvents.ClientReady,\n activatesAfter: [AutomationEvents.ComputeRuntimeReady],\n activate: ComputeRuntime,\n }),\n]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\n\nexport const translations = [\n {\n 'en-US': {\n [meta.id]: {\n 'plugin name': 'Automation',\n 'automation panel label': 'Automations',\n 'script automation label': 'Automation',\n 'automation verbose label': 'Manage automations',\n 'automation description': 'You can manage all the triggers which automate your space here.',\n\n 'runtime label': 'Enable Local Runtime',\n 'runtime description':\n 'This will start a trigger dispatcher locally for this space to run triggers on your device while Composer is running.',\n\n 'functions panel label': 'Functions',\n 'functions verbose label': 'Manage deployed functions',\n 'functions registry verbose label': 'Functions registry',\n 'functions registry description': 'Import functions from the registry',\n 'functions description': 'You can manage all the functions deployed from your space on EDGE here.',\n 'function copy id': 'Copy Function ID',\n 'no functions found': 'No functions found',\n 'go to function source button label': 'Show function source',\n 'delete function button label': 'Delete function',\n\n 'trigger editor title': 'Configure Trigger',\n 'new trigger label': 'Add Trigger',\n 'trigger type timer': 'Timer',\n 'trigger type webhook': 'Webhook',\n 'trigger type websocket': 'Websocket',\n 'trigger type subscription': 'Subscription',\n 'trigger type email': 'Email',\n 'trigger type queue': 'Queue',\n\n 'trigger copy url': 'Copy URL',\n 'trigger copy email': 'Copy Email',\n\n 'trigger payload add': 'Add',\n 'trigger payload remove': 'Remove',\n 'trigger payload prop name placeholder': 'New payload property name',\n },\n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;IACpBX,UAAUY;EACZ,CAAA;EACAjB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOe;IACpBb,UAAUc;EACZ,CAAA;EACAnB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOiB;IACpBf,UAAUgB;EACZ,CAAA;EACArB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaQ,aAAaY;IAC1BC,gBAAgB;MAACC,iBAAiBC;;IAClCpB,UAAUqB;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["defineEvent", "AutomationEvents", "ComputeRuntimeReady", "defineEvent", "meta", "id", "Capabilities", "Events", "contributes", "defineModule", "definePlugin", "Function", "Trigger", "ClientCapabilities", "ClientEvents", "translations", "meta", "id", "AutomationPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "ClientEvents", "SetupSchema", "ClientCapabilities", "Schema", "Function", "Trigger", "SetupAppGraph", "AppGraphBuilder", "SetupIntentResolver", "IntentResolver", "SetupReactSurface", "ReactSurface", "ClientReady", "activatesAfter", "AutomationEvents", "ComputeRuntimeReady", "ComputeRuntime"]
|
|
7
7
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutomationAction
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-YBPJCY3F.mjs";
|
|
4
|
+
import "./chunk-LZQFZO3B.mjs";
|
|
5
5
|
|
|
6
6
|
// src/capabilities/intent-resolver.ts
|
|
7
7
|
import { Capabilities, LayoutAction, contributes, createIntent, createResolver } from "@dxos/app-framework";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Ref } from "@dxos/echo";
|
|
9
|
+
import { Function, Script, Trigger } from "@dxos/functions";
|
|
10
10
|
import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
|
|
11
11
|
import { SpaceAction } from "@dxos/plugin-space/types";
|
|
12
12
|
import { Filter } from "@dxos/react-client/echo";
|
|
@@ -14,16 +14,16 @@ var intent_resolver_default = ((context) => contributes(Capabilities.IntentResol
|
|
|
14
14
|
createResolver({
|
|
15
15
|
intent: AutomationAction.CreateTriggerFromTemplate,
|
|
16
16
|
resolve: async ({ space, template, enabled = false, scriptName, input }) => {
|
|
17
|
-
const trigger =
|
|
17
|
+
const trigger = Trigger.make({
|
|
18
18
|
enabled,
|
|
19
19
|
input
|
|
20
20
|
});
|
|
21
21
|
if (scriptName) {
|
|
22
|
-
const { objects: [script] } = await space.db.query(Filter.type(
|
|
22
|
+
const { objects: [script] } = await space.db.query(Filter.type(Script.Script, {
|
|
23
23
|
name: scriptName
|
|
24
24
|
})).run();
|
|
25
25
|
if (script) {
|
|
26
|
-
const { objects: [fn] } = await space.db.query(Filter.type(
|
|
26
|
+
const { objects: [fn] } = await space.db.query(Filter.type(Function.Function, {
|
|
27
27
|
source: Ref.make(script)
|
|
28
28
|
})).run();
|
|
29
29
|
if (fn) {
|
|
@@ -74,4 +74,4 @@ var intent_resolver_default = ((context) => contributes(Capabilities.IntentResol
|
|
|
74
74
|
export {
|
|
75
75
|
intent_resolver_default as default
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=intent-resolver-
|
|
77
|
+
//# sourceMappingURL=intent-resolver-5HR7M7T6.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n LayoutAction,\n type PluginContext,\n contributes,\n createIntent,\n createResolver,\n} from '@dxos/app-framework';\nimport { Ref } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: AutomationAction.CreateTriggerFromTemplate,\n resolve: async ({ space, template, enabled = false, scriptName, input }) => {\n const trigger = Trigger.make({ enabled, input });\n\n // TODO(wittjosiah): Factor out function lookup by script name?\n if (scriptName) {\n const {\n objects: [script],\n } = await space.db.query(Filter.type(Script.Script, { name: scriptName })).run();\n if (script) {\n const {\n objects: [fn],\n } = await space.db.query(Filter.type(Function.Function, { source: Ref.make(script) })).run();\n if (fn) {\n trigger.function = Ref.make(fn);\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n trigger.spec = { kind: 'timer', cron: template.cron };\n break;\n }\n case 'queue': {\n trigger.spec = { kind: 'queue', queue: (template.queueDXN as DXN).toString() };\n break;\n }\n default: {\n break;\n }\n }\n\n return {\n intents: [\n createIntent(SpaceAction.AddObject, { object: trigger, target: space, hidden: true }),\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],\n options: {\n workspace: space.id,\n },\n }),\n ],\n };\n },\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,SACEA,cACAC,cAEAC,aACAC,cACAC,sBACK;AACP,SAASC,WAAW;AACpB,SAASC,UAAUC,QAAQC,eAAe;AAE1C,SAASC,iCAAiC;AAC1C,SAASC,mBAAmB;AAC5B,SAASC,cAAc;AAIvB,IAAA,2BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,iBAAiBC;IACzBC,SAAS,OAAO,EAAEC,OAAOC,UAAUC,UAAU,OAAOC,YAAYC,MAAK,MAAE;AACrE,YAAMC,UAAUC,QAAQC,KAAK;QAAEL;QAASE;MAAM,CAAA;AAG9C,UAAID,YAAY;AACd,cAAM,EACJK,SAAS,CAACC,MAAAA,EAAO,IACf,MAAMT,MAAMU,GAAGC,MAAMC,OAAOC,KAAKC,OAAOA,QAAQ;UAAEC,MAAMZ;QAAW,CAAA,CAAA,EAAIa,IAAG;AAC9E,YAAIP,QAAQ;AACV,gBAAM,EACJD,SAAS,CAACS,EAAAA,EAAG,IACX,MAAMjB,MAAMU,GAAGC,MAAMC,OAAOC,KAAKK,SAASA,UAAU;YAAEC,QAAQC,IAAIb,KAAKE,MAAAA;UAAQ,CAAA,CAAA,EAAIO,IAAG;AAC1F,cAAIC,IAAI;AACNZ,oBAAQgB,WAAWD,IAAIb,KAAKU,EAAAA;UAC9B;QACF;MACF;AAEA,cAAQhB,SAASY,MAAI;QACnB,KAAK,SAAS;AACZR,kBAAQiB,OAAO;YAAEC,MAAM;YAASC,MAAMvB,SAASuB;UAAK;AACpD;QACF;QACA,KAAK,SAAS;AACZnB,kBAAQiB,OAAO;YAAEC,MAAM;YAASE,OAAQxB,SAASyB,SAAiBC,SAAQ;UAAG;AAC7E;QACF;QACA,SAAS;AACP;QACF;MACF;AAEA,aAAO;QACLC,SAAS;UACPC,aAAaC,YAAYC,WAAW;YAAEC,QAAQ3B;YAAS4B,QAAQjC;YAAOkC,QAAQ;UAAK,CAAA;UACnFL,aAAaM,aAAaC,MAAM;YAC9BC,MAAM;YACNC,SAAS;cAAC,sBAAsBC,yBAAAA,GAA4BvC,MAAMwC,EAAE;;YACpEC,SAAS;cACPC,WAAW1C,MAAMwC;YACnB;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
|
|
6
|
+
"names": ["Capabilities", "LayoutAction", "contributes", "createIntent", "createResolver", "Ref", "Function", "Script", "Trigger", "ATTENDABLE_PATH_SEPARATOR", "SpaceAction", "Filter", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "AutomationAction", "CreateTriggerFromTemplate", "resolve", "space", "template", "enabled", "scriptName", "input", "trigger", "Trigger", "make", "objects", "script", "db", "query", "Filter", "type", "Script", "name", "run", "fn", "Function", "source", "Ref", "function", "spec", "kind", "cron", "queue", "queueDXN", "toString", "intents", "createIntent", "SpaceAction", "AddObject", "object", "target", "hidden", "LayoutAction", "Open", "part", "subject", "ATTENDABLE_PATH_SEPARATOR", "id", "options", "workspace"]
|
|
7
|
+
}
|