@dxos/react-ui-canvas-compute 0.8.2-staging.7ac8446 → 0.8.2

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 (106) hide show
  1. package/dist/lib/browser/index.mjs +1022 -836
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +1040 -854
  5. package/dist/lib/node/index.cjs.map +3 -3
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +1022 -836
  8. package/dist/lib/node-esm/index.mjs.map +3 -3
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
  11. package/dist/types/src/graph/controller.d.ts +2 -18
  12. package/dist/types/src/graph/controller.d.ts.map +1 -1
  13. package/dist/types/src/graph/node-defs.d.ts.map +1 -1
  14. package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
  15. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  16. package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
  17. package/dist/types/src/json.test.d.ts +18 -18
  18. package/dist/types/src/json.test.d.ts.map +1 -1
  19. package/dist/types/src/shapes/Append.d.ts +19 -19
  20. package/dist/types/src/shapes/Append.d.ts.map +1 -1
  21. package/dist/types/src/shapes/Array.d.ts +19 -19
  22. package/dist/types/src/shapes/Array.d.ts.map +1 -1
  23. package/dist/types/src/shapes/Audio.d.ts +19 -19
  24. package/dist/types/src/shapes/Audio.d.ts.map +1 -1
  25. package/dist/types/src/shapes/Beacon.d.ts +19 -19
  26. package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
  27. package/dist/types/src/shapes/Boolean.d.ts +70 -70
  28. package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
  29. package/dist/types/src/shapes/Chat.d.ts +19 -19
  30. package/dist/types/src/shapes/Chat.d.ts.map +1 -1
  31. package/dist/types/src/shapes/Constant.d.ts +20 -20
  32. package/dist/types/src/shapes/Constant.d.ts.map +1 -1
  33. package/dist/types/src/shapes/Database.d.ts +19 -19
  34. package/dist/types/src/shapes/Database.d.ts.map +1 -1
  35. package/dist/types/src/shapes/Function.d.ts +19 -19
  36. package/dist/types/src/shapes/Function.d.ts.map +1 -1
  37. package/dist/types/src/shapes/Gpt.d.ts +19 -19
  38. package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
  39. package/dist/types/src/shapes/GptRealtime.d.ts +19 -19
  40. package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
  41. package/dist/types/src/shapes/Json.d.ts +37 -37
  42. package/dist/types/src/shapes/Json.d.ts.map +1 -1
  43. package/dist/types/src/shapes/Logic.d.ts +37 -37
  44. package/dist/types/src/shapes/Logic.d.ts.map +1 -1
  45. package/dist/types/src/shapes/Queue.d.ts +19 -19
  46. package/dist/types/src/shapes/Queue.d.ts.map +1 -1
  47. package/dist/types/src/shapes/RNG.d.ts +21 -21
  48. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  49. package/dist/types/src/shapes/Scope.d.ts +19 -19
  50. package/dist/types/src/shapes/Scope.d.ts.map +1 -1
  51. package/dist/types/src/shapes/Surface.d.ts +19 -19
  52. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  53. package/dist/types/src/shapes/Switch.d.ts +19 -19
  54. package/dist/types/src/shapes/Switch.d.ts.map +1 -1
  55. package/dist/types/src/shapes/Table.d.ts +19 -19
  56. package/dist/types/src/shapes/Table.d.ts.map +1 -1
  57. package/dist/types/src/shapes/Template.d.ts +20 -20
  58. package/dist/types/src/shapes/Template.d.ts.map +1 -1
  59. package/dist/types/src/shapes/Text.d.ts +19 -19
  60. package/dist/types/src/shapes/Text.d.ts.map +1 -1
  61. package/dist/types/src/shapes/TextToImage.d.ts +19 -19
  62. package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
  63. package/dist/types/src/shapes/Thread.d.ts +19 -19
  64. package/dist/types/src/shapes/Thread.d.ts.map +1 -1
  65. package/dist/types/src/shapes/Trigger.d.ts +47 -45
  66. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  67. package/dist/types/src/shapes/common/FunctionBody.d.ts +5 -5
  68. package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
  69. package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
  70. package/dist/types/src/shapes/defs.d.ts +18 -19
  71. package/dist/types/src/shapes/defs.d.ts.map +1 -1
  72. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +42 -40
  75. package/src/compute.stories.tsx +3 -3
  76. package/src/graph/controller.ts +12 -12
  77. package/src/hooks/useComputeNodeState.ts +3 -3
  78. package/src/hooks/useGraphMonitor.ts +3 -5
  79. package/src/json.test.ts +10 -10
  80. package/src/schema.test.ts +7 -7
  81. package/src/shapes/Append.tsx +5 -5
  82. package/src/shapes/Array.tsx +5 -5
  83. package/src/shapes/Audio.tsx +5 -5
  84. package/src/shapes/Beacon.tsx +5 -5
  85. package/src/shapes/Boolean.tsx +5 -5
  86. package/src/shapes/Chat.tsx +5 -5
  87. package/src/shapes/Constant.tsx +6 -6
  88. package/src/shapes/Database.tsx +5 -5
  89. package/src/shapes/Function.tsx +8 -7
  90. package/src/shapes/Gpt.tsx +6 -6
  91. package/src/shapes/GptRealtime.tsx +8 -8
  92. package/src/shapes/Json.tsx +9 -9
  93. package/src/shapes/Logic.tsx +9 -9
  94. package/src/shapes/Queue.tsx +5 -5
  95. package/src/shapes/RNG.tsx +7 -7
  96. package/src/shapes/Scope.tsx +5 -5
  97. package/src/shapes/Surface.tsx +5 -5
  98. package/src/shapes/Switch.tsx +5 -5
  99. package/src/shapes/Table.tsx +6 -6
  100. package/src/shapes/Template.tsx +8 -7
  101. package/src/shapes/Text.tsx +5 -5
  102. package/src/shapes/TextToImage.tsx +5 -5
  103. package/src/shapes/Thread.tsx +6 -6
  104. package/src/shapes/Trigger.tsx +32 -33
  105. package/src/shapes/common/FunctionBody.tsx +11 -9
  106. package/src/shapes/defs.ts +9 -9
@@ -179,145 +179,174 @@ var import_invariant = require("@dxos/invariant");
179
179
  var import_react = require("react");
180
180
  var import_debug2 = require("@dxos/debug");
181
181
  var import_react2 = require("react");
182
+ var import_effect2 = require("effect");
182
183
  var import_react3 = require("react");
183
- var import_echo_schema2 = require("@dxos/echo-schema");
184
184
  var import_invariant2 = require("@dxos/invariant");
185
185
  var import_react4 = require("react");
186
186
  var import_conductor3 = require("@dxos/conductor");
187
- var import_echo_schema3 = require("@dxos/echo-schema");
187
+ var import_echo_schema2 = require("@dxos/echo-schema");
188
188
  var import_invariant3 = require("@dxos/invariant");
189
- var import_keys = require("@dxos/keys");
190
189
  var import_echo = require("@dxos/react-client/echo");
191
190
  var import_util = require("@dxos/util");
192
191
  var import_react_ui_canvas_editor = require("@dxos/react-ui-canvas-editor");
192
+ var import_tracking = require("@preact-signals/safe-react/tracking");
193
193
  var import_react5 = __toESM(require("react"));
194
194
  var import_invariant4 = require("@dxos/invariant");
195
195
  var import_react_ui = require("@dxos/react-ui");
196
196
  var import_react_ui_canvas_editor2 = require("@dxos/react-ui-canvas-editor");
197
197
  var import_react_ui_theme = require("@dxos/react-ui-theme");
198
+ var import_tracking2 = require("@preact-signals/safe-react/tracking");
199
+ var import_effect3 = require("effect");
198
200
  var import_react6 = __toESM(require("react"));
199
201
  var import_conductor4 = require("@dxos/conductor");
200
- var import_echo_schema4 = require("@dxos/echo-schema");
201
202
  var import_react_ui_canvas = require("@dxos/react-ui-canvas");
202
203
  var import_react_ui_canvas_editor3 = require("@dxos/react-ui-canvas-editor");
203
- var import_effect2 = require("effect");
204
+ var import_effect4 = require("effect");
204
205
  var import_conductor5 = require("@dxos/conductor");
205
- var import_echo_schema5 = require("@dxos/echo-schema");
206
+ var import_echo_schema3 = require("@dxos/echo-schema");
206
207
  var import_react_ui_canvas_editor4 = require("@dxos/react-ui-canvas-editor");
208
+ var import_tracking3 = require("@preact-signals/safe-react/tracking");
207
209
  var import_react7 = __toESM(require("react"));
208
210
  var import_conductor6 = require("@dxos/conductor");
209
211
  var import_react_ui2 = require("@dxos/react-ui");
212
+ var import_tracking4 = require("@preact-signals/safe-react/tracking");
213
+ var import_effect5 = require("effect");
210
214
  var import_react8 = __toESM(require("react"));
211
215
  var import_conductor7 = require("@dxos/conductor");
212
- var import_echo_schema6 = require("@dxos/echo-schema");
216
+ var import_tracking5 = require("@preact-signals/safe-react/tracking");
217
+ var import_effect6 = require("effect");
213
218
  var import_react9 = __toESM(require("react"));
214
219
  var import_conductor8 = require("@dxos/conductor");
215
- var import_echo_schema7 = require("@dxos/echo-schema");
220
+ var import_tracking6 = require("@preact-signals/safe-react/tracking");
221
+ var import_effect7 = require("effect");
216
222
  var import_react10 = __toESM(require("react"));
217
- var import_echo_schema8 = require("@dxos/echo-schema");
218
223
  var import_react_ui3 = require("@dxos/react-ui");
219
224
  var import_react_ui_canvas_editor5 = require("@dxos/react-ui-canvas-editor");
225
+ var import_tracking7 = require("@preact-signals/safe-react/tracking");
226
+ var import_effect8 = require("effect");
220
227
  var import_react11 = __toESM(require("react"));
221
228
  var import_conductor9 = require("@dxos/conductor");
222
- var import_echo_schema9 = require("@dxos/echo-schema");
223
229
  var import_react_ui4 = require("@dxos/react-ui");
224
230
  var import_react_ui_canvas_editor6 = require("@dxos/react-ui-canvas-editor");
225
231
  var import_react_ui_theme2 = require("@dxos/react-ui-theme");
232
+ var import_tracking8 = require("@preact-signals/safe-react/tracking");
233
+ var import_effect9 = require("effect");
226
234
  var import_react12 = __toESM(require("react"));
227
- var import_echo_schema10 = require("@dxos/echo-schema");
228
235
  var import_react_ui_canvas_editor7 = require("@dxos/react-ui-canvas-editor");
236
+ var import_tracking9 = require("@preact-signals/safe-react/tracking");
237
+ var import_effect10 = require("effect");
229
238
  var import_react13 = __toESM(require("react"));
230
239
  var import_conductor10 = require("@dxos/conductor");
231
- var import_echo_schema11 = require("@dxos/echo-schema");
232
240
  var import_react_ui_canvas_editor8 = require("@dxos/react-ui-canvas-editor");
233
241
  var import_react_ui_canvas_editor9 = require("@dxos/react-ui-canvas-editor");
242
+ var import_tracking10 = require("@preact-signals/safe-react/tracking");
243
+ var import_effect11 = require("effect");
234
244
  var import_react14 = __toESM(require("react"));
235
245
  var import_conductor11 = require("@dxos/conductor");
236
- var import_echo_schema12 = require("@dxos/echo-schema");
237
246
  var import_react_ui5 = require("@dxos/react-ui");
238
247
  var import_react_ui_canvas_editor10 = require("@dxos/react-ui-canvas-editor");
239
248
  var import_react_ui_canvas_editor11 = require("@dxos/react-ui-canvas-editor");
240
249
  var import_util2 = require("@dxos/util");
250
+ var import_tracking11 = require("@preact-signals/safe-react/tracking");
251
+ var import_effect12 = require("effect");
241
252
  var import_react15 = __toESM(require("react"));
242
- var import_echo_schema13 = require("@dxos/echo-schema");
243
253
  var import_react_ui_canvas_editor12 = require("@dxos/react-ui-canvas-editor");
254
+ var import_tracking12 = require("@preact-signals/safe-react/tracking");
255
+ var import_effect13 = require("effect");
244
256
  var import_react16 = __toESM(require("react"));
245
257
  var import_conductor12 = require("@dxos/conductor");
246
- var import_echo_schema14 = require("@dxos/echo-schema");
247
- var import_types = require("@dxos/functions/types");
258
+ var import_echo_schema4 = require("@dxos/echo-schema");
259
+ var import_functions = require("@dxos/functions");
248
260
  var import_react_client = require("@dxos/react-client");
249
261
  var import_echo2 = require("@dxos/react-client/echo");
250
262
  var import_react_ui_canvas_editor13 = require("@dxos/react-ui-canvas-editor");
263
+ var import_tracking13 = require("@preact-signals/safe-react/tracking");
264
+ var import_effect14 = require("effect");
251
265
  var import_react17 = __toESM(require("react"));
252
266
  var import_conductor13 = require("@dxos/conductor");
253
- var import_echo_schema15 = require("@dxos/echo-schema");
267
+ var import_tracking14 = require("@preact-signals/safe-react/tracking");
268
+ var import_effect15 = require("effect");
254
269
  var import_react18 = __toESM(require("react"));
255
270
  var import_conductor14 = require("@dxos/conductor");
256
- var import_echo_schema16 = require("@dxos/echo-schema");
257
271
  var import_react_ui_canvas_editor14 = require("@dxos/react-ui-canvas-editor");
258
272
  var import_react_ui_syntax_highlighter = require("@dxos/react-ui-syntax-highlighter");
273
+ var import_tracking15 = require("@preact-signals/safe-react/tracking");
274
+ var import_effect16 = require("effect");
259
275
  var import_react19 = __toESM(require("react"));
260
276
  var import_conductor15 = require("@dxos/conductor");
261
- var import_echo_schema17 = require("@dxos/echo-schema");
277
+ var import_tracking16 = require("@preact-signals/safe-react/tracking");
278
+ var import_effect17 = require("effect");
262
279
  var import_react20 = __toESM(require("react"));
263
280
  var import_conductor16 = require("@dxos/conductor");
264
- var import_echo_schema18 = require("@dxos/echo-schema");
265
281
  var import_react_ui_theme3 = require("@dxos/react-ui-theme");
282
+ var import_tracking17 = require("@preact-signals/safe-react/tracking");
283
+ var import_effect18 = require("effect");
266
284
  var import_react21 = __toESM(require("react"));
267
285
  var import_conductor17 = require("@dxos/conductor");
268
- var import_echo_schema19 = require("@dxos/echo-schema");
269
286
  var import_react_ui6 = require("@dxos/react-ui");
270
287
  var import_react_ui_canvas_editor15 = require("@dxos/react-ui-canvas-editor");
271
288
  var import_react_ui_theme4 = require("@dxos/react-ui-theme");
289
+ var import_tracking18 = require("@preact-signals/safe-react/tracking");
290
+ var import_effect19 = require("effect");
272
291
  var import_react22 = __toESM(require("react"));
273
292
  var import_conductor18 = require("@dxos/conductor");
274
- var import_echo_schema20 = require("@dxos/echo-schema");
275
293
  var import_react_ui_canvas_editor16 = require("@dxos/react-ui-canvas-editor");
276
294
  var import_react_ui_sfx = require("@dxos/react-ui-sfx");
295
+ var import_tracking19 = require("@preact-signals/safe-react/tracking");
296
+ var import_effect20 = require("effect");
277
297
  var import_react23 = __toESM(require("react"));
278
298
  var import_app_framework = require("@dxos/app-framework");
279
299
  var import_conductor19 = require("@dxos/conductor");
280
- var import_echo_schema21 = require("@dxos/echo-schema");
281
300
  var import_react_ui_canvas_editor17 = require("@dxos/react-ui-canvas-editor");
301
+ var import_tracking20 = require("@preact-signals/safe-react/tracking");
302
+ var import_effect21 = require("effect");
282
303
  var import_react24 = __toESM(require("react"));
283
304
  var import_conductor20 = require("@dxos/conductor");
284
- var import_echo_schema22 = require("@dxos/echo-schema");
285
305
  var import_react_ui7 = require("@dxos/react-ui");
286
306
  var import_react_ui_canvas_editor18 = require("@dxos/react-ui-canvas-editor");
307
+ var import_tracking21 = require("@preact-signals/safe-react/tracking");
308
+ var import_effect22 = require("effect");
287
309
  var import_react25 = __toESM(require("react"));
288
310
  var import_conductor21 = require("@dxos/conductor");
289
- var import_echo_schema23 = require("@dxos/echo-schema");
311
+ var import_tracking22 = require("@preact-signals/safe-react/tracking");
312
+ var import_effect23 = require("effect");
290
313
  var import_react26 = __toESM(require("react"));
291
314
  var import_conductor22 = require("@dxos/conductor");
292
- var import_echo_schema24 = require("@dxos/echo-schema");
315
+ var import_echo_schema5 = require("@dxos/echo-schema");
293
316
  var import_invariant5 = require("@dxos/invariant");
294
317
  var import_react_ui_canvas_editor19 = require("@dxos/react-ui-canvas-editor");
318
+ var import_tracking23 = require("@preact-signals/safe-react/tracking");
319
+ var import_effect24 = require("effect");
295
320
  var import_react27 = __toESM(require("react"));
296
321
  var import_conductor23 = require("@dxos/conductor");
297
- var import_echo_schema25 = require("@dxos/echo-schema");
298
322
  var import_react_ui_canvas_editor20 = require("@dxos/react-ui-canvas-editor");
299
323
  var import_react_ui_canvas_editor21 = require("@dxos/react-ui-canvas-editor");
324
+ var import_tracking24 = require("@preact-signals/safe-react/tracking");
325
+ var import_effect25 = require("effect");
300
326
  var import_react28 = __toESM(require("react"));
301
327
  var import_conductor24 = require("@dxos/conductor");
302
- var import_echo_schema26 = require("@dxos/echo-schema");
303
328
  var import_react_ui_theme5 = require("@dxos/react-ui-theme");
329
+ var import_tracking25 = require("@preact-signals/safe-react/tracking");
330
+ var import_effect26 = require("effect");
304
331
  var import_react29 = __toESM(require("react"));
305
- var import_echo_schema27 = require("@dxos/echo-schema");
306
332
  var import_react_ui_canvas_editor22 = require("@dxos/react-ui-canvas-editor");
333
+ var import_tracking26 = require("@preact-signals/safe-react/tracking");
334
+ var import_effect27 = require("effect");
307
335
  var import_react30 = __toESM(require("react"));
308
336
  var import_conductor25 = require("@dxos/conductor");
309
- var import_echo_schema28 = require("@dxos/echo-schema");
310
- var import_types2 = require("@dxos/functions/types");
311
- var import_keys2 = require("@dxos/keys");
337
+ var import_echo_schema6 = require("@dxos/echo-schema");
338
+ var import_functions2 = require("@dxos/functions");
339
+ var import_keys = require("@dxos/keys");
312
340
  var import_echo3 = require("@dxos/react-client/echo");
313
341
  var import_react_ui8 = require("@dxos/react-ui");
342
+ var import_tracking27 = require("@preact-signals/safe-react/tracking");
343
+ var import_effect28 = require("effect");
314
344
  var import_react31 = __toESM(require("react"));
315
- var import_echo_schema29 = require("@dxos/echo-schema");
316
345
  var import_log2 = require("@dxos/log");
317
346
  var import_react_client2 = require("@dxos/react-client");
318
347
  var import_react_ui9 = require("@dxos/react-ui");
319
348
  var import_conductor26 = require("@dxos/conductor");
320
- var import_echo_schema30 = require("@dxos/echo-schema");
349
+ var import_echo_schema7 = require("@dxos/echo-schema");
321
350
  var import_react_ui_canvas_editor23 = require("@dxos/react-ui-canvas-editor");
322
351
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
323
352
  var resolveComputeNode = async (node) => {
@@ -494,8 +523,8 @@ var useComputeNodeState = (shape) => {
494
523
  return {
495
524
  node: controller.getComputeNode(shape.node),
496
525
  meta: meta ?? {
497
- input: import_echo_schema2.S.Struct({}),
498
- output: import_echo_schema2.S.Struct({})
526
+ input: import_effect2.Schema.Struct({}),
527
+ output: import_effect2.Schema.Struct({})
499
528
  },
500
529
  runtime: {
501
530
  inputs: controller.getInputs(shape.node),
@@ -514,7 +543,7 @@ var mapEdge = (graph, { source, target, output = import_conductor3.DEFAULT_OUTPU
514
543
  const targetNode = graph.findNode(target);
515
544
  (0, import_invariant3.invariant)(sourceNode?.node, void 0, {
516
545
  F: __dxlog_file3,
517
- L: 27,
546
+ L: 26,
518
547
  S: void 0,
519
548
  A: [
520
549
  "sourceNode?.node",
@@ -523,7 +552,7 @@ var mapEdge = (graph, { source, target, output = import_conductor3.DEFAULT_OUTPU
523
552
  });
524
553
  (0, import_invariant3.invariant)(targetNode?.node, void 0, {
525
554
  F: __dxlog_file3,
526
- L: 28,
555
+ L: 27,
527
556
  S: void 0,
528
557
  A: [
529
558
  "targetNode?.node",
@@ -531,7 +560,7 @@ var mapEdge = (graph, { source, target, output = import_conductor3.DEFAULT_OUTPU
531
560
  ]
532
561
  });
533
562
  return {
534
- id: import_echo_schema3.ObjectId.random(),
563
+ id: import_echo_schema2.ObjectId.random(),
535
564
  source: sourceNode.node,
536
565
  target: targetNode.node,
537
566
  output,
@@ -547,7 +576,7 @@ var useGraphMonitor = (model) => {
547
576
  }
548
577
  (0, import_invariant3.invariant)(node.type, void 0, {
549
578
  F: __dxlog_file3,
550
- L: 53,
579
+ L: 52,
551
580
  S: void 0,
552
581
  A: [
553
582
  "node.type",
@@ -605,16 +634,15 @@ var linkTriggerToCompute = (graph, computeNode, triggerData) => {
605
634
  const functionTrigger = triggerData.functionTrigger?.target;
606
635
  (0, import_invariant3.invariant)(functionTrigger, void 0, {
607
636
  F: __dxlog_file3,
608
- L: 116,
637
+ L: 115,
609
638
  S: void 0,
610
639
  A: [
611
640
  "functionTrigger",
612
641
  ""
613
642
  ]
614
643
  });
615
- functionTrigger.function = import_keys.DXN.fromLocalObjectId(graph.root.id).toString();
616
- functionTrigger.meta ??= {};
617
- functionTrigger.meta.computeNodeId = computeNode.id;
644
+ functionTrigger.function = import_echo_schema2.Ref.make(graph.root);
645
+ functionTrigger.inputNodeId = computeNode.id;
618
646
  };
619
647
  var deleteTriggerObjects = (computeGraph, deleted) => {
620
648
  const space = (0, import_echo.getSpace)(computeGraph.root);
@@ -652,19 +680,9 @@ var createComputeGraphController = (graph, services) => {
652
680
  };
653
681
  var ComputeGraphController = class extends import_context.Resource {
654
682
  constructor(_graph) {
655
- super();
656
- this._graph = _graph;
657
- this._executor = new import_conductor.GraphExecutor({
683
+ super(), this._graph = _graph, this._executor = new import_conductor.GraphExecutor({
658
684
  computeNodeResolver: (node) => resolveComputeNode(node)
659
- });
660
- this._diagnostics = [];
661
- this._services = {};
662
- this._forcedOutputs = {};
663
- this._runtimeStateInputs = {};
664
- this._runtimeStateOutputs = {};
665
- this.update = new import_async.Event();
666
- this.output = new import_async.Event();
667
- this.events = new import_async.Event();
685
+ }), this._diagnostics = [], this._services = {}, this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new import_async.Event(), this.output = new import_async.Event(), this.events = new import_async.Event();
668
686
  }
669
687
  toJSON() {
670
688
  return {
@@ -931,61 +949,66 @@ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-com
931
949
  var headerHeight = 32;
932
950
  var footerHeight = 32;
933
951
  var Box = /* @__PURE__ */ (0, import_react5.forwardRef)(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
934
- (0, import_invariant4.invariant)(shape.type, void 0, {
935
- F: __dxlog_file5,
936
- L: 30,
937
- S: void 0,
938
- A: [
939
- "shape.type",
940
- ""
941
- ]
942
- });
943
- const { icon, name, openable } = (0, import_react_ui_canvas_editor2.useShapeDef)(shape.type) ?? {
944
- icon: "ph--placeholder--regular"
945
- };
946
- const { debug } = (0, import_react_ui_canvas_editor2.useEditorContext)();
947
- return /* @__PURE__ */ import_react5.default.createElement("div", {
948
- ref: forwardedRef,
949
- className: "flex flex-col h-full w-full justify-between"
950
- }, /* @__PURE__ */ import_react5.default.createElement("div", {
951
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
952
- }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui.Icon, {
953
- icon,
954
- classNames: "mx-2"
955
- }), /* @__PURE__ */ import_react5.default.createElement("div", {
956
- className: "grow text-sm truncate"
957
- }, debug ? shape.type : name ?? shape.text ?? title), /* @__PURE__ */ import_react5.default.createElement(import_react_ui.IconButton, {
958
- classNames: "p-1 text-green-500",
959
- variant: "ghost",
960
- icon: "ph--play--regular",
961
- size: 4,
962
- label: "run",
963
- iconOnly: true,
964
- onDoubleClick: (ev) => ev.stopPropagation(),
965
- onClick: (ev) => {
966
- ev.stopPropagation();
967
- onAction?.("run");
968
- }
969
- })), /* @__PURE__ */ import_react5.default.createElement("div", {
970
- className: (0, import_react_ui_theme.mx)("flex flex-col h-full grow overflow-hidden", classNames)
971
- }, children), /* @__PURE__ */ import_react5.default.createElement("div", {
972
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
973
- }, /* @__PURE__ */ import_react5.default.createElement("div", {
974
- className: "grow px-2 text-sm truncate"
975
- }, debug ? shape.id : status), openable && /* @__PURE__ */ import_react5.default.createElement(import_react_ui.IconButton, {
976
- classNames: "p-1",
977
- variant: "ghost",
978
- icon: open ? "ph--caret-up--regular" : "ph--caret-down--regular",
979
- size: 4,
980
- label: open ? "close" : "open",
981
- iconOnly: true,
982
- onClick: (ev) => {
983
- ev.stopPropagation();
984
- onAction?.(open ? "close" : "open");
985
- }
986
- })));
952
+ var _effect = (0, import_tracking.useSignals)();
953
+ try {
954
+ (0, import_invariant4.invariant)(shape.type, void 0, {
955
+ F: __dxlog_file5,
956
+ L: 30,
957
+ S: void 0,
958
+ A: [
959
+ "shape.type",
960
+ ""
961
+ ]
962
+ });
963
+ const { icon, name, openable } = (0, import_react_ui_canvas_editor2.useShapeDef)(shape.type) ?? {
964
+ icon: "ph--placeholder--regular"
965
+ };
966
+ const { debug } = (0, import_react_ui_canvas_editor2.useEditorContext)();
967
+ return /* @__PURE__ */ import_react5.default.createElement("div", {
968
+ ref: forwardedRef,
969
+ className: "flex flex-col h-full w-full justify-between"
970
+ }, /* @__PURE__ */ import_react5.default.createElement("div", {
971
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
972
+ }, /* @__PURE__ */ import_react5.default.createElement(import_react_ui.Icon, {
973
+ icon,
974
+ classNames: "mx-2"
975
+ }), /* @__PURE__ */ import_react5.default.createElement("div", {
976
+ className: "grow text-sm truncate"
977
+ }, debug ? shape.type : name ?? shape.text ?? title), /* @__PURE__ */ import_react5.default.createElement(import_react_ui.IconButton, {
978
+ classNames: "p-1 text-green-500",
979
+ variant: "ghost",
980
+ icon: "ph--play--regular",
981
+ size: 4,
982
+ label: "run",
983
+ iconOnly: true,
984
+ onDoubleClick: (ev) => ev.stopPropagation(),
985
+ onClick: (ev) => {
986
+ ev.stopPropagation();
987
+ onAction?.("run");
988
+ }
989
+ })), /* @__PURE__ */ import_react5.default.createElement("div", {
990
+ className: (0, import_react_ui_theme.mx)("flex flex-col h-full grow overflow-hidden", classNames)
991
+ }, children), /* @__PURE__ */ import_react5.default.createElement("div", {
992
+ className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
993
+ }, /* @__PURE__ */ import_react5.default.createElement("div", {
994
+ className: "grow px-2 text-sm truncate"
995
+ }, debug ? shape.id : status), openable && /* @__PURE__ */ import_react5.default.createElement(import_react_ui.IconButton, {
996
+ classNames: "p-1",
997
+ variant: "ghost",
998
+ icon: open ? "ph--caret-up--regular" : "ph--caret-down--regular",
999
+ size: 4,
1000
+ label: open ? "close" : "open",
1001
+ iconOnly: true,
1002
+ onClick: (ev) => {
1003
+ ev.stopPropagation();
1004
+ onAction?.(open ? "close" : "open");
1005
+ }
1006
+ })));
1007
+ } finally {
1008
+ _effect.f();
1009
+ }
987
1010
  });
988
- var getProperties = (ast) => import_effect2.SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
1011
+ var getProperties = (ast) => import_effect4.SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
989
1012
  name: name.toString()
990
1013
  }));
991
1014
  var createAnchorId = (kind, property = kind === "input" ? import_conductor5.DEFAULT_INPUT : import_conductor5.DEFAULT_OUTPUT) => [
@@ -999,88 +1022,93 @@ var parseAnchorId = (id) => {
999
1022
  id
1000
1023
  ];
1001
1024
  };
1002
- var ComputeShape = import_echo_schema5.S.extend(import_react_ui_canvas_editor4.Polygon, import_echo_schema5.S.Struct({
1025
+ var ComputeShape = import_effect4.Schema.extend(import_react_ui_canvas_editor4.Polygon, import_effect4.Schema.Struct({
1003
1026
  // TODO(burdon): Rename computeNode?
1004
- node: import_echo_schema5.S.optional(import_echo_schema5.ObjectId.annotations({
1005
- [import_effect2.SchemaAST.DescriptionAnnotationId]: "Compute node id"
1027
+ node: import_effect4.Schema.optional(import_echo_schema3.ObjectId.annotations({
1028
+ description: "Compute node id"
1006
1029
  }))
1007
- }).pipe(import_echo_schema5.S.mutable));
1030
+ }).pipe(import_effect4.Schema.mutable));
1008
1031
  var createShape = ({ id, ...rest }) => {
1009
1032
  return {
1010
- id: id ?? import_echo_schema5.ObjectId.random(),
1033
+ id: id ?? import_echo_schema3.ObjectId.random(),
1011
1034
  ...rest
1012
1035
  };
1013
1036
  };
1014
1037
  var bodyPadding = 8;
1015
1038
  var expandedHeight = 200;
1016
1039
  var FunctionBody = ({ shape, name, content, inputSchema = import_conductor4.VoidInput, outputSchema = import_conductor4.VoidOutput, ...props }) => {
1017
- const { scale } = (0, import_react_ui_canvas.useCanvasContext)();
1018
- const rootRef = (0, import_react6.useRef)(null);
1019
- const [open, setOpen] = (0, import_react6.useState)(false);
1020
- const handleAction = (action) => {
1021
- if (!rootRef.current) {
1022
- return;
1023
- }
1024
- switch (action) {
1025
- case "open": {
1026
- const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
1027
- const { height } = el.getBoundingClientRect();
1028
- el.style.height = `${height / scale + expandedHeight}px`;
1029
- setOpen(true);
1030
- break;
1040
+ var _effect = (0, import_tracking2.useSignals)();
1041
+ try {
1042
+ const { scale } = (0, import_react_ui_canvas.useCanvasContext)();
1043
+ const rootRef = (0, import_react6.useRef)(null);
1044
+ const [open, setOpen] = (0, import_react6.useState)(false);
1045
+ const handleAction = (action) => {
1046
+ if (!rootRef.current) {
1047
+ return;
1031
1048
  }
1032
- case "close": {
1033
- const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
1034
- el.style.height = "";
1035
- setOpen(false);
1036
- break;
1049
+ switch (action) {
1050
+ case "open": {
1051
+ const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
1052
+ const { height } = el.getBoundingClientRect();
1053
+ el.style.height = `${height / scale + expandedHeight}px`;
1054
+ setOpen(true);
1055
+ break;
1056
+ }
1057
+ case "close": {
1058
+ const el = (0, import_react_ui_canvas_editor3.getParentShapeElement)(rootRef.current, shape.id);
1059
+ el.style.height = "";
1060
+ setOpen(false);
1061
+ break;
1062
+ }
1037
1063
  }
1038
- }
1039
- };
1040
- const inputs = getProperties(inputSchema.ast);
1041
- const outputs = getProperties(outputSchema.ast);
1042
- const columnCount = inputs.length && outputs.length ? 2 : 1;
1043
- return /* @__PURE__ */ import_react6.default.createElement(Box, {
1044
- ref: rootRef,
1045
- shape,
1046
- title: name,
1047
- classNames: "divide-y divide-separator",
1048
- open,
1049
- onAction: handleAction,
1050
- ...props
1051
- }, /* @__PURE__ */ import_react6.default.createElement("div", {
1052
- className: `grid grid-cols-${columnCount} items-center`,
1053
- style: {
1054
- paddingTop: bodyPadding,
1055
- paddingBottom: bodyPadding
1056
- }
1057
- }, (inputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react6.default.createElement("div", {
1058
- className: "flex flex-col"
1059
- }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react6.default.createElement("div", {
1060
- key: name2,
1061
- className: "px-2 truncate text-sm font-mono items-center",
1062
- style: {
1063
- height: import_react_ui_canvas_editor3.rowHeight
1064
- }
1065
- }, name2))), (outputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react6.default.createElement("div", {
1066
- className: "flex flex-col"
1067
- }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react6.default.createElement("div", {
1068
- key: name2,
1069
- className: "px-2 truncate text-sm font-mono items-center text-right",
1070
- style: {
1071
- height: import_react_ui_canvas_editor3.rowHeight
1072
- }
1073
- }, name2)))), open && /* @__PURE__ */ import_react6.default.createElement("div", {
1074
- className: "flex flex-col grow overflow-hidden"
1075
- }, content));
1064
+ };
1065
+ const inputs = getProperties(inputSchema.ast);
1066
+ const outputs = getProperties(outputSchema.ast);
1067
+ const columnCount = inputs.length && outputs.length ? 2 : 1;
1068
+ return /* @__PURE__ */ import_react6.default.createElement(Box, {
1069
+ ref: rootRef,
1070
+ shape,
1071
+ title: name,
1072
+ classNames: "divide-y divide-separator",
1073
+ open,
1074
+ onAction: handleAction,
1075
+ ...props
1076
+ }, /* @__PURE__ */ import_react6.default.createElement("div", {
1077
+ className: `grid grid-cols-${columnCount} items-center`,
1078
+ style: {
1079
+ paddingTop: bodyPadding,
1080
+ paddingBottom: bodyPadding
1081
+ }
1082
+ }, (inputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react6.default.createElement("div", {
1083
+ className: "flex flex-col"
1084
+ }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react6.default.createElement("div", {
1085
+ key: name2,
1086
+ className: "px-2 truncate text-sm font-mono items-center",
1087
+ style: {
1088
+ height: import_react_ui_canvas_editor3.rowHeight
1089
+ }
1090
+ }, name2))), (outputs?.length ?? 0) > 0 && /* @__PURE__ */ import_react6.default.createElement("div", {
1091
+ className: "flex flex-col"
1092
+ }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ import_react6.default.createElement("div", {
1093
+ key: name2,
1094
+ className: "px-2 truncate text-sm font-mono items-center text-right",
1095
+ style: {
1096
+ height: import_react_ui_canvas_editor3.rowHeight
1097
+ }
1098
+ }, name2)))), open && /* @__PURE__ */ import_react6.default.createElement("div", {
1099
+ className: "flex flex-col grow overflow-hidden"
1100
+ }, content));
1101
+ } finally {
1102
+ _effect.f();
1103
+ }
1076
1104
  };
1077
1105
  var getHeight = (input) => {
1078
- const properties = import_echo_schema4.AST.getPropertySignatures(input.ast);
1106
+ const properties = import_effect3.SchemaAST.getPropertySignatures(input.ast);
1079
1107
  return headerHeight + footerHeight + bodyPadding * 2 + properties.length * import_react_ui_canvas_editor3.rowHeight + 2;
1080
1108
  };
1081
1109
  var createFunctionAnchors = (shape, input = import_conductor4.VoidInput, output = import_conductor4.VoidOutput) => {
1082
- const inputs = import_echo_schema4.AST.getPropertySignatures(input.ast).map(({ name }) => createAnchorId("input", name.toString()));
1083
- const outputs = import_echo_schema4.AST.getPropertySignatures(output.ast).map(({ name }) => createAnchorId("output", name.toString()));
1110
+ const inputs = import_effect3.SchemaAST.getPropertySignatures(input.ast).map(({ name }) => createAnchorId("input", name.toString()));
1111
+ const outputs = import_effect3.SchemaAST.getPropertySignatures(output.ast).map(({ name }) => createAnchorId("output", name.toString()));
1084
1112
  return (0, import_react_ui_canvas_editor3.createAnchors)({
1085
1113
  shape,
1086
1114
  inputs,
@@ -1092,26 +1120,36 @@ var createFunctionAnchors = (shape, input = import_conductor4.VoidInput, output
1092
1120
  });
1093
1121
  };
1094
1122
  var TypeSelect = ({ value, onValueChange }) => {
1095
- return /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Root, {
1096
- value,
1097
- onValueChange
1098
- }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.TriggerButton, {
1099
- variant: "ghost",
1100
- classNames: "w-full !px-0"
1101
- }), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Portal, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Content, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.ScrollUpButton, null), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Viewport, null, import_conductor6.ComputeValueType.literals.map((type) => /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Option, {
1102
- key: type,
1103
- value: type
1104
- }, type))), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.ScrollDownButton, null), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Arrow, null))));
1105
- };
1106
- var ReducerShape = import_echo_schema6.S.extend(ComputeShape, import_echo_schema6.S.Struct({
1107
- type: import_echo_schema6.S.Literal("reducer")
1123
+ var _effect = (0, import_tracking3.useSignals)();
1124
+ try {
1125
+ return /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Root, {
1126
+ value,
1127
+ onValueChange
1128
+ }, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.TriggerButton, {
1129
+ variant: "ghost",
1130
+ classNames: "w-full !px-0"
1131
+ }), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Portal, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Content, null, /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.ScrollUpButton, null), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Viewport, null, import_conductor6.ComputeValueType.literals.map((type) => /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Option, {
1132
+ key: type,
1133
+ value: type
1134
+ }, type))), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.ScrollDownButton, null), /* @__PURE__ */ import_react7.default.createElement(import_react_ui2.Select.Arrow, null))));
1135
+ } finally {
1136
+ _effect.f();
1137
+ }
1138
+ };
1139
+ var ReducerShape = import_effect5.Schema.extend(ComputeShape, import_effect5.Schema.Struct({
1140
+ type: import_effect5.Schema.Literal("reducer")
1108
1141
  }));
1109
1142
  var ReducerComponent = ({ shape }) => {
1110
- return /* @__PURE__ */ import_react8.default.createElement(FunctionBody, {
1111
- shape,
1112
- inputSchema: import_conductor7.ReducerInput,
1113
- outputSchema: import_conductor7.ReducerOutput
1114
- });
1143
+ var _effect = (0, import_tracking4.useSignals)();
1144
+ try {
1145
+ return /* @__PURE__ */ import_react8.default.createElement(FunctionBody, {
1146
+ shape,
1147
+ inputSchema: import_conductor7.ReducerInput,
1148
+ outputSchema: import_conductor7.ReducerOutput
1149
+ });
1150
+ } finally {
1151
+ _effect.f();
1152
+ }
1115
1153
  };
1116
1154
  var createReducer = ({ id, size = {
1117
1155
  width: 192,
@@ -1129,8 +1167,8 @@ var reducerShape = {
1129
1167
  createShape: createReducer,
1130
1168
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor7.ReducerInput, import_conductor7.ReducerOutput)
1131
1169
  };
1132
- var AppendShape = import_echo_schema7.S.extend(ComputeShape, import_echo_schema7.S.Struct({
1133
- type: import_echo_schema7.S.Literal("append")
1170
+ var AppendShape = import_effect6.Schema.extend(ComputeShape, import_effect6.Schema.Struct({
1171
+ type: import_effect6.Schema.Literal("append")
1134
1172
  }));
1135
1173
  var createAppend = (props) => createShape({
1136
1174
  type: "append",
@@ -1141,10 +1179,15 @@ var createAppend = (props) => createShape({
1141
1179
  ...props
1142
1180
  });
1143
1181
  var AppendComponent = ({ shape }) => {
1144
- return /* @__PURE__ */ import_react9.default.createElement(FunctionBody, {
1145
- shape,
1146
- inputSchema: import_conductor8.AppendInput
1147
- });
1182
+ var _effect = (0, import_tracking5.useSignals)();
1183
+ try {
1184
+ return /* @__PURE__ */ import_react9.default.createElement(FunctionBody, {
1185
+ shape,
1186
+ inputSchema: import_conductor8.AppendInput
1187
+ });
1188
+ } finally {
1189
+ _effect.f();
1190
+ }
1148
1191
  };
1149
1192
  var appendShape = {
1150
1193
  type: "append",
@@ -1154,8 +1197,8 @@ var appendShape = {
1154
1197
  createShape: createAppend,
1155
1198
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor8.AppendInput)
1156
1199
  };
1157
- var AudioShape = import_echo_schema8.S.extend(ComputeShape, import_echo_schema8.S.Struct({
1158
- type: import_echo_schema8.S.Literal("audio")
1200
+ var AudioShape = import_effect7.Schema.extend(ComputeShape, import_effect7.Schema.Struct({
1201
+ type: import_effect7.Schema.Literal("audio")
1159
1202
  }));
1160
1203
  var createAudio = (props) => createShape({
1161
1204
  type: "audio",
@@ -1166,24 +1209,29 @@ var createAudio = (props) => createShape({
1166
1209
  ...props
1167
1210
  });
1168
1211
  var AudioComponent = ({ shape }) => {
1169
- const { node } = useComputeNodeState(shape);
1170
- const [active, setActive] = (0, import_react10.useState)(false);
1171
- (0, import_react10.useEffect)(() => {
1172
- node.value = active;
1173
- }, [
1174
- active
1175
- ]);
1176
- return /* @__PURE__ */ import_react10.default.createElement("div", {
1177
- className: "flex w-full justify-center items-center"
1178
- }, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Icon, {
1179
- icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
1180
- classNames: [
1181
- "transition opacity-20 duration-1000",
1182
- active && "opacity-100 text-red-500"
1183
- ],
1184
- size: 8,
1185
- onClick: () => setActive(!active)
1186
- }));
1212
+ var _effect = (0, import_tracking6.useSignals)();
1213
+ try {
1214
+ const { node } = useComputeNodeState(shape);
1215
+ const [active, setActive] = (0, import_react10.useState)(false);
1216
+ (0, import_react10.useEffect)(() => {
1217
+ node.value = active;
1218
+ }, [
1219
+ active
1220
+ ]);
1221
+ return /* @__PURE__ */ import_react10.default.createElement("div", {
1222
+ className: "flex w-full justify-center items-center"
1223
+ }, /* @__PURE__ */ import_react10.default.createElement(import_react_ui3.Icon, {
1224
+ icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
1225
+ classNames: [
1226
+ "transition opacity-20 duration-1000",
1227
+ active && "opacity-100 text-red-500"
1228
+ ],
1229
+ size: 8,
1230
+ onClick: () => setActive(!active)
1231
+ }));
1232
+ } finally {
1233
+ _effect.f();
1234
+ }
1187
1235
  };
1188
1236
  var audioShape = {
1189
1237
  type: "audio",
@@ -1198,8 +1246,8 @@ var audioShape = {
1198
1246
  }
1199
1247
  })
1200
1248
  };
1201
- var BeaconShape = import_echo_schema9.S.extend(ComputeShape, import_echo_schema9.S.Struct({
1202
- type: import_echo_schema9.S.Literal("beacon")
1249
+ var BeaconShape = import_effect8.Schema.extend(ComputeShape, import_effect8.Schema.Struct({
1250
+ type: import_effect8.Schema.Literal("beacon")
1203
1251
  }));
1204
1252
  var createBeacon = (props) => createShape({
1205
1253
  type: "beacon",
@@ -1210,16 +1258,21 @@ var createBeacon = (props) => createShape({
1210
1258
  ...props
1211
1259
  });
1212
1260
  var BeaconComponent = ({ shape }) => {
1213
- const { runtime } = useComputeNodeState(shape);
1214
- const input = runtime.inputs[import_conductor9.DEFAULT_INPUT];
1215
- const value = input?.type === "executed" ? input.value : false;
1216
- return /* @__PURE__ */ import_react11.default.createElement("div", {
1217
- className: "flex w-full justify-center items-center"
1218
- }, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Icon, {
1219
- icon: "ph--sun--regular",
1220
- classNames: (0, import_react_ui_theme2.mx)("transition opacity-20 duration-1000", (0, import_conductor9.isTruthy)(value) && "opacity-100 text-yellow-500"),
1221
- size: 8
1222
- }));
1261
+ var _effect = (0, import_tracking7.useSignals)();
1262
+ try {
1263
+ const { runtime } = useComputeNodeState(shape);
1264
+ const input = runtime.inputs[import_conductor9.DEFAULT_INPUT];
1265
+ const value = input?.type === "executed" ? input.value : false;
1266
+ return /* @__PURE__ */ import_react11.default.createElement("div", {
1267
+ className: "flex w-full justify-center items-center"
1268
+ }, /* @__PURE__ */ import_react11.default.createElement(import_react_ui4.Icon, {
1269
+ icon: "ph--sun--regular",
1270
+ classNames: (0, import_react_ui_theme2.mx)("transition opacity-20 duration-1000", (0, import_conductor9.isTruthy)(value) && "opacity-100 text-yellow-500"),
1271
+ size: 8
1272
+ }));
1273
+ } finally {
1274
+ _effect.f();
1275
+ }
1223
1276
  };
1224
1277
  var beaconShape = {
1225
1278
  type: "beacon",
@@ -1234,8 +1287,8 @@ var beaconShape = {
1234
1287
  }
1235
1288
  })
1236
1289
  };
1237
- var GateShape = import_echo_schema10.S.extend(ComputeShape, import_echo_schema10.S.Struct({
1238
- type: import_echo_schema10.S.String
1290
+ var GateShape = import_effect9.Schema.extend(ComputeShape, import_effect9.Schema.Struct({
1291
+ type: import_effect9.Schema.String
1239
1292
  }));
1240
1293
  var createGate = (props) => createShape({
1241
1294
  size: {
@@ -1244,10 +1297,17 @@ var createGate = (props) => createShape({
1244
1297
  },
1245
1298
  ...props
1246
1299
  });
1247
- var GateComponent = (Symbol22) => () => {
1248
- return /* @__PURE__ */ import_react12.default.createElement("div", {
1249
- className: "flex w-full justify-center items-center"
1250
- }, /* @__PURE__ */ import_react12.default.createElement(Symbol22, null));
1300
+ var GateComponent = (Symbol22) => {
1301
+ var _effect = (0, import_tracking8.useSignals)();
1302
+ try {
1303
+ return () => {
1304
+ return /* @__PURE__ */ import_react12.default.createElement("div", {
1305
+ className: "flex w-full justify-center items-center"
1306
+ }, /* @__PURE__ */ import_react12.default.createElement(Symbol22, null));
1307
+ };
1308
+ } finally {
1309
+ _effect.f();
1310
+ }
1251
1311
  };
1252
1312
  var defineShape = ({ type, name, icon, Symbol: Symbol22, createShape: createShape2, inputs, outputs = [
1253
1313
  createAnchorId("output")
@@ -1263,48 +1323,55 @@ var defineShape = ({ type, name, icon, Symbol: Symbol22, createShape: createShap
1263
1323
  outputs
1264
1324
  })
1265
1325
  });
1266
- var Symbol2 = (pathConstructor, inputs) => ({
1267
- width = 64,
1268
- height = 32,
1269
- // TODO(burdon): Same as line color.
1270
- className = "fill-neutral-200 dark:fill-neutral-800 stroke-neutral-500",
1271
- strokeWidth = 1
1272
- }) => {
1273
- const startX = width * 0.25;
1274
- const endX = width * 0.75;
1275
- const centerY = height / 2;
1276
- const paths = pathConstructor({
1277
- startX,
1278
- endX,
1279
- height
1280
- });
1281
- return /* @__PURE__ */ import_react12.default.createElement("svg", {
1282
- viewBox: `0 0 ${width} ${height}`,
1283
- className: "w-full h-full"
1284
- }, (0, import_react_ui_canvas_editor7.getAnchorPoints)({
1285
- x: 0,
1286
- y: centerY
1287
- }, inputs).map(({ x, y }, i) => /* @__PURE__ */ import_react12.default.createElement("line", {
1288
- key: i,
1289
- x1: x,
1290
- y1: y,
1291
- x2: startX * 1.3,
1292
- y2: y,
1293
- strokeWidth,
1294
- className
1295
- })), /* @__PURE__ */ import_react12.default.createElement("line", {
1296
- x1: endX,
1297
- y1: centerY,
1298
- x2: width,
1299
- y2: centerY,
1300
- strokeWidth,
1301
- className
1302
- }), paths.map((path, i) => /* @__PURE__ */ import_react12.default.createElement("path", {
1303
- key: i,
1304
- d: path,
1305
- strokeWidth,
1306
- className
1307
- })));
1326
+ var Symbol2 = (pathConstructor, inputs) => {
1327
+ var _effect = (0, import_tracking8.useSignals)();
1328
+ try {
1329
+ return ({
1330
+ width = 64,
1331
+ height = 32,
1332
+ // TODO(burdon): Same as line color.
1333
+ className = "fill-neutral-200 dark:fill-neutral-800 stroke-neutral-500",
1334
+ strokeWidth = 1
1335
+ }) => {
1336
+ const startX = width * 0.25;
1337
+ const endX = width * 0.75;
1338
+ const centerY = height / 2;
1339
+ const paths = pathConstructor({
1340
+ startX,
1341
+ endX,
1342
+ height
1343
+ });
1344
+ return /* @__PURE__ */ import_react12.default.createElement("svg", {
1345
+ viewBox: `0 0 ${width} ${height}`,
1346
+ className: "w-full h-full"
1347
+ }, (0, import_react_ui_canvas_editor7.getAnchorPoints)({
1348
+ x: 0,
1349
+ y: centerY
1350
+ }, inputs).map(({ x, y }, i) => /* @__PURE__ */ import_react12.default.createElement("line", {
1351
+ key: i,
1352
+ x1: x,
1353
+ y1: y,
1354
+ x2: startX * 1.3,
1355
+ y2: y,
1356
+ strokeWidth,
1357
+ className
1358
+ })), /* @__PURE__ */ import_react12.default.createElement("line", {
1359
+ x1: endX,
1360
+ y1: centerY,
1361
+ x2: width,
1362
+ y2: centerY,
1363
+ strokeWidth,
1364
+ className
1365
+ }), paths.map((path, i) => /* @__PURE__ */ import_react12.default.createElement("path", {
1366
+ key: i,
1367
+ d: path,
1368
+ strokeWidth,
1369
+ className
1370
+ })));
1371
+ };
1372
+ } finally {
1373
+ _effect.f();
1374
+ }
1308
1375
  };
1309
1376
  var AndSymbol = Symbol2(({ startX, endX, height }) => {
1310
1377
  const arcRadius = (endX - startX) / 2;
@@ -1400,27 +1467,32 @@ var notShape = defineShape({
1400
1467
  createAnchorId("input")
1401
1468
  ]
1402
1469
  });
1403
- var ChatShape = import_echo_schema11.S.extend(ComputeShape, import_echo_schema11.S.Struct({
1404
- type: import_echo_schema11.S.Literal("chat")
1470
+ var ChatShape = import_effect10.Schema.extend(ComputeShape, import_effect10.Schema.Struct({
1471
+ type: import_effect10.Schema.Literal("chat")
1405
1472
  }));
1406
1473
  var TextInputComponent = ({ shape, title, ...props }) => {
1407
- const { runtime } = useComputeNodeState(shape);
1408
- const inputRef = (0, import_react13.useRef)(null);
1409
- const handleEnter = (text) => {
1410
- const value = text.trim();
1411
- if (value.length) {
1412
- runtime.setOutput(import_conductor10.DEFAULT_OUTPUT, value);
1413
- inputRef.current?.setText("");
1414
- }
1415
- };
1416
- return /* @__PURE__ */ import_react13.default.createElement(Box, {
1417
- shape,
1418
- title
1419
- }, /* @__PURE__ */ import_react13.default.createElement(import_react_ui_canvas_editor8.TextBox, {
1420
- ref: inputRef,
1421
- onEnter: handleEnter,
1422
- ...props
1423
- }));
1474
+ var _effect = (0, import_tracking9.useSignals)();
1475
+ try {
1476
+ const { runtime } = useComputeNodeState(shape);
1477
+ const inputRef = (0, import_react13.useRef)(null);
1478
+ const handleEnter = (text) => {
1479
+ const value = text.trim();
1480
+ if (value.length) {
1481
+ runtime.setOutput(import_conductor10.DEFAULT_OUTPUT, value);
1482
+ inputRef.current?.setText("");
1483
+ }
1484
+ };
1485
+ return /* @__PURE__ */ import_react13.default.createElement(Box, {
1486
+ shape,
1487
+ title
1488
+ }, /* @__PURE__ */ import_react13.default.createElement(import_react_ui_canvas_editor8.TextBox, {
1489
+ ref: inputRef,
1490
+ onEnter: handleEnter,
1491
+ ...props
1492
+ }));
1493
+ } finally {
1494
+ _effect.f();
1495
+ }
1424
1496
  };
1425
1497
  var createChat = (props) => createShape({
1426
1498
  type: "chat",
@@ -1448,9 +1520,9 @@ var chatShape = {
1448
1520
  }),
1449
1521
  resizable: true
1450
1522
  };
1451
- var ConstantShape = import_echo_schema12.S.extend(ComputeShape, import_echo_schema12.S.Struct({
1452
- type: import_echo_schema12.S.Literal("constant"),
1453
- value: import_echo_schema12.S.optional(import_echo_schema12.S.Any)
1523
+ var ConstantShape = import_effect11.Schema.extend(ComputeShape, import_effect11.Schema.Struct({
1524
+ type: import_effect11.Schema.Literal("constant"),
1525
+ value: import_effect11.Schema.optional(import_effect11.Schema.Any)
1454
1526
  }));
1455
1527
  var inferType = (value) => {
1456
1528
  if (typeof value === "string") {
@@ -1464,52 +1536,57 @@ var inferType = (value) => {
1464
1536
  }
1465
1537
  };
1466
1538
  var ConstantComponent = ({ shape, title, chat, ...props }) => {
1467
- const { node } = useComputeNodeState(shape);
1468
- const [type, setType] = (0, import_react14.useState)(inferType(node.value) ?? import_conductor11.ComputeValueType.literals[0]);
1469
- const inputRef = (0, import_react14.useRef)(null);
1470
- const handleEnter = (0, import_react14.useCallback)((text) => {
1471
- const value = text.trim();
1472
- if (value.length) {
1473
- if (type === "number") {
1474
- const floatValue = parseFloat(value);
1475
- if (!isNaN(floatValue)) {
1476
- node.value = floatValue;
1539
+ var _effect = (0, import_tracking10.useSignals)();
1540
+ try {
1541
+ const { node } = useComputeNodeState(shape);
1542
+ const [type, setType] = (0, import_react14.useState)(inferType(node.value) ?? import_conductor11.ComputeValueType.literals[0]);
1543
+ const inputRef = (0, import_react14.useRef)(null);
1544
+ const handleEnter = (0, import_react14.useCallback)((text) => {
1545
+ const value = text.trim();
1546
+ if (value.length) {
1547
+ if (type === "number") {
1548
+ const floatValue = parseFloat(value);
1549
+ if (!isNaN(floatValue)) {
1550
+ node.value = floatValue;
1551
+ }
1552
+ } else if (type === "object") {
1553
+ node.value = (0, import_util2.safeParseJson)(value, {});
1554
+ } else {
1555
+ node.value = value;
1477
1556
  }
1478
- } else if (type === "object") {
1479
- node.value = (0, import_util2.safeParseJson)(value, {});
1480
- } else {
1557
+ inputRef.current?.focus();
1558
+ }
1559
+ }, [
1560
+ type
1561
+ ]);
1562
+ return /* @__PURE__ */ import_react14.default.createElement(Box, {
1563
+ shape,
1564
+ title,
1565
+ status: /* @__PURE__ */ import_react14.default.createElement(TypeSelect, {
1566
+ value: type,
1567
+ onValueChange: setType
1568
+ })
1569
+ }, (type === "string" || type === "number") && /* @__PURE__ */ import_react14.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1570
+ ...props,
1571
+ ref: inputRef,
1572
+ value: node.value,
1573
+ onEnter: handleEnter
1574
+ }), type === "object" && /* @__PURE__ */ import_react14.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1575
+ ...props,
1576
+ ref: inputRef,
1577
+ value: JSON.stringify(node.value, null, 2),
1578
+ language: "json"
1579
+ }), type === "boolean" && /* @__PURE__ */ import_react14.default.createElement("div", {
1580
+ className: "flex grow justify-center items-center"
1581
+ }, /* @__PURE__ */ import_react14.default.createElement(import_react_ui5.Input.Root, null, /* @__PURE__ */ import_react14.default.createElement(import_react_ui5.Input.Switch, {
1582
+ checked: node.value,
1583
+ onCheckedChange: (value) => {
1481
1584
  node.value = value;
1482
1585
  }
1483
- inputRef.current?.focus();
1484
- }
1485
- }, [
1486
- type
1487
- ]);
1488
- return /* @__PURE__ */ import_react14.default.createElement(Box, {
1489
- shape,
1490
- title,
1491
- status: /* @__PURE__ */ import_react14.default.createElement(TypeSelect, {
1492
- value: type,
1493
- onValueChange: setType
1494
- })
1495
- }, (type === "string" || type === "number") && /* @__PURE__ */ import_react14.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1496
- ...props,
1497
- ref: inputRef,
1498
- value: node.value,
1499
- onEnter: handleEnter
1500
- }), type === "object" && /* @__PURE__ */ import_react14.default.createElement(import_react_ui_canvas_editor10.TextBox, {
1501
- ...props,
1502
- ref: inputRef,
1503
- value: JSON.stringify(node.value, null, 2),
1504
- language: "json"
1505
- }), type === "boolean" && /* @__PURE__ */ import_react14.default.createElement("div", {
1506
- className: "flex grow justify-center items-center"
1507
- }, /* @__PURE__ */ import_react14.default.createElement(import_react_ui5.Input.Root, null, /* @__PURE__ */ import_react14.default.createElement(import_react_ui5.Input.Switch, {
1508
- checked: node.value,
1509
- onCheckedChange: (value) => {
1510
- node.value = value;
1511
- }
1512
- }))));
1586
+ }))));
1587
+ } finally {
1588
+ _effect.f();
1589
+ }
1513
1590
  };
1514
1591
  var createConstant = (props) => createShape({
1515
1592
  type: "constant",
@@ -1536,8 +1613,8 @@ var constantShape = {
1536
1613
  }),
1537
1614
  resizable: true
1538
1615
  };
1539
- var DatabaseShape = import_echo_schema13.S.extend(ComputeShape, import_echo_schema13.S.Struct({
1540
- type: import_echo_schema13.S.Literal("database")
1616
+ var DatabaseShape = import_effect12.Schema.extend(ComputeShape, import_effect12.Schema.Struct({
1617
+ type: import_effect12.Schema.Literal("database")
1541
1618
  }));
1542
1619
  var createDatabase = (props) => createShape({
1543
1620
  type: "database",
@@ -1548,9 +1625,14 @@ var createDatabase = (props) => createShape({
1548
1625
  ...props
1549
1626
  });
1550
1627
  var DatabaseComponent = ({ shape }) => {
1551
- return /* @__PURE__ */ import_react15.default.createElement(Box, {
1552
- shape
1553
- });
1628
+ var _effect = (0, import_tracking11.useSignals)();
1629
+ try {
1630
+ return /* @__PURE__ */ import_react15.default.createElement(Box, {
1631
+ shape
1632
+ });
1633
+ } finally {
1634
+ _effect.f();
1635
+ }
1554
1636
  };
1555
1637
  var databaseShape = {
1556
1638
  type: "database",
@@ -1565,8 +1647,8 @@ var databaseShape = {
1565
1647
  }
1566
1648
  })
1567
1649
  };
1568
- var FunctionShape = import_echo_schema14.S.extend(ComputeShape, import_echo_schema14.S.Struct({
1569
- type: import_echo_schema14.S.Literal("function")
1650
+ var FunctionShape = import_effect13.Schema.extend(ComputeShape, import_effect13.Schema.Struct({
1651
+ type: import_effect13.Schema.Literal("function")
1570
1652
  }));
1571
1653
  var createFunction = (props) => createShape({
1572
1654
  type: "function",
@@ -1577,54 +1659,59 @@ var createFunction = (props) => createShape({
1577
1659
  ...props
1578
1660
  });
1579
1661
  var TextInputComponent2 = ({ shape, title, ...props }) => {
1580
- const client = (0, import_react_client.useClient)();
1581
- const { node, runtime } = useComputeNodeState(shape);
1582
- const inputRef = (0, import_react16.useRef)(null);
1583
- const handleEnter = (0, import_react16.useCallback)(async (text) => {
1584
- const value = text.trim();
1585
- const { spaceId, objectId } = (0, import_echo2.parseId)(value);
1586
- if (!spaceId || !objectId) {
1587
- return;
1588
- }
1589
- const space = client.spaces.get(spaceId);
1590
- const object = space?.db.getObjectById(objectId);
1591
- if (!space || !(0, import_echo_schema14.isInstanceOf)(import_types.ScriptType, object)) {
1592
- return;
1593
- }
1594
- const { objects: [fn] } = await space.db.query(import_echo2.Filter.schema(import_types.FunctionType, {
1595
- source: object
1596
- })).run();
1597
- if (!fn) {
1598
- return;
1599
- }
1600
- node.value = value;
1601
- node.function = (0, import_echo2.makeRef)(fn);
1602
- node.inputSchema = (0, import_echo_schema14.getSnapshot)(fn.inputSchema);
1603
- node.outputSchema = (0, import_echo_schema14.getSnapshot)(fn.outputSchema);
1604
- }, [
1605
- client,
1606
- node
1607
- ]);
1608
- const handleAction = (0, import_react16.useCallback)((action) => {
1609
- if (action !== "run") {
1610
- return;
1611
- }
1612
- runtime.evalNode();
1613
- }, [
1614
- runtime
1615
- ]);
1616
- return /* @__PURE__ */ import_react16.default.createElement(Box, {
1617
- shape,
1618
- title: "Function",
1619
- onAction: handleAction
1620
- }, /* @__PURE__ */ import_react16.default.createElement(import_react_ui_canvas_editor13.TextBox, {
1621
- ...props,
1622
- ref: inputRef,
1623
- value: node.value,
1624
- language: node.valueType === "object" ? "json" : void 0,
1625
- onBlur: handleEnter,
1626
- onEnter: handleEnter
1627
- }));
1662
+ var _effect = (0, import_tracking12.useSignals)();
1663
+ try {
1664
+ const client = (0, import_react_client.useClient)();
1665
+ const { node, runtime } = useComputeNodeState(shape);
1666
+ const inputRef = (0, import_react16.useRef)(null);
1667
+ const handleEnter = (0, import_react16.useCallback)(async (text) => {
1668
+ const value = text.trim();
1669
+ const { spaceId, objectId } = (0, import_echo2.parseId)(value);
1670
+ if (!spaceId || !objectId) {
1671
+ return;
1672
+ }
1673
+ const space = client.spaces.get(spaceId);
1674
+ const object = space?.db.getObjectById(objectId);
1675
+ if (!space || !(0, import_echo_schema4.isInstanceOf)(import_functions.ScriptType, object)) {
1676
+ return;
1677
+ }
1678
+ const { objects: [fn] } = await space.db.query(import_echo2.Filter.type(import_functions.FunctionType, {
1679
+ source: import_echo_schema4.Ref.make(object)
1680
+ })).run();
1681
+ if (!fn) {
1682
+ return;
1683
+ }
1684
+ node.value = value;
1685
+ node.function = (0, import_echo2.makeRef)(fn);
1686
+ node.inputSchema = (0, import_echo_schema4.getSnapshot)(fn.inputSchema);
1687
+ node.outputSchema = (0, import_echo_schema4.getSnapshot)(fn.outputSchema);
1688
+ }, [
1689
+ client,
1690
+ node
1691
+ ]);
1692
+ const handleAction = (0, import_react16.useCallback)((action) => {
1693
+ if (action !== "run") {
1694
+ return;
1695
+ }
1696
+ runtime.evalNode();
1697
+ }, [
1698
+ runtime
1699
+ ]);
1700
+ return /* @__PURE__ */ import_react16.default.createElement(Box, {
1701
+ shape,
1702
+ title: "Function",
1703
+ onAction: handleAction
1704
+ }, /* @__PURE__ */ import_react16.default.createElement(import_react_ui_canvas_editor13.TextBox, {
1705
+ ...props,
1706
+ ref: inputRef,
1707
+ value: node.value,
1708
+ language: node.valueType === "object" ? "json" : void 0,
1709
+ onBlur: handleEnter,
1710
+ onEnter: handleEnter
1711
+ }));
1712
+ } finally {
1713
+ _effect.f();
1714
+ }
1628
1715
  };
1629
1716
  var functionShape = {
1630
1717
  type: "function",
@@ -1634,8 +1721,8 @@ var functionShape = {
1634
1721
  createShape: createFunction,
1635
1722
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor12.FunctionInput, import_conductor12.AnyOutput)
1636
1723
  };
1637
- var GptShape = import_echo_schema15.S.extend(ComputeShape, import_echo_schema15.S.Struct({
1638
- type: import_echo_schema15.S.Literal("gpt")
1724
+ var GptShape = import_effect14.Schema.extend(ComputeShape, import_effect14.Schema.Struct({
1725
+ type: import_effect14.Schema.Literal("gpt")
1639
1726
  }));
1640
1727
  var createGpt = (props) => createShape({
1641
1728
  type: "gpt",
@@ -1646,49 +1733,54 @@ var createGpt = (props) => createShape({
1646
1733
  ...props
1647
1734
  });
1648
1735
  var GptComponent = ({ shape }) => {
1649
- const { meta, runtime } = useComputeNodeState(shape);
1650
- const [text, setText] = (0, import_react17.useState)("");
1651
- const [tokens, setTokens] = (0, import_react17.useState)(0);
1652
- (0, import_react17.useEffect)(() => {
1653
- return runtime.subscribeToEventLog((ev) => {
1654
- switch (ev.type) {
1655
- case "begin-compute": {
1656
- setText("");
1657
- break;
1658
- }
1659
- case "custom": {
1660
- const token = ev.event;
1661
- switch (token.type) {
1662
- case "content_block_delta":
1663
- switch (token.delta.type) {
1664
- case "text_delta": {
1665
- const delta = token.delta.text;
1666
- setText((prev) => {
1667
- const text2 = prev + delta;
1668
- setTokens(text2.split(" ").length);
1669
- return text2;
1670
- });
1671
- break;
1736
+ var _effect = (0, import_tracking13.useSignals)();
1737
+ try {
1738
+ const { meta, runtime } = useComputeNodeState(shape);
1739
+ const [text, setText] = (0, import_react17.useState)("");
1740
+ const [tokens, setTokens] = (0, import_react17.useState)(0);
1741
+ (0, import_react17.useEffect)(() => {
1742
+ return runtime.subscribeToEventLog((ev) => {
1743
+ switch (ev.type) {
1744
+ case "begin-compute": {
1745
+ setText("");
1746
+ break;
1747
+ }
1748
+ case "custom": {
1749
+ const token = ev.event;
1750
+ switch (token.type) {
1751
+ case "content_block_delta":
1752
+ switch (token.delta.type) {
1753
+ case "text_delta": {
1754
+ const delta = token.delta.text;
1755
+ setText((prev) => {
1756
+ const text2 = prev + delta;
1757
+ setTokens(text2.split(" ").length);
1758
+ return text2;
1759
+ });
1760
+ break;
1761
+ }
1672
1762
  }
1673
- }
1674
- break;
1763
+ break;
1764
+ }
1765
+ break;
1675
1766
  }
1676
- break;
1677
1767
  }
1678
- }
1768
+ });
1769
+ }, [
1770
+ runtime?.subscribeToEventLog
1771
+ ]);
1772
+ return /* @__PURE__ */ import_react17.default.createElement(FunctionBody, {
1773
+ shape,
1774
+ content: /* @__PURE__ */ import_react17.default.createElement("div", {
1775
+ className: "px-2 py-1 overflow-y-scroll"
1776
+ }, text),
1777
+ status: `${tokens} tokens`,
1778
+ inputSchema: meta.input,
1779
+ outputSchema: meta.output
1679
1780
  });
1680
- }, [
1681
- runtime?.subscribeToEventLog
1682
- ]);
1683
- return /* @__PURE__ */ import_react17.default.createElement(FunctionBody, {
1684
- shape,
1685
- content: /* @__PURE__ */ import_react17.default.createElement("div", {
1686
- className: "px-2 py-1 overflow-y-scroll"
1687
- }, text),
1688
- status: `${tokens} tokens`,
1689
- inputSchema: meta.input,
1690
- outputSchema: meta.output
1691
- });
1781
+ } finally {
1782
+ _effect.f();
1783
+ }
1692
1784
  };
1693
1785
  var gptShape = {
1694
1786
  type: "gpt",
@@ -1699,27 +1791,37 @@ var gptShape = {
1699
1791
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor13.GptInput, import_conductor13.GptOutput),
1700
1792
  openable: true
1701
1793
  };
1702
- var JsonShape = import_echo_schema16.S.extend(ComputeShape, import_echo_schema16.S.Struct({
1703
- type: import_echo_schema16.S.Literal("json")
1794
+ var JsonShape = import_effect15.Schema.extend(ComputeShape, import_effect15.Schema.Struct({
1795
+ type: import_effect15.Schema.Literal("json")
1704
1796
  }));
1705
- var JsonTransformShape = import_echo_schema16.S.extend(ComputeShape, import_echo_schema16.S.Struct({
1706
- type: import_echo_schema16.S.Literal("json-transform")
1797
+ var JsonTransformShape = import_effect15.Schema.extend(ComputeShape, import_effect15.Schema.Struct({
1798
+ type: import_effect15.Schema.Literal("json-transform")
1707
1799
  }));
1708
1800
  var JsonComponent = ({ shape, ...props }) => {
1709
- const { runtime } = useComputeNodeState(shape);
1710
- const input = runtime.inputs[import_conductor14.DEFAULT_INPUT];
1711
- const value = input?.type === "executed" ? input.value : void 0;
1712
- return /* @__PURE__ */ import_react18.default.createElement(Box, {
1713
- shape
1714
- }, /* @__PURE__ */ import_react18.default.createElement(import_react_ui_syntax_highlighter.JsonFilter, {
1715
- data: value,
1716
- classNames: "text-xs"
1717
- }));
1801
+ var _effect = (0, import_tracking14.useSignals)();
1802
+ try {
1803
+ const { runtime } = useComputeNodeState(shape);
1804
+ const input = runtime.inputs[import_conductor14.DEFAULT_INPUT];
1805
+ const value = input?.type === "executed" ? input.value : void 0;
1806
+ return /* @__PURE__ */ import_react18.default.createElement(Box, {
1807
+ shape
1808
+ }, /* @__PURE__ */ import_react18.default.createElement(import_react_ui_syntax_highlighter.JsonFilter, {
1809
+ data: value,
1810
+ classNames: "text-xs"
1811
+ }));
1812
+ } finally {
1813
+ _effect.f();
1814
+ }
1718
1815
  };
1719
1816
  var JsonTransformComponent = ({ shape, ...props }) => {
1720
- return /* @__PURE__ */ import_react18.default.createElement(Box, {
1721
- shape
1722
- });
1817
+ var _effect = (0, import_tracking14.useSignals)();
1818
+ try {
1819
+ return /* @__PURE__ */ import_react18.default.createElement(Box, {
1820
+ shape
1821
+ });
1822
+ } finally {
1823
+ _effect.f();
1824
+ }
1723
1825
  };
1724
1826
  var createJson = (props) => createShape({
1725
1827
  type: "json",
@@ -1764,25 +1866,35 @@ var jsonTransformShape = {
1764
1866
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor14.JsonTransformInput, import_conductor14.DefaultOutput),
1765
1867
  resizable: true
1766
1868
  };
1767
- var IfShape = import_echo_schema17.S.extend(ComputeShape, import_echo_schema17.S.Struct({
1768
- type: import_echo_schema17.S.Literal("if")
1869
+ var IfShape = import_effect16.Schema.extend(ComputeShape, import_effect16.Schema.Struct({
1870
+ type: import_effect16.Schema.Literal("if")
1769
1871
  }));
1770
- var IfElseShape = import_echo_schema17.S.extend(ComputeShape, import_echo_schema17.S.Struct({
1771
- type: import_echo_schema17.S.Literal("if-else")
1872
+ var IfElseShape = import_effect16.Schema.extend(ComputeShape, import_effect16.Schema.Struct({
1873
+ type: import_effect16.Schema.Literal("if-else")
1772
1874
  }));
1773
1875
  var IfComponent = ({ shape, ...props }) => {
1774
- return /* @__PURE__ */ import_react19.default.createElement(FunctionBody, {
1775
- shape,
1776
- inputSchema: import_conductor15.IfInput,
1777
- outputSchema: import_conductor15.IfOutput
1778
- });
1876
+ var _effect = (0, import_tracking15.useSignals)();
1877
+ try {
1878
+ return /* @__PURE__ */ import_react19.default.createElement(FunctionBody, {
1879
+ shape,
1880
+ inputSchema: import_conductor15.IfInput,
1881
+ outputSchema: import_conductor15.IfOutput
1882
+ });
1883
+ } finally {
1884
+ _effect.f();
1885
+ }
1779
1886
  };
1780
1887
  var IfElseComponent = ({ shape, ...props }) => {
1781
- return /* @__PURE__ */ import_react19.default.createElement(FunctionBody, {
1782
- shape,
1783
- inputSchema: import_conductor15.IfElseInput,
1784
- outputSchema: import_conductor15.IfElseOutput
1785
- });
1888
+ var _effect = (0, import_tracking15.useSignals)();
1889
+ try {
1890
+ return /* @__PURE__ */ import_react19.default.createElement(FunctionBody, {
1891
+ shape,
1892
+ inputSchema: import_conductor15.IfElseInput,
1893
+ outputSchema: import_conductor15.IfElseOutput
1894
+ });
1895
+ } finally {
1896
+ _effect.f();
1897
+ }
1786
1898
  };
1787
1899
  var createIf = (props) => createShape({
1788
1900
  type: "if",
@@ -1816,8 +1928,8 @@ var ifElseShape = {
1816
1928
  createShape: createIfElse,
1817
1929
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor15.IfElseInput, import_conductor15.IfElseOutput)
1818
1930
  };
1819
- var QueueShape = import_echo_schema18.S.extend(ComputeShape, import_echo_schema18.S.Struct({
1820
- type: import_echo_schema18.S.Literal("queue")
1931
+ var QueueShape = import_effect17.Schema.extend(ComputeShape, import_effect17.Schema.Struct({
1932
+ type: import_effect17.Schema.Literal("queue")
1821
1933
  }));
1822
1934
  var createQueue = (props) => createShape({
1823
1935
  type: "queue",
@@ -1828,40 +1940,50 @@ var createQueue = (props) => createShape({
1828
1940
  ...props
1829
1941
  });
1830
1942
  var QueueComponent = ({ shape }) => {
1831
- const { runtime } = useComputeNodeState(shape);
1832
- const items = runtime.outputs[import_conductor16.DEFAULT_OUTPUT]?.type === "executed" ? runtime.outputs[import_conductor16.DEFAULT_OUTPUT].value : [];
1833
- const handleAction = (action) => {
1834
- if (action === "run") {
1835
- runtime.evalNode();
1836
- }
1837
- };
1838
- return /* @__PURE__ */ import_react20.default.createElement(Box, {
1839
- shape,
1840
- status: `${items.length} items`,
1841
- onAction: handleAction
1842
- }, /* @__PURE__ */ import_react20.default.createElement("div", {
1843
- className: "flex flex-col w-full overflow-y-scroll divide-y divide-separator"
1844
- }, [
1845
- ...items
1846
- ].map((item, i) => /* @__PURE__ */ import_react20.default.createElement(QueueItem, {
1847
- key: i,
1848
- classNames: "p-1 px-2",
1849
- item
1850
- }))));
1943
+ var _effect = (0, import_tracking16.useSignals)();
1944
+ try {
1945
+ const { runtime } = useComputeNodeState(shape);
1946
+ const items = runtime.outputs[import_conductor16.DEFAULT_OUTPUT]?.type === "executed" ? runtime.outputs[import_conductor16.DEFAULT_OUTPUT].value : [];
1947
+ const handleAction = (action) => {
1948
+ if (action === "run") {
1949
+ runtime.evalNode();
1950
+ }
1951
+ };
1952
+ return /* @__PURE__ */ import_react20.default.createElement(Box, {
1953
+ shape,
1954
+ status: `${items.length} items`,
1955
+ onAction: handleAction
1956
+ }, /* @__PURE__ */ import_react20.default.createElement("div", {
1957
+ className: "flex flex-col w-full overflow-y-scroll divide-y divide-separator"
1958
+ }, [
1959
+ ...items
1960
+ ].map((item, i) => /* @__PURE__ */ import_react20.default.createElement(QueueItem, {
1961
+ key: i,
1962
+ classNames: "p-1 px-2",
1963
+ item
1964
+ }))));
1965
+ } finally {
1966
+ _effect.f();
1967
+ }
1851
1968
  };
1852
1969
  var QueueItem = ({ classNames, item }) => {
1853
- if (typeof item !== "object") {
1970
+ var _effect = (0, import_tracking16.useSignals)();
1971
+ try {
1972
+ if (typeof item !== "object") {
1973
+ return /* @__PURE__ */ import_react20.default.createElement("div", {
1974
+ className: (0, import_react_ui_theme3.mx)(classNames, "whitespace-pre-wrap")
1975
+ }, item);
1976
+ }
1854
1977
  return /* @__PURE__ */ import_react20.default.createElement("div", {
1855
- className: (0, import_react_ui_theme3.mx)(classNames, "whitespace-pre-wrap")
1856
- }, item);
1978
+ className: (0, import_react_ui_theme3.mx)("grid grid-cols-[80px,1fr]", classNames)
1979
+ }, Object.entries(item).map(([key, value]) => /* @__PURE__ */ import_react20.default.createElement(import_react20.Fragment, {
1980
+ key
1981
+ }, /* @__PURE__ */ import_react20.default.createElement("div", {
1982
+ className: "p-1 text-xs text-subdued"
1983
+ }, key), /* @__PURE__ */ import_react20.default.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1984
+ } finally {
1985
+ _effect.f();
1857
1986
  }
1858
- return /* @__PURE__ */ import_react20.default.createElement("div", {
1859
- className: (0, import_react_ui_theme3.mx)("grid grid-cols-[80px,1fr]", classNames)
1860
- }, Object.entries(item).map(([key, value]) => /* @__PURE__ */ import_react20.default.createElement(import_react20.Fragment, {
1861
- key
1862
- }, /* @__PURE__ */ import_react20.default.createElement("div", {
1863
- className: "p-1 text-xs text-subdued"
1864
- }, key), /* @__PURE__ */ import_react20.default.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1865
1987
  };
1866
1988
  var queueShape = {
1867
1989
  type: "queue",
@@ -1872,10 +1994,10 @@ var queueShape = {
1872
1994
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor16.QueueInput, import_conductor16.QueueOutput),
1873
1995
  resizable: true
1874
1996
  };
1875
- var RandomShape = import_echo_schema19.S.extend(ComputeShape, import_echo_schema19.S.Struct({
1876
- type: import_echo_schema19.S.Literal("rng"),
1877
- min: import_echo_schema19.S.optional(import_echo_schema19.S.Number),
1878
- max: import_echo_schema19.S.optional(import_echo_schema19.S.Number)
1997
+ var RandomShape = import_effect18.Schema.extend(ComputeShape, import_effect18.Schema.Struct({
1998
+ type: import_effect18.Schema.Literal("rng"),
1999
+ min: import_effect18.Schema.optional(import_effect18.Schema.Number),
2000
+ max: import_effect18.Schema.optional(import_effect18.Schema.Number)
1879
2001
  }));
1880
2002
  var createRandom = (props) => createShape({
1881
2003
  type: "rng",
@@ -1895,37 +2017,42 @@ var icons = [
1895
2017
  ];
1896
2018
  var pickIcon = () => icons[Math.floor(Math.random() * icons.length)];
1897
2019
  var RandomComponent = ({ shape }) => {
1898
- const { runtime } = useComputeNodeState(shape);
1899
- const [spin, setSpin] = (0, import_react21.useState)(false);
1900
- const [icon, setIcon] = (0, import_react21.useState)(pickIcon());
1901
- (0, import_react21.useEffect)(() => {
1902
- if (!spin) {
1903
- return;
1904
- }
1905
- const i = setInterval(() => setIcon(pickIcon()), 250);
1906
- const t1 = setTimeout(() => clearInterval(i), 900);
1907
- const t2 = setTimeout(() => setSpin(false), 1100);
1908
- return () => {
1909
- clearInterval(i);
1910
- clearTimeout(t1);
1911
- clearTimeout(t2);
2020
+ var _effect = (0, import_tracking17.useSignals)();
2021
+ try {
2022
+ const { runtime } = useComputeNodeState(shape);
2023
+ const [spin, setSpin] = (0, import_react21.useState)(false);
2024
+ const [icon, setIcon] = (0, import_react21.useState)(pickIcon());
2025
+ (0, import_react21.useEffect)(() => {
2026
+ if (!spin) {
2027
+ return;
2028
+ }
2029
+ const i = setInterval(() => setIcon(pickIcon()), 250);
2030
+ const t1 = setTimeout(() => clearInterval(i), 900);
2031
+ const t2 = setTimeout(() => setSpin(false), 1100);
2032
+ return () => {
2033
+ clearInterval(i);
2034
+ clearTimeout(t1);
2035
+ clearTimeout(t2);
2036
+ };
2037
+ }, [
2038
+ spin
2039
+ ]);
2040
+ const handleClick = (ev) => {
2041
+ ev.stopPropagation();
2042
+ runtime.setOutput(import_conductor17.DEFAULT_OUTPUT, Math.random());
2043
+ setSpin(true);
1912
2044
  };
1913
- }, [
1914
- spin
1915
- ]);
1916
- const handleClick = (ev) => {
1917
- ev.stopPropagation();
1918
- runtime.setOutput(import_conductor17.DEFAULT_OUTPUT, Math.random());
1919
- setSpin(true);
1920
- };
1921
- return /* @__PURE__ */ import_react21.default.createElement("div", {
1922
- className: "flex grow items-center justify-center"
1923
- }, /* @__PURE__ */ import_react21.default.createElement(import_react_ui6.Icon, {
1924
- icon,
1925
- classNames: (0, import_react_ui_theme4.mx)(spin && "animate-[spin_1s]"),
1926
- size: 10,
1927
- onClick: handleClick
1928
- }));
2045
+ return /* @__PURE__ */ import_react21.default.createElement("div", {
2046
+ className: "flex grow items-center justify-center"
2047
+ }, /* @__PURE__ */ import_react21.default.createElement(import_react_ui6.Icon, {
2048
+ icon,
2049
+ classNames: (0, import_react_ui_theme4.mx)(spin && "animate-[spin_1s]"),
2050
+ size: 10,
2051
+ onClick: handleClick
2052
+ }));
2053
+ } finally {
2054
+ _effect.f();
2055
+ }
1929
2056
  };
1930
2057
  var randomShape = {
1931
2058
  type: "rng",
@@ -1940,8 +2067,8 @@ var randomShape = {
1940
2067
  }
1941
2068
  })
1942
2069
  };
1943
- var ScopeShape = import_echo_schema20.S.extend(ComputeShape, import_echo_schema20.S.Struct({
1944
- type: import_echo_schema20.S.Literal("scope")
2070
+ var ScopeShape = import_effect19.Schema.extend(ComputeShape, import_effect19.Schema.Struct({
2071
+ type: import_effect19.Schema.Literal("scope")
1945
2072
  }));
1946
2073
  var createScope = (props) => createShape({
1947
2074
  type: "scope",
@@ -1953,20 +2080,25 @@ var createScope = (props) => createShape({
1953
2080
  ...props
1954
2081
  });
1955
2082
  var ScopeComponent = ({ shape }) => {
1956
- const { runtime } = useComputeNodeState(shape);
1957
- const input = runtime.inputs[import_conductor18.DEFAULT_INPUT];
1958
- const active = input?.type === "executed" ? input.value : false;
1959
- const { getAverage } = (0, import_react_ui_sfx.useAudioStream)(active);
1960
- return /* @__PURE__ */ import_react22.default.createElement("div", {
1961
- className: "flex w-full justify-center items-center bg-black"
1962
- }, /* @__PURE__ */ import_react22.default.createElement(import_react_ui_sfx.Chaos, {
1963
- active,
1964
- getValue: getAverage,
1965
- options: {
1966
- ...import_react_ui_sfx.shaderPresets.heptapod,
1967
- zoom: 1.2
1968
- }
1969
- }));
2083
+ var _effect = (0, import_tracking18.useSignals)();
2084
+ try {
2085
+ const { runtime } = useComputeNodeState(shape);
2086
+ const input = runtime.inputs[import_conductor18.DEFAULT_INPUT];
2087
+ const active = input?.type === "executed" ? input.value : false;
2088
+ const { getAverage } = (0, import_react_ui_sfx.useAudioStream)(active);
2089
+ return /* @__PURE__ */ import_react22.default.createElement("div", {
2090
+ className: "flex w-full justify-center items-center bg-black"
2091
+ }, /* @__PURE__ */ import_react22.default.createElement(import_react_ui_sfx.Chaos, {
2092
+ active,
2093
+ getValue: getAverage,
2094
+ options: {
2095
+ ...import_react_ui_sfx.shaderPresets.heptapod,
2096
+ zoom: 1.2
2097
+ }
2098
+ }));
2099
+ } finally {
2100
+ _effect.f();
2101
+ }
1970
2102
  };
1971
2103
  var scopeShape = {
1972
2104
  type: "scope",
@@ -1981,8 +2113,8 @@ var scopeShape = {
1981
2113
  }
1982
2114
  })
1983
2115
  };
1984
- var SurfaceShape = import_echo_schema21.S.extend(ComputeShape, import_echo_schema21.S.Struct({
1985
- type: import_echo_schema21.S.Literal("surface")
2116
+ var SurfaceShape = import_effect20.Schema.extend(ComputeShape, import_effect20.Schema.Struct({
2117
+ type: import_effect20.Schema.Literal("surface")
1986
2118
  }));
1987
2119
  var createSurface = (props) => createShape({
1988
2120
  type: "surface",
@@ -1993,24 +2125,29 @@ var createSurface = (props) => createShape({
1993
2125
  ...props
1994
2126
  });
1995
2127
  var SurfaceComponent = ({ shape }) => {
1996
- const { runtime } = useComputeNodeState(shape);
1997
- const input = runtime.inputs[import_conductor19.DEFAULT_INPUT];
1998
- const value = input?.type === "executed" ? input.value : null;
1999
- const handleAction = (action) => {
2000
- if (action === "run") {
2001
- runtime.evalNode();
2002
- }
2003
- };
2004
- return /* @__PURE__ */ import_react23.default.createElement(Box, {
2005
- shape,
2006
- onAction: handleAction
2007
- }, value !== null && /* @__PURE__ */ import_react23.default.createElement(import_app_framework.Surface, {
2008
- role: "canvas-node",
2009
- data: {
2010
- value
2011
- },
2012
- limit: 1
2013
- }));
2128
+ var _effect = (0, import_tracking19.useSignals)();
2129
+ try {
2130
+ const { runtime } = useComputeNodeState(shape);
2131
+ const input = runtime.inputs[import_conductor19.DEFAULT_INPUT];
2132
+ const value = input?.type === "executed" ? input.value : null;
2133
+ const handleAction = (action) => {
2134
+ if (action === "run") {
2135
+ runtime.evalNode();
2136
+ }
2137
+ };
2138
+ return /* @__PURE__ */ import_react23.default.createElement(Box, {
2139
+ shape,
2140
+ onAction: handleAction
2141
+ }, value !== null && /* @__PURE__ */ import_react23.default.createElement(import_app_framework.Surface, {
2142
+ role: "canvas-node",
2143
+ data: {
2144
+ value
2145
+ },
2146
+ limit: 1
2147
+ }));
2148
+ } finally {
2149
+ _effect.f();
2150
+ }
2014
2151
  };
2015
2152
  var surfaceShape = {
2016
2153
  type: "surface",
@@ -2026,8 +2163,8 @@ var surfaceShape = {
2026
2163
  }),
2027
2164
  resizable: true
2028
2165
  };
2029
- var SwitchShape = import_echo_schema22.S.extend(ComputeShape, import_echo_schema22.S.Struct({
2030
- type: import_echo_schema22.S.Literal("switch")
2166
+ var SwitchShape = import_effect21.Schema.extend(ComputeShape, import_effect21.Schema.Struct({
2167
+ type: import_effect21.Schema.Literal("switch")
2031
2168
  }));
2032
2169
  var createSwitch = (props) => createShape({
2033
2170
  type: "switch",
@@ -2038,20 +2175,25 @@ var createSwitch = (props) => createShape({
2038
2175
  ...props
2039
2176
  });
2040
2177
  var SwitchComponent = ({ shape }) => {
2041
- const { runtime } = useComputeNodeState(shape);
2042
- const [value, setValue] = (0, import_react24.useState)(false);
2043
- (0, import_react24.useEffect)(() => {
2044
- runtime.setOutput(import_conductor20.DEFAULT_OUTPUT, value);
2045
- }, [
2046
- value
2047
- ]);
2048
- return /* @__PURE__ */ import_react24.default.createElement("div", {
2049
- className: "flex w-full justify-center items-center",
2050
- onClick: (ev) => ev.stopPropagation()
2051
- }, /* @__PURE__ */ import_react24.default.createElement(import_react_ui7.Input.Root, null, /* @__PURE__ */ import_react24.default.createElement(import_react_ui7.Input.Switch, {
2052
- checked: value,
2053
- onCheckedChange: (value2) => setValue(value2)
2054
- })));
2178
+ var _effect = (0, import_tracking20.useSignals)();
2179
+ try {
2180
+ const { runtime } = useComputeNodeState(shape);
2181
+ const [value, setValue] = (0, import_react24.useState)(false);
2182
+ (0, import_react24.useEffect)(() => {
2183
+ runtime.setOutput(import_conductor20.DEFAULT_OUTPUT, value);
2184
+ }, [
2185
+ value
2186
+ ]);
2187
+ return /* @__PURE__ */ import_react24.default.createElement("div", {
2188
+ className: "flex w-full justify-center items-center",
2189
+ onClick: (ev) => ev.stopPropagation()
2190
+ }, /* @__PURE__ */ import_react24.default.createElement(import_react_ui7.Input.Root, null, /* @__PURE__ */ import_react24.default.createElement(import_react_ui7.Input.Switch, {
2191
+ checked: value,
2192
+ onCheckedChange: (value2) => setValue(value2)
2193
+ })));
2194
+ } finally {
2195
+ _effect.f();
2196
+ }
2055
2197
  };
2056
2198
  var switchShape = {
2057
2199
  type: "switch",
@@ -2067,9 +2209,9 @@ var switchShape = {
2067
2209
  })
2068
2210
  };
2069
2211
  var InputSchema = (0, import_conductor21.createInputSchema)(import_conductor21.GptMessage);
2070
- var OutputSchema = (0, import_conductor21.createOutputSchema)(import_echo_schema23.S.mutable(import_echo_schema23.S.Array(import_conductor21.GptMessage)));
2071
- var TableShape = import_echo_schema23.S.extend(ComputeShape, import_echo_schema23.S.Struct({
2072
- type: import_echo_schema23.S.Literal("table")
2212
+ var OutputSchema = (0, import_conductor21.createOutputSchema)(import_effect22.Schema.mutable(import_effect22.Schema.Array(import_conductor21.GptMessage)));
2213
+ var TableShape = import_effect22.Schema.extend(ComputeShape, import_effect22.Schema.Struct({
2214
+ type: import_effect22.Schema.Literal("table")
2073
2215
  }));
2074
2216
  var createTable = (props) => createShape({
2075
2217
  type: "table",
@@ -2080,9 +2222,14 @@ var createTable = (props) => createShape({
2080
2222
  ...props
2081
2223
  });
2082
2224
  var TableComponent = ({ shape }) => {
2083
- return /* @__PURE__ */ import_react25.default.createElement(Box, {
2084
- shape
2085
- });
2225
+ var _effect = (0, import_tracking21.useSignals)();
2226
+ try {
2227
+ return /* @__PURE__ */ import_react25.default.createElement(Box, {
2228
+ shape
2229
+ });
2230
+ } finally {
2231
+ _effect.f();
2232
+ }
2086
2233
  };
2087
2234
  var tableShape = {
2088
2235
  type: "table",
@@ -2094,49 +2241,54 @@ var tableShape = {
2094
2241
  resizable: true
2095
2242
  };
2096
2243
  var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
2097
- var TemplateShape = import_echo_schema24.S.extend(ComputeShape, import_echo_schema24.S.Struct({
2098
- type: import_echo_schema24.S.Literal("template"),
2099
- valueType: import_echo_schema24.S.optional(import_conductor22.ComputeValueType)
2244
+ var TemplateShape = import_effect23.Schema.extend(ComputeShape, import_effect23.Schema.Struct({
2245
+ type: import_effect23.Schema.Literal("template"),
2246
+ valueType: import_effect23.Schema.optional(import_conductor22.ComputeValueType)
2100
2247
  }));
2101
2248
  var TextInputComponent3 = ({ shape, title, ...props }) => {
2102
- const { node } = useComputeNodeState(shape);
2103
- const inputRef = (0, import_react26.useRef)(null);
2104
- const handleEnter = (text) => {
2105
- const value = text.trim();
2106
- if (value.length) {
2107
- const schema = (0, import_conductor22.getTemplateInputSchema)(node);
2108
- node.value = value;
2109
- node.inputSchema = (0, import_echo_schema24.toJsonSchema)(schema);
2110
- }
2111
- };
2112
- const handleTypeChange = (newType) => {
2113
- (0, import_invariant5.invariant)(import_echo_schema24.S.is(import_conductor22.ComputeValueType)(newType), "Invalid type", {
2114
- F: __dxlog_file6,
2115
- L: 57,
2116
- S: void 0,
2117
- A: [
2118
- "S.is(ComputeValueType)(newType)",
2119
- "'Invalid type'"
2120
- ]
2121
- });
2122
- node.valueType = newType;
2123
- node.inputSchema = (0, import_echo_schema24.toJsonSchema)((0, import_conductor22.getTemplateInputSchema)(node));
2124
- };
2125
- return /* @__PURE__ */ import_react26.default.createElement(Box, {
2126
- shape,
2127
- title: "Template",
2128
- status: /* @__PURE__ */ import_react26.default.createElement(TypeSelect, {
2129
- value: node.valueType ?? "string",
2130
- onValueChange: handleTypeChange
2131
- })
2132
- }, /* @__PURE__ */ import_react26.default.createElement(import_react_ui_canvas_editor19.TextBox, {
2133
- ...props,
2134
- ref: inputRef,
2135
- value: node.value,
2136
- language: node.valueType === "object" ? "json" : void 0,
2137
- onBlur: handleEnter,
2138
- onEnter: handleEnter
2139
- }));
2249
+ var _effect = (0, import_tracking22.useSignals)();
2250
+ try {
2251
+ const { node } = useComputeNodeState(shape);
2252
+ const inputRef = (0, import_react26.useRef)(null);
2253
+ const handleEnter = (text) => {
2254
+ const value = text.trim();
2255
+ if (value.length) {
2256
+ const schema = (0, import_conductor22.getTemplateInputSchema)(node);
2257
+ node.value = value;
2258
+ node.inputSchema = (0, import_echo_schema5.toJsonSchema)(schema);
2259
+ }
2260
+ };
2261
+ const handleTypeChange = (newType) => {
2262
+ (0, import_invariant5.invariant)(import_effect23.Schema.is(import_conductor22.ComputeValueType)(newType), "Invalid type", {
2263
+ F: __dxlog_file6,
2264
+ L: 58,
2265
+ S: void 0,
2266
+ A: [
2267
+ "Schema.is(ComputeValueType)(newType)",
2268
+ "'Invalid type'"
2269
+ ]
2270
+ });
2271
+ node.valueType = newType;
2272
+ node.inputSchema = (0, import_echo_schema5.toJsonSchema)((0, import_conductor22.getTemplateInputSchema)(node));
2273
+ };
2274
+ return /* @__PURE__ */ import_react26.default.createElement(Box, {
2275
+ shape,
2276
+ title: "Template",
2277
+ status: /* @__PURE__ */ import_react26.default.createElement(TypeSelect, {
2278
+ value: node.valueType ?? "string",
2279
+ onValueChange: handleTypeChange
2280
+ })
2281
+ }, /* @__PURE__ */ import_react26.default.createElement(import_react_ui_canvas_editor19.TextBox, {
2282
+ ...props,
2283
+ ref: inputRef,
2284
+ value: node.value,
2285
+ language: node.valueType === "object" ? "json" : void 0,
2286
+ onBlur: handleEnter,
2287
+ onEnter: handleEnter
2288
+ }));
2289
+ } finally {
2290
+ _effect.f();
2291
+ }
2140
2292
  };
2141
2293
  var createTemplate = (props) => createShape({
2142
2294
  type: "template",
@@ -2158,8 +2310,8 @@ var templateShape = {
2158
2310
  getAnchors: (shape) => createFunctionAnchors(shape, import_conductor22.VoidInput, import_conductor22.TemplateOutput),
2159
2311
  resizable: true
2160
2312
  };
2161
- var TextShape = import_echo_schema25.S.extend(ComputeShape, import_echo_schema25.S.Struct({
2162
- type: import_echo_schema25.S.Literal("text")
2313
+ var TextShape = import_effect24.Schema.extend(ComputeShape, import_effect24.Schema.Struct({
2314
+ type: import_effect24.Schema.Literal("text")
2163
2315
  }));
2164
2316
  var createText = (props) => createShape({
2165
2317
  type: "text",
@@ -2170,20 +2322,25 @@ var createText = (props) => createShape({
2170
2322
  ...props
2171
2323
  });
2172
2324
  var TextComponent = ({ shape }) => {
2173
- const { runtime } = useComputeNodeState(shape);
2174
- const input = runtime.inputs[import_conductor23.DEFAULT_INPUT];
2175
- const value = input?.type === "executed" ? input.value : 0;
2176
- const handleAction = (action) => {
2177
- if (action === "run") {
2178
- runtime.evalNode();
2179
- }
2180
- };
2181
- return /* @__PURE__ */ import_react27.default.createElement(Box, {
2182
- shape,
2183
- onAction: handleAction
2184
- }, /* @__PURE__ */ import_react27.default.createElement(import_react_ui_canvas_editor20.TextBox, {
2185
- value
2186
- }));
2325
+ var _effect = (0, import_tracking23.useSignals)();
2326
+ try {
2327
+ const { runtime } = useComputeNodeState(shape);
2328
+ const input = runtime.inputs[import_conductor23.DEFAULT_INPUT];
2329
+ const value = input?.type === "executed" ? input.value : 0;
2330
+ const handleAction = (action) => {
2331
+ if (action === "run") {
2332
+ runtime.evalNode();
2333
+ }
2334
+ };
2335
+ return /* @__PURE__ */ import_react27.default.createElement(Box, {
2336
+ shape,
2337
+ onAction: handleAction
2338
+ }, /* @__PURE__ */ import_react27.default.createElement(import_react_ui_canvas_editor20.TextBox, {
2339
+ value
2340
+ }));
2341
+ } finally {
2342
+ _effect.f();
2343
+ }
2187
2344
  };
2188
2345
  var textShape = {
2189
2346
  type: "text",
@@ -2200,9 +2357,9 @@ var textShape = {
2200
2357
  resizable: true
2201
2358
  };
2202
2359
  var InputSchema2 = (0, import_conductor24.createInputSchema)(import_conductor24.GptMessage);
2203
- var OutputSchema2 = (0, import_conductor24.createOutputSchema)(import_echo_schema26.S.mutable(import_echo_schema26.S.Array(import_conductor24.GptMessage)));
2204
- var ThreadShape = import_echo_schema26.S.extend(ComputeShape, import_echo_schema26.S.Struct({
2205
- type: import_echo_schema26.S.Literal("thread")
2360
+ var OutputSchema2 = (0, import_conductor24.createOutputSchema)(import_effect25.Schema.mutable(import_effect25.Schema.Array(import_conductor24.GptMessage)));
2361
+ var ThreadShape = import_effect25.Schema.extend(ComputeShape, import_effect25.Schema.Struct({
2362
+ type: import_effect25.Schema.Literal("thread")
2206
2363
  }));
2207
2364
  var createThread = (props) => createShape({
2208
2365
  type: "thread",
@@ -2213,39 +2370,49 @@ var createThread = (props) => createShape({
2213
2370
  ...props
2214
2371
  });
2215
2372
  var ThreadComponent = ({ shape }) => {
2216
- const items = [];
2217
- const scrollRef = (0, import_react28.useRef)(null);
2218
- (0, import_react28.useEffect)(() => {
2219
- if (scrollRef.current) {
2220
- scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2221
- }
2222
- }, [
2223
- items
2224
- ]);
2225
- return /* @__PURE__ */ import_react28.default.createElement(Box, {
2226
- shape
2227
- }, /* @__PURE__ */ import_react28.default.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__ */ import_react28.default.createElement(ThreadItem, {
2233
- key: i,
2234
- item
2235
- }))));
2373
+ var _effect = (0, import_tracking24.useSignals)();
2374
+ try {
2375
+ const items = [];
2376
+ const scrollRef = (0, import_react28.useRef)(null);
2377
+ (0, import_react28.useEffect)(() => {
2378
+ if (scrollRef.current) {
2379
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
2380
+ }
2381
+ }, [
2382
+ items
2383
+ ]);
2384
+ return /* @__PURE__ */ import_react28.default.createElement(Box, {
2385
+ shape
2386
+ }, /* @__PURE__ */ import_react28.default.createElement("div", {
2387
+ ref: scrollRef,
2388
+ className: "flex flex-col w-full overflow-y-scroll gap-2 p-2"
2389
+ }, [
2390
+ ...items
2391
+ ].map((item, i) => /* @__PURE__ */ import_react28.default.createElement(ThreadItem, {
2392
+ key: i,
2393
+ item
2394
+ }))));
2395
+ } finally {
2396
+ _effect.f();
2397
+ }
2236
2398
  };
2237
2399
  var ThreadItem = ({ classNames, item }) => {
2238
- if (typeof item !== "object") {
2400
+ var _effect = (0, import_tracking24.useSignals)();
2401
+ try {
2402
+ if (typeof item !== "object") {
2403
+ return /* @__PURE__ */ import_react28.default.createElement("div", {
2404
+ className: (0, import_react_ui_theme5.mx)(classNames)
2405
+ }, item);
2406
+ }
2407
+ const { role, message } = item;
2239
2408
  return /* @__PURE__ */ import_react28.default.createElement("div", {
2240
- className: (0, import_react_ui_theme5.mx)(classNames)
2241
- }, item);
2409
+ className: (0, import_react_ui_theme5.mx)("flex", classNames, role === "user" && "justify-end")
2410
+ }, /* @__PURE__ */ import_react28.default.createElement("div", {
2411
+ className: (0, import_react_ui_theme5.mx)("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")
2412
+ }, message));
2413
+ } finally {
2414
+ _effect.f();
2242
2415
  }
2243
- const { role, message } = item;
2244
- return /* @__PURE__ */ import_react28.default.createElement("div", {
2245
- className: (0, import_react_ui_theme5.mx)("flex", classNames, role === "user" && "justify-end")
2246
- }, /* @__PURE__ */ import_react28.default.createElement("div", {
2247
- className: (0, import_react_ui_theme5.mx)("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")
2248
- }, message));
2249
2416
  };
2250
2417
  var threadShape = {
2251
2418
  type: "thread",
@@ -2256,8 +2423,8 @@ var threadShape = {
2256
2423
  getAnchors: (shape) => createFunctionAnchors(shape, InputSchema2, OutputSchema2),
2257
2424
  resizable: true
2258
2425
  };
2259
- var TextToImageShape = import_echo_schema27.S.extend(ComputeShape, import_echo_schema27.S.Struct({
2260
- type: import_echo_schema27.S.Literal("text-to-image")
2426
+ var TextToImageShape = import_effect26.Schema.extend(ComputeShape, import_effect26.Schema.Struct({
2427
+ type: import_effect26.Schema.Literal("text-to-image")
2261
2428
  }));
2262
2429
  var createTextToImage = (props) => createShape({
2263
2430
  type: "text-to-image",
@@ -2268,9 +2435,14 @@ var createTextToImage = (props) => createShape({
2268
2435
  ...props
2269
2436
  });
2270
2437
  var TextToImageComponent = ({ shape }) => {
2271
- return /* @__PURE__ */ import_react29.default.createElement(Box, {
2272
- shape
2273
- });
2438
+ var _effect = (0, import_tracking25.useSignals)();
2439
+ try {
2440
+ return /* @__PURE__ */ import_react29.default.createElement(Box, {
2441
+ shape
2442
+ });
2443
+ } finally {
2444
+ _effect.f();
2445
+ }
2274
2446
  };
2275
2447
  var textToImageShape = {
2276
2448
  type: "text-to-image",
@@ -2285,12 +2457,12 @@ var textToImageShape = {
2285
2457
  }
2286
2458
  })
2287
2459
  };
2288
- var TriggerShape = import_echo_schema28.S.extend(ComputeShape, import_echo_schema28.S.Struct({
2289
- type: import_echo_schema28.S.Literal("trigger"),
2290
- functionTrigger: import_echo_schema28.S.optional((0, import_echo_schema28.Ref)(import_types2.FunctionTrigger))
2460
+ var TriggerShape = import_effect27.Schema.extend(ComputeShape, import_effect27.Schema.Struct({
2461
+ type: import_effect27.Schema.Literal("trigger"),
2462
+ functionTrigger: import_effect27.Schema.optional((0, import_echo_schema6.Ref)(import_functions2.FunctionTrigger))
2291
2463
  }));
2292
2464
  var createTrigger = (props) => {
2293
- const functionTrigger = (0, import_echo3.create)(import_types2.FunctionTrigger, {
2465
+ const functionTrigger = (0, import_echo3.live)(import_functions2.FunctionTrigger, {
2294
2466
  enabled: true,
2295
2467
  spec: createTriggerSpec(props)
2296
2468
  });
@@ -2299,93 +2471,103 @@ var createTrigger = (props) => {
2299
2471
  functionTrigger: (0, import_echo3.makeRef)(functionTrigger),
2300
2472
  size: {
2301
2473
  width: 192,
2302
- height: getHeight(import_conductor25.EmailTriggerOutput)
2474
+ height: getHeight(import_functions2.EmailTriggerOutput)
2303
2475
  },
2304
2476
  ...props
2305
2477
  });
2306
2478
  };
2307
2479
  var TriggerComponent = ({ shape }) => {
2308
- const space = (0, import_echo3.useSpace)();
2309
- const functionTrigger = shape.functionTrigger?.target;
2310
- (0, import_react30.useEffect)(() => {
2311
- if (functionTrigger && !functionTrigger.spec) {
2312
- functionTrigger.spec = createTriggerSpec({
2313
- triggerKind: import_types2.TriggerKind.Email,
2314
- spaceId: space?.id
2315
- });
2316
- }
2317
- }, [
2318
- functionTrigger,
2319
- functionTrigger?.spec
2320
- ]);
2321
- (0, import_react30.useEffect)(() => {
2322
- shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.type ?? import_types2.TriggerKind.Email));
2323
- }, [
2324
- functionTrigger?.spec?.type
2325
- ]);
2326
- const setKind = (kind) => {
2327
- if (functionTrigger?.spec?.type !== kind) {
2328
- functionTrigger.spec = createTriggerSpec({
2329
- triggerKind: import_types2.TriggerKind.Email,
2330
- spaceId: space?.id
2331
- });
2480
+ var _effect = (0, import_tracking26.useSignals)();
2481
+ try {
2482
+ const space = (0, import_echo3.useSpace)();
2483
+ const functionTrigger = shape.functionTrigger?.target;
2484
+ (0, import_react30.useEffect)(() => {
2485
+ if (functionTrigger && !functionTrigger.spec) {
2486
+ functionTrigger.spec = createTriggerSpec({
2487
+ triggerKind: import_functions2.TriggerKind.Email,
2488
+ spaceId: space?.id
2489
+ });
2490
+ }
2491
+ }, [
2492
+ functionTrigger,
2493
+ functionTrigger?.spec
2494
+ ]);
2495
+ (0, import_react30.useEffect)(() => {
2496
+ shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.kind ?? import_functions2.TriggerKind.Email));
2497
+ }, [
2498
+ functionTrigger?.spec?.kind
2499
+ ]);
2500
+ const setKind = (kind) => {
2501
+ if (functionTrigger?.spec?.kind !== kind) {
2502
+ functionTrigger.spec = createTriggerSpec({
2503
+ triggerKind: kind,
2504
+ spaceId: space?.id
2505
+ });
2506
+ }
2507
+ };
2508
+ if (!functionTrigger?.spec) {
2509
+ return;
2332
2510
  }
2333
- };
2334
- if (!functionTrigger?.spec) {
2335
- return;
2511
+ return /* @__PURE__ */ import_react30.default.createElement(FunctionBody, {
2512
+ shape,
2513
+ status: /* @__PURE__ */ import_react30.default.createElement(TriggerKindSelect, {
2514
+ value: functionTrigger.spec?.kind,
2515
+ onValueChange: (kind) => setKind(kind)
2516
+ }),
2517
+ inputSchema: import_conductor25.VoidInput,
2518
+ outputSchema: getOutputSchema(functionTrigger.spec.kind)
2519
+ });
2520
+ } finally {
2521
+ _effect.f();
2336
2522
  }
2337
- return /* @__PURE__ */ import_react30.default.createElement(FunctionBody, {
2338
- shape,
2339
- status: /* @__PURE__ */ import_react30.default.createElement(TriggerKindSelect, {
2340
- value: functionTrigger.spec?.type,
2341
- onValueChange: (kind) => setKind(kind)
2342
- }),
2343
- inputSchema: import_conductor25.VoidInput,
2344
- outputSchema: getOutputSchema(functionTrigger.spec.type)
2345
- });
2346
2523
  };
2347
2524
  var TriggerKindSelect = ({ value, onValueChange }) => {
2348
- return /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Root, {
2349
- value,
2350
- onValueChange
2351
- }, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.TriggerButton, {
2352
- variant: "ghost",
2353
- classNames: "w-full !px-0"
2354
- }), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Portal, null, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Content, null, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.ScrollUpButton, null), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Viewport, null, Object.values(import_types2.TriggerKind).map((type) => /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Option, {
2355
- key: type,
2356
- value: type
2357
- }, type))), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.ScrollDownButton, null), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Arrow, null))));
2525
+ var _effect = (0, import_tracking26.useSignals)();
2526
+ try {
2527
+ return /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Root, {
2528
+ value,
2529
+ onValueChange
2530
+ }, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.TriggerButton, {
2531
+ variant: "ghost",
2532
+ classNames: "w-full !px-0"
2533
+ }), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Portal, null, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Content, null, /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.ScrollUpButton, null), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Viewport, null, Object.values(import_functions2.TriggerKind).map((kind) => /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Option, {
2534
+ key: kind,
2535
+ value: kind
2536
+ }, kind))), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.ScrollDownButton, null), /* @__PURE__ */ import_react30.default.createElement(import_react_ui8.Select.Arrow, null))));
2537
+ } finally {
2538
+ _effect.f();
2539
+ }
2358
2540
  };
2359
2541
  var createTriggerSpec = (props) => {
2360
- const kind = props.triggerKind ?? import_types2.TriggerKind.Email;
2542
+ const kind = props.triggerKind ?? import_functions2.TriggerKind.Email;
2361
2543
  switch (kind) {
2362
- case import_types2.TriggerKind.Timer:
2544
+ case import_functions2.TriggerKind.Timer:
2363
2545
  return {
2364
- type: import_types2.TriggerKind.Timer,
2546
+ kind: import_functions2.TriggerKind.Timer,
2365
2547
  cron: "*/10 * * * * *"
2366
2548
  };
2367
- case import_types2.TriggerKind.Webhook:
2549
+ case import_functions2.TriggerKind.Webhook:
2368
2550
  return {
2369
- type: import_types2.TriggerKind.Webhook,
2551
+ kind: import_functions2.TriggerKind.Webhook,
2370
2552
  method: "POST"
2371
2553
  };
2372
- case import_types2.TriggerKind.Subscription:
2554
+ case import_functions2.TriggerKind.Subscription:
2373
2555
  return {
2374
- type: import_types2.TriggerKind.Subscription,
2556
+ kind: import_functions2.TriggerKind.Subscription,
2375
2557
  filter: {}
2376
2558
  };
2377
- case import_types2.TriggerKind.Email:
2559
+ case import_functions2.TriggerKind.Email:
2378
2560
  return {
2379
- type: import_types2.TriggerKind.Email
2561
+ kind: import_functions2.TriggerKind.Email
2380
2562
  };
2381
- case import_types2.TriggerKind.Queue: {
2382
- const dxn = new import_keys2.DXN(import_keys2.DXN.kind.QUEUE, [
2563
+ case import_functions2.TriggerKind.Queue: {
2564
+ const dxn = new import_keys.DXN(import_keys.DXN.kind.QUEUE, [
2383
2565
  "data",
2384
- props.spaceId ?? import_keys2.SpaceId.random(),
2385
- import_echo_schema28.ObjectId.random()
2566
+ props.spaceId ?? import_keys.SpaceId.random(),
2567
+ import_echo_schema6.ObjectId.random()
2386
2568
  ]).toString();
2387
2569
  return {
2388
- type: import_types2.TriggerKind.Queue,
2570
+ kind: import_functions2.TriggerKind.Queue,
2389
2571
  queue: dxn
2390
2572
  };
2391
2573
  }
@@ -2393,11 +2575,11 @@ var createTriggerSpec = (props) => {
2393
2575
  };
2394
2576
  var getOutputSchema = (kind) => {
2395
2577
  const kindToSchema = {
2396
- [import_types2.TriggerKind.Email]: import_conductor25.EmailTriggerOutput,
2397
- [import_types2.TriggerKind.Subscription]: import_conductor25.SubscriptionTriggerOutput,
2398
- [import_types2.TriggerKind.Timer]: import_conductor25.TimerTriggerOutput,
2399
- [import_types2.TriggerKind.Webhook]: import_conductor25.WebhookTriggerOutput,
2400
- [import_types2.TriggerKind.Queue]: import_conductor25.QueueTriggerOutput
2578
+ [import_functions2.TriggerKind.Email]: import_functions2.EmailTriggerOutput,
2579
+ [import_functions2.TriggerKind.Subscription]: import_functions2.SubscriptionTriggerOutput,
2580
+ [import_functions2.TriggerKind.Timer]: import_functions2.TimerTriggerOutput,
2581
+ [import_functions2.TriggerKind.Webhook]: import_functions2.WebhookTriggerOutput,
2582
+ [import_functions2.TriggerKind.Queue]: import_functions2.QueueTriggerOutput
2401
2583
  };
2402
2584
  return kindToSchema[kind];
2403
2585
  };
@@ -2407,11 +2589,11 @@ var triggerShape = {
2407
2589
  icon: "ph--lightning--regular",
2408
2590
  component: TriggerComponent,
2409
2591
  createShape: createTrigger,
2410
- getAnchors: (shape) => createFunctionAnchors(shape, import_conductor25.VoidInput, getOutputSchema(shape.functionTrigger?.target?.spec?.type ?? import_types2.TriggerKind.Email))
2592
+ getAnchors: (shape) => createFunctionAnchors(shape, import_conductor25.VoidInput, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? import_functions2.TriggerKind.Email))
2411
2593
  };
2412
2594
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/GptRealtime.tsx";
2413
- var GptRealtimeShape = import_echo_schema29.S.extend(ComputeShape, import_echo_schema29.S.Struct({
2414
- type: import_echo_schema29.S.Literal("gpt-realtime")
2595
+ var GptRealtimeShape = import_effect28.Schema.extend(ComputeShape, import_effect28.Schema.Struct({
2596
+ type: import_effect28.Schema.Literal("gpt-realtime")
2415
2597
  }));
2416
2598
  var createGptRealtime = (props) => createShape({
2417
2599
  type: "gpt-realtime",
@@ -2422,100 +2604,105 @@ var createGptRealtime = (props) => createShape({
2422
2604
  ...props
2423
2605
  });
2424
2606
  var GptRealtimeComponent = ({ shape }) => {
2425
- const [isLive, setIsLive] = (0, import_react31.useState)(false);
2426
- const [isReady, setIsReady] = (0, import_react31.useState)(false);
2427
- const config = (0, import_react_client2.useConfig)();
2428
- const start = async () => {
2429
- setIsLive(true);
2430
- try {
2431
- const peerConnection = new RTCPeerConnection();
2432
- peerConnection.ontrack = (event) => {
2433
- const audioElement = document.createElement("audio");
2434
- audioElement.srcObject = event.streams[0];
2435
- audioElement.autoplay = true;
2436
- audioElement.controls = false;
2437
- audioElement.style.display = "none";
2438
- document.body.appendChild(audioElement);
2439
- setIsReady(true);
2440
- };
2441
- const stream = await navigator.mediaDevices.getUserMedia({
2442
- audio: true
2443
- });
2444
- stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, {
2445
- direction: "sendrecv"
2446
- }));
2447
- const offer = await peerConnection.createOffer();
2448
- await peerConnection.setLocalDescription(offer);
2449
- const aiServiceUrl = new URL("/rtc-connect", config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL);
2450
- const response = await fetch(aiServiceUrl, {
2451
- method: "POST",
2452
- body: offer.sdp,
2453
- headers: {
2454
- "Content-Type": "application/sdp"
2455
- }
2456
- });
2457
- const answer = await response.text();
2458
- await peerConnection.setRemoteDescription({
2459
- sdp: answer,
2460
- type: "answer"
2461
- });
2462
- const dataChannel = peerConnection.createDataChannel("response");
2463
- const configureData = () => {
2464
- import_log2.log.info("Configuring data channel", void 0, {
2465
- F: __dxlog_file7,
2466
- L: 87,
2467
- S: void 0,
2468
- C: (f, a) => f(...a)
2607
+ var _effect = (0, import_tracking27.useSignals)();
2608
+ try {
2609
+ const [isLive, setIsLive] = (0, import_react31.useState)(false);
2610
+ const [isReady, setIsReady] = (0, import_react31.useState)(false);
2611
+ const config = (0, import_react_client2.useConfig)();
2612
+ const start = async () => {
2613
+ setIsLive(true);
2614
+ try {
2615
+ const peerConnection = new RTCPeerConnection();
2616
+ peerConnection.ontrack = (event) => {
2617
+ const audioElement = document.createElement("audio");
2618
+ audioElement.srcObject = event.streams[0];
2619
+ audioElement.autoplay = true;
2620
+ audioElement.controls = false;
2621
+ audioElement.style.display = "none";
2622
+ document.body.appendChild(audioElement);
2623
+ setIsReady(true);
2624
+ };
2625
+ const stream = await navigator.mediaDevices.getUserMedia({
2626
+ audio: true
2469
2627
  });
2470
- const event = {
2471
- type: "session.update",
2472
- session: {
2473
- modalities: [
2474
- "text",
2475
- "audio"
2476
- ],
2477
- // Provide the tools. Note they match the keys in the `fns` object above
2478
- tools: []
2628
+ stream.getTracks().forEach((track) => peerConnection.addTransceiver(track, {
2629
+ direction: "sendrecv"
2630
+ }));
2631
+ const offer = await peerConnection.createOffer();
2632
+ await peerConnection.setLocalDescription(offer);
2633
+ const aiServiceUrl = new URL("/rtc-connect", config.values.runtime?.services?.ai?.server ?? DEFAULT_AI_SERVICE_URL);
2634
+ const response = await fetch(aiServiceUrl, {
2635
+ method: "POST",
2636
+ body: offer.sdp,
2637
+ headers: {
2638
+ "Content-Type": "application/sdp"
2479
2639
  }
2640
+ });
2641
+ const answer = await response.text();
2642
+ await peerConnection.setRemoteDescription({
2643
+ sdp: answer,
2644
+ type: "answer"
2645
+ });
2646
+ const dataChannel = peerConnection.createDataChannel("response");
2647
+ const configureData = () => {
2648
+ import_log2.log.info("Configuring data channel", void 0, {
2649
+ F: __dxlog_file7,
2650
+ L: 87,
2651
+ S: void 0,
2652
+ C: (f, a) => f(...a)
2653
+ });
2654
+ const event = {
2655
+ type: "session.update",
2656
+ session: {
2657
+ modalities: [
2658
+ "text",
2659
+ "audio"
2660
+ ],
2661
+ // Provide the tools. Note they match the keys in the `fns` object above
2662
+ tools: []
2663
+ }
2664
+ };
2665
+ dataChannel.send(JSON.stringify(event));
2480
2666
  };
2481
- dataChannel.send(JSON.stringify(event));
2482
- };
2483
- dataChannel.addEventListener("open", (ev) => {
2484
- import_log2.log.info("Opening data channel", {
2485
- ev
2667
+ dataChannel.addEventListener("open", (ev) => {
2668
+ import_log2.log.info("Opening data channel", {
2669
+ ev
2670
+ }, {
2671
+ F: __dxlog_file7,
2672
+ L: 100,
2673
+ S: void 0,
2674
+ C: (f, a) => f(...a)
2675
+ });
2676
+ configureData();
2677
+ });
2678
+ dataChannel.addEventListener("message", async (ev) => {
2679
+ const msg = JSON.parse(ev.data);
2680
+ if (msg.type === "response.function_call_arguments.done") {
2681
+ }
2682
+ });
2683
+ } catch (error) {
2684
+ import_log2.log.error("Error in realtime session:", {
2685
+ error
2486
2686
  }, {
2487
2687
  F: __dxlog_file7,
2488
- L: 100,
2688
+ L: 140,
2489
2689
  S: void 0,
2490
2690
  C: (f, a) => f(...a)
2491
2691
  });
2492
- configureData();
2493
- });
2494
- dataChannel.addEventListener("message", async (ev) => {
2495
- const msg = JSON.parse(ev.data);
2496
- if (msg.type === "response.function_call_arguments.done") {
2497
- }
2498
- });
2499
- } catch (error) {
2500
- import_log2.log.error("Error in realtime session:", {
2501
- error
2502
- }, {
2503
- F: __dxlog_file7,
2504
- L: 140,
2505
- S: void 0,
2506
- C: (f, a) => f(...a)
2507
- });
2508
- throw error;
2509
- }
2510
- };
2511
- return /* @__PURE__ */ import_react31.default.createElement("div", {
2512
- className: "flex w-full justify-center items-center"
2513
- }, /* @__PURE__ */ import_react31.default.createElement(import_react_ui9.Icon, {
2514
- icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2515
- size: 16,
2516
- classNames: !isLive && "cursor-pointer",
2517
- onClick: start
2518
- }));
2692
+ throw error;
2693
+ }
2694
+ };
2695
+ return /* @__PURE__ */ import_react31.default.createElement("div", {
2696
+ className: "flex w-full justify-center items-center"
2697
+ }, /* @__PURE__ */ import_react31.default.createElement(import_react_ui9.Icon, {
2698
+ icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2699
+ size: 16,
2700
+ classNames: !isLive && "cursor-pointer",
2701
+ onClick: start
2702
+ }));
2703
+ } finally {
2704
+ _effect.f();
2705
+ }
2519
2706
  };
2520
2707
  var gptRealtimeShape = {
2521
2708
  type: "gpt-realtime",
@@ -2524,9 +2711,9 @@ var gptRealtimeShape = {
2524
2711
  component: GptRealtimeComponent,
2525
2712
  createShape: createGptRealtime,
2526
2713
  // TODO(dmaretskyi): Can we fetch the schema dynamically?
2527
- getAnchors: (shape) => createFunctionAnchors(shape, import_echo_schema29.S.Struct({
2528
- audio: import_echo_schema29.S.Any
2529
- }), import_echo_schema29.S.Struct({})),
2714
+ getAnchors: (shape) => createFunctionAnchors(shape, import_effect28.Schema.Struct({
2715
+ audio: import_effect28.Schema.Any
2716
+ }), import_effect28.Schema.Struct({})),
2530
2717
  resizable: true
2531
2718
  };
2532
2719
  var DEFAULT_AI_SERVICE_URL = "http://localhost:8788";
@@ -2592,8 +2779,7 @@ var computeShapes = [
2592
2779
  ];
2593
2780
  var ComputeShapeLayout = class extends import_react_ui_canvas_editor23.ShapeLayout {
2594
2781
  constructor(_controller, registry2) {
2595
- super(registry2);
2596
- this._controller = _controller;
2782
+ super(registry2), this._controller = _controller;
2597
2783
  }
2598
2784
  // TODO(burdon): Doesn't update.
2599
2785
  getAnchors(shape) {
@@ -2602,8 +2788,8 @@ var ComputeShapeLayout = class extends import_react_ui_canvas_editor23.ShapeLayo
2602
2788
  if (shape.node) {
2603
2789
  const node = this._controller.graph.getNode(shape.node);
2604
2790
  if (node.inputSchema || node.outputSchema) {
2605
- const inputSchema = node.inputSchema ? (0, import_echo_schema30.toEffectSchema)(node.inputSchema) : import_conductor26.DefaultInput;
2606
- const outputSchema = node.outputSchema ? (0, import_echo_schema30.toEffectSchema)(node.outputSchema) : import_conductor26.DefaultOutput;
2791
+ const inputSchema = node.inputSchema ? (0, import_echo_schema7.toEffectSchema)(node.inputSchema) : import_conductor26.DefaultInput;
2792
+ const outputSchema = node.outputSchema ? (0, import_echo_schema7.toEffectSchema)(node.outputSchema) : import_conductor26.DefaultOutput;
2607
2793
  anchors = createFunctionAnchors(shape, inputSchema, outputSchema);
2608
2794
  }
2609
2795
  }