@dxos/react-ui-canvas-compute 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549
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 +14 -15
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +14 -15
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +1 -1
- package/dist/types/src/shapes/Trigger.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 +41 -41
- package/src/graph/node-defs.ts +3 -3
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/schema.test.ts +7 -7
- package/src/shapes/Trigger.tsx +3 -4
- package/src/shapes/defs.ts +3 -3
- package/src/testing/circuits.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.7ace549",
|
|
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",
|
|
@@ -29,36 +29,36 @@
|
|
|
29
29
|
"@effect/platform": "0.92.1",
|
|
30
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
31
31
|
"chess.js": "^1.0.0",
|
|
32
|
-
"@dxos/ai": "0.8.4-main.
|
|
33
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/edge-client": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/functions": "0.8.4-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-client": "0.8.4-main.
|
|
50
|
-
"@dxos/react-
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/react-ui-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/util": "0.8.4-main.
|
|
61
|
-
"@dxos/
|
|
32
|
+
"@dxos/ai": "0.8.4-main.7ace549",
|
|
33
|
+
"@dxos/app-framework": "0.8.4-main.7ace549",
|
|
34
|
+
"@dxos/assistant": "0.8.4-main.7ace549",
|
|
35
|
+
"@dxos/context": "0.8.4-main.7ace549",
|
|
36
|
+
"@dxos/conductor": "0.8.4-main.7ace549",
|
|
37
|
+
"@dxos/blueprints": "0.8.4-main.7ace549",
|
|
38
|
+
"@dxos/debug": "0.8.4-main.7ace549",
|
|
39
|
+
"@dxos/echo": "0.8.4-main.7ace549",
|
|
40
|
+
"@dxos/edge-client": "0.8.4-main.7ace549",
|
|
41
|
+
"@dxos/functions": "0.8.4-main.7ace549",
|
|
42
|
+
"@dxos/functions-runtime": "0.8.4-main.7ace549",
|
|
43
|
+
"@dxos/graph": "0.8.4-main.7ace549",
|
|
44
|
+
"@dxos/keys": "0.8.4-main.7ace549",
|
|
45
|
+
"@dxos/live-object": "0.8.4-main.7ace549",
|
|
46
|
+
"@dxos/log": "0.8.4-main.7ace549",
|
|
47
|
+
"@dxos/async": "0.8.4-main.7ace549",
|
|
48
|
+
"@dxos/react-client": "0.8.4-main.7ace549",
|
|
49
|
+
"@dxos/react-edge-client": "0.8.4-main.7ace549",
|
|
50
|
+
"@dxos/react-ui-canvas": "0.8.4-main.7ace549",
|
|
51
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.7ace549",
|
|
52
|
+
"@dxos/react-ui-attention": "0.8.4-main.7ace549",
|
|
53
|
+
"@dxos/react-ui-editor": "0.8.4-main.7ace549",
|
|
54
|
+
"@dxos/invariant": "0.8.4-main.7ace549",
|
|
55
|
+
"@dxos/react-ui-form": "0.8.4-main.7ace549",
|
|
56
|
+
"@dxos/react-ui-sfx": "0.8.4-main.7ace549",
|
|
57
|
+
"@dxos/react-ui-stack": "0.8.4-main.7ace549",
|
|
58
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.7ace549",
|
|
59
|
+
"@dxos/types": "0.8.4-main.7ace549",
|
|
60
|
+
"@dxos/util": "0.8.4-main.7ace549",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.7ace549"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@effect/ai": "0.29.1",
|
|
@@ -71,21 +71,21 @@
|
|
|
71
71
|
"react": "~19.2.0",
|
|
72
72
|
"react-dom": "~19.2.0",
|
|
73
73
|
"vite": "7.1.9",
|
|
74
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
75
|
-
"@dxos/assistant-toolkit": "0.8.4-main.
|
|
76
|
-
"@dxos/compute": "0.8.4-main.
|
|
77
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
78
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
79
|
-
"@dxos/random": "0.8.4-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
81
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
74
|
+
"@dxos/app-framework": "0.8.4-main.7ace549",
|
|
75
|
+
"@dxos/assistant-toolkit": "0.8.4-main.7ace549",
|
|
76
|
+
"@dxos/compute": "0.8.4-main.7ace549",
|
|
77
|
+
"@dxos/echo-signals": "0.8.4-main.7ace549",
|
|
78
|
+
"@dxos/react-ui": "0.8.4-main.7ace549",
|
|
79
|
+
"@dxos/random": "0.8.4-main.7ace549",
|
|
80
|
+
"@dxos/react-ui-theme": "0.8.4-main.7ace549",
|
|
81
|
+
"@dxos/storybook-utils": "0.8.4-main.7ace549"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"effect": "^3.13.3",
|
|
85
85
|
"react": "^19.0.0",
|
|
86
86
|
"react-dom": "^19.0.0",
|
|
87
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
88
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
87
|
+
"@dxos/react-ui": "0.8.4-main.7ace549",
|
|
88
|
+
"@dxos/react-ui-theme": "0.8.4-main.7ace549"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
package/src/graph/node-defs.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
registry,
|
|
13
13
|
} from '@dxos/conductor';
|
|
14
14
|
import { raise } from '@dxos/debug';
|
|
15
|
-
import {
|
|
15
|
+
import { JsonSchema, Obj } from '@dxos/echo';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
|
|
18
18
|
import { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';
|
|
@@ -68,7 +68,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
68
68
|
['switch' as const]: () => createNode('switch'),
|
|
69
69
|
['template' as const]: (shape) => {
|
|
70
70
|
const node = createNode('template', { valueType: (shape as TemplateShape).valueType, value: shape.text });
|
|
71
|
-
node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
|
|
71
|
+
node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
|
|
72
72
|
return node;
|
|
73
73
|
},
|
|
74
74
|
['text' as const]: () => createNode('text'),
|
|
@@ -77,7 +77,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const createNode = (type: string, props?: Partial<ComputeNode>): ComputeNode => ({
|
|
80
|
-
id:
|
|
80
|
+
id: Obj.ID.random(),
|
|
81
81
|
type,
|
|
82
82
|
...props,
|
|
83
83
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
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 { Obj, Ref } from '@dxos/echo';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
11
|
import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
|
|
@@ -27,7 +27,7 @@ export const mapEdge = (
|
|
|
27
27
|
invariant(targetNode?.node);
|
|
28
28
|
|
|
29
29
|
return {
|
|
30
|
-
id:
|
|
30
|
+
id: Obj.ID.random(),
|
|
31
31
|
source: sourceNode.node,
|
|
32
32
|
target: targetNode.node,
|
|
33
33
|
output,
|
package/src/schema.test.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { BaseGraphNode, Graph } from '@dxos/graph';
|
|
8
|
+
import { BaseGraphNode, type Graph } from '@dxos/graph';
|
|
10
9
|
import {
|
|
10
|
+
CanvasGraphModel,
|
|
11
11
|
Polygon,
|
|
12
12
|
Shape,
|
|
13
13
|
createEllipse,
|
|
@@ -21,7 +21,7 @@ import { ComputeShape, createFunction, createSwitch } from './shapes';
|
|
|
21
21
|
|
|
22
22
|
describe('compute', () => {
|
|
23
23
|
test('model', ({ expect }) => {
|
|
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
27
|
expect(Schema.is(ComputeShape)(node)).toBe(true);
|
|
@@ -29,11 +29,11 @@ describe('compute', () => {
|
|
|
29
29
|
expect(Schema.is(Shape)(node)).toBe(true);
|
|
30
30
|
expect(Schema.is(BaseGraphNode)(node)).toBe(true);
|
|
31
31
|
|
|
32
|
-
const graph =
|
|
33
|
-
graph.nodes.push(node);
|
|
32
|
+
const graph: Graph = { nodes: [], edges: [] };
|
|
33
|
+
graph.nodes.push(node);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
model.createNode(node);
|
|
36
|
+
console.log(JSON.stringify(model, null, 2));
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
|
package/src/shapes/Trigger.tsx
CHANGED
|
@@ -6,8 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
|
|
8
8
|
import { VoidInput } from '@dxos/conductor';
|
|
9
|
-
import { Filter, Query } from '@dxos/echo';
|
|
10
|
-
import { ObjectId, Ref } from '@dxos/echo/internal';
|
|
9
|
+
import { Filter, Obj, Query, Ref, Type } from '@dxos/echo';
|
|
11
10
|
import { Trigger, TriggerEvent } from '@dxos/functions';
|
|
12
11
|
import { DXN, SpaceId } from '@dxos/keys';
|
|
13
12
|
import { useSpace } from '@dxos/react-client/echo';
|
|
@@ -21,7 +20,7 @@ export const TriggerShape = Schema.extend(
|
|
|
21
20
|
ComputeShape,
|
|
22
21
|
Schema.Struct({
|
|
23
22
|
type: Schema.Literal('trigger'),
|
|
24
|
-
functionTrigger: Schema.optional(Ref(Trigger.Trigger)),
|
|
23
|
+
functionTrigger: Schema.optional(Type.Ref(Trigger.Trigger)),
|
|
25
24
|
}),
|
|
26
25
|
);
|
|
27
26
|
export type TriggerShape = Schema.Schema.Type<typeof TriggerShape>;
|
|
@@ -122,7 +121,7 @@ const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceI
|
|
|
122
121
|
case 'email':
|
|
123
122
|
return { kind: 'email' } satisfies Trigger.EmailSpec;
|
|
124
123
|
case 'queue': {
|
|
125
|
-
const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(),
|
|
124
|
+
const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), Obj.ID.random()]).toString();
|
|
126
125
|
return { kind: 'queue', queue: dxn } satisfies Trigger.QueueSpec;
|
|
127
126
|
}
|
|
128
127
|
}
|
package/src/shapes/defs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
9
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { Polygon } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
import { type MakeOptional } from '@dxos/util';
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ export const ComputeShape = Schema.extend(
|
|
|
37
37
|
Polygon,
|
|
38
38
|
Schema.Struct({
|
|
39
39
|
// TODO(burdon): Rename computeNode?
|
|
40
|
-
node: Schema.optional(
|
|
40
|
+
node: Schema.optional(Obj.ID.annotations({ description: 'Compute node id' })),
|
|
41
41
|
}).pipe(Schema.mutable),
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -45,7 +45,7 @@ export type ComputeShape = Schema.Schema.Type<typeof ComputeShape>;
|
|
|
45
45
|
|
|
46
46
|
export const createShape = <S extends ComputeShape>({ id, ...rest }: CreateShapeProps<S> & { type: string }): S => {
|
|
47
47
|
return {
|
|
48
|
-
id: id ??
|
|
48
|
+
id: id ?? Obj.ID.random(),
|
|
49
49
|
...rest,
|
|
50
50
|
} as S;
|
|
51
51
|
};
|
package/src/testing/circuits.ts
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { createSystemPrompt } from '@dxos/assistant';
|
|
6
|
-
import { ObjectId } from '@dxos/echo/internal';
|
|
7
6
|
import { type ServiceContainer } from '@dxos/functions-runtime';
|
|
8
|
-
import { DXN, SpaceId } from '@dxos/keys';
|
|
7
|
+
import { DXN, ObjectId, SpaceId } from '@dxos/keys';
|
|
9
8
|
import { type Dimension, type Point } from '@dxos/react-ui-canvas';
|
|
10
9
|
import { CanvasGraphModel, createNote, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
|
|
11
10
|
|