@exulu/backend 1.28.2 → 1.30.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 +676 -19
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +676 -19
- package/package.json +1 -1
- package/types/models/tool.ts +1 -0
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",
|
|
@@ -2522,11 +2532,14 @@ var addAgentFields = async (requestedFields, agents, result, tools, user) => {
|
|
|
2522
2532
|
} else {
|
|
2523
2533
|
hydrated = tools.find((t) => t.id === tool2.id);
|
|
2524
2534
|
}
|
|
2525
|
-
|
|
2535
|
+
const hydratedTool = {
|
|
2526
2536
|
...tool2,
|
|
2527
2537
|
name: hydrated?.name || "",
|
|
2528
|
-
description: hydrated?.description || ""
|
|
2538
|
+
description: hydrated?.description || "",
|
|
2539
|
+
category: tool2?.category || "default"
|
|
2529
2540
|
};
|
|
2541
|
+
console.log("[EXULU] hydratedTool", hydratedTool);
|
|
2542
|
+
return hydratedTool;
|
|
2530
2543
|
}));
|
|
2531
2544
|
result.tools = result.tools.filter((tool2) => tool2 !== null);
|
|
2532
2545
|
} else {
|
|
@@ -3470,7 +3483,8 @@ type PageInfo {
|
|
|
3470
3483
|
deleteJob(queue: QueueEnum!, id: String!): JobActionReturnPayload
|
|
3471
3484
|
`;
|
|
3472
3485
|
typeDefs += `
|
|
3473
|
-
tools: ToolPaginationResult
|
|
3486
|
+
tools(search: String, category: String, limit: Int, page: Int): ToolPaginationResult
|
|
3487
|
+
toolCategories: [String!]!
|
|
3474
3488
|
`;
|
|
3475
3489
|
typeDefs += `
|
|
3476
3490
|
jobs(queue: QueueEnum!, statusses: [JobStateEnum!]): JobPaginationResult
|
|
@@ -3790,6 +3804,7 @@ type PageInfo {
|
|
|
3790
3804
|
};
|
|
3791
3805
|
resolvers.Query["tools"] = async (_, args, context, info) => {
|
|
3792
3806
|
const requestedFields = getRequestedFields(info);
|
|
3807
|
+
const { search, category, limit = 100, page = 0 } = args;
|
|
3793
3808
|
const instances = await loadAgents();
|
|
3794
3809
|
let agentTools = await Promise.all(
|
|
3795
3810
|
instances.map(async (instance) => {
|
|
@@ -3801,16 +3816,39 @@ type PageInfo {
|
|
|
3801
3816
|
})
|
|
3802
3817
|
);
|
|
3803
3818
|
const filtered = agentTools.filter((tool2) => tool2 !== null);
|
|
3819
|
+
let allTools = [...filtered, ...tools];
|
|
3820
|
+
if (search && search.trim()) {
|
|
3821
|
+
const searchTerm = search.toLowerCase().trim();
|
|
3822
|
+
allTools = allTools.filter(
|
|
3823
|
+
(tool2) => tool2.name?.toLowerCase().includes(searchTerm) || tool2.description?.toLowerCase().includes(searchTerm)
|
|
3824
|
+
);
|
|
3825
|
+
}
|
|
3826
|
+
if (category && category.trim()) {
|
|
3827
|
+
allTools = allTools.filter((tool2) => tool2.category === category);
|
|
3828
|
+
}
|
|
3829
|
+
const total = allTools.length;
|
|
3830
|
+
const start = page * limit;
|
|
3831
|
+
const end = start + limit;
|
|
3832
|
+
const paginatedTools = allTools.slice(start, end);
|
|
3804
3833
|
return {
|
|
3805
|
-
items:
|
|
3834
|
+
items: paginatedTools.map((tool2) => {
|
|
3806
3835
|
const object = {};
|
|
3807
3836
|
requestedFields.forEach((field) => {
|
|
3808
3837
|
object[field] = tool2[field];
|
|
3809
3838
|
});
|
|
3810
3839
|
return object;
|
|
3811
|
-
})
|
|
3840
|
+
}),
|
|
3841
|
+
total,
|
|
3842
|
+
page,
|
|
3843
|
+
limit
|
|
3812
3844
|
};
|
|
3813
3845
|
};
|
|
3846
|
+
resolvers.Query["toolCategories"] = async () => {
|
|
3847
|
+
const array = tools.map((tool2) => tool2.category).filter((category) => category && typeof category === "string");
|
|
3848
|
+
array.push("contexts");
|
|
3849
|
+
array.push("agents");
|
|
3850
|
+
return [...new Set(array)].sort();
|
|
3851
|
+
};
|
|
3814
3852
|
modelDefs += `
|
|
3815
3853
|
type ProviderPaginationResult {
|
|
3816
3854
|
items: [Provider]!
|
|
@@ -3849,6 +3887,9 @@ type PageInfo {
|
|
|
3849
3887
|
modelDefs += `
|
|
3850
3888
|
type ToolPaginationResult {
|
|
3851
3889
|
items: [Tool]!
|
|
3890
|
+
total: Int!
|
|
3891
|
+
page: Int!
|
|
3892
|
+
limit: Int!
|
|
3852
3893
|
}
|
|
3853
3894
|
`;
|
|
3854
3895
|
modelDefs += `
|
|
@@ -3958,6 +3999,7 @@ type Tool {
|
|
|
3958
3999
|
id: ID!
|
|
3959
4000
|
name: String!
|
|
3960
4001
|
description: String
|
|
4002
|
+
category: String
|
|
3961
4003
|
type: String
|
|
3962
4004
|
config: JSON
|
|
3963
4005
|
}
|
|
@@ -4313,7 +4355,7 @@ var createUppyRoutes = async (app, config) => {
|
|
|
4313
4355
|
const client2 = getS3Client(config);
|
|
4314
4356
|
const command = new import_client_s3.ListObjectsV2Command({
|
|
4315
4357
|
Bucket: config.fileUploads.s3Bucket,
|
|
4316
|
-
Prefix:
|
|
4358
|
+
Prefix: `${config.fileUploads.s3prefix ? config.fileUploads.s3prefix.replace(/\/$/, "") + "/" : ""}${authenticationResult.user.id}`,
|
|
4317
4359
|
MaxKeys: 9,
|
|
4318
4360
|
...req.query.continuationToken && { ContinuationToken: req.query.continuationToken }
|
|
4319
4361
|
});
|
|
@@ -4846,6 +4888,7 @@ var ExuluAgent2 = class {
|
|
|
4846
4888
|
id: agentInstance.id,
|
|
4847
4889
|
name: `${agentInstance.name}`,
|
|
4848
4890
|
type: "agent",
|
|
4891
|
+
category: "agents",
|
|
4849
4892
|
inputSchema: import_zod.z.object({
|
|
4850
4893
|
prompt: import_zod.z.string().describe("The prompt (usually a question for the agent) to send to the agent."),
|
|
4851
4894
|
information: import_zod.z.string().describe("A summary of relevant context / information from the current session")
|
|
@@ -5274,13 +5317,15 @@ var ExuluTool2 = class {
|
|
|
5274
5317
|
id;
|
|
5275
5318
|
name;
|
|
5276
5319
|
description;
|
|
5320
|
+
category;
|
|
5277
5321
|
inputSchema;
|
|
5278
5322
|
type;
|
|
5279
5323
|
tool;
|
|
5280
5324
|
config;
|
|
5281
|
-
constructor({ id, name, description, inputSchema, type, execute: execute2, config }) {
|
|
5325
|
+
constructor({ id, name, description, category, inputSchema, type, execute: execute2, config }) {
|
|
5282
5326
|
this.id = id;
|
|
5283
5327
|
this.config = config;
|
|
5328
|
+
this.category = category || "default";
|
|
5284
5329
|
this.name = name;
|
|
5285
5330
|
this.description = description;
|
|
5286
5331
|
this.inputSchema = inputSchema;
|
|
@@ -5709,6 +5754,7 @@ var ExuluContext = class {
|
|
|
5709
5754
|
id: this.id,
|
|
5710
5755
|
name: `${this.name}`,
|
|
5711
5756
|
type: "context",
|
|
5757
|
+
category: "contexts",
|
|
5712
5758
|
inputSchema: import_zod.z.object({
|
|
5713
5759
|
query: import_zod.z.string()
|
|
5714
5760
|
}),
|
|
@@ -7839,6 +7885,616 @@ var llmAsJudgeEval = new ExuluEval2({
|
|
|
7839
7885
|
llm: true
|
|
7840
7886
|
});
|
|
7841
7887
|
|
|
7888
|
+
// src/templates/tools/math.ts
|
|
7889
|
+
var import_zod4 = require("zod");
|
|
7890
|
+
|
|
7891
|
+
// src/templates/tools/utils/arithmetic.ts
|
|
7892
|
+
var Arithmetic = class {
|
|
7893
|
+
/**
|
|
7894
|
+
* Add two numbers together
|
|
7895
|
+
* @param firstNumber - The first number
|
|
7896
|
+
* @param secondNumber - The second number
|
|
7897
|
+
* @returns sum
|
|
7898
|
+
*/
|
|
7899
|
+
static add(firstNumber, secondNumber) {
|
|
7900
|
+
const sum = firstNumber + secondNumber;
|
|
7901
|
+
return sum;
|
|
7902
|
+
}
|
|
7903
|
+
/**
|
|
7904
|
+
* Subtract one number from another
|
|
7905
|
+
* @param minuend - The number to subtract from
|
|
7906
|
+
* @param subtrahend - The number to subtract
|
|
7907
|
+
* @returns difference
|
|
7908
|
+
*/
|
|
7909
|
+
static subtract(minuend, subtrahend) {
|
|
7910
|
+
const difference = minuend - subtrahend;
|
|
7911
|
+
return difference;
|
|
7912
|
+
}
|
|
7913
|
+
/**
|
|
7914
|
+
* Multiply two numbers together
|
|
7915
|
+
* @param firstNumber - The first number
|
|
7916
|
+
* @param secondNumber - The second number
|
|
7917
|
+
* @returns product
|
|
7918
|
+
*/
|
|
7919
|
+
static multiply(firstNumber, secondNumber) {
|
|
7920
|
+
const product = firstNumber * secondNumber;
|
|
7921
|
+
return product;
|
|
7922
|
+
}
|
|
7923
|
+
/**
|
|
7924
|
+
* Divide one number by another
|
|
7925
|
+
* @param numerator - The number to be divided
|
|
7926
|
+
* @param denominator - The number to divide by
|
|
7927
|
+
* @returns quotient
|
|
7928
|
+
*/
|
|
7929
|
+
static division(numerator, denominator) {
|
|
7930
|
+
const quotient = numerator / denominator;
|
|
7931
|
+
return quotient;
|
|
7932
|
+
}
|
|
7933
|
+
/**
|
|
7934
|
+
* Calculate the sum of an array of numbers
|
|
7935
|
+
* @param numbers - Array of numbers to sum
|
|
7936
|
+
* @returns sum of all numbers in the array
|
|
7937
|
+
*/
|
|
7938
|
+
static sum(numbers) {
|
|
7939
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7940
|
+
return sum;
|
|
7941
|
+
}
|
|
7942
|
+
/**
|
|
7943
|
+
* Calculate the floor of a number
|
|
7944
|
+
* @param number - Number to find the floor of
|
|
7945
|
+
* @returns floor of the number
|
|
7946
|
+
*/
|
|
7947
|
+
static floor(number) {
|
|
7948
|
+
const floor = Math.floor(number);
|
|
7949
|
+
return floor;
|
|
7950
|
+
}
|
|
7951
|
+
/**
|
|
7952
|
+
* Calculate the ceil of a number
|
|
7953
|
+
* @param number - Number to find the ceil of
|
|
7954
|
+
* @returns ceil of the number
|
|
7955
|
+
*/
|
|
7956
|
+
static ceil(number) {
|
|
7957
|
+
const ceil = Math.ceil(number);
|
|
7958
|
+
return ceil;
|
|
7959
|
+
}
|
|
7960
|
+
/**
|
|
7961
|
+
* Calculate the round of a number
|
|
7962
|
+
* @param number - Number to find the round of
|
|
7963
|
+
* @returns round of the number
|
|
7964
|
+
*/
|
|
7965
|
+
static round(number) {
|
|
7966
|
+
const round = Math.round(number);
|
|
7967
|
+
return round;
|
|
7968
|
+
}
|
|
7969
|
+
/**
|
|
7970
|
+
* Get the remainder of a division equation.
|
|
7971
|
+
* Ex: modulo(5,2) = 1
|
|
7972
|
+
* @param numerator - The number to be divided
|
|
7973
|
+
* @param denominator - The number to divide by
|
|
7974
|
+
* @returns remainder of division
|
|
7975
|
+
*/
|
|
7976
|
+
static modulo(numerator, denominator) {
|
|
7977
|
+
const remainder = numerator % denominator;
|
|
7978
|
+
return remainder;
|
|
7979
|
+
}
|
|
7980
|
+
};
|
|
7981
|
+
|
|
7982
|
+
// src/templates/tools/utils/statistics.ts
|
|
7983
|
+
var Statistics = class {
|
|
7984
|
+
/**
|
|
7985
|
+
* Calculate the arithmetic mean (average) of an array of numbers
|
|
7986
|
+
* @param numbers - Array of numbers to calculate the mean of
|
|
7987
|
+
* @returns The arithmetic mean value
|
|
7988
|
+
*/
|
|
7989
|
+
static mean(numbers) {
|
|
7990
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7991
|
+
const mean = sum / numbers.length;
|
|
7992
|
+
return mean;
|
|
7993
|
+
}
|
|
7994
|
+
/**
|
|
7995
|
+
* Calculate the median (middle value) of an array of numbers
|
|
7996
|
+
* @param numbers - Array of numbers to calculate the median of
|
|
7997
|
+
* @returns The median value
|
|
7998
|
+
*/
|
|
7999
|
+
static median(numbers) {
|
|
8000
|
+
numbers.sort();
|
|
8001
|
+
const medianIndex = numbers.length / 2;
|
|
8002
|
+
let medianValue;
|
|
8003
|
+
if (numbers.length % 2 !== 0) {
|
|
8004
|
+
medianValue = numbers[Math.floor(medianIndex)];
|
|
8005
|
+
} else {
|
|
8006
|
+
medianValue = (numbers[medianIndex] + numbers[medianIndex - 1]) / 2;
|
|
8007
|
+
}
|
|
8008
|
+
return medianValue;
|
|
8009
|
+
}
|
|
8010
|
+
/**
|
|
8011
|
+
* Calculate the mode (most frequent value(s)) of an array of numbers
|
|
8012
|
+
* @param numbers - Array of numbers to calculate the mode of
|
|
8013
|
+
* @returns Object containing the mode value(s) and their frequency
|
|
8014
|
+
*/
|
|
8015
|
+
static mode(numbers) {
|
|
8016
|
+
const modeMap = /* @__PURE__ */ new Map();
|
|
8017
|
+
numbers.forEach((value) => {
|
|
8018
|
+
if (modeMap.has(value)) {
|
|
8019
|
+
modeMap.set(value, modeMap.get(value) + 1);
|
|
8020
|
+
} else {
|
|
8021
|
+
modeMap.set(value, 1);
|
|
8022
|
+
}
|
|
8023
|
+
});
|
|
8024
|
+
let maxFrequency = 0;
|
|
8025
|
+
for (const numberFrequency of modeMap.values()) {
|
|
8026
|
+
if (numberFrequency > maxFrequency) {
|
|
8027
|
+
maxFrequency = numberFrequency;
|
|
8028
|
+
}
|
|
8029
|
+
}
|
|
8030
|
+
const modeResult = [];
|
|
8031
|
+
for (const [key, value] of modeMap.entries()) {
|
|
8032
|
+
if (value === maxFrequency) {
|
|
8033
|
+
modeResult.push(key);
|
|
8034
|
+
}
|
|
8035
|
+
}
|
|
8036
|
+
return {
|
|
8037
|
+
modeResult,
|
|
8038
|
+
maxFrequency
|
|
8039
|
+
};
|
|
8040
|
+
}
|
|
8041
|
+
/**
|
|
8042
|
+
* Find the minimum value in an array of numbers
|
|
8043
|
+
* @param numbers - Array of numbers to find the minimum of
|
|
8044
|
+
* @returns The minimum value
|
|
8045
|
+
*/
|
|
8046
|
+
static min(numbers) {
|
|
8047
|
+
const minValue = Math.min(...numbers);
|
|
8048
|
+
return minValue;
|
|
8049
|
+
}
|
|
8050
|
+
/**
|
|
8051
|
+
* Find the maximum value in an array of numbers
|
|
8052
|
+
* @param numbers - Array of numbers to find the maximum of
|
|
8053
|
+
* @returns The maximum value
|
|
8054
|
+
*/
|
|
8055
|
+
static max(numbers) {
|
|
8056
|
+
const maxValue = Math.max(...numbers);
|
|
8057
|
+
return maxValue;
|
|
8058
|
+
}
|
|
8059
|
+
};
|
|
8060
|
+
|
|
8061
|
+
// src/templates/tools/utils/trigonometric.ts
|
|
8062
|
+
var Trigonometric = class {
|
|
8063
|
+
/**
|
|
8064
|
+
* Calculate the sin of a number in radians
|
|
8065
|
+
* @param number - The number to find the sin of
|
|
8066
|
+
* @returns The sin of a number in radians
|
|
8067
|
+
*/
|
|
8068
|
+
static sin(number) {
|
|
8069
|
+
const sin = Math.sin(number);
|
|
8070
|
+
return sin;
|
|
8071
|
+
}
|
|
8072
|
+
/**
|
|
8073
|
+
* Calculate the arcsin of a number in radians
|
|
8074
|
+
* @param number - The number to find the arcsin of
|
|
8075
|
+
* @returns The arcsin of a number in radians
|
|
8076
|
+
*/
|
|
8077
|
+
static arcsin(number) {
|
|
8078
|
+
const arcsin = Math.asin(number);
|
|
8079
|
+
return arcsin;
|
|
8080
|
+
}
|
|
8081
|
+
/**
|
|
8082
|
+
* Calculate the cos of a number in radians
|
|
8083
|
+
* @param number - The number to find the cos of
|
|
8084
|
+
* @returns The cos of a number in radians
|
|
8085
|
+
*/
|
|
8086
|
+
static cos(number) {
|
|
8087
|
+
const cos = Math.cos(number);
|
|
8088
|
+
return cos;
|
|
8089
|
+
}
|
|
8090
|
+
/**
|
|
8091
|
+
* Calculate the arccos of a number in radians
|
|
8092
|
+
* @param number - The number to find the arccos of
|
|
8093
|
+
* @returns The arccos of a number in radians
|
|
8094
|
+
*/
|
|
8095
|
+
static arccos(number) {
|
|
8096
|
+
const arccos = Math.acos(number);
|
|
8097
|
+
return arccos;
|
|
8098
|
+
}
|
|
8099
|
+
/**
|
|
8100
|
+
* Calculate the tangent of a number in radians
|
|
8101
|
+
* @param number - The number to find the tangent of
|
|
8102
|
+
* @returns The tangent of a number in radians
|
|
8103
|
+
*/
|
|
8104
|
+
static tan(number) {
|
|
8105
|
+
const tangent = Math.tan(number);
|
|
8106
|
+
return tangent;
|
|
8107
|
+
}
|
|
8108
|
+
/**
|
|
8109
|
+
* Calculate the arc tangent of a number in radians
|
|
8110
|
+
* @param number - The number to find the arc tangent of
|
|
8111
|
+
* @returns The arc tangent of a number in radians
|
|
8112
|
+
*/
|
|
8113
|
+
static arctan(number) {
|
|
8114
|
+
const arctangent = Math.atan(number);
|
|
8115
|
+
return arctangent;
|
|
8116
|
+
}
|
|
8117
|
+
/**
|
|
8118
|
+
* Converts a radian into its equivalent value in degrees
|
|
8119
|
+
* @param number - The number to get the degree of
|
|
8120
|
+
* @returns The degree of the number
|
|
8121
|
+
*/
|
|
8122
|
+
static radiansToDegrees(number) {
|
|
8123
|
+
const degrees = number * (180 / Math.PI);
|
|
8124
|
+
return degrees;
|
|
8125
|
+
}
|
|
8126
|
+
/**
|
|
8127
|
+
* Converts a degree into its equivalent value in radians
|
|
8128
|
+
* @param number - The number to get the radians of
|
|
8129
|
+
* @returns The radians of the number
|
|
8130
|
+
*/
|
|
8131
|
+
static degreesToRadians(number) {
|
|
8132
|
+
const radians = number * (Math.PI / 180);
|
|
8133
|
+
return radians;
|
|
8134
|
+
}
|
|
8135
|
+
};
|
|
8136
|
+
|
|
8137
|
+
// src/templates/tools/math.ts
|
|
8138
|
+
var additionTool = new ExuluTool2({
|
|
8139
|
+
id: "addition",
|
|
8140
|
+
name: "Addition",
|
|
8141
|
+
description: "Adds two numbers together",
|
|
8142
|
+
type: "function",
|
|
8143
|
+
category: "math",
|
|
8144
|
+
config: [],
|
|
8145
|
+
inputSchema: import_zod4.z.object({
|
|
8146
|
+
firstNumber: import_zod4.z.number().describe("The first addend"),
|
|
8147
|
+
secondNumber: import_zod4.z.number().describe("The second addend")
|
|
8148
|
+
}),
|
|
8149
|
+
execute: async ({ firstNumber, secondNumber }) => {
|
|
8150
|
+
const value = Arithmetic.add(firstNumber, secondNumber);
|
|
8151
|
+
return { result: `${value}` };
|
|
8152
|
+
}
|
|
8153
|
+
});
|
|
8154
|
+
var subtractionTool = new ExuluTool2({
|
|
8155
|
+
id: "subtraction",
|
|
8156
|
+
name: "Subtraction",
|
|
8157
|
+
description: "Subtracts the second number from the first number",
|
|
8158
|
+
type: "function",
|
|
8159
|
+
category: "math",
|
|
8160
|
+
config: [],
|
|
8161
|
+
inputSchema: import_zod4.z.object({
|
|
8162
|
+
minuend: import_zod4.z.number().describe("The number to subtract from (minuend)"),
|
|
8163
|
+
subtrahend: import_zod4.z.number().describe("The number being subtracted (subtrahend)")
|
|
8164
|
+
}),
|
|
8165
|
+
execute: async ({ minuend, subtrahend }) => {
|
|
8166
|
+
const value = Arithmetic.subtract(minuend, subtrahend);
|
|
8167
|
+
return { result: `${value}` };
|
|
8168
|
+
}
|
|
8169
|
+
});
|
|
8170
|
+
var multiplicationTool = new ExuluTool2({
|
|
8171
|
+
id: "multiplication",
|
|
8172
|
+
name: "Multiplication",
|
|
8173
|
+
description: "Multiplies two numbers together",
|
|
8174
|
+
type: "function",
|
|
8175
|
+
category: "math",
|
|
8176
|
+
config: [],
|
|
8177
|
+
inputSchema: import_zod4.z.object({
|
|
8178
|
+
firstNumber: import_zod4.z.number().describe("The first number"),
|
|
8179
|
+
SecondNumber: import_zod4.z.number().describe("The second number")
|
|
8180
|
+
}),
|
|
8181
|
+
execute: async ({ firstNumber, SecondNumber }) => {
|
|
8182
|
+
const value = Arithmetic.multiply(firstNumber, SecondNumber);
|
|
8183
|
+
return { result: `${value}` };
|
|
8184
|
+
}
|
|
8185
|
+
});
|
|
8186
|
+
var divisionTool = new ExuluTool2({
|
|
8187
|
+
id: "division",
|
|
8188
|
+
name: "Division",
|
|
8189
|
+
description: "Divides the first number by the second number",
|
|
8190
|
+
type: "function",
|
|
8191
|
+
category: "math",
|
|
8192
|
+
config: [],
|
|
8193
|
+
inputSchema: import_zod4.z.object({
|
|
8194
|
+
numerator: import_zod4.z.number().describe("The number being divided (numerator)"),
|
|
8195
|
+
denominator: import_zod4.z.number().describe("The number to divide by (denominator)")
|
|
8196
|
+
}),
|
|
8197
|
+
execute: async ({ numerator, denominator }) => {
|
|
8198
|
+
const value = Arithmetic.division(numerator, denominator);
|
|
8199
|
+
return { result: `${value}` };
|
|
8200
|
+
}
|
|
8201
|
+
});
|
|
8202
|
+
var sumTool = new ExuluTool2({
|
|
8203
|
+
id: "sum",
|
|
8204
|
+
name: "Sum",
|
|
8205
|
+
description: "Adds any number of numbers together",
|
|
8206
|
+
type: "function",
|
|
8207
|
+
category: "math",
|
|
8208
|
+
config: [],
|
|
8209
|
+
inputSchema: import_zod4.z.object({
|
|
8210
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to sum")
|
|
8211
|
+
}),
|
|
8212
|
+
execute: async ({ numbers }) => {
|
|
8213
|
+
const value = Arithmetic.sum(numbers);
|
|
8214
|
+
return { result: `${value}` };
|
|
8215
|
+
}
|
|
8216
|
+
});
|
|
8217
|
+
var moduloTool = new ExuluTool2({
|
|
8218
|
+
id: "modulo",
|
|
8219
|
+
name: "Modulo",
|
|
8220
|
+
description: "Divides two numbers and returns the remainder",
|
|
8221
|
+
type: "function",
|
|
8222
|
+
category: "math",
|
|
8223
|
+
config: [],
|
|
8224
|
+
inputSchema: import_zod4.z.object({
|
|
8225
|
+
numerator: import_zod4.z.number().describe("The number being divided (numerator)"),
|
|
8226
|
+
denominator: import_zod4.z.number().describe("The number to divide by (denominator)")
|
|
8227
|
+
}),
|
|
8228
|
+
execute: async ({ numerator, denominator }) => {
|
|
8229
|
+
const value = Arithmetic.modulo(numerator, denominator);
|
|
8230
|
+
return { result: `${value}` };
|
|
8231
|
+
}
|
|
8232
|
+
});
|
|
8233
|
+
var meanTool = new ExuluTool2({
|
|
8234
|
+
id: "mean",
|
|
8235
|
+
name: "Mean",
|
|
8236
|
+
description: "Calculates the arithmetic mean of a list of numbers",
|
|
8237
|
+
type: "function",
|
|
8238
|
+
category: "math",
|
|
8239
|
+
config: [],
|
|
8240
|
+
inputSchema: import_zod4.z.object({
|
|
8241
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to find the mean of")
|
|
8242
|
+
}),
|
|
8243
|
+
execute: async ({ numbers }) => {
|
|
8244
|
+
const value = Statistics.mean(numbers);
|
|
8245
|
+
return { result: `${value}` };
|
|
8246
|
+
}
|
|
8247
|
+
});
|
|
8248
|
+
var medianTool = new ExuluTool2({
|
|
8249
|
+
id: "median",
|
|
8250
|
+
name: "Median",
|
|
8251
|
+
description: "Calculates the median of a list of numbers",
|
|
8252
|
+
type: "function",
|
|
8253
|
+
category: "math",
|
|
8254
|
+
config: [],
|
|
8255
|
+
inputSchema: import_zod4.z.object({
|
|
8256
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).min(1).describe("Array of numbers to find the median of")
|
|
8257
|
+
}),
|
|
8258
|
+
execute: async ({ numbers }) => {
|
|
8259
|
+
const value = Statistics.median(numbers);
|
|
8260
|
+
return { result: `${value}` };
|
|
8261
|
+
}
|
|
8262
|
+
});
|
|
8263
|
+
var modeTool = new ExuluTool2({
|
|
8264
|
+
id: "mode",
|
|
8265
|
+
name: "Mode",
|
|
8266
|
+
description: "Finds the most common number in a list of numbers",
|
|
8267
|
+
type: "function",
|
|
8268
|
+
category: "math",
|
|
8269
|
+
config: [],
|
|
8270
|
+
inputSchema: import_zod4.z.object({
|
|
8271
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the mode of")
|
|
8272
|
+
}),
|
|
8273
|
+
execute: async ({ numbers }) => {
|
|
8274
|
+
const value = Statistics.mode(numbers);
|
|
8275
|
+
return { result: `Entries (${value.modeResult.join(", ")}) appeared ${value.maxFrequency} times` };
|
|
8276
|
+
}
|
|
8277
|
+
});
|
|
8278
|
+
var minTool = new ExuluTool2({
|
|
8279
|
+
id: "min",
|
|
8280
|
+
name: "Minimum",
|
|
8281
|
+
description: "Finds the minimum value from a list of numbers",
|
|
8282
|
+
type: "function",
|
|
8283
|
+
category: "math",
|
|
8284
|
+
config: [],
|
|
8285
|
+
inputSchema: import_zod4.z.object({
|
|
8286
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the minimum of")
|
|
8287
|
+
}),
|
|
8288
|
+
execute: async ({ numbers }) => {
|
|
8289
|
+
const value = Statistics.min(numbers);
|
|
8290
|
+
return { result: `${value}` };
|
|
8291
|
+
}
|
|
8292
|
+
});
|
|
8293
|
+
var maxTool = new ExuluTool2({
|
|
8294
|
+
id: "max",
|
|
8295
|
+
name: "Maximum",
|
|
8296
|
+
description: "Finds the maximum value from a list of numbers",
|
|
8297
|
+
type: "function",
|
|
8298
|
+
category: "math",
|
|
8299
|
+
config: [],
|
|
8300
|
+
inputSchema: import_zod4.z.object({
|
|
8301
|
+
numbers: import_zod4.z.array(import_zod4.z.number()).describe("Array of numbers to find the maximum of")
|
|
8302
|
+
}),
|
|
8303
|
+
execute: async ({ numbers }) => {
|
|
8304
|
+
const value = Statistics.max(numbers);
|
|
8305
|
+
return { result: `${value}` };
|
|
8306
|
+
}
|
|
8307
|
+
});
|
|
8308
|
+
var floorTool = new ExuluTool2({
|
|
8309
|
+
id: "floor",
|
|
8310
|
+
name: "Floor",
|
|
8311
|
+
description: "Rounds a number down to the nearest integer",
|
|
8312
|
+
type: "function",
|
|
8313
|
+
category: "math",
|
|
8314
|
+
config: [],
|
|
8315
|
+
inputSchema: import_zod4.z.object({
|
|
8316
|
+
number: import_zod4.z.number().describe("The number to round down")
|
|
8317
|
+
}),
|
|
8318
|
+
execute: async ({ number }) => {
|
|
8319
|
+
const value = Arithmetic.floor(number);
|
|
8320
|
+
return { result: `${value}` };
|
|
8321
|
+
}
|
|
8322
|
+
});
|
|
8323
|
+
var ceilingTool = new ExuluTool2({
|
|
8324
|
+
id: "ceiling",
|
|
8325
|
+
name: "Ceiling",
|
|
8326
|
+
description: "Rounds a number up to the nearest integer",
|
|
8327
|
+
type: "function",
|
|
8328
|
+
category: "math",
|
|
8329
|
+
config: [],
|
|
8330
|
+
inputSchema: import_zod4.z.object({
|
|
8331
|
+
number: import_zod4.z.number().describe("The number to round up")
|
|
8332
|
+
}),
|
|
8333
|
+
execute: async ({ number }) => {
|
|
8334
|
+
const value = Arithmetic.ceil(number);
|
|
8335
|
+
return { result: `${value}` };
|
|
8336
|
+
}
|
|
8337
|
+
});
|
|
8338
|
+
var roundTool = new ExuluTool2({
|
|
8339
|
+
id: "round",
|
|
8340
|
+
name: "Round",
|
|
8341
|
+
description: "Rounds a number to the nearest integer",
|
|
8342
|
+
type: "function",
|
|
8343
|
+
category: "math",
|
|
8344
|
+
config: [],
|
|
8345
|
+
inputSchema: import_zod4.z.object({
|
|
8346
|
+
number: import_zod4.z.number().describe("The number to round")
|
|
8347
|
+
}),
|
|
8348
|
+
execute: async ({ number }) => {
|
|
8349
|
+
const value = Arithmetic.round(number);
|
|
8350
|
+
return { result: `${value}` };
|
|
8351
|
+
}
|
|
8352
|
+
});
|
|
8353
|
+
var sinTool = new ExuluTool2({
|
|
8354
|
+
id: "sin",
|
|
8355
|
+
name: "Sine",
|
|
8356
|
+
description: "Calculates the sine of a number in radians",
|
|
8357
|
+
type: "function",
|
|
8358
|
+
category: "math",
|
|
8359
|
+
config: [],
|
|
8360
|
+
inputSchema: import_zod4.z.object({
|
|
8361
|
+
number: import_zod4.z.number().describe("The number in radians to find the sine of")
|
|
8362
|
+
}),
|
|
8363
|
+
execute: async ({ number }) => {
|
|
8364
|
+
const value = Trigonometric.sin(number);
|
|
8365
|
+
return { result: `${value}` };
|
|
8366
|
+
}
|
|
8367
|
+
});
|
|
8368
|
+
var arcsinTool = new ExuluTool2({
|
|
8369
|
+
id: "arcsin",
|
|
8370
|
+
name: "Arcsine",
|
|
8371
|
+
description: "Calculates the arcsine of a number in radians",
|
|
8372
|
+
type: "function",
|
|
8373
|
+
category: "math",
|
|
8374
|
+
config: [],
|
|
8375
|
+
inputSchema: import_zod4.z.object({
|
|
8376
|
+
number: import_zod4.z.number().describe("The number to find the arcsine of")
|
|
8377
|
+
}),
|
|
8378
|
+
execute: async ({ number }) => {
|
|
8379
|
+
const value = Trigonometric.arcsin(number);
|
|
8380
|
+
return { result: `${value}` };
|
|
8381
|
+
}
|
|
8382
|
+
});
|
|
8383
|
+
var cosTool = new ExuluTool2({
|
|
8384
|
+
id: "cos",
|
|
8385
|
+
name: "Cosine",
|
|
8386
|
+
description: "Calculates the cosine of a number in radians",
|
|
8387
|
+
type: "function",
|
|
8388
|
+
category: "math",
|
|
8389
|
+
config: [],
|
|
8390
|
+
inputSchema: import_zod4.z.object({
|
|
8391
|
+
number: import_zod4.z.number().describe("The number in radians to find the cosine of")
|
|
8392
|
+
}),
|
|
8393
|
+
execute: async ({ number }) => {
|
|
8394
|
+
const value = Trigonometric.cos(number);
|
|
8395
|
+
return { result: `${value}` };
|
|
8396
|
+
}
|
|
8397
|
+
});
|
|
8398
|
+
var arccosTool = new ExuluTool2({
|
|
8399
|
+
id: "arccos",
|
|
8400
|
+
name: "Arccosine",
|
|
8401
|
+
description: "Calculates the arccosine of a number in radians",
|
|
8402
|
+
type: "function",
|
|
8403
|
+
category: "math",
|
|
8404
|
+
config: [],
|
|
8405
|
+
inputSchema: import_zod4.z.object({
|
|
8406
|
+
number: import_zod4.z.number().describe("The number to find the arccosine of")
|
|
8407
|
+
}),
|
|
8408
|
+
execute: async ({ number }) => {
|
|
8409
|
+
const value = Trigonometric.arccos(number);
|
|
8410
|
+
return { result: `${value}` };
|
|
8411
|
+
}
|
|
8412
|
+
});
|
|
8413
|
+
var tanTool = new ExuluTool2({
|
|
8414
|
+
id: "tan",
|
|
8415
|
+
name: "Tangent",
|
|
8416
|
+
description: "Calculates the tangent of a number in radians",
|
|
8417
|
+
type: "function",
|
|
8418
|
+
category: "math",
|
|
8419
|
+
config: [],
|
|
8420
|
+
inputSchema: import_zod4.z.object({
|
|
8421
|
+
number: import_zod4.z.number().describe("The number in radians to find the tangent of")
|
|
8422
|
+
}),
|
|
8423
|
+
execute: async ({ number }) => {
|
|
8424
|
+
const value = Trigonometric.tan(number);
|
|
8425
|
+
return { result: `${value}` };
|
|
8426
|
+
}
|
|
8427
|
+
});
|
|
8428
|
+
var arctanTool = new ExuluTool2({
|
|
8429
|
+
id: "arctan",
|
|
8430
|
+
name: "Arctangent",
|
|
8431
|
+
description: "Calculates the arctangent of a number in radians",
|
|
8432
|
+
type: "function",
|
|
8433
|
+
category: "math",
|
|
8434
|
+
config: [],
|
|
8435
|
+
inputSchema: import_zod4.z.object({
|
|
8436
|
+
number: import_zod4.z.number().describe("The number to find the arctangent of")
|
|
8437
|
+
}),
|
|
8438
|
+
execute: async ({ number }) => {
|
|
8439
|
+
const value = Trigonometric.arctan(number);
|
|
8440
|
+
return { result: `${value}` };
|
|
8441
|
+
}
|
|
8442
|
+
});
|
|
8443
|
+
var radiansToDegreesTool = new ExuluTool2({
|
|
8444
|
+
id: "radiansToDegrees",
|
|
8445
|
+
name: "Radians to Degrees",
|
|
8446
|
+
description: "Converts a radian value to its equivalent in degrees",
|
|
8447
|
+
type: "function",
|
|
8448
|
+
category: "math",
|
|
8449
|
+
config: [],
|
|
8450
|
+
inputSchema: import_zod4.z.object({
|
|
8451
|
+
number: import_zod4.z.number().describe("The number in radians to convert to degrees")
|
|
8452
|
+
}),
|
|
8453
|
+
execute: async ({ number }) => {
|
|
8454
|
+
const value = Trigonometric.radiansToDegrees(number);
|
|
8455
|
+
return { result: `${value}` };
|
|
8456
|
+
}
|
|
8457
|
+
});
|
|
8458
|
+
var degreesToRadiansTool = new ExuluTool2({
|
|
8459
|
+
id: "degreesToRadians",
|
|
8460
|
+
name: "Degrees to Radians",
|
|
8461
|
+
description: "Converts a degree value to its equivalent in radians",
|
|
8462
|
+
type: "function",
|
|
8463
|
+
category: "math",
|
|
8464
|
+
config: [],
|
|
8465
|
+
inputSchema: import_zod4.z.object({
|
|
8466
|
+
number: import_zod4.z.number().describe("The number in degrees to convert to radians")
|
|
8467
|
+
}),
|
|
8468
|
+
execute: async ({ number }) => {
|
|
8469
|
+
const value = Trigonometric.degreesToRadians(number);
|
|
8470
|
+
return { result: `${value}` };
|
|
8471
|
+
}
|
|
8472
|
+
});
|
|
8473
|
+
var mathTools = [
|
|
8474
|
+
additionTool,
|
|
8475
|
+
subtractionTool,
|
|
8476
|
+
multiplicationTool,
|
|
8477
|
+
divisionTool,
|
|
8478
|
+
sumTool,
|
|
8479
|
+
moduloTool,
|
|
8480
|
+
meanTool,
|
|
8481
|
+
medianTool,
|
|
8482
|
+
modeTool,
|
|
8483
|
+
minTool,
|
|
8484
|
+
maxTool,
|
|
8485
|
+
floorTool,
|
|
8486
|
+
ceilingTool,
|
|
8487
|
+
roundTool,
|
|
8488
|
+
sinTool,
|
|
8489
|
+
arcsinTool,
|
|
8490
|
+
cosTool,
|
|
8491
|
+
arccosTool,
|
|
8492
|
+
tanTool,
|
|
8493
|
+
arctanTool,
|
|
8494
|
+
radiansToDegreesTool,
|
|
8495
|
+
degreesToRadiansTool
|
|
8496
|
+
];
|
|
8497
|
+
|
|
7842
8498
|
// src/registry/index.ts
|
|
7843
8499
|
var isDev = process.env.NODE_ENV !== "production";
|
|
7844
8500
|
var consoleTransport = new import_winston2.default.transports.Console({
|
|
@@ -7868,7 +8524,7 @@ var isValidPostgresName = (id) => {
|
|
|
7868
8524
|
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
7869
8525
|
const isValid = regex.test(id);
|
|
7870
8526
|
const length = id.length;
|
|
7871
|
-
return isValid && length <= 80 && length >
|
|
8527
|
+
return isValid && length <= 80 && length > 2;
|
|
7872
8528
|
};
|
|
7873
8529
|
var ExuluApp = class {
|
|
7874
8530
|
_agents = [];
|
|
@@ -7910,6 +8566,7 @@ var ExuluApp = class {
|
|
|
7910
8566
|
this._config = config;
|
|
7911
8567
|
this._tools = [
|
|
7912
8568
|
...tools ?? [],
|
|
8569
|
+
...mathTools,
|
|
7913
8570
|
// Add contexts as tools
|
|
7914
8571
|
...Object.values(contexts || {}).map((context) => context.tool())
|
|
7915
8572
|
// Because agents are stored in the database, we add those as tools
|