@dxos/plugin-automation 0.8.4-main.b97322e → 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-WZKRIDQ6.mjs +54 -0
- package/dist/lib/browser/chunk-WZKRIDQ6.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +1122 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- 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 +117 -0
- package/dist/lib/browser/hooks/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -83
- 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 +10 -4
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-POUAOKR5.mjs +56 -0
- 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 +1123 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- 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 +118 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -83
- 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 +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.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- 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 -3
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +47 -4
- 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 +8 -0
- package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
- package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
- package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
- 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 +11 -8
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +116 -4
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -3
- 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 +6 -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 +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- 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 +13 -0
- package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
- 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 +12 -0
- package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.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 +204 -3
- package/dist/types/src/testing/test-functions.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +29 -25
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +24 -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 +12 -4
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +105 -41
- package/src/AutomationPlugin.tsx +22 -33
- package/src/capabilities/app-graph-builder.ts +55 -79
- package/src/capabilities/compute-runtime.ts +180 -0
- package/src/capabilities/index.ts +9 -4
- package/src/capabilities/node.ts +7 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +46 -45
- 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 +90 -0
- package/src/cli/commands/trigger/create/subscription.ts +129 -0
- package/src/cli/commands/trigger/create/timer.ts +94 -0
- package/src/cli/commands/trigger/index.ts +16 -0
- package/src/cli/commands/trigger/list.ts +68 -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 +279 -0
- package/src/cli/commands/trigger/update/timer.ts +194 -0
- package/src/cli/commands/trigger/util.ts +409 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +24 -0
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +18 -17
- package/src/components/AutomationPanel/AutomationPanel.tsx +240 -90
- package/src/components/FunctionsPanel/FunctionsPanel.tsx +52 -32
- package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +114 -0
- package/src/components/FunctionsRegistry/index.ts +8 -0
- package/src/components/TriggerEditor/FunctionInputEditor.tsx +42 -35
- package/src/components/TriggerEditor/SpecSelector.tsx +39 -22
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +123 -34
- package/src/components/TriggerEditor/TriggerEditor.tsx +110 -48
- 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/containers/TriggerSettings/TriggerSettings.tsx +26 -0
- package/src/containers/TriggerSettings/index.ts +6 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useComputeRuntime.ts +15 -0
- package/src/hooks/useComputeRuntimeCallback.ts +67 -0
- package/src/hooks/useComputeRuntimeService.ts +22 -0
- package/src/hooks/useTriggerRuntimeControls.ts +67 -0
- package/src/index.ts +2 -4
- package/src/meta.ts +8 -7
- 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 +10 -7
- package/src/translations.ts +37 -29
- package/src/types/capabilities.ts +54 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +6 -6
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs +0 -38
- package/dist/lib/browser/AutomationContainer-VZNV2ZQF.mjs.map +0 -7
- package/dist/lib/browser/AutomationPanel-ZWA6GOFY.mjs +0 -11
- package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs +0 -39
- package/dist/lib/browser/FunctionsContainer-IOB333TX.mjs.map +0 -7
- package/dist/lib/browser/FunctionsPanel-56ZKRVM5.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-ZTAUTFI4.mjs.map +0 -7
- package/dist/lib/browser/chunk-ECSTS2UI.mjs +0 -14
- package/dist/lib/browser/chunk-ECSTS2UI.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERTIGJYE.mjs +0 -147
- package/dist/lib/browser/chunk-ERTIGJYE.mjs.map +0 -7
- package/dist/lib/browser/chunk-FSJZXTS2.mjs +0 -230
- package/dist/lib/browser/chunk-FSJZXTS2.mjs.map +0 -7
- package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
- package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
- package/dist/lib/browser/chunk-HN7OHFCB.mjs +0 -38
- package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
- package/dist/lib/browser/chunk-LYJVTIVD.mjs +0 -94
- package/dist/lib/browser/chunk-LYJVTIVD.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-U3ZAQEFW.mjs +0 -76
- package/dist/lib/browser/intent-resolver-U3ZAQEFW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4DFSM7OX.mjs +0 -64
- package/dist/lib/browser/react-surface-4DFSM7OX.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs +0 -39
- package/dist/lib/node-esm/AutomationContainer-WMIH3F4V.mjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-YYUMSK2W.mjs +0 -12
- package/dist/lib/node-esm/AutomationPanel-YYUMSK2W.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs +0 -40
- package/dist/lib/node-esm/FunctionsContainer-DJWB6WFH.mjs.map +0 -7
- package/dist/lib/node-esm/FunctionsPanel-KGIOZSPZ.mjs +0 -11
- package/dist/lib/node-esm/FunctionsPanel-KGIOZSPZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs +0 -81
- package/dist/lib/node-esm/app-graph-builder-3FP63ZSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AZH66CED.mjs +0 -231
- package/dist/lib/node-esm/chunk-AZH66CED.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HIMYPGHF.mjs +0 -148
- package/dist/lib/node-esm/chunk-HIMYPGHF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
- package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs +0 -39
- package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SGZPTJ47.mjs +0 -16
- package/dist/lib/node-esm/chunk-SGZPTJ47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs +0 -95
- package/dist/lib/node-esm/chunk-ZGPUV5VS.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-3QWXEBPX.mjs +0 -77
- package/dist/lib/node-esm/intent-resolver-3QWXEBPX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs +0 -65
- package/dist/lib/node-esm/react-surface-3PNW7NDW.mjs.map +0 -7
- 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/components/AutomationContainer.d.ts +0 -5
- package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
- package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -72
- package/src/components/AutomationContainer.tsx +0 -30
- package/src/components/FunctionsContainer.tsx +0 -31
- /package/dist/lib/browser/{AutomationPanel-ZWA6GOFY.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/FunctionsPanel-56ZKRVM5.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
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 { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { FunctionsPanel } from '../../components/FunctionsPanel';
|
|
12
|
+
import { FunctionsRegistry } from '../../components/FunctionsRegistry';
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
|
|
15
|
+
export const FunctionsContainer = ({ space }: { space: Space }) => {
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
|
+
return (
|
|
18
|
+
<Settings.Viewport>
|
|
19
|
+
<Settings.Section
|
|
20
|
+
title={t('functions-verbose.label', { ns: meta.id })}
|
|
21
|
+
description={t('functions.description', { ns: meta.id })}
|
|
22
|
+
>
|
|
23
|
+
<FunctionsPanel space={space} />
|
|
24
|
+
</Settings.Section>
|
|
25
|
+
<Settings.Section
|
|
26
|
+
title={t('functions-registry-verbose.label', { ns: meta.id })}
|
|
27
|
+
description={t('functions-registry.description', { ns: meta.id })}
|
|
28
|
+
>
|
|
29
|
+
<FunctionsRegistry space={space} />
|
|
30
|
+
</Settings.Section>
|
|
31
|
+
</Settings.Viewport>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Database } from '@dxos/echo';
|
|
8
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { useTriggerRuntimeControls } from '#hooks';
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
export const TriggersSettings = ({ db }: { db: Database.Database }) => {
|
|
15
|
+
const { state, start, stop } = useTriggerRuntimeControls(db);
|
|
16
|
+
const isRunning = state?.enabled ?? false;
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
|
|
21
|
+
<Settings.Item title={t('runtime.label')} description={t('runtime.description')}>
|
|
22
|
+
<Input.Switch classNames='justify-self-end' checked={isRunning} onCheckedChange={isRunning ? stop : start} />
|
|
23
|
+
</Settings.Item>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const AutomationSettings: ComponentType<any> = lazy(() => import('./AutomationSettings'));
|
|
8
|
+
export const FunctionsContainer: ComponentType<any> = lazy(() => import('./FunctionsContainer'));
|
|
9
|
+
export const TriggerSettings: ComponentType<any> = lazy(() => import('./TriggerSettings'));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
6
|
+
import { AutomationCapabilities } from '../types';
|
|
7
|
+
import { SpaceId } from '@dxos/keys';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the compute runtime for a space.
|
|
11
|
+
*/
|
|
12
|
+
export const useComputeRuntime = (id: SpaceId | undefined): AutomationCapabilities.ComputeRuntime | undefined => {
|
|
13
|
+
const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
14
|
+
return id !== undefined ? computeRuntime.getRuntime(id) : undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Cause from 'effect/Cause';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Exit from 'effect/Exit';
|
|
8
|
+
import { type DependencyList, useCallback } from 'react';
|
|
9
|
+
|
|
10
|
+
import { type Key } from '@dxos/echo';
|
|
11
|
+
import { FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
12
|
+
import { type Operation } from '@dxos/operation';
|
|
13
|
+
import { log } from '@dxos/log';
|
|
14
|
+
|
|
15
|
+
import { AutomationCapabilities } from '#types';
|
|
16
|
+
import { useComputeRuntime } from './useComputeRuntime';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create an effectful function that has access to compute services
|
|
20
|
+
*/
|
|
21
|
+
// TODO(burdon): Factor out (figure out cross-plugin capabilities dependencies).
|
|
22
|
+
export const useComputeRuntimeCallback = <T>(
|
|
23
|
+
id: Key.SpaceId | undefined,
|
|
24
|
+
fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,
|
|
25
|
+
deps?: DependencyList,
|
|
26
|
+
): (() => Promise<T>) => {
|
|
27
|
+
const runtime = useComputeRuntime(id);
|
|
28
|
+
|
|
29
|
+
return useCallback(() => {
|
|
30
|
+
if (!runtime) {
|
|
31
|
+
throw new TypeError('Space not provided to useComputeRuntimeCallback');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return runtime.runPromise(fn());
|
|
35
|
+
}, [runtime, ...(deps ?? [])]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// TODO(wittjosiah): Function invoking should automatically be traced (DX-647).
|
|
39
|
+
export const invokeFunctionWithTracing = <I, O>(functionDef: Operation.Definition<I, O, any>, inputData: I) =>
|
|
40
|
+
Effect.gen(function* () {
|
|
41
|
+
const tracer = yield* TracingService;
|
|
42
|
+
const trace = yield* tracer.traceInvocationStart({
|
|
43
|
+
target: undefined,
|
|
44
|
+
payload: {
|
|
45
|
+
data: {},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Invoke the function.
|
|
50
|
+
const result = yield* FunctionInvocationService.invokeFunction(functionDef, inputData).pipe(
|
|
51
|
+
Effect.provide(trace.invocationTraceQueue ? TracingService.layerInvocation(trace) : TracingService.layerNoop),
|
|
52
|
+
Effect.exit,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (Exit.isFailure(result)) {
|
|
56
|
+
const error = Cause.prettyErrors(result.cause)[0];
|
|
57
|
+
log.error(error.message, error.cause ?? error.stack);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
yield* tracer.traceInvocationEnd({
|
|
61
|
+
trace,
|
|
62
|
+
// TODO(dmaretskyi): Might miss errors.
|
|
63
|
+
exception: Exit.isFailure(result) ? Cause.prettyErrors(result.cause)[0] : undefined,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SpaceId } from '@dxos/keys';
|
|
6
|
+
import { AutomationCapabilities } from '../types';
|
|
7
|
+
import * as Context from 'effect/Context';
|
|
8
|
+
import { useComputeRuntime } from './useComputeRuntime';
|
|
9
|
+
import { use } from 'react';
|
|
10
|
+
import { unwrapExit } from '@dxos/effect';
|
|
11
|
+
import { useMemo } from 'react';
|
|
12
|
+
|
|
13
|
+
export const useComputeRuntimeService = <T extends Context.Tag<any, any>>(
|
|
14
|
+
tag: T,
|
|
15
|
+
spaceId?: SpaceId,
|
|
16
|
+
): (Context.Tag.Service<T> & AutomationCapabilities.ComputeRuntime) | undefined => {
|
|
17
|
+
const runtime = useComputeRuntime(spaceId);
|
|
18
|
+
if (!runtime) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return unwrapExit(use(useMemo(() => runtime.runPromiseExit(tag), [runtime, tag])));
|
|
22
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import type * as Context from 'effect/Context';
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import { type Database, Filter } from '@dxos/echo';
|
|
11
|
+
import { Trigger } from '@dxos/functions';
|
|
12
|
+
import { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';
|
|
13
|
+
import { useQuery } from '@dxos/react-client/echo';
|
|
14
|
+
|
|
15
|
+
import { useComputeRuntimeCallback } from './useComputeRuntimeCallback';
|
|
16
|
+
|
|
17
|
+
interface TriggerRuntimeControls {
|
|
18
|
+
triggers: Trigger.Trigger[];
|
|
19
|
+
|
|
20
|
+
state: TriggerDispatcherState | undefined;
|
|
21
|
+
|
|
22
|
+
start: () => void;
|
|
23
|
+
stop: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
|
|
27
|
+
const triggers = useQuery(db, Filter.type(Trigger.Trigger));
|
|
28
|
+
|
|
29
|
+
const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);
|
|
30
|
+
|
|
31
|
+
const init = useComputeRuntimeCallback(
|
|
32
|
+
db?.spaceId,
|
|
33
|
+
Effect.fnUntraced(function* () {
|
|
34
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
35
|
+
setDispatcher(dispatcher);
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
void init();
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));
|
|
44
|
+
|
|
45
|
+
const start = useComputeRuntimeCallback(
|
|
46
|
+
db?.spaceId,
|
|
47
|
+
Effect.fnUntraced(function* () {
|
|
48
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
49
|
+
yield* dispatcher.start();
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const stop = useComputeRuntimeCallback(
|
|
54
|
+
db?.spaceId,
|
|
55
|
+
Effect.fnUntraced(function* () {
|
|
56
|
+
const dispatcher = yield* TriggerDispatcher;
|
|
57
|
+
yield* dispatcher.stop();
|
|
58
|
+
}),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
triggers,
|
|
63
|
+
state,
|
|
64
|
+
start: () => void start(),
|
|
65
|
+
stop: () => void stop(),
|
|
66
|
+
};
|
|
67
|
+
};
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: AUTOMATION_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.automation',
|
|
11
10
|
name: 'Automation',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Workflow automation engine that triggers custom actions based on object events and conditions.
|
|
13
|
+
Create automated pipelines that respond to changes and streamline repetitive tasks.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--robot--regular',
|
|
15
16
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
|
|
16
17
|
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { LayoutOperation, getSpacePath } from '@dxos/app-toolkit';
|
|
8
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
9
|
+
import { Script, Trigger } from '@dxos/functions';
|
|
10
|
+
import { type DXN } from '@dxos/keys';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
13
|
+
import { Filter } from '@dxos/react-client/echo';
|
|
14
|
+
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
import { CreateTriggerFromTemplate } from './definitions';
|
|
17
|
+
|
|
18
|
+
const handler: Operation.WithHandler<typeof CreateTriggerFromTemplate> = CreateTriggerFromTemplate.pipe(
|
|
19
|
+
Operation.withHandler(
|
|
20
|
+
Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
|
|
21
|
+
const trigger = Trigger.make({ enabled, input });
|
|
22
|
+
|
|
23
|
+
// TODO(wittjosiah): Factor out function lookup by script name?
|
|
24
|
+
if (scriptName) {
|
|
25
|
+
const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, { name: scriptName })).run());
|
|
26
|
+
const [script] = scripts;
|
|
27
|
+
if (script) {
|
|
28
|
+
const functions = yield* Effect.promise(() =>
|
|
29
|
+
db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(script) })).run(),
|
|
30
|
+
);
|
|
31
|
+
const [fn] = functions;
|
|
32
|
+
if (fn) {
|
|
33
|
+
Obj.change(trigger, (obj) => {
|
|
34
|
+
obj.function = Ref.make(fn);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
switch (template.type) {
|
|
41
|
+
case 'timer': {
|
|
42
|
+
Obj.change(trigger, (obj) => {
|
|
43
|
+
obj.spec = { kind: 'timer', cron: template.cron };
|
|
44
|
+
});
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'queue': {
|
|
48
|
+
Obj.change(trigger, (obj) => {
|
|
49
|
+
obj.spec = {
|
|
50
|
+
kind: 'queue',
|
|
51
|
+
queue: (template.queueDXN as DXN).toString(),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
default: {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
62
|
+
object: trigger,
|
|
63
|
+
target: db,
|
|
64
|
+
hidden: true,
|
|
65
|
+
});
|
|
66
|
+
yield* Operation.invoke(LayoutOperation.Open, {
|
|
67
|
+
subject: [`${getSpacePath(db.spaceId)}/settings/${meta.id}.automations`],
|
|
68
|
+
workspace: getSpacePath(db.spaceId),
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
export default handler;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Database } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { TriggerTemplate } from '../types';
|
|
13
|
+
|
|
14
|
+
const AUTOMATION_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
|
|
16
|
+
export const CreateTriggerFromTemplate = Operation.make({
|
|
17
|
+
meta: { key: `${AUTOMATION_OPERATION}.create-trigger-from-template`, name: 'Create Trigger From Template' },
|
|
18
|
+
services: [Capability.Service],
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
db: Database.Database,
|
|
21
|
+
template: TriggerTemplate,
|
|
22
|
+
enabled: Schema.optional(Schema.Boolean),
|
|
23
|
+
scriptName: Schema.optional(Schema.String),
|
|
24
|
+
input: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
25
|
+
}),
|
|
26
|
+
output: Schema.Void,
|
|
27
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
6
|
+
|
|
7
|
+
export * as AutomationOperation from './definitions';
|
|
8
|
+
|
|
9
|
+
export const AutomationOperationHandlerSet = OperationHandlerSet.lazy(() => import('./create-trigger-from-template'));
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { TestSchema } from '@dxos/client/testing';
|
|
8
|
+
import { JsonSchema, Ref } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
export const functions = [
|
|
11
11
|
{
|
|
12
|
+
key: 'example.com/function/chess',
|
|
12
13
|
name: 'example.com/function/chess',
|
|
13
14
|
version: '0.1.0',
|
|
14
|
-
inputSchema:
|
|
15
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
15
16
|
Schema.Struct({
|
|
16
17
|
level: Schema.Number.annotations({
|
|
17
18
|
title: 'Level',
|
|
@@ -20,10 +21,11 @@ export const functions = [
|
|
|
20
21
|
),
|
|
21
22
|
},
|
|
22
23
|
{
|
|
24
|
+
key: 'example.com/function/forex',
|
|
23
25
|
name: 'example.com/function/forex',
|
|
24
26
|
version: '0.1.0',
|
|
25
27
|
binding: 'FOREX',
|
|
26
|
-
inputSchema:
|
|
28
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
27
29
|
Schema.Struct({
|
|
28
30
|
from: Schema.String.annotations({ title: 'Currency from' }),
|
|
29
31
|
to: Schema.String.annotations({ title: 'Currency to' }),
|
|
@@ -31,11 +33,12 @@ export const functions = [
|
|
|
31
33
|
),
|
|
32
34
|
},
|
|
33
35
|
{
|
|
36
|
+
key: 'example.com/function/ping-contact',
|
|
34
37
|
name: 'example.com/function/ping-contact',
|
|
35
38
|
version: '0.0.1',
|
|
36
|
-
inputSchema:
|
|
39
|
+
inputSchema: JsonSchema.toJsonSchema(
|
|
37
40
|
Schema.Struct({
|
|
38
|
-
contact:
|
|
41
|
+
contact: Ref.Ref(TestSchema.ContactType).annotations({ title: 'Contact' }),
|
|
39
42
|
}),
|
|
40
43
|
),
|
|
41
44
|
},
|
package/src/translations.ts
CHANGED
|
@@ -4,40 +4,48 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'automation
|
|
15
|
-
'script
|
|
16
|
-
'automation
|
|
17
|
-
'automation
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
|
|
31
|
-
'
|
|
32
|
-
|
|
33
|
-
'trigger
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'trigger
|
|
37
|
-
|
|
38
|
-
'trigger
|
|
39
|
-
'trigger
|
|
40
|
-
'trigger
|
|
13
|
+
'plugin.name': 'Automation',
|
|
14
|
+
'automation-panel.label': 'Automations',
|
|
15
|
+
'script-automation.label': 'Automation',
|
|
16
|
+
'automation-verbose.label': 'Manage automations',
|
|
17
|
+
'automation.description': 'You can manage all the triggers which automate your space here.',
|
|
18
|
+
|
|
19
|
+
'runtime.label': 'Enable Local Runtime',
|
|
20
|
+
'runtime.description':
|
|
21
|
+
'This will start a trigger dispatcher locally for this space to run triggers on your device while Composer is running.',
|
|
22
|
+
|
|
23
|
+
'functions-panel.label': 'Functions',
|
|
24
|
+
'functions-verbose.label': 'Manage deployed functions',
|
|
25
|
+
'functions-registry-verbose.label': 'Functions registry',
|
|
26
|
+
'functions-registry.description': 'Import functions from the registry',
|
|
27
|
+
'functions.description': 'You can manage all the functions deployed from your space on EDGE here.',
|
|
28
|
+
'show-source-button.label': 'Show source',
|
|
29
|
+
'delete-function-button.label': 'Delete function',
|
|
30
|
+
|
|
31
|
+
'function-parameters.label': 'Function parameters',
|
|
32
|
+
|
|
33
|
+
'trigger-editor.title': 'Configure Trigger',
|
|
34
|
+
'trigger-editor.description':
|
|
35
|
+
'Triggers are used to run functions at specific times or when specific events occur.',
|
|
36
|
+
'new-trigger.label': 'Add Trigger',
|
|
37
|
+
|
|
38
|
+
'trigger-type.timer.label': 'Timer',
|
|
39
|
+
'trigger-type.webhook.label': 'Webhook',
|
|
40
|
+
'trigger-type.websocket.label': 'Websocket',
|
|
41
|
+
'trigger-type.subscription.label': 'Subscription',
|
|
42
|
+
'trigger-type.email.label': 'Email',
|
|
43
|
+
'trigger-type.queue.label': 'Feed',
|
|
44
|
+
|
|
45
|
+
'trigger-payload-prop-name.placeholder': 'New payload property name',
|
|
46
|
+
'import-function-button.label': 'Loading...',
|
|
47
|
+
'loading-functions.message': 'Loading functions...',
|
|
48
|
+
'update-function-button.label': 'Update',
|
|
41
49
|
},
|
|
42
50
|
},
|
|
43
51
|
},
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import type * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
6
|
+
|
|
7
|
+
import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type Database, type Feed } from '@dxos/echo';
|
|
10
|
+
import type {
|
|
11
|
+
CredentialsService,
|
|
12
|
+
FunctionInvocationService,
|
|
13
|
+
Process,
|
|
14
|
+
QueueService,
|
|
15
|
+
TracingService,
|
|
16
|
+
} from '@dxos/functions';
|
|
17
|
+
import type { TriggerDispatcher, TriggerStateStore } from '@dxos/functions-runtime';
|
|
18
|
+
import type { SpaceId } from '@dxos/keys';
|
|
19
|
+
import type { Blueprint } from '@dxos/blueprints';
|
|
20
|
+
import { AgentService } from '@dxos/assistant';
|
|
21
|
+
|
|
22
|
+
import { meta } from '#meta';
|
|
23
|
+
|
|
24
|
+
export namespace AutomationCapabilities {
|
|
25
|
+
/**
|
|
26
|
+
* Service stack for executing agents, functions, and triggers.
|
|
27
|
+
*/
|
|
28
|
+
export type ComputeServices =
|
|
29
|
+
| TriggerDispatcher
|
|
30
|
+
| TriggerStateStore
|
|
31
|
+
| AiService.AiService
|
|
32
|
+
| Database.Service
|
|
33
|
+
| Feed.Service
|
|
34
|
+
| QueueService
|
|
35
|
+
| CredentialsService
|
|
36
|
+
| Blueprint.RegistryService
|
|
37
|
+
| AgentService.AgentService
|
|
38
|
+
| Process.ProcessMonitorService
|
|
39
|
+
| TracingService // TODO(dmaretskyi): Probably should not be provided here.
|
|
40
|
+
| FunctionInvocationService // TODO(dmaretskyi): Deprecated
|
|
41
|
+
// TODO(dmaretskyi): Those should be provided at AI-chat call site.
|
|
42
|
+
| ToolResolverService
|
|
43
|
+
| ToolExecutionService;
|
|
44
|
+
|
|
45
|
+
export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;
|
|
46
|
+
export interface ComputeRuntimeProvider {
|
|
47
|
+
getRuntime(spaceId: SpaceId): ComputeRuntime;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Runtime for executing agents, functions, and triggers.
|
|
52
|
+
*/
|
|
53
|
+
export const ComputeRuntime = Capability.make<ComputeRuntimeProvider>(`${meta.id}.capability.compute-runtime`);
|
|
54
|
+
}
|
|
@@ -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
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Database } from '@dxos/echo';
|
|
8
8
|
|
|
9
|
-
import { meta } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
10
|
|
|
11
|
-
const TriggerTemplate = Schema.Union(
|
|
11
|
+
export const TriggerTemplate = Schema.Union(
|
|
12
12
|
Schema.Struct({ type: Schema.Literal('timer'), cron: Schema.String }),
|
|
13
13
|
Schema.Struct({ type: Schema.Literal('queue'), queueDXN: Schema.Any }),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
export namespace AutomationAction {
|
|
17
17
|
export class CreateTriggerFromTemplate extends Schema.TaggedClass<CreateTriggerFromTemplate>()(
|
|
18
|
-
`${meta.id}
|
|
18
|
+
`${meta.id}.action.create-trigger-from-template`,
|
|
19
19
|
{
|
|
20
20
|
input: Schema.Struct({
|
|
21
|
-
|
|
21
|
+
db: Database.Database,
|
|
22
22
|
template: TriggerTemplate,
|
|
23
23
|
enabled: Schema.optional(Schema.Boolean),
|
|
24
24
|
// TODO(wittjosiah): Improve how this lookup is done.
|