@dxos/react-ui-canvas-compute 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b

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 (115) hide show
  1. package/dist/lib/browser/index.mjs +227 -202
  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 +227 -202
  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 +12 -5
  8. package/dist/types/src/compute.stories.d.ts.map +1 -1
  9. package/dist/types/src/graph/controller.d.ts +33 -24
  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 +1 -1
  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 +4 -33
  67. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  68. package/dist/types/src/shapes/common/Box.d.ts.map +1 -1
  69. package/dist/types/src/shapes/common/FunctionBody.d.ts +1 -1
  70. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  71. package/dist/types/src/shapes/defs.d.ts +2 -1
  72. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  73. package/dist/types/src/testing/circuits.d.ts +1 -1
  74. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  75. package/dist/types/tsconfig.tsbuildinfo +1 -1
  76. package/package.json +53 -49
  77. package/src/compute-layout.ts +1 -1
  78. package/src/compute.stories.tsx +29 -21
  79. package/src/graph/controller.ts +24 -13
  80. package/src/graph/node-defs.ts +6 -6
  81. package/src/hooks/useComputeGraphController.ts +2 -2
  82. package/src/hooks/useComputeNodeState.ts +10 -7
  83. package/src/hooks/useGraphMonitor.ts +3 -3
  84. package/src/json.test.ts +1 -1
  85. package/src/registry.ts +2 -2
  86. package/src/schema.test.ts +10 -10
  87. package/src/shapes/Append.tsx +3 -3
  88. package/src/shapes/Array.tsx +3 -3
  89. package/src/shapes/Audio.tsx +5 -4
  90. package/src/shapes/Beacon.tsx +5 -4
  91. package/src/shapes/Boolean.tsx +5 -5
  92. package/src/shapes/Chat.tsx +4 -3
  93. package/src/shapes/Constant.tsx +4 -3
  94. package/src/shapes/Database.tsx +2 -2
  95. package/src/shapes/Function.tsx +15 -12
  96. package/src/shapes/Gpt.tsx +8 -6
  97. package/src/shapes/GptRealtime.tsx +3 -3
  98. package/src/shapes/Json.tsx +4 -3
  99. package/src/shapes/Logic.tsx +3 -3
  100. package/src/shapes/Queue.tsx +6 -5
  101. package/src/shapes/RNG.tsx +9 -4
  102. package/src/shapes/Scope.tsx +6 -5
  103. package/src/shapes/Surface.tsx +10 -5
  104. package/src/shapes/Switch.tsx +5 -4
  105. package/src/shapes/Table.tsx +6 -6
  106. package/src/shapes/Template.tsx +6 -5
  107. package/src/shapes/Text.tsx +5 -4
  108. package/src/shapes/TextToImage.tsx +2 -2
  109. package/src/shapes/Thread.tsx +8 -8
  110. package/src/shapes/Trigger.tsx +42 -55
  111. package/src/shapes/common/Box.tsx +6 -6
  112. package/src/shapes/common/FunctionBody.tsx +5 -4
  113. package/src/shapes/common/TypeSelect.tsx +1 -1
  114. package/src/shapes/defs.ts +5 -4
  115. package/src/testing/circuits.ts +2 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-canvas-compute",
3
- "version": "0.8.4-main.2e9d522",
3
+ "version": "0.8.4-main.3c1ae3b",
4
4
  "description": "A compute graph extension for the canvas editor component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -9,6 +9,7 @@
9
9
  "type": "module",
10
10
  "exports": {
11
11
  ".": {
12
+ "source": "./src/index.ts",
12
13
  "types": "./dist/types/src/index.d.ts",
13
14
  "browser": "./dist/lib/browser/index.mjs",
14
15
  "node": "./dist/lib/node-esm/index.mjs"
@@ -25,63 +26,66 @@
25
26
  "dependencies": {
26
27
  "@antv/graphlib": "^2.0.4",
27
28
  "@antv/layout": "^1.2.13",
28
- "@effect/platform": "0.89.0",
29
+ "@effect/platform": "0.92.1",
29
30
  "@preact-signals/safe-react": "^0.9.0",
30
31
  "chess.js": "^1.0.0",
31
- "@dxos/ai": "0.8.4-main.2e9d522",
32
- "@dxos/app-framework": "0.8.4-main.2e9d522",
33
- "@dxos/assistant": "0.8.4-main.2e9d522",
34
- "@dxos/async": "0.8.4-main.2e9d522",
35
- "@dxos/blueprints": "0.8.4-main.2e9d522",
36
- "@dxos/conductor": "0.8.4-main.2e9d522",
37
- "@dxos/context": "0.8.4-main.2e9d522",
38
- "@dxos/debug": "0.8.4-main.2e9d522",
39
- "@dxos/echo-schema": "0.8.4-main.2e9d522",
40
- "@dxos/edge-client": "0.8.4-main.2e9d522",
41
- "@dxos/functions": "0.8.4-main.2e9d522",
42
- "@dxos/graph": "0.8.4-main.2e9d522",
43
- "@dxos/invariant": "0.8.4-main.2e9d522",
44
- "@dxos/keys": "0.8.4-main.2e9d522",
45
- "@dxos/live-object": "0.8.4-main.2e9d522",
46
- "@dxos/log": "0.8.4-main.2e9d522",
47
- "@dxos/react-client": "0.8.4-main.2e9d522",
48
- "@dxos/react-edge-client": "0.8.4-main.2e9d522",
49
- "@dxos/react-ui-attention": "0.8.4-main.2e9d522",
50
- "@dxos/react-ui-canvas": "0.8.4-main.2e9d522",
51
- "@dxos/react-ui-canvas-editor": "0.8.4-main.2e9d522",
52
- "@dxos/react-ui-editor": "0.8.4-main.2e9d522",
53
- "@dxos/react-ui-form": "0.8.4-main.2e9d522",
54
- "@dxos/react-ui-sfx": "0.8.4-main.2e9d522",
55
- "@dxos/react-ui-stack": "0.8.4-main.2e9d522",
56
- "@dxos/schema": "0.8.4-main.2e9d522",
57
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.2e9d522",
58
- "@dxos/util": "0.8.4-main.2e9d522"
32
+ "@dxos/ai": "0.8.4-main.3c1ae3b",
33
+ "@dxos/app-framework": "0.8.4-main.3c1ae3b",
34
+ "@dxos/assistant": "0.8.4-main.3c1ae3b",
35
+ "@dxos/async": "0.8.4-main.3c1ae3b",
36
+ "@dxos/conductor": "0.8.4-main.3c1ae3b",
37
+ "@dxos/blueprints": "0.8.4-main.3c1ae3b",
38
+ "@dxos/context": "0.8.4-main.3c1ae3b",
39
+ "@dxos/debug": "0.8.4-main.3c1ae3b",
40
+ "@dxos/echo": "0.8.4-main.3c1ae3b",
41
+ "@dxos/functions": "0.8.4-main.3c1ae3b",
42
+ "@dxos/edge-client": "0.8.4-main.3c1ae3b",
43
+ "@dxos/graph": "0.8.4-main.3c1ae3b",
44
+ "@dxos/functions-runtime": "0.8.4-main.3c1ae3b",
45
+ "@dxos/invariant": "0.8.4-main.3c1ae3b",
46
+ "@dxos/keys": "0.8.4-main.3c1ae3b",
47
+ "@dxos/log": "0.8.4-main.3c1ae3b",
48
+ "@dxos/react-client": "0.8.4-main.3c1ae3b",
49
+ "@dxos/react-edge-client": "0.8.4-main.3c1ae3b",
50
+ "@dxos/react-ui-attention": "0.8.4-main.3c1ae3b",
51
+ "@dxos/react-ui-canvas": "0.8.4-main.3c1ae3b",
52
+ "@dxos/live-object": "0.8.4-main.3c1ae3b",
53
+ "@dxos/react-ui-canvas-editor": "0.8.4-main.3c1ae3b",
54
+ "@dxos/react-ui-form": "0.8.4-main.3c1ae3b",
55
+ "@dxos/react-ui-editor": "0.8.4-main.3c1ae3b",
56
+ "@dxos/react-ui-sfx": "0.8.4-main.3c1ae3b",
57
+ "@dxos/react-ui-stack": "0.8.4-main.3c1ae3b",
58
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.3c1ae3b",
59
+ "@dxos/schema": "0.8.4-main.3c1ae3b",
60
+ "@dxos/types": "0.8.4-main.3c1ae3b",
61
+ "@dxos/util": "0.8.4-main.3c1ae3b"
59
62
  },
60
63
  "devDependencies": {
61
- "@effect/ai": "0.23.0",
64
+ "@effect/ai": "0.29.1",
65
+ "@effect/experimental": "0.56.0",
62
66
  "@types/lodash.defaultsdeep": "^4.6.6",
63
- "@types/react": "~18.2.0",
64
- "@types/react-dom": "~18.2.0",
65
- "effect": "3.17.0",
67
+ "@types/react": "~19.2.2",
68
+ "@types/react-dom": "~19.2.2",
69
+ "effect": "3.18.3",
66
70
  "lodash.defaultsdeep": "^4.6.1",
67
- "react": "~18.2.0",
68
- "react-dom": "~18.2.0",
69
- "vite": "5.4.7",
70
- "@dxos/app-framework": "0.8.4-main.2e9d522",
71
- "@dxos/assistant-testing": "0.8.4-main.2e9d522",
72
- "@dxos/compute": "0.8.4-main.2e9d522",
73
- "@dxos/echo-signals": "0.8.4-main.2e9d522",
74
- "@dxos/random": "0.8.4-main.2e9d522",
75
- "@dxos/react-ui": "0.8.4-main.2e9d522",
76
- "@dxos/storybook-utils": "0.8.4-main.2e9d522",
77
- "@dxos/react-ui-theme": "0.8.4-main.2e9d522"
71
+ "react": "~19.2.0",
72
+ "react-dom": "~19.2.0",
73
+ "vite": "7.1.9",
74
+ "@dxos/app-framework": "0.8.4-main.3c1ae3b",
75
+ "@dxos/assistant-toolkit": "0.8.4-main.3c1ae3b",
76
+ "@dxos/compute": "0.8.4-main.3c1ae3b",
77
+ "@dxos/echo-signals": "0.8.4-main.3c1ae3b",
78
+ "@dxos/random": "0.8.4-main.3c1ae3b",
79
+ "@dxos/react-ui": "0.8.4-main.3c1ae3b",
80
+ "@dxos/storybook-utils": "0.8.4-main.3c1ae3b",
81
+ "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
78
82
  },
79
83
  "peerDependencies": {
80
84
  "effect": "^3.13.3",
81
- "react": "~18.2.0",
82
- "react-dom": "~18.2.0",
83
- "@dxos/react-ui": "0.8.4-main.2e9d522",
84
- "@dxos/react-ui-theme": "0.8.4-main.2e9d522"
85
+ "react": "^19.0.0",
86
+ "react-dom": "^19.0.0",
87
+ "@dxos/react-ui": "0.8.4-main.3c1ae3b",
88
+ "@dxos/react-ui-theme": "0.8.4-main.3c1ae3b"
85
89
  },
86
90
  "publishConfig": {
87
91
  "access": "public"
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { DefaultInput, DefaultOutput } from '@dxos/conductor';
6
- import { toEffectSchema } from '@dxos/echo-schema';
6
+ import { toEffectSchema } from '@dxos/echo/internal';
7
7
  import { type Anchor, ShapeLayout, type ShapeRegistry } from '@dxos/react-ui-canvas-editor';
8
8
 
9
9
  import { type ComputeGraphController } from './graph';
@@ -2,17 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import type { Meta, StoryObj } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React, { type PropsWithChildren, useEffect, useMemo, useRef, useState } from 'react';
9
7
 
10
8
  import { withPluginManager } from '@dxos/app-framework/testing';
11
- import { capabilities } from '@dxos/assistant-testing';
9
+ import { capabilities } from '@dxos/assistant-toolkit';
12
10
  import { type ComputeGraphModel, type ComputeNode, type GraphDiagnostic } from '@dxos/conductor';
13
- import { ServiceContainer } from '@dxos/functions';
11
+ import { ServiceContainer } from '@dxos/functions-runtime';
14
12
  import { withClientProvider } from '@dxos/react-client/testing';
15
13
  import { Select, Toolbar } from '@dxos/react-ui';
14
+ import { withTheme } from '@dxos/react-ui/testing';
16
15
  import { withAttention } from '@dxos/react-ui-attention/testing';
17
16
  import {
18
17
  CanvasGraphModel,
@@ -22,8 +21,8 @@ import {
22
21
  ShapeRegistry,
23
22
  } from '@dxos/react-ui-canvas-editor';
24
23
  import { Container, useSelection } from '@dxos/react-ui-canvas-editor/testing';
24
+ import { Form } from '@dxos/react-ui-form';
25
25
  import { JsonFilter } from '@dxos/react-ui-syntax-highlighter';
26
- import { withLayout, withTheme } from '@dxos/storybook-utils';
27
26
 
28
27
  import { DiagnosticOverlay } from './components';
29
28
  import { ComputeShapeLayout } from './compute-layout';
@@ -37,8 +36,8 @@ import {
37
36
  createBasicCircuit,
38
37
  createComputeGraphController,
39
38
  createControlCircuit,
40
- createGptCircuit,
41
39
  createGPTRealtimeCircuit,
40
+ createGptCircuit,
42
41
  createLogicCircuit,
43
42
  createTemplateCircuit,
44
43
  createTransformCircuit,
@@ -121,7 +120,7 @@ const DefaultStory = ({
121
120
  }
122
121
 
123
122
  return (
124
- <div className='grid grid-cols-[1fr,360px] w-full h-full'>
123
+ <div className='grid grid-cols-[1fr,360px] is-full bs-full'>
125
124
  <ComputeContext.Provider value={{ controller }}>
126
125
  <Container id={id} classNames={['flex grow overflow-hidden', !sidebar && 'col-span-2']}>
127
126
  <Editor.Root<ComputeShape>
@@ -143,8 +142,8 @@ const DefaultStory = ({
143
142
  </ComputeContext.Provider>
144
143
 
145
144
  {sidebar && (
146
- <Container id='sidebar' classNames='flex flex-col h-full overflow-hidden'>
147
- <Toolbar.Root classNames='p-1'>
145
+ <Container id='sidebar' classNames='flex flex-col bs-full overflow-hidden'>
146
+ <Toolbar.Root>
148
147
  <Select.Root value={sidebar} onValueChange={(value) => setSidebar(value as RenderProps['sidebar'])}>
149
148
  <Select.TriggerButton classNames='is-full'>{sidebar}</Select.TriggerButton>
150
149
  <Select.Portal>
@@ -156,17 +155,24 @@ const DefaultStory = ({
156
155
  </Select.Item>
157
156
  ))}
158
157
  </Select.Viewport>
158
+ <Select.Arrow />
159
159
  </Select.Content>
160
160
  </Select.Portal>
161
161
  </Select.Root>
162
162
  </Toolbar.Root>
163
163
 
164
- <div className='flex flex-col h-full overflow-hidden divide-y divider-separator'>
164
+ <div className='flex flex-col bs-full overflow-hidden divide-y divider-separator'>
165
+ {/* TODO(burdon): Provide schema. */}
165
166
  {sidebar === 'selected' && selected && (
166
- <div>Form</div>
167
- // <Form<ComputeNode> schema={FormSchema} values={getComputeNode(selected.id) ?? {}} Custom={{}} />
167
+ <Form.Root<ComputeNode> values={getComputeNode(selected.id) ?? {}}>
168
+ <Form.Viewport>
169
+ <Form.Content>
170
+ <Form.FieldSet />
171
+ <Form.Actions />
172
+ </Form.Content>
173
+ </Form.Viewport>
174
+ </Form.Root>
168
175
  )}
169
-
170
176
  <JsonFilter data={json} />
171
177
  </div>
172
178
  </Container>
@@ -175,22 +181,24 @@ const DefaultStory = ({
175
181
  );
176
182
  };
177
183
 
178
- const meta: Meta<RenderProps> = {
184
+ const meta = {
179
185
  title: 'ui/react-ui-canvas-compute/compute',
180
- component: Editor.Root,
186
+ component: Editor.Root as any,
181
187
  render: DefaultStory,
182
188
  decorators: [
183
189
  withTheme,
184
190
  withAttention,
185
191
  withClientProvider({ createIdentity: true, createSpace: true }),
186
- withLayout({ fullscreen: true }),
187
192
  withPluginManager({ capabilities }),
188
193
  ],
189
- };
194
+ parameters: {
195
+ layout: 'fullscreen',
196
+ },
197
+ } satisfies Meta<typeof DefaultStory>;
190
198
 
191
199
  export default meta;
192
200
 
193
- type Story = StoryObj<RenderProps>;
201
+ type Story = StoryObj<typeof meta>;
194
202
 
195
203
  export const Default: Story = {
196
204
  args: {
@@ -289,7 +297,7 @@ export const Plugins: Story = {
289
297
  ...createComputeGraphController(
290
298
  createGptCircuit({ history: true, image: true, artifact: true }),
291
299
  new ServiceContainer().setServices({
292
- // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
300
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
293
301
  }),
294
302
  ),
295
303
  },
@@ -305,7 +313,7 @@ export const Artifact: Story = {
305
313
  ...createComputeGraphController(
306
314
  createArtifactCircuit(),
307
315
  new ServiceContainer().setServices({
308
- // ai: AiService.make(new Edge AiServiceClient({ endpoint: localServiceEndpoints.ai })),
316
+ // ai: AiService.make(new Edge AiServiceClient({ endpoint: SERVICES_CONFIG.local.ai.server })),
309
317
  }),
310
318
  ),
311
319
  },
@@ -2,17 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type Context, Effect, Either, Exit, Scope } from 'effect';
5
+ import type * as Context from 'effect/Context';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Either from 'effect/Either';
8
+ import * as Exit from 'effect/Exit';
9
+ import * as Scope from 'effect/Scope';
6
10
 
7
- import { type ImageContentBlock } from '@dxos/ai';
8
11
  import { Event, synchronized } from '@dxos/async';
9
12
  import {
10
13
  type ComputeEdge,
11
- type ComputeEvent,
12
14
  type ComputeGraphModel,
13
- type ComputeMeta,
14
15
  type ComputeNode,
15
- type EventLogger,
16
+ type ComputeNodeMeta,
16
17
  type GptInput,
17
18
  type GptOutput,
18
19
  type GraphDiagnostic,
@@ -21,14 +22,17 @@ import {
21
22
  isNotExecuted,
22
23
  } from '@dxos/conductor';
23
24
  import { Resource } from '@dxos/context';
24
- import { type ServiceContainer } from '@dxos/functions';
25
+ import { type ComputeEventLogger, type ComputeEventPayload } from '@dxos/functions';
26
+ import { type ServiceContainer } from '@dxos/functions-runtime';
25
27
  import { log } from '@dxos/log';
26
28
  import { type CanvasGraphModel } from '@dxos/react-ui-canvas-editor';
29
+ import { type ContentBlock } from '@dxos/types';
27
30
 
28
- import { resolveComputeNode } from './node-defs';
29
31
  import { createComputeGraph } from '../hooks';
30
32
  import { type ComputeShape } from '../shapes';
31
33
 
34
+ import { resolveComputeNode } from './node-defs';
35
+
32
36
  // TODO(burdon): API package for conductor.
33
37
  export const InvalidStateError = Error;
34
38
 
@@ -43,7 +47,7 @@ export interface GptExecutor {
43
47
  invoke: FunctionCallback<GptInput, GptOutput>;
44
48
 
45
49
  // TODO(dmaretskyi): A hack to get image artifacts working. Rework into querying images from the ai-service store.
46
- imageCache: Map<string, ImageContentBlock>;
50
+ imageCache: Map<string, ContentBlock.Image>;
47
51
  }
48
52
 
49
53
  export type RuntimeValue =
@@ -110,7 +114,7 @@ export class ComputeGraphController extends Resource {
110
114
  /** Computed result. */
111
115
  public readonly output = new Event<ComputeOutputEvent>();
112
116
 
113
- public readonly events = new Event<ComputeEvent>();
117
+ public readonly events = new Event<ComputeEventPayload>();
114
118
 
115
119
  constructor(
116
120
  private readonly _serviceContainer: ServiceContainer,
@@ -154,7 +158,14 @@ export class ComputeGraphController extends Resource {
154
158
  /**
155
159
  * Inputs and outputs for all nodes.
156
160
  */
157
- get state() {
161
+ get state(): Record<
162
+ string,
163
+ {
164
+ node: ComputeNode;
165
+ input: Record<string, RuntimeValue>;
166
+ output: Record<string, RuntimeValue>;
167
+ }
168
+ > {
158
169
  const ids = [...new Set([...Object.keys(this._runtimeStateInputs), ...Object.keys(this._runtimeStateOutputs)])];
159
170
  return Object.fromEntries(
160
171
  ids.map((id) => [
@@ -201,7 +212,7 @@ export class ComputeGraphController extends Resource {
201
212
  });
202
213
  }
203
214
 
204
- async getMeta(node: ComputeNode): Promise<ComputeMeta> {
215
+ async getMeta(node: ComputeNode): Promise<ComputeNodeMeta> {
205
216
  const { meta } = await resolveComputeNode(node);
206
217
  return meta;
207
218
  }
@@ -322,7 +333,7 @@ export class ComputeGraphController extends Resource {
322
333
  this.update.emit();
323
334
  }
324
335
 
325
- private _createLogger(): Context.Tag.Service<EventLogger> {
336
+ private _createLogger(): Context.Tag.Service<ComputeEventLogger> {
326
337
  return {
327
338
  log: (event) => {
328
339
  this._handleEvent(event);
@@ -331,7 +342,7 @@ export class ComputeGraphController extends Resource {
331
342
  };
332
343
  }
333
344
 
334
- private _handleEvent(event: ComputeEvent): void {
345
+ private _handleEvent(event: ComputeEventPayload): void {
335
346
  log('handleEvent', { event });
336
347
  switch (event.type) {
337
348
  case 'compute-input': {
@@ -3,16 +3,16 @@
3
3
  //
4
4
 
5
5
  import {
6
- NODE_INPUT,
7
- NODE_OUTPUT,
8
6
  type ComputeNode,
9
7
  type Executable,
8
+ NODE_INPUT,
9
+ NODE_OUTPUT,
10
10
  type NodeType,
11
- registry,
12
11
  getTemplateInputSchema,
12
+ registry,
13
13
  } from '@dxos/conductor';
14
14
  import { raise } from '@dxos/debug';
15
- import { ObjectId, toJsonSchema } from '@dxos/echo-schema';
15
+ import { JsonSchema, Obj } from '@dxos/echo';
16
16
  import { invariant } from '@dxos/invariant';
17
17
 
18
18
  import { type ComputeShape, type ConstantShape, type TemplateShape } from '../shapes';
@@ -68,7 +68,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
68
68
  ['switch' as const]: () => createNode('switch'),
69
69
  ['template' as const]: (shape) => {
70
70
  const node = createNode('template', { valueType: (shape as TemplateShape).valueType, value: shape.text });
71
- node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
71
+ node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
72
72
  return node;
73
73
  },
74
74
  ['text' as const]: () => createNode('text'),
@@ -77,7 +77,7 @@ const nodeFactory: Record<NodeType | 'trigger', (shape: ComputeShape) => Compute
77
77
  };
78
78
 
79
79
  const createNode = (type: string, props?: Partial<ComputeNode>): ComputeNode => ({
80
- id: ObjectId.random(),
80
+ id: Obj.ID.random(),
81
81
  type,
82
82
  ...props,
83
83
  });
@@ -5,7 +5,7 @@
5
5
  import { type RefObject, useEffect, useState } from 'react';
6
6
 
7
7
  import { type CleanupFn } from '@dxos/async';
8
- import { type EditorRootProps, type EditorController } from '@dxos/react-ui-canvas-editor';
8
+ import { type EditorController, type EditorRootProps } from '@dxos/react-ui-canvas-editor';
9
9
 
10
10
  import { type ComputeGraphController } from '../graph';
11
11
  import { type ComputeShape } from '../shapes';
@@ -21,7 +21,7 @@ const combine = (...cbs: CleanupFn[]) => {
21
21
 
22
22
  export type UseComputeGraphControllerOptions = Pick<EditorRootProps<ComputeShape>, 'graph'> & {
23
23
  controller: ComputeGraphController | null;
24
- editorRef: RefObject<EditorController>;
24
+ editorRef: RefObject<EditorController | null>;
25
25
  };
26
26
 
27
27
  export const useComputeGraphController = ({ controller, graph, editorRef }: UseComputeGraphControllerOptions) => {
@@ -2,25 +2,27 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { useCallback, useEffect, useState } from 'react';
7
7
 
8
- import type { ComputeNode, ComputeMeta, ComputeEvent } from '@dxos/conductor';
8
+ import type { ComputeNode, ComputeNodeMeta } from '@dxos/conductor';
9
+ import type { ComputeEventPayload } from '@dxos/functions';
9
10
  import { invariant } from '@dxos/invariant';
10
11
 
11
- import { useComputeContext } from './compute-context';
12
12
  import { type RuntimeValue } from '../graph';
13
13
  import { type ComputeShape } from '../shapes';
14
14
 
15
+ import { useComputeContext } from './compute-context';
16
+
15
17
  export type ComputeNodeState = {
16
18
  node: ComputeNode;
17
- meta: ComputeMeta;
19
+ meta: ComputeNodeMeta;
18
20
  runtime: {
19
21
  inputs: Record<string, RuntimeValue>;
20
22
  outputs: Record<string, RuntimeValue>;
21
23
  setOutput: (property: string, value: any) => void;
22
24
  evalNode: () => void;
23
- subscribeToEventLog: (cb: (event: ComputeEvent) => void) => void;
25
+ subscribeToEventLog: (cb: (event: ComputeEventPayload) => void) => void;
24
26
  };
25
27
  };
26
28
 
@@ -31,7 +33,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
31
33
  const { controller } = useComputeContext();
32
34
  invariant(controller);
33
35
 
34
- const [meta, setMeta] = useState<ComputeMeta>();
36
+ const [meta, setMeta] = useState<ComputeNodeMeta>();
35
37
  useEffect(() => {
36
38
  let disposed = false;
37
39
  queueMicrotask(async () => {
@@ -41,6 +43,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
41
43
  if (disposed) {
42
44
  return;
43
45
  }
46
+
44
47
  setMeta(meta);
45
48
  });
46
49
 
@@ -54,7 +57,7 @@ export const useComputeNodeState = (shape: ComputeShape): ComputeNodeState => {
54
57
  }, [shape.node]);
55
58
 
56
59
  const subscribeToEventLog = useCallback(
57
- (cb: (event: ComputeEvent) => void) => {
60
+ (cb: (event: ComputeEventPayload) => void) => {
58
61
  return controller.events.on((ev) => {
59
62
  if (ev.nodeId === shape.node) {
60
63
  cb(ev);
@@ -5,10 +5,10 @@
5
5
  import { useMemo } from 'react';
6
6
 
7
7
  import { type ComputeEdge, ComputeGraphModel, type ComputeNode, DEFAULT_INPUT, DEFAULT_OUTPUT } from '@dxos/conductor';
8
- import { ObjectId, Ref } from '@dxos/echo-schema';
8
+ import { Obj, Ref } from '@dxos/echo';
9
9
  import { invariant } from '@dxos/invariant';
10
10
  import { getSpace } from '@dxos/react-client/echo';
11
- import { type GraphMonitor, type CanvasGraphModel, type Connection } from '@dxos/react-ui-canvas-editor';
11
+ import { type CanvasGraphModel, type Connection, type GraphMonitor } from '@dxos/react-ui-canvas-editor';
12
12
  import { isNonNullable } from '@dxos/util';
13
13
 
14
14
  import { createComputeNode, isValidComputeNode } from '../graph';
@@ -27,7 +27,7 @@ export const mapEdge = (
27
27
  invariant(targetNode?.node);
28
28
 
29
29
  return {
30
- id: ObjectId.random(),
30
+ id: Obj.ID.random(),
31
31
  source: sourceNode.node,
32
32
  target: targetNode.node,
33
33
  output,
package/src/json.test.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import { describe, test } from 'vitest';
7
7
 
8
8
  import { BaseGraphEdge, BaseGraphNode } from '@dxos/graph';
package/src/registry.ts CHANGED
@@ -29,10 +29,10 @@ import {
29
29
  surfaceShape,
30
30
  switchShape,
31
31
  templateShape,
32
- threadShape,
32
+ textShape,
33
33
  textToImageShape,
34
+ threadShape,
34
35
  triggerShape,
35
- textShape,
36
36
  } from './shapes';
37
37
 
38
38
  /**
@@ -2,26 +2,26 @@
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 { describe, test } from 'vitest';
7
7
 
8
- import { live } from '@dxos/client/echo';
9
- import { BaseGraphNode, Graph } from '@dxos/graph';
8
+ import { BaseGraphNode, type Graph } from '@dxos/graph';
10
9
  import {
10
+ CanvasGraphModel,
11
11
  Polygon,
12
+ Shape,
12
13
  createEllipse,
13
14
  createPath,
14
15
  createRectangle,
15
16
  isPath,
16
17
  isPolygon,
17
- Shape,
18
18
  } from '@dxos/react-ui-canvas-editor';
19
19
 
20
- import { createSwitch, ComputeShape, createFunction } from './shapes';
20
+ import { ComputeShape, createFunction, createSwitch } from './shapes';
21
21
 
22
22
  describe('compute', () => {
23
23
  test('model', ({ expect }) => {
24
- // const model = CanvasGraphModel.create<ComputeShape>();
24
+ const model = CanvasGraphModel.create<ComputeShape>();
25
25
  const node = createSwitch({ id: 'x', center: { x: 0, y: 0 }, size: { width: 80, height: 80 } });
26
26
  console.log(JSON.stringify(node, null, 2));
27
27
  expect(Schema.is(ComputeShape)(node)).toBe(true);
@@ -29,11 +29,11 @@ describe('compute', () => {
29
29
  expect(Schema.is(Shape)(node)).toBe(true);
30
30
  expect(Schema.is(BaseGraphNode)(node)).toBe(true);
31
31
 
32
- const graph = live(Graph, { nodes: [], edges: [] });
33
- graph.nodes.push(node); // Throws.
32
+ const graph: Graph = { nodes: [], edges: [] };
33
+ graph.nodes.push(node);
34
34
 
35
- // model.createNode(node);
36
- // console.log(JSON.stringify(model, null, 2));
35
+ model.createNode(node);
36
+ console.log(JSON.stringify(model, null, 2));
37
37
  });
38
38
  });
39
39
 
@@ -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 from 'react';
7
7
 
8
8
  import { AppendInput } from '@dxos/conductor';
9
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
10
 
11
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
11
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
12
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
13
13
 
14
14
  export const AppendShape = Schema.extend(
15
15
  ComputeShape,
@@ -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 from 'react';
7
7
 
8
8
  import { ReducerInput, ReducerOutput } from '@dxos/conductor';
9
9
  import { type ShapeComponentProps, type ShapeDef } from '@dxos/react-ui-canvas-editor';
10
10
 
11
- import { createFunctionAnchors, FunctionBody, getHeight } from './common';
12
- import { ComputeShape, createShape, type CreateShapeProps } from './defs';
11
+ import { FunctionBody, createFunctionAnchors, getHeight } from './common';
12
+ import { ComputeShape, type CreateShapeProps, createShape } from './defs';
13
13
 
14
14
  //
15
15
  // Data