@dxos/react-ui-canvas-compute 0.9.0 → 0.9.1-staging.ee54ba693a

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.
@@ -208,7 +208,7 @@ var linkTriggerToCompute = (graph, computeNode, triggerData) => {
208
208
  const functionTrigger = triggerData.functionTrigger?.target;
209
209
  invariant2(functionTrigger, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 88, S: void 0, A: ["functionTrigger", ""] });
210
210
  Obj.update(functionTrigger, (functionTrigger2) => {
211
- functionTrigger2.function = Ref.make(graph.root);
211
+ functionTrigger2.runnable = Ref.make(graph.root);
212
212
  functionTrigger2.inputNodeId = computeNode.id;
213
213
  });
214
214
  };
@@ -250,42 +250,42 @@ var nodeFactory = {
250
250
  [NODE_OUTPUT]: () => createNode(NODE_OUTPUT),
251
251
  // Extensions.
252
252
  "text-to-image": () => createNode("text-to-image"),
253
- and: () => createNode("and"),
254
- append: () => createNode("append"),
255
- audio: () => createNode("audio"),
256
- beacon: () => createNode("beacon"),
257
- chat: () => createNode("chat"),
258
- constant: (shape) => createNode("constant", {
253
+ "and": () => createNode("and"),
254
+ "append": () => createNode("append"),
255
+ "audio": () => createNode("audio"),
256
+ "beacon": () => createNode("beacon"),
257
+ "chat": () => createNode("chat"),
258
+ "constant": (shape) => createNode("constant", {
259
259
  value: shape.value
260
260
  }),
261
261
  "make-queue": () => createNode("make-queue"),
262
- database: () => createNode("database"),
263
- gpt: () => createNode("gpt"),
262
+ "database": () => createNode("database"),
263
+ "gpt": () => createNode("gpt"),
264
264
  "gpt-realtime": () => createNode("gpt-realtime"),
265
- if: () => createNode("if"),
265
+ "if": () => createNode("if"),
266
266
  "if-else": () => createNode("if-else"),
267
- function: () => createNode("function"),
268
- json: () => createNode("json"),
267
+ "function": () => createNode("function"),
268
+ "json": () => createNode("json"),
269
269
  "json-transform": () => createNode("json-transform"),
270
- not: () => createNode("not"),
271
- or: () => createNode("or"),
272
- queue: () => createNode("queue"),
273
- rng: () => createNode("rng"),
274
- reducer: () => createNode("reducer"),
275
- scope: () => createNode("scope"),
276
- surface: () => createNode("surface"),
277
- switch: () => createNode("switch"),
278
- template: (shape) => {
270
+ "not": () => createNode("not"),
271
+ "or": () => createNode("or"),
272
+ "queue": () => createNode("queue"),
273
+ "rng": () => createNode("rng"),
274
+ "reducer": () => createNode("reducer"),
275
+ "scope": () => createNode("scope"),
276
+ "surface": () => createNode("surface"),
277
+ "switch": () => createNode("switch"),
278
+ "template": (shape) => {
279
279
  const node = createNode("template", {
280
280
  valueType: shape.valueType,
281
281
  value: shape.text
282
282
  });
283
- node.inputSchema = JsonSchema.toJsonSchema(getTemplateInputSchema(node));
283
+ node.inputSchema = structuredClone(JsonSchema.toJsonSchema(getTemplateInputSchema(node)));
284
284
  return node;
285
285
  },
286
- text: () => createNode("text"),
287
- thread: () => createNode("thread"),
288
- trigger: () => createNode(NODE_INPUT)
286
+ "text": () => createNode("text"),
287
+ "thread": () => createNode("thread"),
288
+ "trigger": () => createNode(NODE_INPUT)
289
289
  };
290
290
  var createNode = (type, props) => ({
291
291
  id: Obj2.ID.random(),
@@ -857,6 +857,7 @@ var appendShape = {
857
857
  // src/shapes/Audio.tsx
858
858
  import * as Schema5 from "effect/Schema";
859
859
  import React6, { useEffect as useEffect3, useState as useState4 } from "react";
860
+ import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
860
861
  import { Icon as Icon2 } from "@dxos/react-ui";
861
862
  import { createAnchorMap } from "@dxos/react-ui-canvas-editor";
862
863
  var AudioShape = Schema5.extend(ComputeShape, Schema5.Struct({
@@ -871,10 +872,10 @@ var createAudio = (props) => createShape({
871
872
  ...props
872
873
  });
873
874
  var AudioComponent = ({ shape }) => {
874
- const { node } = useComputeNodeState(shape);
875
+ const { runtime } = useComputeNodeState(shape);
875
876
  const [active, setActive] = useState4(false);
876
877
  useEffect3(() => {
877
- node.value = active;
878
+ runtime.setOutput(DEFAULT_OUTPUT3, active);
878
879
  }, [
879
880
  active
880
881
  ]);
@@ -1126,7 +1127,7 @@ var notShape = defineShape({
1126
1127
  // src/shapes/Chat.tsx
1127
1128
  import * as Schema8 from "effect/Schema";
1128
1129
  import React9, { useRef as useRef2 } from "react";
1129
- import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
1130
+ import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4 } from "@dxos/conductor";
1130
1131
  import { TextBox } from "@dxos/react-ui-canvas-editor";
1131
1132
  import { createAnchorMap as createAnchorMap3 } from "@dxos/react-ui-canvas-editor";
1132
1133
  var ChatShape = Schema8.extend(ComputeShape, Schema8.Struct({
@@ -1138,7 +1139,7 @@ var TextInputComponent = ({ shape, title, ...props }) => {
1138
1139
  const handleEnter = (text) => {
1139
1140
  const value = text.trim();
1140
1141
  if (value.length) {
1141
- runtime.setOutput(DEFAULT_OUTPUT3, value);
1142
+ runtime.setOutput(DEFAULT_OUTPUT4, value);
1142
1143
  inputRef.current?.setText("");
1143
1144
  }
1144
1145
  };
@@ -1312,7 +1313,7 @@ var databaseShape = {
1312
1313
  // src/shapes/Feed.tsx
1313
1314
  import * as Schema11 from "effect/Schema";
1314
1315
  import React12, { Fragment } from "react";
1315
- import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
1316
+ import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5, QueueInput, QueueOutput } from "@dxos/conductor";
1316
1317
  import { ScrollArea } from "@dxos/react-ui";
1317
1318
  import { mx as mx2 } from "@dxos/ui-theme";
1318
1319
  var FeedShape = Schema11.extend(ComputeShape, Schema11.Struct({
@@ -1328,7 +1329,7 @@ var createFeed = (props) => createShape({
1328
1329
  });
1329
1330
  var FeedComponent = ({ shape }) => {
1330
1331
  const { runtime } = useComputeNodeState(shape);
1331
- const items = runtime.outputs[DEFAULT_OUTPUT4]?.type === "executed" ? runtime.outputs[DEFAULT_OUTPUT4].value : [];
1332
+ const items = runtime.outputs[DEFAULT_OUTPUT5]?.type === "executed" ? runtime.outputs[DEFAULT_OUTPUT5].value : [];
1332
1333
  const handleAction = (action) => {
1333
1334
  if (action === "run") {
1334
1335
  runtime.evalNode();
@@ -1365,7 +1366,8 @@ var FeedItem = ({ classNames, item }) => {
1365
1366
  }, key), /* @__PURE__ */ React12.createElement("div", null, typeof value === "string" ? value : JSON.stringify(value)))));
1366
1367
  };
1367
1368
  var feedShape = {
1368
- type: "feed",
1369
+ // Must match the shape's `type` literal ('queue') so the registry resolves it; the registry is keyed by this.
1370
+ type: "queue",
1369
1371
  name: "Feed",
1370
1372
  icon: "ph--queue--regular",
1371
1373
  component: FeedComponent,
@@ -1773,7 +1775,7 @@ var ifElseShape = {
1773
1775
  // src/shapes/RNG.tsx
1774
1776
  import * as Schema17 from "effect/Schema";
1775
1777
  import React18, { useEffect as useEffect5, useState as useState8 } from "react";
1776
- import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
1778
+ import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
1777
1779
  import { Icon as Icon5 } from "@dxos/react-ui";
1778
1780
  import { createAnchorMap as createAnchorMap7 } from "@dxos/react-ui-canvas-editor";
1779
1781
  var RandomShape = Schema17.extend(ComputeShape, Schema17.Struct({
@@ -1819,7 +1821,7 @@ var RandomComponent = ({ shape }) => {
1819
1821
  ]);
1820
1822
  const handleClick = (ev) => {
1821
1823
  ev.stopPropagation();
1822
- runtime.setOutput(DEFAULT_OUTPUT5, Math.random());
1824
+ runtime.setOutput(DEFAULT_OUTPUT6, Math.random());
1823
1825
  setSpin(true);
1824
1826
  };
1825
1827
  return /* @__PURE__ */ React18.createElement("div", {
@@ -1926,7 +1928,7 @@ var SurfaceComponent = ({ shape }) => {
1926
1928
  shape,
1927
1929
  onAction: handleAction
1928
1930
  }, /* @__PURE__ */ React20.createElement(Card.Root, null, value !== null && /* @__PURE__ */ React20.createElement(Surface.Surface, {
1929
- type: AppSurface.Card,
1931
+ type: AppSurface.CardContent,
1930
1932
  data: {
1931
1933
  subject: value
1932
1934
  },
@@ -1951,7 +1953,7 @@ var surfaceShape = {
1951
1953
  // src/shapes/Switch.tsx
1952
1954
  import * as Schema20 from "effect/Schema";
1953
1955
  import React21, { useEffect as useEffect6, useState as useState9 } from "react";
1954
- import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
1956
+ import { DEFAULT_OUTPUT as DEFAULT_OUTPUT7 } from "@dxos/conductor";
1955
1957
  import { Input as Input2 } from "@dxos/react-ui";
1956
1958
  import { createAnchorMap as createAnchorMap10 } from "@dxos/react-ui-canvas-editor";
1957
1959
  var SwitchShape = Schema20.extend(ComputeShape, Schema20.Struct({
@@ -1969,7 +1971,7 @@ var SwitchComponent = ({ shape }) => {
1969
1971
  const { runtime } = useComputeNodeState(shape);
1970
1972
  const [value, setValue] = useState9(false);
1971
1973
  useEffect6(() => {
1972
- runtime.setOutput(DEFAULT_OUTPUT6, value);
1974
+ runtime.setOutput(DEFAULT_OUTPUT7, value);
1973
1975
  }, [
1974
1976
  value
1975
1977
  ]);