opencode-acp 1.5.1 → 1.6.0
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 +9 -17
- package/README.zh-CN.md +7 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +291 -330
- package/dist/index.js.map +1 -1
- package/dist/lib/compress/index.d.ts +0 -1
- package/dist/lib/compress/index.d.ts.map +1 -1
- package/dist/lib/compress/message.d.ts.map +1 -1
- package/dist/lib/compress/range-utils.d.ts.map +1 -1
- package/dist/lib/compress/range.d.ts.map +1 -1
- package/dist/lib/config-validation.d.ts.map +1 -1
- package/dist/lib/config.d.ts +3 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/gc/merge.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/inject/inject.d.ts.map +1 -1
- package/dist/lib/messages/prune.d.ts.map +1 -1
- package/dist/lib/prompts/compress-range.d.ts +1 -1
- package/dist/lib/prompts/compress-range.d.ts.map +1 -1
- package/dist/lib/prompts/extensions/nudge.d.ts +6 -0
- package/dist/lib/prompts/extensions/nudge.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/token-utils.d.ts +1 -0
- package/dist/lib/token-utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/lib/compress/mark-block.d.ts +0 -5
- package/dist/lib/compress/mark-block.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -82,18 +82,20 @@ Or add to your opencode config:
|
|
|
82
82
|
|
|
83
83
|
ACP hands the context-compression tool directly to the model. The model is
|
|
84
84
|
**100% responsible** for context compression. The model's available tools are
|
|
85
|
-
mainly: **compress
|
|
85
|
+
mainly: **compress** and **decompress**. A hardcoded 100% GC fallback acts as
|
|
86
|
+
a safety net when the context window is completely full.
|
|
86
87
|
|
|
87
88
|
### Lifecycle
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
Two operations: **compress** and **decompress**. Content loops between raw and
|
|
91
|
+
compressed. When context hits 100%, old-gen block summaries are truncated as
|
|
92
|
+
a last resort:
|
|
91
93
|
|
|
92
94
|
```mermaid
|
|
93
95
|
stateDiagram-v2
|
|
94
96
|
Raw --> Compressed : compress
|
|
95
97
|
Compressed --> Raw : decompress
|
|
96
|
-
Compressed -->
|
|
98
|
+
Compressed --> Truncated : GC at 100%
|
|
97
99
|
```
|
|
98
100
|
|
|
99
101
|
### Compression strategy
|
|
@@ -305,7 +307,7 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
305
307
|
"protectedTools": [],
|
|
306
308
|
},
|
|
307
309
|
},
|
|
308
|
-
// Garbage collection
|
|
310
|
+
// Garbage collection — hardcoded 100% fallback only
|
|
309
311
|
"gc": {
|
|
310
312
|
"algorithm": "truncate",
|
|
311
313
|
// young → old generation promotion after this many survivals
|
|
@@ -314,18 +316,8 @@ Each level overrides the previous, so project settings take priority over global
|
|
|
314
316
|
"maxBlockAge": 15,
|
|
315
317
|
// truncate old-gen summaries exceeding this length (chars)
|
|
316
318
|
"maxOldGenSummaryLength": 3000,
|
|
317
|
-
// run major GC when context usage exceeds this
|
|
319
|
+
// run major GC when context usage exceeds this (hardcoded, not configurable)
|
|
318
320
|
"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
321
|
},
|
|
330
322
|
}
|
|
331
323
|
```
|
|
@@ -354,7 +346,7 @@ To reset an override, delete the matching file from your overrides directory.
|
|
|
354
346
|
### Protected Tools
|
|
355
347
|
|
|
356
348
|
By default, these tools are always protected from pruning:
|
|
357
|
-
`task`, `skill`, `todowrite`, `todoread`, `compress`, `decompress`, `
|
|
349
|
+
`task`, `skill`, `todowrite`, `todoread`, `compress`, `decompress`, `batch`, `plan_enter`, `plan_exit`, `write`, `edit`
|
|
358
350
|
|
|
359
351
|
The `protectedTools` arrays in `commands` and `strategies` add to this default list.
|
|
360
352
|
|
package/README.zh-CN.md
CHANGED
|
@@ -73,17 +73,17 @@ opencode plugin opencode-acp@latest --global
|
|
|
73
73
|
|
|
74
74
|
## 工作原理
|
|
75
75
|
|
|
76
|
-
ACP 把上下文压缩工具直接交给模型。模型对上下文压缩**负全责**。模型可用的工具主要是:**compress
|
|
76
|
+
ACP 把上下文压缩工具直接交给模型。模型对上下文压缩**负全责**。模型可用的工具主要是:**compress** 和 **decompress**。当上下文达到 100% 时,系统自动触发 GC 截断作为兜底。
|
|
77
77
|
|
|
78
78
|
### 生命周期
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
两个操作:**压缩**、**解压缩**。内容在原始与压缩之间循环。当上下文达到 100% 时,GC 自动截断老年代 block 作为兜底:
|
|
81
81
|
|
|
82
82
|
```mermaid
|
|
83
83
|
stateDiagram-v2
|
|
84
84
|
Raw --> Compressed : compress
|
|
85
85
|
Compressed --> Raw : decompress
|
|
86
|
-
Compressed -->
|
|
86
|
+
Compressed --> GC_Truncated : GC (100%)
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
### 压缩策略
|
|
@@ -104,9 +104,9 @@ stateDiagram-v2
|
|
|
104
104
|
|
|
105
105
|
由模型决定何时解压。当上下文大到足以干扰模型的 self-attention 时,简短的 block 会让模型先压缩一部分内容,处理完紧急事务,再在后续工作中按需解压。
|
|
106
106
|
|
|
107
|
-
###
|
|
107
|
+
### GC 兜底
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
当上下文达到 100% 时,系统自动截断老年代 block 摘要,防止上下文溢出。这是最后的兜底机制,不影响模型的正常压缩/解压操作。
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
@@ -289,18 +289,8 @@ ACP 使用自己的配置文件,按以下顺序搜索:
|
|
|
289
289
|
"maxBlockAge": 15,
|
|
290
290
|
// 截断超过此长度(字符)的老年代摘要
|
|
291
291
|
"maxOldGenSummaryLength": 3000,
|
|
292
|
-
// 上下文使用率超过此值时执行主 GC
|
|
292
|
+
// 上下文使用率超过此值时执行主 GC(兜底,硬编码为 100%)
|
|
293
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
294
|
},
|
|
305
295
|
}
|
|
306
296
|
```
|
|
@@ -329,7 +319,7 @@ ACP 暴露六个可编辑的 prompt:
|
|
|
329
319
|
### 受保护工具
|
|
330
320
|
|
|
331
321
|
默认情况下,以下工具始终受保护不被剪枝:
|
|
332
|
-
`task`、`skill`、`todowrite`、`todoread`、`compress`、`decompress`、`
|
|
322
|
+
`task`、`skill`、`todowrite`、`todoread`、`compress`、`decompress`、`batch`、`plan_enter`、`plan_exit`、`write`、`edit`
|
|
333
323
|
|
|
334
324
|
`commands` 和 `strategies` 中的 `protectedTools` 数组会添加到此默认列表。
|
|
335
325
|
|
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;AAyBjD,QAAA,MAAM,MAAM,EAAE,MAkHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
|