acp-kernel 0.0.47-pr.175.28 → 0.0.47-pr.177.30
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/compress.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -38
- package/dist/index.js.map +1 -1
- package/dist/message-kind.d.ts +11 -0
- package/dist/message-kind.d.ts.map +1 -0
- package/dist/panel/index.js.map +1 -1
- package/dist/panel/panel.d.ts +7 -6
- package/dist/panel/panel.d.ts.map +1 -1
- package/dist/recommend.d.ts.map +1 -1
- package/dist/report.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/compress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAchF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAUvD,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAEhB,MAAM,EAEN,WAAW,EAGX,iBAAiB,EAEjB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IACxD,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,sBAAsB,CAAC;IACvE,YAAY,IAAI,YAAY,EAAE,CAAC;IAC/B,UAAU,CACR,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,gBAAgB,GACtB,gBAAgB,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IACnE,MAAM,CACJ,KAAK,EAAE,gBAAgB,EACvB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,YAAY,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,EAAE,CAAC;IACJ,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AA2BD,wBAAgB,UAAU,CAAC,KAAK,GAAE,KAAU,GAAG,eAAe,CA+T7D;AAm5BD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { parseBlockIdArg, findBlocksOverlappingMessages, findActiveAncestor, dea
|
|
|
21
21
|
export type { DeactivateOptions, CollectedContentResult, CollectContentOptions, } from "./decompress.js";
|
|
22
22
|
export { buildStatusReport, buildRecap } from "./report.js";
|
|
23
23
|
export type { StatusReportOptions } from "./report.js";
|
|
24
|
+
export { isToolMessage } from "./message-kind.js";
|
|
24
25
|
export { hideConsumedCompressCalls } from "./hide-consumed.js";
|
|
25
26
|
export type { HideConsumedResult } from "./hide-consumed.js";
|
|
26
27
|
export { ABSORB_TOOL_NAME, ABSORB_TOOL, ABSORB_TOOL_OPENAI, } from "./compress-tools.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;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AAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EACV,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,E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AmB,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,MAAM,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1575,6 +1575,11 @@ function createRenderRefsNode(strategy) {
|
|
|
1575
1575
|
}
|
|
1576
1576
|
var renderRefsNode = createRenderRefsNode("all");
|
|
1577
1577
|
|
|
1578
|
+
// src/message-kind.ts
|
|
1579
|
+
function isToolMessage(message) {
|
|
1580
|
+
return message.contentType === "tool-call" || message.contentType === "tool-result";
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1578
1583
|
// src/tool-pairs.ts
|
|
1579
1584
|
function adjustBoundariesForToolPairs(startIndex, endIndex, messages, maxScan = 20) {
|
|
1580
1585
|
const callIdsInRange = /* @__PURE__ */ new Set();
|
|
@@ -1652,9 +1657,6 @@ function refNum(ref) {
|
|
|
1652
1657
|
function estimateTextTokens(text) {
|
|
1653
1658
|
return Math.ceil(text.length / 4);
|
|
1654
1659
|
}
|
|
1655
|
-
function isToolMessage(message) {
|
|
1656
|
-
return message.contentType === "tool-call" || message.contentType === "tool-result";
|
|
1657
|
-
}
|
|
1658
1660
|
function isSyntheticOrPruned(message, state) {
|
|
1659
1661
|
if (message.text?.startsWith("[Compressed conversation section]")) return true;
|
|
1660
1662
|
for (const block of state.blocks) {
|
|
@@ -1861,26 +1863,6 @@ function numericBlockId(id) {
|
|
|
1861
1863
|
const parsed = /^b(\d+)$/.exec(id);
|
|
1862
1864
|
return parsed ? Number(parsed[1]) : 0;
|
|
1863
1865
|
}
|
|
1864
|
-
function refGateDiagnostics(state, requestedRanges, unknownCount) {
|
|
1865
|
-
const highest = highestUsedIndex(state.messageRefs);
|
|
1866
|
-
const highestRef = highest > 0 ? indexToRef(highest) : "none";
|
|
1867
|
-
return `[diagnostics: session highest ref=${highestRef}, unknown ranges in request=${unknownCount}/${requestedRanges}, session history=${state.stats.compressionCount} compression(s), ${state.blocks.length} block(s)]`;
|
|
1868
|
-
}
|
|
1869
|
-
function danglingMessageRefs(state, messages, spec) {
|
|
1870
|
-
const visible = new Set(messages.map((m) => m.id));
|
|
1871
|
-
const dangling = [];
|
|
1872
|
-
for (const ref of [spec.startRef, spec.endRef]) {
|
|
1873
|
-
const parsed = parseBoundary(ref);
|
|
1874
|
-
if (!parsed || parsed.kind !== "message") continue;
|
|
1875
|
-
const rawId = state.messageRefs.byRef[parsed.raw] ?? state.messageRefs.byRef[indexToRef(parsed.numericId)];
|
|
1876
|
-
if (!rawId || visible.has(rawId)) continue;
|
|
1877
|
-
const covered = state.blocks.some(
|
|
1878
|
-
(block) => block.active && block.effectiveMessageIds.includes(rawId)
|
|
1879
|
-
);
|
|
1880
|
-
if (!covered) dangling.push(parsed.raw);
|
|
1881
|
-
}
|
|
1882
|
-
return dangling;
|
|
1883
|
-
}
|
|
1884
1866
|
function createCore(ports = {}) {
|
|
1885
1867
|
const countTokens = ports.countTokens ?? defaultCountTokens;
|
|
1886
1868
|
function applyCompression(input) {
|
|
@@ -1981,15 +1963,7 @@ function createCore(ports = {}) {
|
|
|
1981
1963
|
if (!hasBlockBoundaryRange && totalRangeChars < input.config.compress.minCompressRange) {
|
|
1982
1964
|
const live = activeBlocks(state).map((b) => b.blockId).sort((x, y) => numericBlockId(x) - numericBlockId(y));
|
|
1983
1965
|
const liveHint = live.length > 0 ? ` Current active blocks span ${live[0]}..${live[live.length - 1]} \u2014 retry with startId/endId set to active block IDs in that span.` : "";
|
|
1984
|
-
const
|
|
1985
|
-
state,
|
|
1986
|
-
input.ranges.length,
|
|
1987
|
-
unknownCount
|
|
1988
|
-
);
|
|
1989
|
-
const danglingRefs = consumedRanges.flatMap(
|
|
1990
|
-
(spec) => danglingMessageRefs(state, input.messages, spec)
|
|
1991
|
-
);
|
|
1992
|
-
const gateMessage = resolvableCount === 0 && consumedRanges.length === 0 && unknownCount > 0 ? `None of the ${input.ranges.length} requested range(s) resolved \u2014 every ref is unknown to this session. Refs are per-session snapshots, assigned once when a message is first rendered; no compress reassigns them, so unknown refs cannot come from an earlier compress in this session. They come from a different generation: a previous session instance (switching model or upstream mid-conversation starts a fresh session whose refs restart at m00001), the generation before a native-compaction rebase (which also resets refs to m00001), or a typo. ${diagnostics} Run acp_status, then call the compress tool again using only the refs it reports.` : consumedRanges.length > 0 ? danglingRefs.length > 0 ? `Requested range(s) cannot be anchored (e.g. ${consumedRanges[0].startRef}..${consumedRanges[0].endRef}) \u2014 the refs exist in this session's ref map, but the messages they point to are no longer in the visible context and no active block covers them: the message content changed (or the message was filtered out of the view) and now carries a new ref, leaving your old refs dangling. ${diagnostics} Run acp_status, then call the compress tool again using only the refs it reports.` : `Requested range(s) already compressed (e.g. ${consumedRanges[0].startRef}..${consumedRanges[0].endRef}) \u2014 those refs no longer point to directly compressible content: the range is covered by active block(s) or the block ref(s) are stale (distilled or consumed). ${diagnostics} Run acp_status, then call the compress tool again using only the CURRENT compressible ranges it reports.${liveHint}` : `Total compressible content too small (${totalRangeChars} chars across ${countedRanges} range(s), min ${input.config.compress.minCompressRange}). Combine more messages into your range(s) to meet the threshold.`;
|
|
1966
|
+
const gateMessage = resolvableCount === 0 && consumedRanges.length === 0 && unknownCount > 0 ? `None of the ${input.ranges.length} requested range(s) resolved \u2014 every ref failed with "does not exist in this session". Refs recorded before an earlier compress are stale: each successful compress renumbers the remaining refs. Run acp_status, then call the compress tool again using only the refs it reports.` : consumedRanges.length > 0 ? `Requested range(s) already compressed (e.g. ${consumedRanges[0].startRef}..${consumedRanges[0].endRef}) \u2014 your refs are stale: a prior compress renumbered the remaining refs, so this range now falls inside an active block. Run acp_status, then call the compress tool again using only the CURRENT compressible ranges it reports.${liveHint}` : `Total compressible content too small (${totalRangeChars} chars across ${countedRanges} range(s), min ${input.config.compress.minCompressRange}). Combine more messages into your range(s) to meet the threshold.`;
|
|
1993
1967
|
return {
|
|
1994
1968
|
state: input.state,
|
|
1995
1969
|
result: {
|
|
@@ -2694,7 +2668,7 @@ function computeContextBreakdown(messages, total, growth, countTokens) {
|
|
|
2694
2668
|
const tokens = count(msg.text ?? "");
|
|
2695
2669
|
if (msg.text?.startsWith("[Compressed conversation section]")) {
|
|
2696
2670
|
summaries += tokens;
|
|
2697
|
-
} else if (msg
|
|
2671
|
+
} else if (isToolMessage(msg)) {
|
|
2698
2672
|
tool += tokens;
|
|
2699
2673
|
} else if (msg.role === "system") {
|
|
2700
2674
|
system += tokens;
|
|
@@ -2897,7 +2871,7 @@ function formatTokens2(n) {
|
|
|
2897
2871
|
}
|
|
2898
2872
|
function pct(n, total) {
|
|
2899
2873
|
if (n <= 0 || total <= 0) return 0;
|
|
2900
|
-
return Math.
|
|
2874
|
+
return Math.round(n / total * 100);
|
|
2901
2875
|
}
|
|
2902
2876
|
function numericPart2(blockId) {
|
|
2903
2877
|
const match = /^b(\d+)$/.exec(blockId);
|
|
@@ -2935,14 +2909,21 @@ function collectVisible(messages, state, countTokens) {
|
|
|
2935
2909
|
for (const block of state.blocks) {
|
|
2936
2910
|
if (block.active) summaryTokens += summaryTokensOf(block, countTokens);
|
|
2937
2911
|
}
|
|
2912
|
+
const nameByCallId = /* @__PURE__ */ new Map();
|
|
2913
|
+
for (const message of messages) {
|
|
2914
|
+
if (message.contentType === "tool-call" && message.toolCallId && message.toolName) {
|
|
2915
|
+
nameByCallId.set(message.toolCallId, message.toolName);
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2938
2918
|
const visible = [];
|
|
2939
2919
|
messages.forEach((message, index) => {
|
|
2940
2920
|
if (coveredIds.has(message.id)) return;
|
|
2941
2921
|
const ref = refForRaw(state.messageRefs, message.id);
|
|
2942
2922
|
if (!ref) return;
|
|
2943
2923
|
const tokens = countTokens(message.text ?? "");
|
|
2944
|
-
const
|
|
2945
|
-
|
|
2924
|
+
const isTool = isToolMessage(message);
|
|
2925
|
+
const tool = isTool ? message.toolName ?? (message.toolCallId ? nameByCallId.get(message.toolCallId) : void 0) ?? "tool" : "text";
|
|
2926
|
+
if (tokens > 0) visible.push({ ref, tokens, tool, isTool, index });
|
|
2946
2927
|
});
|
|
2947
2928
|
return { visible, summaryTokens };
|
|
2948
2929
|
}
|
|
@@ -2972,8 +2953,8 @@ function renderOverview(visible, summaryTokens, blocks, state, countTokens, limi
|
|
|
2972
2953
|
toolTypeMap.set(message.tool, (toolTypeMap.get(message.tool) ?? 0) + message.tokens);
|
|
2973
2954
|
}
|
|
2974
2955
|
const topTool = [...toolTypeMap.entries()].sort((a, b) => b[1] - a[1])[0]?.[0];
|
|
2975
|
-
const totalTool = visible.filter((m) => m.
|
|
2976
|
-
const totalText = visible.filter((m) => m.
|
|
2956
|
+
const totalTool = visible.filter((m) => m.isTool).reduce((sum, m) => sum + m.tokens, 0);
|
|
2957
|
+
const totalText = visible.filter((m) => !m.isTool).reduce((sum, m) => sum + m.tokens, 0);
|
|
2977
2958
|
const total = summaryTokens + totalTool + totalText;
|
|
2978
2959
|
lines.push("CONTEXT BREAKDOWN");
|
|
2979
2960
|
lines.push(
|
|
@@ -3902,6 +3883,7 @@ export {
|
|
|
3902
3883
|
isMessageProtected,
|
|
3903
3884
|
isRenderedSummaryMessage,
|
|
3904
3885
|
isSummaryMessageId,
|
|
3886
|
+
isToolMessage,
|
|
3905
3887
|
listMessageFilters,
|
|
3906
3888
|
listSearchAlgorithms,
|
|
3907
3889
|
makeIO,
|