@superatomai/sdk-node 0.0.48 → 0.0.49
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 +5 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5678,9 +5678,11 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
5678
5678
|
let outputSchemaText = "Not available";
|
|
5679
5679
|
if (tool.outputSchema) {
|
|
5680
5680
|
const fields = tool.outputSchema.fields || [];
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5681
|
+
const recordCount = tool.result?._recordCount || (Array.isArray(tool.result) ? tool.result.length : "unknown");
|
|
5682
|
+
outputSchemaText = `Returns ARRAY of ${recordCount} records. ${tool.outputSchema.description}
|
|
5683
|
+
Fields in EACH ROW (these are per-row values, NOT aggregates):
|
|
5684
|
+
${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")}
|
|
5685
|
+
NOTE: For aggregate values (SUM, COUNT, AVG across all rows), write SQL query instead.`;
|
|
5684
5686
|
}
|
|
5685
5687
|
return `${idx + 1}. **${tool.name}**
|
|
5686
5688
|
toolId: "${tool.id}" (USE THIS EXACT VALUE for externalTool.toolId)
|
|
@@ -5800,23 +5802,9 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
|
|
|
5800
5802
|
true
|
|
5801
5803
|
// Parse as JSON
|
|
5802
5804
|
);
|
|
5803
|
-
logger.debug(`[${this.getProviderName()}] Component matching response parsed successfully`);
|
|
5804
|
-
const componentSuggestionPattern = /c\d+:(\w+)\s*:\s*(.+)/g;
|
|
5805
|
-
const suggestedComponents = [];
|
|
5806
|
-
let match;
|
|
5807
|
-
while ((match = componentSuggestionPattern.exec(analysisContent)) !== null) {
|
|
5808
|
-
suggestedComponents.push({
|
|
5809
|
-
type: match[1],
|
|
5810
|
-
reasoning: match[2].trim()
|
|
5811
|
-
});
|
|
5812
|
-
}
|
|
5813
5805
|
const matchedComponents = result.matchedComponents || [];
|
|
5814
5806
|
const layoutTitle = result.layoutTitle || "Dashboard";
|
|
5815
5807
|
const layoutDescription = result.layoutDescription || "Multi-component dashboard";
|
|
5816
|
-
logger.info(`[${this.getProviderName()}] \u{1F4CA} Component Suggestions from Text Analysis: ${suggestedComponents.length}`);
|
|
5817
|
-
suggestedComponents.forEach((comp, idx) => {
|
|
5818
|
-
logger.info(`[${this.getProviderName()}] c${idx + 1}: ${comp.type} - ${comp.reasoning}`);
|
|
5819
|
-
});
|
|
5820
5808
|
logger.info(`[${this.getProviderName()}] \u{1F4E6} Matched Components from LLM: ${matchedComponents.length}`);
|
|
5821
5809
|
matchedComponents.forEach((comp, idx) => {
|
|
5822
5810
|
logger.info(`[${this.getProviderName()}] ${idx + 1}. ${comp.componentType} (${comp.componentName}) - ${comp.originalSuggestion || "N/A"}`);
|
|
@@ -5824,22 +5812,7 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
|
|
|
5824
5812
|
logger.file("\n=============================\nFull LLM response:", JSON.stringify(result, null, 2));
|
|
5825
5813
|
const rawActions = result.actions || [];
|
|
5826
5814
|
const actions = convertQuestionsToActions(rawActions);
|
|
5827
|
-
logger.info(`[${this.getProviderName()}] Matched ${matchedComponents.length} components from text response`);
|
|
5828
|
-
logger.info(`[${this.getProviderName()}] Layout title: "${layoutTitle}"`);
|
|
5829
|
-
logger.info(`[${this.getProviderName()}] Layout description: "${layoutDescription}"`);
|
|
5830
|
-
logger.info(`[${this.getProviderName()}] Generated ${actions.length} follow-up actions`);
|
|
5831
|
-
if (suggestedComponents.length > 0) {
|
|
5832
|
-
logCollector?.info(`\u{1F4DD} Text Analysis suggested ${suggestedComponents.length} dashboard components:`);
|
|
5833
|
-
suggestedComponents.forEach((comp, idx) => {
|
|
5834
|
-
logCollector?.info(` c${idx + 1}: ${comp.type} - ${comp.reasoning}`);
|
|
5835
|
-
});
|
|
5836
|
-
}
|
|
5837
5815
|
if (matchedComponents.length > 0) {
|
|
5838
|
-
logCollector?.info(`\u{1F4E6} Matched ${matchedComponents.length} components for dashboard`);
|
|
5839
|
-
if (suggestedComponents.length !== matchedComponents.length) {
|
|
5840
|
-
logCollector?.warn(`\u26A0\uFE0F Component count mismatch: Suggested ${suggestedComponents.length}, but matched ${matchedComponents.length}`);
|
|
5841
|
-
}
|
|
5842
|
-
logCollector?.info(`Dashboard: "${layoutTitle}"`);
|
|
5843
5816
|
matchedComponents.forEach((comp, idx) => {
|
|
5844
5817
|
logCollector?.info(` ${idx + 1}. ${comp.componentName} (${comp.componentType}): ${comp.reasoning}`);
|
|
5845
5818
|
if (comp.props?.query) {
|
|
@@ -5851,12 +5824,6 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
|
|
|
5851
5824
|
}
|
|
5852
5825
|
});
|
|
5853
5826
|
}
|
|
5854
|
-
if (actions.length > 0) {
|
|
5855
|
-
logCollector?.info(`Generated ${actions.length} follow-up questions`);
|
|
5856
|
-
actions.forEach((action, idx) => {
|
|
5857
|
-
logCollector?.info(` ${idx + 1}. ${action.name}`);
|
|
5858
|
-
});
|
|
5859
|
-
}
|
|
5860
5827
|
const finalComponents = matchedComponents.map((mc) => {
|
|
5861
5828
|
const originalComponent = components.find((c) => c.id === mc.componentId);
|
|
5862
5829
|
if (!originalComponent) {
|