@exulu/backend 1.28.2 → 1.29.0
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/CHANGELOG.md +3 -3
- package/dist/index.cjs +612 -13
- package/dist/index.js +612 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# [1.29.0](https://github.com/Qventu/exulu-backend/compare/v1.28.2...v1.29.0) (2025-10-28)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* add agent animations, math tools, and improve file handling ([d335a7e](https://github.com/Qventu/exulu-backend/commit/d335a7e6c8454490d971ec63dc8486fcd60ef59b))
|
package/dist/index.cjs
CHANGED
|
@@ -763,17 +763,6 @@ var requestValidators = {
|
|
|
763
763
|
// src/registry/utils/graphql.ts
|
|
764
764
|
var import_bcryptjs3 = __toESM(require("bcryptjs"), 1);
|
|
765
765
|
|
|
766
|
-
// types/enums/jobs.ts
|
|
767
|
-
var JOB_STATUS_ENUM = {
|
|
768
|
-
completed: "completed",
|
|
769
|
-
failed: "failed",
|
|
770
|
-
delayed: "delayed",
|
|
771
|
-
active: "active",
|
|
772
|
-
waiting: "waiting",
|
|
773
|
-
paused: "paused",
|
|
774
|
-
stuck: "stuck"
|
|
775
|
-
};
|
|
776
|
-
|
|
777
766
|
// src/postgres/core-schema.ts
|
|
778
767
|
var agentMessagesSchema = {
|
|
779
768
|
type: "agent_messages",
|
|
@@ -982,6 +971,14 @@ var agentsSchema = {
|
|
|
982
971
|
{
|
|
983
972
|
name: "tools",
|
|
984
973
|
type: "json"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
name: "animation_idle",
|
|
977
|
+
type: "text"
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
name: "animation_responding",
|
|
981
|
+
type: "text"
|
|
985
982
|
}
|
|
986
983
|
]
|
|
987
984
|
};
|
|
@@ -1683,6 +1680,19 @@ var generateApiKey = async (name, email) => {
|
|
|
1683
1680
|
|
|
1684
1681
|
// src/registry/utils/graphql.ts
|
|
1685
1682
|
var import_uuid2 = require("uuid");
|
|
1683
|
+
|
|
1684
|
+
// types/enums/jobs.ts
|
|
1685
|
+
var JOB_STATUS_ENUM = {
|
|
1686
|
+
completed: "completed",
|
|
1687
|
+
failed: "failed",
|
|
1688
|
+
delayed: "delayed",
|
|
1689
|
+
active: "active",
|
|
1690
|
+
waiting: "waiting",
|
|
1691
|
+
paused: "paused",
|
|
1692
|
+
stuck: "stuck"
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
// src/registry/utils/graphql.ts
|
|
1686
1696
|
var GraphQLDate = new import_graphql2.GraphQLScalarType({
|
|
1687
1697
|
name: "Date",
|
|
1688
1698
|
description: "Date custom scalar type",
|
|
@@ -4313,7 +4323,7 @@ var createUppyRoutes = async (app, config) => {
|
|
|
4313
4323
|
const client2 = getS3Client(config);
|
|
4314
4324
|
const command = new import_client_s3.ListObjectsV2Command({
|
|
4315
4325
|
Bucket: config.fileUploads.s3Bucket,
|
|
4316
|
-
Prefix:
|
|
4326
|
+
Prefix: `${config.fileUploads.s3prefix ? config.fileUploads.s3prefix.replace(/\/$/, "") + "/" : ""}${authenticationResult.user.id}`,
|
|
4317
4327
|
MaxKeys: 9,
|
|
4318
4328
|
...req.query.continuationToken && { ContinuationToken: req.query.continuationToken }
|
|
4319
4329
|
});
|
|
@@ -7839,6 +7849,594 @@ var llmAsJudgeEval = new ExuluEval2({
|
|
|
7839
7849
|
llm: true
|
|
7840
7850
|
});
|
|
7841
7851
|
|
|
7852
|
+
// src/templates/tools/math.ts
|
|
7853
|
+
var import_zod4 = require("zod");
|
|
7854
|
+
|
|
7855
|
+
// src/templates/tools/utils/arithmetic.ts
|
|
7856
|
+
var Arithmetic = class {
|
|
7857
|
+
/**
|
|
7858
|
+
* Add two numbers together
|
|
7859
|
+
* @param firstNumber - The first number
|
|
7860
|
+
* @param secondNumber - The second number
|
|
7861
|
+
* @returns sum
|
|
7862
|
+
*/
|
|
7863
|
+
static add(firstNumber, secondNumber) {
|
|
7864
|
+
const sum = firstNumber + secondNumber;
|
|
7865
|
+
return sum;
|
|
7866
|
+
}
|
|
7867
|
+
/**
|
|
7868
|
+
* Subtract one number from another
|
|
7869
|
+
* @param minuend - The number to subtract from
|
|
7870
|
+
* @param subtrahend - The number to subtract
|
|
7871
|
+
* @returns difference
|
|
7872
|
+
*/
|
|
7873
|
+
static subtract(minuend, subtrahend) {
|
|
7874
|
+
const difference = minuend - subtrahend;
|
|
7875
|
+
return difference;
|
|
7876
|
+
}
|
|
7877
|
+
/**
|
|
7878
|
+
* Multiply two numbers together
|
|
7879
|
+
* @param firstNumber - The first number
|
|
7880
|
+
* @param secondNumber - The second number
|
|
7881
|
+
* @returns product
|
|
7882
|
+
*/
|
|
7883
|
+
static multiply(firstNumber, secondNumber) {
|
|
7884
|
+
const product = firstNumber * secondNumber;
|
|
7885
|
+
return product;
|
|
7886
|
+
}
|
|
7887
|
+
/**
|
|
7888
|
+
* Divide one number by another
|
|
7889
|
+
* @param numerator - The number to be divided
|
|
7890
|
+
* @param denominator - The number to divide by
|
|
7891
|
+
* @returns quotient
|
|
7892
|
+
*/
|
|
7893
|
+
static division(numerator, denominator) {
|
|
7894
|
+
const quotient = numerator / denominator;
|
|
7895
|
+
return quotient;
|
|
7896
|
+
}
|
|
7897
|
+
/**
|
|
7898
|
+
* Calculate the sum of an array of numbers
|
|
7899
|
+
* @param numbers - Array of numbers to sum
|
|
7900
|
+
* @returns sum of all numbers in the array
|
|
7901
|
+
*/
|
|
7902
|
+
static sum(numbers) {
|
|
7903
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7904
|
+
return sum;
|
|
7905
|
+
}
|
|
7906
|
+
/**
|
|
7907
|
+
* Calculate the floor of a number
|
|
7908
|
+
* @param number - Number to find the floor of
|
|
7909
|
+
* @returns floor of the number
|
|
7910
|
+
*/
|
|
7911
|
+
static floor(number) {
|
|
7912
|
+
const floor = Math.floor(number);
|
|
7913
|
+
return floor;
|
|
7914
|
+
}
|
|
7915
|
+
/**
|
|
7916
|
+
* Calculate the ceil of a number
|
|
7917
|
+
* @param number - Number to find the ceil of
|
|
7918
|
+
* @returns ceil of the number
|
|
7919
|
+
*/
|
|
7920
|
+
static ceil(number) {
|
|
7921
|
+
const ceil = Math.ceil(number);
|
|
7922
|
+
return ceil;
|
|
7923
|
+
}
|
|
7924
|
+
/**
|
|
7925
|
+
* Calculate the round of a number
|
|
7926
|
+
* @param number - Number to find the round of
|
|
7927
|
+
* @returns round of the number
|
|
7928
|
+
*/
|
|
7929
|
+
static round(number) {
|
|
7930
|
+
const round = Math.round(number);
|
|
7931
|
+
return round;
|
|
7932
|
+
}
|
|
7933
|
+
/**
|
|
7934
|
+
* Get the remainder of a division equation.
|
|
7935
|
+
* Ex: modulo(5,2) = 1
|
|
7936
|
+
* @param numerator - The number to be divided
|
|
7937
|
+
* @param denominator - The number to divide by
|
|
7938
|
+
* @returns remainder of division
|
|
7939
|
+
*/
|
|
7940
|
+
static modulo(numerator, denominator) {
|
|
7941
|
+
const remainder = numerator % denominator;
|
|
7942
|
+
return remainder;
|
|
7943
|
+
}
|
|
7944
|
+
};
|
|
7945
|
+
|
|
7946
|
+
// src/templates/tools/utils/statistics.ts
|
|
7947
|
+
var Statistics = class {
|
|
7948
|
+
/**
|
|
7949
|
+
* Calculate the arithmetic mean (average) of an array of numbers
|
|
7950
|
+
* @param numbers - Array of numbers to calculate the mean of
|
|
7951
|
+
* @returns The arithmetic mean value
|
|
7952
|
+
*/
|
|
7953
|
+
static mean(numbers) {
|
|
7954
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7955
|
+
const mean = sum / numbers.length;
|
|
7956
|
+
return mean;
|
|
7957
|
+
}
|
|
7958
|
+
/**
|
|
7959
|
+
* Calculate the median (middle value) of an array of numbers
|
|
7960
|
+
* @param numbers - Array of numbers to calculate the median of
|
|
7961
|
+
* @returns The median value
|
|
7962
|
+
*/
|
|
7963
|
+
static median(numbers) {
|
|
7964
|
+
numbers.sort();
|
|
7965
|
+
const medianIndex = numbers.length / 2;
|
|
7966
|
+
let medianValue;
|
|
7967
|
+
if (numbers.length % 2 !== 0) {
|
|
7968
|
+
medianValue = numbers[Math.floor(medianIndex)];
|
|
7969
|
+
} else {
|
|
7970
|
+
medianValue = (numbers[medianIndex] + numbers[medianIndex - 1]) / 2;
|
|
7971
|
+
}
|
|
7972
|
+
return medianValue;
|
|
7973
|
+
}
|
|
7974
|
+
/**
|
|
7975
|
+
* Calculate the mode (most frequent value(s)) of an array of numbers
|
|
7976
|
+
* @param numbers - Array of numbers to calculate the mode of
|
|
7977
|
+
* @returns Object containing the mode value(s) and their frequency
|
|
7978
|
+
*/
|
|
7979
|
+
static mode(numbers) {
|
|
7980
|
+
const modeMap = /* @__PURE__ */ new Map();
|
|
7981
|
+
numbers.forEach((value) => {
|
|
7982
|
+
if (modeMap.has(value)) {
|
|
7983
|
+
modeMap.set(value, modeMap.get(value) + 1);
|
|
7984
|
+
} else {
|
|
7985
|
+
modeMap.set(value, 1);
|
|
7986
|
+
}
|
|
7987
|
+
});
|
|
7988
|
+
let maxFrequency = 0;
|
|
7989
|
+
for (const numberFrequency of modeMap.values()) {
|
|
7990
|
+
if (numberFrequency > maxFrequency) {
|
|
7991
|
+
maxFrequency = numberFrequency;
|
|
7992
|
+
}
|
|
7993
|
+
}
|
|
7994
|
+
const modeResult = [];
|
|
7995
|
+
for (const [key, value] of modeMap.entries()) {
|
|
7996
|
+
if (value === maxFrequency) {
|
|
7997
|
+
modeResult.push(key);
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
8000
|
+
return {
|
|
8001
|
+
modeResult,
|
|
8002
|
+
maxFrequency
|
|
8003
|
+
};
|
|
8004
|
+
}
|
|
8005
|
+
/**
|
|
8006
|
+
* Find the minimum value in an array of numbers
|
|
8007
|
+
* @param numbers - Array of numbers to find the minimum of
|
|
8008
|
+
* @returns The minimum value
|
|
8009
|
+
*/
|
|
8010
|
+
static min(numbers) {
|
|
8011
|
+
const minValue = Math.min(...numbers);
|
|
8012
|
+
return minValue;
|
|
8013
|
+
}
|
|
8014
|
+
/**
|
|
8015
|
+
* Find the maximum value in an array of numbers
|
|
8016
|
+
* @param numbers - Array of numbers to find the maximum of
|
|
8017
|
+
* @returns The maximum value
|
|
8018
|
+
*/
|
|
8019
|
+
static max(numbers) {
|
|
8020
|
+
const maxValue = Math.max(...numbers);
|
|
8021
|
+
return maxValue;
|
|
8022
|
+
}
|
|
8023
|
+
};
|
|
8024
|
+
|
|
8025
|
+
// src/templates/tools/utils/trigonometric.ts
|
|
8026
|
+
var Trigonometric = class {
|
|
8027
|
+
/**
|
|
8028
|
+
* Calculate the sin of a number in radians
|
|
8029
|
+
* @param number - The number to find the sin of
|
|
8030
|
+
* @returns The sin of a number in radians
|
|
8031
|
+
*/
|
|
8032
|
+
static sin(number) {
|
|
8033
|
+
const sin = Math.sin(number);
|
|
8034
|
+
return sin;
|
|
8035
|
+
}
|
|
8036
|
+
/**
|
|
8037
|
+
* Calculate the arcsin of a number in radians
|
|
8038
|
+
* @param number - The number to find the arcsin of
|
|
8039
|
+
* @returns The arcsin of a number in radians
|
|
8040
|
+
*/
|
|
8041
|
+
static arcsin(number) {
|
|
8042
|
+
const arcsin = Math.asin(number);
|
|
8043
|
+
return arcsin;
|
|
8044
|
+
}
|
|
8045
|
+
/**
|
|
8046
|
+
* Calculate the cos of a number in radians
|
|
8047
|
+
* @param number - The number to find the cos of
|
|
8048
|
+
* @returns The cos of a number in radians
|
|
8049
|
+
*/
|
|
8050
|
+
static cos(number) {
|
|
8051
|
+
const cos = Math.cos(number);
|
|
8052
|
+
return cos;
|
|
8053
|
+
}
|
|
8054
|
+
/**
|
|
8055
|
+
* Calculate the arccos of a number in radians
|
|
8056
|
+
* @param number - The number to find the arccos of
|
|
8057
|
+
* @returns The arccos of a number in radians
|
|
8058
|
+
*/
|
|
8059
|
+
static arccos(number) {
|
|
8060
|
+
const arccos = Math.acos(number);
|
|
8061
|
+
return arccos;
|
|
8062
|
+
}
|
|
8063
|
+
/**
|
|
8064
|
+
* Calculate the tangent of a number in radians
|
|
8065
|
+
* @param number - The number to find the tangent of
|
|
8066
|
+
* @returns The tangent of a number in radians
|
|
8067
|
+
*/
|
|
8068
|
+
static tan(number) {
|
|
8069
|
+
const tangent = Math.tan(number);
|
|
8070
|
+
return tangent;
|
|
8071
|
+
}
|
|
8072
|
+
/**
|
|
8073
|
+
* Calculate the arc tangent of a number in radians
|
|
8074
|
+
* @param number - The number to find the arc tangent of
|
|
8075
|
+
* @returns The arc tangent of a number in radians
|
|
8076
|
+
*/
|
|
8077
|
+
static arctan(number) {
|
|
8078
|
+
const arctangent = Math.atan(number);
|
|
8079
|
+
return arctangent;
|
|
8080
|
+
}
|
|
8081
|
+
/**
|
|
8082
|
+
* Converts a radian into its equivalent value in degrees
|
|
8083
|
+
* @param number - The number to get the degree of
|
|
8084
|
+
* @returns The degree of the number
|
|
8085
|
+
*/
|
|
8086
|
+
static radiansToDegrees(number) {
|
|
8087
|
+
const degrees = number * (180 / Math.PI);
|
|
8088
|
+
return degrees;
|
|
8089
|
+
}
|
|
8090
|
+
/**
|
|
8091
|
+
* Converts a degree into its equivalent value in radians
|
|
8092
|
+
* @param number - The number to get the radians of
|
|
8093
|
+
* @returns The radians of the number
|
|
8094
|
+
*/
|
|
8095
|
+
static degreesToRadians(number) {
|
|
8096
|
+
const radians = number * (Math.PI / 180);
|
|
8097
|
+
return radians;
|
|
8098
|
+
}
|
|
8099
|
+
};
|
|
8100
|
+
|
|
8101
|
+
// src/templates/tools/math.ts
|
|
8102
|
+
var additionTool = new ExuluTool2({
|
|
8103
|
+
id: "addition",
|
|
8104
|
+
name: "Addition",
|
|
8105
|
+
description: "Adds two numbers together",
|
|
8106
|
+
type: "function",
|
|
8107
|
+
config: [],
|
|
8108
|
+
inputSchema: import_zod4.z.object({
|
|
8109
|
+
firstNumber: import_zod4.z.number().describe("The first addend"),
|
|
8110
|
+
secondNumber: import_zod4.z.number().describe("The second addend")
|
|
8111
|
+
}),
|
|
8112
|
+
execute: async ({ firstNumber, secondNumber }) => {
|
|
8113
|
+
const value = Arithmetic.add(firstNumber, secondNumber);
|
|
8114
|
+
return { result: `${value}` };
|
|
8115
|
+
}
|
|
8116
|
+
});
|
|
8117
|
+
var subtractionTool = new ExuluTool2({
|
|
8118
|
+
id: "subtraction",
|
|
8119
|
+
name: "Subtraction",
|
|
8120
|
+
description: "Subtracts the second number from the first number",
|
|
8121
|
+
type: "function",
|
|
8122
|
+
config: [],
|
|
8123
|
+
inputSchema: import_zod4.z.object({
|
|
8124
|
+
minuend: import_zod4.z.number().describe("The number to subtract from (minuend)"),
|
|
8125
|
+
subtrahend: import_zod4.z.number().describe("The number being subtracted (subtrahend)")
|
|
8126
|
+
}),
|
|
8127
|
+
execute: async ({ minuend, subtrahend }) => {
|
|
8128
|
+
const value = Arithmetic.subtract(minuend, subtrahend);
|
|
8129
|
+
return { result: `${value}` };
|
|
8130
|
+
}
|
|
8131
|
+
});
|
|
8132
|
+
var multiplicationTool = new ExuluTool2({
|
|
8133
|
+
id: "multiplication",
|
|
8134
|
+
name: "Multiplication",
|
|
8135
|
+
description: "Multiplies two numbers together",
|
|
8136
|
+
type: "function",
|
|
8137
|
+
config: [],
|
|
8138
|
+
inputSchema: import_zod4.z.object({
|
|
8139
|
+
firstNumber: import_zod4.z.number().describe("The first number"),
|
|
8140
|
+
SecondNumber: import_zod4.z.number().describe("The second number")
|
|
8141
|
+
}),
|
|
8142
|
+
execute: async ({ firstNumber, SecondNumber }) => {
|
|
8143
|
+
const value = Arithmetic.multiply(firstNumber, SecondNumber);
|
|
8144
|
+
return { result: `${value}` };
|
|
8145
|
+
}
|
|
8146
|
+
});
|
|
8147
|
+
var divisionTool = new ExuluTool2({
|
|
8148
|
+
id: "division",
|
|
8149
|
+
name: "Division",
|
|
8150
|
+
description: "Divides the first number by the second number",
|
|
8151
|
+
type: "function",
|
|
8152
|
+
config: [],
|
|
8153
|
+
inputSchema: import_zod4.z.object({
|
|
8154
|
+
numerator: import_zod4.z.number().describe("The number being divided (numerator)"),
|
|
8155
|
+
denominator: import_zod4.z.number().describe("The number to divide by (denominator)")
|
|
8156
|
+
}),
|
|
8157
|
+
execute: async ({ numerator, denominator }) => {
|
|
8158
|
+
const value = Arithmetic.division(numerator, denominator);
|
|
8159
|
+
return { result: `${value}` };
|
|
8160
|
+
}
|
|
8161
|
+
});
|
|
8162
|
+
var sumTool = new ExuluTool2({
|
|
8163
|
+
id: "sum",
|
|
8164
|
+
name: "Sum",
|
|
8165
|
+
description: "Adds any number of numbers together",
|
|
8166
|
+
type: "function",
|
|
8167
|
+
config: [],
|
|
8168
|
+
inputSchema: import_zod4.z.object({
|
|
8169
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to sum")
|
|
8170
|
+
}),
|
|
8171
|
+
execute: async ({ numbers }) => {
|
|
8172
|
+
const value = Arithmetic.sum(numbers);
|
|
8173
|
+
return { result: `${value}` };
|
|
8174
|
+
}
|
|
8175
|
+
});
|
|
8176
|
+
var moduloTool = new ExuluTool2({
|
|
8177
|
+
id: "modulo",
|
|
8178
|
+
name: "Modulo",
|
|
8179
|
+
description: "Divides two numbers and returns the remainder",
|
|
8180
|
+
type: "function",
|
|
8181
|
+
config: [],
|
|
8182
|
+
inputSchema: import_zod4.z.object({
|
|
8183
|
+
numerator: import_zod4.z.number().describe("The number being divided (numerator)"),
|
|
8184
|
+
denominator: import_zod4.z.number().describe("The number to divide by (denominator)")
|
|
8185
|
+
}),
|
|
8186
|
+
execute: async ({ numerator, denominator }) => {
|
|
8187
|
+
const value = Arithmetic.modulo(numerator, denominator);
|
|
8188
|
+
return { result: `${value}` };
|
|
8189
|
+
}
|
|
8190
|
+
});
|
|
8191
|
+
var meanTool = new ExuluTool2({
|
|
8192
|
+
id: "mean",
|
|
8193
|
+
name: "Mean",
|
|
8194
|
+
description: "Calculates the arithmetic mean of a list of numbers",
|
|
8195
|
+
type: "function",
|
|
8196
|
+
config: [],
|
|
8197
|
+
inputSchema: import_zod4.z.object({
|
|
8198
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to find the mean of")
|
|
8199
|
+
}),
|
|
8200
|
+
execute: async ({ numbers }) => {
|
|
8201
|
+
const value = Statistics.mean(numbers);
|
|
8202
|
+
return { result: `${value}` };
|
|
8203
|
+
}
|
|
8204
|
+
});
|
|
8205
|
+
var medianTool = new ExuluTool2({
|
|
8206
|
+
id: "median",
|
|
8207
|
+
name: "Median",
|
|
8208
|
+
description: "Calculates the median of a list of numbers",
|
|
8209
|
+
type: "function",
|
|
8210
|
+
config: [],
|
|
8211
|
+
inputSchema: import_zod4.z.object({
|
|
8212
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to find the median of")
|
|
8213
|
+
}),
|
|
8214
|
+
execute: async ({ numbers }) => {
|
|
8215
|
+
const value = Statistics.median(numbers);
|
|
8216
|
+
return { result: `${value}` };
|
|
8217
|
+
}
|
|
8218
|
+
});
|
|
8219
|
+
var modeTool = new ExuluTool2({
|
|
8220
|
+
id: "mode",
|
|
8221
|
+
name: "Mode",
|
|
8222
|
+
description: "Finds the most common number in a list of numbers",
|
|
8223
|
+
type: "function",
|
|
8224
|
+
config: [],
|
|
8225
|
+
inputSchema: import_zod4.z.object({
|
|
8226
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the mode of")
|
|
8227
|
+
}),
|
|
8228
|
+
execute: async ({ numbers }) => {
|
|
8229
|
+
const value = Statistics.mode(numbers);
|
|
8230
|
+
return { result: `Entries (${value.modeResult.join(", ")}) appeared ${value.maxFrequency} times` };
|
|
8231
|
+
}
|
|
8232
|
+
});
|
|
8233
|
+
var minTool = new ExuluTool2({
|
|
8234
|
+
id: "min",
|
|
8235
|
+
name: "Minimum",
|
|
8236
|
+
description: "Finds the minimum value from a list of numbers",
|
|
8237
|
+
type: "function",
|
|
8238
|
+
config: [],
|
|
8239
|
+
inputSchema: import_zod4.z.object({
|
|
8240
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the minimum of")
|
|
8241
|
+
}),
|
|
8242
|
+
execute: async ({ numbers }) => {
|
|
8243
|
+
const value = Statistics.min(numbers);
|
|
8244
|
+
return { result: `${value}` };
|
|
8245
|
+
}
|
|
8246
|
+
});
|
|
8247
|
+
var maxTool = new ExuluTool2({
|
|
8248
|
+
id: "max",
|
|
8249
|
+
name: "Maximum",
|
|
8250
|
+
description: "Finds the maximum value from a list of numbers",
|
|
8251
|
+
type: "function",
|
|
8252
|
+
config: [],
|
|
8253
|
+
inputSchema: import_zod4.z.object({
|
|
8254
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the maximum of")
|
|
8255
|
+
}),
|
|
8256
|
+
execute: async ({ numbers }) => {
|
|
8257
|
+
const value = Statistics.max(numbers);
|
|
8258
|
+
return { result: `${value}` };
|
|
8259
|
+
}
|
|
8260
|
+
});
|
|
8261
|
+
var floorTool = new ExuluTool2({
|
|
8262
|
+
id: "floor",
|
|
8263
|
+
name: "Floor",
|
|
8264
|
+
description: "Rounds a number down to the nearest integer",
|
|
8265
|
+
type: "function",
|
|
8266
|
+
config: [],
|
|
8267
|
+
inputSchema: import_zod4.z.object({
|
|
8268
|
+
number: import_zod4.z.number().describe("The number to round down")
|
|
8269
|
+
}),
|
|
8270
|
+
execute: async ({ number }) => {
|
|
8271
|
+
const value = Arithmetic.floor(number);
|
|
8272
|
+
return { result: `${value}` };
|
|
8273
|
+
}
|
|
8274
|
+
});
|
|
8275
|
+
var ceilingTool = new ExuluTool2({
|
|
8276
|
+
id: "ceiling",
|
|
8277
|
+
name: "Ceiling",
|
|
8278
|
+
description: "Rounds a number up to the nearest integer",
|
|
8279
|
+
type: "function",
|
|
8280
|
+
config: [],
|
|
8281
|
+
inputSchema: import_zod4.z.object({
|
|
8282
|
+
number: import_zod4.z.number().describe("The number to round up")
|
|
8283
|
+
}),
|
|
8284
|
+
execute: async ({ number }) => {
|
|
8285
|
+
const value = Arithmetic.ceil(number);
|
|
8286
|
+
return { result: `${value}` };
|
|
8287
|
+
}
|
|
8288
|
+
});
|
|
8289
|
+
var roundTool = new ExuluTool2({
|
|
8290
|
+
id: "round",
|
|
8291
|
+
name: "Round",
|
|
8292
|
+
description: "Rounds a number to the nearest integer",
|
|
8293
|
+
type: "function",
|
|
8294
|
+
config: [],
|
|
8295
|
+
inputSchema: import_zod4.z.object({
|
|
8296
|
+
number: import_zod4.z.number().describe("The number to round")
|
|
8297
|
+
}),
|
|
8298
|
+
execute: async ({ number }) => {
|
|
8299
|
+
const value = Arithmetic.round(number);
|
|
8300
|
+
return { result: `${value}` };
|
|
8301
|
+
}
|
|
8302
|
+
});
|
|
8303
|
+
var sinTool = new ExuluTool2({
|
|
8304
|
+
id: "sin",
|
|
8305
|
+
name: "Sine",
|
|
8306
|
+
description: "Calculates the sine of a number in radians",
|
|
8307
|
+
type: "function",
|
|
8308
|
+
config: [],
|
|
8309
|
+
inputSchema: import_zod4.z.object({
|
|
8310
|
+
number: import_zod4.z.number().describe("The number in radians to find the sine of")
|
|
8311
|
+
}),
|
|
8312
|
+
execute: async ({ number }) => {
|
|
8313
|
+
const value = Trigonometric.sin(number);
|
|
8314
|
+
return { result: `${value}` };
|
|
8315
|
+
}
|
|
8316
|
+
});
|
|
8317
|
+
var arcsinTool = new ExuluTool2({
|
|
8318
|
+
id: "arcsin",
|
|
8319
|
+
name: "Arcsine",
|
|
8320
|
+
description: "Calculates the arcsine of a number in radians",
|
|
8321
|
+
type: "function",
|
|
8322
|
+
config: [],
|
|
8323
|
+
inputSchema: import_zod4.z.object({
|
|
8324
|
+
number: import_zod4.z.number().describe("The number to find the arcsine of")
|
|
8325
|
+
}),
|
|
8326
|
+
execute: async ({ number }) => {
|
|
8327
|
+
const value = Trigonometric.arcsin(number);
|
|
8328
|
+
return { result: `${value}` };
|
|
8329
|
+
}
|
|
8330
|
+
});
|
|
8331
|
+
var cosTool = new ExuluTool2({
|
|
8332
|
+
id: "cos",
|
|
8333
|
+
name: "Cosine",
|
|
8334
|
+
description: "Calculates the cosine of a number in radians",
|
|
8335
|
+
type: "function",
|
|
8336
|
+
config: [],
|
|
8337
|
+
inputSchema: import_zod4.z.object({
|
|
8338
|
+
number: import_zod4.z.number().describe("The number in radians to find the cosine of")
|
|
8339
|
+
}),
|
|
8340
|
+
execute: async ({ number }) => {
|
|
8341
|
+
const value = Trigonometric.cos(number);
|
|
8342
|
+
return { result: `${value}` };
|
|
8343
|
+
}
|
|
8344
|
+
});
|
|
8345
|
+
var arccosTool = new ExuluTool2({
|
|
8346
|
+
id: "arccos",
|
|
8347
|
+
name: "Arccosine",
|
|
8348
|
+
description: "Calculates the arccosine of a number in radians",
|
|
8349
|
+
type: "function",
|
|
8350
|
+
config: [],
|
|
8351
|
+
inputSchema: import_zod4.z.object({
|
|
8352
|
+
number: import_zod4.z.number().describe("The number to find the arccosine of")
|
|
8353
|
+
}),
|
|
8354
|
+
execute: async ({ number }) => {
|
|
8355
|
+
const value = Trigonometric.arccos(number);
|
|
8356
|
+
return { result: `${value}` };
|
|
8357
|
+
}
|
|
8358
|
+
});
|
|
8359
|
+
var tanTool = new ExuluTool2({
|
|
8360
|
+
id: "tan",
|
|
8361
|
+
name: "Tangent",
|
|
8362
|
+
description: "Calculates the tangent of a number in radians",
|
|
8363
|
+
type: "function",
|
|
8364
|
+
config: [],
|
|
8365
|
+
inputSchema: import_zod4.z.object({
|
|
8366
|
+
number: import_zod4.z.number().describe("The number in radians to find the tangent of")
|
|
8367
|
+
}),
|
|
8368
|
+
execute: async ({ number }) => {
|
|
8369
|
+
const value = Trigonometric.tan(number);
|
|
8370
|
+
return { result: `${value}` };
|
|
8371
|
+
}
|
|
8372
|
+
});
|
|
8373
|
+
var arctanTool = new ExuluTool2({
|
|
8374
|
+
id: "arctan",
|
|
8375
|
+
name: "Arctangent",
|
|
8376
|
+
description: "Calculates the arctangent of a number in radians",
|
|
8377
|
+
type: "function",
|
|
8378
|
+
config: [],
|
|
8379
|
+
inputSchema: import_zod4.z.object({
|
|
8380
|
+
number: import_zod4.z.number().describe("The number to find the arctangent of")
|
|
8381
|
+
}),
|
|
8382
|
+
execute: async ({ number }) => {
|
|
8383
|
+
const value = Trigonometric.arctan(number);
|
|
8384
|
+
return { result: `${value}` };
|
|
8385
|
+
}
|
|
8386
|
+
});
|
|
8387
|
+
var radiansToDegreesTool = new ExuluTool2({
|
|
8388
|
+
id: "radiansToDegrees",
|
|
8389
|
+
name: "Radians to Degrees",
|
|
8390
|
+
description: "Converts a radian value to its equivalent in degrees",
|
|
8391
|
+
type: "function",
|
|
8392
|
+
config: [],
|
|
8393
|
+
inputSchema: import_zod4.z.object({
|
|
8394
|
+
number: import_zod4.z.number().describe("The number in radians to convert to degrees")
|
|
8395
|
+
}),
|
|
8396
|
+
execute: async ({ number }) => {
|
|
8397
|
+
const value = Trigonometric.radiansToDegrees(number);
|
|
8398
|
+
return { result: `${value}` };
|
|
8399
|
+
}
|
|
8400
|
+
});
|
|
8401
|
+
var degreesToRadiansTool = new ExuluTool2({
|
|
8402
|
+
id: "degreesToRadians",
|
|
8403
|
+
name: "Degrees to Radians",
|
|
8404
|
+
description: "Converts a degree value to its equivalent in radians",
|
|
8405
|
+
type: "function",
|
|
8406
|
+
config: [],
|
|
8407
|
+
inputSchema: import_zod4.z.object({
|
|
8408
|
+
number: import_zod4.z.number().describe("The number in degrees to convert to radians")
|
|
8409
|
+
}),
|
|
8410
|
+
execute: async ({ number }) => {
|
|
8411
|
+
const value = Trigonometric.degreesToRadians(number);
|
|
8412
|
+
return { result: `${value}` };
|
|
8413
|
+
}
|
|
8414
|
+
});
|
|
8415
|
+
var mathTools = [
|
|
8416
|
+
additionTool,
|
|
8417
|
+
subtractionTool,
|
|
8418
|
+
multiplicationTool,
|
|
8419
|
+
divisionTool,
|
|
8420
|
+
sumTool,
|
|
8421
|
+
moduloTool,
|
|
8422
|
+
meanTool,
|
|
8423
|
+
medianTool,
|
|
8424
|
+
modeTool,
|
|
8425
|
+
minTool,
|
|
8426
|
+
maxTool,
|
|
8427
|
+
floorTool,
|
|
8428
|
+
ceilingTool,
|
|
8429
|
+
roundTool,
|
|
8430
|
+
sinTool,
|
|
8431
|
+
arcsinTool,
|
|
8432
|
+
cosTool,
|
|
8433
|
+
arccosTool,
|
|
8434
|
+
tanTool,
|
|
8435
|
+
arctanTool,
|
|
8436
|
+
radiansToDegreesTool,
|
|
8437
|
+
degreesToRadiansTool
|
|
8438
|
+
];
|
|
8439
|
+
|
|
7842
8440
|
// src/registry/index.ts
|
|
7843
8441
|
var isDev = process.env.NODE_ENV !== "production";
|
|
7844
8442
|
var consoleTransport = new import_winston2.default.transports.Console({
|
|
@@ -7868,7 +8466,7 @@ var isValidPostgresName = (id) => {
|
|
|
7868
8466
|
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
7869
8467
|
const isValid = regex.test(id);
|
|
7870
8468
|
const length = id.length;
|
|
7871
|
-
return isValid && length <= 80 && length >
|
|
8469
|
+
return isValid && length <= 80 && length > 2;
|
|
7872
8470
|
};
|
|
7873
8471
|
var ExuluApp = class {
|
|
7874
8472
|
_agents = [];
|
|
@@ -7910,6 +8508,7 @@ var ExuluApp = class {
|
|
|
7910
8508
|
this._config = config;
|
|
7911
8509
|
this._tools = [
|
|
7912
8510
|
...tools ?? [],
|
|
8511
|
+
...mathTools,
|
|
7913
8512
|
// Add contexts as tools
|
|
7914
8513
|
...Object.values(contexts || {}).map((context) => context.tool())
|
|
7915
8514
|
// Because agents are stored in the database, we add those as tools
|
package/dist/index.js
CHANGED
|
@@ -711,17 +711,6 @@ var requestValidators = {
|
|
|
711
711
|
// src/registry/utils/graphql.ts
|
|
712
712
|
import bcrypt3 from "bcryptjs";
|
|
713
713
|
|
|
714
|
-
// types/enums/jobs.ts
|
|
715
|
-
var JOB_STATUS_ENUM = {
|
|
716
|
-
completed: "completed",
|
|
717
|
-
failed: "failed",
|
|
718
|
-
delayed: "delayed",
|
|
719
|
-
active: "active",
|
|
720
|
-
waiting: "waiting",
|
|
721
|
-
paused: "paused",
|
|
722
|
-
stuck: "stuck"
|
|
723
|
-
};
|
|
724
|
-
|
|
725
714
|
// src/postgres/core-schema.ts
|
|
726
715
|
var agentMessagesSchema = {
|
|
727
716
|
type: "agent_messages",
|
|
@@ -930,6 +919,14 @@ var agentsSchema = {
|
|
|
930
919
|
{
|
|
931
920
|
name: "tools",
|
|
932
921
|
type: "json"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
name: "animation_idle",
|
|
925
|
+
type: "text"
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
name: "animation_responding",
|
|
929
|
+
type: "text"
|
|
933
930
|
}
|
|
934
931
|
]
|
|
935
932
|
};
|
|
@@ -1631,6 +1628,19 @@ var generateApiKey = async (name, email) => {
|
|
|
1631
1628
|
|
|
1632
1629
|
// src/registry/utils/graphql.ts
|
|
1633
1630
|
import { v4 as uuidv42 } from "uuid";
|
|
1631
|
+
|
|
1632
|
+
// types/enums/jobs.ts
|
|
1633
|
+
var JOB_STATUS_ENUM = {
|
|
1634
|
+
completed: "completed",
|
|
1635
|
+
failed: "failed",
|
|
1636
|
+
delayed: "delayed",
|
|
1637
|
+
active: "active",
|
|
1638
|
+
waiting: "waiting",
|
|
1639
|
+
paused: "paused",
|
|
1640
|
+
stuck: "stuck"
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
// src/registry/utils/graphql.ts
|
|
1634
1644
|
var GraphQLDate = new GraphQLScalarType({
|
|
1635
1645
|
name: "Date",
|
|
1636
1646
|
description: "Date custom scalar type",
|
|
@@ -4280,7 +4290,7 @@ var createUppyRoutes = async (app, config) => {
|
|
|
4280
4290
|
const client2 = getS3Client(config);
|
|
4281
4291
|
const command = new ListObjectsV2Command({
|
|
4282
4292
|
Bucket: config.fileUploads.s3Bucket,
|
|
4283
|
-
Prefix:
|
|
4293
|
+
Prefix: `${config.fileUploads.s3prefix ? config.fileUploads.s3prefix.replace(/\/$/, "") + "/" : ""}${authenticationResult.user.id}`,
|
|
4284
4294
|
MaxKeys: 9,
|
|
4285
4295
|
...req.query.continuationToken && { ContinuationToken: req.query.continuationToken }
|
|
4286
4296
|
});
|
|
@@ -7806,6 +7816,594 @@ var llmAsJudgeEval = new ExuluEval2({
|
|
|
7806
7816
|
llm: true
|
|
7807
7817
|
});
|
|
7808
7818
|
|
|
7819
|
+
// src/templates/tools/math.ts
|
|
7820
|
+
import { z as z4 } from "zod";
|
|
7821
|
+
|
|
7822
|
+
// src/templates/tools/utils/arithmetic.ts
|
|
7823
|
+
var Arithmetic = class {
|
|
7824
|
+
/**
|
|
7825
|
+
* Add two numbers together
|
|
7826
|
+
* @param firstNumber - The first number
|
|
7827
|
+
* @param secondNumber - The second number
|
|
7828
|
+
* @returns sum
|
|
7829
|
+
*/
|
|
7830
|
+
static add(firstNumber, secondNumber) {
|
|
7831
|
+
const sum = firstNumber + secondNumber;
|
|
7832
|
+
return sum;
|
|
7833
|
+
}
|
|
7834
|
+
/**
|
|
7835
|
+
* Subtract one number from another
|
|
7836
|
+
* @param minuend - The number to subtract from
|
|
7837
|
+
* @param subtrahend - The number to subtract
|
|
7838
|
+
* @returns difference
|
|
7839
|
+
*/
|
|
7840
|
+
static subtract(minuend, subtrahend) {
|
|
7841
|
+
const difference = minuend - subtrahend;
|
|
7842
|
+
return difference;
|
|
7843
|
+
}
|
|
7844
|
+
/**
|
|
7845
|
+
* Multiply two numbers together
|
|
7846
|
+
* @param firstNumber - The first number
|
|
7847
|
+
* @param secondNumber - The second number
|
|
7848
|
+
* @returns product
|
|
7849
|
+
*/
|
|
7850
|
+
static multiply(firstNumber, secondNumber) {
|
|
7851
|
+
const product = firstNumber * secondNumber;
|
|
7852
|
+
return product;
|
|
7853
|
+
}
|
|
7854
|
+
/**
|
|
7855
|
+
* Divide one number by another
|
|
7856
|
+
* @param numerator - The number to be divided
|
|
7857
|
+
* @param denominator - The number to divide by
|
|
7858
|
+
* @returns quotient
|
|
7859
|
+
*/
|
|
7860
|
+
static division(numerator, denominator) {
|
|
7861
|
+
const quotient = numerator / denominator;
|
|
7862
|
+
return quotient;
|
|
7863
|
+
}
|
|
7864
|
+
/**
|
|
7865
|
+
* Calculate the sum of an array of numbers
|
|
7866
|
+
* @param numbers - Array of numbers to sum
|
|
7867
|
+
* @returns sum of all numbers in the array
|
|
7868
|
+
*/
|
|
7869
|
+
static sum(numbers) {
|
|
7870
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7871
|
+
return sum;
|
|
7872
|
+
}
|
|
7873
|
+
/**
|
|
7874
|
+
* Calculate the floor of a number
|
|
7875
|
+
* @param number - Number to find the floor of
|
|
7876
|
+
* @returns floor of the number
|
|
7877
|
+
*/
|
|
7878
|
+
static floor(number) {
|
|
7879
|
+
const floor = Math.floor(number);
|
|
7880
|
+
return floor;
|
|
7881
|
+
}
|
|
7882
|
+
/**
|
|
7883
|
+
* Calculate the ceil of a number
|
|
7884
|
+
* @param number - Number to find the ceil of
|
|
7885
|
+
* @returns ceil of the number
|
|
7886
|
+
*/
|
|
7887
|
+
static ceil(number) {
|
|
7888
|
+
const ceil = Math.ceil(number);
|
|
7889
|
+
return ceil;
|
|
7890
|
+
}
|
|
7891
|
+
/**
|
|
7892
|
+
* Calculate the round of a number
|
|
7893
|
+
* @param number - Number to find the round of
|
|
7894
|
+
* @returns round of the number
|
|
7895
|
+
*/
|
|
7896
|
+
static round(number) {
|
|
7897
|
+
const round = Math.round(number);
|
|
7898
|
+
return round;
|
|
7899
|
+
}
|
|
7900
|
+
/**
|
|
7901
|
+
* Get the remainder of a division equation.
|
|
7902
|
+
* Ex: modulo(5,2) = 1
|
|
7903
|
+
* @param numerator - The number to be divided
|
|
7904
|
+
* @param denominator - The number to divide by
|
|
7905
|
+
* @returns remainder of division
|
|
7906
|
+
*/
|
|
7907
|
+
static modulo(numerator, denominator) {
|
|
7908
|
+
const remainder = numerator % denominator;
|
|
7909
|
+
return remainder;
|
|
7910
|
+
}
|
|
7911
|
+
};
|
|
7912
|
+
|
|
7913
|
+
// src/templates/tools/utils/statistics.ts
|
|
7914
|
+
var Statistics = class {
|
|
7915
|
+
/**
|
|
7916
|
+
* Calculate the arithmetic mean (average) of an array of numbers
|
|
7917
|
+
* @param numbers - Array of numbers to calculate the mean of
|
|
7918
|
+
* @returns The arithmetic mean value
|
|
7919
|
+
*/
|
|
7920
|
+
static mean(numbers) {
|
|
7921
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7922
|
+
const mean = sum / numbers.length;
|
|
7923
|
+
return mean;
|
|
7924
|
+
}
|
|
7925
|
+
/**
|
|
7926
|
+
* Calculate the median (middle value) of an array of numbers
|
|
7927
|
+
* @param numbers - Array of numbers to calculate the median of
|
|
7928
|
+
* @returns The median value
|
|
7929
|
+
*/
|
|
7930
|
+
static median(numbers) {
|
|
7931
|
+
numbers.sort();
|
|
7932
|
+
const medianIndex = numbers.length / 2;
|
|
7933
|
+
let medianValue;
|
|
7934
|
+
if (numbers.length % 2 !== 0) {
|
|
7935
|
+
medianValue = numbers[Math.floor(medianIndex)];
|
|
7936
|
+
} else {
|
|
7937
|
+
medianValue = (numbers[medianIndex] + numbers[medianIndex - 1]) / 2;
|
|
7938
|
+
}
|
|
7939
|
+
return medianValue;
|
|
7940
|
+
}
|
|
7941
|
+
/**
|
|
7942
|
+
* Calculate the mode (most frequent value(s)) of an array of numbers
|
|
7943
|
+
* @param numbers - Array of numbers to calculate the mode of
|
|
7944
|
+
* @returns Object containing the mode value(s) and their frequency
|
|
7945
|
+
*/
|
|
7946
|
+
static mode(numbers) {
|
|
7947
|
+
const modeMap = /* @__PURE__ */ new Map();
|
|
7948
|
+
numbers.forEach((value) => {
|
|
7949
|
+
if (modeMap.has(value)) {
|
|
7950
|
+
modeMap.set(value, modeMap.get(value) + 1);
|
|
7951
|
+
} else {
|
|
7952
|
+
modeMap.set(value, 1);
|
|
7953
|
+
}
|
|
7954
|
+
});
|
|
7955
|
+
let maxFrequency = 0;
|
|
7956
|
+
for (const numberFrequency of modeMap.values()) {
|
|
7957
|
+
if (numberFrequency > maxFrequency) {
|
|
7958
|
+
maxFrequency = numberFrequency;
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7961
|
+
const modeResult = [];
|
|
7962
|
+
for (const [key, value] of modeMap.entries()) {
|
|
7963
|
+
if (value === maxFrequency) {
|
|
7964
|
+
modeResult.push(key);
|
|
7965
|
+
}
|
|
7966
|
+
}
|
|
7967
|
+
return {
|
|
7968
|
+
modeResult,
|
|
7969
|
+
maxFrequency
|
|
7970
|
+
};
|
|
7971
|
+
}
|
|
7972
|
+
/**
|
|
7973
|
+
* Find the minimum value in an array of numbers
|
|
7974
|
+
* @param numbers - Array of numbers to find the minimum of
|
|
7975
|
+
* @returns The minimum value
|
|
7976
|
+
*/
|
|
7977
|
+
static min(numbers) {
|
|
7978
|
+
const minValue = Math.min(...numbers);
|
|
7979
|
+
return minValue;
|
|
7980
|
+
}
|
|
7981
|
+
/**
|
|
7982
|
+
* Find the maximum value in an array of numbers
|
|
7983
|
+
* @param numbers - Array of numbers to find the maximum of
|
|
7984
|
+
* @returns The maximum value
|
|
7985
|
+
*/
|
|
7986
|
+
static max(numbers) {
|
|
7987
|
+
const maxValue = Math.max(...numbers);
|
|
7988
|
+
return maxValue;
|
|
7989
|
+
}
|
|
7990
|
+
};
|
|
7991
|
+
|
|
7992
|
+
// src/templates/tools/utils/trigonometric.ts
|
|
7993
|
+
var Trigonometric = class {
|
|
7994
|
+
/**
|
|
7995
|
+
* Calculate the sin of a number in radians
|
|
7996
|
+
* @param number - The number to find the sin of
|
|
7997
|
+
* @returns The sin of a number in radians
|
|
7998
|
+
*/
|
|
7999
|
+
static sin(number) {
|
|
8000
|
+
const sin = Math.sin(number);
|
|
8001
|
+
return sin;
|
|
8002
|
+
}
|
|
8003
|
+
/**
|
|
8004
|
+
* Calculate the arcsin of a number in radians
|
|
8005
|
+
* @param number - The number to find the arcsin of
|
|
8006
|
+
* @returns The arcsin of a number in radians
|
|
8007
|
+
*/
|
|
8008
|
+
static arcsin(number) {
|
|
8009
|
+
const arcsin = Math.asin(number);
|
|
8010
|
+
return arcsin;
|
|
8011
|
+
}
|
|
8012
|
+
/**
|
|
8013
|
+
* Calculate the cos of a number in radians
|
|
8014
|
+
* @param number - The number to find the cos of
|
|
8015
|
+
* @returns The cos of a number in radians
|
|
8016
|
+
*/
|
|
8017
|
+
static cos(number) {
|
|
8018
|
+
const cos = Math.cos(number);
|
|
8019
|
+
return cos;
|
|
8020
|
+
}
|
|
8021
|
+
/**
|
|
8022
|
+
* Calculate the arccos of a number in radians
|
|
8023
|
+
* @param number - The number to find the arccos of
|
|
8024
|
+
* @returns The arccos of a number in radians
|
|
8025
|
+
*/
|
|
8026
|
+
static arccos(number) {
|
|
8027
|
+
const arccos = Math.acos(number);
|
|
8028
|
+
return arccos;
|
|
8029
|
+
}
|
|
8030
|
+
/**
|
|
8031
|
+
* Calculate the tangent of a number in radians
|
|
8032
|
+
* @param number - The number to find the tangent of
|
|
8033
|
+
* @returns The tangent of a number in radians
|
|
8034
|
+
*/
|
|
8035
|
+
static tan(number) {
|
|
8036
|
+
const tangent = Math.tan(number);
|
|
8037
|
+
return tangent;
|
|
8038
|
+
}
|
|
8039
|
+
/**
|
|
8040
|
+
* Calculate the arc tangent of a number in radians
|
|
8041
|
+
* @param number - The number to find the arc tangent of
|
|
8042
|
+
* @returns The arc tangent of a number in radians
|
|
8043
|
+
*/
|
|
8044
|
+
static arctan(number) {
|
|
8045
|
+
const arctangent = Math.atan(number);
|
|
8046
|
+
return arctangent;
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Converts a radian into its equivalent value in degrees
|
|
8050
|
+
* @param number - The number to get the degree of
|
|
8051
|
+
* @returns The degree of the number
|
|
8052
|
+
*/
|
|
8053
|
+
static radiansToDegrees(number) {
|
|
8054
|
+
const degrees = number * (180 / Math.PI);
|
|
8055
|
+
return degrees;
|
|
8056
|
+
}
|
|
8057
|
+
/**
|
|
8058
|
+
* Converts a degree into its equivalent value in radians
|
|
8059
|
+
* @param number - The number to get the radians of
|
|
8060
|
+
* @returns The radians of the number
|
|
8061
|
+
*/
|
|
8062
|
+
static degreesToRadians(number) {
|
|
8063
|
+
const radians = number * (Math.PI / 180);
|
|
8064
|
+
return radians;
|
|
8065
|
+
}
|
|
8066
|
+
};
|
|
8067
|
+
|
|
8068
|
+
// src/templates/tools/math.ts
|
|
8069
|
+
var additionTool = new ExuluTool2({
|
|
8070
|
+
id: "addition",
|
|
8071
|
+
name: "Addition",
|
|
8072
|
+
description: "Adds two numbers together",
|
|
8073
|
+
type: "function",
|
|
8074
|
+
config: [],
|
|
8075
|
+
inputSchema: z4.object({
|
|
8076
|
+
firstNumber: z4.number().describe("The first addend"),
|
|
8077
|
+
secondNumber: z4.number().describe("The second addend")
|
|
8078
|
+
}),
|
|
8079
|
+
execute: async ({ firstNumber, secondNumber }) => {
|
|
8080
|
+
const value = Arithmetic.add(firstNumber, secondNumber);
|
|
8081
|
+
return { result: `${value}` };
|
|
8082
|
+
}
|
|
8083
|
+
});
|
|
8084
|
+
var subtractionTool = new ExuluTool2({
|
|
8085
|
+
id: "subtraction",
|
|
8086
|
+
name: "Subtraction",
|
|
8087
|
+
description: "Subtracts the second number from the first number",
|
|
8088
|
+
type: "function",
|
|
8089
|
+
config: [],
|
|
8090
|
+
inputSchema: z4.object({
|
|
8091
|
+
minuend: z4.number().describe("The number to subtract from (minuend)"),
|
|
8092
|
+
subtrahend: z4.number().describe("The number being subtracted (subtrahend)")
|
|
8093
|
+
}),
|
|
8094
|
+
execute: async ({ minuend, subtrahend }) => {
|
|
8095
|
+
const value = Arithmetic.subtract(minuend, subtrahend);
|
|
8096
|
+
return { result: `${value}` };
|
|
8097
|
+
}
|
|
8098
|
+
});
|
|
8099
|
+
var multiplicationTool = new ExuluTool2({
|
|
8100
|
+
id: "multiplication",
|
|
8101
|
+
name: "Multiplication",
|
|
8102
|
+
description: "Multiplies two numbers together",
|
|
8103
|
+
type: "function",
|
|
8104
|
+
config: [],
|
|
8105
|
+
inputSchema: z4.object({
|
|
8106
|
+
firstNumber: z4.number().describe("The first number"),
|
|
8107
|
+
SecondNumber: z4.number().describe("The second number")
|
|
8108
|
+
}),
|
|
8109
|
+
execute: async ({ firstNumber, SecondNumber }) => {
|
|
8110
|
+
const value = Arithmetic.multiply(firstNumber, SecondNumber);
|
|
8111
|
+
return { result: `${value}` };
|
|
8112
|
+
}
|
|
8113
|
+
});
|
|
8114
|
+
var divisionTool = new ExuluTool2({
|
|
8115
|
+
id: "division",
|
|
8116
|
+
name: "Division",
|
|
8117
|
+
description: "Divides the first number by the second number",
|
|
8118
|
+
type: "function",
|
|
8119
|
+
config: [],
|
|
8120
|
+
inputSchema: z4.object({
|
|
8121
|
+
numerator: z4.number().describe("The number being divided (numerator)"),
|
|
8122
|
+
denominator: z4.number().describe("The number to divide by (denominator)")
|
|
8123
|
+
}),
|
|
8124
|
+
execute: async ({ numerator, denominator }) => {
|
|
8125
|
+
const value = Arithmetic.division(numerator, denominator);
|
|
8126
|
+
return { result: `${value}` };
|
|
8127
|
+
}
|
|
8128
|
+
});
|
|
8129
|
+
var sumTool = new ExuluTool2({
|
|
8130
|
+
id: "sum",
|
|
8131
|
+
name: "Sum",
|
|
8132
|
+
description: "Adds any number of numbers together",
|
|
8133
|
+
type: "function",
|
|
8134
|
+
config: [],
|
|
8135
|
+
inputSchema: z4.object({
|
|
8136
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to sum")
|
|
8137
|
+
}),
|
|
8138
|
+
execute: async ({ numbers }) => {
|
|
8139
|
+
const value = Arithmetic.sum(numbers);
|
|
8140
|
+
return { result: `${value}` };
|
|
8141
|
+
}
|
|
8142
|
+
});
|
|
8143
|
+
var moduloTool = new ExuluTool2({
|
|
8144
|
+
id: "modulo",
|
|
8145
|
+
name: "Modulo",
|
|
8146
|
+
description: "Divides two numbers and returns the remainder",
|
|
8147
|
+
type: "function",
|
|
8148
|
+
config: [],
|
|
8149
|
+
inputSchema: z4.object({
|
|
8150
|
+
numerator: z4.number().describe("The number being divided (numerator)"),
|
|
8151
|
+
denominator: z4.number().describe("The number to divide by (denominator)")
|
|
8152
|
+
}),
|
|
8153
|
+
execute: async ({ numerator, denominator }) => {
|
|
8154
|
+
const value = Arithmetic.modulo(numerator, denominator);
|
|
8155
|
+
return { result: `${value}` };
|
|
8156
|
+
}
|
|
8157
|
+
});
|
|
8158
|
+
var meanTool = new ExuluTool2({
|
|
8159
|
+
id: "mean",
|
|
8160
|
+
name: "Mean",
|
|
8161
|
+
description: "Calculates the arithmetic mean of a list of numbers",
|
|
8162
|
+
type: "function",
|
|
8163
|
+
config: [],
|
|
8164
|
+
inputSchema: z4.object({
|
|
8165
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the mean of")
|
|
8166
|
+
}),
|
|
8167
|
+
execute: async ({ numbers }) => {
|
|
8168
|
+
const value = Statistics.mean(numbers);
|
|
8169
|
+
return { result: `${value}` };
|
|
8170
|
+
}
|
|
8171
|
+
});
|
|
8172
|
+
var medianTool = new ExuluTool2({
|
|
8173
|
+
id: "median",
|
|
8174
|
+
name: "Median",
|
|
8175
|
+
description: "Calculates the median of a list of numbers",
|
|
8176
|
+
type: "function",
|
|
8177
|
+
config: [],
|
|
8178
|
+
inputSchema: z4.object({
|
|
8179
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the median of")
|
|
8180
|
+
}),
|
|
8181
|
+
execute: async ({ numbers }) => {
|
|
8182
|
+
const value = Statistics.median(numbers);
|
|
8183
|
+
return { result: `${value}` };
|
|
8184
|
+
}
|
|
8185
|
+
});
|
|
8186
|
+
var modeTool = new ExuluTool2({
|
|
8187
|
+
id: "mode",
|
|
8188
|
+
name: "Mode",
|
|
8189
|
+
description: "Finds the most common number in a list of numbers",
|
|
8190
|
+
type: "function",
|
|
8191
|
+
config: [],
|
|
8192
|
+
inputSchema: z4.object({
|
|
8193
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the mode of")
|
|
8194
|
+
}),
|
|
8195
|
+
execute: async ({ numbers }) => {
|
|
8196
|
+
const value = Statistics.mode(numbers);
|
|
8197
|
+
return { result: `Entries (${value.modeResult.join(", ")}) appeared ${value.maxFrequency} times` };
|
|
8198
|
+
}
|
|
8199
|
+
});
|
|
8200
|
+
var minTool = new ExuluTool2({
|
|
8201
|
+
id: "min",
|
|
8202
|
+
name: "Minimum",
|
|
8203
|
+
description: "Finds the minimum value from a list of numbers",
|
|
8204
|
+
type: "function",
|
|
8205
|
+
config: [],
|
|
8206
|
+
inputSchema: z4.object({
|
|
8207
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the minimum of")
|
|
8208
|
+
}),
|
|
8209
|
+
execute: async ({ numbers }) => {
|
|
8210
|
+
const value = Statistics.min(numbers);
|
|
8211
|
+
return { result: `${value}` };
|
|
8212
|
+
}
|
|
8213
|
+
});
|
|
8214
|
+
var maxTool = new ExuluTool2({
|
|
8215
|
+
id: "max",
|
|
8216
|
+
name: "Maximum",
|
|
8217
|
+
description: "Finds the maximum value from a list of numbers",
|
|
8218
|
+
type: "function",
|
|
8219
|
+
config: [],
|
|
8220
|
+
inputSchema: z4.object({
|
|
8221
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the maximum of")
|
|
8222
|
+
}),
|
|
8223
|
+
execute: async ({ numbers }) => {
|
|
8224
|
+
const value = Statistics.max(numbers);
|
|
8225
|
+
return { result: `${value}` };
|
|
8226
|
+
}
|
|
8227
|
+
});
|
|
8228
|
+
var floorTool = new ExuluTool2({
|
|
8229
|
+
id: "floor",
|
|
8230
|
+
name: "Floor",
|
|
8231
|
+
description: "Rounds a number down to the nearest integer",
|
|
8232
|
+
type: "function",
|
|
8233
|
+
config: [],
|
|
8234
|
+
inputSchema: z4.object({
|
|
8235
|
+
number: z4.number().describe("The number to round down")
|
|
8236
|
+
}),
|
|
8237
|
+
execute: async ({ number }) => {
|
|
8238
|
+
const value = Arithmetic.floor(number);
|
|
8239
|
+
return { result: `${value}` };
|
|
8240
|
+
}
|
|
8241
|
+
});
|
|
8242
|
+
var ceilingTool = new ExuluTool2({
|
|
8243
|
+
id: "ceiling",
|
|
8244
|
+
name: "Ceiling",
|
|
8245
|
+
description: "Rounds a number up to the nearest integer",
|
|
8246
|
+
type: "function",
|
|
8247
|
+
config: [],
|
|
8248
|
+
inputSchema: z4.object({
|
|
8249
|
+
number: z4.number().describe("The number to round up")
|
|
8250
|
+
}),
|
|
8251
|
+
execute: async ({ number }) => {
|
|
8252
|
+
const value = Arithmetic.ceil(number);
|
|
8253
|
+
return { result: `${value}` };
|
|
8254
|
+
}
|
|
8255
|
+
});
|
|
8256
|
+
var roundTool = new ExuluTool2({
|
|
8257
|
+
id: "round",
|
|
8258
|
+
name: "Round",
|
|
8259
|
+
description: "Rounds a number to the nearest integer",
|
|
8260
|
+
type: "function",
|
|
8261
|
+
config: [],
|
|
8262
|
+
inputSchema: z4.object({
|
|
8263
|
+
number: z4.number().describe("The number to round")
|
|
8264
|
+
}),
|
|
8265
|
+
execute: async ({ number }) => {
|
|
8266
|
+
const value = Arithmetic.round(number);
|
|
8267
|
+
return { result: `${value}` };
|
|
8268
|
+
}
|
|
8269
|
+
});
|
|
8270
|
+
var sinTool = new ExuluTool2({
|
|
8271
|
+
id: "sin",
|
|
8272
|
+
name: "Sine",
|
|
8273
|
+
description: "Calculates the sine of a number in radians",
|
|
8274
|
+
type: "function",
|
|
8275
|
+
config: [],
|
|
8276
|
+
inputSchema: z4.object({
|
|
8277
|
+
number: z4.number().describe("The number in radians to find the sine of")
|
|
8278
|
+
}),
|
|
8279
|
+
execute: async ({ number }) => {
|
|
8280
|
+
const value = Trigonometric.sin(number);
|
|
8281
|
+
return { result: `${value}` };
|
|
8282
|
+
}
|
|
8283
|
+
});
|
|
8284
|
+
var arcsinTool = new ExuluTool2({
|
|
8285
|
+
id: "arcsin",
|
|
8286
|
+
name: "Arcsine",
|
|
8287
|
+
description: "Calculates the arcsine of a number in radians",
|
|
8288
|
+
type: "function",
|
|
8289
|
+
config: [],
|
|
8290
|
+
inputSchema: z4.object({
|
|
8291
|
+
number: z4.number().describe("The number to find the arcsine of")
|
|
8292
|
+
}),
|
|
8293
|
+
execute: async ({ number }) => {
|
|
8294
|
+
const value = Trigonometric.arcsin(number);
|
|
8295
|
+
return { result: `${value}` };
|
|
8296
|
+
}
|
|
8297
|
+
});
|
|
8298
|
+
var cosTool = new ExuluTool2({
|
|
8299
|
+
id: "cos",
|
|
8300
|
+
name: "Cosine",
|
|
8301
|
+
description: "Calculates the cosine of a number in radians",
|
|
8302
|
+
type: "function",
|
|
8303
|
+
config: [],
|
|
8304
|
+
inputSchema: z4.object({
|
|
8305
|
+
number: z4.number().describe("The number in radians to find the cosine of")
|
|
8306
|
+
}),
|
|
8307
|
+
execute: async ({ number }) => {
|
|
8308
|
+
const value = Trigonometric.cos(number);
|
|
8309
|
+
return { result: `${value}` };
|
|
8310
|
+
}
|
|
8311
|
+
});
|
|
8312
|
+
var arccosTool = new ExuluTool2({
|
|
8313
|
+
id: "arccos",
|
|
8314
|
+
name: "Arccosine",
|
|
8315
|
+
description: "Calculates the arccosine of a number in radians",
|
|
8316
|
+
type: "function",
|
|
8317
|
+
config: [],
|
|
8318
|
+
inputSchema: z4.object({
|
|
8319
|
+
number: z4.number().describe("The number to find the arccosine of")
|
|
8320
|
+
}),
|
|
8321
|
+
execute: async ({ number }) => {
|
|
8322
|
+
const value = Trigonometric.arccos(number);
|
|
8323
|
+
return { result: `${value}` };
|
|
8324
|
+
}
|
|
8325
|
+
});
|
|
8326
|
+
var tanTool = new ExuluTool2({
|
|
8327
|
+
id: "tan",
|
|
8328
|
+
name: "Tangent",
|
|
8329
|
+
description: "Calculates the tangent of a number in radians",
|
|
8330
|
+
type: "function",
|
|
8331
|
+
config: [],
|
|
8332
|
+
inputSchema: z4.object({
|
|
8333
|
+
number: z4.number().describe("The number in radians to find the tangent of")
|
|
8334
|
+
}),
|
|
8335
|
+
execute: async ({ number }) => {
|
|
8336
|
+
const value = Trigonometric.tan(number);
|
|
8337
|
+
return { result: `${value}` };
|
|
8338
|
+
}
|
|
8339
|
+
});
|
|
8340
|
+
var arctanTool = new ExuluTool2({
|
|
8341
|
+
id: "arctan",
|
|
8342
|
+
name: "Arctangent",
|
|
8343
|
+
description: "Calculates the arctangent of a number in radians",
|
|
8344
|
+
type: "function",
|
|
8345
|
+
config: [],
|
|
8346
|
+
inputSchema: z4.object({
|
|
8347
|
+
number: z4.number().describe("The number to find the arctangent of")
|
|
8348
|
+
}),
|
|
8349
|
+
execute: async ({ number }) => {
|
|
8350
|
+
const value = Trigonometric.arctan(number);
|
|
8351
|
+
return { result: `${value}` };
|
|
8352
|
+
}
|
|
8353
|
+
});
|
|
8354
|
+
var radiansToDegreesTool = new ExuluTool2({
|
|
8355
|
+
id: "radiansToDegrees",
|
|
8356
|
+
name: "Radians to Degrees",
|
|
8357
|
+
description: "Converts a radian value to its equivalent in degrees",
|
|
8358
|
+
type: "function",
|
|
8359
|
+
config: [],
|
|
8360
|
+
inputSchema: z4.object({
|
|
8361
|
+
number: z4.number().describe("The number in radians to convert to degrees")
|
|
8362
|
+
}),
|
|
8363
|
+
execute: async ({ number }) => {
|
|
8364
|
+
const value = Trigonometric.radiansToDegrees(number);
|
|
8365
|
+
return { result: `${value}` };
|
|
8366
|
+
}
|
|
8367
|
+
});
|
|
8368
|
+
var degreesToRadiansTool = new ExuluTool2({
|
|
8369
|
+
id: "degreesToRadians",
|
|
8370
|
+
name: "Degrees to Radians",
|
|
8371
|
+
description: "Converts a degree value to its equivalent in radians",
|
|
8372
|
+
type: "function",
|
|
8373
|
+
config: [],
|
|
8374
|
+
inputSchema: z4.object({
|
|
8375
|
+
number: z4.number().describe("The number in degrees to convert to radians")
|
|
8376
|
+
}),
|
|
8377
|
+
execute: async ({ number }) => {
|
|
8378
|
+
const value = Trigonometric.degreesToRadians(number);
|
|
8379
|
+
return { result: `${value}` };
|
|
8380
|
+
}
|
|
8381
|
+
});
|
|
8382
|
+
var mathTools = [
|
|
8383
|
+
additionTool,
|
|
8384
|
+
subtractionTool,
|
|
8385
|
+
multiplicationTool,
|
|
8386
|
+
divisionTool,
|
|
8387
|
+
sumTool,
|
|
8388
|
+
moduloTool,
|
|
8389
|
+
meanTool,
|
|
8390
|
+
medianTool,
|
|
8391
|
+
modeTool,
|
|
8392
|
+
minTool,
|
|
8393
|
+
maxTool,
|
|
8394
|
+
floorTool,
|
|
8395
|
+
ceilingTool,
|
|
8396
|
+
roundTool,
|
|
8397
|
+
sinTool,
|
|
8398
|
+
arcsinTool,
|
|
8399
|
+
cosTool,
|
|
8400
|
+
arccosTool,
|
|
8401
|
+
tanTool,
|
|
8402
|
+
arctanTool,
|
|
8403
|
+
radiansToDegreesTool,
|
|
8404
|
+
degreesToRadiansTool
|
|
8405
|
+
];
|
|
8406
|
+
|
|
7809
8407
|
// src/registry/index.ts
|
|
7810
8408
|
var isDev = process.env.NODE_ENV !== "production";
|
|
7811
8409
|
var consoleTransport = new winston2.transports.Console({
|
|
@@ -7835,7 +8433,7 @@ var isValidPostgresName = (id) => {
|
|
|
7835
8433
|
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
7836
8434
|
const isValid = regex.test(id);
|
|
7837
8435
|
const length = id.length;
|
|
7838
|
-
return isValid && length <= 80 && length >
|
|
8436
|
+
return isValid && length <= 80 && length > 2;
|
|
7839
8437
|
};
|
|
7840
8438
|
var ExuluApp = class {
|
|
7841
8439
|
_agents = [];
|
|
@@ -7877,6 +8475,7 @@ var ExuluApp = class {
|
|
|
7877
8475
|
this._config = config;
|
|
7878
8476
|
this._tools = [
|
|
7879
8477
|
...tools ?? [],
|
|
8478
|
+
...mathTools,
|
|
7880
8479
|
// Add contexts as tools
|
|
7881
8480
|
...Object.values(contexts || {}).map((context) => context.tool())
|
|
7882
8481
|
// Because agents are stored in the database, we add those as tools
|