@dxos/plugin-automation 0.8.4-main.7ace549 → 0.8.4-main.9735255
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-FAS6ADCW.mjs +11 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs +56 -0
- package/dist/lib/browser/AutomationSettings-XN2OIYWL.mjs.map +7 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs +129 -0
- package/dist/lib/browser/FunctionsContainer-6QLC7JP4.mjs.map +7 -0
- package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs → FunctionsPanel-ZX4J75UM.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs +84 -0
- package/dist/lib/browser/app-graph-builder-LAQMEBMH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CZVA5NMD.mjs → chunk-54PANILA.mjs} +5 -5
- package/dist/lib/browser/chunk-BFUIVUQH.mjs +102 -0
- package/dist/lib/browser/chunk-BFUIVUQH.mjs.map +7 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs +8 -0
- package/dist/lib/browser/chunk-BKFQBKYO.mjs.map +7 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs +83 -0
- package/dist/lib/browser/chunk-JOXPQ27I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LZQFZO3B.mjs → chunk-PZNBEKO5.mjs} +1 -1
- package/dist/lib/browser/chunk-PZNBEKO5.mjs.map +7 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs +248 -0
- package/dist/lib/browser/chunk-QW3EM35H.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4MBM6C6A.mjs → chunk-RAF2FJST.mjs} +14 -28
- package/dist/lib/browser/chunk-RAF2FJST.mjs.map +7 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs +200 -0
- package/dist/lib/browser/chunk-YWLEY2FD.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1107 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs +114 -0
- package/dist/lib/browser/compute-runtime-WTWLQ67J.mjs.map +7 -0
- package/dist/lib/browser/hooks/index.mjs +3 -3
- package/dist/lib/browser/index.mjs +49 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs +82 -0
- package/dist/lib/browser/operation-resolver-Q3MWOR7K.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-TKU2EQ5A.mjs → react-surface-EV3AC62F.mjs} +12 -11
- package/dist/lib/browser/react-surface-EV3AC62F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -4
- package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs → AutomationPanel-B7NAGDFA.mjs} +4 -4
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs +57 -0
- package/dist/lib/node-esm/AutomationSettings-M5PMZJ6P.mjs.map +7 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs +130 -0
- package/dist/lib/node-esm/FunctionsContainer-J4O2ULWR.mjs.map +7 -0
- package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs → FunctionsPanel-SS6GIVNU.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs +85 -0
- package/dist/lib/node-esm/app-graph-builder-4UCMXHYY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs +201 -0
- package/dist/lib/node-esm/chunk-2CKVH7JC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CEVIVRTY.mjs → chunk-5FXNN3MV.mjs} +1 -1
- package/dist/lib/node-esm/chunk-5FXNN3MV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs → chunk-7QRUPEHH.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-7B6NAAI6.mjs → chunk-HQLVREIX.mjs} +14 -28
- package/dist/lib/node-esm/chunk-HQLVREIX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs +10 -0
- package/dist/lib/node-esm/chunk-K7GCM342.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs +103 -0
- package/dist/lib/node-esm/chunk-KWKWOGS5.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs +249 -0
- package/dist/lib/node-esm/chunk-LJAXQ6CX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs +84 -0
- package/dist/lib/node-esm/chunk-RX52VKI2.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +1108 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs +115 -0
- package/dist/lib/node-esm/compute-runtime-ZHROOBLY.mjs.map +7 -0
- package/dist/lib/node-esm/hooks/index.mjs +3 -3
- package/dist/lib/node-esm/index.mjs +49 -57
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs +83 -0
- package/dist/lib/node-esm/operation-resolver-R5GA4YNO.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-7QROSEGH.mjs → react-surface-S6VZJCEZ.mjs} +12 -11
- package/dist/lib/node-esm/react-surface-S6VZJCEZ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -4
- package/dist/types/src/AutomationPlugin.d.ts +2 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts +6 -0
- package/dist/types/src/capabilities/compute-runtime/compute-runtime.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-runtime/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/cli/commands/index.d.ts +2 -0
- package/dist/types/src/cli/commands/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
- package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
- package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
- package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
- package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
- package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
- package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
- package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
- package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
- package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
- package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +1 -0
- 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/TriggerEditor/FunctionInputEditor.d.ts +10 -7
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
- package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +7 -6
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +70 -2
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerSettings.d.ts +3 -3
- package/dist/types/src/components/TriggerSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +6 -6
- 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 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/test-functions.d.ts +202 -2
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +30 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -49
- package/src/AutomationPlugin.tsx +13 -33
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +71 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/{compute-runtime.ts → compute-runtime/compute-runtime.ts} +48 -44
- package/src/capabilities/compute-runtime/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +79 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +60 -0
- package/src/cli/commands/index.ts +5 -0
- package/src/cli/commands/trigger/create/index.ts +14 -0
- package/src/cli/commands/trigger/create/queue.ts +89 -0
- package/src/cli/commands/trigger/create/subscription.ts +128 -0
- package/src/cli/commands/trigger/create/timer.ts +93 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +67 -0
- package/src/cli/commands/trigger/options.ts +59 -0
- package/src/cli/commands/trigger/remove.ts +45 -0
- package/src/cli/commands/trigger/update/index.ts +14 -0
- package/src/cli/commands/trigger/update/queue.ts +195 -0
- package/src/cli/commands/trigger/update/subscription.ts +278 -0
- package/src/cli/commands/trigger/update/timer.ts +193 -0
- package/src/cli/commands/trigger/util.ts +395 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +23 -0
- package/src/components/AutomationPanel/AutomationPanel.tsx +33 -12
- package/src/components/AutomationSettings.tsx +1 -1
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +11 -16
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +8 -24
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +23 -31
- package/src/components/TriggerEditor/SpecSelector.tsx +8 -6
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +27 -24
- package/src/components/TriggerEditor/TriggerEditor.tsx +55 -42
- package/src/components/TriggerSettings.tsx +3 -3
- package/src/hooks/useComputeRuntimeCallback.ts +9 -10
- package/src/hooks/useTriggerRuntimeControls.ts +7 -7
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/translations.ts +2 -0
- package/src/{capabilities → types}/capabilities.ts +8 -7
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +23 -2
- package/dist/lib/browser/AutomationPanel-M4M77L4V.mjs +0 -11
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs +0 -68
- package/dist/lib/browser/AutomationSettings-4HCI6KJR.mjs.map +0 -7
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs +0 -144
- package/dist/lib/browser/FunctionsContainer-CDVBRQCT.mjs.map +0 -7
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs +0 -81
- package/dist/lib/browser/app-graph-builder-W7LLC6XW.mjs.map +0 -7
- package/dist/lib/browser/chunk-4MBM6C6A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7W6QMY3L.mjs +0 -267
- package/dist/lib/browser/chunk-7W6QMY3L.mjs.map +0 -7
- package/dist/lib/browser/chunk-LZQFZO3B.mjs.map +0 -7
- package/dist/lib/browser/chunk-T6ZESHDY.mjs +0 -191
- package/dist/lib/browser/chunk-T6ZESHDY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TWWFNOIR.mjs +0 -109
- package/dist/lib/browser/chunk-TWWFNOIR.mjs.map +0 -7
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs +0 -15
- package/dist/lib/browser/chunk-XAKZ4ANY.mjs.map +0 -7
- package/dist/lib/browser/chunk-YBPJCY3F.mjs +0 -38
- package/dist/lib/browser/chunk-YBPJCY3F.mjs.map +0 -7
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs +0 -113
- package/dist/lib/browser/compute-runtime-B4XJVY4Y.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs +0 -77
- package/dist/lib/browser/intent-resolver-5HR7M7T6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TKU2EQ5A.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs +0 -69
- package/dist/lib/node-esm/AutomationSettings-BQLJIFRT.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs +0 -145
- package/dist/lib/node-esm/FunctionsContainer-ZHHJPQAZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs +0 -82
- package/dist/lib/node-esm/app-graph-builder-SLQOO7GH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7B6NAAI6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CEVIVRTY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs +0 -268
- package/dist/lib/node-esm/chunk-CF2SWXPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs +0 -39
- package/dist/lib/node-esm/chunk-ECJKIUBO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F76XVENA.mjs +0 -192
- package/dist/lib/node-esm/chunk-F76XVENA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs +0 -16
- package/dist/lib/node-esm/chunk-KB7NFEYY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs +0 -110
- package/dist/lib/node-esm/chunk-RVK52XGK.mjs.map +0 -7
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs +0 -114
- package/dist/lib/node-esm/compute-runtime-JUWTQXOV.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-KDRYB5BC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7QROSEGH.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -20
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-runtime.d.ts +0 -5
- package/dist/types/src/capabilities/compute-runtime.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -87
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/capabilities/react-surface.tsx +0 -56
- package/src/events.ts +0 -11
- /package/dist/lib/browser/{AutomationPanel-M4M77L4V.mjs.map → AutomationPanel-FAS6ADCW.mjs.map} +0 -0
- /package/dist/lib/browser/{FunctionsPanel-CRW6SJUN.mjs.map → FunctionsPanel-ZX4J75UM.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-CZVA5NMD.mjs.map → chunk-54PANILA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{AutomationPanel-F5CTC6AT.mjs.map → AutomationPanel-B7NAGDFA.mjs.map} +0 -0
- /package/dist/lib/node-esm/{FunctionsPanel-RVVCS6VH.mjs.map → FunctionsPanel-SS6GIVNU.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-3IYSC75Z.mjs.map → chunk-7QRUPEHH.mjs.map} +0 -0
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import type * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
6
6
|
|
|
7
7
|
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import type {
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type Database } from '@dxos/echo';
|
|
10
|
+
import type { CredentialsService, FunctionInvocationService, QueueService, TracingService } from '@dxos/functions';
|
|
11
|
+
import type { TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';
|
|
11
12
|
import type { SpaceId } from '@dxos/keys';
|
|
12
13
|
|
|
13
14
|
import { meta } from '../meta';
|
|
@@ -18,13 +19,13 @@ export namespace AutomationCapabilities {
|
|
|
18
19
|
*/
|
|
19
20
|
export type ComputeServices =
|
|
20
21
|
| TriggerDispatcher
|
|
22
|
+
| TriggerStateStore
|
|
21
23
|
| AiService.AiService
|
|
22
|
-
|
|
|
24
|
+
| Database.Service
|
|
23
25
|
| QueueService
|
|
24
26
|
| CredentialsService
|
|
25
27
|
| FunctionInvocationService
|
|
26
|
-
|
|
|
27
|
-
| TriggerStateStore
|
|
28
|
+
| TracingService
|
|
28
29
|
// TODO(dmaretskyi): Those should be provided at AI-chat call site.
|
|
29
30
|
| ToolResolverService
|
|
30
31
|
| ToolExecutionService;
|
|
@@ -37,5 +38,5 @@ export namespace AutomationCapabilities {
|
|
|
37
38
|
/**
|
|
38
39
|
* Runtime for executing agents, functions, and triggers.
|
|
39
40
|
*/
|
|
40
|
-
export const ComputeRuntime =
|
|
41
|
+
export const ComputeRuntime = Capability.make<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);
|
|
41
42
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '../meta';
|
|
8
|
+
|
|
9
|
+
export namespace AutomationEvents {
|
|
10
|
+
export const ComputeRuntimeReady = ActivationEvent.make(`${meta.id}/event/compute-runtime-ready`);
|
|
11
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
8
10
|
|
|
9
11
|
import { meta } from '../meta';
|
|
10
12
|
|
|
@@ -18,7 +20,7 @@ export namespace AutomationAction {
|
|
|
18
20
|
`${meta.id}/action/create-trigger-from-template`,
|
|
19
21
|
{
|
|
20
22
|
input: Schema.Struct({
|
|
21
|
-
|
|
23
|
+
db: Database.Database,
|
|
22
24
|
template: TriggerTemplate,
|
|
23
25
|
enabled: Schema.optional(Schema.Boolean),
|
|
24
26
|
// TODO(wittjosiah): Improve how this lookup is done.
|
|
@@ -29,3 +31,22 @@ export namespace AutomationAction {
|
|
|
29
31
|
},
|
|
30
32
|
) {}
|
|
31
33
|
}
|
|
34
|
+
|
|
35
|
+
const AUTOMATION_OPERATION = `${meta.id}/operation`;
|
|
36
|
+
|
|
37
|
+
export namespace AutomationOperation {
|
|
38
|
+
export const CreateTriggerFromTemplate = Operation.make({
|
|
39
|
+
meta: { key: `${AUTOMATION_OPERATION}/create-trigger-from-template`, name: 'Create Trigger From Template' },
|
|
40
|
+
services: [Capability.Service],
|
|
41
|
+
schema: {
|
|
42
|
+
input: Schema.Struct({
|
|
43
|
+
db: Database.Database,
|
|
44
|
+
template: TriggerTemplate,
|
|
45
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
46
|
+
scriptName: Schema.optional(Schema.String),
|
|
47
|
+
input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
48
|
+
}),
|
|
49
|
+
output: Schema.Void,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AutomationPanel,
|
|
3
|
-
AutomationPanel_default
|
|
4
|
-
} from "./chunk-T6ZESHDY.mjs";
|
|
5
|
-
import "./chunk-7W6QMY3L.mjs";
|
|
6
|
-
import "./chunk-LZQFZO3B.mjs";
|
|
7
|
-
export {
|
|
8
|
-
AutomationPanel,
|
|
9
|
-
AutomationPanel_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=AutomationPanel-M4M77L4V.mjs.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useTriggerRuntimeControls
|
|
3
|
-
} from "./chunk-4MBM6C6A.mjs";
|
|
4
|
-
import "./chunk-XAKZ4ANY.mjs";
|
|
5
|
-
import {
|
|
6
|
-
AutomationPanel
|
|
7
|
-
} from "./chunk-T6ZESHDY.mjs";
|
|
8
|
-
import "./chunk-7W6QMY3L.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-LZQFZO3B.mjs";
|
|
12
|
-
|
|
13
|
-
// src/components/AutomationSettings.tsx
|
|
14
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
15
|
-
import React2 from "react";
|
|
16
|
-
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
17
|
-
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
18
|
-
|
|
19
|
-
// src/components/TriggerSettings.tsx
|
|
20
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
21
|
-
import React from "react";
|
|
22
|
-
import { Input, useTranslation } from "@dxos/react-ui";
|
|
23
|
-
import { ControlItemInput } from "@dxos/react-ui-form";
|
|
24
|
-
var TriggersSettings = ({ space }) => {
|
|
25
|
-
var _effect = _useSignals();
|
|
26
|
-
try {
|
|
27
|
-
const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(space);
|
|
28
|
-
const { t } = useTranslation(meta.id);
|
|
29
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
30
|
-
className: "container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]"
|
|
31
|
-
}, /* @__PURE__ */ React.createElement(ControlItemInput, {
|
|
32
|
-
title: t("runtime label"),
|
|
33
|
-
description: t("runtime description")
|
|
34
|
-
}, /* @__PURE__ */ React.createElement(Input.Switch, {
|
|
35
|
-
classNames: "justify-self-end",
|
|
36
|
-
checked: isRunning,
|
|
37
|
-
onCheckedChange: isRunning ? stop : start
|
|
38
|
-
})));
|
|
39
|
-
} finally {
|
|
40
|
-
_effect.f();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// src/components/AutomationSettings.tsx
|
|
45
|
-
var AutomationSettings = (props) => {
|
|
46
|
-
var _effect = _useSignals2();
|
|
47
|
-
try {
|
|
48
|
-
const { t } = useTranslation2(meta.id);
|
|
49
|
-
return /* @__PURE__ */ React2.createElement(ControlPage, null, /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
50
|
-
title: t("automation verbose label", {
|
|
51
|
-
ns: meta.id
|
|
52
|
-
}),
|
|
53
|
-
description: t("automation description", {
|
|
54
|
-
ns: meta.id
|
|
55
|
-
})
|
|
56
|
-
}, /* @__PURE__ */ React2.createElement(AutomationPanel, props), /* @__PURE__ */ React2.createElement(TriggersSettings, {
|
|
57
|
-
space: props.space
|
|
58
|
-
})));
|
|
59
|
-
} finally {
|
|
60
|
-
_effect.f();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var AutomationSettings_default = AutomationSettings;
|
|
64
|
-
export {
|
|
65
|
-
AutomationSettings,
|
|
66
|
-
AutomationSettings_default as default
|
|
67
|
-
};
|
|
68
|
-
//# sourceMappingURL=AutomationSettings-4HCI6KJR.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/AutomationSettings.tsx", "../../../src/components/TriggerSettings.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { AutomationPanel, type AutomationPanelProps } from './AutomationPanel';\nimport { TriggersSettings } from './TriggerSettings';\n\nexport const AutomationSettings = (props: AutomationPanelProps) => {\n const { t } = useTranslation(meta.id);\n return (\n <ControlPage>\n <ControlSection\n title={t('automation verbose label', { ns: meta.id })}\n description={t('automation description', { ns: meta.id })}\n >\n <AutomationPanel {...props} />\n <TriggersSettings space={props.space} />\n </ControlSection>\n </ControlPage>\n );\n};\n\nexport default AutomationSettings;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { Input, useTranslation } from '@dxos/react-ui';\nimport { ControlItemInput } from '@dxos/react-ui-form';\n\nimport { useTriggerRuntimeControls } from '../hooks';\nimport { meta } from '../meta';\n\nexport const TriggersSettings = ({ space }: { space: Space }) => {\n const { triggers, isRunning, start, stop } = useTriggerRuntimeControls(space);\n const { t } = useTranslation(meta.id);\n\n return (\n <div className='container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content]'>\n <ControlItemInput title={t('runtime label')} description={t('runtime description')}>\n <Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />\n </ControlItemInput>\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,kBAAAA,uBAAsB;AAC/B,SAASC,aAAaC,sBAAsB;;;;ACH5C,OAAOC,WAAW;AAGlB,SAASC,OAAOC,sBAAsB;AACtC,SAASC,wBAAwB;AAK1B,IAAMC,mBAAmB,CAAC,EAAEC,MAAK,MAAoB;;;AAC1D,UAAM,EAAEC,UAAUC,WAAWC,OAAOC,KAAI,IAAKC,0BAA0BL,KAAAA;AACvE,UAAM,EAAEM,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,WACE,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,kBAAAA;MAAiBC,OAAOP,EAAE,eAAA;MAAkBQ,aAAaR,EAAE,qBAAA;OAC1D,sBAAA,cAACS,MAAMC,QAAM;MAACC,YAAW;MAAmBC,SAAShB;MAAWiB,iBAAiBjB,YAAYE,OAAOD;;;;;AAI5G;;;ADVO,IAAMiB,qBAAqB,CAACC,UAAAA;;;AACjC,UAAM,EAAEC,EAAC,IAAKC,gBAAeC,KAAKC,EAAE;AACpC,WACE,gBAAAC,OAAA,cAACC,aAAAA,MACC,gBAAAD,OAAA,cAACE,gBAAAA;MACCC,OAAOP,EAAE,4BAA4B;QAAEQ,IAAIN,KAAKC;MAAG,CAAA;MACnDM,aAAaT,EAAE,0BAA0B;QAAEQ,IAAIN,KAAKC;MAAG,CAAA;OAEvD,gBAAAC,OAAA,cAACM,iBAAoBX,KAAAA,GACrB,gBAAAK,OAAA,cAACO,kBAAAA;MAAiBC,OAAOb,MAAMa;;;;;AAIvC;AAEA,IAAA,6BAAed;",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "React", "Input", "useTranslation", "ControlItemInput", "TriggersSettings", "space", "triggers", "isRunning", "start", "stop", "useTriggerRuntimeControls", "t", "useTranslation", "meta", "id", "div", "className", "ControlItemInput", "title", "description", "Input", "Switch", "classNames", "checked", "onCheckedChange", "AutomationSettings", "props", "t", "useTranslation", "meta", "id", "React", "ControlPage", "ControlSection", "title", "ns", "description", "AutomationPanel", "TriggersSettings", "space"]
|
|
7
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FunctionsPanel
|
|
3
|
-
} from "./chunk-TWWFNOIR.mjs";
|
|
4
|
-
import {
|
|
5
|
-
meta
|
|
6
|
-
} from "./chunk-LZQFZO3B.mjs";
|
|
7
|
-
|
|
8
|
-
// src/components/FunctionsContainer.tsx
|
|
9
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
10
|
-
import React2 from "react";
|
|
11
|
-
import { useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
12
|
-
import { ControlPage, ControlSection } from "@dxos/react-ui-form";
|
|
13
|
-
|
|
14
|
-
// src/components/FunctionsRegistry/FunctionsRegistry.tsx
|
|
15
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
16
|
-
import * as Array from "effect/Array";
|
|
17
|
-
import * as EffectFunction from "effect/Function";
|
|
18
|
-
import * as Order from "effect/Order";
|
|
19
|
-
import * as Schema from "effect/Schema";
|
|
20
|
-
import { useState } from "react";
|
|
21
|
-
import React, { useCallback } from "react";
|
|
22
|
-
import { Function } from "@dxos/functions";
|
|
23
|
-
import { getDeployedFunctions } from "@dxos/functions-runtime/edge";
|
|
24
|
-
import { useClient } from "@dxos/react-client";
|
|
25
|
-
import { Filter, Query, useQuery } from "@dxos/react-client/echo";
|
|
26
|
-
import { useAsyncEffect } from "@dxos/react-ui";
|
|
27
|
-
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
28
|
-
import { controlItemClasses } from "@dxos/react-ui-form";
|
|
29
|
-
import { List } from "@dxos/react-ui-list";
|
|
30
|
-
import { ghostHover, mx } from "@dxos/react-ui-theme";
|
|
31
|
-
var grid = "grid grid-cols-[1fr_1fr_auto] min-bs-[2.5rem]";
|
|
32
|
-
var FunctionsRegistry = ({ space }) => {
|
|
33
|
-
var _effect = _useSignals();
|
|
34
|
-
try {
|
|
35
|
-
const client = useClient();
|
|
36
|
-
const [loading, setLoading] = useState(true);
|
|
37
|
-
const [functions, setFunctions] = useState([]);
|
|
38
|
-
const { t } = useTranslation(meta.id);
|
|
39
|
-
const dbFunctions = useQuery(space, Filter.type(Function.Function));
|
|
40
|
-
const state = (func) => {
|
|
41
|
-
const dbFunction = dbFunctions.find((f) => f.key === func.key);
|
|
42
|
-
if (!dbFunction) {
|
|
43
|
-
return "import";
|
|
44
|
-
}
|
|
45
|
-
if (dbFunction.version === func.version && dbFunction.updated === func.updated) {
|
|
46
|
-
return "none";
|
|
47
|
-
}
|
|
48
|
-
return "update";
|
|
49
|
-
};
|
|
50
|
-
useAsyncEffect(async () => {
|
|
51
|
-
setLoading(true);
|
|
52
|
-
const functions2 = await getDeployedFunctions(client);
|
|
53
|
-
setFunctions(functions2);
|
|
54
|
-
setLoading(false);
|
|
55
|
-
}, []);
|
|
56
|
-
const dedupedFunctions = EffectFunction.pipe(functions, Array.filter((_) => _.key !== void 0), Array.sort(Order.reverse(Order.mapInput(Order.string, (_) => _.updated ?? ""))), Array.dedupeWith((self, that) => self.key === that.key), Array.sort(Order.mapInput(Order.string, (_) => _.key ?? "")));
|
|
57
|
-
const hanleImportOrUpdate = useCallback(async (func) => {
|
|
58
|
-
const { objects: [existingFunc] } = await space.db.query(Query.type(Function.Function, {
|
|
59
|
-
key: func.key
|
|
60
|
-
})).run();
|
|
61
|
-
if (!existingFunc) {
|
|
62
|
-
space.db.add(func);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
Function.setFrom(existingFunc, func);
|
|
66
|
-
}, [
|
|
67
|
-
space
|
|
68
|
-
]);
|
|
69
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
70
|
-
role: "none",
|
|
71
|
-
className: mx(controlItemClasses)
|
|
72
|
-
}, dedupedFunctions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
|
|
73
|
-
items: dedupedFunctions,
|
|
74
|
-
isItem: Schema.is(Function.Function),
|
|
75
|
-
getId: (func) => func.id
|
|
76
|
-
}, ({ items }) => /* @__PURE__ */ React.createElement("div", {
|
|
77
|
-
role: "list",
|
|
78
|
-
className: "flex flex-col is-full"
|
|
79
|
-
}, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
|
|
80
|
-
key: func.id,
|
|
81
|
-
item: func,
|
|
82
|
-
classNames: mx(grid, ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
|
|
83
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
84
|
-
className: "flex flex-col truncate"
|
|
85
|
-
}, /* @__PURE__ */ React.createElement(List.ItemTitle, {
|
|
86
|
-
classNames: "truncate"
|
|
87
|
-
}, func.name), /* @__PURE__ */ React.createElement("div", {
|
|
88
|
-
className: "text-xs text-description truncate"
|
|
89
|
-
}, func.key)), /* @__PURE__ */ React.createElement("div", {
|
|
90
|
-
className: "flex flex-col truncate"
|
|
91
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
92
|
-
className: "text-xs text-description truncate"
|
|
93
|
-
}, func.version), /* @__PURE__ */ React.createElement("div", {
|
|
94
|
-
className: "text-xs text-description truncate"
|
|
95
|
-
}, func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : "")), /* @__PURE__ */ React.createElement(IconButton, {
|
|
96
|
-
iconOnly: true,
|
|
97
|
-
icon: state(func) === "update" ? "ph--arrows-clockwise--regular" : "ph--download--regular",
|
|
98
|
-
label: state(func) === "update" ? t("update function button label") : t("import function button label"),
|
|
99
|
-
disabled: state(func) === "none",
|
|
100
|
-
onClick: () => hanleImportOrUpdate(func)
|
|
101
|
-
}))))), dedupedFunctions.length === 0 && !loading && /* @__PURE__ */ React.createElement("div", {
|
|
102
|
-
className: "text-center plb-4 text-gray-500"
|
|
103
|
-
}, t("no functions found")), loading && /* @__PURE__ */ React.createElement("div", {
|
|
104
|
-
className: "text-center plb-4 text-gray-500"
|
|
105
|
-
}, t("loading functions")));
|
|
106
|
-
} finally {
|
|
107
|
-
_effect.f();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// src/components/FunctionsContainer.tsx
|
|
112
|
-
var FunctionsContainer = ({ space }) => {
|
|
113
|
-
var _effect = _useSignals2();
|
|
114
|
-
try {
|
|
115
|
-
const { t } = useTranslation2(meta.id);
|
|
116
|
-
return /* @__PURE__ */ React2.createElement(ControlPage, null, /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
117
|
-
title: t("functions verbose label", {
|
|
118
|
-
ns: meta.id
|
|
119
|
-
}),
|
|
120
|
-
description: t("functions description", {
|
|
121
|
-
ns: meta.id
|
|
122
|
-
})
|
|
123
|
-
}, /* @__PURE__ */ React2.createElement(FunctionsPanel, {
|
|
124
|
-
space
|
|
125
|
-
})), /* @__PURE__ */ React2.createElement(ControlSection, {
|
|
126
|
-
title: t("functions registry verbose label", {
|
|
127
|
-
ns: meta.id
|
|
128
|
-
}),
|
|
129
|
-
description: t("functions registry description", {
|
|
130
|
-
ns: meta.id
|
|
131
|
-
})
|
|
132
|
-
}, /* @__PURE__ */ React2.createElement(FunctionsRegistry, {
|
|
133
|
-
space
|
|
134
|
-
})));
|
|
135
|
-
} finally {
|
|
136
|
-
_effect.f();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var FunctionsContainer_default = FunctionsContainer;
|
|
140
|
-
export {
|
|
141
|
-
FunctionsContainer,
|
|
142
|
-
FunctionsContainer_default as default
|
|
143
|
-
};
|
|
144
|
-
//# sourceMappingURL=FunctionsContainer-CDVBRQCT.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/FunctionsContainer.tsx", "../../../src/components/FunctionsRegistry/FunctionsRegistry.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { ControlPage, ControlSection } from '@dxos/react-ui-form';\n\nimport { meta } from '../meta';\n\nimport { FunctionsPanel } from './FunctionsPanel';\nimport { FunctionsRegistry } from './FunctionsRegistry';\n\nexport const FunctionsContainer = ({ space }: { space: Space }) => {\n const { t } = useTranslation(meta.id);\n return (\n <ControlPage>\n <ControlSection\n title={t('functions verbose label', { ns: meta.id })}\n description={t('functions description', { ns: meta.id })}\n >\n <FunctionsPanel space={space} />\n </ControlSection>\n <ControlSection\n title={t('functions registry verbose label', { ns: meta.id })}\n description={t('functions registry description', { ns: meta.id })}\n >\n <FunctionsRegistry space={space} />\n </ControlSection>\n </ControlPage>\n );\n};\n\nexport default FunctionsContainer;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Array from 'effect/Array';\nimport * as EffectFunction from 'effect/Function';\nimport * as Order from 'effect/Order';\nimport * as Schema from 'effect/Schema';\nimport { useState } from 'react';\nimport React, { useCallback } from 'react';\n\nimport { Function } from '@dxos/functions';\nimport { getDeployedFunctions } from '@dxos/functions-runtime/edge';\nimport { useClient } from '@dxos/react-client';\nimport { Filter, Query, type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncEffect } from '@dxos/react-ui';\nimport { 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_1fr_auto] min-bs-[2.5rem]';\n\ntype FunctionsRegistryProps = {\n space: Space;\n};\n\nexport const FunctionsRegistry = ({ space }: FunctionsRegistryProps) => {\n const client = useClient();\n const [loading, setLoading] = useState(true);\n const [functions, setFunctions] = useState<Function.Function[]>([]);\n const { t } = useTranslation(meta.id);\n\n const dbFunctions = useQuery(space, Filter.type(Function.Function));\n\n const state = (func: Function.Function) => {\n const dbFunction = dbFunctions.find((f) => f.key === func.key);\n if (!dbFunction) {\n return 'import';\n }\n if (dbFunction.version === func.version && dbFunction.updated === func.updated) {\n return 'none';\n }\n return 'update';\n };\n\n useAsyncEffect(async () => {\n setLoading(true);\n const functions = await getDeployedFunctions(client);\n setFunctions(functions);\n setLoading(false);\n }, []);\n\n const dedupedFunctions = EffectFunction.pipe(\n functions,\n Array.filter((_) => _.key !== undefined),\n Array.sort(Order.reverse(Order.mapInput(Order.string, (_: Function.Function) => _.updated ?? ''))),\n Array.dedupeWith((self, that) => self.key === that.key),\n Array.sort(Order.mapInput(Order.string, (_: Function.Function) => _.key ?? '')),\n );\n\n const hanleImportOrUpdate = useCallback(\n async (func: Function.Function) => {\n const {\n objects: [existingFunc],\n } = await space.db.query(Query.type(Function.Function, { key: func.key })).run();\n if (!existingFunc) {\n space.db.add(func);\n return;\n }\n Function.setFrom(existingFunc, func);\n },\n [space],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {dedupedFunctions.length > 0 && (\n <List.Root<Function.Function>\n items={dedupedFunctions}\n isItem={Schema.is(Function.Function)}\n getId={(func) => func.id}\n >\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 <div className='text-xs text-description truncate'>{func.key}</div>\n </div>\n <div className='flex flex-col truncate'>\n <div className='text-xs text-description truncate'>{func.version}</div>\n <div className='text-xs text-description truncate'>\n {func.updated ? `Uploaded ${new Date(func.updated).toLocaleString()}` : ''}\n </div>\n </div>\n\n <IconButton\n iconOnly\n icon={state(func) === 'update' ? 'ph--arrows-clockwise--regular' : 'ph--download--regular'}\n label={\n state(func) === 'update' ? t('update function button label') : t('import function button label')\n }\n disabled={state(func) === 'none'}\n onClick={() => hanleImportOrUpdate(func)}\n />\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {dedupedFunctions.length === 0 && !loading && (\n <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>\n )}\n {loading && <div className='text-center plb-4 text-gray-500'>{t('loading functions')}</div>}\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["React", "useTranslation", "ControlPage", "ControlSection", "Array", "EffectFunction", "Order", "Schema", "useState", "React", "useCallback", "Function", "getDeployedFunctions", "useClient", "Filter", "Query", "useQuery", "useAsyncEffect", "IconButton", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsRegistry", "space", "client", "useClient", "loading", "setLoading", "useState", "functions", "setFunctions", "t", "useTranslation", "meta", "id", "dbFunctions", "useQuery", "Filter", "type", "Function", "state", "func", "dbFunction", "find", "f", "key", "version", "updated", "useAsyncEffect", "getDeployedFunctions", "dedupedFunctions", "pipe", "filter", "_", "undefined", "sort", "reverse", "mapInput", "string", "dedupeWith", "self", "that", "hanleImportOrUpdate", "useCallback", "objects", "existingFunc", "db", "query", "Query", "run", "add", "setFrom", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "map", "Item", "item", "classNames", "ghostHover", "ItemTitle", "name", "Date", "toLocaleString", "IconButton", "iconOnly", "icon", "label", "disabled", "onClick", "FunctionsContainer", "space", "t", "useTranslation", "meta", "id", "React", "ControlPage", "ControlSection", "title", "ns", "description", "FunctionsPanel", "FunctionsRegistry"]
|
|
7
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-LZQFZO3B.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/app-graph-builder.ts
|
|
6
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
7
|
-
import * as Function from "effect/Function";
|
|
8
|
-
import * as Option from "effect/Option";
|
|
9
|
-
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
10
|
-
import { Obj } from "@dxos/echo";
|
|
11
|
-
import { Script } from "@dxos/functions";
|
|
12
|
-
import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
13
|
-
import { createExtension } from "@dxos/plugin-graph";
|
|
14
|
-
import { meta as spaceMeta } from "@dxos/plugin-space";
|
|
15
|
-
var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, [
|
|
16
|
-
createExtension({
|
|
17
|
-
id: `${meta.id}/space-settings-automation`,
|
|
18
|
-
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.type === `${spaceMeta.id}/settings` ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
19
|
-
{
|
|
20
|
-
id: `automation-${node2.id}`,
|
|
21
|
-
type: `${meta.id}/space-settings-automation`,
|
|
22
|
-
data: `${meta.id}/space-settings-automation`,
|
|
23
|
-
properties: {
|
|
24
|
-
label: [
|
|
25
|
-
"automation panel label",
|
|
26
|
-
{
|
|
27
|
-
ns: meta.id
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
icon: "ph--lightning--regular"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
]), Option.getOrElse(() => [])))
|
|
34
|
-
}),
|
|
35
|
-
createExtension({
|
|
36
|
-
id: `${meta.id}/space-settings-functions`,
|
|
37
|
-
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.type === `${spaceMeta.id}/settings` ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
38
|
-
{
|
|
39
|
-
id: `functions-${node2.id}`,
|
|
40
|
-
type: `${meta.id}/space-settings-functions`,
|
|
41
|
-
data: `${meta.id}/space-settings-functions`,
|
|
42
|
-
properties: {
|
|
43
|
-
label: [
|
|
44
|
-
"functions panel label",
|
|
45
|
-
{
|
|
46
|
-
ns: meta.id
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
icon: "ph--function--regular"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
]), Option.getOrElse(() => [])))
|
|
53
|
-
}),
|
|
54
|
-
createExtension({
|
|
55
|
-
id: `${meta.id}/script-companion`,
|
|
56
|
-
connector: (node) => Atom.make((get) => Function.pipe(get(node), Option.flatMap((node2) => Obj.instanceOf(Script.Script, node2.data) ? Option.some(node2) : Option.none()), Option.map((node2) => [
|
|
57
|
-
{
|
|
58
|
-
id: [
|
|
59
|
-
node2.id,
|
|
60
|
-
"automation"
|
|
61
|
-
].join(ATTENDABLE_PATH_SEPARATOR),
|
|
62
|
-
type: PLANK_COMPANION_TYPE,
|
|
63
|
-
data: "automation",
|
|
64
|
-
properties: {
|
|
65
|
-
label: [
|
|
66
|
-
"script automation label",
|
|
67
|
-
{
|
|
68
|
-
ns: meta.id
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
icon: "ph--lightning--regular",
|
|
72
|
-
disposition: "hidden"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
]), Option.getOrElse(() => [])))
|
|
76
|
-
})
|
|
77
|
-
]));
|
|
78
|
-
export {
|
|
79
|
-
app_graph_builder_default as default
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=app-graph-builder-W7LLC6XW.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { Script } from '@dxos/functions';\nimport { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { createExtension } from '@dxos/plugin-graph';\nimport { meta as spaceMeta } from '@dxos/plugin-space';\n\nimport { meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${meta.id}/space-settings-automation`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `automation-${node.id}`,\n type: `${meta.id}/space-settings-automation`,\n data: `${meta.id}/space-settings-automation`,\n properties: {\n label: ['automation panel label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/space-settings-functions`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: `functions-${node.id}`,\n type: `${meta.id}/space-settings-functions`,\n data: `${meta.id}/space-settings-functions`,\n properties: {\n label: ['functions panel label', { ns: meta.id }],\n icon: 'ph--function--regular',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n createExtension({\n id: `${meta.id}/script-companion`,\n connector: (node) =>\n Atom.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (Obj.instanceOf(Script.Script, node.data) ? Option.some(node) : Option.none())),\n Option.map((node) => [\n {\n id: [node.id, 'automation'].join(ATTENDABLE_PATH_SEPARATOR),\n type: PLANK_COMPANION_TYPE,\n data: 'automation',\n properties: {\n label: ['script automation label', { ns: meta.id }],\n icon: 'ph--lightning--regular',\n disposition: 'hidden',\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,YAAY;AACrB,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AAExB,SAASC,cAAkCC,mBAAmB;AAC9D,SAASC,WAAW;AACpB,SAASC,cAAc;AACvB,SAASC,2BAA2BC,4BAA4B;AAChE,SAASC,uBAAuB;AAChC,SAASC,QAAQC,iBAAiB;AAIlC,IAAA,6BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKM,SAAS,GAAGC,UAAUV,EAAE,cAAqBW,YAAKR,KAAAA,IAAeS,YAAI,CAAA,GAC7FC,WAAI,CAACV,UAAS;MACnB;QACEH,IAAI,cAAcG,MAAKH,EAAE;QACzBS,MAAM,GAAGR,KAAKD,EAAE;QAChBc,MAAM,GAAGb,KAAKD,EAAE;QAChBe,YAAY;UACVC,OAAO;YAAC;YAA0B;cAAEC,IAAIhB,KAAKD;YAAG;;UAChDkB,MAAM;QACR;MACF;KACD,GACMC,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;EACApB,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKM,SAAS,GAAGC,UAAUV,EAAE,cAAqBW,YAAKR,KAAAA,IAAeS,YAAI,CAAA,GAC7FC,WAAI,CAACV,UAAS;MACnB;QACEH,IAAI,aAAaG,MAAKH,EAAE;QACxBS,MAAM,GAAGR,KAAKD,EAAE;QAChBc,MAAM,GAAGb,KAAKD,EAAE;QAChBe,YAAY;UACVC,OAAO;YAAC;YAAyB;cAAEC,IAAIhB,KAAKD;YAAG;;UAC/CkB,MAAM;QACR;MACF;KACD,GACMC,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;EACApB,gBAAgB;IACdC,IAAI,GAAGC,KAAKD,EAAE;IACdE,WAAW,CAACC,SACVC,KAAKC,KAAK,CAACC,QACAC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUiB,IAAIC,WAAWC,OAAOA,QAAQnB,MAAKW,IAAI,IAAWH,YAAKR,KAAAA,IAAeS,YAAI,CAAA,GAC7FC,WAAI,CAACV,UAAS;MACnB;QACEH,IAAI;UAACG,MAAKH;UAAI;UAAcuB,KAAKC,yBAAAA;QACjCf,MAAMgB;QACNX,MAAM;QACNC,YAAY;UACVC,OAAO;YAAC;YAA2B;cAAEC,IAAIhB,KAAKD;YAAG;;UACjDkB,MAAM;UACNQ,aAAa;QACf;MACF;KACD,GACMP,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;EAGjC,CAAA;CACD;",
|
|
6
|
-
"names": ["Atom", "Function", "Option", "Capabilities", "contributes", "Obj", "Script", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "createExtension", "meta", "spaceMeta", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "connector", "node", "Atom", "make", "get", "pipe", "flatMap", "type", "spaceMeta", "some", "none", "map", "data", "properties", "label", "ns", "icon", "getOrElse", "Obj", "instanceOf", "Script", "join", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "disposition"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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 * as Cause from 'effect/Cause';\nimport * as Effect from 'effect/Effect';\nimport * as Exit from 'effect/Exit';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework/react';\nimport { type FunctionDefinition, FunctionInvocationService } from '@dxos/functions';\nimport { InvocationTracer, TracingServiceExt } from '@dxos/functions-runtime';\nimport { log } from '@dxos/log';\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// TODO(wittjosiah): Function invoking should automatically be traced (DX-647).\nexport const invokeFunctionWithTracing = <I, O>(functionDef: FunctionDefinition<I, O>, inputData: I) =>\n Effect.gen(function* () {\n const tracer = yield* InvocationTracer;\n const trace = yield* tracer.traceInvocationStart({\n target: undefined,\n payload: {\n data: {},\n },\n });\n\n // Invoke the function.\n const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(\n Effect.provide(TracingServiceExt.layerQueue(trace.invocationTraceQueue)),\n Effect.exit,\n );\n\n if (Exit.isFailure(result)) {\n const error = Cause.prettyErrors(result.cause)[0];\n log.error(error.message, error.cause ?? error.stack);\n }\n\n yield* tracer.traceInvocationEnd({\n trace,\n // TODO(dmaretskyi): Might miss errors.\n exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,\n });\n\n return result;\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
|
-
"mappings": ";;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AACtB,SAASC,mBAAmB;AAE5B,SAASC,qBAAqB;AAC9B,SAAkCC,iCAAiC;AACnE,SAASC,kBAAkBC,yBAAyB;AACpD,SAASC,WAAW;;;ACRpB,SAASC,YAAY;AAEd,IAAMC,kBAAkBC,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC1C,IAAMC,iBAAiBD,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAME,iBAAiBF,KAAK,MAAM,OAAO,gCAAA,CAAA;AACzC,IAAMG,eAAeH,KAAK,MAAM,OAAO,8BAAA,CAAA;;;;ADYvC,IAAMI,4BAA4B,CACvCC,OACAC,IACAC,SAAAA;AAEA,QAAMC,iBAAiBC,cAAcC,uBAAuBC,cAAc;AAC1E,QAAMC,UAAUP,UAAUQ,SAAYL,eAAeM,WAAWT,MAAMU,EAAE,IAAIF;AAE5E,SAAOG,YAAY,MAAA;AACjB,QAAI,CAACJ,SAAS;AACZ,YAAM,IAAIK,UAAU,iDAAA;IACtB;AAEA,WAAOL,QAAQM,WAAWZ,GAAAA,CAAAA;EAC5B,GAAG;IAACM;OAAaL,QAAQ,CAAA;GAAI;AAC/B;AAGO,IAAMY,4BAA4B,CAAOC,aAAuCC,cAC9EC,WAAI,aAAA;AACT,QAAMC,SAAS,OAAOC;AACtB,QAAMC,QAAQ,OAAOF,OAAOG,qBAAqB;IAC/CC,QAAQd;IACRe,SAAS;MACPC,MAAM,CAAC;IACT;EACF,CAAA;AAGA,QAAMC,SAAS,OAAOC,0BAA0BC,eAAeZ,aAAaC,SAAAA,EAAWY,KAC9EC,eAAQC,kBAAkBC,WAAWX,MAAMY,oBAAoB,CAAA,GAC/DC,WAAI;AAGb,MAASC,eAAUT,MAAAA,GAAS;AAC1B,UAAMU,QAAcC,mBAAaX,OAAOY,KAAK,EAAE,CAAA;AAC/CC,QAAIH,MAAMA,MAAMI,SAASJ,MAAME,SAASF,MAAMK,OAAK;;;;;;EACrD;AAEA,SAAOtB,OAAOuB,mBAAmB;IAC/BrB;;IAEAsB,WAAgBR,eAAUT,MAAAA,IAAgBW,mBAAaX,OAAOY,KAAK,EAAE,CAAA,IAAK7B;EAC5E,CAAA;AAEA,SAAOiB;AACT,CAAA;;;AE/DF,YAAYkB,aAAY;AAExB,SAASC,cAAc;AACvB,SAASC,eAAe;AACxB,SAASC,yBAAyB;AAClC,SAAqBC,gBAAgB;AACrC,SAASC,qBAAqB;AAWvB,IAAMC,4BAA4B,CAACC,UAAAA;AACxC,QAAMC,WAAWC,SAASF,OAAOG,OAAOC,KAAKC,QAAQA,OAAO,CAAA;AAE5D,QAAM,CAACC,gBAAgBC,iBAAAA,IAAqBC,cAC1CC,0BAA0BT,OAAO,MAAMU,kBAAkBC,KAAYC,YAAI,CAACC,MAAMA,EAAEC,OAAO,CAAA,CAAA,CAAA;AAG3F,QAAMC,QAAQN,0BACZT,OACOgB,mBAAW,aAAA;AAChB,UAAMC,aAAa,OAAOP;AAC1B,WAAOO,WAAWF,MAAK;AACvBR,sBAAkB,IAAA;EACpB,CAAA,CAAA;AAGF,QAAMW,OAAOT,0BACXT,OACOgB,mBAAW,aAAA;AAChB,UAAMC,aAAa,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": ["Cause", "Effect", "Exit", "useCallback", "useCapability", "FunctionInvocationService", "InvocationTracer", "TracingServiceExt", "log", "lazy", "AppGraphBuilder", "lazy", "ComputeRuntime", "IntentResolver", "ReactSurface", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "invokeFunctionWithTracing", "functionDef", "inputData", "gen", "tracer", "InvocationTracer", "trace", "traceInvocationStart", "target", "payload", "data", "result", "FunctionInvocationService", "invokeFunction", "pipe", "provide", "TracingServiceExt", "layerQueue", "invocationTraceQueue", "exit", "isFailure", "error", "prettyErrors", "cause", "log", "message", "stack", "traceInvocationEnd", "exception", "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
|
-
}
|