@dxos/react-ui-canvas-compute 0.8.4-main.fd6878d → 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 +112 -105
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +112 -105
- package/dist/lib/node-esm/index.mjs.map +3 -3
- 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 +13 -30
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -2
- package/dist/types/src/hooks/useComputeNodeState.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 +2 -2
- 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/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 +52 -49
- package/src/compute-layout.ts +1 -1
- package/src/compute.stories.tsx +18 -17
- package/src/graph/controller.ts +17 -6
- package/src/graph/node-defs.ts +1 -1
- package/src/hooks/useComputeGraphController.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +5 -4
- package/src/hooks/useGraphMonitor.ts +1 -1
- package/src/json.test.ts +1 -1
- package/src/schema.test.ts +2 -2
- package/src/shapes/Append.tsx +1 -1
- package/src/shapes/Array.tsx +1 -1
- package/src/shapes/Audio.tsx +2 -2
- package/src/shapes/Beacon.tsx +2 -2
- package/src/shapes/Boolean.tsx +3 -3
- package/src/shapes/Chat.tsx +1 -1
- package/src/shapes/Constant.tsx +1 -1
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/Function.tsx +5 -5
- package/src/shapes/Gpt.tsx +2 -2
- package/src/shapes/GptRealtime.tsx +2 -2
- package/src/shapes/Json.tsx +1 -1
- package/src/shapes/Logic.tsx +1 -1
- package/src/shapes/Queue.tsx +3 -3
- package/src/shapes/RNG.tsx +6 -2
- package/src/shapes/Scope.tsx +2 -2
- package/src/shapes/Surface.tsx +7 -3
- package/src/shapes/Switch.tsx +2 -2
- package/src/shapes/Table.tsx +4 -4
- package/src/shapes/Template.tsx +2 -2
- package/src/shapes/Text.tsx +1 -1
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +6 -6
- package/src/shapes/Trigger.tsx +40 -52
- package/src/shapes/common/Box.tsx +5 -5
- package/src/shapes/common/FunctionBody.tsx +4 -3
- package/src/shapes/common/TypeSelect.tsx +1 -1
- package/src/shapes/defs.ts +3 -2
- package/src/testing/circuits.ts +2 -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.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",
|
|
@@ -26,63 +26,66 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@antv/graphlib": "^2.0.4",
|
|
28
28
|
"@antv/layout": "^1.2.13",
|
|
29
|
-
"@effect/platform": "0.
|
|
29
|
+
"@effect/platform": "0.92.1",
|
|
30
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
31
31
|
"chess.js": "^1.0.0",
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/async": "0.8.4-main.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/conductor": "0.8.4-main.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/edge-client": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-edge-client": "0.8.4-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/react-ui-canvas": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-canvas-editor": "0.8.4-main.
|
|
53
|
-
"@dxos/react-
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/react-ui-
|
|
57
|
-
"@dxos/react-ui-stack": "0.8.4-main.
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@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"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
|
-
"@effect/ai": "0.
|
|
64
|
+
"@effect/ai": "0.29.1",
|
|
65
|
+
"@effect/experimental": "0.56.0",
|
|
63
66
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
64
|
-
"@types/react": "~
|
|
65
|
-
"@types/react-dom": "~
|
|
66
|
-
"effect": "3.
|
|
67
|
+
"@types/react": "~19.2.2",
|
|
68
|
+
"@types/react-dom": "~19.2.2",
|
|
69
|
+
"effect": "3.18.3",
|
|
67
70
|
"lodash.defaultsdeep": "^4.6.1",
|
|
68
|
-
"react": "~
|
|
69
|
-
"react-dom": "~
|
|
70
|
-
"vite": "
|
|
71
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
72
|
-
"@dxos/compute": "0.8.4-main.
|
|
73
|
-
"@dxos/assistant-
|
|
74
|
-
"@dxos/random": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@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"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
84
|
"effect": "^3.13.3",
|
|
82
|
-
"react": "
|
|
83
|
-
"react-dom": "
|
|
84
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
85
|
-
"@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"
|
|
86
89
|
},
|
|
87
90
|
"publishConfig": {
|
|
88
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,17 +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
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
-
import { capabilities } from '@dxos/assistant-
|
|
9
|
+
import { capabilities } from '@dxos/assistant-toolkit';
|
|
12
10
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
13
|
-
import { ServiceContainer } from '@dxos/functions';
|
|
11
|
+
import { ServiceContainer } from '@dxos/functions-runtime';
|
|
14
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
13
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
14
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
16
15
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
17
16
|
import {
|
|
18
17
|
CanvasGraphModel,
|
|
@@ -23,7 +22,6 @@ import {
|
|
|
23
22
|
} from '@dxos/react-ui-canvas-editor';
|
|
24
23
|
import { Container, useSelection } from '@dxos/react-ui-canvas-editor/testing';
|
|
25
24
|
import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
|
|
26
|
-
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
27
25
|
|
|
28
26
|
import { DiagnosticOverlay } from './components';
|
|
29
27
|
import { ComputeShapeLayout } from './compute-layout';
|
|
@@ -121,7 +119,7 @@ const DefaultStory = ({
|
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
return (
|
|
124
|
-
<div className='grid grid-cols-[1fr,360px]
|
|
122
|
+
<div className='grid grid-cols-[1fr,360px] is-full bs-full'>
|
|
125
123
|
<ComputeContext.Provider value={{ controller }}>
|
|
126
124
|
<Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
|
|
127
125
|
<Editor.Root<ComputeShape>
|
|
@@ -143,8 +141,8 @@ const DefaultStory = ({
|
|
|
143
141
|
</ComputeContext.Provider>
|
|
144
142
|
|
|
145
143
|
{sidebar && (
|
|
146
|
-
<Container id='sidebar' classNames='flex flex-col
|
|
147
|
-
<Toolbar.Root
|
|
144
|
+
<Container id='sidebar' classNames='flex flex-col bs-full overflow-hidden'>
|
|
145
|
+
<Toolbar.Root>
|
|
148
146
|
<Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
|
|
149
147
|
<Select.TriggerButton classNames='is-full'>{sidebar}</Select.TriggerButton>
|
|
150
148
|
<Select.Portal>
|
|
@@ -156,12 +154,13 @@ const DefaultStory = ({
|
|
|
156
154
|
</Select.Item>
|
|
157
155
|
))}
|
|
158
156
|
</Select.Viewport>
|
|
157
|
+
<Select.Arrow />
|
|
159
158
|
</Select.Content>
|
|
160
159
|
</Select.Portal>
|
|
161
160
|
</Select.Root>
|
|
162
161
|
</Toolbar.Root>
|
|
163
162
|
|
|
164
|
-
<div className='flex flex-col
|
|
163
|
+
<div className='flex flex-col bs-full overflow-hidden divide-y divider-separator'>
|
|
165
164
|
{sidebar === 'selected' && selected && (
|
|
166
165
|
<div>Form</div>
|
|
167
166
|
// <Form<ComputeNode> schema={FormSchema} values={getComputeNode(selected.id) ?? {}} Custom={{}} />
|
|
@@ -175,22 +174,24 @@ const DefaultStory = ({
|
|
|
175
174
|
);
|
|
176
175
|
};
|
|
177
176
|
|
|
178
|
-
const meta
|
|
177
|
+
const meta = {
|
|
179
178
|
title: 'ui/react-ui-canvas-compute/compute',
|
|
180
|
-
component: Editor.Root,
|
|
179
|
+
component: Editor.Root as any,
|
|
181
180
|
render: DefaultStory,
|
|
182
181
|
decorators: [
|
|
183
182
|
withTheme,
|
|
184
183
|
withAttention,
|
|
185
184
|
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
186
|
-
withLayout({ fullscreen: true }),
|
|
187
185
|
withPluginManager({ capabilities }),
|
|
188
186
|
],
|
|
189
|
-
|
|
187
|
+
parameters: {
|
|
188
|
+
layout: 'fullscreen',
|
|
189
|
+
},
|
|
190
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
190
191
|
|
|
191
192
|
export default meta;
|
|
192
193
|
|
|
193
|
-
type Story = StoryObj<
|
|
194
|
+
type Story = StoryObj<typeof meta>;
|
|
194
195
|
|
|
195
196
|
export const Default: Story = {
|
|
196
197
|
args: {
|
|
@@ -289,7 +290,7 @@ export const Plugins: Story = {
|
|
|
289
290
|
...createComputeGraphController(
|
|
290
291
|
createGptCircuit({ history: true, image: true, artifact: true }),
|
|
291
292
|
new ServiceContainer().setServices({
|
|
292
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint:
|
|
293
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
|
|
293
294
|
}),
|
|
294
295
|
),
|
|
295
296
|
},
|
|
@@ -305,7 +306,7 @@ export const Artifact: Story = {
|
|
|
305
306
|
...createComputeGraphController(
|
|
306
307
|
createArtifactCircuit(),
|
|
307
308
|
new ServiceContainer().setServices({
|
|
308
|
-
// ai: AiService.make(new Edge AiServiceClient({ endpoint:
|
|
309
|
+
// ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
|
|
309
310
|
}),
|
|
310
311
|
),
|
|
311
312
|
},
|
package/src/graph/controller.ts
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
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
11
|
import { Event, synchronized } from '@dxos/async';
|
|
8
12
|
import {
|
|
9
13
|
type ComputeEdge,
|
|
10
14
|
type ComputeGraphModel,
|
|
11
|
-
type ComputeMeta,
|
|
12
15
|
type ComputeNode,
|
|
16
|
+
type ComputeNodeMeta,
|
|
13
17
|
type GptInput,
|
|
14
18
|
type GptOutput,
|
|
15
19
|
type GraphDiagnostic,
|
|
@@ -19,10 +23,10 @@ import {
|
|
|
19
23
|
} from '@dxos/conductor';
|
|
20
24
|
import { Resource } from '@dxos/context';
|
|
21
25
|
import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
|
|
22
|
-
import { type ServiceContainer } from '@dxos/functions';
|
|
26
|
+
import { type ServiceContainer } from '@dxos/functions-runtime';
|
|
23
27
|
import { log } from '@dxos/log';
|
|
24
28
|
import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
|
|
25
|
-
import { type ContentBlock } from '@dxos/
|
|
29
|
+
import { type ContentBlock } from '@dxos/types';
|
|
26
30
|
|
|
27
31
|
import { createComputeGraph } from '../hooks';
|
|
28
32
|
import { type ComputeShape } from '../shapes';
|
|
@@ -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
|
}
|
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 { 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';
|
|
@@ -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,10 +2,10 @@
|
|
|
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 {
|
|
8
|
+
import type { ComputeNode, ComputeNodeMeta } from '@dxos/conductor';
|
|
9
9
|
import type { ComputeEventPayload } from '@dxos/functions';
|
|
10
10
|
import { invariant } from '@dxos/invariant';
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ import { useComputeContext } from './compute-context';
|
|
|
16
16
|
|
|
17
17
|
export type ComputeNodeState = {
|
|
18
18
|
node: ComputeNode;
|
|
19
|
-
meta:
|
|
19
|
+
meta: ComputeNodeMeta;
|
|
20
20
|
runtime: {
|
|
21
21
|
inputs: Record<string, RuntimeValue>;
|
|
22
22
|
outputs: Record<string, RuntimeValue>;
|
|
@@ -33,7 +33,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
33
33
|
const { controller } = useComputeContext();
|
|
34
34
|
invariant(controller);
|
|
35
35
|
|
|
36
|
-
const [meta, setMeta] = useState<
|
|
36
|
+
const [meta, setMeta] = useState<ComputeNodeMeta>();
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
let disposed = false;
|
|
39
39
|
queueMicrotask(async () => {
|
|
@@ -43,6 +43,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
43
43
|
if (disposed) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
|
|
46
47
|
setMeta(meta);
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -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 { 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
11
|
import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
|
package/src/json.test.ts
CHANGED
package/src/schema.test.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
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,
|
package/src/shapes/Append.tsx
CHANGED
package/src/shapes/Array.tsx
CHANGED
package/src/shapes/Audio.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Icon } from '@dxos/react-ui';
|
|
@@ -35,7 +35,7 @@ export const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {
|
|
|
35
35
|
|
|
36
36
|
// https://docs.pmnd.rs/react-three-fiber/api/canvas#render-props
|
|
37
37
|
return (
|
|
38
|
-
<div className='flex
|
|
38
|
+
<div className='flex is-full justify-center items-center'>
|
|
39
39
|
<Icon
|
|
40
40
|
icon={active ? 'ph--microphone--regular' : 'ph--microphone-slash--regular'}
|
|
41
41
|
classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-red-500']}
|
package/src/shapes/Beacon.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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 { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
|
|
@@ -33,7 +33,7 @@ export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) =>
|
|
|
33
33
|
const value = input?.type === 'executed' ? input.value : false;
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<div className='flex
|
|
36
|
+
<div className='flex is-full justify-center items-center'>
|
|
37
37
|
<Icon
|
|
38
38
|
icon='ph--sun--regular'
|
|
39
39
|
classNames={['transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500']}
|
package/src/shapes/Boolean.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { type FC } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type ShapeDef, getAnchorPoints } from '@dxos/react-ui-canvas-editor';
|
|
@@ -57,7 +57,7 @@ const defineShape = <S extends GateShape>({
|
|
|
57
57
|
// Be careful not to name component factories with a capital letter.
|
|
58
58
|
component: () => {
|
|
59
59
|
return (
|
|
60
|
-
<div className='flex
|
|
60
|
+
<div className='flex is-full justify-center items-center'>
|
|
61
61
|
<Symbol />
|
|
62
62
|
</div>
|
|
63
63
|
);
|
|
@@ -95,7 +95,7 @@ const createSymbol =
|
|
|
95
95
|
const paths = pathConstructor({ startX, endX, height });
|
|
96
96
|
|
|
97
97
|
return (
|
|
98
|
-
<svg viewBox={`0 0 ${width} ${height}`} className='
|
|
98
|
+
<svg viewBox={`0 0 ${width} ${height}`} className='is-full bs-full'>
|
|
99
99
|
{/* Input line. */}
|
|
100
100
|
{getAnchorPoints({ x: 0, y: centerY }, inputs).map(({ x, y }, i) => (
|
|
101
101
|
<line key={i} x1={x} y1={y} x2={startX * 1.3} y2={y} strokeWidth={strokeWidth} className={className} />
|
package/src/shapes/Chat.tsx
CHANGED
package/src/shapes/Constant.tsx
CHANGED
package/src/shapes/Database.tsx
CHANGED
package/src/shapes/Function.tsx
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useCallback, useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
9
|
-
import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo
|
|
10
|
-
import {
|
|
9
|
+
import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo/internal';
|
|
10
|
+
import { Function, Script } from '@dxos/functions';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { Filter, parseId } from '@dxos/react-client/echo';
|
|
13
13
|
import {
|
|
@@ -58,13 +58,13 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
58
58
|
|
|
59
59
|
const space = client.spaces.get(spaceId);
|
|
60
60
|
const object = space?.db.getObjectById(objectId);
|
|
61
|
-
if (!space || !isInstanceOf(
|
|
61
|
+
if (!space || !isInstanceOf(Script.Script, object)) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const {
|
|
66
66
|
objects: [fn],
|
|
67
|
-
} = await space.db.query(Filter.type(
|
|
67
|
+
} = await space.db.query(Filter.type(Function.Function, { source: Ref.make(object) })).run();
|
|
68
68
|
if (!fn) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
package/src/shapes/Gpt.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { GptInput, GptOutput } from '@dxos/conductor';
|
|
@@ -74,7 +74,7 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
|
|
|
74
74
|
return (
|
|
75
75
|
<FunctionBody
|
|
76
76
|
shape={shape}
|
|
77
|
-
content={<div className='
|
|
77
|
+
content={<div className='pli-2 plb-1 overflow-y-auto'>{text}</div>}
|
|
78
78
|
status={`${tokens} tokens`}
|
|
79
79
|
inputSchema={meta.input}
|
|
80
80
|
outputSchema={meta.output}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
@@ -143,7 +143,7 @@ export const GptRealtimeComponent = ({ shape }: ShapeComponentProps<GptRealtimeS
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
return (
|
|
146
|
-
<div className='flex
|
|
146
|
+
<div className='flex is-full justify-center items-center'>
|
|
147
147
|
<Icon
|
|
148
148
|
icon={isReady ? 'ph--waveform--regular' : isLive ? 'ph--pulse--regular' : 'ph--play--regular'}
|
|
149
149
|
size={16}
|
package/src/shapes/Json.tsx
CHANGED
package/src/shapes/Logic.tsx
CHANGED
package/src/shapes/Queue.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { Fragment } from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_OUTPUT, QueueInput, QueueOutput } from '@dxos/conductor';
|
|
@@ -42,9 +42,9 @@ export const QueueComponent = ({ shape }: ShapeComponentProps<QueueShape>) => {
|
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<Box shape={shape} status={`${items.length} items`} onAction={handleAction}>
|
|
45
|
-
<div className='flex flex-col
|
|
45
|
+
<div className='flex flex-col is-full overflow-y-auto divide-y divide-separator'>
|
|
46
46
|
{[...items].map((item, i) => (
|
|
47
|
-
<QueueItem key={i} classNames='p-1
|
|
47
|
+
<QueueItem key={i} classNames='p-1 pli-2' item={item} />
|
|
48
48
|
))}
|
|
49
49
|
</div>
|
|
50
50
|
</Box>
|
package/src/shapes/RNG.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_OUTPUT } from '@dxos/conductor';
|
|
@@ -27,7 +27,11 @@ export type RandomShape = Schema.Schema.Type<typeof RandomShape>;
|
|
|
27
27
|
export type CreateRandomProps = CreateShapeProps<RandomShape>;
|
|
28
28
|
|
|
29
29
|
export const createRandom = (props: CreateRandomProps) =>
|
|
30
|
-
createShape<RandomShape>({
|
|
30
|
+
createShape<RandomShape>({
|
|
31
|
+
type: 'rng',
|
|
32
|
+
size: { width: 64, height: 64 },
|
|
33
|
+
...props,
|
|
34
|
+
});
|
|
31
35
|
|
|
32
36
|
const icons = [
|
|
33
37
|
'ph--dice-one--regular',
|