@superatomai/sdk-node 0.0.46 → 0.0.48

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.mjs CHANGED
@@ -2043,12 +2043,27 @@ var ComponentListResponseMessageSchema = z3.object({
2043
2043
  type: z3.literal("COMPONENT_LIST_RES"),
2044
2044
  payload: ComponentListResponsePayloadSchema
2045
2045
  });
2046
+ var OutputFieldSchema = z3.object({
2047
+ name: z3.string(),
2048
+ // Field name (column name in the result)
2049
+ type: z3.enum(["string", "number", "boolean", "date"]),
2050
+ description: z3.string()
2051
+ // What this field contains
2052
+ });
2053
+ var OutputSchema = z3.object({
2054
+ description: z3.string(),
2055
+ // Brief description of what the output represents
2056
+ fields: z3.array(OutputFieldSchema)
2057
+ // List of fields in each record (like columns in a table)
2058
+ });
2046
2059
  var ToolSchema = z3.object({
2047
2060
  id: z3.string(),
2048
2061
  name: z3.string(),
2049
2062
  description: z3.string(),
2050
2063
  params: z3.record(z3.string()),
2051
- fn: z3.function().args(z3.any()).returns(z3.any())
2064
+ fn: z3.function().args(z3.any()).returns(z3.any()),
2065
+ outputSchema: OutputSchema.optional()
2066
+ // Optional: describes the data structure returned by this tool
2052
2067
  });
2053
2068
  var UserQueryFiltersSchema = z3.object({
2054
2069
  username: z3.string().optional(),
@@ -5654,17 +5669,25 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
5654
5669
  let executedToolsText = "No external tools were executed for data fetching.";
5655
5670
  if (executedTools && executedTools.length > 0) {
5656
5671
  logger.info(`[${this.getProviderName()}] Passing ${executedTools.length} executed tools to component matching`);
5657
- executedToolsText = "The following external tools were executed to fetch data.\n**IMPORTANT: For components displaying this data, use externalTool prop instead of query.**\n**IMPORTANT: Use the result data to populate deferred tool parameters when applicable.**\n\n" + executedTools.map((tool, idx) => {
5672
+ executedToolsText = "The following external tools were executed to fetch data.\n**IMPORTANT: For components displaying this data, use externalTool prop instead of query.**\n**IMPORTANT: Use the outputSchema fields to set correct config keys (xAxisKey, yAxisKey, valueKey, nameKey, etc.)**\n**IMPORTANT: Use the result data to populate deferred tool parameters when applicable.**\n\n" + executedTools.map((tool, idx) => {
5658
5673
  let resultPreview = "No result data";
5659
5674
  if (tool.result) {
5660
5675
  const resultStr = typeof tool.result === "string" ? tool.result : JSON.stringify(tool.result, null, 2);
5661
5676
  resultPreview = resultStr.length > 2e3 ? resultStr.substring(0, 2e3) + "\n... (truncated)" : resultStr;
5662
5677
  }
5678
+ let outputSchemaText = "Not available";
5679
+ if (tool.outputSchema) {
5680
+ const fields = tool.outputSchema.fields || [];
5681
+ outputSchemaText = `${tool.outputSchema.description}
5682
+ Fields (use these exact names for component config):
5683
+ ${fields.map((f) => ` - ${f.name} (${f.type}): ${f.description}`).join("\n")}`;
5684
+ }
5663
5685
  return `${idx + 1}. **${tool.name}**
5664
5686
  toolId: "${tool.id}" (USE THIS EXACT VALUE for externalTool.toolId)
5665
5687
  toolName: "${tool.name}" (USE THIS EXACT VALUE for externalTool.toolName)
5666
5688
  parameters: ${JSON.stringify(tool.params || {})} (USE THESE for externalTool.parameters)
5667
- result: ${resultPreview}`;
5689
+ outputSchema: ${outputSchemaText}
5690
+ result preview: ${resultPreview}`;
5668
5691
  }).join("\n\n");
5669
5692
  }
5670
5693
  const schemaDoc = schema.generateSchemaDocumentation();
@@ -6402,8 +6425,10 @@ Please try rephrasing your request or contact support.
6402
6425
  name: externalTool.name,
6403
6426
  params: toolInput,
6404
6427
  // The actual parameters used in this execution
6405
- result: resultSummary
6428
+ result: resultSummary,
6406
6429
  // Store summary instead of full result to save memory
6430
+ outputSchema: externalTool.outputSchema
6431
+ // Include output schema for component config generation
6407
6432
  });
6408
6433
  logger.info(`[${this.getProviderName()}] Tracked executed tool: ${externalTool.name} with params: ${JSON.stringify(toolInput)}`);
6409
6434
  }
@@ -6619,8 +6644,8 @@ ${errorMsg}
6619
6644
  userPrompt,
6620
6645
  collections,
6621
6646
  userId,
6622
- similarityThreshold: 0.6
6623
- // 60% threshold
6647
+ similarityThreshold: 0.75
6648
+ // 75% threshold
6624
6649
  });
6625
6650
  if (conversationMatch) {
6626
6651
  logger.info(`[${this.getProviderName()}] \u2713 Found matching conversation with ${(conversationMatch.similarity * 100).toFixed(2)}% similarity`);