@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.d.mts +92 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +31 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -681,24 +681,115 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
681
681
|
keywords?: string[] | undefined;
|
|
682
682
|
}>;
|
|
683
683
|
type Component = z.infer<typeof ComponentSchema>;
|
|
684
|
+
declare const OutputFieldSchema: z.ZodObject<{
|
|
685
|
+
name: z.ZodString;
|
|
686
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
687
|
+
description: z.ZodString;
|
|
688
|
+
}, "strip", z.ZodTypeAny, {
|
|
689
|
+
type: "string" | "number" | "boolean" | "date";
|
|
690
|
+
name: string;
|
|
691
|
+
description: string;
|
|
692
|
+
}, {
|
|
693
|
+
type: "string" | "number" | "boolean" | "date";
|
|
694
|
+
name: string;
|
|
695
|
+
description: string;
|
|
696
|
+
}>;
|
|
697
|
+
type OutputField = z.infer<typeof OutputFieldSchema>;
|
|
698
|
+
declare const OutputSchema: z.ZodObject<{
|
|
699
|
+
description: z.ZodString;
|
|
700
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
701
|
+
name: z.ZodString;
|
|
702
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
703
|
+
description: z.ZodString;
|
|
704
|
+
}, "strip", z.ZodTypeAny, {
|
|
705
|
+
type: "string" | "number" | "boolean" | "date";
|
|
706
|
+
name: string;
|
|
707
|
+
description: string;
|
|
708
|
+
}, {
|
|
709
|
+
type: "string" | "number" | "boolean" | "date";
|
|
710
|
+
name: string;
|
|
711
|
+
description: string;
|
|
712
|
+
}>, "many">;
|
|
713
|
+
}, "strip", z.ZodTypeAny, {
|
|
714
|
+
description: string;
|
|
715
|
+
fields: {
|
|
716
|
+
type: "string" | "number" | "boolean" | "date";
|
|
717
|
+
name: string;
|
|
718
|
+
description: string;
|
|
719
|
+
}[];
|
|
720
|
+
}, {
|
|
721
|
+
description: string;
|
|
722
|
+
fields: {
|
|
723
|
+
type: "string" | "number" | "boolean" | "date";
|
|
724
|
+
name: string;
|
|
725
|
+
description: string;
|
|
726
|
+
}[];
|
|
727
|
+
}>;
|
|
728
|
+
type ToolOutputSchema = z.infer<typeof OutputSchema>;
|
|
684
729
|
declare const ToolSchema: z.ZodObject<{
|
|
685
730
|
id: z.ZodString;
|
|
686
731
|
name: z.ZodString;
|
|
687
732
|
description: z.ZodString;
|
|
688
733
|
params: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
689
734
|
fn: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodAny>;
|
|
735
|
+
outputSchema: z.ZodOptional<z.ZodObject<{
|
|
736
|
+
description: z.ZodString;
|
|
737
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
738
|
+
name: z.ZodString;
|
|
739
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
740
|
+
description: z.ZodString;
|
|
741
|
+
}, "strip", z.ZodTypeAny, {
|
|
742
|
+
type: "string" | "number" | "boolean" | "date";
|
|
743
|
+
name: string;
|
|
744
|
+
description: string;
|
|
745
|
+
}, {
|
|
746
|
+
type: "string" | "number" | "boolean" | "date";
|
|
747
|
+
name: string;
|
|
748
|
+
description: string;
|
|
749
|
+
}>, "many">;
|
|
750
|
+
}, "strip", z.ZodTypeAny, {
|
|
751
|
+
description: string;
|
|
752
|
+
fields: {
|
|
753
|
+
type: "string" | "number" | "boolean" | "date";
|
|
754
|
+
name: string;
|
|
755
|
+
description: string;
|
|
756
|
+
}[];
|
|
757
|
+
}, {
|
|
758
|
+
description: string;
|
|
759
|
+
fields: {
|
|
760
|
+
type: "string" | "number" | "boolean" | "date";
|
|
761
|
+
name: string;
|
|
762
|
+
description: string;
|
|
763
|
+
}[];
|
|
764
|
+
}>>;
|
|
690
765
|
}, "strip", z.ZodTypeAny, {
|
|
691
766
|
id: string;
|
|
692
767
|
params: Record<string, string>;
|
|
693
768
|
name: string;
|
|
694
769
|
description: string;
|
|
695
770
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
771
|
+
outputSchema?: {
|
|
772
|
+
description: string;
|
|
773
|
+
fields: {
|
|
774
|
+
type: "string" | "number" | "boolean" | "date";
|
|
775
|
+
name: string;
|
|
776
|
+
description: string;
|
|
777
|
+
}[];
|
|
778
|
+
} | undefined;
|
|
696
779
|
}, {
|
|
697
780
|
id: string;
|
|
698
781
|
params: Record<string, string>;
|
|
699
782
|
name: string;
|
|
700
783
|
description: string;
|
|
701
784
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
785
|
+
outputSchema?: {
|
|
786
|
+
description: string;
|
|
787
|
+
fields: {
|
|
788
|
+
type: "string" | "number" | "boolean" | "date";
|
|
789
|
+
name: string;
|
|
790
|
+
description: string;
|
|
791
|
+
}[];
|
|
792
|
+
} | undefined;
|
|
702
793
|
}>;
|
|
703
794
|
type Tool$1 = z.infer<typeof ToolSchema>;
|
|
704
795
|
type CollectionOperation = 'getMany' | 'getOne' | 'query' | 'mutation' | 'updateOne' | 'deleteOne' | 'createOne';
|
|
@@ -2243,4 +2334,4 @@ declare class SuperatomSDK {
|
|
|
2243
2334
|
getModelStrategy(): ModelStrategy;
|
|
2244
2335
|
}
|
|
2245
2336
|
|
|
2246
|
-
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type RerankedResult, SDK_VERSION, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|
|
2337
|
+
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult, SDK_VERSION, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|
package/dist/index.d.ts
CHANGED
|
@@ -681,24 +681,115 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
681
681
|
keywords?: string[] | undefined;
|
|
682
682
|
}>;
|
|
683
683
|
type Component = z.infer<typeof ComponentSchema>;
|
|
684
|
+
declare const OutputFieldSchema: z.ZodObject<{
|
|
685
|
+
name: z.ZodString;
|
|
686
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
687
|
+
description: z.ZodString;
|
|
688
|
+
}, "strip", z.ZodTypeAny, {
|
|
689
|
+
type: "string" | "number" | "boolean" | "date";
|
|
690
|
+
name: string;
|
|
691
|
+
description: string;
|
|
692
|
+
}, {
|
|
693
|
+
type: "string" | "number" | "boolean" | "date";
|
|
694
|
+
name: string;
|
|
695
|
+
description: string;
|
|
696
|
+
}>;
|
|
697
|
+
type OutputField = z.infer<typeof OutputFieldSchema>;
|
|
698
|
+
declare const OutputSchema: z.ZodObject<{
|
|
699
|
+
description: z.ZodString;
|
|
700
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
701
|
+
name: z.ZodString;
|
|
702
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
703
|
+
description: z.ZodString;
|
|
704
|
+
}, "strip", z.ZodTypeAny, {
|
|
705
|
+
type: "string" | "number" | "boolean" | "date";
|
|
706
|
+
name: string;
|
|
707
|
+
description: string;
|
|
708
|
+
}, {
|
|
709
|
+
type: "string" | "number" | "boolean" | "date";
|
|
710
|
+
name: string;
|
|
711
|
+
description: string;
|
|
712
|
+
}>, "many">;
|
|
713
|
+
}, "strip", z.ZodTypeAny, {
|
|
714
|
+
description: string;
|
|
715
|
+
fields: {
|
|
716
|
+
type: "string" | "number" | "boolean" | "date";
|
|
717
|
+
name: string;
|
|
718
|
+
description: string;
|
|
719
|
+
}[];
|
|
720
|
+
}, {
|
|
721
|
+
description: string;
|
|
722
|
+
fields: {
|
|
723
|
+
type: "string" | "number" | "boolean" | "date";
|
|
724
|
+
name: string;
|
|
725
|
+
description: string;
|
|
726
|
+
}[];
|
|
727
|
+
}>;
|
|
728
|
+
type ToolOutputSchema = z.infer<typeof OutputSchema>;
|
|
684
729
|
declare const ToolSchema: z.ZodObject<{
|
|
685
730
|
id: z.ZodString;
|
|
686
731
|
name: z.ZodString;
|
|
687
732
|
description: z.ZodString;
|
|
688
733
|
params: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
689
734
|
fn: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodAny>;
|
|
735
|
+
outputSchema: z.ZodOptional<z.ZodObject<{
|
|
736
|
+
description: z.ZodString;
|
|
737
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
738
|
+
name: z.ZodString;
|
|
739
|
+
type: z.ZodEnum<["string", "number", "boolean", "date"]>;
|
|
740
|
+
description: z.ZodString;
|
|
741
|
+
}, "strip", z.ZodTypeAny, {
|
|
742
|
+
type: "string" | "number" | "boolean" | "date";
|
|
743
|
+
name: string;
|
|
744
|
+
description: string;
|
|
745
|
+
}, {
|
|
746
|
+
type: "string" | "number" | "boolean" | "date";
|
|
747
|
+
name: string;
|
|
748
|
+
description: string;
|
|
749
|
+
}>, "many">;
|
|
750
|
+
}, "strip", z.ZodTypeAny, {
|
|
751
|
+
description: string;
|
|
752
|
+
fields: {
|
|
753
|
+
type: "string" | "number" | "boolean" | "date";
|
|
754
|
+
name: string;
|
|
755
|
+
description: string;
|
|
756
|
+
}[];
|
|
757
|
+
}, {
|
|
758
|
+
description: string;
|
|
759
|
+
fields: {
|
|
760
|
+
type: "string" | "number" | "boolean" | "date";
|
|
761
|
+
name: string;
|
|
762
|
+
description: string;
|
|
763
|
+
}[];
|
|
764
|
+
}>>;
|
|
690
765
|
}, "strip", z.ZodTypeAny, {
|
|
691
766
|
id: string;
|
|
692
767
|
params: Record<string, string>;
|
|
693
768
|
name: string;
|
|
694
769
|
description: string;
|
|
695
770
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
771
|
+
outputSchema?: {
|
|
772
|
+
description: string;
|
|
773
|
+
fields: {
|
|
774
|
+
type: "string" | "number" | "boolean" | "date";
|
|
775
|
+
name: string;
|
|
776
|
+
description: string;
|
|
777
|
+
}[];
|
|
778
|
+
} | undefined;
|
|
696
779
|
}, {
|
|
697
780
|
id: string;
|
|
698
781
|
params: Record<string, string>;
|
|
699
782
|
name: string;
|
|
700
783
|
description: string;
|
|
701
784
|
fn: (args_0: any, ...args: unknown[]) => any;
|
|
785
|
+
outputSchema?: {
|
|
786
|
+
description: string;
|
|
787
|
+
fields: {
|
|
788
|
+
type: "string" | "number" | "boolean" | "date";
|
|
789
|
+
name: string;
|
|
790
|
+
description: string;
|
|
791
|
+
}[];
|
|
792
|
+
} | undefined;
|
|
702
793
|
}>;
|
|
703
794
|
type Tool$1 = z.infer<typeof ToolSchema>;
|
|
704
795
|
type CollectionOperation = 'getMany' | 'getOne' | 'query' | 'mutation' | 'updateOne' | 'deleteOne' | 'createOne';
|
|
@@ -2243,4 +2334,4 @@ declare class SuperatomSDK {
|
|
|
2243
2334
|
getModelStrategy(): ModelStrategy;
|
|
2244
2335
|
}
|
|
2245
2336
|
|
|
2246
|
-
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type RerankedResult, SDK_VERSION, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|
|
2337
|
+
export { type Action, BM25L, type BM25LOptions, type BaseLLMConfig, CONTEXT_CONFIG, type CapturedLog, CleanupService, type CollectionHandler, type CollectionOperation, type DBUIBlock, type DatabaseType, type HybridSearchOptions, type IncomingMessage, type KbNodesQueryFilters, type KbNodesRequestPayload, LLM, type LLMUsageEntry, type LogLevel, type Message, type ModelStrategy, type OutputField, type RerankedResult, SDK_VERSION, STORAGE_CONFIG, SuperatomSDK, type SuperatomSDKConfig, type TaskType, Thread, ThreadManager, type Tool$1 as Tool, type ToolOutputSchema, UIBlock, UILogCollector, type User, UserManager, type UsersData, anthropicLLM, geminiLLM, groqLLM, hybridRerank, llmUsageLogger, logger, openaiLLM, rerankChromaResults, rerankConversationResults, userPromptErrorLogger };
|
package/dist/index.js
CHANGED
|
@@ -2093,12 +2093,27 @@ var ComponentListResponseMessageSchema = import_zod3.z.object({
|
|
|
2093
2093
|
type: import_zod3.z.literal("COMPONENT_LIST_RES"),
|
|
2094
2094
|
payload: ComponentListResponsePayloadSchema
|
|
2095
2095
|
});
|
|
2096
|
+
var OutputFieldSchema = import_zod3.z.object({
|
|
2097
|
+
name: import_zod3.z.string(),
|
|
2098
|
+
// Field name (column name in the result)
|
|
2099
|
+
type: import_zod3.z.enum(["string", "number", "boolean", "date"]),
|
|
2100
|
+
description: import_zod3.z.string()
|
|
2101
|
+
// What this field contains
|
|
2102
|
+
});
|
|
2103
|
+
var OutputSchema = import_zod3.z.object({
|
|
2104
|
+
description: import_zod3.z.string(),
|
|
2105
|
+
// Brief description of what the output represents
|
|
2106
|
+
fields: import_zod3.z.array(OutputFieldSchema)
|
|
2107
|
+
// List of fields in each record (like columns in a table)
|
|
2108
|
+
});
|
|
2096
2109
|
var ToolSchema = import_zod3.z.object({
|
|
2097
2110
|
id: import_zod3.z.string(),
|
|
2098
2111
|
name: import_zod3.z.string(),
|
|
2099
2112
|
description: import_zod3.z.string(),
|
|
2100
2113
|
params: import_zod3.z.record(import_zod3.z.string()),
|
|
2101
|
-
fn: import_zod3.z.function().args(import_zod3.z.any()).returns(import_zod3.z.any())
|
|
2114
|
+
fn: import_zod3.z.function().args(import_zod3.z.any()).returns(import_zod3.z.any()),
|
|
2115
|
+
outputSchema: OutputSchema.optional()
|
|
2116
|
+
// Optional: describes the data structure returned by this tool
|
|
2102
2117
|
});
|
|
2103
2118
|
var UserQueryFiltersSchema = import_zod3.z.object({
|
|
2104
2119
|
username: import_zod3.z.string().optional(),
|
|
@@ -5704,17 +5719,25 @@ ${JSON.stringify(tool.requiredFields || [], null, 2)}`;
|
|
|
5704
5719
|
let executedToolsText = "No external tools were executed for data fetching.";
|
|
5705
5720
|
if (executedTools && executedTools.length > 0) {
|
|
5706
5721
|
logger.info(`[${this.getProviderName()}] Passing ${executedTools.length} executed tools to component matching`);
|
|
5707
|
-
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) => {
|
|
5722
|
+
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) => {
|
|
5708
5723
|
let resultPreview = "No result data";
|
|
5709
5724
|
if (tool.result) {
|
|
5710
5725
|
const resultStr = typeof tool.result === "string" ? tool.result : JSON.stringify(tool.result, null, 2);
|
|
5711
5726
|
resultPreview = resultStr.length > 2e3 ? resultStr.substring(0, 2e3) + "\n... (truncated)" : resultStr;
|
|
5712
5727
|
}
|
|
5728
|
+
let outputSchemaText = "Not available";
|
|
5729
|
+
if (tool.outputSchema) {
|
|
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")}`;
|
|
5734
|
+
}
|
|
5713
5735
|
return `${idx + 1}. **${tool.name}**
|
|
5714
5736
|
toolId: "${tool.id}" (USE THIS EXACT VALUE for externalTool.toolId)
|
|
5715
5737
|
toolName: "${tool.name}" (USE THIS EXACT VALUE for externalTool.toolName)
|
|
5716
5738
|
parameters: ${JSON.stringify(tool.params || {})} (USE THESE for externalTool.parameters)
|
|
5717
|
-
|
|
5739
|
+
outputSchema: ${outputSchemaText}
|
|
5740
|
+
result preview: ${resultPreview}`;
|
|
5718
5741
|
}).join("\n\n");
|
|
5719
5742
|
}
|
|
5720
5743
|
const schemaDoc = schema.generateSchemaDocumentation();
|
|
@@ -6452,8 +6475,10 @@ Please try rephrasing your request or contact support.
|
|
|
6452
6475
|
name: externalTool.name,
|
|
6453
6476
|
params: toolInput,
|
|
6454
6477
|
// The actual parameters used in this execution
|
|
6455
|
-
result: resultSummary
|
|
6478
|
+
result: resultSummary,
|
|
6456
6479
|
// Store summary instead of full result to save memory
|
|
6480
|
+
outputSchema: externalTool.outputSchema
|
|
6481
|
+
// Include output schema for component config generation
|
|
6457
6482
|
});
|
|
6458
6483
|
logger.info(`[${this.getProviderName()}] Tracked executed tool: ${externalTool.name} with params: ${JSON.stringify(toolInput)}`);
|
|
6459
6484
|
}
|
|
@@ -6669,8 +6694,8 @@ ${errorMsg}
|
|
|
6669
6694
|
userPrompt,
|
|
6670
6695
|
collections,
|
|
6671
6696
|
userId,
|
|
6672
|
-
similarityThreshold: 0.
|
|
6673
|
-
//
|
|
6697
|
+
similarityThreshold: 0.75
|
|
6698
|
+
// 75% threshold
|
|
6674
6699
|
});
|
|
6675
6700
|
if (conversationMatch) {
|
|
6676
6701
|
logger.info(`[${this.getProviderName()}] \u2713 Found matching conversation with ${(conversationMatch.similarity * 100).toFixed(2)}% similarity`);
|