acp-kernel 0.0.69-pr.293.158 → 0.0.70-pr.294.159

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.
@@ -1 +1 @@
1
- {"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAgBhF,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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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;AA2DD,wBAAgB,UAAU,CAAC,KAAK,GAAE,KAAU,GAAG,eAAe,CAyU7D;AAygCD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -165,40 +165,9 @@ function collectSummaryAnchors(state, indexById, summaryIndexById) {
165
165
  anchors.sort((left, right) => left.insertAt - right.insertAt);
166
166
  return anchors;
167
167
  }
168
- function pairSafeAnchorIndex(messages, index) {
169
- const resultIndexByCallId = /* @__PURE__ */ new Map();
170
- messages.forEach((message, at) => {
171
- if (message.contentType !== "tool-result") return;
172
- if (typeof message.toolCallId !== "string") return;
173
- if (!resultIndexByCallId.has(message.toolCallId)) {
174
- resultIndexByCallId.set(message.toolCallId, at);
175
- }
176
- });
177
- let safe = index;
178
- for (let guard = 0; guard < messages.length; guard++) {
179
- let moved = safe;
180
- for (let at = 0; at < safe && at < messages.length; at++) {
181
- const message = messages[at];
182
- if (message.role !== "assistant") continue;
183
- if (message.contentType !== "tool-call") continue;
184
- if (typeof message.toolCallId !== "string") continue;
185
- const resultIndex = resultIndexByCallId.get(message.toolCallId);
186
- if (resultIndex !== void 0 && resultIndex >= safe && resultIndex + 1 > moved) {
187
- moved = resultIndex + 1;
188
- }
189
- }
190
- if (moved === safe) break;
191
- safe = moved;
192
- }
193
- return safe;
194
- }
195
168
  function rebuildMessages(messages, covered, firstUserIndex, anchors) {
196
- const safeAnchors = anchors.map((anchor) => ({
197
- ...anchor,
198
- insertAt: pairSafeAnchorIndex(messages, anchor.insertAt)
199
- })).sort((left, right) => left.insertAt - right.insertAt);
200
169
  const result = [];
201
- const pending = [...safeAnchors];
170
+ const pending = [...anchors];
202
171
  const anchoredSummaryIds = new Set(
203
172
  anchors.map((anchor) => summaryMessageId(anchor.blockId))
204
173
  );
@@ -2662,42 +2631,17 @@ function applySingleRange(input) {
2662
2631
  splitTurnCount++;
2663
2632
  for (const id of group) withdrawIds.add(id);
2664
2633
  }
2665
- const resultIdByCallId = /* @__PURE__ */ new Map();
2666
- for (const m of input.messages) {
2667
- if (!m.id || m.contentType !== "tool-result") continue;
2668
- if (typeof m.toolCallId !== "string") continue;
2669
- if (!resultIdByCallId.has(m.toolCallId)) {
2670
- resultIdByCallId.set(m.toolCallId, m.id);
2671
- }
2672
- }
2673
- let splitPairCount = 0;
2674
- for (const m of input.messages) {
2675
- if (!m.id || m.contentType !== "tool-call") continue;
2676
- if (typeof m.toolCallId !== "string") continue;
2677
- const resultId = resultIdByCallId.get(m.toolCallId);
2678
- if (resultId === void 0) continue;
2679
- if (effectiveMessageIds.has(m.id) === effectiveMessageIds.has(resultId)) {
2680
- continue;
2681
- }
2682
- withdrawIds.add(m.id);
2683
- withdrawIds.add(resultId);
2684
- splitPairCount++;
2685
- }
2686
2634
  if (withdrawIds.size > 0) {
2687
2635
  for (const id of withdrawIds) effectiveMessageIds.delete(id);
2688
2636
  const beforeWithdraw = filteredIds.length;
2689
2637
  filteredIds = filteredIds.filter((id) => !withdrawIds.has(id));
2690
- const splitDesc = [
2691
- splitTurnCount > 0 ? `${splitTurnCount} turn(s)` : null,
2692
- splitPairCount > 0 ? `${splitPairCount} tool call/result pair(s)` : null
2693
- ].filter((part) => part !== null).join(" and ");
2694
2638
  if (filteredIds.length === 0 && consumedBlockIds.length === 0) {
2695
2639
  throw new Error(
2696
- `Range would split ${splitDesc} at the protected-zone boundary: a visible tool-call must keep its reasoning run and its results (strict providers reject a rebuilt request that lost either). Shrink the range to end before the turn starts, or wait until the whole turn ages out of the protected zone.`
2640
+ `Range would split ${splitTurnCount} turn(s) at the protected-zone boundary: a visible tool-call must keep its reasoning run (strict-echo providers reject a rebuilt request that lost it). Shrink the range to end before the turn starts, or wait until the whole turn ages out of the protected zone.`
2697
2641
  );
2698
2642
  }
2699
2643
  warnings.push(
2700
- `Withdrawn ${beforeWithdraw - filteredIds.length} message(s) from compression range to keep ${splitDesc} intact (visible tool-call would lose its reasoning run or its results).`
2644
+ `Withdrawn ${beforeWithdraw - filteredIds.length} message(s) from compression range to keep ${splitTurnCount} turn(s) intact (visible tool-call would lose its reasoning run).`
2701
2645
  );
2702
2646
  }
2703
2647
  }