@exulu/backend 1.28.1 → 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/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: `test/${authenticationResult.user.id}`,
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
  });
@@ -7718,6 +7728,80 @@ var outputsContext = new ExuluContext({
7718
7728
  var import_winston2 = __toESM(require("winston"), 1);
7719
7729
  var import_util = __toESM(require("util"), 1);
7720
7730
 
7731
+ // src/bullmq/queues.ts
7732
+ var import_bullmq5 = require("bullmq");
7733
+ var import_bullmq_otel = require("bullmq-otel");
7734
+ var ExuluQueues = class {
7735
+ queues;
7736
+ constructor() {
7737
+ this.queues = [];
7738
+ }
7739
+ list = /* @__PURE__ */ new Map();
7740
+ // list of queue names
7741
+ queue(name) {
7742
+ return this.queues.find((x) => x.queue?.name === name);
7743
+ }
7744
+ // name: string
7745
+ // concurrency: global concurrency for the queue
7746
+ // ratelimit: maximum number of jobs per second
7747
+ // Rate limit is set on workers (see workers.ts), even global rate limits,
7748
+ // that is a bit counter-intuitive. Since queues are registered using .user
7749
+ // method of ExuluQueues we need to store the desired rate limit on the queue
7750
+ // here so we can use the value when creating workers for the queue instance
7751
+ // as there is no way to store a rate limit value natively on a bullm queue.
7752
+ register = (name, concurrency = 1, ratelimit = 1) => {
7753
+ const use = async () => {
7754
+ const existing = this.queues.find((x) => x.queue?.name === name);
7755
+ if (existing) {
7756
+ const globalConcurrency = await existing.queue.getGlobalConcurrency();
7757
+ if (globalConcurrency !== concurrency) {
7758
+ await existing.queue.setGlobalConcurrency(concurrency);
7759
+ }
7760
+ return {
7761
+ queue: existing.queue,
7762
+ ratelimit,
7763
+ concurrency
7764
+ };
7765
+ }
7766
+ if (!redisServer.host?.length || !redisServer.port?.length) {
7767
+ console.error(`[EXULU] no redis server configured, but you are trying to use a queue ( ${name}), likely in an agent or embedder (look for ExuluQueues.register().use() ).`);
7768
+ throw new Error(`[EXULU] no redis server configured.`);
7769
+ }
7770
+ const newQueue = new import_bullmq5.Queue(
7771
+ `${name}`,
7772
+ {
7773
+ connection: {
7774
+ ...redisServer,
7775
+ enableOfflineQueue: false
7776
+ },
7777
+ telemetry: new import_bullmq_otel.BullMQOtel("simple-guide")
7778
+ }
7779
+ );
7780
+ await newQueue.setGlobalConcurrency(concurrency);
7781
+ this.queues.push({
7782
+ queue: newQueue,
7783
+ ratelimit,
7784
+ concurrency
7785
+ });
7786
+ return {
7787
+ queue: newQueue,
7788
+ ratelimit,
7789
+ concurrency
7790
+ };
7791
+ };
7792
+ this.list.set(name, {
7793
+ name,
7794
+ concurrency,
7795
+ ratelimit,
7796
+ use
7797
+ });
7798
+ return {
7799
+ use
7800
+ };
7801
+ };
7802
+ };
7803
+ var queues = new ExuluQueues();
7804
+
7721
7805
  // src/templates/evals/index.ts
7722
7806
  var import_zod3 = require("zod");
7723
7807
  var llmAsJudgeEval = new ExuluEval2({
@@ -7765,6 +7849,594 @@ var llmAsJudgeEval = new ExuluEval2({
7765
7849
  llm: true
7766
7850
  });
7767
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
+
7768
8440
  // src/registry/index.ts
7769
8441
  var isDev = process.env.NODE_ENV !== "production";
7770
8442
  var consoleTransport = new import_winston2.default.transports.Console({
@@ -7794,7 +8466,7 @@ var isValidPostgresName = (id) => {
7794
8466
  const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
7795
8467
  const isValid = regex.test(id);
7796
8468
  const length = id.length;
7797
- return isValid && length <= 80 && length > 5;
8469
+ return isValid && length <= 80 && length > 2;
7798
8470
  };
7799
8471
  var ExuluApp = class {
7800
8472
  _agents = [];
@@ -7836,6 +8508,7 @@ var ExuluApp = class {
7836
8508
  this._config = config;
7837
8509
  this._tools = [
7838
8510
  ...tools ?? [],
8511
+ ...mathTools,
7839
8512
  // Add contexts as tools
7840
8513
  ...Object.values(contexts || {}).map((context) => context.tool())
7841
8514
  // Because agents are stored in the database, we add those as tools
@@ -8031,80 +8704,6 @@ var ExuluApp = class {
8031
8704
  };
8032
8705
  };
8033
8706
 
8034
- // src/bullmq/queues.ts
8035
- var import_bullmq5 = require("bullmq");
8036
- var import_bullmq_otel = require("bullmq-otel");
8037
- var ExuluQueues = class {
8038
- queues;
8039
- constructor() {
8040
- this.queues = [];
8041
- }
8042
- list = /* @__PURE__ */ new Map();
8043
- // list of queue names
8044
- queue(name) {
8045
- return this.queues.find((x) => x.queue?.name === name);
8046
- }
8047
- // name: string
8048
- // concurrency: global concurrency for the queue
8049
- // ratelimit: maximum number of jobs per second
8050
- // Rate limit is set on workers (see workers.ts), even global rate limits,
8051
- // that is a bit counter-intuitive. Since queues are registered using .user
8052
- // method of ExuluQueues we need to store the desired rate limit on the queue
8053
- // here so we can use the value when creating workers for the queue instance
8054
- // as there is no way to store a rate limit value natively on a bullm queue.
8055
- register = (name, concurrency = 1, ratelimit = 1) => {
8056
- const use = async () => {
8057
- const existing = this.queues.find((x) => x.queue?.name === name);
8058
- if (existing) {
8059
- const globalConcurrency = await existing.queue.getGlobalConcurrency();
8060
- if (globalConcurrency !== concurrency) {
8061
- await existing.queue.setGlobalConcurrency(concurrency);
8062
- }
8063
- return {
8064
- queue: existing.queue,
8065
- ratelimit,
8066
- concurrency
8067
- };
8068
- }
8069
- if (!redisServer.host?.length || !redisServer.port?.length) {
8070
- console.error(`[EXULU] no redis server configured, but you are trying to use a queue ( ${name}), likely in an agent or embedder (look for ExuluQueues.register().use() ).`);
8071
- throw new Error(`[EXULU] no redis server configured.`);
8072
- }
8073
- const newQueue = new import_bullmq5.Queue(
8074
- `${name}`,
8075
- {
8076
- connection: {
8077
- ...redisServer,
8078
- enableOfflineQueue: false
8079
- },
8080
- telemetry: new import_bullmq_otel.BullMQOtel("simple-guide")
8081
- }
8082
- );
8083
- await newQueue.setGlobalConcurrency(concurrency);
8084
- this.queues.push({
8085
- queue: newQueue,
8086
- ratelimit,
8087
- concurrency
8088
- });
8089
- return {
8090
- queue: newQueue,
8091
- ratelimit,
8092
- concurrency
8093
- };
8094
- };
8095
- this.list.set(name, {
8096
- name,
8097
- concurrency,
8098
- ratelimit,
8099
- use
8100
- });
8101
- return {
8102
- use
8103
- };
8104
- };
8105
- };
8106
- var queues = new ExuluQueues();
8107
-
8108
8707
  // src/chunking/types/base.ts
8109
8708
  var Chunk = class _Chunk {
8110
8709
  /** The text of the chunk. */