@dxos/plugin-automation 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-NQY2QL47.mjs +44 -0
- package/dist/lib/browser/chunk-NQY2QL47.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JOXPQ27I.mjs → chunk-WZKRIDQ6.mjs} +9 -38
- package/dist/lib/browser/chunk-WZKRIDQ6.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +96 -81
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/create-trigger-from-template-J2Z7AAHV.mjs +77 -0
- package/dist/lib/browser/create-trigger-from-template-J2Z7AAHV.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +110 -6
- package/dist/lib/browser/hooks/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +60 -92
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +14 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -4
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/{chunk-RX52VKI2.mjs → chunk-POUAOKR5.mjs} +9 -37
- package/dist/lib/node-esm/chunk-POUAOKR5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Z6J7TDVZ.mjs +45 -0
- package/dist/lib/node-esm/chunk-Z6J7TDVZ.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +96 -81
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/create-trigger-from-template-TRSHHYEB.mjs +78 -0
- package/dist/lib/node-esm/create-trigger-from-template-TRSHHYEB.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +110 -6
- package/dist/lib/node-esm/hooks/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +60 -92
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +15 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -4
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -4
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +3 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/list.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/remove.d.ts +1 -1
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -1
- package/dist/types/src/cli/commands/trigger/util.d.ts +2 -2
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -1
- package/dist/types/src/cli/plugin.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +3 -4
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +28 -30
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.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.map +1 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +3 -1
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +2 -2
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.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.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +90 -91
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +4 -0
- package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts +3 -0
- package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/FunctionsContainer}/FunctionsContainer.d.ts +0 -1
- package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts +3 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntime.d.ts +7 -0
- package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +4 -3
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts +5 -0
- package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +2 -1
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -5
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
- package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +19 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/testing/test-functions.d.ts +16 -14
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +29 -31
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +5 -3
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +9 -30
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +73 -46
- package/src/AutomationPlugin.tsx +13 -10
- package/src/capabilities/app-graph-builder.ts +62 -0
- package/src/capabilities/{compute-runtime/compute-runtime.ts → compute-runtime.ts} +68 -21
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +17 -20
- package/src/cli/commands/trigger/create/queue.ts +7 -6
- package/src/cli/commands/trigger/create/subscription.ts +7 -6
- package/src/cli/commands/trigger/create/timer.ts +7 -6
- package/src/cli/commands/trigger/list.ts +3 -2
- package/src/cli/commands/trigger/remove.ts +2 -2
- package/src/cli/commands/trigger/update/queue.ts +12 -12
- package/src/cli/commands/trigger/update/subscription.ts +12 -11
- package/src/cli/commands/trigger/update/timer.ts +12 -11
- package/src/cli/commands/trigger/util.ts +43 -29
- package/src/cli/plugin.ts +7 -6
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +9 -7
- package/src/components/AutomationPanel/AutomationPanel.tsx +147 -77
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +37 -31
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +27 -24
- package/src/components/FunctionsRegistry/index.ts +4 -1
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +17 -8
- package/src/components/TriggerEditor/SpecSelector.tsx +12 -3
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +52 -9
- package/src/components/TriggerEditor/TriggerEditor.tsx +46 -17
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +27 -0
- package/src/containers/AutomationSettings/index.ts +7 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +33 -0
- package/src/containers/FunctionsContainer/index.ts +7 -0
- package/src/{components → containers/TriggerSettings}/TriggerSettings.tsx +8 -7
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useComputeRuntime.ts +15 -0
- package/src/hooks/useComputeRuntimeCallback.ts +6 -6
- package/src/hooks/useComputeRuntimeService.ts +22 -0
- package/src/hooks/useTriggerRuntimeControls.ts +22 -8
- package/src/index.ts +2 -6
- package/src/meta.ts +1 -1
- package/src/operations/create-trigger-from-template.ts +74 -0
- package/src/operations/definitions.ts +27 -0
- package/src/operations/index.ts +9 -0
- package/src/testing/test-functions.ts +8 -5
- package/src/translations.ts +35 -36
- package/src/types/capabilities.ts +18 -6
- package/src/types/events.ts +2 -2
- package/src/types/schema.ts +3 -24
- package/dist/lib/browser/AutomationPanel-FAS6ADCW.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs +0 -56
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs +0 -129
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-ZX4J75UM.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs +0 -84
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +0 -7
- package/dist/lib/browser/chunk-54PANILA.mjs +0 -14
- package/dist/lib/browser/chunk-54PANILA.mjs.map +0 -7
- package/dist/lib/browser/chunk-BFUIVUQH.mjs +0 -102
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +0 -7
- package/dist/lib/browser/chunk-BKFQBKYO.mjs +0 -8
- package/dist/lib/browser/chunk-BKFQBKYO.mjs.map +0 -7
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +0 -7
- package/dist/lib/browser/chunk-PZNBEKO5.mjs +0 -17
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +0 -7
- package/dist/lib/browser/chunk-QW3EM35H.mjs +0 -248
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +0 -7
- package/dist/lib/browser/chunk-RAF2FJST.mjs +0 -86
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +0 -7
- package/dist/lib/browser/chunk-YWLEY2FD.mjs +0 -200
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs +0 -114
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs +0 -82
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EV3AC62F.mjs +0 -65
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-B7NAGDFA.mjs +0 -12
- package/dist/lib/node-esm/AutomationPanel-B7NAGDFA.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs +0 -57
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs +0 -130
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-SS6GIVNU.mjs +0 -11
- package/dist/lib/node-esm/FunctionsPanel-SS6GIVNU.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs +0 -85
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs +0 -201
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs +0 -19
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7QRUPEHH.mjs +0 -16
- package/dist/lib/node-esm/chunk-7QRUPEHH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs +0 -87
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K7GCM342.mjs +0 -10
- package/dist/lib/node-esm/chunk-K7GCM342.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs +0 -103
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs +0 -249
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs +0 -115
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs +0 -83
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs +0 -66
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +0 -6
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/AutomationSettings.d.ts +0 -5
- package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +0 -71
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -79
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/components/AutomationSettings.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -36
- /package/dist/lib/browser/{AutomationPanel-FAS6ADCW.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-ZX4J75UM.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
- /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
- /package/src/capabilities/{compute-runtime/index.ts → node.ts} +0 -0
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
AutomationCapabilities
|
|
4
|
-
} from "./chunk-RX52VKI2.mjs";
|
|
5
|
-
import "./chunk-5FXNN3MV.mjs";
|
|
6
|
-
|
|
7
|
-
// src/capabilities/compute-runtime/compute-runtime.ts
|
|
8
|
-
import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as Layer from "effect/Layer";
|
|
11
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
12
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
13
|
-
import { GenericToolkit, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
|
|
14
|
-
import { SpaceProperties } from "@dxos/client/echo";
|
|
15
|
-
import { Resource } from "@dxos/context";
|
|
16
|
-
import { Database, Obj, Query, Ref } from "@dxos/echo";
|
|
17
|
-
import { CredentialsService, QueueService } from "@dxos/functions";
|
|
18
|
-
import { FunctionImplementationResolver, FunctionInvocationServiceLayerWithLocalLoopbackExecutor, RemoteFunctionExecutionService, TracingServiceExt, TriggerDispatcher, TriggerStateStore } from "@dxos/functions-runtime";
|
|
19
|
-
import { invariant } from "@dxos/invariant";
|
|
20
|
-
import { ClientCapabilities } from "@dxos/plugin-client/types";
|
|
21
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/capabilities/compute-runtime/compute-runtime.ts";
|
|
22
|
-
var compute_runtime_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
23
|
-
const capabilities = yield* Capability.Service;
|
|
24
|
-
const provider = yield* Effect.tryPromise(() => new ComputeRuntimeProviderImpl(capabilities).open());
|
|
25
|
-
return Capability.contributes(AutomationCapabilities.ComputeRuntime, provider, () => Effect.tryPromise(() => provider.close()));
|
|
26
|
-
}));
|
|
27
|
-
var ComputeRuntimeProviderImpl = class extends Resource {
|
|
28
|
-
#runtimes = /* @__PURE__ */ new Map();
|
|
29
|
-
#capabilities;
|
|
30
|
-
constructor(capabilities) {
|
|
31
|
-
super();
|
|
32
|
-
this.#capabilities = capabilities;
|
|
33
|
-
}
|
|
34
|
-
async _open() {
|
|
35
|
-
}
|
|
36
|
-
async _close() {
|
|
37
|
-
await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));
|
|
38
|
-
this.#runtimes.clear();
|
|
39
|
-
}
|
|
40
|
-
getRuntime(spaceId) {
|
|
41
|
-
if (this.#runtimes.has(spaceId)) {
|
|
42
|
-
return this.#runtimes.get(spaceId);
|
|
43
|
-
}
|
|
44
|
-
const layer = Layer.unwrapEffect(Effect.gen(this, function* () {
|
|
45
|
-
const client = this.#capabilities.get(ClientCapabilities.Client);
|
|
46
|
-
const aiServiceLayer = this.#capabilities.get(Common.Capability.AiServiceLayer) ?? Layer.die("AiService not found");
|
|
47
|
-
const functions = this.#capabilities.getAll(Common.Capability.Functions).flat();
|
|
48
|
-
const toolkits = this.#capabilities.getAll(Common.Capability.Toolkit);
|
|
49
|
-
const mergedToolkit = GenericToolkit.merge(...toolkits);
|
|
50
|
-
const toolkit = mergedToolkit.toolkit;
|
|
51
|
-
const toolkitLayer = mergedToolkit.layer;
|
|
52
|
-
const space = client.spaces.get(spaceId);
|
|
53
|
-
invariant(space, `Invalid space: ${spaceId}`, {
|
|
54
|
-
F: __dxlog_file,
|
|
55
|
-
L: 78,
|
|
56
|
-
S: this,
|
|
57
|
-
A: [
|
|
58
|
-
"space",
|
|
59
|
-
"`Invalid space: ${spaceId}`"
|
|
60
|
-
]
|
|
61
|
-
});
|
|
62
|
-
yield* Effect.promise(() => space.waitUntilReady());
|
|
63
|
-
return Layer.mergeAll(TriggerDispatcher.layer({
|
|
64
|
-
timeControl: "natural"
|
|
65
|
-
})).pipe(Layer.provideMerge(Layer.mergeAll(TracingServiceLive, TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)), makeToolResolverFromFunctions(functions, toolkit), makeToolExecutionServiceFromFunctions(toolkit, toolkitLayer))), Layer.provideMerge(FunctionInvocationServiceLayerWithLocalLoopbackExecutor.pipe(Layer.provideMerge(FunctionImplementationResolver.layerTest({
|
|
66
|
-
functions
|
|
67
|
-
})), Layer.provideMerge(RemoteFunctionExecutionService.fromClient(
|
|
68
|
-
client,
|
|
69
|
-
// If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.
|
|
70
|
-
client.config.get("runtime.client.edgeFeatures.agents") ? spaceId : void 0
|
|
71
|
-
)), Layer.provideMerge(aiServiceLayer), Layer.provideMerge(CredentialsService.layerFromDatabase()), Layer.provideMerge(space ? Database.Service.layer(space.db) : Database.Service.notAvailable), Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable))));
|
|
72
|
-
}));
|
|
73
|
-
const runtime = ManagedRuntime.make(layer);
|
|
74
|
-
this.#runtimes.set(spaceId, runtime);
|
|
75
|
-
return runtime;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var TracingServiceLive = Layer.unwrapEffect(Effect.gen(function* () {
|
|
79
|
-
const objects = yield* Database.Service.runQuery(Query.type(SpaceProperties));
|
|
80
|
-
const [properties] = objects;
|
|
81
|
-
invariant(properties, void 0, {
|
|
82
|
-
F: __dxlog_file,
|
|
83
|
-
L: 120,
|
|
84
|
-
S: this,
|
|
85
|
-
A: [
|
|
86
|
-
"properties",
|
|
87
|
-
""
|
|
88
|
-
]
|
|
89
|
-
});
|
|
90
|
-
if (!properties.invocationTraceQueue || !properties.invocationTraceQueue.target) {
|
|
91
|
-
const queue2 = yield* QueueService.createQueue({
|
|
92
|
-
subspaceTag: "trace"
|
|
93
|
-
});
|
|
94
|
-
Obj.change(properties, (m) => {
|
|
95
|
-
m.invocationTraceQueue = Ref.fromDXN(queue2.dxn);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
const queue = properties.invocationTraceQueue.target;
|
|
99
|
-
invariant(queue, void 0, {
|
|
100
|
-
F: __dxlog_file,
|
|
101
|
-
L: 130,
|
|
102
|
-
S: this,
|
|
103
|
-
A: [
|
|
104
|
-
"queue",
|
|
105
|
-
""
|
|
106
|
-
]
|
|
107
|
-
});
|
|
108
|
-
return TracingServiceExt.layerInvocationsQueue({
|
|
109
|
-
invocationTraceQueue: queue
|
|
110
|
-
});
|
|
111
|
-
}));
|
|
112
|
-
export {
|
|
113
|
-
compute_runtime_default as default
|
|
114
|
-
};
|
|
115
|
-
//# sourceMappingURL=compute-runtime-ZHROOBLY.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/compute-runtime/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 { Capability, type CapabilityManager, Common } from '@dxos/app-framework';\nimport { GenericToolkit, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';\nimport { SpaceProperties } from '@dxos/client/echo';\nimport { Resource } from '@dxos/context';\nimport { Database, Obj, Query, Ref } from '@dxos/echo';\nimport { CredentialsService, QueueService } from '@dxos/functions';\nimport {\n FunctionImplementationResolver,\n FunctionInvocationServiceLayerWithLocalLoopbackExecutor,\n RemoteFunctionExecutionService,\n TracingServiceExt,\n TriggerDispatcher,\n TriggerStateStore,\n} from '@dxos/functions-runtime';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceId } from '@dxos/keys';\nimport { ClientCapabilities } from '@dxos/plugin-client/types';\n\nimport { AutomationCapabilities } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const capabilities = yield* Capability.Service;\n const provider = yield* Effect.tryPromise(() => new ComputeRuntimeProviderImpl(capabilities).open());\n return Capability.contributes(AutomationCapabilities.ComputeRuntime, provider, () =>\n Effect.tryPromise(() => provider.close()),\n );\n }),\n);\n\n/**\n * Adapts plugin capabilities to runtime layers.\n */\nclass ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {\n readonly #runtimes = new Map<SpaceId, AutomationCapabilities.ComputeRuntime>();\n readonly #capabilities: CapabilityManager.CapabilityManager;\n\n constructor(capabilities: CapabilityManager.CapabilityManager) {\n super();\n this.#capabilities = capabilities;\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.#capabilities.get(ClientCapabilities.Client);\n const aiServiceLayer =\n this.#capabilities.get(Common.Capability.AiServiceLayer) ?? Layer.die('AiService not found');\n\n // TODO(dmaretskyi): Make these reactive.\n const functions = this.#capabilities.getAll(Common.Capability.Functions).flat();\n const toolkits = this.#capabilities.getAll(Common.Capability.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, `Invalid space: ${spaceId}`);\n yield* Effect.promise(() => space.waitUntilReady());\n\n return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n TracingServiceLive,\n TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),\n makeToolResolverFromFunctions(functions, toolkit),\n makeToolExecutionServiceFromFunctions(toolkit, toolkitLayer),\n ),\n ),\n Layer.provideMerge(\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(aiServiceLayer),\n Layer.provideMerge(CredentialsService.layerFromDatabase()),\n Layer.provideMerge(space ? Database.Service.layer(space.db) : Database.Service.notAvailable),\n Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable),\n ),\n ),\n );\n }),\n );\n\n const runtime = ManagedRuntime.make(layer);\n this.#runtimes.set(spaceId, runtime);\n return runtime;\n }\n}\n\nconst TracingServiceLive = Layer.unwrapEffect(\n Effect.gen(function* () {\n const objects = yield* Database.Service.runQuery(Query.type(SpaceProperties));\n const [properties] = objects;\n invariant(properties);\n // TODO(burdon): Check ref target has loaded?\n if (!properties.invocationTraceQueue || !properties.invocationTraceQueue.target) {\n const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });\n Obj.change(properties, (m) => {\n m.invocationTraceQueue = Ref.fromDXN(queue.dxn);\n });\n }\n\n const queue = properties.invocationTraceQueue.target;\n invariant(queue);\n return TracingServiceExt.layerInvocationsQueue({ invocationTraceQueue: queue });\n }),\n);\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["BrowserKeyValueStore", "Effect", "Layer", "ManagedRuntime", "Capability", "Common", "GenericToolkit", "makeToolExecutionServiceFromFunctions", "makeToolResolverFromFunctions", "SpaceProperties", "Resource", "Database", "Obj", "Query", "Ref", "CredentialsService", "QueueService", "FunctionImplementationResolver", "FunctionInvocationServiceLayerWithLocalLoopbackExecutor", "RemoteFunctionExecutionService", "TracingServiceExt", "TriggerDispatcher", "TriggerStateStore", "invariant", "ClientCapabilities", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "provider", "tryPromise", "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", "ClientCapabilities", "Client", "aiServiceLayer", "Common", "AiServiceLayer", "die", "functions", "getAll", "Functions", "flat", "toolkits", "Toolkit", "mergedToolkit", "GenericToolkit", "merge", "toolkit", "toolkitLayer", "space", "spaces", "invariant", "promise", "waitUntilReady", "mergeAll", "TriggerDispatcher", "timeControl", "pipe", "provideMerge", "TracingServiceLive", "TriggerStateStore", "layerKv", "provide", "layerLocalStorage", "makeToolResolverFromFunctions", "makeToolExecutionServiceFromFunctions", "FunctionInvocationServiceLayerWithLocalLoopbackExecutor", "FunctionImplementationResolver", "layerTest", "RemoteFunctionExecutionService", "fromClient", "config", "undefined", "CredentialsService", "layerFromDatabase", "Database", "db", "notAvailable", "QueueService", "queues", "runtime", "make", "set", "objects", "runQuery", "Query", "type", "SpaceProperties", "properties", "invocationTraceQueue", "target", "queue", "createQueue", "subspaceTag", "Obj", "change", "m", "Ref", "fromDXN", "dxn", "TracingServiceExt", "layerInvocationsQueue"]
|
|
7
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
AutomationOperation
|
|
4
|
-
} from "./chunk-RX52VKI2.mjs";
|
|
5
|
-
import "./chunk-5FXNN3MV.mjs";
|
|
6
|
-
|
|
7
|
-
// src/capabilities/operation-resolver/operation-resolver.ts
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
10
|
-
import { Obj, Ref } from "@dxos/echo";
|
|
11
|
-
import { Function, Script, Trigger } from "@dxos/functions";
|
|
12
|
-
import { Operation, OperationResolver } from "@dxos/operation";
|
|
13
|
-
import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
|
|
14
|
-
import { SpaceOperation } from "@dxos/plugin-space/types";
|
|
15
|
-
import { Filter } from "@dxos/react-client/echo";
|
|
16
|
-
var operation_resolver_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
17
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
18
|
-
OperationResolver.make({
|
|
19
|
-
operation: AutomationOperation.CreateTriggerFromTemplate,
|
|
20
|
-
handler: Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
|
|
21
|
-
const trigger = Trigger.make({
|
|
22
|
-
enabled,
|
|
23
|
-
input
|
|
24
|
-
});
|
|
25
|
-
if (scriptName) {
|
|
26
|
-
const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, {
|
|
27
|
-
name: scriptName
|
|
28
|
-
})).run());
|
|
29
|
-
const [script] = scripts;
|
|
30
|
-
if (script) {
|
|
31
|
-
const functions = yield* Effect.promise(() => db.query(Filter.type(Function.Function, {
|
|
32
|
-
source: Ref.make(script)
|
|
33
|
-
})).run());
|
|
34
|
-
const [fn] = functions;
|
|
35
|
-
if (fn) {
|
|
36
|
-
Obj.change(trigger, (t) => {
|
|
37
|
-
t.function = Ref.make(fn);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
switch (template.type) {
|
|
43
|
-
case "timer": {
|
|
44
|
-
Obj.change(trigger, (t) => {
|
|
45
|
-
t.spec = {
|
|
46
|
-
kind: "timer",
|
|
47
|
-
cron: template.cron
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case "queue": {
|
|
53
|
-
Obj.change(trigger, (t) => {
|
|
54
|
-
t.spec = {
|
|
55
|
-
kind: "queue",
|
|
56
|
-
queue: template.queueDXN.toString()
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
default: {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
66
|
-
object: trigger,
|
|
67
|
-
target: db,
|
|
68
|
-
hidden: true
|
|
69
|
-
});
|
|
70
|
-
yield* Operation.invoke(Common.LayoutOperation.Open, {
|
|
71
|
-
subject: [
|
|
72
|
-
`automation-settings${ATTENDABLE_PATH_SEPARATOR}${db.spaceId}`
|
|
73
|
-
],
|
|
74
|
-
workspace: db.spaceId
|
|
75
|
-
});
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
]);
|
|
79
|
-
}));
|
|
80
|
-
export {
|
|
81
|
-
operation_resolver_default as default
|
|
82
|
-
};
|
|
83
|
-
//# sourceMappingURL=operation-resolver-R5GA4YNO.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/operation-resolver/operation-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Obj, Ref } from '@dxos/echo';\nimport { Function, Script, Trigger } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { Operation, OperationResolver } from '@dxos/operation';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceOperation } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationOperation } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(Common.Capability.OperationResolver, [\n OperationResolver.make({\n operation: AutomationOperation.CreateTriggerFromTemplate,\n handler: Effect.fnUntraced(function* ({ db, 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 scripts = yield* Effect.promise(() =>\n db.query(Filter.type(Script.Script, { name: scriptName })).run(),\n );\n const [script] = scripts;\n if (script) {\n const functions = yield* Effect.promise(() =>\n db.query(Filter.type(Function.Function, { source: Ref.make(script) })).run(),\n );\n const [fn] = functions;\n if (fn) {\n Obj.change(trigger, (t) => {\n t.function = Ref.make(fn);\n });\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n Obj.change(trigger, (t) => {\n t.spec = { kind: 'timer', cron: template.cron };\n });\n break;\n }\n case 'queue': {\n Obj.change(trigger, (t) => {\n t.spec = {\n kind: 'queue',\n queue: (template.queueDXN as DXN).toString(),\n };\n });\n break;\n }\n default: {\n break;\n }\n }\n\n yield* Operation.invoke(SpaceOperation.AddObject, {\n object: trigger,\n target: db,\n hidden: true,\n });\n yield* Operation.invoke(Common.LayoutOperation.Open, {\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${db.spaceId}`],\n workspace: db.spaceId,\n });\n }),\n }),\n ]);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,KAAKC,WAAW;AACzB,SAASC,UAAUC,QAAQC,eAAe;AAE1C,SAASC,WAAWC,yBAAyB;AAC7C,SAASC,iCAAiC;AAC1C,SAASC,sBAAsB;AAC/B,SAASC,cAAc;AAIvB,IAAA,6BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,SAAOF,WAAWG,YAAYC,OAAOJ,WAAWK,mBAAmB;IACjEA,kBAAkBC,KAAK;MACrBC,WAAWC,oBAAoBC;MAC/BC,SAAgBR,kBAAW,WAAW,EAAES,IAAIC,UAAUC,UAAU,OAAOC,YAAYC,MAAK,GAAE;AACxF,cAAMC,UAAUC,QAAQX,KAAK;UAAEO;UAASE;QAAM,CAAA;AAG9C,YAAID,YAAY;AACd,gBAAMI,UAAU,OAAcC,eAAQ,MACpCR,GAAGS,MAAMC,OAAOC,KAAKC,OAAOA,QAAQ;YAAEC,MAAMV;UAAW,CAAA,CAAA,EAAIW,IAAG,CAAA;AAEhE,gBAAM,CAACC,MAAAA,IAAUR;AACjB,cAAIQ,QAAQ;AACV,kBAAMC,YAAY,OAAcR,eAAQ,MACtCR,GAAGS,MAAMC,OAAOC,KAAKM,SAASA,UAAU;cAAEC,QAAQC,IAAIxB,KAAKoB,MAAAA;YAAQ,CAAA,CAAA,EAAID,IAAG,CAAA;AAE5E,kBAAM,CAACM,EAAAA,IAAMJ;AACb,gBAAII,IAAI;AACNC,kBAAIC,OAAOjB,SAAS,CAACkB,MAAAA;AACnBA,kBAAEC,WAAWL,IAAIxB,KAAKyB,EAAAA;cACxB,CAAA;YACF;UACF;QACF;AAEA,gBAAQnB,SAASU,MAAI;UACnB,KAAK,SAAS;AACZU,gBAAIC,OAAOjB,SAAS,CAACkB,MAAAA;AACnBA,gBAAEE,OAAO;gBAAEC,MAAM;gBAASC,MAAM1B,SAAS0B;cAAK;YAChD,CAAA;AACA;UACF;UACA,KAAK,SAAS;AACZN,gBAAIC,OAAOjB,SAAS,CAACkB,MAAAA;AACnBA,gBAAEE,OAAO;gBACPC,MAAM;gBACNE,OAAQ3B,SAAS4B,SAAiBC,SAAQ;cAC5C;YACF,CAAA;AACA;UACF;UACA,SAAS;AACP;UACF;QACF;AAEA,eAAOC,UAAUC,OAAOC,eAAeC,WAAW;UAChDC,QAAQ9B;UACR+B,QAAQpC;UACRqC,QAAQ;QACV,CAAA;AACA,eAAON,UAAUC,OAAOvC,OAAO6C,gBAAgBC,MAAM;UACnDC,SAAS;YAAC,sBAAsBC,yBAAAA,GAA4BzC,GAAG0C,OAAO;;UACtEC,WAAW3C,GAAG0C;QAChB,CAAA;MACF,CAAA;IACF,CAAA;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Obj", "Ref", "Function", "Script", "Trigger", "Operation", "OperationResolver", "ATTENDABLE_PATH_SEPARATOR", "SpaceOperation", "Filter", "Capability", "makeModule", "fnUntraced", "contributes", "Common", "OperationResolver", "make", "operation", "AutomationOperation", "CreateTriggerFromTemplate", "handler", "db", "template", "enabled", "scriptName", "input", "trigger", "Trigger", "scripts", "promise", "query", "Filter", "type", "Script", "name", "run", "script", "functions", "Function", "source", "Ref", "fn", "Obj", "change", "t", "function", "spec", "kind", "cron", "queue", "queueDXN", "toString", "Operation", "invoke", "SpaceOperation", "AddObject", "object", "target", "hidden", "LayoutOperation", "Open", "subject", "ATTENDABLE_PATH_SEPARATOR", "spaceId", "workspace"]
|
|
7
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
AutomationSettings,
|
|
4
|
-
FunctionsContainer
|
|
5
|
-
} from "./chunk-7QRUPEHH.mjs";
|
|
6
|
-
import "./chunk-LJAXQ6CX.mjs";
|
|
7
|
-
import {
|
|
8
|
-
meta
|
|
9
|
-
} from "./chunk-5FXNN3MV.mjs";
|
|
10
|
-
|
|
11
|
-
// src/capabilities/react-surface/react-surface.tsx
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
|
-
import React from "react";
|
|
14
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
15
|
-
import { useLayout } from "@dxos/app-framework/react";
|
|
16
|
-
import { Obj } from "@dxos/echo";
|
|
17
|
-
import { getSpace, parseId, useSpace } from "@dxos/react-client/echo";
|
|
18
|
-
var react_surface_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(Common.Capability.ReactSurface, [
|
|
19
|
-
Common.createSurface({
|
|
20
|
-
id: `${meta.id}/space-settings-functions`,
|
|
21
|
-
role: "article",
|
|
22
|
-
filter: (data) => data.subject === `${meta.id}/space-settings-functions`,
|
|
23
|
-
component: () => {
|
|
24
|
-
const layout = useLayout();
|
|
25
|
-
const { spaceId } = parseId(layout.workspace);
|
|
26
|
-
const space = useSpace(spaceId);
|
|
27
|
-
if (!space) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return /* @__PURE__ */ React.createElement(FunctionsContainer, {
|
|
31
|
-
space
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
Common.createSurface({
|
|
36
|
-
id: `${meta.id}/space-settings-automation`,
|
|
37
|
-
role: "article",
|
|
38
|
-
filter: (data) => data.subject === `${meta.id}/space-settings-automation`,
|
|
39
|
-
component: () => {
|
|
40
|
-
const layout = useLayout();
|
|
41
|
-
const { spaceId } = parseId(layout.workspace);
|
|
42
|
-
const space = useSpace(spaceId);
|
|
43
|
-
if (!space) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
return /* @__PURE__ */ React.createElement(AutomationSettings, {
|
|
47
|
-
space
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
Common.createSurface({
|
|
52
|
-
id: `${meta.id}/companion/automation`,
|
|
53
|
-
role: "article",
|
|
54
|
-
filter: (data) => Obj.isObject(data.companionTo) && data.subject === "automation",
|
|
55
|
-
component: ({ data }) => {
|
|
56
|
-
return /* @__PURE__ */ React.createElement(AutomationSettings, {
|
|
57
|
-
space: getSpace(data.companionTo),
|
|
58
|
-
object: data.companionTo
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
])));
|
|
63
|
-
export {
|
|
64
|
-
react_surface_default as default
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=react-surface-S6VZJCEZ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport React from 'react';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { useLayout } from '@dxos/app-framework/react';\nimport { Obj } from '@dxos/echo';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\n\nimport { AutomationSettings, FunctionsContainer } from '../../components';\nimport { meta } from '../../meta';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(Common.Capability.ReactSurface, [\n Common.createSurface({\n id: `${meta.id}/space-settings-functions`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n Common.createSurface({\n id: `${meta.id}/space-settings-automation`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <AutomationSettings space={space} />;\n },\n }),\n Common.createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: Obj.Unknown; subject: 'automation' } =>\n Obj.isObject(data.companionTo) && data.subject === 'automation',\n component: ({ data }) => {\n return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;\n },\n }),\n ]),\n ),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,WAAW;AAElB,SAASC,YAAYC,cAAc;AACnC,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,UAAUC,SAASC,gBAAgB;AAK5C,IAAA,wBAAeC,WAAWC,WAAW,MAC5BC,eACLF,WAAWG,YAAYC,OAAOJ,WAAWK,cAAc;EACrDD,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACE,oBAAAA;QAAmBF;;IAC7B;EACF,CAAA;EACAf,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACG,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAf,OAAOE,cAAc;IACnBC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,IAAIC,SAASb,KAAKc,WAAW,KAAKd,KAAKC,YAAY;IACrDC,WAAW,CAAC,EAAEF,KAAI,MAAE;AAClB,aAAO,sBAAA,cAACW,oBAAAA;QAAmBH,OAAOO,SAASf,KAAKc,WAAW;QAAIE,QAAQhB,KAAKc;;IAC9E;EACF,CAAA;CACD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "React", "Capability", "Common", "useLayout", "Obj", "getSpace", "parseId", "useSpace", "Capability", "makeModule", "succeed", "contributes", "Common", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "FunctionsContainer", "AutomationSettings", "Obj", "isObject", "companionTo", "getSpace", "object"]
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
4
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<GraphBuilder.BuilderExtensions>>, never, never>;
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=app-graph-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-graph-builder.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAC;;AAK/D,wBAwDE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/app-graph-builder/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,eAAe,qIAA0E,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
import { AutomationCapabilities } from '../../types';
|
|
4
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<AutomationCapabilities.ComputeRuntimeProvider>>, import("effect/Cause").UnknownException, Capability.Service>;
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=compute-runtime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compute-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/compute-runtime/compute-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAkC,MAAM,qBAAqB,CAAC;AAkBjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;;AAErD,wBAQE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const ComputeRuntime: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("../..").AutomationCapabilities.ComputeRuntimeProvider>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/compute-runtime/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,cAAc,uJAAuE,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const OperationResolver: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("@dxos/app-framework/Common").Capability.OperationResolver[]>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,6JAA6E,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.OperationResolver[]>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=operation-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/operation-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAWzD,wBA6DE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,sJAAmE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Common.Capability.ReactSurface>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=react-surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;;AAQzD,wBA4CE"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AutomationPanelProps } from './AutomationPanel';
|
|
3
|
-
export declare const AutomationSettings: (props: AutomationPanelProps) => React.JSX.Element;
|
|
4
|
-
export default AutomationSettings;
|
|
5
|
-
//# sourceMappingURL=AutomationSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AutomationSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/AutomationSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG/E,eAAO,MAAM,kBAAkB,GAAI,OAAO,oBAAoB,sBAa7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/FunctionsContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AASrD,eAAO,MAAM,kBAAkB,GAAI,WAAW;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,sBAkB7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/TriggerSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,gBAAgB,GAAI,QAAQ;IAAE,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAA;CAAE,sBAWjE,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Script } from '@dxos/functions';
|
|
9
|
-
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
10
|
-
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
11
|
-
import { meta as spaceMeta } from '@dxos/plugin-space';
|
|
12
|
-
|
|
13
|
-
import { meta } from '../../meta';
|
|
14
|
-
|
|
15
|
-
export default Capability.makeModule(
|
|
16
|
-
Effect.fnUntraced(function* () {
|
|
17
|
-
const extensions = yield* Effect.all([
|
|
18
|
-
GraphBuilder.createExtension({
|
|
19
|
-
id: `${meta.id}/space-settings-automation`,
|
|
20
|
-
match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),
|
|
21
|
-
connector: (node) =>
|
|
22
|
-
Effect.succeed([
|
|
23
|
-
{
|
|
24
|
-
id: `automation-${node.id}`,
|
|
25
|
-
type: `${meta.id}/space-settings-automation`,
|
|
26
|
-
data: `${meta.id}/space-settings-automation`,
|
|
27
|
-
properties: {
|
|
28
|
-
label: ['automation panel label', { ns: meta.id }],
|
|
29
|
-
icon: 'ph--lightning--regular',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
]),
|
|
33
|
-
}),
|
|
34
|
-
GraphBuilder.createExtension({
|
|
35
|
-
id: `${meta.id}/space-settings-functions`,
|
|
36
|
-
match: NodeMatcher.whenNodeType(`${spaceMeta.id}/settings`),
|
|
37
|
-
connector: (node) =>
|
|
38
|
-
Effect.succeed([
|
|
39
|
-
{
|
|
40
|
-
id: `functions-${node.id}`,
|
|
41
|
-
type: `${meta.id}/space-settings-functions`,
|
|
42
|
-
data: `${meta.id}/space-settings-functions`,
|
|
43
|
-
properties: {
|
|
44
|
-
label: ['functions panel label', { ns: meta.id }],
|
|
45
|
-
icon: 'ph--function--regular',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
]),
|
|
49
|
-
}),
|
|
50
|
-
GraphBuilder.createTypeExtension({
|
|
51
|
-
id: `${meta.id}/script-companion`,
|
|
52
|
-
type: Script.Script,
|
|
53
|
-
connector: (script) =>
|
|
54
|
-
Effect.succeed([
|
|
55
|
-
{
|
|
56
|
-
id: [script.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
57
|
-
type: PLANK_COMPANION_TYPE,
|
|
58
|
-
data: 'automation',
|
|
59
|
-
properties: {
|
|
60
|
-
label: ['script automation label', { ns: meta.id }],
|
|
61
|
-
icon: 'ph--lightning--regular',
|
|
62
|
-
disposition: 'hidden',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
]),
|
|
66
|
-
}),
|
|
67
|
-
]);
|
|
68
|
-
|
|
69
|
-
return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
9
|
-
import { Function, Script, Trigger } from '@dxos/functions';
|
|
10
|
-
import { type DXN } from '@dxos/keys';
|
|
11
|
-
import { Operation, OperationResolver } from '@dxos/operation';
|
|
12
|
-
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';
|
|
13
|
-
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
14
|
-
import { Filter } from '@dxos/react-client/echo';
|
|
15
|
-
|
|
16
|
-
import { AutomationOperation } from '../../types';
|
|
17
|
-
|
|
18
|
-
export default Capability.makeModule(
|
|
19
|
-
Effect.fnUntraced(function* () {
|
|
20
|
-
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
21
|
-
OperationResolver.make({
|
|
22
|
-
operation: AutomationOperation.CreateTriggerFromTemplate,
|
|
23
|
-
handler: Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
|
|
24
|
-
const trigger = Trigger.make({ enabled, input });
|
|
25
|
-
|
|
26
|
-
// TODO(wittjosiah): Factor out function lookup by script name?
|
|
27
|
-
if (scriptName) {
|
|
28
|
-
const scripts = yield* Effect.promise(() =>
|
|
29
|
-
db.query(Filter.type(Script.Script, { name: scriptName })).run(),
|
|
30
|
-
);
|
|
31
|
-
const [script] = scripts;
|
|
32
|
-
if (script) {
|
|
33
|
-
const functions = yield* Effect.promise(() =>
|
|
34
|
-
db.query(Filter.type(Function.Function, { source: Ref.make(script) })).run(),
|
|
35
|
-
);
|
|
36
|
-
const [fn] = functions;
|
|
37
|
-
if (fn) {
|
|
38
|
-
Obj.change(trigger, (t) => {
|
|
39
|
-
t.function = Ref.make(fn);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
switch (template.type) {
|
|
46
|
-
case 'timer': {
|
|
47
|
-
Obj.change(trigger, (t) => {
|
|
48
|
-
t.spec = { kind: 'timer', cron: template.cron };
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'queue': {
|
|
53
|
-
Obj.change(trigger, (t) => {
|
|
54
|
-
t.spec = {
|
|
55
|
-
kind: 'queue',
|
|
56
|
-
queue: (template.queueDXN as DXN).toString(),
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
default: {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
67
|
-
object: trigger,
|
|
68
|
-
target: db,
|
|
69
|
-
hidden: true,
|
|
70
|
-
});
|
|
71
|
-
yield* Operation.invoke(Common.LayoutOperation.Open, {
|
|
72
|
-
subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${db.spaceId}`],
|
|
73
|
-
workspace: db.spaceId,
|
|
74
|
-
});
|
|
75
|
-
}),
|
|
76
|
-
}),
|
|
77
|
-
]);
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
@@ -1,30 +0,0 @@
|
|
|
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 { meta } 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(meta.id);
|
|
17
|
-
return (
|
|
18
|
-
<ControlPage>
|
|
19
|
-
<ControlSection
|
|
20
|
-
title={t('automation verbose label', { ns: meta.id })}
|
|
21
|
-
description={t('automation description', { ns: meta.id })}
|
|
22
|
-
>
|
|
23
|
-
<AutomationPanel {...props} />
|
|
24
|
-
<TriggersSettings db={props.space.db} />
|
|
25
|
-
</ControlSection>
|
|
26
|
-
</ControlPage>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default AutomationSettings;
|