@dxos/react-ui-canvas-compute 0.8.3 → 0.8.4-main.1da679c
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 +243 -201
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +243 -201
- 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 +9 -4
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +31 -5
- 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 +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts +3 -2
- 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/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts.map +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.map +1 -1
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +2 -31
- 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/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 +49 -45
- package/src/compute.stories.tsx +22 -33
- package/src/graph/controller.ts +10 -10
- package/src/graph/node-defs.ts +4 -3
- package/src/hooks/useComputeGraphController.ts +1 -1
- package/src/hooks/useComputeNodeState.ts +6 -4
- package/src/hooks/useGraphMonitor.ts +1 -1
- package/src/registry.ts +2 -2
- package/src/schema.test.ts +2 -2
- package/src/shapes/Append.tsx +2 -2
- package/src/shapes/Array.tsx +2 -2
- package/src/shapes/Audio.tsx +3 -2
- package/src/shapes/Beacon.tsx +4 -4
- package/src/shapes/Boolean.tsx +2 -2
- package/src/shapes/Chat.tsx +3 -2
- package/src/shapes/Constant.tsx +3 -2
- package/src/shapes/Database.tsx +1 -1
- package/src/shapes/Function.tsx +8 -7
- package/src/shapes/Gpt.tsx +6 -4
- package/src/shapes/GptRealtime.tsx +1 -1
- package/src/shapes/Json.tsx +3 -2
- package/src/shapes/Logic.tsx +2 -2
- package/src/shapes/Queue.tsx +3 -2
- package/src/shapes/RNG.tsx +4 -4
- package/src/shapes/Scope.tsx +4 -3
- package/src/shapes/Surface.tsx +4 -3
- package/src/shapes/Switch.tsx +3 -2
- package/src/shapes/Table.tsx +6 -5
- package/src/shapes/Template.tsx +4 -3
- package/src/shapes/Text.tsx +4 -3
- package/src/shapes/TextToImage.tsx +1 -1
- package/src/shapes/Thread.tsx +6 -5
- package/src/shapes/Trigger.tsx +32 -34
- package/src/shapes/common/Box.tsx +2 -2
- package/src/shapes/common/FunctionBody.tsx +1 -1
- package/src/testing/circuits.ts +4 -4
- package/dist/lib/node/index.cjs +0 -2896
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-canvas-compute",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4-main.1da679c",
|
|
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,12 +9,16 @@
|
|
|
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"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"types": "dist/types/src/index.d.ts",
|
|
19
|
+
"typesVersions": {
|
|
20
|
+
"*": {}
|
|
21
|
+
},
|
|
18
22
|
"files": [
|
|
19
23
|
"dist",
|
|
20
24
|
"src"
|
|
@@ -22,64 +26,64 @@
|
|
|
22
26
|
"dependencies": {
|
|
23
27
|
"@antv/graphlib": "^2.0.4",
|
|
24
28
|
"@antv/layout": "^1.2.13",
|
|
25
|
-
"@effect/platform": "0.
|
|
29
|
+
"@effect/platform": "0.90.2",
|
|
26
30
|
"@preact-signals/safe-react": "^0.9.0",
|
|
27
31
|
"chess.js": "^1.0.0",
|
|
28
|
-
"@dxos/ai": "0.8.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/conductor": "0.8.
|
|
34
|
-
"@dxos/context": "0.8.
|
|
35
|
-
"@dxos/debug": "0.8.
|
|
36
|
-
"@dxos/echo
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/graph": "0.8.
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-
|
|
46
|
-
"@dxos/react-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/react-ui-editor": "0.8.
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/react-ui-sfx": "0.8.
|
|
53
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
32
|
+
"@dxos/ai": "0.8.4-main.1da679c",
|
|
33
|
+
"@dxos/app-framework": "0.8.4-main.1da679c",
|
|
34
|
+
"@dxos/async": "0.8.4-main.1da679c",
|
|
35
|
+
"@dxos/blueprints": "0.8.4-main.1da679c",
|
|
36
|
+
"@dxos/assistant": "0.8.4-main.1da679c",
|
|
37
|
+
"@dxos/conductor": "0.8.4-main.1da679c",
|
|
38
|
+
"@dxos/context": "0.8.4-main.1da679c",
|
|
39
|
+
"@dxos/debug": "0.8.4-main.1da679c",
|
|
40
|
+
"@dxos/echo": "0.8.4-main.1da679c",
|
|
41
|
+
"@dxos/echo-schema": "0.8.4-main.1da679c",
|
|
42
|
+
"@dxos/functions": "0.8.4-main.1da679c",
|
|
43
|
+
"@dxos/graph": "0.8.4-main.1da679c",
|
|
44
|
+
"@dxos/invariant": "0.8.4-main.1da679c",
|
|
45
|
+
"@dxos/edge-client": "0.8.4-main.1da679c",
|
|
46
|
+
"@dxos/keys": "0.8.4-main.1da679c",
|
|
47
|
+
"@dxos/log": "0.8.4-main.1da679c",
|
|
48
|
+
"@dxos/live-object": "0.8.4-main.1da679c",
|
|
49
|
+
"@dxos/react-client": "0.8.4-main.1da679c",
|
|
50
|
+
"@dxos/react-edge-client": "0.8.4-main.1da679c",
|
|
51
|
+
"@dxos/react-ui-canvas": "0.8.4-main.1da679c",
|
|
52
|
+
"@dxos/react-ui-attention": "0.8.4-main.1da679c",
|
|
53
|
+
"@dxos/react-ui-canvas-editor": "0.8.4-main.1da679c",
|
|
54
|
+
"@dxos/react-ui-editor": "0.8.4-main.1da679c",
|
|
55
|
+
"@dxos/react-ui-form": "0.8.4-main.1da679c",
|
|
56
|
+
"@dxos/react-ui-sfx": "0.8.4-main.1da679c",
|
|
57
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.1da679c",
|
|
58
|
+
"@dxos/react-ui-stack": "0.8.4-main.1da679c",
|
|
59
|
+
"@dxos/schema": "0.8.4-main.1da679c",
|
|
60
|
+
"@dxos/util": "0.8.4-main.1da679c"
|
|
56
61
|
},
|
|
57
62
|
"devDependencies": {
|
|
58
|
-
"@effect/ai": "0.
|
|
59
|
-
"@effect/platform": "^0.72.1",
|
|
63
|
+
"@effect/ai": "0.25.2",
|
|
60
64
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
61
65
|
"@types/react": "~18.2.0",
|
|
62
66
|
"@types/react-dom": "~18.2.0",
|
|
63
|
-
"effect": "3.
|
|
67
|
+
"effect": "3.17.7",
|
|
64
68
|
"lodash.defaultsdeep": "^4.6.1",
|
|
65
69
|
"react": "~18.2.0",
|
|
66
70
|
"react-dom": "~18.2.0",
|
|
67
|
-
"vite": "
|
|
68
|
-
"@dxos/app-framework": "0.8.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/compute": "0.8.
|
|
71
|
-
"@dxos/echo-signals": "0.8.
|
|
72
|
-
"@dxos/random": "0.8.
|
|
73
|
-
"@dxos/react-ui": "0.8.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
71
|
+
"vite": "7.1.1",
|
|
72
|
+
"@dxos/app-framework": "0.8.4-main.1da679c",
|
|
73
|
+
"@dxos/assistant-testing": "0.8.4-main.1da679c",
|
|
74
|
+
"@dxos/compute": "0.8.4-main.1da679c",
|
|
75
|
+
"@dxos/echo-signals": "0.8.4-main.1da679c",
|
|
76
|
+
"@dxos/random": "0.8.4-main.1da679c",
|
|
77
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
78
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c",
|
|
79
|
+
"@dxos/storybook-utils": "0.8.4-main.1da679c"
|
|
76
80
|
},
|
|
77
81
|
"peerDependencies": {
|
|
78
|
-
"effect": "3.13.3",
|
|
82
|
+
"effect": "^3.13.3",
|
|
79
83
|
"react": "~18.2.0",
|
|
80
84
|
"react-dom": "~18.2.0",
|
|
81
|
-
"@dxos/react-ui": "0.8.
|
|
82
|
-
"@dxos/react-ui-theme": "0.8.
|
|
85
|
+
"@dxos/react-ui": "0.8.4-main.1da679c",
|
|
86
|
+
"@dxos/react-ui-theme": "0.8.4-main.1da679c"
|
|
83
87
|
},
|
|
84
88
|
"publishConfig": {
|
|
85
89
|
"access": "public"
|
package/src/compute.stories.tsx
CHANGED
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import type
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
8
|
import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { EdgeAiServiceClient } from '@dxos/ai';
|
|
11
|
-
import { createTestOllamaClient } from '@dxos/ai/testing';
|
|
12
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
13
|
-
import { capabilities
|
|
11
|
+
import { capabilities } from '@dxos/assistant-testing';
|
|
14
12
|
import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
|
|
15
|
-
import {
|
|
13
|
+
import { ServiceContainer } from '@dxos/functions';
|
|
16
14
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
17
15
|
import { Select, Toolbar } from '@dxos/react-ui';
|
|
18
16
|
import { withAttention } from '@dxos/react-ui-attention/testing';
|
|
@@ -34,16 +32,16 @@ import { ComputeContext, useComputeGraphController, useGraphMonitor } from './ho
|
|
|
34
32
|
import { computeShapes } from './registry';
|
|
35
33
|
import { type ComputeShape } from './shapes';
|
|
36
34
|
import {
|
|
35
|
+
createArtifactCircuit,
|
|
36
|
+
createAudioCircuit,
|
|
37
|
+
createBasicCircuit,
|
|
38
|
+
createComputeGraphController,
|
|
37
39
|
createControlCircuit,
|
|
38
40
|
createGPTRealtimeCircuit,
|
|
39
|
-
createLogicCircuit,
|
|
40
|
-
createComputeGraphController,
|
|
41
|
-
createBasicCircuit,
|
|
42
41
|
createGptCircuit,
|
|
43
|
-
|
|
44
|
-
createTransformCircuit,
|
|
42
|
+
createLogicCircuit,
|
|
45
43
|
createTemplateCircuit,
|
|
46
|
-
|
|
44
|
+
createTransformCircuit,
|
|
47
45
|
} from './testing';
|
|
48
46
|
|
|
49
47
|
// const FormSchema = Schema.omit<any, any, ['subgraph']>('subgraph')(ComputeNode);
|
|
@@ -158,6 +156,7 @@ const DefaultStory = ({
|
|
|
158
156
|
</Select.Item>
|
|
159
157
|
))}
|
|
160
158
|
</Select.Viewport>
|
|
159
|
+
<Select.Arrow />
|
|
161
160
|
</Select.Content>
|
|
162
161
|
</Select.Portal>
|
|
163
162
|
</Select.Root>
|
|
@@ -177,22 +176,22 @@ const DefaultStory = ({
|
|
|
177
176
|
);
|
|
178
177
|
};
|
|
179
178
|
|
|
180
|
-
const meta
|
|
179
|
+
const meta = {
|
|
181
180
|
title: 'ui/react-ui-canvas-compute/compute',
|
|
182
|
-
component: Editor.Root,
|
|
181
|
+
component: Editor.Root as any,
|
|
183
182
|
render: DefaultStory,
|
|
184
183
|
decorators: [
|
|
185
|
-
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
186
184
|
withTheme,
|
|
187
185
|
withAttention,
|
|
186
|
+
withClientProvider({ createIdentity: true, createSpace: true }),
|
|
188
187
|
withLayout({ fullscreen: true }),
|
|
189
188
|
withPluginManager({ capabilities }),
|
|
190
189
|
],
|
|
191
|
-
}
|
|
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(
|
|
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(
|
|
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(
|
|
357
|
+
// ai: AiService.make(createTestAiServiceClient()),
|
|
369
358
|
}),
|
|
370
359
|
),
|
|
371
360
|
},
|
package/src/graph/controller.ts
CHANGED
|
@@ -4,31 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Context, Effect, Either, Exit, Scope } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { type ImageContentBlock } from '@dxos/ai';
|
|
8
7
|
import { Event, synchronized } from '@dxos/async';
|
|
9
8
|
import {
|
|
10
9
|
type ComputeEdge,
|
|
11
|
-
type ComputeEvent,
|
|
12
10
|
type ComputeGraphModel,
|
|
13
11
|
type ComputeMeta,
|
|
14
12
|
type ComputeNode,
|
|
15
|
-
type EventLogger,
|
|
16
13
|
type GptInput,
|
|
17
14
|
type GptOutput,
|
|
18
15
|
type GraphDiagnostic,
|
|
19
16
|
GraphExecutor,
|
|
20
|
-
isNotExecuted,
|
|
21
17
|
ValueBag,
|
|
18
|
+
isNotExecuted,
|
|
22
19
|
} from '@dxos/conductor';
|
|
23
20
|
import { Resource } from '@dxos/context';
|
|
24
|
-
import type
|
|
21
|
+
import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
|
|
22
|
+
import { type ServiceContainer } from '@dxos/functions';
|
|
25
23
|
import { log } from '@dxos/log';
|
|
26
24
|
import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
|
|
25
|
+
import { type ContentBlock } from '@dxos/schema';
|
|
27
26
|
|
|
28
|
-
import { resolveComputeNode } from './node-defs';
|
|
29
27
|
import { createComputeGraph } from '../hooks';
|
|
30
28
|
import { type ComputeShape } from '../shapes';
|
|
31
29
|
|
|
30
|
+
import { resolveComputeNode } from './node-defs';
|
|
31
|
+
|
|
32
32
|
// TODO(burdon): API package for conductor.
|
|
33
33
|
export const InvalidStateError = Error;
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@ export interface GptExecutor {
|
|
|
43
43
|
invoke: FunctionCallback<GptInput, GptOutput>;
|
|
44
44
|
|
|
45
45
|
// TODO(dmaretskyi): A hack to get image artifacts working. Rework into querying images from the ai-service store.
|
|
46
|
-
imageCache: Map<string,
|
|
46
|
+
imageCache: Map<string, ContentBlock.Image>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export type RuntimeValue =
|
|
@@ -110,7 +110,7 @@ export class ComputeGraphController extends Resource {
|
|
|
110
110
|
/** Computed result. */
|
|
111
111
|
public readonly output = new Event<ComputeOutputEvent>();
|
|
112
112
|
|
|
113
|
-
public readonly events = new Event<
|
|
113
|
+
public readonly events = new Event<ComputeEventPayload>();
|
|
114
114
|
|
|
115
115
|
constructor(
|
|
116
116
|
private readonly _serviceContainer: ServiceContainer,
|
|
@@ -322,7 +322,7 @@ export class ComputeGraphController extends Resource {
|
|
|
322
322
|
this.update.emit();
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
private _createLogger(): Context.Tag.Service<
|
|
325
|
+
private _createLogger(): Context.Tag.Service<ComputeEventLogger> {
|
|
326
326
|
return {
|
|
327
327
|
log: (event) => {
|
|
328
328
|
this._handleEvent(event);
|
|
@@ -331,7 +331,7 @@ export class ComputeGraphController extends Resource {
|
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
private _handleEvent(event:
|
|
334
|
+
private _handleEvent(event: ComputeEventPayload): void {
|
|
335
335
|
log('handleEvent', { event });
|
|
336
336
|
switch (event.type) {
|
|
337
337
|
case 'compute-input': {
|
package/src/graph/node-defs.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
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
15
|
import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
|
|
@@ -49,6 +49,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
|
|
|
49
49
|
createNode('constant', {
|
|
50
50
|
value: (shape as ConstantShape).value,
|
|
51
51
|
}),
|
|
52
|
+
['make-queue' as const]: () => createNode('make-queue'),
|
|
52
53
|
['database' as const]: () => createNode('database'),
|
|
53
54
|
['gpt' as const]: () => createNode('gpt'),
|
|
54
55
|
['gpt-realtime' as const]: () => createNode('gpt-realtime'),
|
|
@@ -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';
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { ComputeMeta, ComputeNode } 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
19
|
meta: ComputeMeta;
|
|
@@ -20,7 +22,7 @@ export type ComputeNodeState = {
|
|
|
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
|
|
|
@@ -54,7 +56,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
|
|
|
54
56
|
}, [shape.node]);
|
|
55
57
|
|
|
56
58
|
const subscribeToEventLog = useCallback(
|
|
57
|
-
(cb: (event:
|
|
59
|
+
(cb: (event: ComputeEventPayload) => void) => {
|
|
58
60
|
return controller.events.on((ev) => {
|
|
59
61
|
if (ev.nodeId === shape.node) {
|
|
60
62
|
cb(ev);
|
|
@@ -8,7 +8,7 @@ import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, D
|
|
|
8
8
|
import { ObjectId, Ref } from '@dxos/echo-schema';
|
|
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/registry.ts
CHANGED
package/src/schema.test.ts
CHANGED
|
@@ -9,15 +9,15 @@ import { live } from '@dxos/client/echo';
|
|
|
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
|
@@ -8,8 +8,8 @@ import React from 'react';
|
|
|
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
|
@@ -8,8 +8,8 @@ import React from 'react';
|
|
|
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
|
package/src/shapes/Audio.tsx
CHANGED
|
@@ -6,11 +6,12 @@ import { Schema } from 'effect';
|
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Icon } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
9
|
+
import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
|
-
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
12
11
|
import { useComputeNodeState } from '../hooks';
|
|
13
12
|
|
|
13
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
14
|
+
|
|
14
15
|
export const AudioShape = Schema.extend(
|
|
15
16
|
ComputeShape,
|
|
16
17
|
Schema.Struct({
|
package/src/shapes/Beacon.tsx
CHANGED
|
@@ -7,12 +7,12 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
|
|
9
9
|
import { Icon } from '@dxos/react-ui';
|
|
10
|
-
import {
|
|
11
|
-
import { mx } from '@dxos/react-ui-theme';
|
|
10
|
+
import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
12
11
|
|
|
13
|
-
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
14
12
|
import { useComputeNodeState } from '../hooks';
|
|
15
13
|
|
|
14
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
15
|
+
|
|
16
16
|
export const BeaconShape = Schema.extend(
|
|
17
17
|
ComputeShape,
|
|
18
18
|
Schema.Struct({
|
|
@@ -36,7 +36,7 @@ export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) =>
|
|
|
36
36
|
<div className='flex w-full justify-center items-center'>
|
|
37
37
|
<Icon
|
|
38
38
|
icon='ph--sun--regular'
|
|
39
|
-
classNames={
|
|
39
|
+
classNames={['transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500']}
|
|
40
40
|
size={8}
|
|
41
41
|
/>
|
|
42
42
|
</div>
|
package/src/shapes/Boolean.tsx
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import React, { type FC } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { type ShapeDef, getAnchorPoints } from '@dxos/react-ui-canvas-editor';
|
|
9
9
|
import { createAnchors } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
|
-
import { ComputeShape, createAnchorId, createShape
|
|
11
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
12
12
|
|
|
13
13
|
//
|
|
14
14
|
// Gate utils.
|
package/src/shapes/Chat.tsx
CHANGED
|
@@ -15,10 +15,11 @@ import {
|
|
|
15
15
|
} from '@dxos/react-ui-canvas-editor';
|
|
16
16
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
17
17
|
|
|
18
|
-
import { Box } from './common';
|
|
19
|
-
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
20
18
|
import { useComputeNodeState } from '../hooks';
|
|
21
19
|
|
|
20
|
+
import { Box } from './common';
|
|
21
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
22
|
+
|
|
22
23
|
//
|
|
23
24
|
// Data
|
|
24
25
|
//
|
package/src/shapes/Constant.tsx
CHANGED
|
@@ -17,10 +17,11 @@ import {
|
|
|
17
17
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
18
18
|
import { safeParseJson } from '@dxos/util';
|
|
19
19
|
|
|
20
|
-
import { Box, TypeSelect } from './common';
|
|
21
|
-
import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
|
|
22
20
|
import { useComputeNodeState } from '../hooks';
|
|
23
21
|
|
|
22
|
+
import { Box, TypeSelect } from './common';
|
|
23
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
24
|
+
|
|
24
25
|
//
|
|
25
26
|
// Data
|
|
26
27
|
//
|
package/src/shapes/Database.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-e
|
|
|
9
9
|
import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
|
|
10
10
|
|
|
11
11
|
import { Box } from './common';
|
|
12
|
-
import { ComputeShape, createAnchorId, createShape
|
|
12
|
+
import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
|
|
13
13
|
|
|
14
14
|
export const DatabaseShape = Schema.extend(
|
|
15
15
|
ComputeShape,
|
package/src/shapes/Function.tsx
CHANGED
|
@@ -6,22 +6,23 @@ import { Schema } from 'effect';
|
|
|
6
6
|
import React, { useCallback, useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import { AnyOutput, FunctionInput } from '@dxos/conductor';
|
|
9
|
-
import { getSnapshot, isInstanceOf
|
|
9
|
+
import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo-schema';
|
|
10
10
|
import { FunctionType, ScriptType } from '@dxos/functions';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
|
-
import { Filter,
|
|
12
|
+
import { Filter, parseId } from '@dxos/react-client/echo';
|
|
13
13
|
import {
|
|
14
|
+
type ShapeComponentProps,
|
|
15
|
+
type ShapeDef,
|
|
14
16
|
TextBox,
|
|
15
17
|
type TextBoxControl,
|
|
16
18
|
type TextBoxProps,
|
|
17
|
-
type ShapeComponentProps,
|
|
18
|
-
type ShapeDef,
|
|
19
19
|
} from '@dxos/react-ui-canvas-editor';
|
|
20
20
|
|
|
21
|
-
import { Box, createFunctionAnchors } from './common';
|
|
22
|
-
import { ComputeShape, createShape, type CreateShapeProps } from './defs';
|
|
23
21
|
import { useComputeNodeState } from '../hooks';
|
|
24
22
|
|
|
23
|
+
import { Box, createFunctionAnchors } from './common';
|
|
24
|
+
import { ComputeShape, type CreateShapeProps, createShape } from './defs';
|
|
25
|
+
|
|
25
26
|
export const FunctionShape = Schema.extend(
|
|
26
27
|
ComputeShape,
|
|
27
28
|
Schema.Struct({
|
|
@@ -69,7 +70,7 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
node.value = value;
|
|
72
|
-
node.function =
|
|
73
|
+
node.function = Ref.make(fn);
|
|
73
74
|
node.inputSchema = getSnapshot(fn.inputSchema);
|
|
74
75
|
node.outputSchema = getSnapshot(fn.outputSchema);
|
|
75
76
|
},
|