@dxos/react-ui-canvas-compute 0.8.4-main.b97322e → 0.8.4-main.f5c0578

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.
Files changed (78) hide show
  1. package/dist/lib/browser/index.mjs +123 -104
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +123 -104
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/compute.stories.d.ts.map +1 -1
  8. package/dist/types/src/graph/controller.d.ts +30 -4
  9. package/dist/types/src/graph/controller.d.ts.map +1 -1
  10. package/dist/types/src/graph/node-defs.d.ts.map +1 -1
  11. package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
  12. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  13. package/dist/types/src/hooks/useComputeNodeState.d.ts +3 -2
  14. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  15. package/dist/types/src/hooks/useGraphMonitor.d.ts +1 -1
  16. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  17. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  18. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  20. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  22. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Constant.d.ts +1 -1
  24. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  25. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  26. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  28. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  29. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  30. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  31. package/dist/types/src/shapes/Queue.d.ts.map +1 -1
  32. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  33. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  34. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  36. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  37. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  38. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  39. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  40. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  41. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  42. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  43. package/dist/types/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +43 -42
  45. package/src/compute.stories.tsx +14 -16
  46. package/src/graph/controller.ts +8 -8
  47. package/src/graph/node-defs.ts +3 -3
  48. package/src/hooks/useComputeGraphController.ts +1 -1
  49. package/src/hooks/useComputeNodeState.ts +6 -4
  50. package/src/hooks/useGraphMonitor.ts +1 -1
  51. package/src/registry.ts +2 -2
  52. package/src/schema.test.ts +2 -2
  53. package/src/shapes/Append.tsx +2 -2
  54. package/src/shapes/Array.tsx +2 -2
  55. package/src/shapes/Audio.tsx +3 -2
  56. package/src/shapes/Beacon.tsx +3 -2
  57. package/src/shapes/Boolean.tsx +2 -2
  58. package/src/shapes/Chat.tsx +3 -2
  59. package/src/shapes/Constant.tsx +3 -2
  60. package/src/shapes/Database.tsx +1 -1
  61. package/src/shapes/Function.tsx +6 -5
  62. package/src/shapes/Gpt.tsx +6 -4
  63. package/src/shapes/GptRealtime.tsx +1 -1
  64. package/src/shapes/Json.tsx +3 -2
  65. package/src/shapes/Logic.tsx +2 -2
  66. package/src/shapes/Queue.tsx +3 -2
  67. package/src/shapes/RNG.tsx +3 -2
  68. package/src/shapes/Scope.tsx +4 -3
  69. package/src/shapes/Surface.tsx +3 -2
  70. package/src/shapes/Switch.tsx +3 -2
  71. package/src/shapes/Table.tsx +2 -2
  72. package/src/shapes/Template.tsx +4 -3
  73. package/src/shapes/Text.tsx +4 -3
  74. package/src/shapes/TextToImage.tsx +1 -1
  75. package/src/shapes/Thread.tsx +2 -2
  76. package/src/shapes/Trigger.tsx +4 -4
  77. package/src/shapes/common/Box.tsx +1 -1
  78. package/src/shapes/common/FunctionBody.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-canvas-compute",
3
- "version": "0.8.4-main.b97322e",
3
+ "version": "0.8.4-main.f5c0578",
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,63 @@
25
26
  "dependencies": {
26
27
  "@antv/graphlib": "^2.0.4",
27
28
  "@antv/layout": "^1.2.13",
28
- "@effect/platform": "0.89.0",
29
+ "@effect/platform": "0.90.2",
29
30
  "@preact-signals/safe-react": "^0.9.0",
30
31
  "chess.js": "^1.0.0",
31
- "@dxos/ai": "0.8.4-main.b97322e",
32
- "@dxos/app-framework": "0.8.4-main.b97322e",
33
- "@dxos/assistant": "0.8.4-main.b97322e",
34
- "@dxos/async": "0.8.4-main.b97322e",
35
- "@dxos/blueprints": "0.8.4-main.b97322e",
36
- "@dxos/conductor": "0.8.4-main.b97322e",
37
- "@dxos/context": "0.8.4-main.b97322e",
38
- "@dxos/debug": "0.8.4-main.b97322e",
39
- "@dxos/echo-schema": "0.8.4-main.b97322e",
40
- "@dxos/edge-client": "0.8.4-main.b97322e",
41
- "@dxos/functions": "0.8.4-main.b97322e",
42
- "@dxos/graph": "0.8.4-main.b97322e",
43
- "@dxos/invariant": "0.8.4-main.b97322e",
44
- "@dxos/keys": "0.8.4-main.b97322e",
45
- "@dxos/live-object": "0.8.4-main.b97322e",
46
- "@dxos/log": "0.8.4-main.b97322e",
47
- "@dxos/react-edge-client": "0.8.4-main.b97322e",
48
- "@dxos/react-client": "0.8.4-main.b97322e",
49
- "@dxos/react-ui-attention": "0.8.4-main.b97322e",
50
- "@dxos/react-ui-canvas": "0.8.4-main.b97322e",
51
- "@dxos/react-ui-canvas-editor": "0.8.4-main.b97322e",
52
- "@dxos/react-ui-editor": "0.8.4-main.b97322e",
53
- "@dxos/react-ui-form": "0.8.4-main.b97322e",
54
- "@dxos/react-ui-sfx": "0.8.4-main.b97322e",
55
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.b97322e",
56
- "@dxos/react-ui-stack": "0.8.4-main.b97322e",
57
- "@dxos/schema": "0.8.4-main.b97322e",
58
- "@dxos/util": "0.8.4-main.b97322e"
32
+ "@dxos/ai": "0.8.4-main.f5c0578",
33
+ "@dxos/app-framework": "0.8.4-main.f5c0578",
34
+ "@dxos/blueprints": "0.8.4-main.f5c0578",
35
+ "@dxos/conductor": "0.8.4-main.f5c0578",
36
+ "@dxos/assistant": "0.8.4-main.f5c0578",
37
+ "@dxos/context": "0.8.4-main.f5c0578",
38
+ "@dxos/debug": "0.8.4-main.f5c0578",
39
+ "@dxos/echo-schema": "0.8.4-main.f5c0578",
40
+ "@dxos/edge-client": "0.8.4-main.f5c0578",
41
+ "@dxos/async": "0.8.4-main.f5c0578",
42
+ "@dxos/functions": "0.8.4-main.f5c0578",
43
+ "@dxos/invariant": "0.8.4-main.f5c0578",
44
+ "@dxos/graph": "0.8.4-main.f5c0578",
45
+ "@dxos/keys": "0.8.4-main.f5c0578",
46
+ "@dxos/live-object": "0.8.4-main.f5c0578",
47
+ "@dxos/react-edge-client": "0.8.4-main.f5c0578",
48
+ "@dxos/log": "0.8.4-main.f5c0578",
49
+ "@dxos/react-ui-attention": "0.8.4-main.f5c0578",
50
+ "@dxos/react-ui-canvas": "0.8.4-main.f5c0578",
51
+ "@dxos/react-ui-canvas-editor": "0.8.4-main.f5c0578",
52
+ "@dxos/react-ui-editor": "0.8.4-main.f5c0578",
53
+ "@dxos/react-ui-form": "0.8.4-main.f5c0578",
54
+ "@dxos/react-ui-sfx": "0.8.4-main.f5c0578",
55
+ "@dxos/react-ui-stack": "0.8.4-main.f5c0578",
56
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.f5c0578",
57
+ "@dxos/schema": "0.8.4-main.f5c0578",
58
+ "@dxos/util": "0.8.4-main.f5c0578",
59
+ "@dxos/react-client": "0.8.4-main.f5c0578"
59
60
  },
60
61
  "devDependencies": {
61
- "@effect/ai": "0.23.0",
62
+ "@effect/ai": "0.25.2",
62
63
  "@types/lodash.defaultsdeep": "^4.6.6",
63
64
  "@types/react": "~18.2.0",
64
65
  "@types/react-dom": "~18.2.0",
65
- "effect": "3.17.0",
66
+ "effect": "3.17.7",
66
67
  "lodash.defaultsdeep": "^4.6.1",
67
68
  "react": "~18.2.0",
68
69
  "react-dom": "~18.2.0",
69
70
  "vite": "5.4.7",
70
- "@dxos/app-framework": "0.8.4-main.b97322e",
71
- "@dxos/assistant-testing": "0.8.4-main.b97322e",
72
- "@dxos/compute": "0.8.4-main.b97322e",
73
- "@dxos/echo-signals": "0.8.4-main.b97322e",
74
- "@dxos/random": "0.8.4-main.b97322e",
75
- "@dxos/react-ui-theme": "0.8.4-main.b97322e",
76
- "@dxos/storybook-utils": "0.8.4-main.b97322e",
77
- "@dxos/react-ui": "0.8.4-main.b97322e"
71
+ "@dxos/app-framework": "0.8.4-main.f5c0578",
72
+ "@dxos/assistant-testing": "0.8.4-main.f5c0578",
73
+ "@dxos/random": "0.8.4-main.f5c0578",
74
+ "@dxos/echo-signals": "0.8.4-main.f5c0578",
75
+ "@dxos/react-ui": "0.8.4-main.f5c0578",
76
+ "@dxos/react-ui-theme": "0.8.4-main.f5c0578",
77
+ "@dxos/storybook-utils": "0.8.4-main.f5c0578",
78
+ "@dxos/compute": "0.8.4-main.f5c0578"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "effect": "^3.13.3",
81
82
  "react": "~18.2.0",
82
83
  "react-dom": "~18.2.0",
83
- "@dxos/react-ui": "0.8.4-main.b97322e",
84
- "@dxos/react-ui-theme": "0.8.4-main.b97322e"
84
+ "@dxos/react-ui": "0.8.4-main.f5c0578",
85
+ "@dxos/react-ui-theme": "0.8.4-main.f5c0578"
85
86
  },
86
87
  "publishConfig": {
87
88
  "access": "public"
@@ -7,10 +7,8 @@ import '@dxos-theme';
7
7
  import type { Meta, StoryObj } from '@storybook/react-vite';
8
8
  import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
9
9
 
10
- import { EdgeAiServiceClient, AiService } from '@dxos/ai';
11
- import { createTestAiServiceClient } from '@dxos/ai/testing';
12
10
  import { withPluginManager } from '@dxos/app-framework/testing';
13
- import { capabilities, localServiceEndpoints } from '@dxos/assistant-testing';
11
+ import { capabilities } from '@dxos/assistant-testing';
14
12
  import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
15
13
  import { ServiceContainer } from '@dxos/functions';
16
14
  import { withClientProvider } from '@dxos/react-client/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
- createAudioCircuit,
44
- createTransformCircuit,
42
+ createLogicCircuit,
45
43
  createTemplateCircuit,
46
- createArtifactCircuit,
44
+ createTransformCircuit,
47
45
  } from './testing';
48
46
 
49
47
  // const FormSchema = Schema.omit<any, any, ['subgraph']>('subgraph')(ComputeNode);
@@ -258,7 +256,7 @@ export const Template: Story = {
258
256
  ...createComputeGraphController(
259
257
  createTemplateCircuit(),
260
258
  new ServiceContainer().setServices({
261
- ai: AiService.make(new EdgeAiServiceClient({ endpoint: localServiceEndpoints.ai })),
259
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
262
260
  }),
263
261
  ),
264
262
  },
@@ -275,7 +273,7 @@ export const GPT: Story = {
275
273
  ...createComputeGraphController(
276
274
  createGptCircuit({ history: true }),
277
275
  new ServiceContainer().setServices({
278
- ai: AiService.make(new EdgeAiServiceClient({ endpoint: localServiceEndpoints.ai })),
276
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
279
277
  }),
280
278
  ),
281
279
  },
@@ -291,7 +289,7 @@ export const Plugins: Story = {
291
289
  ...createComputeGraphController(
292
290
  createGptCircuit({ history: true, image: true, artifact: true }),
293
291
  new ServiceContainer().setServices({
294
- ai: AiService.make(new EdgeAiServiceClient({ endpoint: localServiceEndpoints.ai })),
292
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
295
293
  }),
296
294
  ),
297
295
  },
@@ -307,7 +305,7 @@ export const Artifact: Story = {
307
305
  ...createComputeGraphController(
308
306
  createArtifactCircuit(),
309
307
  new ServiceContainer().setServices({
310
- ai: AiService.make(new EdgeAiServiceClient({ endpoint: localServiceEndpoints.ai })),
308
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
311
309
  }),
312
310
  ),
313
311
  },
@@ -324,7 +322,7 @@ export const ImageGen: Story = {
324
322
  ...createComputeGraphController(
325
323
  createGptCircuit({ image: true, artifact: true }),
326
324
  new ServiceContainer().setServices({
327
- ai: AiService.make(createTestAiServiceClient()),
325
+ // ai: AiService.make(createTestAiServiceClient()),
328
326
  }),
329
327
  ),
330
328
  },
@@ -340,7 +338,7 @@ export const Audio: Story = {
340
338
  ...createComputeGraphController(
341
339
  createAudioCircuit(),
342
340
  new ServiceContainer().setServices({
343
- ai: AiService.make(createTestAiServiceClient()),
341
+ // ai: AiService.make(createTestAiServiceClient()),
344
342
  }),
345
343
  ),
346
344
  },
@@ -355,7 +353,7 @@ export const Voice: Story = {
355
353
  ...createComputeGraphController(
356
354
  createGPTRealtimeCircuit(),
357
355
  new ServiceContainer().setServices({
358
- ai: AiService.make(createTestAiServiceClient()),
356
+ // ai: AiService.make(createTestAiServiceClient()),
359
357
  }),
360
358
  ),
361
359
  },
@@ -4,15 +4,12 @@
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,
@@ -21,14 +18,17 @@ import {
21
18
  isNotExecuted,
22
19
  } from '@dxos/conductor';
23
20
  import { Resource } from '@dxos/context';
21
+ import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
24
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, ImageContentBlock>;
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<ComputeEvent>();
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<EventLogger> {
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: ComputeEvent): void {
334
+ private _handleEvent(event: ComputeEventPayload): void {
335
335
  log('handleEvent', { event });
336
336
  switch (event.type) {
337
337
  case 'compute-input': {
@@ -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';
@@ -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 EditorRootProps, type EditorController } from '@dxos/react-ui-canvas-editor';
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 { ComputeNode, ComputeMeta, ComputeEvent } from '@dxos/conductor';
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: ComputeEvent) => void) => void;
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: ComputeEvent) => void) => {
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 GraphMonitor, type CanvasGraphModel, type Connection } from '@dxos/react-ui-canvas-editor';
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
@@ -29,10 +29,10 @@ import {
29
29
  surfaceShape,
30
30
  switchShape,
31
31
  templateShape,
32
- threadShape,
32
+ textShape,
33
33
  textToImageShape,
34
+ threadShape,
34
35
  triggerShape,
35
- textShape,
36
36
  } from './shapes';
37
37
 
38
38
  /**
@@ -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 { createSwitch, ComputeShape, createFunction } from './shapes';
20
+ import { ComputeShape, createFunction, createSwitch } from './shapes';
21
21
 
22
22
  describe('compute', () => {
23
23
  test('model', ({ expect }) => {
@@ -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 { createFunctionAnchors, FunctionBody, getHeight } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
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,
@@ -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 { createFunctionAnchors, FunctionBody, getHeight } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
11
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
12
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
13
13
 
14
14
  //
15
15
  // Data
@@ -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 { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
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({
@@ -7,11 +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 { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
+ import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
- import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
13
12
  import { useComputeNodeState } from '../hooks';
14
13
 
14
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
+
15
16
  export const BeaconShape = Schema.extend(
16
17
  ComputeShape,
17
18
  Schema.Struct({
@@ -5,10 +5,10 @@
5
5
  import { Schema } from 'effect';
6
6
  import React, { type FC } from 'react';
7
7
 
8
- import { getAnchorPoints, type ShapeDef } from '@dxos/react-ui-canvas-editor';
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, type CreateShapeProps } from './defs';
11
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
12
12
 
13
13
  //
14
14
  // Gate utils.
@@ -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
  //
@@ -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
  //
@@ -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, type CreateShapeProps } from './defs';
12
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
13
13
 
14
14
  export const DatabaseShape = Schema.extend(
15
15
  ComputeShape,
@@ -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, Ref } from '@dxos/echo-schema';
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
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({
@@ -5,14 +5,14 @@
5
5
  import { Schema } from 'effect';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
- import { type GenerationStreamEvent } from '@dxos/ai';
9
8
  import { GptInput, GptOutput } from '@dxos/conductor';
10
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
10
 
12
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
13
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
14
11
  import { useComputeNodeState } from '../hooks';
15
12
 
13
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
14
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
15
+
16
16
  export const GptShape = Schema.extend(
17
17
  ComputeShape,
18
18
  Schema.Struct({
@@ -43,8 +43,10 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
43
43
  setText('');
44
44
  break;
45
45
  }
46
+
46
47
  case 'custom': {
47
- const token: GenerationStreamEvent = ev.event;
48
+ // TODO(burdon): Any?
49
+ const token = ev.event;
48
50
  switch (token.type) {
49
51
  case 'content_block_delta':
50
52
  switch (token.delta.type) {
@@ -11,7 +11,7 @@ import { Icon } from '@dxos/react-ui';
11
11
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
12
12
 
13
13
  import { createFunctionAnchors } from './common';
14
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
14
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
15
15
 
16
16
  export const GptRealtimeShape = Schema.extend(
17
17
  ComputeShape,
@@ -10,10 +10,11 @@ import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-e
10
10
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
  import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
12
12
 
13
- import { createFunctionAnchors, getHeight, Box } from './common';
14
- import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
15
13
  import { useComputeNodeState } from '../hooks';
16
14
 
15
+ import { Box, createFunctionAnchors, getHeight } from './common';
16
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
17
+
17
18
  //
18
19
  // Data
19
20
  //
@@ -8,8 +8,8 @@ import React from 'react';
8
8
  import { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';
9
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
10
 
11
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
11
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
12
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
13
13
 
14
14
  //
15
15
  // Data
@@ -10,10 +10,11 @@ import { type ThemedClassName } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
11
  import { mx } from '@dxos/react-ui-theme';
12
12
 
13
+ import { useComputeNodeState } from '../hooks';
14
+
13
15
  import { createFunctionAnchors } from './common';
14
16
  import { Box, type BoxActionHandler } from './common';
15
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
16
- import { useComputeNodeState } from '../hooks';
17
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
17
18
 
18
19
  export const QueueShape = Schema.extend(
19
20
  ComputeShape,
@@ -7,11 +7,12 @@ import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
9
9
  import { Icon, type IconProps } from '@dxos/react-ui';
10
- import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
+ import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
- import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
13
12
  import { useComputeNodeState } from '../hooks';
14
13
 
14
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
+
15
16
  export const RandomShape = Schema.extend(
16
17
  ComputeShape,
17
18
  Schema.Struct({