@te-river/opencode-team-mode 1.5.13 → 1.5.15

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 (74) hide show
  1. package/README.md +24 -5
  2. package/README.zh-CN.md +20 -4
  3. package/dist/agents.d.ts.map +1 -1
  4. package/dist/agents.js +4 -2
  5. package/dist/agents.js.map +1 -1
  6. package/dist/capabilities.d.ts +66 -0
  7. package/dist/capabilities.d.ts.map +1 -0
  8. package/dist/capabilities.js +165 -0
  9. package/dist/capabilities.js.map +1 -0
  10. package/dist/host-hooks.d.ts.map +1 -1
  11. package/dist/host-hooks.js +1 -0
  12. package/dist/host-hooks.js.map +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +35 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/prompts/lead.d.ts +1 -1
  17. package/dist/prompts/lead.d.ts.map +1 -1
  18. package/dist/prompts/lead.js +51 -0
  19. package/dist/prompts/lead.js.map +1 -1
  20. package/dist/prompts/shared.d.ts +2 -2
  21. package/dist/prompts/shared.d.ts.map +1 -1
  22. package/dist/prompts/shared.js +32 -6
  23. package/dist/prompts/shared.js.map +1 -1
  24. package/dist/tm/args-schema.d.ts.map +1 -1
  25. package/dist/tm/args-schema.js +8 -0
  26. package/dist/tm/args-schema.js.map +1 -1
  27. package/dist/tm/browser.d.ts +25 -0
  28. package/dist/tm/browser.d.ts.map +1 -1
  29. package/dist/tm/browser.js +90 -2
  30. package/dist/tm/browser.js.map +1 -1
  31. package/dist/tm/cache.d.ts +68 -0
  32. package/dist/tm/cache.d.ts.map +1 -0
  33. package/dist/tm/cache.js +157 -0
  34. package/dist/tm/cache.js.map +1 -0
  35. package/dist/tm/config.d.ts +43 -0
  36. package/dist/tm/config.d.ts.map +1 -1
  37. package/dist/tm/config.js +10 -0
  38. package/dist/tm/config.js.map +1 -1
  39. package/dist/tm/dispatch.d.ts +84 -2
  40. package/dist/tm/dispatch.d.ts.map +1 -1
  41. package/dist/tm/dispatch.js +397 -39
  42. package/dist/tm/dispatch.js.map +1 -1
  43. package/dist/tm/dupe-guard.d.ts +58 -0
  44. package/dist/tm/dupe-guard.d.ts.map +1 -0
  45. package/dist/tm/dupe-guard.js +105 -0
  46. package/dist/tm/dupe-guard.js.map +1 -0
  47. package/dist/tm/index.d.ts +5 -0
  48. package/dist/tm/index.d.ts.map +1 -1
  49. package/dist/tm/index.js +29 -2
  50. package/dist/tm/index.js.map +1 -1
  51. package/dist/tm/perm-ask.d.ts +1 -0
  52. package/dist/tm/perm-ask.d.ts.map +1 -1
  53. package/dist/tm/perm-ask.js +15 -1
  54. package/dist/tm/perm-ask.js.map +1 -1
  55. package/dist/tm/pipelines.d.ts.map +1 -1
  56. package/dist/tm/pipelines.js +11 -0
  57. package/dist/tm/pipelines.js.map +1 -1
  58. package/dist/tm/search.d.ts +5 -0
  59. package/dist/tm/search.d.ts.map +1 -1
  60. package/dist/tm/search.js +44 -4
  61. package/dist/tm/search.js.map +1 -1
  62. package/dist/tm/stats.d.ts +147 -0
  63. package/dist/tm/stats.d.ts.map +1 -0
  64. package/dist/tm/stats.js +383 -0
  65. package/dist/tm/stats.js.map +1 -0
  66. package/dist/tm/store.d.ts +3 -0
  67. package/dist/tm/store.d.ts.map +1 -1
  68. package/dist/tm/store.js +6 -1
  69. package/dist/tm/store.js.map +1 -1
  70. package/dist/tm/webfetch.d.ts +19 -0
  71. package/dist/tm/webfetch.d.ts.map +1 -1
  72. package/dist/tm/webfetch.js +70 -4
  73. package/dist/tm/webfetch.js.map +1 -1
  74. package/package.json +4 -2
package/README.md CHANGED
@@ -49,6 +49,7 @@ TeamMode's answer to each:
49
49
  | 🕳️ **Silent side effects** | R6/R2 approval gate: env-var reads and dangerous ops route through OpenCode's official confirmation dialog, auto-rejected after 1 unanswered minute (default). The plugin never approves on its own — it only ever rejects. |
50
50
  | 🌫️ **Hallucinated research** | Web access is a two-role grant with an allowlisted, governed tool chain. A fact that couldn't be fetched is reported as a gap — never fabricated. |
51
51
  | 🧭 **Walls of text** | Replies are steered into the shape the host renders fastest: a markdown table for per-file / per-case / per-finding results, fenced code for diffs and configs, a browser screenshot attached as an inline image only when you ask for one. The host does not draw mermaid, so no agent pretends it does. |
52
+ | 🎯 **Goal drift** | The lead opens with `GOAL:` in your own words plus checkable `ACCEPTANCE:` criteria, and the run does not end while a criterion lacks evidence — the only legitimate stops are named (blocked on you, or provably unachievable). When a round settles with items still open on the host's todo list, `tm_join` says 目标未达成 and lists them, and the goal is carried through context compaction so a summarized transcript cannot redefine it. |
52
53
 
53
54
  And the workflow discipline underneath: deterministic routing, a ≤30-line plan
54
55
  you approve before ≥2 dispatches execute, structured `STATUS/CHANGES/FINDINGS/
@@ -219,14 +220,27 @@ through with `tm_fetch` when it genuinely needs the payload.
219
220
  | `tm_ptc_run` | Batch orchestration: one program, N governed calls, zero LLM round-trips; web roles also get `tm.search` / `tm.webfetch` inside the program | all six agents |
220
221
  | `tm_search` | Multi-engine web search with extracted, deduplicated, RRF-fused hit lists | Lead + Researcher |
221
222
  | `tm_webfetch` | Single governed GET of an allowlisted page (search pages auto-extracted) | Lead + Researcher |
222
- | `tm_dispatch` / `tm_join` | **Async sub-agent dispatch**: `tm_dispatch` starts a specialist in its own child session and returns the id immediately (the built-in `task` tool blocks you until it finishes), `tm_join` collects — status snapshot, bounded `waitMs`, `cancel:true` to abort a runaway child; collected replies ride the offload pipeline, so five fat reports arrive as handles + previews instead of multiplying your context. Lead-only, and a child never dispatches | Lead only |
223
+ | `tm_dispatch` / `tm_join` | **Async sub-agent dispatch**: `tm_dispatch` starts a specialist in its own child session and returns the id immediately (the built-in `task` tool blocks you until it finishes), `tm_join` collects — status snapshot, bounded `waitMs`, `cancel:true` to abort a runaway child; collected replies ride the offload pipeline, so five fat reports arrive as handles + previews instead of multiplying your context. Lead-only, and a child never dispatches. Each child is a real session the user can open from the session tree (titled `<description> (@<agent> subagent ·tm)`) and one toast names it — because the tool card itself is not expandable | Lead only |
223
224
  | `tm_pty` | **Non-blocking command execution** on the host's own terminal sessions (`start`/`status`/`list`/`kill`) — independent builds and test suites overlap instead of queueing behind one 120 s bash call. Captures no output (the command tees its own log; read it with `tm_read`), and every start passes the R6 classifier, the R2 danger-face globs **and** the official confirmation dialog before a process exists | Lead only |
225
+ | `tm_stats` | **The plugin reads its own trajectory back**: tokens kept out of the context window by offloading (net of the preview that arrived), seconds saved by dispatch overlap (serial cost minus the wall window the children actually used), PTC internals, governance counts (blocked subresources, refused `tm_pty` starts, clamped bash timeouts, cache hits, redactions) — plus the **host capability matrix** (`已验证/存在未用/待观察/缺失/需人眼` per host surface). Read-only over files this plugin wrote; run it first after an OpenCode upgrade. `{ recent: 20 }` appends a call-by-call recap — handle + payload path for every offloaded result, which is how you see what a governed tool actually returned (the host gives plugin tools no expandable card) | All agents |
224
226
  | `tm_browser` | Interactive browser session (**your default browser**): 16 Playwright verbs (snapshot-first `take_snapshot` → uid-addressed `click`/`fill`/`drag`/…) + 5 legacy compat verbs (open/navigate/read/screenshot/close); Playwright engine needs Node ≥ 20, below that (or on any import failure) it auto-degrades to the legacy CDP engine. It drives YOUR default browser channel (an Edge Beta default opens Edge Beta), stays headful unless the operator sets `TM_BROWSER_HEADLESS`, loads a page's own images/CSS/JS via the `same-site` subresource policy, and `take_screenshot { image:true }` attaches a JPEG so the model can actually see the screen | Lead + Researcher + Tester (UI verification) |
225
227
 
226
- > **Fixed tool priority ladder (every task): ① TeamMode governed tools
227
- > (`tm_*`) → ② user MCP/plugin tools → ③ the model's own reasoning.**
228
- > It doubles as the fallback chain: when a governed tool errors (no browser
229
- > on this host, blocked host), the agent says so and drops to the next rung.
228
+ > **Fixed tool priority ladder (every task): ① the user's own MCP/plugin
229
+ > tools → ② TeamMode governed tools (`tm_*`) → ③ the model's own reasoning.**
230
+ > It doubles as the fallback chain: when a tool errors (no browser on this
231
+ > host, blocked host), the agent says so and drops to the next rung — and
232
+ > rung ③ is where a missing capability gets reported, never fabricated.
233
+ > One stated exception: on the **web** channel `tm_search` / `tm_webfetch` /
234
+ > `tm_browser` come first, because that path is the only one carrying the
235
+ > domain allowlist, the per-request confirmation dialog and the R6 red lines.
236
+
237
+ > **What the host UI cannot show you.** OpenCode renders a *plugin* tool call
238
+ > as a one-line card with no expandable body — its tool-renderer registry
239
+ > holds only the built-in tool names, and an extension cannot add to it. The
240
+ > governed output still exists: anything over the offload boundary is written
241
+ > to disk as a handle, and `tm_stats { recent: 20 }` prints the call-by-call
242
+ > recap with those handles and file paths, which you can open. Ask your agent
243
+ > for it — "what did that tool actually return?"
230
244
 
231
245
  All governed tools are **parallel-safe**: the host may run a batch of
232
246
  `tm_search` / `tm_webfetch` / `tm_fetch` calls concurrently — each call gets
@@ -474,6 +488,8 @@ for overrides, extra agents and disabling roles.
474
488
  | `TM_BROWSER_SNAPSHOT_MAX_TOKENS` | `1200` | hard cap on `take_snapshot` payloads |
475
489
  | `TM_BROWSER_SUBRESOURCE` | `same-site` | what a page may load after its navigation was allowed: `same-site` = images/media/fonts/stylesheets always, scripts/XHR only for a site this session actually opened; `passive` = only the passive types; `off` = the legacy every-request gate. Blocked requests surface as a "N 个子资源请求被拦截" note on the next snapshot |
476
490
  | `TM_BROWSER_IDLE_MS` | `180000` | an untouched browser session closes itself after this many ms (0 disables) and tells the user — a window nobody owns is a user-facing bug |
491
+ | `TM_BROWSER_ASK_EVAL` | `on` | `evaluate_script` runs arbitrary JS in YOUR browser — the one verb the domain allowlist can't cover (it limits where we navigate, not what a loaded page hands back). One official-dialog consent per browser session; no ask bridge ⇒ refused. `off` restores the old behaviour; the result redaction (JWT/bearer/cookie/api-key shapes) is NOT switchable |
492
+ | `TM_WEB_CACHE_TTL_SEC` | `300` | how long a governed fetch may re-serve the same URL (0 = off). One store shared by tm_webfetch / tm_search / the PTC bridge; entries are hash-named (a token-bearing query never hits disk) and are only read or written for hops the STATIC allowlist admitted — dialog consent stays per-request, and a re-served page says 缓存命中 |
477
493
  | `TM_BROWSER_IMAGE_MAX_BYTES` | `400000` | ceiling on the JPEG `take_screenshot { image:true }` inlines into the model's context (above it the reply stays path-only and says why) |
478
494
  | `TM_SEARCH_WEIGHTS` | unset | per-engine fusion weight overrides, e.g. `bing=0.3,hn=0.25`; anything unset keeps the built-in table |
479
495
  | `TM_SEARCH_RELEVANCE_FLOOR` | `0.35` | weight fraction kept by a hit that shares no query token with its title/snippet/host (demotes junk without deleting an engine) |
@@ -482,6 +498,9 @@ for overrides, extra agents and disabling roles.
482
498
  | `TM_BASH_TIMEOUT_PROBE_MS` | `60000` | ceiling forced onto a `timeout` the model set for a read-only probe command (0 disables) |
483
499
  | `TM_BASH_TIMEOUT_MAX_MS` | `0` | optional global ceiling for every other bash command — off by default so a real build keeps the timeout it asked for |
484
500
  | `TM_PTY_MAX` | `4` | concurrent `tm_pty` terminal sessions this plugin may keep running at once |
501
+ | `TM_DISPATCH_ASK` | `on` | `tm_dispatch` opens the official confirmation dialog before spawning a sub-agent — the same gate the built-in `task` tool applies (`ctx.ask` per sub-agent type), so a plugin-side dispatcher is not a way around the user's rules. No ask bridge ⇒ refused. `off` skips it (the lead-only lock still applies) |
502
+ | `TM_SUBAGENT_DEPTH` | `1` | nesting ceiling for dispatched children, same 口径 as the host's `subagent_depth` (1 = sub-agents never spawn sub-agents). Enforced plugin-side because that check lives in the task tool, not in the session API |
503
+ | `TM_PARALLEL_DISPATCH` | `on` | whether the lead may have more than one sub-agent running at a time. `off` refuses a second `tm_dispatch` while any child is still live (the refusal names the running children, and happens before the confirmation dialog), so the team works serially: dispatch → `tm_join` → next. For a machine or provider quota that cannot carry N sessions at once |
485
504
  | `TM_TOOL_HINTS` | `on` | append TeamMode's call-site discipline to the built-in `bash` / `task` tool DESCRIPTIONS via `tool.definition` (append-only, idempotent — the host text is never replaced) |
486
505
  | `TM_AGENT_TEMPERATURE` | `off` | `on` applies a per-role sampling table (architect 0.35 / researcher 0.3 / reviewer 0.1 / rest 0.2) via `chat.params`; or give it `reviewer=0.05;team=0.4`. Off = the documented "all agents at 0.2" invariant stands |
487
506
  | `TM_COMPACTION_CONTEXT` | `on` | on the host's pre-compaction hook, add the must-survive list (reply skeleton, offload handles, dispatched child session ids, provenance, board paths). Additive — the host's own summarizer prompt is never replaced |
package/README.zh-CN.md CHANGED
@@ -48,6 +48,7 @@ TeamMode 对每一个的回应:
48
48
  | 🕳️ **静默副作用** | R6/R2 审批门禁:环境变量读取和危险操作走 OpenCode 官方确认弹窗,1 分钟没人理自动拒绝。插件从不代替你批准——它只会拒绝。 |
49
49
  | 🌫️ **幻觉式调研** | 联网是双角色的授权 + 白名单受治理工具链。抓不到的事实就报告为缺口——绝不编造。 |
50
50
  | 🧭 **纯文本墙** | 回复被引导成宿主渲染得最快的形状:逐文件 / 逐用例 / 逐条发现用 markdown 表格,diff 和配置用围栏代码块,浏览器截图只在你明确要求时才内联附上。宿主不画 mermaid,所以没有 agent 会假装它在画。 |
51
+ | 🎯 **目标漂移** | lead 开局必须用你自己的措辞写下 `GOAL:` 和可验证的 `ACCEPTANCE:` 判据,判据没有证据支撑这一轮就不算结束——合法的停止只有两种(卡在你这里,或有证据地证明做不到)。一轮收完但宿主 todolist 上还有未完成项时,`tm_join` 会直接说"目标未达成"并列出条目;目标本身随上下文压缩一起存活,摘要不能悄悄把它换掉。 |
51
52
 
52
53
  底下还有流程纪律:确定性路由表、≥2 次派工先出 ≤30 行计划等你批、agent
53
54
  之间用 `STATUS/CHANGES/FINDINGS/EVIDENCE/HANDOFF` 结构化交接、以及静态
@@ -213,14 +214,24 @@ HMAC 句柄,agent 真需要 payload 时用 `tm_fetch` 分页取。
213
214
  | `tm_ptc_run` | 批量编排:一个程序、N 次受治理调用、零 LLM 回合;联网角色还能在程序里调 `tm.search` / `tm.webfetch` | 全部六个 agent |
214
215
  | `tm_search` | 多引擎网络搜索,返回提取、去重、RRF 融合后的命中列表 | Lead + Researcher |
215
216
  | `tm_webfetch` | 白名单页面的单次受治理 GET(搜索页自动提取) | Lead + Researcher |
216
- | `tm_dispatch` / `tm_join` | **异步子代理派发**:`tm_dispatch` 在独立子会话里启动某个专员并立刻返回其 id(内置 `task` 会把你阻塞到子代理结束),`tm_join` 负责回收——不带参数=状态快照,`waitMs`=有界等待,`cancel:true` 取消跑飞的子任务;回收到的回复同样走卸载管线,五份长报告变成句柄+预览而不是压垮你的上下文 | 仅 Lead(子代理不得再派发) |
217
+ | `tm_dispatch` / `tm_join` | **异步子代理派发**:`tm_dispatch` 在独立子会话里启动某个专员并立刻返回其 id(内置 `task` 会把你阻塞到子代理结束),`tm_join` 负责回收——不带参数=状态快照,`waitMs`=有界等待,`cancel:true` 取消跑飞的子任务;回收到的回复同样走卸载管线,五份长报告变成句柄+预览而不是压垮你的上下文。子会话是宿主会话树里一个真实会话(标题 `<description> (@<agent> subagent ·tm)`),派发时还会弹一条 toast 告诉你去看谁——因为工具卡片本身展不开 | 仅 Lead(子代理不得再派发) |
217
218
  | `tm_pty` | 在宿主自己的终端会话上**非阻塞执行命令**(`start`/`status`/`list`/`kill`):独立的构建与测试各自一个会话并行跑,不再串成一条 120 秒的 bash 调用。它不抓输出(命令自己 tee 日志,用 `tm_read` 读),且每次启动都先过 R6 分类器、R2 危险面 glob,再走官方确认窗,才真的建进程 | 仅 Lead |
219
+ | `tm_stats` | **插件把自己的 trajectory 读回来**:卸载挡在上下文之外的 token(扣掉确实回来的预览)、派发重叠省下的秒数(串行代价减去子代理实际占用的墙钟)、PTC 内部量、治理计数(被拦子资源、`tm_pty` 拒绝、bash 超时夹顶、缓存命中、脱敏次数)——外加**宿主能力矩阵**(每个宿主接口标 `已验证/存在未用/待观察/缺失/需人眼`)。只读本插件自己写的文件;OpenCode 升级后第一个跑它。`{ recent: 20 }` 追加一份逐条调用清单——每次卸载结果的句柄和落盘路径都在里面,这就是"看看刚才那个工具到底返回了什么"的办法(宿主不给插件工具卡片留展开位) | 全角色 |
218
220
  | `tm_browser` | 交互式浏览器会话(**驱动你的默认浏览器**):16 个 Playwright 动词(快照优先:`take_snapshot` → 按 uid 寻址的 `click`/`fill`/`drag`…)+ 5 个旧版兼容动词(open/navigate/read/screenshot/close);Playwright 引擎需 Node ≥ 20,不满足或导入失败时自动降级到旧版 CDP 引擎。它开的是**你自己的默认浏览器渠道**(默认装 Edge Beta 就开 Beta),除操作者设 `TM_BROWSER_HEADLESS` 外保持有头;页面自家图片/CSS/JS 靠 `same-site` 子资源策略正常加载;`take_screenshot { image:true }` 会附一张 JPEG,让模型真能看见画面 | Lead + Researcher + Tester(仅 UI 验证) |
219
221
 
220
- > **固定工具优先级阶梯(每个任务都适用):① TeamMode 受治理工具(`tm_*`)
221
- > → ② 用户 MCP/插件工具 → ③ 模型自己的推理。** 它同时是回退链:某个受治理
222
+ > **固定工具优先级阶梯(每个任务都适用):① 用户自己的 MCP/插件工具
223
+ > → ② TeamMode 受治理工具(`tm_*`) → ③ 模型自己的推理。** 它同时是回退链:某个受治理
222
224
  > 工具报错(这台机器没浏览器、主机被拦),agent 会说明情况降到下一级,
223
- > 而不是躺平。
225
+ > 而不是躺平;第 ③ 级里缺失的能力只能如实报"缺口",绝不编造。
226
+ > 一个会当场说明的例外:**网络**这一路仍是 `tm_search` / `tm_webfetch` /
227
+ > `tm_browser` 优先,因为只有这条线带着域名白名单、逐次确认窗和 R6 红线,
228
+ > 换用户的抓取工具去看同一个页面,等于把这三样治理一起绕掉。
229
+
230
+ > **宿主 UI 看不到的一部分。** OpenCode 只给"它自己内置的工具"渲染可展开的
231
+ > 详情卡片,插件工具(我们的 `tm_*`)永远是一行点不开的条目——它的渲染器注册表
232
+ > 是封闭的,外接层加不进去。但结果并没丢:超过卸载阈值的内容都落成了句柄 +
233
+ > 磁盘文件,`tm_stats { recent: 20 }` 会把最近每一次调用连同句柄和文件路径
234
+ > 列出来。想知道"刚才那个工具到底返回了什么",直接这么问你的 agent。
224
235
 
225
236
  所有受治理工具都**支持并行**:宿主可以把一批 `tm_search` / `tm_webfetch` /
226
237
  `tm_fetch` 调用并发执行——每次调用拿到自己的 step id 和自己的 payload,
@@ -429,10 +440,15 @@ Team Lead 自己从不删黑板,你可以随时审计任何一次运行。
429
440
  | `TM_SEARCH_DISABLED_ENGINES` | 未设 | 从引擎表与所有 `auto` 路由中移除的引擎(`sogou,baidu` 写法) |
430
441
  | `TM_BROWSER_SUBRESOURCE` | `same-site` | 顶层导航过白名单后,页面子资源的策略:`same-site` = 图/媒体/字体/样式表一律放行,脚本/XHR 仅当属于本次会话真正打开过的站点;`passive` = 只放被动资源;`off` = 旧行为(逐请求过白名单)。被拦掉的请求会在下一次快照以"N 个子资源请求被拦截"告知 |
431
442
  | `TM_BROWSER_IDLE_MS` | `180000` | 无人触碰的浏览器会话超过该毫秒数自动关闭并提示用户(0 关闭该回收)——没人负责的窗口是打扰用户的 bug |
443
+ | `TM_BROWSER_ASK_EVAL` | `on` | `evaluate_script` 在**你的**浏览器里跑任意 JS——这是域白名单管不住的唯一动词(白名单限制我们去哪儿导航,管不了已加载的页面交回什么)。每个浏览器会话走一次官方确认窗;没有 ask 桥就拒绝。`off` 恢复旧行为;结果脱敏(JWT/bearer/cookie/api-key 形状)不可关闭 |
444
+ | `TM_WEB_CACHE_TTL_SEC` | `300` | 受治理抓取在同一 URL 上可复用多久(0 = 关)。tm_webfetch / tm_search / PTC 桥共用一份缓存;条目以哈希命名(带令牌的查询串不落盘),且只在**静态白名单**放行的那一跳读写——弹窗授权仍是逐请求的,复用命中会标注 缓存命中 |
432
445
  | `TM_BROWSER_IMAGE_MAX_BYTES` | `400000` | `take_screenshot { image:true }` 内联给模型的 JPEG 上限;超过则只回路径并说明原因 |
433
446
  | `TM_BASH_TIMEOUT_PROBE_MS` | `60000` | 对只读探针命令(P3 白名单内)强制夹顶模型自设的 `timeout`(0 关闭) |
434
447
  | `TM_BASH_TIMEOUT_MAX_MS` | `0` | 其它 bash 命令的可选全局上限——默认关闭,真实构建保留它要的超时 |
435
448
  | `TM_PTY_MAX` | `4` | 本插件同时最多保持多少个 `tm_pty` 终端会话 |
449
+ | `TM_DISPATCH_ASK` | `on` | `tm_dispatch` 在创建子代理前先开官方确认窗——与内置 `task` 工具同一道闸(按子代理类型 `ctx.ask`),这样"走插件"不会变成绕过用户规则的后门。没有 ask 桥就拒绝。`off` 跳过这道确认(仅 lead 可派发的锁始终生效) |
450
+ | `TM_SUBAGENT_DEPTH` | `1` | 派发子代理的嵌套上限,与宿主 `subagent_depth` 同口径(1 = 子代理不得再生子代理)。必须插件侧自己执行,因为那道检查长在 task 工具里,不在 session API 上 |
451
+ | `TM_PARALLEL_DISPATCH` | `on` | lead 能否同时跑多个子代理。`off` 时只要还有子代理在跑,第二次 `tm_dispatch` 就被拒绝(拒绝语点名在跑的是谁,并让你先 `tm_join`),团队变成串行:派发 → 回收 → 再派发。拒绝发生在确认窗之前,也写在工具描述里。给带不动 N 个会话的机器或额度用 |
436
452
  | `TM_TOOL_HINTS` | `on` | 通过 `tool.definition` 把本插件的调用点纪律追加到内置 `bash` / `task` 的**描述**后面(只追加、幂等,绝不替换宿主原文) |
437
453
  | `TM_AGENT_TEMPERATURE` | `off` | `on` 时按角色分档采样(architect 0.35 / researcher 0.3 / reviewer 0.1 / 其余 0.2)经 `chat.params` 生效;也可写 `reviewer=0.05;team=0.4`。默认关闭=守住"所有 agent 0.2"这条既定原则 |
438
454
  | `TM_COMPACTION_CONTEXT` | `on` | 在宿主压缩前追加"必须存活清单"(回复骨架、offload 句柄、未回收的子会话 id、出处、板上路径)。只做追加——宿主自己的压缩提示词不被替换 |
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAkH9D;;4DAE4D;AAC5D,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAIhG;AAiLD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAO9C,CAAA"}
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAoH9D;;4DAE4D;AAC5D,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CAIhG;AAiLD,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAO9C,CAAA"}
package/dist/agents.js CHANGED
@@ -89,8 +89,10 @@ const PER_AGENT_TOOLS = ["edit", "write", "task", "bash", "todowrite", "question
89
89
  /** The governed tools, named explicitly next to the "tm_*" wildcard
90
90
  * (belt-and-braces: the explicit allows survive even if a host ever
91
91
  * stops expanding the wildcard). tm_memory is the project memory store —
92
- * not a network channel, available to all six agents. */
93
- const TM_TOOLS = ["tm_read", "tm_grep", "tm_bash", "tm_fetch", "tm_memory"];
92
+ * not a network channel, available to all six agents. tm_stats reads this
93
+ * plugin's own trajectory (no network, no shell, no secrets) so any role can
94
+ * answer "what did we spend" — and after a host upgrade, "what broke". */
95
+ const TM_TOOLS = ["tm_read", "tm_grep", "tm_bash", "tm_fetch", "tm_memory", "tm_stats"];
94
96
  /** M3: tm_ptc_run — explicit per-agent grant. v1.5.4 revised the original
95
97
  * M3 ruling (five specialists = allow, team = deny): ALL SIX agents now
96
98
  * get `allow` (per user request, CHANGELOG 1.5.4), overriding the tm_*
@@ -1 +1 @@
1
- {"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,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IACT,WAAW;IACX,QAAQ;IACR,MAAM;IACN,UAAU;CACX,CAAA"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Host-capability probe — the "fail loud, not silent" seam (2026-09-19).
3
+ *
4
+ * Everything this plugin does interesting leans on a host surface that is NOT
5
+ * part of a stability promise: `ctx.ask`, the `permission.asked` event,
6
+ * `client.session.create/promptAsync/children`, `client.pty.*`, `tui.showToast`,
7
+ * and the handful of hooks the host agrees to call (`tool.definition`,
8
+ * `chat.params`, `shell.env`, the compaction pair). Each of our features
9
+ * already degrades gracefully when one of those disappears — which is exactly
10
+ * the problem: an OpenCode upgrade can quietly take `tm_pty` and every web
11
+ * dialog out of the build, and the only symptom is the agent working around
12
+ * something the user never agreed to lose.
13
+ *
14
+ * So the plugin records what it ACTUALLY sees and says it out loud once:
15
+ * - `missing` — the surface is gone; the named feature is off.
16
+ * - `declared` — the surface exists but nothing has exercised it yet.
17
+ * - `ok` — observed working in this process (a hook fired, an event
18
+ * arrived, an ask bridge was handed to a tool).
19
+ * - `not-seen` — the host has not called/fired it since startup; the
20
+ * feature is armed and waiting (NOT evidence of a break).
21
+ * - `unverified`— we emit the contract; only a human can see the result
22
+ * (the `attachments` screenshot — the host either paints it
23
+ * or ignores it, and we cannot observe which).
24
+ *
25
+ * `tm_stats` renders the live matrix; a missing REQUIRED surface also raises
26
+ * one toast at startup, so a host upgrade is reported instead of discovered
27
+ * mid-task. Nothing here ever throws and nothing probes the network.
28
+ */
29
+ /** How each row was decided — kept as data so a test can pin the reasoning. */
30
+ export type CapState = "ok" | "declared" | "missing" | "not-seen" | "unverified";
31
+ export type CapEvidence = "static" | "hook" | "event" | "runtime" | "human";
32
+ export interface CapabilityRow {
33
+ /** The host surface, spelled the way the user reads it in a toast. */
34
+ seam: string;
35
+ /** What we lose if it is gone. */
36
+ feature: string;
37
+ state: CapState;
38
+ evidence: CapEvidence;
39
+ note?: string;
40
+ }
41
+ export interface CapabilityProbe {
42
+ observeAskBridge(present: boolean): void;
43
+ observeEvent(type: string): void;
44
+ observeHook(name: string): void;
45
+ /** Live matrix for tm_stats. */
46
+ snapshot(): CapabilityRow[];
47
+ /** Rows the plugin considers load-bearing and did NOT find. */
48
+ missingRequired(): CapabilityRow[];
49
+ /** One trajectory line + (when something required is gone) one toast. */
50
+ report(): {
51
+ rows: CapabilityRow[];
52
+ missing: string[];
53
+ };
54
+ }
55
+ export declare function createCapabilityProbe(deps: {
56
+ client: unknown;
57
+ /** `input.$` — the host shell bridge, handed outside the client object. */
58
+ hasShellBridge?: boolean;
59
+ /** Already-resolved R6 reply capability (index.ts owns that decision). */
60
+ hasPermissionReply?: boolean;
61
+ trajectory?: (event: Record<string, unknown>) => void;
62
+ notify?: (message: string) => void;
63
+ }): CapabilityProbe;
64
+ /** Markdown table for tm_stats — the shape the host renders fastest. */
65
+ export declare function renderCapabilityMatrix(rows: readonly CapabilityRow[]): string;
66
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAA;AAEhF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;AAE3E,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,QAAQ,CAAA;IACf,QAAQ,EAAE,WAAW,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAmED,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACxC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gCAAgC;IAChC,QAAQ,IAAI,aAAa,EAAE,CAAA;IAC3B,+DAA+D;IAC/D,eAAe,IAAI,aAAa,EAAE,CAAA;IAClC,yEAAyE;IACzE,MAAM,IAAI;QAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CACvD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,OAAO,CAAA;IACf,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACrD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,GAAG,eAAe,CAoElB;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAQ7E"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Host-capability probe — the "fail loud, not silent" seam (2026-09-19).
3
+ *
4
+ * Everything this plugin does interesting leans on a host surface that is NOT
5
+ * part of a stability promise: `ctx.ask`, the `permission.asked` event,
6
+ * `client.session.create/promptAsync/children`, `client.pty.*`, `tui.showToast`,
7
+ * and the handful of hooks the host agrees to call (`tool.definition`,
8
+ * `chat.params`, `shell.env`, the compaction pair). Each of our features
9
+ * already degrades gracefully when one of those disappears — which is exactly
10
+ * the problem: an OpenCode upgrade can quietly take `tm_pty` and every web
11
+ * dialog out of the build, and the only symptom is the agent working around
12
+ * something the user never agreed to lose.
13
+ *
14
+ * So the plugin records what it ACTUALLY sees and says it out loud once:
15
+ * - `missing` — the surface is gone; the named feature is off.
16
+ * - `declared` — the surface exists but nothing has exercised it yet.
17
+ * - `ok` — observed working in this process (a hook fired, an event
18
+ * arrived, an ask bridge was handed to a tool).
19
+ * - `not-seen` — the host has not called/fired it since startup; the
20
+ * feature is armed and waiting (NOT evidence of a break).
21
+ * - `unverified`— we emit the contract; only a human can see the result
22
+ * (the `attachments` screenshot — the host either paints it
23
+ * or ignores it, and we cannot observe which).
24
+ *
25
+ * `tm_stats` renders the live matrix; a missing REQUIRED surface also raises
26
+ * one toast at startup, so a host upgrade is reported instead of discovered
27
+ * mid-task. Nothing here ever throws and nothing probes the network.
28
+ */
29
+ const SEAMS = [
30
+ {
31
+ seam: "ToolContext.ask",
32
+ feature: "out-of-allowlist web fetch/search/browser + every tm_pty start",
33
+ evidence: "runtime",
34
+ observed: ["ask-bridge"],
35
+ required: true,
36
+ note: "first observed by whichever tm_* tool runs",
37
+ },
38
+ { seam: "client.session.create+promptAsync", feature: "tm_dispatch (non-blocking lead)", evidence: "static", path: "session.promptAsync", required: true },
39
+ { seam: "client.session.children", feature: "tm_join recovery after a restart", evidence: "static", path: "session.children" },
40
+ { seam: "client.session.status", feature: "tm_join bounded wait", evidence: "static", path: "session.status" },
41
+ { seam: "client.session.abort", feature: "tm_join cancel:true", evidence: "static", path: "session.abort" },
42
+ { seam: "client.pty.create", feature: "tm_pty (non-blocking commands)", evidence: "static", path: "pty.create", required: true },
43
+ { seam: "client.permission.reply", feature: "the approval gate's auto-reject timer", evidence: "static", path: "permission.reply", required: true },
44
+ { seam: "tui.showToast", feature: "a toast when a dialog is waiting", evidence: "static", path: "tui.showToast" },
45
+ { seam: "input.$ (shell bridge)", feature: "tm_bash via the host shell (else spawn fallback)", evidence: "static", path: "$" },
46
+ {
47
+ seam: "event permission.asked",
48
+ feature: "R6/R2 dialog observation + the unanswered-ask timer",
49
+ evidence: "event",
50
+ observed: ["permission.asked"],
51
+ note: "only arrives once something asks — absence so far is not a break",
52
+ },
53
+ { seam: "hook tool.execute.before", feature: "bash timeout clamp + R6 deferral", evidence: "hook", observed: ["hook:tool.execute.before"], required: true },
54
+ { seam: "hook tool.definition", feature: "TM_TOOL_HINTS on built-in bash/task", evidence: "hook", observed: ["hook:tool.definition"] },
55
+ { seam: "hook chat.params", feature: "TM_AGENT_TEMPERATURE", evidence: "hook", observed: ["hook:chat.params"] },
56
+ { seam: "hook shell.env", feature: "NO_COLOR / TM_SHELL_ENV passthrough", evidence: "hook", observed: ["hook:shell.env"] },
57
+ { seam: "hook experimental.session.compacting", feature: "the must-survive compaction context", evidence: "hook", observed: ["hook:session.compacting"] },
58
+ {
59
+ seam: "ToolResult.attachments",
60
+ feature: "tm_browser take_screenshot { image:true }",
61
+ evidence: "human",
62
+ state: "unverified",
63
+ note: "we emit the official shape; whether the desktop paints it is only visible to you",
64
+ },
65
+ ];
66
+ /** Read a dot path off the live client without assuming any of it exists. */
67
+ function pathPresent(client, dotted) {
68
+ if (dotted === "$")
69
+ return false; // resolved by the caller — not a client path
70
+ let cur = client;
71
+ for (const seg of dotted.split(".")) {
72
+ if (!cur || typeof cur !== "object")
73
+ return false;
74
+ cur = cur[seg];
75
+ }
76
+ return typeof cur === "function";
77
+ }
78
+ export function createCapabilityProbe(deps) {
79
+ const ok = new Set();
80
+ if (deps.hasShellBridge)
81
+ ok.add("$");
82
+ if (deps.hasPermissionReply)
83
+ ok.add("permission.reply");
84
+ const presentOf = (spec) => {
85
+ if (!spec.path)
86
+ return null;
87
+ if (spec.path === "$")
88
+ return !!deps.hasShellBridge;
89
+ if (spec.path === "permission.reply")
90
+ return !!deps.hasPermissionReply;
91
+ return pathPresent(deps.client, spec.path);
92
+ };
93
+ const rowFor = (spec) => {
94
+ const observed = (spec.observed ?? []).some((name) => ok.has(name));
95
+ const present = presentOf(spec);
96
+ const row = { seam: spec.seam, feature: spec.feature, evidence: spec.evidence, state: "not-seen" };
97
+ if (spec.state === "unverified")
98
+ row.state = "unverified";
99
+ else if (observed)
100
+ row.state = "ok";
101
+ else if (present === false)
102
+ row.state = "missing";
103
+ else if (spec.evidence === "static")
104
+ row.state = "declared";
105
+ else
106
+ row.state = "not-seen";
107
+ if (spec.note)
108
+ row.note = spec.note;
109
+ return row;
110
+ };
111
+ let reported = false;
112
+ const report = () => {
113
+ const rows = SEAMS.map(rowFor);
114
+ const missing = rows.filter((r) => r.state === "missing").map((r) => r.seam);
115
+ if (reported)
116
+ return { rows, missing };
117
+ reported = true;
118
+ try {
119
+ deps.trajectory?.({ tool: "capabilities", step_id: "boot", event: "probe", rows: rows.map((r) => `${r.seam}=${r.state}`) });
120
+ }
121
+ catch {
122
+ /* observability only */
123
+ }
124
+ const required = SEAMS.filter((s, i) => s.required && rows[i].state === "missing").map((s) => s.feature);
125
+ if (required.length) {
126
+ try {
127
+ deps.notify?.(`检测到宿主接口缺失,本进程已降级:${required.join(";")}。` +
128
+ `(OpenCode 升级后常见。用 tm_stats 看完整能力矩阵。)`);
129
+ }
130
+ catch {
131
+ /* notification is best-effort */
132
+ }
133
+ }
134
+ return { rows, missing };
135
+ };
136
+ return {
137
+ observeAskBridge(present) {
138
+ if (present)
139
+ ok.add("ask-bridge");
140
+ },
141
+ observeEvent(type) {
142
+ const t = String(type ?? "");
143
+ if (t === "permission.asked" || t === "permission.updated")
144
+ ok.add("permission.asked");
145
+ },
146
+ observeHook(name) {
147
+ const n = String(name ?? "");
148
+ if (n)
149
+ ok.add(`hook:${n}`);
150
+ },
151
+ snapshot: () => SEAMS.map(rowFor),
152
+ missingRequired: () => SEAMS.map(rowFor).filter((r, i) => SEAMS[i].required && r.state === "missing"),
153
+ report,
154
+ };
155
+ }
156
+ /** Markdown table for tm_stats — the shape the host renders fastest. */
157
+ export function renderCapabilityMatrix(rows) {
158
+ const badge = (s) => s === "ok" ? "✓ 已验证" : s === "declared" ? "◦ 存在未用" : s === "missing" ? "✗ 缺失" : s === "not-seen" ? "… 待观察" : "? 需人眼";
159
+ const lines = ["| 宿主接口 | 影响的能力 | 状态 |", "|---|---|---|"];
160
+ for (const r of rows) {
161
+ lines.push(`| \`${r.seam}\` | ${r.feature} | ${badge(r.state)}${r.note ? ` — ${r.note}` : ""} |`);
162
+ }
163
+ return lines.join("\n");
164
+ }
165
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAiCH,MAAM,KAAK,GAAe;IACxB;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,gEAAgE;QACzE,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,CAAC,YAAY,CAAC;QACxB,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,4CAA4C;KACnD;IACD,EAAE,IAAI,EAAE,mCAAmC,EAAE,OAAO,EAAE,iCAAiC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1J,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,kCAAkC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC9H,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAC9G,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE;IAC3G,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,gCAAgC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE;IAChI,EAAE,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,uCAAuC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI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kBAAkB,UAO9B,CAAA;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,UAAO,GAAG,OAAO,CAkB/E;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAUhG;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,OAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBlF;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAkBlF"}
@@ -167,6 +167,7 @@ export function applyChatParams(input, output, env = process.env) {
167
167
  * - the todo list and board paths — the state lives there, not in chat.
168
168
  */
169
169
  export const COMPACTION_CONTEXT = [
170
+ "The GOAL directive survives compaction: the user's own ask (GOAL + its ACCEPTANCE criteria) is the contract for this run — carry it verbatim, keep working while a criterion lacks EVIDENCE, and never let a summarized transcript quietly redefine or shrink what they asked for.",
170
171
  "OpenCode TeamMode contract survives compaction: every specialist reply keeps the STATUS / CHANGES / FINDINGS / EVIDENCE / HANDOFF skeleton and the lead machine-checks it — never summarize a reply into prose without those keys.",
171
172
  "Offloaded payloads are addressed by handle (ref + access_token + expire_at) from tm_* results. Carry the handles forward VERBATIM; never re-run a tool to rediscover a payload a handle already names.",
172
173
  "Async dispatches (tm_dispatch) and their child session ids must survive: an uncollected child is still-running work, not finished work.",
@@ -1 +1 @@
1
- {"version":3,"file":"host-hooks.js","sourceRoot":"","sources":["../src/host-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,I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AAI,CAAC;QACH,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;QAClC,MAAM,GAAG,GAAG,MAA8C,CAAA;QAC1D,IAAI,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAA;QACzD,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ;YAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAA;QACzD,MAAM,MAAM,GAAG,GAAG,CAAC,GAA6B,CAAA;QAChD,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC5B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;gBACb,KAAK,EAAE,CAAA;YACT,CAAC;QACH,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA8C,MAAM,YAAY,CAAA;AAkD5F,QAAA,MAAM,MAAM,EAAE,cAyQb,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA8C,MAAM,YAAY,CAAA;AAoD5F,QAAA,MAAM,MAAM,EAAE,cA4Sb,CAAA;AAED,eAAe,MAAM,CAAA"}
package/dist/index.js CHANGED
@@ -35,6 +35,8 @@ import { createEnvProtectHook, parseExtraDeny, resolveEnvProtectMode, bashAskPat
35
35
  import { createApprovalGate, resolveAskTimeoutMs, hasPermissionReplyCapability, } from "./approval-gate.js";
36
36
  import { createTmTools } from "./tm/index.js";
37
37
  import { createBashTimeoutHook } from "./tm/bash-timeout.js";
38
+ import { createCapabilityProbe } from "./capabilities.js";
39
+ import { setAskBridgeObserver } from "./tm/perm-ask.js";
38
40
  import { applyToolDefinition, applyChatParams, applySessionCompacting, applyCompactionAutoContinue, applyShellEnv, hookSwitches, } from "./host-hooks.js";
39
41
  /** Runtime addendum to the team prompt: concrete board + TTL (hybrid mode). */
40
42
  function blackboardNote(root, ttlDays) {
@@ -133,10 +135,20 @@ const plugin = {
133
135
  // The R6 mode/extra resolved above are passed in so the tm_* pipelines
134
136
  // share the SAME interception source as the built-in tools (anti-backdoor:
135
137
  // the global hook ALSO aliases tm_* onto read/grep/bash — see envprotect).
138
+ // ---------- host-capability probe (see src/capabilities.ts) ----------
139
+ // The plugin's features degrade quietly when a host surface disappears;
140
+ // this records what is actually present and says so once, at startup,
141
+ // instead of letting an OpenCode upgrade surface as an agent working
142
+ // around something the user never agreed to lose.
143
+ let capabilityProbe = null;
136
144
  const tmRuntime = await createTmTools(input, {
137
145
  mode: envProtectMode,
138
146
  extra: envProtectExtra,
139
147
  notify: notifyAsk,
148
+ // The capability probe is built from the tm runtime (it needs the run
149
+ // store to log into), and tm_stats needs the probe back — a declaration
150
+ // before construction breaks the cycle without weakening either side.
151
+ capabilities: () => capabilityProbe?.snapshot() ?? [],
140
152
  // A tm_dispatch child is registered the moment it is created (the
141
153
  // message.updated route below re-confirms it): an exec-role sub-agent
142
154
  // whose session were NOT registered would hard-throw its own protected
@@ -148,6 +160,19 @@ const plugin = {
148
160
  });
149
161
  // ---------- host-hook switches (TM_TOOL_HINTS / TM_COMPACTION_*) ------
150
162
  const hostSwitches = hookSwitches(process.env);
163
+ capabilityProbe = createCapabilityProbe({
164
+ client: input?.client,
165
+ hasShellBridge: typeof input?.$ === "function",
166
+ hasPermissionReply: hasPermissionReplyCapability(input?.client),
167
+ trajectory: (event) => tmRuntime.pipelines.store.appendTrajectory(event),
168
+ notify: notifyAsk,
169
+ });
170
+ // ctx.ask is only observable from inside a tool call — perm-ask reports
171
+ // every lookup it makes, which is how this row ever reaches 已验证.
172
+ setAskBridgeObserver((present) => capabilityProbe?.observeAskBridge(present));
173
+ // Startup report: one trajectory line always, one toast ONLY when a
174
+ // required surface is gone (a missing 待观察 row is not an alarm).
175
+ capabilityProbe.report();
151
176
  // ---------- bash timeout clamp (issue #6, see tm/bash-timeout.ts) ------
152
177
  const bashTimeoutHook = createBashTimeoutHook({
153
178
  probeMs: tmRuntime.config.bashTimeoutProbeMs,
@@ -220,6 +245,7 @@ const plugin = {
220
245
  // model-set bash timeout, then run the R6 interception. The clamp
221
246
  // runs BEFORE R6 so a blocked call is never also a slow one.
222
247
  "tool.execute.before": async (input, output) => {
248
+ capabilityProbe?.observeHook("tool.execute.before");
223
249
  bashTimeoutHook(input, output);
224
250
  await envProtectHook(input, output);
225
251
  },
@@ -228,23 +254,32 @@ const plugin = {
228
254
  // fields whose shape is verified; each is independently switchable,
229
255
  // because this host's d.ts has shipped surfaces the runtime never
230
256
  // fires (permission.ask), so adapters must fail soft, not assume.
257
+ // The `observeHook` calls are that "not assume" made observable: a row
258
+ // stays 待观察 until the host actually calls the hook, and tm_stats
259
+ // reports it either way.
231
260
  "tool.definition": (input, output) => {
261
+ capabilityProbe?.observeHook("tool.definition");
232
262
  applyToolDefinition(input, output, hostSwitches.toolHints);
233
263
  },
234
264
  "chat.params": (input, output) => {
265
+ capabilityProbe?.observeHook("chat.params");
235
266
  applyChatParams(input, output, process.env);
236
267
  },
237
268
  "experimental.session.compacting": (input, output) => {
269
+ capabilityProbe?.observeHook("session.compacting");
238
270
  applySessionCompacting(output, hostSwitches.compactionContext);
239
271
  },
240
272
  "experimental.compaction.autocontinue": (input, output) => {
273
+ capabilityProbe?.observeHook("compaction.autocontinue");
241
274
  applyCompactionAutoContinue(output, process.env);
242
275
  },
243
276
  "shell.env": (input, output) => {
277
+ capabilityProbe?.observeHook("shell.env");
244
278
  applyShellEnv(output, process.env);
245
279
  },
246
280
  // ---------- unified approval gate: watch the host permission dialog ---
247
281
  event: ({ event }) => {
282
+ capabilityProbe?.observeEvent(event?.type ?? "");
248
283
  // Async dispatch bookkeeping runs FIRST and independently of R6:
249
284
  // session.idle / .error are what tell the lead its children settled.
250
285
  tmRuntime.observeDispatchEvent(event);