@dxos/react-ui-canvas-compute 0.8.3 → 0.8.4-main.b97322e
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.
- package/dist/lib/browser/index.mjs +74 -70
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +74 -70
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/compute.stories.d.ts +1 -1
- package/dist/types/src/compute.stories.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +1 -1
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +46 -44
- package/src/compute.stories.tsx +9 -19
- package/src/graph/controller.ts +2 -2
- package/src/graph/node-defs.ts +1 -0
- package/src/shapes/Beacon.tsx +1 -2
- package/src/shapes/Function.tsx +2 -2
- package/src/shapes/RNG.tsx +1 -2
- package/src/shapes/Surface.tsx +1 -1
- package/src/shapes/Table.tsx +4 -3
- package/src/shapes/Thread.tsx +4 -3
- package/src/shapes/Trigger.tsx +5 -5
- package/src/shapes/common/Box.tsx +1 -1
- package/src/testing/circuits.ts +4 -4
- package/dist/lib/node/index.cjs +0 -2896
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/graph/controller.ts
|
|
4
4
|
import { Effect, Either, Exit, Scope } from "effect";
|
|
5
5
|
import { Event, synchronized } from "@dxos/async";
|
|
6
|
-
import { GraphExecutor,
|
|
6
|
+
import { GraphExecutor, ValueBag, isNotExecuted } from "@dxos/conductor";
|
|
7
7
|
import { Resource } from "@dxos/context";
|
|
8
8
|
import { log } from "@dxos/log";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// src/graph/node-defs.ts
|
|
11
11
|
import { NODE_INPUT, NODE_OUTPUT, registry, getTemplateInputSchema } from "@dxos/conductor";
|
|
12
12
|
import { raise } from "@dxos/debug";
|
|
13
13
|
import { ObjectId, toJsonSchema } from "@dxos/echo-schema";
|
|
14
14
|
import { invariant } from "@dxos/invariant";
|
|
15
|
-
var __dxlog_file = "/
|
|
15
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/node-defs.ts";
|
|
16
16
|
var resolveComputeNode = async (node) => {
|
|
17
17
|
const impl = registry[node.type];
|
|
18
18
|
invariant(impl, `Unknown node type: ${node.type}`, {
|
|
@@ -48,6 +48,7 @@ var nodeFactory = {
|
|
|
48
48
|
["constant"]: (shape) => createNode("constant", {
|
|
49
49
|
value: shape.value
|
|
50
50
|
}),
|
|
51
|
+
["make-queue"]: () => createNode("make-queue"),
|
|
51
52
|
["database"]: () => createNode("database"),
|
|
52
53
|
["gpt"]: () => createNode("gpt"),
|
|
53
54
|
["gpt-realtime"]: () => createNode("gpt-realtime"),
|
|
@@ -82,7 +83,7 @@ var createNode = (type, props) => ({
|
|
|
82
83
|
...props
|
|
83
84
|
});
|
|
84
85
|
|
|
85
|
-
//
|
|
86
|
+
// src/hooks/compute-context.ts
|
|
86
87
|
import { createContext, useContext } from "react";
|
|
87
88
|
import { raise as raise2 } from "@dxos/debug";
|
|
88
89
|
var ComputeContext = createContext(null);
|
|
@@ -90,7 +91,7 @@ var useComputeContext = () => {
|
|
|
90
91
|
return useContext(ComputeContext) ?? raise2(new Error("Missing ComputeContext"));
|
|
91
92
|
};
|
|
92
93
|
|
|
93
|
-
//
|
|
94
|
+
// src/hooks/useComputeGraphController.ts
|
|
94
95
|
import { useEffect, useState } from "react";
|
|
95
96
|
var combine = (...cbs) => {
|
|
96
97
|
return () => {
|
|
@@ -140,11 +141,11 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
|
|
|
140
141
|
]);
|
|
141
142
|
};
|
|
142
143
|
|
|
143
|
-
//
|
|
144
|
+
// src/hooks/useComputeNodeState.ts
|
|
144
145
|
import { Schema } from "effect";
|
|
145
146
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
146
147
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
147
|
-
var __dxlog_file2 = "/
|
|
148
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
|
|
148
149
|
var useComputeNodeState = (shape) => {
|
|
149
150
|
const { controller } = useComputeContext();
|
|
150
151
|
invariant2(controller, void 0, {
|
|
@@ -214,14 +215,14 @@ var useComputeNodeState = (shape) => {
|
|
|
214
215
|
};
|
|
215
216
|
};
|
|
216
217
|
|
|
217
|
-
//
|
|
218
|
+
// src/hooks/useGraphMonitor.ts
|
|
218
219
|
import { useMemo } from "react";
|
|
219
220
|
import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
|
|
220
221
|
import { ObjectId as ObjectId2, Ref } from "@dxos/echo-schema";
|
|
221
222
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
222
223
|
import { getSpace } from "@dxos/react-client/echo";
|
|
223
224
|
import { isNonNullable } from "@dxos/util";
|
|
224
|
-
var __dxlog_file3 = "/
|
|
225
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
|
|
225
226
|
var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT_INPUT }) => {
|
|
226
227
|
const sourceNode = graph.findNode(source);
|
|
227
228
|
const targetNode = graph.findNode(target);
|
|
@@ -341,14 +342,14 @@ var deleteTriggerObjects = (computeGraph, deleted) => {
|
|
|
341
342
|
}
|
|
342
343
|
};
|
|
343
344
|
|
|
344
|
-
//
|
|
345
|
+
// src/graph/controller.ts
|
|
345
346
|
function _ts_decorate(decorators, target, key, desc) {
|
|
346
347
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
347
348
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
348
349
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
349
350
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
350
351
|
}
|
|
351
|
-
var __dxlog_file4 = "/
|
|
352
|
+
var __dxlog_file4 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/graph/controller.ts";
|
|
352
353
|
var InvalidStateError = Error;
|
|
353
354
|
var AUTO_TRIGGER_NODES = [
|
|
354
355
|
"chat",
|
|
@@ -604,17 +605,17 @@ var computeValueBag = (bag) => {
|
|
|
604
605
|
})))).pipe(Effect.map((entries) => Object.fromEntries(entries)));
|
|
605
606
|
};
|
|
606
607
|
|
|
607
|
-
//
|
|
608
|
+
// src/registry.ts
|
|
608
609
|
import { noteShape } from "@dxos/react-ui-canvas-editor";
|
|
609
610
|
|
|
610
|
-
//
|
|
611
|
+
// src/shapes/common/Box.tsx
|
|
611
612
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
612
613
|
import React, { forwardRef } from "react";
|
|
613
614
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
614
615
|
import { Icon, IconButton } from "@dxos/react-ui";
|
|
615
616
|
import { useEditorContext, useShapeDef } from "@dxos/react-ui-canvas-editor";
|
|
616
617
|
import { mx } from "@dxos/react-ui-theme";
|
|
617
|
-
var __dxlog_file5 = "/
|
|
618
|
+
var __dxlog_file5 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/common/Box.tsx";
|
|
618
619
|
var headerHeight = 32;
|
|
619
620
|
var footerHeight = 32;
|
|
620
621
|
var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, status, open, onAction }, forwardedRef) => {
|
|
@@ -678,7 +679,7 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
678
679
|
}
|
|
679
680
|
});
|
|
680
681
|
|
|
681
|
-
//
|
|
682
|
+
// src/shapes/common/FunctionBody.tsx
|
|
682
683
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
683
684
|
import { SchemaAST as SchemaAST2 } from "effect";
|
|
684
685
|
import React2, { useRef, useState as useState3 } from "react";
|
|
@@ -686,7 +687,7 @@ import { VoidInput, VoidOutput } from "@dxos/conductor";
|
|
|
686
687
|
import { useCanvasContext } from "@dxos/react-ui-canvas";
|
|
687
688
|
import { getParentShapeElement, createAnchors, rowHeight } from "@dxos/react-ui-canvas-editor";
|
|
688
689
|
|
|
689
|
-
//
|
|
690
|
+
// src/shapes/defs.ts
|
|
690
691
|
import { Schema as Schema2, SchemaAST } from "effect";
|
|
691
692
|
import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
|
|
692
693
|
import { ObjectId as ObjectId3 } from "@dxos/echo-schema";
|
|
@@ -718,7 +719,7 @@ var createShape = ({ id, ...rest }) => {
|
|
|
718
719
|
};
|
|
719
720
|
};
|
|
720
721
|
|
|
721
|
-
//
|
|
722
|
+
// src/shapes/common/FunctionBody.tsx
|
|
722
723
|
var bodyPadding = 8;
|
|
723
724
|
var expandedHeight = 200;
|
|
724
725
|
var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchema = VoidOutput, ...props }) => {
|
|
@@ -805,7 +806,7 @@ var createFunctionAnchors = (shape, input = VoidInput, output = VoidOutput) => {
|
|
|
805
806
|
});
|
|
806
807
|
};
|
|
807
808
|
|
|
808
|
-
//
|
|
809
|
+
// src/shapes/common/TypeSelect.tsx
|
|
809
810
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
810
811
|
import React3 from "react";
|
|
811
812
|
import { ComputeValueType } from "@dxos/conductor";
|
|
@@ -828,7 +829,7 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
828
829
|
}
|
|
829
830
|
};
|
|
830
831
|
|
|
831
|
-
//
|
|
832
|
+
// src/shapes/Array.tsx
|
|
832
833
|
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
833
834
|
import { Schema as Schema3 } from "effect";
|
|
834
835
|
import React4 from "react";
|
|
@@ -865,7 +866,7 @@ var reducerShape = {
|
|
|
865
866
|
getAnchors: (shape) => createFunctionAnchors(shape, ReducerInput, ReducerOutput)
|
|
866
867
|
};
|
|
867
868
|
|
|
868
|
-
//
|
|
869
|
+
// src/shapes/Append.tsx
|
|
869
870
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
870
871
|
import { Schema as Schema4 } from "effect";
|
|
871
872
|
import React5 from "react";
|
|
@@ -901,7 +902,7 @@ var appendShape = {
|
|
|
901
902
|
getAnchors: (shape) => createFunctionAnchors(shape, AppendInput)
|
|
902
903
|
};
|
|
903
904
|
|
|
904
|
-
//
|
|
905
|
+
// src/shapes/Audio.tsx
|
|
905
906
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
906
907
|
import { Schema as Schema5 } from "effect";
|
|
907
908
|
import React6, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
@@ -957,14 +958,13 @@ var audioShape = {
|
|
|
957
958
|
})
|
|
958
959
|
};
|
|
959
960
|
|
|
960
|
-
//
|
|
961
|
+
// src/shapes/Beacon.tsx
|
|
961
962
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
962
963
|
import { Schema as Schema6 } from "effect";
|
|
963
964
|
import React7 from "react";
|
|
964
965
|
import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
|
|
965
966
|
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
966
967
|
import { createAnchorMap as createAnchorMap2 } from "@dxos/react-ui-canvas-editor";
|
|
967
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
968
968
|
var BeaconShape = Schema6.extend(ComputeShape, Schema6.Struct({
|
|
969
969
|
type: Schema6.Literal("beacon")
|
|
970
970
|
}));
|
|
@@ -986,7 +986,10 @@ var BeaconComponent = ({ shape }) => {
|
|
|
986
986
|
className: "flex w-full justify-center items-center"
|
|
987
987
|
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
988
988
|
icon: "ph--sun--regular",
|
|
989
|
-
classNames:
|
|
989
|
+
classNames: [
|
|
990
|
+
"transition opacity-20 duration-1000",
|
|
991
|
+
isTruthy(value) && "opacity-100 text-yellow-500"
|
|
992
|
+
],
|
|
990
993
|
size: 8
|
|
991
994
|
}));
|
|
992
995
|
} finally {
|
|
@@ -1007,7 +1010,7 @@ var beaconShape = {
|
|
|
1007
1010
|
})
|
|
1008
1011
|
};
|
|
1009
1012
|
|
|
1010
|
-
//
|
|
1013
|
+
// src/shapes/Boolean.tsx
|
|
1011
1014
|
import { Schema as Schema7 } from "effect";
|
|
1012
1015
|
import React8 from "react";
|
|
1013
1016
|
import { getAnchorPoints } from "@dxos/react-ui-canvas-editor";
|
|
@@ -1180,7 +1183,7 @@ var notShape = defineShape({
|
|
|
1180
1183
|
]
|
|
1181
1184
|
});
|
|
1182
1185
|
|
|
1183
|
-
//
|
|
1186
|
+
// src/shapes/Chat.tsx
|
|
1184
1187
|
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1185
1188
|
import { Schema as Schema8 } from "effect";
|
|
1186
1189
|
import React9, { useRef as useRef2 } from "react";
|
|
@@ -1241,7 +1244,7 @@ var chatShape = {
|
|
|
1241
1244
|
resizable: true
|
|
1242
1245
|
};
|
|
1243
1246
|
|
|
1244
|
-
//
|
|
1247
|
+
// src/shapes/Constant.tsx
|
|
1245
1248
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
1246
1249
|
import { Schema as Schema9 } from "effect";
|
|
1247
1250
|
import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
|
|
@@ -1344,7 +1347,7 @@ var constantShape = {
|
|
|
1344
1347
|
resizable: true
|
|
1345
1348
|
};
|
|
1346
1349
|
|
|
1347
|
-
//
|
|
1350
|
+
// src/shapes/Database.tsx
|
|
1348
1351
|
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
1349
1352
|
import { Schema as Schema10 } from "effect";
|
|
1350
1353
|
import React11 from "react";
|
|
@@ -1384,7 +1387,7 @@ var databaseShape = {
|
|
|
1384
1387
|
})
|
|
1385
1388
|
};
|
|
1386
1389
|
|
|
1387
|
-
//
|
|
1390
|
+
// src/shapes/Function.tsx
|
|
1388
1391
|
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
1389
1392
|
import { Schema as Schema11 } from "effect";
|
|
1390
1393
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
@@ -1392,7 +1395,7 @@ import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
|
1392
1395
|
import { getSnapshot, isInstanceOf, Ref as Ref2 } from "@dxos/echo-schema";
|
|
1393
1396
|
import { FunctionType, ScriptType } from "@dxos/functions";
|
|
1394
1397
|
import { useClient } from "@dxos/react-client";
|
|
1395
|
-
import { Filter,
|
|
1398
|
+
import { Filter, parseId } from "@dxos/react-client/echo";
|
|
1396
1399
|
import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
|
|
1397
1400
|
var FunctionShape = Schema11.extend(ComputeShape, Schema11.Struct({
|
|
1398
1401
|
type: Schema11.Literal("function")
|
|
@@ -1429,7 +1432,7 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
|
|
|
1429
1432
|
return;
|
|
1430
1433
|
}
|
|
1431
1434
|
node.value = value;
|
|
1432
|
-
node.function =
|
|
1435
|
+
node.function = Ref2.make(fn);
|
|
1433
1436
|
node.inputSchema = getSnapshot(fn.inputSchema);
|
|
1434
1437
|
node.outputSchema = getSnapshot(fn.outputSchema);
|
|
1435
1438
|
}, [
|
|
@@ -1469,7 +1472,7 @@ var functionShape = {
|
|
|
1469
1472
|
getAnchors: (shape) => createFunctionAnchors(shape, FunctionInput, AnyOutput)
|
|
1470
1473
|
};
|
|
1471
1474
|
|
|
1472
|
-
//
|
|
1475
|
+
// src/shapes/Gpt.tsx
|
|
1473
1476
|
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
1474
1477
|
import { Schema as Schema12 } from "effect";
|
|
1475
1478
|
import React13, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
@@ -1545,7 +1548,7 @@ var gptShape = {
|
|
|
1545
1548
|
openable: true
|
|
1546
1549
|
};
|
|
1547
1550
|
|
|
1548
|
-
//
|
|
1551
|
+
// src/shapes/Json.tsx
|
|
1549
1552
|
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1550
1553
|
import { Schema as Schema13 } from "effect";
|
|
1551
1554
|
import React14 from "react";
|
|
@@ -1628,7 +1631,7 @@ var jsonTransformShape = {
|
|
|
1628
1631
|
resizable: true
|
|
1629
1632
|
};
|
|
1630
1633
|
|
|
1631
|
-
//
|
|
1634
|
+
// src/shapes/Logic.tsx
|
|
1632
1635
|
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1633
1636
|
import { Schema as Schema14 } from "effect";
|
|
1634
1637
|
import React15 from "react";
|
|
@@ -1696,12 +1699,12 @@ var ifElseShape = {
|
|
|
1696
1699
|
getAnchors: (shape) => createFunctionAnchors(shape, IfElseInput, IfElseOutput)
|
|
1697
1700
|
};
|
|
1698
1701
|
|
|
1699
|
-
//
|
|
1702
|
+
// src/shapes/Queue.tsx
|
|
1700
1703
|
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1701
1704
|
import { Schema as Schema15 } from "effect";
|
|
1702
1705
|
import React16, { Fragment } from "react";
|
|
1703
1706
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
|
|
1704
|
-
import { mx as
|
|
1707
|
+
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
1705
1708
|
var QueueShape = Schema15.extend(ComputeShape, Schema15.Struct({
|
|
1706
1709
|
type: Schema15.Literal("queue")
|
|
1707
1710
|
}));
|
|
@@ -1745,11 +1748,11 @@ var QueueItem = ({ classNames, item }) => {
|
|
|
1745
1748
|
try {
|
|
1746
1749
|
if (typeof item !== "object") {
|
|
1747
1750
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1748
|
-
className:
|
|
1751
|
+
className: mx2(classNames, "whitespace-pre-wrap")
|
|
1749
1752
|
}, item);
|
|
1750
1753
|
}
|
|
1751
1754
|
return /* @__PURE__ */ React16.createElement("div", {
|
|
1752
|
-
className:
|
|
1755
|
+
className: mx2("grid grid-cols-[80px,1fr]", classNames)
|
|
1753
1756
|
}, Object.entries(item).map(([key, value]) => /* @__PURE__ */ React16.createElement(Fragment, {
|
|
1754
1757
|
key
|
|
1755
1758
|
}, /* @__PURE__ */ React16.createElement("div", {
|
|
@@ -1769,14 +1772,13 @@ var queueShape = {
|
|
|
1769
1772
|
resizable: true
|
|
1770
1773
|
};
|
|
1771
1774
|
|
|
1772
|
-
//
|
|
1775
|
+
// src/shapes/RNG.tsx
|
|
1773
1776
|
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1774
1777
|
import { Schema as Schema16 } from "effect";
|
|
1775
1778
|
import React17, { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1776
1779
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
|
|
1777
1780
|
import { Icon as Icon4 } from "@dxos/react-ui";
|
|
1778
1781
|
import { createAnchorMap as createAnchorMap7 } from "@dxos/react-ui-canvas-editor";
|
|
1779
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1780
1782
|
var RandomShape = Schema16.extend(ComputeShape, Schema16.Struct({
|
|
1781
1783
|
type: Schema16.Literal("rng"),
|
|
1782
1784
|
min: Schema16.optional(Schema16.Number),
|
|
@@ -1829,7 +1831,7 @@ var RandomComponent = ({ shape }) => {
|
|
|
1829
1831
|
className: "flex grow items-center justify-center"
|
|
1830
1832
|
}, /* @__PURE__ */ React17.createElement(Icon4, {
|
|
1831
1833
|
icon,
|
|
1832
|
-
classNames:
|
|
1834
|
+
classNames: spin && "animate-[spin_1s]",
|
|
1833
1835
|
size: 10,
|
|
1834
1836
|
onClick: handleClick
|
|
1835
1837
|
}));
|
|
@@ -1851,7 +1853,7 @@ var randomShape = {
|
|
|
1851
1853
|
})
|
|
1852
1854
|
};
|
|
1853
1855
|
|
|
1854
|
-
//
|
|
1856
|
+
// src/shapes/Scope.tsx
|
|
1855
1857
|
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
1856
1858
|
import { Schema as Schema17 } from "effect";
|
|
1857
1859
|
import React18 from "react";
|
|
@@ -1905,7 +1907,7 @@ var scopeShape = {
|
|
|
1905
1907
|
})
|
|
1906
1908
|
};
|
|
1907
1909
|
|
|
1908
|
-
//
|
|
1910
|
+
// src/shapes/Surface.tsx
|
|
1909
1911
|
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1910
1912
|
import { Schema as Schema18 } from "effect";
|
|
1911
1913
|
import React19 from "react";
|
|
@@ -1938,7 +1940,7 @@ var SurfaceComponent = ({ shape }) => {
|
|
|
1938
1940
|
shape,
|
|
1939
1941
|
onAction: handleAction
|
|
1940
1942
|
}, value !== null && /* @__PURE__ */ React19.createElement(Surface, {
|
|
1941
|
-
role: "
|
|
1943
|
+
role: "card--extrinsic",
|
|
1942
1944
|
data: {
|
|
1943
1945
|
value
|
|
1944
1946
|
},
|
|
@@ -1963,7 +1965,7 @@ var surfaceShape = {
|
|
|
1963
1965
|
resizable: true
|
|
1964
1966
|
};
|
|
1965
1967
|
|
|
1966
|
-
//
|
|
1968
|
+
// src/shapes/Switch.tsx
|
|
1967
1969
|
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1968
1970
|
import { Schema as Schema19 } from "effect";
|
|
1969
1971
|
import React20, { useEffect as useEffect6, useState as useState8 } from "react";
|
|
@@ -2016,13 +2018,14 @@ var switchShape = {
|
|
|
2016
2018
|
})
|
|
2017
2019
|
};
|
|
2018
2020
|
|
|
2019
|
-
//
|
|
2021
|
+
// src/shapes/Table.tsx
|
|
2020
2022
|
import { useSignals as _useSignals20 } from "@preact-signals/safe-react/tracking";
|
|
2021
2023
|
import { Schema as Schema20 } from "effect";
|
|
2022
2024
|
import React21 from "react";
|
|
2023
|
-
import { createInputSchema, createOutputSchema
|
|
2024
|
-
|
|
2025
|
-
var
|
|
2025
|
+
import { createInputSchema, createOutputSchema } from "@dxos/conductor";
|
|
2026
|
+
import { DataType } from "@dxos/schema";
|
|
2027
|
+
var InputSchema = createInputSchema(DataType.Message);
|
|
2028
|
+
var OutputSchema = createOutputSchema(Schema20.mutable(Schema20.Array(DataType.Message)));
|
|
2026
2029
|
var TableShape = Schema20.extend(ComputeShape, Schema20.Struct({
|
|
2027
2030
|
type: Schema20.Literal("table")
|
|
2028
2031
|
}));
|
|
@@ -2054,7 +2057,7 @@ var tableShape = {
|
|
|
2054
2057
|
resizable: true
|
|
2055
2058
|
};
|
|
2056
2059
|
|
|
2057
|
-
//
|
|
2060
|
+
// src/shapes/Template.tsx
|
|
2058
2061
|
import { useSignals as _useSignals21 } from "@preact-signals/safe-react/tracking";
|
|
2059
2062
|
import { Schema as Schema21 } from "effect";
|
|
2060
2063
|
import React22, { useRef as useRef5 } from "react";
|
|
@@ -2062,7 +2065,7 @@ import { ComputeValueType as ComputeValueType3, getTemplateInputSchema as getTem
|
|
|
2062
2065
|
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo-schema";
|
|
2063
2066
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
2064
2067
|
import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
|
|
2065
|
-
var __dxlog_file6 = "/
|
|
2068
|
+
var __dxlog_file6 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
|
|
2066
2069
|
var TemplateShape = Schema21.extend(ComputeShape, Schema21.Struct({
|
|
2067
2070
|
type: Schema21.Literal("template"),
|
|
2068
2071
|
valueType: Schema21.optional(ComputeValueType3)
|
|
@@ -2133,7 +2136,7 @@ var templateShape = {
|
|
|
2133
2136
|
resizable: true
|
|
2134
2137
|
};
|
|
2135
2138
|
|
|
2136
|
-
//
|
|
2139
|
+
// src/shapes/Text.tsx
|
|
2137
2140
|
import { useSignals as _useSignals22 } from "@preact-signals/safe-react/tracking";
|
|
2138
2141
|
import { Schema as Schema22 } from "effect";
|
|
2139
2142
|
import React23 from "react";
|
|
@@ -2187,14 +2190,15 @@ var textShape = {
|
|
|
2187
2190
|
resizable: true
|
|
2188
2191
|
};
|
|
2189
2192
|
|
|
2190
|
-
//
|
|
2193
|
+
// src/shapes/Thread.tsx
|
|
2191
2194
|
import { useSignals as _useSignals23 } from "@preact-signals/safe-react/tracking";
|
|
2192
2195
|
import { Schema as Schema23 } from "effect";
|
|
2193
2196
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2194
|
-
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2
|
|
2195
|
-
import { mx as
|
|
2196
|
-
|
|
2197
|
-
var
|
|
2197
|
+
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2 } from "@dxos/conductor";
|
|
2198
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
2199
|
+
import { DataType as DataType2 } from "@dxos/schema";
|
|
2200
|
+
var InputSchema2 = createInputSchema2(DataType2.Message);
|
|
2201
|
+
var OutputSchema2 = createOutputSchema2(Schema23.mutable(Schema23.Array(DataType2.Message)));
|
|
2198
2202
|
var ThreadShape = Schema23.extend(ComputeShape, Schema23.Struct({
|
|
2199
2203
|
type: Schema23.Literal("thread")
|
|
2200
2204
|
}));
|
|
@@ -2238,14 +2242,14 @@ var ThreadItem = ({ classNames, item }) => {
|
|
|
2238
2242
|
try {
|
|
2239
2243
|
if (typeof item !== "object") {
|
|
2240
2244
|
return /* @__PURE__ */ React24.createElement("div", {
|
|
2241
|
-
className:
|
|
2245
|
+
className: mx3(classNames)
|
|
2242
2246
|
}, item);
|
|
2243
2247
|
}
|
|
2244
2248
|
const { role, message } = item;
|
|
2245
2249
|
return /* @__PURE__ */ React24.createElement("div", {
|
|
2246
|
-
className:
|
|
2250
|
+
className: mx3("flex", classNames, role === "user" && "justify-end")
|
|
2247
2251
|
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2248
|
-
className:
|
|
2252
|
+
className: mx3("block rounded-md p-1 px-2 text-sm", role === "user" ? "bg-blue-100 dark:bg-blue-800" : role === "system" ? "bg-red-100, dark:bg-red-800" : "whitespace-pre-wrap bg-neutral-50 dark:bg-neutral-800")
|
|
2249
2253
|
}, message));
|
|
2250
2254
|
} finally {
|
|
2251
2255
|
_effect.f();
|
|
@@ -2261,7 +2265,7 @@ var threadShape = {
|
|
|
2261
2265
|
resizable: true
|
|
2262
2266
|
};
|
|
2263
2267
|
|
|
2264
|
-
//
|
|
2268
|
+
// src/shapes/TextToImage.tsx
|
|
2265
2269
|
import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
|
|
2266
2270
|
import { Schema as Schema24 } from "effect";
|
|
2267
2271
|
import React25 from "react";
|
|
@@ -2301,15 +2305,15 @@ var textToImageShape = {
|
|
|
2301
2305
|
})
|
|
2302
2306
|
};
|
|
2303
2307
|
|
|
2304
|
-
//
|
|
2308
|
+
// src/shapes/Trigger.tsx
|
|
2305
2309
|
import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
|
|
2306
2310
|
import { Schema as Schema25 } from "effect";
|
|
2307
2311
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2308
2312
|
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2309
2313
|
import { ObjectId as ObjectId4, Ref as Ref3 } from "@dxos/echo-schema";
|
|
2310
|
-
import {
|
|
2314
|
+
import { EmailTriggerOutput, FunctionTrigger, QueueTriggerOutput, TriggerKind, SubscriptionTriggerOutput, TimerTriggerOutput, WebhookTriggerOutput } from "@dxos/functions";
|
|
2311
2315
|
import { DXN, SpaceId } from "@dxos/keys";
|
|
2312
|
-
import { live,
|
|
2316
|
+
import { live, useSpace } from "@dxos/react-client/echo";
|
|
2313
2317
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2314
2318
|
var TriggerShape = Schema25.extend(ComputeShape, Schema25.Struct({
|
|
2315
2319
|
type: Schema25.Literal("trigger"),
|
|
@@ -2322,7 +2326,7 @@ var createTrigger = (props) => {
|
|
|
2322
2326
|
});
|
|
2323
2327
|
return createShape({
|
|
2324
2328
|
type: "trigger",
|
|
2325
|
-
functionTrigger:
|
|
2329
|
+
functionTrigger: Ref3.make(functionTrigger),
|
|
2326
2330
|
size: {
|
|
2327
2331
|
width: 192,
|
|
2328
2332
|
height: getHeight(EmailTriggerOutput)
|
|
@@ -2446,14 +2450,14 @@ var triggerShape = {
|
|
|
2446
2450
|
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.kind ?? TriggerKind.Email))
|
|
2447
2451
|
};
|
|
2448
2452
|
|
|
2449
|
-
//
|
|
2453
|
+
// src/shapes/GptRealtime.tsx
|
|
2450
2454
|
import { useSignals as _useSignals26 } from "@preact-signals/safe-react/tracking";
|
|
2451
2455
|
import { Schema as Schema26 } from "effect";
|
|
2452
2456
|
import React27, { useState as useState9 } from "react";
|
|
2453
2457
|
import { log as log2 } from "@dxos/log";
|
|
2454
2458
|
import { useConfig } from "@dxos/react-client";
|
|
2455
2459
|
import { Icon as Icon5 } from "@dxos/react-ui";
|
|
2456
|
-
var __dxlog_file7 = "/
|
|
2460
|
+
var __dxlog_file7 = "/__w/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/GptRealtime.tsx";
|
|
2457
2461
|
var GptRealtimeShape = Schema26.extend(ComputeShape, Schema26.Struct({
|
|
2458
2462
|
type: Schema26.Literal("gpt-realtime")
|
|
2459
2463
|
}));
|
|
@@ -2580,7 +2584,7 @@ var gptRealtimeShape = {
|
|
|
2580
2584
|
};
|
|
2581
2585
|
var DEFAULT_AI_SERVICE_URL = "http://localhost:8788";
|
|
2582
2586
|
|
|
2583
|
-
//
|
|
2587
|
+
// src/registry.ts
|
|
2584
2588
|
var computeShapes = [
|
|
2585
2589
|
{
|
|
2586
2590
|
title: "Inputs",
|
|
@@ -2642,7 +2646,7 @@ var computeShapes = [
|
|
|
2642
2646
|
}
|
|
2643
2647
|
];
|
|
2644
2648
|
|
|
2645
|
-
//
|
|
2649
|
+
// src/compute-layout.ts
|
|
2646
2650
|
import { DefaultInput, DefaultOutput as DefaultOutput2 } from "@dxos/conductor";
|
|
2647
2651
|
import { toEffectSchema } from "@dxos/echo-schema";
|
|
2648
2652
|
import { ShapeLayout } from "@dxos/react-ui-canvas-editor";
|