@dxos/react-ui-canvas-compute 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +963 -1198
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +963 -1198
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
- package/dist/types/src/compute-layout.d.ts.map +1 -1
- package/dist/types/src/compute.stories.d.ts +33 -5
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +54 -53
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +4 -5
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts +2 -2
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +1 -1
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +2 -2
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +2 -2
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +2 -2
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +2 -2
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +8 -8
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +2 -2
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +3 -3
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +2 -2
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/{Queue.d.ts → Feed.d.ts} +10 -10
- package/dist/types/src/shapes/Feed.d.ts.map +1 -0
- package/dist/types/src/shapes/Function.d.ts +2 -2
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +2 -2
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +2 -2
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +3 -3
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +3 -3
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +3 -3
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +2 -2
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +2 -2
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +2 -2
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +2 -2
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +3 -3
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +2 -2
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +2 -2
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +2 -2
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +11 -61
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts +4 -4
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +3 -3
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +3 -2
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/src/shapes/index.d.ts +2 -2
- package/dist/types/src/shapes/index.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts +18 -24
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +63 -57
- package/src/README.md +0 -3
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +100 -123
- package/src/graph/controller.ts +158 -79
- package/src/graph/node-defs.ts +31 -31
- package/src/hooks/useComputeGraphController.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +8 -9
- package/src/hooks/useGraphMonitor.ts +11 -10
- package/src/json.test.ts +4 -4
- package/src/registry.ts +2 -2
- package/src/schema.test.ts +12 -12
- package/src/shapes/Append.tsx +1 -1
- package/src/shapes/Array.tsx +1 -1
- package/src/shapes/Audio.tsx +2 -3
- package/src/shapes/Beacon.tsx +1 -2
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Chat.tsx +1 -2
- package/src/shapes/Constant.tsx +1 -2
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/{Queue.tsx → Feed.tsx} +27 -22
- package/src/shapes/Function.tsx +16 -13
- package/src/shapes/Gpt.tsx +7 -3
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Json.tsx +10 -4
- package/src/shapes/Logic.tsx +1 -1
- package/src/shapes/RNG.tsx +6 -3
- package/src/shapes/Scope.tsx +3 -3
- package/src/shapes/Surface.tsx +13 -5
- package/src/shapes/Switch.tsx +1 -2
- package/src/shapes/Table.tsx +5 -4
- package/src/shapes/Template.tsx +2 -3
- package/src/shapes/Text.tsx +1 -2
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +14 -11
- package/src/shapes/Trigger.tsx +51 -58
- package/src/shapes/common/Box.tsx +6 -9
- package/src/shapes/common/FunctionBody.tsx +4 -3
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/shapes/defs.ts +5 -4
- package/src/shapes/index.ts +2 -2
- package/src/testing/circuits.ts +9 -18
- package/dist/types/src/shapes/Queue.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.4-
|
|
3
|
+
"version": "0.8.4-staging.60fe92afc8",
|
|
4
4
|
"description": "A compute graph extension for the canvas editor component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"type": "module",
|
|
10
14
|
"exports": {
|
|
11
15
|
".": {
|
|
12
16
|
"source": "./src/index.ts",
|
|
13
|
-
"types": "./dist/types/src/index.d.ts",
|
|
14
17
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
18
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
19
|
+
"types": "./dist/types/src/index.d.ts"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"types": "dist/types/src/index.d.ts",
|
|
19
|
-
"typesVersions": {
|
|
20
|
-
"*": {}
|
|
21
|
-
},
|
|
22
23
|
"files": [
|
|
23
24
|
"dist",
|
|
24
25
|
"src"
|
|
@@ -26,63 +27,68 @@
|
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@antv/graphlib": "^2.0.4",
|
|
28
29
|
"@antv/layout": "^1.2.13",
|
|
29
|
-
"@effect/platform": "0.
|
|
30
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
30
|
+
"@effect/platform": "0.96.1",
|
|
31
31
|
"chess.js": "^1.0.0",
|
|
32
|
-
"
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/debug": "0.8.4-
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-ui-
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
32
|
+
"workerize-loader": "^2.0.2",
|
|
33
|
+
"@dxos/ai": "0.8.4-staging.60fe92afc8",
|
|
34
|
+
"@dxos/assistant": "0.8.4-staging.60fe92afc8",
|
|
35
|
+
"@dxos/compute-runtime": "0.8.4-staging.60fe92afc8",
|
|
36
|
+
"@dxos/async": "0.8.4-staging.60fe92afc8",
|
|
37
|
+
"@dxos/context": "0.8.4-staging.60fe92afc8",
|
|
38
|
+
"@dxos/compute": "0.8.4-staging.60fe92afc8",
|
|
39
|
+
"@dxos/debug": "0.8.4-staging.60fe92afc8",
|
|
40
|
+
"@dxos/edge-client": "0.8.4-staging.60fe92afc8",
|
|
41
|
+
"@dxos/conductor": "0.8.4-staging.60fe92afc8",
|
|
42
|
+
"@dxos/app-framework": "0.8.4-staging.60fe92afc8",
|
|
43
|
+
"@dxos/echo": "0.8.4-staging.60fe92afc8",
|
|
44
|
+
"@dxos/effect": "0.8.4-staging.60fe92afc8",
|
|
45
|
+
"@dxos/functions": "0.8.4-staging.60fe92afc8",
|
|
46
|
+
"@dxos/functions-runtime": "0.8.4-staging.60fe92afc8",
|
|
47
|
+
"@dxos/invariant": "0.8.4-staging.60fe92afc8",
|
|
48
|
+
"@dxos/keys": "0.8.4-staging.60fe92afc8",
|
|
49
|
+
"@dxos/log": "0.8.4-staging.60fe92afc8",
|
|
50
|
+
"@dxos/react-client": "0.8.4-staging.60fe92afc8",
|
|
51
|
+
"@dxos/graph": "0.8.4-staging.60fe92afc8",
|
|
52
|
+
"@dxos/react-edge-client": "0.8.4-staging.60fe92afc8",
|
|
53
|
+
"@dxos/react-ui-audio": "0.8.4-staging.60fe92afc8",
|
|
54
|
+
"@dxos/react-ui-attention": "0.8.4-staging.60fe92afc8",
|
|
55
|
+
"@dxos/react-ui-canvas": "0.8.4-staging.60fe92afc8",
|
|
56
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-staging.60fe92afc8",
|
|
57
|
+
"@dxos/react-ui-editor": "0.8.4-staging.60fe92afc8",
|
|
58
|
+
"@dxos/react-ui-experimental": "0.8.4-staging.60fe92afc8",
|
|
59
|
+
"@dxos/react-ui-mosaic": "0.8.4-staging.60fe92afc8",
|
|
60
|
+
"@dxos/react-ui-form": "0.8.4-staging.60fe92afc8",
|
|
61
|
+
"@dxos/react-ui-stack": "0.8.4-staging.60fe92afc8",
|
|
62
|
+
"@dxos/app-toolkit": "0.8.4-staging.60fe92afc8",
|
|
63
|
+
"@dxos/schema": "0.8.4-staging.60fe92afc8",
|
|
64
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-staging.60fe92afc8",
|
|
65
|
+
"@dxos/types": "0.8.4-staging.60fe92afc8",
|
|
66
|
+
"@dxos/util": "0.8.4-staging.60fe92afc8"
|
|
60
67
|
},
|
|
61
68
|
"devDependencies": {
|
|
62
|
-
"@effect/ai": "0.
|
|
69
|
+
"@effect/ai": "0.36.0",
|
|
70
|
+
"@effect/experimental": "0.60.0",
|
|
63
71
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
64
|
-
"@types/react": "~
|
|
65
|
-
"@types/react-dom": "~
|
|
66
|
-
"effect": "3.
|
|
72
|
+
"@types/react": "~19.2.7",
|
|
73
|
+
"@types/react-dom": "~19.2.3",
|
|
74
|
+
"effect": "3.21.3",
|
|
67
75
|
"lodash.defaultsdeep": "^4.6.1",
|
|
68
|
-
"react": "~
|
|
69
|
-
"react-dom": "~
|
|
70
|
-
"vite": "
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/echo-signals": "0.8.4-main.fd6878d",
|
|
78
|
-
"@dxos/storybook-utils": "0.8.4-main.fd6878d"
|
|
76
|
+
"react": "~19.2.3",
|
|
77
|
+
"react-dom": "~19.2.3",
|
|
78
|
+
"vite": "^8.0.16",
|
|
79
|
+
"@dxos/assistant-toolkit": "0.8.4-staging.60fe92afc8",
|
|
80
|
+
"@dxos/random": "0.8.4-staging.60fe92afc8",
|
|
81
|
+
"@dxos/react-ui": "0.8.4-staging.60fe92afc8",
|
|
82
|
+
"@dxos/app-framework": "0.8.4-staging.60fe92afc8",
|
|
83
|
+
"@dxos/storybook-utils": "0.8.4-staging.60fe92afc8",
|
|
84
|
+
"@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
|
|
79
85
|
},
|
|
80
86
|
"peerDependencies": {
|
|
81
|
-
"effect": "
|
|
82
|
-
"react": "~
|
|
83
|
-
"react-dom": "~
|
|
84
|
-
"@dxos/react-ui": "0.8.4-
|
|
85
|
-
"@dxos/
|
|
87
|
+
"effect": "3.21.3",
|
|
88
|
+
"react": "~19.2.3",
|
|
89
|
+
"react-dom": "~19.2.3",
|
|
90
|
+
"@dxos/react-ui": "0.8.4-staging.60fe92afc8",
|
|
91
|
+
"@dxos/ui-theme": "0.8.4-staging.60fe92afc8"
|
|
86
92
|
},
|
|
87
93
|
"publishConfig": {
|
|
88
94
|
"access": "public"
|
package/src/README.md
CHANGED
package/src/compute-layout.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { DefaultInput, DefaultOutput } from '@dxos/conductor';
|
|
6
|
-
import { toEffectSchema } from '@dxos/echo
|
|
6
|
+
import { toEffectSchema } from '@dxos/echo/JsonSchema';
|
|
7
7
|
import { type Anchor, ShapeLayout, type ShapeRegistry } from '@dxos/react-ui-canvas-editor';
|
|
8
8
|
|
|
9
9
|
import { type ComputeGraphController } from './graph';
|
package/src/compute.stories.tsx
CHANGED
|
@@ -2,32 +2,33 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
8
9
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
10
|
|
|
11
|
+
import { AiServiceTestingPreset } from '@dxos/ai/testing';
|
|
10
12
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import { capabilities } from '@dxos/assistant-testing';
|
|
13
|
+
import { capabilities } from '@dxos/assistant-toolkit/testing';
|
|
14
|
+
import { Operation } from '@dxos/compute';
|
|
15
|
+
import { TestDatabaseLayer } from '@dxos/compute-runtime/testing';
|
|
12
16
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
13
|
-
import {
|
|
17
|
+
import { Feed } from '@dxos/echo';
|
|
18
|
+
import { registryLayerNoop } from '@dxos/echo/testing';
|
|
19
|
+
import { configuredCredentialsLayer } from '@dxos/functions';
|
|
14
20
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
21
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
16
22
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
17
|
-
import {
|
|
18
|
-
CanvasGraphModel,
|
|
19
|
-
Editor,
|
|
20
|
-
type EditorController,
|
|
21
|
-
type EditorRootProps,
|
|
22
|
-
ShapeRegistry,
|
|
23
|
-
} from '@dxos/react-ui-canvas-editor';
|
|
23
|
+
import { Editor, type EditorController, type EditorRootProps, ShapeRegistry } from '@dxos/react-ui-canvas-editor';
|
|
24
24
|
import { Container, useSelection } from '@dxos/react-ui-canvas-editor/testing';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
25
|
+
import { Form } from '@dxos/react-ui-form';
|
|
26
|
+
import { Syntax } from '@dxos/react-ui-syntax-highlighter';
|
|
27
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
27
28
|
|
|
28
29
|
import { DiagnosticOverlay } from './components';
|
|
29
30
|
import { ComputeShapeLayout } from './compute-layout';
|
|
30
|
-
import { type ComputeGraphController } from './graph';
|
|
31
|
+
import { type ComputeGraphController, createComputeGraphController } from './graph';
|
|
31
32
|
import { ComputeContext, useComputeGraphController, useGraphMonitor } from './hooks';
|
|
32
33
|
import { computeShapes } from './registry';
|
|
33
34
|
import { type ComputeShape } from './shapes';
|
|
@@ -35,8 +36,8 @@ import {
|
|
|
35
36
|
createArtifactCircuit,
|
|
36
37
|
createAudioCircuit,
|
|
37
38
|
createBasicCircuit,
|
|
38
|
-
createComputeGraphController,
|
|
39
39
|
createControlCircuit,
|
|
40
|
+
createEmptyCircuit,
|
|
40
41
|
createGPTRealtimeCircuit,
|
|
41
42
|
createGptCircuit,
|
|
42
43
|
createLogicCircuit,
|
|
@@ -44,10 +45,12 @@ import {
|
|
|
44
45
|
createTransformCircuit,
|
|
45
46
|
} from './testing';
|
|
46
47
|
|
|
47
|
-
//
|
|
48
|
+
// TODO(burdon): Replace ServiceContainer.
|
|
48
49
|
|
|
49
50
|
const sidebarTypes: NonNullable<RenderProps['sidebar']>[] = ['canvas', 'compute', 'controller', 'selected'] as const;
|
|
50
51
|
|
|
52
|
+
const hiddenArg = { table: { disable: true } };
|
|
53
|
+
|
|
51
54
|
type RenderProps = EditorRootProps<ComputeShape> &
|
|
52
55
|
PropsWithChildren<{
|
|
53
56
|
init?: boolean;
|
|
@@ -61,9 +64,10 @@ const DefaultStory = ({
|
|
|
61
64
|
children,
|
|
62
65
|
graph,
|
|
63
66
|
controller = null,
|
|
64
|
-
|
|
65
|
-
sidebar: _sidebar,
|
|
67
|
+
sidebar: sidebarProp,
|
|
66
68
|
registry,
|
|
69
|
+
showGrid = true,
|
|
70
|
+
snapToGrid = true,
|
|
67
71
|
...props
|
|
68
72
|
}: RenderProps) => {
|
|
69
73
|
const editorRef = useRef<EditorController>(null);
|
|
@@ -81,7 +85,7 @@ const DefaultStory = ({
|
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
// Sidebar.
|
|
84
|
-
const [sidebar, setSidebar] = useState(
|
|
88
|
+
const [sidebar, setSidebar] = useState<RenderProps['sidebar']>(sidebarProp);
|
|
85
89
|
const json = useMemo(() => {
|
|
86
90
|
switch (sidebar) {
|
|
87
91
|
case 'canvas':
|
|
@@ -121,7 +125,7 @@ const DefaultStory = ({
|
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
return (
|
|
124
|
-
<div className='grid grid-cols-[
|
|
128
|
+
<div className='grid grid-cols-[1fr_360px] h-full w-full'>
|
|
125
129
|
<ComputeContext.Provider value={{ controller }}>
|
|
126
130
|
<Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
|
|
127
131
|
<Editor.Root<ComputeShape>
|
|
@@ -133,6 +137,8 @@ const DefaultStory = ({
|
|
|
133
137
|
registry={registry}
|
|
134
138
|
selection={selection}
|
|
135
139
|
autoZoom
|
|
140
|
+
showGrid={showGrid}
|
|
141
|
+
snapToGrid={snapToGrid}
|
|
136
142
|
{...props}
|
|
137
143
|
>
|
|
138
144
|
<Editor.Canvas>{children}</Editor.Canvas>
|
|
@@ -144,9 +150,9 @@ const DefaultStory = ({
|
|
|
144
150
|
|
|
145
151
|
{sidebar && (
|
|
146
152
|
<Container id='sidebar' classNames='flex flex-col h-full overflow-hidden'>
|
|
147
|
-
<Toolbar.Root
|
|
153
|
+
<Toolbar.Root>
|
|
148
154
|
<Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
|
|
149
|
-
<Select.TriggerButton classNames='
|
|
155
|
+
<Select.TriggerButton classNames='w-full'>{sidebar}</Select.TriggerButton>
|
|
150
156
|
<Select.Portal>
|
|
151
157
|
<Select.Content>
|
|
152
158
|
<Select.Viewport>
|
|
@@ -156,18 +162,32 @@ const DefaultStory = ({
|
|
|
156
162
|
</Select.Item>
|
|
157
163
|
))}
|
|
158
164
|
</Select.Viewport>
|
|
165
|
+
<Select.Arrow />
|
|
159
166
|
</Select.Content>
|
|
160
167
|
</Select.Portal>
|
|
161
168
|
</Select.Root>
|
|
162
169
|
</Toolbar.Root>
|
|
163
170
|
|
|
164
171
|
<div className='flex flex-col h-full overflow-hidden divide-y divider-separator'>
|
|
172
|
+
{/* TODO(burdon): Provide schema. */}
|
|
165
173
|
{sidebar === 'selected' && selected && (
|
|
166
|
-
<
|
|
167
|
-
|
|
174
|
+
<Form.Root<ComputeNode> values={getComputeNode(selected.id) ?? {}}>
|
|
175
|
+
<Form.Viewport>
|
|
176
|
+
<Form.Content>
|
|
177
|
+
<Form.FieldSet />
|
|
178
|
+
<Form.Actions />
|
|
179
|
+
</Form.Content>
|
|
180
|
+
</Form.Viewport>
|
|
181
|
+
</Form.Root>
|
|
168
182
|
)}
|
|
169
|
-
|
|
170
|
-
|
|
183
|
+
<Syntax.Root data={json}>
|
|
184
|
+
<Syntax.Content>
|
|
185
|
+
<Syntax.Filter />
|
|
186
|
+
<Syntax.Viewport>
|
|
187
|
+
<Syntax.Code />
|
|
188
|
+
</Syntax.Viewport>
|
|
189
|
+
</Syntax.Content>
|
|
190
|
+
</Syntax.Root>
|
|
171
191
|
</div>
|
|
172
192
|
</Container>
|
|
173
193
|
)}
|
|
@@ -175,186 +195,143 @@ const DefaultStory = ({
|
|
|
175
195
|
);
|
|
176
196
|
};
|
|
177
197
|
|
|
178
|
-
const meta
|
|
198
|
+
const meta = {
|
|
179
199
|
title: 'ui/react-ui-canvas-compute/compute',
|
|
180
|
-
component: Editor.Root,
|
|
200
|
+
component: Editor.Root as any,
|
|
181
201
|
render: DefaultStory,
|
|
182
202
|
decorators: [
|
|
183
|
-
withTheme,
|
|
184
|
-
|
|
203
|
+
withTheme(),
|
|
204
|
+
withLayout({ layout: 'fullscreen' }),
|
|
205
|
+
withAttention(),
|
|
185
206
|
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
186
|
-
withLayout({ fullscreen: true }),
|
|
187
207
|
withPluginManager({ capabilities }),
|
|
188
208
|
],
|
|
189
|
-
|
|
209
|
+
parameters: {
|
|
210
|
+
layout: 'fullscreen',
|
|
211
|
+
},
|
|
212
|
+
argTypes: {
|
|
213
|
+
controller: hiddenArg,
|
|
214
|
+
graph: hiddenArg,
|
|
215
|
+
registry: hiddenArg,
|
|
216
|
+
sidebar: {
|
|
217
|
+
control: 'select',
|
|
218
|
+
options: [...sidebarTypes, null],
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
190
222
|
|
|
191
223
|
export default meta;
|
|
192
224
|
|
|
193
|
-
type Story = StoryObj<
|
|
225
|
+
type Story = StoryObj<typeof meta>;
|
|
226
|
+
|
|
227
|
+
const ServiceLayer = Layer.empty.pipe(
|
|
228
|
+
Layer.provideMerge(
|
|
229
|
+
Layer.mergeAll(
|
|
230
|
+
Layer.succeed(Operation.Service, {
|
|
231
|
+
invoke: () => Effect.die('Operation.Service not available in test.'),
|
|
232
|
+
schedule: () => Effect.die('Operation.Service not available in test.'),
|
|
233
|
+
invokePromise: async () => ({ error: new Error('Not available') }),
|
|
234
|
+
} as any),
|
|
235
|
+
registryLayerNoop,
|
|
236
|
+
),
|
|
237
|
+
),
|
|
238
|
+
Layer.provideMerge(
|
|
239
|
+
Layer.mergeAll(
|
|
240
|
+
AiServiceTestingPreset('direct'),
|
|
241
|
+
TestDatabaseLayer(),
|
|
242
|
+
configuredCredentialsLayer([]),
|
|
243
|
+
Feed.notAvailable,
|
|
244
|
+
),
|
|
245
|
+
),
|
|
246
|
+
Layer.orDie,
|
|
247
|
+
);
|
|
194
248
|
|
|
195
249
|
export const Default: Story = {
|
|
196
250
|
args: {
|
|
197
|
-
// debug: true,
|
|
198
|
-
showGrid: false,
|
|
199
|
-
snapToGrid: false,
|
|
200
|
-
sidebar: 'selected',
|
|
201
251
|
registry: new ShapeRegistry(computeShapes),
|
|
202
|
-
...createComputeGraphController(
|
|
252
|
+
...createComputeGraphController(createEmptyCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
203
253
|
},
|
|
204
254
|
};
|
|
205
255
|
|
|
206
256
|
export const Beacon: Story = {
|
|
207
257
|
args: {
|
|
208
|
-
// debug: true,
|
|
209
|
-
showGrid: false,
|
|
210
|
-
snapToGrid: false,
|
|
211
|
-
sidebar: 'selected',
|
|
212
258
|
registry: new ShapeRegistry(computeShapes),
|
|
213
|
-
...createComputeGraphController(createBasicCircuit(),
|
|
259
|
+
...createComputeGraphController(createBasicCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
214
260
|
},
|
|
215
261
|
};
|
|
216
262
|
|
|
217
263
|
export const Transform: Story = {
|
|
218
264
|
args: {
|
|
219
|
-
// debug: true,
|
|
220
|
-
showGrid: false,
|
|
221
|
-
snapToGrid: false,
|
|
222
|
-
sidebar: 'selected',
|
|
223
265
|
registry: new ShapeRegistry(computeShapes),
|
|
224
|
-
...createComputeGraphController(createTransformCircuit(),
|
|
266
|
+
...createComputeGraphController(createTransformCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
225
267
|
},
|
|
226
268
|
};
|
|
227
269
|
|
|
228
270
|
export const Logic: Story = {
|
|
229
271
|
args: {
|
|
230
|
-
// debug: true,
|
|
231
|
-
showGrid: false,
|
|
232
|
-
snapToGrid: false,
|
|
233
|
-
sidebar: 'compute',
|
|
234
272
|
registry: new ShapeRegistry(computeShapes),
|
|
235
|
-
...createComputeGraphController(createLogicCircuit(),
|
|
273
|
+
...createComputeGraphController(createLogicCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
236
274
|
},
|
|
237
275
|
};
|
|
238
276
|
|
|
239
277
|
export const Control: Story = {
|
|
240
278
|
args: {
|
|
241
|
-
// debug: true,
|
|
242
|
-
showGrid: false,
|
|
243
|
-
snapToGrid: false,
|
|
244
|
-
sidebar: 'compute',
|
|
245
279
|
registry: new ShapeRegistry(computeShapes),
|
|
246
|
-
...createComputeGraphController(createControlCircuit(),
|
|
280
|
+
...createComputeGraphController(createControlCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
247
281
|
},
|
|
248
282
|
};
|
|
249
283
|
|
|
250
284
|
export const Template: Story = {
|
|
251
285
|
args: {
|
|
252
|
-
showGrid: false,
|
|
253
|
-
snapToGrid: false,
|
|
254
|
-
// sidebar: 'controller',
|
|
255
286
|
registry: new ShapeRegistry(computeShapes),
|
|
256
|
-
...createComputeGraphController(
|
|
257
|
-
createTemplateCircuit(),
|
|
258
|
-
new ServiceContainer().setServices({
|
|
259
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
260
|
-
}),
|
|
261
|
-
),
|
|
287
|
+
...createComputeGraphController(createTemplateCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
262
288
|
},
|
|
263
289
|
};
|
|
264
290
|
|
|
265
291
|
export const GPT: Story = {
|
|
266
292
|
args: {
|
|
267
|
-
// debug: true,
|
|
268
|
-
showGrid: false,
|
|
269
|
-
snapToGrid: false,
|
|
270
|
-
// sidebar: 'json',
|
|
271
|
-
sidebar: 'controller',
|
|
272
293
|
registry: new ShapeRegistry(computeShapes),
|
|
273
|
-
...createComputeGraphController(
|
|
274
|
-
createGptCircuit({ history: true }),
|
|
275
|
-
new ServiceContainer().setServices({
|
|
276
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
277
|
-
}),
|
|
278
|
-
),
|
|
294
|
+
...createComputeGraphController(createGptCircuit({ history: true }), ManagedRuntime.make(ServiceLayer)),
|
|
279
295
|
},
|
|
280
296
|
};
|
|
281
297
|
|
|
282
298
|
export const Plugins: Story = {
|
|
283
299
|
args: {
|
|
284
|
-
// debug: true,
|
|
285
|
-
showGrid: false,
|
|
286
|
-
snapToGrid: false,
|
|
287
|
-
// sidebar: 'json',
|
|
288
300
|
registry: new ShapeRegistry(computeShapes),
|
|
289
301
|
...createComputeGraphController(
|
|
290
302
|
createGptCircuit({ history: true, image: true, artifact: true }),
|
|
291
|
-
|
|
292
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
293
|
-
}),
|
|
303
|
+
ManagedRuntime.make(ServiceLayer),
|
|
294
304
|
),
|
|
295
305
|
},
|
|
296
306
|
};
|
|
297
307
|
|
|
298
308
|
export const Artifact: Story = {
|
|
299
309
|
args: {
|
|
300
|
-
// debug: true,
|
|
301
|
-
showGrid: false,
|
|
302
|
-
snapToGrid: false,
|
|
303
|
-
// sidebar: 'json',
|
|
304
310
|
registry: new ShapeRegistry(computeShapes),
|
|
305
|
-
...createComputeGraphController(
|
|
306
|
-
createArtifactCircuit(),
|
|
307
|
-
new ServiceContainer().setServices({
|
|
308
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
309
|
-
}),
|
|
310
|
-
),
|
|
311
|
+
...createComputeGraphController(createArtifactCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
311
312
|
},
|
|
312
313
|
};
|
|
313
314
|
|
|
314
315
|
export const ImageGen: Story = {
|
|
315
316
|
args: {
|
|
316
|
-
// debug: true,
|
|
317
|
-
showGrid: false,
|
|
318
|
-
snapToGrid: false,
|
|
319
|
-
// sidebar: 'json',
|
|
320
|
-
sidebar: 'controller',
|
|
321
317
|
registry: new ShapeRegistry(computeShapes),
|
|
322
318
|
...createComputeGraphController(
|
|
323
319
|
createGptCircuit({ image: true, artifact: true }),
|
|
324
|
-
|
|
325
|
-
// ai: AiService.make(createTestAiServiceClient()),
|
|
326
|
-
}),
|
|
320
|
+
ManagedRuntime.make(ServiceLayer),
|
|
327
321
|
),
|
|
328
322
|
},
|
|
329
323
|
};
|
|
330
324
|
|
|
331
325
|
export const Audio: Story = {
|
|
332
326
|
args: {
|
|
333
|
-
// debug: true,
|
|
334
|
-
showGrid: false,
|
|
335
|
-
snapToGrid: false,
|
|
336
|
-
sidebar: 'controller',
|
|
337
327
|
registry: new ShapeRegistry(computeShapes),
|
|
338
|
-
...createComputeGraphController(
|
|
339
|
-
createAudioCircuit(),
|
|
340
|
-
new ServiceContainer().setServices({
|
|
341
|
-
// ai: AiService.make(createTestAiServiceClient()),
|
|
342
|
-
}),
|
|
343
|
-
),
|
|
328
|
+
...createComputeGraphController(createAudioCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
344
329
|
},
|
|
345
330
|
};
|
|
346
331
|
|
|
347
332
|
export const Voice: Story = {
|
|
348
333
|
args: {
|
|
349
|
-
showGrid: false,
|
|
350
|
-
snapToGrid: false,
|
|
351
|
-
sidebar: 'controller',
|
|
352
334
|
registry: new ShapeRegistry(computeShapes),
|
|
353
|
-
...createComputeGraphController(
|
|
354
|
-
createGPTRealtimeCircuit(),
|
|
355
|
-
new ServiceContainer().setServices({
|
|
356
|
-
// ai: AiService.make(createTestAiServiceClient()),
|
|
357
|
-
}),
|
|
358
|
-
),
|
|
335
|
+
...createComputeGraphController(createGPTRealtimeCircuit(), ManagedRuntime.make(ServiceLayer)),
|
|
359
336
|
},
|
|
360
337
|
};
|