@dxos/react-ui-canvas-compute 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
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 +137 -138
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +160 -161
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +137 -138
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/DiagnosticOverlay.d.ts.map +1 -1
- package/dist/types/src/graph/controller.d.ts +17 -1
- package/dist/types/src/graph/controller.d.ts.map +1 -1
- package/dist/types/src/graph/node-defs.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeGraphController.d.ts.map +1 -1
- package/dist/types/src/hooks/useComputeNodeState.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphMonitor.d.ts.map +1 -1
- package/dist/types/src/json.test.d.ts +18 -18
- package/dist/types/src/json.test.d.ts.map +1 -1
- package/dist/types/src/shapes/Append.d.ts +19 -19
- package/dist/types/src/shapes/Append.d.ts.map +1 -1
- package/dist/types/src/shapes/Array.d.ts +19 -19
- package/dist/types/src/shapes/Array.d.ts.map +1 -1
- package/dist/types/src/shapes/Audio.d.ts +19 -19
- package/dist/types/src/shapes/Audio.d.ts.map +1 -1
- package/dist/types/src/shapes/Beacon.d.ts +19 -19
- package/dist/types/src/shapes/Beacon.d.ts.map +1 -1
- package/dist/types/src/shapes/Boolean.d.ts +70 -70
- package/dist/types/src/shapes/Boolean.d.ts.map +1 -1
- package/dist/types/src/shapes/Chat.d.ts +19 -19
- package/dist/types/src/shapes/Chat.d.ts.map +1 -1
- package/dist/types/src/shapes/Constant.d.ts +20 -20
- package/dist/types/src/shapes/Constant.d.ts.map +1 -1
- package/dist/types/src/shapes/Database.d.ts +19 -19
- package/dist/types/src/shapes/Database.d.ts.map +1 -1
- package/dist/types/src/shapes/Function.d.ts +19 -19
- package/dist/types/src/shapes/Function.d.ts.map +1 -1
- package/dist/types/src/shapes/Gpt.d.ts +19 -19
- package/dist/types/src/shapes/Gpt.d.ts.map +1 -1
- package/dist/types/src/shapes/GptRealtime.d.ts +19 -19
- package/dist/types/src/shapes/GptRealtime.d.ts.map +1 -1
- package/dist/types/src/shapes/Json.d.ts +37 -37
- package/dist/types/src/shapes/Json.d.ts.map +1 -1
- package/dist/types/src/shapes/Logic.d.ts +37 -37
- package/dist/types/src/shapes/Logic.d.ts.map +1 -1
- package/dist/types/src/shapes/Queue.d.ts +19 -19
- package/dist/types/src/shapes/Queue.d.ts.map +1 -1
- package/dist/types/src/shapes/RNG.d.ts +21 -21
- package/dist/types/src/shapes/RNG.d.ts.map +1 -1
- package/dist/types/src/shapes/Scope.d.ts +19 -19
- package/dist/types/src/shapes/Scope.d.ts.map +1 -1
- package/dist/types/src/shapes/Surface.d.ts +19 -19
- package/dist/types/src/shapes/Surface.d.ts.map +1 -1
- package/dist/types/src/shapes/Switch.d.ts +19 -19
- package/dist/types/src/shapes/Switch.d.ts.map +1 -1
- package/dist/types/src/shapes/Table.d.ts +19 -19
- package/dist/types/src/shapes/Table.d.ts.map +1 -1
- package/dist/types/src/shapes/Template.d.ts +20 -20
- package/dist/types/src/shapes/Template.d.ts.map +1 -1
- package/dist/types/src/shapes/Text.d.ts +19 -19
- package/dist/types/src/shapes/Text.d.ts.map +1 -1
- package/dist/types/src/shapes/TextToImage.d.ts +19 -19
- package/dist/types/src/shapes/TextToImage.d.ts.map +1 -1
- package/dist/types/src/shapes/Thread.d.ts +19 -19
- package/dist/types/src/shapes/Thread.d.ts.map +1 -1
- package/dist/types/src/shapes/Trigger.d.ts +45 -47
- package/dist/types/src/shapes/Trigger.d.ts.map +1 -1
- package/dist/types/src/shapes/common/FunctionBody.d.ts +5 -5
- package/dist/types/src/shapes/common/FunctionBody.d.ts.map +1 -1
- package/dist/types/src/shapes/common/TypeSelect.d.ts.map +1 -1
- package/dist/types/src/shapes/defs.d.ts +19 -18
- package/dist/types/src/shapes/defs.d.ts.map +1 -1
- package/dist/types/src/testing/circuits.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -40
- package/src/compute.stories.tsx +2 -2
- package/src/hooks/useComputeNodeState.ts +3 -3
- package/src/hooks/useGraphMonitor.ts +5 -3
- package/src/json.test.ts +10 -10
- package/src/schema.test.ts +7 -7
- package/src/shapes/Append.tsx +5 -5
- package/src/shapes/Array.tsx +5 -5
- package/src/shapes/Audio.tsx +5 -5
- package/src/shapes/Beacon.tsx +5 -5
- package/src/shapes/Boolean.tsx +5 -5
- package/src/shapes/Chat.tsx +5 -5
- package/src/shapes/Constant.tsx +6 -6
- package/src/shapes/Database.tsx +5 -5
- package/src/shapes/Function.tsx +7 -8
- package/src/shapes/Gpt.tsx +5 -5
- package/src/shapes/GptRealtime.tsx +8 -8
- package/src/shapes/Json.tsx +9 -9
- package/src/shapes/Logic.tsx +9 -9
- package/src/shapes/Queue.tsx +5 -5
- package/src/shapes/RNG.tsx +7 -7
- package/src/shapes/Scope.tsx +5 -5
- package/src/shapes/Surface.tsx +5 -5
- package/src/shapes/Switch.tsx +5 -5
- package/src/shapes/Table.tsx +6 -6
- package/src/shapes/Template.tsx +7 -8
- package/src/shapes/Text.tsx +5 -5
- package/src/shapes/TextToImage.tsx +5 -5
- package/src/shapes/Thread.tsx +6 -6
- package/src/shapes/Trigger.tsx +33 -32
- package/src/shapes/common/FunctionBody.tsx +9 -11
- package/src/shapes/defs.ts +9 -9
|
@@ -142,8 +142,8 @@ var useComputeGraphController = ({ controller, graph, editorRef }) => {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
// packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts
|
|
145
|
-
import { Schema } from "effect";
|
|
146
145
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
146
|
+
import { S } from "@dxos/echo-schema";
|
|
147
147
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
148
148
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useComputeNodeState.ts";
|
|
149
149
|
var useComputeNodeState = (shape) => {
|
|
@@ -200,8 +200,8 @@ var useComputeNodeState = (shape) => {
|
|
|
200
200
|
return {
|
|
201
201
|
node: controller.getComputeNode(shape.node),
|
|
202
202
|
meta: meta ?? {
|
|
203
|
-
input:
|
|
204
|
-
output:
|
|
203
|
+
input: S.Struct({}),
|
|
204
|
+
output: S.Struct({})
|
|
205
205
|
},
|
|
206
206
|
runtime: {
|
|
207
207
|
inputs: controller.getInputs(shape.node),
|
|
@@ -218,8 +218,9 @@ var useComputeNodeState = (shape) => {
|
|
|
218
218
|
// packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts
|
|
219
219
|
import { useMemo } from "react";
|
|
220
220
|
import { ComputeGraphModel, DEFAULT_INPUT, DEFAULT_OUTPUT } from "@dxos/conductor";
|
|
221
|
-
import { ObjectId as ObjectId2
|
|
221
|
+
import { ObjectId as ObjectId2 } from "@dxos/echo-schema";
|
|
222
222
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
223
|
+
import { DXN } from "@dxos/keys";
|
|
223
224
|
import { getSpace } from "@dxos/react-client/echo";
|
|
224
225
|
import { isNonNullable } from "@dxos/util";
|
|
225
226
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/hooks/useGraphMonitor.ts";
|
|
@@ -228,7 +229,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
228
229
|
const targetNode = graph.findNode(target);
|
|
229
230
|
invariant3(sourceNode?.node, void 0, {
|
|
230
231
|
F: __dxlog_file3,
|
|
231
|
-
L:
|
|
232
|
+
L: 27,
|
|
232
233
|
S: void 0,
|
|
233
234
|
A: [
|
|
234
235
|
"sourceNode?.node",
|
|
@@ -237,7 +238,7 @@ var mapEdge = (graph, { source, target, output = DEFAULT_OUTPUT, input = DEFAULT
|
|
|
237
238
|
});
|
|
238
239
|
invariant3(targetNode?.node, void 0, {
|
|
239
240
|
F: __dxlog_file3,
|
|
240
|
-
L:
|
|
241
|
+
L: 28,
|
|
241
242
|
S: void 0,
|
|
242
243
|
A: [
|
|
243
244
|
"targetNode?.node",
|
|
@@ -261,7 +262,7 @@ var useGraphMonitor = (model) => {
|
|
|
261
262
|
}
|
|
262
263
|
invariant3(node.type, void 0, {
|
|
263
264
|
F: __dxlog_file3,
|
|
264
|
-
L:
|
|
265
|
+
L: 53,
|
|
265
266
|
S: void 0,
|
|
266
267
|
A: [
|
|
267
268
|
"node.type",
|
|
@@ -319,15 +320,16 @@ var linkTriggerToCompute = (graph, computeNode, triggerData) => {
|
|
|
319
320
|
const functionTrigger = triggerData.functionTrigger?.target;
|
|
320
321
|
invariant3(functionTrigger, void 0, {
|
|
321
322
|
F: __dxlog_file3,
|
|
322
|
-
L:
|
|
323
|
+
L: 116,
|
|
323
324
|
S: void 0,
|
|
324
325
|
A: [
|
|
325
326
|
"functionTrigger",
|
|
326
327
|
""
|
|
327
328
|
]
|
|
328
329
|
});
|
|
329
|
-
functionTrigger.function =
|
|
330
|
-
functionTrigger.
|
|
330
|
+
functionTrigger.function = DXN.fromLocalObjectId(graph.root.id).toString();
|
|
331
|
+
functionTrigger.meta ??= {};
|
|
332
|
+
functionTrigger.meta.computeNodeId = computeNode.id;
|
|
331
333
|
};
|
|
332
334
|
var deleteTriggerObjects = (computeGraph, deleted) => {
|
|
333
335
|
const space = getSpace(computeGraph.root);
|
|
@@ -712,18 +714,18 @@ var Box = /* @__PURE__ */ forwardRef(({ children, classNames, shape, title, stat
|
|
|
712
714
|
});
|
|
713
715
|
|
|
714
716
|
// packages/ui/react-ui-canvas-compute/src/shapes/common/FunctionBody.tsx
|
|
715
|
-
import { SchemaAST as SchemaAST2 } from "effect";
|
|
716
717
|
import React2, { useRef, useState as useState3 } from "react";
|
|
717
718
|
import { VoidInput, VoidOutput } from "@dxos/conductor";
|
|
719
|
+
import { AST as AST2 } from "@dxos/echo-schema";
|
|
718
720
|
import { useCanvasContext } from "@dxos/react-ui-canvas";
|
|
719
721
|
import { getParentShapeElement, createAnchors, rowHeight } from "@dxos/react-ui-canvas-editor";
|
|
720
722
|
|
|
721
723
|
// packages/ui/react-ui-canvas-compute/src/shapes/defs.ts
|
|
722
|
-
import {
|
|
724
|
+
import { SchemaAST as AST } from "effect";
|
|
723
725
|
import { DEFAULT_INPUT as DEFAULT_INPUT2, DEFAULT_OUTPUT as DEFAULT_OUTPUT2 } from "@dxos/conductor";
|
|
724
|
-
import { ObjectId as ObjectId3 } from "@dxos/echo-schema";
|
|
726
|
+
import { ObjectId as ObjectId3, S as S2 } from "@dxos/echo-schema";
|
|
725
727
|
import { Polygon } from "@dxos/react-ui-canvas-editor";
|
|
726
|
-
var getProperties = (ast) =>
|
|
728
|
+
var getProperties = (ast) => AST.getPropertySignatures(ast).map(({ name }) => ({
|
|
727
729
|
name: name.toString()
|
|
728
730
|
}));
|
|
729
731
|
var createAnchorId = (kind, property = kind === "input" ? DEFAULT_INPUT2 : DEFAULT_OUTPUT2) => [
|
|
@@ -737,12 +739,12 @@ var parseAnchorId = (id) => {
|
|
|
737
739
|
id
|
|
738
740
|
];
|
|
739
741
|
};
|
|
740
|
-
var ComputeShape =
|
|
742
|
+
var ComputeShape = S2.extend(Polygon, S2.Struct({
|
|
741
743
|
// TODO(burdon): Rename computeNode?
|
|
742
|
-
node:
|
|
743
|
-
[
|
|
744
|
+
node: S2.optional(ObjectId3.annotations({
|
|
745
|
+
[AST.DescriptionAnnotationId]: "Compute node id"
|
|
744
746
|
}))
|
|
745
|
-
}).pipe(
|
|
747
|
+
}).pipe(S2.mutable));
|
|
746
748
|
var createShape = ({ id, ...rest }) => {
|
|
747
749
|
return {
|
|
748
750
|
id: id ?? ObjectId3.random(),
|
|
@@ -815,12 +817,12 @@ var FunctionBody = ({ shape, name, content, inputSchema = VoidInput, outputSchem
|
|
|
815
817
|
}, content));
|
|
816
818
|
};
|
|
817
819
|
var getHeight = (input) => {
|
|
818
|
-
const properties =
|
|
820
|
+
const properties = AST2.getPropertySignatures(input.ast);
|
|
819
821
|
return headerHeight + footerHeight + bodyPadding * 2 + properties.length * rowHeight + 2;
|
|
820
822
|
};
|
|
821
823
|
var createFunctionAnchors = (shape, input = VoidInput, output = VoidOutput) => {
|
|
822
|
-
const inputs =
|
|
823
|
-
const outputs =
|
|
824
|
+
const inputs = AST2.getPropertySignatures(input.ast).map(({ name }) => createAnchorId("input", name.toString()));
|
|
825
|
+
const outputs = AST2.getPropertySignatures(output.ast).map(({ name }) => createAnchorId("output", name.toString()));
|
|
824
826
|
return createAnchors({
|
|
825
827
|
shape,
|
|
826
828
|
inputs,
|
|
@@ -850,11 +852,11 @@ var TypeSelect = ({ value, onValueChange }) => {
|
|
|
850
852
|
};
|
|
851
853
|
|
|
852
854
|
// packages/ui/react-ui-canvas-compute/src/shapes/Array.tsx
|
|
853
|
-
import { Schema as Schema3 } from "effect";
|
|
854
855
|
import React4 from "react";
|
|
855
856
|
import { ReducerInput, ReducerOutput } from "@dxos/conductor";
|
|
856
|
-
|
|
857
|
-
|
|
857
|
+
import { S as S3 } from "@dxos/echo-schema";
|
|
858
|
+
var ReducerShape = S3.extend(ComputeShape, S3.Struct({
|
|
859
|
+
type: S3.Literal("reducer")
|
|
858
860
|
}));
|
|
859
861
|
var ReducerComponent = ({ shape }) => {
|
|
860
862
|
return /* @__PURE__ */ React4.createElement(FunctionBody, {
|
|
@@ -881,11 +883,11 @@ var reducerShape = {
|
|
|
881
883
|
};
|
|
882
884
|
|
|
883
885
|
// packages/ui/react-ui-canvas-compute/src/shapes/Append.tsx
|
|
884
|
-
import { Schema as Schema4 } from "effect";
|
|
885
886
|
import React5 from "react";
|
|
886
887
|
import { AppendInput } from "@dxos/conductor";
|
|
887
|
-
|
|
888
|
-
|
|
888
|
+
import { S as S4 } from "@dxos/echo-schema";
|
|
889
|
+
var AppendShape = S4.extend(ComputeShape, S4.Struct({
|
|
890
|
+
type: S4.Literal("append")
|
|
889
891
|
}));
|
|
890
892
|
var createAppend = (props) => createShape({
|
|
891
893
|
type: "append",
|
|
@@ -911,12 +913,12 @@ var appendShape = {
|
|
|
911
913
|
};
|
|
912
914
|
|
|
913
915
|
// packages/ui/react-ui-canvas-compute/src/shapes/Audio.tsx
|
|
914
|
-
import { Schema as Schema5 } from "effect";
|
|
915
916
|
import React6, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
917
|
+
import { S as S5 } from "@dxos/echo-schema";
|
|
916
918
|
import { Icon as Icon2 } from "@dxos/react-ui";
|
|
917
919
|
import { createAnchorMap } from "@dxos/react-ui-canvas-editor";
|
|
918
|
-
var AudioShape =
|
|
919
|
-
type:
|
|
920
|
+
var AudioShape = S5.extend(ComputeShape, S5.Struct({
|
|
921
|
+
type: S5.Literal("audio")
|
|
920
922
|
}));
|
|
921
923
|
var createAudio = (props) => createShape({
|
|
922
924
|
type: "audio",
|
|
@@ -961,14 +963,14 @@ var audioShape = {
|
|
|
961
963
|
};
|
|
962
964
|
|
|
963
965
|
// packages/ui/react-ui-canvas-compute/src/shapes/Beacon.tsx
|
|
964
|
-
import { Schema as Schema6 } from "effect";
|
|
965
966
|
import React7 from "react";
|
|
966
967
|
import { DEFAULT_INPUT as DEFAULT_INPUT3, isTruthy } from "@dxos/conductor";
|
|
968
|
+
import { S as S6 } from "@dxos/echo-schema";
|
|
967
969
|
import { Icon as Icon3 } from "@dxos/react-ui";
|
|
968
970
|
import { createAnchorMap as createAnchorMap2 } from "@dxos/react-ui-canvas-editor";
|
|
969
971
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
970
|
-
var BeaconShape =
|
|
971
|
-
type:
|
|
972
|
+
var BeaconShape = S6.extend(ComputeShape, S6.Struct({
|
|
973
|
+
type: S6.Literal("beacon")
|
|
972
974
|
}));
|
|
973
975
|
var createBeacon = (props) => createShape({
|
|
974
976
|
type: "beacon",
|
|
@@ -1005,11 +1007,11 @@ var beaconShape = {
|
|
|
1005
1007
|
};
|
|
1006
1008
|
|
|
1007
1009
|
// packages/ui/react-ui-canvas-compute/src/shapes/Boolean.tsx
|
|
1008
|
-
import { Schema as Schema7 } from "effect";
|
|
1009
1010
|
import React8 from "react";
|
|
1011
|
+
import { S as S7 } from "@dxos/echo-schema";
|
|
1010
1012
|
import { createAnchors as createAnchors2, getAnchorPoints } from "@dxos/react-ui-canvas-editor";
|
|
1011
|
-
var GateShape =
|
|
1012
|
-
type:
|
|
1013
|
+
var GateShape = S7.extend(ComputeShape, S7.Struct({
|
|
1014
|
+
type: S7.String
|
|
1013
1015
|
}));
|
|
1014
1016
|
var createGate = (props) => createShape({
|
|
1015
1017
|
size: {
|
|
@@ -1176,13 +1178,13 @@ var notShape = defineShape({
|
|
|
1176
1178
|
});
|
|
1177
1179
|
|
|
1178
1180
|
// packages/ui/react-ui-canvas-compute/src/shapes/Chat.tsx
|
|
1179
|
-
import { Schema as Schema8 } from "effect";
|
|
1180
1181
|
import React9, { useRef as useRef2 } from "react";
|
|
1181
1182
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT3 } from "@dxos/conductor";
|
|
1183
|
+
import { S as S8 } from "@dxos/echo-schema";
|
|
1182
1184
|
import { TextBox } from "@dxos/react-ui-canvas-editor";
|
|
1183
1185
|
import { createAnchorMap as createAnchorMap3 } from "@dxos/react-ui-canvas-editor";
|
|
1184
|
-
var ChatShape =
|
|
1185
|
-
type:
|
|
1186
|
+
var ChatShape = S8.extend(ComputeShape, S8.Struct({
|
|
1187
|
+
type: S8.Literal("chat")
|
|
1186
1188
|
}));
|
|
1187
1189
|
var TextInputComponent = ({ shape, title, ...props }) => {
|
|
1188
1190
|
const { runtime } = useComputeNodeState(shape);
|
|
@@ -1231,16 +1233,16 @@ var chatShape = {
|
|
|
1231
1233
|
};
|
|
1232
1234
|
|
|
1233
1235
|
// packages/ui/react-ui-canvas-compute/src/shapes/Constant.tsx
|
|
1234
|
-
import { Schema as Schema9 } from "effect";
|
|
1235
1236
|
import React10, { useCallback as useCallback2, useRef as useRef3, useState as useState5 } from "react";
|
|
1236
1237
|
import { ComputeValueType as ComputeValueType2 } from "@dxos/conductor";
|
|
1238
|
+
import { S as S9 } from "@dxos/echo-schema";
|
|
1237
1239
|
import { Input } from "@dxos/react-ui";
|
|
1238
1240
|
import { TextBox as TextBox2 } from "@dxos/react-ui-canvas-editor";
|
|
1239
1241
|
import { createAnchorMap as createAnchorMap4 } from "@dxos/react-ui-canvas-editor";
|
|
1240
1242
|
import { safeParseJson } from "@dxos/util";
|
|
1241
|
-
var ConstantShape =
|
|
1242
|
-
type:
|
|
1243
|
-
value:
|
|
1243
|
+
var ConstantShape = S9.extend(ComputeShape, S9.Struct({
|
|
1244
|
+
type: S9.Literal("constant"),
|
|
1245
|
+
value: S9.optional(S9.Any)
|
|
1244
1246
|
}));
|
|
1245
1247
|
var inferType = (value) => {
|
|
1246
1248
|
if (typeof value === "string") {
|
|
@@ -1328,11 +1330,11 @@ var constantShape = {
|
|
|
1328
1330
|
};
|
|
1329
1331
|
|
|
1330
1332
|
// packages/ui/react-ui-canvas-compute/src/shapes/Database.tsx
|
|
1331
|
-
import { Schema as Schema10 } from "effect";
|
|
1332
1333
|
import React11 from "react";
|
|
1334
|
+
import { S as S10 } from "@dxos/echo-schema";
|
|
1333
1335
|
import { createAnchorMap as createAnchorMap5 } from "@dxos/react-ui-canvas-editor";
|
|
1334
|
-
var DatabaseShape =
|
|
1335
|
-
type:
|
|
1336
|
+
var DatabaseShape = S10.extend(ComputeShape, S10.Struct({
|
|
1337
|
+
type: S10.Literal("database")
|
|
1336
1338
|
}));
|
|
1337
1339
|
var createDatabase = (props) => createShape({
|
|
1338
1340
|
type: "database",
|
|
@@ -1362,16 +1364,15 @@ var databaseShape = {
|
|
|
1362
1364
|
};
|
|
1363
1365
|
|
|
1364
1366
|
// packages/ui/react-ui-canvas-compute/src/shapes/Function.tsx
|
|
1365
|
-
import { Schema as Schema11 } from "effect";
|
|
1366
1367
|
import React12, { useCallback as useCallback3, useRef as useRef4 } from "react";
|
|
1367
1368
|
import { AnyOutput, FunctionInput } from "@dxos/conductor";
|
|
1368
|
-
import { getSnapshot, isInstanceOf,
|
|
1369
|
-
import { FunctionType, ScriptType } from "@dxos/functions";
|
|
1369
|
+
import { getSnapshot, isInstanceOf, S as S11 } from "@dxos/echo-schema";
|
|
1370
|
+
import { FunctionType, ScriptType } from "@dxos/functions/types";
|
|
1370
1371
|
import { useClient } from "@dxos/react-client";
|
|
1371
1372
|
import { Filter, makeRef, parseId } from "@dxos/react-client/echo";
|
|
1372
1373
|
import { TextBox as TextBox3 } from "@dxos/react-ui-canvas-editor";
|
|
1373
|
-
var FunctionShape =
|
|
1374
|
-
type:
|
|
1374
|
+
var FunctionShape = S11.extend(ComputeShape, S11.Struct({
|
|
1375
|
+
type: S11.Literal("function")
|
|
1375
1376
|
}));
|
|
1376
1377
|
var createFunction = (props) => createShape({
|
|
1377
1378
|
type: "function",
|
|
@@ -1396,8 +1397,8 @@ var TextInputComponent2 = ({ shape, title, ...props }) => {
|
|
|
1396
1397
|
if (!space || !isInstanceOf(ScriptType, object)) {
|
|
1397
1398
|
return;
|
|
1398
1399
|
}
|
|
1399
|
-
const { objects: [fn] } = await space.db.query(Filter.
|
|
1400
|
-
source:
|
|
1400
|
+
const { objects: [fn] } = await space.db.query(Filter.schema(FunctionType, {
|
|
1401
|
+
source: object
|
|
1401
1402
|
})).run();
|
|
1402
1403
|
if (!fn) {
|
|
1403
1404
|
return;
|
|
@@ -1441,11 +1442,11 @@ var functionShape = {
|
|
|
1441
1442
|
};
|
|
1442
1443
|
|
|
1443
1444
|
// packages/ui/react-ui-canvas-compute/src/shapes/Gpt.tsx
|
|
1444
|
-
import { Schema as Schema12 } from "effect";
|
|
1445
1445
|
import React13, { useEffect as useEffect4, useState as useState6 } from "react";
|
|
1446
1446
|
import { GptInput, GptOutput } from "@dxos/conductor";
|
|
1447
|
-
|
|
1448
|
-
|
|
1447
|
+
import { S as S12 } from "@dxos/echo-schema";
|
|
1448
|
+
var GptShape = S12.extend(ComputeShape, S12.Struct({
|
|
1449
|
+
type: S12.Literal("gpt")
|
|
1449
1450
|
}));
|
|
1450
1451
|
var createGpt = (props) => createShape({
|
|
1451
1452
|
type: "gpt",
|
|
@@ -1511,16 +1512,16 @@ var gptShape = {
|
|
|
1511
1512
|
};
|
|
1512
1513
|
|
|
1513
1514
|
// packages/ui/react-ui-canvas-compute/src/shapes/Json.tsx
|
|
1514
|
-
import { Schema as Schema13 } from "effect";
|
|
1515
1515
|
import React14 from "react";
|
|
1516
1516
|
import { DEFAULT_INPUT as DEFAULT_INPUT4, DefaultOutput, JsonTransformInput } from "@dxos/conductor";
|
|
1517
|
+
import { S as S13 } from "@dxos/echo-schema";
|
|
1517
1518
|
import { createAnchorMap as createAnchorMap6 } from "@dxos/react-ui-canvas-editor";
|
|
1518
1519
|
import { JsonFilter } from "@dxos/react-ui-syntax-highlighter";
|
|
1519
|
-
var JsonShape =
|
|
1520
|
-
type:
|
|
1520
|
+
var JsonShape = S13.extend(ComputeShape, S13.Struct({
|
|
1521
|
+
type: S13.Literal("json")
|
|
1521
1522
|
}));
|
|
1522
|
-
var JsonTransformShape =
|
|
1523
|
-
type:
|
|
1523
|
+
var JsonTransformShape = S13.extend(ComputeShape, S13.Struct({
|
|
1524
|
+
type: S13.Literal("json-transform")
|
|
1524
1525
|
}));
|
|
1525
1526
|
var JsonComponent = ({ shape, ...props }) => {
|
|
1526
1527
|
const { runtime } = useComputeNodeState(shape);
|
|
@@ -1583,14 +1584,14 @@ var jsonTransformShape = {
|
|
|
1583
1584
|
};
|
|
1584
1585
|
|
|
1585
1586
|
// packages/ui/react-ui-canvas-compute/src/shapes/Logic.tsx
|
|
1586
|
-
import { Schema as Schema14 } from "effect";
|
|
1587
1587
|
import React15 from "react";
|
|
1588
1588
|
import { IfElseInput, IfElseOutput, IfInput, IfOutput } from "@dxos/conductor";
|
|
1589
|
-
|
|
1590
|
-
|
|
1589
|
+
import { S as S14 } from "@dxos/echo-schema";
|
|
1590
|
+
var IfShape = S14.extend(ComputeShape, S14.Struct({
|
|
1591
|
+
type: S14.Literal("if")
|
|
1591
1592
|
}));
|
|
1592
|
-
var IfElseShape =
|
|
1593
|
-
type:
|
|
1593
|
+
var IfElseShape = S14.extend(ComputeShape, S14.Struct({
|
|
1594
|
+
type: S14.Literal("if-else")
|
|
1594
1595
|
}));
|
|
1595
1596
|
var IfComponent = ({ shape, ...props }) => {
|
|
1596
1597
|
return /* @__PURE__ */ React15.createElement(FunctionBody, {
|
|
@@ -1640,12 +1641,12 @@ var ifElseShape = {
|
|
|
1640
1641
|
};
|
|
1641
1642
|
|
|
1642
1643
|
// packages/ui/react-ui-canvas-compute/src/shapes/Queue.tsx
|
|
1643
|
-
import { Schema as Schema15 } from "effect";
|
|
1644
1644
|
import React16, { Fragment } from "react";
|
|
1645
1645
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT4, QueueInput, QueueOutput } from "@dxos/conductor";
|
|
1646
|
+
import { S as S15 } from "@dxos/echo-schema";
|
|
1646
1647
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
1647
|
-
var QueueShape =
|
|
1648
|
-
type:
|
|
1648
|
+
var QueueShape = S15.extend(ComputeShape, S15.Struct({
|
|
1649
|
+
type: S15.Literal("queue")
|
|
1649
1650
|
}));
|
|
1650
1651
|
var createQueue = (props) => createShape({
|
|
1651
1652
|
type: "queue",
|
|
@@ -1702,16 +1703,16 @@ var queueShape = {
|
|
|
1702
1703
|
};
|
|
1703
1704
|
|
|
1704
1705
|
// packages/ui/react-ui-canvas-compute/src/shapes/RNG.tsx
|
|
1705
|
-
import { Schema as Schema16 } from "effect";
|
|
1706
1706
|
import React17, { useEffect as useEffect5, useState as useState7 } from "react";
|
|
1707
1707
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT5 } from "@dxos/conductor";
|
|
1708
|
+
import { S as S16 } from "@dxos/echo-schema";
|
|
1708
1709
|
import { Icon as Icon4 } from "@dxos/react-ui";
|
|
1709
1710
|
import { createAnchorMap as createAnchorMap7 } from "@dxos/react-ui-canvas-editor";
|
|
1710
1711
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1711
|
-
var RandomShape =
|
|
1712
|
-
type:
|
|
1713
|
-
min:
|
|
1714
|
-
max:
|
|
1712
|
+
var RandomShape = S16.extend(ComputeShape, S16.Struct({
|
|
1713
|
+
type: S16.Literal("rng"),
|
|
1714
|
+
min: S16.optional(S16.Number),
|
|
1715
|
+
max: S16.optional(S16.Number)
|
|
1715
1716
|
}));
|
|
1716
1717
|
var createRandom = (props) => createShape({
|
|
1717
1718
|
type: "rng",
|
|
@@ -1778,13 +1779,13 @@ var randomShape = {
|
|
|
1778
1779
|
};
|
|
1779
1780
|
|
|
1780
1781
|
// packages/ui/react-ui-canvas-compute/src/shapes/Scope.tsx
|
|
1781
|
-
import { Schema as Schema17 } from "effect";
|
|
1782
1782
|
import React18 from "react";
|
|
1783
1783
|
import { DEFAULT_INPUT as DEFAULT_INPUT5 } from "@dxos/conductor";
|
|
1784
|
+
import { S as S17 } from "@dxos/echo-schema";
|
|
1784
1785
|
import { createAnchorMap as createAnchorMap8 } from "@dxos/react-ui-canvas-editor";
|
|
1785
1786
|
import { useAudioStream, Chaos, shaderPresets } from "@dxos/react-ui-sfx";
|
|
1786
|
-
var ScopeShape =
|
|
1787
|
-
type:
|
|
1787
|
+
var ScopeShape = S17.extend(ComputeShape, S17.Struct({
|
|
1788
|
+
type: S17.Literal("scope")
|
|
1788
1789
|
}));
|
|
1789
1790
|
var createScope = (props) => createShape({
|
|
1790
1791
|
type: "scope",
|
|
@@ -1826,13 +1827,13 @@ var scopeShape = {
|
|
|
1826
1827
|
};
|
|
1827
1828
|
|
|
1828
1829
|
// packages/ui/react-ui-canvas-compute/src/shapes/Surface.tsx
|
|
1829
|
-
import { Schema as Schema18 } from "effect";
|
|
1830
1830
|
import React19 from "react";
|
|
1831
1831
|
import { Surface } from "@dxos/app-framework";
|
|
1832
1832
|
import { DEFAULT_INPUT as DEFAULT_INPUT6 } from "@dxos/conductor";
|
|
1833
|
+
import { S as S18 } from "@dxos/echo-schema";
|
|
1833
1834
|
import { createAnchorMap as createAnchorMap9 } from "@dxos/react-ui-canvas-editor";
|
|
1834
|
-
var SurfaceShape =
|
|
1835
|
-
type:
|
|
1835
|
+
var SurfaceShape = S18.extend(ComputeShape, S18.Struct({
|
|
1836
|
+
type: S18.Literal("surface")
|
|
1836
1837
|
}));
|
|
1837
1838
|
var createSurface = (props) => createShape({
|
|
1838
1839
|
type: "surface",
|
|
@@ -1878,13 +1879,13 @@ var surfaceShape = {
|
|
|
1878
1879
|
};
|
|
1879
1880
|
|
|
1880
1881
|
// packages/ui/react-ui-canvas-compute/src/shapes/Switch.tsx
|
|
1881
|
-
import { Schema as Schema19 } from "effect";
|
|
1882
1882
|
import React20, { useEffect as useEffect6, useState as useState8 } from "react";
|
|
1883
1883
|
import { DEFAULT_OUTPUT as DEFAULT_OUTPUT6 } from "@dxos/conductor";
|
|
1884
|
+
import { S as S19 } from "@dxos/echo-schema";
|
|
1884
1885
|
import { Input as Input2 } from "@dxos/react-ui";
|
|
1885
1886
|
import { createAnchorMap as createAnchorMap10 } from "@dxos/react-ui-canvas-editor";
|
|
1886
|
-
var SwitchShape =
|
|
1887
|
-
type:
|
|
1887
|
+
var SwitchShape = S19.extend(ComputeShape, S19.Struct({
|
|
1888
|
+
type: S19.Literal("switch")
|
|
1888
1889
|
}));
|
|
1889
1890
|
var createSwitch = (props) => createShape({
|
|
1890
1891
|
type: "switch",
|
|
@@ -1925,13 +1926,13 @@ var switchShape = {
|
|
|
1925
1926
|
};
|
|
1926
1927
|
|
|
1927
1928
|
// packages/ui/react-ui-canvas-compute/src/shapes/Table.tsx
|
|
1928
|
-
import { Schema as Schema20 } from "effect";
|
|
1929
1929
|
import React21 from "react";
|
|
1930
1930
|
import { createInputSchema, createOutputSchema, GptMessage } from "@dxos/conductor";
|
|
1931
|
+
import { S as S20 } from "@dxos/echo-schema";
|
|
1931
1932
|
var InputSchema = createInputSchema(GptMessage);
|
|
1932
|
-
var OutputSchema = createOutputSchema(
|
|
1933
|
-
var TableShape =
|
|
1934
|
-
type:
|
|
1933
|
+
var OutputSchema = createOutputSchema(S20.mutable(S20.Array(GptMessage)));
|
|
1934
|
+
var TableShape = S20.extend(ComputeShape, S20.Struct({
|
|
1935
|
+
type: S20.Literal("table")
|
|
1935
1936
|
}));
|
|
1936
1937
|
var createTable = (props) => createShape({
|
|
1937
1938
|
type: "table",
|
|
@@ -1957,16 +1958,15 @@ var tableShape = {
|
|
|
1957
1958
|
};
|
|
1958
1959
|
|
|
1959
1960
|
// packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx
|
|
1960
|
-
import { Schema as Schema21 } from "effect";
|
|
1961
1961
|
import React22, { useRef as useRef5 } from "react";
|
|
1962
1962
|
import { ComputeValueType as ComputeValueType3, getTemplateInputSchema as getTemplateInputSchema2, TemplateOutput, VoidInput as VoidInput2 } from "@dxos/conductor";
|
|
1963
|
-
import { toJsonSchema as toJsonSchema2 } from "@dxos/echo-schema";
|
|
1963
|
+
import { S as S21, toJsonSchema as toJsonSchema2 } from "@dxos/echo-schema";
|
|
1964
1964
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1965
1965
|
import { TextBox as TextBox4 } from "@dxos/react-ui-canvas-editor";
|
|
1966
1966
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/Template.tsx";
|
|
1967
|
-
var TemplateShape =
|
|
1968
|
-
type:
|
|
1969
|
-
valueType:
|
|
1967
|
+
var TemplateShape = S21.extend(ComputeShape, S21.Struct({
|
|
1968
|
+
type: S21.Literal("template"),
|
|
1969
|
+
valueType: S21.optional(ComputeValueType3)
|
|
1970
1970
|
}));
|
|
1971
1971
|
var TextInputComponent3 = ({ shape, title, ...props }) => {
|
|
1972
1972
|
const { node } = useComputeNodeState(shape);
|
|
@@ -1980,12 +1980,12 @@ var TextInputComponent3 = ({ shape, title, ...props }) => {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
};
|
|
1982
1982
|
const handleTypeChange = (newType) => {
|
|
1983
|
-
invariant5(
|
|
1983
|
+
invariant5(S21.is(ComputeValueType3)(newType), "Invalid type", {
|
|
1984
1984
|
F: __dxlog_file6,
|
|
1985
|
-
L:
|
|
1985
|
+
L: 57,
|
|
1986
1986
|
S: void 0,
|
|
1987
1987
|
A: [
|
|
1988
|
-
"
|
|
1988
|
+
"S.is(ComputeValueType)(newType)",
|
|
1989
1989
|
"'Invalid type'"
|
|
1990
1990
|
]
|
|
1991
1991
|
});
|
|
@@ -2030,13 +2030,13 @@ var templateShape = {
|
|
|
2030
2030
|
};
|
|
2031
2031
|
|
|
2032
2032
|
// packages/ui/react-ui-canvas-compute/src/shapes/Text.tsx
|
|
2033
|
-
import { Schema as Schema22 } from "effect";
|
|
2034
2033
|
import React23 from "react";
|
|
2035
2034
|
import { DEFAULT_INPUT as DEFAULT_INPUT7 } from "@dxos/conductor";
|
|
2035
|
+
import { S as S22 } from "@dxos/echo-schema";
|
|
2036
2036
|
import { TextBox as TextBox5 } from "@dxos/react-ui-canvas-editor";
|
|
2037
2037
|
import { createAnchorMap as createAnchorMap11 } from "@dxos/react-ui-canvas-editor";
|
|
2038
|
-
var TextShape =
|
|
2039
|
-
type:
|
|
2038
|
+
var TextShape = S22.extend(ComputeShape, S22.Struct({
|
|
2039
|
+
type: S22.Literal("text")
|
|
2040
2040
|
}));
|
|
2041
2041
|
var createText = (props) => createShape({
|
|
2042
2042
|
type: "text",
|
|
@@ -2078,14 +2078,14 @@ var textShape = {
|
|
|
2078
2078
|
};
|
|
2079
2079
|
|
|
2080
2080
|
// packages/ui/react-ui-canvas-compute/src/shapes/Thread.tsx
|
|
2081
|
-
import { Schema as Schema23 } from "effect";
|
|
2082
2081
|
import React24, { useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
2083
2082
|
import { createInputSchema as createInputSchema2, createOutputSchema as createOutputSchema2, GptMessage as GptMessage2 } from "@dxos/conductor";
|
|
2083
|
+
import { S as S23 } from "@dxos/echo-schema";
|
|
2084
2084
|
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
2085
2085
|
var InputSchema2 = createInputSchema2(GptMessage2);
|
|
2086
|
-
var OutputSchema2 = createOutputSchema2(
|
|
2087
|
-
var ThreadShape =
|
|
2088
|
-
type:
|
|
2086
|
+
var OutputSchema2 = createOutputSchema2(S23.mutable(S23.Array(GptMessage2)));
|
|
2087
|
+
var ThreadShape = S23.extend(ComputeShape, S23.Struct({
|
|
2088
|
+
type: S23.Literal("thread")
|
|
2089
2089
|
}));
|
|
2090
2090
|
var createThread = (props) => createShape({
|
|
2091
2091
|
type: "thread",
|
|
@@ -2141,11 +2141,11 @@ var threadShape = {
|
|
|
2141
2141
|
};
|
|
2142
2142
|
|
|
2143
2143
|
// packages/ui/react-ui-canvas-compute/src/shapes/TextToImage.tsx
|
|
2144
|
-
import { Schema as Schema24 } from "effect";
|
|
2145
2144
|
import React25 from "react";
|
|
2145
|
+
import { S as S24 } from "@dxos/echo-schema";
|
|
2146
2146
|
import { createAnchorMap as createAnchorMap12 } from "@dxos/react-ui-canvas-editor";
|
|
2147
|
-
var TextToImageShape =
|
|
2148
|
-
type:
|
|
2147
|
+
var TextToImageShape = S24.extend(ComputeShape, S24.Struct({
|
|
2148
|
+
type: S24.Literal("text-to-image")
|
|
2149
2149
|
}));
|
|
2150
2150
|
var createTextToImage = (props) => createShape({
|
|
2151
2151
|
type: "text-to-image",
|
|
@@ -2175,20 +2175,19 @@ var textToImageShape = {
|
|
|
2175
2175
|
};
|
|
2176
2176
|
|
|
2177
2177
|
// packages/ui/react-ui-canvas-compute/src/shapes/Trigger.tsx
|
|
2178
|
-
import { Schema as Schema25 } from "effect";
|
|
2179
2178
|
import React26, { useEffect as useEffect8 } from "react";
|
|
2180
|
-
import { VoidInput as VoidInput3 } from "@dxos/conductor";
|
|
2181
|
-
import { ObjectId as ObjectId4, Ref as
|
|
2182
|
-
import { FunctionTrigger, TriggerKind
|
|
2183
|
-
import { DXN, SpaceId } from "@dxos/keys";
|
|
2184
|
-
import {
|
|
2179
|
+
import { EmailTriggerOutput, QueueTriggerOutput, SubscriptionTriggerOutput, TimerTriggerOutput, VoidInput as VoidInput3, WebhookTriggerOutput } from "@dxos/conductor";
|
|
2180
|
+
import { ObjectId as ObjectId4, Ref, S as S25 } from "@dxos/echo-schema";
|
|
2181
|
+
import { FunctionTrigger, TriggerKind } from "@dxos/functions/types";
|
|
2182
|
+
import { DXN as DXN2, SpaceId } from "@dxos/keys";
|
|
2183
|
+
import { create, makeRef as makeRef2, useSpace } from "@dxos/react-client/echo";
|
|
2185
2184
|
import { Select as Select2 } from "@dxos/react-ui";
|
|
2186
|
-
var TriggerShape =
|
|
2187
|
-
type:
|
|
2188
|
-
functionTrigger:
|
|
2185
|
+
var TriggerShape = S25.extend(ComputeShape, S25.Struct({
|
|
2186
|
+
type: S25.Literal("trigger"),
|
|
2187
|
+
functionTrigger: S25.optional(Ref(FunctionTrigger))
|
|
2189
2188
|
}));
|
|
2190
2189
|
var createTrigger = (props) => {
|
|
2191
|
-
const functionTrigger =
|
|
2190
|
+
const functionTrigger = create(FunctionTrigger, {
|
|
2192
2191
|
enabled: true,
|
|
2193
2192
|
spec: createTriggerSpec(props)
|
|
2194
2193
|
});
|
|
@@ -2217,14 +2216,14 @@ var TriggerComponent = ({ shape }) => {
|
|
|
2217
2216
|
functionTrigger?.spec
|
|
2218
2217
|
]);
|
|
2219
2218
|
useEffect8(() => {
|
|
2220
|
-
shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.
|
|
2219
|
+
shape.size.height = getHeight(getOutputSchema(functionTrigger?.spec?.type ?? TriggerKind.Email));
|
|
2221
2220
|
}, [
|
|
2222
|
-
functionTrigger?.spec?.
|
|
2221
|
+
functionTrigger?.spec?.type
|
|
2223
2222
|
]);
|
|
2224
2223
|
const setKind = (kind) => {
|
|
2225
|
-
if (functionTrigger?.spec?.
|
|
2224
|
+
if (functionTrigger?.spec?.type !== kind) {
|
|
2226
2225
|
functionTrigger.spec = createTriggerSpec({
|
|
2227
|
-
triggerKind:
|
|
2226
|
+
triggerKind: TriggerKind.Email,
|
|
2228
2227
|
spaceId: space?.id
|
|
2229
2228
|
});
|
|
2230
2229
|
}
|
|
@@ -2235,11 +2234,11 @@ var TriggerComponent = ({ shape }) => {
|
|
|
2235
2234
|
return /* @__PURE__ */ React26.createElement(FunctionBody, {
|
|
2236
2235
|
shape,
|
|
2237
2236
|
status: /* @__PURE__ */ React26.createElement(TriggerKindSelect, {
|
|
2238
|
-
value: functionTrigger.spec?.
|
|
2237
|
+
value: functionTrigger.spec?.type,
|
|
2239
2238
|
onValueChange: (kind) => setKind(kind)
|
|
2240
2239
|
}),
|
|
2241
2240
|
inputSchema: VoidInput3,
|
|
2242
|
-
outputSchema: getOutputSchema(functionTrigger.spec.
|
|
2241
|
+
outputSchema: getOutputSchema(functionTrigger.spec.type)
|
|
2243
2242
|
});
|
|
2244
2243
|
};
|
|
2245
2244
|
var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
@@ -2249,41 +2248,41 @@ var TriggerKindSelect = ({ value, onValueChange }) => {
|
|
|
2249
2248
|
}, /* @__PURE__ */ React26.createElement(Select2.TriggerButton, {
|
|
2250
2249
|
variant: "ghost",
|
|
2251
2250
|
classNames: "w-full !px-0"
|
|
2252
|
-
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Object.values(TriggerKind).map((
|
|
2253
|
-
key:
|
|
2254
|
-
value:
|
|
2255
|
-
},
|
|
2251
|
+
}), /* @__PURE__ */ React26.createElement(Select2.Portal, null, /* @__PURE__ */ React26.createElement(Select2.Content, null, /* @__PURE__ */ React26.createElement(Select2.ScrollUpButton, null), /* @__PURE__ */ React26.createElement(Select2.Viewport, null, Object.values(TriggerKind).map((type) => /* @__PURE__ */ React26.createElement(Select2.Option, {
|
|
2252
|
+
key: type,
|
|
2253
|
+
value: type
|
|
2254
|
+
}, type))), /* @__PURE__ */ React26.createElement(Select2.ScrollDownButton, null), /* @__PURE__ */ React26.createElement(Select2.Arrow, null))));
|
|
2256
2255
|
};
|
|
2257
2256
|
var createTriggerSpec = (props) => {
|
|
2258
2257
|
const kind = props.triggerKind ?? TriggerKind.Email;
|
|
2259
2258
|
switch (kind) {
|
|
2260
2259
|
case TriggerKind.Timer:
|
|
2261
2260
|
return {
|
|
2262
|
-
|
|
2261
|
+
type: TriggerKind.Timer,
|
|
2263
2262
|
cron: "*/10 * * * * *"
|
|
2264
2263
|
};
|
|
2265
2264
|
case TriggerKind.Webhook:
|
|
2266
2265
|
return {
|
|
2267
|
-
|
|
2266
|
+
type: TriggerKind.Webhook,
|
|
2268
2267
|
method: "POST"
|
|
2269
2268
|
};
|
|
2270
2269
|
case TriggerKind.Subscription:
|
|
2271
2270
|
return {
|
|
2272
|
-
|
|
2271
|
+
type: TriggerKind.Subscription,
|
|
2273
2272
|
filter: {}
|
|
2274
2273
|
};
|
|
2275
2274
|
case TriggerKind.Email:
|
|
2276
2275
|
return {
|
|
2277
|
-
|
|
2276
|
+
type: TriggerKind.Email
|
|
2278
2277
|
};
|
|
2279
2278
|
case TriggerKind.Queue: {
|
|
2280
|
-
const dxn = new
|
|
2279
|
+
const dxn = new DXN2(DXN2.kind.QUEUE, [
|
|
2281
2280
|
"data",
|
|
2282
2281
|
props.spaceId ?? SpaceId.random(),
|
|
2283
2282
|
ObjectId4.random()
|
|
2284
2283
|
]).toString();
|
|
2285
2284
|
return {
|
|
2286
|
-
|
|
2285
|
+
type: TriggerKind.Queue,
|
|
2287
2286
|
queue: dxn
|
|
2288
2287
|
};
|
|
2289
2288
|
}
|
|
@@ -2305,18 +2304,18 @@ var triggerShape = {
|
|
|
2305
2304
|
icon: "ph--lightning--regular",
|
|
2306
2305
|
component: TriggerComponent,
|
|
2307
2306
|
createShape: createTrigger,
|
|
2308
|
-
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.
|
|
2307
|
+
getAnchors: (shape) => createFunctionAnchors(shape, VoidInput3, getOutputSchema(shape.functionTrigger?.target?.spec?.type ?? TriggerKind.Email))
|
|
2309
2308
|
};
|
|
2310
2309
|
|
|
2311
2310
|
// packages/ui/react-ui-canvas-compute/src/shapes/GptRealtime.tsx
|
|
2312
|
-
import { Schema as Schema26 } from "effect";
|
|
2313
2311
|
import React27, { useState as useState9 } from "react";
|
|
2312
|
+
import { S as S26 } from "@dxos/echo-schema";
|
|
2314
2313
|
import { log as log2 } from "@dxos/log";
|
|
2315
2314
|
import { useConfig } from "@dxos/react-client";
|
|
2316
2315
|
import { Icon as Icon5 } from "@dxos/react-ui";
|
|
2317
2316
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-canvas-compute/src/shapes/GptRealtime.tsx";
|
|
2318
|
-
var GptRealtimeShape =
|
|
2319
|
-
type:
|
|
2317
|
+
var GptRealtimeShape = S26.extend(ComputeShape, S26.Struct({
|
|
2318
|
+
type: S26.Literal("gpt-realtime")
|
|
2320
2319
|
}));
|
|
2321
2320
|
var createGptRealtime = (props) => createShape({
|
|
2322
2321
|
type: "gpt-realtime",
|
|
@@ -2429,9 +2428,9 @@ var gptRealtimeShape = {
|
|
|
2429
2428
|
component: GptRealtimeComponent,
|
|
2430
2429
|
createShape: createGptRealtime,
|
|
2431
2430
|
// TODO(dmaretskyi): Can we fetch the schema dynamically?
|
|
2432
|
-
getAnchors: (shape) => createFunctionAnchors(shape,
|
|
2433
|
-
audio:
|
|
2434
|
-
}),
|
|
2431
|
+
getAnchors: (shape) => createFunctionAnchors(shape, S26.Struct({
|
|
2432
|
+
audio: S26.Any
|
|
2433
|
+
}), S26.Struct({})),
|
|
2435
2434
|
resizable: true
|
|
2436
2435
|
};
|
|
2437
2436
|
var DEFAULT_AI_SERVICE_URL = "http://localhost:8788";
|