@dxos/react-ui-canvas-compute 0.8.4-main.5ad4a44 → 0.8.4-main.66e292d

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 (43) hide show
  1. package/dist/lib/browser/index.mjs +86 -106
  2. package/dist/lib/browser/index.mjs.map +3 -3
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +86 -106
  5. package/dist/lib/node-esm/index.mjs.map +3 -3
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/graph/controller.d.ts +11 -28
  8. package/dist/types/src/graph/controller.d.ts.map +1 -1
  9. package/dist/types/src/hooks/useComputeNodeState.d.ts +2 -2
  10. package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
  11. package/dist/types/src/shapes/RNG.d.ts.map +1 -1
  12. package/dist/types/src/shapes/Surface.d.ts.map +1 -1
  13. package/dist/types/src/shapes/Trigger.d.ts +3 -3
  14. package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
  15. package/dist/types/src/testing/circuits.d.ts +1 -1
  16. package/dist/types/src/testing/circuits.d.ts.map +1 -1
  17. package/dist/types/tsconfig.tsbuildinfo +1 -1
  18. package/package.json +42 -40
  19. package/src/compute.stories.tsx +6 -6
  20. package/src/graph/controller.ts +12 -5
  21. package/src/graph/node-defs.ts +3 -3
  22. package/src/hooks/useComputeNodeState.ts +4 -3
  23. package/src/hooks/useGraphMonitor.ts +2 -2
  24. package/src/schema.test.ts +7 -7
  25. package/src/shapes/Audio.tsx +1 -1
  26. package/src/shapes/Beacon.tsx +1 -1
  27. package/src/shapes/Boolean.tsx +2 -2
  28. package/src/shapes/Function.tsx +3 -3
  29. package/src/shapes/Gpt.tsx +1 -1
  30. package/src/shapes/GptRealtime.tsx +1 -1
  31. package/src/shapes/Queue.tsx +2 -2
  32. package/src/shapes/RNG.tsx +5 -1
  33. package/src/shapes/Scope.tsx +1 -1
  34. package/src/shapes/Surface.tsx +6 -2
  35. package/src/shapes/Switch.tsx +1 -1
  36. package/src/shapes/Table.tsx +3 -3
  37. package/src/shapes/Thread.tsx +5 -5
  38. package/src/shapes/Trigger.tsx +24 -41
  39. package/src/shapes/common/Box.tsx +5 -5
  40. package/src/shapes/common/FunctionBody.tsx +2 -2
  41. package/src/shapes/common/TypeSelect.tsx +1 -1
  42. package/src/shapes/defs.ts +3 -3
  43. package/src/testing/circuits.ts +2 -3
@@ -145,7 +145,7 @@ var useComputeNodeState = (shape) => {
145
145
  // src/hooks/useGraphMonitor.ts
146
146
  import { useMemo } from "react";
147
147
  import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
148
- import { ObjectId, Ref } from "@dxos/echo/internal";
148
+ import { Obj, Ref } from "@dxos/echo";
149
149
  import { invariant as invariant2 } from "@dxos/invariant";
150
150
  import { getSpace } from "@dxos/react-client/echo";
151
151
  import { isNonNullable } from "@dxos/util";
@@ -172,7 +172,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
172
172
  ]
173
173
  });
174
174
  return {
175
- id: ObjectId.random(),
175
+ id: Obj.ID.random(),
176
176
  source: sourceNode.node,
177
177
  target: targetNode.node,
178
178
  output,
@@ -272,7 +272,7 @@ var deleteTriggerObjects = (computeGraph, deleted) => {
272
272
  // src/graph/node-defs.ts
273
273
  import { NODE_INPUT, NODE_OUTPUT, getTemplateInputSchema, registry } from "@dxos/conductor";
274
274
  import { raise as raise2 } from "@dxos/debug";
275
- import { ObjectId as ObjectId2, toJsonSchema } from "@dxos/echo/internal";
275
+ import { JsonSchema, Obj as Obj2 } from "@dxos/echo";
276
276
  import { invariant as invariant3 } from "@dxos/invariant";
277
277
  var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
278
278
  var resolveComputeNode = async (node) => {
@@ -332,7 +332,7 @@ var nodeFactory = {
332
332
  valueType: shape.valueType,
333
333
  value: shape.text
334
334
  });
335
- node.inputSchema = toJsonSchema(getTemplateInputSchema(node));
335
+ node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
336
336
  return node;
337
337
  },
338
338
  ["text"]: () => createNode("text"),
@@ -340,25 +340,12 @@ var nodeFactory = {
340
340
  ["trigger"]: () => createNode(NODE_INPUT)
341
341
  };
342
342
  var createNode = (type, props) => ({
343
- id: ObjectId2.random(),
343
+ id: Obj2.ID.random(),
344
344
  type,
345
345
  ...props
346
346
  });
347
347
 
348
348
  // src/graph/controller.ts
349
- function _define_property(obj, key, value) {
350
- if (key in obj) {
351
- Object.defineProperty(obj, key, {
352
- value,
353
- enumerable: true,
354
- configurable: true,
355
- writable: true
356
- });
357
- } else {
358
- obj[key] = value;
359
- }
360
- return obj;
361
- }
362
349
  function _ts_decorate(decorators, target, key, desc) {
363
350
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
364
351
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -381,6 +368,29 @@ var createComputeGraphController = (graph, serviceContainer) => {
381
368
  };
382
369
  };
383
370
  var ComputeGraphController = class extends Resource {
371
+ _serviceContainer;
372
+ _graph;
373
+ _executor = new GraphExecutor({
374
+ computeNodeResolver: (node) => resolveComputeNode(node)
375
+ });
376
+ _diagnostics = [];
377
+ /**
378
+ * Canvas force-sets outputs of those nodes.
379
+ */
380
+ _forcedOutputs = {};
381
+ /**
382
+ * Runtime state of the execution graph.
383
+ */
384
+ _runtimeStateInputs = {};
385
+ _runtimeStateOutputs = {};
386
+ // TODO(burdon): Remove? Make state reactive?
387
+ update = new Event();
388
+ /** Computed result. */
389
+ output = new Event();
390
+ events = new Event();
391
+ constructor(_serviceContainer, _graph) {
392
+ super(), this._serviceContainer = _serviceContainer, this._graph = _graph;
393
+ }
384
394
  toJSON() {
385
395
  return {
386
396
  graph: this._graph,
@@ -441,8 +451,7 @@ var ComputeGraphController = class extends Resource {
441
451
  return this._runtimeStateOutputs[nodeId] ?? {};
442
452
  }
443
453
  setOutput(nodeId, property, value) {
444
- var _this__forcedOutputs, _nodeId;
445
- (_this__forcedOutputs = this._forcedOutputs)[_nodeId = nodeId] ?? (_this__forcedOutputs[_nodeId] = {});
454
+ this._forcedOutputs[nodeId] ??= {};
446
455
  this._forcedOutputs[nodeId][property] = value;
447
456
  queueMicrotask(async () => {
448
457
  try {
@@ -450,7 +459,7 @@ var ComputeGraphController = class extends Resource {
450
459
  } catch (err) {
451
460
  log.catch(err, void 0, {
452
461
  F: __dxlog_file4,
453
- L: 203,
462
+ L: 210,
454
463
  S: this,
455
464
  C: (f, a) => f(...a)
456
465
  });
@@ -544,7 +553,7 @@ var ComputeGraphController = class extends Resource {
544
553
  event
545
554
  }, {
546
555
  F: __dxlog_file4,
547
- L: 339,
556
+ L: 346,
548
557
  S: this,
549
558
  C: (f, a) => f(...a)
550
559
  });
@@ -567,13 +576,11 @@ var ComputeGraphController = class extends Resource {
567
576
  this.events.emit(event);
568
577
  }
569
578
  _onInputComputed(nodeId, property, value) {
570
- var _this__runtimeStateInputs, _nodeId;
571
- (_this__runtimeStateInputs = this._runtimeStateInputs)[_nodeId = nodeId] ?? (_this__runtimeStateInputs[_nodeId] = {});
579
+ this._runtimeStateInputs[nodeId] ??= {};
572
580
  this._runtimeStateInputs[nodeId][property] = value;
573
581
  }
574
582
  _onOutputComputed(nodeId, property, value) {
575
- var _this__runtimeStateOutputs, _nodeId;
576
- (_this__runtimeStateOutputs = this._runtimeStateOutputs)[_nodeId = nodeId] ?? (_this__runtimeStateOutputs[_nodeId] = {});
583
+ this._runtimeStateOutputs[nodeId] ??= {};
577
584
  this._runtimeStateOutputs[nodeId][property] = value;
578
585
  this.output.emit({
579
586
  nodeId,
@@ -581,19 +588,6 @@ var ComputeGraphController = class extends Resource {
581
588
  value
582
589
  });
583
590
  }
584
- constructor(_serviceContainer, _graph) {
585
- super(), _define_property(this, "_serviceContainer", void 0), _define_property(this, "_graph", void 0), _define_property(this, "_executor", void 0), _define_property(this, "_diagnostics", void 0), /**
586
- * Canvas force-sets outputs of those nodes.
587
- */
588
- _define_property(this, "_forcedOutputs", void 0), /**
589
- * Runtime state of the execution graph.
590
- */
591
- _define_property(this, "_runtimeStateInputs", void 0), _define_property(this, "_runtimeStateOutputs", void 0), // TODO(burdon): Remove? Make state reactive?
592
- _define_property(this, "update", void 0), /** Computed result. */
593
- _define_property(this, "output", void 0), _define_property(this, "events", void 0), this._serviceContainer = _serviceContainer, this._graph = _graph, this._executor = new GraphExecutor({
594
- computeNodeResolver: (node) => resolveComputeNode(node)
595
- }), this._diagnostics = [], this._forcedOutputs = {}, this._runtimeStateInputs = {}, this._runtimeStateOutputs = {}, this.update = new Event(), this.output = new Event(), this.events = new Event();
596
- }
597
591
  };
598
592
  _ts_decorate([
599
593
  synchronized
@@ -663,9 +657,9 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
663
657
  const { debug } = useEditorContext();
664
658
  return /* @__PURE__ */ React.createElement("div", {
665
659
  ref: forwardedRef,
666
- className: "flex flex-col h-full w-full justify-between"
660
+ className: "flex flex-col bs-full is-full justify-between"
667
661
  }, /* @__PURE__ */ React.createElement("div", {
668
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
662
+ className: "flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface"
669
663
  }, /* @__PURE__ */ React.createElement(Icon, {
670
664
  icon,
671
665
  classNames: "mx-2"
@@ -684,11 +678,11 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
684
678
  onAction?.("run");
685
679
  }
686
680
  })), /* @__PURE__ */ React.createElement("div", {
687
- className: mx("flex flex-col h-full grow overflow-hidden", classNames)
681
+ className: mx("flex flex-col bs-full grow overflow-hidden", classNames)
688
682
  }, children), /* @__PURE__ */ React.createElement("div", {
689
- className: "flex shrink-0 w-full justify-between items-center h-[32px] bg-hoverSurface"
683
+ className: "flex shrink-0 is-full justify-between items-center bs-[32px] bg-hoverSurface"
690
684
  }, /* @__PURE__ */ React.createElement("div", {
691
- className: "grow px-2 text-sm truncate"
685
+ className: "grow pli-2 text-sm truncate"
692
686
  }, debug ? shape.id : status), openable && /* @__PURE__ */ React.createElement(IconButton, {
693
687
  classNames: "p-1",
694
688
  variant: "ghost",
@@ -718,7 +712,7 @@ import { createAnchors, getParentShapeElement, rowHeight } from "@dxos/react-ui-
718
712
  import * as Schema2 from "effect/Schema";
719
713
  import * as SchemaAST from "effect/SchemaAST";
720
714
  import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
721
- import { ObjectId as ObjectId3 } from "@dxos/echo/internal";
715
+ import { Obj as Obj3 } from "@dxos/echo";
722
716
  import { Polygon } from "@dxos/react-ui-canvas-editor";
723
717
  var getProperties = (ast) => SchemaAST.getPropertySignatures(ast).map(({ name }) => ({
724
718
  name: name.toString()
@@ -736,13 +730,13 @@ var parseAnchorId = (id) => {
736
730
  };
737
731
  var ComputeShape = Schema2.extend(Polygon, Schema2.Struct({
738
732
  // TODO(burdon): Rename computeNode?
739
- node: Schema2.optional(ObjectId3.annotations({
733
+ node: Schema2.optional(Obj3.ID.annotations({
740
734
  description: "Compute node id"
741
735
  }))
742
736
  }).pipe(Schema2.mutable));
743
737
  var createShape = ({ id, ...rest }) => {
744
738
  return {
745
- id: id ?? ObjectId3.random(),
739
+ id: id ?? Obj3.ID.random(),
746
740
  ...rest
747
741
  };
748
742
  };
@@ -797,7 +791,7 @@ var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchem
797
791
  className: "flex flex-col"
798
792
  }, inputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
799
793
  key: name2,
800
- className: "px-2 truncate text-sm font-mono items-center",
794
+ className: "pli-2 truncate text-sm font-mono items-center",
801
795
  style: {
802
796
  height: rowHeight
803
797
  }
@@ -805,7 +799,7 @@ var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchem
805
799
  className: "flex flex-col"
806
800
  }, outputs?.map(({ name: name2 }) => /* @__PURE__ */ React2.createElement("div", {
807
801
  key: name2,
808
- className: "px-2 truncate text-sm font-mono items-center text-right",
802
+ className: "pli-2 truncate text-sm font-mono items-center text-right",
809
803
  style: {
810
804
  height: rowHeight
811
805
  }
@@ -847,7 +841,7 @@ var TypeSelect = ({ value, onValueChange }) => {
847
841
  onValueChange
848
842
  }, /* @__PURE__ */ React3.createElement(Select.TriggerButton, {
849
843
  variant: "ghost",
850
- classNames: "w-full !px-0"
844
+ classNames: "is-full !pli-0"
851
845
  }), /* @__PURE__ */ React3.createElement(Select.Portal, null, /* @__PURE__ */ React3.createElement(Select.Content, null, /* @__PURE__ */ React3.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React3.createElement(Select.Viewport, null, ComputeValueType.literals.map((type) => /* @__PURE__ */ React3.createElement(Select.Option, {
852
846
  key: type,
853
847
  value: type
@@ -958,7 +952,7 @@ var AudioComponent = ({ shape }) => {
958
952
  active
959
953
  ]);
960
954
  return /* @__PURE__ */ React6.createElement("div", {
961
- className: "flex w-full justify-center items-center"
955
+ className: "flex is-full justify-center items-center"
962
956
  }, /* @__PURE__ */ React6.createElement(Icon2, {
963
957
  icon: active ? "ph--microphone--regular" : "ph--microphone-slash--regular",
964
958
  classNames: [
@@ -1011,7 +1005,7 @@ var BeaconComponent = ({ shape }) => {
1011
1005
  const input = runtime.inputs[DEFAULT_INPUT3];
1012
1006
  const value = input?.type === "executed" ? input.value : false;
1013
1007
  return /* @__PURE__ */ React7.createElement("div", {
1014
- className: "flex w-full justify-center items-center"
1008
+ className: "flex is-full justify-center items-center"
1015
1009
  }, /* @__PURE__ */ React7.createElement(Icon3, {
1016
1010
  icon: "ph--sun--regular",
1017
1011
  classNames: [
@@ -1063,7 +1057,7 @@ var defineShape = ({ type, name, icon, symbol: Symbol, createShape: createShape2
1063
1057
  // Be careful not to name component factories with a capital letter.
1064
1058
  component: () => {
1065
1059
  return /* @__PURE__ */ React8.createElement("div", {
1066
- className: "flex w-full justify-center items-center"
1060
+ className: "flex is-full justify-center items-center"
1067
1061
  }, /* @__PURE__ */ React8.createElement(Symbol, null));
1068
1062
  },
1069
1063
  createShape: createShape2,
@@ -1090,7 +1084,7 @@ var createSymbol = (pathConstructor, inputs) => ({
1090
1084
  });
1091
1085
  return /* @__PURE__ */ React8.createElement("svg", {
1092
1086
  viewBox: `0 0 ${width} ${height}`,
1093
- className: "w-full h-full"
1087
+ className: "is-full bs-full"
1094
1088
  }, getAnchorPoints({
1095
1089
  x: 0,
1096
1090
  y: centerY
@@ -1421,7 +1415,7 @@ import * as Schema11 from "effect/Schema";
1421
1415
  import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
1422
1416
  import { AnyOutput, FunctionInput } from "@dxos/conductor";
1423
1417
  import { Ref as Ref2, getSnapshot, isInstanceOf } from "@dxos/echo/internal";
1424
- import { FunctionType, ScriptType } from "@dxos/functions";
1418
+ import { Function, Script } from "@dxos/functions";
1425
1419
  import { useClient } from "@dxos/react-client";
1426
1420
  import { Filter, parseId } from "@dxos/react-client/echo";
1427
1421
  import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
@@ -1450,10 +1444,10 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
1450
1444
  }
1451
1445
  const space = client.spaces.get(spaceId);
1452
1446
  const object = space?.db.getObjectById(objectId);
1453
- if (!space || !isInstanceOf(ScriptType, object)) {
1447
+ if (!space || !isInstanceOf(Script.Script, object)) {
1454
1448
  return;
1455
1449
  }
1456
- const { objects: [fn] } = await space.db.query(Filter.type(FunctionType, {
1450
+ const { objects: [fn] } = await space.db.query(Filter.type(Function.Function, {
1457
1451
  source: Ref2.make(object)
1458
1452
  })).run();
1459
1453
  if (!fn) {
@@ -1556,7 +1550,7 @@ var GptComponent = ({ shape }) => {
1556
1550
  return /* @__PURE__ */ React13.createElement(FunctionBody, {
1557
1551
  shape,
1558
1552
  content: /* @__PURE__ */ React13.createElement("div", {
1559
- className: "px-2 py-1 overflow-y-scroll"
1553
+ className: "pli-2 plb-1 overflow-y-auto"
1560
1554
  }, text),
1561
1555
  status: `${tokens} tokens`,
1562
1556
  inputSchema: meta.input,
@@ -1759,12 +1753,12 @@ var QueueComponent = ({ shape }) => {
1759
1753
  status: `${items.length} items`,
1760
1754
  onAction: handleAction
1761
1755
  }, /* @__PURE__ */ React16.createElement("div", {
1762
- className: "flex flex-col w-full overflow-y-scroll divide-y divide-separator"
1756
+ className: "flex flex-col is-full overflow-y-auto divide-y divide-separator"
1763
1757
  }, [
1764
1758
  ...items
1765
1759
  ].map((item, i) => /* @__PURE__ */ React16.createElement(QueueItem, {
1766
1760
  key: i,
1767
- classNames: "p-1 px-2",
1761
+ classNames: "p-1 pli-2",
1768
1762
  item
1769
1763
  }))));
1770
1764
  } finally {
@@ -1908,7 +1902,7 @@ var ScopeComponent = ({ shape }) => {
1908
1902
  const active = input?.type === "executed" ? input.value : false;
1909
1903
  const { getAverage } = useAudioStream(active);
1910
1904
  return /* @__PURE__ */ React18.createElement("div", {
1911
- className: "flex w-full justify-center items-center bg-black"
1905
+ className: "flex is-full justify-center items-center bg-black"
1912
1906
  }, /* @__PURE__ */ React18.createElement(Chaos, {
1913
1907
  active,
1914
1908
  getValue: getAverage,
@@ -1939,7 +1933,7 @@ var scopeShape = {
1939
1933
  import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
1940
1934
  import * as Schema18 from "effect/Schema";
1941
1935
  import React19 from "react";
1942
- import { Surface } from "@dxos/app-framework";
1936
+ import { Surface } from "@dxos/app-framework/react";
1943
1937
  import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
1944
1938
  import { createAnchorMap as createAnchorMap9 } from "@dxos/react-ui-canvas-editor";
1945
1939
  var SurfaceShape = Schema18.extend(ComputeShape, Schema18.Struct({
@@ -2022,7 +2016,7 @@ var SwitchComponent = ({ shape }) => {
2022
2016
  value
2023
2017
  ]);
2024
2018
  return /* @__PURE__ */ React20.createElement("div", {
2025
- className: "flex w-full justify-center items-center",
2019
+ className: "flex is-full justify-center items-center",
2026
2020
  onClick: (ev) => ev.stopPropagation()
2027
2021
  }, /* @__PURE__ */ React20.createElement(Input2.Root, null, /* @__PURE__ */ React20.createElement(Input2.Switch, {
2028
2022
  checked: value,
@@ -2051,9 +2045,9 @@ import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking
2051
2045
  import * as Schema20 from "effect/Schema";
2052
2046
  import React21 from "react";
2053
2047
  import { createInputSchema, createOutputSchema } from "@dxos/conductor";
2054
- import { DataType } from "@dxos/schema";
2055
- var InputSchema = createInputSchema(DataType.Message);
2056
- var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(DataType.Message)));
2048
+ import { Message } from "@dxos/types";
2049
+ var InputSchema = createInputSchema(Message.Message);
2050
+ var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(Message.Message)));
2057
2051
  var TableShape = Schema20.extend(ComputeShape, Schema20.Struct({
2058
2052
  type: Schema20.Literal("table")
2059
2053
  }));
@@ -2090,7 +2084,7 @@ import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking
2090
2084
  import * as Schema21 from "effect/Schema";
2091
2085
  import React22, { useRef as useRef5 } from "react";
2092
2086
  import { ComputeValueType as ComputeValueType3, TemplateOutput, VoidInput as VoidInput2, getTemplateInputSchema as getTemplateInputSchema2 } from "@dxos/conductor";
2093
- import { toJsonSchema as toJsonSchema2 } from "@dxos/echo/internal";
2087
+ import { toJsonSchema } from "@dxos/echo/internal";
2094
2088
  import { invariant as invariant5 } from "@dxos/invariant";
2095
2089
  import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
2096
2090
  var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
@@ -2108,7 +2102,7 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
2108
2102
  if (value.length) {
2109
2103
  const schema = getTemplateInputSchema2(node);
2110
2104
  node.value = value;
2111
- node.inputSchema = toJsonSchema2(schema);
2105
+ node.inputSchema = toJsonSchema(schema);
2112
2106
  }
2113
2107
  };
2114
2108
  const handleTypeChange = (newType) => {
@@ -2122,7 +2116,7 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
2122
2116
  ]
2123
2117
  });
2124
2118
  node.valueType = newType;
2125
- node.inputSchema = toJsonSchema2(getTemplateInputSchema2(node));
2119
+ node.inputSchema = toJsonSchema(getTemplateInputSchema2(node));
2126
2120
  };
2127
2121
  return /* @__PURE__ */ React22.createElement(Box, {
2128
2122
  shape,
@@ -2224,9 +2218,9 @@ import * as Schema23 from "effect/Schema";
2224
2218
  import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
2225
2219
  import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
2226
2220
  import { mx as mx3 } from "@dxos/react-ui-theme";
2227
- import { DataType as DataType2 } from "@dxos/schema";
2228
- var InputSchema2 = createInputSchema2(DataType2.Message);
2229
- var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(DataType2.Message)));
2221
+ import { Message as Message2 } from "@dxos/types";
2222
+ var InputSchema2 = createInputSchema2(Message2.Message);
2223
+ var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(Message2.Message)));
2230
2224
  var ThreadShape = Schema23.extend(ComputeShape, Schema23.Struct({
2231
2225
  type: Schema23.Literal("thread")
2232
2226
  }));
@@ -2254,7 +2248,7 @@ var ThreadComponent = ({ shape }) => {
2254
2248
  shape
2255
2249
  }, /* @__PURE__ */ React24.createElement("div", {
2256
2250
  ref: scrollRef,
2257
- className: "flex flex-col w-full overflow-y-scroll gap-2 p-2"
2251
+ className: "flex flex-col is-full overflow-y-auto gap-2 p-2"
2258
2252
  }, [
2259
2253
  ...items
2260
2254
  ].map((item, i) => /* @__PURE__ */ React24.createElement(ThreadItem, {
@@ -2277,7 +2271,7 @@ var ThreadItem = ({ classNames, item }) => {
2277
2271
  return /* @__PURE__ */ React24.createElement("div", {
2278
2272
  className: mx3("flex", classNames, role === "user" && "justify-end")
2279
2273
  }, /* @__PURE__ */ React24.createElement("div", {
2280
- className: mx3("block rounded-md p-1 px-2 text-sm", role === "user" ? "bg-blue-100 dark:bg-blue-800" : role === "system" ? "bg-red-100, dark:bg-red-800" : "whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800")
2274
+ className: mx3("block rounded-md p-1 pli-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")
2281
2275
  }, message));
2282
2276
  } finally {
2283
2277
  _effect.f();
@@ -2338,18 +2332,17 @@ import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking
2338
2332
  import * as Schema25 from "effect/Schema";
2339
2333
  import React26, { useEffect as useEffect8 } from "react";
2340
2334
  import { VoidInput as VoidInput3 } from "@dxos/conductor";
2341
- import { Filter as Filter2, Obj, Query } from "@dxos/echo";
2342
- import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo/internal";
2343
- import { EmailTriggerOutput, FunctionTrigger, QueueTriggerOutput, SubscriptionTriggerOutput, TimerTriggerOutput, TriggerKinds, WebhookTriggerOutput } from "@dxos/functions";
2335
+ import { Filter as Filter2, Obj as Obj4, Query, Ref as Ref3, Type } from "@dxos/echo";
2336
+ import { Trigger, TriggerEvent } from "@dxos/functions";
2344
2337
  import { DXN, SpaceId } from "@dxos/keys";
2345
2338
  import { useSpace } from "@dxos/react-client/echo";
2346
2339
  import { Select as Select2 } from "@dxos/react-ui";
2347
2340
  var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
2348
2341
  type: Schema25.Literal("trigger"),
2349
- functionTrigger: Schema25.optional(Ref3(FunctionTrigger))
2342
+ functionTrigger: Schema25.optional(Type.Ref(Trigger.Trigger))
2350
2343
  }));
2351
2344
  var createTrigger = (props) => {
2352
- const functionTrigger = Obj.make(FunctionTrigger, {
2345
+ const functionTrigger = Trigger.make({
2353
2346
  enabled: true,
2354
2347
  spec: createTriggerSpec(props)
2355
2348
  });
@@ -2358,7 +2351,7 @@ var createTrigger = (props) => {
2358
2351
  functionTrigger: Ref3.make(functionTrigger),
2359
2352
  size: {
2360
2353
  width: 192,
2361
- height: getHeight(EmailTriggerOutput)
2354
+ height: getHeight(TriggerEvent.EmailEvent)
2362
2355
  },
2363
2356
  ...props
2364
2357
  });
@@ -2416,8 +2409,8 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
2416
2409
  onValueChange
2417
2410
  }, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
2418
2411
  variant: "ghost",
2419
- classNames: "w-full !px-0"
2420
- }), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, TriggerKinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
2412
+ classNames: "is-full !pli-0"
2413
+ }), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Trigger.Kinds.map((kind) => /* @__PURE__ */ React26.createElement(Select2.Option, {
2421
2414
  key: kind,
2422
2415
  value: kind
2423
2416
  }, kind))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
@@ -2442,7 +2435,6 @@ var createTriggerSpec = (props) => {
2442
2435
  return {
2443
2436
  kind: "subscription",
2444
2437
  query: {
2445
- string: "Query.select(Filter.nothing())",
2446
2438
  ast: Query.select(Filter2.nothing()).ast
2447
2439
  }
2448
2440
  };
@@ -2454,7 +2446,7 @@ var createTriggerSpec = (props) => {
2454
2446
  const dxn = new DXN(DXN.kind.QUEUE, [
2455
2447
  "data",
2456
2448
  props.spaceId ?? SpaceId.random(),
2457
- ObjectId4.random()
2449
+ Obj4.ID.random()
2458
2450
  ]).toString();
2459
2451
  return {
2460
2452
  kind: "queue",
@@ -2465,11 +2457,11 @@ var createTriggerSpec = (props) => {
2465
2457
  };
2466
2458
  var getOutputSchema = (kind) => {
2467
2459
  const kindToSchema = {
2468
- ["email"]: EmailTriggerOutput,
2469
- ["subscription"]: SubscriptionTriggerOutput,
2470
- ["timer"]: TimerTriggerOutput,
2471
- ["webhook"]: WebhookTriggerOutput,
2472
- ["queue"]: QueueTriggerOutput
2460
+ ["email"]: TriggerEvent.EmailEvent,
2461
+ ["subscription"]: TriggerEvent.SubscriptionEvent,
2462
+ ["timer"]: TriggerEvent.TimerEvent,
2463
+ ["webhook"]: TriggerEvent.WebhookEvent,
2464
+ ["queue"]: TriggerEvent.QueueEvent
2473
2465
  };
2474
2466
  return kindToSchema[kind];
2475
2467
  };
@@ -2591,7 +2583,7 @@ var GptRealtimeComponent = ({ shape }) => {
2591
2583
  }
2592
2584
  };
2593
2585
  return /* @__PURE__ */ React27.createElement("div", {
2594
- className: "flex w-full justify-center items-center"
2586
+ className: "flex is-full justify-center items-center"
2595
2587
  }, /* @__PURE__ */ React27.createElement(Icon5, {
2596
2588
  icon: isReady ? "ph--waveform--regular" : isLive ? "ph--pulse--regular" : "ph--play--regular",
2597
2589
  size: 16,
@@ -2682,20 +2674,11 @@ var computeShapes = [
2682
2674
  import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
2683
2675
  import { toEffectSchema } from "@dxos/echo/internal";
2684
2676
  import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
2685
- function _define_property2(obj, key, value) {
2686
- if (key in obj) {
2687
- Object.defineProperty(obj, key, {
2688
- value,
2689
- enumerable: true,
2690
- configurable: true,
2691
- writable: true
2692
- });
2693
- } else {
2694
- obj[key] = value;
2695
- }
2696
- return obj;
2697
- }
2698
2677
  var ComputeShapeLayout = class extends ShapeLayout {
2678
+ _controller;
2679
+ constructor(_controller, registry2) {
2680
+ super(registry2), this._controller = _controller;
2681
+ }
2699
2682
  // TODO(burdon): Doesn't update.
2700
2683
  getAnchors(shape) {
2701
2684
  const shapeDef = this._registry.getShapeDef(shape.type);
@@ -2710,9 +2693,6 @@ var ComputeShapeLayout = class extends ShapeLayout {
2710
2693
  }
2711
2694
  return anchors;
2712
2695
  }
2713
- constructor(_controller, registry2) {
2714
- super(registry2), _define_property2(this, "_controller", void 0), this._controller = _controller;
2715
- }
2716
2696
  };
2717
2697
  export {
2718
2698
  AndShape,