opencode-acp 1.14.0 → 1.14.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 CHANGED
@@ -528,6 +528,14 @@ For the complete list with root cause analysis, see the [bug tracker](https://gi
528
528
 
529
529
  ## Changelog
530
530
 
531
+ ### v1.14.1 — Log Version Info + Growth Baseline Fix (PRs #205, #207)
532
+
533
+ **Problem**: Two issues since v1.14.0. (1) **Unidentifiable logs** (PR #205): ACP daily logs and per-request context logs carried no version marker, so when users shared debug logs it was impossible to tell which ACP version produced them — making regression triage across versions guesswork. (2) **Growth-baseline feedback loop in short sessions** (PR #207): When the growth threshold was met (`nudgeAllowed`) but every compressible range was filtered out (`nothingToCompress`, e.g. all ranges inside the protected zone in a short session or subagent), the code reset `state.nudges.lastPerMessageNudgeTokens = currentTokens`. This ate the accumulated growth every cycle, so the baseline chased the current context and the model never saw a nudge even though context had grown well past the threshold.
534
+
535
+ **Fix**: (1) PR #205 — `lib/logger.ts` now appends `| v={version}` to every daily-log line and writes a one-shot `_version` file under each per-request context-log directory. The version is injected at build time via a new `tsup.config.ts` `define: { ACP_VERSION: JSON.stringify(pkg.version) }` (read from `package.json`), with a `declare const ACP_VERSION` ambient declaration in `logger.ts`. Falls back to `"dev"` when the define is absent (e.g. tsx-run tests). (2) PR #207 — Removed the `lastPerMessageNudgeTokens = currentTokens` reset in the `nothingToCompress` branch of `lib/messages/inject/inject.ts`; only `lastNudgeShownTokens` is cleared now. Growth now accumulates across `nothingToCompress` turns until there genuinely is something to compress, at which point the nudge fires. Coverage: 3 tautological baseline-reset tests (which never called `injectCompressNudges`, violating AGENTS.md §5.6) were removed; a real E2E growth scenario in `tests/inject.test.ts` verifies baseline preservation through `nothingToCompress` turns and nudge firing once content exits the protected zone. Dual-authored with Sisyphus (co-authored-by trailer).
536
+
537
+ Files: `lib/logger.ts`, `tsup.config.ts`, `lib/messages/inject/inject.ts`. Tests: `tests/inject.test.ts` (E2E growth scenario added, 3 tautological tests removed from `tests/baseline-reset.test.ts`). No persisted-state schema changes. No config changes.
538
+
531
539
  ### v1.14.0 — Three-Tier Compression + Preserve-Recent + Summary Visibility Fix (PRs #200, #201, #202)
532
540
 
533
541
  **Problem**: Three critical issues for long-session stability. (1) **Summary accumulation** (PR #200): Summary blocks accumulated indefinitely (v1.13.5+ force-protection). At ~7.3K tokens/day growth rate, sessions hit the 100K summary ceiling in ~3 days. 92.5% of ancient blocks were shipped/historical work with zero actionable value. (2) **Active task loss** (PR #201): `lastSegmentSoftBlock` only protected the very last 1 message from compression. When the model compressed a range that included the current task context, the active work was lost — the recommendation list itself could point at messages that should have been protected. (3) **summaryBuffer over-counting** (PR #202): `getActiveSummaryTokenUsage()` counted ALL active blocks (e.g., 448 = 151K tokens), but only ~26 blocks had their compress calls in the visible context window. The inflated count caused false T2/T3 triggers and misleading `acp stats` output ("摘要 146%").
package/README.zh-CN.md CHANGED
@@ -482,6 +482,14 @@ ACP 在首次启动时自动将配置从 `dcp.jsonc` 迁移到 `acp.jsonc`,将
482
482
 
483
483
  ## 更新日志
484
484
 
485
+ ### v1.14.1 — 日志版本信息 + 增长基线修复(PR #205, #207)
486
+
487
+ **问题**:v1.14.0 之后的两个问题。(1) **日志无法识别版本**(PR #205):ACP daily 日志和每请求 context 日志没有任何版本标记,用户分享调试日志时无法判断是哪个 ACP 版本产生的 —— 跨版本回归排查只能靠猜。(2) **短会话中的增长基线反馈循环**(PR #207):当增长阈值已满足(`nudgeAllowed`)但所有可压缩范围都被过滤掉时(`nothingToCompress`,例如短会话或子代理中所有范围都在保护区内),旧代码会重置 `state.nudges.lastPerMessageNudgeTokens = currentTokens`。这会每轮吃掉累积增长,基线一路追逐当前上下文,即使上下文早已远超阈值,模型也永远等不到 nudge。
488
+
489
+ **修复**:(1) PR #205 —— `lib/logger.ts` 现在在每行 daily 日志末尾追加 `| v={version}`,并在每个每请求 context 日志目录下写一个一次性 `_version` 文件。版本通过新的 `tsup.config.ts` `define: { ACP_VERSION: JSON.stringify(pkg.version) }`(从 `package.json` 读取)在构建时注入,`logger.ts` 中有 `declare const ACP_VERSION` 环境声明。当 define 缺失时(例如 tsx 跑测试)回退为 `"dev"`。(2) PR #207 —— 移除了 `lib/messages/inject/inject.ts` 中 `nothingToCompress` 分支的 `lastPerMessageNudgeTokens = currentTokens` 重置;现在只清空 `lastNudgeShownTokens`。增长会在多个 `nothingToCompress` 轮次之间累积,直到确实有内容可压缩时 nudge 才触发。测试覆盖:删除了 3 个 taautological 的 baseline-reset 测试(这些测试从不调用 `injectCompressNudges`,违反 AGENTS.md §5.6);`tests/inject.test.ts` 中新增真实 E2E 增长场景,验证基线在 `nothingToCompress` 轮次间被保留、内容离开保护区后 nudge 触发。与 Sisyphus 合作完成(co-authored-by 署名)。
490
+
491
+ 文件:`lib/logger.ts`、`tsup.config.ts`、`lib/messages/inject/inject.ts`。测试:`tests/inject.test.ts`(新增 E2E 增长场景,`tests/baseline-reset.test.ts` 删除 3 个 tautological 测试)。无持久化 state schema 变更,无配置变更。
492
+
485
493
  ### v1.14.0 — 三级压缩 + 保留近期消息 + 摘要可见性修复(PR #200, #201, #202)
486
494
 
487
495
  **问题**:长会话稳定性三个关键问题。(1) **摘要累积**(PR #200):摘要块无限累积(v1.13.5+ 强制保护后),以每天约 7.3K token 增长,会话在约 3 天内触及 100K 摘要上限。92.5% 的旧块是已发布/历史工作,零可操作价值。(2) **活跃任务丢失**(PR #201):`lastSegmentSoftBlock` 仅保护最后 1 条消息不被压缩。当模型压缩包含当前任务上下文的范围时,活跃工作丢失——推荐列表本身可能指向应该被保护的消息。(3) **summaryBuffer 过度计数**(PR #202):`getActiveSummaryTokenUsage()` 计算了所有活跃块(如 448 块 = 151K token),但只有约 26 块的 compress 调用在可见上下文窗口中。虚高的计数导致错误的 T2/T3 触发和误导性的 `acp stats` 输出("摘要 146%")。
package/dist/index.js CHANGED
@@ -8637,8 +8637,7 @@ var injectCompressNudges = (state, config, logger, messages, prompts, compressio
8637
8637
  const allProtected = contextRanges.compressible.length === 0 && contextRanges.protected.length > 0;
8638
8638
  const nothingToCompress = filterSuppressed || allProtected;
8639
8639
  let shouldInject = nudgeAllowed && (!nothingToCompress || emergencyOverride);
8640
- if (nudgeAllowed && nothingToCompress && !emergencyOverride && currentTokens !== void 0) {
8641
- state.nudges.lastPerMessageNudgeTokens = currentTokens;
8640
+ if (nudgeAllowed && nothingToCompress && !emergencyOverride) {
8642
8641
  state.nudges.lastNudgeShownTokens = void 0;
8643
8642
  }
8644
8643
  if (suffixMessage && !shouldInject) {
@@ -10023,6 +10022,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
10023
10022
  import { join as join3 } from "path";
10024
10023
  import { existsSync as existsSync3 } from "fs";
10025
10024
  import { homedir as homedir3 } from "os";
10025
+ var LOG_VERSION = true ? "1.14.1" : "dev";
10026
10026
  var Logger = class {
10027
10027
  logDir;
10028
10028
  enabled;
@@ -10082,7 +10082,7 @@ var Logger = class {
10082
10082
  await this.ensureLogDir();
10083
10083
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
10084
10084
  const dataStr = this.formatData(data);
10085
- const logLine = `${timestamp} ${level.padEnd(5)} ${component}: ${message}${dataStr ? " | " + dataStr : ""}
10085
+ const logLine = `${timestamp} ${level.padEnd(5)} ${component}: ${message}${dataStr ? " | " + dataStr : ""} | v=${LOG_VERSION}
10086
10086
  `;
10087
10087
  const dailyLogDir = join3(this.logDir, "daily");
10088
10088
  if (!existsSync3(dailyLogDir)) {
@@ -10211,6 +10211,10 @@ var Logger = class {
10211
10211
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
10212
10212
  const contextFile = join3(contextDir, `${timestamp}.json`);
10213
10213
  await writeFile2(contextFile, JSON.stringify(minimized, null, 2));
10214
+ const versionFile = join3(contextDir, "_version");
10215
+ if (!existsSync3(versionFile)) {
10216
+ await writeFile2(versionFile, LOG_VERSION);
10217
+ }
10214
10218
  } catch (error) {
10215
10219
  }
10216
10220
  }