opencode-acp 1.3.1 → 1.4.1
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/README.md +115 -41
- package/README.zh-CN.md +90 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +575 -72
- package/dist/index.js.map +1 -1
- package/dist/lib/compress/index.d.ts +1 -0
- package/dist/lib/compress/index.d.ts.map +1 -1
- package/dist/lib/compress/mark-block.d.ts +5 -0
- package/dist/lib/compress/mark-block.d.ts.map +1 -0
- package/dist/lib/config-validation.d.ts.map +1 -1
- package/dist/lib/config.d.ts +6 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/gc/merge.d.ts +17 -0
- package/dist/lib/gc/merge.d.ts.map +1 -0
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/utils.d.ts +1 -0
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/prompts/system.d.ts +1 -1
- package/dist/lib/prompts/system.d.ts.map +1 -1
- package/dist/lib/state/persistence.d.ts +1 -0
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/types.d.ts +1 -0
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.d.ts +1 -0
- package/dist/lib/state/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,19 +22,41 @@ The model decides <em>when</em> and <em>what</em> to compress — not a hard lim
|
|
|
22
22
|
|
|
23
23
|
## Why ACP
|
|
24
24
|
|
|
25
|
-
ACP
|
|
25
|
+
ACP hands all context-management authority to the model itself — not relying on
|
|
26
|
+
external models or any complex external mechanism to do context management. It
|
|
27
|
+
is, to date, the best context-management implementation on the market.
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
This brings two concrete effects:
|
|
30
|
+
|
|
31
|
+
- **It saves about two-thirds of tokens.** A model with a 1,000,000-token context
|
|
32
|
+
window effectively runs in the **200,000–300,000 token range**.
|
|
33
|
+
- **It supports ultra-long sessions without losing key content** — **500M-token-level
|
|
34
|
+
cumulative context, 100,000 messages per session**.
|
|
35
|
+
|
|
36
|
+
---
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
## Proven at scale
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
Real engineering context, in practice.
|
|
41
|
+
|
|
42
|
+
**Supports 500M-token-level cumulative context, with p95 context around 30% and
|
|
43
|
+
an average prompt-cache hit ratio above 85%.** (That average — not per-session —
|
|
44
|
+
is explained in [Impact on Prompt Caching](#impact-on-prompt-caching), where it
|
|
45
|
+
turns out to save far more tokens than traditional compression.)
|
|
46
|
+
|
|
47
|
+
| | Session 1 | Session 2 |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| **Messages** | 3,024 | 2,028 |
|
|
50
|
+
| **Total tokens processed** | 582 M | 463 M |
|
|
51
|
+
| **Prompt-cache hit ratio** | 86.2% | 89.0% |
|
|
52
|
+
| **Context p50 (median)** | 1.2 K (<1%) | 1.8 K (<1%) |
|
|
53
|
+
| **Context p75** | 2.8 K | 3.5 K |
|
|
54
|
+
| **Context p90** | 108 K (11%) | 58 K (6%) |
|
|
55
|
+
| **Context p95** | 251 K (25%) | 335 K (34%) |
|
|
56
|
+
| **Context p99** | 425 K (43%) | 442 K (44%) |
|
|
57
|
+
| **Peak** | 488 K (49%) | 769 K (77%) |
|
|
58
|
+
|
|
59
|
+
(Context percentages are of the 1M window.)
|
|
38
60
|
|
|
39
61
|
---
|
|
40
62
|
|
|
@@ -58,26 +80,70 @@ Or add to your opencode config:
|
|
|
58
80
|
|
|
59
81
|
## How It Works
|
|
60
82
|
|
|
61
|
-
ACP
|
|
83
|
+
ACP hands the context-compression tool directly to the model. The model is
|
|
84
|
+
**100% responsible** for context compression. The model's available tools are
|
|
85
|
+
mainly: **compress**, **decompress**, and **delete** (`mark_block` / `unmark_block`).
|
|
86
|
+
|
|
87
|
+
### Lifecycle
|
|
88
|
+
|
|
89
|
+
Three operations: **compress**, **decompress**, and **delete**. Content loops
|
|
90
|
+
between raw and compressed, and eventually terminates in deletion:
|
|
91
|
+
|
|
92
|
+
```mermaid
|
|
93
|
+
stateDiagram-v2
|
|
94
|
+
Raw --> Compressed : compress
|
|
95
|
+
Compressed --> Raw : decompress
|
|
96
|
+
Compressed --> Deleted : delete
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Compression strategy
|
|
100
|
+
|
|
101
|
+
The system injects a prompt telling the model the current context ratio, the
|
|
102
|
+
compression ratio, whether context is idle, and compression suggestions. When the
|
|
103
|
+
trigger ratio is hit, content is compressed in **priority order**:
|
|
104
|
+
|
|
105
|
+
1. Agent/subagent review & consultation results (largest block of uncompressed content)
|
|
106
|
+
2. Verbose command output (build/test runs, git diff/log/status, directory listings)
|
|
107
|
+
3. Exploration that led nowhere (failed approaches, dead-end searches)
|
|
108
|
+
4. Redundant tool results (reading the same file repeatedly, repeated status checks)
|
|
109
|
+
5. Intermediate steps of completed multi-step tasks
|
|
110
|
+
6. Resolved discussion threads (once a decision is recorded)
|
|
111
|
+
7. Large file contents already used
|
|
112
|
+
|
|
113
|
+
After compression, the original content is replaced by a short **block** that
|
|
114
|
+
references the original (recoverable via `decompress`).
|
|
62
115
|
|
|
63
|
-
###
|
|
116
|
+
### Decompression strategy
|
|
64
117
|
|
|
65
|
-
|
|
118
|
+
The model decides when to decompress. When the context is large enough to
|
|
119
|
+
interfere with the model's self-attention, short blocks lead the model to compress
|
|
120
|
+
some content first, handle the urgent matter, then decompress what it needs in
|
|
121
|
+
later work.
|
|
66
122
|
|
|
67
|
-
|
|
123
|
+
### Deletion strategy
|
|
68
124
|
|
|
69
|
-
|
|
70
|
-
|
|
125
|
+
To handle the accumulation of many small historical blocks, the new version adds
|
|
126
|
+
a deletion strategy. The model decides whether to delete. **Once deleted, content
|
|
127
|
+
is irrecoverable.** This replaces the original forced GC, so that forced garbage
|
|
128
|
+
collection no longer deletes things the model considers important.
|
|
71
129
|
|
|
72
|
-
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Impact on Prompt Caching
|
|
73
133
|
|
|
74
|
-
|
|
134
|
+
Historically, ACP has fixed many of the low-cache-hit-rate problems caused by
|
|
135
|
+
DCP. The overall cache hit rate is now **~87%**.
|
|
75
136
|
|
|
76
|
-
|
|
137
|
+
Compared to traditional compression — which only compresses at 80–90% and, once it
|
|
138
|
+
compresses, forces 100% of the context to re-hit — ACP's hit rate is effectively
|
|
139
|
+
higher.
|
|
77
140
|
|
|
78
|
-
|
|
141
|
+
Additionally, ACP keeps total context around **~30% most of the time**, versus the
|
|
142
|
+
traditional **50–80%**. So total token savings are far higher than traditional
|
|
143
|
+
compression.
|
|
79
144
|
|
|
80
|
-
|
|
145
|
+
**Conclusion:** ACP simultaneously raises the overall cache hit rate **and**
|
|
146
|
+
ensures key context information is not lost.
|
|
81
147
|
|
|
82
148
|
---
|
|
83
149
|
|
|
@@ -131,7 +197,7 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
131
197
|
|
|
132
198
|
```jsonc
|
|
133
199
|
{
|
|
134
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
200
|
+
"$schema": "https://raw.githubusercontent.com/ranxianglei/opencode-acp/master/dcp.schema.json",
|
|
135
201
|
// Enable or disable the plugin
|
|
136
202
|
"enabled": true,
|
|
137
203
|
// Automatically update npm-installed ACP when a newer npm latest is available.
|
|
@@ -239,6 +305,28 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
239
305
|
"protectedTools": [],
|
|
240
306
|
},
|
|
241
307
|
},
|
|
308
|
+
// Garbage collection and batch cleanup
|
|
309
|
+
"gc": {
|
|
310
|
+
"algorithm": "truncate",
|
|
311
|
+
// young → old generation promotion after this many survivals
|
|
312
|
+
"promotionThreshold": 5,
|
|
313
|
+
// deactivate a block after this many survivals
|
|
314
|
+
"maxBlockAge": 15,
|
|
315
|
+
// truncate old-gen summaries exceeding this length (chars)
|
|
316
|
+
"maxOldGenSummaryLength": 3000,
|
|
317
|
+
// run major GC when context usage exceeds this
|
|
318
|
+
"majorGcThresholdPercent": "100%",
|
|
319
|
+
// Three-tier batch merge-cleanup for blocks flagged via mark_block.
|
|
320
|
+
// Accepts a number or "X%" of the model context window.
|
|
321
|
+
"batchCleanup": {
|
|
322
|
+
// At/above this usage, remind the model about marked blocks
|
|
323
|
+
"lowThreshold": "60%",
|
|
324
|
+
// At/above this usage, auto merge-compress all marked blocks into one
|
|
325
|
+
"highThreshold": "75%",
|
|
326
|
+
// At/above this usage, force-merge all old-gen blocks (before GC)
|
|
327
|
+
"forceThreshold": "90%",
|
|
328
|
+
},
|
|
329
|
+
},
|
|
242
330
|
}
|
|
243
331
|
```
|
|
244
332
|
|
|
@@ -266,27 +354,11 @@ To reset an override, delete the matching file from your overrides directory.
|
|
|
266
354
|
### Protected Tools
|
|
267
355
|
|
|
268
356
|
By default, these tools are always protected from pruning:
|
|
269
|
-
`task`, `skill`, `todowrite`, `todoread`, `compress`, `batch`, `plan_enter`, `plan_exit`, `write`, `edit`
|
|
357
|
+
`task`, `skill`, `todowrite`, `todoread`, `compress`, `decompress`, `mark_block`, `unmark_block`, `batch`, `plan_enter`, `plan_exit`, `write`, `edit`
|
|
270
358
|
|
|
271
359
|
The `protectedTools` arrays in `commands` and `strategies` add to this default list.
|
|
272
360
|
|
|
273
|
-
For the `compress` tool, `compress.protectedTools` ensures specific tool outputs are appended to the compressed summary. By default it includes `task`, `skill`, `todowrite`, and `
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Impact on Prompt Caching
|
|
278
|
-
|
|
279
|
-
LLM providers cache prompts based on exact prefix matching. When ACP prunes content, it changes messages, which invalidates cached prefixes from that point forward.
|
|
280
|
-
|
|
281
|
-
**Trade-off:** You lose some cache reads but gain token savings from reduced context size and fewer hallucinations from stale context. In most cases, especially in long sessions, the savings outweigh the cache miss cost.
|
|
282
|
-
|
|
283
|
-
> [!NOTE]
|
|
284
|
-
> In testing, cache hit rates were approximately 85% with ACP vs 90% without.
|
|
285
|
-
|
|
286
|
-
**No impact for:**
|
|
287
|
-
|
|
288
|
-
- **Request-based billing** -- Providers like GitHub Copilot that charge per request, not tokens.
|
|
289
|
-
- **Uniform token pricing** -- Providers like Cerebras that bill cached and uncached tokens at the same rate.
|
|
361
|
+
For the `compress` tool, `compress.protectedTools` ensures specific tool outputs are appended to the compressed summary. By default it includes `task`, `skill`, `todowrite`, `todoread`, and `decompress`.
|
|
290
362
|
|
|
291
363
|
---
|
|
292
364
|
|
|
@@ -317,7 +389,7 @@ ACP auto-migrates config from `dcp.jsonc` to `acp.jsonc` and prompts from `dcp-p
|
|
|
317
389
|
---
|
|
318
390
|
|
|
319
391
|
<details>
|
|
320
|
-
<summary><strong>Bug Fixes (
|
|
392
|
+
<summary><strong>Bug Fixes (37 total)</strong> -- applied on top of DCP v3.1.11</summary>
|
|
321
393
|
|
|
322
394
|
| # | Severity | Summary |
|
|
323
395
|
|---|----------|---------|
|
|
@@ -345,6 +417,8 @@ ACP auto-migrates config from `dcp.jsonc` to `acp.jsonc` and prompts from `dcp-p
|
|
|
345
417
|
| 22 | HIGH | compress throws hard error on reversed block boundaries -- model gives up |
|
|
346
418
|
| 23--34 | MEDIUM | Various fixes for dedup, purge errors, schema validation, hook timing, etc. |
|
|
347
419
|
| 35 | HIGH | Aging warnings shown at low context usage (<50%) -- triggers unnecessary compress, wastes tokens |
|
|
420
|
+
| 36 | HIGH | Compression summary emitted as a standalone user message before the user's real turn -- model reads its own prior assistant output as user input, causing dialog role confusion / self-Q&A loops |
|
|
421
|
+
| 37 | HIGH | Message-transform pipeline runs on OpenCode's hidden title/summary/compaction agent requests -- corrupts the request and shared session state, breaking session title generation |
|
|
348
422
|
|
|
349
423
|
For the complete list with root cause analysis, see the [bug tracker](https://github.com/ranxianglei/opencode-acp/issues).
|
|
350
424
|
|
package/README.zh-CN.md
CHANGED
|
@@ -22,19 +22,34 @@
|
|
|
22
22
|
|
|
23
23
|
## 为什么选择 ACP
|
|
24
24
|
|
|
25
|
-
ACP
|
|
25
|
+
ACP 将上下文管理的所有权限全部交给模型自己,而不依靠外部模型或各种复杂的机制去做上下文管理。它是迄今为止,市面上对上下文管理最好的实现。
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| **Compress 可靠性** | 边界情况失败,模型放弃 | 自动恢复反转的边界 |
|
|
27
|
+
这带来两个影响:
|
|
28
|
+
|
|
29
|
+
- **省 token(约三分之二)。** 一个 100 万 token 上下文窗口的模型,实际只在 **20 万–30 万 token** 区间运行。
|
|
30
|
+
- **超长上下文不丢关键内容** —— 支持 **5 亿级别上下文、单会话 10 万条消息**。
|
|
31
|
+
|
|
32
|
+
---
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
## 实战验证
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
真实工程中的上下文情况。
|
|
37
|
+
|
|
38
|
+
**支持 5 亿级别 token,p95 上下文比例在 30% 左右,平均缓存命中率 85% 以上。**(注意这是平均缓存命中率,不是单会话命中率——后面[对 Prompt 缓存的影响](#对-prompt-缓存的影响)会解释,这实际上比传统压缩算法大幅度节省了 token。)
|
|
39
|
+
|
|
40
|
+
| | 会话一 | 会话二 |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| **消息总条数** | 3,024 | 2,028 |
|
|
43
|
+
| **累计处理 token** | 5.82 亿 | 4.63 亿 |
|
|
44
|
+
| **prompt-cache 命中率** | 86.2% | 89.0% |
|
|
45
|
+
| **上下文 p50(中位)** | 1.2 K(<1%) | 1.8 K(<1%) |
|
|
46
|
+
| **上下文 p75** | 2.8 K | 3.5 K |
|
|
47
|
+
| **上下文 p90** | 10.8 万(11%) | 5.8 万(6%) |
|
|
48
|
+
| **上下文 p95** | 25.1 万(25%) | 33.5 万(34%) |
|
|
49
|
+
| **上下文 p99** | 42.5 万(43%) | 44.2 万(44%) |
|
|
50
|
+
| **峰值** | 48.8 万(49%) | 76.9 万(77%) |
|
|
51
|
+
|
|
52
|
+
(上下文百分比均以 1M 窗口计。)
|
|
38
53
|
|
|
39
54
|
---
|
|
40
55
|
|
|
@@ -58,26 +73,52 @@ opencode plugin opencode-acp@latest --global
|
|
|
58
73
|
|
|
59
74
|
## 工作原理
|
|
60
75
|
|
|
61
|
-
ACP
|
|
76
|
+
ACP 把上下文压缩工具直接交给模型。模型对上下文压缩**负全责**。模型可用的工具主要是:**compress**、**decompress** 和 **delete**(`mark_block` / `unmark_block`)。
|
|
77
|
+
|
|
78
|
+
### 生命周期
|
|
79
|
+
|
|
80
|
+
三个操作:**压缩**、**解压缩**、**删除**。内容在原始与压缩之间循环,最终以删除终结:
|
|
81
|
+
|
|
82
|
+
```mermaid
|
|
83
|
+
stateDiagram-v2
|
|
84
|
+
Raw --> Compressed : compress
|
|
85
|
+
Compressed --> Raw : decompress
|
|
86
|
+
Compressed --> Deleted : delete
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 压缩策略
|
|
90
|
+
|
|
91
|
+
系统会注入一段 prompt,告诉模型当前的上下文比例、压缩比例、上下文是否空闲,以及压缩建议。当触发比例被命中时,内容按**优先级顺序**被压缩:
|
|
92
|
+
|
|
93
|
+
1. Agent/子代理的评审与咨询结果(最大一块未压缩内容)
|
|
94
|
+
2. 冗长的命令输出(构建/测试运行、git diff/log/status、目录列表)
|
|
95
|
+
3. 无结果的探索(失败的方法、死胡同式的搜索)
|
|
96
|
+
4. 冗余的工具结果(反复读同一个文件、重复的状态检查)
|
|
97
|
+
5. 已完成多步任务的中间步骤
|
|
98
|
+
6. 已尘埃落定的讨论(一旦决策被记录)
|
|
99
|
+
7. 已经用过的大段文件内容
|
|
100
|
+
|
|
101
|
+
压缩完成后,原始内容被一个简短的 **block** 替换,该 block 引用原始内容(可通过 `decompress` 恢复)。
|
|
62
102
|
|
|
63
|
-
###
|
|
103
|
+
### 解压策略
|
|
64
104
|
|
|
65
|
-
|
|
105
|
+
由模型决定何时解压。当上下文大到足以干扰模型的 self-attention 时,简短的 block 会让模型先压缩一部分内容,处理完紧急事务,再在后续工作中按需解压。
|
|
66
106
|
|
|
67
|
-
|
|
107
|
+
### 删除策略
|
|
68
108
|
|
|
69
|
-
|
|
70
|
-
- **`message` 模式**(实验性)独立压缩单条原始消息,使模型能够更精细地管理上下文。
|
|
109
|
+
为了应对大量小块历史内容的堆积,新版本增加了删除策略。由模型决定是否删除。**一旦删除,内容不可恢复。** 这取代了原先的强制 GC,使得强制垃圾回收不再删除模型认为重要的内容。
|
|
71
110
|
|
|
72
|
-
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 对 Prompt 缓存的影响
|
|
73
114
|
|
|
74
|
-
|
|
115
|
+
历史上 ACP 修复了大量由 DCP 导致的低缓存命中率问题。目前整体缓存命中率约为 **87%**。
|
|
75
116
|
|
|
76
|
-
|
|
117
|
+
相比传统压缩——只在 80–90% 时才压缩,一旦压缩就强制 100% 的上下文重新命中——ACP 的命中率实际上更高。
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
此外:ACP 大部分时间将总上下文维持在 **~30%** 左右,而传统方案是 50–80%。因此总 token 节省远高于传统压缩。
|
|
79
120
|
|
|
80
|
-
|
|
121
|
+
**结论:** ACP 在提高整体缓存命中率的同时,确保关键上下文信息不丢失。
|
|
81
122
|
|
|
82
123
|
---
|
|
83
124
|
|
|
@@ -131,7 +172,7 @@ ACP 使用自己的配置文件,按以下顺序搜索:
|
|
|
131
172
|
|
|
132
173
|
```jsonc
|
|
133
174
|
{
|
|
134
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
175
|
+
"$schema": "https://raw.githubusercontent.com/ranxianglei/opencode-acp/master/dcp.schema.json",
|
|
135
176
|
// Enable or disable the plugin
|
|
136
177
|
"enabled": true,
|
|
137
178
|
// Automatically update npm-installed ACP when a newer npm latest is available.
|
|
@@ -239,6 +280,28 @@ ACP 使用自己的配置文件,按以下顺序搜索:
|
|
|
239
280
|
"protectedTools": [],
|
|
240
281
|
},
|
|
241
282
|
},
|
|
283
|
+
// 垃圾回收与批量清理
|
|
284
|
+
"gc": {
|
|
285
|
+
"algorithm": "truncate",
|
|
286
|
+
// 存活此次数后从新生代晋升为老年代
|
|
287
|
+
"promotionThreshold": 5,
|
|
288
|
+
// 存活此次数后停用该块
|
|
289
|
+
"maxBlockAge": 15,
|
|
290
|
+
// 截断超过此长度(字符)的老年代摘要
|
|
291
|
+
"maxOldGenSummaryLength": 3000,
|
|
292
|
+
// 上下文使用率超过此值时执行主 GC
|
|
293
|
+
"majorGcThresholdPercent": "100%",
|
|
294
|
+
// 通过 mark_block 标记的块的三级批量合并清理阈值。
|
|
295
|
+
// 接受数字或 "X%"(模型上下文窗口的百分比)。
|
|
296
|
+
"batchCleanup": {
|
|
297
|
+
// 达到此使用率时,提醒模型已标记的块
|
|
298
|
+
"lowThreshold": "60%",
|
|
299
|
+
// 达到此使用率时,自动将所有已标记块合并压缩为一个
|
|
300
|
+
"highThreshold": "75%",
|
|
301
|
+
// 达到此使用率时,强制合并所有老年代块(GC 之前)
|
|
302
|
+
"forceThreshold": "90%",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
242
305
|
}
|
|
243
306
|
```
|
|
244
307
|
|
|
@@ -266,27 +329,11 @@ ACP 暴露六个可编辑的 prompt:
|
|
|
266
329
|
### 受保护工具
|
|
267
330
|
|
|
268
331
|
默认情况下,以下工具始终受保护不被剪枝:
|
|
269
|
-
`task`、`skill`、`todowrite`、`todoread`、`compress`、`batch`、`plan_enter`、`plan_exit`、`write`、`edit`
|
|
332
|
+
`task`、`skill`、`todowrite`、`todoread`、`compress`、`decompress`、`mark_block`、`unmark_block`、`batch`、`plan_enter`、`plan_exit`、`write`、`edit`
|
|
270
333
|
|
|
271
334
|
`commands` 和 `strategies` 中的 `protectedTools` 数组会添加到此默认列表。
|
|
272
335
|
|
|
273
|
-
对于 `compress` 工具,`compress.protectedTools` 确保特定工具的输出会被附加到压缩摘要中。默认包含 `task`、`skill`、`todowrite` 和 `
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## 对 Prompt 缓存的影响
|
|
278
|
-
|
|
279
|
-
LLM 提供商基于精确前缀匹配来缓存 prompt。当 ACP 剪枝内容时,它会修改消息,从而从该点开始使缓存的前缀失效。
|
|
280
|
-
|
|
281
|
-
**权衡:** 你会损失一些缓存读取,但从缩减的上下文大小中获得 token 节省,并减少因过时上下文产生的幻觉。在大多数情况下,尤其是长会话中,节省的开销超过缓存未命中的代价。
|
|
282
|
-
|
|
283
|
-
> [!NOTE]
|
|
284
|
-
> 在测试中,使用 ACP 的缓存命中率约为 85%,不使用时约为 90%。
|
|
285
|
-
|
|
286
|
-
**以下场景无影响:**
|
|
287
|
-
|
|
288
|
-
- **按请求计费** — 如 GitHub Copilot 等按请求而非按 token 计费的提供商。
|
|
289
|
-
- **统一 token 定价** — 如 Cerebras 等对缓存和未缓存 token 统一价格的提供商。
|
|
336
|
+
对于 `compress` 工具,`compress.protectedTools` 确保特定工具的输出会被附加到压缩摘要中。默认包含 `task`、`skill`、`todowrite`、`todoread` 和 `decompress`。
|
|
290
337
|
|
|
291
338
|
---
|
|
292
339
|
|
|
@@ -317,7 +364,7 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
|
|
|
317
364
|
---
|
|
318
365
|
|
|
319
366
|
<details>
|
|
320
|
-
<summary><strong>错误修复(共
|
|
367
|
+
<summary><strong>错误修复(共 37 项)</strong> — 基于 DCP v3.1.11</summary>
|
|
321
368
|
|
|
322
369
|
| # | 严重程度 | 摘要 |
|
|
323
370
|
|---|----------|------|
|
|
@@ -345,6 +392,8 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
|
|
|
345
392
|
| 22 | 高 | compress 在块边界反转时抛出硬错误 — 模型放弃 |
|
|
346
393
|
| 23--34 | 中 | 去重、错误清除、schema 验证、hook 时序等方面的多项修复 |
|
|
347
394
|
| 35 | 高 | 在低上下文使用率(<50%)时显示老化警告 — 触发不必要的 compress,浪费 token |
|
|
395
|
+
| 36 | 高 | 压缩摘要作为独立的 user 消息插入在用户真实发言之前 — 模型把自己先前的 assistant 输出误读为用户输入,导致对话角色混乱 / 自问自答循环 |
|
|
396
|
+
| 37 | 高 | 消息转换管线对 OpenCode 隐藏的 title/summary/compaction agent 请求也运行 — 污染请求并破坏共享会话状态,导致会话标题生成失效 |
|
|
348
397
|
|
|
349
398
|
完整列表及根因分析,请参见 [Bug Tracker](https://github.com/ranxianglei/opencode-acp/issues)。
|
|
350
399
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA2BjD,QAAA,MAAM,MAAM,EAAE,MAoHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
|