Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
library: RTK's tag for Grok Build and Grok App gives their own reason and rtk-ai/rtk#2136, not DeepSeek Harness's (新v学员 on Discord)
yetone7916045591c3
diff --git a/docs/subsystems/library.md b/docs/subsystems/library.mdindex ce474ca27..07fda2c11 100644--- a/docs/subsystems/library.md+++ b/docs/subsystems/library.md@@ -28,7 +28,7 @@ agents RTK, a CLI that cuts shell output down before the model reads it.| Hooks | A `Hook` (#1790) is a command, an event, an optional matcher, a timeout and the agents ticked for it. Its optional `Description` (#2011) says what it is for in any language, since its name is letters, digits, - and _: one line of at most `maxHookDescription` (200) characters, shown under the name; only library.json keeps it, and no agent is given it. Its event is portable (`HookEvents`: turn-end, after-tool, before-tool, prompt, session-start, each under the agent's own name) or an agent's own (`"codex:PermissionRequest"`), which only that agent is given. A portable tool event can be narrowed to shell or edit tools, each agent's own tool names for them. `syncHooks` writes each into the agent's own file and shape (`hookSpecOf`): Claude Code `<claude dir>/settings.json`, Codex `hooks.json` beside its config.toml, Gemini CLI `~/.gemini/settings.json` (timeout in ms), Cursor `~/.cursor/hooks.json` (flat entries, `version: 1`), and Grok Build `~/.grok/config.toml` and Grok App `agent-home/config.toml` as `[[hooks.<Event>]]` array tables with a `[[hooks.<Event>.hooks]]` child. Grok Build and Grok App run the one CLI, so a `grok:<Event>` own event goes to both (`sameHookFamily`). Every other agent, and an agent in WSL, is refused with why, and the page greys its chip with that reason. The page also says when an agent has every hook turned off (`hooksOff`: Claude Code's `disableAllHooks`, Gemini's `hooksConfig.enabled`, Codex's `[features] hooks`). | [`hooks.go`](../../internal/library/hooks.go) || Subagents | A `Subagent` (#2283) is a name (lowercase letters, digits and -), a one-line description, a prompt, and the library's skills and MCP servers it uses, given to the agents ticked for it. `syncSubagents` writes it as a file of its own in each agent's user-level folder, in that agent's format (`subagentSpecOf`): Markdown with YAML front matter in `~/.claude/agents` (with `skills` and `mcpServers`), `~/.factory/droids` (with `mcpServers`), `~/.config/opencode/agents` (`mode: subagent`), `~/.gemini/agents`, `~/.qwen/agents`, `~/.grok/agents`, `~/.cursor/agents` and `~/.copilot/agents` (`<name>.agent.md`); a TOML role (`name`, `description`, `developer_instructions`) in `$CODEX_HOME/agents`. Skills and servers are named only where the agent's file can name them, and only those the library has. The page lists, per agent, whether it binds skills and servers (`SubagentAgentView`) and greys out an agent that takes none. | [`subagents.go`](../../internal/library/subagents.go) || Backups | Before a change first writes an agent file, `backups` copies it to `BackupDir`, one folder per change. The last `keepBackups` (30) changes are kept. The Backups button at the top of every tab, beside Library folder, opens that folder (`libHead`; Dade on Discord found it at the foot of a long page). | [`backup.go`](../../internal/library/backup.go) |-| RTK | `SetRTK` runs rtk's own installer (`rtk init -g …`) for an agent being switched on. For one being switched off, it removes exactly what the installer wrote, using magpie's own code, which works even with rtk gone. `ReadRTK` reads each agent's files to say which have the hook. An agent gone for its CLI (`CLIMissing`, #2254) isn't offered rtk, but one that still has the hook is listed so it can be taken out. `rtkSpec.blocked` stops the installer where it would break an agent. `rtkSpec.env` tells the installer the agent's folder where rtk would pick another: Hermes Agent's is `appdir.HermesHome` (`%LOCALAPPDATA%\hermes` on Windows), which rtk is given as `HERMES_HOME`, since rtk 0.51 knows only `$HERMES_HOME` and `~/.hermes`. Antigravity CLI (`agy`, #2202) gets rtk 0.51's own plugin for Antigravity, `plugins/rtk` in its global customization folder `~/.gemini/config` (`plugin.json`, `hooks.json` with `PreToolUse` → `rtk hook antigravity`, `rules/AGENTS.md`), which `agy plugin list` lists; switching it off takes that one folder out. rtk 0.50 knows Antigravity only per project and fails `rtk init -g --agent antigravity`, so an older rtk is `blocked` (`agyBlocked`) and the row says to update RTK. OpenCode 2 loads only the plugin rtk 0.52 on writes (one default object with `id` and `setup()`, rtk-ai/rtk#4187); an older rtk's plugin is for OpenCode 1 and OpenCode 2 refuses it, so with an OpenCode 2 here an older rtk is `blocked` (`openCodeBlocked`) and the row says to update RTK (#2295). Under OpenCode 2, an old plugin left from before an rtk update counts as off once the rtk here can write the new one (`openCodeHas`), so switching it on writes the new one over it; with an older rtk it counts as on, so it can be switched off. A detected agent RTK has no hook for at all is still listed, from `rtkNoHook`, with the reason and a switch that can't be turned on (dsh: its hooks can allow or deny a command but not rewrite it, and `rtk init` has no `--agent dsh`; Grok Build and Grok App: `rtk init` has no Grok or Grok App agent, so both are listed with the switch off). | [`rtk.go`](../../internal/library/rtk.go) |+| RTK | `SetRTK` runs rtk's own installer (`rtk init -g …`) for an agent being switched on. For one being switched off, it removes exactly what the installer wrote, using magpie's own code, which works even with rtk gone. `ReadRTK` reads each agent's files to say which have the hook. An agent gone for its CLI (`CLIMissing`, #2254) isn't offered rtk, but one that still has the hook is listed so it can be taken out. `rtkSpec.blocked` stops the installer where it would break an agent. `rtkSpec.env` tells the installer the agent's folder where rtk would pick another: Hermes Agent's is `appdir.HermesHome` (`%LOCALAPPDATA%\hermes` on Windows), which rtk is given as `HERMES_HOME`, since rtk 0.51 knows only `$HERMES_HOME` and `~/.hermes`. Antigravity CLI (`agy`, #2202) gets rtk 0.51's own plugin for Antigravity, `plugins/rtk` in its global customization folder `~/.gemini/config` (`plugin.json`, `hooks.json` with `PreToolUse` → `rtk hook antigravity`, `rules/AGENTS.md`), which `agy plugin list` lists; switching it off takes that one folder out. rtk 0.50 knows Antigravity only per project and fails `rtk init -g --agent antigravity`, so an older rtk is `blocked` (`agyBlocked`) and the row says to update RTK. OpenCode 2 loads only the plugin rtk 0.52 on writes (one default object with `id` and `setup()`, rtk-ai/rtk#4187); an older rtk's plugin is for OpenCode 1 and OpenCode 2 refuses it, so with an OpenCode 2 here an older rtk is `blocked` (`openCodeBlocked`) and the row says to update RTK (#2295). Under OpenCode 2, an old plugin left from before an rtk update counts as off once the rtk here can write the new one (`openCodeHas`), so switching it on writes the new one over it; with an older rtk it counts as on, so it can be switched off. A detected agent RTK has no hook for at all is still listed, from `rtkNoHook`, with the reason and a switch that can't be turned on (dsh: its hooks can allow or deny a command but not rewrite it, and `rtk init` has no `--agent dsh`; Grok Build and Grok App: `rtk init` has no Grok or Grok App agent, so both are listed with the switch off). The page's No RTK hook tag gives each agent's own reason and rtk-ai/rtk issue (`rtkNoHookWhy` in plugins/library/client.js: dsh #3847, Grok Build and Grok App #2136), and an agent with no entry gets no link; `TestRTKNoHookIssuesAreEachAgents` fails when the page and `rtkNoHook` cite different issues, or two agents cite the same ones without a reason in `sharedRTKIssues`. | [`rtk.go`](../../internal/library/rtk.go) |## Runtime pathdiff --git a/internal/gui/assets/plugins/library/client.js b/internal/gui/assets/plugins/library/client.jsindex 12524fc19..fa3ad6ac5 100644--- a/internal/gui/assets/plugins/library/client.js+++ b/internal/gui/assets/plugins/library/client.js@@ -947,8 +947,8 @@ magpie.plugin("library", (ctx) => {if (a.on && !rtk.path) row.append(tag(t("RTK missing"), "warn", t("{agent}'s hook calls rtk, which isn't installed, so its shell commands fail. Install RTK, or switch this off.", { agent: a.name })));// …or one that is, off the PATH the agent getselse if (a.on && rtk.offPath) row.append(tag(t("Not on PATH"), "warn", t("{agent}'s hook runs rtk by name and can't find it, so RTK does nothing for it. Put RTK on PATH above.", { agent: a.name })));- // an agent RTK has no hook for (DeepSeek Harness): listed, with why- if (a.noHook) row.append(tag(t("No RTK hook"), "warn", t("RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).", { agent: a.name })));+ // an agent RTK has no hook for (rtkNoHook in rtk.go): listed, with its own why+ if (a.noHook) row.append(tag(t("No RTK hook"), "warn", rtkNoHookWhy(a)));// RTK before 0.51 installs Antigravity's hook only per projectelse if (a.blocked && a.id === "agy") row.append(tag(t("Update RTK"), "warn", t("{agent}'s hook needs RTK 0.51 or newer: older ones install it only per project. Update RTK (brew upgrade rtk, or its installer again), then switch it on.", { agent: a.name })));else if (a.blocked && a.id !== "opencode") row.append(tag(t("Update RTK"), "warn", t("{agent}'s hook needs RTK 0.50 or newer: older ones only add @RTK.md to AGENTS.md, which rewrites no command. Update RTK (brew upgrade rtk, or its installer again), then switch it on.", { agent: a.name })));@@ -965,6 +965,20 @@ magpie.plugin("library", (ctx) => {if (!rows.length) list.append(el("div", "lib-none", t("None of your agents is one RTK has a hook for.")));body.append(list);}+ // Why RTK has no hook for an agent: each agent's own reason and its own+ // rtk-ai/rtk issue, never another agent's (新v学员 on Discord: Grok Build's+ // said DeepSeek Harness's hooks can't rewrite and linked dsh's issue).+ // Keyed as rtkNoHook in rtk.go; TestRTKNoHookIssuesAreEachAgents holds the+ // two together. An agent with no entry gets no reason and no link.+ function rtkNoHookWhy(a) {+ const agent = a.name;+ switch (a.id) {+ case "dsh": return t("RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).", { agent });+ case "grok": return t("RTK can't be given to {agent} yet: RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).", { agent });+ case "grok-app": return t("RTK can't be given to {agent} yet: {agent} runs Grok Build, and RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).", { agent });+ default: return t("RTK can't be given to {agent} yet: RTK has no hook for it.", { agent });+ }+ }async function setRTK(a, on) {rtkBusy.add(a.id);render();diff --git a/internal/gui/assets/plugins/library/i18n.js b/internal/gui/assets/plugins/library/i18n.jsindex 20b75f605..2e6c018d0 100644--- a/internal/gui/assets/plugins/library/i18n.js+++ b/internal/gui/assets/plugins/library/i18n.js@@ -170,6 +170,9 @@ magpie.strings({"OpenCode 2 needs RTK 0.52 or newer: older ones write a plugin for OpenCode 1, which OpenCode 2 refuses to load. Update RTK (brew upgrade rtk, or its installer again), then switch it on.": "OpenCode 2 需要 RTK 0.52 或更高版本:旧版写的是 OpenCode 1 的插件,OpenCode 2 拒绝加载。请先更新 RTK(brew upgrade rtk,或重新运行其安装脚本)再打开。","No RTK hook": "RTK 暂不支持","RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).": "暂时无法给 {agent} 接入 RTK:RTK 的做法是在 agent 执行 shell 命令前把命令改写掉,而 {agent} 的 hook 只能放行或拦截命令,不能改写;RTK 的安装程序也还没有它的选项(github.com/rtk-ai/rtk/issues/3847)。",+ "RTK can't be given to {agent} yet: RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "暂时无法给 {agent} 接入 RTK:RTK 的安装程序还没有 Grok Build 的选项(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: {agent} runs Grok Build, and RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "暂时无法给 {agent} 接入 RTK:{agent} 运行的是 Grok Build,而 RTK 的安装程序还没有 Grok Build 的选项(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: RTK has no hook for it.": "暂时无法给 {agent} 接入 RTK:RTK 还没有它的 hook。","Get RTK": "获取 RTK","restart an agent after switching it": "切换后需重启对应 Agent","{agent} runs its commands through RTK": "{agent} 的命令经过 RTK",@@ -777,6 +780,9 @@ magpie.strings({"OpenCode 2 needs RTK 0.52 or newer: older ones write a plugin for OpenCode 1, which OpenCode 2 refuses to load. Update RTK (brew upgrade rtk, or its installer again), then switch it on.": "OpenCode 2 需要 RTK 0.52 或更高版本:舊版寫的是 OpenCode 1 的外掛,OpenCode 2 拒絕載入。請先更新 RTK(brew upgrade rtk,或重新執行其安裝指令碼)再開啟。","No RTK hook": "RTK 暫不支援","RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).": "暫時無法給 {agent} 接入 RTK:RTK 的做法是在 agent 執行 shell 命令前把命令改寫掉,而 {agent} 的 hook 只能放行或攔截命令,不能改寫;RTK 的安裝程式也還沒有它的選項(github.com/rtk-ai/rtk/issues/3847)。",+ "RTK can't be given to {agent} yet: RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "暫時無法給 {agent} 接入 RTK:RTK 的安裝程式還沒有 Grok Build 的選項(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: {agent} runs Grok Build, and RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "暫時無法給 {agent} 接入 RTK:{agent} 執行的是 Grok Build,而 RTK 的安裝程式還沒有 Grok Build 的選項(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: RTK has no hook for it.": "暫時無法給 {agent} 接入 RTK:RTK 還沒有它的 hook。","Get RTK": "取得 RTK","restart an agent after switching it": "切換後需重啟對應 Agent","{agent} runs its commands through RTK": "{agent} 的命令經過 RTK",@@ -1379,6 +1385,9 @@ magpie.strings({"OpenCode 2 needs RTK 0.52 or newer: older ones write a plugin for OpenCode 1, which OpenCode 2 refuses to load. Update RTK (brew upgrade rtk, or its installer again), then switch it on.": "OpenCode 2 には RTK 0.52 以降が必要です。古いバージョンは OpenCode 1 向けのプラグインを書き込み、OpenCode 2 はその読み込みを拒否します。RTK を更新(brew upgrade rtk、またはインストーラを再実行)してからオンにしてください。","No RTK hook": "RTK 未対応","RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).": "{agent} にはまだ RTK を使えません。RTK はエージェントが実行しようとするシェルコマンドを書き換えて動きますが、{agent} のフックはコマンドを許可・拒否できるだけで書き換えられません。RTK のインストーラーにもそのためのオプションはありません(github.com/rtk-ai/rtk/issues/3847)。",+ "RTK can't be given to {agent} yet: RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "{agent} にはまだ RTK を使えません。RTK のインストーラーに Grok Build のオプションがありません(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: {agent} runs Grok Build, and RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "{agent} にはまだ RTK を使えません。{agent} は Grok Build を実行しますが、RTK のインストーラーに Grok Build のオプションがありません(github.com/rtk-ai/rtk/issues/2136)。",+ "RTK can't be given to {agent} yet: RTK has no hook for it.": "{agent} にはまだ RTK を使えません。RTK にはそのフックがありません。","Get RTK": "RTK を入手","restart an agent after switching it": "切り替え後はエージェントを再起動してください","{agent} runs its commands through RTK": "{agent} のコマンドは RTK を通ります",@@ -1984,6 +1993,9 @@ magpie.strings({"OpenCode 2 needs RTK 0.52 or newer: older ones write a plugin for OpenCode 1, which OpenCode 2 refuses to load. Update RTK (brew upgrade rtk, or its installer again), then switch it on.": "OpenCode 2 benötigt RTK 0.52 oder neuer: Ältere Versionen schreiben eine Erweiterung für OpenCode 1, die OpenCode 2 nicht lädt. Aktualisieren Sie RTK (brew upgrade rtk oder erneut über den Installer) und schalten Sie es dann ein.","No RTK hook": "Kein RTK-Hook","RTK can't be given to {agent} yet: RTK works by rewriting the shell command an agent is about to run, and {agent}'s hooks can only allow or deny a command, not change it. RTK's installer has no option for it either (github.com/rtk-ai/rtk/issues/3847).": "RTK lässt sich {agent} noch nicht geben: RTK schreibt den Shell-Befehl um, den ein Agent gleich ausführt, und die Hooks von {agent} können einen Befehl nur erlauben oder ablehnen, nicht ändern. Auch der Installer von RTK hat keine Option dafür (github.com/rtk-ai/rtk/issues/3847).",+ "RTK can't be given to {agent} yet: RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "RTK lässt sich {agent} noch nicht geben: Der Installer von RTK hat keine Option für Grok Build (github.com/rtk-ai/rtk/issues/2136).",+ "RTK can't be given to {agent} yet: {agent} runs Grok Build, and RTK's installer has no option for Grok Build (github.com/rtk-ai/rtk/issues/2136).": "RTK lässt sich {agent} noch nicht geben: {agent} führt Grok Build aus, und der Installer von RTK hat keine Option für Grok Build (github.com/rtk-ai/rtk/issues/2136).",+ "RTK can't be given to {agent} yet: RTK has no hook for it.": "RTK lässt sich {agent} noch nicht geben: RTK hat keinen Hook dafür.","Get RTK": "RTK holen","restart an agent after switching it": "Agenten nach dem Umschalten neu starten","{agent} runs its commands through RTK": "{agent} führt seine Befehle über RTK aus",diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.mdindex c115d5b28..5418bbc09 100644--- a/internal/gui/tests/README.md+++ b/internal/gui/tests/README.md@@ -2348,8 +2348,9 @@ node --test internal/gui/tests/ledger-protocol.test.cjs`library-rtk-nohook.test.cjs` checks that an agent RTK has no hook for(DeepSeek Harness) is listed in Library › RTK with a No RTK hook tag saying-why, and that its switch can't be turned on, while Pi's can. English and-Chinese, Chromium and WebKit.+why, and that its switch can't be turned on, while Pi's can. Grok Build's+tag gives its own reason and rtk-ai/rtk#2136, never dsh's #3847. English+and Chinese, Chromium and WebKit.```shnode --test internal/gui/tests/library-rtk-nohook.test.cjsdiff --git a/internal/gui/tests/library-rtk-nohook.test.cjs b/internal/gui/tests/library-rtk-nohook.test.cjsindex aa7158b95..41bbdd77f 100644--- a/internal/gui/tests/library-rtk-nohook.test.cjs+++ b/internal/gui/tests/library-rtk-nohook.test.cjs@@ -4,6 +4,10 @@// --agent dsh), and the RTK tab left it out, as if magpie hadn't seen it.// It is listed now, tagged No RTK hook with why, and its switch can't be// turned on; in English and Chinese. No backend: the API is faked here.+// Discord (新v学员): Grok Build's tag said DeepSeek Harness's reason and+// linked dsh's rtk-ai/rtk#3847. Each agent's tag says its own reason now:+// Grok Build's cites rtk-ai/rtk#2136, the request for Grok Build, and says+// nothing about its hooks.const assert = require("node:assert/strict");const fs = require("node:fs/promises");const path = require("node:path");@@ -15,7 +19,7 @@ const HOME = "/Users/aimer";const agent = (id, name) => ({ id, name, icon: "", skills: `${HOME}/.${id}/skills`, mcp: `${HOME}/.${id}/mcp.json` });const lib = () => ({dir: `${HOME}/.magpie/library`, backups: `${HOME}/.magpie/backups`, home: HOME,- agents: [agent("pi", "Pi"), agent("dsh", "DeepSeek Harness")],+ agents: [agent("pi", "Pi"), agent("dsh", "DeepSeek Harness"), agent("grok", "Grok Build")],instructions: { agents: [], sets: [] }, foundServers: [], projects: [], foundSkills: [], skills: [], servers: [],});const rtkView = () => ({@@ -23,6 +27,7 @@ const rtkView = () => ({agents: [{ id: "pi", name: "Pi", icon: "", on: false },{ id: "dsh", name: "DeepSeek Harness", icon: "", on: false, noHook: true, blocked: "RTK has no hook for DeepSeek Harness yet" },+ { id: "grok", name: "Grok Build", icon: "", on: false, noHook: true, blocked: "RTK has no hook for Grok Build yet" },],});@@ -49,8 +54,8 @@ function server(lang, calls) {}const words = {- en: { tag: "No RTK hook", why: "DeepSeek Harness's hooks can only allow or deny a command, not change it" },- zh: { tag: "RTK 暂不支持", why: "DeepSeek Harness 的 hook 只能放行或拦截命令,不能改写" },+ en: { tag: "No RTK hook", why: "DeepSeek Harness's hooks can only allow or deny a command, not change it", grok: "RTK's installer has no option for Grok Build" },+ zh: { tag: "RTK 暂不支持", why: "DeepSeek Harness 的 hook 只能放行或拦截命令,不能改写", grok: "RTK 的安装程序还没有 Grok Build 的选项" },};for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {@@ -79,6 +84,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",const tag = row("DeepSeek Harness").locator(".lib-tag");assert.deepEqual(await tag.allTextContents(), [w.tag]);assert((await tag.getAttribute("title")).includes(w.why), await tag.getAttribute("title"));+ assert((await tag.getAttribute("title")).includes("rtk-ai/rtk/issues/3847"));+ // Grok Build's tag is its own: its issue, not dsh's, and nothing+ // said about its hooks+ const gtag = row("Grok Build").locator(".lib-tag");+ assert.deepEqual(await gtag.allTextContents(), [w.tag]);+ const gwhy = await gtag.getAttribute("title");+ assert(gwhy.includes(w.grok) && gwhy.includes("rtk-ai/rtk/issues/2136"), gwhy);+ assert(!gwhy.includes("3847") && !gwhy.includes("DeepSeek") && !gwhy.includes("hook"), gwhy);+ assert.equal(await row("Grok Build").locator(".lib-switch").isDisabled(), true);const sw = row("DeepSeek Harness").locator(".lib-switch");assert.equal(await sw.isDisabled(), true);// Pi has a hook: nothing to say, and it can be switched ondiff --git a/internal/library/rtk.go b/internal/library/rtk.goindex 1f855bac5..2dd47310c 100644--- a/internal/library/rtk.go+++ b/internal/library/rtk.go@@ -227,11 +227,13 @@ var rtkSpecs = map[string]rtkSpec{var rtkNoHook = map[string]string{"dsh": "RTK has no hook for DeepSeek Harness yet: RTK works by rewriting the shell command an agent is about to run, and dsh's hooks can only allow or deny a command, not change it; rtk init has no --agent dsh either (github.com/rtk-ai/rtk/issues/3847)",// rtk init's agents are claude, cursor, codex, copilot, gemini,- // opencode and the rest of rtkSpecs. There is no grok or grok-app,- // so a hook written here would have nowhere to go, for Grok Build no- // more than for the App that runs it.- "grok": "RTK has no hook for Grok Build yet: rtk init has no Grok agent, so it cannot rewrite the shell commands Grok Build runs",- "grok-app": "RTK has no hook for Grok App yet: rtk init has no Grok or Grok App agent, so it cannot rewrite the shell commands Grok App runs",+ // opencode and the rest of rtkSpecs (src/hooks/init in rtk 1.0.1).+ // There is no grok or grok-app, so a hook written here would have+ // nowhere to go, for Grok Build no more than for the App that runs it.+ // rtk-ai/rtk#2136 asks for Grok Build, and Grok App runs Grok Build,+ // so the two share it on purpose (sharedRTKIssues in the test).+ "grok": "RTK has no hook for Grok Build yet: rtk init has no Grok agent, so it cannot rewrite the shell commands Grok Build runs (github.com/rtk-ai/rtk/issues/2136)",+ "grok-app": "RTK has no hook for Grok App yet: rtk init has no Grok or Grok App agent, so it cannot rewrite the shell commands Grok App runs (github.com/rtk-ai/rtk/issues/2136)",}func opencodePlugin(a *agent.Agent) string {diff --git a/internal/library/rtk_nohook_issues_test.go b/internal/library/rtk_nohook_issues_test.gonew file mode 100644index 000000000..bf3e1226c--- /dev/null+++ b/internal/library/rtk_nohook_issues_test.go@@ -0,0 +1,111 @@+package library++import (+ "os"+ "path/filepath"+ "regexp"+ "slices"+ "sort"+ "strings"+ "testing"+)++// sharedRTKIssues are the agents that cite the same rtk-ai/rtk issues on+// purpose, each with why. Any other two agents citing the same list is a+// reason copied from one agent onto another.+var sharedRTKIssues = map[[2]string]string{+ // Grok App runs Grok Build, and rtk-ai/rtk#2136 asks for Grok Build.+ {"grok", "grok-app"}: "Grok App runs Grok Build",+}++var rtkIssueRe = regexp.MustCompile(`github\.com/([\w.-]+/[\w.-]+)/issues/(\d+)`)++func rtkIssues(s string) []string {+ var out []string+ for _, m := range rtkIssueRe.FindAllStringSubmatch(s, -1) {+ out = append(out, m[1]+"#"+m[2])+ }+ sort.Strings(out)+ return slices.Compact(out)+}++// The RTK tab's no-hook tag says each agent's own reason and cites its+// own issues (新v学员 on Discord: Grok Build's tag said DeepSeek Harness's+// hooks can't rewrite a command and linked dsh's rtk-ai/rtk#3847, since+// every agent got dsh's text). The page's reasons (rtkNoHookWhy in+// plugins/library/client.js) cover every agent in rtkNoHook and cite the+// same issues as rtk.go's, two agents share an issue list only when+// sharedRTKIssues says why, and the fallback for an agent with no entry+// cites nothing.+func TestRTKNoHookIssuesAreEachAgents(t *testing.T) {+ src, err := os.ReadFile(filepath.Join("..", "gui", "assets", "plugins", "library", "client.js"))+ if err != nil {+ t.Fatal(err)+ }+ s := string(src)+ start := strings.Index(s, "function rtkNoHookWhy(")+ if start < 0 {+ t.Fatal("client.js has no rtkNoHookWhy: the no-hook tag isn't per agent")+ }+ end := strings.Index(s[start:], "\n }\n")+ if end < 0 {+ t.Fatal("rtkNoHookWhy has no end")+ }+ body := s[start : start+end]+ page := map[string]string{}+ fallback, hasFallback := "", false+ for _, line := range strings.Split(body, "\n") {+ if m := regexp.MustCompile(`^\s*case "([\w-]+)": return (.*)$`).FindStringSubmatch(line); m != nil {+ page[m[1]] = m[2]+ } else if m := regexp.MustCompile(`^\s*default: return (.*)$`).FindStringSubmatch(line); m != nil {+ fallback, hasFallback = m[1], true+ }+ }+ if !hasFallback {+ t.Error("rtkNoHookWhy has no default reason")+ }+ if got := rtkIssues(fallback); len(got) > 0 {+ t.Errorf("the reason for an agent with no entry cites %v", got)+ }++ ids := make([]string, 0, len(rtkNoHook))+ for id := range rtkNoHook {+ ids = append(ids, id)+ }+ sort.Strings(ids)+ for _, id := range ids {+ why, ok := page[id]+ if !ok {+ t.Errorf("%s is in rtkNoHook but the page has no reason for it", id)+ continue+ }+ if g, p := rtkIssues(rtkNoHook[id]), rtkIssues(why); !slices.Equal(g, p) {+ t.Errorf("%s cites %v in rtk.go and %v on the page", id, g, p)+ }+ }+ for id := range page {+ if _, ok := rtkNoHook[id]; !ok {+ t.Errorf("the page has a reason for %s, which rtkNoHook doesn't list", id)+ }+ }++ for _, src := range []map[string]string{rtkNoHook, page} {+ for i, a := range ids {+ for _, b := range ids[i+1:] {+ ia, ib := rtkIssues(src[a]), rtkIssues(src[b])+ if len(ia) == 0 || !slices.Equal(ia, ib) {+ continue+ }+ if _, ok := sharedRTKIssues[[2]string{a, b}]; !ok {+ t.Errorf("%s and %s both cite %v: one's reason was copied onto the other", a, b, ia)+ }+ }+ }+ }+ // a deliberate share that no longer holds is dropped from the list+ for pair := range sharedRTKIssues {+ if ia := rtkIssues(rtkNoHook[pair[0]]); len(ia) == 0 || !slices.Equal(ia, rtkIssues(rtkNoHook[pair[1]])) {+ t.Errorf("sharedRTKIssues lists %v, which don't share an issue list", pair)+ }+ }+}