opencode-acp 1.14.10 → 1.14.11

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
@@ -492,6 +492,15 @@ For the complete list with root cause analysis, see the [bug tracker](https://gi
492
492
 
493
493
  ## Changelog
494
494
 
495
+ ### v1.14.11 — Stable Release (1 PR since v1.14.10)
496
+
497
+ Stable release with the omo-system-reminder filter fix and configurable `keepLast`.
498
+
499
+ **PRs included**:
500
+ - **#268** — Fix (issue #267): `omo-system-reminder` filter was stripping ALL `<system-reminder>` blocks from messages, deleting background task notifications and preventing the main session from recovering subagent results. Rewrote to v1.2.0: `keepLastOnly: true, keepLast: 2` — keeps the 2 most recent matches, drops older duplicates. Also adds framework-level configurable `keepLast` field so users can override how many recent matches to keep per `keepLastOnly` filter (default 1, clamped to minimum 1).
501
+
502
+ **Install**: `opencode plugin opencode-acp@stable --global`
503
+
495
504
  ### v1.14.10 — Stable Release (1 PR since v1.14.9)
496
505
 
497
506
  Stable release with the omo-mode-injection filter fix.
package/README.zh-CN.md CHANGED
@@ -446,6 +446,15 @@ ACP 是 DCP 的直接替代品。迁移步骤:
446
446
 
447
447
  ## 更新日志
448
448
 
449
+ ### v1.14.11 — 正式版(v1.14.10 以来 1 个 PR)
450
+
451
+ 正式版发布,包含 omo-system-reminder 过滤器修复和可配置 `keepLast`。
452
+
453
+ **包含的 PR**:
454
+ - **#268** — 修复(issue #267):`omo-system-reminder` 过滤器删除所有 `<system-reminder>` 块,导致后台任务通知丢失、主会话无法恢复子代理结果。改为 v1.2.0:`keepLastOnly: true, keepLast: 2` — 保留最近 2 条匹配,丢弃更早的重复。同时添加框架级可配置 `keepLast` 字段,用户可覆盖每个 `keepLastOnly` 过滤器保留最近几条(默认 1,最小 1)。
455
+
456
+ **安装**:`opencode plugin opencode-acp@stable --global`
457
+
449
458
  ### v1.14.10 — 正式版(v1.14.9 以来 1 个 PR)
450
459
 
451
460
  正式版发布,包含 omo-mode-injection 过滤器修复。
package/dist/index.js CHANGED
@@ -8831,7 +8831,7 @@ import { writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
8831
8831
  import { join as join3 } from "path";
8832
8832
  import { existsSync as existsSync3 } from "fs";
8833
8833
  import { homedir as homedir3 } from "os";
8834
- var LOG_VERSION = true ? "1.14.10" : "dev";
8834
+ var LOG_VERSION = true ? "1.14.11" : "dev";
8835
8835
  var Logger = class {
8836
8836
  logDir;
8837
8837
  enabled;
@@ -9999,7 +9999,9 @@ function applyMessageFilters(messages, config, logger, ctx) {
9999
9999
  }
10000
10000
  const keepLastFilters = allFilters.filter((f) => f.keepLastOnly);
10001
10001
  for (const filter of keepLastFilters) {
10002
- let foundLast = false;
10002
+ const fcKeepLast = config.filters?.[filter.name]?.keepLast;
10003
+ const keepCount = Math.max(1, fcKeepLast ?? filter.keepLast ?? 1);
10004
+ let kept = 0;
10003
10005
  for (let i = messages.length - 1; i >= 0; i--) {
10004
10006
  const msg = messages[i];
10005
10007
  const role = msg.info.role ?? "unknown";
@@ -10017,13 +10019,13 @@ function applyMessageFilters(messages, config, logger, ctx) {
10017
10019
  continue;
10018
10020
  }
10019
10021
  if (decision.action !== "drop" && decision.action !== "modify") continue;
10020
- if (foundLast) {
10021
- applyDecision(part, { action: "drop", reason: `keepLastOnly: earlier occurrence` }, filter.name, i, text);
10022
- } else {
10023
- foundLast = true;
10022
+ if (kept < keepCount) {
10023
+ kept++;
10024
10024
  if (decision.action === "modify" && decision.text !== void 0) {
10025
10025
  applyDecision(part, decision, filter.name, i, text);
10026
10026
  }
10027
+ } else {
10028
+ applyDecision(part, { action: "drop", reason: `keepLastOnly(${keepCount}): earlier occurrence` }, filter.name, i, text);
10027
10029
  }
10028
10030
  }
10029
10031
  }
@@ -10042,41 +10044,18 @@ function applyMessageFilters(messages, config, logger, ctx) {
10042
10044
  // lib/messages/filter/builtin/omo-system-reminder.ts
10043
10045
  var SYSTEM_REMINDER_OPEN = "<system-reminder>";
10044
10046
  var OMO_MARKER = "<!-- OMO_INTERNAL_INITIATOR -->";
10045
- var PAIRED_BLOCK_RE = /<system-reminder>[\s\S]*?<\/system-reminder>\s*<!-- OMO_INTERNAL_INITIATOR -->/g;
10046
- var LONE_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
10047
- var LONE_MARKER_RE = /<!-- OMO_INTERNAL_INITIATOR -->/g;
10048
10047
  var OMO_SYSTEM_REMINDER_FILTER = {
10049
10048
  name: "omo-system-reminder",
10050
- version: "1.0.0",
10051
- description: "Strip OMO <system-reminder> blocks and OMO_INTERNAL_INITIATOR markers from user messages",
10049
+ version: "1.2.0",
10050
+ description: "Keep only the 2 most recent OMO <system-reminder> messages, drop older ones",
10051
+ keepLastOnly: true,
10052
+ keepLast: 2,
10052
10053
  filter(ctx) {
10053
10054
  if (ctx.role !== "user") return { action: "keep" };
10054
10055
  if (!ctx.text.includes(SYSTEM_REMINDER_OPEN) && !ctx.text.includes(OMO_MARKER)) {
10055
10056
  return { action: "keep" };
10056
10057
  }
10057
- let modified = ctx.text;
10058
- let removedBlocks = 0;
10059
- modified = modified.replace(PAIRED_BLOCK_RE, () => {
10060
- removedBlocks++;
10061
- return "";
10062
- });
10063
- modified = modified.replace(LONE_REMINDER_RE, () => {
10064
- removedBlocks++;
10065
- return "";
10066
- });
10067
- modified = modified.replace(LONE_MARKER_RE, "");
10068
- modified = modified.replace(/\n{3,}/g, "\n\n").trim();
10069
- if (modified.length === 0) {
10070
- return { action: "drop", reason: `Stripped ${removedBlocks} OMO system-reminder block(s)` };
10071
- }
10072
- if (modified !== ctx.text) {
10073
- return {
10074
- action: "modify",
10075
- text: modified,
10076
- reason: `Stripped ${removedBlocks} OMO system-reminder block(s)`
10077
- };
10078
- }
10079
- return { action: "keep" };
10058
+ return { action: "drop", reason: "OMO system-reminder match (keepLast dedup)" };
10080
10059
  }
10081
10060
  };
10082
10061