acp-kernel 0.0.83 → 0.0.84

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.
Files changed (39) hide show
  1. package/DESIGN.md +16 -3
  2. package/README.md +104 -3
  3. package/dist/absorb.d.ts.map +1 -1
  4. package/dist/boundaries.d.ts.map +1 -1
  5. package/dist/ccr.d.ts +116 -0
  6. package/dist/ccr.d.ts.map +1 -0
  7. package/dist/{chunk-VPRKYTHW.js → chunk-6RNVHY67.js} +3 -3
  8. package/dist/{chunk-5TQA7ZQM.js → chunk-MXL3G3BN.js} +13 -2
  9. package/dist/chunk-MXL3G3BN.js.map +1 -0
  10. package/dist/compress-tools.d.ts +104 -2
  11. package/dist/compress-tools.d.ts.map +1 -1
  12. package/dist/compress.d.ts +8 -0
  13. package/dist/compress.d.ts.map +1 -1
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/content-store.d.ts +86 -0
  16. package/dist/content-store.d.ts.map +1 -0
  17. package/dist/crush.d.ts +142 -0
  18. package/dist/crush.d.ts.map +1 -0
  19. package/dist/image-compress.d.ts +156 -0
  20. package/dist/image-compress.d.ts.map +1 -0
  21. package/dist/index.d.ts +12 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2909 -636
  24. package/dist/index.js.map +1 -1
  25. package/dist/output-steering.d.ts +176 -0
  26. package/dist/output-steering.d.ts.map +1 -0
  27. package/dist/panel/index.js +1 -1
  28. package/dist/persist/index.js +4 -2
  29. package/dist/persist/index.js.map +1 -1
  30. package/dist/persist/state-merge.d.ts.map +1 -1
  31. package/dist/pipeline.d.ts +3 -0
  32. package/dist/pipeline.d.ts.map +1 -1
  33. package/dist/rebuild.d.ts.map +1 -1
  34. package/dist/state.d.ts.map +1 -1
  35. package/dist/types.d.ts +82 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-5TQA7ZQM.js.map +0 -1
  39. /package/dist/{chunk-VPRKYTHW.js.map → chunk-6RNVHY67.js.map} +0 -0
package/DESIGN.md CHANGED
@@ -113,20 +113,31 @@ type Config = {
113
113
  interface CompressionCore {
114
114
  // Per-turn node pipeline (replaces the message-transform hook's algorithm part).
115
115
  // Runs every turn (canonical order): assign-refs → sync-blocks → merge-blocks →
116
- // prune → filter → hide-compress-calls → nudge-inject → emergency-truncate →
117
- // render-refs. Survives/promotes blocks via advanceSurvival (no age-based
118
- // deactivation). Returns transformed messages + updated state + nudge decision.
116
+ // prune → ccr-store → filter → hide-compress-calls → nudge-inject →
117
+ // emergency-truncate → render-refs. Survives/promotes blocks via advanceSurvival
118
+ // (no age-based deactivation). Returns transformed messages + updated state +
119
+ // nudge decision + the (possibly grown) content store.
119
120
  processTurn(input: {
120
121
  messages: CoreMessage[];
121
122
  state: CompressionState;
122
123
  config: Config;
123
124
  tokenCount: number;
125
+ /** Per-session CCR content store from the previous turn (optional; an
126
+ * empty store is created when omitted). */
127
+ contentStore?: MessageContentStore;
124
128
  }): {
125
129
  messages: CoreMessage[];
126
130
  state: CompressionState;
127
131
  nudge?: NudgeDecision;
132
+ /** Always present; pass back as input.contentStore next turn. */
133
+ contentStore: MessageContentStore;
128
134
  };
129
135
 
136
+ // When the model calls acp_retrieve. Pure lookup over the host-provided store
137
+ // plus an ephemeral injection message (id prefix acp_retrieved_*) that consumes
138
+ // no ref and never enters fold space. Hallucinated refs → not-found ack.
139
+ retrieve(store: MessageContentStore, ref: string): ApplyRetrieveResult;
140
+
130
141
  // When the model calls compress. `ranges[].summary` is model-produced text.
131
142
  // Allocates block(s), deactivates consumed blocks, updates indices, resets the
132
143
  // nudge growth baseline on success (§5.7 feedback-loop fix).
@@ -211,6 +222,8 @@ A default `countTokens` ships with the core (word-level + unicode CJK tokenizer,
211
222
  | compress/decompress/search/status **tool registration** | **adapter** (calls core pure fns) |
212
223
  | `/acp` commands | **adapter** |
213
224
  | opencode hooks | **OpenCode adapter** |
225
+ | output-steering **decisions** (turn classification / verbosity level / effort clamp, #355) | **core** `decideOutputSteering` (pure; operates on a structural summary — role + block kinds, no content) |
226
+ | output-steering **landing** (wire field write-back, system-prompt carrier selection, numeric budget floors) | **adapter** |
214
227
  | config three-layer merge | **adapter** (core only consumes its own `Config`) |
215
228
  | logger / auth / persistence / update | **adapter** (core does zero I/O) |
216
229
 
package/README.md CHANGED
@@ -37,10 +37,12 @@ const state = createInitialState();
37
37
  const config = defaultConfig(200000); // modelContextLimit (positional); optional overrides as 2nd arg
38
38
 
39
39
  // processTurn runs the canonical node pipeline every turn:
40
- // assign-refs → sync-blocks → merge-blocks → prune → filter →
41
- // hide-compress-calls → nudge-inject → emergency-truncate → render-refs
42
- const { messages, state: nextState, nudge } = core.processTurn({
40
+ // assign-refs → sync-blocks → prune → ccr-store → absorb-hide → crush →
41
+ // absorb-prompt → filter → hide-compress-calls → recommend → nudge-inject
42
+ // → emergency-truncate → render-refs
43
+ const { messages, state: nextState, nudge, contentStore } = core.processTurn({
43
44
  messages, state, config, tokenCount,
45
+ contentStore, // previous turn's content store (optional; see CCR below)
44
46
  });
45
47
 
46
48
  // When the model emits a compress decision (summary written by the model):
@@ -85,6 +87,74 @@ processTurn({ messages, state, config, tokenCount, renderTags: "none" });
85
87
  `renderTags` is optional and defaults to `"all"`, so existing call sites keep
86
88
  working unchanged.
87
89
 
90
+ #### CCR — content-cached retrieval (lossless tool-result offload)
91
+
92
+ CCR is the lossless alternative to absorb's lossy distillation. When enabled,
93
+ a tool result at or above `ccr.minToolTokens` is stored **once, at arrival** in
94
+ the per-session content store, and its visible copy is replaced with a
95
+ deterministic placeholder carrying enough signal (kind, size, command/head
96
+ preview, ref) to judge relevance without retrieving. The model pulls the
97
+ original back via the `acp_retrieve` tool; the retrieved text rides back as an
98
+ ephemeral trailing message that never consumes a ref and never enters the fold
99
+ space. Disabled by default — no behavior change unless opted in.
100
+
101
+ ```ts
102
+ const config = defaultConfig(200000, { ccr: { enabled: true } }); // opt-in
103
+
104
+ // Turn N: pass the previous turn's store back in.
105
+ const { messages, state, contentStore } = core.processTurn({
106
+ messages, state, config, tokenCount,
107
+ contentStore, // persisted from turn N-1 (host owns persistence)
108
+ });
109
+
110
+ // When the model calls acp_retrieve({ ref }):
111
+ const hit = core.retrieve(contentStore, "m00042");
112
+ if (hit.ok) {
113
+ // hit.text — the original bytes
114
+ // hit.injection — trailing request-only message to append for this request
115
+ // hit.ackText — short tool-result ack string
116
+ } else {
117
+ // hit.ackText — not-found notice (hallucinated ref costs one tool call)
118
+ }
119
+ ```
120
+
121
+ Placeholder wire shape (deterministic — same inputs always produce identical
122
+ bytes, so the visible text is byte-stable after arrival and prefix-cache
123
+ friendly):
124
+
125
+ ```
126
+ 📦 [acp-stored #m00423 · shell output · 4,213 tok] `npm run build`
127
+ → acp_retrieve("m000423") returns the full text
128
+ ```
129
+
130
+ Contract guarantees:
131
+
132
+ - **Replace-once-at-arrival.** The visible bytes change exactly once
133
+ (original → placeholder); every later turn sees identical bytes.
134
+ - **Tool-pair integrity.** Only the tool-result's own content shrinks; the
135
+ paired assistant `tool_calls` survive untouched (OpenAI-family wire pairing).
136
+ - **id-never-reused safe.** The store is per-ref append-only, first-write-wins,
137
+ and never reissues or recycles refs. Refs stay retrievable even if a host
138
+ prunes its own `messageRefs` map after compaction (e.g. billion-context
139
+ archive), because lookup happens against the store, not the ref map.
140
+ - **Ephemeral retrieval.** `acp_retrieved_*` messages are skipped by assign-refs
141
+ and excluded from block coverage — they consume no ref and enter no fold
142
+ space. Hosts may strip them after the request (nudge channel); if they
143
+ round-trip anyway, the kernel handles them safely.
144
+ - **Coexists with absorb.** Placeholder-marked results are never absorb
145
+ candidates (ID-reference wins); absorb keeps handling semantic distillation
146
+ of everything else.
147
+
148
+ Persistence: the store is plain JSON (`{ version: 1, byHash, byRef }`) — hosts
149
+ persist it alongside `CompressionState` (same StateStore envelope path as
150
+ blockContents). Content-addressed dedup means identical bytes are written once.
151
+ `core.status(...)` reports `breakdown.storedMessages` and
152
+ `breakdown.retrievals` so a host can measure retrieve rate.
153
+
154
+ For folded-range retention (v2 groundwork), hosts can call
155
+ `storeCoveredOriginals(store, messages, compressedState, [blockId], countTokens)`
156
+ right after `applyCompression` so pruned originals stay retrievable by ref.
157
+
88
158
  **Token counts in rendered tags are snapshots.** Each message's
89
159
  `<acp tokens="N">` attribute is frozen at the tag's first render (the
90
160
  per-message `tokenSnapshot` in state) and is not recomputed when the message
@@ -102,8 +172,10 @@ live-recomputed tags, use `renderVisibleRefs` directly.
102
172
  | `buildStatusReport` / `buildRecap` | Context-usage report + block recap |
103
173
  | `mergeMarkedBlocks` / `collectOldGenBlocks` | Batch merge old-gen blocks into one summary |
104
174
  | `rebuildCompressionState` | Fork-recovery: replay historical compress calls |
175
+ | `MessageContentStore` / `storeLargeResults` / `retrieveByRef` / `storeCoveredOriginals` | CCR content store: per-session, content-addressed dedup of tool-result originals + on-demand retrieval (see "CCR" above) |
105
176
  | `applyMessageFilters` | Pluggable message-filter framework |
106
177
  | `resolveTransformChannel` | Channel-selection policy: an explicit preference wins; the default is the wire channel only when the caller reports it viable |
178
+ | `decideOutputSteering` / `classifyTurn` / `clampEffortToFloor` / `applySteeringToPrompt` | Output-side steering *decisions* (#355): structural turn classification (`new_user_ask` / `mechanical_continuation` / `error_continuation` / `unknown`), byte-stable verbosity directives L0–L4 (default L2), and clamp-only effort routing. The kernel decides; adapters land decisions onto wire fields. Default OFF |
107
179
  | `applySectionOverrides` / `cloneWithDescriptions` / `applyAcpToolOverrides` | Prompt/tool *surface* customization (see below) |
108
180
  | `sanitizePackSurface` / `createPackResolver` / `defaultPackSources` | Prompt packs: named, swappable surface presets resolved over pluggable sources (see below) |
109
181
 
@@ -162,6 +234,35 @@ The nudge system tells the model *when* to compress. It implements:
162
234
  - **Compressible-range computation**: reports the actual compressible ranges (excluding covered + preserved-recent messages) so the model knows what to target.
163
235
  - **Baseline reset on compress**: `applyCompression` clears the growth baseline on success, preventing the feedback-loop bug where the nudge re-fires post-compress.
164
236
 
237
+ ### Tool-result crush gate
238
+
239
+ Deterministic first tier of the two-tier absorb gate. When a tool result qualifies as an absorb candidate and context pressure is on, the `crush` node (between `absorb-hide` and `absorb-prompt`) re-evaluates it **in view** with pure, deterministic strategies before the absorb-prompt decision runs:
240
+
241
+ - **skip** — below `absorb.minToolTokens` or under `absorb.contextThresholdPct`; bytes untouched.
242
+ - **crushed** — deterministic compression brought it under `minToolTokens`; no model round-trip. The wire carries the crushed payload (e.g. `__acp_crush` rows/identical-run envelopes for JSON, lossless — decodes back to an equal JSON document).
243
+ - **distill** — still over (or uncrushable); forwarded to the `[ACP absorb]` prompt path, carrying the crushed payload when crushing succeeded.
244
+
245
+ Built-in strategies form an ordered plugin registry (hosts can add/replace/disable via `registerCrushPlugin` / config):
246
+
247
+ | Strategy | Kind | Lossy | What it does |
248
+ |----------|------|-------|--------------|
249
+ | `json-fold` | json | no | constant-field hoisting + identical row/run collapse into annotated envelopes |
250
+ | `code-trim` | code | yes | comment/docstring elision behind a string-literal-aware scanner; template literals and assigned triple-quoted strings survive verbatim; unterminated constructs fail open |
251
+ | `log-select` | log | yes | level-classified line selection; **every distinct ERROR/FAIL line survives verbatim** (kernel-enforced invariant — output dropping one is rejected); warnings deduped, stack frames collapsed, honest `[N lines omitted]` footer |
252
+
253
+ Kernel-enforced guarantees: dispatch guards keep each payload kind on its own strategies; plugins must be pure and deterministic (same payload + config ⇒ same bytes, prefix-cache friendly); any throw, sub-`minReduction` result, or invariant violation fails open to the next candidate or pass-through. **Default off** (`crush.enabled: false`) and requires `absorb.enabled: true`; when disabled the pipeline is byte-identical to pre-crush behavior.
254
+
255
+ ```json
256
+ "crush": {
257
+ "enabled": false,
258
+ "minReduction": 0.1,
259
+ "strategies": {
260
+ "json-fold": { "enabled": false },
261
+ "code-trim": { "excludeTools": ["bash"] }
262
+ }
263
+ }
264
+ ```
265
+
165
266
  ## Wire codec (`acp-kernel/wire`)
166
267
 
167
268
  The `acp-kernel/wire` subpath ships the provider wire-body codecs (lossless
@@ -1 +1 @@
1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AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAMzE"}
package/dist/ccr.d.ts ADDED
@@ -0,0 +1,116 @@
1
+ import type { CcrConfig, Config, CompressionState, CoreMessage } from "./types.js";
2
+ import type { MessageContentStore, StoredEntry } from "./content-store.js";
3
+ import type { PipelineNode } from "./pipeline.js";
4
+ /**
5
+ * CCR — content-cached retrieval (issue #352 / billion-context#1097).
6
+ *
7
+ * Lossless alternative to absorb's lossy distillation: oversized tool results
8
+ * are stored once at arrival in the per-session MessageContentStore, and the
9
+ * visible copy is replaced with a deterministic placeholder carrying enough
10
+ * signal (kind, size, command/head preview, ref) to judge relevance without
11
+ * retrieving. The model pulls the original back via the retrieve tool; the
12
+ * retrieved text rides back as an ephemeral trailing message that never
13
+ * consumes a ref and never enters the fold space.
14
+ *
15
+ * Replace-once-at-arrival: the pipeline node only acts on results it has not
16
+ * stored yet (marker check + store lookup). After replacement the visible
17
+ * bytes never change again → prefix-cache stable.
18
+ */
19
+ export declare const RETRIEVE_TOOL_NAME = "acp_retrieve";
20
+ export declare const DEFAULT_CCR_CONFIG: CcrConfig;
21
+ export declare function resolveCcrConfig(config: Config): CcrConfig;
22
+ /** Marker embedded in every placeholder. Idempotency check for the pipeline
23
+ * node AND the exclusion signal for absorb (ID-reference wins over distill). */
24
+ export declare const STORED_PLACEHOLDER_MARKER = "[acp-stored";
25
+ /** Reserved id prefix for ephemeral retrieval injections (mirrors
26
+ * acp_summary_): no ref is ever assigned, fold-space collection skips them. */
27
+ export declare const RETRIEVED_ID_PREFIX = "acp_retrieved_";
28
+ export declare function classifyKind(toolName?: string): string;
29
+ /** Collapse whitespace to single spaces and cap length. Deterministic — the
30
+ * preview is baked into the placeholder at arrival and must be byte-stable. */
31
+ export declare function normalizeHead(text: string, maxChars: number): string;
32
+ /** Best-effort extraction of the call's subject (command/path/query) from the
33
+ * paired tool-call args JSON. Returns undefined when args are not JSON or no
34
+ * known field holds a short string — the head preview covers that case. */
35
+ export declare function extractCommand(toolCallText: string | undefined, maxChars: number): string | undefined;
36
+ export interface StoredPlaceholderInput {
37
+ ref: string;
38
+ kind: string;
39
+ tokens: number;
40
+ head: string;
41
+ command?: string;
42
+ retrieveToolName: string;
43
+ }
44
+ /** Deterministic two-line placeholder. No timestamps, no randomness — the
45
+ * same inputs always produce identical bytes (prefix-cache friendly). */
46
+ export declare function buildStoredPlaceholder(input: StoredPlaceholderInput): string;
47
+ export declare function stripLeadingTag(text: string): string;
48
+ /** Marker check over the untagged body: hosts round-trip rendered output, so
49
+ * placeholders arrive prefixed with their own history tag. */
50
+ export declare function isStoredPlaceholderText(text: string): boolean;
51
+ export declare function retrievedMessageId(ref: string): string;
52
+ export declare function isRetrievedMessage(message: CoreMessage): boolean;
53
+ export interface RetrievalInjection {
54
+ /** Short deterministic ack — rides as the tool result so OpenAI-family
55
+ * wire pairing (every tool_call needs a response) stays intact. */
56
+ ackText: string;
57
+ /** Full-text trailing request-only message. Hosts strip it before
58
+ * persisting (same channel as nudge); if it round-trips anyway it is
59
+ * structurally excluded from refs and the fold space. */
60
+ injection: CoreMessage;
61
+ }
62
+ export declare function buildRetrievalInjection(ref: string, entry: StoredEntry, text: string): RetrievalInjection;
63
+ export interface ApplyRetrieveInput {
64
+ store: MessageContentStore;
65
+ ref: string;
66
+ }
67
+ export type ApplyRetrieveResult = {
68
+ ok: true;
69
+ text: string;
70
+ ackText: string;
71
+ injection: CoreMessage;
72
+ entry: StoredEntry;
73
+ } | {
74
+ ok: false;
75
+ reason: "not-found";
76
+ ackText: string;
77
+ };
78
+ /** Kernel primitive behind acp_retrieve: resolve a ref to its stored
79
+ * original plus the wire-safe injection pair. Hallucinated refs → not-found
80
+ * (cost: one tool call, by design). */
81
+ export declare function applyRetrieve(input: ApplyRetrieveInput): ApplyRetrieveResult;
82
+ export interface StoreLargeResultsInput {
83
+ messages: CoreMessage[];
84
+ state: CompressionState;
85
+ store: MessageContentStore;
86
+ config: Config;
87
+ countTokens: (text: string) => number;
88
+ }
89
+ export interface StoreLargeResultsResult {
90
+ messages: CoreMessage[];
91
+ store: MessageContentStore;
92
+ storedCount: number;
93
+ }
94
+ /** Core transform: store oversized tool-result originals and replace their
95
+ * visible text with placeholders. Pure over its inputs; returns new arrays.
96
+ * Only shrinks tool-result content in place — message ids, roles, toolCallId
97
+ * and the assistant tool_calls half are untouched (tool-pair integrity). */
98
+ export declare function storeLargeResults(input: StoreLargeResultsInput): StoreLargeResultsResult;
99
+ /** Effect shape carried in NodeIO.effects.ccr by ccrStoreNode. */
100
+ export interface CcrEffect {
101
+ store: MessageContentStore;
102
+ storedCount: number;
103
+ }
104
+ /** Pipeline node: runs after prune (new results live in the preserved tail,
105
+ * already referenced by assign-refs) and before absorb (placeholder-marked
106
+ * text is not an absorb candidate → ID-reference priority). */
107
+ export declare const ccrStoreNode: PipelineNode;
108
+ /** Adapter glue for v2 groundwork: persist originals of newly covered
109
+ * messages after applyCompression succeeds, so retrieve-by-ref works for
110
+ * folded content. First-write-wins keeps earlier CCR arrivals authoritative.
111
+ * Reasoning messages are skipped (thinking content is not retrievable). */
112
+ export declare function storeCoveredOriginals(store: MessageContentStore, messages: CoreMessage[], state: CompressionState, blockIds: readonly string[], countTokens: (text: string) => number, maxHeadChars?: number): MessageContentStore;
113
+ /** Bump the cumulative retrieval counter (host calls after a successful
114
+ * applyRetrieve; feeds the status report's retrieve-rate metric). */
115
+ export declare function noteRetrieval(state: CompressionState): CompressionState;
116
+ //# sourceMappingURL=ccr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ccr.d.ts","sourceRoot":"","sources":["../src/ccr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AAKpB,OAAO,KAAK,EACV,mBAAmB,EAEnB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAA2B,YAAY,EAAE,MAAM,e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eAAO,MAAM,YAAY,EAAE,YA8B1B,CAAC;AAEF;;;4EAG4E;AAC5E,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACrC,YAAY,GAAE,MAAwC,GACrD,mBAAmB,CA0BrB;AAED;sEACsE;AACtE,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CAQvE"}
@@ -421,17 +421,17 @@ export {
421
421
  countMessageTokens,
422
422
  estimateTokensFast,
423
423
  createBpeTokenizer,
424
- clampPrefix,
425
- clampWindow,
426
424
  COMPRESS_PHILOSOPHY,
427
425
  HOW_TO_COMPRESS_RULES,
428
426
  TIER2_DISTILL_RULES,
429
427
  TIER3_CONDENSE_RULES,
430
428
  defaultPrompts,
431
429
  resolvePrompts,
430
+ clampPrefix,
431
+ clampWindow,
432
432
  formatRanges,
433
433
  renderNudgeText,
434
434
  VIABLE_RANGE_MIN_TOKENS,
435
435
  viableRanges
436
436
  };
437
- //# sourceMappingURL=chunk-VPRKYTHW.js.map
437
+ //# sourceMappingURL=chunk-6RNVHY67.js.map
@@ -11,10 +11,21 @@ function createInitialState() {
11
11
  anchors: {},
12
12
  lastShownByTier: {}
13
13
  },
14
- stats: { tokensCompressed: 0, compressionCount: 0, absorbedTokens: 0 },
14
+ stats: {
15
+ tokensCompressed: 0,
16
+ compressionCount: 0,
17
+ absorbedTokens: 0,
18
+ imagesShrunk: 0,
19
+ imageBytesSaved: 0,
20
+ imageTokensSaved: 0,
21
+ storedCount: 0,
22
+ retrievalCount: 0
23
+ },
15
24
  absorbed: [],
16
25
  rules: [],
17
26
  nextRuleId: 1,
27
+ imageFullRestored: [],
28
+ imageShrinks: [],
18
29
  nextBlockId: 1,
19
30
  nextRunId: 1
20
31
  };
@@ -70,4 +81,4 @@ export {
70
81
  highestActiveTier,
71
82
  advanceSurvival
72
83
  };
73
- //# sourceMappingURL=chunk-5TQA7ZQM.js.map
84
+ //# sourceMappingURL=chunk-MXL3G3BN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/state.ts"],"sourcesContent":["import type { CompressionBlock, CompressionState } from \"./types.js\";\n\nexport function createInitialState(): CompressionState {\n return {\n blocks: [],\n messageRefs: { byRaw: {}, byRef: {} },\n tokenSnapshot: {},\n nudge: {\n lastPerMessageNudgeTokens: 0,\n lastNudgeShownTokens: 0,\n baselineTokens: 0,\n anchors: {},\n lastShownByTier: {},\n },\n stats: {\n tokensCompressed: 0,\n compressionCount: 0,\n absorbedTokens: 0,\n imagesShrunk: 0,\n imageBytesSaved: 0,\n imageTokensSaved: 0,\n storedCount: 0,\n retrievalCount: 0,\n },\n absorbed: [],\n rules: [],\n nextRuleId: 1,\n imageFullRestored: [],\n imageShrinks: [],\n nextBlockId: 1,\n nextRunId: 1,\n };\n}\n\nexport function allocateBlockId(state: CompressionState): string {\n const id = state.nextBlockId;\n state.nextBlockId = Math.max(1, id) + 1;\n return `b${id}`;\n}\n\nexport function allocateRunId(state: CompressionState): string {\n const id = state.nextRunId;\n state.nextRunId = Math.max(1, id) + 1;\n return `r${id}`;\n}\n\nexport function blockById(\n state: CompressionState,\n blockId: string,\n): CompressionBlock | undefined {\n return state.blocks.find((block) => block.blockId === blockId);\n}\n\nexport function activeBlocks(state: CompressionState): CompressionBlock[] {\n return state.blocks.filter((block) => block.active);\n}\n\nexport function coveredMessageIds(state: CompressionState): Set<string> {\n const covered = new Set<string>();\n for (const block of state.blocks) {\n if (!block.active) continue;\n for (const id of block.effectiveMessageIds) covered.add(id);\n }\n return covered;\n}\n\nexport function highestActiveTier(state: CompressionState): 0 | 1 | 2 | 3 {\n let highest: 0 | 1 | 2 | 3 = 0;\n for (const block of state.blocks) {\n if (block.active && block.tier > highest) highest = block.tier;\n }\n return highest;\n}\n\nexport function advanceSurvival(\n state: CompressionState,\n promotionThreshold: number,\n): void {\n for (const block of state.blocks) {\n if (!block.active) continue;\n block.survivedCount += 1;\n if (block.survivedCount >= promotionThreshold) {\n block.generation = \"old\";\n }\n }\n}\n"],"mappings":";AAEO,SAAS,qBAAuC;AACrD,SAAO;AAAA,IACL,QAAQ,CAAC;AAAA,IACT,aAAa,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,IACpC,eAAe,CAAC;AAAA,IAChB,OAAO;AAAA,MACL,2BAA2B;AAAA,MAC3B,sBAAsB;AAAA,MACtB,gBAAgB;AAAA,MAChB,SAAS,CAAC;AAAA,MACV,iBAAiB,CAAC;AAAA,IACpB;AAAA,IACA,OAAO;AAAA,MACL,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,gBAAgB;AAAA,MAChB,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,kBAAkB;AAAA,MAClB,aAAa;AAAA,MACb,gBAAgB;AAAA,IAClB;AAAA,IACA,UAAU,CAAC;AAAA,IACX,OAAO,CAAC;AAAA,IACR,YAAY;AAAA,IACZ,mBAAmB,CAAC;AAAA,IACpB,cAAc,CAAC;AAAA,IACf,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAEO,SAAS,gBAAgB,OAAiC;AAC/D,QAAM,KAAK,MAAM;AACjB,QAAM,cAAc,KAAK,IAAI,GAAG,EAAE,IAAI;AACtC,SAAO,IAAI,EAAE;AACf;AAEO,SAAS,cAAc,OAAiC;AAC7D,QAAM,KAAK,MAAM;AACjB,QAAM,YAAY,KAAK,IAAI,GAAG,EAAE,IAAI;AACpC,SAAO,IAAI,EAAE;AACf;AAEO,SAAS,UACd,OACA,SAC8B;AAC9B,SAAO,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,YAAY,OAAO;AAC/D;AAEO,SAAS,aAAa,OAA6C;AACxE,SAAO,MAAM,OAAO,OAAO,CAAC,UAAU,MAAM,MAAM;AACpD;AAEO,SAAS,kBAAkB,OAAsC;AACtE,QAAM,UAAU,oBAAI,IAAY;AAChC,aAAW,SAAS,MAAM,QAAQ;AAChC,QAAI,CAAC,MAAM,OAAQ;AACnB,eAAW,MAAM,MAAM,oBAAqB,SAAQ,IAAI,EAAE;AAAA,EAC5D;AACA,SAAO;AACT;AAEO,SAAS,kBAAkB,OAAwC;AACxE,MAAI,UAAyB;AAC7B,aAAW,SAAS,MAAM,QAAQ;AAChC,QAAI,MAAM,UAAU,MAAM,OAAO,QAAS,WAAU,MAAM;AAAA,EAC5D;AACA,SAAO;AACT;AAEO,SAAS,gBACd,OACA,oBACM;AACN,aAAW,SAAS,MAAM,QAAQ;AAChC,QAAI,CAAC,MAAM,OAAQ;AACnB,UAAM,iBAAiB;AACvB,QAAI,MAAM,iBAAiB,oBAAoB;AAC7C,YAAM,aAAa;AAAA,IACrB;AAAA,EACF;AACF;","names":[]}
@@ -16,6 +16,7 @@ export declare const SEARCH_CONTEXT_TOOL_NAME = "search_context";
16
16
  export declare const ACP_STATUS_TOOL_NAME = "acp_status";
17
17
  export declare const ACP_CACHE_TOOL_NAME = "acp_cache";
18
18
  export declare const ABSORB_TOOL_NAME = "absorb";
19
+ export declare const IMAGE_FULL_TOOL_NAME = "image_full";
19
20
  /** Text-protocol trigger tags. The model emits these in its text output to
20
21
  * request compression (used when host client tools cannot coexist with a
21
22
  * declared `tools` field — e.g. OpenAI Codex code_mode). Distinct from the
@@ -804,8 +805,8 @@ export declare const ACP_READONLY_TOOLS_RESPONSES: readonly [{
804
805
  };
805
806
  }];
806
807
  /** All ACP tool names (dynamic membership — Set, not a static record). Does
807
- * NOT include absorb: it is opt-in (config.absorb.enabled) and hosts only
808
- * register/inject it when the feature is on. */
808
+ * NOT include absorb or acp_retrieve: both are opt-in (config.absorb.enabled
809
+ * / config.ccr.enabled) and hosts only register/inject them when on. */
809
810
  export declare const ACP_TOOL_NAMES: ReadonlySet<string>;
810
811
  /** compress/decompress: mutate history → must drive the compress loop (their
811
812
  * result is folded into the request before the model continues). */
@@ -1046,4 +1047,105 @@ export declare const ABSORB_TOOL_GOOGLE: {
1046
1047
  required: string[];
1047
1048
  };
1048
1049
  };
1050
+ /** Opt-in image_full tool (restore original-resolution images for a previously
1051
+ * downscaled message). Inject/register only when
1052
+ * config.imageCompression.enabled — NOT part of ACP_TOOLS_* arrays. */
1053
+ export declare const IMAGE_FULL_TOOL_DESCRIPTION = "Restore original-resolution images for a previously downscaled message. Call when you cannot read details (text, colors, alignment) in a reduced image: pass the message ref (\"mNNNNN\") from the [Downscaled screenshots] note. Full resolution applies for the rest of this session.";
1054
+ /** Opt-in retrieve tool (lossless content-cached retrieval). Inject/register
1055
+ * only when config.ccr.enabled — NOT part of ACP_TOOLS_* arrays (same
1056
+ * opt-in pattern as absorb). */
1057
+ export declare const RETRIEVE_TOOL_NAME = "acp_retrieve";
1058
+ export declare const RETRIEVE_TOOL_DESCRIPTION = "Retrieve the full original text of a stored tool result. REQUIRED when you need details from a placeholder that starts with \uD83D\uDCE6 [acp-stored #mNNNNN: pass its ref. Returns the exact original text; the placeholder stays in context. Unknown refs return not-found.";
1059
+ export declare const IMAGE_FULL_TOOL: {
1060
+ name: string;
1061
+ description: string;
1062
+ input_schema: {
1063
+ type: "object";
1064
+ properties: {
1065
+ ref: {
1066
+ type: string;
1067
+ description: string;
1068
+ };
1069
+ };
1070
+ required: string[];
1071
+ };
1072
+ };
1073
+ export declare const IMAGE_FULL_TOOL_OPENAI: {
1074
+ type: "function";
1075
+ function: {
1076
+ name: string;
1077
+ description: string;
1078
+ parameters: {
1079
+ type: "object";
1080
+ properties: {
1081
+ ref: {
1082
+ type: string;
1083
+ description: string;
1084
+ };
1085
+ };
1086
+ required: string[];
1087
+ };
1088
+ };
1089
+ };
1090
+ export declare const IMAGE_FULL_TOOL_RESPONSES: {
1091
+ type: "function";
1092
+ name: string;
1093
+ description: string;
1094
+ parameters: {
1095
+ type: "object";
1096
+ properties: {
1097
+ ref: {
1098
+ type: string;
1099
+ description: string;
1100
+ };
1101
+ };
1102
+ required: string[];
1103
+ };
1104
+ };
1105
+ export declare const RETRIEVE_TOOL: {
1106
+ name: string;
1107
+ description: string;
1108
+ input_schema: {
1109
+ type: "object";
1110
+ properties: {
1111
+ ref: {
1112
+ type: string;
1113
+ description: string;
1114
+ };
1115
+ };
1116
+ required: string[];
1117
+ };
1118
+ };
1119
+ export declare const RETRIEVE_TOOL_OPENAI: {
1120
+ type: "function";
1121
+ function: {
1122
+ name: string;
1123
+ description: string;
1124
+ parameters: {
1125
+ type: "object";
1126
+ properties: {
1127
+ ref: {
1128
+ type: string;
1129
+ description: string;
1130
+ };
1131
+ };
1132
+ required: string[];
1133
+ };
1134
+ };
1135
+ };
1136
+ export declare const RETRIEVE_TOOL_RESPONSES: {
1137
+ type: "function";
1138
+ name: string;
1139
+ description: string;
1140
+ parameters: {
1141
+ type: "object";
1142
+ properties: {
1143
+ ref: {
1144
+ type: string;
1145
+ description: string;
1146
+ };
1147
+ };
1148
+ required: string[];
1149
+ };
1150
+ };
1049
1151
  //# sourceMappingURL=compress-tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compress-tools.d.ts","sourceRoot":"","sources":["../src/compress-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC;;;6DAG6D;AAC7D,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAC9C,eAAO,MAAM,cAAc,oBAAoB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C;AAEF,oEAAoE;AACpE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKnB,CAAC;AAEX,wEAAwE;AACxE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAI9B,CAAC;AAEF;;wEAEwE;AACxE,eAAO,MAAM,2BAA2B,4RACiP,CAAC;AAc1R;;iCAEiC;AACjC,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,eAAO,MAAM,yBAAyB,kRACiO,CAAC;AAaxQ,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAI3B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;CAKrC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAIzB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;CAOhC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;CAKnC,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import { createInitialState } from "./state.js";
2
+ import type { ApplyRetrieveResult } from "./ccr.js";
3
+ import type { MessageContentStore } from "./content-store.js";
2
4
  import type { RenderStrategy } from "./render-refs.js";
3
5
  import { type PipelineNode } from "./pipeline.js";
4
6
  import type { ApplyCompressionResult, CompressionBlock, CompressionState, Config, CoreMessage, ProcessTurnResult, StatusReport } from "./types.js";
@@ -7,6 +9,9 @@ export interface Ports {
7
9
  }
8
10
  export interface CompressionCore {
9
11
  processTurn(input: ProcessTurnInput): ProcessTurnResult;
12
+ /** Kernel primitive behind acp_retrieve: resolve a ref to its stored
13
+ * original plus the wire-safe injection pair (see ccr.ts). */
14
+ retrieve(store: MessageContentStore, ref: string): ApplyRetrieveResult;
10
15
  applyCompression(input: ApplyCompressionInput): ApplyCompressionResult;
11
16
  defaultNodes(): PipelineNode[];
12
17
  decompress(blockId: string, state: CompressionState): CompressionBlock | undefined;
@@ -31,6 +36,9 @@ export interface ProcessTurnInput {
31
36
  * directly from result.state.messageRefs.
32
37
  */
33
38
  renderTags?: RenderStrategy;
39
+ /** Per-session CCR content store (pass result.contentStore back here).
40
+ * Omit for pre-CCR sessions — an empty store is used. */
41
+ contentStore?: MessageContentStore;
34
42
  }
35
43
  export interface ApplyCompressionInput {
36
44
  ranges: {
@@ -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;AAcvD,OAAO,EAGL,KAAK,YAAY,EAGlB,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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,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;AA2GD,wBAAgB,UAAU,CAAC,KAAK,GAAE,KAAU,GAAG,eAAe,CAmW7D;AAgoCD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,MAAM,EACzB,SAAS,GAAE,OAAO,CAAC,MAAM,CAAM,GAC9B,MAAM,CAgDR;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CA6EvD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,wBAAgB,aAAa,CAC3B,iBAAiB,EAAE,MAAM,EACzB,SAAS,GAAE,OAAO,CAAC,MAAM,CAAM,GAC9B,MAAM,CAyER;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CA+IvD"}