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

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 (85) hide show
  1. package/dist/lib/browser/index.mjs +191 -168
  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 +191 -168
  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 +1 -1
  8. package/dist/types/src/compute.stories.d.ts.map +1 -1
  9. package/dist/types/src/graph/controller.d.ts +31 -5
  10. package/dist/types/src/graph/controller.d.ts.map +1 -1
  11. package/dist/types/src/graph/node-defs.d.ts.map +1 -1
  12. package/dist/types/src/hooks/useComputeGraphController.d.ts +1 -1
  13. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  14. package/dist/types/src/hooks/useComputeNodeState.d.ts +3 -2
  15. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  16. package/dist/types/src/hooks/useGraphMonitor.d.ts +1 -1
  17. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  18. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  20. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  22. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  24. package/dist/types/src/shapes/Constant.d.ts +1 -1
  25. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  26. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  28. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  29. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  30. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  31. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  32. package/dist/types/src/shapes/Queue.d.ts.map +1 -1
  33. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  34. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  36. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  37. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  38. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  39. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  40. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  41. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  42. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  43. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  44. package/dist/types/src/testing/circuits.d.ts +1 -1
  45. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  46. package/dist/types/tsconfig.tsbuildinfo +1 -1
  47. package/package.json +47 -44
  48. package/src/compute.stories.tsx +17 -29
  49. package/src/graph/controller.ts +10 -10
  50. package/src/graph/node-defs.ts +4 -3
  51. package/src/hooks/useComputeGraphController.ts +1 -1
  52. package/src/hooks/useComputeNodeState.ts +6 -4
  53. package/src/hooks/useGraphMonitor.ts +1 -1
  54. package/src/registry.ts +2 -2
  55. package/src/schema.test.ts +2 -2
  56. package/src/shapes/Append.tsx +2 -2
  57. package/src/shapes/Array.tsx +2 -2
  58. package/src/shapes/Audio.tsx +3 -2
  59. package/src/shapes/Beacon.tsx +4 -4
  60. package/src/shapes/Boolean.tsx +2 -2
  61. package/src/shapes/Chat.tsx +3 -2
  62. package/src/shapes/Constant.tsx +3 -2
  63. package/src/shapes/Database.tsx +1 -1
  64. package/src/shapes/Function.tsx +8 -7
  65. package/src/shapes/Gpt.tsx +6 -4
  66. package/src/shapes/GptRealtime.tsx +1 -1
  67. package/src/shapes/Json.tsx +3 -2
  68. package/src/shapes/Logic.tsx +2 -2
  69. package/src/shapes/Queue.tsx +3 -2
  70. package/src/shapes/RNG.tsx +4 -4
  71. package/src/shapes/Scope.tsx +4 -3
  72. package/src/shapes/Surface.tsx +4 -3
  73. package/src/shapes/Switch.tsx +3 -2
  74. package/src/shapes/Table.tsx +6 -5
  75. package/src/shapes/Template.tsx +4 -3
  76. package/src/shapes/Text.tsx +4 -3
  77. package/src/shapes/TextToImage.tsx +1 -1
  78. package/src/shapes/Thread.tsx +6 -5
  79. package/src/shapes/Trigger.tsx +8 -8
  80. package/src/shapes/common/Box.tsx +2 -2
  81. package/src/shapes/common/FunctionBody.tsx +1 -1
  82. package/src/testing/circuits.ts +4 -4
  83. package/dist/lib/node/index.cjs +0 -2896
  84. package/dist/lib/node/index.cjs.map +0 -7
  85. package/dist/lib/node/meta.json +0 -1
@@ -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,12 +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';
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 RandomShape = Schema.extend(
17
17
  ComputeShape,
18
18
  Schema.Struct({
@@ -69,7 +69,7 @@ export const RandomComponent = ({ shape }: ShapeComponentProps<RandomShape>) =>
69
69
 
70
70
  return (
71
71
  <div className='flex grow items-center justify-center'>
72
- <Icon icon={icon} classNames={mx(spin && 'animate-[spin_1s]')} size={10} onClick={handleClick} />
72
+ <Icon icon={icon} classNames={spin && 'animate-[spin_1s]'} size={10} onClick={handleClick} />
73
73
  </div>
74
74
  );
75
75
  };
@@ -6,12 +6,13 @@ import { Schema } from 'effect';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
9
- import { createAnchorMap, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
- import { useAudioStream, Chaos, shaderPresets } from '@dxos/react-ui-sfx';
9
+ import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
10
+ import { Chaos, shaderPresets, useAudioStream } from '@dxos/react-ui-sfx';
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 ScopeShape = Schema.extend(
16
17
  ComputeShape,
17
18
  Schema.Struct({
@@ -10,10 +10,11 @@ import { DEFAULT_INPUT } from '@dxos/conductor';
10
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
11
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
12
12
 
13
- import { Box, type BoxActionHandler } from './common';
14
- import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
15
13
  import { useComputeNodeState } from '../hooks';
16
14
 
15
+ import { Box, type BoxActionHandler } from './common';
16
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
17
+
17
18
  export const SurfaceShape = Schema.extend(
18
19
  ComputeShape,
19
20
  Schema.Struct({
@@ -41,7 +42,7 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
41
42
 
42
43
  return (
43
44
  <Box shape={shape} onAction={handleAction}>
44
- {value !== null && <Surface role='canvas-node' data={{ value }} limit={1} />}
45
+ {value !== null && <Surface role='card--extrinsic' data={{ value }} limit={1} />}
45
46
  </Box>
46
47
  );
47
48
  };
@@ -7,11 +7,12 @@ import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
9
9
  import { Input } 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 SwitchShape = Schema.extend(
16
17
  ComputeShape,
17
18
  Schema.Struct({
@@ -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
- import { createFunctionAnchors, Box } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
12
+ import { Box, createFunctionAnchors } from './common';
13
+ import { ComputeShape, type CreateShapeProps, createShape } 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,7 +5,7 @@
5
5
  import { Schema } from 'effect';
6
6
  import React, { useRef } from 'react';
7
7
 
8
- import { ComputeValueType, getTemplateInputSchema, TemplateOutput, VoidInput } from '@dxos/conductor';
8
+ import { ComputeValueType, TemplateOutput, VoidInput, getTemplateInputSchema } from '@dxos/conductor';
9
9
  import { toJsonSchema } from '@dxos/echo-schema';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import {
@@ -16,10 +16,11 @@ import {
16
16
  type TextBoxProps,
17
17
  } from '@dxos/react-ui-canvas-editor';
18
18
 
19
- import { Box, createFunctionAnchors, TypeSelect } from './common';
20
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
21
19
  import { useComputeNodeState } from '../hooks';
22
20
 
21
+ import { Box, TypeSelect, createFunctionAnchors } from './common';
22
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
23
+
23
24
  //
24
25
  // Data
25
26
  //
@@ -6,13 +6,14 @@ import { Schema } from 'effect';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
9
- import { TextBox, type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
9
+ import { type ShapeComponentProps, type ShapeDef, TextBox } from '@dxos/react-ui-canvas-editor';
10
10
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
- import { Box, type BoxActionHandler } from './common';
13
- import { ComputeShape, createAnchorId, createShape, type CreateShapeProps } from './defs';
14
12
  import { useComputeNodeState } from '../hooks';
15
13
 
14
+ import { Box, type BoxActionHandler } from './common';
15
+ import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
16
+
16
17
  export const TextShape = Schema.extend(
17
18
  ComputeShape,
18
19
  Schema.Struct({
@@ -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 TextToImageShape = Schema.extend(
15
15
  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
- import { createFunctionAnchors, Box } from './common';
14
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
14
+ import { Box, createFunctionAnchors } from './common';
15
+ import { ComputeShape, type CreateShapeProps, createShape } 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,26 +9,26 @@ 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,
17
+ SubscriptionTriggerOutput,
15
18
  type TimerTrigger,
19
+ TimerTriggerOutput,
16
20
  TriggerKind,
17
21
  type TriggerType,
18
22
  type WebhookTrigger,
19
- EmailTriggerOutput,
20
- QueueTriggerOutput,
21
- SubscriptionTriggerOutput,
22
- TimerTriggerOutput,
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
 
30
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
31
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
30
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
31
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
32
32
 
33
33
  export const TriggerShape = Schema.extend(
34
34
  ComputeShape,
@@ -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
  });
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React, { forwardRef, type PropsWithChildren, type ReactNode } from 'react';
5
+ import React, { type PropsWithChildren, type ReactNode, forwardRef } from 'react';
6
6
 
7
7
  import { invariant } from '@dxos/invariant';
8
8
  import { Icon, IconButton, type ThemedClassName } from '@dxos/react-ui';
@@ -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'
@@ -8,7 +8,7 @@ import React, { type JSX, useRef, useState } from 'react';
8
8
  import { VoidInput, VoidOutput } from '@dxos/conductor';
9
9
  import { useCanvasContext } from '@dxos/react-ui-canvas';
10
10
  import { type Polygon, type Shape } from '@dxos/react-ui-canvas-editor';
11
- import { getParentShapeElement, createAnchors, rowHeight } from '@dxos/react-ui-canvas-editor';
11
+ import { createAnchors, getParentShapeElement, rowHeight } from '@dxos/react-ui-canvas-editor';
12
12
 
13
13
  import { Box, type BoxProps, footerHeight, headerHeight } from '../common';
14
14
  import { createAnchorId, getProperties } from '../defs';
@@ -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
  );