@dxos/plugin-automation 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
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-POEIL4RN.mjs +44 -0
- package/dist/lib/browser/chunk-POEIL4RN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JOXPQ27I.mjs → chunk-WQLEMRPU.mjs} +9 -38
- package/dist/lib/browser/chunk-WQLEMRPU.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +122 -107
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/create-trigger-from-template-JZ62EZTB.mjs +77 -0
- package/dist/lib/browser/create-trigger-from-template-JZ62EZTB.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +79 -7
- 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-JWZAVQLF.mjs} +9 -37
- package/dist/lib/node-esm/chunk-JWZAVQLF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SP3P4OUI.mjs +45 -0
- package/dist/lib/node-esm/chunk-SP3P4OUI.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +122 -107
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/create-trigger-from-template-224Z7WJI.mjs +78 -0
- package/dist/lib/node-esm/create-trigger-from-template-224Z7WJI.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +79 -7
- 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 +91 -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 +2 -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 +2 -0
- package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
- package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +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 +1 -4
- 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 +2 -0
- 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 +6 -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.ts +248 -0
- package/src/capabilities/index.ts +10 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +59 -0
- 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 +21 -21
- package/src/cli/commands/trigger/update/subscription.ts +20 -19
- package/src/cli/commands/trigger/update/timer.ts +21 -20
- package/src/cli/commands/trigger/util.ts +43 -29
- package/src/cli/plugin.ts +6 -6
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +10 -8
- package/src/components/AutomationPanel/AutomationPanel.tsx +160 -87
- 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 +56 -13
- package/src/components/TriggerEditor/TriggerEditor.tsx +46 -17
- package/src/components/index.ts +1 -2
- package/src/containers/AutomationSettings/AutomationSettings.tsx +28 -0
- package/src/containers/AutomationSettings/index.ts +5 -0
- package/src/containers/FunctionsContainer/FunctionsContainer.tsx +34 -0
- package/src/containers/FunctionsContainer/index.ts +5 -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 +16 -0
- package/src/hooks/useComputeRuntimeCallback.ts +4 -39
- package/src/hooks/useComputeRuntimeService.ts +24 -0
- package/src/hooks/useTriggerRuntimeControls.ts +22 -8
- package/src/index.ts +2 -6
- package/src/meta.ts +2 -2
- package/src/operations/create-trigger-from-template.ts +75 -0
- package/src/operations/definitions.ts +28 -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 +20 -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/compute-runtime/compute-runtime.ts +0 -133
- 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/capabilities/react-surface/react-surface.tsx +0 -60
- 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,133 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as BrowserKeyValueStore from '@effect/platform-browser/BrowserKeyValueStore';
|
|
6
|
-
import * as Effect from 'effect/Effect';
|
|
7
|
-
import * as Layer from 'effect/Layer';
|
|
8
|
-
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
9
|
-
|
|
10
|
-
import { Capability, type CapabilityManager, Common } from '@dxos/app-framework';
|
|
11
|
-
import { GenericToolkit, makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
|
|
12
|
-
import { SpaceProperties } from '@dxos/client/echo';
|
|
13
|
-
import { Resource } from '@dxos/context';
|
|
14
|
-
import { Database, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
-
import { CredentialsService, QueueService } from '@dxos/functions';
|
|
16
|
-
import {
|
|
17
|
-
FunctionImplementationResolver,
|
|
18
|
-
FunctionInvocationServiceLayerWithLocalLoopbackExecutor,
|
|
19
|
-
RemoteFunctionExecutionService,
|
|
20
|
-
TracingServiceExt,
|
|
21
|
-
TriggerDispatcher,
|
|
22
|
-
TriggerStateStore,
|
|
23
|
-
} from '@dxos/functions-runtime';
|
|
24
|
-
import { invariant } from '@dxos/invariant';
|
|
25
|
-
import { type SpaceId } from '@dxos/keys';
|
|
26
|
-
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
27
|
-
|
|
28
|
-
import { AutomationCapabilities } from '../../types';
|
|
29
|
-
|
|
30
|
-
export default Capability.makeModule(
|
|
31
|
-
Effect.fnUntraced(function* () {
|
|
32
|
-
const capabilities = yield* Capability.Service;
|
|
33
|
-
const provider = yield* Effect.tryPromise(() => new ComputeRuntimeProviderImpl(capabilities).open());
|
|
34
|
-
return Capability.contributes(AutomationCapabilities.ComputeRuntime, provider, () =>
|
|
35
|
-
Effect.tryPromise(() => provider.close()),
|
|
36
|
-
);
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Adapts plugin capabilities to runtime layers.
|
|
42
|
-
*/
|
|
43
|
-
class ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {
|
|
44
|
-
readonly #runtimes = new Map<SpaceId, AutomationCapabilities.ComputeRuntime>();
|
|
45
|
-
readonly #capabilities: CapabilityManager.CapabilityManager;
|
|
46
|
-
|
|
47
|
-
constructor(capabilities: CapabilityManager.CapabilityManager) {
|
|
48
|
-
super();
|
|
49
|
-
this.#capabilities = capabilities;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
protected override async _open() {}
|
|
53
|
-
|
|
54
|
-
protected override async _close() {
|
|
55
|
-
await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));
|
|
56
|
-
this.#runtimes.clear();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getRuntime(spaceId: SpaceId): AutomationCapabilities.ComputeRuntime {
|
|
60
|
-
if (this.#runtimes.has(spaceId)) {
|
|
61
|
-
return this.#runtimes.get(spaceId)!;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const layer = Layer.unwrapEffect(
|
|
65
|
-
Effect.gen(this, function* () {
|
|
66
|
-
const client = this.#capabilities.get(ClientCapabilities.Client);
|
|
67
|
-
const aiServiceLayer =
|
|
68
|
-
this.#capabilities.get(Common.Capability.AiServiceLayer) ?? Layer.die('AiService not found');
|
|
69
|
-
|
|
70
|
-
// TODO(dmaretskyi): Make these reactive.
|
|
71
|
-
const functions = this.#capabilities.getAll(Common.Capability.Functions).flat();
|
|
72
|
-
const toolkits = this.#capabilities.getAll(Common.Capability.Toolkit);
|
|
73
|
-
const mergedToolkit = GenericToolkit.merge(...toolkits);
|
|
74
|
-
const toolkit = mergedToolkit.toolkit;
|
|
75
|
-
const toolkitLayer = mergedToolkit.layer;
|
|
76
|
-
|
|
77
|
-
const space = client.spaces.get(spaceId);
|
|
78
|
-
invariant(space, `Invalid space: ${spaceId}`);
|
|
79
|
-
yield* Effect.promise(() => space.waitUntilReady());
|
|
80
|
-
|
|
81
|
-
return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(
|
|
82
|
-
Layer.provideMerge(
|
|
83
|
-
Layer.mergeAll(
|
|
84
|
-
TracingServiceLive,
|
|
85
|
-
TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),
|
|
86
|
-
makeToolResolverFromFunctions(functions, toolkit),
|
|
87
|
-
makeToolExecutionServiceFromFunctions(toolkit, toolkitLayer),
|
|
88
|
-
),
|
|
89
|
-
),
|
|
90
|
-
Layer.provideMerge(
|
|
91
|
-
FunctionInvocationServiceLayerWithLocalLoopbackExecutor.pipe(
|
|
92
|
-
Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions })),
|
|
93
|
-
Layer.provideMerge(
|
|
94
|
-
RemoteFunctionExecutionService.fromClient(
|
|
95
|
-
client,
|
|
96
|
-
// If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.
|
|
97
|
-
client.config.get('runtime.client.edgeFeatures.agents') ? spaceId : undefined,
|
|
98
|
-
),
|
|
99
|
-
),
|
|
100
|
-
Layer.provideMerge(aiServiceLayer),
|
|
101
|
-
Layer.provideMerge(CredentialsService.layerFromDatabase()),
|
|
102
|
-
Layer.provideMerge(space ? Database.Service.layer(space.db) : Database.Service.notAvailable),
|
|
103
|
-
Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable),
|
|
104
|
-
),
|
|
105
|
-
),
|
|
106
|
-
);
|
|
107
|
-
}),
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const runtime = ManagedRuntime.make(layer);
|
|
111
|
-
this.#runtimes.set(spaceId, runtime);
|
|
112
|
-
return runtime;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const TracingServiceLive = Layer.unwrapEffect(
|
|
117
|
-
Effect.gen(function* () {
|
|
118
|
-
const objects = yield* Database.Service.runQuery(Query.type(SpaceProperties));
|
|
119
|
-
const [properties] = objects;
|
|
120
|
-
invariant(properties);
|
|
121
|
-
// TODO(burdon): Check ref target has loaded?
|
|
122
|
-
if (!properties.invocationTraceQueue || !properties.invocationTraceQueue.target) {
|
|
123
|
-
const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });
|
|
124
|
-
Obj.change(properties, (m) => {
|
|
125
|
-
m.invocationTraceQueue = Ref.fromDXN(queue.dxn);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const queue = properties.invocationTraceQueue.target;
|
|
130
|
-
invariant(queue);
|
|
131
|
-
return TracingServiceExt.layerInvocationsQueue({ invocationTraceQueue: queue });
|
|
132
|
-
}),
|
|
133
|
-
);
|
|
@@ -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,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
-
import { useLayout } from '@dxos/app-framework/react';
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { getSpace, parseId, useSpace } from '@dxos/react-client/echo';
|
|
12
|
-
|
|
13
|
-
import { AutomationSettings, FunctionsContainer } from '../../components';
|
|
14
|
-
import { meta } from '../../meta';
|
|
15
|
-
|
|
16
|
-
export default Capability.makeModule(() =>
|
|
17
|
-
Effect.succeed(
|
|
18
|
-
Capability.contributes(Common.Capability.ReactSurface, [
|
|
19
|
-
Common.createSurface({
|
|
20
|
-
id: `${meta.id}/space-settings-functions`,
|
|
21
|
-
role: 'article',
|
|
22
|
-
filter: (data): data is { subject: string } => 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
|
-
|
|
31
|
-
return <FunctionsContainer space={space} />;
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
Common.createSurface({
|
|
35
|
-
id: `${meta.id}/space-settings-automation`,
|
|
36
|
-
role: 'article',
|
|
37
|
-
filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,
|
|
38
|
-
component: () => {
|
|
39
|
-
const layout = useLayout();
|
|
40
|
-
const { spaceId } = parseId(layout.workspace);
|
|
41
|
-
const space = useSpace(spaceId);
|
|
42
|
-
if (!space) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return <AutomationSettings space={space} />;
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
Common.createSurface({
|
|
50
|
-
id: `${meta.id}/companion/automation`,
|
|
51
|
-
role: 'article',
|
|
52
|
-
filter: (data): data is { companionTo: Obj.Unknown; subject: 'automation' } =>
|
|
53
|
-
Obj.isObject(data.companionTo) && data.subject === 'automation',
|
|
54
|
-
component: ({ data }) => {
|
|
55
|
-
return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
]),
|
|
59
|
-
),
|
|
60
|
-
);
|
|
@@ -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;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
12
|
-
|
|
13
|
-
import { FunctionsPanel } from './FunctionsPanel';
|
|
14
|
-
import { FunctionsRegistry } from './FunctionsRegistry';
|
|
15
|
-
|
|
16
|
-
export const FunctionsContainer = ({ space }: { space: Space }) => {
|
|
17
|
-
const { t } = useTranslation(meta.id);
|
|
18
|
-
return (
|
|
19
|
-
<ControlPage>
|
|
20
|
-
<ControlSection
|
|
21
|
-
title={t('functions verbose label', { ns: meta.id })}
|
|
22
|
-
description={t('functions description', { ns: meta.id })}
|
|
23
|
-
>
|
|
24
|
-
<FunctionsPanel space={space} />
|
|
25
|
-
</ControlSection>
|
|
26
|
-
<ControlSection
|
|
27
|
-
title={t('functions registry verbose label', { ns: meta.id })}
|
|
28
|
-
description={t('functions registry description', { ns: meta.id })}
|
|
29
|
-
>
|
|
30
|
-
<FunctionsRegistry space={space} />
|
|
31
|
-
</ControlSection>
|
|
32
|
-
</ControlPage>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default FunctionsContainer;
|
|
File without changes
|
/package/dist/lib/{browser/FunctionsPanel-ZX4J75UM.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|