@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.mjs CHANGED
@@ -7700,10 +7700,10 @@ var DEFAULT_AGENT_CONFIG = {
7700
7700
  // will use the provider's default model
7701
7701
  sourceAgentModel: "",
7702
7702
  // will use the provider's default model
7703
- maxRetries: 3,
7704
- // 3 retries = 4 total query attempts (1 initial + 3 retries for SQL errors)
7705
- maxIterations: 15
7706
- // must accommodate: schema searches (2-3) + query attempts (4) + LLM responses + final
7703
+ maxRetries: 1,
7704
+ // 1 retry = 2 total query attempts (1 initial + 1 retry for SQL errors)
7705
+ maxIterations: 8
7706
+ // schema search (2-3) + query attempts (2) + LLM responses + final
7707
7707
  };
7708
7708
 
7709
7709
  // src/userResponse/utils/component-props-processor.ts
@@ -7867,9 +7867,20 @@ ${executedToolsText}`);
7867
7867
  true
7868
7868
  // Parse as JSON
7869
7869
  );
7870
- const matchedComponents = result.matchedComponents || [];
7870
+ let matchedComponents = result.matchedComponents || [];
7871
7871
  const layoutTitle = result.layoutTitle || "Dashboard";
7872
7872
  const layoutDescription = result.layoutDescription || "Multi-component dashboard";
7873
+ const complexityMatch = analysisContent.match(/\[COMPLEXITY:\s*(simple|medium|complex)\]/i);
7874
+ const complexity = complexityMatch ? complexityMatch[1].toLowerCase() : "medium";
7875
+ const maxVisualizations = complexity === "simple" ? 1 : complexity === "medium" ? 3 : 5;
7876
+ const markdownComps = matchedComponents.filter((mc) => mc.componentName === "DynamicMarkdownBlock");
7877
+ const vizComps = matchedComponents.filter((mc) => mc.componentName !== "DynamicMarkdownBlock");
7878
+ if (vizComps.length > maxVisualizations) {
7879
+ logger.info(`[AgentComponentGen] Trimming ${vizComps.length} visualizations to ${maxVisualizations} (complexity: ${complexity})`);
7880
+ matchedComponents = [...vizComps.slice(0, maxVisualizations), ...markdownComps];
7881
+ } else {
7882
+ logger.info(`[AgentComponentGen] Complexity: ${complexity} | ${vizComps.length} visualizations (limit: ${maxVisualizations})`);
7883
+ }
7873
7884
  if (result.hasAnswerComponent && result.answerComponent?.componentId) {
7874
7885
  const answer = result.answerComponent;
7875
7886
  const answerSql = answer.props?.externalTool?.parameters?.sql || "";
@@ -10264,7 +10275,7 @@ function getLLMInstance(provider) {
10264
10275
  return anthropicLLM;
10265
10276
  }
10266
10277
  }
10267
- var get_agent_user_response = async (prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, conversationHistory, streamCallback, collections, externalTools, userId) => {
10278
+ var get_agent_user_response = async (prompt, components, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, conversationHistory, streamCallback, collections, externalTools, userId, mainAgentModel, sourceAgentModel) => {
10268
10279
  const startTime = Date.now();
10269
10280
  const providers = llmProviders || ["anthropic"];
10270
10281
  const provider = providers[0];
@@ -10360,6 +10371,8 @@ var get_agent_user_response = async (prompt, components, anthropicApiKey, groqAp
10360
10371
  const agentConfig = {
10361
10372
  ...DEFAULT_AGENT_CONFIG,
10362
10373
  apiKey: apiKey || void 0,
10374
+ mainAgentModel: mainAgentModel || DEFAULT_AGENT_CONFIG.mainAgentModel,
10375
+ sourceAgentModel: sourceAgentModel || DEFAULT_AGENT_CONFIG.sourceAgentModel,
10363
10376
  globalKnowledgeBase,
10364
10377
  knowledgeBaseContext
10365
10378
  };
@@ -10628,7 +10641,7 @@ var CONTEXT_CONFIG = {
10628
10641
  };
10629
10642
 
10630
10643
  // src/handlers/user-prompt-request.ts
10631
- var get_user_request = async (data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools) => {
10644
+ var get_user_request = async (data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel) => {
10632
10645
  const errors = [];
10633
10646
  const parseResult = UserPromptRequestMessageSchema.safeParse(data);
10634
10647
  if (!parseResult.success) {
@@ -10711,7 +10724,9 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
10711
10724
  streamCallback,
10712
10725
  collections,
10713
10726
  externalTools,
10714
- userId
10727
+ userId,
10728
+ mainAgentModel,
10729
+ sourceAgentModel
10715
10730
  );
10716
10731
  logger.info("User prompt request completed");
10717
10732
  const uiBlockId = existingUiBlockId;
@@ -10811,8 +10826,8 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
10811
10826
  wsId
10812
10827
  };
10813
10828
  };
10814
- async function handleUserPromptRequest(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools) {
10815
- const response = await get_user_request(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools);
10829
+ async function handleUserPromptRequest(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel) {
10830
+ const response = await get_user_request(data, components, sendMessage, anthropicApiKey, groqApiKey, geminiApiKey, openaiApiKey, llmProviders, collections, externalTools, mainAgentModel, sourceAgentModel);
10816
10831
  if (response.data?.component?.props?.config?.components) {
10817
10832
  response.data.component.props.config.components = response.data.component.props.config.components.map((comp) => ({
10818
10833
  ...comp,
@@ -16550,6 +16565,8 @@ var SuperatomSDK = class {
16550
16565
  this.llmProviders = config.LLM_PROVIDERS || getLLMProviders();
16551
16566
  this.databaseType = config.databaseType || "postgresql";
16552
16567
  this.modelStrategy = config.modelStrategy || "fast";
16568
+ this.mainAgentModel = config.mainAgentModel || "anthropic/claude-sonnet-4-5-20250929";
16569
+ this.sourceAgentModel = config.sourceAgentModel || "anthropic/claude-sonnet-4-5-20250929";
16553
16570
  this.conversationSimilarityThreshold = config.conversationSimilarityThreshold ?? 0.8;
16554
16571
  this.applyModelStrategy(this.modelStrategy);
16555
16572
  this.applyConversationSimilarityThreshold(this.conversationSimilarityThreshold);
@@ -16707,7 +16724,7 @@ var SuperatomSDK = class {
16707
16724
  });
16708
16725
  break;
16709
16726
  case "USER_PROMPT_REQ":
16710
- handleUserPromptRequest(parsed, this.components, (msg) => this.send(msg), this.anthropicApiKey, this.groqApiKey, this.geminiApiKey, this.openaiApiKey, this.llmProviders, this.collections, this.tools).catch((error) => {
16727
+ 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) => {
16711
16728
  logger.error("Failed to handle user prompt request:", error);
16712
16729
  });
16713
16730
  break;