@superatomai/sdk-node 0.0.53 → 0.0.55

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
@@ -131,7 +131,22 @@ ${"#".repeat(80)}
131
131
  ${"#".repeat(80)}
132
132
  `;
133
133
  LOGSTREAM.write(header);
134
- LOGSTREAM.write(content);
134
+ let contentStr;
135
+ if (typeof content === "string") {
136
+ contentStr = content;
137
+ } else if (Array.isArray(content)) {
138
+ contentStr = content.map((item) => {
139
+ if (typeof item === "string") return item;
140
+ if (item.text) return item.text;
141
+ if (item.content) return typeof item.content === "string" ? item.content : JSON.stringify(item.content, null, 2);
142
+ return JSON.stringify(item, null, 2);
143
+ }).join("\n\n");
144
+ } else if (typeof content === "object") {
145
+ contentStr = JSON.stringify(content, null, 2);
146
+ } else {
147
+ contentStr = String(content);
148
+ }
149
+ LOGSTREAM.write(contentStr);
135
150
  LOGSTREAM.write(`
136
151
  ${"#".repeat(80)}
137
152
 
@@ -5340,6 +5355,19 @@ var LLM = class {
5340
5355
  // src/userResponse/base-llm.ts
5341
5356
  init_logger();
5342
5357
 
5358
+ // src/utils/datetime.ts
5359
+ function getCurrentDateTimeForPrompt() {
5360
+ return (/* @__PURE__ */ new Date()).toLocaleString("en-US", {
5361
+ weekday: "long",
5362
+ year: "numeric",
5363
+ month: "long",
5364
+ day: "numeric",
5365
+ hour: "2-digit",
5366
+ minute: "2-digit",
5367
+ timeZoneName: "short"
5368
+ });
5369
+ }
5370
+
5343
5371
  // src/userResponse/knowledge-base.ts
5344
5372
  init_logger();
5345
5373
  var getKnowledgeBase = async ({
@@ -5820,7 +5848,8 @@ ${fieldsText}`;
5820
5848
  SCHEMA_DOC: schemaDoc,
5821
5849
  DATABASE_RULES: databaseRules,
5822
5850
  DEFERRED_TOOLS: deferredToolsText,
5823
- EXECUTED_TOOLS: executedToolsText
5851
+ EXECUTED_TOOLS: executedToolsText,
5852
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
5824
5853
  });
5825
5854
  logger.debug(`[${this.getProviderName()}] Loaded match-text-components prompts`);
5826
5855
  const systemPromptStr = Array.isArray(prompts.system) ? prompts.system.join("\n") : prompts.system;
@@ -6095,7 +6124,8 @@ ${executedToolsText}`);
6095
6124
  USER_PROMPT: userPrompt,
6096
6125
  CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
6097
6126
  AVAILABLE_TOOLS: availableToolsDoc,
6098
- SCHEMA_DOC: schemaDoc || "No database schema available"
6127
+ SCHEMA_DOC: schemaDoc || "No database schema available",
6128
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
6099
6129
  });
6100
6130
  const systemPrompt = Array.isArray(prompts.system) ? prompts.system.join("\n") : prompts.system;
6101
6131
  const userPromptText = Array.isArray(prompts.user) ? prompts.user.join("\n") : prompts.user;
@@ -6162,7 +6192,8 @@ ${executedToolsText}`);
6162
6192
  COMPONENT_PROPS: JSON.stringify(component.props, null, 2),
6163
6193
  CACHED_TEXT_RESPONSE: cachedTextResponse || "No cached text response available",
6164
6194
  SCHEMA_DOC: schemaDoc || "No schema available",
6165
- DATABASE_RULES: databaseRules
6195
+ DATABASE_RULES: databaseRules,
6196
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
6166
6197
  });
6167
6198
  const result = await LLM.stream(
6168
6199
  {
@@ -6294,7 +6325,8 @@ ${executedToolsText}`);
6294
6325
  SCHEMA_DOC: schemaDoc,
6295
6326
  DATABASE_RULES: databaseRules,
6296
6327
  KNOWLEDGE_BASE_CONTEXT: knowledgeBaseContext || "No additional knowledge base context available.",
6297
- AVAILABLE_EXTERNAL_TOOLS: availableToolsDoc
6328
+ AVAILABLE_EXTERNAL_TOOLS: availableToolsDoc,
6329
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
6298
6330
  });
6299
6331
  const sysPrompt = Array.isArray(prompts.system) ? prompts.system.join("\n") : prompts.system;
6300
6332
  const usrPrompt = Array.isArray(prompts.user) ? prompts.user.join("\n") : prompts.user;
@@ -6975,6 +7007,8 @@ ${errorMsg}
6975
7007
  executionReason: t.executionReason || "",
6976
7008
  requiredFields: t.requiredFields || [],
6977
7009
  userProvidedData: t.userProvidedData || null,
7010
+ // CRITICAL: Include outputSchema from real tool for component config generation
7011
+ outputSchema: realTool?.outputSchema,
6978
7012
  fn: (() => {
6979
7013
  if (realTool) {
6980
7014
  logger.info(`[${this.getProviderName()}] Using real tool implementation for ${t.type}`);
@@ -7063,7 +7097,8 @@ ${errorMsg}
7063
7097
  ORIGINAL_USER_PROMPT: originalUserPrompt,
7064
7098
  COMPONENT_INFO: component_info,
7065
7099
  COMPONENT_DATA: component_data,
7066
- CONVERSATION_HISTORY: conversationHistory || "No previous conversation"
7100
+ CONVERSATION_HISTORY: conversationHistory || "No previous conversation",
7101
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
7067
7102
  });
7068
7103
  const result = await LLM.stream(
7069
7104
  {
@@ -10966,7 +11001,8 @@ async function pickComponentWithLLM(prompt, components, anthropicApiKey, groqApi
10966
11001
  AVAILABLE_COMPONENTS: availableComponentsText,
10967
11002
  SCHEMA_DOC: schemaDoc || "No database schema available",
10968
11003
  DATABASE_RULES: databaseRules,
10969
- AVAILABLE_TOOLS: availableToolsText
11004
+ AVAILABLE_TOOLS: availableToolsText,
11005
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
10970
11006
  });
10971
11007
  logger.debug("[DASH_COMP_REQ] Loaded dash-comp-picker prompts with schema and tools");
10972
11008
  const { apiKey, model } = getApiKeyAndModel(
@@ -11115,7 +11151,8 @@ async function createFilterWithLLM(prompt, components, existingComponents, anthr
11115
11151
  EXISTING_COMPONENTS: formatExistingComponentsForPrompt(existingComponents),
11116
11152
  SCHEMA_DOC: schemaDoc || "No database schema available",
11117
11153
  DATABASE_RULES: databaseRules,
11118
- AVAILABLE_TOOLS: formatToolsForPrompt(tools)
11154
+ AVAILABLE_TOOLS: formatToolsForPrompt(tools),
11155
+ CURRENT_DATETIME: getCurrentDateTimeForPrompt()
11119
11156
  });
11120
11157
  logger.debug("[DASH_COMP_REQ:FILTER] Loaded dash-filter-picker prompts");
11121
11158
  const { apiKey, model } = getApiKeyAndModel(