From 6635dec7cde5fdacff7446e2d4f8c0c5fe6694ef Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 20 Nov 2026 15:53:22 +0800 Subject: [PATCH] agents: Show settings file in an agent row's menu (InkCoalW on X) InkCoalW asked on X for agent config files (settings.json, config.yaml and the like) to be managed as CC Switch does it. magpie already sets what is managed in those files: providers, models, effort, MCP servers, skills, hooks and the agent's own options. So the rest of the file gets an entry point, not an editor. An agent row's menu has "Show settings file", which shows the file magpie writes (agent.Path) in the file manager. A file not written yet shows its folder. An in-app raw editor would race magpie's own writes and the agent's live sessions, so there is none. POST /api/agents/reveal takes only the agent's id and looks the path up in agent.Detected(). A path or an unknown id shows nothing. The page served to a browser (magpie web) is refused, and the item isn't drawn there or in the tray panel. app.js and the core scripts' budgets are raised by 182: one item, packed to the shortest form. openAgentMenu draws every agent's menu, so there is no page to move it to. The route is named in the CLI parity list as the window's own. Run, on mote via mote-run, at this head rebased on eb1da1572: - go test -tags nogui -run 'TestAgentReveal|TestAgentOpen|TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI' ./internal/gui: ok - the internal/gui package in full: the only reds are TestBuiltinsTranslated (#7257) and TestSettingsSaveKeepsWhatItDoesNotSend (#7240), which fail the same on a fresh origin/main eb1da1572 copy. - go vet with GOOS=darwin, linux and windows on ./internal/gui: ok. gofmt: empty. - agent-open-terminal.test.cjs: 24/24 in Chromium and WebKit, in five languages, at 980 and 420 wide. On the old app.js it is 20 of 24 red. - i18n-keys: ok. Broken by hand: - the route at the old sessions.go: TestAgentRevealShowsOnlyItsFile red - the isWeb check removed: red ("the browser's page showed a file: 204") Not tried: a real Finder, Explorer or Linux file-manager reveal, and Windows or Linux runs. --- internal/cli/settings_parity_test.go | 1 + internal/gui/agent_open_test.go | 67 +++++++++++++++++++ internal/gui/assets/app.js | 4 +- internal/gui/assets/i18n.js | 4 ++ internal/gui/core_budget_test.go | 4 +- internal/gui/sessions.go | 37 ++++++++++ .../gui/tests/agent-open-terminal.test.cjs | 27 ++++++-- 7 files changed, 134 insertions(+), 10 deletions(-) diff --git a/internal/cli/settings_parity_test.go b/internal/cli/settings_parity_test.go index 4c5d532cf..c48fa149a 100644 --- a/internal/cli/settings_parity_test.go +++ b/internal/cli/settings_parity_test.go @@ -517,6 +517,7 @@ var notYet = map[string]string{ "GET /api/sessions/progress": U, // sessions.go "GET /api/sessions/stats": U, // sessions.go "POST /api/agents/open": W, // sessions.go + "POST /api/agents/reveal": W, // sessions.go "POST /api/sessions/carry": U, // sessions.go "POST /api/sessions/export": U, // sessions.go "POST /api/sessions/terminal": W, // sessions.go diff --git a/internal/gui/agent_open_test.go b/internal/gui/agent_open_test.go index 2fffa069f..990fafa78 100644 --- a/internal/gui/agent_open_test.go +++ b/internal/gui/agent_open_test.go @@ -191,3 +191,70 @@ func TestCodexOpenButton(t *testing.T) { t.Fatalf("Open in terminal opened the app: %v", apps) } } + +// revealHost is the app's windows, keeping what they were asked to show. +type revealHost struct { + folderOnly + shown *[]string +} + +func (h revealHost) RevealFolder(p string) error { *h.shown = append(*h.shown, p); return nil } +func (h revealHost) OpenFolder(p string) error { *h.shown = append(*h.shown, p); return nil } + +// Show settings file on an Agents row (InkCoalW on X): the file shown is +// the agent's own, as detected. The page sends only the id; an id that +// isn't an agent's, or a path, shows nothing, and the page served to a +// browser shows nothing on the computer it runs on. +func TestAgentRevealShowsOnlyItsFile(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("claude here is a POSIX shell's program") + } + h := sandboxHome(t) + dir := t.TempDir() + prog := filepath.Join(dir, "claude") + if err := os.WriteFile(prog, []byte("#!/bin/sh\n"), 0o755); err != nil { + t.Fatal(err) + } + t.Setenv("PATH", dir) + proc.Forget() + t.Cleanup(proc.Forget) + a, err := agent.Find("claude") + if err != nil { + t.Fatal(err) + } + if a.Path == "" || !strings.HasPrefix(a.Path, h) { + t.Fatalf("claude's file is %q, not in the sandbox %q", a.Path, h) + } + if err := os.MkdirAll(filepath.Dir(a.Path), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(a.Path, []byte("{}"), 0o644); err != nil { + t.Fatal(err) + } + + var shown []string + post := func(w Windows, id string) int { + t.Helper() + b, _ := json.Marshal(map[string]string{"agent": id}) + rec := httptest.NewRecorder() + Handler(w, nil).ServeHTTP(rec, httptest.NewRequest("POST", "/api/agents/reveal", strings.NewReader(string(b)))) + return rec.Code + } + for _, id := range []string{"nope", a.Path, "../claude", ""} { + if code := post(revealHost{shown: &shown}, id); code == http.StatusNoContent || len(shown) != 0 { + t.Fatalf("%q: %d, shown %q", id, code, shown) + } + } + if code := post(webTab{}, "claude"); code == http.StatusNoContent { + t.Fatalf("the browser's page showed a file: %d", code) + } + if code := post(revealHost{shown: &shown}, "claude"); code != http.StatusNoContent || len(shown) != 1 || shown[0] != a.Path { + t.Fatalf("claude: %d, shown %q, want %q", code, shown, a.Path) + } + // not written yet: its folder + os.Remove(a.Path) + shown = nil + if code := post(revealHost{shown: &shown}, "claude"); code != http.StatusNoContent || len(shown) != 1 || shown[0] != filepath.Dir(a.Path) { + t.Fatalf("claude with no file: %d, shown %q", code, shown) + } +} diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 14cb4fd37..3c0808374 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -3902,7 +3902,9 @@ function openAgentMenu(anchor, a, inFold, at) { // coolmantou, lileo0668 // Codex's desktop app, by the setting Open Codex with (Yink88564391 on // X): in the menu, not on the row, so the row lines up with the others - const app = a.openApp && mode != "panel" && !web, o = a.terminal && mode != "panel" && !web, term = [...app ? [{ name: "Open the Codex app", icon: LAUNCH_GLYPH, sep: !0, run: () => api("agents/open", { agent: a.id }).catch(statusErr) }] : [], ...o ? [{ name: "Open in terminal", icon: LAUNCH_GLYPH, sep: !app, run: () => api("agents/open", { agent: a.id, terminal: !0 }).catch(statusErr) }] : [], ...a.command ? [{ name: "Copy launch command", icon: COPY_ICON, sep: !o && !app, run: () => copy(a.command, t("Launch command")) }] : []]; + const app = a.openApp && mode != "panel" && !web, o = a.terminal && mode != "panel" && !web, term = [...app ? [{ name: "Open the Codex app", icon: LAUNCH_GLYPH, sep: !0, run: () => api("agents/open", { agent: a.id }).catch(statusErr) }] : [], ...o ? [{ name: "Open in terminal", icon: LAUNCH_GLYPH, sep: !app, run: () => api("agents/open", { agent: a.id, terminal: !0 }).catch(statusErr) }] : [], ...a.command ? [{ name: "Copy launch command", icon: COPY_ICON, sep: !o && !app, run: () => copy(a.command, t("Launch command")) }] : [], + // its whole file at hand, as CC Switch has it (InkCoalW on X) + ...a.path && mode != "panel" && !web ? [{ name: "Show settings file", icon: "M4.5 2.5h5l2.5 2.5v8.5h-7.5zM9.5 2.5V5H12", run: () => api("agents/reveal", { agent: a.id }).catch(statusErr) }] : []]; const acts = inFold && isHidden(a) ? [{ name: "Show", icon: EYE, run: () => setAgentHidden(a, false) }] : inFold diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 44a8ad18c..b8e8de02d 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -3949,6 +3949,7 @@ const I18N = { "Type {command} in a new terminal to start {name} on magpie · click to copy the command for a terminal open now:": "在新终端输入 {command} 即可让 {name} 走 magpie · 点击复制在已打开终端中用的命令:", "Launch command": "启动命令", "Copy launch command": "复制启动命令", + "Show settings file": "在文件夹中显示设置文件", "Open in terminal": "在终端中打开", "Copied — run it to start {name} on magpie": "已复制,运行它即可让 {name} 走 magpie", // the Sessions page (sessions.js) @@ -9451,6 +9452,7 @@ const I18N = { "Type {command} in a new terminal to start {name} on magpie · click to copy the command for a terminal open now:": "在新終端機輸入 {command} 即可讓 {name} 走 magpie · 點選複製在已開啟終端機中用的命令:", "Launch command": "啟動命令", "Copy launch command": "複製啟動命令", + "Show settings file": "在資料夾中顯示設定檔", "Open in terminal": "在終端機中開啟", "Copied — run it to start {name} on magpie": "已複製,執行它即可讓 {name} 走 magpie", "Filter sessions": "篩選會話", @@ -14954,6 +14956,7 @@ const I18N = { "Type {command} in a new terminal to start {name} on magpie · click to copy the command for a terminal open now:": "新しいターミナルで {command} と入力すると {name} が magpie 経由で起動します · クリックで開いているターミナル用のコマンドをコピー:", "Launch command": "起動コマンド", "Copy launch command": "起動コマンドをコピー", + "Show settings file": "設定ファイルをフォルダで表示", "Open in terminal": "ターミナルで開く", "Copied — run it to start {name} on magpie": "コピーしました。実行すると {name} が magpie 経由で起動します", "Filter sessions": "セッションを絞り込む", @@ -20478,6 +20481,7 @@ const I18N = { "Type {command} in a new terminal to start {name} on magpie · click to copy the command for a terminal open now:": "In einem neuen Terminal startet {command} {name} über magpie · klicken, um den Befehl für ein schon offenes Terminal zu kopieren:", "Launch command": "Startbefehl", "Copy launch command": "Startbefehl kopieren", + "Show settings file": "Einstellungsdatei im Ordner zeigen", "Open in terminal": "Im Terminal öffnen", "Copied — run it to start {name} on magpie": "Kopiert — ausführen, um {name} über magpie zu starten", "Filter sessions": "Sitzungen filtern", diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index 8a542355e..8d4440955 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -17,8 +17,8 @@ import ( // never what pays for a change (#5918); the history of each number is in // `git log -L` of this file. const ( - appScriptBudget = 1_089_480 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, so there is no page to move it to - coreScriptBudget = 1_274_171 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, so there is no page to move it to + appScriptBudget = 1_089_662 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, so there is no page to move it to; +182 for Show settings file in an agent row's menu (InkCoalW on X): its whole settings file at hand, as CC Switch has it, shown in the file manager by agents/reveal from the id alone, one item packed to the shortest form; openAgentMenu draws every agent's menu, so there is no page to move it to + coreScriptBudget = 1_274_353 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, so there is no page to move it to; +182 for Show settings file in an agent row's menu (InkCoalW on X): its whole settings file at hand, as CC Switch has it, shown in the file manager by agents/reveal from the id alone, one item packed to the shortest form; openAgentMenu draws every agent's menu, so there is no page to move it to ) // codeBytes is how many bytes of b are code: its blank lines, its lines diff --git a/internal/gui/sessions.go b/internal/gui/sessions.go index 821164f26..04442cd06 100644 --- a/internal/gui/sessions.go +++ b/internal/gui/sessions.go @@ -10,6 +10,7 @@ import ( "math" "net/http" "os" + "path/filepath" "reflect" "runtime" "runtime/debug" @@ -463,6 +464,42 @@ func sessionRoutes(mux *http.ServeMux, w Windows) { } rw.WriteHeader(http.StatusNoContent) }) + // agents/reveal shows an agent's settings file, the one magpie writes, + // in the file manager, from its row's menu (InkCoalW on X: its whole + // file at hand, as CC Switch has it). The page sends only the agent's + // id; the path is the agent's as detected, never one the page names. + mux.HandleFunc("POST /api/agents/reveal", func(rw http.ResponseWriter, r *http.Request) { + var in struct{ Agent string } + if err := json.NewDecoder(r.Body).Decode(&in); err != nil { + fail(rw, err) + return + } + if isWeb(w) { + fail(rw, errors.New("showing a file is only for the desktop app")) + return + } + path := "" + for _, a := range agent.Detected() { + if a.ID == in.Agent { + path = a.Path + } + } + if path == "" { + fail(rw, errors.New("no settings file for this agent")) + return + } + var err error + if _, e := os.Stat(path); e == nil { + err = revealIn(w, path) + } else { + err = w.OpenFolder(filepath.Dir(path)) + } + if err != nil { + fail(rw, err) + return + } + rw.WriteHeader(http.StatusNoContent) + }) // carry converts a session for another agent (one its Carry offers with // Convert): a new session of that agent's, in its own folder, the // source only read. It runs only when the user picks the agent, never diff --git a/internal/gui/tests/agent-open-terminal.test.cjs b/internal/gui/tests/agent-open-terminal.test.cjs index 46a1e6df6..4867249dc 100644 --- a/internal/gui/tests/agent-open-terminal.test.cjs +++ b/internal/gui/tests/agent-open-terminal.test.cjs @@ -8,7 +8,9 @@ // API is faked here. lileo0668 on Discord: every agent with a program has // "Copy launch command" there too, the line the server made, on every // system, the web build and the panel included; a desktop app has none. -// Narrow too. +// Narrow too. InkCoalW on X: "Show settings file" posts agents/reveal with +// the id alone (the server finds the file), on the window, not in the web +// build or the panel. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -33,6 +35,7 @@ function server(lang, web, posts) { if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:${web}};` }); if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); if (url.pathname === "/api/state") return json({ ...state, settings: { lang, theme: "light" } }); + if (url.pathname === "/api/agents/reveal") { posts.push([url.pathname, req.postData()]); return route.fulfill({ status: 204, body: "" }); } if (url.pathname === "/api/agents/open") { posts.push([url.pathname, req.postData()]); return route.fulfill({ status: 204, body: "" }); } if (url.pathname === "/api/copy") { posts.push([url.pathname, req.postData()]); return route.fulfill({ status: 204, body: "" }); } if (url.pathname === "/api/usage/quotas") return json([]); @@ -48,11 +51,11 @@ function server(lang, web, posts) { } const words = { - en: { item: "Open in terminal", copy: "Copy launch command" }, - zh: { item: "在终端中打开", copy: "复制启动命令" }, - "zh-TW": { item: "在終端機中開啟", copy: "複製啟動命令" }, - ja: { item: "ターミナルで開く", copy: "起動コマンドをコピー" }, - de: { item: "Im Terminal öffnen", copy: "Startbefehl kopieren" }, + en: { item: "Open in terminal", copy: "Copy launch command", show: "Show settings file" }, + zh: { item: "在终端中打开", copy: "复制启动命令", show: "在文件夹中显示设置文件" }, + "zh-TW": { item: "在終端機中開啟", copy: "複製啟動命令", show: "在資料夾中顯示設定檔" }, + ja: { item: "ターミナルで開く", copy: "起動コマンドをコピー", show: "設定ファイルをフォルダで表示" }, + de: { item: "Im Terminal öffnen", copy: "Startbefehl kopieren", show: "Einstellungsdatei im Ordner zeigen" }, }; const row = (id) => `.row.agent[data-id="${id}"]`; @@ -107,7 +110,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await item().click(); await sent; await page.locator(".pop.row-menu").waitFor({ state: "detached" }); - assert.deepEqual(posts.map(([p, b]) => [p, JSON.parse(b)]), [["/api/agents/open", { agent: "codex", terminal: true }]], "the id, and the terminal asked for"); + assert.deepEqual(posts.splice(0).map(([p, b]) => [p, JSON.parse(b)]), [["/api/agents/open", { agent: "codex", terminal: true }]], "the id, and the terminal asked for"); + + await menu("codex"); + const show = page.locator(".pop.row-menu .rm-item", { hasText: w.show }); + assert.equal(await show.count(), 1, "its settings file can be shown"); + const shown = page.waitForResponse((r) => new URL(r.url()).pathname === "/api/agents/reveal"); + await show.click(); + await shown; + assert.deepEqual(posts.map(([p, b]) => [p, JSON.parse(b)]), [["/api/agents/reveal", { agent: "codex" }]], "the id alone"); assert.deepEqual(errors, []); }); } @@ -119,6 +130,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.locator(".pop.row-menu").waitFor(); assert.equal(await page.locator(".pop.row-menu .rm-item", { hasText: "Open in terminal" }).count(), 0); assert.equal(await page.locator(".pop.row-menu .rm-item", { hasText: "Copy launch command" }).count(), 1, "copying is for the web too"); + assert.equal(await page.locator(".pop.row-menu .rm-item", { hasText: "Show settings file" }).count(), 0, "a file on the server's computer isn't shown"); assert.deepEqual(errors, []); }); @@ -129,6 +141,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.locator(".pop.row-menu").waitFor(); assert.equal(await page.locator(".rm-item", { hasText: "Open in terminal" }).count(), 0); assert.equal(await page.locator(".rm-item", { hasText: "Copy launch command" }).count(), 1, "copying is for the panel too"); + assert.equal(await page.locator(".rm-item", { hasText: "Show settings file" }).count(), 0); assert.deepEqual(posts, []); assert.deepEqual(errors, []); });