agent, gui: the Codex takeover names browser use and offers Keep on ChatGPT
eddie.zhan on Discord (10-27): once Codex's allowance ran out, magpie
took it over and "many features stop working, browser use is blocked,
the agent says it has no permission".
Cause, from openai/codex 5a361b5: under the takeover magpie is Codex's
model provider without requires_openai_auth, so app-server's
getAuthStatus hands the app no auth token. The Codex app's Chrome
control needs that token, so browser use is off till the reset, with
cloud tasks, the usage meter and Log out. Image generation (actor
authorization header) and web search (provider default) stay. Bringing
requires_openai_auth back would bring back the greyed Send the takeover
exists to avoid, so it can't be kept by config.
The off switch existed (sign-in > Always ChatGPT, `magpie codex login
chatgpt`) but nothing under the takeover pointed to it. The default is
kept; the opened Codex row's takeover note now names browser use and has
a Keep on ChatGPT button (login=chatgpt) on its own line. In every
language.
Also fixed: Always ChatGPT picked while Codex was taken over on one of
its own models left model_provider = "magpie" for good. set now puts it
back on the sign-in as Join leaves it.
Run (on mote, at this tree):
- go test ./internal/agent ./internal/gui: ok except
TestWSLColdPlaceOpensNothing (#3924) and TestMainWindowCorners/macOS_26
(#2645), both red on origin/main f2b4b9894 too.
- TestCoreScriptBudget ok; app.js 1,310,432 under 1,310,460, not raised.
- GUI codex-app-out, codex-signin-always, i18n-keys in chromium and
webkit at 980 and 440, every language: 95 pass, 1 red is #3897
(i18n-keys plugin words, red on main).
- gofmt -l clean; go vet darwin, linux (nogui), windows on internal/agent
and internal/gui.
Broken by hand: TestCodexOwnModelOutThenKeptOnChatGPT red on the old
set (model_provider = "magpie" left); codex-app-out red with origin's
app.js/i18n.js (no browser use in the note).
Not tried: the real Codex app, a real used-up account, the Windows box
and the Linux app.
This commit is contained in:
@@ -115,7 +115,7 @@ something else shows up as drift.
|
||||
- `unreachable` never sets anything: the config is right, and the page's pill only says what has to listen. The exception is an address a WSL distro reached Windows at before (`distro.Was`, kept in `wsl.json`) while it reaches Windows at another now: the pill offers that one, and `Reapply` moves the config there (`Agent.move`, Codex's `codexMoveGateway`). An address no distro was seen at is the user's own and is never moved. An unknown answer (no probe yet) and a gateway down on loopback too are not drift. Tests stub `reachProbe` in `TestMain`. A WSL twin's address on a WSL network is asked from inside the running distro (`reachFrom`, `wslReach`: curl, wget or bash's /dev/tcp), never from Windows, where the gateway's own listener answers whatever the firewall keeps out. A distro that can't connect is told the firewall rule that lets it in (`wslFirewallCommand`). A stopped distro is never run to be asked, and one with nothing to ask with is not drift.
|
||||
- `proxied` (Muma102kMichael on X: every project and every new chat 502 after magpie took Codex over) is this machine's Codex sending its requests for the gateway through a proxy that doesn't pass them on, while the gateway answers here ([`codex_proxy.go`](../../internal/agent/codex_proxy.go)). Codex's reqwest takes `HTTP_PROXY`, else the system's proxy for `http://` (macOS' HTTP entry alone, never its HTTPS or SOCKS one; Windows' `ProxyServer` only when it is one address for every protocol), else `ALL_PROXY`, and lets only an exact IP or a CIDR in `NO_PROXY` (on Windows, with no `NO_PROXY`, the bypass list with `*.` taken out) keep 127.0.0.1 off it: `127.*` and `localhost` don't, and macOS' exceptions aren't read. With `[features] respect_system_proxy` it asks the system alone, matching its list itself, wildcards and `<local>` included, and goes direct when no proxy is set there; a macOS SOCKS entry alone it can't use, and takes `HTTP_PROXY`/`ALL_PROXY` then (codex-rs `outbound_proxy`; tried with codex-cli 0.162.1). Its reqwest has no SOCKS, so a `socks5://` proxy is spoken to as an HTTP one, and the probe does the same. The environment is Codex's: the login shell's `*_PROXY` (`proc.LoginEnv`, which a terminal's Codex and the ChatGPT app's both have; only exported ones, as the probe asks a child `/bin/sh` for them, so fish's unexported universal `http_proxy` doesn't count, #2627) over magpie's own, which a magpie opened from the Dock lacks (liu_dyj on X: a `NO_PROXY=127.0.0.1` in the profile, or a macOS proxy with no HTTP entry, warned while Codex went direct). `codexProxyFor` works out that proxy the same way, and a `GET /` through it must come back as magpie's (`proxyProbe`), tried as `reachable` is. Its pill says how to fix it, as `unreachable`'s does, naming the proxy and the variable it was read from, `http_proxy` or `HTTP_PROXY` as it is (`Addr`, `Detail`), through `netproxy.Redact`, without its user and password (#1886), while the probe goes through it whole, and the dialog has Disconnect from magpie. Account failover, which magpie writes uninvited, waits for that probe (`codexProxyOK`) and isn't written while the proxy doesn't pass Codex on, and one it wrote goes again. Tests stub the env, the system proxy and `proxyProbe` in `TestMain`.
|
||||
- Listing never starts a stopped WSL distro. A stopped distro's agent shows what was last seen there (`asleep`, `wsl.json`); setting one of its fields writes its files, which starts the distro.
|
||||
- Codex's sign-in (`login`) is ChatGPT (`""`, the default), Always ChatGPT (`chatgpt`) or magpie API (`api`). With ChatGPT, magpie's models join Codex's own beside the sign-in (`openai_base_url`), and while the Codex app holds the ChatGPT account Codex is signed in to (`codexUsedUp`, `provider.CodexUsedUp`: OpenAI no longer allows the account and it has no credits left, a workspace still within its overage excepted), magpie is made Codex's provider (`codex.out`): the Codex app sends nothing at all on an account it holds, a magpie model's turn included (#540), and as a provider of its own magpie is past that. A window at 100% with credits left doesn't count, and Codex stays signed in. Sync puts it back beside the sign-in once the account has room. Always ChatGPT never does that: Codex stays in its ChatGPT state, and the Codex app may send nothing till the account has room, while Codex CLI's turns still reach magpie by the base URL, and its routing and other accounts serve them. With magpie API, Codex's `getAuthStatus` returns no token (its provider has no `requires_openai_auth`), so its Chrome control turns away; the option's note says to pick ChatGPT to keep it (#1824). While magpie is Codex's provider (magpie API, or `codex.out`), `Joined` reports false although the `codex.joined` mark stays for Sync's way back: the Agents row said Codex's own models stay in `/model` beside magpie's, the ChatGPT state the Codex app blocks sending in, and the app only leaves that state once it is restarted (#2267, `TestCodexProviderIsNotJoined`). A Codex that reaches the gateway from another machine (a WSL distro under NAT, or `MAGPIE_ADDR` pinned beyond loopback, `onAnotherMachine(at.gw())`) is wired as one with no ChatGPT sign-in (`chatGPT()` is false there): never joined or beside, since beside its sign-in it would send its ChatGPT token to `/backend-api/codex`, and from there the gateway takes a named key alone, so every request was a 401 (#2145, `TestCodexBeyondLoopbackNotJoined`). magpie is its provider and it sends `gwKey()`, the LAN sharing key; one of its own models picked goes straight to OpenAI on its sign-in.
|
||||
- Codex's sign-in (`login`) is ChatGPT (`""`, the default), Always ChatGPT (`chatgpt`) or magpie API (`api`). With ChatGPT, magpie's models join Codex's own beside the sign-in (`openai_base_url`), and while the Codex app holds the ChatGPT account Codex is signed in to (`codexUsedUp`, `provider.CodexUsedUp`: OpenAI no longer allows the account and it has no credits left, a workspace still within its overage excepted), magpie is made Codex's provider (`codex.out`): the Codex app sends nothing at all on an account it holds, a magpie model's turn included (#540), and as a provider of its own magpie is past that. A window at 100% with credits left doesn't count, and Codex stays signed in. Sync puts it back beside the sign-in once the account has room. Always ChatGPT never does that: Codex stays in its ChatGPT state, and the Codex app may send nothing till the account has room, while Codex CLI's turns still reach magpie by the base URL, and its routing and other accounts serve them. With magpie API, Codex's `getAuthStatus` returns no token (its provider has no `requires_openai_auth`), so its Chrome control turns away; the option's note says to pick ChatGPT to keep it (#1824). The same holds while magpie is Codex's provider for `codex.out`, so the Agents row opened over that takeover names browser use among what is off and offers Keep on ChatGPT right there (`keepChatGPT`, posting `login` = `chatgpt`); picked on one of Codex's own models taken over (`codex/<model>`), `set` puts Codex back on its sign-in at once, `model_provider` and `model_catalog_json` gone, where it had left magpie the provider (eddie.zhan on Discord, `TestCodexOwnModelOutThenKeptOnChatGPT`). While magpie is Codex's provider (magpie API, or `codex.out`), `Joined` reports false although the `codex.joined` mark stays for Sync's way back: the Agents row said Codex's own models stay in `/model` beside magpie's, the ChatGPT state the Codex app blocks sending in, and the app only leaves that state once it is restarted (#2267, `TestCodexProviderIsNotJoined`). A Codex that reaches the gateway from another machine (a WSL distro under NAT, or `MAGPIE_ADDR` pinned beyond loopback, `onAnotherMachine(at.gw())`) is wired as one with no ChatGPT sign-in (`chatGPT()` is false there): never joined or beside, since beside its sign-in it would send its ChatGPT token to `/backend-api/codex`, and from there the gateway takes a named key alone, so every request was a 401 (#2145, `TestCodexBeyondLoopbackNotJoined`). magpie is its provider and it sends `gwKey()`, the LAN sharing key; one of its own models picked goes straight to OpenAI on its sign-in.
|
||||
- Whether Codex is signed in to ChatGPT is read from its auth.json or keychain item (`codexChatGPTKnown`, `provider.CodexSignInKnown`). Codex rewrites auth.json in place when it refreshes its tokens (codex-rs `FileAuthStorage::save` opens it with truncate), so a read in that moment finds it empty or cut off, and a keychain read can fail for a moment. Such a read is unknown, and Codex is taken to be as magpie last wired it (joined, beside, or `codex.out`); only a sign-in that isn't there (no auth.json, no item) or holds no ChatGPT token is "not signed in". Taking an unknown read for "not signed in" made Sync or a pick move Codex from beside its sign-in to magpie as its provider, with no `codex.out` to bring it back, and the Codex app showed "magpie" for its account and magpie's catalog for its models, on and off (lucy on Discord, v0.1.1394; `TestCodexHalfWrittenAuthKeepsSignIn`, `TestCodexHalfWrittenAuthKeepsOut`, `TestCodexSignInKnown`).
|
||||
- Codex signed in to ChatGPT and not connected still gets `openai_base_url` while more of its ChatGPT accounts are on in magpie (`failover`, stash `codex.failover`; with a CC Switch mirror as its provider, the mirror's `base_url` and `codex.mirror_failover`), so a turn its own account has no allowance for goes on to the next — never for a Codex that reaches the gateway from another machine, where that path takes a named key alone and the failed-over turn came back a 401 (#2145, `TestCodexFailoverBeyondLoopbackNotWritten`); Sync takes one it wrote before off again. That Codex is `FailingOver`: not `Wired`, yet its requests go through magpie. The Agents row says so and what turns it off (`FailoverSaid` in the CLI and TUI, `failover` in `/api/state`, a button to Providers › Codex in the GUI), and the gateway hands it only its own models from `/backend-api/codex/models` (`CodexOwnOnly`, set on `gateway.CodexOwnOnly` by main; its ETag carries `provider.CodexOwnListTag`, and Sync ages a `models_cache.json` without it). A connected WSL Codex shares the gateway path, so while one is connected every Codex gets magpie's models (#1385). A base URL the user wrote by hand (#856) isn't failover's and stays a plain not-connected row. A Codex the user disconnected gets no failover till they connect it again. The app serving the gateway takes failover out as it quits (`EndFailover`, `EndCodexFailover` in `OnShutdown`), so a Codex left on its own goes straight to OpenAI rather than retrying a gateway that's gone (Leon920717 on X); the next start's Sync writes it again. Codex's app-server read the old base URL as it started and keeps it, and `KeepCodexDaemonCurrent` ends with magpie, so `EndCodexFailover` restarts it there when no codex session is on it (`codexDaemonCheck`); with one on it, it stays on the gone gateway until the user restarts it (thisisvainxx on X: "several restarts"). Every restart magpie makes runs `codex app-server daemon restart` as its own responsible process on macOS (`proc.CombinedOutputOwn`, a disclaimed `posix_spawn`): the daemon works in the folder of each codex attached to it, and as magpie's child the first codex in ~/Desktop had macOS ask for the Desktop folder in magpie's name (reformed9448 on Discord; `TestRestartedCodexDaemonIsNotMagpies`). A magpie built without cgo (the CLI) still restarts it as its own child. A connected Codex keeps magpie as it quits: its model is one of magpie's, and Disconnect is what puts its own config back. A magpie that ends without quitting (killed, a crash, `magpie serve`) leaves failover in place.
|
||||
- A Codex thread keeps the provider it was started on. While a magpie model is on, CC Switch's provider tables go through magpie too (`takeTables`), and get their own base URL back when Codex steps off magpie (`giveTables`, stash `codex.tables`). CC Switch's OpenAI mirror (a table of another id, `name = "OpenAI"`, `requires_openai_auth`, no `base_url`) isn't reached by `openai_base_url`, which takes only the built-in provider to magpie: a thread started on it and reopened went straight to ChatGPT, which refused the magpie model picked in it, and magpie never saw the request (#1796). While Codex goes to magpie by the base URL, `takeMirrors` gives each such mirror magpie's ChatGPT backend as its `base_url` (stash `codex.mirrors`), and `giveMirrors` takes it off again; a mirror a profile names, or one whose `base_url` was changed since, stays as it is. Moving the threads onto another provider is the Sessions page's Move (#887).
|
||||
|
||||
@@ -1336,6 +1336,24 @@ func codexIn(at place) *Agent {
|
||||
// joined, a model of Codex's own is picked beside magpie's, as in
|
||||
// Codex's /model: it stays connected
|
||||
if joined() && !api() && chatGPT() {
|
||||
// magpie made its provider for a used-up account (codex.out)
|
||||
// and that no longer holds (kept on ChatGPT, or room again):
|
||||
// back on the sign-in as Join leaves it. Only the model set
|
||||
// left magpie the provider of one of Codex's own for good
|
||||
// (eddie.zhan on Discord, Always ChatGPT from the takeover)
|
||||
if asProvider() && stashLoad()[at.key("codex.out")] == "1" && !out() {
|
||||
forget(at.key("codex.out"), at.key("codex.out_own"))
|
||||
if err := edit.DelTOMLTop(path, "model_provider", "model_catalog_json"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := edit.SetTOMLTop(path,
|
||||
edit.KV{Path: "openai_base_url", Value: at.codexURL()},
|
||||
edit.KV{Path: "model", Value: v},
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
return settle()
|
||||
}
|
||||
if err := edit.SetTOMLTop(path, edit.KV{Path: "model", Value: v}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -200,3 +200,48 @@ func TestCodexOwnModelKeptOnChatGPT(t *testing.T) {
|
||||
t.Fatal("kept on ChatGPT: AppOut")
|
||||
}
|
||||
}
|
||||
|
||||
// Moved onto magpie on one of Codex's own models while the account is
|
||||
// used up, then kept on ChatGPT from the Agents row's takeover line
|
||||
// (eddie.zhan on Discord: the Codex app's browser use said it had no
|
||||
// permission): Codex goes back on its sign-in at once, on the model it
|
||||
// picked, beside it as joined, and no later Sync moves it again.
|
||||
func TestCodexOwnModelOutThenKeptOnChatGPT(t *testing.T) {
|
||||
home, read := codexHome(t, `{"tokens":{"access_token":"x","id_token":"x.e30.x"}}`, "model = \"gpt-a\"\n")
|
||||
os.WriteFile(filepath.Join(home, ".codex", "models_cache.json"),
|
||||
[]byte(`{"models":[{"slug":"gpt-a","display_name":"A","priority":1}]}`), 0o644)
|
||||
cx := codex(home)
|
||||
if ok, err := cx.Join(); err != nil || !ok {
|
||||
t.Fatalf("join: %v %v", ok, err)
|
||||
}
|
||||
codexUsedUp = func() bool { return true }
|
||||
t.Cleanup(func() { codexUsedUp = func() bool { return false } })
|
||||
if err := cx.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !cx.AppOut() {
|
||||
t.Fatalf("used up: not AppOut:\n%s", read())
|
||||
}
|
||||
if err := cx.Field("login").Set("chatgpt"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
onSignIn := func(when string) {
|
||||
t.Helper()
|
||||
if cfg := read(); strings.Contains(cfg, "model_provider =") || strings.Contains(cfg, "model_catalog_json") || !strings.Contains(cfg, `model = "gpt-a"`) {
|
||||
t.Fatalf("%s:\n%s", when, cfg)
|
||||
}
|
||||
if cx.AppOut() {
|
||||
t.Fatalf("%s: AppOut", when)
|
||||
}
|
||||
}
|
||||
onSignIn("kept on ChatGPT while used up")
|
||||
if err := cx.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
onSignIn("kept on ChatGPT, synced")
|
||||
codexUsedUp = func() bool { return false }
|
||||
if err := cx.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
onSignIn("kept on ChatGPT, allowance back")
|
||||
}
|
||||
|
||||
@@ -1903,9 +1903,28 @@ function appOutSaid(a) {
|
||||
let s = o.user
|
||||
? t("{user}'s ChatGPT allowance is used up, so magpie serves {agent}'s turns until it resets.", { user: o.user, agent: a.name })
|
||||
: t("{agent}'s ChatGPT allowance is used up, so magpie serves its turns until it resets.", { agent: a.name });
|
||||
s += " " + t("Till then the {agent} app's ChatGPT side is off: cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.", { agent: a.name });
|
||||
s += " " + t("Till then the {agent} app's ChatGPT side is off: browser use (its Chrome control), cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.", { agent: a.name });
|
||||
if (o.stuck) s += " " + t("magpie couldn't restart the {agent} app's app-server: quit the app and open it again to send.", { agent: a.name });
|
||||
return s;
|
||||
return s + " " + t("Keep on ChatGPT (its sign-in's Always ChatGPT) leaves {agent} on its ChatGPT account instead: it shows its own limit message till the reset, and magpie no longer takes it over.", { agent: a.name });
|
||||
}
|
||||
|
||||
// keepChatGPT: the takeover turned off where it is told (eddie.zhan on
|
||||
// Discord: browser use said it had no permission), as the sign-in's
|
||||
// Always ChatGPT, which puts Codex back on its account at once
|
||||
function keepChatGPT(a) {
|
||||
const go = el("button", "ag-quiet accent", t("Keep on ChatGPT"));
|
||||
go.type = "button";
|
||||
go.onclick = async () => {
|
||||
go.disabled = true;
|
||||
try {
|
||||
state = await api("set", { agent: a.id, field: "login", value: "chatgpt" });
|
||||
renderAgents();
|
||||
} catch (e) {
|
||||
go.disabled = false;
|
||||
status(tNotice(e.message), "err");
|
||||
}
|
||||
};
|
||||
return go;
|
||||
}
|
||||
|
||||
// appRestart: a desktop app running on what it read before magpie's last
|
||||
@@ -1994,7 +2013,9 @@ function connectPanel(a, { fields, fieldBtn }) {
|
||||
if (a.appOut) {
|
||||
const w = line(el("span", "ag-dot"), el("span", "", appOutSaid(a)));
|
||||
w.classList.add("ag-warn", "ag-app-out");
|
||||
parts.unshift(w);
|
||||
// its own line: WebKit sized a wrapped flex line to the text alone,
|
||||
// and the next line lay over the button
|
||||
parts.unshift(w, line(keepChatGPT(a)));
|
||||
}
|
||||
kv(t("In {agent}", { agent: a.name }), ...parts);
|
||||
} else if (menuFromList(a)) {
|
||||
|
||||
@@ -1838,7 +1838,9 @@ const I18N = {
|
||||
"On magpie until the reset · ChatGPT allowance used up": "由 magpie 接管至额度重置 · ChatGPT 额度已用完",
|
||||
"{user}'s ChatGPT allowance is used up, so magpie serves {agent}'s turns until it resets.": "{user} 的 ChatGPT 额度已用完,重置前由 magpie 接管 {agent} 的对话。",
|
||||
"{agent}'s ChatGPT allowance is used up, so magpie serves its turns until it resets.": "{agent} 的 ChatGPT 额度已用完,重置前由 magpie 接管它的对话。",
|
||||
"Till then the {agent} app's ChatGPT side is off: cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "在此之前,{agent} 应用的 ChatGPT 功能暂时关闭:云端任务、用量显示和退出登录。额度重置后会自动全部恢复。",
|
||||
"Till then the {agent} app's ChatGPT side is off: browser use (its Chrome control), cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "在此之前,{agent} 应用的 ChatGPT 功能暂时关闭:浏览器操作(Chrome 控制)、云端任务、用量显示和退出登录。额度重置后会自动全部恢复。",
|
||||
"Keep on ChatGPT (its sign-in's Always ChatGPT) leaves {agent} on its ChatGPT account instead: it shows its own limit message till the reset, and magpie no longer takes it over.": "点「保持 ChatGPT」(即登录方式里的「始终 ChatGPT」)可让 {agent} 留在它的 ChatGPT 账号上:额度重置前它会显示自己的额度用尽提示,magpie 不再接管。",
|
||||
"Keep on ChatGPT": "保持 ChatGPT",
|
||||
"magpie couldn't restart the {agent} app's app-server: quit the app and open it again to send.": "magpie 无法重启 {agent} 应用的 app-server:退出应用并重新打开即可发送。",
|
||||
"Restart it to use the new account. Running Codex sessions will be interrupted.": "重启后才会使用新账号,正在运行的 Codex 会话将中断。",
|
||||
"Restart Zed if it still asks for an API key: magpie has configured its gateway credential in the system credential store.": "若 Zed 仍要求输入 API 密钥,请重启 Zed:网关凭据已写入系统凭据存储。",
|
||||
@@ -5859,7 +5861,9 @@ const I18N = {
|
||||
"On magpie until the reset · ChatGPT allowance used up": "由 magpie 接管至額度重設 · ChatGPT 額度已用完",
|
||||
"{user}'s ChatGPT allowance is used up, so magpie serves {agent}'s turns until it resets.": "{user} 的 ChatGPT 額度已用完,重設前由 magpie 接管 {agent} 的對話。",
|
||||
"{agent}'s ChatGPT allowance is used up, so magpie serves its turns until it resets.": "{agent} 的 ChatGPT 額度已用完,重設前由 magpie 接管它的對話。",
|
||||
"Till then the {agent} app's ChatGPT side is off: cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "在此之前,{agent} 應用的 ChatGPT 功能暫時關閉:雲端任務、用量顯示和登出。額度重設後會自動全部恢復。",
|
||||
"Till then the {agent} app's ChatGPT side is off: browser use (its Chrome control), cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "在此之前,{agent} 應用的 ChatGPT 功能暫時關閉:瀏覽器操作(Chrome 控制)、雲端任務、用量顯示和登出。額度重設後會自動全部恢復。",
|
||||
"Keep on ChatGPT (its sign-in's Always ChatGPT) leaves {agent} on its ChatGPT account instead: it shows its own limit message till the reset, and magpie no longer takes it over.": "點「保持 ChatGPT」(即登入方式裡的「始終 ChatGPT」)可讓 {agent} 留在它的 ChatGPT 帳號上:額度重設前它會顯示自己的額度用盡提示,magpie 不再接管。",
|
||||
"Keep on ChatGPT": "保持 ChatGPT",
|
||||
"magpie couldn't restart the {agent} app's app-server: quit the app and open it again to send.": "magpie 無法重新啟動 {agent} 應用的 app-server:結束應用並重新開啟即可傳送。",
|
||||
"Restart it to use the new account. Running Codex sessions will be interrupted.": "重啟後才會使用新帳號,正在執行的 Codex 會話將中斷。",
|
||||
"Restart Zed if it still asks for an API key: magpie has configured its gateway credential in the system credential store.": "若 Zed 仍要求輸入 API 金鑰,請重啟 Zed:閘道憑據已寫入系統憑據儲存。",
|
||||
@@ -9857,7 +9861,9 @@ const I18N = {
|
||||
"On magpie until the reset · ChatGPT allowance used up": "リセットまで magpie が処理 · ChatGPT の利用枠を使い切りました",
|
||||
"{user}'s ChatGPT allowance is used up, so magpie serves {agent}'s turns until it resets.": "{user} の ChatGPT の利用枠を使い切ったため、リセットまで magpie が {agent} のターンを処理します。",
|
||||
"{agent}'s ChatGPT allowance is used up, so magpie serves its turns until it resets.": "{agent} の ChatGPT の利用枠を使い切ったため、リセットまで magpie がそのターンを処理します。",
|
||||
"Till then the {agent} app's ChatGPT side is off: cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "それまで {agent} アプリの ChatGPT 機能(クラウドタスク、使用量の表示、ログアウト)はオフになります。リセット時にすべて自動で戻ります。",
|
||||
"Till then the {agent} app's ChatGPT side is off: browser use (its Chrome control), cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "それまで {agent} アプリの ChatGPT 機能(ブラウザ操作(Chrome の操作)、クラウドタスク、使用量の表示、ログアウト)はオフになります。リセット時にすべて自動で戻ります。",
|
||||
"Keep on ChatGPT (its sign-in's Always ChatGPT) leaves {agent} on its ChatGPT account instead: it shows its own limit message till the reset, and magpie no longer takes it over.": "「ChatGPT のまま」(サインインの「常に ChatGPT」)を選ぶと {agent} は ChatGPT アカウントのままになります。リセットまでは {agent} 自身の上限メッセージが表示され、magpie は引き継ぎません。",
|
||||
"Keep on ChatGPT": "ChatGPT のまま",
|
||||
"magpie couldn't restart the {agent} app's app-server: quit the app and open it again to send.": "magpie は {agent} アプリの app-server を再起動できませんでした。送信するには、アプリを終了して開き直してください。",
|
||||
"Restart it to use the new account. Running Codex sessions will be interrupted.": "新しいアカウントを使うには再起動してください。実行中の Codex セッションは中断されます。",
|
||||
"Restart Zed if it still asks for an API key: magpie has configured its gateway credential in the system credential store.": "Zed がまだ APIキーを求める場合は Zed を再起動してください。magpie はシステムの資格情報ストアにゲートウェイの資格情報を設定済みです。",
|
||||
@@ -13885,7 +13891,9 @@ const I18N = {
|
||||
"On magpie until the reset · ChatGPT allowance used up": "Über magpie bis zum Zurücksetzen · ChatGPT-Kontingent aufgebraucht",
|
||||
"{user}'s ChatGPT allowance is used up, so magpie serves {agent}'s turns until it resets.": "Das ChatGPT-Kontingent von {user} ist aufgebraucht, daher bedient magpie die Anfragen von {agent}, bis es zurückgesetzt wird.",
|
||||
"{agent}'s ChatGPT allowance is used up, so magpie serves its turns until it resets.": "Das ChatGPT-Kontingent von {agent} ist aufgebraucht, daher bedient magpie seine Anfragen, bis es zurückgesetzt wird.",
|
||||
"Till then the {agent} app's ChatGPT side is off: cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "Bis dahin ist die ChatGPT-Seite der {agent}-App aus: Cloud-Aufgaben, ihre Nutzungsanzeige und Abmelden. Beim Zurücksetzen kommt alles von selbst wieder.",
|
||||
"Till then the {agent} app's ChatGPT side is off: browser use (its Chrome control), cloud tasks, its usage meter and Log out. It all comes back on its own at the reset.": "Bis dahin ist die ChatGPT-Seite der {agent}-App aus: Browser-Nutzung (ihre Chrome-Steuerung), Cloud-Aufgaben, ihre Nutzungsanzeige und Abmelden. Beim Zurücksetzen kommt alles von selbst wieder.",
|
||||
"Keep on ChatGPT (its sign-in's Always ChatGPT) leaves {agent} on its ChatGPT account instead: it shows its own limit message till the reset, and magpie no longer takes it over.": "„Bei ChatGPT bleiben“ (bei der Anmeldung „Immer ChatGPT“) lässt {agent} stattdessen bei seinem ChatGPT-Konto: Bis zum Zurücksetzen zeigt es seine eigene Limit-Meldung, und magpie übernimmt nicht mehr.",
|
||||
"Keep on ChatGPT": "Bei ChatGPT bleiben",
|
||||
"magpie couldn't restart the {agent} app's app-server: quit the app and open it again to send.": "magpie konnte den App-Server der {agent}-App nicht neu starten: beende die App und öffne sie wieder, um zu senden.",
|
||||
"Restart it to use the new account. Running Codex sessions will be interrupted.": "Starten Sie ihn neu, um das neue Konto zu verwenden. Laufende Codex-Sitzungen werden unterbrochen.",
|
||||
"Restart Zed if it still asks for an API key: magpie has configured its gateway credential in the system credential store.": "Starten Sie Zed neu, falls es weiterhin nach einem API-Schlüssel fragt: magpie hat die Anmeldedaten des Zugangspunkts im Anmeldeinformationsspeicher des Systems hinterlegt.",
|
||||
|
||||
@@ -5,8 +5,12 @@
|
||||
// the app sends again but turns its ChatGPT side off till the reset. The
|
||||
// Agents row says so: on magpie until when, and (on hover and in the row
|
||||
// opened) what is off and that it all comes back. When magpie couldn't
|
||||
// restart the app-server, it says to quit and reopen the app. Every
|
||||
// language, both engines, wide and narrow. No backend, the API is faked.
|
||||
// restart the app-server, it says to quit and reopen the app. What is off
|
||||
// names browser use, which the Codex app's Chrome control loses with
|
||||
// magpie its provider, and the row opened offers Keep on ChatGPT right
|
||||
// there, posted as the sign-in's Always ChatGPT (eddie.zhan on Discord:
|
||||
// browser use said it had no permission). Every language, both engines,
|
||||
// wide and narrow. No backend, the API is faked.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
@@ -22,17 +26,21 @@ const codex = (appOut) => ({
|
||||
});
|
||||
|
||||
const words = {
|
||||
en: { until: "On magpie until", reset: "On magpie until the reset", stuck: "quit and reopen the Codex app", off: "cloud tasks" },
|
||||
zh: { until: "由 magpie 接管至", reset: "由 magpie 接管至额度重置", stuck: "退出并重新打开 Codex 应用", off: "云端任务" },
|
||||
"zh-TW": { until: "由 magpie 接管至", reset: "由 magpie 接管至額度重設", stuck: "結束並重新開啟 Codex 應用", off: "雲端任務" },
|
||||
ja: { until: "まで magpie が処理", reset: "リセットまで magpie が処理", stuck: "Codex アプリを終了して開き直して", off: "クラウドタスク" },
|
||||
de: { until: "Über magpie bis", reset: "Über magpie bis zum Zurücksetzen", stuck: "beende die Codex-App", off: "Cloud-Aufgaben" },
|
||||
en: { until: "On magpie until", reset: "On magpie until the reset", stuck: "quit and reopen the Codex app", off: "cloud tasks", browser: "browser use", keep: "Keep on ChatGPT" },
|
||||
zh: { until: "由 magpie 接管至", reset: "由 magpie 接管至额度重置", stuck: "退出并重新打开 Codex 应用", off: "云端任务", browser: "浏览器操作", keep: "保持 ChatGPT" },
|
||||
"zh-TW": { until: "由 magpie 接管至", reset: "由 magpie 接管至額度重設", stuck: "結束並重新開啟 Codex 應用", off: "雲端任務", browser: "瀏覽器操作", keep: "保持 ChatGPT" },
|
||||
ja: { until: "まで magpie が処理", reset: "リセットまで magpie が処理", stuck: "Codex アプリを終了して開き直して", off: "クラウドタスク", browser: "ブラウザ操作", keep: "ChatGPT のまま" },
|
||||
de: { until: "Über magpie bis", reset: "Über magpie bis zum Zurücksetzen", stuck: "beende die Codex-App", off: "Cloud-Aufgaben", browser: "Browser-Nutzung", keep: "Bei ChatGPT bleiben" },
|
||||
};
|
||||
|
||||
function serve(lang, agents) {
|
||||
function serve(lang, agents, sets = []) {
|
||||
const state = { agents, profiles: [], settings: { lang, theme: "light" } };
|
||||
return async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
if (url.pathname === "/api/set") {
|
||||
sets.push(route.request().postDataJSON());
|
||||
return route.fulfill({ json: { ...state, agents: agents.map((a) => ({ ...a, appOut: undefined })) } });
|
||||
}
|
||||
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false};` });
|
||||
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
|
||||
if (url.pathname === "/api/state") return route.fulfill({ json: state });
|
||||
@@ -68,7 +76,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
page.setDefaultTimeout(5000);
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", serve(lang, [codex(appOut)]));
|
||||
const sets = [];
|
||||
await page.route("**/*", serve(lang, [codex(appOut)], sets));
|
||||
await page.goto("http://magpie.test/?view=agents");
|
||||
const st = page.locator(`${row} .ag-st-t`);
|
||||
await st.waitFor();
|
||||
@@ -76,7 +85,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.ok(text.includes(w[kind]), `${JSON.stringify(text)} lacks ${JSON.stringify(w[kind])}`);
|
||||
assert.doesNotMatch(text, /\{\w+\}/);
|
||||
const title = await page.locator(`${row} .ag-st-t`).getAttribute("title");
|
||||
assert.ok(title && title.includes(w.off), "the hover says what is off: " + title);
|
||||
assert.ok(title && title.includes(w.off) && title.includes(w.browser), "the hover says what is off, browser use too: " + title);
|
||||
assert.ok(title.includes(w.keep), "the hover names Keep on ChatGPT: " + title);
|
||||
assert.ok(title.includes("spent@example.com"), "the hover names the account: " + title);
|
||||
assert.doesNotMatch(title, /\{\w+\}/);
|
||||
|
||||
@@ -84,10 +94,23 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
const said = page.locator(`${row} .ag-app-out`);
|
||||
await said.waitFor();
|
||||
const s = await said.textContent();
|
||||
assert.ok(s.includes(w.off), "the row opened says what is off: " + s);
|
||||
assert.ok(s.includes(w.off) && s.includes(w.browser), "the row opened says what is off, browser use too: " + s);
|
||||
assert.doesNotMatch(s, /\{\w+\}/);
|
||||
const side = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
|
||||
assert.ok(side <= 1, "scrolls sideways: " + side);
|
||||
const keep = page.locator(`${row} .ag-app-out + .ag-vl button`);
|
||||
assert.equal((await keep.textContent()).trim(), w.keep);
|
||||
const box = await keep.boundingBox(), vw = page.viewportSize().width;
|
||||
assert.ok(box && box.x >= 0 && box.x + box.width <= vw + 0.5, "Keep on ChatGPT is on the page: " + JSON.stringify(box));
|
||||
// the row grows open on a spring: pressed once it has, as a
|
||||
// reader would, the button the top thing where it is
|
||||
await page.waitForFunction(() => {
|
||||
const b = document.querySelector('.row.agent[data-id="codex"] .ag-app-out + .ag-vl button'), r = b.getBoundingClientRect();
|
||||
return document.elementFromPoint(r.x + r.width / 2, r.y + r.height / 2) === b;
|
||||
});
|
||||
await keep.click();
|
||||
await page.waitForFunction(() => !document.querySelector('.row.agent[data-id="codex"] .ag-app-out'));
|
||||
assert.deepEqual(sets, [{ agent: "codex", field: "login", value: "chatgpt" }]);
|
||||
assert.deepEqual(errors, []);
|
||||
await page.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user