@dxos/react-ui-canvas-compute 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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 (123) hide show
  1. package/dist/lib/browser/index.mjs +967 -1221
  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 +967 -1221
  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/components/DiagnosticOverlay.d.ts.map +1 -1
  8. package/dist/types/src/compute-layout.d.ts.map +1 -1
  9. package/dist/types/src/compute.stories.d.ts +22 -1
  10. package/dist/types/src/compute.stories.d.ts.map +1 -1
  11. package/dist/types/src/graph/controller.d.ts +45 -53
  12. package/dist/types/src/graph/controller.d.ts.map +1 -1
  13. package/dist/types/src/graph/node-defs.d.ts.map +1 -1
  14. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  15. package/dist/types/src/hooks/useComputeNodeState.d.ts +4 -5
  16. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  17. package/dist/types/src/hooks/useGraphMonitor.d.ts +2 -2
  18. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  19. package/dist/types/src/json.test.d.ts +1 -1
  20. package/dist/types/src/json.test.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Append.d.ts +2 -2
  22. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Array.d.ts +2 -2
  24. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  25. package/dist/types/src/shapes/Audio.d.ts +2 -2
  26. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Beacon.d.ts +2 -2
  28. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  29. package/dist/types/src/shapes/Boolean.d.ts +8 -8
  30. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  31. package/dist/types/src/shapes/Chat.d.ts +2 -2
  32. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  33. package/dist/types/src/shapes/Constant.d.ts +2 -2
  34. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Database.d.ts +2 -2
  36. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  37. package/dist/types/src/shapes/{Queue.d.ts → Feed.d.ts} +10 -10
  38. package/dist/types/src/shapes/Feed.d.ts.map +1 -0
  39. package/dist/types/src/shapes/Function.d.ts +2 -2
  40. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  41. package/dist/types/src/shapes/Gpt.d.ts +2 -2
  42. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  43. package/dist/types/src/shapes/GptRealtime.d.ts +2 -2
  44. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  45. package/dist/types/src/shapes/Json.d.ts +3 -3
  46. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  47. package/dist/types/src/shapes/Logic.d.ts +3 -3
  48. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  49. package/dist/types/src/shapes/RNG.d.ts +3 -3
  50. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  51. package/dist/types/src/shapes/Scope.d.ts +2 -2
  52. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  53. package/dist/types/src/shapes/Surface.d.ts +2 -2
  54. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  55. package/dist/types/src/shapes/Switch.d.ts +2 -2
  56. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  57. package/dist/types/src/shapes/Table.d.ts +2 -2
  58. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  59. package/dist/types/src/shapes/Template.d.ts +3 -3
  60. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  61. package/dist/types/src/shapes/Text.d.ts +2 -2
  62. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  63. package/dist/types/src/shapes/TextToImage.d.ts +2 -2
  64. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  65. package/dist/types/src/shapes/Thread.d.ts +2 -2
  66. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  67. package/dist/types/src/shapes/Trigger.d.ts +8 -6
  68. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  69. package/dist/types/src/shapes/common/Box.d.ts +4 -4
  70. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  71. package/dist/types/src/shapes/common/FunctionBody.d.ts +3 -3
  72. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  73. package/dist/types/src/shapes/common/TypeSelect.d.ts +1 -1
  74. package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
  75. package/dist/types/src/shapes/defs.d.ts +3 -2
  76. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  77. package/dist/types/src/shapes/index.d.ts +2 -2
  78. package/dist/types/src/shapes/index.d.ts.map +1 -1
  79. package/dist/types/src/testing/circuits.d.ts +18 -24
  80. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  81. package/dist/types/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +60 -58
  83. package/src/README.md +0 -3
  84. package/src/compute-layout.ts +1 -1
  85. package/src/compute.stories.tsx +90 -115
  86. package/src/graph/controller.ts +152 -80
  87. package/src/graph/node-defs.ts +31 -31
  88. package/src/hooks/useComputeNodeState.ts +8 -9
  89. package/src/hooks/useGraphMonitor.ts +11 -10
  90. package/src/json.test.ts +4 -4
  91. package/src/registry.ts +2 -2
  92. package/src/schema.test.ts +12 -12
  93. package/src/shapes/Append.tsx +1 -1
  94. package/src/shapes/Array.tsx +1 -1
  95. package/src/shapes/Audio.tsx +2 -3
  96. package/src/shapes/Beacon.tsx +1 -2
  97. package/src/shapes/Boolean.tsx +2 -2
  98. package/src/shapes/Chat.tsx +1 -2
  99. package/src/shapes/Constant.tsx +1 -2
  100. package/src/shapes/Database.tsx +1 -1
  101. package/src/shapes/{Queue.tsx → Feed.tsx} +27 -22
  102. package/src/shapes/Function.tsx +13 -11
  103. package/src/shapes/Gpt.tsx +7 -3
  104. package/src/shapes/GptRealtime.tsx +1 -1
  105. package/src/shapes/Json.tsx +10 -4
  106. package/src/shapes/Logic.tsx +1 -1
  107. package/src/shapes/RNG.tsx +6 -3
  108. package/src/shapes/Scope.tsx +1 -2
  109. package/src/shapes/Surface.tsx +13 -5
  110. package/src/shapes/Switch.tsx +1 -2
  111. package/src/shapes/Table.tsx +4 -4
  112. package/src/shapes/Template.tsx +2 -3
  113. package/src/shapes/Text.tsx +1 -2
  114. package/src/shapes/TextToImage.tsx +1 -1
  115. package/src/shapes/Thread.tsx +18 -12
  116. package/src/shapes/Trigger.tsx +36 -46
  117. package/src/shapes/common/Box.tsx +5 -8
  118. package/src/shapes/common/FunctionBody.tsx +4 -3
  119. package/src/shapes/common/TypeSelect.tsx +1 -1
  120. package/src/shapes/defs.ts +5 -4
  121. package/src/shapes/index.ts +2 -2
  122. package/src/testing/circuits.ts +7 -16
  123. package/dist/types/src/shapes/Queue.d.ts.map +0 -1
@@ -2,14 +2,13 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { Icon } from '@dxos/react-ui';
9
9
  import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
10
10
 
11
11
  import { useComputeNodeState } from '../hooks';
12
-
13
12
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
14
13
 
15
14
  export const AudioShape = Schema.extend(
@@ -38,7 +37,7 @@ export const AudioComponent = ({ shape }: ShapeComponentProps<AudioShape>) => {
38
37
  <div className='flex w-full justify-center items-center'>
39
38
  <Icon
40
39
  icon={active ? 'ph--microphone--regular' : 'ph--microphone-slash--regular'}
41
- classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-red-500']}
40
+ classNames={['transition opacity-20 duration-1000', active && 'opacity-100 text-error-text']}
42
41
  size={8}
43
42
  onClick={() => setActive(!active)}
44
43
  />
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT, isTruthy } from '@dxos/conductor';
@@ -10,7 +10,6 @@ import { Icon } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
12
  import { useComputeNodeState } from '../hooks';
13
-
14
13
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
14
 
16
15
  export const BeaconShape = Schema.extend(
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { type FC } from 'react';
7
7
 
8
8
  import { type ShapeDef, getAnchorPoints } from '@dxos/react-ui-canvas-editor';
@@ -95,7 +95,7 @@ const createSymbol =
95
95
  const paths = pathConstructor({ startX, endX, height });
96
96
 
97
97
  return (
98
- <svg viewBox={`0 0 ${width} ${height}`} className='w-full h-full'>
98
+ <svg viewBox={`0 0 ${width} ${height}`} className='h-full w-full'>
99
99
  {/* Input line. */}
100
100
  {getAnchorPoints({ x: 0, y: centerY }, inputs).map(({ x, y }, i) => (
101
101
  <line key={i} x1={x} y1={y} x2={startX * 1.3} y2={y} strokeWidth={strokeWidth} className={className} />
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useRef } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
@@ -16,7 +16,6 @@ import {
16
16
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
17
17
 
18
18
  import { useComputeNodeState } from '../hooks';
19
-
20
19
  import { Box } from './common';
21
20
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
22
21
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useRef, useState } from 'react';
7
7
 
8
8
  import { ComputeValueType } from '@dxos/conductor';
@@ -18,7 +18,6 @@ import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
18
18
  import { safeParseJson } from '@dxos/util';
19
19
 
20
20
  import { useComputeNodeState } from '../hooks';
21
-
22
21
  import { Box, TypeSelect } from './common';
23
22
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
24
23
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
@@ -2,35 +2,38 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { Fragment } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT, QueueInput, QueueOutput } from '@dxos/conductor';
9
- import { type ThemedClassName } from '@dxos/react-ui';
9
+ import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
- import { mx } from '@dxos/react-ui-theme';
11
+ import { mx } from '@dxos/ui-theme';
12
12
 
13
13
  import { useComputeNodeState } from '../hooks';
14
-
15
14
  import { createFunctionAnchors } from './common';
16
15
  import { Box, type BoxActionHandler } from './common';
17
16
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
18
17
 
19
- export const QueueShape = Schema.extend(
18
+ export const FeedShape = Schema.extend(
20
19
  ComputeShape,
21
20
  Schema.Struct({
22
21
  type: Schema.Literal('queue'),
23
22
  }),
24
23
  );
25
24
 
26
- export type QueueShape = Schema.Schema.Type<typeof QueueShape>;
25
+ export type FeedShape = Schema.Schema.Type<typeof FeedShape>;
27
26
 
28
- export type CreateQueueProps = CreateShapeProps<QueueShape>;
27
+ export type CreateFeedProps = CreateShapeProps<FeedShape>;
29
28
 
30
- export const createQueue = (props: CreateQueueProps) =>
31
- createShape<QueueShape>({ type: 'queue', size: { width: 256, height: 512 }, ...props });
29
+ export const createFeed = (props: CreateFeedProps) =>
30
+ createShape<FeedShape>({
31
+ type: 'queue',
32
+ size: { width: 256, height: 512 },
33
+ ...props,
34
+ });
32
35
 
33
- export const QueueComponent = ({ shape }: ShapeComponentProps<QueueShape>) => {
36
+ export const FeedComponent = ({ shape }: ShapeComponentProps<FeedShape>) => {
34
37
  const { runtime } = useComputeNodeState(shape);
35
38
  const items = runtime.outputs[DEFAULT_OUTPUT]?.type === 'executed' ? runtime.outputs[DEFAULT_OUTPUT].value : [];
36
39
 
@@ -42,22 +45,24 @@ export const QueueComponent = ({ shape }: ShapeComponentProps<QueueShape>) => {
42
45
 
43
46
  return (
44
47
  <Box shape={shape} status={`${items.length} items`} onAction={handleAction}>
45
- <div className='flex flex-col w-full overflow-y-scroll divide-y divide-separator'>
46
- {[...items].map((item, i) => (
47
- <QueueItem key={i} classNames='p-1 px-2' item={item} />
48
- ))}
49
- </div>
48
+ <ScrollArea.Root orientation='vertical'>
49
+ <ScrollArea.Viewport classNames='divide-y divide-separator'>
50
+ {[...items].map((item, i) => (
51
+ <FeedItem key={i} classNames='p-1 px-2' item={item} />
52
+ ))}
53
+ </ScrollArea.Viewport>
54
+ </ScrollArea.Root>
50
55
  </Box>
51
56
  );
52
57
  };
53
58
 
54
- export const QueueItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
59
+ export const FeedItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
55
60
  if (typeof item !== 'object') {
56
61
  return <div className={mx(classNames, 'whitespace-pre-wrap')}>{item}</div>;
57
62
  }
58
63
 
59
64
  return (
60
- <div className={mx('grid grid-cols-[80px,1fr]', classNames)}>
65
+ <div className={mx('grid grid-cols-[80px_1fr]', classNames)}>
61
66
  {Object.entries(item).map(([key, value]) => (
62
67
  <Fragment key={key}>
63
68
  <div className='p-1 text-xs text-subdued'>{key}</div>
@@ -68,12 +73,12 @@ export const QueueItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
68
73
  );
69
74
  };
70
75
 
71
- export const queueShape: ShapeDef<QueueShape> = {
72
- type: 'queue',
73
- name: 'Queue',
76
+ export const feedShape: ShapeDef<FeedShape> = {
77
+ type: 'feed',
78
+ name: 'Feed',
74
79
  icon: 'ph--queue--regular',
75
- component: QueueComponent,
76
- createShape: createQueue,
80
+ component: FeedComponent,
81
+ createShape: createFeed,
77
82
  getAnchors: (shape) => createFunctionAnchors(shape, QueueInput, QueueOutput),
78
83
  resizable: true,
79
84
  };
@@ -2,12 +2,13 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback, useRef } from 'react';
7
7
 
8
+ import { Script } from '@dxos/compute';
9
+ import { Operation } from '@dxos/compute';
8
10
  import { AnyOutput, FunctionInput } from '@dxos/conductor';
9
- import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo-schema';
10
- import { FunctionType, ScriptType } from '@dxos/functions';
11
+ import { Ref, getSnapshot, isInstanceOf } from '@dxos/echo/internal';
11
12
  import { useClient } from '@dxos/react-client';
12
13
  import { Filter, parseId } from '@dxos/react-client/echo';
13
14
  import {
@@ -19,7 +20,6 @@ import {
19
20
  } from '@dxos/react-ui-canvas-editor';
20
21
 
21
22
  import { useComputeNodeState } from '../hooks';
22
-
23
23
  import { Box, createFunctionAnchors } from './common';
24
24
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
25
25
 
@@ -35,7 +35,11 @@ export type FunctionShape = Schema.Schema.Type<typeof FunctionShape>;
35
35
  export type CreateFunctionProps = CreateShapeProps<FunctionShape>;
36
36
 
37
37
  export const createFunction = (props: CreateFunctionProps) =>
38
- createShape<FunctionShape>({ type: 'function', size: { width: 256, height: 192 }, ...props });
38
+ createShape<FunctionShape>({
39
+ type: 'function',
40
+ size: { width: 256, height: 192 },
41
+ ...props,
42
+ });
39
43
 
40
44
  //
41
45
  // Component
@@ -58,21 +62,19 @@ const TextInputComponent = ({ shape, title, ...props }: TextInputComponentProps)
58
62
 
59
63
  const space = client.spaces.get(spaceId);
60
64
  const object = space?.db.getObjectById(objectId);
61
- if (!space || !isInstanceOf(ScriptType, object)) {
65
+ if (!space || !isInstanceOf(Script.Script, object)) {
62
66
  return;
63
67
  }
64
68
 
65
- const {
66
- objects: [fn],
67
- } = await space.db.query(Filter.type(FunctionType, { source: Ref.make(object) })).run();
69
+ const [fn] = await space.db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(object) })).run();
68
70
  if (!fn) {
69
71
  return;
70
72
  }
71
73
 
72
74
  node.value = value;
73
75
  node.function = Ref.make(fn);
74
- node.inputSchema = getSnapshot(fn.inputSchema);
75
- node.outputSchema = getSnapshot(fn.outputSchema);
76
+ node.inputSchema = fn.inputSchema ? getSnapshot(fn.inputSchema) : undefined;
77
+ node.outputSchema = fn.outputSchema ? getSnapshot(fn.outputSchema) : undefined;
76
78
  },
77
79
  [client, node],
78
80
  );
@@ -2,14 +2,14 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { GptInput, GptOutput } from '@dxos/conductor';
9
+ import { ScrollArea } from '@dxos/react-ui';
9
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
11
 
11
12
  import { useComputeNodeState } from '../hooks';
12
-
13
13
  import { FunctionBody, createFunctionAnchors, getHeight } from './common';
14
14
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
15
15
 
@@ -74,7 +74,11 @@ export const GptComponent = ({ shape }: ShapeComponentProps<GptShape>) => {
74
74
  return (
75
75
  <FunctionBody
76
76
  shape={shape}
77
- content={<div className='px-2 py-1 overflow-y-scroll'>{text}</div>}
77
+ content={
78
+ <ScrollArea.Root orientation='vertical' thin>
79
+ <ScrollArea.Viewport>{text}</ScrollArea.Viewport>
80
+ </ScrollArea.Root>
81
+ }
78
82
  status={`${tokens} tokens`}
79
83
  inputSchema={meta.input}
80
84
  outputSchema={meta.output}
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useState } from 'react';
7
7
 
8
8
  import { log } from '@dxos/log';
@@ -2,16 +2,15 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT, DefaultOutput, JsonTransformInput } from '@dxos/conductor';
9
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
10
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
- import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
11
+ import { Syntax } from '@dxos/react-ui-syntax-highlighter';
12
12
 
13
13
  import { useComputeNodeState } from '../hooks';
14
-
15
14
  import { Box, createFunctionAnchors, getHeight } from './common';
16
15
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
17
16
 
@@ -50,7 +49,14 @@ export const JsonComponent = ({ shape, ...props }: JsonComponentProps) => {
50
49
 
51
50
  return (
52
51
  <Box shape={shape}>
53
- <JsonFilter data={value} classNames='text-xs' />
52
+ <Syntax.Root data={value}>
53
+ <Syntax.Content>
54
+ <Syntax.Filter />
55
+ <Syntax.Viewport>
56
+ <Syntax.Code classNames='text-xs' />
57
+ </Syntax.Viewport>
58
+ </Syntax.Content>
59
+ </Syntax.Root>
54
60
  </Box>
55
61
  );
56
62
  };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { IfElseInput, IfElseOutput, IfInput, IfOutput } from '@dxos/conductor';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
@@ -10,7 +10,6 @@ import { Icon, type IconProps } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
12
  import { useComputeNodeState } from '../hooks';
13
-
14
13
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
14
 
16
15
  export const RandomShape = Schema.extend(
@@ -27,7 +26,11 @@ export type RandomShape = Schema.Schema.Type<typeof RandomShape>;
27
26
  export type CreateRandomProps = CreateShapeProps<RandomShape>;
28
27
 
29
28
  export const createRandom = (props: CreateRandomProps) =>
30
- createShape<RandomShape>({ type: 'rng', size: { width: 64, height: 64 }, ...props });
29
+ createShape<RandomShape>({
30
+ type: 'rng',
31
+ size: { width: 64, height: 64 },
32
+ ...props,
33
+ });
31
34
 
32
35
  const icons = [
33
36
  'ph--dice-one--regular',
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
@@ -10,7 +10,6 @@ import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/
10
10
  import { Chaos, shaderPresets, useAudioStream } from '@dxos/react-ui-sfx';
11
11
 
12
12
  import { useComputeNodeState } from '../hooks';
13
-
14
13
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
14
 
16
15
  export const ScopeShape = Schema.extend(
@@ -2,16 +2,17 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
- import { Surface } from '@dxos/app-framework';
8
+ import { Surface } from '@dxos/app-framework/ui';
9
+ import { AppSurface } from '@dxos/app-toolkit/ui';
9
10
  import { DEFAULT_INPUT } from '@dxos/conductor';
11
+ import { Card } from '@dxos/react-ui';
10
12
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
13
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
12
14
 
13
15
  import { useComputeNodeState } from '../hooks';
14
-
15
16
  import { Box, type BoxActionHandler } from './common';
16
17
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
17
18
 
@@ -27,7 +28,11 @@ export type SurfaceShape = Schema.Schema.Type<typeof SurfaceShape>;
27
28
  export type CreateSurfaceProps = CreateShapeProps<SurfaceShape>;
28
29
 
29
30
  export const createSurface = (props: CreateSurfaceProps) =>
30
- createShape<SurfaceShape>({ type: 'surface', size: { width: 384, height: 384 }, ...props });
31
+ createShape<SurfaceShape>({
32
+ type: 'surface',
33
+ size: { width: 384, height: 384 },
34
+ ...props,
35
+ });
31
36
 
32
37
  export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) => {
33
38
  const { runtime } = useComputeNodeState(shape);
@@ -40,9 +45,12 @@ export const SurfaceComponent = ({ shape }: ShapeComponentProps<SurfaceShape>) =
40
45
  }
41
46
  };
42
47
 
48
+ // TODO(burdon): Subject property?
43
49
  return (
44
50
  <Box shape={shape} onAction={handleAction}>
45
- {value !== null && <Surface role='card--extrinsic' data={{ value }} limit={1} />}
51
+ <Card.Root>
52
+ {value !== null && <Surface.Surface type={AppSurface.Card} data={{ subject: value }} limit={1} />}
53
+ </Card.Root>
46
54
  </Box>
47
55
  );
48
56
  };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useState } from 'react';
7
7
 
8
8
  import { DEFAULT_OUTPUT } from '@dxos/conductor';
@@ -10,7 +10,6 @@ import { Input } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef, createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
12
  import { useComputeNodeState } from '../hooks';
13
-
14
13
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
15
14
 
16
15
  export const SwitchShape = Schema.extend(
@@ -2,18 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
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
+ import { Message } from '@dxos/types';
11
11
 
12
12
  import { Box, createFunctionAnchors } from './common';
13
13
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
14
14
 
15
- const InputSchema = createInputSchema(DataType.Message);
16
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
15
+ const InputSchema = createInputSchema(Message.Message);
16
+ const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Message.Message)));
17
17
 
18
18
  export const TableShape = Schema.extend(
19
19
  ComputeShape,
@@ -2,11 +2,11 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useRef } from 'react';
7
7
 
8
8
  import { ComputeValueType, TemplateOutput, VoidInput, getTemplateInputSchema } from '@dxos/conductor';
9
- import { toJsonSchema } from '@dxos/echo-schema';
9
+ import { toJsonSchema } from '@dxos/echo/internal';
10
10
  import { invariant } from '@dxos/invariant';
11
11
  import {
12
12
  type ShapeComponentProps,
@@ -17,7 +17,6 @@ import {
17
17
  } from '@dxos/react-ui-canvas-editor';
18
18
 
19
19
  import { useComputeNodeState } from '../hooks';
20
-
21
20
  import { Box, TypeSelect, createFunctionAnchors } from './common';
22
21
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
23
22
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { DEFAULT_INPUT } from '@dxos/conductor';
@@ -10,7 +10,6 @@ import { type ShapeComponentProps, type ShapeDef, TextBox } from '@dxos/react-ui
10
10
  import { createAnchorMap } from '@dxos/react-ui-canvas-editor';
11
11
 
12
12
  import { useComputeNodeState } from '../hooks';
13
-
14
13
  import { Box, type BoxActionHandler } from './common';
15
14
  import { ComputeShape, type CreateShapeProps, createAnchorId, createShape } from './defs';
16
15
 
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React from 'react';
7
7
 
8
8
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
@@ -2,20 +2,20 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useEffect, useRef } from 'react';
7
7
 
8
8
  import { createInputSchema, createOutputSchema } from '@dxos/conductor';
9
- import { type ThemedClassName } from '@dxos/react-ui';
9
+ import { ScrollArea, type ThemedClassName } from '@dxos/react-ui';
10
10
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
11
- import { mx } from '@dxos/react-ui-theme';
12
- import { DataType } from '@dxos/schema';
11
+ import { Message } from '@dxos/types';
12
+ import { mx } from '@dxos/ui-theme';
13
13
 
14
14
  import { Box, createFunctionAnchors } from './common';
15
15
  import { ComputeShape, type CreateShapeProps, createShape } from './defs';
16
16
 
17
- const InputSchema = createInputSchema(DataType.Message);
18
- const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(DataType.Message)));
17
+ const InputSchema = createInputSchema(Message.Message);
18
+ const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Message.Message)));
19
19
 
20
20
  export const ThreadShape = Schema.extend(
21
21
  ComputeShape,
@@ -42,18 +42,24 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
42
42
 
43
43
  return (
44
44
  <Box shape={shape}>
45
- <div ref={scrollRef} className='flex flex-col w-full overflow-y-scroll gap-2 p-2'>
46
- {[...items].map((item, i) => (
47
- <ThreadItem key={i} item={item} />
48
- ))}
49
- </div>
45
+ <ScrollArea.Root orientation='vertical'>
46
+ <ScrollArea.Viewport classNames='gap-2 p-2' ref={scrollRef}>
47
+ {[...items].map((item, i) => (
48
+ <ThreadItem key={i} item={item} />
49
+ ))}
50
+ </ScrollArea.Viewport>
51
+ </ScrollArea.Root>
50
52
  </Box>
51
53
  );
52
54
  };
53
55
 
54
56
  export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
55
57
  if (typeof item !== 'object') {
56
- return <div className={mx(classNames)}>{item}</div>;
58
+ return (
59
+ <div role='none' className={mx(classNames)}>
60
+ {item}
61
+ </div>
62
+ );
57
63
  }
58
64
 
59
65
  // TODO(burdon): Hack; introspect type.