@superatomai/sdk-node 0.0.59 → 0.0.61
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/README.md +942 -942
- package/dist/index.js +61 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +49 -48
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) {
|
|
@@ -2527,7 +2544,13 @@ var ArtifactsRequestPayloadSchema = import_zod3.z.object({
|
|
|
2527
2544
|
limit: import_zod3.z.number().optional(),
|
|
2528
2545
|
// Query operation fields
|
|
2529
2546
|
filters: ArtifactsQueryFiltersSchema.optional(),
|
|
2530
|
-
sort: import_zod3.z.enum(["ASC", "DESC"]).optional()
|
|
2547
|
+
sort: import_zod3.z.enum(["ASC", "DESC"]).optional(),
|
|
2548
|
+
// Menu grouping fields
|
|
2549
|
+
type: import_zod3.z.string().optional(),
|
|
2550
|
+
menuId: import_zod3.z.number().optional(),
|
|
2551
|
+
artifactGroupName: import_zod3.z.string().optional(),
|
|
2552
|
+
artifactGroupId: import_zod3.z.string().optional(),
|
|
2553
|
+
artifactGroupIcon: import_zod3.z.string().optional()
|
|
2531
2554
|
}).optional()
|
|
2532
2555
|
});
|
|
2533
2556
|
var ArtifactsRequestMessageSchema = import_zod3.z.object({
|
|
@@ -2604,7 +2627,9 @@ var MenusRequestPayloadSchema = import_zod3.z.object({
|
|
|
2604
2627
|
items: import_zod3.z.array(import_zod3.z.object({
|
|
2605
2628
|
id: import_zod3.z.number(),
|
|
2606
2629
|
sortOrder: import_zod3.z.number()
|
|
2607
|
-
})).optional()
|
|
2630
|
+
})).optional(),
|
|
2631
|
+
menuJson: import_zod3.z.record(import_zod3.z.unknown()).optional(),
|
|
2632
|
+
version: import_zod3.z.number().optional()
|
|
2608
2633
|
}).optional()
|
|
2609
2634
|
});
|
|
2610
2635
|
var MenusRequestMessageSchema = import_zod3.z.object({
|
|
@@ -6731,7 +6756,13 @@ ${executedToolsText}`);
|
|
|
6731
6756
|
(t) => t.executionType === "immediate" || t.executionType === "deferred" && t.userProvidedData
|
|
6732
6757
|
);
|
|
6733
6758
|
logger.info(`[${this.getProviderName()}] Executable tools: ${executableTools.length} of ${externalTools.length} total`);
|
|
6759
|
+
const addedToolIds = /* @__PURE__ */ new Set();
|
|
6734
6760
|
executableTools.forEach((tool) => {
|
|
6761
|
+
if (addedToolIds.has(tool.id)) {
|
|
6762
|
+
logger.info(`[${this.getProviderName()}] Skipping duplicate tool definition: ${tool.id} (already added)`);
|
|
6763
|
+
return;
|
|
6764
|
+
}
|
|
6765
|
+
addedToolIds.add(tool.id);
|
|
6735
6766
|
logger.info(`[${this.getProviderName()}] Processing executable tool:`, JSON.stringify(tool, null, 2));
|
|
6736
6767
|
const properties = {};
|
|
6737
6768
|
const required = [];
|
|
@@ -6801,7 +6832,7 @@ ${executedToolsText}`);
|
|
|
6801
6832
|
input_schema: inputSchema
|
|
6802
6833
|
});
|
|
6803
6834
|
});
|
|
6804
|
-
logger.info(`[${this.getProviderName()}] Added ${
|
|
6835
|
+
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
6836
|
logger.info(`[${this.getProviderName()}] Complete tools array:`, JSON.stringify(tools, null, 2));
|
|
6806
6837
|
}
|
|
6807
6838
|
const queryAttempts = /* @__PURE__ */ new Map();
|
|
@@ -10578,6 +10609,7 @@ async function handleArtifactsRequest(data, collections, sendMessage) {
|
|
|
10578
10609
|
const request = ArtifactsRequestMessageSchema.parse(data);
|
|
10579
10610
|
const { id, payload, from } = request;
|
|
10580
10611
|
const { operation, data: requestData } = payload;
|
|
10612
|
+
logger.info("[SDK-NODEJS] Received artifacts request:", JSON.stringify({ operation, requestData }, null, 2));
|
|
10581
10613
|
const artifactId = requestData?.id;
|
|
10582
10614
|
const name = requestData?.name;
|
|
10583
10615
|
const createdBy = requestData?.createdBy;
|
|
@@ -10587,9 +10619,22 @@ async function handleArtifactsRequest(data, collections, sendMessage) {
|
|
|
10587
10619
|
const limit = requestData?.limit;
|
|
10588
10620
|
const filters = requestData?.filters;
|
|
10589
10621
|
const sort = requestData?.sort;
|
|
10622
|
+
const type = requestData?.type;
|
|
10623
|
+
const menuId = requestData?.menuId;
|
|
10624
|
+
const artifactGroupName = requestData?.artifactGroupName;
|
|
10625
|
+
const artifactGroupId = requestData?.artifactGroupId;
|
|
10626
|
+
const artifactGroupIcon = requestData?.artifactGroupIcon;
|
|
10627
|
+
logger.info("[SDK-NODEJS] Extracted params for create:", JSON.stringify({
|
|
10628
|
+
name,
|
|
10629
|
+
type,
|
|
10630
|
+
menuId,
|
|
10631
|
+
artifactGroupName,
|
|
10632
|
+
artifactGroupId,
|
|
10633
|
+
artifactGroupIcon
|
|
10634
|
+
}, null, 2));
|
|
10590
10635
|
switch (operation) {
|
|
10591
10636
|
case "create":
|
|
10592
|
-
await handleCreate6(id, name, createdBy, dsl, status, executeCollection, sendMessage, from.id);
|
|
10637
|
+
await handleCreate6(id, name, createdBy, dsl, status, type, menuId, artifactGroupName, artifactGroupId, artifactGroupIcon, executeCollection, sendMessage, from.id);
|
|
10593
10638
|
break;
|
|
10594
10639
|
case "update":
|
|
10595
10640
|
await handleUpdate6(id, artifactId, name, dsl, status, deleted, executeCollection, sendMessage, from.id);
|
|
@@ -10620,7 +10665,7 @@ async function handleArtifactsRequest(data, collections, sendMessage) {
|
|
|
10620
10665
|
}, sendMessage);
|
|
10621
10666
|
}
|
|
10622
10667
|
}
|
|
10623
|
-
async function handleCreate6(id, name, createdBy, dsl, status, executeCollection, sendMessage, clientId) {
|
|
10668
|
+
async function handleCreate6(id, name, createdBy, dsl, status, type, menuId, artifactGroupName, artifactGroupId, artifactGroupIcon, executeCollection, sendMessage, clientId) {
|
|
10624
10669
|
if (!name) {
|
|
10625
10670
|
sendResponse8(id, {
|
|
10626
10671
|
success: false,
|
|
@@ -10629,7 +10674,17 @@ async function handleCreate6(id, name, createdBy, dsl, status, executeCollection
|
|
|
10629
10674
|
return;
|
|
10630
10675
|
}
|
|
10631
10676
|
try {
|
|
10632
|
-
const result = await executeCollection("artifacts", "create", {
|
|
10677
|
+
const result = await executeCollection("artifacts", "create", {
|
|
10678
|
+
name,
|
|
10679
|
+
createdBy,
|
|
10680
|
+
dsl,
|
|
10681
|
+
status,
|
|
10682
|
+
type,
|
|
10683
|
+
menuId,
|
|
10684
|
+
artifactGroupName,
|
|
10685
|
+
artifactGroupId,
|
|
10686
|
+
artifactGroupIcon
|
|
10687
|
+
});
|
|
10633
10688
|
sendResponse8(id, {
|
|
10634
10689
|
success: true,
|
|
10635
10690
|
data: result.data,
|