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

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 (34) hide show
  1. package/dist/lib/browser/index.mjs +74 -70
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +74 -70
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/compute.stories.d.ts +1 -1
  8. package/dist/types/src/compute.stories.d.ts.map +1 -1
  9. package/dist/types/src/graph/controller.d.ts +1 -1
  10. package/dist/types/src/graph/controller.d.ts.map +1 -1
  11. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  12. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  13. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  14. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  15. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  16. package/dist/types/src/testing/circuits.d.ts +1 -1
  17. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  18. package/dist/types/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +46 -44
  20. package/src/compute.stories.tsx +9 -19
  21. package/src/graph/controller.ts +2 -2
  22. package/src/graph/node-defs.ts +1 -0
  23. package/src/shapes/Beacon.tsx +1 -2
  24. package/src/shapes/Function.tsx +2 -2
  25. package/src/shapes/RNG.tsx +1 -2
  26. package/src/shapes/Surface.tsx +1 -1
  27. package/src/shapes/Table.tsx +4 -3
  28. package/src/shapes/Thread.tsx +4 -3
  29. package/src/shapes/Trigger.tsx +5 -5
  30. package/src/shapes/common/Box.tsx +1 -1
  31. package/src/testing/circuits.ts +4 -4
  32. package/dist/lib/node/index.cjs +0 -2896
  33. package/dist/lib/node/index.cjs.map +0 -7
  34. 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",
3
+ "version": "0.8.4-main.b97322e",
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",
@@ -15,6 +15,9 @@
15
15
  }
16
16
  },
17
17
  "types": "dist/types/src/index.d.ts",
18
+ "typesVersions": {
19
+ "*": {}
20
+ },
18
21
  "files": [
19
22
  "dist",
20
23
  "src"
@@ -22,64 +25,63 @@
22
25
  "dependencies": {
23
26
  "@antv/graphlib": "^2.0.4",
24
27
  "@antv/layout": "^1.2.13",
25
- "@effect/platform": "0.80.12",
28
+ "@effect/platform": "0.89.0",
26
29
  "@preact-signals/safe-react": "^0.9.0",
27
30
  "chess.js": "^1.0.0",
28
- "@dxos/ai": "0.8.3",
29
- "@dxos/artifact": "0.8.3",
30
- "@dxos/assistant": "0.8.3",
31
- "@dxos/async": "0.8.3",
32
- "@dxos/app-framework": "0.8.3",
33
- "@dxos/conductor": "0.8.3",
34
- "@dxos/context": "0.8.3",
35
- "@dxos/debug": "0.8.3",
36
- "@dxos/echo-schema": "0.8.3",
37
- "@dxos/edge-client": "0.8.3",
38
- "@dxos/invariant": "0.8.3",
39
- "@dxos/graph": "0.8.3",
40
- "@dxos/keys": "0.8.3",
41
- "@dxos/live-object": "0.8.3",
42
- "@dxos/log": "0.8.3",
43
- "@dxos/react-client": "0.8.3",
44
- "@dxos/react-ui-attention": "0.8.3",
45
- "@dxos/react-edge-client": "0.8.3",
46
- "@dxos/react-ui-canvas": "0.8.3",
47
- "@dxos/functions": "0.8.3",
48
- "@dxos/react-ui-canvas-editor": "0.8.3",
49
- "@dxos/react-ui-editor": "0.8.3",
50
- "@dxos/react-ui-form": "0.8.3",
51
- "@dxos/react-ui-stack": "0.8.3",
52
- "@dxos/react-ui-sfx": "0.8.3",
53
- "@dxos/react-ui-syntax-highlighter": "0.8.3",
54
- "@dxos/schema": "0.8.3",
55
- "@dxos/util": "0.8.3"
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"
56
59
  },
57
60
  "devDependencies": {
58
- "@effect/ai": "0.8.0",
59
- "@effect/platform": "^0.72.1",
61
+ "@effect/ai": "0.23.0",
60
62
  "@types/lodash.defaultsdeep": "^4.6.6",
61
63
  "@types/react": "~18.2.0",
62
64
  "@types/react-dom": "~18.2.0",
63
- "effect": "3.14.21",
65
+ "effect": "3.17.0",
64
66
  "lodash.defaultsdeep": "^4.6.1",
65
67
  "react": "~18.2.0",
66
68
  "react-dom": "~18.2.0",
67
69
  "vite": "5.4.7",
68
- "@dxos/app-framework": "0.8.3",
69
- "@dxos/artifact-testing": "0.8.3",
70
- "@dxos/compute": "0.8.3",
71
- "@dxos/echo-signals": "0.8.3",
72
- "@dxos/random": "0.8.3",
73
- "@dxos/react-ui": "0.8.3",
74
- "@dxos/storybook-utils": "0.8.3",
75
- "@dxos/react-ui-theme": "0.8.3"
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"
76
78
  },
77
79
  "peerDependencies": {
78
- "effect": "3.13.3",
80
+ "effect": "^3.13.3",
79
81
  "react": "~18.2.0",
80
82
  "react-dom": "~18.2.0",
81
- "@dxos/react-ui": "0.8.3",
82
- "@dxos/react-ui-theme": "0.8.3"
83
+ "@dxos/react-ui": "0.8.4-main.b97322e",
84
+ "@dxos/react-ui-theme": "0.8.4-main.b97322e"
83
85
  },
84
86
  "publishConfig": {
85
87
  "access": "public"
@@ -4,15 +4,15 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import type { Meta, StoryObj } from '@storybook/react';
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 } from '@dxos/ai';
11
- import { createTestOllamaClient } from '@dxos/ai/testing';
10
+ import { EdgeAiServiceClient, AiService } from '@dxos/ai';
11
+ import { createTestAiServiceClient } from '@dxos/ai/testing';
12
12
  import { withPluginManager } from '@dxos/app-framework/testing';
13
- import { capabilities, localServiceEndpoints } from '@dxos/artifact-testing';
13
+ import { capabilities, localServiceEndpoints } from '@dxos/assistant-testing';
14
14
  import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
15
- import { AiService, ServiceContainer } from '@dxos/functions';
15
+ import { ServiceContainer } from '@dxos/functions';
16
16
  import { withClientProvider } from '@dxos/react-client/testing';
17
17
  import { Select, Toolbar } from '@dxos/react-ui';
18
18
  import { withAttention } from '@dxos/react-ui-attention/testing';
@@ -182,9 +182,9 @@ const meta: Meta<RenderProps> = {
182
182
  component: Editor.Root,
183
183
  render: DefaultStory,
184
184
  decorators: [
185
- withClientProvider({ createIdentity: true, createSpace: true }),
186
185
  withTheme,
187
186
  withAttention,
187
+ withClientProvider({ createIdentity: true, createSpace: true }),
188
188
  withLayout({ fullscreen: true }),
189
189
  withPluginManager({ capabilities }),
190
190
  ],
@@ -249,16 +249,6 @@ export const Control: Story = {
249
249
  },
250
250
  };
251
251
 
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
252
  export const Template: Story = {
263
253
  args: {
264
254
  showGrid: false,
@@ -334,7 +324,7 @@ export const ImageGen: Story = {
334
324
  ...createComputeGraphController(
335
325
  createGptCircuit({ image: true, artifact: true }),
336
326
  new ServiceContainer().setServices({
337
- ai: AiService.make(createTestOllamaClient()),
327
+ ai: AiService.make(createTestAiServiceClient()),
338
328
  }),
339
329
  ),
340
330
  },
@@ -350,7 +340,7 @@ export const Audio: Story = {
350
340
  ...createComputeGraphController(
351
341
  createAudioCircuit(),
352
342
  new ServiceContainer().setServices({
353
- ai: AiService.make(createTestOllamaClient()),
343
+ ai: AiService.make(createTestAiServiceClient()),
354
344
  }),
355
345
  ),
356
346
  },
@@ -365,7 +355,7 @@ export const Voice: Story = {
365
355
  ...createComputeGraphController(
366
356
  createGPTRealtimeCircuit(),
367
357
  new ServiceContainer().setServices({
368
- ai: AiService.make(createTestOllamaClient()),
358
+ ai: AiService.make(createTestAiServiceClient()),
369
359
  }),
370
360
  ),
371
361
  },
@@ -17,11 +17,11 @@ import {
17
17
  type GptOutput,
18
18
  type GraphDiagnostic,
19
19
  GraphExecutor,
20
- isNotExecuted,
21
20
  ValueBag,
21
+ isNotExecuted,
22
22
  } from '@dxos/conductor';
23
23
  import { Resource } from '@dxos/context';
24
- import type { ServiceContainer } from '@dxos/functions';
24
+ import { type ServiceContainer } from '@dxos/functions';
25
25
  import { log } from '@dxos/log';
26
26
  import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
27
27
 
@@ -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'),
@@ -8,7 +8,6 @@ import React from 'react';
8
8
  import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
9
9
  import { Icon } from '@dxos/react-ui';
10
10
  import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
- import { mx } from '@dxos/react-ui-theme';
12
11
 
13
12
  import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
14
13
  import { useComputeNodeState } from '../hooks';
@@ -36,7 +35,7 @@ export const BeaconComponent = ({ shape }: ShapeComponentProps<BeaconShape>) =>
36
35
  <div className='flex w-full justify-center items-center'>
37
36
  <Icon
38
37
  icon='ph--sun--regular'
39
- classNames={mx('transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500')}
38
+ classNames={['transition opacity-20 duration-1000', isTruthy(value) && 'opacity-100 text-yellow-500']}
40
39
  size={8}
41
40
  />
42
41
  </div>
@@ -9,7 +9,7 @@ import { AnyOutput, FunctionInput } from '@dxos/conductor';
9
9
  import { getSnapshot, isInstanceOf, Ref } from '@dxos/echo-schema';
10
10
  import { FunctionType, ScriptType } from '@dxos/functions';
11
11
  import { useClient } from '@dxos/react-client';
12
- import { Filter, makeRef, parseId } from '@dxos/react-client/echo';
12
+ import { Filter, parseId } from '@dxos/react-client/echo';
13
13
  import {
14
14
  TextBox,
15
15
  type TextBoxControl,
@@ -69,7 +69,7 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
69
69
  }
70
70
 
71
71
  node.value = value;
72
- node.function = makeRef(fn);
72
+ node.function = Ref.make(fn);
73
73
  node.inputSchema = getSnapshot(fn.inputSchema);
74
74
  node.outputSchema = getSnapshot(fn.outputSchema);
75
75
  },
@@ -8,7 +8,6 @@ import React, { useEffect, useState } from 'react';
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
9
9
  import { Icon, type IconProps } from '@dxos/react-ui';
10
10
  import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
- import { mx } from '@dxos/react-ui-theme';
12
11
 
13
12
  import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
14
13
  import { useComputeNodeState } from '../hooks';
@@ -69,7 +68,7 @@ export const RandomComponent = ({ shape }: ShapeComponentProps<RandomShape>) =>
69
68
 
70
69
  return (
71
70
  <div className='flex grow items-center justify-center'>
72
- <Icon icon={icon} classNames={mx(spin && 'animate-[spin_1s]')} size={10} onClick={handleClick} />
71
+ <Icon icon={icon} classNames={spin && 'animate-[spin_1s]'} size={10} onClick={handleClick} />
73
72
  </div>
74
73
  );
75
74
  };
@@ -41,7 +41,7 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
41
41
 
42
42
  return (
43
43
  <Box shape={shape} onAction={handleAction}>
44
- {value !== null && <Surface role='canvas-node' data={{ value }} limit={1} />}
44
+ {value !== null && <Surface role='card--extrinsic' data={{ value }} limit={1} />}
45
45
  </Box>
46
46
  );
47
47
  };
@@ -5,14 +5,15 @@
5
5
  import { Schema } from 'effect';
6
6
  import React from 'react';
7
7
 
8
- import { createInputSchema, createOutputSchema, GptMessage } from '@dxos/conductor';
8
+ import { createInputSchema, createOutputSchema } from '@dxos/conductor';
9
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
+ import { DataType } from '@dxos/schema';
10
11
 
11
12
  import { createFunctionAnchors, Box } from './common';
12
13
  import { ComputeShape, createShape, type CreateShapeProps } from './defs';
13
14
 
14
- const InputSchema = createInputSchema(GptMessage);
15
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(GptMessage)));
15
+ const InputSchema = createInputSchema(DataType.Message);
16
+ const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
16
17
 
17
18
  export const TableShape = Schema.extend(
18
19
  ComputeShape,
@@ -5,16 +5,17 @@
5
5
  import { Schema } from 'effect';
6
6
  import React, { useEffect, useRef } from 'react';
7
7
 
8
- import { createInputSchema, createOutputSchema, GptMessage } from '@dxos/conductor';
8
+ import { createInputSchema, createOutputSchema } from '@dxos/conductor';
9
9
  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
+ import { DataType } from '@dxos/schema';
12
13
 
13
14
  import { createFunctionAnchors, Box } from './common';
14
15
  import { ComputeShape, createShape, type CreateShapeProps } from './defs';
15
16
 
16
- const InputSchema = createInputSchema(GptMessage);
17
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(GptMessage)));
17
+ const InputSchema = createInputSchema(DataType.Message);
18
+ const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
18
19
 
19
20
  export const ThreadShape = Schema.extend(
20
21
  ComputeShape,
@@ -9,21 +9,21 @@ import { VoidInput } from '@dxos/conductor';
9
9
  import { ObjectId, Ref } from '@dxos/echo-schema';
10
10
  import {
11
11
  type EmailTrigger,
12
+ EmailTriggerOutput,
12
13
  FunctionTrigger,
13
14
  type QueueTrigger,
15
+ QueueTriggerOutput,
14
16
  type SubscriptionTrigger,
15
17
  type TimerTrigger,
16
18
  TriggerKind,
17
19
  type TriggerType,
18
- type WebhookTrigger,
19
- EmailTriggerOutput,
20
- QueueTriggerOutput,
21
20
  SubscriptionTriggerOutput,
22
21
  TimerTriggerOutput,
22
+ type WebhookTrigger,
23
23
  WebhookTriggerOutput,
24
24
  } from '@dxos/functions';
25
25
  import { DXN, SpaceId } from '@dxos/keys';
26
- import { live, makeRef, useSpace } from '@dxos/react-client/echo';
26
+ import { live, useSpace } from '@dxos/react-client/echo';
27
27
  import { Select, type SelectRootProps } from '@dxos/react-ui';
28
28
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
29
29
 
@@ -51,7 +51,7 @@ export const createTrigger = (props: CreateTriggerProps): TriggerShape => {
51
51
  });
52
52
  return createShape<TriggerShape>({
53
53
  type: 'trigger',
54
- functionTrigger: makeRef(functionTrigger),
54
+ functionTrigger: Ref.make(functionTrigger),
55
55
  size: { width: 192, height: getHeight(EmailTriggerOutput) },
56
56
  ...props,
57
57
  });
@@ -35,7 +35,7 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
35
35
  <div ref={forwardedRef} className='flex flex-col h-full w-full justify-between'>
36
36
  <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface'>
37
37
  <Icon icon={icon} classNames='mx-2' />
38
- <div className='grow text-sm truncate'>{debug ? shape.type : name ?? shape.text ?? title}</div>
38
+ <div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>
39
39
  <IconButton
40
40
  classNames='p-1 text-green-500'
41
41
  variant='ghost'
@@ -2,9 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { createSystemPrompt } from '@dxos/artifact';
5
+ import { createSystemPrompt } from '@dxos/assistant';
6
6
  import { ObjectId } from '@dxos/echo-schema';
7
- import type { ServiceContainer } from '@dxos/functions';
7
+ import { type ServiceContainer } from '@dxos/functions';
8
8
  import { DXN, SpaceId } from '@dxos/keys';
9
9
  import { type Dimension, type Point } from '@dxos/react-ui-canvas';
10
10
  import { CanvasGraphModel, createNote, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
@@ -207,7 +207,7 @@ export const createArtifactCircuit = () => {
207
207
  model.builder.call((builder) => {
208
208
  const prompt = model.createNode(
209
209
  createTemplate({
210
- text: createSystemPrompt(),
210
+ text: createSystemPrompt({}),
211
211
  ...position({ x: -10, y: -5, width: 8, height: 18 }),
212
212
  }),
213
213
  );
@@ -262,7 +262,7 @@ export const createGptCircuit = (options: {
262
262
  if (options.instructions) {
263
263
  const prompt = model.createNode(
264
264
  createTemplate({
265
- text: createSystemPrompt(),
265
+ text: createSystemPrompt({}),
266
266
  ...position({ x: -18, y: -12, width: 8, height: 10 }),
267
267
  }),
268
268
  );