@superatomai/sdk-node 0.0.22-mds → 0.0.23-mds

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
@@ -5017,7 +5017,8 @@ var TOOL_TRACKING_MAX_ROWS = 5;
5017
5017
  var TOOL_TRACKING_MAX_CHARS = 200;
5018
5018
  var TOOL_TRACKING_SAMPLE_ROWS = 3;
5019
5019
  var DEFAULT_QUERY_LIMIT = 10;
5020
- var MAX_COMPONENT_QUERY_LIMIT = 10;
5020
+ var MAX_AGENT_QUERY_LIMIT = 10;
5021
+ var MAX_COMPONENT_QUERY_LIMIT = 100;
5021
5022
  var EXACT_MATCH_SIMILARITY_THRESHOLD = 0.99;
5022
5023
  var DEFAULT_CONVERSATION_SIMILARITY_THRESHOLD = 0.8;
5023
5024
  var MAX_TOOL_CALLING_ITERATIONS = 20;
@@ -7806,11 +7807,11 @@ function validateAndCleanQuery(query, config) {
7806
7807
  }
7807
7808
  }
7808
7809
  if (typeof cleanedQuery === "string") {
7809
- const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
7810
+ const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
7810
7811
  if (limitedQuery !== cleanedQuery) wasModified = true;
7811
7812
  cleanedQuery = limitedQuery;
7812
7813
  } else if (cleanedQuery?.sql) {
7813
- const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
7814
+ const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
7814
7815
  if (limitedSql !== cleanedQuery.sql) wasModified = true;
7815
7816
  cleanedQuery = { ...cleanedQuery, sql: limitedSql };
7816
7817
  }
@@ -8207,7 +8208,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8207
8208
  if (!toolId || !currentSql) return component;
8208
8209
  const executedTool = executedTools.find((t) => t.id === toolId);
8209
8210
  const dbType = executedTool?.sourceType || "postgresql";
8210
- currentSql = ensureQueryLimit(currentSql, 10, MAX_COMPONENT_QUERY_LIMIT, dbType);
8211
+ currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8211
8212
  let attempts = 0;
8212
8213
  while (attempts < MAX_QUERY_VALIDATION_RETRIES) {
8213
8214
  attempts++;
@@ -8257,7 +8258,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8257
8258
  apiKey
8258
8259
  );
8259
8260
  if (fixedSql && fixedSql !== currentSql) {
8260
- currentSql = ensureQueryLimit(fixedSql, 10, MAX_COMPONENT_QUERY_LIMIT, dbType);
8261
+ currentSql = ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8261
8262
  logger.info(`[AgentComponentGen] LLM provided fix for ${component.name}, retrying...`);
8262
8263
  } else {
8263
8264
  logger.warn(`[AgentComponentGen] LLM returned same or empty query, stopping retries`);
@@ -8613,7 +8614,7 @@ Fixed SQL query:`;
8613
8614
  );
8614
8615
  if (fixedQueryStr && fixedQueryStr !== currentQueryStr) {
8615
8616
  logger.info(`[${this.config.providerName}] Received fixed query for ${component.name}, retrying...`);
8616
- const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
8617
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
8617
8618
  currentQueryStr = limitedFixedQuery;
8618
8619
  if (typeof currentQuery === "string") {
8619
8620
  currentQuery = limitedFixedQuery;
@@ -8745,7 +8746,7 @@ var ToolExecutorService = class {
8745
8746
  const params = toolInput.params || {};
8746
8747
  const reasoning = toolInput.reasoning;
8747
8748
  const { streamBuffer, collections, providerName } = this.config;
8748
- sql = ensureQueryLimit(sql, MAX_COMPONENT_QUERY_LIMIT, MAX_COMPONENT_QUERY_LIMIT);
8749
+ sql = ensureQueryLimit(sql, MAX_AGENT_QUERY_LIMIT, MAX_AGENT_QUERY_LIMIT);
8749
8750
  const queryKey = sql.toLowerCase().replace(/\s+/g, " ").trim();
8750
8751
  const attempts = (this.queryAttempts.get(queryKey) || 0) + 1;
8751
8752
  this.queryAttempts.set(queryKey, attempts);
@@ -8941,11 +8942,11 @@ Please try rephrasing your request or contact support.
8941
8942
  await streamDelay();
8942
8943
  }
8943
8944
  const cappedToolInput = { ...toolInput };
8944
- if (cappedToolInput.limit !== void 0 && cappedToolInput.limit > MAX_COMPONENT_QUERY_LIMIT) {
8945
- logger.info(`[${providerName}] Capping external tool limit from ${cappedToolInput.limit} to ${MAX_COMPONENT_QUERY_LIMIT}`);
8946
- cappedToolInput.limit = MAX_COMPONENT_QUERY_LIMIT;
8945
+ if (cappedToolInput.limit !== void 0 && cappedToolInput.limit > MAX_AGENT_QUERY_LIMIT) {
8946
+ logger.info(`[${providerName}] Capping external tool limit from ${cappedToolInput.limit} to ${MAX_AGENT_QUERY_LIMIT}`);
8947
+ cappedToolInput.limit = MAX_AGENT_QUERY_LIMIT;
8947
8948
  } else if (cappedToolInput.limit === void 0) {
8948
- cappedToolInput.limit = MAX_COMPONENT_QUERY_LIMIT;
8949
+ cappedToolInput.limit = MAX_AGENT_QUERY_LIMIT;
8949
8950
  }
8950
8951
  const result = await withProgressHeartbeat(
8951
8952
  () => externalTool.fn(cappedToolInput),
@@ -9266,10 +9267,10 @@ ${executedToolsText}`);
9266
9267
  let answerQuery = answerComponent.props?.query;
9267
9268
  if (answerQuery) {
9268
9269
  if (typeof answerQuery === "string") {
9269
- answerQuery = ensureQueryLimit(answerQuery, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
9270
+ answerQuery = ensureQueryLimit(answerQuery, this.defaultLimit, MAX_AGENT_QUERY_LIMIT);
9270
9271
  } else if (answerQuery?.sql) {
9271
9272
  const queryObj = answerQuery;
9272
- answerQuery = { ...queryObj, sql: ensureQueryLimit(queryObj.sql, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT) };
9273
+ answerQuery = { ...queryObj, sql: ensureQueryLimit(queryObj.sql, this.defaultLimit, MAX_AGENT_QUERY_LIMIT) };
9273
9274
  }
9274
9275
  answerComponent.props.query = answerQuery;
9275
9276
  }
@@ -9310,7 +9311,7 @@ ${executedToolsText}`);
9310
9311
  },
9311
9312
  apiKey
9312
9313
  );
9313
- const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
9314
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, MAX_AGENT_QUERY_LIMIT);
9314
9315
  if (typeof currentQuery === "string") {
9315
9316
  currentQuery = limitedFixedQuery;
9316
9317
  } else {