@cognipeer/agent-sdk 0.4.2 → 0.4.4
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 +6 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +6 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2140,12 +2140,10 @@ function safeStringify(value) {
|
|
|
2140
2140
|
if (typeof value === "string") return value;
|
|
2141
2141
|
try {
|
|
2142
2142
|
const serialized = JSON.stringify(value);
|
|
2143
|
-
|
|
2144
|
-
return serialized;
|
|
2145
|
-
}
|
|
2143
|
+
return typeof serialized === "string" ? serialized : String(value);
|
|
2146
2144
|
} catch {
|
|
2145
|
+
return String(value);
|
|
2147
2146
|
}
|
|
2148
|
-
return String(value);
|
|
2149
2147
|
}
|
|
2150
2148
|
function summarizeObject(value) {
|
|
2151
2149
|
if (value == null) return "null";
|
|
@@ -2189,11 +2187,10 @@ function resolveToolResponsePolicy(toolName, output, config) {
|
|
|
2189
2187
|
} else if (classification === "redundant") {
|
|
2190
2188
|
retentionPolicy = byTool || "drop";
|
|
2191
2189
|
}
|
|
2190
|
+
const summary = summarizeObject(output);
|
|
2192
2191
|
if (retentionPolicy === "keep_full") {
|
|
2193
|
-
|
|
2194
|
-
return { classification, retentionPolicy, content: serialized, rawOutput: output, summary: summary2, tokenCount };
|
|
2192
|
+
return { classification, retentionPolicy, content: serialized, rawOutput: output, summary, tokenCount };
|
|
2195
2193
|
}
|
|
2196
|
-
const summary = summarizeObject(output);
|
|
2197
2194
|
if (retentionPolicy === "keep_structured") {
|
|
2198
2195
|
return { classification, retentionPolicy, content: summary, rawOutput: output, summary, tokenCount };
|
|
2199
2196
|
}
|
|
@@ -3063,8 +3060,8 @@ function createAgent(opts) {
|
|
|
3063
3060
|
}
|
|
3064
3061
|
}
|
|
3065
3062
|
let maxTok;
|
|
3066
|
-
if (opts.summarization && typeof opts.summarization === "object"
|
|
3067
|
-
maxTok = opts.summarization.maxTokens;
|
|
3063
|
+
if (opts.summarization && typeof opts.summarization === "object") {
|
|
3064
|
+
maxTok = opts.summarization.summaryTriggerTokens || opts.summarization.maxTokens;
|
|
3068
3065
|
}
|
|
3069
3066
|
if (maxTok === void 0) {
|
|
3070
3067
|
maxTok = 5e4;
|