@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.js CHANGED
@@ -7487,7 +7487,13 @@ Even if a table appears in the detailed schema above, search_schema returns samp
7487
7487
  */
7488
7488
  extractSourceType() {
7489
7489
  const match = this.tool.id.match(/^(\w+)-[a-f0-9]+_/);
7490
- return match ? match[1] : "unknown";
7490
+ if (!match) return "unknown";
7491
+ const raw = match[1].toLowerCase();
7492
+ if (raw.startsWith("mssql")) return "mssql";
7493
+ if (raw.startsWith("postgres")) return "postgres";
7494
+ if (raw.startsWith("mysql")) return "mysql";
7495
+ if (raw.startsWith("snowflake")) return "snowflake";
7496
+ return raw;
7491
7497
  }
7492
7498
  /**
7493
7499
  * Build an empty ExecutedToolInfo for error cases.
@@ -8282,8 +8288,10 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8282
8288
  let currentSql = compProps?.externalTool?.parameters?.sql;
8283
8289
  if (!toolId || !currentSql) return component;
8284
8290
  const executedTool = executedTools.find((t) => t.id === toolId);
8285
- const dbType = executedTool?.sourceType || "postgresql";
8286
- currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8291
+ const dbType = executedTool?.sourceType;
8292
+ if (dbType) {
8293
+ currentSql = ensureQueryLimit(currentSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8294
+ }
8287
8295
  let attempts = 0;
8288
8296
  while (attempts < MAX_QUERY_VALIDATION_RETRIES) {
8289
8297
  attempts++;
@@ -8333,7 +8341,7 @@ async function validateSingleExternalToolQuery(component, collections, executedT
8333
8341
  apiKey
8334
8342
  );
8335
8343
  if (fixedSql && fixedSql !== currentSql) {
8336
- currentSql = ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType);
8344
+ currentSql = dbType ? ensureQueryLimit(fixedSql, 10, MAX_AGENT_QUERY_LIMIT, dbType) : fixedSql;
8337
8345
  logger.info(`[AgentComponentGen] LLM provided fix for ${component.name}, retrying...`);
8338
8346
  } else {
8339
8347
  logger.warn(`[AgentComponentGen] LLM returned same or empty query, stopping retries`);