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

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 (119) hide show
  1. package/dist/lib/browser/index.mjs +938 -1074
  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 +938 -1074
  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 +33 -5
  8. package/dist/types/src/compute.stories.d.ts.map +1 -1
  9. package/dist/types/src/graph/controller.d.ts +40 -27
  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 +2 -2
  13. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  14. package/dist/types/src/hooks/useComputeNodeState.d.ts +4 -3
  15. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  16. package/dist/types/src/hooks/useGraphMonitor.d.ts +2 -2
  17. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  18. package/dist/types/src/json.test.d.ts +1 -1
  19. package/dist/types/src/json.test.d.ts.map +1 -1
  20. package/dist/types/src/shapes/Append.d.ts +1 -1
  21. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  22. package/dist/types/src/shapes/Array.d.ts +1 -1
  23. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  24. package/dist/types/src/shapes/Audio.d.ts +1 -1
  25. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  26. package/dist/types/src/shapes/Beacon.d.ts +1 -1
  27. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  28. package/dist/types/src/shapes/Boolean.d.ts +1 -1
  29. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  30. package/dist/types/src/shapes/Chat.d.ts +1 -1
  31. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  32. package/dist/types/src/shapes/Constant.d.ts +1 -1
  33. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  34. package/dist/types/src/shapes/Database.d.ts +1 -1
  35. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  36. package/dist/types/src/shapes/Function.d.ts +1 -1
  37. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  38. package/dist/types/src/shapes/Gpt.d.ts +1 -1
  39. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  40. package/dist/types/src/shapes/GptRealtime.d.ts +1 -1
  41. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  42. package/dist/types/src/shapes/Json.d.ts +1 -1
  43. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  44. package/dist/types/src/shapes/Logic.d.ts +1 -1
  45. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  46. package/dist/types/src/shapes/Queue.d.ts +1 -1
  47. package/dist/types/src/shapes/Queue.d.ts.map +1 -1
  48. package/dist/types/src/shapes/RNG.d.ts +1 -1
  49. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  50. package/dist/types/src/shapes/Scope.d.ts +1 -1
  51. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  52. package/dist/types/src/shapes/Surface.d.ts +1 -1
  53. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  54. package/dist/types/src/shapes/Switch.d.ts +1 -1
  55. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  56. package/dist/types/src/shapes/Table.d.ts +1 -1
  57. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  58. package/dist/types/src/shapes/Template.d.ts +1 -1
  59. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  60. package/dist/types/src/shapes/Text.d.ts +1 -1
  61. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  62. package/dist/types/src/shapes/TextToImage.d.ts +1 -1
  63. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  64. package/dist/types/src/shapes/Thread.d.ts +1 -1
  65. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  66. package/dist/types/src/shapes/Trigger.d.ts +6 -34
  67. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  68. package/dist/types/src/shapes/common/Box.d.ts +4 -4
  69. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  70. package/dist/types/src/shapes/common/FunctionBody.d.ts +3 -3
  71. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  72. package/dist/types/src/shapes/defs.d.ts +2 -1
  73. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  74. package/dist/types/src/testing/circuits.d.ts +18 -24
  75. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  76. package/dist/types/tsconfig.tsbuildinfo +1 -1
  77. package/package.json +60 -52
  78. package/src/compute-layout.ts +1 -1
  79. package/src/compute.stories.tsx +84 -139
  80. package/src/graph/controller.ts +121 -80
  81. package/src/graph/node-defs.ts +7 -6
  82. package/src/hooks/useComputeGraphController.ts +2 -2
  83. package/src/hooks/useComputeNodeState.ts +10 -7
  84. package/src/hooks/useGraphMonitor.ts +11 -10
  85. package/src/json.test.ts +4 -4
  86. package/src/registry.ts +2 -2
  87. package/src/schema.test.ts +13 -13
  88. package/src/shapes/Append.tsx +3 -3
  89. package/src/shapes/Array.tsx +3 -3
  90. package/src/shapes/Audio.tsx +5 -4
  91. package/src/shapes/Beacon.tsx +6 -6
  92. package/src/shapes/Boolean.tsx +5 -5
  93. package/src/shapes/Chat.tsx +4 -3
  94. package/src/shapes/Constant.tsx +4 -3
  95. package/src/shapes/Database.tsx +2 -2
  96. package/src/shapes/Function.tsx +19 -16
  97. package/src/shapes/Gpt.tsx +13 -6
  98. package/src/shapes/GptRealtime.tsx +3 -3
  99. package/src/shapes/Json.tsx +4 -3
  100. package/src/shapes/Logic.tsx +3 -3
  101. package/src/shapes/Queue.tsx +18 -11
  102. package/src/shapes/RNG.tsx +10 -6
  103. package/src/shapes/Scope.tsx +6 -5
  104. package/src/shapes/Surface.tsx +11 -6
  105. package/src/shapes/Switch.tsx +5 -4
  106. package/src/shapes/Table.tsx +7 -6
  107. package/src/shapes/Template.tsx +6 -5
  108. package/src/shapes/Text.tsx +5 -4
  109. package/src/shapes/TextToImage.tsx +2 -2
  110. package/src/shapes/Thread.tsx +22 -15
  111. package/src/shapes/Trigger.tsx +51 -58
  112. package/src/shapes/common/Box.tsx +10 -11
  113. package/src/shapes/common/FunctionBody.tsx +7 -6
  114. package/src/shapes/common/TypeSelect.tsx +1 -1
  115. package/src/shapes/defs.ts +5 -4
  116. package/src/testing/circuits.ts +8 -17
  117. package/dist/lib/node/index.cjs +0 -2896
  118. package/dist/lib/node/index.cjs.map +0 -7
  119. package/dist/lib/node/meta.json +0 -1
@@ -2,19 +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
- import { createInputSchema, createOutputSchema, GptMessage } from '@dxos/conductor';
9
- import { type ThemedClassName } from '@dxos/react-ui';
8
+ import { createInputSchema, createOutputSchema } from '@dxos/conductor';
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 { Message } from '@dxos/types';
12
+ import { mx } from '@dxos/ui-theme';
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(Message.Message);
18
+ const OutputSchema = createOutputSchema(Schema.mutable(Schema.Array(Message.Message)));
18
19
 
19
20
  export const ThreadShape = Schema.extend(
20
21
  ComputeShape,
@@ -41,18 +42,24 @@ export const ThreadComponent = ({ shape }: ShapeComponentProps<ThreadShape>) =>
41
42
 
42
43
  return (
43
44
  <Box shape={shape}>
44
- <div ref={scrollRef} className='flex flex-col w-full overflow-y-scroll gap-2 p-2'>
45
- {[...items].map((item, i) => (
46
- <ThreadItem key={i} item={item} />
47
- ))}
48
- </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>
49
52
  </Box>
50
53
  );
51
54
  };
52
55
 
53
56
  export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>) => {
54
57
  if (typeof item !== 'object') {
55
- return <div className={mx(classNames)}>{item}</div>;
58
+ return (
59
+ <div role='none' className={mx(classNames)}>
60
+ {item}
61
+ </div>
62
+ );
56
63
  }
57
64
 
58
65
  // TODO(burdon): Hack; introspect type.
@@ -62,7 +69,7 @@ export const ThreadItem = ({ classNames, item }: ThemedClassName<{ item: any }>)
62
69
  <div className={mx('flex', classNames, role === 'user' && 'justify-end')}>
63
70
  <div
64
71
  className={mx(
65
- 'block rounded-md p-1 px-2 text-sm',
72
+ 'block rounded-md p-1 pli-2 text-sm',
66
73
  role === 'user'
67
74
  ? 'bg-blue-100 dark:bg-blue-800'
68
75
  : role === 'system'
@@ -2,57 +2,45 @@
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 } from 'react';
7
7
 
8
8
  import { VoidInput } from '@dxos/conductor';
9
- import { ObjectId, Ref } from '@dxos/echo-schema';
10
- import {
11
- type EmailTrigger,
12
- FunctionTrigger,
13
- type QueueTrigger,
14
- type SubscriptionTrigger,
15
- type TimerTrigger,
16
- TriggerKind,
17
- type TriggerType,
18
- type WebhookTrigger,
19
- EmailTriggerOutput,
20
- QueueTriggerOutput,
21
- SubscriptionTriggerOutput,
22
- TimerTriggerOutput,
23
- WebhookTriggerOutput,
24
- } from '@dxos/functions';
9
+ import { Filter, Obj, Query, Ref, Type } from '@dxos/echo';
10
+ import { type Mutable } from '@dxos/echo/internal';
11
+ import { Trigger, TriggerEvent } from '@dxos/functions';
25
12
  import { DXN, SpaceId } from '@dxos/keys';
26
- import { live, makeRef, useSpace } from '@dxos/react-client/echo';
13
+ import { useSpace } from '@dxos/react-client/echo';
27
14
  import { Select, type SelectRootProps } from '@dxos/react-ui';
28
15
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
29
16
 
30
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
31
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
17
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
18
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
32
19
 
33
20
  export const TriggerShape = Schema.extend(
34
21
  ComputeShape,
35
22
  Schema.Struct({
36
23
  type: Schema.Literal('trigger'),
37
- functionTrigger: Schema.optional(Ref(FunctionTrigger)),
24
+ functionTrigger: Schema.optional(Type.Ref(Trigger.Trigger)),
38
25
  }),
39
26
  );
40
- export type TriggerShape = Schema.Schema.Type<typeof TriggerShape>;
27
+
28
+ export interface TriggerShape extends Schema.Schema.Type<typeof TriggerShape> {}
41
29
 
42
30
  export type CreateTriggerProps = CreateShapeProps<Omit<TriggerShape, 'functionTrigger'>> & {
43
31
  spaceId?: SpaceId;
44
- triggerKind?: TriggerKind;
32
+ triggerKind?: Trigger.Kind;
45
33
  };
46
34
 
47
35
  export const createTrigger = (props: CreateTriggerProps): TriggerShape => {
48
- const functionTrigger = live(FunctionTrigger, {
36
+ const functionTrigger = Trigger.make({
49
37
  enabled: true,
50
38
  spec: createTriggerSpec(props),
51
39
  });
52
40
  return createShape<TriggerShape>({
53
41
  type: 'trigger',
54
- functionTrigger: makeRef(functionTrigger),
55
- size: { width: 192, height: getHeight(EmailTriggerOutput) },
42
+ functionTrigger: Ref.make(functionTrigger),
43
+ size: { width: 192, height: getHeight(TriggerEvent.EmailEvent) },
56
44
  ...props,
57
45
  });
58
46
  };
@@ -65,17 +53,21 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
65
53
 
66
54
  useEffect(() => {
67
55
  if (functionTrigger && !functionTrigger.spec) {
68
- functionTrigger.spec = createTriggerSpec({ triggerKind: TriggerKind.Email, spaceId: space?.id });
56
+ Obj.change(functionTrigger, (t) => {
57
+ t.spec = createTriggerSpec({ triggerKind: 'email', spaceId: space?.id }) as Mutable<Trigger.Spec>;
58
+ });
69
59
  }
70
60
  }, [functionTrigger, functionTrigger?.spec]);
71
61
 
72
62
  useEffect(() => {
73
- shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? TriggerKind.Email));
63
+ shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? 'email'));
74
64
  }, [functionTrigger?.spec?.kind]);
75
65
 
76
- const setKind = (kind: TriggerKind) => {
66
+ const setKind = (kind: Trigger.Kind) => {
77
67
  if (functionTrigger?.spec?.kind !== kind) {
78
- functionTrigger!.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id });
68
+ Obj.change(functionTrigger!, (t) => {
69
+ t.spec = createTriggerSpec({ triggerKind: kind, spaceId: space?.id }) as Mutable<Trigger.Spec>;
70
+ });
79
71
  }
80
72
  };
81
73
 
@@ -87,7 +79,7 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
87
79
  <FunctionBody
88
80
  shape={shape}
89
81
  status={
90
- <TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as TriggerKind)} />
82
+ <TriggerKindSelect value={functionTrigger.spec?.kind} onValueChange={(kind) => setKind(kind as Trigger.Kind)} />
91
83
  }
92
84
  inputSchema={VoidInput}
93
85
  outputSchema={getOutputSchema(functionTrigger.spec!.kind!)}
@@ -99,12 +91,12 @@ export const TriggerComponent = ({ shape }: TriggerComponentProps) => {
99
91
  const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
100
92
  return (
101
93
  <Select.Root value={value} onValueChange={onValueChange}>
102
- <Select.TriggerButton variant='ghost' classNames='w-full !px-0' />
94
+ <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
103
95
  <Select.Portal>
104
96
  <Select.Content>
105
97
  <Select.ScrollUpButton />
106
98
  <Select.Viewport>
107
- {Object.values(TriggerKind).map((kind) => (
99
+ {Trigger.Kinds.map((kind) => (
108
100
  <Select.Option key={kind} value={kind}>
109
101
  {kind}
110
102
  </Select.Option>
@@ -118,31 +110,36 @@ const TriggerKindSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'valu
118
110
  );
119
111
  };
120
112
 
121
- const createTriggerSpec = (props: { triggerKind?: TriggerKind; spaceId?: SpaceId }): TriggerType => {
122
- const kind = props.triggerKind ?? TriggerKind.Email;
113
+ const createTriggerSpec = (props: { triggerKind?: Trigger.Kind; spaceId?: SpaceId }): Trigger.Spec => {
114
+ const kind = props.triggerKind ?? 'email';
123
115
  switch (kind) {
124
- case TriggerKind.Timer:
125
- return { kind: TriggerKind.Timer, cron: '*/10 * * * * *' } satisfies TimerTrigger;
126
- case TriggerKind.Webhook:
127
- return { kind: TriggerKind.Webhook, method: 'POST' } satisfies WebhookTrigger;
128
- case TriggerKind.Subscription:
129
- return { kind: TriggerKind.Subscription, filter: {} } satisfies SubscriptionTrigger;
130
- case TriggerKind.Email:
131
- return { kind: TriggerKind.Email } satisfies EmailTrigger;
132
- case TriggerKind.Queue: {
133
- const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), ObjectId.random()]).toString();
134
- return { kind: TriggerKind.Queue, queue: dxn } satisfies QueueTrigger;
116
+ case 'timer':
117
+ return { kind: 'timer', cron: '*/10 * * * * *' } satisfies Trigger.TimerSpec;
118
+ case 'webhook':
119
+ return { kind: 'webhook', method: 'POST' } satisfies Trigger.WebhookSpec;
120
+ case 'subscription':
121
+ return {
122
+ kind: 'subscription',
123
+ query: {
124
+ ast: Query.select(Filter.nothing()).ast,
125
+ },
126
+ } satisfies Trigger.SubscriptionSpec;
127
+ case 'email':
128
+ return { kind: 'email' } satisfies Trigger.EmailSpec;
129
+ case 'queue': {
130
+ const dxn = new DXN(DXN.kind.QUEUE, ['data', props.spaceId ?? SpaceId.random(), Obj.ID.random()]).toString();
131
+ return { kind: 'queue', queue: dxn } satisfies Trigger.QueueSpec;
135
132
  }
136
133
  }
137
134
  };
138
135
 
139
- const getOutputSchema = (kind: TriggerKind) => {
140
- const kindToSchema: Record<TriggerKind, Schema.Schema<any>> = {
141
- [TriggerKind.Email]: EmailTriggerOutput,
142
- [TriggerKind.Subscription]: SubscriptionTriggerOutput,
143
- [TriggerKind.Timer]: TimerTriggerOutput,
144
- [TriggerKind.Webhook]: WebhookTriggerOutput,
145
- [TriggerKind.Queue]: QueueTriggerOutput,
136
+ const getOutputSchema = (kind: Trigger.Kind) => {
137
+ const kindToSchema: Record<Trigger.Kind, Schema.Schema<any>> = {
138
+ ['email']: TriggerEvent.EmailEvent,
139
+ ['subscription']: TriggerEvent.SubscriptionEvent,
140
+ ['timer']: TriggerEvent.TimerEvent,
141
+ ['webhook']: TriggerEvent.WebhookEvent,
142
+ ['queue']: TriggerEvent.QueueEvent,
146
143
  };
147
144
  return kindToSchema[kind];
148
145
  };
@@ -154,9 +151,5 @@ export const triggerShape: ShapeDef<TriggerShape> = {
154
151
  component: TriggerComponent,
155
152
  createShape: createTrigger,
156
153
  getAnchors: (shape) =>
157
- createFunctionAnchors(
158
- shape,
159
- VoidInput,
160
- getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? TriggerKind.Email),
161
- ),
154
+ createFunctionAnchors(shape, VoidInput, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? 'email')),
162
155
  };
@@ -2,13 +2,12 @@
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';
9
- import { useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
10
- import { type Shape } from '@dxos/react-ui-canvas-editor';
11
- import { mx } from '@dxos/react-ui-theme';
9
+ import { type CanvasBoard, useEditorContext, useShapeDef } from '@dxos/react-ui-canvas-editor';
10
+ import { mx } from '@dxos/ui-theme';
12
11
 
13
12
  export const headerHeight = 32;
14
13
  export const footerHeight = 32;
@@ -17,7 +16,7 @@ export type BoxActionHandler = (action: 'run' | 'open' | 'close') => void;
17
16
 
18
17
  export type BoxProps = PropsWithChildren<
19
18
  ThemedClassName<{
20
- shape: Shape;
19
+ shape: CanvasBoard.Shape;
21
20
  title?: string;
22
21
  status?: string | ReactNode;
23
22
  open?: boolean;
@@ -32,10 +31,10 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
32
31
  const { debug } = useEditorContext();
33
32
 
34
33
  return (
35
- <div ref={forwardedRef} className='flex flex-col h-full w-full justify-between'>
36
- <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface'>
34
+ <div ref={forwardedRef} className='flex flex-col bs-full is-full justify-between'>
35
+ <div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
37
36
  <Icon icon={icon} classNames='mx-2' />
38
- <div className='grow text-sm truncate'>{debug ? shape.type : name ?? shape.text ?? title}</div>
37
+ <div className='grow text-sm truncate'>{debug ? shape.type : (name ?? shape.text ?? title)}</div>
39
38
  <IconButton
40
39
  classNames='p-1 text-green-500'
41
40
  variant='ghost'
@@ -50,9 +49,9 @@ export const Box = forwardRef<HTMLDivElement, BoxProps>(
50
49
  }}
51
50
  />
52
51
  </div>
53
- <div className={mx('flex flex-col h-full grow overflow-hidden', classNames)}>{children}</div>
54
- <div className='flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface'>
55
- <div className='grow px-2 text-sm truncate'>{debug ? shape.id : status}</div>
52
+ <div className={mx('flex flex-col bs-full grow overflow-hidden', classNames)}>{children}</div>
53
+ <div className='flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface'>
54
+ <div className='grow pli-2 text-sm truncate'>{debug ? shape.id : status}</div>
56
55
  {openable && (
57
56
  <IconButton
58
57
  classNames='p-1'
@@ -2,13 +2,14 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type Schema, SchemaAST } from 'effect';
5
+ import type * as Schema from 'effect/Schema';
6
+ import * as SchemaAST from 'effect/SchemaAST';
6
7
  import React, { type JSX, useRef, useState } from 'react';
7
8
 
8
9
  import { VoidInput, VoidOutput } from '@dxos/conductor';
9
10
  import { useCanvasContext } from '@dxos/react-ui-canvas';
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 { type CanvasBoard, type Polygon } from '@dxos/react-ui-canvas-editor';
12
+ import { createAnchors, getParentShapeElement, rowHeight } from '@dxos/react-ui-canvas-editor';
12
13
 
13
14
  import { Box, type BoxProps, footerHeight, headerHeight } from '../common';
14
15
  import { createAnchorId, getProperties } from '../defs';
@@ -17,7 +18,7 @@ const bodyPadding = 8;
17
18
  const expandedHeight = 200;
18
19
 
19
20
  export type FunctionBodyProps = {
20
- shape: Shape;
21
+ shape: CanvasBoard.Shape;
21
22
  name?: string;
22
23
  content?: JSX.Element;
23
24
  inputSchema?: Schema.Schema.Any;
@@ -81,7 +82,7 @@ export const FunctionBody = ({
81
82
  {(inputs?.length ?? 0) > 0 && (
82
83
  <div className='flex flex-col'>
83
84
  {inputs?.map(({ name }) => (
84
- <div key={name} className='px-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
85
+ <div key={name} className='pli-2 truncate text-sm font-mono items-center' style={{ height: rowHeight }}>
85
86
  {name}
86
87
  </div>
87
88
  ))}
@@ -92,7 +93,7 @@ export const FunctionBody = ({
92
93
  {outputs?.map(({ name }) => (
93
94
  <div
94
95
  key={name}
95
- className='px-2 truncate text-sm font-mono items-center text-right'
96
+ className='pli-2 truncate text-sm font-mono items-center text-right'
96
97
  style={{ height: rowHeight }}
97
98
  >
98
99
  {name}
@@ -11,7 +11,7 @@ import { Select, type SelectRootProps } from '@dxos/react-ui';
11
11
  export const TypeSelect = ({ value, onValueChange }: Pick<SelectRootProps, 'value' | 'onValueChange'>) => {
12
12
  return (
13
13
  <Select.Root value={value} onValueChange={onValueChange}>
14
- <Select.TriggerButton variant='ghost' classNames='w-full !px-0' />
14
+ <Select.TriggerButton variant='ghost' classNames='is-full !pli-0' />
15
15
  <Select.Portal>
16
16
  <Select.Content>
17
17
  <Select.ScrollUpButton />
@@ -2,10 +2,11 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, SchemaAST } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
+ import * as SchemaAST from 'effect/SchemaAST';
6
7
 
7
8
  import { DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
8
- import { ObjectId } from '@dxos/echo-schema';
9
+ import { Obj } from '@dxos/echo';
9
10
  import { Polygon } from '@dxos/react-ui-canvas-editor';
10
11
  import { type MakeOptional } from '@dxos/util';
11
12
 
@@ -36,7 +37,7 @@ export const ComputeShape = Schema.extend(
36
37
  Polygon,
37
38
  Schema.Struct({
38
39
  // TODO(burdon): Rename computeNode?
39
- node: Schema.optional(ObjectId.annotations({ description: 'Compute node id' })),
40
+ node: Schema.optional(Obj.ID.annotations({ description: 'Compute node id' })),
40
41
  }).pipe(Schema.mutable),
41
42
  );
42
43
 
@@ -44,7 +45,7 @@ export type ComputeShape = Schema.Schema.Type<typeof ComputeShape>;
44
45
 
45
46
  export const createShape = <S extends ComputeShape>({ id, ...rest }: CreateShapeProps<S> & { type: string }): S => {
46
47
  return {
47
- id: id ?? ObjectId.random(),
48
+ id: id ?? Obj.ID.random(),
48
49
  ...rest,
49
50
  } as S;
50
51
  };
@@ -2,15 +2,11 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { createSystemPrompt } from '@dxos/artifact';
6
- import { ObjectId } from '@dxos/echo-schema';
7
- import type { ServiceContainer } from '@dxos/functions';
8
- import { DXN, SpaceId } from '@dxos/keys';
5
+ import { createSystemPrompt } from '@dxos/assistant';
6
+ import { DXN, ObjectId, SpaceId } from '@dxos/keys';
9
7
  import { type Dimension, type Point } from '@dxos/react-ui-canvas';
10
8
  import { CanvasGraphModel, createNote, pointMultiply, pointsToRect, rectToPoints } from '@dxos/react-ui-canvas-editor';
11
9
 
12
- import { ComputeGraphController } from '../graph';
13
- import { createComputeGraph } from '../hooks';
14
10
  import {
15
11
  type ComputeShape,
16
12
  createAnd,
@@ -38,19 +34,14 @@ import {
38
34
  createTextToImage,
39
35
  } from '../shapes';
40
36
 
41
- export const createComputeGraphController = (
42
- graph: CanvasGraphModel<ComputeShape>,
43
- serviceContainer: ServiceContainer,
44
- ) => {
45
- const computeGraph = createComputeGraph(graph);
46
- const controller = new ComputeGraphController(serviceContainer, computeGraph);
47
- return { controller, graph };
48
- };
49
-
50
37
  //
51
38
  // Circuits
52
39
  //
53
40
 
41
+ export const createEmptyCircuit = () => {
42
+ return CanvasGraphModel.create<ComputeShape>();
43
+ };
44
+
54
45
  export const createBasicCircuit = () => {
55
46
  const model = CanvasGraphModel.create<ComputeShape>();
56
47
  model.builder.call(({ model }) => {
@@ -207,7 +198,7 @@ export const createArtifactCircuit = () => {
207
198
  model.builder.call((builder) => {
208
199
  const prompt = model.createNode(
209
200
  createTemplate({
210
- text: createSystemPrompt(),
201
+ text: createSystemPrompt({}),
211
202
  ...position({ x: -10, y: -5, width: 8, height: 18 }),
212
203
  }),
213
204
  );
@@ -262,7 +253,7 @@ export const createGptCircuit = (options: {
262
253
  if (options.instructions) {
263
254
  const prompt = model.createNode(
264
255
  createTemplate({
265
- text: createSystemPrompt(),
256
+ text: createSystemPrompt({}),
266
257
  ...position({ x: -18, y: -12, width: 8, height: 10 }),
267
258
  }),
268
259
  );