acp-kernel 0.0.36 → 0.0.38
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/boundaries.d.ts +10 -2
- package/dist/boundaries.d.ts.map +1 -1
- package/dist/compress.d.ts.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -64
- package/dist/index.js.map +1 -1
- package/dist/prune.d.ts +15 -0
- package/dist/prune.d.ts.map +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/wire/index.js +6 -1
- package/dist/wire/index.js.map +1 -1
- package/dist/wire/openai.d.ts +10 -0
- package/dist/wire/openai.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/boundaries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompressionState, CoreMessage, ResolvedBoundary } from "./types.js";
|
|
1
|
+
import type { CompressionBlock, CompressionState, CoreMessage, ResolvedBoundary } from "./types.js";
|
|
2
2
|
export type BoundaryKind = "message" | "block";
|
|
3
3
|
export interface ParsedBoundary {
|
|
4
4
|
kind: BoundaryKind;
|
|
@@ -35,6 +35,14 @@ export interface ResolvedRange {
|
|
|
35
35
|
snappedBoundaries: string[];
|
|
36
36
|
}
|
|
37
37
|
export declare function resolveBoundaries(input: ResolveBoundariesInput): ResolvedRange;
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Visible anchor index for a block: its rendered summary message if present
|
|
40
|
+
* (post-prune views replace raw messages with `acp_summary_bN`), else the
|
|
41
|
+
* earliest visible raw message it covers. Without the summary fallback an
|
|
42
|
+
* active block whose raws were pruned becomes unresolvable and cannot be
|
|
43
|
+
* promoted (dog/billion-context-pi#195).
|
|
44
|
+
*/
|
|
45
|
+
export declare function visibleBlockAnchor(block: CompressionBlock, indexByMessageId: Map<string, number>): number | null;
|
|
46
|
+
export declare function earliestIndexOfIds(ids: string[], indexByMessageId: Map<string, number>): number | null;
|
|
39
47
|
export declare function toResolvedBoundary(range: ResolvedRange): ResolvedBoundary;
|
|
40
48
|
//# sourceMappingURL=boundaries.d.ts.map
|
package/dist/boundaries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../src/boundaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAKD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAehE;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,KAAK,CAAC;gBAGjC,IAAI,EAAE,SAAS,GAAG,UAAU,EAC5B,QAAQ,EAAE,OAAO,GAAG,KAAK,EACzB,OAAO,EAAE,MAAM;CAQlB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,GAC5B,aAAa,CAwEf;AAgJD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,gBAAgB,EACvB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,GAAG,IAAI,CAIf;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EAAE,EACb,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAMzE"}
|
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,
|
|
1
|
+
{"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../src/compress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAkC,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAahF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASvD,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,E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ionCore, ProcessTurnInput, ApplyCompressionInput, }
|
|
|
4
4
|
export { createInitialState, allocateBlockId, allocateRunId, blockById, activeBlocks, coveredMessageIds, highestActiveTier, advanceSurvival, } from "./state.js";
|
|
5
5
|
export { defaultConfig, validateConfig } from "./config.js";
|
|
6
6
|
export { assignRefs, highestUsedIndex, emptyRefMap, indexToRef, refToIndex, refForRaw, rawForRef, BLOCKED_REF, } from "./refs.js";
|
|
7
|
-
export { prune, SUMMARY_HEADER } from "./prune.js";
|
|
7
|
+
export { prune, SUMMARY_HEADER, summaryMessageId, isSummaryMessageId, isRenderedSummaryMessage, } from "./prune.js";
|
|
8
8
|
export { syncBlocks } from "./sync.js";
|
|
9
|
-
export { resolveBoundaries, parseBoundary, BoundaryNotFoundError } from "./boundaries.js";
|
|
10
|
-
export { defaultCountTokens, estimateTokensFast, createBpeTokenizer } from "./tokenize.js";
|
|
9
|
+
export { resolveBoundaries, parseBoundary, BoundaryNotFoundError, visibleBlockAnchor, } from "./boundaries.js";
|
|
10
|
+
export { defaultCountTokens, estimateTokensFast, createBpeTokenizer, } from "./tokenize.js";
|
|
11
11
|
export type { TokenCountFn } from "./tokenize.js";
|
|
12
12
|
export { renderNudgeText, formatRanges } from "./nudge-text.js";
|
|
13
13
|
export type { NudgeVoice, RenderedNudge } from "./nudge-text.js";
|
|
14
|
-
export { COMPRESS_PHILOSOPHY, HOW_TO_COMPRESS_RULES, TIER2_DISTILL_RULES, TIER3_CONDENSE_RULES } from "./compression-rules.js";
|
|
14
|
+
export { COMPRESS_PHILOSOPHY, HOW_TO_COMPRESS_RULES, TIER2_DISTILL_RULES, TIER3_CONDENSE_RULES, } from "./compression-rules.js";
|
|
15
15
|
export { defaultPrompts, resolvePrompts } from "./prompts.js";
|
|
16
16
|
export type { Prompts, ResolvePromptsOptions } from "./prompts.js";
|
|
17
17
|
export { truncateLargeToolOutputs } from "./truncate-tools.js";
|
|
18
18
|
export type { TruncateOptions, TruncateResult } from "./truncate-tools.js";
|
|
19
19
|
export { parseBlockIdArg, findBlocksOverlappingMessages, findActiveAncestor, deactivateBlock, buildRestoredContentPreview, collectBlockContent, } from "./decompress.js";
|
|
20
|
-
export type { DeactivateOptions, CollectedContentResult, CollectContentOptions } from "./decompress.js";
|
|
20
|
+
export type { DeactivateOptions, CollectedContentResult, CollectContentOptions, } from "./decompress.js";
|
|
21
21
|
export { buildStatusReport, buildRecap } from "./report.js";
|
|
22
22
|
export type { StatusReportOptions } from "./report.js";
|
|
23
23
|
export { hideConsumedCompressCalls } from "./hide-consumed.js";
|
|
24
24
|
export type { HideConsumedResult } from "./hide-consumed.js";
|
|
25
25
|
export { rebuildCompressionState } from "./rebuild.js";
|
|
26
26
|
export type { RebuildResult, RebuildPorts } from "./rebuild.js";
|
|
27
|
-
export { renderVisibleRefs, renderRefsNode, createRenderRefsNode } from "./render-refs.js";
|
|
27
|
+
export { renderVisibleRefs, renderRefsNode, createRenderRefsNode, } from "./render-refs.js";
|
|
28
28
|
export type { RenderStrategy } from "./render-refs.js";
|
|
29
29
|
export { resolveTransformChannel } from "./transform-channel.js";
|
|
30
30
|
export type { TransformChannel } from "./transform-channel.js";
|
|
31
|
-
export { searchBlocks, searchBlocksAsync, blockDocs, messageDocs } from "./search.js";
|
|
32
|
-
export { clearDocFeatures, docCacheInfo, docFeatures, setDocCacheCap } from "./search.js";
|
|
33
|
-
export type { SearchResult, SearchOptions, SearchAlgorithm, AsyncSearchAlgorithm, AnySearchAlgorithm, SearchDoc, SearchDocKind, ScoredBlock, MessageRole, RoleWeights, MessageInput } from "./search.js";
|
|
34
|
-
export { DEFAULT_ALGORITHM, DEFAULT_ROLE_WEIGHTS, registerSearchAlgorithm, getSearchAlgorithm, listSearchAlgorithms } from "./search.js";
|
|
31
|
+
export { searchBlocks, searchBlocksAsync, blockDocs, messageDocs, } from "./search.js";
|
|
32
|
+
export { clearDocFeatures, docCacheInfo, docFeatures, setDocCacheCap, } from "./search.js";
|
|
33
|
+
export type { SearchResult, SearchOptions, SearchAlgorithm, AsyncSearchAlgorithm, AnySearchAlgorithm, SearchDoc, SearchDocKind, ScoredBlock, MessageRole, RoleWeights, MessageInput, } from "./search.js";
|
|
34
|
+
export { DEFAULT_ALGORITHM, DEFAULT_ROLE_WEIGHTS, registerSearchAlgorithm, getSearchAlgorithm, listSearchAlgorithms, } from "./search.js";
|
|
35
35
|
export { isMessageProtected, matchToolPattern } from "./protected.js";
|
|
36
36
|
export { runPipeline, makeIO, type PipelineNode, type PipelineContext, type NodeIO, type NodeEffects, } from "./pipeline.js";
|
|
37
37
|
export * from "./filter/index.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,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,
|
|
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,EA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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
|
@@ -149,6 +149,16 @@ function advanceSurvival(state, promotionThreshold) {
|
|
|
149
149
|
|
|
150
150
|
// src/prune.ts
|
|
151
151
|
var SUMMARY_HEADER = "[Compressed conversation section]";
|
|
152
|
+
var SUMMARY_ID_PREFIX = "acp_summary_";
|
|
153
|
+
function summaryMessageId(blockId) {
|
|
154
|
+
return `${SUMMARY_ID_PREFIX}${blockId}`;
|
|
155
|
+
}
|
|
156
|
+
function isSummaryMessageId(id) {
|
|
157
|
+
return id.startsWith(SUMMARY_ID_PREFIX);
|
|
158
|
+
}
|
|
159
|
+
function isRenderedSummaryMessage(message) {
|
|
160
|
+
return isSummaryMessageId(message.id) && message.role === "system" && message.contentType === "text";
|
|
161
|
+
}
|
|
152
162
|
function prune(messages, state, options = {}) {
|
|
153
163
|
const covered = coveredMessageIds(state);
|
|
154
164
|
if (covered.size === 0) return [...messages];
|
|
@@ -157,8 +167,13 @@ function prune(messages, state, options = {}) {
|
|
|
157
167
|
(message) => message.role === "user"
|
|
158
168
|
);
|
|
159
169
|
const indexById = /* @__PURE__ */ new Map();
|
|
160
|
-
|
|
161
|
-
|
|
170
|
+
const summaryIndexById = /* @__PURE__ */ new Map();
|
|
171
|
+
messages.forEach((message, index) => {
|
|
172
|
+
indexById.set(message.id, index);
|
|
173
|
+
if (isRenderedSummaryMessage(message))
|
|
174
|
+
summaryIndexById.set(message.id, index);
|
|
175
|
+
});
|
|
176
|
+
const anchors = inject ? collectSummaryAnchors(state, indexById, summaryIndexById) : [];
|
|
162
177
|
return stripOrphanedReasoning(
|
|
163
178
|
stripOrphanedToolResults(
|
|
164
179
|
stripOrphanedToolCalls(
|
|
@@ -167,9 +182,19 @@ function prune(messages, state, options = {}) {
|
|
|
167
182
|
)
|
|
168
183
|
);
|
|
169
184
|
}
|
|
170
|
-
function collectSummaryAnchors(state, indexById) {
|
|
185
|
+
function collectSummaryAnchors(state, indexById, summaryIndexById) {
|
|
171
186
|
const anchors = [];
|
|
172
187
|
for (const block of activeBlocks(state)) {
|
|
188
|
+
const existingIndex = summaryIndexById.get(summaryMessageId(block.blockId));
|
|
189
|
+
if (existingIndex !== void 0) {
|
|
190
|
+
anchors.push({
|
|
191
|
+
blockId: block.blockId,
|
|
192
|
+
summary: block.summary,
|
|
193
|
+
topic: block.topic,
|
|
194
|
+
insertAt: existingIndex
|
|
195
|
+
});
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
173
198
|
let earliest = null;
|
|
174
199
|
for (const id of block.effectiveMessageIds) {
|
|
175
200
|
const index = indexById.get(id);
|
|
@@ -190,6 +215,9 @@ function collectSummaryAnchors(state, indexById) {
|
|
|
190
215
|
function rebuildMessages(messages, covered, firstUserIndex, anchors) {
|
|
191
216
|
const result = [];
|
|
192
217
|
const pending = [...anchors];
|
|
218
|
+
const anchoredSummaryIds = new Set(
|
|
219
|
+
anchors.map((anchor) => summaryMessageId(anchor.blockId))
|
|
220
|
+
);
|
|
193
221
|
for (let index = 0; index < messages.length; index++) {
|
|
194
222
|
while (pending.length > 0 && pending[0].insertAt === index) {
|
|
195
223
|
result.push(renderSummary(pending.shift()));
|
|
@@ -199,6 +227,8 @@ function rebuildMessages(messages, covered, firstUserIndex, anchors) {
|
|
|
199
227
|
continue;
|
|
200
228
|
}
|
|
201
229
|
if (covered.has(messages[index].id)) continue;
|
|
230
|
+
if (isRenderedSummaryMessage(messages[index]) && anchoredSummaryIds.has(messages[index].id))
|
|
231
|
+
continue;
|
|
202
232
|
result.push(messages[index]);
|
|
203
233
|
}
|
|
204
234
|
while (pending.length > 0) {
|
|
@@ -212,7 +242,7 @@ function renderSummary(anchor) {
|
|
|
212
242
|
const text = body.length === 0 ? topicLine : `${topicLine}
|
|
213
243
|
${body}`;
|
|
214
244
|
return {
|
|
215
|
-
id:
|
|
245
|
+
id: summaryMessageId(anchor.blockId),
|
|
216
246
|
role: "system",
|
|
217
247
|
contentType: "text",
|
|
218
248
|
text
|
|
@@ -303,9 +333,7 @@ function syncBlocks(messages, state) {
|
|
|
303
333
|
continue;
|
|
304
334
|
}
|
|
305
335
|
block.active = true;
|
|
306
|
-
const stillPresent = block.effectiveMessageIds.some(
|
|
307
|
-
(id) => presentIds.has(id)
|
|
308
|
-
);
|
|
336
|
+
const stillPresent = block.effectiveMessageIds.some((id) => presentIds.has(id)) || presentIds.has(summaryMessageId(block.blockId));
|
|
309
337
|
if (!stillPresent) {
|
|
310
338
|
block.active = false;
|
|
311
339
|
deactivated.push(block.blockId);
|
|
@@ -422,14 +450,24 @@ function resolveBoundaries(input) {
|
|
|
422
450
|
`Invalid boundary ref(s): startId="${input.startRef}", endId="${input.endRef}". Use mNNNNN or bN.`
|
|
423
451
|
);
|
|
424
452
|
}
|
|
425
|
-
const
|
|
453
|
+
const indexByMessageId = /* @__PURE__ */ new Map();
|
|
426
454
|
input.messages.forEach(
|
|
427
|
-
(message, index) =>
|
|
455
|
+
(message, index) => indexByMessageId.set(message.id, index)
|
|
428
456
|
);
|
|
429
457
|
let snappedBoundaries = [];
|
|
430
|
-
const startAnchor = resolveAnchorIndex(
|
|
458
|
+
const startAnchor = resolveAnchorIndex(
|
|
459
|
+
start,
|
|
460
|
+
input.state,
|
|
461
|
+
indexByMessageId,
|
|
462
|
+
"start"
|
|
463
|
+
);
|
|
431
464
|
if (startAnchor.snapped) snappedBoundaries.push(startAnchor.snapped);
|
|
432
|
-
const endAnchor = resolveAnchorIndex(
|
|
465
|
+
const endAnchor = resolveAnchorIndex(
|
|
466
|
+
end,
|
|
467
|
+
input.state,
|
|
468
|
+
indexByMessageId,
|
|
469
|
+
"end"
|
|
470
|
+
);
|
|
433
471
|
if (endAnchor.snapped) snappedBoundaries.push(endAnchor.snapped);
|
|
434
472
|
let startIndex = startAnchor.index;
|
|
435
473
|
let endIndex = endAnchor.index;
|
|
@@ -439,13 +477,14 @@ function resolveBoundaries(input) {
|
|
|
439
477
|
const messageIds = [];
|
|
440
478
|
for (let index = startIndex; index <= endIndex; index++) {
|
|
441
479
|
const message = input.messages[index];
|
|
442
|
-
if (message
|
|
480
|
+
if (message && !isRenderedSummaryMessage(message))
|
|
481
|
+
messageIds.push(message.id);
|
|
443
482
|
}
|
|
444
483
|
const boundaryKind = start.kind === "block" || end.kind === "block" ? "block" : "message";
|
|
445
484
|
const nestedBlockIds = [];
|
|
446
485
|
const nestedSeen = /* @__PURE__ */ new Set();
|
|
447
486
|
for (const block of activeBlocks(input.state)) {
|
|
448
|
-
const anchor =
|
|
487
|
+
const anchor = visibleBlockAnchor(block, indexByMessageId);
|
|
449
488
|
if (anchor !== null && anchor >= startIndex && anchor <= endIndex) {
|
|
450
489
|
if (!nestedSeen.has(block.blockId)) {
|
|
451
490
|
nestedSeen.add(block.blockId);
|
|
@@ -464,7 +503,7 @@ function resolveBoundaries(input) {
|
|
|
464
503
|
snappedBoundaries
|
|
465
504
|
};
|
|
466
505
|
}
|
|
467
|
-
function resolveAnchorIndex(boundary, state,
|
|
506
|
+
function resolveAnchorIndex(boundary, state, indexByMessageId, endpoint) {
|
|
468
507
|
const label = endpoint === "start" ? "startId" : "endId";
|
|
469
508
|
if (boundary.kind === "message") {
|
|
470
509
|
const rawId = state.messageRefs.byRef[boundary.raw] ?? state.messageRefs.byRef[formatPaddedRef(boundary.numericId)];
|
|
@@ -475,15 +514,15 @@ function resolveAnchorIndex(boundary, state, indexByRawId, endpoint) {
|
|
|
475
514
|
`${label}="${boundary.raw}" does not exist in this session (typo or wrong session) \u2014 run acp_status for current refs.`
|
|
476
515
|
);
|
|
477
516
|
}
|
|
478
|
-
const index =
|
|
517
|
+
const index = indexByMessageId.get(rawId);
|
|
479
518
|
if (index !== void 0) {
|
|
480
519
|
return { index, snapped: null };
|
|
481
520
|
}
|
|
482
|
-
const owner2 = activeOwnerAnchor(state, [rawId],
|
|
521
|
+
const owner2 = activeOwnerAnchor(state, [rawId], indexByMessageId);
|
|
483
522
|
if (owner2 !== null) {
|
|
484
523
|
return {
|
|
485
524
|
index: owner2,
|
|
486
|
-
snapped: `${label}="${boundary.raw}" refers to a message already compressed into an active block \u2014 anchored to
|
|
525
|
+
snapped: `${label}="${boundary.raw}" refers to a message already compressed into an active block \u2014 anchored to the active block covering it instead.`
|
|
487
526
|
};
|
|
488
527
|
}
|
|
489
528
|
throw new BoundaryNotFoundError(
|
|
@@ -501,12 +540,16 @@ function resolveAnchorIndex(boundary, state, indexByRawId, endpoint) {
|
|
|
501
540
|
);
|
|
502
541
|
}
|
|
503
542
|
if (block.active) {
|
|
504
|
-
const anchor =
|
|
543
|
+
const anchor = visibleBlockAnchor(block, indexByMessageId);
|
|
505
544
|
if (anchor !== null) {
|
|
506
545
|
return { index: anchor, snapped: null };
|
|
507
546
|
}
|
|
508
547
|
}
|
|
509
|
-
const owner = activeOwnerAnchor(
|
|
548
|
+
const owner = activeOwnerAnchor(
|
|
549
|
+
state,
|
|
550
|
+
block.effectiveMessageIds,
|
|
551
|
+
indexByMessageId
|
|
552
|
+
);
|
|
510
553
|
if (owner !== null) {
|
|
511
554
|
return {
|
|
512
555
|
index: owner,
|
|
@@ -523,31 +566,53 @@ function resolveAnchorIndex(boundary, state, indexByRawId, endpoint) {
|
|
|
523
566
|
throw new BoundaryNotFoundError(
|
|
524
567
|
"consumed",
|
|
525
568
|
endpoint,
|
|
526
|
-
`${label}="b${boundary.numericId}"
|
|
569
|
+
`${label}="b${boundary.numericId}" is an active block but none of its content (raw messages or rendered summary) is visible in the current context \u2014 run acp_status to verify.`
|
|
527
570
|
);
|
|
528
571
|
}
|
|
529
|
-
function activeOwnerAnchor(state, ownedIds,
|
|
572
|
+
function activeOwnerAnchor(state, ownedIds, indexByMessageId) {
|
|
530
573
|
if (ownedIds.length === 0) return null;
|
|
531
574
|
const owned = new Set(ownedIds);
|
|
532
575
|
let best = null;
|
|
533
576
|
for (const block of state.blocks) {
|
|
534
577
|
if (!block.active) continue;
|
|
535
|
-
const
|
|
578
|
+
const inherited = inheritedContentIds(state, block);
|
|
579
|
+
let ownsInherited = false;
|
|
580
|
+
for (const id of owned) {
|
|
581
|
+
if (inherited.has(id)) {
|
|
582
|
+
ownsInherited = true;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (!ownsInherited) continue;
|
|
587
|
+
const anchor = visibleBlockAnchor(block, indexByMessageId);
|
|
536
588
|
if (anchor === null) continue;
|
|
537
|
-
|
|
538
|
-
if (ownsContent && (best === null || anchor < best)) {
|
|
589
|
+
if (best === null || anchor < best) {
|
|
539
590
|
best = anchor;
|
|
540
591
|
}
|
|
541
592
|
}
|
|
542
593
|
return best;
|
|
543
594
|
}
|
|
595
|
+
function inheritedContentIds(state, block) {
|
|
596
|
+
const ids = /* @__PURE__ */ new Set();
|
|
597
|
+
for (const childId of block.directBlockIds) {
|
|
598
|
+
const child = blockById(state, childId);
|
|
599
|
+
if (!child) continue;
|
|
600
|
+
for (const id of child.effectiveMessageIds) ids.add(id);
|
|
601
|
+
}
|
|
602
|
+
return ids;
|
|
603
|
+
}
|
|
544
604
|
function formatPaddedRef(index) {
|
|
545
605
|
return `m${String(index).padStart(5, "0")}`;
|
|
546
606
|
}
|
|
547
|
-
function
|
|
607
|
+
function visibleBlockAnchor(block, indexByMessageId) {
|
|
608
|
+
const summaryIndex = indexByMessageId.get(summaryMessageId(block.blockId));
|
|
609
|
+
if (summaryIndex !== void 0) return summaryIndex;
|
|
610
|
+
return earliestIndexOfIds(block.effectiveMessageIds, indexByMessageId);
|
|
611
|
+
}
|
|
612
|
+
function earliestIndexOfIds(ids, indexByMessageId) {
|
|
548
613
|
let earliest = null;
|
|
549
614
|
for (const id of ids) {
|
|
550
|
-
const index =
|
|
615
|
+
const index = indexByMessageId.get(id);
|
|
551
616
|
if (index !== void 0 && (earliest === null || index < earliest)) {
|
|
552
617
|
earliest = index;
|
|
553
618
|
}
|
|
@@ -1219,7 +1284,12 @@ function createCore(ports = {}) {
|
|
|
1219
1284
|
let tokensCompressed = 0;
|
|
1220
1285
|
const errors = [];
|
|
1221
1286
|
const warnings = [];
|
|
1222
|
-
const protectedMessageIds = input.protectedMessageIds ?? computeProtectedRefs(
|
|
1287
|
+
const protectedMessageIds = input.protectedMessageIds ?? computeProtectedRefs(
|
|
1288
|
+
input.messages,
|
|
1289
|
+
input.state,
|
|
1290
|
+
input.config,
|
|
1291
|
+
countTokens
|
|
1292
|
+
);
|
|
1223
1293
|
const preExistingCoverage = collectCoverage(state);
|
|
1224
1294
|
const classifications = /* @__PURE__ */ new Map();
|
|
1225
1295
|
const classificationErrors = [];
|
|
@@ -1250,7 +1320,10 @@ function createCore(ports = {}) {
|
|
|
1250
1320
|
error: error instanceof Error ? error : new Error(String(error))
|
|
1251
1321
|
});
|
|
1252
1322
|
classificationErrors.push(
|
|
1253
|
-
rangeError(
|
|
1323
|
+
rangeError(
|
|
1324
|
+
spec,
|
|
1325
|
+
error instanceof Error ? error.message : String(error)
|
|
1326
|
+
)
|
|
1254
1327
|
);
|
|
1255
1328
|
}
|
|
1256
1329
|
}
|
|
@@ -1261,32 +1334,27 @@ function createCore(ports = {}) {
|
|
|
1261
1334
|
if (resolution.status === "ok") resolvableCount++;
|
|
1262
1335
|
else if (resolution.status === "unknown") unknownCount++;
|
|
1263
1336
|
}
|
|
1264
|
-
const
|
|
1337
|
+
const rangeSpans = [];
|
|
1265
1338
|
for (const [spec, resolution] of classifications) {
|
|
1266
1339
|
if (resolution.status !== "ok") continue;
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
const bMin = b.indices.length > 0 ? Math.min(...b.indices) : Infinity;
|
|
1275
|
-
return aMin - bMin;
|
|
1276
|
-
});
|
|
1340
|
+
rangeSpans.push({
|
|
1341
|
+
spec,
|
|
1342
|
+
start: resolution.resolved.startIndex,
|
|
1343
|
+
end: resolution.resolved.endIndex
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
const sortedRanges = [...rangeSpans].sort((a, b) => a.start - b.start);
|
|
1277
1347
|
const skipSpecs = /* @__PURE__ */ new Set();
|
|
1278
1348
|
let acceptedMaxIndex = -1;
|
|
1279
1349
|
for (const entry of sortedRanges) {
|
|
1280
|
-
|
|
1281
|
-
const entryMin = entry.indices.length > 0 ? Math.min(...entry.indices) : -1;
|
|
1282
|
-
if (entryMin >= 0 && entryMin <= acceptedMaxIndex) {
|
|
1350
|
+
if (entry.start <= acceptedMaxIndex) {
|
|
1283
1351
|
skipSpecs.add(entry.spec);
|
|
1284
1352
|
warnings.push(
|
|
1285
1353
|
`Skipped range (${entry.spec.startRef}..${entry.spec.endRef}) \u2014 overlaps an earlier range in the batch; the earlier range takes precedence. Keep ranges disjoint.`
|
|
1286
1354
|
);
|
|
1287
1355
|
continue;
|
|
1288
1356
|
}
|
|
1289
|
-
if (
|
|
1357
|
+
if (entry.end > acceptedMaxIndex) acceptedMaxIndex = entry.end;
|
|
1290
1358
|
}
|
|
1291
1359
|
if (input.config.compress.minCompressRange > 0 && input.ranges.length > 0) {
|
|
1292
1360
|
let totalRangeChars = 0;
|
|
@@ -1349,7 +1417,12 @@ function createCore(ports = {}) {
|
|
|
1349
1417
|
tokensCompressed += outcome.tokens;
|
|
1350
1418
|
warnings.push(...outcome.warnings);
|
|
1351
1419
|
} catch (error) {
|
|
1352
|
-
errors.push(
|
|
1420
|
+
errors.push(
|
|
1421
|
+
rangeError(
|
|
1422
|
+
spec,
|
|
1423
|
+
error instanceof Error ? error.message : String(error)
|
|
1424
|
+
)
|
|
1425
|
+
);
|
|
1353
1426
|
}
|
|
1354
1427
|
}
|
|
1355
1428
|
state.stats.compressionCount += blocksCreated;
|
|
@@ -1359,12 +1432,17 @@ function createCore(ports = {}) {
|
|
|
1359
1432
|
state.nudge.lastNudgeShownTokens = 0;
|
|
1360
1433
|
state.nudge.lastShownByTier = {};
|
|
1361
1434
|
}
|
|
1362
|
-
return {
|
|
1435
|
+
return {
|
|
1436
|
+
state,
|
|
1437
|
+
result: { blocksCreated, tokensCompressed, errors, warnings }
|
|
1438
|
+
};
|
|
1363
1439
|
}
|
|
1364
1440
|
function processTurn(input) {
|
|
1365
1441
|
const configErrors = validateConfig(input.config);
|
|
1366
1442
|
if (configErrors.length > 0) {
|
|
1367
|
-
console.warn(
|
|
1443
|
+
console.warn(
|
|
1444
|
+
`[acp-kernel] Config validation warnings: ${configErrors.join("; ")}. Thresholds may not fire correctly.`
|
|
1445
|
+
);
|
|
1368
1446
|
}
|
|
1369
1447
|
const ctx = {
|
|
1370
1448
|
config: input.config,
|
|
@@ -1424,7 +1502,14 @@ function createCore(ports = {}) {
|
|
|
1424
1502
|
if (strategy === "none") return base;
|
|
1425
1503
|
return [...base, createRenderRefsNode(strategy)];
|
|
1426
1504
|
}
|
|
1427
|
-
return {
|
|
1505
|
+
return {
|
|
1506
|
+
processTurn,
|
|
1507
|
+
applyCompression,
|
|
1508
|
+
defaultNodes,
|
|
1509
|
+
decompress,
|
|
1510
|
+
search,
|
|
1511
|
+
status
|
|
1512
|
+
};
|
|
1428
1513
|
}
|
|
1429
1514
|
var assignRefsNode = {
|
|
1430
1515
|
name: "assign-refs",
|
|
@@ -1524,7 +1609,10 @@ var nudgeNode = {
|
|
|
1524
1609
|
if (nudge.shouldInject) {
|
|
1525
1610
|
stamped.lastNudgeShownTokens = ctx.tokenCount;
|
|
1526
1611
|
if (nudge.tier !== null) {
|
|
1527
|
-
stamped.lastShownByTier = {
|
|
1612
|
+
stamped.lastShownByTier = {
|
|
1613
|
+
...stamped.lastShownByTier,
|
|
1614
|
+
[nudge.tier]: ctx.tokenCount
|
|
1615
|
+
};
|
|
1528
1616
|
}
|
|
1529
1617
|
}
|
|
1530
1618
|
return {
|
|
@@ -1564,16 +1652,16 @@ function applySingleRange(input) {
|
|
|
1564
1652
|
const rangeMessageIds = applyPairBoundaryAdjustments(
|
|
1565
1653
|
resolved,
|
|
1566
1654
|
input.messages
|
|
1567
|
-
);
|
|
1655
|
+
).filter((id) => !isSummaryMessageId(id));
|
|
1568
1656
|
if (rangeMessageIds.length > resolved.messageIds.length) {
|
|
1569
|
-
const
|
|
1570
|
-
input.messages.forEach((m, i) =>
|
|
1571
|
-
const adjustedStart =
|
|
1572
|
-
const adjustedEnd =
|
|
1657
|
+
const indexByMessageId = /* @__PURE__ */ new Map();
|
|
1658
|
+
input.messages.forEach((m, i) => indexByMessageId.set(m.id, i));
|
|
1659
|
+
const adjustedStart = rangeMessageIds.length > 0 ? indexByMessageId.get(rangeMessageIds[0]) ?? resolved.startIndex : resolved.startIndex;
|
|
1660
|
+
const adjustedEnd = rangeMessageIds.length > 0 ? indexByMessageId.get(rangeMessageIds[rangeMessageIds.length - 1]) ?? resolved.endIndex : resolved.endIndex;
|
|
1573
1661
|
const nestedSeen = new Set(resolved.nestedBlockIds);
|
|
1574
1662
|
for (const block2 of activeBlocks(input.state)) {
|
|
1575
1663
|
if (nestedSeen.has(block2.blockId)) continue;
|
|
1576
|
-
const anchor =
|
|
1664
|
+
const anchor = visibleBlockAnchor(block2, indexByMessageId);
|
|
1577
1665
|
if (anchor !== null && anchor >= adjustedStart && anchor <= adjustedEnd) {
|
|
1578
1666
|
nestedSeen.add(block2.blockId);
|
|
1579
1667
|
resolved.nestedBlockIds.push(block2.blockId);
|
|
@@ -1789,12 +1877,21 @@ function pendingByTier(state, recommendation, countTokens, minCompressRange) {
|
|
|
1789
1877
|
const out = {};
|
|
1790
1878
|
const merged = recommendation?.recommendedRanges ?? [];
|
|
1791
1879
|
const effective = minCompressRange > 0 ? merged.filter((r) => (r.chars ?? r.tokens * 4) >= minCompressRange) : merged;
|
|
1792
|
-
out[1] = {
|
|
1880
|
+
out[1] = {
|
|
1881
|
+
pending: effective.reduce((s, r) => s + r.tokens, 0),
|
|
1882
|
+
targetBlocks: []
|
|
1883
|
+
};
|
|
1793
1884
|
const active = activeBlocks(state);
|
|
1794
1885
|
const t1 = active.filter((b) => b.tier === 1);
|
|
1795
1886
|
const t2 = active.filter((b) => b.tier === 2);
|
|
1796
|
-
out[2] = {
|
|
1797
|
-
|
|
1887
|
+
out[2] = {
|
|
1888
|
+
pending: t1.reduce((s, b) => s + countTokens(b.summary), 0),
|
|
1889
|
+
targetBlocks: t1
|
|
1890
|
+
};
|
|
1891
|
+
out[3] = {
|
|
1892
|
+
pending: t2.reduce((s, b) => s + countTokens(b.summary), 0),
|
|
1893
|
+
targetBlocks: t2
|
|
1894
|
+
};
|
|
1798
1895
|
return out;
|
|
1799
1896
|
}
|
|
1800
1897
|
function decideNudge(input) {
|
|
@@ -1882,18 +1979,35 @@ function decideNudge(input) {
|
|
|
1882
1979
|
const eligible = tiersList.filter((t) => config.tiers.enabled || t === 1);
|
|
1883
1980
|
const ready = eligible.filter((t) => (tiers[t]?.pending ?? 0) >= nudgeGrowthTokens).map((t) => `T${t} ${tiers[t].pending}`);
|
|
1884
1981
|
const readyHint = ready.length > 0 ? `, ready: ${ready.join(", ")}` : "";
|
|
1885
|
-
const blocked = eligible.filter(
|
|
1982
|
+
const blocked = eligible.filter(
|
|
1983
|
+
(t) => (tiers[t]?.pending ?? 0) >= nudgeGrowthTokens && (state.nudge.lastShownByTier[t] ?? 0) > 0 && tokenCount - (state.nudge.lastShownByTier[t] ?? 0) < growthFloor
|
|
1984
|
+
).map((t) => `T${t} (cadence)`);
|
|
1886
1985
|
const blockedHint = blocked.length > 0 ? `, blocked: ${blocked.join(", ")}` : "";
|
|
1887
|
-
const maxPending = Math.max(
|
|
1986
|
+
const maxPending = Math.max(
|
|
1987
|
+
0,
|
|
1988
|
+
...Object.values(tiers).map((t) => t.pending)
|
|
1989
|
+
);
|
|
1888
1990
|
const pendingShort = maxPending < nudgeGrowthTokens;
|
|
1889
1991
|
const growthShort = growthSinceReference < growthFloor;
|
|
1890
1992
|
const parts = [];
|
|
1891
|
-
if (pendingShort)
|
|
1892
|
-
|
|
1893
|
-
|
|
1993
|
+
if (pendingShort)
|
|
1994
|
+
parts.push(
|
|
1995
|
+
`max compressible ${maxPending} < threshold ${nudgeGrowthTokens}`
|
|
1996
|
+
);
|
|
1997
|
+
if (growthShort)
|
|
1998
|
+
parts.push(`growth ${growthSinceReference} < floor ${growthFloor}`);
|
|
1999
|
+
if (parts.length === 0)
|
|
2000
|
+
parts.push(
|
|
2001
|
+
`max compressible ${maxPending}, growth ${growthSinceReference}`
|
|
2002
|
+
);
|
|
1894
2003
|
reason = `${parts.join("; ")}${readyHint}${blockedHint}`;
|
|
1895
2004
|
}
|
|
1896
|
-
const ctxBreakdown = computeContextBreakdown(
|
|
2005
|
+
const ctxBreakdown = computeContextBreakdown(
|
|
2006
|
+
input.messages,
|
|
2007
|
+
tokenCount,
|
|
2008
|
+
growthSinceReference,
|
|
2009
|
+
countTokens
|
|
2010
|
+
);
|
|
1897
2011
|
return {
|
|
1898
2012
|
shouldInject,
|
|
1899
2013
|
reason,
|
|
@@ -2811,6 +2925,8 @@ export {
|
|
|
2811
2925
|
highestUsedIndex,
|
|
2812
2926
|
indexToRef,
|
|
2813
2927
|
isMessageProtected,
|
|
2928
|
+
isRenderedSummaryMessage,
|
|
2929
|
+
isSummaryMessageId,
|
|
2814
2930
|
listMessageFilters,
|
|
2815
2931
|
listSearchAlgorithms,
|
|
2816
2932
|
makeIO,
|
|
@@ -2835,9 +2951,11 @@ export {
|
|
|
2835
2951
|
searchBlocks,
|
|
2836
2952
|
searchBlocksAsync,
|
|
2837
2953
|
setDocCacheCap,
|
|
2954
|
+
summaryMessageId,
|
|
2838
2955
|
syncBlocks,
|
|
2839
2956
|
truncateLargeToolOutputs,
|
|
2840
2957
|
validateConfig,
|
|
2841
|
-
viableRanges
|
|
2958
|
+
viableRanges,
|
|
2959
|
+
visibleBlockAnchor
|
|
2842
2960
|
};
|
|
2843
2961
|
//# sourceMappingURL=index.js.map
|