@superatomai/sdk-node 0.0.29-mds → 0.0.30-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
@@ -7427,7 +7427,13 @@ Even if a table appears in the detailed schema above, search_schema returns samp
7427
7427
  */
7428
7428
  extractSourceType() {
7429
7429
  const match = this.tool.id.match(/^(\w+)-[a-f0-9]+_/);
7430
- return match ? match[1] : "unknown";
7430
+ if (!match) return "unknown";
7431
+ const raw = match[1].toLowerCase();
7432
+ if (raw.startsWith("mssql")) return "mssql";
7433
+ if (raw.startsWith("postgres")) return "postgres";
7434
+ if (raw.startsWith("mysql")) return "mysql";
7435
+ if (raw.startsWith("snowflake")) return "snowflake";
7436
+ return raw;
7431
7437
  }
7432
7438
  /**
7433
7439
  * Build an empty ExecutedToolInfo for error cases.
@@ -8222,8 +8228,10 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8222
8228
  let currentSql = compProps?.externalTool?.parameters?.sql;
8223
8229
  if (!toolId || !currentSql) return component;
8224
8230
  const executedTool = executedTools.find((t) => t.id === toolId);
8225
- const dbType = executedTool?.sourceType || "postgresql";
8226
- currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8231
+ const dbType = executedTool?.sourceType;
8232
+ if (dbType) {
8233
+ currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8234
+ }
8227
8235
  let attempts = 0;
8228
8236
  while (attempts < MAX_QUERY_VALIDATION_RETRIES) {
8229
8237
  attempts++;
@@ -8273,7 +8281,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8273
8281
  apiKey
8274
8282
  );
8275
8283
  if (fixedSql && fixedSql !== currentSql) {
8276
- currentSql = ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8284
+ currentSql = dbType ? ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType) : fixedSql;
8277
8285
  logger.info(`[AgentComponentGen] LLM provided fix for ${component.name}, retrying...`);
8278
8286
  } else {
8279
8287
  logger.warn(`[AgentComponentGen] LLM returned same or empty query, stopping retries`);