@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 CHANGED
@@ -5728,9 +5728,11 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
5728
5728
  let outputSchemaText = "Not available";
5729
5729
  if (tool.outputSchema) {
5730
5730
  const fields = tool.outputSchema.fields || [];
5731
- outputSchemaText = `${tool.outputSchema.description}
5732
- Fields (use these exact names for component config):
5733
- ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")}`;
5731
+ const recordCount = tool.result?._recordCount || (Array.isArray(tool.result) ? tool.result.length : "unknown");
5732
+ outputSchemaText = `Returns ARRAY of ${recordCount} records. ${tool.outputSchema.description}
5733
+ Fields in EACH ROW (these are per-row values, NOT aggregates):
5734
+ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")}
5735
+ NOTE: For aggregate values (SUM, COUNT, AVG across all rows), write SQL query instead.`;
5734
5736
  }
5735
5737
  return `${idx + 1}. **${tool.name}**
5736
5738
  toolId: "${tool.id}" (USE THIS EXACT VALUE for externalTool.toolId)
@@ -5850,23 +5852,9 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
5850
5852
  true
5851
5853
  // Parse as JSON
5852
5854
  );
5853
- logger.debug(`[${this.getProviderName()}] Component matching response parsed successfully`);
5854
- const componentSuggestionPattern = /c\d+:(\w+)\s*:\s*(.+)/g;
5855
- const suggestedComponents = [];
5856
- let match;
5857
- while ((match = componentSuggestionPattern.exec(analysisContent)) !== null) {
5858
- suggestedComponents.push({
5859
- type: match[1],
5860
- reasoning: match[2].trim()
5861
- });
5862
- }
5863
5855
  const matchedComponents = result.matchedComponents || [];
5864
5856
  const layoutTitle = result.layoutTitle || "Dashboard";
5865
5857
  const layoutDescription = result.layoutDescription || "Multi-component dashboard";
5866
- logger.info(`[${this.getProviderName()}] \u{1F4CA} Component Suggestions from Text Analysis: ${suggestedComponents.length}`);
5867
- suggestedComponents.forEach((comp, idx) => {
5868
- logger.info(`[${this.getProviderName()}] c${idx + 1}: ${comp.type} - ${comp.reasoning}`);
5869
- });
5870
5858
  logger.info(`[${this.getProviderName()}] \u{1F4E6} Matched Components from LLM: ${matchedComponents.length}`);
5871
5859
  matchedComponents.forEach((comp, idx) => {
5872
5860
  logger.info(`[${this.getProviderName()}] ${idx + 1}. ${comp.componentType} (${comp.componentName}) - ${comp.originalSuggestion || "N/A"}`);
@@ -5874,22 +5862,7 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
5874
5862
  logger.file("\n=============================\nFull LLM response:", JSON.stringify(result, null, 2));
5875
5863
  const rawActions = result.actions || [];
5876
5864
  const actions = convertQuestionsToActions(rawActions);
5877
- logger.info(`[${this.getProviderName()}] Matched ${matchedComponents.length} components from text response`);
5878
- logger.info(`[${this.getProviderName()}] Layout title: "${layoutTitle}"`);
5879
- logger.info(`[${this.getProviderName()}] Layout description: "${layoutDescription}"`);
5880
- logger.info(`[${this.getProviderName()}] Generated ${actions.length} follow-up actions`);
5881
- if (suggestedComponents.length > 0) {
5882
- logCollector?.info(`\u{1F4DD} Text Analysis suggested ${suggestedComponents.length} dashboard components:`);
5883
- suggestedComponents.forEach((comp, idx) => {
5884
- logCollector?.info(` c${idx + 1}: ${comp.type} - ${comp.reasoning}`);
5885
- });
5886
- }
5887
5865
  if (matchedComponents.length > 0) {
5888
- logCollector?.info(`\u{1F4E6} Matched ${matchedComponents.length} components for dashboard`);
5889
- if (suggestedComponents.length !== matchedComponents.length) {
5890
- logCollector?.warn(`\u26A0\uFE0F Component count mismatch: Suggested ${suggestedComponents.length}, but matched ${matchedComponents.length}`);
5891
- }
5892
- logCollector?.info(`Dashboard: "${layoutTitle}"`);
5893
5866
  matchedComponents.forEach((comp, idx) => {
5894
5867
  logCollector?.info(` ${idx + 1}. ${comp.componentName} (${comp.componentType}): ${comp.reasoning}`);
5895
5868
  if (comp.props?.query) {
@@ -5901,12 +5874,6 @@ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")
5901
5874
  }
5902
5875
  });
5903
5876
  }
5904
- if (actions.length > 0) {
5905
- logCollector?.info(`Generated ${actions.length} follow-up questions`);
5906
- actions.forEach((action, idx) => {
5907
- logCollector?.info(` ${idx + 1}. ${action.name}`);
5908
- });
5909
- }
5910
5877
  const finalComponents = matchedComponents.map((mc) => {
5911
5878
  const originalComponent = components.find((c) => c.id === mc.componentId);
5912
5879
  if (!originalComponent) {