opencode-acp 1.14.9 → 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,24 @@ 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
+
504
+ ### v1.14.10 — Stable Release (1 PR since v1.14.9)
505
+
506
+ Stable release with the omo-mode-injection filter fix.
507
+
508
+ **PRs included**:
509
+ - **#263** — Fix: `omo-mode-injection` filter was dropping entire user messages when OMO mode injections (`<ultrawork-mode>`, `[search-mode]`, etc.) were prepended to user content. Mode injections are prepended via `UserPromptSubmit.additionalContext`, not standalone — the old filter (v1.0.0) matched the injection and returned `drop`, clearing the entire message including the user's actual request. Rewrote to v1.1.0: strips injection blocks and preserves user content via `modify`. Also fixes config validation (messageFilters.filters dynamic key skip) and adds messageFilters to dcp.schema.json.
510
+
511
+ **Install**: `opencode plugin opencode-acp@stable --global`
512
+
495
513
  ### v1.14.9 — Stable Release (3 PRs since v1.14.8)
496
514
 
497
515
  Stable release with nudge loop fix, holistic T2/T3 compression prompts, and multi-entry compress format documentation.
@@ -503,6 +521,15 @@ Stable release with nudge loop fix, holistic T2/T3 compression prompts, and mult
503
521
 
504
522
  **Install**: `opencode plugin opencode-acp@stable --global`
505
523
 
524
+ ### v1.14.9-dev.2 — Dev Prerelease (1 PR since v1.14.9-dev.1)
525
+
526
+ Dev prerelease covering PR #263. Published to `dev` npm tag for early testing.
527
+
528
+ **PRs included**:
529
+ - **#263** — Fix: `omo-mode-injection` filter was dropping entire user messages when OMO mode injections (`<ultrawork-mode>`, `[search-mode]`, etc.) were prepended to user content. Mode injections are prepended via `UserPromptSubmit.additionalContext`, not standalone — the old filter (v1.0.0) matched the injection and returned `drop`, clearing the entire message including the user's actual request. Rewrote to v1.1.0: strips injection blocks and preserves user content via `modify`. Also fixes config validation (messageFilters.filters dynamic key skip) and adds messageFilters to dcp.schema.json.
530
+
531
+ **Install**: `opencode plugin opencode-acp@dev --global`
532
+
506
533
  ### v1.14.9-dev.1 — Dev Prerelease (1 PR since v1.14.8-dev.5)
507
534
 
508
535
  Dev prerelease covering PR #259. Published to `dev` npm tag for early testing.
package/README.zh-CN.md CHANGED
@@ -446,6 +446,24 @@ 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
+
458
+ ### v1.14.10 — 正式版(v1.14.9 以来 1 个 PR)
459
+
460
+ 正式版发布,包含 omo-mode-injection 过滤器修复。
461
+
462
+ **包含的 PR**:
463
+ - **#263** — 修复:`omo-mode-injection` 过滤器在 OMO 模式注入(`<ultrawork-mode>`、`[search-mode]` 等)被前置到用户消息时,会丢弃整个用户消息。模式注入通过 `UserPromptSubmit.additionalContext` 前置,不是独立消息——旧过滤器(v1.0.0)匹配到注入就返回 `drop`,清空了整个消息包括用户的实际请求。重写为 v1.1.0:剥离注入块、通过 `modify` 保留用户内容。同时修复配置校验(messageFilters.filters 动态键跳过)并补充 dcp.schema.json。
464
+
465
+ **安装**:`opencode plugin opencode-acp@stable --global`
466
+
449
467
  ### v1.14.9 — 正式版(v1.14.8 以来 3 个 PR)
450
468
 
451
469
  正式版发布,包含 nudge 循环修复、整体式 T2/T3 压缩提示词、多条目 compress 格式文档。
@@ -457,6 +475,15 @@ ACP 是 DCP 的直接替代品。迁移步骤:
457
475
 
458
476
  **安装**:`opencode plugin opencode-acp@stable --global`
459
477
 
478
+ ### v1.14.9-dev.2 — Dev 预发布(v1.14.9-dev.1 以来 1 个 PR)
479
+
480
+ Dev 预发布,覆盖 PR #263。已发布到 `dev` npm 标签供早期测试。
481
+
482
+ **包含的 PR**:
483
+ - **#263** — 修复:`omo-mode-injection` 过滤器在 OMO 模式注入(`<ultrawork-mode>`、`[search-mode]` 等)被前置到用户消息时,会丢弃整个用户消息。模式注入通过 `UserPromptSubmit.additionalContext` 前置,不是独立消息——旧过滤器(v1.0.0)匹配到注入就返回 `drop`,清空了整个消息包括用户的实际请求。重写为 v1.1.0:剥离注入块、通过 `modify` 保留用户内容。同时修复配置校验(messageFilters.filters 动态键跳过)并补充 dcp.schema.json。
484
+
485
+ **安装**:`opencode plugin opencode-acp@dev --global`
486
+
460
487
  ### v1.14.9-dev.1 — Dev 预发布(v1.14.8-dev.5 以来 1 个 PR)
461
488
 
462
489
  Dev 预发布,涵盖 PR #259。发布到 `dev` npm tag 供早期测试。
package/dist/index.js CHANGED
@@ -929,7 +929,7 @@ function getConfigKeyPaths(obj, prefix = "") {
929
929
  for (const key of Object.keys(obj)) {
930
930
  const fullKey = prefix ? `${prefix}.${key}` : key;
931
931
  keys.push(fullKey);
932
- if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits") {
932
+ if (fullKey === "compress.modelMaxLimits" || fullKey === "compress.modelMinLimits" || fullKey === "messageFilters.filters") {
933
933
  continue;
934
934
  }
935
935
  if (obj[key] && typeof obj[key] === "object" && !Array.isArray(obj[key])) {
@@ -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.9" : "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
 
@@ -10134,17 +10113,62 @@ var OMO_TASK_FILTER = {
10134
10113
  };
10135
10114
 
10136
10115
  // lib/messages/filter/builtin/omo-mode-injection.ts
10137
- var MODE_PATTERNS = ["[search-mode]", "[analyze-mode]", "<ultrawork-mode>", "[ultrawork-mode]"];
10116
+ var XML_MODE_TAGS = [
10117
+ { open: "<hyperplan-ultrawork-mode>", close: "</hyperplan-ultrawork-mode>" },
10118
+ { open: "<ultrawork-mode>", close: "</ultrawork-mode>" }
10119
+ ];
10120
+ var BRACKET_MODE_PATTERNS = ["[search-mode]", "[analyze-mode]", "[ultrawork-mode]"];
10121
+ function stripLeadingModeInjections(text) {
10122
+ let current = text;
10123
+ let strippedAny = false;
10124
+ for (let iter = 0; iter < 5; iter++) {
10125
+ current = current.trimStart();
10126
+ let matched = false;
10127
+ for (const { open, close } of XML_MODE_TAGS) {
10128
+ if (current.startsWith(open)) {
10129
+ const closeIdx = current.indexOf(close);
10130
+ if (closeIdx !== -1) {
10131
+ current = current.slice(closeIdx + close.length);
10132
+ } else {
10133
+ current = current.slice(open.length);
10134
+ }
10135
+ matched = true;
10136
+ break;
10137
+ }
10138
+ }
10139
+ if (!matched) {
10140
+ for (const pattern of BRACKET_MODE_PATTERNS) {
10141
+ if (current.startsWith(pattern)) {
10142
+ current = current.slice(pattern.length);
10143
+ matched = true;
10144
+ break;
10145
+ }
10146
+ }
10147
+ }
10148
+ if (matched) {
10149
+ strippedAny = true;
10150
+ } else {
10151
+ break;
10152
+ }
10153
+ }
10154
+ return strippedAny ? current.trim() : null;
10155
+ }
10138
10156
  var OMO_MODE_FILTER = {
10139
10157
  name: "omo-mode-injection",
10140
- version: "1.0.0",
10141
- description: "Strip OMO mode injection blocks ([search-mode], [analyze-mode], <ultrawork-mode>)",
10158
+ version: "1.1.0",
10159
+ description: "Strip OMO mode injection blocks (<ultrawork-mode>...</ultrawork-mode>, [search-mode], etc.) from user messages, preserving user content",
10142
10160
  filter(ctx) {
10143
10161
  if (ctx.role !== "user") return { action: "keep" };
10144
- const stripped = ctx.text.trimStart();
10145
- const isModeInjection = MODE_PATTERNS.some((p) => stripped.startsWith(p));
10146
- if (!isModeInjection) return { action: "keep" };
10147
- return { action: "drop", reason: "OMO mode injection" };
10162
+ const remaining = stripLeadingModeInjections(ctx.text);
10163
+ if (remaining === null) return { action: "keep" };
10164
+ if (remaining.length === 0) {
10165
+ return { action: "drop", reason: "OMO mode injection (no user content after stripping)" };
10166
+ }
10167
+ return {
10168
+ action: "modify",
10169
+ text: remaining,
10170
+ reason: "Stripped OMO mode injection block(s), preserved user content"
10171
+ };
10148
10172
  }
10149
10173
  };
10150
10174