@dxos/react-ui-canvas-compute 0.8.2-main.36232bc → 0.8.2-main.5ca3450
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 +137 -136
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +168 -167
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +137 -136
- 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 +1 -17
- 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 +40 -39
- package/src/compute.stories.tsx +1 -1
- package/src/hooks/useComputeNodeState.ts +3 -3
- package/src/hooks/useGraphMonitor.ts +4 -6
- package/src/json.test.ts +10 -10
- package/src/schema.test.ts +5 -5
- 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 +7 -6
- package/src/shapes/Gpt.tsx +5 -5
- 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 +30 -31
- package/src/shapes/common/FunctionBody.tsx +11 -9
- package/src/shapes/defs.ts +9 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.5ca3450",
|
|
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",
|
|
@@ -24,33 +24,34 @@
|
|
|
24
24
|
"@antv/layout": "^1.2.13",
|
|
25
25
|
"@effect/platform": "0.75.1",
|
|
26
26
|
"chess.js": "^1.0.0",
|
|
27
|
-
"@dxos/app-framework": "0.8.2-main.
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/context": "0.8.2-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/react-client": "0.8.2-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/react-
|
|
45
|
-
"@dxos/react-ui-canvas-editor": "0.8.2-main.
|
|
46
|
-
"@dxos/react-ui-
|
|
47
|
-
"@dxos/react-ui-
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/react-ui-
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/schema": "0.8.2-main.
|
|
27
|
+
"@dxos/app-framework": "0.8.2-main.5ca3450",
|
|
28
|
+
"@dxos/artifact": "0.8.2-main.5ca3450",
|
|
29
|
+
"@dxos/assistant": "0.8.2-main.5ca3450",
|
|
30
|
+
"@dxos/async": "0.8.2-main.5ca3450",
|
|
31
|
+
"@dxos/context": "0.8.2-main.5ca3450",
|
|
32
|
+
"@dxos/echo": "0.8.2-main.5ca3450",
|
|
33
|
+
"@dxos/debug": "0.8.2-main.5ca3450",
|
|
34
|
+
"@dxos/conductor": "0.8.2-main.5ca3450",
|
|
35
|
+
"@dxos/echo-schema": "0.8.2-main.5ca3450",
|
|
36
|
+
"@dxos/functions": "0.8.2-main.5ca3450",
|
|
37
|
+
"@dxos/graph": "0.8.2-main.5ca3450",
|
|
38
|
+
"@dxos/edge-client": "0.8.2-main.5ca3450",
|
|
39
|
+
"@dxos/invariant": "0.8.2-main.5ca3450",
|
|
40
|
+
"@dxos/keys": "0.8.2-main.5ca3450",
|
|
41
|
+
"@dxos/log": "0.8.2-main.5ca3450",
|
|
42
|
+
"@dxos/react-client": "0.8.2-main.5ca3450",
|
|
43
|
+
"@dxos/live-object": "0.8.2-main.5ca3450",
|
|
44
|
+
"@dxos/react-edge-client": "0.8.2-main.5ca3450",
|
|
45
|
+
"@dxos/react-ui-canvas-editor": "0.8.2-main.5ca3450",
|
|
46
|
+
"@dxos/react-ui-canvas": "0.8.2-main.5ca3450",
|
|
47
|
+
"@dxos/react-ui-editor": "0.8.2-main.5ca3450",
|
|
48
|
+
"@dxos/react-ui-attention": "0.8.2-main.5ca3450",
|
|
49
|
+
"@dxos/react-ui-form": "0.8.2-main.5ca3450",
|
|
50
|
+
"@dxos/react-ui-sfx": "0.8.2-main.5ca3450",
|
|
51
|
+
"@dxos/react-ui-stack": "0.8.2-main.5ca3450",
|
|
52
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-main.5ca3450",
|
|
53
|
+
"@dxos/schema": "0.8.2-main.5ca3450",
|
|
54
|
+
"@dxos/util": "0.8.2-main.5ca3450"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@effect/ai": "0.8.0",
|
|
@@ -58,26 +59,26 @@
|
|
|
58
59
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
59
60
|
"@types/react": "~18.2.0",
|
|
60
61
|
"@types/react-dom": "~18.2.0",
|
|
61
|
-
"effect": "3.
|
|
62
|
+
"effect": "3.14.21",
|
|
62
63
|
"lodash.defaultsdeep": "^4.6.1",
|
|
63
64
|
"react": "~18.2.0",
|
|
64
65
|
"react-dom": "~18.2.0",
|
|
65
66
|
"vite": "5.4.7",
|
|
66
|
-
"@dxos/app-framework": "0.8.2-main.
|
|
67
|
-
"@dxos/artifact-testing": "0.8.2-main.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
67
|
+
"@dxos/app-framework": "0.8.2-main.5ca3450",
|
|
68
|
+
"@dxos/artifact-testing": "0.8.2-main.5ca3450",
|
|
69
|
+
"@dxos/compute": "0.8.2-main.5ca3450",
|
|
70
|
+
"@dxos/random": "0.8.2-main.5ca3450",
|
|
71
|
+
"@dxos/echo-signals": "0.8.2-main.5ca3450",
|
|
72
|
+
"@dxos/react-ui-theme": "0.8.2-main.5ca3450",
|
|
73
|
+
"@dxos/react-ui": "0.8.2-main.5ca3450",
|
|
74
|
+
"@dxos/storybook-utils": "0.8.2-main.5ca3450"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
77
|
"effect": "3.13.3",
|
|
77
78
|
"react": "~18.2.0",
|
|
78
79
|
"react-dom": "~18.2.0",
|
|
79
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.2-main.
|
|
80
|
+
"@dxos/react-ui": "0.8.2-main.5ca3450",
|
|
81
|
+
"@dxos/react-ui-theme": "0.8.2-main.5ca3450"
|
|
81
82
|
},
|
|
82
83
|
"publishConfig": {
|
|
83
84
|
"access": "public"
|
package/src/compute.stories.tsx
CHANGED
|
@@ -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
|
|
|
@@ -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 {
|
|
8
|
+
import { Type } from '@dxos/echo';
|
|
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';
|
|
@@ -28,7 +27,7 @@ export const mapEdge = (
|
|
|
28
27
|
invariant(targetNode?.node);
|
|
29
28
|
|
|
30
29
|
return {
|
|
31
|
-
id: ObjectId.random(),
|
|
30
|
+
id: Type.ObjectId.random(),
|
|
32
31
|
source: sourceNode.node,
|
|
33
32
|
target: targetNode.node,
|
|
34
33
|
output,
|
|
@@ -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 = Type.ref(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
8
|
import { live } from '@dxos/client/echo';
|
|
8
|
-
import { S } from '@dxos/echo-schema';
|
|
9
9
|
import { BaseGraphNode, Graph } from '@dxos/graph';
|
|
10
10
|
import {
|
|
11
11
|
Polygon,
|
|
@@ -24,10 +24,10 @@ 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
32
|
const graph = live(Graph, { nodes: [], edges: [] });
|
|
33
33
|
graph.nodes.push(node); // Throws.
|
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
|
package/src/shapes/Database.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
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { Box } from './common';
|
|
12
12
|
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
13
13
|
|
|
14
|
-
export const DatabaseShape =
|
|
14
|
+
export const DatabaseShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
|
16
|
-
|
|
17
|
-
type:
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
type: Schema.Literal('database'),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export type DatabaseShape =
|
|
21
|
+
export type DatabaseShape = Schema.Schema.Type<typeof DatabaseShape>;
|
|
22
22
|
|
|
23
23
|
export type CreateDatabaseProps = CreateShapeProps<DatabaseShape>;
|
|
24
24
|
|
package/src/shapes/Function.tsx
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useCallback, useRef } from 'react';
|
|
6
7
|
|
|
7
8
|
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
8
|
-
import { getSnapshot, isInstanceOf
|
|
9
|
-
import { FunctionType, ScriptType } from '@dxos/functions
|
|
9
|
+
import { getSnapshot, isInstanceOf } from '@dxos/echo-schema';
|
|
10
|
+
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
12
|
import { Filter, makeRef, parseId } from '@dxos/react-client/echo';
|
|
12
13
|
import {
|
|
@@ -21,14 +22,14 @@ import { Box, createFunctionAnchors } from './common';
|
|
|
21
22
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
22
23
|
import { useComputeNodeState } from '../hooks';
|
|
23
24
|
|
|
24
|
-
export const FunctionShape =
|
|
25
|
+
export const FunctionShape = Schema.extend(
|
|
25
26
|
ComputeShape,
|
|
26
|
-
|
|
27
|
-
type:
|
|
27
|
+
Schema.Struct({
|
|
28
|
+
type: Schema.Literal('function'),
|
|
28
29
|
}),
|
|
29
30
|
);
|
|
30
31
|
|
|
31
|
-
export type FunctionShape =
|
|
32
|
+
export type FunctionShape = Schema.Schema.Type<typeof FunctionShape>;
|
|
32
33
|
|
|
33
34
|
export type CreateFunctionProps = CreateShapeProps<FunctionShape>;
|
|
34
35
|
|
package/src/shapes/Gpt.tsx
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
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
8
|
import type { GenerationStreamEvent } from '@dxos/assistant';
|
|
8
9
|
import { GptInput, GptOutput } from '@dxos/conductor';
|
|
9
|
-
import { S } from '@dxos/echo-schema';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
|
12
12
|
import { createFunctionAnchors, FunctionBody, getHeight } from './common';
|
|
13
13
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
14
14
|
import { useComputeNodeState } from '../hooks';
|
|
15
15
|
|
|
16
|
-
export const GptShape =
|
|
16
|
+
export const GptShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('gpt'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type GptShape =
|
|
23
|
+
export type GptShape = Schema.Schema.Type<typeof GptShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateGptProps = CreateShapeProps<GptShape>;
|
|
26
26
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Schema } from 'effect';
|
|
5
6
|
import React, { useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import { S } from '@dxos/echo-schema';
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { useConfig } from '@dxos/react-client';
|
|
10
10
|
import { Icon } from '@dxos/react-ui';
|
|
@@ -13,14 +13,14 @@ import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-e
|
|
|
13
13
|
import { createFunctionAnchors } from './common';
|
|
14
14
|
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
15
15
|
|
|
16
|
-
export const GptRealtimeShape =
|
|
16
|
+
export const GptRealtimeShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
|
-
|
|
19
|
-
type:
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
type: Schema.Literal('gpt-realtime'),
|
|
20
20
|
}),
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
export type GptRealtimeShape =
|
|
23
|
+
export type GptRealtimeShape = Schema.Schema.Type<typeof GptRealtimeShape>;
|
|
24
24
|
|
|
25
25
|
export type CreateGptRealtimeProps = CreateShapeProps<GptRealtimeShape>;
|
|
26
26
|
|
|
@@ -164,10 +164,10 @@ export const gptRealtimeShape: ShapeDef<GptRealtimeShape> = {
|
|
|
164
164
|
getAnchors: (shape) =>
|
|
165
165
|
createFunctionAnchors(
|
|
166
166
|
shape,
|
|
167
|
-
|
|
168
|
-
audio:
|
|
167
|
+
Schema.Struct({
|
|
168
|
+
audio: Schema.Any,
|
|
169
169
|
}),
|
|
170
|
-
|
|
170
|
+
Schema.Struct({}),
|
|
171
171
|
),
|
|
172
172
|
resizable: true,
|
|
173
173
|
};
|
package/src/shapes/Json.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, DefaultOutput, JsonTransformInput } 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
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
@@ -18,23 +18,23 @@ import { useComputeNodeState } from '../hooks';
|
|
|
18
18
|
// Data
|
|
19
19
|
//
|
|
20
20
|
|
|
21
|
-
export const JsonShape =
|
|
21
|
+
export const JsonShape = Schema.extend(
|
|
22
22
|
ComputeShape,
|
|
23
|
-
|
|
24
|
-
type:
|
|
23
|
+
Schema.Struct({
|
|
24
|
+
type: Schema.Literal('json'),
|
|
25
25
|
}),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
export type JsonShape =
|
|
28
|
+
export type JsonShape = Schema.Schema.Type<typeof JsonShape>;
|
|
29
29
|
|
|
30
|
-
export const JsonTransformShape =
|
|
30
|
+
export const JsonTransformShape = Schema.extend(
|
|
31
31
|
ComputeShape,
|
|
32
|
-
|
|
33
|
-
type:
|
|
32
|
+
Schema.Struct({
|
|
33
|
+
type: Schema.Literal('json-transform'),
|
|
34
34
|
}),
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
export type JsonTransformShape =
|
|
37
|
+
export type JsonTransformShape = Schema.Schema.Type<typeof JsonTransformShape>;
|
|
38
38
|
|
|
39
39
|
//
|
|
40
40
|
// Component
|