@dxos/react-ui-canvas-compute 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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 +900 -715
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +900 -715
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +900 -715
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph/controller.d.ts +1 -1
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +1 -1
- package/package.json +40 -38
- package/src/compute.stories.tsx +1 -1
- package/src/graph/controller.ts +12 -12
- package/src/shapes/Gpt.tsx +1 -1
- package/src/shapes/defs.ts +1 -1
package/src/graph/controller.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { FetchHttpClient } from '@effect/platform';
|
|
6
6
|
import { type Context, Effect, Either, Exit, Layer, Scope } from 'effect';
|
|
7
7
|
|
|
8
|
-
import { type ImageContentBlock } from '@dxos/
|
|
8
|
+
import { type ImageContentBlock } from '@dxos/ai';
|
|
9
9
|
import { Event, synchronized } from '@dxos/async';
|
|
10
10
|
import {
|
|
11
11
|
isNotExecuted,
|
|
@@ -145,7 +145,7 @@ export class ComputeGraphController extends Resource {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
setServices(services: Partial<Services>) {
|
|
148
|
+
setServices(services: Partial<Services>): void {
|
|
149
149
|
log.info('setServices', { services });
|
|
150
150
|
Object.assign(this._services, services);
|
|
151
151
|
}
|
|
@@ -187,11 +187,11 @@ export class ComputeGraphController extends Resource {
|
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
addNode(node: ComputeNode) {
|
|
190
|
+
addNode(node: ComputeNode): void {
|
|
191
191
|
this._graph.addNode(node);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
addEdge(edge: ComputeEdge) {
|
|
194
|
+
addEdge(edge: ComputeEdge): void {
|
|
195
195
|
this._graph.addEdge(edge);
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -199,15 +199,15 @@ export class ComputeGraphController extends Resource {
|
|
|
199
199
|
return this._graph.getNode(nodeId);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
getInputs(nodeId: string) {
|
|
202
|
+
getInputs(nodeId: string): Record<string, RuntimeValue> {
|
|
203
203
|
return this._runtimeStateInputs[nodeId] ?? {};
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
getOutputs(nodeId: string) {
|
|
206
|
+
getOutputs(nodeId: string): Record<string, RuntimeValue> {
|
|
207
207
|
return this._runtimeStateOutputs[nodeId] ?? {};
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
setOutput(nodeId: string, property: string, value: any) {
|
|
210
|
+
setOutput(nodeId: string, property: string, value: any): void {
|
|
211
211
|
this._forcedOutputs[nodeId] ??= {};
|
|
212
212
|
this._forcedOutputs[nodeId][property] = value;
|
|
213
213
|
|
|
@@ -232,7 +232,7 @@ export class ComputeGraphController extends Resource {
|
|
|
232
232
|
this._diagnostics = executor.getDiagnostics();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
async evalNode(nodeId: string) {
|
|
235
|
+
async evalNode(nodeId: string): Promise<void> {
|
|
236
236
|
const executor = this._executor.clone();
|
|
237
237
|
await executor.load(this._graph);
|
|
238
238
|
|
|
@@ -281,7 +281,7 @@ export class ComputeGraphController extends Resource {
|
|
|
281
281
|
* @param startFromNode - Node to start from, otherwise all {@link AUTO_TRIGGER_NODES} are executed.
|
|
282
282
|
*/
|
|
283
283
|
@synchronized
|
|
284
|
-
async exec(startFromNode?: string) {
|
|
284
|
+
async exec(startFromNode?: string): Promise<void> {
|
|
285
285
|
this._runtimeStateInputs = {};
|
|
286
286
|
this._runtimeStateOutputs = {};
|
|
287
287
|
const executor = this._executor.clone();
|
|
@@ -372,7 +372,7 @@ export class ComputeGraphController extends Resource {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
private _handleEvent(event: ComputeEvent) {
|
|
375
|
+
private _handleEvent(event: ComputeEvent): void {
|
|
376
376
|
log('handleEvent', { event });
|
|
377
377
|
switch (event.type) {
|
|
378
378
|
case 'compute-input': {
|
|
@@ -388,12 +388,12 @@ export class ComputeGraphController extends Resource {
|
|
|
388
388
|
this.events.emit(event);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
private _onInputComputed(nodeId: string, property: string, value: RuntimeValue) {
|
|
391
|
+
private _onInputComputed(nodeId: string, property: string, value: RuntimeValue): void {
|
|
392
392
|
this._runtimeStateInputs[nodeId] ??= {};
|
|
393
393
|
this._runtimeStateInputs[nodeId][property] = value;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
private _onOutputComputed(nodeId: string, property: string, value: RuntimeValue) {
|
|
396
|
+
private _onOutputComputed(nodeId: string, property: string, value: RuntimeValue): void {
|
|
397
397
|
this._runtimeStateOutputs[nodeId] ??= {};
|
|
398
398
|
this._runtimeStateOutputs[nodeId][property] = value;
|
|
399
399
|
|
package/src/shapes/Gpt.tsx
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import type
|
|
8
|
+
import { type GenerationStreamEvent } from '@dxos/ai';
|
|
9
9
|
import { GptInput, GptOutput } from '@dxos/conductor';
|
|
10
10
|
import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
|
|
11
11
|
|
package/src/shapes/defs.ts
CHANGED
|
@@ -36,7 +36,7 @@ export const ComputeShape = Schema.extend(
|
|
|
36
36
|
Polygon,
|
|
37
37
|
Schema.Struct({
|
|
38
38
|
// TODO(burdon): Rename computeNode?
|
|
39
|
-
node: Schema.optional(ObjectId.annotations({
|
|
39
|
+
node: Schema.optional(ObjectId.annotations({ description: 'Compute node id' })),
|
|
40
40
|
}).pipe(Schema.mutable),
|
|
41
41
|
);
|
|
42
42
|
|