Stop paying the multimodal tax. Your AI agent keeps every image it has seen but only sends the ones it needs: lighter chats, no endless reconnecting, no starting over. Works with Codex, Claude Code, Cline, Gemini CLI, OpenCode, WorkBuddy and more. Install once, forget it.
TypeScript ai-agentsai-imageclaude-codeclaude-code-pluginclinecodexcodex-plugincomputer-usecontext-engineeringcontext-managementdeveloper-toolsgemini-cliimage-generationmcpmultimodalmultimodal-aiopencodeqwen-codetoken-optimizationvision-language-model
feat(panel): 按 v0.8 原型重做面板:占用卡片、搜索、筛选、按轮缩略图和面板内预览
chipfightereacc24dd520a
diff --git a/plugin/src/panel.html b/plugin/src/panel.htmlindex b373914..98ff8ca 100644--- a/plugin/src/panel.html+++ b/plugin/src/panel.html@@ -5,41 +5,29 @@<meta name="viewport" content="width=device-width, initial-scale=1"><title>上下文素材</title><!--- Purpose: P4 — the context-material panel inside Codex Desktop's side panel (an MCP App). It lists the thread's- images in history order; the user previews them and checks or unchecks them. Nothing is sent to the model.+ Purpose: P4 — the context-material panel inside Codex Desktop's side panel (an MCP App); v0.4: the same page runs for+ a Claude Code session, served by the engine (panel-web.js stands in for the host). Nothing is sent to the model.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 刷新.- 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. v0.1-10: such a panel switches to the thread the user starts there (cam_bind): the page notes when it is on- screen, and only a thread started meanwhile counts; when several did, the user picks one. v0.1-9: the title shows the- task's name. v0.1-13: a notice when an earlier part of the history cannot be found (e.g. the task a fork came from- was deleted); the images left are listed as usual.+ v0.1-8 / v0.1-10 — a panel opened on a new chat follows the thread the user starts there (cam_bind); when several+ started, the user picks one. v0.1-9: the title shows the task's name. v0.1-13: a notice when an earlier part of the+ history cannot be found.v0.1-14: Simplified Chinese or English, following Codex's interface language (the host context's locale; else thesystem's). Every call tells the plugin the language, so its answers match and the text for the model follows it.- v0.1-17: with many images, the ones the model asked for ("需要 IMG-xxx") and the user has not checked are listed in- a bar under the request size; clicking one scrolls the list to its row and flashes the row twice.- v0.1-18: a checkbox at the end of a turn's line (when it has two or more images that can change) checks or- unchecks all of them at once; it shows a dash while only some are checked.- v0.1-22 (user 2026-09-28): every check or uncheck, one image or a whole turn, is saved at once; no 确定, no 撤销,- and the footer keeps its one line (no "saved" message).- v0.1-21: Codex 26.924 gives the page no fixed height, only the most it may take; by MCP Apps the page reports the- height it wants (size-changed): it asks for all of it, and fits a smaller frame if that is what it gets.- v0.1-23: the panel never scrolls as a whole; only the list does (a turn's hidden checkbox once let it).- v0.2 (user 2026-09-29): a filter button next to 刷新 unfolds a bar of the task's sources (uploaded, PDF page, web page,- viewed, tool result, generated); picking some shows only their images. It changes what is shown, never what is sent.- v0.3 (user 2026-10-06): an automatic selection switch at the end of the footer. While it is on, a tick pins an image- (sent every turn; kept apart from the manual ticks), the others are left out unless the model fetches them, the bar- lists what the model fetched in the latest turn instead of what it asked for, and those rows say so.- v0.4: under Claude Code, when Anthropic refused the rewritten history under its thinking and the engine sent the- original request, the panel says so as for any request it could not rewrite. On an account that checks thinking, it- also says how many thinking records the last request left out to keep the selection (user 2026-10-11).- v0.5 (user 2026-10-12): under Claude Code, images from before a compaction stay in the list as they were, marked- “压缩前”; checked ones go out again from the engine, and the last request's line says how many.- v0.7 (user 2026-10-13): once the engine has seen a Codex task's subagents or side chats, a block under the request- size lists them (folded to one line by default), each with its last request and the rule that applies to it, and- holds the task's switch for them (on by default).+ v0.1-21: the page reports the height it wants (size-changed) and fits a smaller frame if that is what it gets; only+ the list scrolls, never the panel as a whole. v0.1-22: every change is saved at once; no 确定, no 撤销.+ v0.3: the automatic selection switch at the end of the footer; with it on, an image the user keeps on is sent every+ turn (pinned), the others are left out unless the model fetches them.+ v0.4 / v0.5: under Claude Code, the notices about the thinking check; images from before a compaction are marked 压缩前.+ v0.8 (user 2026-10-19, after a clickable prototype; docs/v0.8/plan.md §2): one screen. The request card (folded by+ default: the estimate, the bar and the next message; unfolded: the last request, what the model fetched in the latest+ turn, the subagents' and side chats' savings); a search over the scene, the words the model noted and what was said in+ that turn; one filter at a time (全部, 上传, 生成, then the scenes); thumbnails by turn, newest first, with small marks+ only; a preview inside the panel with the image's switch (每轮都发 / 发送); in manual mode, a bar of the images the+ model asked for, and 整轮不发 / 整轮发送 on each turn. An id button finds its thumbnail: scrolls it to the middle,+ flashes it twice and focuses it. The v0.2 source filter and the v0.7 switch for subagents and side chats are gone.--><style>/* Fallbacks follow Codex's own widget palette; inside Codex its theme variables (MCP Apps host styles) win. */@@ -81,24 +69,19 @@background: var(--bg); color: var(--text); font: 13px/1.5 var(--font);-webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;}- button { font: inherit; color: inherit; }+ button, input { font: inherit; color: inherit; }:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }+ [hidden] { display: none !important; }- header { flex: none; padding: 16px 18px 14px; }+ header { flex: none; padding: 14px 16px 10px; }.title { display: flex; align-items: center; gap: 8px; }.title h1 { flex: 0 1 auto; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }- .count { flex: none; padding: 0 7px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); font-size: 12px; font-weight: 500; line-height: 20px; font-variant-numeric: tabular-nums; }- .count:empty { display: none; }.actions { flex: none; margin-left: auto; display: flex; align-items: center; gap: 6px; }.icon-quiet { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; }.icon-quiet:hover { background: var(--bg-soft); color: var(--text-2); }.icon-quiet svg { width: 16px; height: 16px; }.icon-quiet.spinning svg { animation: spin .8s linear infinite; }.icon-quiet.stale { color: var(--warn); }- /* v0.2: the filter button, and a dot on it while a filter is on and the bar is folded away. */- #filter { position: relative; }- #filter[aria-expanded="true"] { background: var(--bg-soft); color: var(--text-2); }- #filter .dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--info); box-shadow: 0 0 0 2px var(--bg); }@keyframes spin { to { transform: rotate(360deg); } }.plugin { display: flex; gap: 6px; }.plugin:empty { display: none; }@@ -109,117 +92,111 @@.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); }- .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); }- .meter-head { display: flex; align-items: baseline; gap: 8px; color: var(--text-2); font-size: 12.5px; }- .meter-head b { color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }- .meter-full { margin-left: auto; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }- .meter-full.saved { color: var(--ok); }- .bar { margin-top: 8px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 9%, transparent); overflow: hidden; }++ /* The request card: folded to the estimate, its bar and the next message; unfolded, three more lines. */+ .card { margin-top: 10px; padding: 10px 12px 6px; border-radius: 12px; background: var(--bg-soft); font-size: 12.5px; font-variant-numeric: tabular-nums; }+ .card-head { display: flex; align-items: baseline; gap: 8px; color: var(--text-2); }+ .card-head b { color: var(--text); font-size: 15px; font-weight: 600; }+ .card-full { margin-left: auto; color: var(--text-3); white-space: nowrap; }+ .card-full.saved { color: var(--ok); }+ .bar { margin-top: 7px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 9%, transparent); overflow: hidden; }.bar i { display: block; height: 100%; border-radius: inherit; background: var(--info); transition: width .25s ease; }- .last { margin-top: 8px; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }- .last:empty { display: none; }- /* v0.1-17: stays in the header, so after jumping to one image the next one is still a click away. */- .needs { margin-top: 10px; padding: 6px 8px 6px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }- .needs button { height: 22px; padding: 0 9px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 999px; background: var(--bg); color: var(--warn); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color .15s, transform .1s; }- .needs button:hover { border-color: var(--warn); }- .needs button:active { transform: scale(.96); }- /* v0.3: what the model fetched itself is news, not a request: the same bar in blue. */- .needs.fetched { background: var(--info-bg); color: var(--info); }- .needs.fetched button { border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--info); }- .needs.fetched button:hover { border-color: var(--info); }- /* v0.7: the task's subagents and side chats; folded to its first line, which holds the switch for them. */- .children { margin-top: 10px; border-radius: 12px; background: var(--bg-soft); font-size: 12.5px; }- .children-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; }- .children-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font: inherit; font-weight: 500; text-align: left; cursor: pointer; transition: background .15s; }- .children-toggle:hover { background: var(--bg-hover); }- .children-toggle svg { flex: none; width: 14px; height: 14px; color: var(--text-3); transition: transform .15s; }- .children-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }- .children-toggle .label { flex: none; white-space: nowrap; }- .children-toggle .n { flex: none; color: var(--text-3); font-variant-numeric: tabular-nums; }- .children-toggle .sum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; }- .children-list { display: flex; flex-direction: column; gap: 8px; padding: 2px 12px 10px 32px; }- .child-line1 { display: flex; align-items: center; gap: 6px; min-width: 0; }- .child-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }- .child-kind { flex: none; color: var(--text-3); }- .child-rule { flex: none; margin-left: auto; padding: 0 8px; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: 11.5px; font-weight: 500; line-height: 20px; white-space: nowrap; }- .child-rule.off { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-3); }- .child-meta { margin-top: 1px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }- /* v0.2: rounded source buttons, drawn unlike the rows' square send checkboxes so the two are not confused. */- .filters { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }+ .line { display: flex; align-items: center; gap: 10px; min-height: 26px; padding-top: 4px; }+ .line .k { flex: none; color: var(--text-3); white-space: nowrap; }+ .line .v { flex: 1; min-width: 0; text-align: right; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }+ .line .v b { color: var(--text); font-weight: 600; }+ .line .ids { flex: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }+ .more { display: flex; align-items: center; justify-content: center; gap: 3px; width: 100%; margin-top: 2px; padding: 3px 0; border: 0; border-radius: 8px; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; transition: background .15s, color .15s; }+ .more:hover { background: var(--bg-hover); color: var(--text-2); }+ .more svg { width: 13px; height: 13px; transition: transform .15s; }+ .more[aria-expanded="true"] svg { transform: rotate(180deg); }+ /* An image id that finds its thumbnail. */+ .idbtn { height: 22px; padding: 0 9px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); border-radius: 999px; background: var(--bg); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color .15s, transform .1s; }+ .idbtn:hover { border-color: currentColor; }+ .idbtn:active { transform: scale(.96); }+ .line .idbtn { color: var(--info); }+ /* v0.1-17: stays in the header, so after jumping to one image the next one is still a click away. Manual mode only. */+ .needs { margin-top: 8px; padding: 6px 8px 6px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }+ .needs .idbtn { color: var(--warn); }++ .search { margin-top: 10px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); transition: border-color .15s; }+ .search:focus-within { border-color: color-mix(in srgb, var(--info) 60%, transparent); }+ .search svg { flex: none; width: 15px; height: 15px; color: var(--text-3); }+ .search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; font-size: 13px; }+ .search input::placeholder { color: var(--text-3); }+ /* One filter at a time, with the search. */+ .chips { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }+ .chips:empty { display: none; }.chip { height: 26px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }.chip:hover { background: var(--bg-hover); }.chip .n { margin-left: 5px; color: var(--text-3); font-variant-numeric: tabular-nums; }- .chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--info) 55%, transparent); background: var(--info-bg); color: var(--text); }- .chip[aria-pressed="true"] .n { color: var(--text-2); }+ .chip[aria-pressed="true"] { border-color: transparent; background: var(--accent); color: var(--accent-text); }+ .chip[aria-pressed="true"] .n { color: color-mix(in srgb, var(--accent-text) 70%, transparent); }+ .chips .sep { width: 1px; height: 16px; background: var(--border-strong); }- main { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 18px; border-top: 1px solid var(--border); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }- /* position: the hidden checkbox inside stays in this line. Without it, it hung off the page far down the list, the- page could scroll, and checking a turn low in the list scrolled the whole panel away (user 2026-09-28). */- .turn { position: relative; display: flex; align-items: center; gap: 10px; margin: 18px 8px 6px; color: var(--text-3); font-size: 12px; font-weight: 500; }+ main { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 16px; border-top: 1px solid var(--border); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }+ .turn { display: flex; align-items: center; gap: 10px; margin: 14px 4px 6px; color: var(--text-3); font-size: 12px; font-weight: 500; }.turn::after { content: ""; flex: 1; height: 1px; background: var(--border); }- .turn:first-child { margin-top: 14px; }- /* v0.1-18: the turn's checkbox sits after the line, in the column of the rows' checkboxes, drawn quieter than them. */+ .turn .act { order: 2; flex: none; padding: 0 2px; border: 0; background: none; color: var(--info); font-size: 12px; font-weight: 500; cursor: pointer; }+ .turn .act:hover { text-decoration: underline; }.turn::after { order: 1; }- .turn .check { flex: none; order: 2; }- .turn .check input:checked + .box, .turn .check input:indeterminate + .box { background: transparent; border-color: var(--text-3); }- .turn .check:hover .box { border-color: var(--text-2); }- .turn .box::after { border-color: var(--text-2); }- .check input:indeterminate + .box::after { opacity: 1; width: 8px; height: 0; margin-top: 0; border: 0; border-top: 2px solid var(--text-2); transform: none; }-- .row { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background .15s; }- .row:hover { background: var(--bg-hover); }- /* Two flashes on the row picked in the bar above. */- .row.flash { animation: flash 1.2s ease-in-out; }- @keyframes flash {- 0%, 50%, 100% { box-shadow: inset 0 0 0 0 transparent; }- 20%, 30%, 70%, 80% { box-shadow: inset 0 0 0 2px var(--warn); background: var(--warn-bg); }- }- @media (prefers-reduced-motion: reduce) { .row.flash { animation: none; box-shadow: inset 0 0 0 2px var(--warn); } }- .thumb {- position: relative; flex: none; width: 64px; height: 64px; padding: 0; border: 1px solid var(--border);- border-radius: 10px; background: var(--bg-soft); overflow: hidden; cursor: zoom-in;- transition: border-color .15s, box-shadow .15s;- }- .thumb:hover { border-color: var(--border-strong); box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 10%, transparent); }- .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity .15s, filter .15s; }- .thumb .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 11px; }- .thumb.loading::after {+ .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }+ .tile { position: relative; aspect-ratio: 1 / 1; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }+ .tile:hover { border-color: var(--border-strong); box-shadow: 0 2px 8px color-mix(in srgb, var(--text) 10%, transparent); }+ .tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s, filter .15s; }+ .tile .none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 11px; }+ .tile.loading::after {content: ""; position: absolute; inset: 0;background: linear-gradient(100deg, transparent 20%, var(--bg-hover) 50%, transparent 80%) var(--bg-soft);background-size: 200% 100%; animation: shimmer 1.2s linear infinite;}@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }- .row.off .thumb img { opacity: .4; filter: grayscale(1); }+ /* Not sent (manual mode): faded, with a dashed edge. No longer in context: faded further. */+ .tile.off { border-style: dashed; border-color: var(--border-strong); }+ .tile.off img { opacity: .4; filter: grayscale(1); }+ .tile.gone img { opacity: .3; filter: grayscale(1); }+ .mark { position: absolute; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 90%, transparent); color: var(--text-2); font-size: 11px; font-weight: 500; line-height: 18px; white-space: nowrap; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent); pointer-events: none; }+ .mark.state { top: 4px; right: 4px; }+ .mark.when { top: 4px; left: 4px; }+ .mark.corner { bottom: 4px; right: 4px; border-radius: 5px; }+ .mark.pin { background: var(--info); color: var(--bg); box-shadow: none; }+ .mark.fetched { background: var(--info-bg); color: var(--info); }+ .mark.warn { background: var(--warn-bg); color: var(--warn); }+ /* Two flashes on the thumbnail an id button found. */+ .tile.flash { animation: flash 1.2s ease-in-out; }+ @keyframes flash {+ 0%, 50%, 100% { box-shadow: 0 0 0 0 transparent; }+ 20%, 30%, 70%, 80% { box-shadow: 0 0 0 3px var(--warn); }+ }+ @media (prefers-reduced-motion: reduce) { .tile.flash { animation: none; box-shadow: 0 0 0 3px var(--warn); } }- .check { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; cursor: pointer; }- .check.locked { cursor: default; }- .info { display: block; flex: 1; min-width: 0; }- .line1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 14px; line-height: 20px; }- .id { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }- .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }- .meta { display: block; margin-top: 2px; color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }- .row.off .id, .row.off .name { color: var(--text-3); }- .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }- .tags:empty { display: none; }- .tag { padding: 0 8px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); font-size: 11.5px; font-weight: 500; line-height: 20px; white-space: nowrap; }- .tag.warn { background: var(--warn-bg); color: var(--warn); }- .tag.fetched { background: var(--info-bg); color: var(--info); }+ /* The preview, inside the panel in place of the list. */+ .preview { display: flex; flex-direction: column; min-height: 100%; padding-top: 10px; }+ .preview-top { flex: none; display: flex; align-items: center; gap: 10px; }+ .back { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 4px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: background .15s; }+ .back:hover { background: var(--bg-hover); }+ .back svg { width: 15px; height: 15px; }+ .preview-meta { flex: 1; min-width: 0; text-align: right; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }+ .preview-meta b { color: var(--text); font-weight: 600; }+ .stage { flex: 1; min-height: 160px; margin-top: 10px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--bg-soft); overflow: hidden; }+ .stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }+ .stage .none { color: var(--text-3); font-size: 12.5px; }+ .stage.loading img { filter: blur(6px); opacity: .7; }+ .preview-bottom { flex: none; display: flex; align-items: center; gap: 10px; padding-top: 10px; }+ .preview-note { flex: 1; min-width: 0; color: var(--text-3); font-size: 12px; }- .check input { position: absolute; opacity: 0; pointer-events: none; }- .box {- flex: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border-strong);- display: grid; place-items: center; transition: background .15s, border-color .15s;- }- .check:hover .box { border-color: var(--text-3); }- .box::after { content: ""; width: 8px; height: 4.5px; margin-top: -2px; border: 2px solid var(--accent-text); border-top: 0; border-right: 0; transform: rotate(-45deg); opacity: 0; transition: opacity .12s; }- .check input:checked + .box { background: var(--accent); border-color: var(--accent); }- .check input:checked + .box::after { opacity: 1; }- .check input:disabled + .box { opacity: .35; }- .check input:focus-visible + .box { outline: 2px solid var(--info); outline-offset: 2px; }+ /* A switch: the footer's (自动选图) and the preview's (每轮都发 / 发送). */+ .switch { flex: none; position: relative; display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer; user-select: none; white-space: nowrap; }+ .switch input { position: absolute; opacity: 0; pointer-events: none; }+ .switch .sw { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }+ .switch .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: left .15s; }+ .switch input:checked + .sw { background: var(--accent); }+ .switch input:checked + .sw::after { left: 14px; background: var(--accent-text); }+ .switch input:disabled + .sw { opacity: .5; }+ .switch input:disabled ~ * { cursor: default; }+ .switch input:focus-visible + .sw { outline: 2px solid var(--info); outline-offset: 2px; }- .notice { margin: 12px 8px 0; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start; }+ .notice { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; display: flex; gap: 10px; align-items: flex-start; }.notice.warn { background: var(--warn-bg); color: var(--warn); }.notice.error { background: var(--danger-bg); color: var(--danger); }.notice.info { background: var(--info-bg); color: var(--text); }@@ -236,69 +213,35 @@.empty svg { width: 36px; height: 36px; margin-bottom: 6px; }.empty strong { color: var(--text-2); font-weight: 500; font-size: 14px; }.empty span { font-size: 12.5px; max-width: 260px; }+ .nothing { padding: 28px 0; text-align: center; color: var(--text-3); font-size: 12.5px; }- footer { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-top: 1px solid var(--border); background: var(--bg); }+ footer { flex: none; display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 16px; border-top: 1px solid var(--border); background: var(--bg); }.status { flex: 1; min-width: 0; color: var(--text-3); font-size: 12.5px; }- /* v0.3: the automatic selection switch, at the end of the footer whose line says what a tick means. */- .auto { flex: none; position: relative; display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer; user-select: none; white-space: nowrap; }- .auto input { position: absolute; opacity: 0; pointer-events: none; }- .auto .sw { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }- .auto .sw::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: left .15s; }- .auto input:checked + .sw { background: var(--accent); }- .auto input:checked + .sw::after { left: 14px; background: var(--accent-text); }- .auto input:disabled + .sw { opacity: .5; }- .auto input:focus-visible + .sw { outline: 2px solid var(--info); outline-offset: 2px; }- [hidden] { display: none !important; }-- .viewer { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; background: rgb(19 19 19); color: rgb(245 245 245); }- .viewer-top, .viewer-bottom { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; }- .viewer-title { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; font-size: 14px; }- .viewer-title .name { color: rgb(255 255 255 / 62%); }- .viewer-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 14px; }- .viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }- .viewer-stage .none { color: rgb(255 255 255 / 55%); font-size: 12.5px; }- .viewer-stage.loading img { filter: blur(6px); opacity: .7; }- .viewer-bottom .meta { flex: 1; color: rgb(255 255 255 / 55%); margin: 0; }- .icon-btn { width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: rgb(255 255 255 / 80%); cursor: pointer; display: grid; place-items: center; transition: background .15s; }- .icon-btn:hover { background: rgb(255 255 255 / 12%); }- .viewer .check { flex: none; gap: 8px; color: rgb(245 245 245); font-size: 13px; font-weight: 500; }- .viewer .box { border-color: rgb(255 255 255 / 45%); }- .viewer .check:hover .box { border-color: rgb(255 255 255 / 75%); }- .viewer .check input:checked + .box { background: rgb(245 245 245); border-color: rgb(245 245 245); }- .viewer .box::after { border-color: rgb(19 19 19); }</style></head><body><header>- <div class="title"><h1 id="title">上下文素材</h1><span class="count" id="count"></span><div class="actions"><button class="icon-quiet" id="filter" type="button" hidden aria-expanded="false" aria-controls="filters"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M7 12h10"/><path d="M10 18h4"/></svg><span class="dot" hidden></span></button><button class="icon-quiet" id="refresh" type="button" title="刷新" aria-label="刷新"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg></button><span class="plugin" id="plugin"></span></div></div>- <div class="plan" id="plan">正在读取…</div>- <div class="meter" id="meter" hidden>- <div class="meter-head"><span id="meterLabel"></span><b id="meterValue"></b><span class="meter-full" id="meterFull"></span></div>- <div class="bar"><i id="meterBar"></i></div>- </div>- <div class="last" id="last"></div>+ <div class="title"><h1 id="title">上下文素材</h1><div class="actions"><button class="icon-quiet" id="refresh" type="button" title="刷新" aria-label="刷新"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg></button><span class="plugin" id="plugin"></span></div></div>+ <section class="card" id="card">+ <div class="card-head"><span id="meterLabel">正在读取…</span><b id="meterValue"></b><span class="card-full" id="meterFull"></span></div>+ <div class="bar" id="meterBarBox"><i id="meterBar"></i></div>+ <div class="line" id="nextLine"><span class="k" id="nextLabel"></span><span class="v" id="nextValue"></span></div>+ <div id="details" hidden>+ <div class="line" id="lastLine"><span class="k" id="lastLabel"></span><span class="v" id="lastValue"></span></div>+ <div class="line" id="fetchedLine"><span class="k" id="fetchedLabel"></span><span class="ids" id="fetchedIds"></span></div>+ <div class="line" id="childrenLine"><span class="k" id="childrenLabel"></span><span class="v" id="childrenValue"></span></div>+ </div>+ <button class="more" id="more" type="button" aria-expanded="false" aria-controls="details"><span></span><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></button>+ </section><div class="needs" id="needs" hidden></div>- <div class="children" id="children" hidden></div>- <div class="filters" id="filters" role="group" hidden></div>+ <label class="search" id="searchBox"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg><input id="search" type="search" autocomplete="off" spellcheck="false"></label>+ <div class="chips" id="chips" role="group"></div></header><main id="main"></main><footer><div class="status" id="status"></div>- <label class="auto" id="auto" hidden><span class="auto-label"></span><input type="checkbox" role="switch"><span class="sw"></span></label>+ <label class="switch" id="auto" hidden><span class="auto-label"></span><input type="checkbox" role="switch"><span class="sw"></span></label></footer>-<div class="viewer" id="viewer" hidden role="dialog" aria-modal="true" aria-label="图片预览">- <div class="viewer-top">- <div class="viewer-title"><span class="id" id="viewerId"></span><span class="name" id="viewerName"></span></div>- <button class="icon-btn" id="viewerClose" aria-label="关闭预览" title="关闭(Esc)">- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M2 2l10 10M12 2 2 12"/></svg>- </button>- </div>- <div class="viewer-stage" id="viewerStage"></div>- <div class="viewer-bottom">- <span class="meta" id="viewerMeta"></span>- <label class="check" id="viewerCheck"><input type="checkbox"><span class="box"></span><span class="label">发送这张图</span></label>- </div>-</div><!-- The panel's words (v0.1-14): Simplified Chinese and English, the same keys in both (a unit test checks it);"key_one" is the English text for a count of one. --><script type="application/json" id="messages">@@ -311,76 +254,89 @@"refresh": "刷新","refresh.at": "刷新(上次更新 {time})","refresh.stale": "刷新(有一会儿没更新了;上次更新 {time})",- "filter.toggle": "按来源筛选",- "filter.all": "全部",- "count.shown": "显示 {shown} 张,共 {total} 张","plugin.disable": "停用插件","plugin.enable": "启用插件",- "plan.loading": "正在读取…",- "plan.failed": "读取失败",- "plan.empty": "还没有图片",- "plan.next": "下一条消息:发送 {sent} 张",- "plan.nextAuto": "下一条消息:固定发送 {sent} 张",- "plan.dropped": " · 占位 {dropped} 张",- "plan.duplicates": "(其中重复 {duplicates} 张)",- "plan.gone": " · {gone} 张已不在上下文",+ "meter.loading": "正在读取…",+ "meter.failed": "读取失败",+ "meter.empty": "还没有图片","meter.request": "预计请求",- "meter.requestAuto": "预计请求",+ "meter.images": "预计图片数据","meter.atLeast": "{bytes} 起","meter.autoNote": "模型这一轮要取回的图不算在内(事先不知道会取哪几张)",- "meter.images": "预计图片数据","meter.full": "全部发送 {full} · 省 {percent}%",- "meter.none": "未取消任何图",- "last.noBaseline": "还没有记录到经过代理的完整请求,先按图片大小估算",- "last.skipped": "上一次请求 {time}:没能替换,原样发出 {bytes}",- "last.replaced": "上一次请求 {time}:替换了 {count} 张,少发 {saved},实际发出 {after}",- "last.none": "上一次请求 {time}:没有替换,发出 {bytes}",- "last.resent": "上一次请求 {time}:补回压缩前的图 {resent} 张,替换了 {count} 张,实际发出 {after}",+ "meter.none": "没有省略任何图",+ "next.label": "下一条消息",+ "next.auto": "每轮都发 {sent} 张",+ "next.manual": "照常发送 {sent} 张",+ "next.dropped": " · 占位 {dropped} 张",+ "next.duplicates": "(其中重复 {duplicates} 张)",+ "next.gone": " · {gone} 张已不在上下文",+ "card.more": "展开详情",+ "card.less": "收起",+ "last.label": "上一次请求 {time}",+ "last.labelNone": "上一次请求",+ "last.noBaseline": "还没有经过代理的完整请求,先按图片大小估算",+ "last.skipped": "没能替换,原样发出 {bytes}",+ "last.replaced": "替换 {count} 张 · 少发 {saved}",+ "last.none": "没有替换,发出 {bytes}",+ "last.resent": "补回压缩前的图 {resent} 张 · 替换 {count} 张",+ "fetched.label": "最近一轮模型取回",+ "fetched.none": "没有取回",+ "children.label": "子代理和旁聊 {count} 个",+ "children.saved": "上次共少发 {saved}",+ "children.none": "上次没有替换",+ "needs.title": "模型需要 {count} 张没发送的图",+ "id.jump": "在列表里找到 {id}",+ "search.placeholder": "画面,或你当时说过的话",+ "search.label": "搜索图片",+ "chips.label": "筛选图片",+ "chip.all": "全部",+ "chip.upload": "上传",+ "chip.generated": "生成",+ "chip.other": "其他","kind.upload": "用户上传","kind.view": "查看的图片","kind.generated": "生成的图片","kind.tool": "工具返回","kind.pdf": "PDF 页面","kind.browser": "网页截图",- "tag.locked": "无法取消",- "tag.gone": "已不在上下文",- "tag.compacted": "压缩前",- "tag.requested": "模型需要这张",- "needs.title": "模型需要 {count} 张没发送的图:",- "needs.jump": "在列表里定位到 {id}",- "fetched.title": "最近一轮模型取回 {count} 张:",- "tag.fetched": "模型取回",- "tag.replacedBy": "由 {id} 代替",- "tag.notSent": "不发送",- "tag.sameAs": "与 {id} 相同",+ "mark.pinned": "每轮都发",+ "mark.fetched": "刚取回",+ "mark.notSent": "不发送",+ "mark.requested": "模型需要",+ "mark.locked": "无法取消",+ "mark.gone": "已不在上下文",+ "mark.compacted": "压缩前",+ "corner.pdf": "PDF 第 {page} 页",+ "corner.pdfAny": "PDF",+ "corner.browser": "网页","turn.n": "第 {n} 轮","turn.earlier": "更早",- "turn.all": "发送第 {n} 轮的全部图片",- "turn.allEarlier": "发送更早的全部图片",- "turn.shown": "发送第 {n} 轮列出的图片",- "turn.shownEarlier": "发送更早列出的图片",- "turn.pinAll": "第 {n} 轮的全部图片固定发送",- "turn.pinAllEarlier": "更早的全部图片固定发送",- "turn.pinShown": "第 {n} 轮列出的图片固定发送",- "turn.pinShownEarlier": "更早列出的图片固定发送",- "row.unnamed": "未命名",- "row.pdfPage": "PDF 第 {page} 页",- "row.preview": "预览 {id}",- "row.send": "发送 {id}",- "row.pin": "固定发送 {id}",- "thumb.none": "无预览",+ "turn.allOff": "整轮不发",+ "turn.allOn": "整轮发送",+ "tile.open": "预览 {id}",+ "preview.back": "返回",+ "preview.pin": "每轮都发",+ "preview.send": "发送",+ "preview.loading": "正在加载…",+ "preview.none": "这张图无法预览",+ "preview.sameAs": "与 {id} 相同",+ "preview.locked": "这张图无法取消,每轮都会发送",+ "preview.gone": "这张图已不在上下文,不会再发送",+ "preview.compacted": "压缩前的图:打开后由插件补发","empty.title": "这个任务里还没有图片","empty.text": "上传、查看或生成的图片会按时间顺序出现在这里。",+ "empty.search": "没有找到相关的图片","notice.retry": "重试",- "notice.enabled": "已启用。重启 Codex 后生效,取消勾选的图就不再发送了。",- "notice.disabled": "已停用。重启 Codex 后恢复直连,取消勾选不再生效。要卸载插件,现在可以去插件页面移除。",- "notice.notEnabled": "插件没有启用:Codex 现在直连,取消勾选不会生效。点右上角的“启用插件”,然后重启 Codex。",+ "notice.enabled": "已启用,重启 Codex 后生效。",+ "notice.disabled": "已停用,重启 Codex 后生效;随时可以点“启用插件”撤回。要卸载插件,现在可以去插件页面移除。",+ "notice.notEnabled": "插件没有启用:Codex 现在直连,这里的设置不会生效。点右上角的“启用插件”,然后重启 Codex。","notice.waiting": "这个任务还没开始。发出第一条消息后,这里会自动切到这个任务。","notice.historyMissing": "这个任务前面有一段历史找不到了(它所在的任务记录可能已被删除),那一段里的图片没法在这里列出。",- "notice.engineDown": "代理没有在运行,取消勾选暂时不会生效。关掉 Codex 再打开,一般就能恢复。",- "notice.skipped": "上一次请求({time})没能按勾选替换,图片原样发给了模型。原因:{reason}。",- "notice.websocket": "取消勾选时这一轮对话还在进行,这一轮剩下的请求仍带着原图;从下一条消息起生效。",- "notice.thinking": "这个账号会校验思考记录:上一次请求({time})去掉了 {count} 段和现在的勾选对不上的思考记录,模型可能要重新思考,多用一些 token。",+ "notice.engineDown": "代理没有在运行,这里的设置暂时不会生效。关掉 Codex 再打开,一般就能恢复。",+ "notice.skipped": "上一次请求({time})没能按这里的设置替换,图片原样发给了模型。原因:{reason}。",+ "notice.websocket": "改设置时这一轮对话还在进行,这一轮剩下的请求仍带着原图;从下一条消息起生效。",+ "notice.thinking": "这个账号会校验思考记录:上一次请求({time})去掉了 {count} 段和现在的设置对不上的思考记录,模型可能要重新思考,多用一些 token。","reason.undecodable": "请求内容无法解压","reason.unparsable": "请求内容无法解析","reason.format": "请求的格式和预期不同",@@ -390,30 +346,10 @@"reason.thinking": "这个账号不接受改过的对话历史(思考记录的校验),引擎改发了原始请求","chooser.title": "刚刚开始了好几个任务,这个面板要显示哪一个?","chooser.untitled": "新任务",- "footer.hint": "勾选的图片会随下一条消息发给模型",- "footer.hintAuto": "勾选的图每轮都发,其余由模型按需取回",+ "footer.hint": "图默认都发,可在预览里关掉",+ "footer.hintAuto": "其余图由模型按需取回","auto.label": "自动选图",- "auto.title": "打开后,之前各轮的图默认不发,模型需要时自己按编号取回;勾选的图每轮都发",- "children.title": "子代理和旁聊",- "children.saved": " · 上次请求共少发 {saved}",- "children.auto": "也自动选图",- "children.autoTitle": "打开后,这个任务的子代理和旁聊也按自动选图发图:之前各轮的图默认不发,模型需要时按编号取回;关掉则原样发送",- "children.subagent": "子代理",- "children.sideAt": "旁聊 {time}",- "children.ruleAuto": "自动选图",- "children.ruleOff": "原样发送",- "children.images": "{count} 张图",- "children.noRequest": "还没有经过代理的请求",- "children.lastReplaced": "上次 {time}:替换了 {count} 张,少发 {saved}",- "children.lastNone": "上次 {time}:没有替换",- "children.lastSkipped": "上次 {time}:没能替换,原样发出",- "viewer.label": "图片预览",- "viewer.close": "关闭预览",- "viewer.closeTitle": "关闭(Esc)",- "viewer.send": "发送这张图",- "viewer.pin": "固定发送这张图",- "viewer.loading": "正在加载…",- "viewer.none": "这张图无法预览",+ "auto.title": "打开后,之前各轮的图默认不发,模型需要时自己按编号取回;在预览里打开“每轮都发”的图每轮都发","error.load": "读取失败:{message}","error.save": "保存失败:{message}","error.switch": "切换失败:{message}",@@ -430,84 +366,93 @@"refresh": "Refresh","refresh.at": "Refresh (last updated {time})","refresh.stale": "Refresh (not updated for a while; last updated {time})",- "filter.toggle": "Filter by source",- "filter.all": "All",- "count.shown": "Showing {shown} of {total} images","plugin.disable": "Disable plugin","plugin.enable": "Enable plugin",- "plan.loading": "Loading…",- "plan.failed": "Could not load",- "plan.empty": "No images yet",- "plan.next": "Next message sends {sent} images",- "plan.next_one": "Next message sends {sent} image",- "plan.nextAuto": "Next message: {sent} pinned images",- "plan.nextAuto_one": "Next message: {sent} pinned image",- "plan.dropped": " · {dropped} as placeholders",- "plan.dropped_one": " · {dropped} as a placeholder",- "plan.duplicates": " ({duplicates} of them duplicates)",- "plan.duplicates_one": " ({duplicates} of them a duplicate)",- "plan.gone": " · {gone} no longer in context",+ "meter.loading": "Loading…",+ "meter.failed": "Could not load",+ "meter.empty": "No images yet","meter.request": "Estimated request",- "meter.requestAuto": "At least",- "meter.atLeast": "{bytes}",- "meter.autoNote": "Images the model fetches this turn are not counted (they are not known beforehand)","meter.images": "Estimated image data",+ "meter.atLeast": "{bytes}+",+ "meter.autoNote": "Images the model fetches this turn are not counted (they are not known beforehand)","meter.full": "All images {full} · {percent}% saved",- "meter.none": "Nothing unchecked",- "last.noBaseline": "No full request through the proxy recorded yet; estimated from the image sizes",- "last.skipped": "Last request {time}: not rewritten, sent as it was ({bytes})",- "last.replaced": "Last request {time}: {count} images replaced, {saved} less, {after} sent",- "last.replaced_one": "Last request {time}: {count} image replaced, {saved} less, {after} sent",- "last.none": "Last request {time}: nothing replaced, {bytes} sent",- "last.resent": "Last request {time}: sent again from before the compaction: {resent}; replaced: {count}; {after} sent",+ "meter.none": "Nothing left out",+ "next.label": "Next message",+ "next.auto": "{sent} sent every turn",+ "next.manual": "{sent} sent",+ "next.dropped": " · {dropped} as placeholders",+ "next.dropped_one": " · {dropped} as a placeholder",+ "next.duplicates": " ({duplicates} of them duplicates)",+ "next.duplicates_one": " ({duplicates} of them a duplicate)",+ "next.gone": " · {gone} no longer in context",+ "card.more": "Show details",+ "card.less": "Hide details",+ "last.label": "Last request {time}",+ "last.labelNone": "Last request",+ "last.noBaseline": "No full request through the proxy yet; estimated from the image sizes",+ "last.skipped": "Not rewritten, sent as it was ({bytes})",+ "last.replaced": "{count} replaced · {saved} less",+ "last.none": "Nothing replaced, {bytes} sent",+ "last.resent": "{resent} sent again from before the compaction · {count} replaced",+ "fetched.label": "Fetched by the model last turn",+ "fetched.none": "None",+ "children.label": "Subagents & side chats: {count}",+ "children.saved": "{saved} less last time",+ "children.none": "Nothing replaced last time",+ "needs.title": "The model needs {count} unsent images",+ "needs.title_one": "The model needs {count} unsent image",+ "id.jump": "Find {id} in the list",+ "search.placeholder": "What it shows, or what you said then",+ "search.label": "Search images",+ "chips.label": "Filter images",+ "chip.all": "All",+ "chip.upload": "Uploaded",+ "chip.generated": "Generated",+ "chip.other": "Other","kind.upload": "Uploaded","kind.view": "Viewed","kind.generated": "Generated","kind.tool": "Tool result","kind.pdf": "PDF page","kind.browser": "Web page",- "tag.locked": "Can't uncheck",- "tag.gone": "No longer in context",- "tag.compacted": "Before compaction",- "tag.requested": "The model needs this",- "needs.title": "The model needs {count} unsent images:",- "needs.title_one": "The model needs {count} unsent image:",- "needs.jump": "Show {id} in the list",- "fetched.title": "The model fetched {count} images in the latest turn:",- "fetched.title_one": "The model fetched {count} image in the latest turn:",- "tag.fetched": "Fetched by the model",- "tag.replacedBy": "Replaced by {id}",- "tag.notSent": "Not sent",- "tag.sameAs": "Same as {id}",+ "mark.pinned": "Every turn",+ "mark.fetched": "Just fetched",+ "mark.notSent": "Not sent",+ "mark.requested": "Model needs it",+ "mark.locked": "Can't turn off",+ "mark.gone": "Out of context",+ "mark.compacted": "Before compaction",+ "corner.pdf": "PDF p. {page}",+ "corner.pdfAny": "PDF",+ "corner.browser": "Web","turn.n": "Turn {n}","turn.earlier": "Earlier",- "turn.all": "Send all images from turn {n}",- "turn.allEarlier": "Send all earlier images",- "turn.shown": "Send the listed images from turn {n}",- "turn.shownEarlier": "Send the listed earlier images",- "turn.pinAll": "Pin every image of turn {n}",- "turn.pinAllEarlier": "Pin every earlier image",- "turn.pinShown": "Pin the listed images of turn {n}",- "turn.pinShownEarlier": "Pin the listed earlier images",- "row.unnamed": "Unnamed",- "row.pdfPage": "PDF page {page}",- "row.preview": "Preview {id}",- "row.send": "Send {id}",- "row.pin": "Pin {id}",- "thumb.none": "No preview",+ "turn.allOff": "Don't send this turn",+ "turn.allOn": "Send this turn",+ "tile.open": "Preview {id}",+ "preview.back": "Back",+ "preview.pin": "Send every turn",+ "preview.send": "Send",+ "preview.loading": "Loading…",+ "preview.none": "This image cannot be previewed",+ "preview.sameAs": "Same as {id}",+ "preview.locked": "This image can't be turned off; it is sent every turn",+ "preview.gone": "This image is no longer in context and will not be sent again",+ "preview.compacted": "From before the compaction: turned on, the plugin sends it again","empty.title": "No images in this task yet","empty.text": "Images you upload, and images the model views or generates, show up here in order.",+ "empty.search": "No matching images","notice.retry": "Retry",- "notice.enabled": "Enabled. After you restart Codex, unchecked images are no longer sent.",- "notice.disabled": "Disabled. After you restart Codex it connects directly, and unchecking has no effect. To uninstall, you can now remove the plugin on the plugins page.",- "notice.notEnabled": "The plugin is not enabled: Codex connects directly, so unchecking has no effect. Click \"Enable plugin\" at the top right, then restart Codex.",+ "notice.enabled": "Enabled; takes effect after you restart Codex.",+ "notice.disabled": "Disabled; takes effect after you restart Codex. You can undo it any time with \"Enable plugin\". To uninstall, you can now remove the plugin on the plugins page.",+ "notice.notEnabled": "The plugin is not enabled: Codex connects directly, so the settings here have no effect. Click \"Enable plugin\" at the top right, then restart Codex.","notice.waiting": "This task has not started yet. Once you send the first message, the panel switches to it.","notice.historyMissing": "An earlier part of this task's history cannot be found (the task it came from may have been deleted), so the images from that part are not listed here.",- "notice.engineDown": "The proxy is not running, so unchecking has no effect for now. Closing and reopening Codex usually brings it back.",- "notice.skipped": "The last request ({time}) could not be rewritten as selected; the images went to the model as they were. Reason: {reason}.",- "notice.websocket": "This turn was still running when you unchecked images, so its remaining requests still carry the originals; the change applies from the next message.",- "notice.thinking": "This account checks thinking records: the last request ({time}) left out {count} thinking records that no longer match the selection, so the model may think again and use more tokens.",- "notice.thinking_one": "This account checks thinking records: the last request ({time}) left out {count} thinking record that no longer matches the selection, so the model may think again and use more tokens.",+ "notice.engineDown": "The proxy is not running, so the settings here have no effect for now. Closing and reopening Codex usually brings it back.",+ "notice.skipped": "The last request ({time}) could not be rewritten as set here; the images went to the model as they were. Reason: {reason}.",+ "notice.websocket": "This turn was still running when you changed the settings, so its remaining requests still carry the originals; the change applies from the next message.",+ "notice.thinking": "This account checks thinking records: the last request ({time}) left out {count} thinking records that no longer match the settings, so the model may think again and use more tokens.",+ "notice.thinking_one": "This account checks thinking records: the last request ({time}) left out {count} thinking record that no longer matches the settings, so the model may think again and use more tokens.","reason.undecodable": "the request could not be decompressed","reason.unparsable": "the request could not be parsed","reason.format": "the request is not in the expected format",@@ -517,31 +462,10 @@"reason.thinking": "this account does not accept edited conversation history (the thinking check), so the engine sent the original request","chooser.title": "Several tasks just started. Which one should this panel show?","chooser.untitled": "New task",- "footer.hint": "Checked images go to the model with the next message",- "footer.hintAuto": "Checked images go every turn; the model fetches the rest as needed",+ "footer.hint": "Every image is sent; turn one off in its preview",+ "footer.hintAuto": "The model fetches the rest as needed","auto.label": "Auto-select",- "auto.title": "When on, images from earlier turns are left out by default and the model fetches the ones it needs by id; checked images go every turn",- "children.title": "Subagents & side chats",- "children.saved": " · {saved} saved last time",- "children.auto": "Auto-select too",- "children.autoTitle": "When on, this task's subagents and side chats use Auto-select too: images from earlier turns are left out by default and the model fetches the ones it needs by id. When off, their requests go out as they are",- "children.subagent": "Subagent",- "children.sideAt": "Side chat {time}",- "children.ruleAuto": "Auto-select",- "children.ruleOff": "Sent as is",- "children.images": "{count} images",- "children.images_one": "{count} image",- "children.noRequest": "No request through the proxy yet",- "children.lastReplaced": "Last {time}: {count} replaced, {saved} less",- "children.lastNone": "Last {time}: nothing replaced",- "children.lastSkipped": "Last {time}: not rewritten, sent as it was",- "viewer.label": "Image preview",- "viewer.close": "Close preview",- "viewer.closeTitle": "Close (Esc)",- "viewer.send": "Send this image",- "viewer.pin": "Pin this image",- "viewer.loading": "Loading…",- "viewer.none": "This image cannot be previewed",+ "auto.title": "When on, images from earlier turns are left out by default and the model fetches the ones it needs by id; images set to \"Send every turn\" in their preview go every turn","error.load": "Could not load: {message}","error.save": "Could not save: {message}","error.switch": "Could not switch: {message}",@@ -554,7 +478,7 @@</script><script>(() => {- const THUMB_SIDE = 160;+ const THUMB_SIDE = 240;const POLL_MS = 3000;const STALE_MS = 30000; // older than this, the 刷新 button turns orangeconst $ = (id) => document.getElementById(id);@@ -592,13 +516,13 @@document.documentElement.lang = lang === "zh" ? "zh-CN" : "en";document.title = t("page.title");$("refresh").setAttribute("aria-label", t("refresh"));- $("viewer").setAttribute("aria-label", t("viewer.label"));- $("viewerClose").setAttribute("aria-label", t("viewer.close"));- $("viewerClose").title = t("viewer.closeTitle");- $("viewerCheck").querySelector(".label").textContent = t("viewer.send");+ $("search").placeholder = t("search.placeholder");+ $("search").setAttribute("aria-label", t("search.label"));+ $("chips").setAttribute("aria-label", t("chips.label"));emptyState.querySelector("strong").textContent = t("empty.title");emptyState.querySelector("span").textContent = t("empty.text");- turnLabels.clear();+ nothingFound.textContent = t("empty.search");+ turnParts.clear(); chipsKey = ""; needsKey = ""; fetchedKey = ""; pluginKey = "";render();}@@ -651,8 +575,7 @@// ---- v0.1-21: the frame's height ----// Codex 26.924 gives the page no fixed height, only the most it may take (containerDimensions); by MCP Apps, a page// then reports the height it wants (ui/notifications/size-changed). The panel asks for all it may take; if the frame- // it then gets is smaller (a host may cap it), it fits that frame, so the footer stays in view. A fixed height is- // simply filled. (The strip users saw in 26.924 was the page scrolled away, not a short frame: see .turn above.)+ // it then gets is smaller (a host may cap it), it fits that frame, so the footer stays in view.const frame = { asked: 0, timer: 0 };function fitFrame(dimensions) {const height = Math.floor(Number(dimensions.height) || Number(dimensions.maxHeight) || 0);@@ -681,17 +604,16 @@const S = {data: null, threadId: null,error: null, // { key, message }: said in the current language when drawn- unsaved: new Map(), // id -> checked, clicked and shown already, saved by the next call (v0.1-22)+ unsaved: new Map(), // id -> on, switched and shown already, saved by the next call (v0.1-22)thumbs: new Map(), // id -> data URL or null- viewer: null, // { id, url, loading, failed }+ preview: null, // { id, url, loading }refreshing: false, saving: false,switching: false, // a 启用插件 / 停用插件 call is under wayswitchingTask: false, // a cam_bind call is under waymanual: false, // the running refresh was asked for with the 刷新 button- filter: { open: false, sources: new Set() }, // v0.2: the filter bar, and the sources shown (none picked: all)+ query: "", chip: "all", // v0.8: the search and the one filter picked+ cardOpen: false, // v0.8: the request card unfoldedautoPending: null, // v0.3: the switch's new state while it is being saved- childrenOpen: false, // v0.7: the subagents and side chats unfolded- childrenPending: null, // v0.7: their switch's new state while it is being saved};let lastFresh = 0; // when the panel last received the thread's state// When this page was on screen (v0.1-10), sent with every read: a panel on a new chat is offered the threads started@@ -702,8 +624,8 @@let screenGap = true;const images = () => S.data?.images ?? [];const byId = (id) => images().find((image) => image.id === id);- const isChecked = (image) => (S.unsaved.has(image.id) ? S.unsaved.get(image.id) : image.checked);- // v0.3: automatic selection; a tick then pins the image (the plugin keeps the two kinds of ticks apart).+ // On: sent (manual mode), or sent every turn (automatic selection). The plugin keeps the two kinds apart.+ const isOn = (image) => (S.unsaved.has(image.id) ? S.unsaved.get(image.id) : image.checked);const autoOn = () => S.autoPending ?? S.data?.auto ?? false;function ingest(state) {@@ -714,16 +636,17 @@if (signature === S.signature && !S.error) return;S.signature = signature;if (S.threadId && state.threadId !== S.threadId) {- S.unsaved.clear(); S.thumbs.clear(); thumbQueue.length = 0; thumbsInFlight.clear(); closeViewer();- S.filter = { open: false, sources: new Set() };+ S.unsaved.clear(); S.thumbs.clear(); thumbQueue.length = 0; thumbsInFlight.clear();+ S.preview = null; S.query = ""; S.chip = "all"; $("search").value = "";}S.threadId = state.threadId;S.data = state;S.error = null;- for (const [id, checked] of S.unsaved) {+ for (const [id, on] of S.unsaved) {const image = byId(id);- if (!image || !image.replaceable || image.checked === checked) S.unsaved.delete(id);+ if (!image || !image.replaceable || image.checked === on) S.unsaved.delete(id);}+ if (S.preview && !byId(S.preview.id)) S.preview = null;render();}@@ -754,15 +677,14 @@refresh();}- // ---- checking and unchecking: saved at once (v0.1-22, user 2026-09-28: no 确定, no 撤销) ----- // A click shows at once; clicks made while a save is under way go out together right after it.+ // ---- switching images on and off: saved at once (v0.1-22, user 2026-09-28: no 确定, no 撤销) ----+ // A change shows at once; changes made while a save is under way go out together right after it.let lastSaveStarted = 0;- const setChecked = (id, checked) => change([id], checked);- function change(ids, checked) {+ function change(ids, on) {const targets = ids.filter((id) => byId(id)?.replaceable);- // While the switch is being saved, a tick could land in the wrong record.+ // While the switch is being saved, a change could land in the wrong record.if (!targets.length || S.autoPending !== null) return;- for (const id of targets) S.unsaved.set(id, checked);+ for (const id of targets) S.unsaved.set(id, on);render();flush();}@@ -774,15 +696,15 @@S.saving = true; lastSaveStarted = Date.now();try {const result = await callTool("cam_set_selection", {- check: batch.filter(([, checked]) => checked).map(([id]) => id),- uncheck: batch.filter(([, checked]) => !checked).map(([id]) => id),+ check: batch.filter(([, on]) => on).map(([id]) => id),+ uncheck: batch.filter(([, on]) => !on).map(([id]) => id),mode: autoOn() ? "auto" : "manual",});- // An image clicked again meanwhile keeps its newer choice, which the next round saves.- for (const [id, checked] of batch) if (S.unsaved.get(id) === checked) S.unsaved.delete(id);+ // An image switched again meanwhile keeps its newer choice, which the next round saves.+ for (const [id, on] of batch) if (S.unsaved.get(id) === on) S.unsaved.delete(id);ingest(result.structuredContent);} catch (error) {- // The list goes back to what is saved, and the error says why.+ // The panel goes back to what is saved, and the error says why.failed = true;S.unsaved.clear();S.error = { key: "error.save", message: error.message };@@ -793,8 +715,8 @@render();}- // ---- v0.3: the automatic selection switch, saved at once like a tick ----- // Ticks still being saved go first, in the mode they were made in; while the switch saves, no tick is taken.+ // ---- v0.3: the automatic selection switch, saved at once like an image's ----+ // Changes still being saved go first, in the mode they were made in; while the switch saves, no change is taken.async function setAuto(on) {if (S.autoPending !== null) return;S.autoPending = on;@@ -812,24 +734,6 @@render();}- // v0.7: the switch for the task's subagents and side chats, saved the same way.- async function setChildrenAuto(on) {- if (S.childrenPending !== null) return;- S.childrenPending = on;- render();- try {- while (S.saving || S.unsaved.size) { if (!S.saving) await flush(); else await new Promise((resolve) => setTimeout(resolve, 50)); }- lastSaveStarted = Date.now();- const result = await callTool("cam_set_selection", { childrenAuto: on });- S.childrenPending = null;- ingest(result.structuredContent);- } catch (error) {- S.childrenPending = null;- S.error = { key: "error.switch", message: error.message };- }- render();- }-// ---- a panel opened on a new chat follows the thread its first message starts (v0.1-10) ----// The plugin offers only threads started while this page was on screen, so a panel left on another new chat does not// take a task started elsewhere. One: switch to it. Several (e.g. two windows side by side): the user picks one.@@ -872,7 +776,7 @@}}- // ---- images: every thumbnail is queued in list order, a few at a time; rows scrolled into view go first ----+ // ---- images: every thumbnail is queued in list order, a few at a time; tiles scrolled into view go first ----// (Visibility alone is not enough: a page that is hidden or not painted yet gets no intersection updates.)const thumbQueue = [];const thumbsInFlight = new Set();@@ -895,59 +799,59 @@loadImage(id, THUMB_SIDE).then((url) => { if (thread === S.threadId) S.thumbs.set(id, url); }).catch(() => { if (thread === S.threadId) S.thumbs.set(id, null); })- .finally(() => { thumbsInFlight.delete(id); const row = rows.get(id); if (row) paintThumb(row, id); pumpThumbs(); });+ .finally(() => { thumbsInFlight.delete(id); const tile = tiles.get(id); if (tile) paintThumb(tile, id); if (S.preview?.id === id && !S.preview.url) renderList(); pumpThumbs(); });}}const observer = new IntersectionObserver((entries) => {for (const entry of entries) if (entry.isIntersecting) { observer.unobserve(entry.target); queueThumb(entry.target.dataset.id, true); }}, { root: main, rootMargin: "200px 0px" });- // ---- rendering ----- const rows = new Map();- const turnLabels = new Map();- const emptyState = document.createElement("div");- emptyState.className = "empty";- emptyState.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="14" height="14" rx="2.5"/><path d="M7 3h10.5A3.5 3.5 0 0 1 21 6.5V16"/><circle cx="8" cy="11" r="1.5"/><path d="m3.5 18 4.5-4.5 3 3 2-2 3.5 3.5"/></svg><strong></strong><span></span>';+ // ---- what an image is ----const formatBytes = (bytes) => bytes < 1024 ? `${bytes} B` : bytes < 1024 * 1024 ? `${Math.round(bytes / 1024)} KB` : `${(bytes / 1024 / 1024).toFixed(1)} MB`;- // v0.2: an image from a plugin server older than the page has no source; its kind is its source.const sourceOf = (image) => image.source ?? image.kind;- const sourceLabel = (image) => (sourceOf(image) === "pdf" && image.pdfPage ? t("row.pdfPage", { page: image.pdfPage }) : MESSAGES[lang][`kind.${sourceOf(image)}`] ? t(`kind.${sourceOf(image)}`) : image.kind);- const describe = (image) => [sourceLabel(image), image.width && image.height ? `${image.width}×${image.height}` : null, formatBytes(image.bytes)].filter(Boolean).join(" · ");+ const sourceLabel = (image) => (MESSAGES[lang][`kind.${sourceOf(image)}`] ? t(`kind.${sourceOf(image)}`) : image.kind);// A PDF comment screenshot goes by its PDF's name when the comment says which one.- const nameOf = (image) => image.pdfName ?? image.name ?? t("row.unnamed");+ const nameOf = (image) => image.pdfName ?? image.name ?? null;+ // 上传 covers PDF pages and web pages (Codex attaches both with the user's message); 生成 the generated images.+ const uploaded = (image) => ["upload", "pdf", "browser"].includes(sourceOf(image));+ const generated = (image) => sourceOf(image) === "generated";+ const sceneOf = (image) => image.scene ?? null;+ // An image switched off becomes a duplicate placeholder when a copy of the same content still goes out.+ const sentCopyOf = (image) => image.sameAs.find((id) => { const other = byId(id); return other && other.inNextRequest && isOn(other); });+ const changeable = (image) => image.replaceable && image.inNextRequest;- // An unchecked image becomes a duplicate placeholder when a copy of the same content is still sent in that request.- const sentCopyOf = (image) => image.sameAs.find((id) => { const other = byId(id); return other && other.inNextRequest && isChecked(other); });-- function tagsOf(image) {- const tags = [];- if (!image.replaceable) tags.push([t("tag.locked"), ""]);- // v0.5: from before a Claude Code compaction, sent again by the engine when checked.- if (image.compacted) tags.push([t("tag.compacted"), ""]);- // Compacted out of the history: it is not sent either way.- if (!image.inNextRequest) { tags.push([t("tag.gone"), ""]); return tags; }- const checked = isChecked(image);- const sentCopy = sentCopyOf(image);- // v0.3: with automatic selection, what the model fetched in the latest turn; an image not pinned is left out by- // default, so that needs no word on every row.- if (autoOn()) {- if (image.fetched) tags.push([t("tag.fetched"), "fetched"]);- if (!checked && sentCopy) tags.push([t("tag.replacedBy", { id: sentCopy }), ""]);- else if (checked && image.sameAs.length) tags.push([t("tag.sameAs", { id: image.sameAs[0] }), ""]);- return tags;- }- if (!checked && image.requested) tags.push([t("tag.requested"), "warn"]);- if (!checked) tags.push([sentCopy ? t("tag.replacedBy", { id: sentCopy }) : t("tag.notSent"), ""]);- else if (image.sameAs.length) tags.push([t("tag.sameAs", { id: image.sameAs[0] }), ""]);- return tags;- }+ // ---- v0.8: the search and the one filter; what they find, never what is sent ----+ // Everything an image is known by, in the panel's language and in what the model noted (never shown): its id, name,+ // source, scene, feature line and ratings, and what was said in its turn.+ const haystacks = new Map();+ function haystackOf(image) {+ const key = `${lang}|${image.search}|${image.scene}|${S.data?.turnTexts?.[image.turn] ?? ""}`;+ const known = haystacks.get(image.id);+ if (known?.key === key) return known.text;+ const text = [+ image.id, nameOf(image), image.name, sourceLabel(image), uploaded(image) ? t("chip.upload") : "", generated(image) ? t("chip.generated") : "",+ sceneOf(image) ?? t("chip.other"), image.search, S.data?.turnTexts?.[image.turn] ?? "",+ ].filter(Boolean).join(" ").toLowerCase();+ haystacks.set(image.id, { key, text });+ return text;+ }+ const words = () => S.query.trim().toLowerCase().split(/\s+/).filter(Boolean);+ function inChip(image, chip = S.chip) {+ if (chip === "all") return true;+ if (chip === "upload") return uploaded(image);+ if (chip === "generated") return generated(image);+ if (chip === "other") return sceneOf(image) === null;+ return chip === `scene:${sceneOf(image)}`;+ }+ const matches = (image) => inChip(image) && words().every((word) => haystackOf(image).includes(word));+ const searching = () => S.chip !== "all" || words().length > 0;// ---- the next message: what goes out, and the request size against sending everything (an estimate) ----const PLACEHOLDER_CHARS = 700;function forecast() {const list = images();const counted = list.filter((image) => image.inNextRequest);- const dropped = counted.filter((image) => image.replaceable && !isChecked(image));+ const dropped = counted.filter((image) => image.replaceable && !isOn(image));const saved = dropped.reduce((sum, image) => sum + Math.max(0, image.base64Chars - PLACEHOLDER_CHARS), 0);const baseline = S.data?.send?.baseline ?? null;// With a recorded request: its size plus the images added since. Without one: the images alone.@@ -970,121 +874,229 @@return new Intl.DateTimeFormat(lang === "zh" ? "zh-CN" : "en-US", today ? time : { month: lang === "zh" ? "long" : "short", day: "numeric", ...time }).format(date);}- function makeRow(id) {- const row = document.createElement("div");- row.className = "row";- row.dataset.id = id;- row.innerHTML = '<button class="thumb" type="button"></button><label class="check"><span class="info"><span class="line1"><span class="id"></span><span class="name"></span></span><span class="meta"></span><span class="tags"></span></span><input type="checkbox"><span class="box"></span></label>';- row.querySelector(".thumb").addEventListener("click", () => openViewer(id));- row.querySelector("input").addEventListener("change", (event) => setChecked(id, event.target.checked));- observer.observe(row);- return row;- }-- // ---- v0.1-18: a turn's line, with one checkbox for all of its images that can change ----- const changeable = (image) => image.replaceable && image.inNextRequest;- function makeTurnLabel(turn) {- const label = document.createElement("div");- label.className = "turn";- label.innerHTML = '<span class="turn-name"></span><label class="check"><input type="checkbox"><span class="box"></span></label>';- label.querySelector(".turn-name").textContent = turn === null ? t("turn.earlier") : t("turn.n", { n: turn });- const input = label.querySelector("input");- // A click on a checked box unchecks them all; on a mixed or empty one it checks them all.- input.addEventListener("change", () => setTurn(turn, input.checked));- return label;- }- // Hidden below two images: the row's own checkbox does the same. v0.2: it covers the images shown, and says so while- // a filter is on.- function paintTurn(label, turn, group) {- const targets = group.filter(changeable);- const checked = targets.filter(isChecked).length;- const box = label.querySelector(".check");- box.hidden = targets.length < 2;- const keys = autoOn() ? ["turn.pinShownEarlier", "turn.pinAllEarlier", "turn.pinShown", "turn.pinAll"] : ["turn.shownEarlier", "turn.allEarlier", "turn.shown", "turn.all"];- const all = turn === null ? t(filtering() ? keys[0] : keys[1]) : t(filtering() ? keys[2] : keys[3], { n: turn });- box.title = all;- const input = box.querySelector("input");- input.setAttribute("aria-label", all);- input.checked = checked > 0 && checked === targets.length;- input.indeterminate = checked > 0 && checked < targets.length;- }- // Saved at once, like every check (v0.1-21, user 2026-09-27). v0.2: the images shown only.- function setTurn(turn, checked) {- change(images().filter((image) => image.turn === turn && changeable(image) && inFilter(image)).map((image) => image.id), checked);- }-- function paintThumb(row, id) {- const button = row.querySelector(".thumb");- const url = S.thumbs.get(id);- button.classList.toggle("loading", !S.thumbs.has(id));- let img = button.querySelector("img");- if (url) {- if (!img) { img = document.createElement("img"); img.alt = ""; button.replaceChildren(img); }- if (img.src !== url) img.src = url;- } else if (S.thumbs.has(id)) {- button.replaceChildren(Object.assign(document.createElement("span"), { className: "none", textContent: t("thumb.none") }));- }- }-- function paintRow(row, image) {- const checked = isChecked(image);- row.classList.toggle("off", !checked);- row.querySelector(".thumb").setAttribute("aria-label", t("row.preview", { id: image.id }));- row.querySelector(".id").textContent = image.id;- row.querySelector(".name").textContent = nameOf(image);- row.querySelector(".meta").textContent = describe(image);- const input = row.querySelector("input");- input.checked = checked;- input.disabled = !image.replaceable;- input.setAttribute("aria-label", t(autoOn() ? "row.pin" : "row.send", { id: image.id }));- row.querySelector(".check").classList.toggle("locked", !image.replaceable);- const tags = row.querySelector(".tags");- tags.replaceChildren(...tagsOf(image).map(([text, tone]) => {- const tag = document.createElement("span");- tag.className = `tag ${tone}`.trim();- tag.textContent = text;- return tag;- }));- paintThumb(row, image.id);- }-- function renderHeader() {+ // ---- the request card ----+ function renderCard() {const list = images();- const plan = $("plan");const title = !S.data ? t("title.loading") : S.data.title ?? (S.data.started === false ? t("title.newTask") : t("title.unnamed"));$("title").textContent = title;$("title").title = title;- const listed = list.filter(inFilter).length;- $("count").textContent = !list.length ? "" : filtering() ? `${listed}/${list.length}` : String(list.length);- $("count").title = filtering() ? t("count.shown", { shown: listed, total: list.length }) : "";- if (!S.data || !list.length) {- plan.textContent = !S.data ? (S.error ? t("plan.failed") : t("plan.loading")) : t("plan.empty");- $("meter").hidden = true;- $("last").textContent = "";+ const loaded = !!S.data && list.length > 0;+ for (const id of ["meterBarBox", "nextLine", "details", "more"]) $(id).hidden = !loaded;+ if (!loaded) {+ $("meterLabel").textContent = !S.data ? (S.error ? t("meter.failed") : t("meter.loading")) : t("meter.empty");+ $("meterValue").textContent = ""; $("meterFull").textContent = "";return;}const f = forecast();- plan.replaceChildren(- ...rich(autoOn() ? "plan.nextAuto" : "plan.next", { sent: f.sent, count: f.sent }, "sent"),- f.dropped ? t("plan.dropped", { dropped: f.dropped, count: f.dropped }) + (f.duplicates ? t("plan.duplicates", { duplicates: f.duplicates, count: f.duplicates }) : "") : "",- f.gone ? t("plan.gone", { gone: f.gone, count: f.gone }) : "",- );- $("meter").hidden = false;+ const auto = autoOn();// v0.3: with automatic selection, what the model will fetch comes on top, and is not known beforehand.- $("meterLabel").textContent = t(!f.whole ? "meter.images" : autoOn() ? "meter.requestAuto" : "meter.request");- $("meterValue").textContent = autoOn() ? t("meter.atLeast", { bytes: formatBytes(f.after) }) : formatBytes(f.after);- $("meter").title = autoOn() ? t("meter.autoNote") : "";+ $("meterLabel").textContent = t(f.whole ? "meter.request" : "meter.images");+ $("meterValue").textContent = auto ? t("meter.atLeast", { bytes: formatBytes(f.after) }) : formatBytes(f.after);+ $("card").title = auto ? t("meter.autoNote") : "";const saving = f.after < f.full;const percent = (1 - f.after / f.full) * 100;$("meterFull").textContent = saving ? t("meter.full", { full: formatBytes(f.full), percent: percent < 1 ? "<1" : Math.round(percent) }) : t("meter.none");$("meterFull").classList.toggle("saved", saving);$("meterBar").style.width = `${f.full > 0 ? Math.max(2, Math.round((f.after / f.full) * 100)) : 100}%`;+ $("nextLabel").textContent = t("next.label");+ $("nextValue").replaceChildren(+ ...rich(auto ? "next.auto" : "next.manual", { sent: f.sent, count: f.sent }, "sent"),+ f.dropped ? t("next.dropped", { dropped: f.dropped, count: f.dropped }) + (f.duplicates ? t("next.duplicates", { duplicates: f.duplicates, count: f.duplicates }) : "") : "",+ f.gone ? t("next.gone", { gone: f.gone, count: f.gone }) : "",+ );+ const more = $("more");+ more.setAttribute("aria-expanded", String(S.cardOpen));+ more.querySelector("span").textContent = t(S.cardOpen ? "card.less" : "card.more");+ $("details").hidden = !S.cardOpen;+ // The last request through the engine.const last = S.data.send?.last;- $("last").textContent = !last ? (f.whole ? "" : t("last.noBaseline"))- : last.skipped ? t("last.skipped", { time: timeOf(last.at), bytes: formatBytes(last.bytesBefore) })- : last.resent ? t("last.resent", { time: timeOf(last.at), resent: last.resent, count: last.replaced, after: formatBytes(last.bytesAfter) })- : last.replaced ? t("last.replaced", { time: timeOf(last.at), count: last.replaced, saved: formatBytes(last.bytesBefore - last.bytesAfter), after: formatBytes(last.bytesAfter) })- : t("last.none", { time: timeOf(last.at), bytes: formatBytes(last.bytesBefore) });+ $("lastLabel").textContent = last ? t("last.label", { time: timeOf(last.at) }) : t("last.labelNone");+ $("lastValue").textContent = !last ? t("last.noBaseline")+ : last.skipped ? t("last.skipped", { bytes: formatBytes(last.bytesBefore) })+ : last.resent ? t("last.resent", { resent: last.resent, count: last.replaced })+ : last.replaced ? t("last.replaced", { count: last.replaced, saved: formatBytes(last.bytesBefore - last.bytesAfter) })+ : t("last.none", { bytes: formatBytes(last.bytesBefore) });+ $("lastValue").title = $("lastValue").textContent;+ renderFetched(auto);+ // v0.7: the subagents and side chats of a Codex task, as one line.+ const children = S.data.children ?? [];+ $("childrenLine").hidden = !children.length;+ if (children.length) {+ const saved = children.reduce((sum, child) => sum + (child.last && !child.last.skipped ? Math.max(0, child.last.bytesBefore - child.last.bytesAfter) : 0), 0);+ $("childrenLabel").textContent = t("children.label", { count: children.length });+ $("childrenValue").textContent = saved > 0 ? t("children.saved", { saved: formatBytes(saved) }) : t("children.none");+ }+ }+ // v0.3: with automatic selection on, the ids the model fetched in the latest turn, each finding its thumbnail.+ // Rebuilt only when that list changes, so hover and focus survive the polling.+ let fetchedKey = "";+ function renderFetched(auto) {+ $("fetchedLine").hidden = !auto;+ if (!auto) return;+ $("fetchedLabel").textContent = t("fetched.label");+ const fetched = (S.data?.fetched ?? []).filter(byId);+ const key = `${lang}|${fetched.join(",")}`;+ if (key === fetchedKey) return;+ fetchedKey = key;+ $("fetchedIds").replaceChildren(...(fetched.length ? fetched.map(idButton) : [Object.assign(document.createElement("span"), { className: "v", textContent: t("fetched.none") })]));+ }+ function idButton(id) {+ const button = Object.assign(document.createElement("button"), { type: "button", className: "idbtn", textContent: id, title: t("id.jump", { id }) });+ button.addEventListener("click", () => jumpTo(id));+ return button;+ }++ // ---- v0.1-17: manual mode, the images the model asked for that are not sent (the same test as their mark) ----+ let needsKey = "";+ function renderNeeds() {+ const needed = autoOn() ? [] : images().filter((image) => image.requested && image.inNextRequest && image.replaceable && !isOn(image));+ const box = $("needs");+ const key = needed.length ? `${lang}|${needed.map((image) => image.id).join(",")}` : "";+ box.hidden = !key;+ if (key === needsKey) return;+ needsKey = key;+ box.replaceChildren(...(key ? [+ Object.assign(document.createElement("span"), { textContent: t("needs.title", { count: needed.length }) }),+ ...needed.map((image) => idButton(image.id)),+ ] : []));+ }++ // 启用插件 / 停用插件 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 on = !!setup?.usesEngine;+ const key = !setup ? "" : `${on ? "on" : "off"}|${lang}`;+ const box = $("plugin");+ if (key !== pluginKey) {+ pluginKey = key;+ const button = document.createElement("button");+ button.type = "button";+ button.textContent = t(on ? "plugin.disable" : "plugin.enable");+ button.className = on ? "off" : "on";+ button.addEventListener("click", () => switchEngine(!on));+ box.replaceChildren(...(key ? [button] : []));+ }+ for (const button of box.children) button.disabled = S.switching;+ }++ function renderRefresh() {+ const button = $("refresh");+ const stale = lastFresh > 0 && Date.now() - lastFresh > STALE_MS;+ button.classList.toggle("spinning", S.refreshing && S.manual);+ button.classList.toggle("stale", stale && !S.refreshing);+ button.title = !lastFresh ? t("refresh") : t(stale ? "refresh.stale" : "refresh.at", { time: clockOf(lastFresh) });+ }++ // ---- v0.8: the filters: 全部, 上传, 生成 (when the task has any), then the scenes the model named, and 其他 ----+ // Rebuilt only when what they say changes, so hover and focus survive the polling and the clicks.+ let chipsKey = "";+ function chipList() {+ const list = images();+ const count = (chip) => list.filter((image) => inChip(image, chip)).length;+ const kinds = [["all", t("chip.all")], ["upload", t("chip.upload")], ["generated", t("chip.generated")]].map(([chip, label]) => [chip, label, count(chip)]).filter(([chip, , n]) => chip === "all" || n > 0);+ // The scenes with the most images first; a tie keeps the order they first appeared in.+ const scenes = [...new Set(list.map(sceneOf).filter((scene) => scene !== null))].map((scene) => [`scene:${scene}`, scene, count(`scene:${scene}`)]).sort((a, b) => b[2] - a[2]);+ // Without any scene (images from before v0.8), 其他 alone says nothing.+ const others = scenes.length ? [["other", t("chip.other"), count("other")]].filter(([, , n]) => n > 0) : [];+ return { kinds, scenes: [...scenes, ...others] };+ }+ function renderChips() {+ const box = $("chips");+ const { kinds, scenes } = chipList();+ if (![...kinds, ...scenes].some(([chip]) => chip === S.chip)) S.chip = "all";+ const key = `${lang}|${JSON.stringify([kinds, scenes])}`;+ if (key !== chipsKey) {+ chipsKey = key;+ const make = ([chip, label, n]) => {+ const button = Object.assign(document.createElement("button"), { type: "button", className: "chip" });+ button.dataset.chip = chip;+ button.append(label, Object.assign(document.createElement("span"), { className: "n", textContent: String(n) }));+ button.addEventListener("click", () => { S.chip = chip; render(); });+ return button;+ };+ // One filter alone (全部) says nothing either.+ const all = [...kinds, ...scenes];+ box.replaceChildren(...(all.length < 2 ? [] : [...kinds.map(make), ...(scenes.length ? [Object.assign(document.createElement("span"), { className: "sep" })] : []), ...scenes.map(make)]));+ }+ for (const chip of box.querySelectorAll(".chip")) chip.setAttribute("aria-pressed", String(chip.dataset.chip === S.chip));+ }++ // ---- the thumbnails, by turn, newest first ----+ const tiles = new Map();+ const turnParts = new Map();+ const emptyState = document.createElement("div");+ emptyState.className = "empty";+ emptyState.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="14" height="14" rx="2.5"/><path d="M7 3h10.5A3.5 3.5 0 0 1 21 6.5V16"/><circle cx="8" cy="11" r="1.5"/><path d="m3.5 18 4.5-4.5 3 3 2-2 3.5 3.5"/></svg><strong></strong><span></span>';+ const nothingFound = Object.assign(document.createElement("div"), { className: "nothing" });++ // The mark a thumbnail carries: one for its state, one for before a compaction, one for its source's corner.+ function marksOf(image) {+ const marks = [];+ let state = null;+ if (!image.inNextRequest) state = [t("mark.gone"), ""];+ else if (!image.replaceable) state = [t("mark.locked"), ""];+ else if (autoOn()) {+ if (isOn(image)) state = [t("mark.pinned"), "pin"];+ else if (image.fetched) state = [t("mark.fetched"), "fetched"];+ } else if (!isOn(image)) state = image.requested ? [t("mark.requested"), "warn"] : [t("mark.notSent"), ""];+ if (state) marks.push(["state", ...state]);+ // v0.5: from before a Claude Code compaction.+ if (image.compacted) marks.push(["when", t("mark.compacted"), ""]);+ const source = sourceOf(image);+ if (source === "pdf") marks.push(["corner", image.pdfPage ? t("corner.pdf", { page: image.pdfPage }) : t("corner.pdfAny"), ""]);+ if (source === "browser") marks.push(["corner", t("corner.browser"), ""]);+ return marks;+ }+ function makeTile(id) {+ const tile = Object.assign(document.createElement("button"), { type: "button", className: "tile" });+ tile.dataset.id = id;+ tile.addEventListener("click", () => openPreview(id));+ observer.observe(tile);+ return tile;+ }+ function paintThumb(tile, id) {+ const url = S.thumbs.get(id);+ tile.classList.toggle("loading", !S.thumbs.has(id));+ let img = tile.querySelector("img");+ if (url) {+ if (!img) { img = document.createElement("img"); img.alt = ""; tile.prepend(img); tile.querySelector(".none")?.remove(); }+ if (img.src !== url) img.src = url;+ } else if (S.thumbs.has(id) && !tile.querySelector(".none")) {+ img?.remove();+ tile.prepend(Object.assign(document.createElement("span"), { className: "none", textContent: "—" }));+ }+ }+ function paintTile(tile, image) {+ tile.classList.toggle("off", !autoOn() && image.inNextRequest && image.replaceable && !isOn(image));+ tile.classList.toggle("gone", !image.inNextRequest);+ tile.setAttribute("aria-label", [t("tile.open", { id: image.id }), nameOf(image)].filter(Boolean).join(" · "));+ tile.title = [image.id, nameOf(image)].filter(Boolean).join(" · ");+ const marks = marksOf(image);+ const key = JSON.stringify(marks);+ if (tile.dataset.marks !== key) {+ tile.dataset.marks = key;+ for (const old of tile.querySelectorAll(".mark")) old.remove();+ for (const [place, text, tone] of marks) tile.append(Object.assign(document.createElement("span"), { className: `mark ${place} ${tone}`.trim(), textContent: text }));+ }+ paintThumb(tile, image.id);+ }+ // A turn's line, and in manual mode its one action for the images shown: 整轮不发 when all of them go, else 整轮发送.+ function turnPart(turn) {+ if (turnParts.has(turn)) return turnParts.get(turn);+ const head = Object.assign(document.createElement("div"), { className: "turn" });+ head.append(Object.assign(document.createElement("span"), { textContent: turn === null ? t("turn.earlier") : t("turn.n", { n: turn }) }));+ const act = Object.assign(document.createElement("button"), { type: "button", className: "act" });+ act.addEventListener("click", () => {+ const targets = images().filter((image) => image.turn === turn && changeable(image) && matches(image));+ change(targets.map((image) => image.id), !targets.every(isOn));+ });+ head.append(act);+ const grid = Object.assign(document.createElement("div"), { className: "grid" });+ const part = { head, act, grid };+ turnParts.set(turn, part);+ return part;}// Notices are reused while their text stays the same, so re-rendering does not move the list around.@@ -1108,7 +1120,6 @@}return box;}-// Several threads started since the panel was opened: which one is this panel's?function chooser(tasks) {const key = `chooser|${lang}|${tasks.map((task) => `${task.threadId}:${task.title ?? ""}`).join("|")}`;@@ -1134,7 +1145,6 @@for (const button of box.querySelectorAll("button")) button.disabled = S.switchingTask;return box;}-function setupNotices() {const setup = S.data?.setup;if (!setup) return [];@@ -1143,250 +1153,152 @@if (!setup.usesEngine) return [notice("info", t("notice.notEnabled"))];return [];}-- // 启用插件 / 停用插件 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 on = !!setup?.usesEngine;- const key = !setup ? "" : `${on ? "on" : "off"}|${lang}`;- const box = $("plugin");- if (key !== pluginKey) {- pluginKey = key;- const button = document.createElement("button");- button.type = "button";- button.textContent = t(on ? "plugin.disable" : "plugin.enable");- button.className = on ? "off" : "on";- button.addEventListener("click", () => switchEngine(!on));- box.replaceChildren(...(key ? [button] : []));+ // Only when there is something to say.+ function noticeNodes() {+ const nodes = [];+ if (S.error) nodes.push(notice("error", t(S.error.key, { message: S.error.message }), { label: t("notice.retry"), run: () => { S.error = null; render(); refresh(); } }));+ nodes.push(...setupNotices());+ if (S.data?.started === false) {+ const tasks = newTasks();+ nodes.push(tasks.length > 1 ? chooser(tasks) : notice("info", t("notice.waiting")));}- for (const button of box.children) button.disabled = S.switching;+ if (S.data?.historyMissing) nodes.push(notice("warn", t("notice.historyMissing")));+ if (S.data?.engineRunning === false && S.data?.setup?.usesEngine !== false) nodes.push(notice("warn", t("notice.engineDown")));+ const sendNotice = S.data?.send?.notice;+ if (sendNotice?.kind === "skipped") nodes.push(notice("error", t("notice.skipped", { time: timeOf(sendNotice.at), reason: t(MESSAGES[lang][`reason.${sendNotice.reason}`] ? `reason.${sendNotice.reason}` : "reason.other") })));+ if (sendNotice?.kind === "fallback") nodes.push(notice("error", t("notice.skipped", { time: timeOf(sendNotice.at), reason: t("reason.thinking") })));+ if (sendNotice?.kind === "thinking") nodes.push(notice("info", t("notice.thinking", { time: timeOf(sendNotice.at), count: sendNotice.count })));+ if (sendNotice?.kind === "websocket") nodes.push(notice("warn", t("notice.websocket")));+ return nodes;}- // ---- v0.1-17: the images the model asked for that are not checked (the same test as the row's tag) ----- // Rebuilt only when that list changes, so hover and focus survive the polling.- // v0.3: with automatic selection on, the model fetches what it needs itself; the bar lists what it fetched in the- // latest turn instead, in blue, and works the same way.- let needsKey = "";- function renderNeeds() {- const auto = autoOn();- const needed = auto- ? (S.data?.fetched ?? []).map(byId).filter(Boolean)- : images().filter((image) => image.requested && image.inNextRequest && image.replaceable && !isChecked(image));- const box = $("needs");- const key = needed.length ? `${lang}|${auto}|${needed.map((image) => image.id).join(",")}` : "";- box.hidden = !key;- if (key === needsKey) return;- needsKey = key;- box.classList.toggle("fetched", auto);- box.replaceChildren(...(key ? [- Object.assign(document.createElement("span"), { textContent: t(auto ? "fetched.title" : "needs.title", { count: needed.length }) }),- ...needed.map((image) => {- const button = Object.assign(document.createElement("button"), { type: "button", textContent: image.id, title: t("needs.jump", { id: image.id }) });- button.addEventListener("click", () => jumpTo(image.id));- return button;- }),- ] : []));+ function renderList() {+ const nodes = noticeNodes();+ const list = images();+ if (S.preview && byId(S.preview.id)) nodes.push(previewPart());+ else if (S.data && !list.length) nodes.push(emptyState);+ else {+ const shownImages = list.filter(matches);+ if (S.data && !shownImages.length) nodes.push(nothingFound);+ const turns = [...new Set(shownImages.map((image) => image.turn))].sort((a, b) => (b ?? -1) - (a ?? -1));+ for (const turn of turns) {+ const group = shownImages.filter((image) => image.turn === turn);+ const part = turnPart(turn);+ const targets = group.filter(changeable);+ part.act.hidden = autoOn() || targets.length < 2;+ part.act.textContent = t(targets.every(isOn) ? "turn.allOff" : "turn.allOn");+ const cells = group.map((image) => {+ let tile = tiles.get(image.id);+ if (!tile) { tile = makeTile(image.id); tiles.set(image.id, tile); }+ paintTile(tile, image);+ return tile;+ });+ const current = part.grid.children;+ if (cells.length !== current.length || cells.some((cell, index) => cell !== current[index])) part.grid.replaceChildren(...cells);+ nodes.push(part.head, part.grid);+ }+ for (const image of shownImages) queueThumb(image.id);+ }+ for (const [id, tile] of tiles) if (!byId(id)) { observer.unobserve(tile); tiles.delete(id); }+ for (const [key, box] of notices) if (!nodes.includes(box)) notices.delete(key);+ // Only touch the list when its items changed, so scrolling and keyboard focus are kept.+ const current = main.children;+ if (nodes.length !== current.length || nodes.some((node, index) => node !== current[index])) main.replaceChildren(...nodes);}- // ---- v0.7: the task's subagents and side chats (user 2026-10-13) ----- // Shown once the engine has seen one. Its first line folds the list and holds the switch; both are made once, so hover- // and focus survive the polling, and the rows are rebuilt only when what they say changes.- let childrenParts = null;- let childrenKey = "";- function childrenHead() {- if (childrenParts) return childrenParts;- const toggle = Object.assign(document.createElement("button"), { type: "button", className: "children-toggle" });- toggle.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg><span class="label"></span><span class="n"></span><span class="sum"></span>';- toggle.setAttribute("aria-controls", "childrenList");- toggle.addEventListener("click", () => { S.childrenOpen = !S.childrenOpen; renderChildren(); });- const control = Object.assign(document.createElement("label"), { className: "auto" });- control.innerHTML = '<span class="auto-label"></span><input type="checkbox" role="switch"><span class="sw"></span>';- control.querySelector("input").addEventListener("change", (event) => setChildrenAuto(event.target.checked));- const head = Object.assign(document.createElement("div"), { className: "children-head" });- head.append(toggle, control);- const list = Object.assign(document.createElement("div"), { className: "children-list", id: "childrenList" });- $("children").append(head, list);- childrenParts = { toggle, control, list };- return childrenParts;- }- function renderChildren() {- const children = S.data?.children ?? [];- $("children").hidden = !children.length;- if (!children.length) return;- const { toggle, control, list } = childrenHead();- toggle.setAttribute("aria-expanded", String(S.childrenOpen));- toggle.querySelector(".label").textContent = t("children.title");- toggle.querySelector(".n").textContent = String(children.length);- const saved = children.reduce((sum, child) => sum + (child.last && !child.last.skipped ? Math.max(0, child.last.bytesBefore - child.last.bytesAfter) : 0), 0);- toggle.querySelector(".sum").textContent = saved > 0 ? t("children.saved", { saved: formatBytes(saved) }) : "";- control.title = t("children.autoTitle");- control.querySelector(".auto-label").textContent = t("children.auto");- const input = control.querySelector("input");- input.checked = S.childrenPending ?? S.data?.childrenAuto ?? true;- input.disabled = S.childrenPending !== null;- input.setAttribute("aria-label", t("children.auto"));- list.hidden = !S.childrenOpen;- const key = `${lang}|${JSON.stringify(children)}`;- if (key === childrenKey) return;- childrenKey = key;- list.replaceChildren(...children.map(childRow));+ // ---- the preview, inside the panel: the image, what it is, and its switch ----+ let previewParts = null;+ function previewPart() {+ if (!previewParts) {+ const root = Object.assign(document.createElement("div"), { className: "preview" });+ root.innerHTML = '<div class="preview-top"><button class="back" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span></span></button><span class="preview-meta"></span></div><div class="stage"></div><div class="preview-bottom"><span class="preview-note"></span><label class="switch"><span class="label"></span><input type="checkbox" role="switch"><span class="sw"></span></label></div>';+ root.querySelector(".back").addEventListener("click", closePreview);+ root.querySelector("input").addEventListener("change", (event) => { if (S.preview) change([S.preview.id], event.target.checked); });+ previewParts = { root, back: root.querySelector(".back span"), meta: root.querySelector(".preview-meta"), stage: root.querySelector(".stage"), note: root.querySelector(".preview-note"), label: root.querySelector(".switch .label"), input: root.querySelector("input") };+ }+ const image = byId(S.preview.id);+ const { root, back, meta, stage, note, label, input } = previewParts;+ back.textContent = t("preview.back");+ const where = sourceOf(image) === "pdf" && image.pdfPage ? t("corner.pdf", { page: image.pdfPage }) : sourceLabel(image);+ const parts = [image.id, image.turn === null ? null : t("turn.n", { n: image.turn }), where, nameOf(image)].filter(Boolean);+ meta.replaceChildren(Object.assign(document.createElement("b"), { textContent: parts[0] }), ...parts.slice(1).map((part) => ` · ${part}`));+ meta.title = [...parts, image.width && image.height ? `${image.width}×${image.height}` : null, formatBytes(image.bytes)].filter(Boolean).join(" · ");+ const url = S.preview.url ?? S.thumbs.get(image.id) ?? null;+ stage.classList.toggle("loading", S.preview.loading && !!url);+ if (url) {+ let img = stage.querySelector("img");+ if (!img) { img = document.createElement("img"); stage.replaceChildren(img); }+ img.alt = nameOf(image) ?? image.id;+ if (img.src !== url) img.src = url;+ } else stage.replaceChildren(Object.assign(document.createElement("span"), { className: "none", textContent: t(S.preview.loading ? "preview.loading" : "preview.none") }));+ note.textContent = !image.inNextRequest ? t("preview.gone") : !image.replaceable ? t("preview.locked") : image.compacted ? t("preview.compacted") : image.sameAs.length ? t("preview.sameAs", { id: image.sameAs[0] }) : "";+ label.textContent = t(autoOn() ? "preview.pin" : "preview.send");+ input.checked = image.inNextRequest && (!image.replaceable || isOn(image));+ input.disabled = !changeable(image) || S.autoPending !== null;+ input.setAttribute("aria-label", `${label.textContent} ${image.id}`);+ return root;+ }+ let returnTo = null;+ function openPreview(id) {+ returnTo = id;+ S.preview = { id, url: null, loading: true };+ render();+ previewParts?.root.querySelector(".back").focus({ focusVisible: false });+ const side = Math.min(2048, Math.max(800, Math.round(Math.max(window.innerWidth, window.innerHeight) * (window.devicePixelRatio || 1))));+ loadImage(id, side)+ .then((url) => { if (S.preview?.id === id) S.preview = { id, url, loading: false }; })+ .catch(() => { if (S.preview?.id === id) S.preview = { id, url: null, loading: false }; })+ .finally(() => { if (S.preview?.id === id) renderList(); });}- // A subagent by its name in Codex, a side chat by when it started; the rule that applies to it, and its last request.- function childRow(child) {- const line = Object.assign(document.createElement("div"), { className: "child-line1" });- const named = child.kind === "subagent" && child.name;- line.append(Object.assign(document.createElement("span"), { className: "child-name", textContent: child.kind === "side" ? t("children.sideAt", { time: clockOf(child.startedAt).slice(0, 5) }) : child.name ?? t("children.subagent") }));- if (named) line.append(Object.assign(document.createElement("span"), { className: "child-kind", textContent: t("children.subagent") }));- line.append(Object.assign(document.createElement("span"), { className: `child-rule${child.auto ? "" : " off"}`, textContent: t(child.auto ? "children.ruleAuto" : "children.ruleOff") }));- const last = child.last;- const time = last ? timeOf(last.at) : "";- const meta = [- child.images === null ? null : t("children.images", { count: child.images }),- !last ? t("children.noRequest")- : last.skipped ? t("children.lastSkipped", { time })- : last.replaced ? t("children.lastReplaced", { time, count: last.replaced, saved: formatBytes(last.bytesBefore - last.bytesAfter) })- : t("children.lastNone", { time }),- ].filter(Boolean).join(" · ");- const row = Object.assign(document.createElement("div"), { className: "child" });- row.append(line, Object.assign(document.createElement("div"), { className: "child-meta", textContent: meta, title: meta }));- return row;+ function closePreview() {+ if (!S.preview) return;+ S.preview = null;+ render();+ const tile = returnTo && tiles.get(returnTo);+ if (tile?.isConnected) tile.focus({ preventScroll: false });}- // Scrolls the row to the middle of the list, then flashes it; the keyboard focus goes to its checkbox (Space checks it).+ // ---- an id button: the preview closes, a search or filter that hides the image is cleared, then its thumbnail+ // scrolls to the middle of the list, flashes twice and takes the keyboard focus ----let flashAfterScroll = null;main.addEventListener("scrollend", () => flashAfterScroll?.());function jumpTo(id) {const image = byId(id);- // v0.2: an image the filter hides is shown first, with the rest of its source.- if (image && !inFilter(image)) { S.filter.sources.add(sourceOf(image)); settleFilter(); render(); }- const row = rows.get(id);- if (!row) return;- row.querySelector("input").focus({ preventScroll: true });- const box = row.getBoundingClientRect();+ if (!image) return;+ if (S.preview) S.preview = null;+ if (!matches(image)) { S.query = ""; $("search").value = ""; S.chip = "all"; }+ render();+ const tile = tiles.get(id);+ if (!tile) return;+ tile.focus({ preventScroll: true });+ const box = tile.getBoundingClientRect();const view = main.getBoundingClientRect();const top = Math.max(0, Math.min(main.scrollHeight - main.clientHeight, main.scrollTop + box.top + box.height / 2 - view.top - view.height / 2));- if (Math.abs(top - main.scrollTop) < 2) { flash(row); return; }+ if (Math.abs(top - main.scrollTop) < 2) { flash(tile); return; }// Flash once the scrolling stops; a later jump replaces this one.- const go = () => { if (flashAfterScroll !== go) return; flashAfterScroll = null; flash(row); };+ const go = () => { if (flashAfterScroll !== go) return; flashAfterScroll = null; flash(tile); };flashAfterScroll = go;setTimeout(go, 1000);main.scrollTo({ top, behavior: "smooth" });}const flashTimers = new Map();- function flash(row) {- clearTimeout(flashTimers.get(row));- row.classList.remove("flash");- void row.offsetWidth; // restarts the animation when the same row is picked again- row.classList.add("flash");- flashTimers.set(row, setTimeout(() => { row.classList.remove("flash"); flashTimers.delete(row); }, 1300));- }-- // ---- v0.2: the list filtered by source (user 2026-09-29); it changes what is shown, never what is sent ----- const SOURCES = ["upload", "pdf", "browser", "view", "tool", "generated"];- const filtering = () => S.filter.sources.size > 0;- const inFilter = (image) => !filtering() || S.filter.sources.has(sourceOf(image));- // The task's sources in a fixed order, with how many images each has.- function sourceCounts() {- const counts = new Map();- for (const image of images()) counts.set(sourceOf(image), (counts.get(sourceOf(image)) ?? 0) + 1);- return SOURCES.filter((source) => counts.has(source)).map((source) => [source, counts.get(source)]);- }- // Every source picked is the same as none: 全部.- function settleFilter() {- if (S.filter.sources.size >= sourceCounts().length) S.filter.sources.clear();- }- function pickSource(source) {- if (source === "all") S.filter.sources.clear();- else if (!S.filter.sources.delete(source)) S.filter.sources.add(source);- settleFilter();- render();- }- function makeChip(source, label, count) {- const chip = Object.assign(document.createElement("button"), { type: "button", className: "chip" });- chip.dataset.source = source;- chip.append(label);- if (count !== null) chip.append(Object.assign(document.createElement("span"), { className: "n", textContent: String(count) }));- chip.addEventListener("click", () => pickSource(source));- return chip;- }- // Shown for a task with two sources or more. The chips are rebuilt only when the sources or their counts change, so- // hover and focus survive the polling and the clicks.- let filterKey = "";- function renderFilter() {- const counts = sourceCounts();- const usable = counts.length >= 2;- const present = new Set(counts.map(([source]) => source));- for (const source of S.filter.sources) if (!usable || !present.has(source)) S.filter.sources.delete(source);- if (!usable) S.filter.open = false;- const button = $("filter");- button.hidden = !usable;- button.title = t("filter.toggle");- button.setAttribute("aria-label", t("filter.toggle"));- button.setAttribute("aria-expanded", String(S.filter.open));- button.querySelector(".dot").hidden = S.filter.open || !filtering();- const bar = $("filters");- bar.hidden = !S.filter.open;- bar.setAttribute("aria-label", t("filter.toggle"));- const key = `${lang}|${counts.map(([source, count]) => `${source}:${count}`).join(",")}`;- if (key !== filterKey) {- filterKey = key;- bar.replaceChildren(makeChip("all", t("filter.all"), null), ...counts.map(([source, count]) => makeChip(source, t(`kind.${source}`), count)));- }- for (const chip of bar.children) chip.setAttribute("aria-pressed", String(chip.dataset.source === "all" ? !filtering() : S.filter.sources.has(chip.dataset.source)));- }-- function renderRefresh() {- const button = $("refresh");- const stale = lastFresh > 0 && Date.now() - lastFresh > STALE_MS;- button.classList.toggle("spinning", S.refreshing && S.manual);- button.classList.toggle("stale", stale && !S.refreshing);- button.title = !lastFresh ? t("refresh") : t(stale ? "refresh.stale" : "refresh.at", { time: clockOf(lastFresh) });+ function flash(tile) {+ clearTimeout(flashTimers.get(tile));+ tile.classList.remove("flash");+ void tile.offsetWidth; // restarts the animation when the same tile is found again+ tile.classList.add("flash");+ flashTimers.set(tile, setTimeout(() => { tile.classList.remove("flash"); flashTimers.delete(tile); }, 1300));}- function renderList() {- const nodes = [];- if (S.error) nodes.push(notice("error", t(S.error.key, { message: S.error.message }), { label: t("notice.retry"), run: () => { S.error = null; render(); refresh(); } }));- nodes.push(...setupNotices());- if (S.data?.started === false) {- const tasks = newTasks();- nodes.push(tasks.length > 1 ? chooser(tasks) : notice("info", t("notice.waiting")));- }- if (S.data?.historyMissing) nodes.push(notice("warn", t("notice.historyMissing")));- if (S.data?.engineRunning === false && S.data?.setup?.usesEngine !== false) nodes.push(notice("warn", t("notice.engineDown")));- const sendNotice = S.data?.send?.notice;- if (sendNotice?.kind === "skipped") nodes.push(notice("error", t("notice.skipped", { time: timeOf(sendNotice.at), reason: t(MESSAGES[lang][`reason.${sendNotice.reason}`] ? `reason.${sendNotice.reason}` : "reason.other") })));- if (sendNotice?.kind === "fallback") nodes.push(notice("error", t("notice.skipped", { time: timeOf(sendNotice.at), reason: t("reason.thinking") })));- if (sendNotice?.kind === "thinking") nodes.push(notice("info", t("notice.thinking", { time: timeOf(sendNotice.at), count: sendNotice.count })));- if (sendNotice?.kind === "websocket") nodes.push(notice("warn", t("notice.websocket")));- const list = images();- if (S.data && !list.length) nodes.push(emptyState);- const listed = list.filter(inFilter);- let turn;- for (const image of listed) {- if (image.turn !== turn) {- turn = image.turn;- if (!turnLabels.has(turn)) turnLabels.set(turn, makeTurnLabel(turn));- const label = turnLabels.get(turn);- paintTurn(label, turn, listed.filter((other) => other.turn === turn));- nodes.push(label);- }- let row = rows.get(image.id);- if (!row) { row = makeRow(image.id); rows.set(image.id, row); }- paintRow(row, image);- nodes.push(row);- }- for (const [id, row] of rows) if (!byId(id)) { observer.unobserve(row); rows.delete(id); }- for (const [key, box] of notices) if (!nodes.includes(box)) notices.delete(key);- // Only touch the list when its items changed, so scrolling and keyboard focus are kept.- const current = main.children;- if (nodes.length !== current.length || nodes.some((node, index) => node !== current[index])) main.replaceChildren(...nodes);- for (const image of listed) queueThumb(image.id);+ // The search and the filters stand aside while the preview is open, and before there is anything to find.+ function renderSearch() {+ const hide = !!S.preview || !images().length;+ $("searchBox").hidden = hide;+ $("chips").hidden = hide;}- // Always the same line: a check needs no word that it was saved (user 2026-09-28). v0.3: the automatic selection- // switch sits next to it, and the line says what a tick means in each mode.+ // Always the same line: a change needs no word that it was saved (user 2026-09-28). v0.3: the automatic selection+ // switch sits next to it, and the line says what happens to the other images in each mode.function renderFooter() {const auto = autoOn();$("status").textContent = images().length ? t(auto ? "footer.hintAuto" : "footer.hint") : "";@@ -1400,63 +1312,18 @@input.setAttribute("aria-label", t("auto.label"));}- function renderViewer() {- const viewer = $("viewer");- const image = S.viewer && byId(S.viewer.id);- if (!image) { viewer.hidden = true; return; }- viewer.hidden = false;- $("viewerId").textContent = image.id;- $("viewerName").textContent = nameOf(image);- $("viewerMeta").textContent = [image.turn === null ? null : t("turn.n", { n: image.turn }), describe(image)].filter(Boolean).join(" · ");- const input = $("viewerCheck").querySelector("input");- input.checked = isChecked(image);- input.disabled = !image.replaceable;- $("viewerCheck").querySelector(".label").textContent = t(autoOn() ? "viewer.pin" : "viewer.send");- const stage = $("viewerStage");- const url = S.viewer.url ?? S.thumbs.get(image.id) ?? null;- stage.classList.toggle("loading", S.viewer.loading && !!url);- if (url) {- let img = stage.querySelector("img");- if (!img) { img = document.createElement("img"); img.alt = image.name ?? image.id; stage.replaceChildren(img); }- if (img.src !== url) img.src = url;- } else {- stage.replaceChildren(Object.assign(document.createElement("span"), { className: "none", textContent: t(S.viewer.loading ? "viewer.loading" : "viewer.none") }));- }- }-- function render() { renderFilter(); renderHeader(); renderNeeds(); renderChildren(); renderPlugin(); renderRefresh(); renderList(); renderFooter(); renderViewer(); }-- let focusBeforeViewer = null;- function openViewer(id) {- focusBeforeViewer = document.activeElement;- S.viewer = { id, url: null, loading: true };- renderViewer();- $("viewerClose").focus({ focusVisible: false });- const side = Math.min(2048, Math.max(800, Math.round(Math.max(window.innerWidth, window.innerHeight) * (window.devicePixelRatio || 1))));- loadImage(id, side)- .then((url) => { if (S.viewer?.id === id) S.viewer = { id, url, loading: false }; })- .catch(() => { if (S.viewer?.id === id) S.viewer = { id, url: null, loading: false }; })- .finally(renderViewer);- }- function closeViewer() {- if (!S.viewer) return;- S.viewer = null;- renderViewer();- focusBeforeViewer?.focus?.();- }+ function render() { renderCard(); renderNeeds(); renderPlugin(); renderRefresh(); renderChips(); renderSearch(); renderList(); renderFooter(); }- $("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" && S.viewer) closeViewer(); });+ $("more").addEventListener("click", () => { S.cardOpen = !S.cardOpen; renderCard(); });+ $("search").addEventListener("input", (event) => { S.query = event.target.value; renderList(); });+ document.addEventListener("keydown", (event) => { if (event.key === "Escape" && S.preview) closePreview(); });$("auto").querySelector("input").addEventListener("change", (event) => setAuto(event.target.checked));$("refresh").addEventListener("click", () => refresh(true));- $("filter").addEventListener("click", () => { S.filter.open = !S.filter.open; render(); });// ---- start: handshake, then Codex sends its own cam_panel result; poll so new images show up ----if (window.matchMedia?.("(prefers-color-scheme: dark)").matches) document.documentElement.dataset.theme = "dark";applyLanguage();- request("ui/initialize", { protocolVersion: "2026-01-26", appInfo: { name: "codex-attachment-manager", version: "0.7.0" }, appCapabilities: {} })+ request("ui/initialize", { protocolVersion: "2026-01-26", appInfo: { name: "codex-attachment-manager", version: "0.8.0" }, appCapabilities: {} }).then((init) => { applyHost(init?.hostContext); post({ method: "ui/notifications/initialized", params: {} }); reportFrame(); }).catch(() => {}).finally(() => setTimeout(() => { if (!S.data) refresh(); }, 1200));diff --git a/spike/scripts/panel-dev.ts b/spike/scripts/panel-dev.tsindex f6882ea..a1feb1d 100644--- a/spike/scripts/panel-dev.ts+++ b/spike/scripts/panel-dev.ts@@ -10,7 +10,8 @@// ?thread=many for a task with 45 images whose last reply asks for two unchecked ones, v0.1-17;// ?demo=filter for the filter bar open with PDF pages picked, ?demo=filtered for the same folded away, v0.2;// ?thread=auto for the same task with automatic selection on, IMG-002 pinned and a last turn in which the model fetched-// IMG-004 and IMG-007, v0.3).+// IMG-004 and IMG-007, v0.3; ?thread=v08 for keyframes of one character in two scenes with the model's feature lines,+// and ?thread=v08m for the same in manual mode, v0.8).// The demo task has a name, as if the user had renamed it in Codex (v0.1-9). Its last two turns (v0.2) hold comments on// a PDF and on a web page, as Codex desktop attaches them, and an image a tool returned.// Everything is written to a temporary folder, including a Codex home of its own: nothing in the user's Codex home is@@ -136,10 +137,78 @@ let manyLog = line("session_meta", { id: MANY });});writeFileSync(join(day, `rollout-2026-09-24T12-00-00-${MANY}.jsonl`), manyLog);+// ?thread=v08 (v0.8): keyframes of one character in two scenes, the model's feature lines opening its replies, a rating+// noted turns later, a PDF storyboard page, a web page, a hand sketch pinned, and a last turn in which the model fetched+// IMG-006 and IMG-011; automatic selection on. ?thread=v08m: the same task in manual mode, three images off, the last+// reply asking for two of them.+const V08 = `${THREAD.slice(0, -4)}a080`;+const V08M = `${THREAD.slice(0, -4)}a081`;+const SKIN = [235, 190, 160], COAT = [36, 44, 58];+const keyframe = (sky: number[], glow: number[], size: "wide" | "medium" | "close", at = 0.5, umbrella = false) => png(480, 480, (x, y) => {+ const r = size === "wide" ? 20 : size === "medium" ? 48 : 150;+ const cx = 480 * at, cy = size === "close" ? 250 : size === "medium" ? 170 : 300;+ if (umbrella && y < cy - r * 0.7 && y > cy - r * 2.1 && Math.abs(x - cx) < r * 2.4 - (cy - r * 0.7 - y) * 1.1) return [26, 26, 32];+ if ((x - cx) ** 2 + (y - cy) ** 2 < r * r) {+ const eye = size !== "wide" && Math.abs(y - cy + r * 0.12) < r * 0.08 && (Math.abs(x - cx + r * 0.35) < r * 0.1 || Math.abs(x - cx - r * 0.35) < r * 0.1);+ return eye ? [30, 30, 30] : SKIN;+ }+ if (y > cy + r * 0.8 && Math.abs(x - cx) < r * 1.1 + (y - cy - r) * 0.5) return COAT;+ return (x * 7 + y * 13) % 89 === 0 ? glow : [sky[0] + y / 14, sky[1] + y / 16, sky[2] + y / 12].map(Math.round);+});+const NIGHT = [14, 24, 60], NEON = [255, 80, 180], WARM = [96, 52, 30], LAMP = [255, 205, 120];+const reference = keyframe([200, 200, 205], [200, 200, 205], "medium");+const rain = [keyframe(NIGHT, NEON, "medium", 0.66, true), keyframe(NIGHT, NEON, "wide"), keyframe(NIGHT, NEON, "close", 0.62), keyframe(NIGHT, NEON, "close"),+ keyframe(NIGHT, NEON, "medium", 0.7), keyframe(NIGHT, NEON, "wide", 0.4), keyframe(NIGHT, NEON, "close", 0.48)];+const warm = [keyframe(WARM, LAMP, "medium", 0.4), keyframe(WARM, LAMP, "close", 0.45), keyframe(WARM, LAMP, "wide", 0.3), keyframe(WARM, LAMP, "wide", 0.55)];+const sketch = png(480, 480, (x, y) => ((Math.abs((x - 300) ** 2 + (y - 200) ** 2 - 60 ** 2) < 400 || Math.abs(x - y * 0.4 - 120) < 2 || (y > 300 && Math.abs(y - 300 - Math.abs(x - 300) * 0.3) < 2)) ? [70, 70, 80] : [248, 246, 240]));+const ask = (id: string, turnId: string, text: string, files: Array<[string, Buffer]> = []) => line("response_item", {+ type: "message", id, role: "user",+ content: [{ type: "input_text", text }, ...files.flatMap(([name, bytes], i) => [+ { type: "input_text", text: `<image name=[Image #${i + 1}] path="C:\\w\\${name}">` },+ { type: "input_image", image_url: url(bytes) },+ { type: "input_text", text: "</image>" },+ ])],+ internal_chat_message_metadata_passthrough: { turn_id: turnId },+});+const made = (callId: string, name: string, bytes: Buffer, prompt: string) =>+ toolImage(callId, `const r = await tools.image_gen__imagegen({prompt:${JSON.stringify(prompt)}}); generatedImage(r);`, bytes, `Generated images are saved to C:\\g\\t as C:\\g\\t\\${name} by default.`);+const v08Story =+ turn("v1") + ask("msg_v1", "v1", "这是角色的参考图,人物半身正面。", [["角色参考.png", reference]]) + say("收到。", "v1") ++ turn("v2") + ask("msg_v2", "v2", "生成两张深蓝雨夜的画面:一张中景撑伞,一张远景街道。") ++ made("g1", "rain-1.png", rain[0], "深蓝雨夜 中景 撑伞 霓虹") + made("g2", "rain-2.png", rain[1], "深蓝雨夜 远景 街道") ++ say("[//]: # (cam IMG-002 深蓝雨夜|中景,人物靠右,撑伞,霓虹)\n[//]: # (cam IMG-003 深蓝雨夜|远景,人物居中,街道)\n\n两张都生成好了。", "v2") ++ turn("v3") + commented("msg_v3", "v3", [+ { type: "input_text", text: "\n# Diff comments:\n\n## User Comment 1\nFile: pdf:分镜脚本.pdf\nSide: R\nLines: 1\nPDF path: C:/docs/分镜脚本.pdf\nPDF page: 3/8\nPDF annotation: region at top-left (40, 60) on 595x842 page\nAnnotated PDF screenshot: attached as a labeled image for Comment 1\nComment:\n按这一页的第二格\n\n## My request:\n按分镜再出一张近景、一张特写\n" },+ { type: "input_text", text: "The next image shows PDF page 3 at the time of Comment 1. The selected region is outlined in blue and marked by comment marker 1." },+ { type: "input_image", image_url: url(pdfPage(3)) },+ ]) + made("g3", "rain-3.png", rain[2], "深蓝雨夜 近景 侧脸 雨滴") + made("g4", "rain-4.png", rain[3], "深蓝雨夜 特写 正脸") ++ say("[//]: # (cam IMG-004 分镜脚本|第 3 页,四格分镜)\n[//]: # (cam IMG-005 深蓝雨夜|近景,侧脸,雨滴)\n[//]: # (cam IMG-006 深蓝雨夜|特写,正脸,五官清晰)\n\n近景和特写都在这里。", "v3") ++ turn("v4") + commented("msg_v4", "v4", [+ { type: "input_text", text: "第三轮那个特写正脸最好。再试试暖色灯光的室内,配色参考这个网站。" },+ { type: "input_text", text: "The next image shows the browser page at the time of Comment 1." },+ { type: "input_image", image_url: url(webPage) },+ ]) + made("g5", "warm-1.png", warm[0], "暖色灯光 室内 坐姿 中景") + made("g6", "warm-2.png", warm[1], "暖色灯光 近景 微笑") ++ say("[//]: # (cam IMG-006 评价:脸最好)\n[//]: # (cam IMG-007 参考网站|首页,深色顶栏,蓝色横幅)\n[//]: # (cam IMG-008 暖色灯光|室内,坐姿,中景)\n[//]: # (cam IMG-009 暖色灯光|近景,微笑)\n\n暖色的两张在这里。", "v4") ++ turn("v5") + ask("msg_v5", "v5", "深蓝雨夜再来两张:人物回头,俯拍积水。暖色的加一张窗边剪影。") ++ made("g7", "rain-5.png", rain[4], "深蓝雨夜 中景 回头") + made("g8", "rain-6.png", rain[5], "深蓝雨夜 俯拍 积水倒影") + made("g9", "warm-3.png", warm[2], "暖色灯光 窗边 剪影") ++ say("[//]: # (cam IMG-010 深蓝雨夜|中景,人物靠右,回头)\n[//]: # (cam IMG-011 深蓝雨夜|远景,俯拍,积水倒影)\n[//]: # (cam IMG-012 暖色灯光|窗边,剪影)\n\n三张都好了。", "v5") ++ turn("v6") + ask("msg_v6", "v6", "这是我手绘的构图草图,按它出一张近景正脸;暖色的出一张全身。", [["构图草图.png", sketch]]) ++ made("g10", "rain-7.png", rain[6], "深蓝雨夜 近景 正脸 霓虹反光") + made("g11", "warm-4.png", warm[3], "暖色灯光 全身 走廊") ++ say("[//]: # (cam IMG-013 深蓝雨夜|手绘草图,构图)\n[//]: # (cam IMG-014 深蓝雨夜|近景,正脸,霓虹反光)\n[//]: # (cam IMG-015 暖色灯光|全身,走廊)\n\n按草图出好了。", "v6") ++ turn("v7") + ask("msg_v7", "v7", "用之前最好的那张脸和俯拍那张,合成一张海报草案。");+writeFileSync(join(day, `rollout-2026-09-24T13-00-00-${V08}.jsonl`),+ line("session_meta", { id: V08 }) + v08Story ++ fetchedBy("cv7", [["[图片 IMG-006 取回的原图|rain-4.png|生成的图片|第 3 轮|480×480]", rain[3]], ["[图片 IMG-011 取回的原图|rain-6.png|生成的图片|第 5 轮|480×480]", rain[5]]]) ++ say("海报草案:上半部分用 IMG-006 的正脸特写,下半部分接 IMG-011 的俯拍积水倒影,标题放在两者交界的霓虹里。", "v7"));+writeFileSync(join(day, `rollout-2026-09-24T13-30-00-${V08M}.jsonl`),+ line("session_meta", { id: V08M }) + v08Story + say("需要 IMG-008 和 IMG-009 才能比较暖色的两张。", "v7"));+// Their names, as Codex keeps them next to the sessions folder (the panel's title).writeFileSync(join(root, "session_index.jsonl"), `${JSON.stringify({ id: THREAD, thread_name: "海报配色调整", updated_at: "2026-09-24T10:00:00Z" })}${JSON.stringify({ id: MANY, thread_name: "产品图批量修图", updated_at: "2026-09-24T12:00:00Z" })}${JSON.stringify({ id: AUTO, thread_name: "海报配色调整", updated_at: "2026-09-24T10:30:00Z" })}+${JSON.stringify({ id: V08, thread_name: "人物雨夜关键帧", updated_at: "2026-09-24T13:00:00Z" })}+${JSON.stringify({ id: V08M, thread_name: "人物雨夜关键帧", updated_at: "2026-09-24T13:30:00Z" })}`);// New tasks the user starts after opening the panel on a new chat (?newtask=): Codex files them in today's folder.@@ -177,6 +246,13 @@ callTool("cam_set_selection", { uncheck: ["IMG-005", "IMG-012", "IMG-017", "IMG-const autoMeta = { threadId: AUTO, thread_id: AUTO };callTool("cam_set_selection", { auto: true }, autoMeta, sessionsDir);callTool("cam_set_selection", { check: ["IMG-002"], mode: "auto" }, autoMeta, sessionsDir);+// v0.8: the hand sketch sent every turn; in the manual copy, a far shot and the two warm ones off.+const v08Meta = { threadId: V08, thread_id: V08 };+const v08mMeta = { threadId: V08M, thread_id: V08M };+callTool("cam_set_selection", { auto: true }, v08Meta, sessionsDir);+callTool("cam_set_selection", { check: ["IMG-013"], mode: "auto" }, v08Meta, sessionsDir);+callTool("cam_set_selection", { auto: false }, v08mMeta, sessionsDir);+callTool("cam_set_selection", { uncheck: ["IMG-003", "IMG-008", "IMG-009"] }, v08mMeta, sessionsDir);// What the engine would have recorded: the last full request came in turn 3 (turn 4's images are new since) and had// IMG-001, IMG-005 and IMG-006 replaced. ?stats=skipped|websocket|none shows the other cases.@@ -204,6 +280,25 @@ function writeStats(kind: string): void {const replaced = ["IMG-001", "IMG-003", "IMG-004", "IMG-005", "IMG-006", "IMG-007", "IMG-009", "IMG-010", "IMG-011", "IMG-012", "IMG-013"].map((id) => ({ id, mode: "plain" }));recordRequest(AUTO, { at: new Date(Date.now() - 2 * 60_000).toISOString(), transport: "http", turnId: "t7", decodedBytes: before, imageSizes: sizes, rewrite: { auto: true, replaced, decodedBefore: before, decodedAfter: Math.round(before * 0.14) } }, requestStatsDirOf(process.env.CAM_DATA_DIR));}+// v0.8: the two copies' last requests (turn 7), and a subagent and a side chat of the auto one.+{+ const { recordChild } = await import("../../plugin/src/children.ts");+ const { childrenDirOf } = await import("../../plugin/src/paths.ts");+ const stats = requestStatsDirOf(process.env.CAM_DATA_DIR);+ for (const [id, file, auto] of [[V08, `rollout-2026-09-24T13-00-00-${V08}.jsonl`, true], [V08M, `rollout-2026-09-24T13-30-00-${V08M}.jsonl`, false]] as const) {+ const items = readFileSync(join(day, file), "utf8").trim().split("\n").map((raw) => JSON.parse(raw)).filter((record) => record.type === "response_item").map((record) => record.payload);+ const sizes = imageSizesOf(items);+ const before = Object.values(sizes).reduce((sum, chars) => sum + chars, 0) + 180_000;+ const replaced = (auto ? ["IMG-001", "IMG-002", "IMG-003", "IMG-004", "IMG-005", "IMG-007", "IMG-008", "IMG-009", "IMG-010", "IMG-012", "IMG-014", "IMG-015"] : ["IMG-003", "IMG-008", "IMG-009"]).map((image) => ({ id: image, mode: "plain" }));+ recordRequest(id, { at: new Date(Date.now() - 3 * 60_000).toISOString(), transport: "http", turnId: "v7", decodedBytes: before, imageSizes: sizes, rewrite: { auto, replaced, decodedBefore: before, decodedAfter: Math.round(before * (auto ? 0.22 : 0.8)) } }, stats);+ }+ const SUB = `${THREAD.slice(0, -4)}a0c1`;+ const SIDE = `${THREAD.slice(0, -4)}a0c2`;+ recordChild(V08, SUB, { kind: "subagent", from: V08, at: new Date(Date.now() - 20 * 60_000).toISOString() }, childrenDirOf(process.env.CAM_DATA_DIR));+ recordChild(V08, SIDE, { kind: "side", from: V08, at: new Date(Date.now() - 10 * 60_000).toISOString() }, childrenDirOf(process.env.CAM_DATA_DIR));+ recordRequest(SUB, { at: new Date(Date.now() - 19 * 60_000).toISOString(), transport: "http", images: 4, decodedBytes: 1_800_000, rewrite: { auto: true, replaced: [{ id: "IMG-001" }, { id: "IMG-002" }], decodedBefore: 1_800_000, decodedAfter: 420_000 } }, stats);+ recordRequest(SIDE, { at: new Date(Date.now() - 9 * 60_000).toISOString(), transport: "http", images: 12, decodedBytes: 4_100_000, rewrite: { auto: true, replaced: [{ id: "IMG-003" }], sideChatOf: V08, decodedBefore: 4_100_000, decodedAfter: 900_000 } }, stats);+}// ---- the host page: a stand-in for Codex's side panel ----const HOST = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><title>面板开发页</title><style>@@ -240,7 +335,7 @@ const HOST = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><tit// ?thread=fresh: a thread that has no rollout, like a panel opened on a new chat whose prepared thread was replaced.// Each page load gets a thread of its own, so a switch made on an earlier load does not carry over.const fresh = params.get("thread") === "fresh" ? Math.random().toString(16).slice(2, 6).padEnd(4, "0") : null;- const query = fresh ? "?fresh=" + fresh : params.get("thread") === "gap" ? "?gap=1" : params.get("thread") === "many" ? "?many=1" : params.get("thread") === "auto" ? "?auto=1" : "";+ const query = fresh ? "?fresh=" + fresh : ["gap", "many", "auto", "v08", "v08m"].includes(params.get("thread")) ? "?" + params.get("thread") + "=1" : "";const call = (name, args) => fetch("/call" + query, { method: "POST", body: JSON.stringify({ name, arguments: args }) }).then((r) => r.json());window.addEventListener("message", async (event) => {const m = event.data;@@ -250,15 +345,18 @@ const HOST = `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><titelse if (m.method === "ui/notifications/initialized") { send({ method: "ui/notifications/tool-result", params: await call("cam_panel", {}) }); demo(); }else if (m.method === "tools/call") { const delay = params.get("slow") ? 900 : 60; const result = await call(m.params.name, m.params.arguments); setTimeout(() => send({ id: m.id, result }), delay); }});- // ?demo=preview|disabled puts the panel in that state, for screenshots taken without clicking.+ // ?demo=preview|disabled|details|search|scene|jump puts the panel in that state, for screenshots taken without clicking+ // (v0.8: &id=IMG-xxx for the preview, &q=… for the search).function demo() {const d = frame.contentDocument;setTimeout(() => {- if (params.get("demo") === "preview") d.querySelector('[data-id="IMG-004"] .thumb')?.click();+ if (params.get("demo") === "preview") d.querySelector('.tile[data-id="' + (params.get("id") || "IMG-004") + '"]')?.click();if (params.get("demo") === "disabled") d.querySelector("#plugin .off")?.click();- if (params.get("demo") === "filter" || params.get("demo") === "filtered") { d.querySelector("#filter")?.click(); d.querySelector('.chip[data-source="pdf"]')?.click(); }- if (params.get("demo") === "filtered") d.querySelector("#filter")?.click();- }, 700);+ if (params.get("demo") === "details") d.querySelector("#more")?.click();+ if (params.get("demo") === "search") { const input = d.querySelector("#search"); input.value = params.get("q") || "脸"; input.dispatchEvent(new Event("input")); }+ if (params.get("demo") === "scene") d.querySelector('.chip[data-chip^="scene:"]')?.click();+ if (params.get("demo") === "jump") { d.querySelector("#more")?.click(); setTimeout(() => d.querySelector("#fetchedIds .idbtn, #needs .idbtn")?.click(), 300); }+ }, 900);// The user sends the first message on this new chat (or two tasks start at once).if (params.get("newtask")) setTimeout(() => fetch("/newtask?count=" + params.get("newtask"), { method: "POST" }), 1500);}@@ -307,7 +405,9 @@ createServer((request, response) => {const gap = new URL(request.url, "http://x").searchParams.has("gap");const many = new URL(request.url, "http://x").searchParams.has("many");const auto = new URL(request.url, "http://x").searchParams.has("auto");- const threadMeta = fresh && /^[0-9a-f]{4}$/.test(fresh) ? { threadId: freshId, thread_id: freshId } : gap ? { threadId: GAP, thread_id: GAP } : many ? manyMeta : auto ? autoMeta : meta;+ const v08 = new URL(request.url, "http://x").searchParams.has("v08");+ const v08m = new URL(request.url, "http://x").searchParams.has("v08m");+ const threadMeta = fresh && /^[0-9a-f]{4}$/.test(fresh) ? { threadId: freshId, thread_id: freshId } : gap ? { threadId: GAP, thread_id: GAP } : many ? manyMeta : auto ? autoMeta : v08 ? v08Meta : v08m ? v08mMeta : 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) }] })); }});