@superatomai/sdk-node 0.0.59 → 0.0.60
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 +24 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1907,6 +1907,23 @@ function validateAndFixSqlQuery(query, dbType) {
|
|
|
1907
1907
|
}
|
|
1908
1908
|
fixes.push(`Added ${missingClose} missing closing parenthesis(es)`);
|
|
1909
1909
|
}
|
|
1910
|
+
const subqueryOrderByPattern = /\(\s*SELECT\s+(?!TOP\s)([^()]*?)\s+ORDER\s+BY\s+[^()]+\)/gi;
|
|
1911
|
+
let subqueryMatch;
|
|
1912
|
+
let subqueryFixed = false;
|
|
1913
|
+
while ((subqueryMatch = subqueryOrderByPattern.exec(fixedQuery)) !== null) {
|
|
1914
|
+
const fullMatch = subqueryMatch[0];
|
|
1915
|
+
if (!/\bTOP\s+\d+/i.test(fullMatch) && !/\bOFFSET\b/i.test(fullMatch)) {
|
|
1916
|
+
const fixedSubquery = fullMatch.replace(
|
|
1917
|
+
/\(\s*SELECT\s+/i,
|
|
1918
|
+
"(SELECT TOP 100 "
|
|
1919
|
+
);
|
|
1920
|
+
fixedQuery = fixedQuery.replace(fullMatch, fixedSubquery);
|
|
1921
|
+
subqueryFixed = true;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
if (subqueryFixed) {
|
|
1925
|
+
fixes.push("Added TOP to subquery with ORDER BY (MSSQL requirement)");
|
|
1926
|
+
}
|
|
1910
1927
|
const originalLength = fixedQuery.length;
|
|
1911
1928
|
fixedQuery = fixedQuery.replace(/\s+/g, " ").trim();
|
|
1912
1929
|
if (fixedQuery.length !== originalLength) {
|
|
@@ -6731,7 +6748,13 @@ ${executedToolsText}`);
|
|
|
6731
6748
|
(t) => t.executionType === "immediate" || t.executionType === "deferred" && t.userProvidedData
|
|
6732
6749
|
);
|
|
6733
6750
|
logger.info(`[${this.getProviderName()}] Executable tools: ${executableTools.length} of ${externalTools.length} total`);
|
|
6751
|
+
const addedToolIds = /* @__PURE__ */ new Set();
|
|
6734
6752
|
executableTools.forEach((tool) => {
|
|
6753
|
+
if (addedToolIds.has(tool.id)) {
|
|
6754
|
+
logger.info(`[${this.getProviderName()}] Skipping duplicate tool definition: ${tool.id} (already added)`);
|
|
6755
|
+
return;
|
|
6756
|
+
}
|
|
6757
|
+
addedToolIds.add(tool.id);
|
|
6735
6758
|
logger.info(`[${this.getProviderName()}] Processing executable tool:`, JSON.stringify(tool, null, 2));
|
|
6736
6759
|
const properties = {};
|
|
6737
6760
|
const required = [];
|
|
@@ -6801,7 +6824,7 @@ ${executedToolsText}`);
|
|
|
6801
6824
|
input_schema: inputSchema
|
|
6802
6825
|
});
|
|
6803
6826
|
});
|
|
6804
|
-
logger.info(`[${this.getProviderName()}] Added ${
|
|
6827
|
+
logger.info(`[${this.getProviderName()}] Added ${addedToolIds.size} unique tool definitions from ${executableTools.length} tool calls (${externalTools.length - executableTools.length} deferred tools await form input)`);
|
|
6805
6828
|
logger.info(`[${this.getProviderName()}] Complete tools array:`, JSON.stringify(tools, null, 2));
|
|
6806
6829
|
}
|
|
6807
6830
|
const queryAttempts = /* @__PURE__ */ new Map();
|