@cognipeer/agent-sdk 0.4.0 → 0.4.1

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
@@ -2139,10 +2139,13 @@ function countMessagesTokens(messages) {
2139
2139
  function safeStringify(value) {
2140
2140
  if (typeof value === "string") return value;
2141
2141
  try {
2142
- return JSON.stringify(value);
2142
+ const serialized = JSON.stringify(value);
2143
+ if (typeof serialized === "string") {
2144
+ return serialized;
2145
+ }
2143
2146
  } catch {
2144
- return String(value);
2145
2147
  }
2148
+ return String(value);
2146
2149
  }
2147
2150
  function summarizeObject(value) {
2148
2151
  if (value == null) return "null";
@@ -2186,10 +2189,11 @@ function resolveToolResponsePolicy(toolName, output, config) {
2186
2189
  } else if (classification === "redundant") {
2187
2190
  retentionPolicy = byTool || "drop";
2188
2191
  }
2189
- const summary = summarizeObject(output);
2190
2192
  if (retentionPolicy === "keep_full") {
2191
- return { classification, retentionPolicy, content: serialized, rawOutput: output, summary, tokenCount };
2193
+ const summary2 = "";
2194
+ return { classification, retentionPolicy, content: serialized, rawOutput: output, summary: summary2, tokenCount };
2192
2195
  }
2196
+ const summary = summarizeObject(output);
2193
2197
  if (retentionPolicy === "keep_structured") {
2194
2198
  return { classification, retentionPolicy, content: summary, rawOutput: output, summary, tokenCount };
2195
2199
  }