@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.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",
|
|
@@ -2470,11 +2480,14 @@ var addAgentFields = async (requestedFields, agents, result, tools, user) => {
|
|
|
2470
2480
|
} else {
|
|
2471
2481
|
hydrated = tools.find((t) => t.id === tool2.id);
|
|
2472
2482
|
}
|
|
2473
|
-
|
|
2483
|
+
const hydratedTool = {
|
|
2474
2484
|
...tool2,
|
|
2475
2485
|
name: hydrated?.name || "",
|
|
2476
|
-
description: hydrated?.description || ""
|
|
2486
|
+
description: hydrated?.description || "",
|
|
2487
|
+
category: tool2?.category || "default"
|
|
2477
2488
|
};
|
|
2489
|
+
console.log("[EXULU] hydratedTool", hydratedTool);
|
|
2490
|
+
return hydratedTool;
|
|
2478
2491
|
}));
|
|
2479
2492
|
result.tools = result.tools.filter((tool2) => tool2 !== null);
|
|
2480
2493
|
} else {
|
|
@@ -3418,7 +3431,8 @@ type PageInfo {
|
|
|
3418
3431
|
deleteJob(queue: QueueEnum!, id: String!): JobActionReturnPayload
|
|
3419
3432
|
`;
|
|
3420
3433
|
typeDefs += `
|
|
3421
|
-
tools: ToolPaginationResult
|
|
3434
|
+
tools(search: String, category: String, limit: Int, page: Int): ToolPaginationResult
|
|
3435
|
+
toolCategories: [String!]!
|
|
3422
3436
|
`;
|
|
3423
3437
|
typeDefs += `
|
|
3424
3438
|
jobs(queue: QueueEnum!, statusses: [JobStateEnum!]): JobPaginationResult
|
|
@@ -3738,6 +3752,7 @@ type PageInfo {
|
|
|
3738
3752
|
};
|
|
3739
3753
|
resolvers.Query["tools"] = async (_, args, context, info) => {
|
|
3740
3754
|
const requestedFields = getRequestedFields(info);
|
|
3755
|
+
const { search, category, limit = 100, page = 0 } = args;
|
|
3741
3756
|
const instances = await loadAgents();
|
|
3742
3757
|
let agentTools = await Promise.all(
|
|
3743
3758
|
instances.map(async (instance) => {
|
|
@@ -3749,16 +3764,39 @@ type PageInfo {
|
|
|
3749
3764
|
})
|
|
3750
3765
|
);
|
|
3751
3766
|
const filtered = agentTools.filter((tool2) => tool2 !== null);
|
|
3767
|
+
let allTools = [...filtered, ...tools];
|
|
3768
|
+
if (search && search.trim()) {
|
|
3769
|
+
const searchTerm = search.toLowerCase().trim();
|
|
3770
|
+
allTools = allTools.filter(
|
|
3771
|
+
(tool2) => tool2.name?.toLowerCase().includes(searchTerm) || tool2.description?.toLowerCase().includes(searchTerm)
|
|
3772
|
+
);
|
|
3773
|
+
}
|
|
3774
|
+
if (category && category.trim()) {
|
|
3775
|
+
allTools = allTools.filter((tool2) => tool2.category === category);
|
|
3776
|
+
}
|
|
3777
|
+
const total = allTools.length;
|
|
3778
|
+
const start = page * limit;
|
|
3779
|
+
const end = start + limit;
|
|
3780
|
+
const paginatedTools = allTools.slice(start, end);
|
|
3752
3781
|
return {
|
|
3753
|
-
items:
|
|
3782
|
+
items: paginatedTools.map((tool2) => {
|
|
3754
3783
|
const object = {};
|
|
3755
3784
|
requestedFields.forEach((field) => {
|
|
3756
3785
|
object[field] = tool2[field];
|
|
3757
3786
|
});
|
|
3758
3787
|
return object;
|
|
3759
|
-
})
|
|
3788
|
+
}),
|
|
3789
|
+
total,
|
|
3790
|
+
page,
|
|
3791
|
+
limit
|
|
3760
3792
|
};
|
|
3761
3793
|
};
|
|
3794
|
+
resolvers.Query["toolCategories"] = async () => {
|
|
3795
|
+
const array = tools.map((tool2) => tool2.category).filter((category) => category && typeof category === "string");
|
|
3796
|
+
array.push("contexts");
|
|
3797
|
+
array.push("agents");
|
|
3798
|
+
return [...new Set(array)].sort();
|
|
3799
|
+
};
|
|
3762
3800
|
modelDefs += `
|
|
3763
3801
|
type ProviderPaginationResult {
|
|
3764
3802
|
items: [Provider]!
|
|
@@ -3797,6 +3835,9 @@ type PageInfo {
|
|
|
3797
3835
|
modelDefs += `
|
|
3798
3836
|
type ToolPaginationResult {
|
|
3799
3837
|
items: [Tool]!
|
|
3838
|
+
total: Int!
|
|
3839
|
+
page: Int!
|
|
3840
|
+
limit: Int!
|
|
3800
3841
|
}
|
|
3801
3842
|
`;
|
|
3802
3843
|
modelDefs += `
|
|
@@ -3906,6 +3947,7 @@ type Tool {
|
|
|
3906
3947
|
id: ID!
|
|
3907
3948
|
name: String!
|
|
3908
3949
|
description: String
|
|
3950
|
+
category: String
|
|
3909
3951
|
type: String
|
|
3910
3952
|
config: JSON
|
|
3911
3953
|
}
|
|
@@ -4280,7 +4322,7 @@ var createUppyRoutes = async (app, config) => {
|
|
|
4280
4322
|
const client2 = getS3Client(config);
|
|
4281
4323
|
const command = new ListObjectsV2Command({
|
|
4282
4324
|
Bucket: config.fileUploads.s3Bucket,
|
|
4283
|
-
Prefix:
|
|
4325
|
+
Prefix: `${config.fileUploads.s3prefix ? config.fileUploads.s3prefix.replace(/\/$/, "") + "/" : ""}${authenticationResult.user.id}`,
|
|
4284
4326
|
MaxKeys: 9,
|
|
4285
4327
|
...req.query.continuationToken && { ContinuationToken: req.query.continuationToken }
|
|
4286
4328
|
});
|
|
@@ -4813,6 +4855,7 @@ var ExuluAgent2 = class {
|
|
|
4813
4855
|
id: agentInstance.id,
|
|
4814
4856
|
name: `${agentInstance.name}`,
|
|
4815
4857
|
type: "agent",
|
|
4858
|
+
category: "agents",
|
|
4816
4859
|
inputSchema: z.object({
|
|
4817
4860
|
prompt: z.string().describe("The prompt (usually a question for the agent) to send to the agent."),
|
|
4818
4861
|
information: z.string().describe("A summary of relevant context / information from the current session")
|
|
@@ -5241,13 +5284,15 @@ var ExuluTool2 = class {
|
|
|
5241
5284
|
id;
|
|
5242
5285
|
name;
|
|
5243
5286
|
description;
|
|
5287
|
+
category;
|
|
5244
5288
|
inputSchema;
|
|
5245
5289
|
type;
|
|
5246
5290
|
tool;
|
|
5247
5291
|
config;
|
|
5248
|
-
constructor({ id, name, description, inputSchema, type, execute: execute2, config }) {
|
|
5292
|
+
constructor({ id, name, description, category, inputSchema, type, execute: execute2, config }) {
|
|
5249
5293
|
this.id = id;
|
|
5250
5294
|
this.config = config;
|
|
5295
|
+
this.category = category || "default";
|
|
5251
5296
|
this.name = name;
|
|
5252
5297
|
this.description = description;
|
|
5253
5298
|
this.inputSchema = inputSchema;
|
|
@@ -5676,6 +5721,7 @@ var ExuluContext = class {
|
|
|
5676
5721
|
id: this.id,
|
|
5677
5722
|
name: `${this.name}`,
|
|
5678
5723
|
type: "context",
|
|
5724
|
+
category: "contexts",
|
|
5679
5725
|
inputSchema: z.object({
|
|
5680
5726
|
query: z.string()
|
|
5681
5727
|
}),
|
|
@@ -7806,6 +7852,616 @@ var llmAsJudgeEval = new ExuluEval2({
|
|
|
7806
7852
|
llm: true
|
|
7807
7853
|
});
|
|
7808
7854
|
|
|
7855
|
+
// src/templates/tools/math.ts
|
|
7856
|
+
import { z as z4 } from "zod";
|
|
7857
|
+
|
|
7858
|
+
// src/templates/tools/utils/arithmetic.ts
|
|
7859
|
+
var Arithmetic = class {
|
|
7860
|
+
/**
|
|
7861
|
+
* Add two numbers together
|
|
7862
|
+
* @param firstNumber - The first number
|
|
7863
|
+
* @param secondNumber - The second number
|
|
7864
|
+
* @returns sum
|
|
7865
|
+
*/
|
|
7866
|
+
static add(firstNumber, secondNumber) {
|
|
7867
|
+
const sum = firstNumber + secondNumber;
|
|
7868
|
+
return sum;
|
|
7869
|
+
}
|
|
7870
|
+
/**
|
|
7871
|
+
* Subtract one number from another
|
|
7872
|
+
* @param minuend - The number to subtract from
|
|
7873
|
+
* @param subtrahend - The number to subtract
|
|
7874
|
+
* @returns difference
|
|
7875
|
+
*/
|
|
7876
|
+
static subtract(minuend, subtrahend) {
|
|
7877
|
+
const difference = minuend - subtrahend;
|
|
7878
|
+
return difference;
|
|
7879
|
+
}
|
|
7880
|
+
/**
|
|
7881
|
+
* Multiply two numbers together
|
|
7882
|
+
* @param firstNumber - The first number
|
|
7883
|
+
* @param secondNumber - The second number
|
|
7884
|
+
* @returns product
|
|
7885
|
+
*/
|
|
7886
|
+
static multiply(firstNumber, secondNumber) {
|
|
7887
|
+
const product = firstNumber * secondNumber;
|
|
7888
|
+
return product;
|
|
7889
|
+
}
|
|
7890
|
+
/**
|
|
7891
|
+
* Divide one number by another
|
|
7892
|
+
* @param numerator - The number to be divided
|
|
7893
|
+
* @param denominator - The number to divide by
|
|
7894
|
+
* @returns quotient
|
|
7895
|
+
*/
|
|
7896
|
+
static division(numerator, denominator) {
|
|
7897
|
+
const quotient = numerator / denominator;
|
|
7898
|
+
return quotient;
|
|
7899
|
+
}
|
|
7900
|
+
/**
|
|
7901
|
+
* Calculate the sum of an array of numbers
|
|
7902
|
+
* @param numbers - Array of numbers to sum
|
|
7903
|
+
* @returns sum of all numbers in the array
|
|
7904
|
+
*/
|
|
7905
|
+
static sum(numbers) {
|
|
7906
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7907
|
+
return sum;
|
|
7908
|
+
}
|
|
7909
|
+
/**
|
|
7910
|
+
* Calculate the floor of a number
|
|
7911
|
+
* @param number - Number to find the floor of
|
|
7912
|
+
* @returns floor of the number
|
|
7913
|
+
*/
|
|
7914
|
+
static floor(number) {
|
|
7915
|
+
const floor = Math.floor(number);
|
|
7916
|
+
return floor;
|
|
7917
|
+
}
|
|
7918
|
+
/**
|
|
7919
|
+
* Calculate the ceil of a number
|
|
7920
|
+
* @param number - Number to find the ceil of
|
|
7921
|
+
* @returns ceil of the number
|
|
7922
|
+
*/
|
|
7923
|
+
static ceil(number) {
|
|
7924
|
+
const ceil = Math.ceil(number);
|
|
7925
|
+
return ceil;
|
|
7926
|
+
}
|
|
7927
|
+
/**
|
|
7928
|
+
* Calculate the round of a number
|
|
7929
|
+
* @param number - Number to find the round of
|
|
7930
|
+
* @returns round of the number
|
|
7931
|
+
*/
|
|
7932
|
+
static round(number) {
|
|
7933
|
+
const round = Math.round(number);
|
|
7934
|
+
return round;
|
|
7935
|
+
}
|
|
7936
|
+
/**
|
|
7937
|
+
* Get the remainder of a division equation.
|
|
7938
|
+
* Ex: modulo(5,2) = 1
|
|
7939
|
+
* @param numerator - The number to be divided
|
|
7940
|
+
* @param denominator - The number to divide by
|
|
7941
|
+
* @returns remainder of division
|
|
7942
|
+
*/
|
|
7943
|
+
static modulo(numerator, denominator) {
|
|
7944
|
+
const remainder = numerator % denominator;
|
|
7945
|
+
return remainder;
|
|
7946
|
+
}
|
|
7947
|
+
};
|
|
7948
|
+
|
|
7949
|
+
// src/templates/tools/utils/statistics.ts
|
|
7950
|
+
var Statistics = class {
|
|
7951
|
+
/**
|
|
7952
|
+
* Calculate the arithmetic mean (average) of an array of numbers
|
|
7953
|
+
* @param numbers - Array of numbers to calculate the mean of
|
|
7954
|
+
* @returns The arithmetic mean value
|
|
7955
|
+
*/
|
|
7956
|
+
static mean(numbers) {
|
|
7957
|
+
const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
7958
|
+
const mean = sum / numbers.length;
|
|
7959
|
+
return mean;
|
|
7960
|
+
}
|
|
7961
|
+
/**
|
|
7962
|
+
* Calculate the median (middle value) of an array of numbers
|
|
7963
|
+
* @param numbers - Array of numbers to calculate the median of
|
|
7964
|
+
* @returns The median value
|
|
7965
|
+
*/
|
|
7966
|
+
static median(numbers) {
|
|
7967
|
+
numbers.sort();
|
|
7968
|
+
const medianIndex = numbers.length / 2;
|
|
7969
|
+
let medianValue;
|
|
7970
|
+
if (numbers.length % 2 !== 0) {
|
|
7971
|
+
medianValue = numbers[Math.floor(medianIndex)];
|
|
7972
|
+
} else {
|
|
7973
|
+
medianValue = (numbers[medianIndex] + numbers[medianIndex - 1]) / 2;
|
|
7974
|
+
}
|
|
7975
|
+
return medianValue;
|
|
7976
|
+
}
|
|
7977
|
+
/**
|
|
7978
|
+
* Calculate the mode (most frequent value(s)) of an array of numbers
|
|
7979
|
+
* @param numbers - Array of numbers to calculate the mode of
|
|
7980
|
+
* @returns Object containing the mode value(s) and their frequency
|
|
7981
|
+
*/
|
|
7982
|
+
static mode(numbers) {
|
|
7983
|
+
const modeMap = /* @__PURE__ */ new Map();
|
|
7984
|
+
numbers.forEach((value) => {
|
|
7985
|
+
if (modeMap.has(value)) {
|
|
7986
|
+
modeMap.set(value, modeMap.get(value) + 1);
|
|
7987
|
+
} else {
|
|
7988
|
+
modeMap.set(value, 1);
|
|
7989
|
+
}
|
|
7990
|
+
});
|
|
7991
|
+
let maxFrequency = 0;
|
|
7992
|
+
for (const numberFrequency of modeMap.values()) {
|
|
7993
|
+
if (numberFrequency > maxFrequency) {
|
|
7994
|
+
maxFrequency = numberFrequency;
|
|
7995
|
+
}
|
|
7996
|
+
}
|
|
7997
|
+
const modeResult = [];
|
|
7998
|
+
for (const [key, value] of modeMap.entries()) {
|
|
7999
|
+
if (value === maxFrequency) {
|
|
8000
|
+
modeResult.push(key);
|
|
8001
|
+
}
|
|
8002
|
+
}
|
|
8003
|
+
return {
|
|
8004
|
+
modeResult,
|
|
8005
|
+
maxFrequency
|
|
8006
|
+
};
|
|
8007
|
+
}
|
|
8008
|
+
/**
|
|
8009
|
+
* Find the minimum value in an array of numbers
|
|
8010
|
+
* @param numbers - Array of numbers to find the minimum of
|
|
8011
|
+
* @returns The minimum value
|
|
8012
|
+
*/
|
|
8013
|
+
static min(numbers) {
|
|
8014
|
+
const minValue = Math.min(...numbers);
|
|
8015
|
+
return minValue;
|
|
8016
|
+
}
|
|
8017
|
+
/**
|
|
8018
|
+
* Find the maximum value in an array of numbers
|
|
8019
|
+
* @param numbers - Array of numbers to find the maximum of
|
|
8020
|
+
* @returns The maximum value
|
|
8021
|
+
*/
|
|
8022
|
+
static max(numbers) {
|
|
8023
|
+
const maxValue = Math.max(...numbers);
|
|
8024
|
+
return maxValue;
|
|
8025
|
+
}
|
|
8026
|
+
};
|
|
8027
|
+
|
|
8028
|
+
// src/templates/tools/utils/trigonometric.ts
|
|
8029
|
+
var Trigonometric = class {
|
|
8030
|
+
/**
|
|
8031
|
+
* Calculate the sin of a number in radians
|
|
8032
|
+
* @param number - The number to find the sin of
|
|
8033
|
+
* @returns The sin of a number in radians
|
|
8034
|
+
*/
|
|
8035
|
+
static sin(number) {
|
|
8036
|
+
const sin = Math.sin(number);
|
|
8037
|
+
return sin;
|
|
8038
|
+
}
|
|
8039
|
+
/**
|
|
8040
|
+
* Calculate the arcsin of a number in radians
|
|
8041
|
+
* @param number - The number to find the arcsin of
|
|
8042
|
+
* @returns The arcsin of a number in radians
|
|
8043
|
+
*/
|
|
8044
|
+
static arcsin(number) {
|
|
8045
|
+
const arcsin = Math.asin(number);
|
|
8046
|
+
return arcsin;
|
|
8047
|
+
}
|
|
8048
|
+
/**
|
|
8049
|
+
* Calculate the cos of a number in radians
|
|
8050
|
+
* @param number - The number to find the cos of
|
|
8051
|
+
* @returns The cos of a number in radians
|
|
8052
|
+
*/
|
|
8053
|
+
static cos(number) {
|
|
8054
|
+
const cos = Math.cos(number);
|
|
8055
|
+
return cos;
|
|
8056
|
+
}
|
|
8057
|
+
/**
|
|
8058
|
+
* Calculate the arccos of a number in radians
|
|
8059
|
+
* @param number - The number to find the arccos of
|
|
8060
|
+
* @returns The arccos of a number in radians
|
|
8061
|
+
*/
|
|
8062
|
+
static arccos(number) {
|
|
8063
|
+
const arccos = Math.acos(number);
|
|
8064
|
+
return arccos;
|
|
8065
|
+
}
|
|
8066
|
+
/**
|
|
8067
|
+
* Calculate the tangent of a number in radians
|
|
8068
|
+
* @param number - The number to find the tangent of
|
|
8069
|
+
* @returns The tangent of a number in radians
|
|
8070
|
+
*/
|
|
8071
|
+
static tan(number) {
|
|
8072
|
+
const tangent = Math.tan(number);
|
|
8073
|
+
return tangent;
|
|
8074
|
+
}
|
|
8075
|
+
/**
|
|
8076
|
+
* Calculate the arc tangent of a number in radians
|
|
8077
|
+
* @param number - The number to find the arc tangent of
|
|
8078
|
+
* @returns The arc tangent of a number in radians
|
|
8079
|
+
*/
|
|
8080
|
+
static arctan(number) {
|
|
8081
|
+
const arctangent = Math.atan(number);
|
|
8082
|
+
return arctangent;
|
|
8083
|
+
}
|
|
8084
|
+
/**
|
|
8085
|
+
* Converts a radian into its equivalent value in degrees
|
|
8086
|
+
* @param number - The number to get the degree of
|
|
8087
|
+
* @returns The degree of the number
|
|
8088
|
+
*/
|
|
8089
|
+
static radiansToDegrees(number) {
|
|
8090
|
+
const degrees = number * (180 / Math.PI);
|
|
8091
|
+
return degrees;
|
|
8092
|
+
}
|
|
8093
|
+
/**
|
|
8094
|
+
* Converts a degree into its equivalent value in radians
|
|
8095
|
+
* @param number - The number to get the radians of
|
|
8096
|
+
* @returns The radians of the number
|
|
8097
|
+
*/
|
|
8098
|
+
static degreesToRadians(number) {
|
|
8099
|
+
const radians = number * (Math.PI / 180);
|
|
8100
|
+
return radians;
|
|
8101
|
+
}
|
|
8102
|
+
};
|
|
8103
|
+
|
|
8104
|
+
// src/templates/tools/math.ts
|
|
8105
|
+
var additionTool = new ExuluTool2({
|
|
8106
|
+
id: "addition",
|
|
8107
|
+
name: "Addition",
|
|
8108
|
+
description: "Adds two numbers together",
|
|
8109
|
+
type: "function",
|
|
8110
|
+
category: "math",
|
|
8111
|
+
config: [],
|
|
8112
|
+
inputSchema: z4.object({
|
|
8113
|
+
firstNumber: z4.number().describe("The first addend"),
|
|
8114
|
+
secondNumber: z4.number().describe("The second addend")
|
|
8115
|
+
}),
|
|
8116
|
+
execute: async ({ firstNumber, secondNumber }) => {
|
|
8117
|
+
const value = Arithmetic.add(firstNumber, secondNumber);
|
|
8118
|
+
return { result: `${value}` };
|
|
8119
|
+
}
|
|
8120
|
+
});
|
|
8121
|
+
var subtractionTool = new ExuluTool2({
|
|
8122
|
+
id: "subtraction",
|
|
8123
|
+
name: "Subtraction",
|
|
8124
|
+
description: "Subtracts the second number from the first number",
|
|
8125
|
+
type: "function",
|
|
8126
|
+
category: "math",
|
|
8127
|
+
config: [],
|
|
8128
|
+
inputSchema: z4.object({
|
|
8129
|
+
minuend: z4.number().describe("The number to subtract from (minuend)"),
|
|
8130
|
+
subtrahend: z4.number().describe("The number being subtracted (subtrahend)")
|
|
8131
|
+
}),
|
|
8132
|
+
execute: async ({ minuend, subtrahend }) => {
|
|
8133
|
+
const value = Arithmetic.subtract(minuend, subtrahend);
|
|
8134
|
+
return { result: `${value}` };
|
|
8135
|
+
}
|
|
8136
|
+
});
|
|
8137
|
+
var multiplicationTool = new ExuluTool2({
|
|
8138
|
+
id: "multiplication",
|
|
8139
|
+
name: "Multiplication",
|
|
8140
|
+
description: "Multiplies two numbers together",
|
|
8141
|
+
type: "function",
|
|
8142
|
+
category: "math",
|
|
8143
|
+
config: [],
|
|
8144
|
+
inputSchema: z4.object({
|
|
8145
|
+
firstNumber: z4.number().describe("The first number"),
|
|
8146
|
+
SecondNumber: z4.number().describe("The second number")
|
|
8147
|
+
}),
|
|
8148
|
+
execute: async ({ firstNumber, SecondNumber }) => {
|
|
8149
|
+
const value = Arithmetic.multiply(firstNumber, SecondNumber);
|
|
8150
|
+
return { result: `${value}` };
|
|
8151
|
+
}
|
|
8152
|
+
});
|
|
8153
|
+
var divisionTool = new ExuluTool2({
|
|
8154
|
+
id: "division",
|
|
8155
|
+
name: "Division",
|
|
8156
|
+
description: "Divides the first number by the second number",
|
|
8157
|
+
type: "function",
|
|
8158
|
+
category: "math",
|
|
8159
|
+
config: [],
|
|
8160
|
+
inputSchema: z4.object({
|
|
8161
|
+
numerator: z4.number().describe("The number being divided (numerator)"),
|
|
8162
|
+
denominator: z4.number().describe("The number to divide by (denominator)")
|
|
8163
|
+
}),
|
|
8164
|
+
execute: async ({ numerator, denominator }) => {
|
|
8165
|
+
const value = Arithmetic.division(numerator, denominator);
|
|
8166
|
+
return { result: `${value}` };
|
|
8167
|
+
}
|
|
8168
|
+
});
|
|
8169
|
+
var sumTool = new ExuluTool2({
|
|
8170
|
+
id: "sum",
|
|
8171
|
+
name: "Sum",
|
|
8172
|
+
description: "Adds any number of numbers together",
|
|
8173
|
+
type: "function",
|
|
8174
|
+
category: "math",
|
|
8175
|
+
config: [],
|
|
8176
|
+
inputSchema: z4.object({
|
|
8177
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to sum")
|
|
8178
|
+
}),
|
|
8179
|
+
execute: async ({ numbers }) => {
|
|
8180
|
+
const value = Arithmetic.sum(numbers);
|
|
8181
|
+
return { result: `${value}` };
|
|
8182
|
+
}
|
|
8183
|
+
});
|
|
8184
|
+
var moduloTool = new ExuluTool2({
|
|
8185
|
+
id: "modulo",
|
|
8186
|
+
name: "Modulo",
|
|
8187
|
+
description: "Divides two numbers and returns the remainder",
|
|
8188
|
+
type: "function",
|
|
8189
|
+
category: "math",
|
|
8190
|
+
config: [],
|
|
8191
|
+
inputSchema: z4.object({
|
|
8192
|
+
numerator: z4.number().describe("The number being divided (numerator)"),
|
|
8193
|
+
denominator: z4.number().describe("The number to divide by (denominator)")
|
|
8194
|
+
}),
|
|
8195
|
+
execute: async ({ numerator, denominator }) => {
|
|
8196
|
+
const value = Arithmetic.modulo(numerator, denominator);
|
|
8197
|
+
return { result: `${value}` };
|
|
8198
|
+
}
|
|
8199
|
+
});
|
|
8200
|
+
var meanTool = new ExuluTool2({
|
|
8201
|
+
id: "mean",
|
|
8202
|
+
name: "Mean",
|
|
8203
|
+
description: "Calculates the arithmetic mean of a list of numbers",
|
|
8204
|
+
type: "function",
|
|
8205
|
+
category: "math",
|
|
8206
|
+
config: [],
|
|
8207
|
+
inputSchema: z4.object({
|
|
8208
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the mean of")
|
|
8209
|
+
}),
|
|
8210
|
+
execute: async ({ numbers }) => {
|
|
8211
|
+
const value = Statistics.mean(numbers);
|
|
8212
|
+
return { result: `${value}` };
|
|
8213
|
+
}
|
|
8214
|
+
});
|
|
8215
|
+
var medianTool = new ExuluTool2({
|
|
8216
|
+
id: "median",
|
|
8217
|
+
name: "Median",
|
|
8218
|
+
description: "Calculates the median of a list of numbers",
|
|
8219
|
+
type: "function",
|
|
8220
|
+
category: "math",
|
|
8221
|
+
config: [],
|
|
8222
|
+
inputSchema: z4.object({
|
|
8223
|
+
numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the median of")
|
|
8224
|
+
}),
|
|
8225
|
+
execute: async ({ numbers }) => {
|
|
8226
|
+
const value = Statistics.median(numbers);
|
|
8227
|
+
return { result: `${value}` };
|
|
8228
|
+
}
|
|
8229
|
+
});
|
|
8230
|
+
var modeTool = new ExuluTool2({
|
|
8231
|
+
id: "mode",
|
|
8232
|
+
name: "Mode",
|
|
8233
|
+
description: "Finds the most common number in a list of numbers",
|
|
8234
|
+
type: "function",
|
|
8235
|
+
category: "math",
|
|
8236
|
+
config: [],
|
|
8237
|
+
inputSchema: z4.object({
|
|
8238
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the mode of")
|
|
8239
|
+
}),
|
|
8240
|
+
execute: async ({ numbers }) => {
|
|
8241
|
+
const value = Statistics.mode(numbers);
|
|
8242
|
+
return { result: `Entries (${value.modeResult.join(", ")}) appeared ${value.maxFrequency} times` };
|
|
8243
|
+
}
|
|
8244
|
+
});
|
|
8245
|
+
var minTool = new ExuluTool2({
|
|
8246
|
+
id: "min",
|
|
8247
|
+
name: "Minimum",
|
|
8248
|
+
description: "Finds the minimum value from a list of numbers",
|
|
8249
|
+
type: "function",
|
|
8250
|
+
category: "math",
|
|
8251
|
+
config: [],
|
|
8252
|
+
inputSchema: z4.object({
|
|
8253
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the minimum of")
|
|
8254
|
+
}),
|
|
8255
|
+
execute: async ({ numbers }) => {
|
|
8256
|
+
const value = Statistics.min(numbers);
|
|
8257
|
+
return { result: `${value}` };
|
|
8258
|
+
}
|
|
8259
|
+
});
|
|
8260
|
+
var maxTool = new ExuluTool2({
|
|
8261
|
+
id: "max",
|
|
8262
|
+
name: "Maximum",
|
|
8263
|
+
description: "Finds the maximum value from a list of numbers",
|
|
8264
|
+
type: "function",
|
|
8265
|
+
category: "math",
|
|
8266
|
+
config: [],
|
|
8267
|
+
inputSchema: z4.object({
|
|
8268
|
+
numbers: z4.array(z4.number()).describe("Array of numbers to find the maximum of")
|
|
8269
|
+
}),
|
|
8270
|
+
execute: async ({ numbers }) => {
|
|
8271
|
+
const value = Statistics.max(numbers);
|
|
8272
|
+
return { result: `${value}` };
|
|
8273
|
+
}
|
|
8274
|
+
});
|
|
8275
|
+
var floorTool = new ExuluTool2({
|
|
8276
|
+
id: "floor",
|
|
8277
|
+
name: "Floor",
|
|
8278
|
+
description: "Rounds a number down to the nearest integer",
|
|
8279
|
+
type: "function",
|
|
8280
|
+
category: "math",
|
|
8281
|
+
config: [],
|
|
8282
|
+
inputSchema: z4.object({
|
|
8283
|
+
number: z4.number().describe("The number to round down")
|
|
8284
|
+
}),
|
|
8285
|
+
execute: async ({ number }) => {
|
|
8286
|
+
const value = Arithmetic.floor(number);
|
|
8287
|
+
return { result: `${value}` };
|
|
8288
|
+
}
|
|
8289
|
+
});
|
|
8290
|
+
var ceilingTool = new ExuluTool2({
|
|
8291
|
+
id: "ceiling",
|
|
8292
|
+
name: "Ceiling",
|
|
8293
|
+
description: "Rounds a number up to the nearest integer",
|
|
8294
|
+
type: "function",
|
|
8295
|
+
category: "math",
|
|
8296
|
+
config: [],
|
|
8297
|
+
inputSchema: z4.object({
|
|
8298
|
+
number: z4.number().describe("The number to round up")
|
|
8299
|
+
}),
|
|
8300
|
+
execute: async ({ number }) => {
|
|
8301
|
+
const value = Arithmetic.ceil(number);
|
|
8302
|
+
return { result: `${value}` };
|
|
8303
|
+
}
|
|
8304
|
+
});
|
|
8305
|
+
var roundTool = new ExuluTool2({
|
|
8306
|
+
id: "round",
|
|
8307
|
+
name: "Round",
|
|
8308
|
+
description: "Rounds a number to the nearest integer",
|
|
8309
|
+
type: "function",
|
|
8310
|
+
category: "math",
|
|
8311
|
+
config: [],
|
|
8312
|
+
inputSchema: z4.object({
|
|
8313
|
+
number: z4.number().describe("The number to round")
|
|
8314
|
+
}),
|
|
8315
|
+
execute: async ({ number }) => {
|
|
8316
|
+
const value = Arithmetic.round(number);
|
|
8317
|
+
return { result: `${value}` };
|
|
8318
|
+
}
|
|
8319
|
+
});
|
|
8320
|
+
var sinTool = new ExuluTool2({
|
|
8321
|
+
id: "sin",
|
|
8322
|
+
name: "Sine",
|
|
8323
|
+
description: "Calculates the sine of a number in radians",
|
|
8324
|
+
type: "function",
|
|
8325
|
+
category: "math",
|
|
8326
|
+
config: [],
|
|
8327
|
+
inputSchema: z4.object({
|
|
8328
|
+
number: z4.number().describe("The number in radians to find the sine of")
|
|
8329
|
+
}),
|
|
8330
|
+
execute: async ({ number }) => {
|
|
8331
|
+
const value = Trigonometric.sin(number);
|
|
8332
|
+
return { result: `${value}` };
|
|
8333
|
+
}
|
|
8334
|
+
});
|
|
8335
|
+
var arcsinTool = new ExuluTool2({
|
|
8336
|
+
id: "arcsin",
|
|
8337
|
+
name: "Arcsine",
|
|
8338
|
+
description: "Calculates the arcsine of a number in radians",
|
|
8339
|
+
type: "function",
|
|
8340
|
+
category: "math",
|
|
8341
|
+
config: [],
|
|
8342
|
+
inputSchema: z4.object({
|
|
8343
|
+
number: z4.number().describe("The number to find the arcsine of")
|
|
8344
|
+
}),
|
|
8345
|
+
execute: async ({ number }) => {
|
|
8346
|
+
const value = Trigonometric.arcsin(number);
|
|
8347
|
+
return { result: `${value}` };
|
|
8348
|
+
}
|
|
8349
|
+
});
|
|
8350
|
+
var cosTool = new ExuluTool2({
|
|
8351
|
+
id: "cos",
|
|
8352
|
+
name: "Cosine",
|
|
8353
|
+
description: "Calculates the cosine of a number in radians",
|
|
8354
|
+
type: "function",
|
|
8355
|
+
category: "math",
|
|
8356
|
+
config: [],
|
|
8357
|
+
inputSchema: z4.object({
|
|
8358
|
+
number: z4.number().describe("The number in radians to find the cosine of")
|
|
8359
|
+
}),
|
|
8360
|
+
execute: async ({ number }) => {
|
|
8361
|
+
const value = Trigonometric.cos(number);
|
|
8362
|
+
return { result: `${value}` };
|
|
8363
|
+
}
|
|
8364
|
+
});
|
|
8365
|
+
var arccosTool = new ExuluTool2({
|
|
8366
|
+
id: "arccos",
|
|
8367
|
+
name: "Arccosine",
|
|
8368
|
+
description: "Calculates the arccosine of a number in radians",
|
|
8369
|
+
type: "function",
|
|
8370
|
+
category: "math",
|
|
8371
|
+
config: [],
|
|
8372
|
+
inputSchema: z4.object({
|
|
8373
|
+
number: z4.number().describe("The number to find the arccosine of")
|
|
8374
|
+
}),
|
|
8375
|
+
execute: async ({ number }) => {
|
|
8376
|
+
const value = Trigonometric.arccos(number);
|
|
8377
|
+
return { result: `${value}` };
|
|
8378
|
+
}
|
|
8379
|
+
});
|
|
8380
|
+
var tanTool = new ExuluTool2({
|
|
8381
|
+
id: "tan",
|
|
8382
|
+
name: "Tangent",
|
|
8383
|
+
description: "Calculates the tangent of a number in radians",
|
|
8384
|
+
type: "function",
|
|
8385
|
+
category: "math",
|
|
8386
|
+
config: [],
|
|
8387
|
+
inputSchema: z4.object({
|
|
8388
|
+
number: z4.number().describe("The number in radians to find the tangent of")
|
|
8389
|
+
}),
|
|
8390
|
+
execute: async ({ number }) => {
|
|
8391
|
+
const value = Trigonometric.tan(number);
|
|
8392
|
+
return { result: `${value}` };
|
|
8393
|
+
}
|
|
8394
|
+
});
|
|
8395
|
+
var arctanTool = new ExuluTool2({
|
|
8396
|
+
id: "arctan",
|
|
8397
|
+
name: "Arctangent",
|
|
8398
|
+
description: "Calculates the arctangent of a number in radians",
|
|
8399
|
+
type: "function",
|
|
8400
|
+
category: "math",
|
|
8401
|
+
config: [],
|
|
8402
|
+
inputSchema: z4.object({
|
|
8403
|
+
number: z4.number().describe("The number to find the arctangent of")
|
|
8404
|
+
}),
|
|
8405
|
+
execute: async ({ number }) => {
|
|
8406
|
+
const value = Trigonometric.arctan(number);
|
|
8407
|
+
return { result: `${value}` };
|
|
8408
|
+
}
|
|
8409
|
+
});
|
|
8410
|
+
var radiansToDegreesTool = new ExuluTool2({
|
|
8411
|
+
id: "radiansToDegrees",
|
|
8412
|
+
name: "Radians to Degrees",
|
|
8413
|
+
description: "Converts a radian value to its equivalent in degrees",
|
|
8414
|
+
type: "function",
|
|
8415
|
+
category: "math",
|
|
8416
|
+
config: [],
|
|
8417
|
+
inputSchema: z4.object({
|
|
8418
|
+
number: z4.number().describe("The number in radians to convert to degrees")
|
|
8419
|
+
}),
|
|
8420
|
+
execute: async ({ number }) => {
|
|
8421
|
+
const value = Trigonometric.radiansToDegrees(number);
|
|
8422
|
+
return { result: `${value}` };
|
|
8423
|
+
}
|
|
8424
|
+
});
|
|
8425
|
+
var degreesToRadiansTool = new ExuluTool2({
|
|
8426
|
+
id: "degreesToRadians",
|
|
8427
|
+
name: "Degrees to Radians",
|
|
8428
|
+
description: "Converts a degree value to its equivalent in radians",
|
|
8429
|
+
type: "function",
|
|
8430
|
+
category: "math",
|
|
8431
|
+
config: [],
|
|
8432
|
+
inputSchema: z4.object({
|
|
8433
|
+
number: z4.number().describe("The number in degrees to convert to radians")
|
|
8434
|
+
}),
|
|
8435
|
+
execute: async ({ number }) => {
|
|
8436
|
+
const value = Trigonometric.degreesToRadians(number);
|
|
8437
|
+
return { result: `${value}` };
|
|
8438
|
+
}
|
|
8439
|
+
});
|
|
8440
|
+
var mathTools = [
|
|
8441
|
+
additionTool,
|
|
8442
|
+
subtractionTool,
|
|
8443
|
+
multiplicationTool,
|
|
8444
|
+
divisionTool,
|
|
8445
|
+
sumTool,
|
|
8446
|
+
moduloTool,
|
|
8447
|
+
meanTool,
|
|
8448
|
+
medianTool,
|
|
8449
|
+
modeTool,
|
|
8450
|
+
minTool,
|
|
8451
|
+
maxTool,
|
|
8452
|
+
floorTool,
|
|
8453
|
+
ceilingTool,
|
|
8454
|
+
roundTool,
|
|
8455
|
+
sinTool,
|
|
8456
|
+
arcsinTool,
|
|
8457
|
+
cosTool,
|
|
8458
|
+
arccosTool,
|
|
8459
|
+
tanTool,
|
|
8460
|
+
arctanTool,
|
|
8461
|
+
radiansToDegreesTool,
|
|
8462
|
+
degreesToRadiansTool
|
|
8463
|
+
];
|
|
8464
|
+
|
|
7809
8465
|
// src/registry/index.ts
|
|
7810
8466
|
var isDev = process.env.NODE_ENV !== "production";
|
|
7811
8467
|
var consoleTransport = new winston2.transports.Console({
|
|
@@ -7835,7 +8491,7 @@ var isValidPostgresName = (id) => {
|
|
|
7835
8491
|
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
7836
8492
|
const isValid = regex.test(id);
|
|
7837
8493
|
const length = id.length;
|
|
7838
|
-
return isValid && length <= 80 && length >
|
|
8494
|
+
return isValid && length <= 80 && length > 2;
|
|
7839
8495
|
};
|
|
7840
8496
|
var ExuluApp = class {
|
|
7841
8497
|
_agents = [];
|
|
@@ -7877,6 +8533,7 @@ var ExuluApp = class {
|
|
|
7877
8533
|
this._config = config;
|
|
7878
8534
|
this._tools = [
|
|
7879
8535
|
...tools ?? [],
|
|
8536
|
+
...mathTools,
|
|
7880
8537
|
// Add contexts as tools
|
|
7881
8538
|
...Object.values(contexts || {}).map((context) => context.tool())
|
|
7882
8539
|
// Because agents are stored in the database, we add those as tools
|