A local plugin for image-heavy chats in Codex, Claude Code and other agents: earlier images stop going out with every message, and the model fetches the one it needs by its ID, also after compaction.
TypeScript ai-agentsclaude-codeclaude-code-plugincodexcodex-plugincontext-managementdeveloper-toolsimage-generationmcpmultimodal
fix(panel): 新任务发第一条消息前打开的面板会提示重开;停用插件、启用插件点一下立即生效
chipfighter2b843d57fbe3
diff --git a/README.md b/README.mdindex 86be391..79dd431 100644--- a/README.md+++ b/README.md@@ -60,7 +60,7 @@ curl -fsSL https://github.com/chipfighter/codex-attachment-manager/releases/late## 使用-1. 打开一个任务,在侧边面板里打开“上下文素材”(位置见上面安装的第 4 步)。+1. 打开一个任务,在侧边面板里打开“上下文素材”(位置见上面安装的第 4 步)。新任务建议发出第一条消息之后再打开:Codex 有时会在发第一条消息时换一个任务编号,之前打开的面板跟不上,面板会提示你重新打开。2. 取消勾选不想再发送的图(点缩略图可以看大图),然后点“确定”。从下一条消息起生效。面板里的标签:diff --git a/docs/spec.md b/docs/spec.mdindex e00280e..650b7c4 100644--- a/docs/spec.md+++ b/docs/spec.md@@ -56,11 +56,12 @@- 上一次请求没能按勾选改写,或者取消时这一轮还在走 WebSocket,面板上都有提示;代理没在运行时也提示。- 面板自动刷新:- 平时每 3 秒读一次;- - 用户把鼠标移进面板、点击、滚动时立刻读一次,因为 Codex 可能放慢后台面板的计时器;+ - 用户把鼠标移进面板、点击、滚动时立刻读一次;- 标题右侧有“刷新”按钮,超过 30 秒没更新时变成橙色。-- 标题右侧是“停用插件”和“启用插件”,两个按钮样式不同:- - 停用要在同一个位置再点一次“停用插件”确认,旁边的“启用插件”表示保持启用;- - 中间的提示只说明后果,不放按钮。+- 在新任务发出第一条消息之前打开的面板,可能一直停在 Codex 预先准备、后来又换掉的任务上,刷新也没用。这时面板提示关掉标签页再打开一次(v0.1-8)。+- 标题右侧是“停用插件”或“启用插件”,两种样式不同。点一下立即生效,不用再确认(用户 2026-09-25 定)。+ - 停用或启用后,中间的提示说明要重启 Codex 才生效,另一个按钮随时可以撤回;+ - 撤回到 Codex 启动时的状态,就不再提示重启。- 以上是用户 2026-09-24 定的 MVP,外加 2026-09-25 要求补上的发送预览、改写失败提示、自动刷新和这两个按钮的位置、名称。### 为后续扩展预留diff --git a/docs/tasks.md b/docs/tasks.mdindex ff45171..4895a92 100644--- a/docs/tasks.md+++ b/docs/tasks.md@@ -38,12 +38,20 @@- [ ] **v0.1-6 在 GitHub 上发布 v0.1**:Release 工作流已备好(`.github/workflows/release.yml`:推 `v0.1.0` 标签后先跑三个平台的 CI,再建草稿 Release,附带写好版本号的四个安装、卸载脚本,说明取自 `CHANGELOG.md`)。发布前还差最后一步【需用户】:README、演示视频、截图、仓库目录结构调整;仓库改成公开。- [x] **v0.1-8 用户测试反馈(2026-09-25)**(`panel.html`;用户截图确认:取消两张图后,模型说现在看不到、之前的描述仍然有效,没有收回,也没有编造)- 面板没有自动更新:发送前打开面板,发出带图的一轮、模型收到、模型回复,这三个时间点面板都没变,重新打开才看到最新。- - 查证:服务端每次都重新读记录;Codex 对面板发起的调用原样转发、原样返回,没有缓存。开发页里面板照常更新。所以推断是 Codex 放慢或停掉了侧边面板里的计时器,还没在桌面版里直接看到;用户再测时确认。- - 修复:鼠标移进面板、点击、滚动、窗口获得焦点时立刻刷新,不依赖计时器;加“刷新”按钮,超过 30 秒没更新时变成橙色。+ - 第一次推断是 Codex 停掉了面板的计时器,于是加了“鼠标移进面板就刷新”和“刷新”按钮。用户再测:点“刷新”也没用,面板一直显示“还没有图片”。所以不是计时器的问题。+ - 真正的原因(依据桌面版 26.917 的前端代码):+ - 新任务的页面用的是 Codex 预先准备好的任务,面板在这时打开,就绑在它上面;+ - 发第一条消息时,这个预备任务超过 285 秒、或者设置变了,Codex 会丢掉它,另开一个任务;+ - 面板不会被告知新任务,一直读那个没有记录的任务。两次测试都是在新任务发第一条消息之前打开的面板。+ - 修复:+ - 插件服务在面板数据里标出这个任务有没有记录(`started`);+ - 没有记录时,面板提示“发出第一条消息后,如果这里没有出现图片,请关掉这个标签页再打开一次”;+ - 不按时间猜新任务,免得显示成别的任务的图。+ - “鼠标移进面板就刷新”和“刷新”按钮保留。- 按钮:- - “停用”改名“停用插件”,确认时的“停用 / 取消”改成同一位置的“停用插件 / 启用插件”;- - 停用后显示“启用插件”,两个按钮样式区分开;- - 中间的提示保留,只说明后果。+ - “停用”改名“停用插件”,停用后显示“启用插件”,两种样式区分开,放在标题右侧;+ - 按用户第二次的要求,点一下立即生效,不用再确认;中间的提示说明要重启 Codex;+ - 撤回到 Codex 启动时的状态,就不再提示重启。- [x] **v0.1-7 许可证和 CI**(用户 2026-09-25 定:MIT,并加上 CI):`LICENSE`(插件目录里也放一份);`.github/workflows/ci.yml` 在 Windows、macOS、Linux 上跑单元测试;问题反馈模板,方便 macOS、Linux 用户在 GitHub 上报问题。- 待定:Windows 上不先停用就移除插件,Codex 会断连,只能靠卸载命令恢复;要不要用计划任务让引擎不依赖插件启动,见 spec.md 第 5 节。diff --git a/plugin/src/panel-state.ts b/plugin/src/panel-state.tsindex c93c488..41f14ef 100644--- a/plugin/src/panel-state.ts+++ b/plugin/src/panel-state.ts@@ -28,8 +28,10 @@ export type SendInfo = {last: { at: string; bytesBefore: number; bytesAfter: number; replaced: number; skipped: boolean } | null;notice: { kind: "skipped"; at: string; reason: string } | { kind: "websocket"; at: string } | null;};+// started: the thread has a rollout. A panel opened on a new chat before its first message may be tied to a thread+// Codex prepared and then replaced (v0.1-8); that one never gets a rollout.export type PanelState = {- threadId: string; turns: number; images: PanelImage[]; requested: string[];+ threadId: string; started: boolean; turns: number; images: PanelImage[]; requested: string[];totals: { images: number; unchecked: number; checkedBytes: number; allBytes: number };send: SendInfo;};@@ -113,7 +115,7 @@ export function panelState(threadId: string, history: Record_[], index: ThreadIn};});return {- threadId, turns: index.turns, images, requested,+ threadId, started: history.length > 0, turns: index.turns, images, requested,totals: {images: images.length,unchecked: images.filter((image) => !image.checked).length,diff --git a/plugin/src/panel.html b/plugin/src/panel.htmlindex 92f252a..224fddb 100644--- a/plugin/src/panel.html+++ b/plugin/src/panel.html@@ -10,8 +10,9 @@Input: the MCP Apps bridge (postMessage) — Codex's call of cam_panel, and our own calls of cam_panel, cam_image andcam_set_selection. Output: selection changes through cam_set_selection. Self-contained: no network, no storage.v0.1-5 — 启用插件 / 停用插件 (cam_setup): point Codex at the engine, or back to a direct connection before uninstalling.- The state is polled, and also re-read whenever the user moves to or touches the panel, or presses 刷新: the host may- slow or pause the timers of a panel it thinks is in the background.+ The state is polled, and also re-read whenever the user moves to or touches the panel, or presses 刷新.+ v0.1-8 — a panel opened on a new chat before its first message may stay tied to a thread Codex prepared and then+ replaced; it cannot follow the new one, so it says to reopen.--><style>/* Fallbacks follow Codex's own widget palette; inside Codex its theme variables (MCP Apps host styles) win. */@@ -75,8 +76,6 @@.plugin .on:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 84%, var(--bg)); }.plugin .off { border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent); background: transparent; color: var(--danger); }.plugin .off:hover:not(:disabled) { background: var(--danger-bg); }- .plugin .off.confirming { border-color: var(--danger); background: var(--danger); color: var(--bg); }- .plugin .off.confirming:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 86%, var(--text)); }.plan { margin-top: 4px; color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }.plan b { font-weight: 600; color: var(--text); }.meter { margin-top: 12px; padding: 10px 12px 11px; border-radius: 12px; background: var(--bg-soft); }@@ -270,7 +269,6 @@thumbs: new Map(), // id -> data URL or nullviewer: null, // { id, url, loading, failed }refreshing: false, saving: false,- confirmDisable: false, // 停用插件 was clicked once and waits for the second clickswitching: false, // a 启用插件 / 停用插件 call is under waymanual: false, // the running refresh was asked for with the 刷新 button};@@ -353,7 +351,6 @@S.switching = true; render();try {const result = await callTool("cam_setup", { enable });- S.confirmDisable = false;ingest(result.structuredContent);} catch (error) {S.error = (enable ? "启用失败:" : "停用失败:") + error.message;@@ -548,36 +545,27 @@function setupNotices() {const setup = S.data?.setup;if (!setup) return [];- if (S.confirmDisable && setup.usesEngine) return [notice("warn", "停用后,Codex 下次启动时恢复直连,取消勾选的图会照常发送。卸载插件前请先停用。确认停用,请再点一次右上角的“停用插件”;点“启用插件”则保持启用。")];if (setup.changed === "enabled") return [notice("info", "已启用。重启 Codex 后生效,取消勾选的图就不再发送了。")];if (setup.changed === "disabled") return [notice("warn", "已停用。重启 Codex 后恢复直连,取消勾选不再生效。要卸载插件,现在可以去插件页面移除。")];- if (!setup.usesEngine) return [notice("info", "还没有接入 Codex:点右上角的“启用插件”,然后重启 Codex,取消勾选才会生效。")];+ if (!setup.usesEngine) return [notice("info", "插件没有启用:Codex 现在直连,取消勾选不会生效。点右上角的“启用插件”,然后重启 Codex。")];return [];}- // 启用插件 / 停用插件 sit in the header. 停用 asks for a second click on the same spot; 启用插件 next to it keeps- // the plugin on. Rebuilt only when the choice changes, so hover and focus survive the polling.+ // 启用插件 / 停用插件 in the header switch at once (user 2026-09-25): the notice says a restart is due, and the+ // other button undoes it. Rebuilt only when the choice changes, so hover and focus survive the polling.let pluginKey = "";function renderPlugin() {const setup = S.data?.setup;- const key = !setup ? "" : !setup.usesEngine ? "off" : S.confirmDisable ? "confirm" : "on";+ const key = !setup ? "" : setup.usesEngine ? "on" : "off";const box = $("plugin");if (key !== pluginKey) {pluginKey = key;- const make = (label, className, run) => {- const button = document.createElement("button");- button.type = "button";- button.textContent = label;- button.className = className;- button.addEventListener("click", run);- return button;- };- const keepOn = () => { S.confirmDisable = false; render(); };- const askToDisable = () => { S.confirmDisable = true; render(); main.scrollTo({ top: 0 }); };- box.replaceChildren(...(key === "on" ? [make("停用插件", "off", askToDisable)]- : key === "confirm" ? [make("启用插件", "on", keepOn), make("停用插件", "off confirming", () => switchEngine(false))]- : key === "off" ? [make("启用插件", "on", () => switchEngine(true))]- : []));+ const button = document.createElement("button");+ button.type = "button";+ button.textContent = key === "on" ? "停用插件" : "启用插件";+ button.className = key === "on" ? "off" : "on";+ button.addEventListener("click", () => switchEngine(key !== "on"));+ box.replaceChildren(...(key ? [button] : []));}for (const button of box.children) button.disabled = S.switching;}@@ -594,6 +582,7 @@const nodes = [];if (S.error) nodes.push(notice("error", S.error, { label: "重试", run: () => { S.error = null; render(); refresh(); } }));nodes.push(...setupNotices());+ if (S.data?.started === false) nodes.push(notice("info", "这个任务还没开始。发出第一条消息后,如果这里没有出现图片,请关掉这个标签页,再从“插件和 MCP”里打开一次:Codex 有时会给新任务换一个编号,已经打开的面板跟不上。"));if (S.data?.engineRunning === false && S.data?.setup?.usesEngine !== false) nodes.push(notice("warn", "代理没有在运行,取消勾选暂时不会生效。关掉 Codex 再打开,一般就能恢复。"));const sendNotice = S.data?.send?.notice;if (sendNotice?.kind === "skipped") nodes.push(notice("error", `上一次请求(${timeOf(sendNotice.at)})没能按勾选替换,图片原样发给了模型。原因:${sendNotice.reason}。`));@@ -685,11 +674,7 @@$("viewerClose").addEventListener("click", closeViewer);$("viewerStage").addEventListener("click", (event) => { if (event.target === event.currentTarget) closeViewer(); });$("viewerCheck").querySelector("input").addEventListener("change", (event) => { if (S.viewer) setChecked(S.viewer.id, event.target.checked); });- document.addEventListener("keydown", (event) => {- if (event.key !== "Escape") return;- if (S.viewer) closeViewer();- else if (S.confirmDisable) { S.confirmDisable = false; render(); }- });+ document.addEventListener("keydown", (event) => { if (event.key === "Escape" && S.viewer) closeViewer(); });$("undo").addEventListener("click", () => { S.pending.clear(); render(); });$("refresh").addEventListener("click", () => refresh(true));$("confirm").addEventListener("click", confirm);diff --git a/plugin/src/plugin-server.ts b/plugin/src/plugin-server.tsindex 4c619da..20cb588 100644--- a/plugin/src/plugin-server.ts+++ b/plugin/src/plugin-server.ts@@ -77,10 +77,15 @@ export function readResource(uri: string): Json {// Whether this instance last found the engine running; null until the first check (and in tests).let engineRunning: boolean | null = null;const enginePort = Number(process.env.CAM_ENGINE_PORT ?? DEFAULT_PORT);-// v0.1-5: whether config.toml points Codex at the engine, and what the panel's 启用 / 停用 changed since this instance-// started: Codex reads the setting when it starts, so a change waits for a restart.-let setupChanged: "enabled" | "disabled" | null = null;-const setupState = () => ({ usesEngine: usesEngine(), changed: setupChanged });+// v0.1-5: whether config.toml points Codex at the engine, and whether that differs from what it said when this instance+// started (about when Codex read it): only a difference waits for a restart, so 停用 then 启用 again needs none.+let setupBaseline: boolean | null = null;+export function resetSetupBaseline(): void { setupBaseline = null; }+function setupState(): { usesEngine: boolean; changed: "enabled" | "disabled" | null } {+ const now = usesEngine();+ if (setupBaseline === null) setupBaseline = now;+ return { usesEngine: now, changed: now === setupBaseline ? null : now ? "enabled" : "disabled" };+}function log(entry: Json): void {const root = dataDir();@@ -114,9 +119,9 @@ export function callTool(name: string, args: Json, meta: Json | undefined, sessi}if (name === "cam_setup") {if (fromModel(meta)) throw new Error("只有用户能启用或停用。");+ setupState(); // the baseline, in case this is the first call// A conflict with the user's own settings throws here, before anything is written.const plan = args.enable === true ? useEngine(enginePort) : connectDirectly();- setupChanged = args.enable === true ? "enabled" : "disabled";const state = loadPanelState(threadId, options);return { content: [{ type: "text", text: args.enable === true ? "已启用,重启 Codex 后生效。" : "已停用,重启 Codex 后恢复直连。" }], structuredContent: { ...state, engineRunning, setup: setupState(), notes: plan.notes } };}@@ -140,6 +145,7 @@ function main(): void {engineRunning = result.state !== "failed";};log({ event: "start", ppid: process.ppid });+ setupState(); // what Codex read when it started this session// Codex starts several instances at once; a little jitter keeps them from racing to start the engine.setTimeout(supervise, Math.floor(Math.random() * 400));// Short enough that a crashed engine is back within Codex's own retry window.diff --git a/spike/scripts/panel-dev.ts b/spike/scripts/panel-dev.tsindex f07c948..d4a808e 100644--- a/spike/scripts/panel-dev.ts+++ b/spike/scripts/panel-dev.ts@@ -4,7 +4,7 @@// Input: none; `node spike/scripts/panel-dev.ts [--port 17895]`. Output: http://127.0.0.1:<port>/// (?theme=dark, ?solo=1 for the panel alone, ?demo=pending|preview for a state to screenshot, ?slow=1 for slow calls,// ?stats=none|skipped|websocket for other engine statistics than a normal rewritten request, ?setup=off for a Codex that-// does not go through the engine yet, ?demo=disable for the 停用插件 confirmation, ?demo=disabled for right after it).+// does not go through the engine yet, ?demo=disabled for right after 停用插件, ?thread=fresh for a task with no rollout).// Everything is written to a temporary folder, including a Codex home of its own: nothing in the user's Codex home is// read or changed, whatever is clicked.@@ -58,7 +58,7 @@ writeFileSync(join(day, `rollout-2026-09-24T10-00-00-${THREAD}.jsonl`),turn("t4") + upload("msg_4", "t4", [["settings-screenshot.png", screenshot]]) +line("response_item", { type: "image_generation_call", id: "ig_1", status: "completed", result: png(256, 256, (x, y) => [x, y, 180]).toString("base64") }) + say("需要 IMG-001 才能回答。", "t4"));-const { callTool } = await import("../../plugin/src/plugin-server.ts");+const { callTool, resetSetupBaseline } = await import("../../plugin/src/plugin-server.ts");const { imageSizesOf } = await import("../../plugin/src/proxy.ts");const { recordRequest } = await import("../../plugin/src/request-stats.ts");const { connectDirectly, useEngine } = await import("../../plugin/src/setup.ts");@@ -110,7 +110,8 @@ const HOST = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><titdocument.body.classList.toggle("solo", params.has("solo"));const frame = document.getElementById("app");const send = (message) => frame.contentWindow.postMessage({ jsonrpc: "2.0", ...message }, "*");- const call = (name, args) => fetch("/call", { method: "POST", body: JSON.stringify({ name, arguments: args }) }).then((r) => r.json());+ // ?thread=fresh: a thread that has no rollout, like a panel opened on a new chat whose prepared thread was replaced.+ const call = (name, args) => fetch("/call" + (params.get("thread") === "fresh" ? "?fresh=1" : ""), { method: "POST", body: JSON.stringify({ name, arguments: args }) }).then((r) => r.json());window.addEventListener("message", async (event) => {const m = event.data;if (!m || event.source !== frame.contentWindow) return;@@ -124,9 +125,7 @@ const HOST = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><titsetTimeout(() => {if (params.get("demo") === "pending") d.querySelector('[data-id="IMG-002"] input')?.click();if (params.get("demo") === "preview") d.querySelector('[data-id="IMG-004"] .thumb')?.click();- if (params.get("demo") === "disable") d.querySelector("#plugin .off")?.click();- // Leaves the (temporary) Codex home switched off; restart the page's server for the other states.- if (params.get("demo") === "disabled") { d.querySelector("#plugin .off")?.click(); setTimeout(() => d.querySelector("#plugin .off.confirming")?.click(), 150); }+ if (params.get("demo") === "disabled") d.querySelector("#plugin .off")?.click();}, 700);}document.getElementById("theme").onclick = () => { theme = theme === "dark" ? "light" : "dark"; document.body.classList.toggle("dark", theme === "dark"); send({ method: "ui/notifications/host-context-changed", params: { theme } }); };@@ -149,6 +148,8 @@ createServer((request, response) => {if (request.method === "POST" && request.url?.startsWith("/setup")) {// Whether the (temporary) Codex home goes through the engine when the page loads.if (new URL(request.url, "http://x").searchParams.get("state") === "off") connectDirectly(); else useEngine(17891);+ // Each page load starts as a freshly started Codex: nothing waits for a restart.+ resetSetupBaseline();return reply(200, "application/json", "{}");}if (request.method === "POST" && request.url === "/grow") {@@ -158,12 +159,14 @@ createServer((request, response) => {writeFileSync(file, readFileSync(file, "utf8") + turn(`x${extra}`) + upload(`msg_x${extra}`, `x${extra}`, [[`new-${extra}.png`, png(300, 200, (x, y) => [(x * extra * 40) % 256, (y * 3) % 256, 150])]]));return reply(200, "application/json", "{}");}- if (request.method === "POST" && request.url === "/call") {+ if (request.method === "POST" && request.url?.startsWith("/call")) {+ const fresh = request.url.includes("fresh=1");let body = "";request.on("data", (chunk) => { body += chunk; });request.on("end", () => {const { name, arguments: args } = JSON.parse(body);- try { reply(200, "application/json", JSON.stringify(callTool(name, args ?? {}, meta, sessionsDir))); }+ const threadMeta = fresh ? { threadId: `${THREAD.slice(0, -4)}f00d`, thread_id: `${THREAD.slice(0, -4)}f00d` } : meta;+ try { reply(200, "application/json", JSON.stringify(callTool(name, args ?? {}, threadMeta, sessionsDir))); }catch (error) { reply(200, "application/json", JSON.stringify({ isError: true, content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }] })); }});return;diff --git a/spike/src/panel-state.test.ts b/spike/src/panel-state.test.tsindex 7c2bcd1..3c48077 100644--- a/spike/src/panel-state.test.ts+++ b/spike/src/panel-state.test.ts@@ -97,8 +97,9 @@ test("images within the requested size, and formats other than PNG, reach the paassert.throws(() => imageFor(THREAD, "IMG-099", 160, options), /not an image of this thread/);});-test("a thread without a rollout yet shows an empty panel instead of an error", () => {+test("a thread without a rollout yet shows an empty panel instead of an error, and says it has not started", () => {const options = sampleSessions();const state = loadPanelState("01a0d301-0000-7000-8000-00000000ffff", options);- assert.deepEqual([state.images, state.turns, state.totals.images], [[], 0, 0]);+ assert.deepEqual([state.images, state.turns, state.totals.images, state.started], [[], 0, 0, false]);+ assert.equal(loadPanelState(THREAD, options).started, true);});diff --git a/spike/src/setup.test.ts b/spike/src/setup.test.tsindex 07e4e3d..0b9f135 100644--- a/spike/src/setup.test.ts+++ b/spike/src/setup.test.ts@@ -8,7 +8,7 @@ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, writeFilimport { tmpdir } from "node:os";import { join } from "node:path";import test, { type TestContext } from "node:test";-import { callTool } from "../../plugin/src/plugin-server.ts";+import { callTool, resetSetupBaseline } from "../../plugin/src/plugin-server.ts";import { connectDirectly, pluginGone, useEngine, usesEngine } from "../../plugin/src/setup.ts";import { sampleSessions, THREAD } from "./testfixtures.ts";@@ -41,9 +41,10 @@ test("启用 points Codex at the engine with a backup first; 停用 gives back tassert.equal(existsSync(join(home, "config.toml.cam-tmp")), false, "no temporary file is left behind");});-test("only the panel may switch the setting; a call from the model is refused", (t) => {+test("only the panel may switch the setting; a call from the model is refused; switching back needs no restart", (t) => {const { home } = tempHome(t);writeFileSync(join(home, "config.toml"), CONFIG);+ resetSetupBaseline();const { sessionsDir } = sampleSessions();const panelMeta = { threadId: THREAD };const modelMeta = { "x-codex-turn-metadata": { thread_id: THREAD, turn_id: "t9" } };@@ -53,7 +54,11 @@ test("only the panel may switch the setting; a call from the model is refused",assert.deepEqual(on.setup, { usesEngine: true, changed: "enabled" });assert.equal(on.totals.images, 3, "the panel state comes along");const off = callTool("cam_setup", { enable: false }, panelMeta, sessionsDir).structuredContent;- assert.deepEqual(off.setup, { usesEngine: false, changed: "disabled" });+ assert.deepEqual(off.setup, { usesEngine: false, changed: null }, "back to what Codex loaded: no restart due");+ // Starting from a Codex that goes through the engine, 停用插件 is what waits for the restart.+ useEngine(17891);+ resetSetupBaseline();+ assert.deepEqual(callTool("cam_setup", { enable: false }, panelMeta, sessionsDir).structuredContent.setup, { usesEngine: false, changed: "disabled" });assert.equal(readFileSync(join(home, "config.toml"), "utf8"), CONFIG);});