@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.cjs CHANGED
@@ -2149,10 +2149,13 @@ function countMessagesTokens(messages) {
2149
2149
  function safeStringify(value) {
2150
2150
  if (typeof value === "string") return value;
2151
2151
  try {
2152
- return JSON.stringify(value);
2152
+ const serialized = JSON.stringify(value);
2153
+ if (typeof serialized === "string") {
2154
+ return serialized;
2155
+ }
2153
2156
  } catch {
2154
- return String(value);
2155
2157
  }
2158
+ return String(value);
2156
2159
  }
2157
2160
  function summarizeObject(value) {
2158
2161
  if (value == null) return "null";
@@ -2196,10 +2199,11 @@ function resolveToolResponsePolicy(toolName, output, config) {
2196
2199
  } else if (classification === "redundant") {
2197
2200
  retentionPolicy = byTool || "drop";
2198
2201
  }
2199
- const summary = summarizeObject(output);
2200
2202
  if (retentionPolicy === "keep_full") {
2201
- return { classification, retentionPolicy, content: serialized, rawOutput: output, summary, tokenCount };
2203
+ const summary2 = "";
2204
+ return { classification, retentionPolicy, content: serialized, rawOutput: output, summary: summary2, tokenCount };
2202
2205
  }
2206
+ const summary = summarizeObject(output);
2203
2207
  if (retentionPolicy === "keep_structured") {
2204
2208
  return { classification, retentionPolicy, content: summary, rawOutput: output, summary, tokenCount };
2205
2209
  }