opencode-acp 1.12.8 → 1.12.10-dev.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 +16 -0
- package/README.zh-CN.md +16 -0
- package/dist/index.js +410 -351
- package/dist/index.js.map +1 -1
- package/dist/lib/compress/decompress-logic.d.ts +9 -0
- package/dist/lib/compress/decompress-logic.d.ts.map +1 -1
- package/dist/lib/compress/decompress.d.ts.map +1 -1
- package/dist/lib/compress/message.d.ts.map +1 -1
- package/dist/lib/compress/range.d.ts.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/messages/index.d.ts +1 -1
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/inject/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/dist/lib/messages/prune.d.ts +0 -1
- package/dist/lib/messages/prune.d.ts.map +1 -1
- package/dist/lib/messages/sync.d.ts.map +1 -1
- package/dist/lib/messages/utils.d.ts +0 -3
- 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/package.json +1 -1
package/README.md
CHANGED
|
@@ -422,6 +422,22 @@ For the complete list with root cause analysis, see the [bug tracker](https://gi
|
|
|
422
422
|
|
|
423
423
|
## Changelog
|
|
424
424
|
|
|
425
|
+
### v1.12.10-dev.1 — Decompress Range Mode + Token Classification + Protected Label Accuracy + Nudge Suppression + Discrete Intervals (PRs #73, #155, #157, #158, #159)
|
|
426
|
+
|
|
427
|
+
**Problem**: Five issues across decompress ergonomics, token accounting, and nudge quality. (1) `decompress` required a per-block `acp_status` → decompress-per-block loop to restore multiple compressed blocks. (2) Since v1.12.9 (compress-as-anchor), compress tool `summary` content was misclassified as `toolTokens` instead of `summaryTokens`, inflating tool% and deflating summary% in the context breakdown — misleading the model's compression decisions. (3) The `[PROTECTED: ...]` label listed every tool in a protected message (e.g. `[PROTECTED: grep, skill]`), misleading the model into thinking non-protected tools like `grep` were the reason for protection. (4) When all visible content was protected, the nudge still fired with an empty recommendation list — wasting context and confusing the model. (5) When a nudge was suppressed (filter removed all recommendations), the next-turn check re-evaluated every turn because the baseline never advanced, causing repeated wasted computation.
|
|
428
|
+
|
|
429
|
+
**Fix**: (1) **PR #73** — Added optional `startId`/`endId` to `decompress` schema; range mode batch-restores every active block whose `effectiveMessageIds` overlaps the resolved range in one call. New pure helper `findActiveBlocksOverlappingMessages` in `decompress-logic.ts`; backward compatible (`blockId` path unchanged). (2) **PR #155** — In `estimateContextComposition` (`lib/messages/inject/utils.ts`), when `toolName === "compress"`, extract `summary` text from `part.state.input.content[].summary` and classify it as `summaryTokens`. Structural overhead remains `toolTokens`. (3) **PR #157** — `buildCompressibleRanges` now only adds tools that actually trigger protection via `isToolNameProtected` or `isFilePathProtected`, mirroring `messageContainsProtectedTool` exactly — the label now shows `[PROTECTED: skill]` only. (4) **PR #158** — Added `allProtected = compressible.length === 0 && protected.length > 0` check; `nothingToCompress = filterSuppressed || allProtected` gates nudge injection so soft nudges are suppressed when there's genuinely nothing to compress (the `protected.length > 0` discriminator preserves the "no refs assigned yet" edge case). (5) **PR #159** — When a nudge is suppressed, advance `lastPerMessageNudgeTokens` to `currentTokens` and clear `lastNudgeShownTokens`, creating discrete 5% check intervals instead of every-turn re-evaluation.
|
|
430
|
+
|
|
431
|
+
Files: `lib/compress/decompress.ts`, `lib/compress/decompress-logic.ts`, `lib/messages/inject/utils.ts`, `lib/messages/inject/inject.ts`. Tests: 757 pass (11 new for decompress-logic, 5 new for token classification, 4 "all protected" tests fixed to actually exercise the `allProtected` branch, +1 new Scenario A test for compress-after-suppression).
|
|
432
|
+
|
|
433
|
+
### v1.12.9 — Compress-as-Anchor (PR #153)
|
|
434
|
+
|
|
435
|
+
**Problem**: Since v1.12.1, compression summaries were injected as synthetic tool-result messages via a registered `acp_context_recap` tool, while `stripStaleCompressCalls` removed past `compress` tool calls from the API context to avoid duplication. This doubled summary overhead: each block's summary existed both as a synthetic recap message AND in the original (now-stripped) compress call's `summary` parameter. For sessions with many compressions, this "recap overhead" consumed 10–20% of context with no additional information value. The `acp_context_recap` tool description also claimed it "automatically injects" summaries, which was misleading.
|
|
436
|
+
|
|
437
|
+
**Fix**: Removed the synthetic recap injection entirely. Compression summaries now live **inside the model's own past `compress` tool calls** — the `summary` parameter of each historical `compress({ summary: "..." })` call serves as the anchor, visible to the model like any other tool call. Deleted `createSyntheticToolRecap` (prune.ts), `stripStaleCompressCalls` (prune.ts), and the automatic recap injection path. The `acp_context_recap` tool is now manual-only (model-callable for re-fetching summaries that scrolled out of context). Updated `system.ts` prompt to describe compress-as-anchor behavior and warn against reusing historical `startId`/`endId` without `acp_status` verification. Updated `RECAP_TOOL_DESCRIPTION` to reflect manual-only usage. Net effect: ~50% reduction in summary overhead for compression-heavy sessions.
|
|
438
|
+
|
|
439
|
+
Files: `lib/messages/prune.ts`, `lib/messages/utils.ts`, `lib/compress/recap.ts`, `lib/prompts/system.ts`. Tests: updated for compress-anchor behavior; 725 pass.
|
|
440
|
+
|
|
425
441
|
### v1.12.8 — Phantom Block Rejection (PR #148)
|
|
426
442
|
|
|
427
443
|
**Problem**: When the model called `compress` on a range that was already covered by an active compression block, `applyCompressionState` still created a new block with `directMessageIds: []`, `compressedTokens: 0`, and `effectiveMessageIds` inherited from the consumed block. The model saw "0 tokens removed" in the notification, retried the same range, and entered a death loop: each phantom block added ~1K of summary overhead while compressing nothing, causing context to *grow* with every compression call (issues #93, #135). User sessions showed 9 consecutive phantom compressions (b12–b20) on the same range before the user manually intervened.
|
package/README.zh-CN.md
CHANGED
|
@@ -395,6 +395,22 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
|
|
|
395
395
|
|
|
396
396
|
## 更新日志
|
|
397
397
|
|
|
398
|
+
### v1.12.10-dev.1 — Decompress 范围模式 + Token 分类 + Protected 标签精确性 + Nudge 抑制 + 离散间隔(PR #73, #155, #157, #158, #159)
|
|
399
|
+
|
|
400
|
+
**问题**:五个问题,涉及 decompress 易用性、token 统计和 nudge 质量。(1)`decompress` 需要先 `acp_status` 再逐块 decompress 的循环才能恢复多个压缩块。(2)自 v1.12.9(compress-as-anchor)起,compress 工具的 `summary` 内容被错误分类为 `toolTokens` 而非 `summaryTokens`,导致上下文分布中 tool% 虚高、summary% 虚低 —— 误导模型的压缩决策。(3)`[PROTECTED: ...]` 标签列出受保护消息中的所有工具(例如 `[PROTECTED: grep, skill]`),让模型误以为 `grep` 等非保护工具也是保护原因。(4)当所有可见内容都是受保护内容时,nudge 仍然以空推荐列表注入 —— 浪费上下文且让模型困惑。(5)当 nudge 被抑制(过滤器移除所有推荐)时,下一轮检查每轮都重新评估,因为 baseline 从不前进,导致重复浪费计算。
|
|
401
|
+
|
|
402
|
+
**修复**:(1)**PR #73** —— 为 `decompress` schema 新增可选 `startId`/`endId`;范围模式批量恢复所有 `effectiveMessageIds` 与解析范围重叠的活跃块,一次调用完成。新纯函数 `findActiveBlocksOverlappingMessages` 在 `decompress-logic.ts`;向后兼容(`blockId` 路径不变)。(2)**PR #155** —— 在 `estimateContextComposition`(`lib/messages/inject/utils.ts`)中,当 `toolName === "compress"` 时,从 `part.state.input.content[].summary` 提取 `summary` 文本并分类为 `summaryTokens`。结构开销仍计为 `toolTokens`。(3)**PR #157** —— `buildCompressibleRanges` 现在只添加通过 `isToolNameProtected` 或 `isFilePathProtected` 实际触发保护的工具,与 `messageContainsProtectedTool` 逻辑完全一致 —— 标签现在只显示 `[PROTECTED: skill]`。(4)**PR #158** —— 新增 `allProtected = compressible.length === 0 && protected.length > 0` 检查;`nothingToCompress = filterSuppressed || allProtected` 门控 nudge 注入,当确实没有可压缩内容时抑制软 nudge(`protected.length > 0` 判别式保留了"尚未分配 ref"的边缘情况)。(5)**PR #159** —— 当 nudge 被抑制时,将 `lastPerMessageNudgeTokens` 前进到 `currentTokens` 并清除 `lastNudgeShownTokens`,创建离散 5% 检查间隔而非每轮重新评估。
|
|
403
|
+
|
|
404
|
+
文件:`lib/compress/decompress.ts`、`lib/compress/decompress-logic.ts`、`lib/messages/inject/utils.ts`、`lib/messages/inject/inject.ts`。测试:757 通过(decompress-logic 新增 11 个,token 分类新增 5 个,4 个 "all protected" 测试修复为真正触发 `allProtected` 分支,+1 个 Scenario A 测试覆盖抑制后压缩)。
|
|
405
|
+
|
|
406
|
+
### v1.12.9 — Compress-as-Anchor(PR #153)
|
|
407
|
+
|
|
408
|
+
**问题**:自 v1.12.1 起,压缩摘要通过注册的 `acp_context_recap` 工具以 synthetic tool-result 消息注入,同时 `stripStaleCompressCalls` 从 API 上下文中移除历史 `compress` 工具调用以避免重复。这导致摘要开销翻倍:每个块的摘要同时存在于 synthetic recap 消息和原始(已移除的)compress 调用的 `summary` 参数中。对于压缩频繁的会话,这个 "recap 开销" 占用 10–20% 上下文却没有额外信息价值。`acp_context_recap` 工具描述也声称它"自动注入"摘要,具有误导性。
|
|
409
|
+
|
|
410
|
+
**修复**:完全移除 synthetic recap 注入。压缩摘要现在保留在**模型自己的历史 `compress` 工具调用中** —— 每个历史 `compress({ summary: "..." })` 调用的 `summary` 参数作为锚点,像其他工具调用一样对模型可见。删除了 `createSyntheticToolRecap`(prune.ts)、`stripStaleCompressCalls`(prune.ts)和自动 recap 注入路径。`acp_context_recap` 工具改为手动调用(模型可调用以重新获取滚动出上下文的摘要)。更新 `system.ts` 提示描述 compress-as-anchor 行为,警告不要不经 `acp_status` 验证就重用历史 `startId`/`endId`。更新 `RECAP_TOOL_DESCRIPTION` 反映手动调用语义。净效果:压缩频繁会话的摘要开销减少约 50%。
|
|
411
|
+
|
|
412
|
+
文件:`lib/messages/prune.ts`、`lib/messages/utils.ts`、`lib/compress/recap.ts`、`lib/prompts/system.ts`。测试:更新为 compress-anchor 行为;725 通过。
|
|
413
|
+
|
|
398
414
|
### v1.12.8 — 幽灵块拒绝(PR #148)
|
|
399
415
|
|
|
400
416
|
**问题**:当模型对已被活跃压缩块覆盖的范围调用 `compress` 时,`applyCompressionState` 仍然创建新块,`directMessageIds: []`、`compressedTokens: 0`、`effectiveMessageIds` 从被消费的块继承。模型在通知中看到"移除 0 tokens",重试同一范围,进入死亡循环:每个幽灵块增加约 1K 摘要开销却什么都不压缩,导致上下文随每次压缩调用*增长*(issues #93, #135)。用户会话显示同一范围连续 9 次幽灵压缩(b12–b20),直到用户手动干预。
|