@dxos/react-ui-canvas-compute 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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 +236 -209
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +236 -209
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/compute.stories.d.ts +12 -5
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +33 -24
- 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 +2 -2
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +4 -3
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts +1 -1
- 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 +1 -1
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +1 -1
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +1 -1
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +1 -1
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +1 -1
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +1 -1
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +1 -1
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +1 -1
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +4 -33
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +2 -1
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +53 -49
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +29 -40
- package/src/graph/controller.ts +25 -14
- package/src/graph/node-defs.ts +4 -4
- package/src/hooks/useComputeGraphController.ts +2 -2
- package/src/hooks/useComputeNodeState.ts +10 -7
- package/src/hooks/useGraphMonitor.ts +2 -2
- package/src/json.test.ts +1 -1
- package/src/registry.ts +2 -2
- package/src/schema.test.ts +4 -4
- package/src/shapes/Append.tsx +3 -3
- package/src/shapes/Array.tsx +3 -3
- package/src/shapes/Audio.tsx +5 -4
- package/src/shapes/Beacon.tsx +6 -6
- package/src/shapes/Boolean.tsx +5 -5
- package/src/shapes/Chat.tsx +4 -3
- package/src/shapes/Constant.tsx +4 -3
- package/src/shapes/Database.tsx +2 -2
- package/src/shapes/Function.tsx +10 -9
- package/src/shapes/Gpt.tsx +8 -6
- package/src/shapes/GptRealtime.tsx +3 -3
- package/src/shapes/Json.tsx +4 -3
- package/src/shapes/Logic.tsx +3 -3
- package/src/shapes/Queue.tsx +6 -5
- package/src/shapes/RNG.tsx +10 -6
- package/src/shapes/Scope.tsx +6 -5
- package/src/shapes/Surface.tsx +11 -6
- package/src/shapes/Switch.tsx +5 -4
- package/src/shapes/Table.tsx +6 -6
- package/src/shapes/Template.tsx +6 -5
- package/src/shapes/Text.tsx +5 -4
- package/src/shapes/TextToImage.tsx +2 -2
- package/src/shapes/Thread.tsx +8 -8
- package/src/shapes/Trigger.tsx +42 -54
- package/src/shapes/common/Box.tsx +7 -7
- package/src/shapes/common/FunctionBody.tsx +5 -4
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/shapes/defs.ts +3 -2
- package/src/testing/circuits.ts +5 -5
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.fffef41",
|
|
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",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
+
"source": "./src/index.ts",
|
|
12
13
|
"types": "./dist/types/src/index.d.ts",
|
|
13
14
|
"browser": "./dist/lib/browser/index.mjs",
|
|
14
15
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
@@ -25,63 +26,66 @@
|
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@antv/graphlib": "^2.0.4",
|
|
27
28
|
"@antv/layout": "^1.2.13",
|
|
28
|
-
"@effect/platform": "0.
|
|
29
|
+
"@effect/platform": "0.92.1",
|
|
29
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
30
31
|
"chess.js": "^1.0.0",
|
|
31
|
-
"@dxos/ai": "0.8.4-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/conductor": "0.8.4-main.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/invariant": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-edge-client": "0.8.4-main.
|
|
49
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
50
|
-
"@dxos/react-ui-canvas": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui-editor": "0.8.4-main.
|
|
52
|
-
"@dxos/react-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
58
|
-
"@dxos/
|
|
32
|
+
"@dxos/ai": "0.8.4-main.fffef41",
|
|
33
|
+
"@dxos/assistant": "0.8.4-main.fffef41",
|
|
34
|
+
"@dxos/async": "0.8.4-main.fffef41",
|
|
35
|
+
"@dxos/blueprints": "0.8.4-main.fffef41",
|
|
36
|
+
"@dxos/app-framework": "0.8.4-main.fffef41",
|
|
37
|
+
"@dxos/conductor": "0.8.4-main.fffef41",
|
|
38
|
+
"@dxos/echo": "0.8.4-main.fffef41",
|
|
39
|
+
"@dxos/context": "0.8.4-main.fffef41",
|
|
40
|
+
"@dxos/functions": "0.8.4-main.fffef41",
|
|
41
|
+
"@dxos/edge-client": "0.8.4-main.fffef41",
|
|
42
|
+
"@dxos/graph": "0.8.4-main.fffef41",
|
|
43
|
+
"@dxos/debug": "0.8.4-main.fffef41",
|
|
44
|
+
"@dxos/invariant": "0.8.4-main.fffef41",
|
|
45
|
+
"@dxos/live-object": "0.8.4-main.fffef41",
|
|
46
|
+
"@dxos/functions-runtime": "0.8.4-main.fffef41",
|
|
47
|
+
"@dxos/keys": "0.8.4-main.fffef41",
|
|
48
|
+
"@dxos/log": "0.8.4-main.fffef41",
|
|
49
|
+
"@dxos/react-edge-client": "0.8.4-main.fffef41",
|
|
50
|
+
"@dxos/react-ui-attention": "0.8.4-main.fffef41",
|
|
51
|
+
"@dxos/react-ui-canvas": "0.8.4-main.fffef41",
|
|
52
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.fffef41",
|
|
53
|
+
"@dxos/react-client": "0.8.4-main.fffef41",
|
|
54
|
+
"@dxos/react-ui-sfx": "0.8.4-main.fffef41",
|
|
55
|
+
"@dxos/react-ui-form": "0.8.4-main.fffef41",
|
|
56
|
+
"@dxos/react-ui-editor": "0.8.4-main.fffef41",
|
|
57
|
+
"@dxos/react-ui-stack": "0.8.4-main.fffef41",
|
|
58
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.fffef41",
|
|
59
|
+
"@dxos/schema": "0.8.4-main.fffef41",
|
|
60
|
+
"@dxos/util": "0.8.4-main.fffef41",
|
|
61
|
+
"@dxos/types": "0.8.4-main.fffef41"
|
|
59
62
|
},
|
|
60
63
|
"devDependencies": {
|
|
61
|
-
"@effect/ai": "0.
|
|
64
|
+
"@effect/ai": "0.29.1",
|
|
65
|
+
"@effect/experimental": "0.56.0",
|
|
62
66
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
63
|
-
"@types/react": "~
|
|
64
|
-
"@types/react-dom": "~
|
|
65
|
-
"effect": "3.
|
|
67
|
+
"@types/react": "~19.2.2",
|
|
68
|
+
"@types/react-dom": "~19.2.2",
|
|
69
|
+
"effect": "3.18.3",
|
|
66
70
|
"lodash.defaultsdeep": "^4.6.1",
|
|
67
|
-
"react": "~
|
|
68
|
-
"react-dom": "~
|
|
69
|
-
"vite": "
|
|
70
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
76
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
77
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
71
|
+
"react": "~19.2.0",
|
|
72
|
+
"react-dom": "~19.2.0",
|
|
73
|
+
"vite": "7.1.9",
|
|
74
|
+
"@dxos/app-framework": "0.8.4-main.fffef41",
|
|
75
|
+
"@dxos/compute": "0.8.4-main.fffef41",
|
|
76
|
+
"@dxos/assistant-toolkit": "0.8.4-main.fffef41",
|
|
77
|
+
"@dxos/random": "0.8.4-main.fffef41",
|
|
78
|
+
"@dxos/echo-signals": "0.8.4-main.fffef41",
|
|
79
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
80
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41",
|
|
81
|
+
"@dxos/storybook-utils": "0.8.4-main.fffef41"
|
|
78
82
|
},
|
|
79
83
|
"peerDependencies": {
|
|
80
84
|
"effect": "^3.13.3",
|
|
81
|
-
"react": "
|
|
82
|
-
"react-dom": "
|
|
83
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
84
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
85
|
+
"react": "^19.0.0",
|
|
86
|
+
"react-dom": "^19.0.0",
|
|
87
|
+
"@dxos/react-ui": "0.8.4-main.fffef41",
|
|
88
|
+
"@dxos/react-ui-theme": "0.8.4-main.fffef41"
|
|
85
89
|
},
|
|
86
90
|
"publishConfig": {
|
|
87
91
|
"access": "public"
|
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/internal';
|
|
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,19 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
7
|
|
|
10
|
-
import { EdgeAiServiceClient } from '@dxos/ai';
|
|
11
|
-
import { createTestAiServiceClient } from '@dxos/ai/testing';
|
|
12
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
-
import { capabilities
|
|
9
|
+
import { capabilities } from '@dxos/assistant-toolkit';
|
|
14
10
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
15
|
-
import {
|
|
11
|
+
import { ServiceContainer } from '@dxos/functions-runtime';
|
|
16
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
17
13
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
18
15
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
19
16
|
import {
|
|
20
17
|
CanvasGraphModel,
|
|
@@ -25,7 +22,6 @@ import {
|
|
|
25
22
|
} from '@dxos/react-ui-canvas-editor';
|
|
26
23
|
import { Container, useSelection } from '@dxos/react-ui-canvas-editor/testing';
|
|
27
24
|
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
28
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
29
25
|
|
|
30
26
|
import { DiagnosticOverlay } from './components';
|
|
31
27
|
import { ComputeShapeLayout } from './compute-layout';
|
|
@@ -34,16 +30,16 @@ import { ComputeContext, useComputeGraphController, useGraphMonitor } from './ho
|
|
|
34
30
|
import { computeShapes } from './registry';
|
|
35
31
|
import { type ComputeShape } from './shapes';
|
|
36
32
|
import {
|
|
33
|
+
createArtifactCircuit,
|
|
34
|
+
createAudioCircuit,
|
|
35
|
+
createBasicCircuit,
|
|
36
|
+
createComputeGraphController,
|
|
37
37
|
createControlCircuit,
|
|
38
38
|
createGPTRealtimeCircuit,
|
|
39
|
-
createLogicCircuit,
|
|
40
|
-
createComputeGraphController,
|
|
41
|
-
createBasicCircuit,
|
|
42
39
|
createGptCircuit,
|
|
43
|
-
|
|
44
|
-
createTransformCircuit,
|
|
40
|
+
createLogicCircuit,
|
|
45
41
|
createTemplateCircuit,
|
|
46
|
-
|
|
42
|
+
createTransformCircuit,
|
|
47
43
|
} from './testing';
|
|
48
44
|
|
|
49
45
|
// const FormSchema = Schema.omit<any, any, ['subgraph']>('subgraph')(ComputeNode);
|
|
@@ -123,7 +119,7 @@ const DefaultStory = ({
|
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
return (
|
|
126
|
-
<div className='grid grid-cols-[1fr,360px]
|
|
122
|
+
<div className='grid grid-cols-[1fr,360px] is-full bs-full'>
|
|
127
123
|
<ComputeContext.Provider value={{ controller }}>
|
|
128
124
|
<Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
|
|
129
125
|
<Editor.Root<ComputeShape>
|
|
@@ -145,8 +141,8 @@ const DefaultStory = ({
|
|
|
145
141
|
</ComputeContext.Provider>
|
|
146
142
|
|
|
147
143
|
{sidebar && (
|
|
148
|
-
<Container id='sidebar' classNames='flex flex-col
|
|
149
|
-
<Toolbar.Root
|
|
144
|
+
<Container id='sidebar' classNames='flex flex-col bs-full overflow-hidden'>
|
|
145
|
+
<Toolbar.Root>
|
|
150
146
|
<Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
|
|
151
147
|
<Select.TriggerButton classNames='is-full'>{sidebar}</Select.TriggerButton>
|
|
152
148
|
<Select.Portal>
|
|
@@ -158,12 +154,13 @@ const DefaultStory = ({
|
|
|
158
154
|
</Select.Item>
|
|
159
155
|
))}
|
|
160
156
|
</Select.Viewport>
|
|
157
|
+
<Select.Arrow />
|
|
161
158
|
</Select.Content>
|
|
162
159
|
</Select.Portal>
|
|
163
160
|
</Select.Root>
|
|
164
161
|
</Toolbar.Root>
|
|
165
162
|
|
|
166
|
-
<div className='flex flex-col
|
|
163
|
+
<div className='flex flex-col bs-full overflow-hidden divide-y divider-separator'>
|
|
167
164
|
{sidebar === 'selected' && selected && (
|
|
168
165
|
<div>Form</div>
|
|
169
166
|
// <Form<ComputeNode> schema={FormSchema} values={getComputeNode(selected.id) ?? {}} Custom={{}} />
|
|
@@ -177,22 +174,24 @@ const DefaultStory = ({
|
|
|
177
174
|
);
|
|
178
175
|
};
|
|
179
176
|
|
|
180
|
-
const meta
|
|
177
|
+
const meta = {
|
|
181
178
|
title: 'ui/react-ui-canvas-compute/compute',
|
|
182
|
-
component: Editor.Root,
|
|
179
|
+
component: Editor.Root as any,
|
|
183
180
|
render: DefaultStory,
|
|
184
181
|
decorators: [
|
|
185
182
|
withTheme,
|
|
186
183
|
withAttention,
|
|
187
184
|
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
188
|
-
withLayout({ fullscreen: true }),
|
|
189
185
|
withPluginManager({ capabilities }),
|
|
190
186
|
],
|
|
191
|
-
|
|
187
|
+
parameters: {
|
|
188
|
+
layout: 'fullscreen',
|
|
189
|
+
},
|
|
190
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
192
191
|
|
|
193
192
|
export default meta;
|
|
194
193
|
|
|
195
|
-
type Story = StoryObj<
|
|
194
|
+
type Story = StoryObj<typeof meta>;
|
|
196
195
|
|
|
197
196
|
export const Default: Story = {
|
|
198
197
|
args: {
|
|
@@ -249,16 +248,6 @@ export const Control: Story = {
|
|
|
249
248
|
},
|
|
250
249
|
};
|
|
251
250
|
|
|
252
|
-
// export const Ollama: Story = {
|
|
253
|
-
// args: {
|
|
254
|
-
// // debug: true,
|
|
255
|
-
// showGrid: false,
|
|
256
|
-
// snapToGrid: false,
|
|
257
|
-
// registry: new ShapeRegistry(computeShapes),
|
|
258
|
-
// ...createComputeGraphController(createTest3(), createEdgeServices()),
|
|
259
|
-
// },
|
|
260
|
-
// };
|
|
261
|
-
|
|
262
251
|
export const Template: Story = {
|
|
263
252
|
args: {
|
|
264
253
|
showGrid: false,
|
|
@@ -268,7 +257,7 @@ export const Template: Story = {
|
|
|
268
257
|
...createComputeGraphController(
|
|
269
258
|
createTemplateCircuit(),
|
|
270
259
|
new ServiceContainer().setServices({
|
|
271
|
-
ai: AiService.make(new
|
|
260
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
272
261
|
}),
|
|
273
262
|
),
|
|
274
263
|
},
|
|
@@ -285,7 +274,7 @@ export const GPT: Story = {
|
|
|
285
274
|
...createComputeGraphController(
|
|
286
275
|
createGptCircuit({ history: true }),
|
|
287
276
|
new ServiceContainer().setServices({
|
|
288
|
-
ai: AiService.make(new
|
|
277
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
|
|
289
278
|
}),
|
|
290
279
|
),
|
|
291
280
|
},
|
|
@@ -301,7 +290,7 @@ export const Plugins: Story = {
|
|
|
301
290
|
...createComputeGraphController(
|
|
302
291
|
createGptCircuit({ history: true, image: true, artifact: true }),
|
|
303
292
|
new ServiceContainer().setServices({
|
|
304
|
-
ai: AiService.make(new
|
|
293
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
|
|
305
294
|
}),
|
|
306
295
|
),
|
|
307
296
|
},
|
|
@@ -317,7 +306,7 @@ export const Artifact: Story = {
|
|
|
317
306
|
...createComputeGraphController(
|
|
318
307
|
createArtifactCircuit(),
|
|
319
308
|
new ServiceContainer().setServices({
|
|
320
|
-
ai: AiService.make(new
|
|
309
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
|
|
321
310
|
}),
|
|
322
311
|
),
|
|
323
312
|
},
|
|
@@ -334,7 +323,7 @@ export const ImageGen: Story = {
|
|
|
334
323
|
...createComputeGraphController(
|
|
335
324
|
createGptCircuit({ image: true, artifact: true }),
|
|
336
325
|
new ServiceContainer().setServices({
|
|
337
|
-
ai: AiService.make(createTestAiServiceClient()),
|
|
326
|
+
// ai: AiService.make(createTestAiServiceClient()),
|
|
338
327
|
}),
|
|
339
328
|
),
|
|
340
329
|
},
|
|
@@ -350,7 +339,7 @@ export const Audio: Story = {
|
|
|
350
339
|
...createComputeGraphController(
|
|
351
340
|
createAudioCircuit(),
|
|
352
341
|
new ServiceContainer().setServices({
|
|
353
|
-
ai: AiService.make(createTestAiServiceClient()),
|
|
342
|
+
// ai: AiService.make(createTestAiServiceClient()),
|
|
354
343
|
}),
|
|
355
344
|
),
|
|
356
345
|
},
|
|
@@ -365,7 +354,7 @@ export const Voice: Story = {
|
|
|
365
354
|
...createComputeGraphController(
|
|
366
355
|
createGPTRealtimeCircuit(),
|
|
367
356
|
new ServiceContainer().setServices({
|
|
368
|
-
ai: AiService.make(createTestAiServiceClient()),
|
|
357
|
+
// ai: AiService.make(createTestAiServiceClient()),
|
|
369
358
|
}),
|
|
370
359
|
),
|
|
371
360
|
},
|
package/src/graph/controller.ts
CHANGED
|
@@ -2,33 +2,37 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Context from 'effect/Context';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Either from 'effect/Either';
|
|
8
|
+
import * as Exit from 'effect/Exit';
|
|
9
|
+
import * as Scope from 'effect/Scope';
|
|
6
10
|
|
|
7
|
-
import { type ImageContentBlock } from '@dxos/ai';
|
|
8
11
|
import { Event, synchronized } from '@dxos/async';
|
|
9
12
|
import {
|
|
10
13
|
type ComputeEdge,
|
|
11
|
-
type ComputeEvent,
|
|
12
14
|
type ComputeGraphModel,
|
|
13
|
-
type ComputeMeta,
|
|
14
15
|
type ComputeNode,
|
|
15
|
-
type
|
|
16
|
+
type ComputeNodeMeta,
|
|
16
17
|
type GptInput,
|
|
17
18
|
type GptOutput,
|
|
18
19
|
type GraphDiagnostic,
|
|
19
20
|
GraphExecutor,
|
|
20
|
-
isNotExecuted,
|
|
21
21
|
ValueBag,
|
|
22
|
+
isNotExecuted,
|
|
22
23
|
} from '@dxos/conductor';
|
|
23
24
|
import { Resource } from '@dxos/context';
|
|
24
|
-
import type
|
|
25
|
+
import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
|
|
26
|
+
import { type ServiceContainer } from '@dxos/functions-runtime';
|
|
25
27
|
import { log } from '@dxos/log';
|
|
26
28
|
import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
|
|
29
|
+
import { type ContentBlock } from '@dxos/types';
|
|
27
30
|
|
|
28
|
-
import { resolveComputeNode } from './node-defs';
|
|
29
31
|
import { createComputeGraph } from '../hooks';
|
|
30
32
|
import { type ComputeShape } from '../shapes';
|
|
31
33
|
|
|
34
|
+
import { resolveComputeNode } from './node-defs';
|
|
35
|
+
|
|
32
36
|
// TODO(burdon): API package for conductor.
|
|
33
37
|
export const InvalidStateError = Error;
|
|
34
38
|
|
|
@@ -43,7 +47,7 @@ export interface GptExecutor {
|
|
|
43
47
|
invoke: FunctionCallback<GptInput, GptOutput>;
|
|
44
48
|
|
|
45
49
|
// TODO(dmaretskyi): A hack to get image artifacts working. Rework into querying images from the ai-service store.
|
|
46
|
-
imageCache: Map<string,
|
|
50
|
+
imageCache: Map<string, ContentBlock.Image>;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
export type RuntimeValue =
|
|
@@ -110,7 +114,7 @@ export class ComputeGraphController extends Resource {
|
|
|
110
114
|
/** Computed result. */
|
|
111
115
|
public readonly output = new Event<ComputeOutputEvent>();
|
|
112
116
|
|
|
113
|
-
public readonly events = new Event<
|
|
117
|
+
public readonly events = new Event<ComputeEventPayload>();
|
|
114
118
|
|
|
115
119
|
constructor(
|
|
116
120
|
private readonly _serviceContainer: ServiceContainer,
|
|
@@ -154,7 +158,14 @@ export class ComputeGraphController extends Resource {
|
|
|
154
158
|
/**
|
|
155
159
|
* Inputs and outputs for all nodes.
|
|
156
160
|
*/
|
|
157
|
-
get state()
|
|
161
|
+
get state(): Record<
|
|
162
|
+
string,
|
|
163
|
+
{
|
|
164
|
+
node: ComputeNode;
|
|
165
|
+
input: Record<string, RuntimeValue>;
|
|
166
|
+
output: Record<string, RuntimeValue>;
|
|
167
|
+
}
|
|
168
|
+
> {
|
|
158
169
|
const ids = [...new Set([...Object.keys(this._runtimeStateInputs), ...Object.keys(this._runtimeStateOutputs)])];
|
|
159
170
|
return Object.fromEntries(
|
|
160
171
|
ids.map((id) => [
|
|
@@ -201,7 +212,7 @@ export class ComputeGraphController extends Resource {
|
|
|
201
212
|
});
|
|
202
213
|
}
|
|
203
214
|
|
|
204
|
-
async getMeta(node: ComputeNode): Promise<
|
|
215
|
+
async getMeta(node: ComputeNode): Promise<ComputeNodeMeta> {
|
|
205
216
|
const { meta } = await resolveComputeNode(node);
|
|
206
217
|
return meta;
|
|
207
218
|
}
|
|
@@ -322,7 +333,7 @@ export class ComputeGraphController extends Resource {
|
|
|
322
333
|
this.update.emit();
|
|
323
334
|
}
|
|
324
335
|
|
|
325
|
-
private _createLogger(): Context.Tag.Service<
|
|
336
|
+
private _createLogger(): Context.Tag.Service<ComputeEventLogger> {
|
|
326
337
|
return {
|
|
327
338
|
log: (event) => {
|
|
328
339
|
this._handleEvent(event);
|
|
@@ -331,7 +342,7 @@ export class ComputeGraphController extends Resource {
|
|
|
331
342
|
};
|
|
332
343
|
}
|
|
333
344
|
|
|
334
|
-
private _handleEvent(event:
|
|
345
|
+
private _handleEvent(event: ComputeEventPayload): void {
|
|
335
346
|
log('handleEvent', { event });
|
|
336
347
|
switch (event.type) {
|
|
337
348
|
case 'compute-input': {
|
package/src/graph/node-defs.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
NODE_INPUT,
|
|
7
|
-
NODE_OUTPUT,
|
|
8
6
|
type ComputeNode,
|
|
9
7
|
type Executable,
|
|
8
|
+
NODE_INPUT,
|
|
9
|
+
NODE_OUTPUT,
|
|
10
10
|
type NodeType,
|
|
11
|
-
registry,
|
|
12
11
|
getTemplateInputSchema,
|
|
12
|
+
registry,
|
|
13
13
|
} from '@dxos/conductor';
|
|
14
14
|
import { raise } from '@dxos/debug';
|
|
15
|
-
import { ObjectId, toJsonSchema } from '@dxos/echo
|
|
15
|
+
import { ObjectId, toJsonSchema } from '@dxos/echo/internal';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
|
|
18
18
|
import { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type RefObject, useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type CleanupFn } from '@dxos/async';
|
|
8
|
-
import { type
|
|
8
|
+
import { type EditorController, type EditorRootProps } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
|
|
10
10
|
import { type ComputeGraphController } from '../graph';
|
|
11
11
|
import { type ComputeShape } from '../shapes';
|
|
@@ -21,7 +21,7 @@ const combine = (...cbs: CleanupFn[]) => {
|
|
|
21
21
|
|
|
22
22
|
export type UseComputeGraphControllerOptions = Pick<EditorRootProps<ComputeShape>, 'graph'> & {
|
|
23
23
|
controller: ComputeGraphController | null;
|
|
24
|
-
editorRef: RefObject<EditorController>;
|
|
24
|
+
editorRef: RefObject<EditorController | null>;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export const useComputeGraphController = ({ controller, graph, editorRef }: UseComputeGraphControllerOptions) => {
|
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import type { ComputeNode,
|
|
8
|
+
import type { ComputeNode, ComputeNodeMeta } from '@dxos/conductor';
|
|
9
|
+
import type { ComputeEventPayload } from '@dxos/functions';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
10
11
|
|
|
11
|
-
import { useComputeContext } from './compute-context';
|
|
12
12
|
import { type RuntimeValue } from '../graph';
|
|
13
13
|
import { type ComputeShape } from '../shapes';
|
|
14
14
|
|
|
15
|
+
import { useComputeContext } from './compute-context';
|
|
16
|
+
|
|
15
17
|
export type ComputeNodeState = {
|
|
16
18
|
node: ComputeNode;
|
|
17
|
-
meta:
|
|
19
|
+
meta: ComputeNodeMeta;
|
|
18
20
|
runtime: {
|
|
19
21
|
inputs: Record<string, RuntimeValue>;
|
|
20
22
|
outputs: Record<string, RuntimeValue>;
|
|
21
23
|
setOutput: (property: string, value: any) => void;
|
|
22
24
|
evalNode: () => void;
|
|
23
|
-
subscribeToEventLog: (cb: (event:
|
|
25
|
+
subscribeToEventLog: (cb: (event: ComputeEventPayload) => void) => void;
|
|
24
26
|
};
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -31,7 +33,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
31
33
|
const { controller } = useComputeContext();
|
|
32
34
|
invariant(controller);
|
|
33
35
|
|
|
34
|
-
const [meta, setMeta] = useState<
|
|
36
|
+
const [meta, setMeta] = useState<ComputeNodeMeta>();
|
|
35
37
|
useEffect(() => {
|
|
36
38
|
let disposed = false;
|
|
37
39
|
queueMicrotask(async () => {
|
|
@@ -41,6 +43,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
41
43
|
if (disposed) {
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
46
|
+
|
|
44
47
|
setMeta(meta);
|
|
45
48
|
});
|
|
46
49
|
|
|
@@ -54,7 +57,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
54
57
|
}, [shape.node]);
|
|
55
58
|
|
|
56
59
|
const subscribeToEventLog = useCallback(
|
|
57
|
-
(cb: (event:
|
|
60
|
+
(cb: (event: ComputeEventPayload) => void) => {
|
|
58
61
|
return controller.events.on((ev) => {
|
|
59
62
|
if (ev.nodeId === shape.node) {
|
|
60
63
|
cb(ev);
|
|
@@ -5,10 +5,10 @@
|
|
|
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, Ref } from '@dxos/echo
|
|
8
|
+
import { ObjectId, Ref } from '@dxos/echo/internal';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
|
-
import { type
|
|
11
|
+
import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
|
|
12
12
|
import { isNonNullable } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
import { createComputeNode, isValidComputeNode } from '../graph';
|
package/src/json.test.ts
CHANGED
package/src/registry.ts
CHANGED
package/src/schema.test.ts
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import { live } from '@dxos/
|
|
8
|
+
import { live } from '@dxos/echo/internal';
|
|
9
9
|
import { BaseGraphNode, Graph } from '@dxos/graph';
|
|
10
10
|
import {
|
|
11
11
|
Polygon,
|
|
12
|
+
Shape,
|
|
12
13
|
createEllipse,
|
|
13
14
|
createPath,
|
|
14
15
|
createRectangle,
|
|
15
16
|
isPath,
|
|
16
17
|
isPolygon,
|
|
17
|
-
Shape,
|
|
18
18
|
} from '@dxos/react-ui-canvas-editor';
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { ComputeShape, createFunction, createSwitch } from './shapes';
|
|
21
21
|
|
|
22
22
|
describe('compute', () => {
|
|
23
23
|
test('model', ({ expect }) => {
|
package/src/shapes/Append.tsx
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { AppendInput } from '@dxos/conductor';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { ComputeShape,
|
|
11
|
+
import { FunctionBody, createFunctionAnchors, getHeight } from './common';
|
|
12
|
+
import { ComputeShape, type CreateShapeProps, createShape } from './defs';
|
|
13
13
|
|
|
14
14
|
export const AppendShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
package/src/shapes/Array.tsx
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { ReducerInput, ReducerOutput } from '@dxos/conductor';
|
|
9
9
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { ComputeShape,
|
|
11
|
+
import { FunctionBody, createFunctionAnchors, getHeight } from './common';
|
|
12
|
+
import { ComputeShape, type CreateShapeProps, createShape } from './defs';
|
|
13
13
|
|
|
14
14
|
//
|
|
15
15
|
// Data
|