opencode-acp 1.14.7 → 1.14.8-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.
Files changed (87) hide show
  1. package/README.md +23 -25
  2. package/README.zh-CN.md +23 -25
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1747 -2831
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/commands/compression-targets.d.ts +0 -1
  7. package/dist/lib/commands/compression-targets.d.ts.map +1 -1
  8. package/dist/lib/commands/index.d.ts +1 -4
  9. package/dist/lib/commands/index.d.ts.map +1 -1
  10. package/dist/lib/commands/stats.d.ts +8 -4
  11. package/dist/lib/commands/stats.d.ts.map +1 -1
  12. package/dist/lib/compress/decompress.d.ts.map +1 -1
  13. package/dist/lib/compress/hide-consumed.d.ts +4 -0
  14. package/dist/lib/compress/hide-consumed.d.ts.map +1 -1
  15. package/dist/lib/compress/hide-failed.d.ts +3 -0
  16. package/dist/lib/compress/hide-failed.d.ts.map +1 -0
  17. package/dist/lib/compress/index.d.ts +1 -1
  18. package/dist/lib/compress/index.d.ts.map +1 -1
  19. package/dist/lib/compress/parts.d.ts +4 -0
  20. package/dist/lib/compress/parts.d.ts.map +1 -0
  21. package/dist/lib/compress/pipeline.d.ts +0 -1
  22. package/dist/lib/compress/pipeline.d.ts.map +1 -1
  23. package/dist/lib/compress/status.d.ts +15 -0
  24. package/dist/lib/compress/status.d.ts.map +1 -1
  25. package/dist/lib/config-validation.d.ts.map +1 -1
  26. package/dist/lib/config.d.ts +7 -11
  27. package/dist/lib/config.d.ts.map +1 -1
  28. package/dist/lib/hooks.d.ts.map +1 -1
  29. package/dist/lib/messages/filter/apply.d.ts +14 -0
  30. package/dist/lib/messages/filter/apply.d.ts.map +1 -0
  31. package/dist/lib/messages/filter/builtin/index.d.ts +2 -0
  32. package/dist/lib/messages/filter/builtin/index.d.ts.map +1 -0
  33. package/dist/lib/messages/filter/builtin/omo-context.d.ts +4 -0
  34. package/dist/lib/messages/filter/builtin/omo-context.d.ts.map +1 -0
  35. package/dist/lib/messages/filter/builtin/omo-mode-injection.d.ts +4 -0
  36. package/dist/lib/messages/filter/builtin/omo-mode-injection.d.ts.map +1 -0
  37. package/dist/lib/messages/filter/builtin/omo-system-reminder.d.ts +4 -0
  38. package/dist/lib/messages/filter/builtin/omo-system-reminder.d.ts.map +1 -0
  39. package/dist/lib/messages/filter/builtin/omo-task-directive.d.ts +4 -0
  40. package/dist/lib/messages/filter/builtin/omo-task-directive.d.ts.map +1 -0
  41. package/dist/lib/messages/filter/builtin/omo-todo-continuation.d.ts +4 -0
  42. package/dist/lib/messages/filter/builtin/omo-todo-continuation.d.ts.map +1 -0
  43. package/dist/lib/messages/filter/index.d.ts +6 -0
  44. package/dist/lib/messages/filter/index.d.ts.map +1 -0
  45. package/dist/lib/messages/filter/registry.d.ts +6 -0
  46. package/dist/lib/messages/filter/registry.d.ts.map +1 -0
  47. package/dist/lib/messages/filter/types.d.ts +88 -0
  48. package/dist/lib/messages/filter/types.d.ts.map +1 -0
  49. package/dist/lib/messages/inject/inject.d.ts.map +1 -1
  50. package/dist/lib/messages/inject/utils.d.ts +1 -5
  51. package/dist/lib/messages/inject/utils.d.ts.map +1 -1
  52. package/dist/lib/messages/priority.d.ts +1 -1
  53. package/dist/lib/messages/priority.d.ts.map +1 -1
  54. package/dist/lib/messages/query.d.ts +1 -1
  55. package/dist/lib/messages/query.d.ts.map +1 -1
  56. package/dist/lib/prompts/extensions/system.d.ts +0 -1
  57. package/dist/lib/prompts/extensions/system.d.ts.map +1 -1
  58. package/dist/lib/prompts/index.d.ts +1 -1
  59. package/dist/lib/prompts/index.d.ts.map +1 -1
  60. package/dist/lib/prompts/store.d.ts +1 -3
  61. package/dist/lib/prompts/store.d.ts.map +1 -1
  62. package/dist/lib/prompts/system.d.ts +1 -1
  63. package/dist/lib/prompts/system.d.ts.map +1 -1
  64. package/dist/lib/state/persistence.d.ts.map +1 -1
  65. package/dist/lib/state/rebuild.d.ts.map +1 -1
  66. package/dist/lib/state/state.d.ts +2 -2
  67. package/dist/lib/state/state.d.ts.map +1 -1
  68. package/dist/lib/state/tool-cache.d.ts.map +1 -1
  69. package/dist/lib/state/types.d.ts +0 -6
  70. package/dist/lib/state/types.d.ts.map +1 -1
  71. package/dist/lib/token-utils.d.ts +14 -0
  72. package/dist/lib/token-utils.d.ts.map +1 -1
  73. package/package.json +1 -1
  74. package/dist/lib/commands/decompress.d.ts +0 -12
  75. package/dist/lib/commands/decompress.d.ts.map +0 -1
  76. package/dist/lib/commands/help.d.ts +0 -17
  77. package/dist/lib/commands/help.d.ts.map +0 -1
  78. package/dist/lib/commands/manual.d.ts +0 -23
  79. package/dist/lib/commands/manual.d.ts.map +0 -1
  80. package/dist/lib/commands/recompress.d.ts +0 -12
  81. package/dist/lib/commands/recompress.d.ts.map +0 -1
  82. package/dist/lib/compress/message-utils.d.ts +0 -8
  83. package/dist/lib/compress/message-utils.d.ts.map +0 -1
  84. package/dist/lib/compress/message.d.ts +0 -4
  85. package/dist/lib/compress/message.d.ts.map +0 -1
  86. package/dist/lib/prompts/compress-message.d.ts +0 -2
  87. package/dist/lib/prompts/compress-message.d.ts.map +0 -1
package/README.md CHANGED
@@ -17,7 +17,7 @@ The model decides <em>when</em> and <em>what</em> to compress — not a hard lim
17
17
  </p>
18
18
 
19
19
  <p align="center">
20
- <code>opencode plugin opencode-acp@latest --global</code>
20
+ <code>opencode plugin opencode-acp@stable --global</code>
21
21
  </p>
22
22
 
23
23
  ---
@@ -70,7 +70,7 @@ across all other sessions.
70
70
  ## Installation
71
71
 
72
72
  ```bash
73
- opencode plugin opencode-acp@latest --global
73
+ opencode plugin opencode-acp@stable --global
74
74
  ```
75
75
 
76
76
  Or add to your opencode config:
@@ -78,7 +78,7 @@ Or add to your opencode config:
78
78
  ```json
79
79
  {
80
80
  "plugin": {
81
- "opencode-acp": "latest"
81
+ "opencode-acp": "stable"
82
82
  }
83
83
  }
84
84
  ```
@@ -253,8 +253,6 @@ ACP uses its own config file, searched in order:
253
253
  2. **Custom config directory:** `$OPENCODE_CONFIG_DIR/acp.jsonc` (or `acp.json`), if `OPENCODE_CONFIG_DIR` is set
254
254
  3. **Project:** `.opencode/acp.jsonc` (or `acp.json`) in your project's `.opencode` directory
255
255
 
256
- If no `acp.jsonc` is found, ACP falls back to `dcp.jsonc` / `dcp.json` (for backward compatibility with existing DCP installations) and auto-migrates on first write.
257
-
258
256
  Each level overrides the previous, so project settings take priority over global. Restart OpenCode after making config changes.
259
257
 
260
258
  > **📖 Full parameter reference:** See [CONFIGURATION.md](./CONFIGURATION.md) for a complete reference of every configurable parameter with type, default value, and description.
@@ -300,14 +298,6 @@ Each level overrides the previous, so project settings take priority over global
300
298
  },
301
299
  // Manual mode: disables autonomous context management,
302
300
  // tools only run when explicitly triggered via /acp commands
303
- "manualMode": {
304
- "enabled": false,
305
- },
306
- // Protect from pruning for <turns> message turns past tool invocation
307
- "turnProtection": {
308
- "enabled": false,
309
- "turns": 4,
310
- },
311
301
  // Experimental settings
312
302
  "experimental": {
313
303
  // Allow ACP processing in subagent sessions
@@ -323,7 +313,6 @@ Each level overrides the previous, so project settings take priority over global
323
313
  "compress": {
324
314
  // Compression mode: "range" (compress spans into block summaries)
325
315
  // or experimental "message" (compress individual raw messages)
326
- "mode": "range",
327
316
  // Permission mode: "allow" (no prompt), "ask" (prompt), "deny" (tool not registered)
328
317
  "permission": "allow",
329
318
  // Show compression content in a chat notification
@@ -446,25 +435,19 @@ For the `compress` tool, `compress.protectedTools` ensures specific tool outputs
446
435
  ACP is a drop-in replacement for DCP. To migrate:
447
436
 
448
437
  1. Remove the old DCP plugin from your `opencode.json`
449
- 2. Install ACP: `opencode plugin install opencode-acp@latest --global`
450
- 3. Restart OpenCode
451
-
452
- **What's preserved:**
453
-
454
- - Session state (compression blocks, message ID mappings) -- auto-migrated from `plugin/dcp/` to `~/.local/share/opencode/storage/plugin/acp/`
455
- - Config file `~/.config/opencode/dcp.jsonc` -- ACP auto-migrates to `acp.jsonc`
456
- - Prompt overrides in `~/.config/opencode/dcp-prompts/` -- auto-migrates to `acp-prompts/`
438
+ 2. Install ACP: `opencode plugin install opencode-acp@stable --global`
439
+ 3. Copy your config: `cp ~/.config/opencode/dcp.jsonc ~/.config/opencode/acp.jsonc`
440
+ 4. Copy prompt overrides (if any): `cp -r ~/.config/opencode/dcp-prompts ~/.config/opencode/acp-prompts`
441
+ 5. Copy session state (optional, preserves compression blocks): `cp -r ~/.local/share/opencode/storage/plugin/dcp ~/.local/share/opencode/storage/plugin/acp`
442
+ 6. Restart OpenCode
457
443
 
458
444
  **What changes:**
459
445
 
460
- - Storage directory: `plugin/dcp/` to `plugin/acp/` (auto-migrated on first launch)
461
446
  - Log directory: `logs/dcp/` to `logs/acp/`
462
447
  - Slash command: `/dcp` to `/acp` (both work for backward compatibility)
463
448
  - Notification headers: `DCP` to `ACP`
464
449
  - Context usage label: `DCP threshold` to `ACP threshold`
465
450
 
466
- ACP auto-migrates config from `dcp.jsonc` to `acp.jsonc` and prompts from `dcp-prompts/` to `acp-prompts/` on first launch.
467
-
468
451
  ---
469
452
 
470
453
  <details>
@@ -509,6 +492,21 @@ For the complete list with root cause analysis, see the [bug tracker](https://gi
509
492
 
510
493
  ## Changelog
511
494
 
495
+ ### v1.14.8-dev.1 — Dev Prerelease (7 PRs since v1.14.7)
496
+
497
+ Dev prerelease covering PRs #238–#242. Published to `dev` npm tag for early testing.
498
+
499
+ **PRs included**:
500
+ - **#238** — E2E hardening: observation recording, T2 cadence regression scenario, consumed-call hiding scenario, auxiliary call filtering. 12 E2E scenarios (was 8).
501
+ - **#232** — Refactor: remove dead `turnProtection` config + DCP migration code.
502
+ - **#234** — Re-add `/acp stats` as `acp_status` wrapper.
503
+ - **#239** — Pluggable message filter for third-party injection cleanup.
504
+ - **#240** — Fix: splice orphan messages (only structural parts remain after consumed compress removal).
505
+ - **#241** — System token breakdown in `acp_status` + nudge; hide context fill percentage from model; consolidate 4 duplicate estimations into 1 shared `estimateSystemPromptTokens()`.
506
+ - **#242** — `keepLastOnly` dedup mechanism + 4 OMO builtin filters.
507
+
508
+ **Install**: `opencode plugin opencode-acp@dev --global`
509
+
512
510
  ### v1.14.7 — Deduplicate HOW_TO_COMPRESS_RULES (PR #228)
513
511
 
514
512
  **Problem**: `HOW_TO_COMPRESS_RULES` (~1.2K tokens) was injected 3-4 times per nudge turn — once in the system prompt, 1-2 times in nudge templates (turn/iteration/context-limit), and again in the breakdown block. In non-maxLimit scenarios the suffix message alone contained the rules 2-3 times. This wasted 2.4-3.6K tokens per nudge turn. The duplication became visible in v1.14.6 which persists debug nudge text to chat UI.
package/README.zh-CN.md CHANGED
@@ -17,7 +17,7 @@
17
17
  </p>
18
18
 
19
19
  <p align="center">
20
- <code>opencode plugin opencode-acp@latest --global</code>
20
+ <code>opencode plugin opencode-acp@stable --global</code>
21
21
  </p>
22
22
 
23
23
  ---
@@ -57,7 +57,7 @@ ACP 将上下文管理的所有权限全部交给模型自己,而不依靠外
57
57
  ## 安装
58
58
 
59
59
  ```bash
60
- opencode plugin opencode-acp@latest --global
60
+ opencode plugin opencode-acp@stable --global
61
61
  ```
62
62
 
63
63
  或者添加到你的 opencode 配置中:
@@ -65,7 +65,7 @@ opencode plugin opencode-acp@latest --global
65
65
  ```json
66
66
  {
67
67
  "plugin": {
68
- "opencode-acp": "latest"
68
+ "opencode-acp": "stable"
69
69
  }
70
70
  }
71
71
  ```
@@ -208,8 +208,6 @@ ACP 使用自己的配置文件,按以下顺序搜索:
208
208
  2. **自定义配置目录:** `$OPENCODE_CONFIG_DIR/acp.jsonc`(或 `acp.json`),当设置了 `OPENCODE_CONFIG_DIR` 时
209
209
  3. **项目级:** 项目 `.opencode` 目录下的 `.opencode/acp.jsonc`(或 `acp.json`)
210
210
 
211
- 如果未找到 `acp.jsonc`,ACP 会回退到 `dcp.jsonc` / `dcp.json`(用于与现有 DCP 安装向后兼容),并在首次写入时自动迁移。
212
-
213
211
  每一层覆盖前一层,因此项目设置优先于全局设置。修改配置后请重启 OpenCode。
214
212
 
215
213
  > **📖 完整参数参考:** 请查看 [CONFIGURATION.zh-CN.md](./CONFIGURATION.zh-CN.md)(中文)或 [CONFIGURATION.md](./CONFIGURATION.md)(英文),包含每个可配置参数的类型、默认值和详细说明。
@@ -255,14 +253,6 @@ ACP 使用自己的配置文件,按以下顺序搜索:
255
253
  },
256
254
  // Manual mode: disables autonomous context management,
257
255
  // tools only run when explicitly triggered via /acp commands
258
- "manualMode": {
259
- "enabled": false,
260
- },
261
- // Protect from pruning for <turns> message turns past tool invocation
262
- "turnProtection": {
263
- "enabled": false,
264
- "turns": 4,
265
- },
266
256
  // Experimental settings
267
257
  "experimental": {
268
258
  // Allow ACP processing in subagent sessions
@@ -278,7 +268,6 @@ ACP 使用自己的配置文件,按以下顺序搜索:
278
268
  "compress": {
279
269
  // Compression mode: "range" (compress spans into block summaries)
280
270
  // or experimental "message" (compress individual raw messages)
281
- "mode": "range",
282
271
  // Permission mode: "allow" (no prompt), "ask" (prompt), "deny" (tool not registered)
283
272
  "permission": "allow",
284
273
  // Show compression content in a chat notification
@@ -400,25 +389,19 @@ ACP 暴露六个可编辑的 prompt:
400
389
  ACP 是 DCP 的直接替代品。迁移步骤:
401
390
 
402
391
  1. 从 `opencode.json` 中移除旧的 DCP 插件
403
- 2. 安装 ACP:`opencode plugin install opencode-acp@latest --global`
404
- 3. 重启 OpenCode
405
-
406
- **保留的内容:**
407
-
408
- - 会话状态(压缩块、消息 ID 映射) — 自动从 `plugin/dcp/` 迁移到 `~/.local/share/opencode/storage/plugin/acp/`
409
- - 配置文件 `~/.config/opencode/dcp.jsonc` — ACP 自动迁移到 `acp.jsonc`
410
- - `~/.config/opencode/dcp-prompts/` 中的 prompt 覆盖 — 自动迁移到 `acp-prompts/`
392
+ 2. 安装 ACP:`opencode plugin install opencode-acp@stable --global`
393
+ 3. 复制配置:`cp ~/.config/opencode/dcp.jsonc ~/.config/opencode/acp.jsonc`
394
+ 4. 复制 prompt 覆盖(如有):`cp -r ~/.config/opencode/dcp-prompts ~/.config/opencode/acp-prompts`
395
+ 5. 复制会话状态(可选,保留压缩块):`cp -r ~/.local/share/opencode/storage/plugin/dcp ~/.local/share/opencode/storage/plugin/acp`
396
+ 6. 重启 OpenCode
411
397
 
412
398
  **变更的内容:**
413
399
 
414
- - 存储目录:`plugin/dcp/` → `plugin/acp/`(首次启动时自动迁移)
415
400
  - 日志目录:`logs/dcp/` → `logs/acp/`
416
401
  - 斜杠命令:`/dcp` → `/acp`(两者均可用于向后兼容)
417
402
  - 通知标题:`DCP` → `ACP`
418
403
  - 上下文用量标签:`DCP threshold` → `ACP threshold`
419
404
 
420
- ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将 prompt 从 `dcp-prompts/` 迁移到 `acp-prompts/`。
421
-
422
405
  ---
423
406
 
424
407
  <details>
@@ -463,6 +446,21 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
463
446
 
464
447
  ## 更新日志
465
448
 
449
+ ### v1.14.8-dev.1 — Dev 预发布(v1.14.7 以来 7 个 PR)
450
+
451
+ Dev 预发布,涵盖 PR #238–#242。发布到 `dev` npm tag 供早期测试。
452
+
453
+ **包含的 PR**:
454
+ - **#238** — E2E 强化:观察记录、T2 节奏回归场景、consumed-call 隐藏场景、辅助调用过滤。E2E 场景 8→12 个。
455
+ - **#232** — 重构:移除死代码 `turnProtection` 配置 + DCP 迁移代码。
456
+ - **#234** — 重新添加 `/acp stats` 作为 `acp_status` 的封装。
457
+ - **#239** — 可插拔消息过滤器,用于第三方注入清理。
458
+ - **#240** — 修复:splice 孤儿消息(consumed compress 移除后仅剩结构化部分)。
459
+ - **#241** — `acp_status` + nudge 中的系统 token 分类;隐藏上下文填充百分比;4 处重复估算整合为 1 个共享 `estimateSystemPromptTokens()`。
460
+ - **#242** — `keepLastOnly` 去重机制 + 4 个 OMO 内置过滤器。
461
+
462
+ **安装**:`opencode plugin opencode-acp@dev --global`
463
+
466
464
  ### v1.14.7 — 去重 HOW_TO_COMPRESS_RULES(PR #228)
467
465
 
468
466
  **问题**:`HOW_TO_COMPRESS_RULES`(~1.2K tokens)每次 nudge 注入重复 3-4 次——系统提示词 1 次、nudge 模板 1-2 次、breakdown 块 1 次。非 maxLimit 场景下 suffix 消息单独就包含 2-3 份规则。每次 nudge 浪费 2.4-3.6K tokens。v1.14.6 让 debug 模式持久化 nudge 文本到聊天界面后,重复变得可见。
@@ -1 +1 @@
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,MAoHK,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;AA2BjD,QAAA,MAAM,MAAM,EAAE,MAiHK,CAAA;AAEnB,eAAe,MAAM,CAAA"}