@dxos/plugin-conductor 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/README.md +7 -3
- package/dist/lib/browser/index.mjs +72 -75
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +72 -74
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/ConductorPlugin.d.ts +2 -1
- package/dist/types/src/ConductorPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- 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/components/index.d.ts +0 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/CanvasContainer/CanvasContainer.d.ts +6 -0
- package/dist/types/src/containers/CanvasContainer/CanvasContainer.d.ts.map +1 -0
- package/dist/types/src/containers/CanvasContainer/index.d.ts +3 -0
- package/dist/types/src/containers/CanvasContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +14 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +50 -47
- package/src/ConductorPlugin.tsx +38 -55
- package/src/capabilities/index.ts +2 -3
- package/src/capabilities/react-surface.tsx +20 -14
- package/src/components/index.ts +1 -5
- package/src/{components → containers/CanvasContainer}/CanvasContainer.tsx +48 -51
- package/src/containers/CanvasContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/meta.ts +9 -7
- package/src/translations.ts +14 -12
- package/src/types/index.ts +0 -2
- package/dist/lib/browser/CanvasContainer-ZH5SFXCO.mjs +0 -97
- package/dist/lib/browser/CanvasContainer-ZH5SFXCO.mjs.map +0 -7
- package/dist/lib/browser/chunk-3AGZDOYQ.mjs +0 -21
- package/dist/lib/browser/chunk-3AGZDOYQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-IFYNDE3Z.mjs +0 -25
- package/dist/lib/browser/chunk-IFYNDE3Z.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-7OILSFLQ.mjs +0 -34
- package/dist/lib/browser/intent-resolver-7OILSFLQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-EDDAESDD.mjs +0 -31
- package/dist/lib/browser/react-surface-EDDAESDD.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -8
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node-esm/CanvasContainer-T5LXU3YB.mjs +0 -99
- package/dist/lib/node-esm/CanvasContainer-T5LXU3YB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ELHUFMCW.mjs +0 -26
- package/dist/lib/node-esm/chunk-ELHUFMCW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TL52TWDT.mjs +0 -23
- package/dist/lib/node-esm/chunk-TL52TWDT.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-U3TIHMS2.mjs +0 -35
- package/dist/lib/node-esm/intent-resolver-U3TIHMS2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-UFIHQSHX.mjs +0 -32
- package/dist/lib/node-esm/react-surface-UFIHQSHX.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -9
- package/dist/lib/node-esm/types/index.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/CanvasContainer.d.ts +0 -8
- package/dist/types/src/components/CanvasContainer.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -18
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -27
- package/src/types/schema.ts +0 -20
package/package.json
CHANGED
|
@@ -1,74 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-conductor",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "Composer plugin for conductor.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#capabilities": "./src/capabilities/index.ts",
|
|
17
|
+
"#components": "./src/components/index.ts",
|
|
18
|
+
"#containers": "./src/containers/index.ts",
|
|
19
|
+
"#meta": "./src/meta.ts",
|
|
20
|
+
"#types": "./src/types/index.ts"
|
|
21
|
+
},
|
|
11
22
|
"exports": {
|
|
12
23
|
".": {
|
|
13
|
-
"
|
|
24
|
+
"source": "./src/index.ts",
|
|
14
25
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
|
-
|
|
17
|
-
"./types": {
|
|
18
|
-
"types": "./dist/types/src/types/index.d.ts",
|
|
19
|
-
"browser": "./dist/lib/browser/types/index.mjs",
|
|
20
|
-
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
26
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
27
|
+
"types": "./dist/types/src/index.d.ts"
|
|
21
28
|
}
|
|
22
29
|
},
|
|
23
30
|
"types": "dist/types/src/index.d.ts",
|
|
24
|
-
"typesVersions": {
|
|
25
|
-
"*": {
|
|
26
|
-
"types": [
|
|
27
|
-
"dist/types/src/types/index.d.ts"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
33
|
"src"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
40
|
-
"@dxos/assistant": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/functions": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/plugin-
|
|
51
|
-
"@dxos/react-client": "0.8.4-main.
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/react-ui-canvas-
|
|
54
|
-
"@dxos/react-ui-
|
|
36
|
+
"effect": "3.20.0",
|
|
37
|
+
"@dxos/ai": "0.8.4-main.bcb3aa67d6",
|
|
38
|
+
"@dxos/app-toolkit": "0.8.4-main.bcb3aa67d6",
|
|
39
|
+
"@dxos/app-framework": "0.8.4-main.bcb3aa67d6",
|
|
40
|
+
"@dxos/assistant": "0.8.4-main.bcb3aa67d6",
|
|
41
|
+
"@dxos/conductor": "0.8.4-main.bcb3aa67d6",
|
|
42
|
+
"@dxos/echo": "0.8.4-main.bcb3aa67d6",
|
|
43
|
+
"@dxos/debug": "0.8.4-main.bcb3aa67d6",
|
|
44
|
+
"@dxos/edge-client": "0.8.4-main.bcb3aa67d6",
|
|
45
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
46
|
+
"@dxos/functions-runtime": "0.8.4-main.bcb3aa67d6",
|
|
47
|
+
"@dxos/operation": "0.8.4-main.bcb3aa67d6",
|
|
48
|
+
"@dxos/plugin-automation": "0.8.4-main.bcb3aa67d6",
|
|
49
|
+
"@dxos/functions": "0.8.4-main.bcb3aa67d6",
|
|
50
|
+
"@dxos/plugin-space": "0.8.4-main.bcb3aa67d6",
|
|
51
|
+
"@dxos/react-client": "0.8.4-main.bcb3aa67d6",
|
|
52
|
+
"@dxos/plugin-client": "0.8.4-main.bcb3aa67d6",
|
|
53
|
+
"@dxos/react-ui-canvas-compute": "0.8.4-main.bcb3aa67d6",
|
|
54
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.bcb3aa67d6",
|
|
55
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.bcb3aa67d6",
|
|
56
|
+
"@dxos/react-ui-stack": "0.8.4-main.bcb3aa67d6",
|
|
57
|
+
"@dxos/util": "0.8.4-main.bcb3aa67d6"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@types/react": "~
|
|
58
|
-
"@types/react-dom": "~
|
|
59
|
-
"react": "~
|
|
60
|
-
"react-dom": "~
|
|
61
|
-
"vite": "
|
|
62
|
-
"@dxos/react-ui
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
60
|
+
"@types/react": "~19.2.7",
|
|
61
|
+
"@types/react-dom": "~19.2.3",
|
|
62
|
+
"react": "~19.2.3",
|
|
63
|
+
"react-dom": "~19.2.3",
|
|
64
|
+
"vite": "^7.1.11",
|
|
65
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
66
|
+
"@dxos/storybook-utils": "0.8.4-main.bcb3aa67d6",
|
|
67
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
65
68
|
},
|
|
66
69
|
"peerDependencies": {
|
|
67
|
-
"effect": "
|
|
68
|
-
"react": "~
|
|
69
|
-
"react-dom": "~
|
|
70
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
71
|
-
"@dxos/
|
|
70
|
+
"effect": "3.20.0",
|
|
71
|
+
"react": "~19.2.3",
|
|
72
|
+
"react-dom": "~19.2.3",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
74
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
72
75
|
},
|
|
73
76
|
"publishConfig": {
|
|
74
77
|
"access": "public"
|
package/src/ConductorPlugin.tsx
CHANGED
|
@@ -2,62 +2,45 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
|
|
8
|
+
import { Plugin } from '@dxos/app-framework';
|
|
9
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
10
|
+
import { Annotation } from '@dxos/echo';
|
|
6
11
|
import { ComputeGraph } from '@dxos/conductor';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { CanvasBoardType } from '@dxos/react-ui-canvas-editor';
|
|
12
|
+
import { Operation } from '@dxos/operation';
|
|
13
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
14
|
+
import { SpaceOperation } from '@dxos/plugin-space/operations';
|
|
15
|
+
import { CanvasBoard } from '@dxos/react-ui-canvas-editor';
|
|
12
16
|
|
|
13
|
-
import {
|
|
14
|
-
import { meta } from './meta';
|
|
17
|
+
import { meta } from '#meta';
|
|
15
18
|
import { translations } from './translations';
|
|
16
|
-
import { ConductorAction } from './types';
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
),
|
|
47
|
-
}),
|
|
48
|
-
defineModule({
|
|
49
|
-
id: `${meta.id}/module/schema`,
|
|
50
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
51
|
-
activate: () => contributes(ClientCapabilities.Schema, [ComputeGraph, FunctionTrigger]),
|
|
52
|
-
}),
|
|
53
|
-
defineModule({
|
|
54
|
-
id: `${meta.id}/module/react-surface`,
|
|
55
|
-
activatesOn: Events.SetupReactSurface,
|
|
56
|
-
activate: ReactSurface,
|
|
57
|
-
}),
|
|
58
|
-
defineModule({
|
|
59
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
60
|
-
activatesOn: Events.SetupIntentResolver,
|
|
61
|
-
activate: IntentResolver,
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
20
|
+
import { ReactSurface } from '#capabilities';
|
|
21
|
+
|
|
22
|
+
export const ConductorPlugin = Plugin.define(meta).pipe(
|
|
23
|
+
AppPlugin.addMetadataModule({
|
|
24
|
+
metadata: {
|
|
25
|
+
id: CanvasBoard.CanvasBoard.typename,
|
|
26
|
+
metadata: {
|
|
27
|
+
icon: Annotation.IconAnnotation.get(CanvasBoard.CanvasBoard).pipe(Option.getOrThrow).icon,
|
|
28
|
+
iconHue: Annotation.IconAnnotation.get(CanvasBoard.CanvasBoard).pipe(Option.getOrThrow).hue ?? 'white',
|
|
29
|
+
createObject: ((props, options) =>
|
|
30
|
+
Effect.gen(function* () {
|
|
31
|
+
const object = CanvasBoard.make(props);
|
|
32
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
33
|
+
object,
|
|
34
|
+
target: options.target,
|
|
35
|
+
hidden: true,
|
|
36
|
+
targetNodeId: options.targetNodeId,
|
|
37
|
+
});
|
|
38
|
+
})) satisfies CreateObject,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
AppPlugin.addSchemaModule({ schema: [CanvasBoard.CanvasBoard, ComputeGraph] }),
|
|
43
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
44
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
45
|
+
Plugin.make,
|
|
46
|
+
);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
7
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
@@ -2,22 +2,28 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { Capabilities,
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
10
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import {
|
|
11
|
+
import { CanvasBoard } from '@dxos/react-ui-canvas-editor';
|
|
10
12
|
|
|
11
|
-
import { CanvasContainer } from '
|
|
12
|
-
import {
|
|
13
|
+
import { CanvasContainer } from '#containers';
|
|
14
|
+
import { meta } from '#meta';
|
|
13
15
|
|
|
14
|
-
export default () =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(
|
|
19
|
+
Capabilities.ReactSurface,
|
|
20
|
+
Surface.create({
|
|
21
|
+
id: meta.id,
|
|
22
|
+
role: ['article', 'section'],
|
|
23
|
+
filter: (data): data is { subject: CanvasBoard.CanvasBoard } =>
|
|
24
|
+
Obj.instanceOf(CanvasBoard.CanvasBoard, data.subject),
|
|
25
|
+
component: ({ data, role }) => <CanvasContainer role={role} subject={data.subject} />,
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
);
|
package/src/components/index.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import React, { Fragment, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type
|
|
7
|
+
import { useCapability } from '@dxos/app-framework/ui';
|
|
8
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { ComputeGraphModel } from '@dxos/conductor';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { AutomationCapabilities } from '@dxos/plugin-automation/types';
|
|
12
|
+
import { useObject } from '@dxos/react-client/echo';
|
|
13
|
+
import { Flex, type FlexProps } from '@dxos/react-ui';
|
|
14
14
|
import {
|
|
15
15
|
ComputeContext,
|
|
16
16
|
ComputeGraphController,
|
|
@@ -21,55 +21,23 @@ import {
|
|
|
21
21
|
useGraphMonitor,
|
|
22
22
|
} from '@dxos/react-ui-canvas-compute';
|
|
23
23
|
import {
|
|
24
|
-
type
|
|
24
|
+
type CanvasBoard,
|
|
25
25
|
CanvasGraphModel,
|
|
26
26
|
Editor,
|
|
27
27
|
type EditorController,
|
|
28
28
|
KeyboardContainer,
|
|
29
29
|
ShapeRegistry,
|
|
30
30
|
} from '@dxos/react-ui-canvas-editor';
|
|
31
|
-
import { StackItem } from '@dxos/react-ui-stack';
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
return new ServiceContainer().setServices({
|
|
35
|
-
database: space == null ? undefined : DatabaseService.make(space.db),
|
|
36
|
-
queues: space == null ? undefined : QueueService.make(space.queues, undefined),
|
|
37
|
-
ai:
|
|
38
|
-
config.values.runtime?.services?.ai?.server == null
|
|
39
|
-
? undefined
|
|
40
|
-
: AiService.make(todo(`new Edge AiServiceClient({ endpoint: config.values.runtime?.services?.ai?.server })`)),
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const useGraphController = (canvas: CanvasBoardType) => {
|
|
45
|
-
const config = useConfig();
|
|
46
|
-
const space = getSpace(canvas);
|
|
47
|
-
const controller = useMemo(() => {
|
|
48
|
-
if (!canvas.computeGraph?.target) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const model = new ComputeGraphModel(canvas.computeGraph?.target);
|
|
52
|
-
const controller = new ComputeGraphController(createServices(config, space), model);
|
|
53
|
-
return controller;
|
|
54
|
-
}, [canvas.computeGraph?.target, space]);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!controller) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
32
|
+
export type CanvasContainerProps = ObjectSurfaceProps<CanvasBoard.CanvasBoard>;
|
|
60
33
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const CanvasContainer = ({ canvas, role }: { canvas: CanvasBoardType; role: string }) => {
|
|
71
|
-
const id = fullyQualifiedId(canvas);
|
|
72
|
-
const graph = useMemo(() => CanvasGraphModel.create<ComputeShape>(canvas.layout), [canvas.layout]);
|
|
34
|
+
export const CanvasContainer = ({ role, subject: canvas }: CanvasContainerProps) => {
|
|
35
|
+
const id = Obj.getDXN(canvas as any).toString();
|
|
36
|
+
useObject(canvas);
|
|
37
|
+
const graph = useMemo(
|
|
38
|
+
() => CanvasGraphModel.create<ComputeShape>(canvas.layout, (fn) => Obj.change(canvas, fn)),
|
|
39
|
+
[canvas],
|
|
40
|
+
);
|
|
73
41
|
const controller = useGraphController(canvas);
|
|
74
42
|
const graphMonitor = useGraphMonitor(controller?.graph);
|
|
75
43
|
const registry = useMemo(() => new ShapeRegistry(computeShapes), []);
|
|
@@ -86,9 +54,11 @@ export const CanvasContainer = ({ canvas, role }: { canvas: CanvasBoardType; rol
|
|
|
86
54
|
return;
|
|
87
55
|
}
|
|
88
56
|
|
|
57
|
+
const Root = role === 'section' ? Container : Fragment;
|
|
58
|
+
|
|
89
59
|
return (
|
|
90
60
|
<ComputeContext.Provider value={{ controller }}>
|
|
91
|
-
<
|
|
61
|
+
<Root>
|
|
92
62
|
<KeyboardContainer id={id}>
|
|
93
63
|
<Editor.Root
|
|
94
64
|
id={id}
|
|
@@ -102,9 +72,36 @@ export const CanvasContainer = ({ canvas, role }: { canvas: CanvasBoardType; rol
|
|
|
102
72
|
<Editor.UI showTools />
|
|
103
73
|
</Editor.Root>
|
|
104
74
|
</KeyboardContainer>
|
|
105
|
-
</
|
|
75
|
+
</Root>
|
|
106
76
|
</ComputeContext.Provider>
|
|
107
77
|
);
|
|
108
78
|
};
|
|
109
79
|
|
|
110
|
-
|
|
80
|
+
const Container = (props: FlexProps) => <Flex {...props} classNames='aspect-square' />;
|
|
81
|
+
|
|
82
|
+
const useGraphController = (canvas: CanvasBoard.CanvasBoard) => {
|
|
83
|
+
const db = Obj.getDatabase(canvas);
|
|
84
|
+
const runtime = useCapability(AutomationCapabilities.ComputeRuntime);
|
|
85
|
+
const [computeGraph] = useObject(canvas.computeGraph);
|
|
86
|
+
const controller = useMemo(() => {
|
|
87
|
+
if (!canvas.computeGraph?.target || !db) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const model = new ComputeGraphModel(canvas.computeGraph?.target);
|
|
91
|
+
const controller = new ComputeGraphController(runtime.getRuntime(db.spaceId), model);
|
|
92
|
+
return controller;
|
|
93
|
+
}, [computeGraph, db]);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!controller) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void controller.open();
|
|
101
|
+
return () => {
|
|
102
|
+
void controller.close();
|
|
103
|
+
};
|
|
104
|
+
}, [controller]);
|
|
105
|
+
|
|
106
|
+
return controller;
|
|
107
|
+
};
|
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
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: CONDUCTOR_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.conductor',
|
|
11
10
|
name: 'Conductor',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Visual workflow builder using node-based compute graphs to orchestrate complex AI agent pipelines.
|
|
13
|
+
Connect data sources, transformations, and AI models in a drag-and-drop interface for advanced automation.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--infinity--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
15
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-conductor',
|
|
16
18
|
tags: ['labs'],
|
|
17
19
|
screenshots: ['https://dxos.network/plugin-details-canvas-dark.png'],
|
package/src/translations.ts
CHANGED
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import {
|
|
6
|
+
import { CanvasBoard } from '@dxos/react-ui-canvas-editor';
|
|
7
7
|
|
|
8
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
13
|
+
[CanvasBoard.CanvasBoard.typename]: {
|
|
14
|
+
'typename.label': 'Circuit',
|
|
15
|
+
'typename.label_zero': 'Circuits',
|
|
16
|
+
'typename.label_one': 'Circuit',
|
|
17
|
+
'typename.label_other': 'Circuits',
|
|
18
|
+
'object-name.placeholder': 'New circuit',
|
|
19
|
+
'add-object.label': 'Add circuit',
|
|
20
|
+
'rename-object.label': 'Rename circuit',
|
|
21
|
+
'delete-object.label': 'Delete circuit',
|
|
22
|
+
'object-deleted.label': 'Circuit deleted',
|
|
21
23
|
},
|
|
22
24
|
[meta.id]: {
|
|
23
|
-
'plugin
|
|
24
|
-
'content
|
|
25
|
+
'plugin.name': 'Conductor',
|
|
26
|
+
'content.placeholder': 'Enter text...',
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
29
|
},
|
package/src/types/index.ts
CHANGED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// src/components/CanvasContainer.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React, { useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { AiService } from "@dxos/ai";
|
|
5
|
-
import { ComputeGraphModel } from "@dxos/conductor";
|
|
6
|
-
import { todo } from "@dxos/debug";
|
|
7
|
-
import { DatabaseService, QueueService, ServiceContainer } from "@dxos/functions";
|
|
8
|
-
import { useConfig } from "@dxos/react-client";
|
|
9
|
-
import { fullyQualifiedId, getSpace } from "@dxos/react-client/echo";
|
|
10
|
-
import { ComputeContext, ComputeGraphController, ComputeShapeLayout, computeShapes, useComputeGraphController, useGraphMonitor } from "@dxos/react-ui-canvas-compute";
|
|
11
|
-
import { CanvasGraphModel, Editor, KeyboardContainer, ShapeRegistry } from "@dxos/react-ui-canvas-editor";
|
|
12
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
13
|
-
var createServices = (config, space) => {
|
|
14
|
-
return new ServiceContainer().setServices({
|
|
15
|
-
database: space == null ? void 0 : DatabaseService.make(space.db),
|
|
16
|
-
queues: space == null ? void 0 : QueueService.make(space.queues, void 0),
|
|
17
|
-
ai: config.values.runtime?.services?.ai?.server == null ? void 0 : AiService.make(todo(`new Edge AiServiceClient({ endpoint: config.values.runtime?.services?.ai?.server })`))
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
var useGraphController = (canvas) => {
|
|
21
|
-
const config = useConfig();
|
|
22
|
-
const space = getSpace(canvas);
|
|
23
|
-
const controller = useMemo(() => {
|
|
24
|
-
if (!canvas.computeGraph?.target) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const model = new ComputeGraphModel(canvas.computeGraph?.target);
|
|
28
|
-
const controller2 = new ComputeGraphController(createServices(config, space), model);
|
|
29
|
-
return controller2;
|
|
30
|
-
}, [
|
|
31
|
-
canvas.computeGraph?.target,
|
|
32
|
-
space
|
|
33
|
-
]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!controller) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
void controller.open();
|
|
39
|
-
return () => {
|
|
40
|
-
void controller.close();
|
|
41
|
-
};
|
|
42
|
-
}, [
|
|
43
|
-
controller
|
|
44
|
-
]);
|
|
45
|
-
return controller;
|
|
46
|
-
};
|
|
47
|
-
var CanvasContainer = ({ canvas, role }) => {
|
|
48
|
-
var _effect = _useSignals();
|
|
49
|
-
try {
|
|
50
|
-
const id = fullyQualifiedId(canvas);
|
|
51
|
-
const graph = useMemo(() => CanvasGraphModel.create(canvas.layout), [
|
|
52
|
-
canvas.layout
|
|
53
|
-
]);
|
|
54
|
-
const controller = useGraphController(canvas);
|
|
55
|
-
const graphMonitor = useGraphMonitor(controller?.graph);
|
|
56
|
-
const registry = useMemo(() => new ShapeRegistry(computeShapes), []);
|
|
57
|
-
const editorRef = useRef(null);
|
|
58
|
-
useComputeGraphController({
|
|
59
|
-
controller,
|
|
60
|
-
graph,
|
|
61
|
-
editorRef
|
|
62
|
-
});
|
|
63
|
-
const layout = useMemo(() => controller && registry ? new ComputeShapeLayout(controller, registry) : void 0, [
|
|
64
|
-
controller,
|
|
65
|
-
registry
|
|
66
|
-
]);
|
|
67
|
-
if (!controller) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
return /* @__PURE__ */ React.createElement(ComputeContext.Provider, {
|
|
71
|
-
value: {
|
|
72
|
-
controller
|
|
73
|
-
}
|
|
74
|
-
}, /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
75
|
-
size: role === "section" ? "square" : "intrinsic"
|
|
76
|
-
}, /* @__PURE__ */ React.createElement(KeyboardContainer, {
|
|
77
|
-
id
|
|
78
|
-
}, /* @__PURE__ */ React.createElement(Editor.Root, {
|
|
79
|
-
id,
|
|
80
|
-
ref: editorRef,
|
|
81
|
-
graph,
|
|
82
|
-
graphMonitor,
|
|
83
|
-
registry,
|
|
84
|
-
layout
|
|
85
|
-
}, /* @__PURE__ */ React.createElement(Editor.Canvas, null), /* @__PURE__ */ React.createElement(Editor.UI, {
|
|
86
|
-
showTools: true
|
|
87
|
-
})))));
|
|
88
|
-
} finally {
|
|
89
|
-
_effect.f();
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
var CanvasContainer_default = CanvasContainer;
|
|
93
|
-
export {
|
|
94
|
-
CanvasContainer,
|
|
95
|
-
CanvasContainer_default as default
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=CanvasContainer-ZH5SFXCO.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/CanvasContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useEffect, useMemo, useRef } from 'react';\n\nimport { AiService } from '@dxos/ai';\nimport { type Config } from '@dxos/client';\nimport { ComputeGraphModel } from '@dxos/conductor';\nimport { todo } from '@dxos/debug';\nimport { DatabaseService, QueueService, ServiceContainer } from '@dxos/functions';\nimport { useConfig } from '@dxos/react-client';\nimport { fullyQualifiedId, getSpace, type Space } from '@dxos/react-client/echo';\nimport {\n ComputeContext,\n ComputeGraphController,\n type ComputeShape,\n ComputeShapeLayout,\n computeShapes,\n useComputeGraphController,\n useGraphMonitor,\n} from '@dxos/react-ui-canvas-compute';\nimport {\n type CanvasBoardType,\n CanvasGraphModel,\n Editor,\n type EditorController,\n KeyboardContainer,\n ShapeRegistry,\n} from '@dxos/react-ui-canvas-editor';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nconst createServices = (config: Config, space?: Space): ServiceContainer => {\n return new ServiceContainer().setServices({\n database: space == null ? undefined : DatabaseService.make(space.db),\n queues: space == null ? undefined : QueueService.make(space.queues, undefined),\n ai:\n config.values.runtime?.services?.ai?.server == null\n ? undefined\n : AiService.make(todo(`new Edge AiServiceClient({ endpoint: config.values.runtime?.services?.ai?.server })`)),\n });\n};\n\nconst useGraphController = (canvas: CanvasBoardType) => {\n const config = useConfig();\n const space = getSpace(canvas);\n const controller = useMemo(() => {\n if (!canvas.computeGraph?.target) {\n return null;\n }\n const model = new ComputeGraphModel(canvas.computeGraph?.target);\n const controller = new ComputeGraphController(createServices(config, space), model);\n return controller;\n }, [canvas.computeGraph?.target, space]);\n\n useEffect(() => {\n if (!controller) {\n return;\n }\n\n void controller.open();\n return () => {\n void controller.close();\n };\n }, [controller]);\n\n return controller;\n};\n\nexport const CanvasContainer = ({ canvas, role }: { canvas: CanvasBoardType; role: string }) => {\n const id = fullyQualifiedId(canvas);\n const graph = useMemo(() => CanvasGraphModel.create<ComputeShape>(canvas.layout), [canvas.layout]);\n const controller = useGraphController(canvas);\n const graphMonitor = useGraphMonitor(controller?.graph);\n const registry = useMemo(() => new ShapeRegistry(computeShapes), []);\n const editorRef = useRef<EditorController>(null);\n useComputeGraphController({ controller, graph, editorRef });\n\n // Layout.\n const layout = useMemo(\n () => (controller && registry ? new ComputeShapeLayout(controller, registry) : undefined),\n [controller, registry],\n );\n\n if (!controller) {\n return;\n }\n\n return (\n <ComputeContext.Provider value={{ controller }}>\n <StackItem.Content size={role === 'section' ? 'square' : 'intrinsic'}>\n <KeyboardContainer id={id}>\n <Editor.Root\n id={id}\n ref={editorRef}\n graph={graph}\n graphMonitor={graphMonitor as any}\n registry={registry}\n layout={layout}\n >\n <Editor.Canvas />\n <Editor.UI showTools />\n </Editor.Root>\n </KeyboardContainer>\n </StackItem.Content>\n </ComputeContext.Provider>\n );\n};\n\nexport default CanvasContainer;\n"],
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,SAASC,WAAWC,SAASC,cAAc;AAElD,SAASC,iBAAiB;AAE1B,SAASC,yBAAyB;AAClC,SAASC,YAAY;AACrB,SAASC,iBAAiBC,cAAcC,wBAAwB;AAChE,SAASC,iBAAiB;AAC1B,SAASC,kBAAkBC,gBAA4B;AACvD,SACEC,gBACAC,wBAEAC,oBACAC,eACAC,2BACAC,uBACK;AACP,SAEEC,kBACAC,QAEAC,mBACAC,qBACK;AACP,SAASC,iBAAiB;AAE1B,IAAMC,iBAAiB,CAACC,QAAgBC,UAAAA;AACtC,SAAO,IAAIC,iBAAAA,EAAmBC,YAAY;IACxCC,UAAUH,SAAS,OAAOI,SAAYC,gBAAgBC,KAAKN,MAAMO,EAAE;IACnEC,QAAQR,SAAS,OAAOI,SAAYK,aAAaH,KAAKN,MAAMQ,QAAQJ,MAAAA;IACpEM,IACEX,OAAOY,OAAOC,SAASC,UAAUH,IAAII,UAAU,OAC3CV,SACAW,UAAUT,KAAKU,KAAK,qFAAqF,CAAA;EACjH,CAAA;AACF;AAEA,IAAMC,qBAAqB,CAACC,WAAAA;AAC1B,QAAMnB,SAASoB,UAAAA;AACf,QAAMnB,QAAQoB,SAASF,MAAAA;AACvB,QAAMG,aAAaC,QAAQ,MAAA;AACzB,QAAI,CAACJ,OAAOK,cAAcC,QAAQ;AAChC,aAAO;IACT;AACA,UAAMC,QAAQ,IAAIC,kBAAkBR,OAAOK,cAAcC,MAAAA;AACzD,UAAMH,cAAa,IAAIM,uBAAuB7B,eAAeC,QAAQC,KAAAA,GAAQyB,KAAAA;AAC7E,WAAOJ;EACT,GAAG;IAACH,OAAOK,cAAcC;IAAQxB;GAAM;AAEvC4B,YAAU,MAAA;AACR,QAAI,CAACP,YAAY;AACf;IACF;AAEA,SAAKA,WAAWQ,KAAI;AACpB,WAAO,MAAA;AACL,WAAKR,WAAWS,MAAK;IACvB;EACF,GAAG;IAACT;GAAW;AAEf,SAAOA;AACT;AAEO,IAAMU,kBAAkB,CAAC,EAAEb,QAAQc,KAAI,MAA6C;;;AACzF,UAAMC,KAAKC,iBAAiBhB,MAAAA;AAC5B,UAAMiB,QAAQb,QAAQ,MAAMc,iBAAiBC,OAAqBnB,OAAOoB,MAAM,GAAG;MAACpB,OAAOoB;KAAO;AACjG,UAAMjB,aAAaJ,mBAAmBC,MAAAA;AACtC,UAAMqB,eAAeC,gBAAgBnB,YAAYc,KAAAA;AACjD,UAAMM,WAAWnB,QAAQ,MAAM,IAAIoB,cAAcC,aAAAA,GAAgB,CAAA,CAAE;AACnE,UAAMC,YAAYC,OAAyB,IAAA;AAC3CC,8BAA0B;MAAEzB;MAAYc;MAAOS;IAAU,CAAA;AAGzD,UAAMN,SAAShB,QACb,MAAOD,cAAcoB,WAAW,IAAIM,mBAAmB1B,YAAYoB,QAAAA,IAAYrC,QAC/E;MAACiB;MAAYoB;KAAS;AAGxB,QAAI,CAACpB,YAAY;AACf;IACF;AAEA,WACE,sBAAA,cAAC2B,eAAeC,UAAQ;MAACC,OAAO;QAAE7B;MAAW;OAC3C,sBAAA,cAAC8B,UAAUC,SAAO;MAACC,MAAMrB,SAAS,YAAY,WAAW;OACvD,sBAAA,cAACsB,mBAAAA;MAAkBrB;OACjB,sBAAA,cAACsB,OAAOC,MAAI;MACVvB;MACAwB,KAAKb;MACLT;MACAI;MACAE;MACAH;OAEA,sBAAA,cAACiB,OAAOG,QAAM,IAAA,GACd,sBAAA,cAACH,OAAOI,IAAE;MAACC,WAAAA;;;;;AAMvB;AAEA,IAAA,0BAAe7B;",
|
|
6
|
-
"names": ["React", "useEffect", "useMemo", "useRef", "AiService", "ComputeGraphModel", "todo", "DatabaseService", "QueueService", "ServiceContainer", "useConfig", "fullyQualifiedId", "getSpace", "ComputeContext", "ComputeGraphController", "ComputeShapeLayout", "computeShapes", "useComputeGraphController", "useGraphMonitor", "CanvasGraphModel", "Editor", "KeyboardContainer", "ShapeRegistry", "StackItem", "createServices", "config", "space", "ServiceContainer", "setServices", "database", "undefined", "DatabaseService", "make", "db", "queues", "QueueService", "ai", "values", "runtime", "services", "server", "AiService", "todo", "useGraphController", "canvas", "useConfig", "getSpace", "controller", "useMemo", "computeGraph", "target", "model", "ComputeGraphModel", "ComputeGraphController", "useEffect", "open", "close", "CanvasContainer", "role", "id", "fullyQualifiedId", "graph", "CanvasGraphModel", "create", "layout", "graphMonitor", "useGraphMonitor", "registry", "ShapeRegistry", "computeShapes", "editorRef", "useRef", "useComputeGraphController", "ComputeShapeLayout", "ComputeContext", "Provider", "value", "StackItem", "Content", "size", "KeyboardContainer", "Editor", "Root", "ref", "Canvas", "UI", "showTools"]
|
|
7
|
-
}
|