acp-kernel 0.0.81-pr.338.204 → 0.0.82-pr.165.206
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.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3904,7 +3904,7 @@ function collectVisible(messages, state, countTokens) {
|
|
|
3904
3904
|
if (!ref) return;
|
|
3905
3905
|
const tokens = countMessageTokens(message, countTokens);
|
|
3906
3906
|
const tool = isToolMessage(message) ? message.toolName ?? (message.toolCallId ? toolCallNames.get(message.toolCallId) : void 0) ?? "tool" : "text";
|
|
3907
|
-
if (tokens > 0) visible.push({ ref, tokens, tool, index });
|
|
3907
|
+
if (tokens > 0) visible.push({ ref, tokens, tool, index, isUser: message.role === "user" });
|
|
3908
3908
|
});
|
|
3909
3909
|
return { visible, summaryTokens };
|
|
3910
3910
|
}
|
|
@@ -3923,7 +3923,7 @@ function buildStatusReport(state, messages, countTokens, options = {}) {
|
|
|
3923
3923
|
if (view === "messages") {
|
|
3924
3924
|
return renderMessageDrilldown(visible, toolFilter, sort, limit);
|
|
3925
3925
|
}
|
|
3926
|
-
return renderUncompressedRanges(visible);
|
|
3926
|
+
return renderUncompressedRanges(visible, sort, limit);
|
|
3927
3927
|
}
|
|
3928
3928
|
return renderOverview(visible, summaryTokens, activeBlocks2, state, countTokens, limit, options.meta);
|
|
3929
3929
|
}
|
|
@@ -3991,7 +3991,7 @@ function renderOverview(visible, summaryTokens, blocks, state, countTokens, limi
|
|
|
3991
3991
|
);
|
|
3992
3992
|
return lines.join("\n");
|
|
3993
3993
|
}
|
|
3994
|
-
function renderUncompressedRanges(visible) {
|
|
3994
|
+
function renderUncompressedRanges(visible, sort, limit) {
|
|
3995
3995
|
const lines = [];
|
|
3996
3996
|
const totalTokens = visible.reduce((s, m) => s + m.tokens, 0);
|
|
3997
3997
|
lines.push(`UNCOMPRESSED \u2014 ${formatTokens2(totalTokens)} | ${visible.length} visible messages`);
|
|
@@ -4019,7 +4019,9 @@ function renderUncompressedRanges(visible) {
|
|
|
4019
4019
|
for (const m of visible) {
|
|
4020
4020
|
const num = refNum2(m.ref);
|
|
4021
4021
|
const last = merged[merged.length - 1];
|
|
4022
|
-
|
|
4022
|
+
const contiguous = !!last && num === last.startNum + last.count;
|
|
4023
|
+
const turnBoundary = !!last && m.isUser && last.count >= 3;
|
|
4024
|
+
if (contiguous && !turnBoundary) {
|
|
4023
4025
|
last.endRef = m.ref;
|
|
4024
4026
|
last.count += 1;
|
|
4025
4027
|
last.tokens += m.tokens;
|
|
@@ -4029,12 +4031,16 @@ function renderUncompressedRanges(visible) {
|
|
|
4029
4031
|
merged.push({ startRef: m.ref, endRef: m.ref, startNum: num, count: 1, tokens: m.tokens, toolTokens });
|
|
4030
4032
|
}
|
|
4031
4033
|
}
|
|
4032
|
-
|
|
4034
|
+
if (sort !== "time") merged.sort((a, b) => b.tokens - a.tokens || a.startNum - b.startNum);
|
|
4035
|
+
lines.push(`Sorted by ${sort === "time" ? "time" : "size"}`);
|
|
4036
|
+
lines.push("");
|
|
4037
|
+
const shown = merged.slice(0, limit);
|
|
4038
|
+
for (const r of shown) {
|
|
4033
4039
|
const range = r.count === 1 ? r.startRef : `${r.startRef}\u2013${r.endRef}`;
|
|
4034
4040
|
lines.push(` ${range} (${r.count} msgs, ${formatTokens2(r.tokens)}${r.count > 1 ? ` (${Math.round(r.tokens / r.count)}/msg)` : ""}) ${dominantTool(r.toolTokens)}`);
|
|
4035
4041
|
}
|
|
4036
|
-
if (merged.length >
|
|
4037
|
-
lines.push(` ... and ${merged.length -
|
|
4042
|
+
if (merged.length > shown.length) {
|
|
4043
|
+
lines.push(` ... and ${merged.length - shown.length} more ranges`);
|
|
4038
4044
|
}
|
|
4039
4045
|
return lines.join("\n");
|
|
4040
4046
|
}
|