@superatomai/sdk-node 0.0.19-mds → 0.0.20-mds
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 +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -860,6 +860,18 @@ interface SuperatomSDKConfig {
|
|
|
860
860
|
* - 'balanced': Use best model for complex tasks, fast model for simple tasks (default)
|
|
861
861
|
*/
|
|
862
862
|
modelStrategy?: ModelStrategy;
|
|
863
|
+
/**
|
|
864
|
+
* Model for the main agent (routing + analysis).
|
|
865
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
866
|
+
* If not set, uses the provider's default model.
|
|
867
|
+
*/
|
|
868
|
+
mainAgentModel?: string;
|
|
869
|
+
/**
|
|
870
|
+
* Model for source agents (per-source query generation).
|
|
871
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
872
|
+
* If not set, uses the provider's default model.
|
|
873
|
+
*/
|
|
874
|
+
sourceAgentModel?: string;
|
|
863
875
|
/**
|
|
864
876
|
* Separate model configuration for DASH_COMP flow (dashboard component picking)
|
|
865
877
|
* If not provided, falls back to provider-based model selection
|
|
@@ -2754,6 +2766,8 @@ declare class SuperatomSDK {
|
|
|
2754
2766
|
private llmProviders;
|
|
2755
2767
|
private databaseType;
|
|
2756
2768
|
private modelStrategy;
|
|
2769
|
+
private mainAgentModel;
|
|
2770
|
+
private sourceAgentModel;
|
|
2757
2771
|
private conversationSimilarityThreshold;
|
|
2758
2772
|
private userManager;
|
|
2759
2773
|
private dashboardManager;
|
package/dist/index.d.ts
CHANGED
|
@@ -860,6 +860,18 @@ interface SuperatomSDKConfig {
|
|
|
860
860
|
* - 'balanced': Use best model for complex tasks, fast model for simple tasks (default)
|
|
861
861
|
*/
|
|
862
862
|
modelStrategy?: ModelStrategy;
|
|
863
|
+
/**
|
|
864
|
+
* Model for the main agent (routing + analysis).
|
|
865
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
866
|
+
* If not set, uses the provider's default model.
|
|
867
|
+
*/
|
|
868
|
+
mainAgentModel?: string;
|
|
869
|
+
/**
|
|
870
|
+
* Model for source agents (per-source query generation).
|
|
871
|
+
* Format: "provider/model-name" (e.g., "anthropic/claude-haiku-4-5-20251001")
|
|
872
|
+
* If not set, uses the provider's default model.
|
|
873
|
+
*/
|
|
874
|
+
sourceAgentModel?: string;
|
|
863
875
|
/**
|
|
864
876
|
* Separate model configuration for DASH_COMP flow (dashboard component picking)
|
|
865
877
|
* If not provided, falls back to provider-based model selection
|
|
@@ -2754,6 +2766,8 @@ declare class SuperatomSDK {
|
|
|
2754
2766
|
private llmProviders;
|
|
2755
2767
|
private databaseType;
|
|
2756
2768
|
private modelStrategy;
|
|
2769
|
+
private mainAgentModel;
|
|
2770
|
+
private sourceAgentModel;
|
|
2757
2771
|
private conversationSimilarityThreshold;
|
|
2758
2772
|
private userManager;
|
|
2759
2773
|
private dashboardManager;
|
package/dist/index.js
CHANGED
|
@@ -7760,10 +7760,10 @@ var DEFAULT_AGENT_CONFIG = {
|
|
|
7760
7760
|
// will use the provider's default model
|
|
7761
7761
|
sourceAgentModel: "",
|
|
7762
7762
|
// will use the provider's default model
|
|
7763
|
-
maxRetries:
|
|
7764
|
-
//
|
|
7765
|
-
maxIterations:
|
|
7766
|
-
//
|
|
7763
|
+
maxRetries: 1,
|
|
7764
|
+
// 1 retry = 2 total query attempts (1 initial + 1 retry for SQL errors)
|
|
7765
|
+
maxIterations: 8
|
|
7766
|
+
// schema search (2-3) + query attempts (2) + LLM responses + final
|
|
7767
7767
|
};
|
|
7768
7768
|
|
|
7769
7769
|
// src/userResponse/utils/component-props-processor.ts
|
|
@@ -7927,9 +7927,20 @@ ${executedToolsText}`);
|
|
|
7927
7927
|
true
|
|
7928
7928
|
// Parse as JSON
|
|
7929
7929
|
);
|
|
7930
|
-
|
|
7930
|
+
let matchedComponents = result.matchedComponents || [];
|
|
7931
7931
|
const layoutTitle = result.layoutTitle || "Dashboard";
|
|
7932
7932
|
const layoutDescription = result.layoutDescription || "Multi-component dashboard";
|
|
7933
|
+
const complexityMatch = analysisContent.match(/\[COMPLEXITY:\s*(simple|medium|complex)\]/i);
|
|
7934
|
+
const complexity = complexityMatch ? complexityMatch[1].toLowerCase() : "medium";
|
|
7935
|
+
const maxVisualizations = complexity === "simple" ? 1 : complexity === "medium" ? 3 : 5;
|
|
7936
|
+
const markdownComps = matchedComponents.filter((mc) => mc.componentName === "DynamicMarkdownBlock");
|
|
7937
|
+
const vizComps = matchedComponents.filter((mc) => mc.componentName !== "DynamicMarkdownBlock");
|
|
7938
|
+
if (vizComps.length > maxVisualizations) {
|
|
7939
|
+
logger.info(`[AgentComponentGen] Trimming ${vizComps.length} visualizations to ${maxVisualizations} (complexity: ${complexity})`);
|
|
7940
|
+
matchedComponents = [...vizComps.slice(0, maxVisualizations), ...markdownComps];
|
|
7941
|
+
} else {
|
|
7942
|
+
logger.info(`[AgentComponentGen] Complexity: ${complexity} | ${vizComps.length} visualizations (limit: ${maxVisualizations})`);
|
|
7943
|
+
}
|
|
7933
7944
|
if (result.hasAnswerComponent && result.answerComponent?.componentId) {
|
|
7934
7945
|
const answer = result.answerComponent;
|
|
7935
7946
|
const answerSql = answer.props?.externalTool?.parameters?.sql || "";
|
|
@@ -10324,7 +10335,7 @@ function getLLMInstance(provider) {
|
|
|
10324
10335
|
return anthropicLLM;
|
|
10325
10336
|
}
|
|
10326
10337
|
}
|
|
10327
|
-
var get_agent_user_response = async (prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, conversationHistory, streamCallback, collections, externalTools, userId) => {
|
|
10338
|
+
var get_agent_user_response = async (prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, conversationHistory, streamCallback, collections, externalTools, userId, mainAgentModel, sourceAgentModel) => {
|
|
10328
10339
|
const startTime = Date.now();
|
|
10329
10340
|
const providers = llmProviders || ["anthropic"];
|
|
10330
10341
|
const provider = providers[0];
|
|
@@ -10420,6 +10431,8 @@ var get_agent_user_response = async (prompt, components, anthropicApiKey, groqAp
|
|
|
10420
10431
|
const agentConfig = {
|
|
10421
10432
|
...DEFAULT_AGENT_CONFIG,
|
|
10422
10433
|
apiKey: apiKey || void 0,
|
|
10434
|
+
mainAgentModel: mainAgentModel || DEFAULT_AGENT_CONFIG.mainAgentModel,
|
|
10435
|
+
sourceAgentModel: sourceAgentModel || DEFAULT_AGENT_CONFIG.sourceAgentModel,
|
|
10423
10436
|
globalKnowledgeBase,
|
|
10424
10437
|
knowledgeBaseContext
|
|
10425
10438
|
};
|
|
@@ -10688,7 +10701,7 @@ var CONTEXT_CONFIG = {
|
|
|
10688
10701
|
};
|
|
10689
10702
|
|
|
10690
10703
|
// src/handlers/user-prompt-request.ts
|
|
10691
|
-
var get_user_request = async (data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools) => {
|
|
10704
|
+
var get_user_request = async (data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel) => {
|
|
10692
10705
|
const errors = [];
|
|
10693
10706
|
const parseResult = UserPromptRequestMessageSchema.safeParse(data);
|
|
10694
10707
|
if (!parseResult.success) {
|
|
@@ -10771,7 +10784,9 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
10771
10784
|
streamCallback,
|
|
10772
10785
|
collections,
|
|
10773
10786
|
externalTools,
|
|
10774
|
-
userId
|
|
10787
|
+
userId,
|
|
10788
|
+
mainAgentModel,
|
|
10789
|
+
sourceAgentModel
|
|
10775
10790
|
);
|
|
10776
10791
|
logger.info("User prompt request completed");
|
|
10777
10792
|
const uiBlockId = existingUiBlockId;
|
|
@@ -10871,8 +10886,8 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
10871
10886
|
wsId
|
|
10872
10887
|
};
|
|
10873
10888
|
};
|
|
10874
|
-
async function handleUserPromptRequest(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools) {
|
|
10875
|
-
const response = await get_user_request(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools);
|
|
10889
|
+
async function handleUserPromptRequest(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel) {
|
|
10890
|
+
const response = await get_user_request(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel);
|
|
10876
10891
|
if (response.data?.component?.props?.config?.components) {
|
|
10877
10892
|
response.data.component.props.config.components = response.data.component.props.config.components.map((comp) => ({
|
|
10878
10893
|
...comp,
|
|
@@ -16610,6 +16625,8 @@ var SuperatomSDK = class {
|
|
|
16610
16625
|
this.llmProviders = config.LLM_PROVIDERS || getLLMProviders();
|
|
16611
16626
|
this.databaseType = config.databaseType || "postgresql";
|
|
16612
16627
|
this.modelStrategy = config.modelStrategy || "fast";
|
|
16628
|
+
this.mainAgentModel = config.mainAgentModel || "anthropic/claude-sonnet-4-5-20250929";
|
|
16629
|
+
this.sourceAgentModel = config.sourceAgentModel || "anthropic/claude-sonnet-4-5-20250929";
|
|
16613
16630
|
this.conversationSimilarityThreshold = config.conversationSimilarityThreshold ?? 0.8;
|
|
16614
16631
|
this.applyModelStrategy(this.modelStrategy);
|
|
16615
16632
|
this.applyConversationSimilarityThreshold(this.conversationSimilarityThreshold);
|
|
@@ -16767,7 +16784,7 @@ var SuperatomSDK = class {
|
|
|
16767
16784
|
});
|
|
16768
16785
|
break;
|
|
16769
16786
|
case "USER_PROMPT_REQ":
|
|
16770
|
-
handleUserPromptRequest(parsed, this.components, (msg) => this.send(msg), this.anthropicApiKey, this.groqApiKey, this.geminiApiKey, this.openaiApiKey, this.llmProviders, this.collections, this.tools).catch((error) => {
|
|
16787
|
+
handleUserPromptRequest(parsed, this.components, (msg) => this.send(msg), this.anthropicApiKey, this.groqApiKey, this.geminiApiKey, this.openaiApiKey, this.llmProviders, this.collections, this.tools, this.mainAgentModel, this.sourceAgentModel).catch((error) => {
|
|
16771
16788
|
logger.error("Failed to handle user prompt request:", error);
|
|
16772
16789
|
});
|
|
16773
16790
|
break;
|