@workglow/tasks 0.0.89 → 0.0.91
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/browser.js +1177 -88
- package/dist/browser.js.map +30 -8
- package/dist/bun.js +1177 -88
- package/dist/bun.js.map +30 -8
- package/dist/common.d.ts +43 -2
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +1177 -88
- package/dist/node.js.map +30 -8
- package/dist/task/ArrayTask.d.ts +1 -1
- package/dist/task/ArrayTask.d.ts.map +1 -1
- package/dist/task/JsonTask.d.ts.map +1 -1
- package/dist/task/MergeTask.d.ts +1 -1
- package/dist/task/MergeTask.d.ts.map +1 -1
- package/dist/task/adaptive.d.ts +16 -0
- package/dist/task/adaptive.d.ts.map +1 -0
- package/dist/task/scalar/ScalarAbsTask.d.ts +71 -0
- package/dist/task/scalar/ScalarAbsTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarAddTask.d.ts +81 -0
- package/dist/task/scalar/ScalarAddTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarCeilTask.d.ts +71 -0
- package/dist/task/scalar/ScalarCeilTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarDivideTask.d.ts +81 -0
- package/dist/task/scalar/ScalarDivideTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarFloorTask.d.ts +71 -0
- package/dist/task/scalar/ScalarFloorTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarMaxTask.d.ts +77 -0
- package/dist/task/scalar/ScalarMaxTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarMinTask.d.ts +77 -0
- package/dist/task/scalar/ScalarMinTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarMultiplyTask.d.ts +81 -0
- package/dist/task/scalar/ScalarMultiplyTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarRoundTask.d.ts +71 -0
- package/dist/task/scalar/ScalarRoundTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarSubtractTask.d.ts +81 -0
- package/dist/task/scalar/ScalarSubtractTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarSumTask.d.ts +77 -0
- package/dist/task/scalar/ScalarSumTask.d.ts.map +1 -0
- package/dist/task/scalar/ScalarTruncTask.d.ts +71 -0
- package/dist/task/scalar/ScalarTruncTask.d.ts.map +1 -0
- package/dist/task/scalar/scalar.test.d.ts +7 -0
- package/dist/task/scalar/scalar.test.d.ts.map +1 -0
- package/dist/task/scalar/sumPrecise.d.ts +12 -0
- package/dist/task/scalar/sumPrecise.d.ts.map +1 -0
- package/dist/task/vector/VectorDistanceTask.d.ts +83 -0
- package/dist/task/vector/VectorDistanceTask.d.ts.map +1 -0
- package/dist/task/vector/VectorDivideTask.d.ts +85 -0
- package/dist/task/vector/VectorDivideTask.d.ts.map +1 -0
- package/dist/task/vector/VectorDotProductTask.d.ts +83 -0
- package/dist/task/vector/VectorDotProductTask.d.ts.map +1 -0
- package/dist/task/vector/VectorMultiplyTask.d.ts +85 -0
- package/dist/task/vector/VectorMultiplyTask.d.ts.map +1 -0
- package/dist/task/vector/VectorNormalizeTask.d.ts +75 -0
- package/dist/task/vector/VectorNormalizeTask.d.ts.map +1 -0
- package/dist/task/vector/VectorScaleTask.d.ts +85 -0
- package/dist/task/vector/VectorScaleTask.d.ts.map +1 -0
- package/dist/task/vector/VectorSubtractTask.d.ts +85 -0
- package/dist/task/vector/VectorSubtractTask.d.ts.map +1 -0
- package/dist/task/vector/VectorSumTask.d.ts +85 -0
- package/dist/task/vector/VectorSumTask.d.ts.map +1 -0
- package/dist/task/vector/vector.test.d.ts +7 -0
- package/dist/task/vector/vector.test.d.ts.map +1 -0
- package/package.json +9 -9
package/dist/bun.js
CHANGED
|
@@ -788,6 +788,534 @@ var fileLoader = (input, config) => {
|
|
|
788
788
|
};
|
|
789
789
|
Workflow3.prototype.fileLoader = CreateWorkflow3(FileLoaderTask2);
|
|
790
790
|
|
|
791
|
+
// src/task/adaptive.ts
|
|
792
|
+
import { CreateAdaptiveWorkflow, Workflow as Workflow13 } from "@workglow/task-graph";
|
|
793
|
+
|
|
794
|
+
// src/task/scalar/ScalarAddTask.ts
|
|
795
|
+
import { CreateWorkflow as CreateWorkflow4, Task as Task2, Workflow as Workflow4 } from "@workglow/task-graph";
|
|
796
|
+
|
|
797
|
+
// src/task/scalar/sumPrecise.ts
|
|
798
|
+
function kahanSum(values) {
|
|
799
|
+
let sum = 0;
|
|
800
|
+
let compensation = 0;
|
|
801
|
+
for (const value of values) {
|
|
802
|
+
const y = value - compensation;
|
|
803
|
+
const t = sum + y;
|
|
804
|
+
compensation = t - sum - y;
|
|
805
|
+
sum = t;
|
|
806
|
+
}
|
|
807
|
+
return sum;
|
|
808
|
+
}
|
|
809
|
+
var nativeSumPrecise = typeof Math.sumPrecise === "function" ? Math.sumPrecise : undefined;
|
|
810
|
+
var sumPrecise = nativeSumPrecise ? nativeSumPrecise.bind(Math) : kahanSum;
|
|
811
|
+
|
|
812
|
+
// src/task/scalar/ScalarAddTask.ts
|
|
813
|
+
var inputSchema3 = {
|
|
814
|
+
type: "object",
|
|
815
|
+
properties: {
|
|
816
|
+
a: {
|
|
817
|
+
type: "number",
|
|
818
|
+
title: "A",
|
|
819
|
+
description: "First number"
|
|
820
|
+
},
|
|
821
|
+
b: {
|
|
822
|
+
type: "number",
|
|
823
|
+
title: "B",
|
|
824
|
+
description: "Second number"
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
required: ["a", "b"],
|
|
828
|
+
additionalProperties: false
|
|
829
|
+
};
|
|
830
|
+
var outputSchema3 = {
|
|
831
|
+
type: "object",
|
|
832
|
+
properties: {
|
|
833
|
+
result: {
|
|
834
|
+
type: "number",
|
|
835
|
+
title: "Result",
|
|
836
|
+
description: "Sum of a and b"
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
required: ["result"],
|
|
840
|
+
additionalProperties: false
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
class ScalarAddTask extends Task2 {
|
|
844
|
+
static type = "ScalarAddTask";
|
|
845
|
+
static category = "Math";
|
|
846
|
+
static title = "Add";
|
|
847
|
+
static description = "Returns the sum of two numbers";
|
|
848
|
+
static inputSchema() {
|
|
849
|
+
return inputSchema3;
|
|
850
|
+
}
|
|
851
|
+
static outputSchema() {
|
|
852
|
+
return outputSchema3;
|
|
853
|
+
}
|
|
854
|
+
async execute(input, _context) {
|
|
855
|
+
return { result: sumPrecise([input.a, input.b]) };
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
Workflow4.prototype.scalarAdd = CreateWorkflow4(ScalarAddTask);
|
|
859
|
+
|
|
860
|
+
// src/task/scalar/ScalarDivideTask.ts
|
|
861
|
+
import { CreateWorkflow as CreateWorkflow5, Task as Task3, Workflow as Workflow5 } from "@workglow/task-graph";
|
|
862
|
+
var inputSchema4 = {
|
|
863
|
+
type: "object",
|
|
864
|
+
properties: {
|
|
865
|
+
a: {
|
|
866
|
+
type: "number",
|
|
867
|
+
title: "A",
|
|
868
|
+
description: "Numerator"
|
|
869
|
+
},
|
|
870
|
+
b: {
|
|
871
|
+
type: "number",
|
|
872
|
+
title: "B",
|
|
873
|
+
description: "Denominator"
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
required: ["a", "b"],
|
|
877
|
+
additionalProperties: false
|
|
878
|
+
};
|
|
879
|
+
var outputSchema4 = {
|
|
880
|
+
type: "object",
|
|
881
|
+
properties: {
|
|
882
|
+
result: {
|
|
883
|
+
type: "number",
|
|
884
|
+
title: "Result",
|
|
885
|
+
description: "Quotient (a / b)"
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
required: ["result"],
|
|
889
|
+
additionalProperties: false
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
class ScalarDivideTask extends Task3 {
|
|
893
|
+
static type = "ScalarDivideTask";
|
|
894
|
+
static category = "Math";
|
|
895
|
+
static title = "Divide";
|
|
896
|
+
static description = "Returns the quotient of two numbers (a / b)";
|
|
897
|
+
static inputSchema() {
|
|
898
|
+
return inputSchema4;
|
|
899
|
+
}
|
|
900
|
+
static outputSchema() {
|
|
901
|
+
return outputSchema4;
|
|
902
|
+
}
|
|
903
|
+
async execute(input, _context) {
|
|
904
|
+
return { result: input.a / input.b };
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
Workflow5.prototype.scalarDivide = CreateWorkflow5(ScalarDivideTask);
|
|
908
|
+
|
|
909
|
+
// src/task/scalar/ScalarMultiplyTask.ts
|
|
910
|
+
import { CreateWorkflow as CreateWorkflow6, Task as Task4, Workflow as Workflow6 } from "@workglow/task-graph";
|
|
911
|
+
var inputSchema5 = {
|
|
912
|
+
type: "object",
|
|
913
|
+
properties: {
|
|
914
|
+
a: {
|
|
915
|
+
type: "number",
|
|
916
|
+
title: "A",
|
|
917
|
+
description: "First number"
|
|
918
|
+
},
|
|
919
|
+
b: {
|
|
920
|
+
type: "number",
|
|
921
|
+
title: "B",
|
|
922
|
+
description: "Second number"
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
required: ["a", "b"],
|
|
926
|
+
additionalProperties: false
|
|
927
|
+
};
|
|
928
|
+
var outputSchema5 = {
|
|
929
|
+
type: "object",
|
|
930
|
+
properties: {
|
|
931
|
+
result: {
|
|
932
|
+
type: "number",
|
|
933
|
+
title: "Result",
|
|
934
|
+
description: "Product of a and b"
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
required: ["result"],
|
|
938
|
+
additionalProperties: false
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
class ScalarMultiplyTask extends Task4 {
|
|
942
|
+
static type = "ScalarMultiplyTask";
|
|
943
|
+
static category = "Math";
|
|
944
|
+
static title = "Multiply";
|
|
945
|
+
static description = "Returns the product of two numbers";
|
|
946
|
+
static inputSchema() {
|
|
947
|
+
return inputSchema5;
|
|
948
|
+
}
|
|
949
|
+
static outputSchema() {
|
|
950
|
+
return outputSchema5;
|
|
951
|
+
}
|
|
952
|
+
async execute(input, _context) {
|
|
953
|
+
return { result: input.a * input.b };
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
Workflow6.prototype.scalarMultiply = CreateWorkflow6(ScalarMultiplyTask);
|
|
957
|
+
|
|
958
|
+
// src/task/scalar/ScalarSubtractTask.ts
|
|
959
|
+
import { CreateWorkflow as CreateWorkflow7, Task as Task5, Workflow as Workflow7 } from "@workglow/task-graph";
|
|
960
|
+
var inputSchema6 = {
|
|
961
|
+
type: "object",
|
|
962
|
+
properties: {
|
|
963
|
+
a: {
|
|
964
|
+
type: "number",
|
|
965
|
+
title: "A",
|
|
966
|
+
description: "First number"
|
|
967
|
+
},
|
|
968
|
+
b: {
|
|
969
|
+
type: "number",
|
|
970
|
+
title: "B",
|
|
971
|
+
description: "Second number"
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
required: ["a", "b"],
|
|
975
|
+
additionalProperties: false
|
|
976
|
+
};
|
|
977
|
+
var outputSchema6 = {
|
|
978
|
+
type: "object",
|
|
979
|
+
properties: {
|
|
980
|
+
result: {
|
|
981
|
+
type: "number",
|
|
982
|
+
title: "Result",
|
|
983
|
+
description: "Difference (a - b)"
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
required: ["result"],
|
|
987
|
+
additionalProperties: false
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
class ScalarSubtractTask extends Task5 {
|
|
991
|
+
static type = "ScalarSubtractTask";
|
|
992
|
+
static category = "Math";
|
|
993
|
+
static title = "Subtract";
|
|
994
|
+
static description = "Returns the difference of two numbers (a - b)";
|
|
995
|
+
static inputSchema() {
|
|
996
|
+
return inputSchema6;
|
|
997
|
+
}
|
|
998
|
+
static outputSchema() {
|
|
999
|
+
return outputSchema6;
|
|
1000
|
+
}
|
|
1001
|
+
async execute(input, _context) {
|
|
1002
|
+
return { result: input.a - input.b };
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
Workflow7.prototype.scalarSubtract = CreateWorkflow7(ScalarSubtractTask);
|
|
1006
|
+
|
|
1007
|
+
// src/task/scalar/ScalarSumTask.ts
|
|
1008
|
+
import { CreateWorkflow as CreateWorkflow8, Task as Task6, Workflow as Workflow8 } from "@workglow/task-graph";
|
|
1009
|
+
var inputSchema7 = {
|
|
1010
|
+
type: "object",
|
|
1011
|
+
properties: {
|
|
1012
|
+
values: {
|
|
1013
|
+
type: "array",
|
|
1014
|
+
items: { type: "number" },
|
|
1015
|
+
title: "Values",
|
|
1016
|
+
description: "Array of numbers to sum"
|
|
1017
|
+
}
|
|
1018
|
+
},
|
|
1019
|
+
required: ["values"],
|
|
1020
|
+
additionalProperties: false
|
|
1021
|
+
};
|
|
1022
|
+
var outputSchema7 = {
|
|
1023
|
+
type: "object",
|
|
1024
|
+
properties: {
|
|
1025
|
+
result: {
|
|
1026
|
+
type: "number",
|
|
1027
|
+
title: "Result",
|
|
1028
|
+
description: "Sum of all values"
|
|
1029
|
+
}
|
|
1030
|
+
},
|
|
1031
|
+
required: ["result"],
|
|
1032
|
+
additionalProperties: false
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
class ScalarSumTask extends Task6 {
|
|
1036
|
+
static type = "ScalarSumTask";
|
|
1037
|
+
static category = "Math";
|
|
1038
|
+
static title = "Sum";
|
|
1039
|
+
static description = "Returns the sum of an array of numbers";
|
|
1040
|
+
static inputSchema() {
|
|
1041
|
+
return inputSchema7;
|
|
1042
|
+
}
|
|
1043
|
+
static outputSchema() {
|
|
1044
|
+
return outputSchema7;
|
|
1045
|
+
}
|
|
1046
|
+
async execute(input, _context) {
|
|
1047
|
+
return { result: sumPrecise(input.values) };
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
Workflow8.prototype.scalarSum = CreateWorkflow8(ScalarSumTask);
|
|
1051
|
+
|
|
1052
|
+
// src/task/vector/VectorDivideTask.ts
|
|
1053
|
+
import { CreateWorkflow as CreateWorkflow9, Task as Task7, Workflow as Workflow9 } from "@workglow/task-graph";
|
|
1054
|
+
import {
|
|
1055
|
+
createTypedArrayFrom,
|
|
1056
|
+
TypedArraySchema
|
|
1057
|
+
} from "@workglow/util";
|
|
1058
|
+
var inputSchema8 = {
|
|
1059
|
+
type: "object",
|
|
1060
|
+
properties: {
|
|
1061
|
+
vectors: {
|
|
1062
|
+
type: "array",
|
|
1063
|
+
items: TypedArraySchema({
|
|
1064
|
+
title: "Vector",
|
|
1065
|
+
description: "Vector (first is numerator, rest are denominators)"
|
|
1066
|
+
}),
|
|
1067
|
+
title: "Vectors",
|
|
1068
|
+
description: "Array of vectors: vectors[0] / vectors[1] / vectors[2] / ..."
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
required: ["vectors"],
|
|
1072
|
+
additionalProperties: false
|
|
1073
|
+
};
|
|
1074
|
+
var outputSchema8 = {
|
|
1075
|
+
type: "object",
|
|
1076
|
+
properties: {
|
|
1077
|
+
result: TypedArraySchema({
|
|
1078
|
+
title: "Result",
|
|
1079
|
+
description: "Component-wise quotient"
|
|
1080
|
+
})
|
|
1081
|
+
},
|
|
1082
|
+
required: ["result"],
|
|
1083
|
+
additionalProperties: false
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
class VectorDivideTask extends Task7 {
|
|
1087
|
+
static type = "VectorDivideTask";
|
|
1088
|
+
static category = "Vector";
|
|
1089
|
+
static title = "Divide";
|
|
1090
|
+
static description = "Returns component-wise quotient: vectors[0] / vectors[1] / vectors[2] / ...";
|
|
1091
|
+
static inputSchema() {
|
|
1092
|
+
return inputSchema8;
|
|
1093
|
+
}
|
|
1094
|
+
static outputSchema() {
|
|
1095
|
+
return outputSchema8;
|
|
1096
|
+
}
|
|
1097
|
+
async execute(input, _context) {
|
|
1098
|
+
const { vectors } = input;
|
|
1099
|
+
if (vectors.length < 2) {
|
|
1100
|
+
throw new Error("At least two vectors are required");
|
|
1101
|
+
}
|
|
1102
|
+
const len = vectors[0].length;
|
|
1103
|
+
for (let i = 1;i < vectors.length; i++) {
|
|
1104
|
+
if (vectors[i].length !== len) {
|
|
1105
|
+
throw new Error("All vectors must have the same length");
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
const values = Array.from({ length: len }, (_, i) => {
|
|
1109
|
+
let acc = Number(vectors[0][i]);
|
|
1110
|
+
for (let j = 1;j < vectors.length; j++) {
|
|
1111
|
+
acc /= Number(vectors[j][i]);
|
|
1112
|
+
}
|
|
1113
|
+
return acc;
|
|
1114
|
+
});
|
|
1115
|
+
return { result: createTypedArrayFrom(vectors, values) };
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
Workflow9.prototype.vectorDivide = CreateWorkflow9(VectorDivideTask);
|
|
1119
|
+
|
|
1120
|
+
// src/task/vector/VectorMultiplyTask.ts
|
|
1121
|
+
import { CreateWorkflow as CreateWorkflow10, Task as Task8, Workflow as Workflow10 } from "@workglow/task-graph";
|
|
1122
|
+
import {
|
|
1123
|
+
createTypedArrayFrom as createTypedArrayFrom2,
|
|
1124
|
+
TypedArraySchema as TypedArraySchema2
|
|
1125
|
+
} from "@workglow/util";
|
|
1126
|
+
var inputSchema9 = {
|
|
1127
|
+
type: "object",
|
|
1128
|
+
properties: {
|
|
1129
|
+
vectors: {
|
|
1130
|
+
type: "array",
|
|
1131
|
+
items: TypedArraySchema2({
|
|
1132
|
+
title: "Vector",
|
|
1133
|
+
description: "Vector for component-wise product"
|
|
1134
|
+
}),
|
|
1135
|
+
title: "Vectors",
|
|
1136
|
+
description: "Array of vectors to multiply component-wise"
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
required: ["vectors"],
|
|
1140
|
+
additionalProperties: false
|
|
1141
|
+
};
|
|
1142
|
+
var outputSchema9 = {
|
|
1143
|
+
type: "object",
|
|
1144
|
+
properties: {
|
|
1145
|
+
result: TypedArraySchema2({
|
|
1146
|
+
title: "Result",
|
|
1147
|
+
description: "Component-wise product (Hadamard product)"
|
|
1148
|
+
})
|
|
1149
|
+
},
|
|
1150
|
+
required: ["result"],
|
|
1151
|
+
additionalProperties: false
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
class VectorMultiplyTask extends Task8 {
|
|
1155
|
+
static type = "VectorMultiplyTask";
|
|
1156
|
+
static category = "Vector";
|
|
1157
|
+
static title = "Multiply";
|
|
1158
|
+
static description = "Returns the component-wise product (Hadamard product) of all vectors";
|
|
1159
|
+
static inputSchema() {
|
|
1160
|
+
return inputSchema9;
|
|
1161
|
+
}
|
|
1162
|
+
static outputSchema() {
|
|
1163
|
+
return outputSchema9;
|
|
1164
|
+
}
|
|
1165
|
+
async execute(input, _context) {
|
|
1166
|
+
const { vectors } = input;
|
|
1167
|
+
if (vectors.length === 0) {
|
|
1168
|
+
throw new Error("At least one vector is required");
|
|
1169
|
+
}
|
|
1170
|
+
const len = vectors[0].length;
|
|
1171
|
+
for (let i = 1;i < vectors.length; i++) {
|
|
1172
|
+
if (vectors[i].length !== len) {
|
|
1173
|
+
throw new Error("All vectors must have the same length");
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
const values = Array.from({ length: len }, (_, i) => vectors.reduce((acc, v) => acc * Number(v[i]), 1));
|
|
1177
|
+
return { result: createTypedArrayFrom2(vectors, values) };
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
Workflow10.prototype.vectorMultiply = CreateWorkflow10(VectorMultiplyTask);
|
|
1181
|
+
|
|
1182
|
+
// src/task/vector/VectorSubtractTask.ts
|
|
1183
|
+
import { CreateWorkflow as CreateWorkflow11, Task as Task9, Workflow as Workflow11 } from "@workglow/task-graph";
|
|
1184
|
+
import {
|
|
1185
|
+
createTypedArrayFrom as createTypedArrayFrom3,
|
|
1186
|
+
TypedArraySchema as TypedArraySchema3
|
|
1187
|
+
} from "@workglow/util";
|
|
1188
|
+
var inputSchema10 = {
|
|
1189
|
+
type: "object",
|
|
1190
|
+
properties: {
|
|
1191
|
+
vectors: {
|
|
1192
|
+
type: "array",
|
|
1193
|
+
items: TypedArraySchema3({
|
|
1194
|
+
title: "Vector",
|
|
1195
|
+
description: "Vector (first is minuend, rest are subtrahends)"
|
|
1196
|
+
}),
|
|
1197
|
+
title: "Vectors",
|
|
1198
|
+
description: "Array of vectors: vectors[0] - vectors[1] - vectors[2] - ..."
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
required: ["vectors"],
|
|
1202
|
+
additionalProperties: false
|
|
1203
|
+
};
|
|
1204
|
+
var outputSchema10 = {
|
|
1205
|
+
type: "object",
|
|
1206
|
+
properties: {
|
|
1207
|
+
result: TypedArraySchema3({
|
|
1208
|
+
title: "Result",
|
|
1209
|
+
description: "Difference of vectors"
|
|
1210
|
+
})
|
|
1211
|
+
},
|
|
1212
|
+
required: ["result"],
|
|
1213
|
+
additionalProperties: false
|
|
1214
|
+
};
|
|
1215
|
+
|
|
1216
|
+
class VectorSubtractTask extends Task9 {
|
|
1217
|
+
static type = "VectorSubtractTask";
|
|
1218
|
+
static category = "Vector";
|
|
1219
|
+
static title = "Subtract";
|
|
1220
|
+
static description = "Returns component-wise difference: vectors[0] - vectors[1] - vectors[2] - ...";
|
|
1221
|
+
static inputSchema() {
|
|
1222
|
+
return inputSchema10;
|
|
1223
|
+
}
|
|
1224
|
+
static outputSchema() {
|
|
1225
|
+
return outputSchema10;
|
|
1226
|
+
}
|
|
1227
|
+
async execute(input, _context) {
|
|
1228
|
+
const { vectors } = input;
|
|
1229
|
+
if (vectors.length < 2) {
|
|
1230
|
+
throw new Error("At least two vectors are required");
|
|
1231
|
+
}
|
|
1232
|
+
const len = vectors[0].length;
|
|
1233
|
+
for (let i = 1;i < vectors.length; i++) {
|
|
1234
|
+
if (vectors[i].length !== len) {
|
|
1235
|
+
throw new Error("All vectors must have the same length");
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
const values = Array.from({ length: len }, (_, i) => {
|
|
1239
|
+
let acc = Number(vectors[0][i]);
|
|
1240
|
+
for (let j = 1;j < vectors.length; j++) {
|
|
1241
|
+
acc -= Number(vectors[j][i]);
|
|
1242
|
+
}
|
|
1243
|
+
return acc;
|
|
1244
|
+
});
|
|
1245
|
+
return { result: createTypedArrayFrom3(vectors, values) };
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
Workflow11.prototype.vectorSubtract = CreateWorkflow11(VectorSubtractTask);
|
|
1249
|
+
|
|
1250
|
+
// src/task/vector/VectorSumTask.ts
|
|
1251
|
+
import { CreateWorkflow as CreateWorkflow12, Task as Task10, Workflow as Workflow12 } from "@workglow/task-graph";
|
|
1252
|
+
import {
|
|
1253
|
+
createTypedArrayFrom as createTypedArrayFrom4,
|
|
1254
|
+
TypedArraySchema as TypedArraySchema4
|
|
1255
|
+
} from "@workglow/util";
|
|
1256
|
+
var inputSchema11 = {
|
|
1257
|
+
type: "object",
|
|
1258
|
+
properties: {
|
|
1259
|
+
vectors: {
|
|
1260
|
+
type: "array",
|
|
1261
|
+
items: TypedArraySchema4({
|
|
1262
|
+
title: "Vector",
|
|
1263
|
+
description: "Vector to sum"
|
|
1264
|
+
}),
|
|
1265
|
+
title: "Vectors",
|
|
1266
|
+
description: "Array of vectors to sum component-wise"
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
required: ["vectors"],
|
|
1270
|
+
additionalProperties: false
|
|
1271
|
+
};
|
|
1272
|
+
var outputSchema11 = {
|
|
1273
|
+
type: "object",
|
|
1274
|
+
properties: {
|
|
1275
|
+
result: TypedArraySchema4({
|
|
1276
|
+
title: "Result",
|
|
1277
|
+
description: "Sum of vectors"
|
|
1278
|
+
})
|
|
1279
|
+
},
|
|
1280
|
+
required: ["result"],
|
|
1281
|
+
additionalProperties: false
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1284
|
+
class VectorSumTask extends Task10 {
|
|
1285
|
+
static type = "VectorSumTask";
|
|
1286
|
+
static category = "Vector";
|
|
1287
|
+
static title = "Sum";
|
|
1288
|
+
static description = "Returns the component-wise sum of an array of vectors";
|
|
1289
|
+
static inputSchema() {
|
|
1290
|
+
return inputSchema11;
|
|
1291
|
+
}
|
|
1292
|
+
static outputSchema() {
|
|
1293
|
+
return outputSchema11;
|
|
1294
|
+
}
|
|
1295
|
+
async execute(input, _context) {
|
|
1296
|
+
const { vectors } = input;
|
|
1297
|
+
if (vectors.length === 0) {
|
|
1298
|
+
throw new Error("At least one vector is required");
|
|
1299
|
+
}
|
|
1300
|
+
const len = vectors[0].length;
|
|
1301
|
+
for (let i = 1;i < vectors.length; i++) {
|
|
1302
|
+
if (vectors[i].length !== len) {
|
|
1303
|
+
throw new Error("All vectors must have the same length");
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
const values = Array.from({ length: len }, (_, i) => sumPrecise(vectors.map((v) => Number(v[i]))));
|
|
1307
|
+
return { result: createTypedArrayFrom4(vectors, values) };
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
Workflow12.prototype.vectorSum = CreateWorkflow12(VectorSumTask);
|
|
1311
|
+
|
|
1312
|
+
// src/task/adaptive.ts
|
|
1313
|
+
Workflow13.prototype.add = CreateAdaptiveWorkflow(ScalarAddTask, VectorSumTask);
|
|
1314
|
+
Workflow13.prototype.subtract = CreateAdaptiveWorkflow(ScalarSubtractTask, VectorSubtractTask);
|
|
1315
|
+
Workflow13.prototype.multiply = CreateAdaptiveWorkflow(ScalarMultiplyTask, VectorMultiplyTask);
|
|
1316
|
+
Workflow13.prototype.divide = CreateAdaptiveWorkflow(ScalarDivideTask, VectorDivideTask);
|
|
1317
|
+
Workflow13.prototype.sum = CreateAdaptiveWorkflow(ScalarSumTask, VectorSumTask);
|
|
1318
|
+
|
|
791
1319
|
// src/task/ArrayTask.ts
|
|
792
1320
|
import {
|
|
793
1321
|
uuid4
|
|
@@ -822,12 +1350,12 @@ class ArrayTask extends GraphAsTask {
|
|
|
822
1350
|
regenerateGraph() {
|
|
823
1351
|
const arrayInputs = new Map;
|
|
824
1352
|
let hasArrayInputs = false;
|
|
825
|
-
const
|
|
826
|
-
if (typeof
|
|
827
|
-
const keys = Object.keys(
|
|
1353
|
+
const inputSchema12 = this.inputSchema();
|
|
1354
|
+
if (typeof inputSchema12 !== "boolean") {
|
|
1355
|
+
const keys = Object.keys(inputSchema12.properties || {});
|
|
828
1356
|
for (const inputId of keys) {
|
|
829
1357
|
const inputValue = this.runInputData[inputId];
|
|
830
|
-
const inputDef =
|
|
1358
|
+
const inputDef = inputSchema12.properties?.[inputId];
|
|
831
1359
|
if (typeof inputDef === "object" && inputDef !== null && "x-replicate" in inputDef && inputDef["x-replicate"] === true && Array.isArray(inputValue) && inputValue.length > 1) {
|
|
832
1360
|
arrayInputs.set(inputId, inputValue);
|
|
833
1361
|
hasArrayInputs = true;
|
|
@@ -916,10 +1444,10 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
|
|
|
916
1444
|
}
|
|
917
1445
|
}
|
|
918
1446
|
// src/task/DebugLogTask.ts
|
|
919
|
-
import { CreateWorkflow as
|
|
1447
|
+
import { CreateWorkflow as CreateWorkflow13, Task as Task11, Workflow as Workflow14 } from "@workglow/task-graph";
|
|
920
1448
|
var log_levels = ["dir", "log", "debug", "info", "warn", "error"];
|
|
921
1449
|
var DEFAULT_LOG_LEVEL = "log";
|
|
922
|
-
var
|
|
1450
|
+
var inputSchema12 = {
|
|
923
1451
|
type: "object",
|
|
924
1452
|
properties: {
|
|
925
1453
|
console: {
|
|
@@ -936,7 +1464,7 @@ var inputSchema3 = {
|
|
|
936
1464
|
},
|
|
937
1465
|
additionalProperties: false
|
|
938
1466
|
};
|
|
939
|
-
var
|
|
1467
|
+
var outputSchema12 = {
|
|
940
1468
|
type: "object",
|
|
941
1469
|
properties: {
|
|
942
1470
|
console: {
|
|
@@ -947,17 +1475,17 @@ var outputSchema3 = {
|
|
|
947
1475
|
additionalProperties: false
|
|
948
1476
|
};
|
|
949
1477
|
|
|
950
|
-
class DebugLogTask extends
|
|
1478
|
+
class DebugLogTask extends Task11 {
|
|
951
1479
|
static type = "DebugLogTask";
|
|
952
1480
|
static category = "Utility";
|
|
953
1481
|
static title = "Debug Log";
|
|
954
1482
|
static description = "Logs messages to the console with configurable log levels for debugging task graphs";
|
|
955
1483
|
static cacheable = false;
|
|
956
1484
|
static inputSchema() {
|
|
957
|
-
return
|
|
1485
|
+
return inputSchema12;
|
|
958
1486
|
}
|
|
959
1487
|
static outputSchema() {
|
|
960
|
-
return
|
|
1488
|
+
return outputSchema12;
|
|
961
1489
|
}
|
|
962
1490
|
async executeReactive(input, output) {
|
|
963
1491
|
const { log_level = DEFAULT_LOG_LEVEL, console: messages } = input;
|
|
@@ -974,16 +1502,16 @@ var debugLog = (input, config = {}) => {
|
|
|
974
1502
|
const task = new DebugLogTask({}, config);
|
|
975
1503
|
return task.run(input);
|
|
976
1504
|
};
|
|
977
|
-
|
|
1505
|
+
Workflow14.prototype.debugLog = CreateWorkflow13(DebugLogTask);
|
|
978
1506
|
// src/task/DelayTask.ts
|
|
979
1507
|
import {
|
|
980
|
-
CreateWorkflow as
|
|
981
|
-
Task as
|
|
1508
|
+
CreateWorkflow as CreateWorkflow14,
|
|
1509
|
+
Task as Task12,
|
|
982
1510
|
TaskAbortedError as TaskAbortedError3,
|
|
983
|
-
Workflow as
|
|
1511
|
+
Workflow as Workflow15
|
|
984
1512
|
} from "@workglow/task-graph";
|
|
985
1513
|
import { sleep } from "@workglow/util";
|
|
986
|
-
var
|
|
1514
|
+
var inputSchema13 = {
|
|
987
1515
|
type: "object",
|
|
988
1516
|
properties: {
|
|
989
1517
|
delay: {
|
|
@@ -998,22 +1526,22 @@ var inputSchema4 = {
|
|
|
998
1526
|
},
|
|
999
1527
|
additionalProperties: false
|
|
1000
1528
|
};
|
|
1001
|
-
var
|
|
1529
|
+
var outputSchema13 = {
|
|
1002
1530
|
type: "object",
|
|
1003
1531
|
properties: {},
|
|
1004
1532
|
additionalProperties: true
|
|
1005
1533
|
};
|
|
1006
1534
|
|
|
1007
|
-
class DelayTask extends
|
|
1535
|
+
class DelayTask extends Task12 {
|
|
1008
1536
|
static type = "DelayTask";
|
|
1009
1537
|
static category = "Utility";
|
|
1010
1538
|
static title = "Delay";
|
|
1011
1539
|
static description = "Delays execution for a specified duration with progress tracking";
|
|
1012
1540
|
static inputSchema() {
|
|
1013
|
-
return
|
|
1541
|
+
return inputSchema13;
|
|
1014
1542
|
}
|
|
1015
1543
|
static outputSchema() {
|
|
1016
|
-
return
|
|
1544
|
+
return outputSchema13;
|
|
1017
1545
|
}
|
|
1018
1546
|
async execute(input, executeContext) {
|
|
1019
1547
|
const delay = input.delay ?? 0;
|
|
@@ -1037,11 +1565,11 @@ var delay = (input, config = {}) => {
|
|
|
1037
1565
|
const task = new DelayTask({}, config);
|
|
1038
1566
|
return task.run(input);
|
|
1039
1567
|
};
|
|
1040
|
-
|
|
1568
|
+
Workflow15.prototype.delay = CreateWorkflow14(DelayTask);
|
|
1041
1569
|
// src/task/InputTask.ts
|
|
1042
|
-
import { CreateWorkflow as
|
|
1570
|
+
import { CreateWorkflow as CreateWorkflow15, Task as Task13, Workflow as Workflow16 } from "@workglow/task-graph";
|
|
1043
1571
|
|
|
1044
|
-
class InputTask extends
|
|
1572
|
+
class InputTask extends Task13 {
|
|
1045
1573
|
static type = "InputTask";
|
|
1046
1574
|
static category = "Flow Control";
|
|
1047
1575
|
static title = "Input";
|
|
@@ -1075,9 +1603,9 @@ class InputTask extends Task4 {
|
|
|
1075
1603
|
return input;
|
|
1076
1604
|
}
|
|
1077
1605
|
}
|
|
1078
|
-
|
|
1606
|
+
Workflow16.prototype.input = CreateWorkflow15(InputTask);
|
|
1079
1607
|
// src/task/JavaScriptTask.ts
|
|
1080
|
-
import { CreateWorkflow as
|
|
1608
|
+
import { CreateWorkflow as CreateWorkflow16, Task as Task14, Workflow as Workflow17 } from "@workglow/task-graph";
|
|
1081
1609
|
|
|
1082
1610
|
// src/util/acorn.js
|
|
1083
1611
|
var options;
|
|
@@ -2826,7 +3354,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
|
|
|
2826
3354
|
}(strFunctions[i][0]);
|
|
2827
3355
|
this.setProperty(globalObject, strFunctions[i][1], this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
|
|
2828
3356
|
}
|
|
2829
|
-
wrapper = function
|
|
3357
|
+
wrapper = function setTimeout2(var_args) {
|
|
2830
3358
|
return thisInterpreter.createTask_(false, arguments);
|
|
2831
3359
|
};
|
|
2832
3360
|
this.setProperty(globalObject, "setTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
|
|
@@ -2834,7 +3362,7 @@ Interpreter.prototype.initGlobal = function(globalObject) {
|
|
|
2834
3362
|
return thisInterpreter.createTask_(true, arguments);
|
|
2835
3363
|
};
|
|
2836
3364
|
this.setProperty(globalObject, "setInterval", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
|
|
2837
|
-
wrapper = function
|
|
3365
|
+
wrapper = function clearTimeout2(pid) {
|
|
2838
3366
|
thisInterpreter.deleteTask_(pid);
|
|
2839
3367
|
};
|
|
2840
3368
|
this.setProperty(globalObject, "clearTimeout", this.createNativeFunction(wrapper, false), Interpreter.NONENUMERABLE_DESCRIPTOR);
|
|
@@ -2861,7 +3389,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
|
|
|
2861
3389
|
var thisInterpreter = this;
|
|
2862
3390
|
var wrapper;
|
|
2863
3391
|
var identifierRegexp = /^[A-Za-z_$][\w$]*$/;
|
|
2864
|
-
wrapper = function
|
|
3392
|
+
wrapper = function Function2(var_args) {
|
|
2865
3393
|
if (arguments.length) {
|
|
2866
3394
|
var code = String(arguments[arguments.length - 1]);
|
|
2867
3395
|
} else {
|
|
@@ -2939,7 +3467,7 @@ Interpreter.prototype.initFunction = function(globalObject) {
|
|
|
2939
3467
|
Interpreter.prototype.initObject = function(globalObject) {
|
|
2940
3468
|
var thisInterpreter = this;
|
|
2941
3469
|
var wrapper;
|
|
2942
|
-
wrapper = function
|
|
3470
|
+
wrapper = function Object2(value) {
|
|
2943
3471
|
if (value === undefined || value === null) {
|
|
2944
3472
|
if (thisInterpreter.calledWithNew()) {
|
|
2945
3473
|
return this;
|
|
@@ -3079,7 +3607,7 @@ Interpreter.prototype.initObject = function(globalObject) {
|
|
|
3079
3607
|
Interpreter.prototype.initArray = function(globalObject) {
|
|
3080
3608
|
var thisInterpreter = this;
|
|
3081
3609
|
var wrapper;
|
|
3082
|
-
wrapper = function
|
|
3610
|
+
wrapper = function Array2(var_args) {
|
|
3083
3611
|
if (thisInterpreter.calledWithNew()) {
|
|
3084
3612
|
var newArray = this;
|
|
3085
3613
|
} else {
|
|
@@ -3117,7 +3645,7 @@ Interpreter.prototype.initArray = function(globalObject) {
|
|
|
3117
3645
|
Interpreter.prototype.initString = function(globalObject) {
|
|
3118
3646
|
var thisInterpreter = this;
|
|
3119
3647
|
var wrapper;
|
|
3120
|
-
wrapper = function
|
|
3648
|
+
wrapper = function String2(value) {
|
|
3121
3649
|
value = arguments.length ? Interpreter.nativeGlobal.String(value) : "";
|
|
3122
3650
|
if (thisInterpreter.calledWithNew()) {
|
|
3123
3651
|
this.data = value;
|
|
@@ -3292,7 +3820,7 @@ Interpreter.prototype.initString = function(globalObject) {
|
|
|
3292
3820
|
Interpreter.prototype.initBoolean = function(globalObject) {
|
|
3293
3821
|
var thisInterpreter = this;
|
|
3294
3822
|
var wrapper;
|
|
3295
|
-
wrapper = function
|
|
3823
|
+
wrapper = function Boolean2(value) {
|
|
3296
3824
|
value = Interpreter.nativeGlobal.Boolean(value);
|
|
3297
3825
|
if (thisInterpreter.calledWithNew()) {
|
|
3298
3826
|
this.data = value;
|
|
@@ -3307,7 +3835,7 @@ Interpreter.prototype.initBoolean = function(globalObject) {
|
|
|
3307
3835
|
Interpreter.prototype.initNumber = function(globalObject) {
|
|
3308
3836
|
var thisInterpreter = this;
|
|
3309
3837
|
var wrapper;
|
|
3310
|
-
wrapper = function
|
|
3838
|
+
wrapper = function Number2(value) {
|
|
3311
3839
|
value = arguments.length ? Interpreter.nativeGlobal.Number(value) : 0;
|
|
3312
3840
|
if (thisInterpreter.calledWithNew()) {
|
|
3313
3841
|
this.data = value;
|
|
@@ -3368,7 +3896,7 @@ Interpreter.prototype.initNumber = function(globalObject) {
|
|
|
3368
3896
|
Interpreter.prototype.initDate = function(globalObject) {
|
|
3369
3897
|
var thisInterpreter = this;
|
|
3370
3898
|
var wrapper;
|
|
3371
|
-
wrapper = function
|
|
3899
|
+
wrapper = function Date2(_value, var_args) {
|
|
3372
3900
|
if (!thisInterpreter.calledWithNew()) {
|
|
3373
3901
|
return Interpreter.nativeGlobal.Date();
|
|
3374
3902
|
}
|
|
@@ -3448,7 +3976,7 @@ Interpreter.prototype.initDate = function(globalObject) {
|
|
|
3448
3976
|
Interpreter.prototype.initRegExp = function(globalObject) {
|
|
3449
3977
|
var thisInterpreter = this;
|
|
3450
3978
|
var wrapper;
|
|
3451
|
-
wrapper = function
|
|
3979
|
+
wrapper = function RegExp2(pattern, flags) {
|
|
3452
3980
|
if (thisInterpreter.calledWithNew()) {
|
|
3453
3981
|
var rgx = this;
|
|
3454
3982
|
} else {
|
|
@@ -3525,7 +4053,7 @@ Interpreter.prototype.initRegExp = function(globalObject) {
|
|
|
3525
4053
|
};
|
|
3526
4054
|
Interpreter.prototype.initError = function(globalObject) {
|
|
3527
4055
|
var thisInterpreter = this;
|
|
3528
|
-
this.ERROR = this.createNativeFunction(function
|
|
4056
|
+
this.ERROR = this.createNativeFunction(function Error2(opt_message) {
|
|
3529
4057
|
if (thisInterpreter.calledWithNew()) {
|
|
3530
4058
|
var newError = this;
|
|
3531
4059
|
} else {
|
|
@@ -3595,7 +4123,7 @@ Interpreter.prototype.initJSON = function(globalObject) {
|
|
|
3595
4123
|
var thisInterpreter = this;
|
|
3596
4124
|
var myJSON = thisInterpreter.createObjectProto(this.OBJECT_PROTO);
|
|
3597
4125
|
this.setProperty(globalObject, "JSON", myJSON, Interpreter.NONENUMERABLE_DESCRIPTOR);
|
|
3598
|
-
wrapper = function
|
|
4126
|
+
wrapper = function parse2(text) {
|
|
3599
4127
|
try {
|
|
3600
4128
|
var nativeObj = JSON.parse(String(text));
|
|
3601
4129
|
} catch (e) {
|
|
@@ -5540,7 +6068,7 @@ Interpreter["VALUE_IN_DESCRIPTOR"] = Interpreter.VALUE_IN_DESCRIPTOR;
|
|
|
5540
6068
|
Interpreter["Status"] = Interpreter.Status;
|
|
5541
6069
|
|
|
5542
6070
|
// src/task/JavaScriptTask.ts
|
|
5543
|
-
var
|
|
6071
|
+
var inputSchema14 = {
|
|
5544
6072
|
type: "object",
|
|
5545
6073
|
properties: {
|
|
5546
6074
|
javascript_code: {
|
|
@@ -5554,7 +6082,7 @@ var inputSchema5 = {
|
|
|
5554
6082
|
required: ["javascript_code"],
|
|
5555
6083
|
additionalProperties: true
|
|
5556
6084
|
};
|
|
5557
|
-
var
|
|
6085
|
+
var outputSchema14 = {
|
|
5558
6086
|
type: "object",
|
|
5559
6087
|
properties: {
|
|
5560
6088
|
output: {
|
|
@@ -5566,16 +6094,16 @@ var outputSchema5 = {
|
|
|
5566
6094
|
additionalProperties: false
|
|
5567
6095
|
};
|
|
5568
6096
|
|
|
5569
|
-
class JavaScriptTask extends
|
|
6097
|
+
class JavaScriptTask extends Task14 {
|
|
5570
6098
|
static type = "JavaScriptTask";
|
|
5571
6099
|
static category = "Utility";
|
|
5572
6100
|
static title = "JavaScript Interpreter";
|
|
5573
6101
|
static description = "Executes JavaScript code in a sandboxed interpreter environment";
|
|
5574
6102
|
static inputSchema() {
|
|
5575
|
-
return
|
|
6103
|
+
return inputSchema14;
|
|
5576
6104
|
}
|
|
5577
6105
|
static outputSchema() {
|
|
5578
|
-
return
|
|
6106
|
+
return outputSchema14;
|
|
5579
6107
|
}
|
|
5580
6108
|
async executeReactive(input2, output) {
|
|
5581
6109
|
if (input2.javascript_code) {
|
|
@@ -5586,10 +6114,7 @@ class JavaScriptTask extends Task5 {
|
|
|
5586
6114
|
const myInterpreter = new Interpreter(`${inputVariablesString} ${input2.javascript_code}`);
|
|
5587
6115
|
myInterpreter.run();
|
|
5588
6116
|
output.output = myInterpreter.value;
|
|
5589
|
-
|
|
5590
|
-
} catch (e) {
|
|
5591
|
-
console.error("error", e);
|
|
5592
|
-
}
|
|
6117
|
+
} catch (e) {}
|
|
5593
6118
|
}
|
|
5594
6119
|
return output;
|
|
5595
6120
|
}
|
|
@@ -5597,17 +6122,18 @@ class JavaScriptTask extends Task5 {
|
|
|
5597
6122
|
var javaScript = (input2, config = {}) => {
|
|
5598
6123
|
return new JavaScriptTask({}, config).run(input2);
|
|
5599
6124
|
};
|
|
5600
|
-
|
|
6125
|
+
Workflow17.prototype.javaScript = CreateWorkflow16(JavaScriptTask);
|
|
5601
6126
|
// src/task/JsonTask.ts
|
|
5602
6127
|
import {
|
|
5603
6128
|
createGraphFromDependencyJSON,
|
|
5604
|
-
|
|
6129
|
+
createGraphFromGraphJSON,
|
|
6130
|
+
CreateWorkflow as CreateWorkflow17,
|
|
5605
6131
|
Dataflow,
|
|
5606
6132
|
GraphAsTask as GraphAsTask2,
|
|
5607
6133
|
TaskConfigurationError as TaskConfigurationError2,
|
|
5608
|
-
Workflow as
|
|
6134
|
+
Workflow as Workflow18
|
|
5609
6135
|
} from "@workglow/task-graph";
|
|
5610
|
-
var
|
|
6136
|
+
var inputSchema15 = {
|
|
5611
6137
|
type: "object",
|
|
5612
6138
|
properties: {
|
|
5613
6139
|
json: {
|
|
@@ -5618,7 +6144,7 @@ var inputSchema6 = {
|
|
|
5618
6144
|
},
|
|
5619
6145
|
additionalProperties: false
|
|
5620
6146
|
};
|
|
5621
|
-
var
|
|
6147
|
+
var outputSchema15 = {
|
|
5622
6148
|
type: "object",
|
|
5623
6149
|
properties: {
|
|
5624
6150
|
output: {
|
|
@@ -5635,18 +6161,21 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5635
6161
|
static title = "JSON Task";
|
|
5636
6162
|
static description = "A task that creates and manages task graphs from JSON configurations";
|
|
5637
6163
|
static inputSchema() {
|
|
5638
|
-
return
|
|
6164
|
+
return inputSchema15;
|
|
5639
6165
|
}
|
|
5640
6166
|
static outputSchema() {
|
|
5641
|
-
return
|
|
6167
|
+
return outputSchema15;
|
|
5642
6168
|
}
|
|
5643
6169
|
regenerateGraph() {
|
|
5644
6170
|
if (!this.runInputData.json)
|
|
5645
6171
|
return;
|
|
5646
|
-
|
|
5647
|
-
if (
|
|
5648
|
-
|
|
5649
|
-
|
|
6172
|
+
const data = JSON.parse(this.runInputData.json);
|
|
6173
|
+
if (data && typeof data === "object" && "tasks" in data && Array.isArray(data.tasks) && "dataflows" in data && Array.isArray(data.dataflows)) {
|
|
6174
|
+
this.subGraph = createGraphFromGraphJSON(data);
|
|
6175
|
+
super.regenerateGraph();
|
|
6176
|
+
return;
|
|
6177
|
+
}
|
|
6178
|
+
let jsonItems = Array.isArray(data) ? data : [data];
|
|
5650
6179
|
this.subGraph = createGraphFromDependencyJSON(jsonItems);
|
|
5651
6180
|
for (const item of jsonItems) {
|
|
5652
6181
|
if (!item.dependencies)
|
|
@@ -5669,16 +6198,16 @@ class JsonTask extends GraphAsTask2 {
|
|
|
5669
6198
|
var json = (input2, config = {}) => {
|
|
5670
6199
|
return new JsonTask({}, config).run(input2);
|
|
5671
6200
|
};
|
|
5672
|
-
|
|
6201
|
+
Workflow18.prototype.json = CreateWorkflow17(JsonTask);
|
|
5673
6202
|
// src/task/LambdaTask.ts
|
|
5674
6203
|
import {
|
|
5675
|
-
CreateWorkflow as
|
|
6204
|
+
CreateWorkflow as CreateWorkflow18,
|
|
5676
6205
|
DATAFLOW_ALL_PORTS,
|
|
5677
|
-
Task as
|
|
6206
|
+
Task as Task15,
|
|
5678
6207
|
TaskConfigurationError as TaskConfigurationError3,
|
|
5679
|
-
Workflow as
|
|
6208
|
+
Workflow as Workflow19
|
|
5680
6209
|
} from "@workglow/task-graph";
|
|
5681
|
-
var
|
|
6210
|
+
var inputSchema16 = {
|
|
5682
6211
|
type: "object",
|
|
5683
6212
|
properties: {
|
|
5684
6213
|
[DATAFLOW_ALL_PORTS]: {
|
|
@@ -5688,7 +6217,7 @@ var inputSchema7 = {
|
|
|
5688
6217
|
},
|
|
5689
6218
|
additionalProperties: true
|
|
5690
6219
|
};
|
|
5691
|
-
var
|
|
6220
|
+
var outputSchema16 = {
|
|
5692
6221
|
type: "object",
|
|
5693
6222
|
properties: {
|
|
5694
6223
|
[DATAFLOW_ALL_PORTS]: {
|
|
@@ -5699,17 +6228,17 @@ var outputSchema7 = {
|
|
|
5699
6228
|
additionalProperties: true
|
|
5700
6229
|
};
|
|
5701
6230
|
|
|
5702
|
-
class LambdaTask extends
|
|
6231
|
+
class LambdaTask extends Task15 {
|
|
5703
6232
|
static type = "LambdaTask";
|
|
5704
6233
|
static title = "Lambda Task";
|
|
5705
6234
|
static description = "A task that wraps a provided function and its input";
|
|
5706
6235
|
static category = "Hidden";
|
|
5707
6236
|
static cacheable = true;
|
|
5708
6237
|
static inputSchema() {
|
|
5709
|
-
return
|
|
6238
|
+
return inputSchema16;
|
|
5710
6239
|
}
|
|
5711
6240
|
static outputSchema() {
|
|
5712
|
-
return
|
|
6241
|
+
return outputSchema16;
|
|
5713
6242
|
}
|
|
5714
6243
|
constructor(input2 = {}, config = {}) {
|
|
5715
6244
|
if (!config.execute && !config.executeReactive) {
|
|
@@ -5747,15 +6276,15 @@ function lambda(input2, config) {
|
|
|
5747
6276
|
const task = new LambdaTask(input2, config);
|
|
5748
6277
|
return task.run();
|
|
5749
6278
|
}
|
|
5750
|
-
|
|
6279
|
+
Workflow19.prototype.lambda = CreateWorkflow18(LambdaTask);
|
|
5751
6280
|
// src/task/MergeTask.ts
|
|
5752
|
-
import { CreateWorkflow as
|
|
5753
|
-
var
|
|
6281
|
+
import { CreateWorkflow as CreateWorkflow19, Task as Task16, Workflow as Workflow20 } from "@workglow/task-graph";
|
|
6282
|
+
var inputSchema17 = {
|
|
5754
6283
|
type: "object",
|
|
5755
6284
|
properties: {},
|
|
5756
6285
|
additionalProperties: true
|
|
5757
6286
|
};
|
|
5758
|
-
var
|
|
6287
|
+
var outputSchema17 = {
|
|
5759
6288
|
type: "object",
|
|
5760
6289
|
properties: {
|
|
5761
6290
|
output: {
|
|
@@ -5767,19 +6296,19 @@ var outputSchema8 = {
|
|
|
5767
6296
|
additionalProperties: false
|
|
5768
6297
|
};
|
|
5769
6298
|
|
|
5770
|
-
class MergeTask extends
|
|
6299
|
+
class MergeTask extends Task16 {
|
|
5771
6300
|
static type = "MergeTask";
|
|
5772
6301
|
static category = "Utility";
|
|
5773
6302
|
static title = "Merge";
|
|
5774
6303
|
static description = "Merges multiple inputs into a single array output";
|
|
5775
6304
|
static cacheable = true;
|
|
5776
6305
|
static inputSchema() {
|
|
5777
|
-
return
|
|
6306
|
+
return inputSchema17;
|
|
5778
6307
|
}
|
|
5779
6308
|
static outputSchema() {
|
|
5780
|
-
return
|
|
6309
|
+
return outputSchema17;
|
|
5781
6310
|
}
|
|
5782
|
-
async execute(input2,
|
|
6311
|
+
async execute(input2, _context) {
|
|
5783
6312
|
const keys = Object.keys(input2).sort();
|
|
5784
6313
|
const values = keys.map((key) => input2[key]);
|
|
5785
6314
|
return {
|
|
@@ -5791,11 +6320,11 @@ var merge = (input2, config = {}) => {
|
|
|
5791
6320
|
const task = new MergeTask({}, config);
|
|
5792
6321
|
return task.run(input2);
|
|
5793
6322
|
};
|
|
5794
|
-
|
|
6323
|
+
Workflow20.prototype.merge = CreateWorkflow19(MergeTask);
|
|
5795
6324
|
// src/task/OutputTask.ts
|
|
5796
|
-
import { CreateWorkflow as
|
|
6325
|
+
import { CreateWorkflow as CreateWorkflow20, Task as Task17, Workflow as Workflow21 } from "@workglow/task-graph";
|
|
5797
6326
|
|
|
5798
|
-
class OutputTask extends
|
|
6327
|
+
class OutputTask extends Task17 {
|
|
5799
6328
|
static type = "OutputTask";
|
|
5800
6329
|
static category = "Flow Control";
|
|
5801
6330
|
static title = "Output";
|
|
@@ -5829,10 +6358,10 @@ class OutputTask extends Task8 {
|
|
|
5829
6358
|
return input2;
|
|
5830
6359
|
}
|
|
5831
6360
|
}
|
|
5832
|
-
|
|
6361
|
+
Workflow21.prototype.output = CreateWorkflow20(OutputTask);
|
|
5833
6362
|
// src/task/SplitTask.ts
|
|
5834
|
-
import { CreateWorkflow as
|
|
5835
|
-
var
|
|
6363
|
+
import { CreateWorkflow as CreateWorkflow21, Task as Task18, Workflow as Workflow22 } from "@workglow/task-graph";
|
|
6364
|
+
var inputSchema18 = {
|
|
5836
6365
|
type: "object",
|
|
5837
6366
|
properties: {
|
|
5838
6367
|
input: {
|
|
@@ -5842,13 +6371,13 @@ var inputSchema9 = {
|
|
|
5842
6371
|
},
|
|
5843
6372
|
additionalProperties: false
|
|
5844
6373
|
};
|
|
5845
|
-
var
|
|
6374
|
+
var outputSchema18 = {
|
|
5846
6375
|
type: "object",
|
|
5847
6376
|
properties: {},
|
|
5848
6377
|
additionalProperties: true
|
|
5849
6378
|
};
|
|
5850
6379
|
|
|
5851
|
-
class SplitTask extends
|
|
6380
|
+
class SplitTask extends Task18 {
|
|
5852
6381
|
static type = "SplitTask";
|
|
5853
6382
|
static category = "Utility";
|
|
5854
6383
|
static title = "Split";
|
|
@@ -5856,13 +6385,13 @@ class SplitTask extends Task9 {
|
|
|
5856
6385
|
static hasDynamicSchemas = true;
|
|
5857
6386
|
static cacheable = false;
|
|
5858
6387
|
static inputSchema() {
|
|
5859
|
-
return
|
|
6388
|
+
return inputSchema18;
|
|
5860
6389
|
}
|
|
5861
6390
|
static outputSchema() {
|
|
5862
|
-
return
|
|
6391
|
+
return outputSchema18;
|
|
5863
6392
|
}
|
|
5864
6393
|
outputSchema() {
|
|
5865
|
-
return
|
|
6394
|
+
return outputSchema18;
|
|
5866
6395
|
}
|
|
5867
6396
|
async executeReactive(input2) {
|
|
5868
6397
|
const inputValue = input2.input;
|
|
@@ -5881,13 +6410,533 @@ var split = (input2, config = {}) => {
|
|
|
5881
6410
|
const task = new SplitTask({}, config);
|
|
5882
6411
|
return task.run(input2);
|
|
5883
6412
|
};
|
|
5884
|
-
|
|
6413
|
+
Workflow22.prototype.split = CreateWorkflow21(SplitTask);
|
|
6414
|
+
// src/task/scalar/ScalarAbsTask.ts
|
|
6415
|
+
import { CreateWorkflow as CreateWorkflow22, Task as Task19, Workflow as Workflow23 } from "@workglow/task-graph";
|
|
6416
|
+
var inputSchema19 = {
|
|
6417
|
+
type: "object",
|
|
6418
|
+
properties: {
|
|
6419
|
+
value: {
|
|
6420
|
+
type: "number",
|
|
6421
|
+
title: "Value",
|
|
6422
|
+
description: "Input number"
|
|
6423
|
+
}
|
|
6424
|
+
},
|
|
6425
|
+
required: ["value"],
|
|
6426
|
+
additionalProperties: false
|
|
6427
|
+
};
|
|
6428
|
+
var outputSchema19 = {
|
|
6429
|
+
type: "object",
|
|
6430
|
+
properties: {
|
|
6431
|
+
result: {
|
|
6432
|
+
type: "number",
|
|
6433
|
+
title: "Result",
|
|
6434
|
+
description: "Absolute value"
|
|
6435
|
+
}
|
|
6436
|
+
},
|
|
6437
|
+
required: ["result"],
|
|
6438
|
+
additionalProperties: false
|
|
6439
|
+
};
|
|
6440
|
+
|
|
6441
|
+
class ScalarAbsTask extends Task19 {
|
|
6442
|
+
static type = "ScalarAbsTask";
|
|
6443
|
+
static category = "Math";
|
|
6444
|
+
static title = "Abs";
|
|
6445
|
+
static description = "Returns the absolute value of a number";
|
|
6446
|
+
static inputSchema() {
|
|
6447
|
+
return inputSchema19;
|
|
6448
|
+
}
|
|
6449
|
+
static outputSchema() {
|
|
6450
|
+
return outputSchema19;
|
|
6451
|
+
}
|
|
6452
|
+
async execute(input2, _context) {
|
|
6453
|
+
return { result: Math.abs(input2.value) };
|
|
6454
|
+
}
|
|
6455
|
+
}
|
|
6456
|
+
Workflow23.prototype.scalarAbs = CreateWorkflow22(ScalarAbsTask);
|
|
6457
|
+
// src/task/scalar/ScalarCeilTask.ts
|
|
6458
|
+
import { CreateWorkflow as CreateWorkflow23, Task as Task20, Workflow as Workflow24 } from "@workglow/task-graph";
|
|
6459
|
+
var inputSchema20 = {
|
|
6460
|
+
type: "object",
|
|
6461
|
+
properties: {
|
|
6462
|
+
value: {
|
|
6463
|
+
type: "number",
|
|
6464
|
+
title: "Value",
|
|
6465
|
+
description: "Input number"
|
|
6466
|
+
}
|
|
6467
|
+
},
|
|
6468
|
+
required: ["value"],
|
|
6469
|
+
additionalProperties: false
|
|
6470
|
+
};
|
|
6471
|
+
var outputSchema20 = {
|
|
6472
|
+
type: "object",
|
|
6473
|
+
properties: {
|
|
6474
|
+
result: {
|
|
6475
|
+
type: "number",
|
|
6476
|
+
title: "Result",
|
|
6477
|
+
description: "Ceiling value"
|
|
6478
|
+
}
|
|
6479
|
+
},
|
|
6480
|
+
required: ["result"],
|
|
6481
|
+
additionalProperties: false
|
|
6482
|
+
};
|
|
6483
|
+
|
|
6484
|
+
class ScalarCeilTask extends Task20 {
|
|
6485
|
+
static type = "ScalarCeilTask";
|
|
6486
|
+
static category = "Math";
|
|
6487
|
+
static title = "Ceil";
|
|
6488
|
+
static description = "Returns the smallest integer greater than or equal to a number";
|
|
6489
|
+
static inputSchema() {
|
|
6490
|
+
return inputSchema20;
|
|
6491
|
+
}
|
|
6492
|
+
static outputSchema() {
|
|
6493
|
+
return outputSchema20;
|
|
6494
|
+
}
|
|
6495
|
+
async execute(input2, _context) {
|
|
6496
|
+
return { result: Math.ceil(input2.value) };
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
Workflow24.prototype.scalarCeil = CreateWorkflow23(ScalarCeilTask);
|
|
6500
|
+
// src/task/scalar/ScalarFloorTask.ts
|
|
6501
|
+
import { CreateWorkflow as CreateWorkflow24, Task as Task21, Workflow as Workflow25 } from "@workglow/task-graph";
|
|
6502
|
+
var inputSchema21 = {
|
|
6503
|
+
type: "object",
|
|
6504
|
+
properties: {
|
|
6505
|
+
value: {
|
|
6506
|
+
type: "number",
|
|
6507
|
+
title: "Value",
|
|
6508
|
+
description: "Input number"
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
required: ["value"],
|
|
6512
|
+
additionalProperties: false
|
|
6513
|
+
};
|
|
6514
|
+
var outputSchema21 = {
|
|
6515
|
+
type: "object",
|
|
6516
|
+
properties: {
|
|
6517
|
+
result: {
|
|
6518
|
+
type: "number",
|
|
6519
|
+
title: "Result",
|
|
6520
|
+
description: "Floored value"
|
|
6521
|
+
}
|
|
6522
|
+
},
|
|
6523
|
+
required: ["result"],
|
|
6524
|
+
additionalProperties: false
|
|
6525
|
+
};
|
|
6526
|
+
|
|
6527
|
+
class ScalarFloorTask extends Task21 {
|
|
6528
|
+
static type = "ScalarFloorTask";
|
|
6529
|
+
static category = "Math";
|
|
6530
|
+
static title = "Floor";
|
|
6531
|
+
static description = "Returns the largest integer less than or equal to a number";
|
|
6532
|
+
static inputSchema() {
|
|
6533
|
+
return inputSchema21;
|
|
6534
|
+
}
|
|
6535
|
+
static outputSchema() {
|
|
6536
|
+
return outputSchema21;
|
|
6537
|
+
}
|
|
6538
|
+
async execute(input2, _context) {
|
|
6539
|
+
return { result: Math.floor(input2.value) };
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
Workflow25.prototype.scalarFloor = CreateWorkflow24(ScalarFloorTask);
|
|
6543
|
+
// src/task/scalar/ScalarMaxTask.ts
|
|
6544
|
+
import { CreateWorkflow as CreateWorkflow25, Task as Task22, Workflow as Workflow26 } from "@workglow/task-graph";
|
|
6545
|
+
var inputSchema22 = {
|
|
6546
|
+
type: "object",
|
|
6547
|
+
properties: {
|
|
6548
|
+
values: {
|
|
6549
|
+
type: "array",
|
|
6550
|
+
items: { type: "number" },
|
|
6551
|
+
title: "Values",
|
|
6552
|
+
description: "Array of numbers"
|
|
6553
|
+
}
|
|
6554
|
+
},
|
|
6555
|
+
required: ["values"],
|
|
6556
|
+
additionalProperties: false
|
|
6557
|
+
};
|
|
6558
|
+
var outputSchema22 = {
|
|
6559
|
+
type: "object",
|
|
6560
|
+
properties: {
|
|
6561
|
+
result: {
|
|
6562
|
+
type: "number",
|
|
6563
|
+
title: "Result",
|
|
6564
|
+
description: "Maximum value"
|
|
6565
|
+
}
|
|
6566
|
+
},
|
|
6567
|
+
required: ["result"],
|
|
6568
|
+
additionalProperties: false
|
|
6569
|
+
};
|
|
6570
|
+
|
|
6571
|
+
class ScalarMaxTask extends Task22 {
|
|
6572
|
+
static type = "ScalarMaxTask";
|
|
6573
|
+
static category = "Math";
|
|
6574
|
+
static title = "Max";
|
|
6575
|
+
static description = "Returns the largest of the given numbers";
|
|
6576
|
+
static inputSchema() {
|
|
6577
|
+
return inputSchema22;
|
|
6578
|
+
}
|
|
6579
|
+
static outputSchema() {
|
|
6580
|
+
return outputSchema22;
|
|
6581
|
+
}
|
|
6582
|
+
async execute(input2, _context) {
|
|
6583
|
+
return { result: Math.max(...input2.values) };
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
Workflow26.prototype.scalarMax = CreateWorkflow25(ScalarMaxTask);
|
|
6587
|
+
// src/task/scalar/ScalarMinTask.ts
|
|
6588
|
+
import { CreateWorkflow as CreateWorkflow26, Task as Task23, Workflow as Workflow27 } from "@workglow/task-graph";
|
|
6589
|
+
var inputSchema23 = {
|
|
6590
|
+
type: "object",
|
|
6591
|
+
properties: {
|
|
6592
|
+
values: {
|
|
6593
|
+
type: "array",
|
|
6594
|
+
items: { type: "number" },
|
|
6595
|
+
title: "Values",
|
|
6596
|
+
description: "Array of numbers"
|
|
6597
|
+
}
|
|
6598
|
+
},
|
|
6599
|
+
required: ["values"],
|
|
6600
|
+
additionalProperties: false
|
|
6601
|
+
};
|
|
6602
|
+
var outputSchema23 = {
|
|
6603
|
+
type: "object",
|
|
6604
|
+
properties: {
|
|
6605
|
+
result: {
|
|
6606
|
+
type: "number",
|
|
6607
|
+
title: "Result",
|
|
6608
|
+
description: "Minimum value"
|
|
6609
|
+
}
|
|
6610
|
+
},
|
|
6611
|
+
required: ["result"],
|
|
6612
|
+
additionalProperties: false
|
|
6613
|
+
};
|
|
6614
|
+
|
|
6615
|
+
class ScalarMinTask extends Task23 {
|
|
6616
|
+
static type = "ScalarMinTask";
|
|
6617
|
+
static category = "Math";
|
|
6618
|
+
static title = "Min";
|
|
6619
|
+
static description = "Returns the smallest of the given numbers";
|
|
6620
|
+
static inputSchema() {
|
|
6621
|
+
return inputSchema23;
|
|
6622
|
+
}
|
|
6623
|
+
static outputSchema() {
|
|
6624
|
+
return outputSchema23;
|
|
6625
|
+
}
|
|
6626
|
+
async execute(input2, _context) {
|
|
6627
|
+
return { result: Math.min(...input2.values) };
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
Workflow27.prototype.scalarMin = CreateWorkflow26(ScalarMinTask);
|
|
6631
|
+
// src/task/scalar/ScalarRoundTask.ts
|
|
6632
|
+
import { CreateWorkflow as CreateWorkflow27, Task as Task24, Workflow as Workflow28 } from "@workglow/task-graph";
|
|
6633
|
+
var inputSchema24 = {
|
|
6634
|
+
type: "object",
|
|
6635
|
+
properties: {
|
|
6636
|
+
value: {
|
|
6637
|
+
type: "number",
|
|
6638
|
+
title: "Value",
|
|
6639
|
+
description: "Input number"
|
|
6640
|
+
}
|
|
6641
|
+
},
|
|
6642
|
+
required: ["value"],
|
|
6643
|
+
additionalProperties: false
|
|
6644
|
+
};
|
|
6645
|
+
var outputSchema24 = {
|
|
6646
|
+
type: "object",
|
|
6647
|
+
properties: {
|
|
6648
|
+
result: {
|
|
6649
|
+
type: "number",
|
|
6650
|
+
title: "Result",
|
|
6651
|
+
description: "Rounded value"
|
|
6652
|
+
}
|
|
6653
|
+
},
|
|
6654
|
+
required: ["result"],
|
|
6655
|
+
additionalProperties: false
|
|
6656
|
+
};
|
|
6657
|
+
|
|
6658
|
+
class ScalarRoundTask extends Task24 {
|
|
6659
|
+
static type = "ScalarRoundTask";
|
|
6660
|
+
static category = "Math";
|
|
6661
|
+
static title = "Round";
|
|
6662
|
+
static description = "Returns the value of a number rounded to the nearest integer";
|
|
6663
|
+
static inputSchema() {
|
|
6664
|
+
return inputSchema24;
|
|
6665
|
+
}
|
|
6666
|
+
static outputSchema() {
|
|
6667
|
+
return outputSchema24;
|
|
6668
|
+
}
|
|
6669
|
+
async execute(input2, _context) {
|
|
6670
|
+
return { result: Math.round(input2.value) };
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
Workflow28.prototype.scalarRound = CreateWorkflow27(ScalarRoundTask);
|
|
6674
|
+
// src/task/scalar/ScalarTruncTask.ts
|
|
6675
|
+
import { CreateWorkflow as CreateWorkflow28, Task as Task25, Workflow as Workflow29 } from "@workglow/task-graph";
|
|
6676
|
+
var inputSchema25 = {
|
|
6677
|
+
type: "object",
|
|
6678
|
+
properties: {
|
|
6679
|
+
value: {
|
|
6680
|
+
type: "number",
|
|
6681
|
+
title: "Value",
|
|
6682
|
+
description: "Input number"
|
|
6683
|
+
}
|
|
6684
|
+
},
|
|
6685
|
+
required: ["value"],
|
|
6686
|
+
additionalProperties: false
|
|
6687
|
+
};
|
|
6688
|
+
var outputSchema25 = {
|
|
6689
|
+
type: "object",
|
|
6690
|
+
properties: {
|
|
6691
|
+
result: {
|
|
6692
|
+
type: "number",
|
|
6693
|
+
title: "Result",
|
|
6694
|
+
description: "Truncated value"
|
|
6695
|
+
}
|
|
6696
|
+
},
|
|
6697
|
+
required: ["result"],
|
|
6698
|
+
additionalProperties: false
|
|
6699
|
+
};
|
|
6700
|
+
|
|
6701
|
+
class ScalarTruncTask extends Task25 {
|
|
6702
|
+
static type = "ScalarTruncTask";
|
|
6703
|
+
static category = "Math";
|
|
6704
|
+
static title = "Truncate";
|
|
6705
|
+
static description = "Returns the integer part of a number by removing fractional digits";
|
|
6706
|
+
static inputSchema() {
|
|
6707
|
+
return inputSchema25;
|
|
6708
|
+
}
|
|
6709
|
+
static outputSchema() {
|
|
6710
|
+
return outputSchema25;
|
|
6711
|
+
}
|
|
6712
|
+
async execute(input2, _context) {
|
|
6713
|
+
return { result: Math.trunc(input2.value) };
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
Workflow29.prototype.scalarTrunc = CreateWorkflow28(ScalarTruncTask);
|
|
6717
|
+
// src/task/vector/VectorDistanceTask.ts
|
|
6718
|
+
import { CreateWorkflow as CreateWorkflow29, Task as Task26, Workflow as Workflow30 } from "@workglow/task-graph";
|
|
6719
|
+
import {
|
|
6720
|
+
TypedArraySchema as TypedArraySchema5
|
|
6721
|
+
} from "@workglow/util";
|
|
6722
|
+
var inputSchema26 = {
|
|
6723
|
+
type: "object",
|
|
6724
|
+
properties: {
|
|
6725
|
+
vectors: {
|
|
6726
|
+
type: "array",
|
|
6727
|
+
items: TypedArraySchema5({
|
|
6728
|
+
title: "Vector",
|
|
6729
|
+
description: "Vector for distance computation"
|
|
6730
|
+
}),
|
|
6731
|
+
title: "Vectors",
|
|
6732
|
+
description: "Array of two vectors to compute Euclidean distance"
|
|
6733
|
+
}
|
|
6734
|
+
},
|
|
6735
|
+
required: ["vectors"],
|
|
6736
|
+
additionalProperties: false
|
|
6737
|
+
};
|
|
6738
|
+
var outputSchema26 = {
|
|
6739
|
+
type: "object",
|
|
6740
|
+
properties: {
|
|
6741
|
+
result: {
|
|
6742
|
+
type: "number",
|
|
6743
|
+
title: "Result",
|
|
6744
|
+
description: "Euclidean distance between vectors"
|
|
6745
|
+
}
|
|
6746
|
+
},
|
|
6747
|
+
required: ["result"],
|
|
6748
|
+
additionalProperties: false
|
|
6749
|
+
};
|
|
6750
|
+
|
|
6751
|
+
class VectorDistanceTask extends Task26 {
|
|
6752
|
+
static type = "VectorDistanceTask";
|
|
6753
|
+
static category = "Vector";
|
|
6754
|
+
static title = "Distance";
|
|
6755
|
+
static description = "Returns the Euclidean distance between the first two vectors";
|
|
6756
|
+
static inputSchema() {
|
|
6757
|
+
return inputSchema26;
|
|
6758
|
+
}
|
|
6759
|
+
static outputSchema() {
|
|
6760
|
+
return outputSchema26;
|
|
6761
|
+
}
|
|
6762
|
+
async execute(input2, _context) {
|
|
6763
|
+
const { vectors } = input2;
|
|
6764
|
+
if (vectors.length < 2) {
|
|
6765
|
+
throw new Error("Exactly two vectors are required for distance");
|
|
6766
|
+
}
|
|
6767
|
+
const [a, b] = vectors;
|
|
6768
|
+
if (a.length !== b.length) {
|
|
6769
|
+
throw new Error("Vectors must have the same length");
|
|
6770
|
+
}
|
|
6771
|
+
const diffs = Array.from({ length: a.length }, (_, i) => {
|
|
6772
|
+
const d = Number(a[i]) - Number(b[i]);
|
|
6773
|
+
return d * d;
|
|
6774
|
+
});
|
|
6775
|
+
return { result: Math.sqrt(sumPrecise(diffs)) };
|
|
6776
|
+
}
|
|
6777
|
+
}
|
|
6778
|
+
Workflow30.prototype.vectorDistance = CreateWorkflow29(VectorDistanceTask);
|
|
6779
|
+
// src/task/vector/VectorDotProductTask.ts
|
|
6780
|
+
import { CreateWorkflow as CreateWorkflow30, Task as Task27, Workflow as Workflow31 } from "@workglow/task-graph";
|
|
6781
|
+
import {
|
|
6782
|
+
TypedArraySchema as TypedArraySchema6
|
|
6783
|
+
} from "@workglow/util";
|
|
6784
|
+
var inputSchema27 = {
|
|
6785
|
+
type: "object",
|
|
6786
|
+
properties: {
|
|
6787
|
+
vectors: {
|
|
6788
|
+
type: "array",
|
|
6789
|
+
items: TypedArraySchema6({
|
|
6790
|
+
title: "Vector",
|
|
6791
|
+
description: "Vector for dot product"
|
|
6792
|
+
}),
|
|
6793
|
+
title: "Vectors",
|
|
6794
|
+
description: "Array of two vectors to compute dot product"
|
|
6795
|
+
}
|
|
6796
|
+
},
|
|
6797
|
+
required: ["vectors"],
|
|
6798
|
+
additionalProperties: false
|
|
6799
|
+
};
|
|
6800
|
+
var outputSchema27 = {
|
|
6801
|
+
type: "object",
|
|
6802
|
+
properties: {
|
|
6803
|
+
result: {
|
|
6804
|
+
type: "number",
|
|
6805
|
+
title: "Result",
|
|
6806
|
+
description: "Dot product of the vectors"
|
|
6807
|
+
}
|
|
6808
|
+
},
|
|
6809
|
+
required: ["result"],
|
|
6810
|
+
additionalProperties: false
|
|
6811
|
+
};
|
|
6812
|
+
|
|
6813
|
+
class VectorDotProductTask extends Task27 {
|
|
6814
|
+
static type = "VectorDotProductTask";
|
|
6815
|
+
static category = "Vector";
|
|
6816
|
+
static title = "Dot Product";
|
|
6817
|
+
static description = "Returns the dot (inner) product of the first two vectors";
|
|
6818
|
+
static inputSchema() {
|
|
6819
|
+
return inputSchema27;
|
|
6820
|
+
}
|
|
6821
|
+
static outputSchema() {
|
|
6822
|
+
return outputSchema27;
|
|
6823
|
+
}
|
|
6824
|
+
async execute(input2, _context) {
|
|
6825
|
+
const { vectors } = input2;
|
|
6826
|
+
if (vectors.length < 2) {
|
|
6827
|
+
throw new Error("Exactly two vectors are required for dot product");
|
|
6828
|
+
}
|
|
6829
|
+
const [a, b] = vectors;
|
|
6830
|
+
if (a.length !== b.length) {
|
|
6831
|
+
throw new Error("Vectors must have the same length");
|
|
6832
|
+
}
|
|
6833
|
+
const products = Array.from({ length: a.length }, (_, i) => Number(a[i]) * Number(b[i]));
|
|
6834
|
+
return { result: sumPrecise(products) };
|
|
6835
|
+
}
|
|
6836
|
+
}
|
|
6837
|
+
Workflow31.prototype.vectorDotProduct = CreateWorkflow30(VectorDotProductTask);
|
|
6838
|
+
// src/task/vector/VectorNormalizeTask.ts
|
|
6839
|
+
import { CreateWorkflow as CreateWorkflow31, Task as Task28, Workflow as Workflow32 } from "@workglow/task-graph";
|
|
6840
|
+
import {
|
|
6841
|
+
TypedArraySchema as TypedArraySchema7,
|
|
6842
|
+
normalize
|
|
6843
|
+
} from "@workglow/util";
|
|
6844
|
+
var inputSchema28 = {
|
|
6845
|
+
type: "object",
|
|
6846
|
+
properties: {
|
|
6847
|
+
vector: TypedArraySchema7({
|
|
6848
|
+
title: "Vector",
|
|
6849
|
+
description: "Input vector to normalize"
|
|
6850
|
+
})
|
|
6851
|
+
},
|
|
6852
|
+
required: ["vector"],
|
|
6853
|
+
additionalProperties: false
|
|
6854
|
+
};
|
|
6855
|
+
var outputSchema28 = {
|
|
6856
|
+
type: "object",
|
|
6857
|
+
properties: {
|
|
6858
|
+
result: TypedArraySchema7({
|
|
6859
|
+
title: "Result",
|
|
6860
|
+
description: "L2-normalized vector"
|
|
6861
|
+
})
|
|
6862
|
+
},
|
|
6863
|
+
required: ["result"],
|
|
6864
|
+
additionalProperties: false
|
|
6865
|
+
};
|
|
6866
|
+
|
|
6867
|
+
class VectorNormalizeTask extends Task28 {
|
|
6868
|
+
static type = "VectorNormalizeTask";
|
|
6869
|
+
static category = "Vector";
|
|
6870
|
+
static title = "Normalize";
|
|
6871
|
+
static description = "Returns the L2-normalized (unit length) vector";
|
|
6872
|
+
static inputSchema() {
|
|
6873
|
+
return inputSchema28;
|
|
6874
|
+
}
|
|
6875
|
+
static outputSchema() {
|
|
6876
|
+
return outputSchema28;
|
|
6877
|
+
}
|
|
6878
|
+
async execute(input2, _context) {
|
|
6879
|
+
return { result: normalize(input2.vector) };
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
Workflow32.prototype.vectorNormalize = CreateWorkflow31(VectorNormalizeTask);
|
|
6883
|
+
// src/task/vector/VectorScaleTask.ts
|
|
6884
|
+
import { CreateWorkflow as CreateWorkflow32, Task as Task29, Workflow as Workflow33 } from "@workglow/task-graph";
|
|
6885
|
+
import {
|
|
6886
|
+
createTypedArrayFrom as createTypedArrayFrom5,
|
|
6887
|
+
TypedArraySchema as TypedArraySchema8
|
|
6888
|
+
} from "@workglow/util";
|
|
6889
|
+
var inputSchema29 = {
|
|
6890
|
+
type: "object",
|
|
6891
|
+
properties: {
|
|
6892
|
+
vector: TypedArraySchema8({
|
|
6893
|
+
title: "Vector",
|
|
6894
|
+
description: "Input vector"
|
|
6895
|
+
}),
|
|
6896
|
+
scalar: {
|
|
6897
|
+
type: "number",
|
|
6898
|
+
title: "Scalar",
|
|
6899
|
+
description: "Scalar multiplier"
|
|
6900
|
+
}
|
|
6901
|
+
},
|
|
6902
|
+
required: ["vector", "scalar"],
|
|
6903
|
+
additionalProperties: false
|
|
6904
|
+
};
|
|
6905
|
+
var outputSchema29 = {
|
|
6906
|
+
type: "object",
|
|
6907
|
+
properties: {
|
|
6908
|
+
result: TypedArraySchema8({
|
|
6909
|
+
title: "Result",
|
|
6910
|
+
description: "Scaled vector"
|
|
6911
|
+
})
|
|
6912
|
+
},
|
|
6913
|
+
required: ["result"],
|
|
6914
|
+
additionalProperties: false
|
|
6915
|
+
};
|
|
6916
|
+
|
|
6917
|
+
class VectorScaleTask extends Task29 {
|
|
6918
|
+
static type = "VectorScaleTask";
|
|
6919
|
+
static category = "Vector";
|
|
6920
|
+
static title = "Scale";
|
|
6921
|
+
static description = "Multiplies each element of a vector by a scalar";
|
|
6922
|
+
static inputSchema() {
|
|
6923
|
+
return inputSchema29;
|
|
6924
|
+
}
|
|
6925
|
+
static outputSchema() {
|
|
6926
|
+
return outputSchema29;
|
|
6927
|
+
}
|
|
6928
|
+
async execute(input2, _context) {
|
|
6929
|
+
const { vector, scalar } = input2;
|
|
6930
|
+
const values = Array.from(vector, (v) => Number(v) * scalar);
|
|
6931
|
+
return { result: createTypedArrayFrom5([vector], values) };
|
|
6932
|
+
}
|
|
6933
|
+
}
|
|
6934
|
+
Workflow33.prototype.vectorScale = CreateWorkflow32(VectorScaleTask);
|
|
5885
6935
|
|
|
5886
6936
|
// src/common.ts
|
|
5887
6937
|
import { TaskRegistry } from "@workglow/task-graph";
|
|
5888
6938
|
var registerCommonTasks = () => {
|
|
5889
6939
|
const tasks = [
|
|
5890
|
-
ArrayTask,
|
|
5891
6940
|
DebugLogTask,
|
|
5892
6941
|
DelayTask,
|
|
5893
6942
|
FetchUrlTask,
|
|
@@ -5897,7 +6946,27 @@ var registerCommonTasks = () => {
|
|
|
5897
6946
|
LambdaTask,
|
|
5898
6947
|
MergeTask,
|
|
5899
6948
|
OutputTask,
|
|
5900
|
-
SplitTask
|
|
6949
|
+
SplitTask,
|
|
6950
|
+
ScalarAbsTask,
|
|
6951
|
+
ScalarAddTask,
|
|
6952
|
+
ScalarCeilTask,
|
|
6953
|
+
ScalarDivideTask,
|
|
6954
|
+
ScalarFloorTask,
|
|
6955
|
+
ScalarMaxTask,
|
|
6956
|
+
ScalarMinTask,
|
|
6957
|
+
ScalarMultiplyTask,
|
|
6958
|
+
ScalarRoundTask,
|
|
6959
|
+
ScalarSubtractTask,
|
|
6960
|
+
ScalarSumTask,
|
|
6961
|
+
ScalarTruncTask,
|
|
6962
|
+
VectorSumTask,
|
|
6963
|
+
VectorDistanceTask,
|
|
6964
|
+
VectorDivideTask,
|
|
6965
|
+
VectorDotProductTask,
|
|
6966
|
+
VectorMultiplyTask,
|
|
6967
|
+
VectorNormalizeTask,
|
|
6968
|
+
VectorScaleTask,
|
|
6969
|
+
VectorSubtractTask
|
|
5901
6970
|
];
|
|
5902
6971
|
tasks.map(TaskRegistry.registerTask);
|
|
5903
6972
|
return tasks;
|
|
@@ -5917,8 +6986,28 @@ export {
|
|
|
5917
6986
|
fetchUrl,
|
|
5918
6987
|
delay,
|
|
5919
6988
|
debugLog,
|
|
6989
|
+
VectorSumTask,
|
|
6990
|
+
VectorSubtractTask,
|
|
6991
|
+
VectorScaleTask,
|
|
6992
|
+
VectorNormalizeTask,
|
|
6993
|
+
VectorMultiplyTask,
|
|
6994
|
+
VectorDotProductTask,
|
|
6995
|
+
VectorDivideTask,
|
|
6996
|
+
VectorDistanceTask,
|
|
5920
6997
|
TypeReplicateArray,
|
|
5921
6998
|
SplitTask,
|
|
6999
|
+
ScalarTruncTask,
|
|
7000
|
+
ScalarSumTask,
|
|
7001
|
+
ScalarSubtractTask,
|
|
7002
|
+
ScalarRoundTask,
|
|
7003
|
+
ScalarMultiplyTask,
|
|
7004
|
+
ScalarMinTask,
|
|
7005
|
+
ScalarMaxTask,
|
|
7006
|
+
ScalarFloorTask,
|
|
7007
|
+
ScalarDivideTask,
|
|
7008
|
+
ScalarCeilTask,
|
|
7009
|
+
ScalarAddTask,
|
|
7010
|
+
ScalarAbsTask,
|
|
5922
7011
|
OutputTask,
|
|
5923
7012
|
MergeTask,
|
|
5924
7013
|
LambdaTask,
|
|
@@ -5933,4 +7022,4 @@ export {
|
|
|
5933
7022
|
ArrayTask
|
|
5934
7023
|
};
|
|
5935
7024
|
|
|
5936
|
-
//# debugId=
|
|
7025
|
+
//# debugId=0DEA1074A872FE9464756E2164756E21
|