@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.mjs CHANGED
@@ -4957,7 +4957,8 @@ var TOOL_TRACKING_MAX_ROWS = 5;
4957
4957
  var TOOL_TRACKING_MAX_CHARS = 200;
4958
4958
  var TOOL_TRACKING_SAMPLE_ROWS = 3;
4959
4959
  var DEFAULT_QUERY_LIMIT = 10;
4960
- var MAX_COMPONENT_QUERY_LIMIT = 10;
4960
+ var MAX_AGENT_QUERY_LIMIT = 10;
4961
+ var MAX_COMPONENT_QUERY_LIMIT = 100;
4961
4962
  var EXACT_MATCH_SIMILARITY_THRESHOLD = 0.99;
4962
4963
  var DEFAULT_CONVERSATION_SIMILARITY_THRESHOLD = 0.8;
4963
4964
  var MAX_TOOL_CALLING_ITERATIONS = 20;
@@ -7746,11 +7747,11 @@ function validateAndCleanQuery(query, config) {
7746
7747
  }
7747
7748
  }
7748
7749
  if (typeof cleanedQuery === "string") {
7749
- const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
7750
+ const limitedQuery = ensureQueryLimit(cleanedQuery, config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
7750
7751
  if (limitedQuery !== cleanedQuery) wasModified = true;
7751
7752
  cleanedQuery = limitedQuery;
7752
7753
  } else if (cleanedQuery?.sql) {
7753
- const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
7754
+ const limitedSql = ensureQueryLimit(cleanedQuery.sql, config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
7754
7755
  if (limitedSql !== cleanedQuery.sql) wasModified = true;
7755
7756
  cleanedQuery = { ...cleanedQuery, sql: limitedSql };
7756
7757
  }
@@ -8147,7 +8148,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8147
8148
  if (!toolId || !currentSql) return component;
8148
8149
  const executedTool = executedTools.find((t) => t.id === toolId);
8149
8150
  const dbType = executedTool?.sourceType || "postgresql";
8150
- currentSql = ensureQueryLimit(currentSql, 10, MAX_COMPONENT_QUERY_LIMIT, dbType);
8151
+ currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8151
8152
  let attempts = 0;
8152
8153
  while (attempts < MAX_QUERY_VALIDATION_RETRIES) {
8153
8154
  attempts++;
@@ -8197,7 +8198,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8197
8198
  apiKey
8198
8199
  );
8199
8200
  if (fixedSql && fixedSql !== currentSql) {
8200
- currentSql = ensureQueryLimit(fixedSql, 10, MAX_COMPONENT_QUERY_LIMIT, dbType);
8201
+ currentSql = ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8201
8202
  logger.info(`[AgentComponentGen] LLM provided fix for ${component.name}, retrying...`);
8202
8203
  } else {
8203
8204
  logger.warn(`[AgentComponentGen] LLM returned same or empty query, stopping retries`);
@@ -8553,7 +8554,7 @@ Fixed SQL query:`;
8553
8554
  );
8554
8555
  if (fixedQueryStr && fixedQueryStr !== currentQueryStr) {
8555
8556
  logger.info(`[${this.config.providerName}] Received fixed query for ${component.name}, retrying...`);
8556
- const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.config.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
8557
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.config.defaultLimit, MAX_AGENT_QUERY_LIMIT);
8557
8558
  currentQueryStr = limitedFixedQuery;
8558
8559
  if (typeof currentQuery === "string") {
8559
8560
  currentQuery = limitedFixedQuery;
@@ -8685,7 +8686,7 @@ var ToolExecutorService = class {
8685
8686
  const params = toolInput.params || {};
8686
8687
  const reasoning = toolInput.reasoning;
8687
8688
  const { streamBuffer, collections, providerName } = this.config;
8688
- sql = ensureQueryLimit(sql, MAX_COMPONENT_QUERY_LIMIT, MAX_COMPONENT_QUERY_LIMIT);
8689
+ sql = ensureQueryLimit(sql, MAX_AGENT_QUERY_LIMIT, MAX_AGENT_QUERY_LIMIT);
8689
8690
  const queryKey = sql.toLowerCase().replace(/\s+/g, " ").trim();
8690
8691
  const attempts = (this.queryAttempts.get(queryKey) || 0) + 1;
8691
8692
  this.queryAttempts.set(queryKey, attempts);
@@ -8881,11 +8882,11 @@ Please try rephrasing your request or contact support.
8881
8882
  await streamDelay();
8882
8883
  }
8883
8884
  const cappedToolInput = { ...toolInput };
8884
- if (cappedToolInput.limit !== void 0 && cappedToolInput.limit > MAX_COMPONENT_QUERY_LIMIT) {
8885
- logger.info(`[${providerName}] Capping external tool limit from ${cappedToolInput.limit} to ${MAX_COMPONENT_QUERY_LIMIT}`);
8886
- cappedToolInput.limit = MAX_COMPONENT_QUERY_LIMIT;
8885
+ if (cappedToolInput.limit !== void 0 && cappedToolInput.limit > MAX_AGENT_QUERY_LIMIT) {
8886
+ logger.info(`[${providerName}] Capping external tool limit from ${cappedToolInput.limit} to ${MAX_AGENT_QUERY_LIMIT}`);
8887
+ cappedToolInput.limit = MAX_AGENT_QUERY_LIMIT;
8887
8888
  } else if (cappedToolInput.limit === void 0) {
8888
- cappedToolInput.limit = MAX_COMPONENT_QUERY_LIMIT;
8889
+ cappedToolInput.limit = MAX_AGENT_QUERY_LIMIT;
8889
8890
  }
8890
8891
  const result = await withProgressHeartbeat(
8891
8892
  () => externalTool.fn(cappedToolInput),
@@ -9206,10 +9207,10 @@ ${executedToolsText}`);
9206
9207
  let answerQuery = answerComponent.props?.query;
9207
9208
  if (answerQuery) {
9208
9209
  if (typeof answerQuery === "string") {
9209
- answerQuery = ensureQueryLimit(answerQuery, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
9210
+ answerQuery = ensureQueryLimit(answerQuery, this.defaultLimit, MAX_AGENT_QUERY_LIMIT);
9210
9211
  } else if (answerQuery?.sql) {
9211
9212
  const queryObj = answerQuery;
9212
- answerQuery = { ...queryObj, sql: ensureQueryLimit(queryObj.sql, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT) };
9213
+ answerQuery = { ...queryObj, sql: ensureQueryLimit(queryObj.sql, this.defaultLimit, MAX_AGENT_QUERY_LIMIT) };
9213
9214
  }
9214
9215
  answerComponent.props.query = answerQuery;
9215
9216
  }
@@ -9250,7 +9251,7 @@ ${executedToolsText}`);
9250
9251
  },
9251
9252
  apiKey
9252
9253
  );
9253
- const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, MAX_COMPONENT_QUERY_LIMIT);
9254
+ const limitedFixedQuery = ensureQueryLimit(fixedQueryStr, this.defaultLimit, MAX_AGENT_QUERY_LIMIT);
9254
9255
  if (typeof currentQuery === "string") {
9255
9256
  currentQuery = limitedFixedQuery;
9256
9257
  } else {