@exulu/backend 0.3.11 → 0.3.13

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
@@ -122,11 +122,6 @@ async function postgresClient() {
122
122
  if (!db["exulu"]) {
123
123
  try {
124
124
  console.log("[EXULU] Initializing exulu database.");
125
- console.log(process.env.POSTGRES_DB_HOST);
126
- console.log(process.env.POSTGRES_DB_PORT);
127
- console.log(process.env.POSTGRES_DB_USER);
128
- console.log(process.env.POSTGRES_DB_PASSWORD);
129
- console.log(process.env.POSTGRES_DB_SSL);
130
125
  const knex = (0, import_knex.default)({
131
126
  client: "pg",
132
127
  connection: {
@@ -494,7 +489,7 @@ var agentsSchema = {
494
489
  // src/registry/utils/map-types.ts
495
490
  var mapType = (t, type, name, defaultValue) => {
496
491
  if (type === "text") {
497
- t.string(name, 255);
492
+ t.text(name);
498
493
  return;
499
494
  }
500
495
  if (type === "longText") {
@@ -1122,12 +1117,11 @@ var ExuluEmbedder = class {
1122
1117
  if (!this.chunker) {
1123
1118
  throw new Error("Chunker not found for embedder " + this.name);
1124
1119
  }
1125
- console.log("generating chunks");
1126
1120
  if (!input.id) {
1127
1121
  throw new Error("Item id is required for generating embeddings.");
1128
1122
  }
1129
1123
  const output = await this.chunker(input, this.maxChunkSize);
1130
- console.log("generating embeddings");
1124
+ console.log("[EXULU] Generating embeddings.");
1131
1125
  return await this.generateEmbeddings(output);
1132
1126
  }
1133
1127
  };
@@ -1474,7 +1468,6 @@ var ExuluContext = class {
1474
1468
  if (key === "name" || key === "description" || key === "external_id" || key === "tags" || key === "source" || key === "textLength" || key === "upsert") {
1475
1469
  return;
1476
1470
  }
1477
- console.log("this.fields", this.fields);
1478
1471
  const field = this.fields.find((field2) => field2.name === key);
1479
1472
  if (!field) {
1480
1473
  throw new Error("Trying to uppdate value for field '" + key + "' that does not exist on the context fields definition. Available fields: " + this.fields.map((field2) => sanitizeName(field2.name)).join(", ") + " ,name, description, external_id");
@@ -1551,7 +1544,6 @@ var ExuluContext = class {
1551
1544
  if (key === "name" || key === "description" || key === "external_id" || key === "tags" || key === "source" || key === "textLength" || key === "upsert") {
1552
1545
  return;
1553
1546
  }
1554
- console.log("this.fields", this.fields);
1555
1547
  const field = this.fields.find((field2) => field2.name === key);
1556
1548
  if (!field) {
1557
1549
  throw new Error("Trying to insert value for field '" + key + "' that does not exist on the context fields definition. Available fields: " + this.fields.map((field2) => sanitizeName(field2.name)).join(", ") + " ,name, description, external_id");
@@ -1593,7 +1585,7 @@ var ExuluContext = class {
1593
1585
  if (!exists) {
1594
1586
  await this.createChunksTable();
1595
1587
  }
1596
- console.log("inserting chunks");
1588
+ console.log("[EXULU] Inserting chunks.");
1597
1589
  await db2.from(this.getChunksTableName()).insert(chunks.map((chunk) => ({
1598
1590
  source,
1599
1591
  content: chunk.content,
@@ -1802,7 +1794,7 @@ var ExuluContext = class {
1802
1794
  table.text("description");
1803
1795
  table.text("tags");
1804
1796
  table.boolean("archived").defaultTo(false);
1805
- table.string("external_id", 255);
1797
+ table.text("external_id");
1806
1798
  table.integer("textLength");
1807
1799
  table.text("source");
1808
1800
  for (const field of this.fields) {
@@ -1964,7 +1956,6 @@ var authentication = async ({
1964
1956
  internalkey,
1965
1957
  db: db2
1966
1958
  }) => {
1967
- console.log("[EXULU] apikey", apikey);
1968
1959
  if (internalkey) {
1969
1960
  if (!process.env.INTERNAL_SECRET) {
1970
1961
  return {
@@ -1992,7 +1983,6 @@ var authentication = async ({
1992
1983
  }
1993
1984
  if (authtoken) {
1994
1985
  try {
1995
- console.log("authtoken", authtoken);
1996
1986
  if (!authtoken?.email) {
1997
1987
  return {
1998
1988
  error: true,
@@ -2001,7 +1991,6 @@ var authentication = async ({
2001
1991
  };
2002
1992
  }
2003
1993
  const user = await db2.from("users").select("*").where("email", authtoken?.email).first();
2004
- console.log("user", user);
2005
1994
  if (!user) {
2006
1995
  return {
2007
1996
  error: true,
@@ -2050,15 +2039,11 @@ var authentication = async ({
2050
2039
  code: 401
2051
2040
  };
2052
2041
  }
2053
- console.log("[EXULU] request_key_name", request_key_name);
2054
- console.log("[EXULU] request_key_compare_value", request_key_compare_value);
2055
2042
  const filtered = users.filter(({ apikey: apikey2, id }) => apikey2.includes(request_key_name));
2056
2043
  for (const user of filtered) {
2057
2044
  const user_key_last_slash_index = user.apikey.lastIndexOf("/");
2058
2045
  const user_key_compare_value = user.apikey.substring(0, user_key_last_slash_index);
2059
- console.log("[EXULU] user_key_compare_value", user_key_compare_value);
2060
2046
  const isMatch = await import_bcryptjs2.default.compare(request_key_compare_value, user_key_compare_value);
2061
- console.log("[EXULU] isMatch", isMatch);
2062
2047
  if (isMatch) {
2063
2048
  await db2.from("users").where({ id: user.id }).update({
2064
2049
  last_used: /* @__PURE__ */ new Date()
@@ -2093,7 +2078,6 @@ var requestValidators = {
2093
2078
  if (typeof apikey !== "string") {
2094
2079
  const secret = process.env.NEXTAUTH_SECRET;
2095
2080
  authtoken = await getToken(req.headers["authorization"] ?? "");
2096
- console.log("[EXULU] authtoken", authtoken);
2097
2081
  }
2098
2082
  return await authentication({
2099
2083
  authtoken,
@@ -2195,7 +2179,6 @@ var requestValidators = {
2195
2179
  };
2196
2180
  },
2197
2181
  agents: (req) => {
2198
- console.log("[EXULU] validating request body and headers.", req.body);
2199
2182
  const contentType = req.headers["content-type"] || "";
2200
2183
  if (!contentType.includes("application/json")) {
2201
2184
  return {
@@ -2408,7 +2391,6 @@ function createMutations(table) {
2408
2391
  createdAt: /* @__PURE__ */ new Date(),
2409
2392
  updatedAt: /* @__PURE__ */ new Date()
2410
2393
  }).returning(requestedFields);
2411
- console.log("requestedFields", requestedFields);
2412
2394
  return results[0];
2413
2395
  },
2414
2396
  [`${tableNamePlural}UpdateOne`]: async (_, args, context, info) => {
@@ -2501,7 +2483,6 @@ function createQueries(table) {
2501
2483
  [`${tableNamePlural}Pagination`]: async (_, args, context, info) => {
2502
2484
  const { limit = 10, page = 0, filters = [], sort } = args;
2503
2485
  const { db: db2 } = context;
2504
- console.log("page", page);
2505
2486
  let baseQuery = db2(tableNamePlural);
2506
2487
  baseQuery = applyFilters(baseQuery, filters);
2507
2488
  const [{ count }] = await baseQuery.clone().count("* as count");
@@ -2517,8 +2498,6 @@ function createQueries(table) {
2517
2498
  dataQuery = dataQuery.offset((page - 1) * limit);
2518
2499
  }
2519
2500
  const items = await dataQuery.select(requestedFields).limit(limit);
2520
- console.log("items", items);
2521
- console.log("query", dataQuery.toQuery());
2522
2501
  return {
2523
2502
  pageInfo: {
2524
2503
  pageCount,
@@ -3618,7 +3597,6 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3618
3597
  const response = await db2("jobs").select(db2.raw(`to_char("createdAt", 'YYYY-MM-DD') as date`)).count("* as count").where("type", "embedder").groupByRaw(`to_char("createdAt", 'YYYY-MM-DD')`).then((rows) => ({
3619
3598
  jobs: rows
3620
3599
  }));
3621
- console.log({ response });
3622
3600
  let jobs = [];
3623
3601
  if (response[0]) {
3624
3602
  jobs = response[0].jobs.map((job) => ({
@@ -3715,13 +3693,11 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3715
3693
  });
3716
3694
  console.log("[EXULU] contexts get list");
3717
3695
  app.get(`/contexts`, async (req, res) => {
3718
- console.log("contexts!!");
3719
3696
  const authenticationResult = await requestValidators.authenticate(req);
3720
3697
  if (!authenticationResult.user?.id) {
3721
3698
  res.status(authenticationResult.code || 500).json({ detail: `${authenticationResult.message}` });
3722
3699
  return;
3723
3700
  }
3724
- console.log("contexts", contexts?.length);
3725
3701
  res.status(200).json(contexts.map((context) => ({
3726
3702
  id: context.id,
3727
3703
  name: context.name,
@@ -3988,7 +3964,6 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3988
3964
  console.log("[PROXY] Request body length:", req.body ? req.body.length : 0);
3989
3965
  console.log("[PROXY] Request model name:", req.body.model);
3990
3966
  console.log("[PROXY] Request stream:", req.body.stream);
3991
- console.log("[PROXY] API key:", req.headers["x-api-key"]);
3992
3967
  console.log("[PROXY] Request messages:", req.body.messages?.length);
3993
3968
  try {
3994
3969
  const headers = {
@@ -4386,8 +4361,6 @@ ${code}`
4386
4361
  throw new Error("MCP server not initialized.");
4387
4362
  }
4388
4363
  const sessionId = req.headers[SESSION_ID_HEADER];
4389
- console.log("sessionId!!", sessionId);
4390
- console.log("req.headers!!", req.headers);
4391
4364
  let transport;
4392
4365
  if (sessionId && this.transports[sessionId]) {
4393
4366
  transport = this.transports[sessionId];
@@ -4417,10 +4390,9 @@ ${code}`
4417
4390
  await transport.handleRequest(req, res, req.body);
4418
4391
  });
4419
4392
  const handleSessionRequest = async (req, res) => {
4420
- console.log("handleSessionRequest", req.body);
4421
4393
  const sessionId = req.headers[SESSION_ID_HEADER];
4422
4394
  if (!sessionId || !this.transports[sessionId]) {
4423
- console.log("Invalid or missing session ID");
4395
+ console.log("[EXULU] MCP request invalid or missing session ID");
4424
4396
  res.status(400).send("Invalid or missing session ID");
4425
4397
  return;
4426
4398
  }
@@ -4873,15 +4845,12 @@ var ExuluTokenizer = class {
4873
4845
  console.log("[EXULU] Loading tokenizer.", modelName);
4874
4846
  const model = await (0, import_load.load)(import_registry.default[import_model_to_encoding.default[modelName]]);
4875
4847
  console.log("[EXULU] Loaded tokenizer.", modelName, performance.now() - time);
4876
- console.log("[EXULU] Model.", model.bpe_ranks);
4877
- console.log("[EXULU] Model.", model.special_tokens);
4878
- console.log("[EXULU] Model.", model.pat_str);
4879
4848
  const encoder = new import_lite.Tiktoken(
4880
4849
  model.bpe_ranks,
4881
4850
  model.special_tokens,
4882
4851
  model.pat_str
4883
4852
  );
4884
- console.log("[EXULU] Encoder.", encoder);
4853
+ console.log("[EXULU] Set encoder.");
4885
4854
  this.encoder = encoder;
4886
4855
  return encoder;
4887
4856
  }
@@ -4904,9 +4873,9 @@ var ExuluTokenizer = class {
4904
4873
  throw new Error("Tokenizer not initialized");
4905
4874
  }
4906
4875
  const time = performance.now();
4907
- console.log("[EXULU] Encoding text.", text);
4876
+ console.log("[EXULU] Encoding text length: " + (text?.length || 0));
4908
4877
  const tokens = this.encoder.encode(text);
4909
- console.log("[EXULU] Encoded text.", text, performance.now() - time);
4878
+ console.log("[EXULU] Finished encoding text.", performance.now() - time);
4910
4879
  return tokens;
4911
4880
  }
4912
4881
  async countTokensBatch(texts) {
@@ -4920,7 +4889,6 @@ var ExuluTokenizer = class {
4920
4889
  if (!this.encoder) {
4921
4890
  throw new Error("Tokenizer not initialized");
4922
4891
  }
4923
- console.log("[EXULU] Counting tokens.", text);
4924
4892
  const tokens = this.encoder.encode(text);
4925
4893
  const count = tokens.length;
4926
4894
  console.log("[EXULU] Token count.", count);
@@ -5090,8 +5058,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5090
5058
  *
5091
5059
  * @example <caption>Accessing properties and methods</caption>
5092
5060
  * const chunker = await RecursiveChunker.create();
5093
- * console.log(chunker.chunkSize); // 512
5094
- * console.log(chunker.rules); // RecursiveRules instance
5095
5061
  * const chunks = await chunker.chunk("Some text"); // Use as object method
5096
5062
  *
5097
5063
  * @note
@@ -5310,8 +5276,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5310
5276
  if (!text) {
5311
5277
  return [];
5312
5278
  }
5313
- console.log("[EXULU] Rule.", this.rules.length);
5314
- console.log("[EXULU] Level.", level);
5315
5279
  if (level >= this.rules.length) {
5316
5280
  const tokenCount = await this._estimateTokenCount(text);
5317
5281
  return [
@@ -5375,7 +5339,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5375
5339
  * @returns {Promise<RecursiveChunk[]>} A promise that resolves to an array of RecursiveChunk objects
5376
5340
  */
5377
5341
  async chunk(text) {
5378
- console.log("[EXULU] Chunking text.", text);
5379
5342
  const result = await this._recursiveChunk(text, 0, 0);
5380
5343
  await this.tokenizer.free();
5381
5344
  return result;
@@ -5808,7 +5771,6 @@ var AgentSelector = ({ exulu, setAgent, setEvaluations }) => {
5808
5771
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
5809
5772
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ink2.Text, { children: "Please select an agent:" }),
5810
5773
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Select, { options: agents, onChange: (value) => {
5811
- console.log("selected agent", value);
5812
5774
  const agent = exulu.agent(value);
5813
5775
  if (!agent) {
5814
5776
  console.error("Agent not found", value);
@@ -5831,7 +5793,6 @@ var EvalSelector = ({ evaluations, setEvaluation }) => {
5831
5793
  label: evaluation.runner.name,
5832
5794
  value: evaluation.runner.name
5833
5795
  })), onChange: (value) => {
5834
- console.log("selected eval", value);
5835
5796
  const evaluation = evaluations?.find((evaluation2) => evaluation2.runner.name === value);
5836
5797
  if (evaluation) {
5837
5798
  setEvaluation(evaluation);
package/dist/index.d.cts CHANGED
@@ -1007,8 +1007,6 @@ declare class RecursiveChunker extends BaseChunker {
1007
1007
  *
1008
1008
  * @example <caption>Accessing properties and methods</caption>
1009
1009
  * const chunker = await RecursiveChunker.create();
1010
- * console.log(chunker.chunkSize); // 512
1011
- * console.log(chunker.rules); // RecursiveRules instance
1012
1010
  * const chunks = await chunker.chunk("Some text"); // Use as object method
1013
1011
  *
1014
1012
  * @note
package/dist/index.d.ts CHANGED
@@ -1007,8 +1007,6 @@ declare class RecursiveChunker extends BaseChunker {
1007
1007
  *
1008
1008
  * @example <caption>Accessing properties and methods</caption>
1009
1009
  * const chunker = await RecursiveChunker.create();
1010
- * console.log(chunker.chunkSize); // 512
1011
- * console.log(chunker.rules); // RecursiveRules instance
1012
1010
  * const chunks = await chunker.chunk("Some text"); // Use as object method
1013
1011
  *
1014
1012
  * @note
package/dist/index.js CHANGED
@@ -78,11 +78,6 @@ async function postgresClient() {
78
78
  if (!db["exulu"]) {
79
79
  try {
80
80
  console.log("[EXULU] Initializing exulu database.");
81
- console.log(process.env.POSTGRES_DB_HOST);
82
- console.log(process.env.POSTGRES_DB_PORT);
83
- console.log(process.env.POSTGRES_DB_USER);
84
- console.log(process.env.POSTGRES_DB_PASSWORD);
85
- console.log(process.env.POSTGRES_DB_SSL);
86
81
  const knex = Knex({
87
82
  client: "pg",
88
83
  connection: {
@@ -450,7 +445,7 @@ var agentsSchema = {
450
445
  // src/registry/utils/map-types.ts
451
446
  var mapType = (t, type, name, defaultValue) => {
452
447
  if (type === "text") {
453
- t.string(name, 255);
448
+ t.text(name);
454
449
  return;
455
450
  }
456
451
  if (type === "longText") {
@@ -1078,12 +1073,11 @@ var ExuluEmbedder = class {
1078
1073
  if (!this.chunker) {
1079
1074
  throw new Error("Chunker not found for embedder " + this.name);
1080
1075
  }
1081
- console.log("generating chunks");
1082
1076
  if (!input.id) {
1083
1077
  throw new Error("Item id is required for generating embeddings.");
1084
1078
  }
1085
1079
  const output = await this.chunker(input, this.maxChunkSize);
1086
- console.log("generating embeddings");
1080
+ console.log("[EXULU] Generating embeddings.");
1087
1081
  return await this.generateEmbeddings(output);
1088
1082
  }
1089
1083
  };
@@ -1430,7 +1424,6 @@ var ExuluContext = class {
1430
1424
  if (key === "name" || key === "description" || key === "external_id" || key === "tags" || key === "source" || key === "textLength" || key === "upsert") {
1431
1425
  return;
1432
1426
  }
1433
- console.log("this.fields", this.fields);
1434
1427
  const field = this.fields.find((field2) => field2.name === key);
1435
1428
  if (!field) {
1436
1429
  throw new Error("Trying to uppdate value for field '" + key + "' that does not exist on the context fields definition. Available fields: " + this.fields.map((field2) => sanitizeName(field2.name)).join(", ") + " ,name, description, external_id");
@@ -1507,7 +1500,6 @@ var ExuluContext = class {
1507
1500
  if (key === "name" || key === "description" || key === "external_id" || key === "tags" || key === "source" || key === "textLength" || key === "upsert") {
1508
1501
  return;
1509
1502
  }
1510
- console.log("this.fields", this.fields);
1511
1503
  const field = this.fields.find((field2) => field2.name === key);
1512
1504
  if (!field) {
1513
1505
  throw new Error("Trying to insert value for field '" + key + "' that does not exist on the context fields definition. Available fields: " + this.fields.map((field2) => sanitizeName(field2.name)).join(", ") + " ,name, description, external_id");
@@ -1549,7 +1541,7 @@ var ExuluContext = class {
1549
1541
  if (!exists) {
1550
1542
  await this.createChunksTable();
1551
1543
  }
1552
- console.log("inserting chunks");
1544
+ console.log("[EXULU] Inserting chunks.");
1553
1545
  await db2.from(this.getChunksTableName()).insert(chunks.map((chunk) => ({
1554
1546
  source,
1555
1547
  content: chunk.content,
@@ -1758,7 +1750,7 @@ var ExuluContext = class {
1758
1750
  table.text("description");
1759
1751
  table.text("tags");
1760
1752
  table.boolean("archived").defaultTo(false);
1761
- table.string("external_id", 255);
1753
+ table.text("external_id");
1762
1754
  table.integer("textLength");
1763
1755
  table.text("source");
1764
1756
  for (const field of this.fields) {
@@ -1920,7 +1912,6 @@ var authentication = async ({
1920
1912
  internalkey,
1921
1913
  db: db2
1922
1914
  }) => {
1923
- console.log("[EXULU] apikey", apikey);
1924
1915
  if (internalkey) {
1925
1916
  if (!process.env.INTERNAL_SECRET) {
1926
1917
  return {
@@ -1948,7 +1939,6 @@ var authentication = async ({
1948
1939
  }
1949
1940
  if (authtoken) {
1950
1941
  try {
1951
- console.log("authtoken", authtoken);
1952
1942
  if (!authtoken?.email) {
1953
1943
  return {
1954
1944
  error: true,
@@ -1957,7 +1947,6 @@ var authentication = async ({
1957
1947
  };
1958
1948
  }
1959
1949
  const user = await db2.from("users").select("*").where("email", authtoken?.email).first();
1960
- console.log("user", user);
1961
1950
  if (!user) {
1962
1951
  return {
1963
1952
  error: true,
@@ -2006,15 +1995,11 @@ var authentication = async ({
2006
1995
  code: 401
2007
1996
  };
2008
1997
  }
2009
- console.log("[EXULU] request_key_name", request_key_name);
2010
- console.log("[EXULU] request_key_compare_value", request_key_compare_value);
2011
1998
  const filtered = users.filter(({ apikey: apikey2, id }) => apikey2.includes(request_key_name));
2012
1999
  for (const user of filtered) {
2013
2000
  const user_key_last_slash_index = user.apikey.lastIndexOf("/");
2014
2001
  const user_key_compare_value = user.apikey.substring(0, user_key_last_slash_index);
2015
- console.log("[EXULU] user_key_compare_value", user_key_compare_value);
2016
2002
  const isMatch = await bcrypt2.compare(request_key_compare_value, user_key_compare_value);
2017
- console.log("[EXULU] isMatch", isMatch);
2018
2003
  if (isMatch) {
2019
2004
  await db2.from("users").where({ id: user.id }).update({
2020
2005
  last_used: /* @__PURE__ */ new Date()
@@ -2049,7 +2034,6 @@ var requestValidators = {
2049
2034
  if (typeof apikey !== "string") {
2050
2035
  const secret = process.env.NEXTAUTH_SECRET;
2051
2036
  authtoken = await getToken(req.headers["authorization"] ?? "");
2052
- console.log("[EXULU] authtoken", authtoken);
2053
2037
  }
2054
2038
  return await authentication({
2055
2039
  authtoken,
@@ -2151,7 +2135,6 @@ var requestValidators = {
2151
2135
  };
2152
2136
  },
2153
2137
  agents: (req) => {
2154
- console.log("[EXULU] validating request body and headers.", req.body);
2155
2138
  const contentType = req.headers["content-type"] || "";
2156
2139
  if (!contentType.includes("application/json")) {
2157
2140
  return {
@@ -2364,7 +2347,6 @@ function createMutations(table) {
2364
2347
  createdAt: /* @__PURE__ */ new Date(),
2365
2348
  updatedAt: /* @__PURE__ */ new Date()
2366
2349
  }).returning(requestedFields);
2367
- console.log("requestedFields", requestedFields);
2368
2350
  return results[0];
2369
2351
  },
2370
2352
  [`${tableNamePlural}UpdateOne`]: async (_, args, context, info) => {
@@ -2457,7 +2439,6 @@ function createQueries(table) {
2457
2439
  [`${tableNamePlural}Pagination`]: async (_, args, context, info) => {
2458
2440
  const { limit = 10, page = 0, filters = [], sort } = args;
2459
2441
  const { db: db2 } = context;
2460
- console.log("page", page);
2461
2442
  let baseQuery = db2(tableNamePlural);
2462
2443
  baseQuery = applyFilters(baseQuery, filters);
2463
2444
  const [{ count }] = await baseQuery.clone().count("* as count");
@@ -2473,8 +2454,6 @@ function createQueries(table) {
2473
2454
  dataQuery = dataQuery.offset((page - 1) * limit);
2474
2455
  }
2475
2456
  const items = await dataQuery.select(requestedFields).limit(limit);
2476
- console.log("items", items);
2477
- console.log("query", dataQuery.toQuery());
2478
2457
  return {
2479
2458
  pageInfo: {
2480
2459
  pageCount,
@@ -3574,7 +3553,6 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3574
3553
  const response = await db2("jobs").select(db2.raw(`to_char("createdAt", 'YYYY-MM-DD') as date`)).count("* as count").where("type", "embedder").groupByRaw(`to_char("createdAt", 'YYYY-MM-DD')`).then((rows) => ({
3575
3554
  jobs: rows
3576
3555
  }));
3577
- console.log({ response });
3578
3556
  let jobs = [];
3579
3557
  if (response[0]) {
3580
3558
  jobs = response[0].jobs.map((job) => ({
@@ -3671,13 +3649,11 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3671
3649
  });
3672
3650
  console.log("[EXULU] contexts get list");
3673
3651
  app.get(`/contexts`, async (req, res) => {
3674
- console.log("contexts!!");
3675
3652
  const authenticationResult = await requestValidators.authenticate(req);
3676
3653
  if (!authenticationResult.user?.id) {
3677
3654
  res.status(authenticationResult.code || 500).json({ detail: `${authenticationResult.message}` });
3678
3655
  return;
3679
3656
  }
3680
- console.log("contexts", contexts?.length);
3681
3657
  res.status(200).json(contexts.map((context) => ({
3682
3658
  id: context.id,
3683
3659
  name: context.name,
@@ -3944,7 +3920,6 @@ var createExpressRoutes = async (app, agents, embedders, tools, workflows, conte
3944
3920
  console.log("[PROXY] Request body length:", req.body ? req.body.length : 0);
3945
3921
  console.log("[PROXY] Request model name:", req.body.model);
3946
3922
  console.log("[PROXY] Request stream:", req.body.stream);
3947
- console.log("[PROXY] API key:", req.headers["x-api-key"]);
3948
3923
  console.log("[PROXY] Request messages:", req.body.messages?.length);
3949
3924
  try {
3950
3925
  const headers = {
@@ -4342,8 +4317,6 @@ ${code}`
4342
4317
  throw new Error("MCP server not initialized.");
4343
4318
  }
4344
4319
  const sessionId = req.headers[SESSION_ID_HEADER];
4345
- console.log("sessionId!!", sessionId);
4346
- console.log("req.headers!!", req.headers);
4347
4320
  let transport;
4348
4321
  if (sessionId && this.transports[sessionId]) {
4349
4322
  transport = this.transports[sessionId];
@@ -4373,10 +4346,9 @@ ${code}`
4373
4346
  await transport.handleRequest(req, res, req.body);
4374
4347
  });
4375
4348
  const handleSessionRequest = async (req, res) => {
4376
- console.log("handleSessionRequest", req.body);
4377
4349
  const sessionId = req.headers[SESSION_ID_HEADER];
4378
4350
  if (!sessionId || !this.transports[sessionId]) {
4379
- console.log("Invalid or missing session ID");
4351
+ console.log("[EXULU] MCP request invalid or missing session ID");
4380
4352
  res.status(400).send("Invalid or missing session ID");
4381
4353
  return;
4382
4354
  }
@@ -4829,15 +4801,12 @@ var ExuluTokenizer = class {
4829
4801
  console.log("[EXULU] Loading tokenizer.", modelName);
4830
4802
  const model = await load(registry[models[modelName]]);
4831
4803
  console.log("[EXULU] Loaded tokenizer.", modelName, performance.now() - time);
4832
- console.log("[EXULU] Model.", model.bpe_ranks);
4833
- console.log("[EXULU] Model.", model.special_tokens);
4834
- console.log("[EXULU] Model.", model.pat_str);
4835
4804
  const encoder = new Tiktoken(
4836
4805
  model.bpe_ranks,
4837
4806
  model.special_tokens,
4838
4807
  model.pat_str
4839
4808
  );
4840
- console.log("[EXULU] Encoder.", encoder);
4809
+ console.log("[EXULU] Set encoder.");
4841
4810
  this.encoder = encoder;
4842
4811
  return encoder;
4843
4812
  }
@@ -4860,9 +4829,9 @@ var ExuluTokenizer = class {
4860
4829
  throw new Error("Tokenizer not initialized");
4861
4830
  }
4862
4831
  const time = performance.now();
4863
- console.log("[EXULU] Encoding text.", text);
4832
+ console.log("[EXULU] Encoding text length: " + (text?.length || 0));
4864
4833
  const tokens = this.encoder.encode(text);
4865
- console.log("[EXULU] Encoded text.", text, performance.now() - time);
4834
+ console.log("[EXULU] Finished encoding text.", performance.now() - time);
4866
4835
  return tokens;
4867
4836
  }
4868
4837
  async countTokensBatch(texts) {
@@ -4876,7 +4845,6 @@ var ExuluTokenizer = class {
4876
4845
  if (!this.encoder) {
4877
4846
  throw new Error("Tokenizer not initialized");
4878
4847
  }
4879
- console.log("[EXULU] Counting tokens.", text);
4880
4848
  const tokens = this.encoder.encode(text);
4881
4849
  const count = tokens.length;
4882
4850
  console.log("[EXULU] Token count.", count);
@@ -5046,8 +5014,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5046
5014
  *
5047
5015
  * @example <caption>Accessing properties and methods</caption>
5048
5016
  * const chunker = await RecursiveChunker.create();
5049
- * console.log(chunker.chunkSize); // 512
5050
- * console.log(chunker.rules); // RecursiveRules instance
5051
5017
  * const chunks = await chunker.chunk("Some text"); // Use as object method
5052
5018
  *
5053
5019
  * @note
@@ -5266,8 +5232,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5266
5232
  if (!text) {
5267
5233
  return [];
5268
5234
  }
5269
- console.log("[EXULU] Rule.", this.rules.length);
5270
- console.log("[EXULU] Level.", level);
5271
5235
  if (level >= this.rules.length) {
5272
5236
  const tokenCount = await this._estimateTokenCount(text);
5273
5237
  return [
@@ -5331,7 +5295,6 @@ var RecursiveChunker = class _RecursiveChunker extends BaseChunker {
5331
5295
  * @returns {Promise<RecursiveChunk[]>} A promise that resolves to an array of RecursiveChunk objects
5332
5296
  */
5333
5297
  async chunk(text) {
5334
- console.log("[EXULU] Chunking text.", text);
5335
5298
  const result = await this._recursiveChunk(text, 0, 0);
5336
5299
  await this.tokenizer.free();
5337
5300
  return result;
@@ -5764,7 +5727,6 @@ var AgentSelector = ({ exulu, setAgent, setEvaluations }) => {
5764
5727
  return /* @__PURE__ */ jsxs(Fragment, { children: [
5765
5728
  /* @__PURE__ */ jsx2(Text2, { children: "Please select an agent:" }),
5766
5729
  /* @__PURE__ */ jsx2(Select2, { options: agents, onChange: (value) => {
5767
- console.log("selected agent", value);
5768
5730
  const agent = exulu.agent(value);
5769
5731
  if (!agent) {
5770
5732
  console.error("Agent not found", value);
@@ -5787,7 +5749,6 @@ var EvalSelector = ({ evaluations, setEvaluation }) => {
5787
5749
  label: evaluation.runner.name,
5788
5750
  value: evaluation.runner.name
5789
5751
  })), onChange: (value) => {
5790
- console.log("selected eval", value);
5791
5752
  const evaluation = evaluations?.find((evaluation2) => evaluation2.runner.name === value);
5792
5753
  if (evaluation) {
5793
5754
  setEvaluation(evaluation);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu Bv.",
4
- "version": "0.3.11",
4
+ "version": "0.3.13",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {