@dxos/react-ui-canvas-compute 0.8.4-main.67995b8 → 0.8.4-main.6fa680abb7

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 (117) hide show
  1. package/dist/lib/browser/index.mjs +890 -1029
  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 +890 -1029
  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 +19 -32
  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 +2 -2
  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 +7 -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 +59 -53
  78. package/src/README.md +0 -3
  79. package/src/compute-layout.ts +1 -1
  80. package/src/compute.stories.tsx +82 -122
  81. package/src/graph/controller.ts +118 -75
  82. package/src/graph/node-defs.ts +34 -34
  83. package/src/hooks/useComputeGraphController.ts +2 -2
  84. package/src/hooks/useComputeNodeState.ts +7 -5
  85. package/src/hooks/useGraphMonitor.ts +11 -10
  86. package/src/json.test.ts +4 -4
  87. package/src/registry.ts +2 -2
  88. package/src/schema.test.ts +13 -13
  89. package/src/shapes/Append.tsx +3 -3
  90. package/src/shapes/Array.tsx +3 -3
  91. package/src/shapes/Audio.tsx +5 -4
  92. package/src/shapes/Beacon.tsx +4 -3
  93. package/src/shapes/Boolean.tsx +3 -3
  94. package/src/shapes/Chat.tsx +4 -3
  95. package/src/shapes/Constant.tsx +4 -3
  96. package/src/shapes/Database.tsx +2 -2
  97. package/src/shapes/Function.tsx +17 -14
  98. package/src/shapes/Gpt.tsx +13 -6
  99. package/src/shapes/GptRealtime.tsx +2 -2
  100. package/src/shapes/Json.tsx +4 -3
  101. package/src/shapes/Logic.tsx +3 -3
  102. package/src/shapes/Queue.tsx +19 -12
  103. package/src/shapes/RNG.tsx +9 -4
  104. package/src/shapes/Scope.tsx +5 -4
  105. package/src/shapes/Surface.tsx +13 -6
  106. package/src/shapes/Switch.tsx +4 -3
  107. package/src/shapes/Table.tsx +6 -6
  108. package/src/shapes/Template.tsx +6 -5
  109. package/src/shapes/Text.tsx +5 -4
  110. package/src/shapes/TextToImage.tsx +2 -2
  111. package/src/shapes/Thread.tsx +20 -14
  112. package/src/shapes/Trigger.tsx +50 -57
  113. package/src/shapes/common/Box.tsx +6 -7
  114. package/src/shapes/common/FunctionBody.tsx +5 -4
  115. package/src/shapes/common/TypeSelect.tsx +1 -1
  116. package/src/shapes/defs.ts +5 -4
  117. package/src/testing/circuits.ts +5 -14
@@ -1,94 +1,24 @@
1
1
  import "@dxos/node-std/globals";
2
2
 
3
3
  // src/graph/controller.ts
4
- import { Effect, Either, Exit, Scope } from "effect";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Either from "effect/Either";
6
+ import * as Exit from "effect/Exit";
7
+ import * as Layer from "effect/Layer";
8
+ import * as Scope from "effect/Scope";
5
9
  import { Event, synchronized } from "@dxos/async";
6
10
  import { GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
7
11
  import { Resource } from "@dxos/context";
12
+ import { unwrapExit } from "@dxos/effect";
13
+ import { ComputeEventLogger, TracingService } from "@dxos/functions";
8
14
  import { log } from "@dxos/log";
9
15
 
10
- // src/graph/node-defs.ts
11
- import { NODE_INPUT, NODE_OUTPUT, registry, getTemplateInputSchema } from "@dxos/conductor";
12
- import { raise } from "@dxos/debug";
13
- import { ObjectId, toJsonSchema } from "@dxos/echo-schema";
14
- import { invariant } from "@dxos/invariant";
15
- var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
16
- var resolveComputeNode = async (node) => {
17
- const impl = registry[node.type];
18
- invariant(impl, `Unknown node type: ${node.type}`, {
19
- F: __dxlog_file,
20
- L: 22,
21
- S: void 0,
22
- A: [
23
- "impl",
24
- "`Unknown node type: ${node.type}`"
25
- ]
26
- });
27
- return impl;
28
- };
29
- var isValidComputeNode = (type) => {
30
- return nodeFactory[type] !== void 0;
31
- };
32
- var createComputeNode = (shape) => {
33
- const type = shape.type ?? raise(new Error("Type not specified"));
34
- const factory = nodeFactory[type] ?? raise(new Error(`Unknown shape type: ${type}`));
35
- return factory(shape);
36
- };
37
- var nodeFactory = {
38
- // System.
39
- [NODE_INPUT]: () => createNode(NODE_INPUT),
40
- [NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
41
- // Extensions.
42
- ["text-to-image"]: () => createNode("text-to-image"),
43
- ["and"]: () => createNode("and"),
44
- ["append"]: () => createNode("append"),
45
- ["audio"]: () => createNode("audio"),
46
- ["beacon"]: () => createNode("beacon"),
47
- ["chat"]: () => createNode("chat"),
48
- ["constant"]: (shape) => createNode("constant", {
49
- value: shape.value
50
- }),
51
- ["make-queue"]: () => createNode("make-queue"),
52
- ["database"]: () => createNode("database"),
53
- ["gpt"]: () => createNode("gpt"),
54
- ["gpt-realtime"]: () => createNode("gpt-realtime"),
55
- ["if"]: () => createNode("if"),
56
- ["if-else"]: () => createNode("if-else"),
57
- ["function"]: () => createNode("function"),
58
- ["json"]: () => createNode("json"),
59
- ["json-transform"]: () => createNode("json-transform"),
60
- ["not"]: () => createNode("not"),
61
- ["or"]: () => createNode("or"),
62
- ["queue"]: () => createNode("queue"),
63
- ["rng"]: () => createNode("rng"),
64
- ["reducer"]: () => createNode("reducer"),
65
- ["scope"]: () => createNode("scope"),
66
- ["surface"]: () => createNode("surface"),
67
- ["switch"]: () => createNode("switch"),
68
- ["template"]: (shape) => {
69
- const node = createNode("template", {
70
- valueType: shape.valueType,
71
- value: shape.text
72
- });
73
- node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
74
- return node;
75
- },
76
- ["text"]: () => createNode("text"),
77
- ["thread"]: () => createNode("thread"),
78
- ["trigger"]: () => createNode(NODE_INPUT)
79
- };
80
- var createNode = (type, props) => ({
81
- id: ObjectId.random(),
82
- type,
83
- ...props
84
- });
85
-
86
16
  // src/hooks/compute-context.ts
87
17
  import { createContext, useContext } from "react";
88
- import { raise as raise2 } from "@dxos/debug";
18
+ import { raise } from "@dxos/debug";
89
19
  var ComputeContext = createContext(null);
90
20
  var useComputeContext = () => {
91
- return useContext(ComputeContext) ?? raise2(new Error("Missing ComputeContext"));
21
+ return useContext(ComputeContext) ?? raise(new Error("Missing ComputeContext"));
92
22
  };
93
23
 
94
24
  // src/hooks/useComputeGraphController.ts
@@ -142,15 +72,15 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
142
72
  };
143
73
 
144
74
  // src/hooks/useComputeNodeState.ts
145
- import { Schema } from "effect";
75
+ import * as Schema from "effect/Schema";
146
76
  import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
147
- import { invariant as invariant2 } from "@dxos/invariant";
148
- var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
77
+ import { invariant } from "@dxos/invariant";
78
+ var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
149
79
  var useComputeNodeState = (shape) => {
150
80
  const { controller } = useComputeContext();
151
- invariant2(controller, void 0, {
152
- F: __dxlog_file2,
153
- L: 33,
81
+ invariant(controller, void 0, {
82
+ F: __dxlog_file,
83
+ L: 34,
154
84
  S: void 0,
155
85
  A: [
156
86
  "controller",
@@ -161,9 +91,9 @@ var useComputeNodeState = (shape) => {
161
91
  useEffect2(() => {
162
92
  let disposed = false;
163
93
  queueMicrotask(async () => {
164
- invariant2(shape.node, "Node not specified", {
165
- F: __dxlog_file2,
166
- L: 39,
94
+ invariant(shape.node, "Node not specified", {
95
+ F: __dxlog_file,
96
+ L: 40,
167
97
  S: void 0,
168
98
  A: [
169
99
  "shape.node",
@@ -218,26 +148,25 @@ var useComputeNodeState = (shape) => {
218
148
  // src/hooks/useGraphMonitor.ts
219
149
  import { useMemo } from "react";
220
150
  import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
221
- import { ObjectId as ObjectId2, Ref } from "@dxos/echo-schema";
222
- import { invariant as invariant3 } from "@dxos/invariant";
223
- import { getSpace } from "@dxos/react-client/echo";
151
+ import { Obj, Ref } from "@dxos/echo";
152
+ import { invariant as invariant2 } from "@dxos/invariant";
224
153
  import { isNonNullable } from "@dxos/util";
225
- var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
154
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
226
155
  var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {
227
156
  const sourceNode = graph.findNode(source);
228
157
  const targetNode = graph.findNode(target);
229
- invariant3(sourceNode?.node, void 0, {
230
- F: __dxlog_file3,
231
- L: 26,
158
+ invariant2(sourceNode?.node, void 0, {
159
+ F: __dxlog_file2,
160
+ L: 25,
232
161
  S: void 0,
233
162
  A: [
234
163
  "sourceNode?.node",
235
164
  ""
236
165
  ]
237
166
  });
238
- invariant3(targetNode?.node, void 0, {
239
- F: __dxlog_file3,
240
- L: 27,
167
+ invariant2(targetNode?.node, void 0, {
168
+ F: __dxlog_file2,
169
+ L: 26,
241
170
  S: void 0,
242
171
  A: [
243
172
  "targetNode?.node",
@@ -245,7 +174,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
245
174
  ]
246
175
  });
247
176
  return {
248
- id: ObjectId2.random(),
177
+ id: Obj.ID.random(),
249
178
  source: sourceNode.node,
250
179
  target: targetNode.node,
251
180
  output,
@@ -259,9 +188,9 @@ var useGraphMonitor = (model) => {
259
188
  if (!model) {
260
189
  return;
261
190
  }
262
- invariant3(node.type, void 0, {
263
- F: __dxlog_file3,
264
- L: 52,
191
+ invariant2(node.type, void 0, {
192
+ F: __dxlog_file2,
193
+ L: 51,
265
194
  S: void 0,
266
195
  A: [
267
196
  "node.type",
@@ -317,31 +246,109 @@ var createComputeGraph = (graph) => {
317
246
  };
318
247
  var linkTriggerToCompute = (graph, computeNode, triggerData) => {
319
248
  const functionTrigger = triggerData.functionTrigger?.target;
320
- invariant3(functionTrigger, void 0, {
321
- F: __dxlog_file3,
322
- L: 115,
249
+ invariant2(functionTrigger, void 0, {
250
+ F: __dxlog_file2,
251
+ L: 114,
323
252
  S: void 0,
324
253
  A: [
325
254
  "functionTrigger",
326
255
  ""
327
256
  ]
328
257
  });
329
- functionTrigger.function = Ref.make(graph.root);
330
- functionTrigger.inputNodeId = computeNode.id;
258
+ Obj.change(functionTrigger, (t) => {
259
+ t.function = Ref.make(graph.root);
260
+ t.inputNodeId = computeNode.id;
261
+ });
331
262
  };
332
263
  var deleteTriggerObjects = (computeGraph, deleted) => {
333
- const space = getSpace(computeGraph.root);
334
- if (!space) {
264
+ const db = Obj.getDatabase(computeGraph.root);
265
+ if (!db) {
335
266
  return;
336
267
  }
337
268
  for (const node of deleted.nodes) {
338
269
  if (node.type === "trigger") {
339
270
  const trigger = node;
340
- space.db.remove(trigger.functionTrigger.target);
271
+ db.remove(trigger.functionTrigger.target);
341
272
  }
342
273
  }
343
274
  };
344
275
 
276
+ // src/graph/node-defs.ts
277
+ import { NODE_INPUT, NODE_OUTPUT, getTemplateInputSchema, registry } from "@dxos/conductor";
278
+ import { raise as raise2 } from "@dxos/debug";
279
+ import { JsonSchema, Obj as Obj2 } from "@dxos/echo";
280
+ import { invariant as invariant3 } from "@dxos/invariant";
281
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
282
+ var resolveComputeNode = async (node) => {
283
+ const impl = registry[node.type];
284
+ invariant3(impl, `Unknown node type: ${node.type}`, {
285
+ F: __dxlog_file3,
286
+ L: 22,
287
+ S: void 0,
288
+ A: [
289
+ "impl",
290
+ "`Unknown node type: ${node.type}`"
291
+ ]
292
+ });
293
+ return impl;
294
+ };
295
+ var isValidComputeNode = (type) => {
296
+ return nodeFactory[type] !== void 0;
297
+ };
298
+ var createComputeNode = (shape) => {
299
+ const type = shape.type ?? raise2(new Error("Type not specified"));
300
+ const factory = nodeFactory[type] ?? raise2(new Error(`Unknown shape type: ${type}`));
301
+ return factory(shape);
302
+ };
303
+ var nodeFactory = {
304
+ // System.
305
+ [NODE_INPUT]: () => createNode(NODE_INPUT),
306
+ [NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
307
+ // Extensions.
308
+ "text-to-image": () => createNode("text-to-image"),
309
+ and: () => createNode("and"),
310
+ append: () => createNode("append"),
311
+ audio: () => createNode("audio"),
312
+ beacon: () => createNode("beacon"),
313
+ chat: () => createNode("chat"),
314
+ constant: (shape) => createNode("constant", {
315
+ value: shape.value
316
+ }),
317
+ "make-queue": () => createNode("make-queue"),
318
+ database: () => createNode("database"),
319
+ gpt: () => createNode("gpt"),
320
+ "gpt-realtime": () => createNode("gpt-realtime"),
321
+ if: () => createNode("if"),
322
+ "if-else": () => createNode("if-else"),
323
+ function: () => createNode("function"),
324
+ json: () => createNode("json"),
325
+ "json-transform": () => createNode("json-transform"),
326
+ not: () => createNode("not"),
327
+ or: () => createNode("or"),
328
+ queue: () => createNode("queue"),
329
+ rng: () => createNode("rng"),
330
+ reducer: () => createNode("reducer"),
331
+ scope: () => createNode("scope"),
332
+ surface: () => createNode("surface"),
333
+ switch: () => createNode("switch"),
334
+ template: (shape) => {
335
+ const node = createNode("template", {
336
+ valueType: shape.valueType,
337
+ value: shape.text
338
+ });
339
+ node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
340
+ return node;
341
+ },
342
+ text: () => createNode("text"),
343
+ thread: () => createNode("thread"),
344
+ trigger: () => createNode(NODE_INPUT)
345
+ };
346
+ var createNode = (type, props) => ({
347
+ id: Obj2.ID.random(),
348
+ type,
349
+ ...props
350
+ });
351
+
345
352
  // src/graph/controller.ts
346
353
  function _ts_decorate(decorators, target, key, desc) {
347
354
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -356,19 +363,37 @@ var AUTO_TRIGGER_NODES = [
356
363
  "switch",
357
364
  "constant"
358
365
  ];
359
- var createComputeGraphController = (graph, serviceContainer) => {
366
+ var createComputeGraphController = (graph, computeRuntime) => {
360
367
  const computeGraph = createComputeGraph(graph);
361
- const controller = new ComputeGraphController(serviceContainer, computeGraph);
368
+ const controller = new ComputeGraphController(computeRuntime, computeGraph);
362
369
  return {
363
370
  controller,
364
371
  graph
365
372
  };
366
373
  };
367
374
  var ComputeGraphController = class extends Resource {
368
- constructor(_serviceContainer, _graph) {
369
- super(), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
370
- computeNodeResolver: (node) => resolveComputeNode(node)
371
- }), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
375
+ _computeRuntime;
376
+ _graph;
377
+ _executor = new GraphExecutor({
378
+ computeNodeResolver: (node) => resolveComputeNode(node)
379
+ });
380
+ _diagnostics = [];
381
+ /**
382
+ * Canvas force-sets outputs of those nodes.
383
+ */
384
+ _forcedOutputs = {};
385
+ /**
386
+ * Runtime state of the execution graph.
387
+ */
388
+ _runtimeStateInputs = {};
389
+ _runtimeStateOutputs = {};
390
+ // TODO(burdon): Remove? Make state reactive?
391
+ update = new Event();
392
+ /** Computed result. */
393
+ output = new Event();
394
+ events = new Event();
395
+ constructor(_computeRuntime, _graph) {
396
+ super(), this._computeRuntime = _computeRuntime, this._graph = _graph;
372
397
  }
373
398
  toJSON() {
374
399
  return {
@@ -438,7 +463,7 @@ var ComputeGraphController = class extends Resource {
438
463
  } catch (err) {
439
464
  log.catch(err, void 0, {
440
465
  F: __dxlog_file4,
441
- L: 198,
466
+ L: 230,
442
467
  S: this,
443
468
  C: (f, a) => f(...a)
444
469
  });
@@ -460,12 +485,11 @@ var ComputeGraphController = class extends Resource {
460
485
  for (const [nodeId2, outputs] of Object.entries(this._forcedOutputs)) {
461
486
  executor.setOutputs(nodeId2, Effect.succeed(ValueBag.make(outputs)));
462
487
  }
463
- const serviceLayer = this._serviceContainer.createLayer();
464
- await Effect.runPromise(Effect.gen(this, function* () {
488
+ unwrapExit(await this._computeRuntime.runPromiseExit(Effect.gen(this, function* () {
465
489
  const scope = yield* Scope.make();
466
490
  const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(nodeId)));
467
491
  const computingOutputs = executable.exec != null;
468
- const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.flatMap(computeValueBag), Effect.provide(serviceLayer), Effect.withSpan("test"), Effect.tap((values) => {
492
+ const effect = (computingOutputs ? executor.computeOutputs(nodeId) : executor.computeInputs(nodeId)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.provide(ComputeEventLogger.layerFromTracing.pipe(Layer.provideMerge(TracingService.layerNoop))), Effect.flatMap(computeValueBag), Effect.withSpan("test"), Effect.tap((values) => {
469
493
  for (const [key, value] of Object.entries(values)) {
470
494
  if (computingOutputs) {
471
495
  this._onOutputComputed(nodeId, key, value);
@@ -476,7 +500,7 @@ var ComputeGraphController = class extends Resource {
476
500
  }));
477
501
  yield* effect;
478
502
  yield* Scope.close(scope, Exit.void);
479
- }));
503
+ })));
480
504
  this.update.emit();
481
505
  }
482
506
  /**
@@ -497,13 +521,13 @@ var ComputeGraphController = class extends Resource {
497
521
  const allAffectedNodes = [
498
522
  ...new Set(triggerNodes.flatMap((node) => executor.getAllDependantNodes(node.id)))
499
523
  ];
500
- await Effect.runPromise(Effect.gen(this, function* () {
524
+ unwrapExit(await this._computeRuntime.runPromiseExit(Effect.gen(this, function* () {
501
525
  const scope = yield* Scope.make();
502
526
  const tasks = [];
503
527
  for (const node of allAffectedNodes) {
504
528
  const executable = yield* Effect.promise(() => resolveComputeNode(this._graph.getNode(node)));
505
529
  const computingOutputs = executable.exec != null;
506
- const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.flatMap(computeValueBag), Effect.provide(this._serviceContainer.createLayer()), Effect.withSpan("test"), Effect.tap((values) => {
530
+ const effect = (computingOutputs ? executor.computeOutputs(node) : executor.computeInputs(node)).pipe(Effect.withSpan("runGraph"), Scope.extend(scope), Effect.flatMap(computeValueBag), Effect.provide(ComputeEventLogger.layerFromTracing.pipe(Layer.provideMerge(TracingService.layerNoop))), Effect.withSpan("test"), Effect.tap((values) => {
507
531
  for (const [key, value] of Object.entries(values)) {
508
532
  if (computingOutputs) {
509
533
  this._onOutputComputed(node, key, value);
@@ -516,7 +540,7 @@ var ComputeGraphController = class extends Resource {
516
540
  }
517
541
  yield* Effect.all(tasks);
518
542
  yield* Scope.close(scope, Exit.void);
519
- }));
543
+ })));
520
544
  this.update.emit();
521
545
  }
522
546
  _createLogger() {
@@ -532,7 +556,7 @@ var ComputeGraphController = class extends Resource {
532
556
  event
533
557
  }, {
534
558
  F: __dxlog_file4,
535
- L: 334,
559
+ L: 377,
536
560
  S: this,
537
561
  C: (f, a) => f(...a)
538
562
  });
@@ -609,88 +633,82 @@ var computeValueBag = (bag) => {
609
633
  import { noteShape } from "@dxos/react-ui-canvas-editor";
610
634
 
611
635
  // src/shapes/common/Box.tsx
612
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
613
636
  import React, { forwardRef } from "react";
614
637
  import { invariant as invariant4 } from "@dxos/invariant";
615
638
  import { Icon, IconButton } from "@dxos/react-ui";
616
639
  import { useEditorContext, useShapeDef } from "@dxos/react-ui-canvas-editor";
617
- import { mx } from "@dxos/react-ui-theme";
640
+ import { mx } from "@dxos/ui-theme";
618
641
  var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/common/Box.tsx";
619
642
  var headerHeight = 32;
620
643
  var footerHeight = 32;
621
644
  var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
622
- var _effect = _useSignals();
623
- try {
624
- invariant4(shape.type, void 0, {
625
- F: __dxlog_file5,
626
- L: 30,
627
- S: void 0,
628
- A: [
629
- "shape.type",
630
- ""
631
- ]
632
- });
633
- const { icon, name, openable } = useShapeDef(shape.type) ?? {
634
- icon: "ph--placeholder--regular"
635
- };
636
- const { debug } = useEditorContext();
637
- return /* @__PURE__ */ React.createElement("div", {
638
- ref: forwardedRef,
639
- className: "flex flex-col h-full w-full justify-between"
640
- }, /* @__PURE__ */ React.createElement("div", {
641
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
642
- }, /* @__PURE__ */ React.createElement(Icon, {
643
- icon,
644
- classNames: "mx-2"
645
- }), /* @__PURE__ */ React.createElement("div", {
646
- className: "grow text-sm truncate"
647
- }, debug ? shape.type : name ?? shape.text ?? title), /* @__PURE__ */ React.createElement(IconButton, {
648
- classNames: "p-1 text-green-500",
649
- variant: "ghost",
650
- icon: "ph--play--regular",
651
- size: 4,
652
- label: "run",
653
- iconOnly: true,
654
- onDoubleClick: (ev) => ev.stopPropagation(),
655
- onClick: (ev) => {
656
- ev.stopPropagation();
657
- onAction?.("run");
658
- }
659
- })), /* @__PURE__ */ React.createElement("div", {
660
- className: mx("flex flex-col h-full grow overflow-hidden", classNames)
661
- }, children), /* @__PURE__ */ React.createElement("div", {
662
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
663
- }, /* @__PURE__ */ React.createElement("div", {
664
- className: "grow px-2 text-sm truncate"
665
- }, debug ? shape.id : status), openable && /* @__PURE__ */ React.createElement(IconButton, {
666
- classNames: "p-1",
667
- variant: "ghost",
668
- icon: open ? "ph--caret-up--regular" : "ph--caret-down--regular",
669
- size: 4,
670
- label: open ? "close" : "open",
671
- iconOnly: true,
672
- onClick: (ev) => {
673
- ev.stopPropagation();
674
- onAction?.(open ? "close" : "open");
675
- }
676
- })));
677
- } finally {
678
- _effect.f();
679
- }
645
+ invariant4(shape.type, void 0, {
646
+ F: __dxlog_file5,
647
+ L: 29,
648
+ S: void 0,
649
+ A: [
650
+ "shape.type",
651
+ ""
652
+ ]
653
+ });
654
+ const { icon, name, openable } = useShapeDef(shape.type) ?? {
655
+ icon: "ph--placeholder--regular"
656
+ };
657
+ const { debug } = useEditorContext();
658
+ return /* @__PURE__ */ React.createElement("div", {
659
+ ref: forwardedRef,
660
+ className: "flex flex-col h-full w-full justify-between"
661
+ }, /* @__PURE__ */ React.createElement("div", {
662
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface"
663
+ }, /* @__PURE__ */ React.createElement(Icon, {
664
+ icon,
665
+ classNames: "mx-2"
666
+ }), /* @__PURE__ */ React.createElement("div", {
667
+ className: "grow text-sm truncate"
668
+ }, debug ? shape.type : name ?? shape.text ?? title), /* @__PURE__ */ React.createElement(IconButton, {
669
+ classNames: "p-1 text-green-500",
670
+ variant: "ghost",
671
+ icon: "ph--play--regular",
672
+ size: 4,
673
+ label: "run",
674
+ iconOnly: true,
675
+ onDoubleClick: (ev) => ev.stopPropagation(),
676
+ onClick: (ev) => {
677
+ ev.stopPropagation();
678
+ onAction?.("run");
679
+ }
680
+ })), /* @__PURE__ */ React.createElement("div", {
681
+ className: mx("flex flex-col h-full grow overflow-hidden", classNames)
682
+ }, children), /* @__PURE__ */ React.createElement("div", {
683
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-input-surface"
684
+ }, /* @__PURE__ */ React.createElement("div", {
685
+ className: "grow px-2 text-sm truncate"
686
+ }, debug ? shape.id : status), openable && /* @__PURE__ */ React.createElement(IconButton, {
687
+ classNames: "p-1",
688
+ variant: "ghost",
689
+ icon: open ? "ph--caret-up--regular" : "ph--caret-down--regular",
690
+ size: 4,
691
+ label: open ? "close" : "open",
692
+ iconOnly: true,
693
+ onClick: (ev) => {
694
+ ev.stopPropagation();
695
+ onAction?.(open ? "close" : "open");
696
+ }
697
+ })));
680
698
  });
681
699
 
682
700
  // src/shapes/common/FunctionBody.tsx
683
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
684
- import { SchemaAST as SchemaAST2 } from "effect";
701
+ import * as SchemaAST2 from "effect/SchemaAST";
685
702
  import React2, { useRef, useState as useState3 } from "react";
686
703
  import { VoidInput, VoidOutput } from "@dxos/conductor";
687
704
  import { useCanvasContext } from "@dxos/react-ui-canvas";
688
- import { getParentShapeElement, createAnchors, rowHeight } from "@dxos/react-ui-canvas-editor";
705
+ import { createAnchors, getParentShapeElement, rowHeight } from "@dxos/react-ui-canvas-editor";
689
706
 
690
707
  // src/shapes/defs.ts
691
- import { Schema as Schema2, SchemaAST } from "effect";
708
+ import * as Schema2 from "effect/Schema";
709
+ import * as SchemaAST from "effect/SchemaAST";
692
710
  import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
693
- import { ObjectId as ObjectId3 } from "@dxos/echo-schema";
711
+ import { Obj as Obj3 } from "@dxos/echo";
694
712
  import { Polygon } from "@dxos/react-ui-canvas-editor";
695
713
  var getProperties = (ast) => SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
696
714
  name: name.toString()
@@ -708,13 +726,13 @@ var parseAnchorId = (id) => {
708
726
  };
709
727
  var ComputeShape = Schema2.extend(Polygon, Schema2.Struct({
710
728
  // TODO(burdon): Rename computeNode?
711
- node: Schema2.optional(ObjectId3.annotations({
729
+ node: Schema2.optional(Obj3.ID.annotations({
712
730
  description: "Compute node id"
713
731
  }))
714
732
  }).pipe(Schema2.mutable));
715
733
  var createShape = ({ id, ...rest }) => {
716
734
  return {
717
- id: id ?? ObjectId3.random(),
735
+ id: id ?? Obj3.ID.random(),
718
736
  ...rest
719
737
  };
720
738
  };
@@ -723,70 +741,65 @@ var createShape = ({ id, ...rest }) => {
723
741
  var bodyPadding = 8;
724
742
  var expandedHeight = 200;
725
743
  var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchema = VoidOutput, ...props }) => {
726
- var _effect = _useSignals2();
727
- try {
728
- const { scale } = useCanvasContext();
729
- const rootRef = useRef(null);
730
- const [open, setOpen] = useState3(false);
731
- const handleAction = (action) => {
732
- if (!rootRef.current) {
733
- return;
734
- }
735
- switch (action) {
736
- case "open": {
737
- const el = getParentShapeElement(rootRef.current, shape.id);
738
- const { height } = el.getBoundingClientRect();
739
- el.style.height = `${height / scale + expandedHeight}px`;
740
- setOpen(true);
741
- break;
742
- }
743
- case "close": {
744
- const el = getParentShapeElement(rootRef.current, shape.id);
745
- el.style.height = "";
746
- setOpen(false);
747
- break;
748
- }
749
- }
750
- };
751
- const inputs = getProperties(inputSchema.ast);
752
- const outputs = getProperties(outputSchema.ast);
753
- const columnCount = inputs.length && outputs.length ? 2 : 1;
754
- return /* @__PURE__ */ React2.createElement(Box, {
755
- ref: rootRef,
756
- shape,
757
- title: name,
758
- classNames: "divide-y divide-separator",
759
- open,
760
- onAction: handleAction,
761
- ...props
762
- }, /* @__PURE__ */ React2.createElement("div", {
763
- className: `grid grid-cols-${columnCount} items-center`,
764
- style: {
765
- paddingTop: bodyPadding,
766
- paddingBottom: bodyPadding
767
- }
768
- }, (inputs?.length ?? 0) > 0 && /* @__PURE__ */ React2.createElement("div", {
769
- className: "flex flex-col"
770
- }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
771
- key: name2,
772
- className: "px-2 truncate text-sm font-mono items-center",
773
- style: {
774
- height: rowHeight
744
+ const { scale } = useCanvasContext();
745
+ const rootRef = useRef(null);
746
+ const [open, setOpen] = useState3(false);
747
+ const handleAction = (action) => {
748
+ if (!rootRef.current) {
749
+ return;
750
+ }
751
+ switch (action) {
752
+ case "open": {
753
+ const el = getParentShapeElement(rootRef.current, shape.id);
754
+ const { height } = el.getBoundingClientRect();
755
+ el.style.height = `${height / scale + expandedHeight}px`;
756
+ setOpen(true);
757
+ break;
775
758
  }
776
- }, name2))), (outputs?.length ?? 0) > 0 && /* @__PURE__ */ React2.createElement("div", {
777
- className: "flex flex-col"
778
- }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
779
- key: name2,
780
- className: "px-2 truncate text-sm font-mono items-center text-right",
781
- style: {
782
- height: rowHeight
759
+ case "close": {
760
+ const el = getParentShapeElement(rootRef.current, shape.id);
761
+ el.style.height = "";
762
+ setOpen(false);
763
+ break;
783
764
  }
784
- }, name2)))), open && /* @__PURE__ */ React2.createElement("div", {
785
- className: "flex flex-col grow overflow-hidden"
786
- }, content));
787
- } finally {
788
- _effect.f();
789
- }
765
+ }
766
+ };
767
+ const inputs = getProperties(inputSchema.ast);
768
+ const outputs = getProperties(outputSchema.ast);
769
+ const columnCount = inputs.length && outputs.length ? 2 : 1;
770
+ return /* @__PURE__ */ React2.createElement(Box, {
771
+ ref: rootRef,
772
+ shape,
773
+ title: name,
774
+ classNames: "divide-y divide-separator",
775
+ open,
776
+ onAction: handleAction,
777
+ ...props
778
+ }, /* @__PURE__ */ React2.createElement("div", {
779
+ className: `grid grid-cols-${columnCount} items-center`,
780
+ style: {
781
+ paddingTop: bodyPadding,
782
+ paddingBottom: bodyPadding
783
+ }
784
+ }, (inputs?.length ?? 0) > 0 && /* @__PURE__ */ React2.createElement("div", {
785
+ className: "flex flex-col"
786
+ }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
787
+ key: name2,
788
+ className: "px-2 truncate text-sm font-mono items-center",
789
+ style: {
790
+ height: rowHeight
791
+ }
792
+ }, name2))), (outputs?.length ?? 0) > 0 && /* @__PURE__ */ React2.createElement("div", {
793
+ className: "flex flex-col"
794
+ }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
795
+ key: name2,
796
+ className: "px-2 truncate text-sm font-mono items-center text-right",
797
+ style: {
798
+ height: rowHeight
799
+ }
800
+ }, name2)))), open && /* @__PURE__ */ React2.createElement("div", {
801
+ className: "flex flex-col grow overflow-hidden"
802
+ }, content));
790
803
  };
791
804
  var getHeight = (input) => {
792
805
  const properties = SchemaAST2.getPropertySignatures(input.ast);
@@ -807,47 +820,35 @@ var createFunctionAnchors = (shape, input = VoidInput, output = VoidOutput) => {
807
820
  };
808
821
 
809
822
  // src/shapes/common/TypeSelect.tsx
810
- import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
811
823
  import React3 from "react";
812
824
  import { ComputeValueType } from "@dxos/conductor";
813
825
  import { Select } from "@dxos/react-ui";
814
826
  var TypeSelect = ({ value, onValueChange }) => {
815
- var _effect = _useSignals3();
816
- try {
817
- return /* @__PURE__ */ React3.createElement(Select.Root, {
818
- value,
819
- onValueChange
820
- }, /* @__PURE__ */ React3.createElement(Select.TriggerButton, {
821
- variant: "ghost",
822
- classNames: "w-full !px-0"
823
- }), /* @__PURE__ */ React3.createElement(Select.Portal, null, /* @__PURE__ */ React3.createElement(Select.Content, null, /* @__PURE__ */ React3.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select.Viewport, null, ComputeValueType.literals.map((type) => /* @__PURE__ */ React3.createElement(Select.Option, {
824
- key: type,
825
- value: type
826
- }, type))), /* @__PURE__ */ React3.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React3.createElement(Select.Arrow, null))));
827
- } finally {
828
- _effect.f();
829
- }
827
+ return /* @__PURE__ */ React3.createElement(Select.Root, {
828
+ value,
829
+ onValueChange
830
+ }, /* @__PURE__ */ React3.createElement(Select.TriggerButton, {
831
+ variant: "ghost",
832
+ classNames: "w-full px-0!"
833
+ }), /* @__PURE__ */ React3.createElement(Select.Portal, null, /* @__PURE__ */ React3.createElement(Select.Content, null, /* @__PURE__ */ React3.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select.Viewport, null, ComputeValueType.literals.map((type) => /* @__PURE__ */ React3.createElement(Select.Option, {
834
+ key: type,
835
+ value: type
836
+ }, type))), /* @__PURE__ */ React3.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React3.createElement(Select.Arrow, null))));
830
837
  };
831
838
 
832
839
  // src/shapes/Array.tsx
833
- import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
834
- import { Schema as Schema3 } from "effect";
840
+ import * as Schema3 from "effect/Schema";
835
841
  import React4 from "react";
836
842
  import { ReducerInput, ReducerOutput } from "@dxos/conductor";
837
843
  var ReducerShape = Schema3.extend(ComputeShape, Schema3.Struct({
838
844
  type: Schema3.Literal("reducer")
839
845
  }));
840
846
  var ReducerComponent = ({ shape }) => {
841
- var _effect = _useSignals4();
842
- try {
843
- return /* @__PURE__ */ React4.createElement(FunctionBody, {
844
- shape,
845
- inputSchema: ReducerInput,
846
- outputSchema: ReducerOutput
847
- });
848
- } finally {
849
- _effect.f();
850
- }
847
+ return /* @__PURE__ */ React4.createElement(FunctionBody, {
848
+ shape,
849
+ inputSchema: ReducerInput,
850
+ outputSchema: ReducerOutput
851
+ });
851
852
  };
852
853
  var createReducer = ({ id, size = {
853
854
  width: 192,
@@ -867,8 +868,7 @@ var reducerShape = {
867
868
  };
868
869
 
869
870
  // src/shapes/Append.tsx
870
- import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
871
- import { Schema as Schema4 } from "effect";
871
+ import * as Schema4 from "effect/Schema";
872
872
  import React5 from "react";
873
873
  import { AppendInput } from "@dxos/conductor";
874
874
  var AppendShape = Schema4.extend(ComputeShape, Schema4.Struct({
@@ -883,15 +883,10 @@ var createAppend = (props) => createShape({
883
883
  ...props
884
884
  });
885
885
  var AppendComponent = ({ shape }) => {
886
- var _effect = _useSignals5();
887
- try {
888
- return /* @__PURE__ */ React5.createElement(FunctionBody, {
889
- shape,
890
- inputSchema: AppendInput
891
- });
892
- } finally {
893
- _effect.f();
894
- }
886
+ return /* @__PURE__ */ React5.createElement(FunctionBody, {
887
+ shape,
888
+ inputSchema: AppendInput
889
+ });
895
890
  };
896
891
  var appendShape = {
897
892
  type: "append",
@@ -903,8 +898,7 @@ var appendShape = {
903
898
  };
904
899
 
905
900
  // src/shapes/Audio.tsx
906
- import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
907
- import { Schema as Schema5 } from "effect";
901
+ import * as Schema5 from "effect/Schema";
908
902
  import React6, { useEffect as useEffect3, useState as useState4 } from "react";
909
903
  import { Icon as Icon2 } from "@dxos/react-ui";
910
904
  import { createAnchorMap } from "@dxos/react-ui-canvas-editor";
@@ -920,29 +914,24 @@ var createAudio = (props) => createShape({
920
914
  ...props
921
915
  });
922
916
  var AudioComponent = ({ shape }) => {
923
- var _effect = _useSignals6();
924
- try {
925
- const { node } = useComputeNodeState(shape);
926
- const [active, setActive] = useState4(false);
927
- useEffect3(() => {
928
- node.value = active;
929
- }, [
930
- active
931
- ]);
932
- return /* @__PURE__ */ React6.createElement("div", {
933
- className: "flex w-full justify-center items-center"
934
- }, /* @__PURE__ */ React6.createElement(Icon2, {
935
- icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
936
- classNames: [
937
- "transition opacity-20 duration-1000",
938
- active && "opacity-100 text-red-500"
939
- ],
940
- size: 8,
941
- onClick: () => setActive(!active)
942
- }));
943
- } finally {
944
- _effect.f();
945
- }
917
+ const { node } = useComputeNodeState(shape);
918
+ const [active, setActive] = useState4(false);
919
+ useEffect3(() => {
920
+ node.value = active;
921
+ }, [
922
+ active
923
+ ]);
924
+ return /* @__PURE__ */ React6.createElement("div", {
925
+ className: "flex w-full justify-center items-center"
926
+ }, /* @__PURE__ */ React6.createElement(Icon2, {
927
+ icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
928
+ classNames: [
929
+ "transition opacity-20 duration-1000",
930
+ active && "opacity-100 text-error-text"
931
+ ],
932
+ size: 8,
933
+ onClick: () => setActive(!active)
934
+ }));
946
935
  };
947
936
  var audioShape = {
948
937
  type: "audio",
@@ -959,8 +948,7 @@ var audioShape = {
959
948
  };
960
949
 
961
950
  // src/shapes/Beacon.tsx
962
- import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
963
- import { Schema as Schema6 } from "effect";
951
+ import * as Schema6 from "effect/Schema";
964
952
  import React7 from "react";
965
953
  import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
966
954
  import { Icon as Icon3 } from "@dxos/react-ui";
@@ -977,24 +965,19 @@ var createBeacon = (props) => createShape({
977
965
  ...props
978
966
  });
979
967
  var BeaconComponent = ({ shape }) => {
980
- var _effect = _useSignals7();
981
- try {
982
- const { runtime } = useComputeNodeState(shape);
983
- const input = runtime.inputs[DEFAULT_INPUT3];
984
- const value = input?.type === "executed" ? input.value : false;
985
- return /* @__PURE__ */ React7.createElement("div", {
986
- className: "flex w-full justify-center items-center"
987
- }, /* @__PURE__ */ React7.createElement(Icon3, {
988
- icon: "ph--sun--regular",
989
- classNames: [
990
- "transition opacity-20 duration-1000",
991
- isTruthy(value) && "opacity-100 text-yellow-500"
992
- ],
993
- size: 8
994
- }));
995
- } finally {
996
- _effect.f();
997
- }
968
+ const { runtime } = useComputeNodeState(shape);
969
+ const input = runtime.inputs[DEFAULT_INPUT3];
970
+ const value = input?.type === "executed" ? input.value : false;
971
+ return /* @__PURE__ */ React7.createElement("div", {
972
+ className: "flex w-full justify-center items-center"
973
+ }, /* @__PURE__ */ React7.createElement(Icon3, {
974
+ icon: "ph--sun--regular",
975
+ classNames: [
976
+ "transition opacity-20 duration-1000",
977
+ isTruthy(value) && "opacity-100 text-yellow-500"
978
+ ],
979
+ size: 8
980
+ }));
998
981
  };
999
982
  var beaconShape = {
1000
983
  type: "beacon",
@@ -1011,7 +994,7 @@ var beaconShape = {
1011
994
  };
1012
995
 
1013
996
  // src/shapes/Boolean.tsx
1014
- import { Schema as Schema7 } from "effect";
997
+ import * as Schema7 from "effect/Schema";
1015
998
  import React8 from "react";
1016
999
  import { getAnchorPoints } from "@dxos/react-ui-canvas-editor";
1017
1000
  import { createAnchors as createAnchors2 } from "@dxos/react-ui-canvas-editor";
@@ -1184,8 +1167,7 @@ var notShape = defineShape({
1184
1167
  });
1185
1168
 
1186
1169
  // src/shapes/Chat.tsx
1187
- import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
1188
- import { Schema as Schema8 } from "effect";
1170
+ import * as Schema8 from "effect/Schema";
1189
1171
  import React9, { useRef as useRef2 } from "react";
1190
1172
  import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
1191
1173
  import { TextBox } from "@dxos/react-ui-canvas-editor";
@@ -1194,28 +1176,23 @@ var ChatShape = Schema8.extend(ComputeShape, Schema8.Struct({
1194
1176
  type: Schema8.Literal("chat")
1195
1177
  }));
1196
1178
  var TextInputComponent = ({ shape, title, ...props }) => {
1197
- var _effect = _useSignals8();
1198
- try {
1199
- const { runtime } = useComputeNodeState(shape);
1200
- const inputRef = useRef2(null);
1201
- const handleEnter = (text) => {
1202
- const value = text.trim();
1203
- if (value.length) {
1204
- runtime.setOutput(DEFAULT_OUTPUT3, value);
1205
- inputRef.current?.setText("");
1206
- }
1207
- };
1208
- return /* @__PURE__ */ React9.createElement(Box, {
1209
- shape,
1210
- title
1211
- }, /* @__PURE__ */ React9.createElement(TextBox, {
1212
- ref: inputRef,
1213
- onEnter: handleEnter,
1214
- ...props
1215
- }));
1216
- } finally {
1217
- _effect.f();
1218
- }
1179
+ const { runtime } = useComputeNodeState(shape);
1180
+ const inputRef = useRef2(null);
1181
+ const handleEnter = (text) => {
1182
+ const value = text.trim();
1183
+ if (value.length) {
1184
+ runtime.setOutput(DEFAULT_OUTPUT3, value);
1185
+ inputRef.current?.setText("");
1186
+ }
1187
+ };
1188
+ return /* @__PURE__ */ React9.createElement(Box, {
1189
+ shape,
1190
+ title
1191
+ }, /* @__PURE__ */ React9.createElement(TextBox, {
1192
+ ref: inputRef,
1193
+ onEnter: handleEnter,
1194
+ ...props
1195
+ }));
1219
1196
  };
1220
1197
  var createChat = (props) => createShape({
1221
1198
  type: "chat",
@@ -1245,8 +1222,7 @@ var chatShape = {
1245
1222
  };
1246
1223
 
1247
1224
  // src/shapes/Constant.tsx
1248
- import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
1249
- import { Schema as Schema9 } from "effect";
1225
+ import * as Schema9 from "effect/Schema";
1250
1226
  import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
1251
1227
  import { ComputeValueType as ComputeValueType2 } from "@dxos/conductor";
1252
1228
  import { Input } from "@dxos/react-ui";
@@ -1269,57 +1245,52 @@ var inferType = (value) => {
1269
1245
  }
1270
1246
  };
1271
1247
  var ConstantComponent = ({ shape, title, chat, ...props }) => {
1272
- var _effect = _useSignals9();
1273
- try {
1274
- const { node } = useComputeNodeState(shape);
1275
- const [type, setType] = useState5(inferType(node.value) ?? ComputeValueType2.literals[0]);
1276
- const inputRef = useRef3(null);
1277
- const handleEnter = useCallback2((text) => {
1278
- const value = text.trim();
1279
- if (value.length) {
1280
- if (type === "number") {
1281
- const floatValue = parseFloat(value);
1282
- if (!isNaN(floatValue)) {
1283
- node.value = floatValue;
1284
- }
1285
- } else if (type === "object") {
1286
- node.value = safeParseJson(value, {});
1287
- } else {
1288
- node.value = value;
1248
+ const { node } = useComputeNodeState(shape);
1249
+ const [type, setType] = useState5(inferType(node.value) ?? ComputeValueType2.literals[0]);
1250
+ const inputRef = useRef3(null);
1251
+ const handleEnter = useCallback2((text) => {
1252
+ const value = text.trim();
1253
+ if (value.length) {
1254
+ if (type === "number") {
1255
+ const floatValue = parseFloat(value);
1256
+ if (!isNaN(floatValue)) {
1257
+ node.value = floatValue;
1289
1258
  }
1290
- inputRef.current?.focus();
1291
- }
1292
- }, [
1293
- type
1294
- ]);
1295
- return /* @__PURE__ */ React10.createElement(Box, {
1296
- shape,
1297
- title,
1298
- status: /* @__PURE__ */ React10.createElement(TypeSelect, {
1299
- value: type,
1300
- onValueChange: setType
1301
- })
1302
- }, (type === "string" || type === "number") && /* @__PURE__ */ React10.createElement(TextBox2, {
1303
- ...props,
1304
- ref: inputRef,
1305
- value: node.value,
1306
- onEnter: handleEnter
1307
- }), type === "object" && /* @__PURE__ */ React10.createElement(TextBox2, {
1308
- ...props,
1309
- ref: inputRef,
1310
- value: JSON.stringify(node.value, null, 2),
1311
- language: "json"
1312
- }), type === "boolean" && /* @__PURE__ */ React10.createElement("div", {
1313
- className: "flex grow justify-center items-center"
1314
- }, /* @__PURE__ */ React10.createElement(Input.Root, null, /* @__PURE__ */ React10.createElement(Input.Switch, {
1315
- checked: node.value,
1316
- onCheckedChange: (value) => {
1259
+ } else if (type === "object") {
1260
+ node.value = safeParseJson(value, {});
1261
+ } else {
1317
1262
  node.value = value;
1318
1263
  }
1319
- }))));
1320
- } finally {
1321
- _effect.f();
1322
- }
1264
+ inputRef.current?.focus();
1265
+ }
1266
+ }, [
1267
+ type
1268
+ ]);
1269
+ return /* @__PURE__ */ React10.createElement(Box, {
1270
+ shape,
1271
+ title,
1272
+ status: /* @__PURE__ */ React10.createElement(TypeSelect, {
1273
+ value: type,
1274
+ onValueChange: setType
1275
+ })
1276
+ }, (type === "string" || type === "number") && /* @__PURE__ */ React10.createElement(TextBox2, {
1277
+ ...props,
1278
+ ref: inputRef,
1279
+ value: node.value,
1280
+ onEnter: handleEnter
1281
+ }), type === "object" && /* @__PURE__ */ React10.createElement(TextBox2, {
1282
+ ...props,
1283
+ ref: inputRef,
1284
+ value: JSON.stringify(node.value, null, 2),
1285
+ language: "json"
1286
+ }), type === "boolean" && /* @__PURE__ */ React10.createElement("div", {
1287
+ className: "flex grow justify-center items-center"
1288
+ }, /* @__PURE__ */ React10.createElement(Input.Root, null, /* @__PURE__ */ React10.createElement(Input.Switch, {
1289
+ checked: node.value,
1290
+ onCheckedChange: (value) => {
1291
+ node.value = value;
1292
+ }
1293
+ }))));
1323
1294
  };
1324
1295
  var createConstant = (props) => createShape({
1325
1296
  type: "constant",
@@ -1348,8 +1319,7 @@ var constantShape = {
1348
1319
  };
1349
1320
 
1350
1321
  // src/shapes/Database.tsx
1351
- import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
1352
- import { Schema as Schema10 } from "effect";
1322
+ import * as Schema10 from "effect/Schema";
1353
1323
  import React11 from "react";
1354
1324
  import { createAnchorMap as createAnchorMap5 } from "@dxos/react-ui-canvas-editor";
1355
1325
  var DatabaseShape = Schema10.extend(ComputeShape, Schema10.Struct({
@@ -1364,14 +1334,9 @@ var createDatabase = (props) => createShape({
1364
1334
  ...props
1365
1335
  });
1366
1336
  var DatabaseComponent = ({ shape }) => {
1367
- var _effect = _useSignals10();
1368
- try {
1369
- return /* @__PURE__ */ React11.createElement(Box, {
1370
- shape
1371
- });
1372
- } finally {
1373
- _effect.f();
1374
- }
1337
+ return /* @__PURE__ */ React11.createElement(Box, {
1338
+ shape
1339
+ });
1375
1340
  };
1376
1341
  var databaseShape = {
1377
1342
  type: "database",
@@ -1388,12 +1353,11 @@ var databaseShape = {
1388
1353
  };
1389
1354
 
1390
1355
  // src/shapes/Function.tsx
1391
- import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
1392
- import { Schema as Schema11 } from "effect";
1356
+ import * as Schema11 from "effect/Schema";
1393
1357
  import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
1394
1358
  import { AnyOutput, FunctionInput } from "@dxos/conductor";
1395
- import { getSnapshot, isInstanceOf, Ref as Ref2 } from "@dxos/echo-schema";
1396
- import { FunctionType, ScriptType } from "@dxos/functions";
1359
+ import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
1360
+ import { Function, Script } from "@dxos/functions";
1397
1361
  import { useClient } from "@dxos/react-client";
1398
1362
  import { Filter, parseId } from "@dxos/react-client/echo";
1399
1363
  import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
@@ -1409,59 +1373,54 @@ var createFunction = (props) => createShape({
1409
1373
  ...props
1410
1374
  });
1411
1375
  var TextInputComponent2 = ({ shape, title, ...props }) => {
1412
- var _effect = _useSignals11();
1413
- try {
1414
- const client = useClient();
1415
- const { node, runtime } = useComputeNodeState(shape);
1416
- const inputRef = useRef4(null);
1417
- const handleEnter = useCallback3(async (text) => {
1418
- const value = text.trim();
1419
- const { spaceId, objectId } = parseId(value);
1420
- if (!spaceId || !objectId) {
1421
- return;
1422
- }
1423
- const space = client.spaces.get(spaceId);
1424
- const object = space?.db.getObjectById(objectId);
1425
- if (!space || !isInstanceOf(ScriptType, object)) {
1426
- return;
1427
- }
1428
- const { objects: [fn] } = await space.db.query(Filter.type(FunctionType, {
1429
- source: Ref2.make(object)
1430
- })).run();
1431
- if (!fn) {
1432
- return;
1433
- }
1434
- node.value = value;
1435
- node.function = Ref2.make(fn);
1436
- node.inputSchema = getSnapshot(fn.inputSchema);
1437
- node.outputSchema = getSnapshot(fn.outputSchema);
1438
- }, [
1439
- client,
1440
- node
1441
- ]);
1442
- const handleAction = useCallback3((action) => {
1443
- if (action !== "run") {
1444
- return;
1445
- }
1446
- runtime.evalNode();
1447
- }, [
1448
- runtime
1449
- ]);
1450
- return /* @__PURE__ */ React12.createElement(Box, {
1451
- shape,
1452
- title: "Function",
1453
- onAction: handleAction
1454
- }, /* @__PURE__ */ React12.createElement(TextBox3, {
1455
- ...props,
1456
- ref: inputRef,
1457
- value: node.value,
1458
- language: node.valueType === "object" ? "json" : void 0,
1459
- onBlur: handleEnter,
1460
- onEnter: handleEnter
1461
- }));
1462
- } finally {
1463
- _effect.f();
1464
- }
1376
+ const client = useClient();
1377
+ const { node, runtime } = useComputeNodeState(shape);
1378
+ const inputRef = useRef4(null);
1379
+ const handleEnter = useCallback3(async (text) => {
1380
+ const value = text.trim();
1381
+ const { spaceId, objectId } = parseId(value);
1382
+ if (!spaceId || !objectId) {
1383
+ return;
1384
+ }
1385
+ const space = client.spaces.get(spaceId);
1386
+ const object = space?.db.getObjectById(objectId);
1387
+ if (!space || !isInstanceOf(Script.Script, object)) {
1388
+ return;
1389
+ }
1390
+ const [fn] = await space.db.query(Filter.type(Function.Function, {
1391
+ source: Ref2.make(object)
1392
+ })).run();
1393
+ if (!fn) {
1394
+ return;
1395
+ }
1396
+ node.value = value;
1397
+ node.function = Ref2.make(fn);
1398
+ node.inputSchema = fn.inputSchema ? getSnapshot(fn.inputSchema) : void 0;
1399
+ node.outputSchema = fn.outputSchema ? getSnapshot(fn.outputSchema) : void 0;
1400
+ }, [
1401
+ client,
1402
+ node
1403
+ ]);
1404
+ const handleAction = useCallback3((action) => {
1405
+ if (action !== "run") {
1406
+ return;
1407
+ }
1408
+ runtime.evalNode();
1409
+ }, [
1410
+ runtime
1411
+ ]);
1412
+ return /* @__PURE__ */ React12.createElement(Box, {
1413
+ shape,
1414
+ title: "Function",
1415
+ onAction: handleAction
1416
+ }, /* @__PURE__ */ React12.createElement(TextBox3, {
1417
+ ...props,
1418
+ ref: inputRef,
1419
+ value: node.value,
1420
+ language: node.valueType === "object" ? "json" : void 0,
1421
+ onBlur: handleEnter,
1422
+ onEnter: handleEnter
1423
+ }));
1465
1424
  };
1466
1425
  var functionShape = {
1467
1426
  type: "function",
@@ -1473,10 +1432,10 @@ var functionShape = {
1473
1432
  };
1474
1433
 
1475
1434
  // src/shapes/Gpt.tsx
1476
- import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
1477
- import { Schema as Schema12 } from "effect";
1435
+ import * as Schema12 from "effect/Schema";
1478
1436
  import React13, { useEffect as useEffect4, useState as useState6 } from "react";
1479
1437
  import { GptInput, GptOutput } from "@dxos/conductor";
1438
+ import { ScrollArea } from "@dxos/react-ui";
1480
1439
  var GptShape = Schema12.extend(ComputeShape, Schema12.Struct({
1481
1440
  type: Schema12.Literal("gpt")
1482
1441
  }));
@@ -1489,54 +1448,50 @@ var createGpt = (props) => createShape({
1489
1448
  ...props
1490
1449
  });
1491
1450
  var GptComponent = ({ shape }) => {
1492
- var _effect = _useSignals12();
1493
- try {
1494
- const { meta, runtime } = useComputeNodeState(shape);
1495
- const [text, setText] = useState6("");
1496
- const [tokens, setTokens] = useState6(0);
1497
- useEffect4(() => {
1498
- return runtime.subscribeToEventLog((ev) => {
1499
- switch (ev.type) {
1500
- case "begin-compute": {
1501
- setText("");
1502
- break;
1503
- }
1504
- case "custom": {
1505
- const token = ev.event;
1506
- switch (token.type) {
1507
- case "content_block_delta":
1508
- switch (token.delta.type) {
1509
- case "text_delta": {
1510
- const delta = token.delta.text;
1511
- setText((prev) => {
1512
- const text2 = prev + delta;
1513
- setTokens(text2.split(" ").length);
1514
- return text2;
1515
- });
1516
- break;
1517
- }
1451
+ const { meta, runtime } = useComputeNodeState(shape);
1452
+ const [text, setText] = useState6("");
1453
+ const [tokens, setTokens] = useState6(0);
1454
+ useEffect4(() => {
1455
+ return runtime.subscribeToEventLog((ev) => {
1456
+ switch (ev.type) {
1457
+ case "begin-compute": {
1458
+ setText("");
1459
+ break;
1460
+ }
1461
+ case "custom": {
1462
+ const token = ev.event;
1463
+ switch (token.type) {
1464
+ case "content_block_delta":
1465
+ switch (token.delta.type) {
1466
+ case "text_delta": {
1467
+ const delta = token.delta.text;
1468
+ setText((prev) => {
1469
+ const text2 = prev + delta;
1470
+ setTokens(text2.split(" ").length);
1471
+ return text2;
1472
+ });
1473
+ break;
1518
1474
  }
1519
- break;
1520
- }
1521
- break;
1475
+ }
1476
+ break;
1522
1477
  }
1478
+ break;
1523
1479
  }
1524
- });
1525
- }, [
1526
- runtime?.subscribeToEventLog
1527
- ]);
1528
- return /* @__PURE__ */ React13.createElement(FunctionBody, {
1529
- shape,
1530
- content: /* @__PURE__ */ React13.createElement("div", {
1531
- className: "px-2 py-1 overflow-y-scroll"
1532
- }, text),
1533
- status: `${tokens} tokens`,
1534
- inputSchema: meta.input,
1535
- outputSchema: meta.output
1480
+ }
1536
1481
  });
1537
- } finally {
1538
- _effect.f();
1539
- }
1482
+ }, [
1483
+ runtime?.subscribeToEventLog
1484
+ ]);
1485
+ return /* @__PURE__ */ React13.createElement(FunctionBody, {
1486
+ shape,
1487
+ content: /* @__PURE__ */ React13.createElement(ScrollArea.Root, {
1488
+ orientation: "vertical",
1489
+ thin: true
1490
+ }, /* @__PURE__ */ React13.createElement(ScrollArea.Viewport, null, text)),
1491
+ status: `${tokens} tokens`,
1492
+ inputSchema: meta.input,
1493
+ outputSchema: meta.output
1494
+ });
1540
1495
  };
1541
1496
  var gptShape = {
1542
1497
  type: "gpt",
@@ -1549,8 +1504,7 @@ var gptShape = {
1549
1504
  };
1550
1505
 
1551
1506
  // src/shapes/Json.tsx
1552
- import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
1553
- import { Schema as Schema13 } from "effect";
1507
+ import * as Schema13 from "effect/Schema";
1554
1508
  import React14 from "react";
1555
1509
  import { DEFAULT_INPUT as DEFAULT_INPUT4, DefaultOutput, JsonTransformInput } from "@dxos/conductor";
1556
1510
  import { createAnchorMap as createAnchorMap6 } from "@dxos/react-ui-canvas-editor";
@@ -1562,30 +1516,20 @@ var JsonTransformShape = Schema13.extend(ComputeShape, Schema13.Struct({
1562
1516
  type: Schema13.Literal("json-transform")
1563
1517
  }));
1564
1518
  var JsonComponent = ({ shape, ...props }) => {
1565
- var _effect = _useSignals13();
1566
- try {
1567
- const { runtime } = useComputeNodeState(shape);
1568
- const input = runtime.inputs[DEFAULT_INPUT4];
1569
- const value = input?.type === "executed" ? input.value : void 0;
1570
- return /* @__PURE__ */ React14.createElement(Box, {
1571
- shape
1572
- }, /* @__PURE__ */ React14.createElement(JsonFilter, {
1573
- data: value,
1574
- classNames: "text-xs"
1575
- }));
1576
- } finally {
1577
- _effect.f();
1578
- }
1519
+ const { runtime } = useComputeNodeState(shape);
1520
+ const input = runtime.inputs[DEFAULT_INPUT4];
1521
+ const value = input?.type === "executed" ? input.value : void 0;
1522
+ return /* @__PURE__ */ React14.createElement(Box, {
1523
+ shape
1524
+ }, /* @__PURE__ */ React14.createElement(JsonFilter, {
1525
+ data: value,
1526
+ classNames: "text-xs"
1527
+ }));
1579
1528
  };
1580
1529
  var JsonTransformComponent = ({ shape, ...props }) => {
1581
- var _effect = _useSignals13();
1582
- try {
1583
- return /* @__PURE__ */ React14.createElement(Box, {
1584
- shape
1585
- });
1586
- } finally {
1587
- _effect.f();
1588
- }
1530
+ return /* @__PURE__ */ React14.createElement(Box, {
1531
+ shape
1532
+ });
1589
1533
  };
1590
1534
  var createJson = (props) => createShape({
1591
1535
  type: "json",
@@ -1632,8 +1576,7 @@ var jsonTransformShape = {
1632
1576
  };
1633
1577
 
1634
1578
  // src/shapes/Logic.tsx
1635
- import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
1636
- import { Schema as Schema14 } from "effect";
1579
+ import * as Schema14 from "effect/Schema";
1637
1580
  import React15 from "react";
1638
1581
  import { IfElseInput, IfElseOutput, IfInput, IfOutput } from "@dxos/conductor";
1639
1582
  var IfShape = Schema14.extend(ComputeShape, Schema14.Struct({
@@ -1643,28 +1586,18 @@ var IfElseShape = Schema14.extend(ComputeShape, Schema14.Struct({
1643
1586
  type: Schema14.Literal("if-else")
1644
1587
  }));
1645
1588
  var IfComponent = ({ shape, ...props }) => {
1646
- var _effect = _useSignals14();
1647
- try {
1648
- return /* @__PURE__ */ React15.createElement(FunctionBody, {
1649
- shape,
1650
- inputSchema: IfInput,
1651
- outputSchema: IfOutput
1652
- });
1653
- } finally {
1654
- _effect.f();
1655
- }
1589
+ return /* @__PURE__ */ React15.createElement(FunctionBody, {
1590
+ shape,
1591
+ inputSchema: IfInput,
1592
+ outputSchema: IfOutput
1593
+ });
1656
1594
  };
1657
1595
  var IfElseComponent = ({ shape, ...props }) => {
1658
- var _effect = _useSignals14();
1659
- try {
1660
- return /* @__PURE__ */ React15.createElement(FunctionBody, {
1661
- shape,
1662
- inputSchema: IfElseInput,
1663
- outputSchema: IfElseOutput
1664
- });
1665
- } finally {
1666
- _effect.f();
1667
- }
1596
+ return /* @__PURE__ */ React15.createElement(FunctionBody, {
1597
+ shape,
1598
+ inputSchema: IfElseInput,
1599
+ outputSchema: IfElseOutput
1600
+ });
1668
1601
  };
1669
1602
  var createIf = (props) => createShape({
1670
1603
  type: "if",
@@ -1700,11 +1633,11 @@ var ifElseShape = {
1700
1633
  };
1701
1634
 
1702
1635
  // src/shapes/Queue.tsx
1703
- import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
1704
- import { Schema as Schema15 } from "effect";
1636
+ import * as Schema15 from "effect/Schema";
1705
1637
  import React16, { Fragment } from "react";
1706
1638
  import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
1707
- import { mx as mx2 } from "@dxos/react-ui-theme";
1639
+ import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
1640
+ import { mx as mx2 } from "@dxos/ui-theme";
1708
1641
  var QueueShape = Schema15.extend(ComputeShape, Schema15.Struct({
1709
1642
  type: Schema15.Literal("queue")
1710
1643
  }));
@@ -1717,50 +1650,42 @@ var createQueue = (props) => createShape({
1717
1650
  ...props
1718
1651
  });
1719
1652
  var QueueComponent = ({ shape }) => {
1720
- var _effect = _useSignals15();
1721
- try {
1722
- const { runtime } = useComputeNodeState(shape);
1723
- const items = runtime.outputs[DEFAULT_OUTPUT4]?.type === "executed" ? runtime.outputs[DEFAULT_OUTPUT4].value : [];
1724
- const handleAction = (action) => {
1725
- if (action === "run") {
1726
- runtime.evalNode();
1727
- }
1728
- };
1729
- return /* @__PURE__ */ React16.createElement(Box, {
1730
- shape,
1731
- status: `${items.length} items`,
1732
- onAction: handleAction
1733
- }, /* @__PURE__ */ React16.createElement("div", {
1734
- className: "flex flex-col w-full overflow-y-scroll divide-y divide-separator"
1735
- }, [
1736
- ...items
1737
- ].map((item, i) => /* @__PURE__ */ React16.createElement(QueueItem, {
1738
- key: i,
1739
- classNames: "p-1 px-2",
1740
- item
1741
- }))));
1742
- } finally {
1743
- _effect.f();
1744
- }
1653
+ const { runtime } = useComputeNodeState(shape);
1654
+ const items = runtime.outputs[DEFAULT_OUTPUT4]?.type === "executed" ? runtime.outputs[DEFAULT_OUTPUT4].value : [];
1655
+ const handleAction = (action) => {
1656
+ if (action === "run") {
1657
+ runtime.evalNode();
1658
+ }
1659
+ };
1660
+ return /* @__PURE__ */ React16.createElement(Box, {
1661
+ shape,
1662
+ status: `${items.length} items`,
1663
+ onAction: handleAction
1664
+ }, /* @__PURE__ */ React16.createElement(ScrollArea2.Root, {
1665
+ orientation: "vertical"
1666
+ }, /* @__PURE__ */ React16.createElement(ScrollArea2.Viewport, {
1667
+ classNames: "divide-y divide-separator"
1668
+ }, [
1669
+ ...items
1670
+ ].map((item, i) => /* @__PURE__ */ React16.createElement(QueueItem, {
1671
+ key: i,
1672
+ classNames: "p-1 px-2",
1673
+ item
1674
+ })))));
1745
1675
  };
1746
1676
  var QueueItem = ({ classNames, item }) => {
1747
- var _effect = _useSignals15();
1748
- try {
1749
- if (typeof item !== "object") {
1750
- return /* @__PURE__ */ React16.createElement("div", {
1751
- className: mx2(classNames, "whitespace-pre-wrap")
1752
- }, item);
1753
- }
1677
+ if (typeof item !== "object") {
1754
1678
  return /* @__PURE__ */ React16.createElement("div", {
1755
- className: mx2("grid grid-cols-[80px,1fr]", classNames)
1756
- }, Object.entries(item).map(([key, value]) => /* @__PURE__ */ React16.createElement(Fragment, {
1757
- key
1758
- }, /* @__PURE__ */ React16.createElement("div", {
1759
- className: "p-1 text-xs text-subdued"
1760
- }, key), /* @__PURE__ */ React16.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1761
- } finally {
1762
- _effect.f();
1679
+ className: mx2(classNames, "whitespace-pre-wrap")
1680
+ }, item);
1763
1681
  }
1682
+ return /* @__PURE__ */ React16.createElement("div", {
1683
+ className: mx2("grid grid-cols-[80px_1fr]", classNames)
1684
+ }, Object.entries(item).map(([key, value]) => /* @__PURE__ */ React16.createElement(Fragment, {
1685
+ key
1686
+ }, /* @__PURE__ */ React16.createElement("div", {
1687
+ className: "p-1 text-xs text-subdued"
1688
+ }, key), /* @__PURE__ */ React16.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1764
1689
  };
1765
1690
  var queueShape = {
1766
1691
  type: "queue",
@@ -1773,8 +1698,7 @@ var queueShape = {
1773
1698
  };
1774
1699
 
1775
1700
  // src/shapes/RNG.tsx
1776
- import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
1777
- import { Schema as Schema16 } from "effect";
1701
+ import * as Schema16 from "effect/Schema";
1778
1702
  import React17, { useEffect as useEffect5, useState as useState7 } from "react";
1779
1703
  import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
1780
1704
  import { Icon as Icon4 } from "@dxos/react-ui";
@@ -1802,42 +1726,37 @@ var icons = [
1802
1726
  ];
1803
1727
  var pickIcon = () => icons[Math.floor(Math.random() * icons.length)];
1804
1728
  var RandomComponent = ({ shape }) => {
1805
- var _effect = _useSignals16();
1806
- try {
1807
- const { runtime } = useComputeNodeState(shape);
1808
- const [spin, setSpin] = useState7(false);
1809
- const [icon, setIcon] = useState7(pickIcon());
1810
- useEffect5(() => {
1811
- if (!spin) {
1812
- return;
1813
- }
1814
- const i = setInterval(() => setIcon(pickIcon()), 250);
1815
- const t1 = setTimeout(() => clearInterval(i), 900);
1816
- const t2 = setTimeout(() => setSpin(false), 1100);
1817
- return () => {
1818
- clearInterval(i);
1819
- clearTimeout(t1);
1820
- clearTimeout(t2);
1821
- };
1822
- }, [
1823
- spin
1824
- ]);
1825
- const handleClick = (ev) => {
1826
- ev.stopPropagation();
1827
- runtime.setOutput(DEFAULT_OUTPUT5, Math.random());
1828
- setSpin(true);
1729
+ const { runtime } = useComputeNodeState(shape);
1730
+ const [spin, setSpin] = useState7(false);
1731
+ const [icon, setIcon] = useState7(pickIcon());
1732
+ useEffect5(() => {
1733
+ if (!spin) {
1734
+ return;
1735
+ }
1736
+ const i = setInterval(() => setIcon(pickIcon()), 250);
1737
+ const t1 = setTimeout(() => clearInterval(i), 900);
1738
+ const t2 = setTimeout(() => setSpin(false), 1100);
1739
+ return () => {
1740
+ clearInterval(i);
1741
+ clearTimeout(t1);
1742
+ clearTimeout(t2);
1829
1743
  };
1830
- return /* @__PURE__ */ React17.createElement("div", {
1831
- className: "flex grow items-center justify-center"
1832
- }, /* @__PURE__ */ React17.createElement(Icon4, {
1833
- icon,
1834
- classNames: spin && "animate-[spin_1s]",
1835
- size: 10,
1836
- onClick: handleClick
1837
- }));
1838
- } finally {
1839
- _effect.f();
1840
- }
1744
+ }, [
1745
+ spin
1746
+ ]);
1747
+ const handleClick = (ev) => {
1748
+ ev.stopPropagation();
1749
+ runtime.setOutput(DEFAULT_OUTPUT5, Math.random());
1750
+ setSpin(true);
1751
+ };
1752
+ return /* @__PURE__ */ React17.createElement("div", {
1753
+ className: "flex grow items-center justify-center"
1754
+ }, /* @__PURE__ */ React17.createElement(Icon4, {
1755
+ icon,
1756
+ classNames: spin && "animate-[spin_1s]",
1757
+ size: 10,
1758
+ onClick: handleClick
1759
+ }));
1841
1760
  };
1842
1761
  var randomShape = {
1843
1762
  type: "rng",
@@ -1854,12 +1773,11 @@ var randomShape = {
1854
1773
  };
1855
1774
 
1856
1775
  // src/shapes/Scope.tsx
1857
- import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
1858
- import { Schema as Schema17 } from "effect";
1776
+ import * as Schema17 from "effect/Schema";
1859
1777
  import React18 from "react";
1860
1778
  import { DEFAULT_INPUT as DEFAULT_INPUT5 } from "@dxos/conductor";
1861
1779
  import { createAnchorMap as createAnchorMap8 } from "@dxos/react-ui-canvas-editor";
1862
- import { useAudioStream, Chaos, shaderPresets } from "@dxos/react-ui-sfx";
1780
+ import { Chaos, shaderPresets, useAudioStream } from "@dxos/react-ui-sfx";
1863
1781
  var ScopeShape = Schema17.extend(ComputeShape, Schema17.Struct({
1864
1782
  type: Schema17.Literal("scope")
1865
1783
  }));
@@ -1873,25 +1791,20 @@ var createScope = (props) => createShape({
1873
1791
  ...props
1874
1792
  });
1875
1793
  var ScopeComponent = ({ shape }) => {
1876
- var _effect = _useSignals17();
1877
- try {
1878
- const { runtime } = useComputeNodeState(shape);
1879
- const input = runtime.inputs[DEFAULT_INPUT5];
1880
- const active = input?.type === "executed" ? input.value : false;
1881
- const { getAverage } = useAudioStream(active);
1882
- return /* @__PURE__ */ React18.createElement("div", {
1883
- className: "flex w-full justify-center items-center bg-black"
1884
- }, /* @__PURE__ */ React18.createElement(Chaos, {
1885
- active,
1886
- getValue: getAverage,
1887
- options: {
1888
- ...shaderPresets.heptapod,
1889
- zoom: 1.2
1890
- }
1891
- }));
1892
- } finally {
1893
- _effect.f();
1894
- }
1794
+ const { runtime } = useComputeNodeState(shape);
1795
+ const input = runtime.inputs[DEFAULT_INPUT5];
1796
+ const active = input?.type === "executed" ? input.value : false;
1797
+ const { getAverage } = useAudioStream(active);
1798
+ return /* @__PURE__ */ React18.createElement("div", {
1799
+ className: "flex w-full justify-center items-center bg-black"
1800
+ }, /* @__PURE__ */ React18.createElement(Chaos, {
1801
+ active,
1802
+ getValue: getAverage,
1803
+ options: {
1804
+ ...shaderPresets.heptapod,
1805
+ zoom: 1.2
1806
+ }
1807
+ }));
1895
1808
  };
1896
1809
  var scopeShape = {
1897
1810
  type: "scope",
@@ -1908,11 +1821,11 @@ var scopeShape = {
1908
1821
  };
1909
1822
 
1910
1823
  // src/shapes/Surface.tsx
1911
- import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
1912
- import { Schema as Schema18 } from "effect";
1824
+ import * as Schema18 from "effect/Schema";
1913
1825
  import React19 from "react";
1914
- import { Surface } from "@dxos/app-framework";
1826
+ import { Surface } from "@dxos/app-framework/ui";
1915
1827
  import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
1828
+ import { Card } from "@dxos/react-ui";
1916
1829
  import { createAnchorMap as createAnchorMap9 } from "@dxos/react-ui-canvas-editor";
1917
1830
  var SurfaceShape = Schema18.extend(ComputeShape, Schema18.Struct({
1918
1831
  type: Schema18.Literal("surface")
@@ -1926,29 +1839,24 @@ var createSurface = (props) => createShape({
1926
1839
  ...props
1927
1840
  });
1928
1841
  var SurfaceComponent = ({ shape }) => {
1929
- var _effect = _useSignals18();
1930
- try {
1931
- const { runtime } = useComputeNodeState(shape);
1932
- const input = runtime.inputs[DEFAULT_INPUT6];
1933
- const value = input?.type === "executed" ? input.value : null;
1934
- const handleAction = (action) => {
1935
- if (action === "run") {
1936
- runtime.evalNode();
1937
- }
1938
- };
1939
- return /* @__PURE__ */ React19.createElement(Box, {
1940
- shape,
1941
- onAction: handleAction
1942
- }, value !== null && /* @__PURE__ */ React19.createElement(Surface, {
1943
- role: "card--extrinsic",
1944
- data: {
1945
- value
1946
- },
1947
- limit: 1
1948
- }));
1949
- } finally {
1950
- _effect.f();
1951
- }
1842
+ const { runtime } = useComputeNodeState(shape);
1843
+ const input = runtime.inputs[DEFAULT_INPUT6];
1844
+ const value = input?.type === "executed" ? input.value : null;
1845
+ const handleAction = (action) => {
1846
+ if (action === "run") {
1847
+ runtime.evalNode();
1848
+ }
1849
+ };
1850
+ return /* @__PURE__ */ React19.createElement(Box, {
1851
+ shape,
1852
+ onAction: handleAction
1853
+ }, /* @__PURE__ */ React19.createElement(Card.Root, null, value !== null && /* @__PURE__ */ React19.createElement(Surface.Surface, {
1854
+ role: "card--content",
1855
+ data: {
1856
+ value
1857
+ },
1858
+ limit: 1
1859
+ })));
1952
1860
  };
1953
1861
  var surfaceShape = {
1954
1862
  type: "surface",
@@ -1966,8 +1874,7 @@ var surfaceShape = {
1966
1874
  };
1967
1875
 
1968
1876
  // src/shapes/Switch.tsx
1969
- import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
1970
- import { Schema as Schema19 } from "effect";
1877
+ import * as Schema19 from "effect/Schema";
1971
1878
  import React20, { useEffect as useEffect6, useState as useState8 } from "react";
1972
1879
  import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
1973
1880
  import { Input as Input2 } from "@dxos/react-ui";
@@ -1984,25 +1891,20 @@ var createSwitch = (props) => createShape({
1984
1891
  ...props
1985
1892
  });
1986
1893
  var SwitchComponent = ({ shape }) => {
1987
- var _effect = _useSignals19();
1988
- try {
1989
- const { runtime } = useComputeNodeState(shape);
1990
- const [value, setValue] = useState8(false);
1991
- useEffect6(() => {
1992
- runtime.setOutput(DEFAULT_OUTPUT6, value);
1993
- }, [
1994
- value
1995
- ]);
1996
- return /* @__PURE__ */ React20.createElement("div", {
1997
- className: "flex w-full justify-center items-center",
1998
- onClick: (ev) => ev.stopPropagation()
1999
- }, /* @__PURE__ */ React20.createElement(Input2.Root, null, /* @__PURE__ */ React20.createElement(Input2.Switch, {
2000
- checked: value,
2001
- onCheckedChange: (value2) => setValue(value2)
2002
- })));
2003
- } finally {
2004
- _effect.f();
2005
- }
1894
+ const { runtime } = useComputeNodeState(shape);
1895
+ const [value, setValue] = useState8(false);
1896
+ useEffect6(() => {
1897
+ runtime.setOutput(DEFAULT_OUTPUT6, value);
1898
+ }, [
1899
+ value
1900
+ ]);
1901
+ return /* @__PURE__ */ React20.createElement("div", {
1902
+ className: "flex w-full justify-center items-center",
1903
+ onClick: (ev) => ev.stopPropagation()
1904
+ }, /* @__PURE__ */ React20.createElement(Input2.Root, null, /* @__PURE__ */ React20.createElement(Input2.Switch, {
1905
+ checked: value,
1906
+ onCheckedChange: (value2) => setValue(value2)
1907
+ })));
2006
1908
  };
2007
1909
  var switchShape = {
2008
1910
  type: "switch",
@@ -2019,13 +1921,12 @@ var switchShape = {
2019
1921
  };
2020
1922
 
2021
1923
  // src/shapes/Table.tsx
2022
- import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking";
2023
- import { Schema as Schema20 } from "effect";
1924
+ import * as Schema20 from "effect/Schema";
2024
1925
  import React21 from "react";
2025
1926
  import { createInputSchema, createOutputSchema } from "@dxos/conductor";
2026
- import { DataType } from "@dxos/schema";
2027
- var InputSchema = createInputSchema(DataType.Message);
2028
- var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(DataType.Message)));
1927
+ import { Message } from "@dxos/types";
1928
+ var InputSchema = createInputSchema(Message.Message);
1929
+ var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(Message.Message)));
2029
1930
  var TableShape = Schema20.extend(ComputeShape, Schema20.Struct({
2030
1931
  type: Schema20.Literal("table")
2031
1932
  }));
@@ -2038,14 +1939,9 @@ var createTable = (props) => createShape({
2038
1939
  ...props
2039
1940
  });
2040
1941
  var TableComponent = ({ shape }) => {
2041
- var _effect = _useSignals20();
2042
- try {
2043
- return /* @__PURE__ */ React21.createElement(Box, {
2044
- shape
2045
- });
2046
- } finally {
2047
- _effect.f();
2048
- }
1942
+ return /* @__PURE__ */ React21.createElement(Box, {
1943
+ shape
1944
+ });
2049
1945
  };
2050
1946
  var tableShape = {
2051
1947
  type: "table",
@@ -2058,11 +1954,10 @@ var tableShape = {
2058
1954
  };
2059
1955
 
2060
1956
  // src/shapes/Template.tsx
2061
- import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking";
2062
- import { Schema as Schema21 } from "effect";
1957
+ import * as Schema21 from "effect/Schema";
2063
1958
  import React22, { useRef as useRef5 } from "react";
2064
- import { ComputeValueType as ComputeValueType3, getTemplateInputSchema as getTemplateInputSchema2, TemplateOutput, VoidInput as VoidInput2 } from "@dxos/conductor";
2065
- import { toJsonSchema as toJsonSchema2 } from "@dxos/echo-schema";
1959
+ import { ComputeValueType as ComputeValueType3, TemplateOutput, VoidInput as VoidInput2, getTemplateInputSchema as getTemplateInputSchema2 } from "@dxos/conductor";
1960
+ import { toJsonSchema } from "@dxos/echo/internal";
2066
1961
  import { invariant as invariant5 } from "@dxos/invariant";
2067
1962
  import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
2068
1963
  var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
@@ -2071,49 +1966,44 @@ var TemplateShape = Schema21.extend(ComputeShape, Schema21.Struct({
2071
1966
  valueType: Schema21.optional(ComputeValueType3)
2072
1967
  }));
2073
1968
  var TextInputComponent3 = ({ shape, title, ...props }) => {
2074
- var _effect = _useSignals21();
2075
- try {
2076
- const { node } = useComputeNodeState(shape);
2077
- const inputRef = useRef5(null);
2078
- const handleEnter = (text) => {
2079
- const value = text.trim();
2080
- if (value.length) {
2081
- const schema = getTemplateInputSchema2(node);
2082
- node.value = value;
2083
- node.inputSchema = toJsonSchema2(schema);
2084
- }
2085
- };
2086
- const handleTypeChange = (newType) => {
2087
- invariant5(Schema21.is(ComputeValueType3)(newType), "Invalid type", {
2088
- F: __dxlog_file6,
2089
- L: 58,
2090
- S: void 0,
2091
- A: [
2092
- "Schema.is(ComputeValueType)(newType)",
2093
- "'Invalid type'"
2094
- ]
2095
- });
2096
- node.valueType = newType;
2097
- node.inputSchema = toJsonSchema2(getTemplateInputSchema2(node));
2098
- };
2099
- return /* @__PURE__ */ React22.createElement(Box, {
2100
- shape,
2101
- title: "Template",
2102
- status: /* @__PURE__ */ React22.createElement(TypeSelect, {
2103
- value: node.valueType ?? "string",
2104
- onValueChange: handleTypeChange
2105
- })
2106
- }, /* @__PURE__ */ React22.createElement(TextBox4, {
2107
- ...props,
2108
- ref: inputRef,
2109
- value: node.value,
2110
- language: node.valueType === "object" ? "json" : void 0,
2111
- onBlur: handleEnter,
2112
- onEnter: handleEnter
2113
- }));
2114
- } finally {
2115
- _effect.f();
2116
- }
1969
+ const { node } = useComputeNodeState(shape);
1970
+ const inputRef = useRef5(null);
1971
+ const handleEnter = (text) => {
1972
+ const value = text.trim();
1973
+ if (value.length) {
1974
+ const schema = getTemplateInputSchema2(node);
1975
+ node.value = value;
1976
+ node.inputSchema = toJsonSchema(schema);
1977
+ }
1978
+ };
1979
+ const handleTypeChange = (newType) => {
1980
+ invariant5(Schema21.is(ComputeValueType3)(newType), "Invalid type", {
1981
+ F: __dxlog_file6,
1982
+ L: 59,
1983
+ S: void 0,
1984
+ A: [
1985
+ "Schema.is(ComputeValueType)(newType)",
1986
+ "'Invalid type'"
1987
+ ]
1988
+ });
1989
+ node.valueType = newType;
1990
+ node.inputSchema = toJsonSchema(getTemplateInputSchema2(node));
1991
+ };
1992
+ return /* @__PURE__ */ React22.createElement(Box, {
1993
+ shape,
1994
+ title: "Template",
1995
+ status: /* @__PURE__ */ React22.createElement(TypeSelect, {
1996
+ value: node.valueType ?? "string",
1997
+ onValueChange: handleTypeChange
1998
+ })
1999
+ }, /* @__PURE__ */ React22.createElement(TextBox4, {
2000
+ ...props,
2001
+ ref: inputRef,
2002
+ value: node.value,
2003
+ language: node.valueType === "object" ? "json" : void 0,
2004
+ onBlur: handleEnter,
2005
+ onEnter: handleEnter
2006
+ }));
2117
2007
  };
2118
2008
  var createTemplate = (props) => createShape({
2119
2009
  type: "template",
@@ -2137,8 +2027,7 @@ var templateShape = {
2137
2027
  };
2138
2028
 
2139
2029
  // src/shapes/Text.tsx
2140
- import { useSignals as _useSignals22 } from "@preact-signals/safe-react/tracking";
2141
- import { Schema as Schema22 } from "effect";
2030
+ import * as Schema22 from "effect/Schema";
2142
2031
  import React23 from "react";
2143
2032
  import { DEFAULT_INPUT as DEFAULT_INPUT7 } from "@dxos/conductor";
2144
2033
  import { TextBox as TextBox5 } from "@dxos/react-ui-canvas-editor";
@@ -2155,25 +2044,20 @@ var createText = (props) => createShape({
2155
2044
  ...props
2156
2045
  });
2157
2046
  var TextComponent = ({ shape }) => {
2158
- var _effect = _useSignals22();
2159
- try {
2160
- const { runtime } = useComputeNodeState(shape);
2161
- const input = runtime.inputs[DEFAULT_INPUT7];
2162
- const value = input?.type === "executed" ? input.value : 0;
2163
- const handleAction = (action) => {
2164
- if (action === "run") {
2165
- runtime.evalNode();
2166
- }
2167
- };
2168
- return /* @__PURE__ */ React23.createElement(Box, {
2169
- shape,
2170
- onAction: handleAction
2171
- }, /* @__PURE__ */ React23.createElement(TextBox5, {
2172
- value
2173
- }));
2174
- } finally {
2175
- _effect.f();
2176
- }
2047
+ const { runtime } = useComputeNodeState(shape);
2048
+ const input = runtime.inputs[DEFAULT_INPUT7];
2049
+ const value = input?.type === "executed" ? input.value : 0;
2050
+ const handleAction = (action) => {
2051
+ if (action === "run") {
2052
+ runtime.evalNode();
2053
+ }
2054
+ };
2055
+ return /* @__PURE__ */ React23.createElement(Box, {
2056
+ shape,
2057
+ onAction: handleAction
2058
+ }, /* @__PURE__ */ React23.createElement(TextBox5, {
2059
+ value
2060
+ }));
2177
2061
  };
2178
2062
  var textShape = {
2179
2063
  type: "text",
@@ -2191,14 +2075,14 @@ var textShape = {
2191
2075
  };
2192
2076
 
2193
2077
  // src/shapes/Thread.tsx
2194
- import { useSignals as _useSignals23 } from "@preact-signals/safe-react/tracking";
2195
- import { Schema as Schema23 } from "effect";
2078
+ import * as Schema23 from "effect/Schema";
2196
2079
  import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
2197
2080
  import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
2198
- import { mx as mx3 } from "@dxos/react-ui-theme";
2199
- import { DataType as DataType2 } from "@dxos/schema";
2200
- var InputSchema2 = createInputSchema2(DataType2.Message);
2201
- var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(DataType2.Message)));
2081
+ import { ScrollArea as ScrollArea3 } from "@dxos/react-ui";
2082
+ import { Message as Message2 } from "@dxos/types";
2083
+ import { mx as mx3 } from "@dxos/ui-theme";
2084
+ var InputSchema2 = createInputSchema2(Message2.Message);
2085
+ var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(Message2.Message)));
2202
2086
  var ThreadShape = Schema23.extend(ComputeShape, Schema23.Struct({
2203
2087
  type: Schema23.Literal("thread")
2204
2088
  }));
@@ -2211,49 +2095,42 @@ var createThread = (props) => createShape({
2211
2095
  ...props
2212
2096
  });
2213
2097
  var ThreadComponent = ({ shape }) => {
2214
- var _effect = _useSignals23();
2215
- try {
2216
- const items = [];
2217
- const scrollRef = useRef6(null);
2218
- useEffect7(() => {
2219
- if (scrollRef.current) {
2220
- scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2221
- }
2222
- }, [
2223
- items
2224
- ]);
2225
- return /* @__PURE__ */ React24.createElement(Box, {
2226
- shape
2227
- }, /* @__PURE__ */ React24.createElement("div", {
2228
- ref: scrollRef,
2229
- className: "flex flex-col w-full overflow-y-scroll gap-2 p-2"
2230
- }, [
2231
- ...items
2232
- ].map((item, i) => /* @__PURE__ */ React24.createElement(ThreadItem, {
2233
- key: i,
2234
- item
2235
- }))));
2236
- } finally {
2237
- _effect.f();
2238
- }
2098
+ const items = [];
2099
+ const scrollRef = useRef6(null);
2100
+ useEffect7(() => {
2101
+ if (scrollRef.current) {
2102
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2103
+ }
2104
+ }, [
2105
+ items
2106
+ ]);
2107
+ return /* @__PURE__ */ React24.createElement(Box, {
2108
+ shape
2109
+ }, /* @__PURE__ */ React24.createElement(ScrollArea3.Root, {
2110
+ orientation: "vertical"
2111
+ }, /* @__PURE__ */ React24.createElement(ScrollArea3.Viewport, {
2112
+ classNames: "gap-2 p-2",
2113
+ ref: scrollRef
2114
+ }, [
2115
+ ...items
2116
+ ].map((item, i) => /* @__PURE__ */ React24.createElement(ThreadItem, {
2117
+ key: i,
2118
+ item
2119
+ })))));
2239
2120
  };
2240
2121
  var ThreadItem = ({ classNames, item }) => {
2241
- var _effect = _useSignals23();
2242
- try {
2243
- if (typeof item !== "object") {
2244
- return /* @__PURE__ */ React24.createElement("div", {
2245
- className: mx3(classNames)
2246
- }, item);
2247
- }
2248
- const { role, message } = item;
2122
+ if (typeof item !== "object") {
2249
2123
  return /* @__PURE__ */ React24.createElement("div", {
2250
- className: mx3("flex", classNames, role === "user" && "justify-end")
2251
- }, /* @__PURE__ */ React24.createElement("div", {
2252
- className: mx3("block rounded-md p-1 px-2 text-sm", role === "user" ? "bg-blue-100 dark:bg-blue-800" : role === "system" ? "bg-red-100, dark:bg-red-800" : "whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800")
2253
- }, message));
2254
- } finally {
2255
- _effect.f();
2124
+ role: "none",
2125
+ className: mx3(classNames)
2126
+ }, item);
2256
2127
  }
2128
+ const { role, message } = item;
2129
+ return /* @__PURE__ */ React24.createElement("div", {
2130
+ className: mx3("flex", classNames, role === "user" && "justify-end")
2131
+ }, /* @__PURE__ */ React24.createElement("div", {
2132
+ className: mx3("block rounded-md p-1 px-2 text-sm", role === "user" ? "bg-blue-100 dark:bg-blue-800" : role === "system" ? "bg-red-100, dark:bg-red-800" : "whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800")
2133
+ }, message));
2257
2134
  };
2258
2135
  var threadShape = {
2259
2136
  type: "thread",
@@ -2266,8 +2143,7 @@ var threadShape = {
2266
2143
  };
2267
2144
 
2268
2145
  // src/shapes/TextToImage.tsx
2269
- import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
2270
- import { Schema as Schema24 } from "effect";
2146
+ import * as Schema24 from "effect/Schema";
2271
2147
  import React25 from "react";
2272
2148
  import { createAnchorMap as createAnchorMap12 } from "@dxos/react-ui-canvas-editor";
2273
2149
  var TextToImageShape = Schema24.extend(ComputeShape, Schema24.Struct({
@@ -2282,14 +2158,9 @@ var createTextToImage = (props) => createShape({
2282
2158
  ...props
2283
2159
  });
2284
2160
  var TextToImageComponent = ({ shape }) => {
2285
- var _effect = _useSignals24();
2286
- try {
2287
- return /* @__PURE__ */ React25.createElement(Box, {
2288
- shape
2289
- });
2290
- } finally {
2291
- _effect.f();
2292
- }
2161
+ return /* @__PURE__ */ React25.createElement(Box, {
2162
+ shape
2163
+ });
2293
2164
  };
2294
2165
  var textToImageShape = {
2295
2166
  type: "text-to-image",
@@ -2306,21 +2177,20 @@ var textToImageShape = {
2306
2177
  };
2307
2178
 
2308
2179
  // src/shapes/Trigger.tsx
2309
- import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
2310
- import { Schema as Schema25 } from "effect";
2180
+ import * as Schema25 from "effect/Schema";
2311
2181
  import React26, { useEffect as useEffect8 } from "react";
2312
2182
  import { VoidInput as VoidInput3 } from "@dxos/conductor";
2313
- import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo-schema";
2314
- import { EmailTriggerOutput, FunctionTrigger, QueueTriggerOutput, TriggerKind, SubscriptionTriggerOutput, TimerTriggerOutput, WebhookTriggerOutput } from "@dxos/functions";
2183
+ import { Filter as Filter2, Obj as Obj4, Query, Ref as Ref3 } from "@dxos/echo";
2184
+ import { Trigger, TriggerEvent } from "@dxos/functions";
2315
2185
  import { DXN, SpaceId } from "@dxos/keys";
2316
- import { live, useSpace } from "@dxos/react-client/echo";
2186
+ import { useSpace } from "@dxos/react-client/echo";
2317
2187
  import { Select as Select2 } from "@dxos/react-ui";
2318
2188
  var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
2319
2189
  type: Schema25.Literal("trigger"),
2320
- functionTrigger: Schema25.optional(Ref3(FunctionTrigger))
2190
+ functionTrigger: Schema25.optional(Ref3.Ref(Trigger.Trigger))
2321
2191
  }));
2322
2192
  var createTrigger = (props) => {
2323
- const functionTrigger = live(FunctionTrigger, {
2193
+ const functionTrigger = Trigger.make({
2324
2194
  enabled: true,
2325
2195
  spec: createTriggerSpec(props)
2326
2196
  });
@@ -2329,103 +2199,99 @@ var createTrigger = (props) => {
2329
2199
  functionTrigger: Ref3.make(functionTrigger),
2330
2200
  size: {
2331
2201
  width: 192,
2332
- height: getHeight(EmailTriggerOutput)
2202
+ height: getHeight(TriggerEvent.EmailEvent)
2333
2203
  },
2334
2204
  ...props
2335
2205
  });
2336
2206
  };
2337
2207
  var TriggerComponent = ({ shape }) => {
2338
- var _effect = _useSignals25();
2339
- try {
2340
- const space = useSpace();
2341
- const functionTrigger = shape.functionTrigger?.target;
2342
- useEffect8(() => {
2343
- if (functionTrigger && !functionTrigger.spec) {
2344
- functionTrigger.spec = createTriggerSpec({
2345
- triggerKind: TriggerKind.Email,
2208
+ const space = useSpace();
2209
+ const functionTrigger = shape.functionTrigger?.target;
2210
+ useEffect8(() => {
2211
+ if (functionTrigger && !functionTrigger.spec) {
2212
+ Obj4.change(functionTrigger, (t) => {
2213
+ t.spec = createTriggerSpec({
2214
+ triggerKind: "email",
2346
2215
  spaceId: space?.id
2347
2216
  });
2348
- }
2349
- }, [
2350
- functionTrigger,
2351
- functionTrigger?.spec
2352
- ]);
2353
- useEffect8(() => {
2354
- shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? TriggerKind.Email));
2355
- }, [
2356
- functionTrigger?.spec?.kind
2357
- ]);
2358
- const setKind = (kind) => {
2359
- if (functionTrigger?.spec?.kind !== kind) {
2360
- functionTrigger.spec = createTriggerSpec({
2217
+ });
2218
+ }
2219
+ }, [
2220
+ functionTrigger,
2221
+ functionTrigger?.spec
2222
+ ]);
2223
+ useEffect8(() => {
2224
+ shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? "email"));
2225
+ }, [
2226
+ functionTrigger?.spec?.kind
2227
+ ]);
2228
+ const setKind = (kind) => {
2229
+ if (functionTrigger?.spec?.kind !== kind) {
2230
+ Obj4.change(functionTrigger, (t) => {
2231
+ t.spec = createTriggerSpec({
2361
2232
  triggerKind: kind,
2362
2233
  spaceId: space?.id
2363
2234
  });
2364
- }
2365
- };
2366
- if (!functionTrigger?.spec) {
2367
- return;
2235
+ });
2368
2236
  }
2369
- return /* @__PURE__ */ React26.createElement(FunctionBody, {
2370
- shape,
2371
- status: /* @__PURE__ */ React26.createElement(TriggerKindSelect, {
2372
- value: functionTrigger.spec?.kind,
2373
- onValueChange: (kind) => setKind(kind)
2374
- }),
2375
- inputSchema: VoidInput3,
2376
- outputSchema: getOutputSchema(functionTrigger.spec.kind)
2377
- });
2378
- } finally {
2379
- _effect.f();
2237
+ };
2238
+ if (!functionTrigger?.spec) {
2239
+ return;
2380
2240
  }
2241
+ return /* @__PURE__ */ React26.createElement(FunctionBody, {
2242
+ shape,
2243
+ status: /* @__PURE__ */ React26.createElement(TriggerKindSelect, {
2244
+ value: functionTrigger.spec?.kind,
2245
+ onValueChange: (kind) => setKind(kind)
2246
+ }),
2247
+ inputSchema: VoidInput3,
2248
+ outputSchema: getOutputSchema(functionTrigger.spec.kind)
2249
+ });
2381
2250
  };
2382
2251
  var TriggerKindSelect = ({ value, onValueChange }) => {
2383
- var _effect = _useSignals25();
2384
- try {
2385
- return /* @__PURE__ */ React26.createElement(Select2.Root, {
2386
- value,
2387
- onValueChange
2388
- }, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
2389
- variant: "ghost",
2390
- classNames: "w-full !px-0"
2391
- }), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Object.values(TriggerKind).map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
2392
- key: kind,
2393
- value: kind
2394
- }, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
2395
- } finally {
2396
- _effect.f();
2397
- }
2252
+ return /* @__PURE__ */ React26.createElement(Select2.Root, {
2253
+ value,
2254
+ onValueChange
2255
+ }, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
2256
+ variant: "ghost",
2257
+ classNames: "w-full px-0!"
2258
+ }), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Trigger.Kinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
2259
+ key: kind,
2260
+ value: kind
2261
+ }, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
2398
2262
  };
2399
2263
  var createTriggerSpec = (props) => {
2400
- const kind = props.triggerKind ?? TriggerKind.Email;
2264
+ const kind = props.triggerKind ?? "email";
2401
2265
  switch (kind) {
2402
- case TriggerKind.Timer:
2266
+ case "timer":
2403
2267
  return {
2404
- kind: TriggerKind.Timer,
2268
+ kind: "timer",
2405
2269
  cron: "*/10 * * * * *"
2406
2270
  };
2407
- case TriggerKind.Webhook:
2271
+ case "webhook":
2408
2272
  return {
2409
- kind: TriggerKind.Webhook,
2273
+ kind: "webhook",
2410
2274
  method: "POST"
2411
2275
  };
2412
- case TriggerKind.Subscription:
2276
+ case "subscription":
2413
2277
  return {
2414
- kind: TriggerKind.Subscription,
2415
- filter: {}
2278
+ kind: "subscription",
2279
+ query: {
2280
+ ast: Query.select(Filter2.nothing()).ast
2281
+ }
2416
2282
  };
2417
- case TriggerKind.Email:
2283
+ case "email":
2418
2284
  return {
2419
- kind: TriggerKind.Email
2285
+ kind: "email"
2420
2286
  };
2421
- case TriggerKind.Queue: {
2287
+ case "queue": {
2422
2288
  const dxn = new DXN(DXN.kind.QUEUE, [
2423
2289
  "data",
2424
2290
  props.spaceId ?? SpaceId.random(),
2425
- ObjectId4.random()
2291
+ Obj4.ID.random()
2426
2292
  ]).toString();
2427
2293
  return {
2428
- kind: TriggerKind.Queue,
2294
+ kind: "queue",
2429
2295
  queue: dxn
2430
2296
  };
2431
2297
  }
@@ -2433,11 +2299,11 @@ var createTriggerSpec = (props) => {
2433
2299
  };
2434
2300
  var getOutputSchema = (kind) => {
2435
2301
  const kindToSchema = {
2436
- [TriggerKind.Email]: EmailTriggerOutput,
2437
- [TriggerKind.Subscription]: SubscriptionTriggerOutput,
2438
- [TriggerKind.Timer]: TimerTriggerOutput,
2439
- [TriggerKind.Webhook]: WebhookTriggerOutput,
2440
- [TriggerKind.Queue]: QueueTriggerOutput
2302
+ ["email"]: TriggerEvent.EmailEvent,
2303
+ ["subscription"]: TriggerEvent.SubscriptionEvent,
2304
+ ["timer"]: TriggerEvent.TimerEvent,
2305
+ ["webhook"]: TriggerEvent.WebhookEvent,
2306
+ ["queue"]: TriggerEvent.QueueEvent
2441
2307
  };
2442
2308
  return kindToSchema[kind];
2443
2309
  };
@@ -2447,12 +2313,11 @@ var triggerShape = {
2447
2313
  icon: "ph--lightning--regular",
2448
2314
  component: TriggerComponent,
2449
2315
  createShape: createTrigger,
2450
- getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? TriggerKind.Email))
2316
+ getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? "email"))
2451
2317
  };
2452
2318
 
2453
2319
  // src/shapes/GptRealtime.tsx
2454
- import { useSignals as _useSignals26 } from "@preact-signals/safe-react/tracking";
2455
- import { Schema as Schema26 } from "effect";
2320
+ import * as Schema26 from "effect/Schema";
2456
2321
  import React27, { useState as useState9 } from "react";
2457
2322
  import { log as log2 } from "@dxos/log";
2458
2323
  import { useConfig } from "@dxos/react-client";
@@ -2470,105 +2335,100 @@ var createGptRealtime = (props) => createShape({
2470
2335
  ...props
2471
2336
  });
2472
2337
  var GptRealtimeComponent = ({ shape }) => {
2473
- var _effect = _useSignals26();
2474
- try {
2475
- const [isLive, setIsLive] = useState9(false);
2476
- const [isReady, setIsReady] = useState9(false);
2477
- const config = useConfig();
2478
- const start = async () => {
2479
- setIsLive(true);
2480
- try {
2481
- const peerConnection = new RTCPeerConnection();
2482
- peerConnection.ontrack = (event) => {
2483
- const audioElement = document.createElement("audio");
2484
- audioElement.srcObject = event.streams[0];
2485
- audioElement.autoplay = true;
2486
- audioElement.controls = false;
2487
- audioElement.style.display = "none";
2488
- document.body.appendChild(audioElement);
2489
- setIsReady(true);
2490
- };
2491
- const stream = await navigator.mediaDevices.getUserMedia({
2492
- audio: true
2338
+ const [isLive, setIsLive] = useState9(false);
2339
+ const [isReady, setIsReady] = useState9(false);
2340
+ const config = useConfig();
2341
+ const start = async () => {
2342
+ setIsLive(true);
2343
+ try {
2344
+ const peerConnection = new RTCPeerConnection();
2345
+ peerConnection.ontrack = (event) => {
2346
+ const audioElement = document.createElement("audio");
2347
+ audioElement.srcObject = event.streams[0];
2348
+ audioElement.autoplay = true;
2349
+ audioElement.controls = false;
2350
+ audioElement.style.display = "none";
2351
+ document.body.appendChild(audioElement);
2352
+ setIsReady(true);
2353
+ };
2354
+ const stream = await navigator.mediaDevices.getUserMedia({
2355
+ audio: true
2356
+ });
2357
+ stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, {
2358
+ direction: "sendrecv"
2359
+ }));
2360
+ const offer = await peerConnection.createOffer();
2361
+ await peerConnection.setLocalDescription(offer);
2362
+ const AiServiceUrl = new URL("/rtc-connect", config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL);
2363
+ const response = await fetch(AiServiceUrl, {
2364
+ method: "POST",
2365
+ body: offer.sdp,
2366
+ headers: {
2367
+ "Content-Type": "application/sdp"
2368
+ }
2369
+ });
2370
+ const answer = await response.text();
2371
+ await peerConnection.setRemoteDescription({
2372
+ sdp: answer,
2373
+ type: "answer"
2374
+ });
2375
+ const dataChannel = peerConnection.createDataChannel("response");
2376
+ const configureData = () => {
2377
+ log2.info("Configuring data channel", void 0, {
2378
+ F: __dxlog_file7,
2379
+ L: 87,
2380
+ S: void 0,
2381
+ C: (f, a) => f(...a)
2493
2382
  });
2494
- stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, {
2495
- direction: "sendrecv"
2496
- }));
2497
- const offer = await peerConnection.createOffer();
2498
- await peerConnection.setLocalDescription(offer);
2499
- const AiServiceUrl = new URL("/rtc-connect", config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL);
2500
- const response = await fetch(AiServiceUrl, {
2501
- method: "POST",
2502
- body: offer.sdp,
2503
- headers: {
2504
- "Content-Type": "application/sdp"
2383
+ const event = {
2384
+ type: "session.update",
2385
+ session: {
2386
+ modalities: [
2387
+ "text",
2388
+ "audio"
2389
+ ],
2390
+ // Provide the tools. Note they match the keys in the `fns` object above
2391
+ tools: []
2505
2392
  }
2506
- });
2507
- const answer = await response.text();
2508
- await peerConnection.setRemoteDescription({
2509
- sdp: answer,
2510
- type: "answer"
2511
- });
2512
- const dataChannel = peerConnection.createDataChannel("response");
2513
- const configureData = () => {
2514
- log2.info("Configuring data channel", void 0, {
2515
- F: __dxlog_file7,
2516
- L: 87,
2517
- S: void 0,
2518
- C: (f, a) => f(...a)
2519
- });
2520
- const event = {
2521
- type: "session.update",
2522
- session: {
2523
- modalities: [
2524
- "text",
2525
- "audio"
2526
- ],
2527
- // Provide the tools. Note they match the keys in the `fns` object above
2528
- tools: []
2529
- }
2530
- };
2531
- dataChannel.send(JSON.stringify(event));
2532
2393
  };
2533
- dataChannel.addEventListener("open", (ev) => {
2534
- log2.info("Opening data channel", {
2535
- ev
2536
- }, {
2537
- F: __dxlog_file7,
2538
- L: 100,
2539
- S: void 0,
2540
- C: (f, a) => f(...a)
2541
- });
2542
- configureData();
2543
- });
2544
- dataChannel.addEventListener("message", async (ev) => {
2545
- const msg = JSON.parse(ev.data);
2546
- if (msg.type === "response.function_call_arguments.done") {
2547
- }
2548
- });
2549
- } catch (error) {
2550
- log2.error("Error in realtime session:", {
2551
- error
2394
+ dataChannel.send(JSON.stringify(event));
2395
+ };
2396
+ dataChannel.addEventListener("open", (ev) => {
2397
+ log2.info("Opening data channel", {
2398
+ ev
2552
2399
  }, {
2553
2400
  F: __dxlog_file7,
2554
- L: 140,
2401
+ L: 100,
2555
2402
  S: void 0,
2556
2403
  C: (f, a) => f(...a)
2557
2404
  });
2558
- throw error;
2559
- }
2560
- };
2561
- return /* @__PURE__ */ React27.createElement("div", {
2562
- className: "flex w-full justify-center items-center"
2563
- }, /* @__PURE__ */ React27.createElement(Icon5, {
2564
- icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2565
- size: 16,
2566
- classNames: !isLive && "cursor-pointer",
2567
- onClick: start
2568
- }));
2569
- } finally {
2570
- _effect.f();
2571
- }
2405
+ configureData();
2406
+ });
2407
+ dataChannel.addEventListener("message", async (ev) => {
2408
+ const msg = JSON.parse(ev.data);
2409
+ if (msg.type === "response.function_call_arguments.done") {
2410
+ }
2411
+ });
2412
+ } catch (error) {
2413
+ log2.error("Error in realtime session:", {
2414
+ error
2415
+ }, {
2416
+ F: __dxlog_file7,
2417
+ L: 140,
2418
+ S: void 0,
2419
+ C: (f, a) => f(...a)
2420
+ });
2421
+ throw error;
2422
+ }
2423
+ };
2424
+ return /* @__PURE__ */ React27.createElement("div", {
2425
+ className: "flex w-full justify-center items-center"
2426
+ }, /* @__PURE__ */ React27.createElement(Icon5, {
2427
+ icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2428
+ size: 16,
2429
+ classNames: !isLive && "cursor-pointer",
2430
+ onClick: start
2431
+ }));
2572
2432
  };
2573
2433
  var gptRealtimeShape = {
2574
2434
  type: "gpt-realtime",
@@ -2648,9 +2508,10 @@ var computeShapes = [
2648
2508
 
2649
2509
  // src/compute-layout.ts
2650
2510
  import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
2651
- import { toEffectSchema } from "@dxos/echo-schema";
2511
+ import { toEffectSchema } from "@dxos/echo/internal";
2652
2512
  import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
2653
2513
  var ComputeShapeLayout = class extends ShapeLayout {
2514
+ _controller;
2654
2515
  constructor(_controller, registry2) {
2655
2516
  super(registry2), this._controller = _controller;
2656
2517
  }