opencode-acp 1.10.1 → 1.11.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 CHANGED
@@ -422,7 +422,45 @@ For the complete list with root cause analysis, see the [bug tracker](https://gi
422
422
 
423
423
  ## Changelog
424
424
 
425
- ### v1.10.1Over-Compression Fix & More Compression Candidates
425
+ ### v1.11.0Tool-Result Recap Injection, Context Breakdown & Fork Rebuild
426
+
427
+ This release fixes two critical compression-injection bugs (#20 echo, #78 drift), adds a visible context breakdown to `acp_status`, and introduces a fork-rebuild mechanism.
428
+
429
+ #### Tool-Result Recap Injection — Fixes #20 & #78 (PR #95)
430
+
431
+ **Problem**: Compression summaries were injected as text-based `role:assistant` or `role:user` messages. Both roles misled the model:
432
+ - `role:assistant` (Bug 37 path) → model treated summaries as its own prior output and echoed them verbatim (#20, GLM-5.2).
433
+ - `role:user` (Bug 36 merge path) → model treated summaries as user instructions and chased old topics (#78, gpt-5.5).
434
+
435
+ **Fix**: Summaries are now injected as synthetic **tool-call + tool-result** pairs via `acp_context_recap`. At the API level, the model sees `role:"tool"` — a neutral third role meaning "data from a tool", neither instruction nor own voice. This eliminates both echo (#20) and drift (#78) without breaking prefix caching (mid-stream injection, system prompt unchanged) and works across all providers (OpenAI `role:"tool"`, Anthropic `tool_result` content type).
436
+
437
+ Files: `lib/messages/utils.ts` (`createSyntheticToolRecap`), `lib/messages/prune.ts` (single-path injection), `lib/messages/query.ts` (`isSyntheticMessage` recognizes `msg_acp_recap_` prefix), `lib/prompts/system.ts` (updated tool description). Removed dead code: `prependCompressionSummary`, `MERGED_SUMMARY_HEADER/FOOTER`, `[ACP system message]` notification wrapper.
438
+
439
+ Tests: 600 total (10 updated for tool-result format + 1 new multi-block test). TypeScript: 0 errors. Dual-agent reviewed.
440
+
441
+ #### acp_status Visible Context Breakdown (PR #91)
442
+
443
+ `acp_status` now shows a per-category token breakdown (tool/code/text/summaries) with largest-item identification. Added drilldown params: `scope:"uncompressed"` with optional `tool:"bash"` filter and `sort:"size"`. The nudge injection was simplified — removed mini breakdown and Top blocks, replaced with a cleaner per-tool-type breakdown. Fixed tool-type detection to only count `type:"tool"` parts (skip step-start/step-finish). Added a dynamic drill-down hint that shows the session's actual top tool.
444
+
445
+ Files: `lib/compress/status.ts`, `lib/messages/inject/inject.ts`, `lib/messages/inject/utils.ts`, `tests/acp-status.test.ts`.
446
+
447
+ #### Fork Rebuild & Prune Tool (PR #90)
448
+
449
+ Added `lib/state/rebuild.ts` — rebuilds compression state after a session fork to prevent context overflow. Added `lib/compress/prune-tool.ts` — a standalone `prune` tool that removes old tool outputs by type (`toolType` param), separate from the `compress` tool for safety.
450
+
451
+ Files: `lib/state/rebuild.ts`, `lib/compress/prune-tool.ts`, `lib/compress/index.ts`, `index.ts`, `tests/rebuild.test.ts`.
452
+
453
+ #### Remove todowrite/todoread from compress.protectedTools defaults (PR #87)
454
+
455
+ `todowrite` and `todoread` were in the `compress.protectedTools` default list, which prevented them from being compressed. Removed so that old todowrite states can be pruned normally.
456
+
457
+ ---
458
+
459
+ ### v1.10.2 — Protected Tools Default Update (PR #87)
460
+
461
+ Removed `todowrite` and `todoread` from the `compress.protectedTools` default configuration. These tools' outputs accumulate over long sessions and should be eligible for compression like other tool outputs. Users who want to keep them protected can set `compress.protectedTools: ["todowrite", "todoread"]` in their config.
462
+
463
+ ---
426
464
 
427
465
  Fixes the over-compression bug reported in issue #18 and GitHub #85, where the `toolOutputReminder` nudge bypassed the adaptive 5%-of-context growth protection and fired ~10x too often on large-context models.
428
466
 
package/README.zh-CN.md CHANGED
@@ -395,7 +395,37 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
395
395
 
396
396
  ## 更新日志
397
397
 
398
- ### v1.10.0 — 受保护工具硬排除、压缩提示词重写、后缀与部署修复
398
+ ### v1.11.0 — 工具结果注入、上下文分解 & Fork 重建
399
+
400
+ 本次发布修复了两个关键压缩注入 bug(#20 复读、#78 漂移),为 `acp_status` 添加了可见上下文分解,并引入了 fork 重建机制。
401
+
402
+ #### 工具结果注入 — 修复 #20 & #78(PR #95)
403
+
404
+ **问题**:压缩摘要以文本形式的 `role:assistant` 或 `role:user` 消息注入。两种角色都会误导模型:
405
+ - `role:assistant`(Bug 37 路径)→ 模型将摘要当作自己的前文,逐字复读(#20,GLM-5.2)。
406
+ - `role:user`(Bug 36 合并路径)→ 模型将摘要当作用户指令,去执行旧话题(#78,gpt-5.5)。
407
+
408
+ **修复**:摘要现在以合成的 **tool-call + tool-result** 对注入(`acp_context_recap`)。在 API 层面,模型看到的是 `role:"tool"` —— 一个中立角色,表示「工具返回的数据」,既不是指令也不是自己的前文。这同时消除了复读(#20)和漂移(#78),不破坏前缀缓存(mid-stream 注入,system prompt 不变),且跨所有 provider 兼容。
409
+
410
+ #### acp_status 可见上下文分解(PR #91)
411
+
412
+ `acp_status` 现在显示按类别(tool/code/text/summaries)的 token 分解,并标识最大项。新增下钻参数:`scope:"uncompressed"` + 可选 `tool:"bash"` 过滤和 `sort:"size"`。简化了 nudge 注入 —— 移除了 mini breakdown 和 Top blocks,替换为更清晰的按工具类型分解。
413
+
414
+ #### Fork 重建 & Prune 工具(PR #90)
415
+
416
+ 新增 `lib/state/rebuild.ts` —— 在 session fork 后重建压缩状态以防止上下文溢出。新增 `lib/compress/prune-tool.ts` —— 独立的 `prune` 工具,按类型(`toolType` 参数)移除旧工具输出,与 `compress` 工具分离以提高安全性。
417
+
418
+ #### 移除 todowrite/todoread 的默认保护(PR #87)
419
+
420
+ 从 `compress.protectedTools` 默认配置中移除了 `todowrite` 和 `todoread`,使旧 todowrite 状态可以正常被压缩。
421
+
422
+ ---
423
+
424
+ ### v1.10.2 — 受保护工具默认配置更新(PR #87)
425
+
426
+ 从 `compress.protectedTools` 默认配置中移除了 `todowrite` 和 `todoread`。这些工具的输出在长会话中累积,应像其他工具输出一样可被压缩。如需保持保护,可在配置中设置 `compress.protectedTools: ["todowrite", "todoread"]`。
427
+
428
+ ---
399
429
 
400
430
  本次发布合并了 7 个 PR。核心变更是**受保护工具消息硬排除**;其余为同期合入的修复和提示词重写。
401
431
 
@@ -1 +1 @@
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,MAqHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AA4BjD,QAAA,MAAM,MAAM,EAAE,MAsHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}