@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.js CHANGED
@@ -711,17 +711,6 @@ var requestValidators = {
711
711
  // src/registry/utils/graphql.ts
712
712
  import bcrypt3 from "bcryptjs";
713
713
 
714
- // types/enums/jobs.ts
715
- var JOB_STATUS_ENUM = {
716
- completed: "completed",
717
- failed: "failed",
718
- delayed: "delayed",
719
- active: "active",
720
- waiting: "waiting",
721
- paused: "paused",
722
- stuck: "stuck"
723
- };
724
-
725
714
  // src/postgres/core-schema.ts
726
715
  var agentMessagesSchema = {
727
716
  type: "agent_messages",
@@ -930,6 +919,14 @@ var agentsSchema = {
930
919
  {
931
920
  name: "tools",
932
921
  type: "json"
922
+ },
923
+ {
924
+ name: "animation_idle",
925
+ type: "text"
926
+ },
927
+ {
928
+ name: "animation_responding",
929
+ type: "text"
933
930
  }
934
931
  ]
935
932
  };
@@ -1631,6 +1628,19 @@ var generateApiKey = async (name, email) => {
1631
1628
 
1632
1629
  // src/registry/utils/graphql.ts
1633
1630
  import { v4 as uuidv42 } from "uuid";
1631
+
1632
+ // types/enums/jobs.ts
1633
+ var JOB_STATUS_ENUM = {
1634
+ completed: "completed",
1635
+ failed: "failed",
1636
+ delayed: "delayed",
1637
+ active: "active",
1638
+ waiting: "waiting",
1639
+ paused: "paused",
1640
+ stuck: "stuck"
1641
+ };
1642
+
1643
+ // src/registry/utils/graphql.ts
1634
1644
  var GraphQLDate = new GraphQLScalarType({
1635
1645
  name: "Date",
1636
1646
  description: "Date custom scalar type",
@@ -4280,7 +4290,7 @@ var createUppyRoutes = async (app, config) => {
4280
4290
  const client2 = getS3Client(config);
4281
4291
  const command = new ListObjectsV2Command({
4282
4292
  Bucket: config.fileUploads.s3Bucket,
4283
- Prefix: `test/${authenticationResult.user.id}`,
4293
+ Prefix: `${config.fileUploads.s3prefix ? config.fileUploads.s3prefix.replace(/\/$/, "") + "/" : ""}${authenticationResult.user.id}`,
4284
4294
  MaxKeys: 9,
4285
4295
  ...req.query.continuationToken && { ContinuationToken: req.query.continuationToken }
4286
4296
  });
@@ -7685,6 +7695,80 @@ var outputsContext = new ExuluContext({
7685
7695
  import winston2 from "winston";
7686
7696
  import util from "util";
7687
7697
 
7698
+ // src/bullmq/queues.ts
7699
+ import { Queue as Queue3 } from "bullmq";
7700
+ import { BullMQOtel } from "bullmq-otel";
7701
+ var ExuluQueues = class {
7702
+ queues;
7703
+ constructor() {
7704
+ this.queues = [];
7705
+ }
7706
+ list = /* @__PURE__ */ new Map();
7707
+ // list of queue names
7708
+ queue(name) {
7709
+ return this.queues.find((x) => x.queue?.name === name);
7710
+ }
7711
+ // name: string
7712
+ // concurrency: global concurrency for the queue
7713
+ // ratelimit: maximum number of jobs per second
7714
+ // Rate limit is set on workers (see workers.ts), even global rate limits,
7715
+ // that is a bit counter-intuitive. Since queues are registered using .user
7716
+ // method of ExuluQueues we need to store the desired rate limit on the queue
7717
+ // here so we can use the value when creating workers for the queue instance
7718
+ // as there is no way to store a rate limit value natively on a bullm queue.
7719
+ register = (name, concurrency = 1, ratelimit = 1) => {
7720
+ const use = async () => {
7721
+ const existing = this.queues.find((x) => x.queue?.name === name);
7722
+ if (existing) {
7723
+ const globalConcurrency = await existing.queue.getGlobalConcurrency();
7724
+ if (globalConcurrency !== concurrency) {
7725
+ await existing.queue.setGlobalConcurrency(concurrency);
7726
+ }
7727
+ return {
7728
+ queue: existing.queue,
7729
+ ratelimit,
7730
+ concurrency
7731
+ };
7732
+ }
7733
+ if (!redisServer.host?.length || !redisServer.port?.length) {
7734
+ 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() ).`);
7735
+ throw new Error(`[EXULU] no redis server configured.`);
7736
+ }
7737
+ const newQueue = new Queue3(
7738
+ `${name}`,
7739
+ {
7740
+ connection: {
7741
+ ...redisServer,
7742
+ enableOfflineQueue: false
7743
+ },
7744
+ telemetry: new BullMQOtel("simple-guide")
7745
+ }
7746
+ );
7747
+ await newQueue.setGlobalConcurrency(concurrency);
7748
+ this.queues.push({
7749
+ queue: newQueue,
7750
+ ratelimit,
7751
+ concurrency
7752
+ });
7753
+ return {
7754
+ queue: newQueue,
7755
+ ratelimit,
7756
+ concurrency
7757
+ };
7758
+ };
7759
+ this.list.set(name, {
7760
+ name,
7761
+ concurrency,
7762
+ ratelimit,
7763
+ use
7764
+ });
7765
+ return {
7766
+ use
7767
+ };
7768
+ };
7769
+ };
7770
+ var queues = new ExuluQueues();
7771
+
7688
7772
  // src/templates/evals/index.ts
7689
7773
  import { z as z3 } from "zod";
7690
7774
  var llmAsJudgeEval = new ExuluEval2({
@@ -7732,6 +7816,594 @@ var llmAsJudgeEval = new ExuluEval2({
7732
7816
  llm: true
7733
7817
  });
7734
7818
 
7819
+ // src/templates/tools/math.ts
7820
+ import { z as z4 } from "zod";
7821
+
7822
+ // src/templates/tools/utils/arithmetic.ts
7823
+ var Arithmetic = class {
7824
+ /**
7825
+ * Add two numbers together
7826
+ * @param firstNumber - The first number
7827
+ * @param secondNumber - The second number
7828
+ * @returns sum
7829
+ */
7830
+ static add(firstNumber, secondNumber) {
7831
+ const sum = firstNumber + secondNumber;
7832
+ return sum;
7833
+ }
7834
+ /**
7835
+ * Subtract one number from another
7836
+ * @param minuend - The number to subtract from
7837
+ * @param subtrahend - The number to subtract
7838
+ * @returns difference
7839
+ */
7840
+ static subtract(minuend, subtrahend) {
7841
+ const difference = minuend - subtrahend;
7842
+ return difference;
7843
+ }
7844
+ /**
7845
+ * Multiply two numbers together
7846
+ * @param firstNumber - The first number
7847
+ * @param secondNumber - The second number
7848
+ * @returns product
7849
+ */
7850
+ static multiply(firstNumber, secondNumber) {
7851
+ const product = firstNumber * secondNumber;
7852
+ return product;
7853
+ }
7854
+ /**
7855
+ * Divide one number by another
7856
+ * @param numerator - The number to be divided
7857
+ * @param denominator - The number to divide by
7858
+ * @returns quotient
7859
+ */
7860
+ static division(numerator, denominator) {
7861
+ const quotient = numerator / denominator;
7862
+ return quotient;
7863
+ }
7864
+ /**
7865
+ * Calculate the sum of an array of numbers
7866
+ * @param numbers - Array of numbers to sum
7867
+ * @returns sum of all numbers in the array
7868
+ */
7869
+ static sum(numbers) {
7870
+ const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
7871
+ return sum;
7872
+ }
7873
+ /**
7874
+ * Calculate the floor of a number
7875
+ * @param number - Number to find the floor of
7876
+ * @returns floor of the number
7877
+ */
7878
+ static floor(number) {
7879
+ const floor = Math.floor(number);
7880
+ return floor;
7881
+ }
7882
+ /**
7883
+ * Calculate the ceil of a number
7884
+ * @param number - Number to find the ceil of
7885
+ * @returns ceil of the number
7886
+ */
7887
+ static ceil(number) {
7888
+ const ceil = Math.ceil(number);
7889
+ return ceil;
7890
+ }
7891
+ /**
7892
+ * Calculate the round of a number
7893
+ * @param number - Number to find the round of
7894
+ * @returns round of the number
7895
+ */
7896
+ static round(number) {
7897
+ const round = Math.round(number);
7898
+ return round;
7899
+ }
7900
+ /**
7901
+ * Get the remainder of a division equation.
7902
+ * Ex: modulo(5,2) = 1
7903
+ * @param numerator - The number to be divided
7904
+ * @param denominator - The number to divide by
7905
+ * @returns remainder of division
7906
+ */
7907
+ static modulo(numerator, denominator) {
7908
+ const remainder = numerator % denominator;
7909
+ return remainder;
7910
+ }
7911
+ };
7912
+
7913
+ // src/templates/tools/utils/statistics.ts
7914
+ var Statistics = class {
7915
+ /**
7916
+ * Calculate the arithmetic mean (average) of an array of numbers
7917
+ * @param numbers - Array of numbers to calculate the mean of
7918
+ * @returns The arithmetic mean value
7919
+ */
7920
+ static mean(numbers) {
7921
+ const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
7922
+ const mean = sum / numbers.length;
7923
+ return mean;
7924
+ }
7925
+ /**
7926
+ * Calculate the median (middle value) of an array of numbers
7927
+ * @param numbers - Array of numbers to calculate the median of
7928
+ * @returns The median value
7929
+ */
7930
+ static median(numbers) {
7931
+ numbers.sort();
7932
+ const medianIndex = numbers.length / 2;
7933
+ let medianValue;
7934
+ if (numbers.length % 2 !== 0) {
7935
+ medianValue = numbers[Math.floor(medianIndex)];
7936
+ } else {
7937
+ medianValue = (numbers[medianIndex] + numbers[medianIndex - 1]) / 2;
7938
+ }
7939
+ return medianValue;
7940
+ }
7941
+ /**
7942
+ * Calculate the mode (most frequent value(s)) of an array of numbers
7943
+ * @param numbers - Array of numbers to calculate the mode of
7944
+ * @returns Object containing the mode value(s) and their frequency
7945
+ */
7946
+ static mode(numbers) {
7947
+ const modeMap = /* @__PURE__ */ new Map();
7948
+ numbers.forEach((value) => {
7949
+ if (modeMap.has(value)) {
7950
+ modeMap.set(value, modeMap.get(value) + 1);
7951
+ } else {
7952
+ modeMap.set(value, 1);
7953
+ }
7954
+ });
7955
+ let maxFrequency = 0;
7956
+ for (const numberFrequency of modeMap.values()) {
7957
+ if (numberFrequency > maxFrequency) {
7958
+ maxFrequency = numberFrequency;
7959
+ }
7960
+ }
7961
+ const modeResult = [];
7962
+ for (const [key, value] of modeMap.entries()) {
7963
+ if (value === maxFrequency) {
7964
+ modeResult.push(key);
7965
+ }
7966
+ }
7967
+ return {
7968
+ modeResult,
7969
+ maxFrequency
7970
+ };
7971
+ }
7972
+ /**
7973
+ * Find the minimum value in an array of numbers
7974
+ * @param numbers - Array of numbers to find the minimum of
7975
+ * @returns The minimum value
7976
+ */
7977
+ static min(numbers) {
7978
+ const minValue = Math.min(...numbers);
7979
+ return minValue;
7980
+ }
7981
+ /**
7982
+ * Find the maximum value in an array of numbers
7983
+ * @param numbers - Array of numbers to find the maximum of
7984
+ * @returns The maximum value
7985
+ */
7986
+ static max(numbers) {
7987
+ const maxValue = Math.max(...numbers);
7988
+ return maxValue;
7989
+ }
7990
+ };
7991
+
7992
+ // src/templates/tools/utils/trigonometric.ts
7993
+ var Trigonometric = class {
7994
+ /**
7995
+ * Calculate the sin of a number in radians
7996
+ * @param number - The number to find the sin of
7997
+ * @returns The sin of a number in radians
7998
+ */
7999
+ static sin(number) {
8000
+ const sin = Math.sin(number);
8001
+ return sin;
8002
+ }
8003
+ /**
8004
+ * Calculate the arcsin of a number in radians
8005
+ * @param number - The number to find the arcsin of
8006
+ * @returns The arcsin of a number in radians
8007
+ */
8008
+ static arcsin(number) {
8009
+ const arcsin = Math.asin(number);
8010
+ return arcsin;
8011
+ }
8012
+ /**
8013
+ * Calculate the cos of a number in radians
8014
+ * @param number - The number to find the cos of
8015
+ * @returns The cos of a number in radians
8016
+ */
8017
+ static cos(number) {
8018
+ const cos = Math.cos(number);
8019
+ return cos;
8020
+ }
8021
+ /**
8022
+ * Calculate the arccos of a number in radians
8023
+ * @param number - The number to find the arccos of
8024
+ * @returns The arccos of a number in radians
8025
+ */
8026
+ static arccos(number) {
8027
+ const arccos = Math.acos(number);
8028
+ return arccos;
8029
+ }
8030
+ /**
8031
+ * Calculate the tangent of a number in radians
8032
+ * @param number - The number to find the tangent of
8033
+ * @returns The tangent of a number in radians
8034
+ */
8035
+ static tan(number) {
8036
+ const tangent = Math.tan(number);
8037
+ return tangent;
8038
+ }
8039
+ /**
8040
+ * Calculate the arc tangent of a number in radians
8041
+ * @param number - The number to find the arc tangent of
8042
+ * @returns The arc tangent of a number in radians
8043
+ */
8044
+ static arctan(number) {
8045
+ const arctangent = Math.atan(number);
8046
+ return arctangent;
8047
+ }
8048
+ /**
8049
+ * Converts a radian into its equivalent value in degrees
8050
+ * @param number - The number to get the degree of
8051
+ * @returns The degree of the number
8052
+ */
8053
+ static radiansToDegrees(number) {
8054
+ const degrees = number * (180 / Math.PI);
8055
+ return degrees;
8056
+ }
8057
+ /**
8058
+ * Converts a degree into its equivalent value in radians
8059
+ * @param number - The number to get the radians of
8060
+ * @returns The radians of the number
8061
+ */
8062
+ static degreesToRadians(number) {
8063
+ const radians = number * (Math.PI / 180);
8064
+ return radians;
8065
+ }
8066
+ };
8067
+
8068
+ // src/templates/tools/math.ts
8069
+ var additionTool = new ExuluTool2({
8070
+ id: "addition",
8071
+ name: "Addition",
8072
+ description: "Adds two numbers together",
8073
+ type: "function",
8074
+ config: [],
8075
+ inputSchema: z4.object({
8076
+ firstNumber: z4.number().describe("The first addend"),
8077
+ secondNumber: z4.number().describe("The second addend")
8078
+ }),
8079
+ execute: async ({ firstNumber, secondNumber }) => {
8080
+ const value = Arithmetic.add(firstNumber, secondNumber);
8081
+ return { result: `${value}` };
8082
+ }
8083
+ });
8084
+ var subtractionTool = new ExuluTool2({
8085
+ id: "subtraction",
8086
+ name: "Subtraction",
8087
+ description: "Subtracts the second number from the first number",
8088
+ type: "function",
8089
+ config: [],
8090
+ inputSchema: z4.object({
8091
+ minuend: z4.number().describe("The number to subtract from (minuend)"),
8092
+ subtrahend: z4.number().describe("The number being subtracted (subtrahend)")
8093
+ }),
8094
+ execute: async ({ minuend, subtrahend }) => {
8095
+ const value = Arithmetic.subtract(minuend, subtrahend);
8096
+ return { result: `${value}` };
8097
+ }
8098
+ });
8099
+ var multiplicationTool = new ExuluTool2({
8100
+ id: "multiplication",
8101
+ name: "Multiplication",
8102
+ description: "Multiplies two numbers together",
8103
+ type: "function",
8104
+ config: [],
8105
+ inputSchema: z4.object({
8106
+ firstNumber: z4.number().describe("The first number"),
8107
+ SecondNumber: z4.number().describe("The second number")
8108
+ }),
8109
+ execute: async ({ firstNumber, SecondNumber }) => {
8110
+ const value = Arithmetic.multiply(firstNumber, SecondNumber);
8111
+ return { result: `${value}` };
8112
+ }
8113
+ });
8114
+ var divisionTool = new ExuluTool2({
8115
+ id: "division",
8116
+ name: "Division",
8117
+ description: "Divides the first number by the second number",
8118
+ type: "function",
8119
+ config: [],
8120
+ inputSchema: z4.object({
8121
+ numerator: z4.number().describe("The number being divided (numerator)"),
8122
+ denominator: z4.number().describe("The number to divide by (denominator)")
8123
+ }),
8124
+ execute: async ({ numerator, denominator }) => {
8125
+ const value = Arithmetic.division(numerator, denominator);
8126
+ return { result: `${value}` };
8127
+ }
8128
+ });
8129
+ var sumTool = new ExuluTool2({
8130
+ id: "sum",
8131
+ name: "Sum",
8132
+ description: "Adds any number of numbers together",
8133
+ type: "function",
8134
+ config: [],
8135
+ inputSchema: z4.object({
8136
+ numbers: z4.array(z4.number()).min(1).describe("Array of numbers to sum")
8137
+ }),
8138
+ execute: async ({ numbers }) => {
8139
+ const value = Arithmetic.sum(numbers);
8140
+ return { result: `${value}` };
8141
+ }
8142
+ });
8143
+ var moduloTool = new ExuluTool2({
8144
+ id: "modulo",
8145
+ name: "Modulo",
8146
+ description: "Divides two numbers and returns the remainder",
8147
+ type: "function",
8148
+ config: [],
8149
+ inputSchema: z4.object({
8150
+ numerator: z4.number().describe("The number being divided (numerator)"),
8151
+ denominator: z4.number().describe("The number to divide by (denominator)")
8152
+ }),
8153
+ execute: async ({ numerator, denominator }) => {
8154
+ const value = Arithmetic.modulo(numerator, denominator);
8155
+ return { result: `${value}` };
8156
+ }
8157
+ });
8158
+ var meanTool = new ExuluTool2({
8159
+ id: "mean",
8160
+ name: "Mean",
8161
+ description: "Calculates the arithmetic mean of a list of numbers",
8162
+ type: "function",
8163
+ config: [],
8164
+ inputSchema: z4.object({
8165
+ numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the mean of")
8166
+ }),
8167
+ execute: async ({ numbers }) => {
8168
+ const value = Statistics.mean(numbers);
8169
+ return { result: `${value}` };
8170
+ }
8171
+ });
8172
+ var medianTool = new ExuluTool2({
8173
+ id: "median",
8174
+ name: "Median",
8175
+ description: "Calculates the median of a list of numbers",
8176
+ type: "function",
8177
+ config: [],
8178
+ inputSchema: z4.object({
8179
+ numbers: z4.array(z4.number()).min(1).describe("Array of numbers to find the median of")
8180
+ }),
8181
+ execute: async ({ numbers }) => {
8182
+ const value = Statistics.median(numbers);
8183
+ return { result: `${value}` };
8184
+ }
8185
+ });
8186
+ var modeTool = new ExuluTool2({
8187
+ id: "mode",
8188
+ name: "Mode",
8189
+ description: "Finds the most common number in a list of numbers",
8190
+ type: "function",
8191
+ config: [],
8192
+ inputSchema: z4.object({
8193
+ numbers: z4.array(z4.number()).describe("Array of numbers to find the mode of")
8194
+ }),
8195
+ execute: async ({ numbers }) => {
8196
+ const value = Statistics.mode(numbers);
8197
+ return { result: `Entries (${value.modeResult.join(", ")}) appeared ${value.maxFrequency} times` };
8198
+ }
8199
+ });
8200
+ var minTool = new ExuluTool2({
8201
+ id: "min",
8202
+ name: "Minimum",
8203
+ description: "Finds the minimum value from a list of numbers",
8204
+ type: "function",
8205
+ config: [],
8206
+ inputSchema: z4.object({
8207
+ numbers: z4.array(z4.number()).describe("Array of numbers to find the minimum of")
8208
+ }),
8209
+ execute: async ({ numbers }) => {
8210
+ const value = Statistics.min(numbers);
8211
+ return { result: `${value}` };
8212
+ }
8213
+ });
8214
+ var maxTool = new ExuluTool2({
8215
+ id: "max",
8216
+ name: "Maximum",
8217
+ description: "Finds the maximum value from a list of numbers",
8218
+ type: "function",
8219
+ config: [],
8220
+ inputSchema: z4.object({
8221
+ numbers: z4.array(z4.number()).describe("Array of numbers to find the maximum of")
8222
+ }),
8223
+ execute: async ({ numbers }) => {
8224
+ const value = Statistics.max(numbers);
8225
+ return { result: `${value}` };
8226
+ }
8227
+ });
8228
+ var floorTool = new ExuluTool2({
8229
+ id: "floor",
8230
+ name: "Floor",
8231
+ description: "Rounds a number down to the nearest integer",
8232
+ type: "function",
8233
+ config: [],
8234
+ inputSchema: z4.object({
8235
+ number: z4.number().describe("The number to round down")
8236
+ }),
8237
+ execute: async ({ number }) => {
8238
+ const value = Arithmetic.floor(number);
8239
+ return { result: `${value}` };
8240
+ }
8241
+ });
8242
+ var ceilingTool = new ExuluTool2({
8243
+ id: "ceiling",
8244
+ name: "Ceiling",
8245
+ description: "Rounds a number up to the nearest integer",
8246
+ type: "function",
8247
+ config: [],
8248
+ inputSchema: z4.object({
8249
+ number: z4.number().describe("The number to round up")
8250
+ }),
8251
+ execute: async ({ number }) => {
8252
+ const value = Arithmetic.ceil(number);
8253
+ return { result: `${value}` };
8254
+ }
8255
+ });
8256
+ var roundTool = new ExuluTool2({
8257
+ id: "round",
8258
+ name: "Round",
8259
+ description: "Rounds a number to the nearest integer",
8260
+ type: "function",
8261
+ config: [],
8262
+ inputSchema: z4.object({
8263
+ number: z4.number().describe("The number to round")
8264
+ }),
8265
+ execute: async ({ number }) => {
8266
+ const value = Arithmetic.round(number);
8267
+ return { result: `${value}` };
8268
+ }
8269
+ });
8270
+ var sinTool = new ExuluTool2({
8271
+ id: "sin",
8272
+ name: "Sine",
8273
+ description: "Calculates the sine of a number in radians",
8274
+ type: "function",
8275
+ config: [],
8276
+ inputSchema: z4.object({
8277
+ number: z4.number().describe("The number in radians to find the sine of")
8278
+ }),
8279
+ execute: async ({ number }) => {
8280
+ const value = Trigonometric.sin(number);
8281
+ return { result: `${value}` };
8282
+ }
8283
+ });
8284
+ var arcsinTool = new ExuluTool2({
8285
+ id: "arcsin",
8286
+ name: "Arcsine",
8287
+ description: "Calculates the arcsine of a number in radians",
8288
+ type: "function",
8289
+ config: [],
8290
+ inputSchema: z4.object({
8291
+ number: z4.number().describe("The number to find the arcsine of")
8292
+ }),
8293
+ execute: async ({ number }) => {
8294
+ const value = Trigonometric.arcsin(number);
8295
+ return { result: `${value}` };
8296
+ }
8297
+ });
8298
+ var cosTool = new ExuluTool2({
8299
+ id: "cos",
8300
+ name: "Cosine",
8301
+ description: "Calculates the cosine of a number in radians",
8302
+ type: "function",
8303
+ config: [],
8304
+ inputSchema: z4.object({
8305
+ number: z4.number().describe("The number in radians to find the cosine of")
8306
+ }),
8307
+ execute: async ({ number }) => {
8308
+ const value = Trigonometric.cos(number);
8309
+ return { result: `${value}` };
8310
+ }
8311
+ });
8312
+ var arccosTool = new ExuluTool2({
8313
+ id: "arccos",
8314
+ name: "Arccosine",
8315
+ description: "Calculates the arccosine of a number in radians",
8316
+ type: "function",
8317
+ config: [],
8318
+ inputSchema: z4.object({
8319
+ number: z4.number().describe("The number to find the arccosine of")
8320
+ }),
8321
+ execute: async ({ number }) => {
8322
+ const value = Trigonometric.arccos(number);
8323
+ return { result: `${value}` };
8324
+ }
8325
+ });
8326
+ var tanTool = new ExuluTool2({
8327
+ id: "tan",
8328
+ name: "Tangent",
8329
+ description: "Calculates the tangent of a number in radians",
8330
+ type: "function",
8331
+ config: [],
8332
+ inputSchema: z4.object({
8333
+ number: z4.number().describe("The number in radians to find the tangent of")
8334
+ }),
8335
+ execute: async ({ number }) => {
8336
+ const value = Trigonometric.tan(number);
8337
+ return { result: `${value}` };
8338
+ }
8339
+ });
8340
+ var arctanTool = new ExuluTool2({
8341
+ id: "arctan",
8342
+ name: "Arctangent",
8343
+ description: "Calculates the arctangent of a number in radians",
8344
+ type: "function",
8345
+ config: [],
8346
+ inputSchema: z4.object({
8347
+ number: z4.number().describe("The number to find the arctangent of")
8348
+ }),
8349
+ execute: async ({ number }) => {
8350
+ const value = Trigonometric.arctan(number);
8351
+ return { result: `${value}` };
8352
+ }
8353
+ });
8354
+ var radiansToDegreesTool = new ExuluTool2({
8355
+ id: "radiansToDegrees",
8356
+ name: "Radians to Degrees",
8357
+ description: "Converts a radian value to its equivalent in degrees",
8358
+ type: "function",
8359
+ config: [],
8360
+ inputSchema: z4.object({
8361
+ number: z4.number().describe("The number in radians to convert to degrees")
8362
+ }),
8363
+ execute: async ({ number }) => {
8364
+ const value = Trigonometric.radiansToDegrees(number);
8365
+ return { result: `${value}` };
8366
+ }
8367
+ });
8368
+ var degreesToRadiansTool = new ExuluTool2({
8369
+ id: "degreesToRadians",
8370
+ name: "Degrees to Radians",
8371
+ description: "Converts a degree value to its equivalent in radians",
8372
+ type: "function",
8373
+ config: [],
8374
+ inputSchema: z4.object({
8375
+ number: z4.number().describe("The number in degrees to convert to radians")
8376
+ }),
8377
+ execute: async ({ number }) => {
8378
+ const value = Trigonometric.degreesToRadians(number);
8379
+ return { result: `${value}` };
8380
+ }
8381
+ });
8382
+ var mathTools = [
8383
+ additionTool,
8384
+ subtractionTool,
8385
+ multiplicationTool,
8386
+ divisionTool,
8387
+ sumTool,
8388
+ moduloTool,
8389
+ meanTool,
8390
+ medianTool,
8391
+ modeTool,
8392
+ minTool,
8393
+ maxTool,
8394
+ floorTool,
8395
+ ceilingTool,
8396
+ roundTool,
8397
+ sinTool,
8398
+ arcsinTool,
8399
+ cosTool,
8400
+ arccosTool,
8401
+ tanTool,
8402
+ arctanTool,
8403
+ radiansToDegreesTool,
8404
+ degreesToRadiansTool
8405
+ ];
8406
+
7735
8407
  // src/registry/index.ts
7736
8408
  var isDev = process.env.NODE_ENV !== "production";
7737
8409
  var consoleTransport = new winston2.transports.Console({
@@ -7761,7 +8433,7 @@ var isValidPostgresName = (id) => {
7761
8433
  const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
7762
8434
  const isValid = regex.test(id);
7763
8435
  const length = id.length;
7764
- return isValid && length <= 80 && length > 5;
8436
+ return isValid && length <= 80 && length > 2;
7765
8437
  };
7766
8438
  var ExuluApp = class {
7767
8439
  _agents = [];
@@ -7803,6 +8475,7 @@ var ExuluApp = class {
7803
8475
  this._config = config;
7804
8476
  this._tools = [
7805
8477
  ...tools ?? [],
8478
+ ...mathTools,
7806
8479
  // Add contexts as tools
7807
8480
  ...Object.values(contexts || {}).map((context) => context.tool())
7808
8481
  // Because agents are stored in the database, we add those as tools
@@ -7998,80 +8671,6 @@ var ExuluApp = class {
7998
8671
  };
7999
8672
  };
8000
8673
 
8001
- // src/bullmq/queues.ts
8002
- import { Queue as Queue3 } from "bullmq";
8003
- import { BullMQOtel } from "bullmq-otel";
8004
- var ExuluQueues = class {
8005
- queues;
8006
- constructor() {
8007
- this.queues = [];
8008
- }
8009
- list = /* @__PURE__ */ new Map();
8010
- // list of queue names
8011
- queue(name) {
8012
- return this.queues.find((x) => x.queue?.name === name);
8013
- }
8014
- // name: string
8015
- // concurrency: global concurrency for the queue
8016
- // ratelimit: maximum number of jobs per second
8017
- // Rate limit is set on workers (see workers.ts), even global rate limits,
8018
- // that is a bit counter-intuitive. Since queues are registered using .user
8019
- // method of ExuluQueues we need to store the desired rate limit on the queue
8020
- // here so we can use the value when creating workers for the queue instance
8021
- // as there is no way to store a rate limit value natively on a bullm queue.
8022
- register = (name, concurrency = 1, ratelimit = 1) => {
8023
- const use = async () => {
8024
- const existing = this.queues.find((x) => x.queue?.name === name);
8025
- if (existing) {
8026
- const globalConcurrency = await existing.queue.getGlobalConcurrency();
8027
- if (globalConcurrency !== concurrency) {
8028
- await existing.queue.setGlobalConcurrency(concurrency);
8029
- }
8030
- return {
8031
- queue: existing.queue,
8032
- ratelimit,
8033
- concurrency
8034
- };
8035
- }
8036
- if (!redisServer.host?.length || !redisServer.port?.length) {
8037
- 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() ).`);
8038
- throw new Error(`[EXULU] no redis server configured.`);
8039
- }
8040
- const newQueue = new Queue3(
8041
- `${name}`,
8042
- {
8043
- connection: {
8044
- ...redisServer,
8045
- enableOfflineQueue: false
8046
- },
8047
- telemetry: new BullMQOtel("simple-guide")
8048
- }
8049
- );
8050
- await newQueue.setGlobalConcurrency(concurrency);
8051
- this.queues.push({
8052
- queue: newQueue,
8053
- ratelimit,
8054
- concurrency
8055
- });
8056
- return {
8057
- queue: newQueue,
8058
- ratelimit,
8059
- concurrency
8060
- };
8061
- };
8062
- this.list.set(name, {
8063
- name,
8064
- concurrency,
8065
- ratelimit,
8066
- use
8067
- });
8068
- return {
8069
- use
8070
- };
8071
- };
8072
- };
8073
- var queues = new ExuluQueues();
8074
-
8075
8674
  // src/chunking/types/base.ts
8076
8675
  var Chunk = class _Chunk {
8077
8676
  /** The text of the chunk. */