acp-kernel 0.0.15 → 0.0.17

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.
@@ -8,20 +8,23 @@ export declare const ALWAYS_PROTECTED_TOOLS: readonly ["compress"];
8
8
  /** Tool results that must NEVER participate in the soft-protected recent zone
9
9
  * (preserveRecentMessages / preserveRecentTokens / last user message).
10
10
  *
11
- * `decompress` returns large restored content as an inline tool result. If it
12
- * lands in the last-N window it becomes un-compressible: the model cannot
13
- * reclaim that context, and it never appears in the compressible-ranges
14
- * recommendation list. Excluding it from the protected zone lets the model
15
- * compress it again immediately, while still leaving it visible (the host's
16
- * preserveRecent is about not compressing the active working set, not about
17
- * which tool results are in scope).
11
+ * These tools return large content (restored blocks, search hits, file bodies,
12
+ * command output). If such a result lands in the last-N window it becomes
13
+ * un-compressible: the model cannot reclaim that context, and it never appears
14
+ * in the compressible-ranges recommendation list. Excluding these tools from
15
+ * the protected zone lets the model compress them again immediately, while
16
+ * still leaving them visible (the host's preserveRecent is about not
17
+ * compressing the active working set, not about which tool results are in
18
+ * scope).
18
19
  *
19
- * `search_context` returns large result lists (10 ranked hits with previews).
20
- * Same reasoning: excluding it from the protected zone keeps it compressible.
20
+ * - `decompress`: large restored content as an inline tool result.
21
+ * - `search_context`: large result lists (10 ranked hits with previews).
22
+ * - `read`: file/image contents — the largest common source of context bloat.
23
+ * - `bash`: command output (build/test/logs) — frequently large and spent.
21
24
  *
22
25
  * Note: this only affects the recent-zone computation. Such messages remain
23
26
  * fully visible and compressible like any ordinary message. */
24
- export declare const NEVER_PRESERVE_RECENT_TOOLS: readonly ["decompress", "search_context"];
27
+ export declare const NEVER_PRESERVE_RECENT_TOOLS: readonly ["decompress", "search_context", "read", "bash"];
25
28
  /** True for tool-call / tool-result messages whose toolName is in the
26
29
  * NEVER_PRESERVE_RECENT_TOOLS list — i.e. tool results (like decompress)
27
30
  * that should be excluded from the soft-protected recent zone. */
@@ -1 +1 @@
1
- {"version":3,"file":"protected.d.ts","sourceRoot":"","sources":["../src/protected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;kFAIkF;AAClF,eAAO,MAAM,sBAAsB,uBAAwB,CAAC;AAE5D;;;;;;;;;;;;;;;gEAegE;AAChE,eAAO,MAAM,2BAA2B,2CAA4C,CAAC;AAErF;;mEAEmE;AACnE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAM/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAK3E;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GACzD,OAAO,CAsBT;AAED;;;8DAG8D;AAC9D,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,WAAW,EAAE,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GACzD,GAAG,CAAC,MAAM,CAAC,CAQb;AAED;iFACiF;AACjF,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,EAC1D,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC5B,OAAO,CAUT"}
1
+ {"version":3,"file":"protected.d.ts","sourceRoot":"","sources":["../src/protected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;kFAIkF;AAClF,eAAO,MAAM,sBAAsB,uBAAwB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;gEAkBgE;AAChE,eAAO,MAAM,2BAA2B,2DAK9B,CAAC;AAEX;;mEAEmE;AACnE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAM/D;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAK3E;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GACzD,OAAO,CAsBT;AAED;;;8DAG8D;AAC9D,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,WAAW,EAAE,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GACzD,GAAG,CAAC,MAAM,CAAC,CAQb;AAED;iFACiF;AACjF,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,EAC1D,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC5B,OAAO,CAUT"}
@@ -1,5 +1,20 @@
1
1
  import type { CoreMessage, CompressionState } from "./types.js";
2
2
  import type { PipelineNode } from "./pipeline.js";
3
- export declare function renderVisibleRefs(messages: CoreMessage[], state: CompressionState, countTokens?: (text: string) => number): CoreMessage[];
3
+ /**
4
+ * Controls which messages get an <acp> ref tag injected into their text.
5
+ * Ref assignment (assignRefsNode) is unconditional — every message always
6
+ * receives a ref in state.messageRefs regardless of this setting. This only
7
+ * governs text rendering:
8
+ * - "all": tag every mapped message (in-process hosts like pai-acp)
9
+ * - "text-only": tag only user/assistant text; leave tool-call args and
10
+ * tool-result content pristine (proxy hosts — structured content must not
11
+ * be polluted)
12
+ * - "none": leave all text untouched (hosts that read the ref map directly)
13
+ */
14
+ export type RenderStrategy = "all" | "text-only" | "none";
15
+ export declare function renderVisibleRefs(messages: CoreMessage[], state: CompressionState, countTokens?: (text: string) => number, strategy?: RenderStrategy): CoreMessage[];
16
+ /** Factory: build a render-refs node bound to a specific render strategy. */
17
+ export declare function createRenderRefsNode(strategy: RenderStrategy): PipelineNode;
18
+ /** Backward compat: default render-refs node using strategy "all". */
4
19
  export declare const renderRefsNode: PipelineNode;
5
20
  //# sourceMappingURL=render-refs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-refs.d.ts","sourceRoot":"","sources":["../src/render-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAiB,MAAM,YAAY,CAAC;AAE/E,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AAuD3E,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,EACvB,WAAW,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MACH,GAC3B,WAAW,EAAE,CAKf;AAED,eAAO,MAAM,cAAc,EAAE,YAQ5B,CAAC"}
1
+ {"version":3,"file":"render-refs.d.ts","sourceRoot":"","sources":["../src/render-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAiB,MAAM,YAAY,CAAC;AAE/E,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;AAgE1D,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,EACvB,WAAW,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MACH,EAC5B,QAAQ,GAAE,cAAsB,GAC/B,WAAW,EAAE,CAKf;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,CAU3E;AAED,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,YAA0C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acp-kernel",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Framework-agnostic context-compression engine (model-driven, 3-tier LSM). Pure core: no host dependency.",
5
5
  "license": "MIT",
6
6
  "author": "ranxianglei",