@dxos/react-ui-canvas-compute 0.8.2-staging.7ac8446 → 0.8.2
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/index.mjs +1022 -836
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1040 -854
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1022 -836
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +2 -18
- 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.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +18 -18
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +19 -19
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +19 -19
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +19 -19
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +19 -19
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +70 -70
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +19 -19
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +20 -20
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +19 -19
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +19 -19
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +19 -19
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +19 -19
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +37 -37
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +37 -37
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +19 -19
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +21 -21
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +19 -19
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +19 -19
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +19 -19
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +19 -19
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +20 -20
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +19 -19
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +19 -19
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +19 -19
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +47 -45
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +5 -5
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +18 -19
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -40
- package/src/compute.stories.tsx +3 -3
- package/src/graph/controller.ts +12 -12
- package/src/hooks/useComputeNodeState.ts +3 -3
- package/src/hooks/useGraphMonitor.ts +3 -5
- package/src/json.test.ts +10 -10
- package/src/schema.test.ts +7 -7
- package/src/shapes/Append.tsx +5 -5
- package/src/shapes/Array.tsx +5 -5
- package/src/shapes/Audio.tsx +5 -5
- package/src/shapes/Beacon.tsx +5 -5
- package/src/shapes/Boolean.tsx +5 -5
- package/src/shapes/Chat.tsx +5 -5
- package/src/shapes/Constant.tsx +6 -6
- package/src/shapes/Database.tsx +5 -5
- package/src/shapes/Function.tsx +8 -7
- package/src/shapes/Gpt.tsx +6 -6
- package/src/shapes/GptRealtime.tsx +8 -8
- package/src/shapes/Json.tsx +9 -9
- package/src/shapes/Logic.tsx +9 -9
- package/src/shapes/Queue.tsx +5 -5
- package/src/shapes/RNG.tsx +7 -7
- package/src/shapes/Scope.tsx +5 -5
- package/src/shapes/Surface.tsx +5 -5
- package/src/shapes/Switch.tsx +5 -5
- package/src/shapes/Table.tsx +6 -6
- package/src/shapes/Template.tsx +8 -7
- package/src/shapes/Text.tsx +5 -5
- package/src/shapes/TextToImage.tsx +5 -5
- package/src/shapes/Thread.tsx +6 -6
- package/src/shapes/Trigger.tsx +32 -33
- package/src/shapes/common/FunctionBody.tsx +11 -9
- package/src/shapes/defs.ts +9 -9
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import { SchemaAST
|
|
2
|
-
import { S } from '@dxos/echo-schema';
|
|
1
|
+
import { Schema, SchemaAST } from 'effect';
|
|
3
2
|
import { Polygon } from '@dxos/react-ui-canvas-editor';
|
|
4
3
|
import { type MakeOptional } from '@dxos/util';
|
|
5
4
|
export type PropertyKind = 'input' | 'output';
|
|
6
|
-
export declare const getProperties: (ast:
|
|
5
|
+
export declare const getProperties: (ast: SchemaAST.AST) => {
|
|
7
6
|
name: string;
|
|
8
7
|
}[];
|
|
9
8
|
export declare const createAnchorId: (kind: PropertyKind, property?: string) => string;
|
|
10
9
|
export declare const parseAnchorId: (id: string) => [PropertyKind | undefined, string];
|
|
11
10
|
export type CreateShapeProps<S extends Polygon> = Omit<MakeOptional<S, 'id' | 'size'>, 'type' | 'node'>;
|
|
12
|
-
export declare const ComputeShape:
|
|
11
|
+
export declare const ComputeShape: Schema.extend<Schema.mutable<Schema.extend<Schema.extend<Schema.SchemaClass<{
|
|
13
12
|
readonly id: string;
|
|
14
13
|
readonly data?: any;
|
|
15
14
|
}, {
|
|
16
15
|
readonly id: string;
|
|
17
16
|
readonly data?: any;
|
|
18
|
-
}, never>,
|
|
19
|
-
type: typeof
|
|
20
|
-
text:
|
|
21
|
-
guide:
|
|
22
|
-
classNames:
|
|
23
|
-
}>>,
|
|
24
|
-
center:
|
|
25
|
-
x: typeof
|
|
26
|
-
y: typeof
|
|
17
|
+
}, never>, Schema.Struct<{
|
|
18
|
+
type: typeof Schema.String;
|
|
19
|
+
text: Schema.optional<typeof Schema.String>;
|
|
20
|
+
guide: Schema.optional<typeof Schema.Boolean>;
|
|
21
|
+
classNames: Schema.optional<typeof Schema.String>;
|
|
22
|
+
}>>, Schema.Struct<{
|
|
23
|
+
center: Schema.Struct<{
|
|
24
|
+
x: typeof Schema.Number;
|
|
25
|
+
y: typeof Schema.Number;
|
|
27
26
|
}>;
|
|
28
|
-
size:
|
|
29
|
-
width: typeof
|
|
30
|
-
height: typeof
|
|
27
|
+
size: Schema.mutable<Schema.Struct<{
|
|
28
|
+
width: typeof Schema.Number;
|
|
29
|
+
height: typeof Schema.Number;
|
|
31
30
|
}>>;
|
|
32
|
-
}>>>,
|
|
33
|
-
node:
|
|
31
|
+
}>>>, Schema.mutable<Schema.Struct<{
|
|
32
|
+
node: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
34
33
|
}>>>;
|
|
35
|
-
export type ComputeShape =
|
|
34
|
+
export type ComputeShape = Schema.Schema.Type<typeof ComputeShape>;
|
|
36
35
|
export declare const createShape: <S extends ComputeShape>({ id, ...rest }: CreateShapeProps<S> & {
|
|
37
36
|
type: string;
|
|
38
37
|
}) => S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/shapes/defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../../../src/shapes/defs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAI3C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE9C,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,CAAC,GAAG;;GACqC,CAAC;AAEtF,eAAO,MAAM,cAAc,GAAI,MAAM,YAAY,EAAE,iBAA4D,WACnF,CAAC;AAE7B,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,CAAC,YAAY,GAAG,SAAS,EAAE,MAAM,CAG3E,CAAC;AAMF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAExG,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;IAMxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAEnE,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,YAAY,EAAE,iBAAiB,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,CAK7G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circuits.d.ts","sourceRoot":"","sources":["../../../../src/testing/circuits.ts"],"names":[],"mappings":"AAQA,OAAO,EAAyD,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEvH,OAAO,EAAE,sBAAsB,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AA6BjE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"circuits.d.ts","sourceRoot":"","sources":["../../../../src/testing/circuits.ts"],"names":[],"mappings":"AAQA,OAAO,EAAyD,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEvH,OAAO,EAAE,sBAAsB,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AA6BjE,eAAO,MAAM,4BAA4B,GACvC;;;;;;;;;;;;;;;;;EAA+C,EAC/C,WAAW,OAAO,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;CAM7B,CAAC;AAMF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;EAiBlC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;EAmB9B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;EA2BhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;EAiEjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;EAqBjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS;IACxC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;;;;;;;;;;;;;;;;;EA6DA,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;EAIpC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;EAS9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.2
|
|
3
|
+
"version": "0.8.2",
|
|
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",
|
|
@@ -22,35 +22,37 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@antv/graphlib": "^2.0.4",
|
|
24
24
|
"@antv/layout": "^1.2.13",
|
|
25
|
-
"@effect/platform": "0.
|
|
25
|
+
"@effect/platform": "0.80.12",
|
|
26
|
+
"@preact-signals/safe-react": "^0.9.0",
|
|
26
27
|
"chess.js": "^1.0.0",
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/edge-client": "0.8.2
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/keys": "0.8.2
|
|
40
|
-
"@dxos/live-object": "0.8.2
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/react-client": "0.8.2
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/react-
|
|
45
|
-
"@dxos/react-ui-
|
|
46
|
-
"@dxos/react-ui-
|
|
47
|
-
"@dxos/react-ui-canvas-editor": "0.8.2
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/react-ui-
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
28
|
+
"@dxos/ai": "0.8.2",
|
|
29
|
+
"@dxos/app-framework": "0.8.2",
|
|
30
|
+
"@dxos/artifact": "0.8.2",
|
|
31
|
+
"@dxos/assistant": "0.8.2",
|
|
32
|
+
"@dxos/conductor": "0.8.2",
|
|
33
|
+
"@dxos/async": "0.8.2",
|
|
34
|
+
"@dxos/context": "0.8.2",
|
|
35
|
+
"@dxos/edge-client": "0.8.2",
|
|
36
|
+
"@dxos/debug": "0.8.2",
|
|
37
|
+
"@dxos/echo-schema": "0.8.2",
|
|
38
|
+
"@dxos/graph": "0.8.2",
|
|
39
|
+
"@dxos/functions": "0.8.2",
|
|
40
|
+
"@dxos/keys": "0.8.2",
|
|
41
|
+
"@dxos/live-object": "0.8.2",
|
|
42
|
+
"@dxos/invariant": "0.8.2",
|
|
43
|
+
"@dxos/react-client": "0.8.2",
|
|
44
|
+
"@dxos/log": "0.8.2",
|
|
45
|
+
"@dxos/react-edge-client": "0.8.2",
|
|
46
|
+
"@dxos/react-ui-attention": "0.8.2",
|
|
47
|
+
"@dxos/react-ui-canvas": "0.8.2",
|
|
48
|
+
"@dxos/react-ui-canvas-editor": "0.8.2",
|
|
49
|
+
"@dxos/react-ui-editor": "0.8.2",
|
|
50
|
+
"@dxos/react-ui-form": "0.8.2",
|
|
51
|
+
"@dxos/react-ui-stack": "0.8.2",
|
|
52
|
+
"@dxos/react-ui-sfx": "0.8.2",
|
|
53
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2",
|
|
54
|
+
"@dxos/schema": "0.8.2",
|
|
55
|
+
"@dxos/util": "0.8.2"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@effect/ai": "0.8.0",
|
|
@@ -58,26 +60,26 @@
|
|
|
58
60
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
59
61
|
"@types/react": "~18.2.0",
|
|
60
62
|
"@types/react-dom": "~18.2.0",
|
|
61
|
-
"effect": "3.
|
|
63
|
+
"effect": "3.14.21",
|
|
62
64
|
"lodash.defaultsdeep": "^4.6.1",
|
|
63
65
|
"react": "~18.2.0",
|
|
64
66
|
"react-dom": "~18.2.0",
|
|
65
67
|
"vite": "5.4.7",
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/random": "0.8.2
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/react-ui
|
|
72
|
-
"@dxos/react-ui": "0.8.2
|
|
73
|
-
"@dxos/storybook-utils": "0.8.2
|
|
68
|
+
"@dxos/artifact-testing": "0.8.2",
|
|
69
|
+
"@dxos/app-framework": "0.8.2",
|
|
70
|
+
"@dxos/compute": "0.8.2",
|
|
71
|
+
"@dxos/random": "0.8.2",
|
|
72
|
+
"@dxos/echo-signals": "0.8.2",
|
|
73
|
+
"@dxos/react-ui": "0.8.2",
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.2",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.2"
|
|
74
76
|
},
|
|
75
77
|
"peerDependencies": {
|
|
76
78
|
"effect": "3.13.3",
|
|
77
79
|
"react": "~18.2.0",
|
|
78
80
|
"react-dom": "~18.2.0",
|
|
79
|
-
"@dxos/react-ui-theme": "0.8.2
|
|
80
|
-
"@dxos/react-ui": "0.8.2
|
|
81
|
+
"@dxos/react-ui-theme": "0.8.2",
|
|
82
|
+
"@dxos/react-ui": "0.8.2"
|
|
81
83
|
},
|
|
82
84
|
"publishConfig": {
|
|
83
85
|
"access": "public"
|
package/src/compute.stories.tsx
CHANGED
|
@@ -7,9 +7,9 @@ import '@dxos-theme';
|
|
|
7
7
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
8
8
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
|
+
import { createTestOllamaClient } from '@dxos/ai/testing';
|
|
10
11
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
12
|
import { capabilities, createEdgeServices } from '@dxos/artifact-testing';
|
|
12
|
-
import { createTestOllamaClient } from '@dxos/assistant/testing';
|
|
13
13
|
import { EdgeGpt, type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
14
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
15
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
createArtifactCircuit,
|
|
39
39
|
} from './testing';
|
|
40
40
|
|
|
41
|
-
// const FormSchema =
|
|
41
|
+
// const FormSchema = Schema.omit<any, any, ['subgraph']>('subgraph')(ComputeNode);
|
|
42
42
|
|
|
43
43
|
const sidebarTypes: NonNullable<RenderProps['sidebar']>[] = ['canvas', 'compute', 'controller', 'selected'] as const;
|
|
44
44
|
|
|
@@ -177,7 +177,7 @@ const meta: Meta<RenderProps> = {
|
|
|
177
177
|
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
178
178
|
withTheme,
|
|
179
179
|
withAttention,
|
|
180
|
-
withLayout({ fullscreen: true
|
|
180
|
+
withLayout({ fullscreen: true }),
|
|
181
181
|
withPluginManager({ capabilities }),
|
|
182
182
|
],
|
|
183
183
|
};
|
package/src/graph/controller.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FetchHttpClient } from '@effect/platform';
|
|
6
6
|
import { type Context, Effect, Either, Exit, Layer, Scope } from 'effect';
|
|
7
7
|
|
|
8
|
-
import { type ImageContentBlock } from '@dxos/
|
|
8
|
+
import { type ImageContentBlock } from '@dxos/ai';
|
|
9
9
|
import { Event, synchronized } from '@dxos/async';
|
|
10
10
|
import {
|
|
11
11
|
isNotExecuted,
|
|
@@ -145,7 +145,7 @@ export class ComputeGraphController extends Resource {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
setServices(services: Partial<Services>) {
|
|
148
|
+
setServices(services: Partial<Services>): void {
|
|
149
149
|
log.info('setServices', { services });
|
|
150
150
|
Object.assign(this._services, services);
|
|
151
151
|
}
|
|
@@ -187,11 +187,11 @@ export class ComputeGraphController extends Resource {
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
addNode(node: ComputeNode) {
|
|
190
|
+
addNode(node: ComputeNode): void {
|
|
191
191
|
this._graph.addNode(node);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
addEdge(edge: ComputeEdge) {
|
|
194
|
+
addEdge(edge: ComputeEdge): void {
|
|
195
195
|
this._graph.addEdge(edge);
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -199,15 +199,15 @@ export class ComputeGraphController extends Resource {
|
|
|
199
199
|
return this._graph.getNode(nodeId);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
getInputs(nodeId: string) {
|
|
202
|
+
getInputs(nodeId: string): Record<string, RuntimeValue> {
|
|
203
203
|
return this._runtimeStateInputs[nodeId] ?? {};
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
getOutputs(nodeId: string) {
|
|
206
|
+
getOutputs(nodeId: string): Record<string, RuntimeValue> {
|
|
207
207
|
return this._runtimeStateOutputs[nodeId] ?? {};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
setOutput(nodeId: string, property: string, value: any) {
|
|
210
|
+
setOutput(nodeId: string, property: string, value: any): void {
|
|
211
211
|
this._forcedOutputs[nodeId] ??= {};
|
|
212
212
|
this._forcedOutputs[nodeId][property] = value;
|
|
213
213
|
|
|
@@ -232,7 +232,7 @@ export class ComputeGraphController extends Resource {
|
|
|
232
232
|
this._diagnostics = executor.getDiagnostics();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
async evalNode(nodeId: string) {
|
|
235
|
+
async evalNode(nodeId: string): Promise<void> {
|
|
236
236
|
const executor = this._executor.clone();
|
|
237
237
|
await executor.load(this._graph);
|
|
238
238
|
|
|
@@ -281,7 +281,7 @@ export class ComputeGraphController extends Resource {
|
|
|
281
281
|
* @param startFromNode - Node to start from, otherwise all {@link AUTO_TRIGGER_NODES} are executed.
|
|
282
282
|
*/
|
|
283
283
|
@synchronized
|
|
284
|
-
async exec(startFromNode?: string) {
|
|
284
|
+
async exec(startFromNode?: string): Promise<void> {
|
|
285
285
|
this._runtimeStateInputs = {};
|
|
286
286
|
this._runtimeStateOutputs = {};
|
|
287
287
|
const executor = this._executor.clone();
|
|
@@ -372,7 +372,7 @@ export class ComputeGraphController extends Resource {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
private _handleEvent(event: ComputeEvent) {
|
|
375
|
+
private _handleEvent(event: ComputeEvent): void {
|
|
376
376
|
log('handleEvent', { event });
|
|
377
377
|
switch (event.type) {
|
|
378
378
|
case 'compute-input': {
|
|
@@ -388,12 +388,12 @@ export class ComputeGraphController extends Resource {
|
|
|
388
388
|
this.events.emit(event);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
private _onInputComputed(nodeId: string, property: string, value: RuntimeValue) {
|
|
391
|
+
private _onInputComputed(nodeId: string, property: string, value: RuntimeValue): void {
|
|
392
392
|
this._runtimeStateInputs[nodeId] ??= {};
|
|
393
393
|
this._runtimeStateInputs[nodeId][property] = value;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
private _onOutputComputed(nodeId: string, property: string, value: RuntimeValue) {
|
|
396
|
+
private _onOutputComputed(nodeId: string, property: string, value: RuntimeValue): void {
|
|
397
397
|
this._runtimeStateOutputs[nodeId] ??= {};
|
|
398
398
|
this._runtimeStateOutputs[nodeId][property] = value;
|
|
399
399
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import type { ComputeNode, ComputeMeta, ComputeEvent } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
|
|
11
11
|
import { useComputeContext } from './compute-context';
|
|
@@ -67,8 +67,8 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
67
67
|
return {
|
|
68
68
|
node: controller.getComputeNode(shape.node!),
|
|
69
69
|
meta: meta ?? {
|
|
70
|
-
input:
|
|
71
|
-
output:
|
|
70
|
+
input: Schema.Struct({}),
|
|
71
|
+
output: Schema.Struct({}),
|
|
72
72
|
},
|
|
73
73
|
runtime: {
|
|
74
74
|
inputs: controller.getInputs(shape.node!),
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { ObjectId } from '@dxos/echo-schema';
|
|
8
|
+
import { ObjectId, Ref } from '@dxos/echo-schema';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { DXN } from '@dxos/keys';
|
|
11
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
12
11
|
import { type GraphMonitor, type CanvasGraphModel, type Connection } from '@dxos/react-ui-canvas-editor';
|
|
13
12
|
import { isNonNullable } from '@dxos/util';
|
|
@@ -114,9 +113,8 @@ export const createComputeGraph = (graph?: CanvasGraphModel<ComputeShape>) => {
|
|
|
114
113
|
const linkTriggerToCompute = (graph: ComputeGraphModel, computeNode: ComputeNode, triggerData: TriggerShape) => {
|
|
115
114
|
const functionTrigger = triggerData.functionTrigger?.target;
|
|
116
115
|
invariant(functionTrigger);
|
|
117
|
-
functionTrigger.function =
|
|
118
|
-
functionTrigger.
|
|
119
|
-
functionTrigger.meta.computeNodeId = computeNode.id;
|
|
116
|
+
functionTrigger.function = Ref.make(graph.root);
|
|
117
|
+
functionTrigger.inputNodeId = computeNode.id;
|
|
120
118
|
};
|
|
121
119
|
|
|
122
120
|
const deleteTriggerObjects = (computeGraph: ComputeGraphModel, deleted: CanvasGraphModel) => {
|
package/src/json.test.ts
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import { describe, test } from 'vitest';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { BaseGraphEdge, BaseGraphNode } from '@dxos/graph';
|
|
9
9
|
|
|
10
10
|
import { createGptCircuit } from './testing';
|
|
11
11
|
|
|
12
|
-
export const Shape =
|
|
12
|
+
export const Shape = Schema.extend(
|
|
13
13
|
BaseGraphNode,
|
|
14
|
-
|
|
15
|
-
text:
|
|
16
|
-
guide:
|
|
17
|
-
classNames:
|
|
14
|
+
Schema.Struct({
|
|
15
|
+
text: Schema.optional(Schema.String),
|
|
16
|
+
guide: Schema.optional(Schema.Boolean),
|
|
17
|
+
classNames: Schema.optional(Schema.String),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export const Connection =
|
|
21
|
+
export const Connection = Schema.extend(
|
|
22
22
|
BaseGraphEdge,
|
|
23
|
-
|
|
24
|
-
input:
|
|
25
|
-
output:
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
input: Schema.optional(Schema.String),
|
|
25
|
+
output: Schema.optional(Schema.String),
|
|
26
26
|
}),
|
|
27
27
|
);
|
|
28
28
|
|
package/src/schema.test.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import { describe, test } from 'vitest';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
8
|
+
import { live } from '@dxos/client/echo';
|
|
9
9
|
import { BaseGraphNode, Graph } from '@dxos/graph';
|
|
10
10
|
import {
|
|
11
11
|
Polygon,
|
|
@@ -24,12 +24,12 @@ describe('compute', () => {
|
|
|
24
24
|
// const model = CanvasGraphModel.create<ComputeShape>();
|
|
25
25
|
const node = createSwitch({ id: 'x', center: { x: 0, y: 0 }, size: { width: 80, height: 80 } });
|
|
26
26
|
console.log(JSON.stringify(node, null, 2));
|
|
27
|
-
expect(
|
|
28
|
-
expect(
|
|
29
|
-
expect(
|
|
30
|
-
expect(
|
|
27
|
+
expect(Schema.is(ComputeShape)(node)).toBe(true);
|
|
28
|
+
expect(Schema.is(Polygon)(node)).toBe(true);
|
|
29
|
+
expect(Schema.is(Shape)(node)).toBe(true);
|
|
30
|
+
expect(Schema.is(BaseGraphNode)(node)).toBe(true);
|
|
31
31
|
|
|
32
|
-
const graph =
|
|
32
|
+
const graph = live(Graph, { nodes: [], edges: [] });
|
|
33
33
|
graph.nodes.push(node); // Throws.
|
|
34
34
|
|
|
35
35
|
// model.createNode(node);
|
package/src/shapes/Append.tsx
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { AppendInput } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { createFunctionAnchors, FunctionBody, getHeight } from './common';
|
|
12
12
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
|
|
14
|
-
export const AppendShape =
|
|
14
|
+
export const AppendShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
|
16
|
-
|
|
17
|
-
type:
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
type: Schema.Literal('append'),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export type AppendShape =
|
|
21
|
+
export type AppendShape = Schema.Schema.Type<typeof AppendShape>;
|
|
22
22
|
|
|
23
23
|
export type CreateAppendProps = CreateShapeProps<AppendShape>;
|
|
24
24
|
|
package/src/shapes/Array.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { ReducerInput, ReducerOutput } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { createFunctionAnchors, FunctionBody, getHeight } from './common';
|
|
@@ -15,14 +15,14 @@ import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
|
15
15
|
// Data
|
|
16
16
|
//
|
|
17
17
|
|
|
18
|
-
export const ReducerShape =
|
|
18
|
+
export const ReducerShape = Schema.extend(
|
|
19
19
|
ComputeShape,
|
|
20
|
-
|
|
21
|
-
type:
|
|
20
|
+
Schema.Struct({
|
|
21
|
+
type: Schema.Literal('reducer'),
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
export type ReducerShape =
|
|
25
|
+
export type ReducerShape = Schema.Schema.Type<typeof ReducerShape>;
|
|
26
26
|
|
|
27
27
|
//
|
|
28
28
|
// Components
|
package/src/shapes/Audio.tsx
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { Icon } from '@dxos/react-ui';
|
|
9
9
|
import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
12
12
|
import { useComputeNodeState } from '../hooks';
|
|
13
13
|
|
|
14
|
-
export const AudioShape =
|
|
14
|
+
export const AudioShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
|
16
|
-
|
|
17
|
-
type:
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
type: Schema.Literal('audio'),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export type AudioShape =
|
|
21
|
+
export type AudioShape = Schema.Schema.Type<typeof AudioShape>;
|
|
22
22
|
|
|
23
23
|
export type CreateAudioProps = CreateShapeProps<AudioShape>;
|
|
24
24
|
|
package/src/shapes/Beacon.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { Icon } from '@dxos/react-ui';
|
|
10
10
|
import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { mx } from '@dxos/react-ui-theme';
|
|
@@ -13,14 +13,14 @@ import { mx } from '@dxos/react-ui-theme';
|
|
|
13
13
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
14
14
|
import { useComputeNodeState } from '../hooks';
|
|
15
15
|
|
|
16
|
-
export const BeaconShape =
|
|
16
|
+
export const BeaconShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('beacon'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type BeaconShape =
|
|
23
|
+
export type BeaconShape = Schema.Schema.Type<typeof BeaconShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateBeaconProps = CreateShapeProps<BeaconShape>;
|
|
26
26
|
|
package/src/shapes/Boolean.tsx
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { type FC } from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
import { createAnchors, getAnchorPoints } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
@@ -17,14 +17,14 @@ import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from
|
|
|
17
17
|
|
|
18
18
|
type GateType = 'and' | 'or' | 'not';
|
|
19
19
|
|
|
20
|
-
const GateShape =
|
|
20
|
+
const GateShape = Schema.extend(
|
|
21
21
|
ComputeShape,
|
|
22
|
-
|
|
23
|
-
type:
|
|
22
|
+
Schema.Struct({
|
|
23
|
+
type: Schema.String,
|
|
24
24
|
}),
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
type GateShape =
|
|
27
|
+
type GateShape = Schema.Schema.Type<typeof GateShape>;
|
|
28
28
|
|
|
29
29
|
type CreateGateProps = CreateShapeProps<GateShape> & { type: GateType };
|
|
30
30
|
|
package/src/shapes/Chat.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useRef } from 'react';
|
|
6
7
|
|
|
7
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import {
|
|
10
10
|
type ShapeComponentProps,
|
|
11
11
|
type ShapeDef,
|
|
@@ -23,14 +23,14 @@ import { useComputeNodeState } from '../hooks';
|
|
|
23
23
|
// Data
|
|
24
24
|
//
|
|
25
25
|
|
|
26
|
-
export const ChatShape =
|
|
26
|
+
export const ChatShape = Schema.extend(
|
|
27
27
|
ComputeShape,
|
|
28
|
-
|
|
29
|
-
type:
|
|
28
|
+
Schema.Struct({
|
|
29
|
+
type: Schema.Literal('chat'),
|
|
30
30
|
}),
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
export type ChatShape =
|
|
33
|
+
export type ChatShape = Schema.Schema.Type<typeof ChatShape>;
|
|
34
34
|
|
|
35
35
|
//
|
|
36
36
|
// Component
|
package/src/shapes/Constant.tsx
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useCallback, useRef, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { ComputeValueType } from '@dxos/conductor';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { Input } from '@dxos/react-ui';
|
|
10
10
|
import {
|
|
11
11
|
type ShapeComponentProps,
|
|
@@ -25,15 +25,15 @@ import { useComputeNodeState } from '../hooks';
|
|
|
25
25
|
// Data
|
|
26
26
|
//
|
|
27
27
|
|
|
28
|
-
export const ConstantShape =
|
|
28
|
+
export const ConstantShape = Schema.extend(
|
|
29
29
|
ComputeShape,
|
|
30
|
-
|
|
31
|
-
type:
|
|
32
|
-
value:
|
|
30
|
+
Schema.Struct({
|
|
31
|
+
type: Schema.Literal('constant'),
|
|
32
|
+
value: Schema.optional(Schema.Any),
|
|
33
33
|
}),
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
-
export type ConstantShape =
|
|
36
|
+
export type ConstantShape = Schema.Schema.Type<typeof ConstantShape>;
|
|
37
37
|
|
|
38
38
|
//
|
|
39
39
|
// Component
|