diff --git a/internal/cli/cpu_cli.go b/internal/cli/cpu_cli.go index a3e1c9f4b..4a64c3b61 100644 --- a/internal/cli/cpu_cli.go +++ b/internal/cli/cpu_cli.go @@ -33,7 +33,7 @@ const cpuUsage = `usage: magpie cpu [] [--seconds N] magpie then prints the file, the CPU time the process used while recording and its goroutines: send both. The profile holds where the time went (function names, source lines) and the path of the magpie program, not keys or messages; go tool pprof - reads it. It asks the gateway at Settings' Gateway port (or MAGPIE_ADDR) over loopback.` + reads it. It asks the gateway at the port in Settings' Gateway address (or MAGPIE_ADDR) over loopback.` // cpuArgs reads magpie cpu's arguments: the file, "" for the default, and // the seconds to record. diff --git a/internal/cli/healthcheck_cli.go b/internal/cli/healthcheck_cli.go index 96f4c564e..52a73cc00 100644 --- a/internal/cli/healthcheck_cli.go +++ b/internal/cli/healthcheck_cli.go @@ -14,7 +14,7 @@ import ( ) // healthcheck: magpie healthcheck — exits 0 when a magpie gateway answers -// at its address (MAGPIE_ADDR, else Settings' Gateway port on 127.0.0.1, +// at its address (MAGPIE_ADDR, else the port in Settings' Gateway address on 127.0.0.1, // 3425 unless set), for a container's // HEALTHCHECK, which has no curl to ask it with. func healthcheck() error { diff --git a/internal/cli/heap_cli.go b/internal/cli/heap_cli.go index 8d2007492..2615ca240 100644 --- a/internal/cli/heap_cli.go +++ b/internal/cli/heap_cli.go @@ -28,7 +28,7 @@ const heapUsage = `usage: magpie heap [] as Go counts it (its heap, what it took from the system, its goroutines): send both. The profile holds where memory was allocated (function names, source lines, sizes) and the path of the magpie program, not keys or messages; go tool pprof reads it. - It asks the gateway at Settings' Gateway port (or MAGPIE_ADDR) over loopback.` + It asks the gateway at the port in Settings' Gateway address (or MAGPIE_ADDR) over loopback.` // heapWait bounds the ask: the profile runs a collection first, which on a // heap of gigabytes takes a while. diff --git a/internal/cli/quota_cli.go b/internal/cli/quota_cli.go index 502ce6408..7f29cf392 100644 --- a/internal/cli/quota_cli.go +++ b/internal/cli/quota_cli.go @@ -26,7 +26,7 @@ const quotaUsage = `usage: magpie quota […] [--json] when it starts again, and each key's balance, asked of the vendors now (or less than a minute ago). --json is for scripts and agents, each entry with lastServedAt, when it last answered through the gateway, and last: true on the latest; the gateway answers the same at - GET http://127.0.0.1:3425/v1/magpie/quotas (on Settings' Gateway port), and to another machine only while magpie is + GET http://127.0.0.1:3425/v1/magpie/quotas (on the port in Settings' Gateway address), and to another machine only while magpie is shared on the local network, with its key as the API key (Authorization: Bearer or x-api-key) A Codex account that holds rate-limit resets says how many; quota reset spends one, starting the account's current windows again (the one Codex is signed in to unless diff --git a/internal/cli/statusline_cli.go b/internal/cli/statusline_cli.go index 518cb567f..f19972a7c 100644 --- a/internal/cli/statusline_cli.go +++ b/internal/cli/statusline_cli.go @@ -34,7 +34,7 @@ const statuslineUsage = `usage: magpie statusline […] ~/.claude/settings.json yourself (magpie doesn't write it, a status line such as claude-hud may hold it): "statusLine": {"type": "command", "command": "magpie statusline"} - It asks the gateway on this computer (Settings' Gateway port, or MAGPIE_ADDR), never + It asks the gateway on this computer (the port in Settings' Gateway address, or MAGPIE_ADDR), never a vendor, and prints nothing when the gateway isn't running.` // statuslineWait bounds each ask of the gateway: Claude Code shows the line diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index ab65e7c22..48cb7061c 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -22730,11 +22730,12 @@ function editRedactRule(r, n, row) { if (d.err) head.querySelector(".sub").classList.add("err"); } -// renderPort: the gateway's port on this computer (Magic_zero on Discord: -// 3425 taken by another program, or one easier to tell apart). Any port -// from 1024 up can be typed; magpie moves its gateway there and every +// renderPort: the gateway's address on this computer (Magic_zero on Discord: +// 3425 taken by another program, or one easier to tell apart). Only its +// port, 1024 up, is typed here; magpie moves its gateway there and every // agent it connected with it, or says why it can't (another program has -// it). MAGPIE_ADDR, set, comes first and the field says so. +// it). MAGPIE_ADDR, a whole host:port, comes first and the field shows it, +// off (Chicring on Discord: the row was titled a port while it showed one). let portDraft = { value: null, err: "" }; // portSays is the gateway's word on a port it couldn't take, in the page's // language: it says the port, so it is matched rather than looked up @@ -22749,23 +22750,23 @@ function renderPort(s) { const box = $("#portList"); const r = el("div", "row pref port-row"); const who = el("div", "who"); - who.append(el("div", "name", t("Gateway port"))); + who.append(el("div", "name", t("Gateway address"))); const sub = el("div", "sub"); const d = portDraft; const now = s.addrEnv ? "" : String(s.port || 3425); const field = input(d.value ?? now, "3425"); field.className = "words gateway-port"; field.inputMode = "numeric"; - field.setAttribute("aria-label", t("Gateway port")); + field.setAttribute("aria-label", t("Gateway address")); const save = el("button", "text", t("Apply")); if (s.addrEnv) { field.value = s.addrEnv; field.disabled = save.disabled = true; - sub.textContent = t("MAGPIE_ADDR={addr} sets the gateway’s address: unset it to set the port here", { addr: s.addrEnv }); + sub.textContent = t("MAGPIE_ADDR={addr} sets the gateway’s whole address, host:port: unset it to set the port here", { addr: s.addrEnv }); } else if (d.err) { sub.textContent = d.err; sub.classList.add("err"); - } else sub.textContent = t("Agents magpie connected move with it. Now {url}", { url: s.gateway || "" }); + } else sub.textContent = t("Only the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole address instead. Agents magpie connected move with it. Now {url}", { url: s.gateway || "" }); who.append(sub); save.onclick = () => { const p = Number(field.value.trim()); diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 6f98ac96e..0ebea1d46 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -939,9 +939,9 @@ const I18N = { "Public address": "公网地址", "MAGPIE_PUBLIC_URL: where other computers reach the gateway, with a gateway key": "MAGPIE_PUBLIC_URL:其他电脑访问网关的地址,需带网关密钥", "Share on local network": "局域网共享", - "Gateway port": "网关端口", - "Agents magpie connected move with it. Now {url}": "改了之后,已接入 magpie 的 Agent 会一起换过去。当前 {url}", - "MAGPIE_ADDR={addr} sets the gateway’s address: unset it to set the port here": "MAGPIE_ADDR={addr} 已指定网关地址:去掉这个环境变量后才能在这里设端口", + "Gateway address": "网关地址", + "Only the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole address instead. Agents magpie connected move with it. Now {url}": "这里只设端口(1024 到 65535);MAGPIE_ADDR=主机:端口 可指定完整地址。改了之后,已接入 magpie 的 Agent 会一起换过去。当前 {url}", + "MAGPIE_ADDR={addr} sets the gateway’s whole address, host:port: unset it to set the port here": "MAGPIE_ADDR={addr} 已指定网关的完整地址(主机:端口):去掉这个环境变量后才能在这里设端口", "A port is a number from 1024 to 65535": "端口是 1024 到 65535 之间的数字", "Port {p} is in use by another program: pick another one": "端口 {p} 已被其他程序占用,请换一个", "Another magpie serves the gateway at {url}: set its port there, or quit it first": "另一个 magpie 正在 {url} 提供网关:请在那边设端口,或先退出它", @@ -4775,9 +4775,9 @@ const I18N = { "Public address": "公開位址", "MAGPIE_PUBLIC_URL: where other computers reach the gateway, with a gateway key": "MAGPIE_PUBLIC_URL:其他電腦連到閘道的位址,需帶閘道金鑰", "Share on local network": "區域網共享", - "Gateway port": "閘道連接埠", - "Agents magpie connected move with it. Now {url}": "改了之後,已接入 magpie 的 Agent 會一起換過去。目前 {url}", - "MAGPIE_ADDR={addr} sets the gateway’s address: unset it to set the port here": "MAGPIE_ADDR={addr} 已指定閘道位址:去掉這個環境變數後才能在這裡設連接埠", + "Gateway address": "閘道位址", + "Only the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole address instead. Agents magpie connected move with it. Now {url}": "這裡只設連接埠(1024 到 65535);MAGPIE_ADDR=主機:連接埠 可指定完整位址。改了之後,已接入 magpie 的 Agent 會一起換過去。目前 {url}", + "MAGPIE_ADDR={addr} sets the gateway’s whole address, host:port: unset it to set the port here": "MAGPIE_ADDR={addr} 已指定閘道的完整位址(主機:連接埠):去掉這個環境變數後才能在這裡設連接埠", "A port is a number from 1024 to 65535": "連接埠是 1024 到 65535 之間的數字", "Port {p} is in use by another program: pick another one": "連接埠 {p} 已被其他程式佔用,請換一個", "Another magpie serves the gateway at {url}: set its port there, or quit it first": "另一個 magpie 正在 {url} 提供閘道:請在那邊設連接埠,或先退出它", @@ -8583,9 +8583,9 @@ const I18N = { "Public address": "公開アドレス", "MAGPIE_PUBLIC_URL: where other computers reach the gateway, with a gateway key": "MAGPIE_PUBLIC_URL:他のコンピュータがゲートウェイに接続するアドレス(ゲートウェイキーが必要)", "Share on local network": "ローカルネットワークで共有", - "Gateway port": "ゲートウェイのポート", - "Agents magpie connected move with it. Now {url}": "magpie に接続したエージェントも一緒に移ります。現在 {url}", - "MAGPIE_ADDR={addr} sets the gateway’s address: unset it to set the port here": "MAGPIE_ADDR={addr} がゲートウェイのアドレスを指定しています。ここでポートを設定するには解除してください", + "Gateway address": "ゲートウェイのアドレス", + "Only the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole address instead. Agents magpie connected move with it. Now {url}": "ここで設定するのはポート(1024〜65535)だけです。アドレス全体は MAGPIE_ADDR=ホスト:ポート で指定します。magpie に接続したエージェントも一緒に移ります。現在 {url}", + "MAGPIE_ADDR={addr} sets the gateway’s whole address, host:port: unset it to set the port here": "MAGPIE_ADDR={addr} がゲートウェイのアドレス全体(ホスト:ポート)を指定しています。ここでポートを設定するには解除してください", "A port is a number from 1024 to 65535": "ポートは 1024〜65535 の数値です", "Port {p} is in use by another program: pick another one": "ポート {p} は他のプログラムが使用中です。別のポートを選んでください", "Another magpie serves the gateway at {url}: set its port there, or quit it first": "別の magpie が {url} でゲートウェイを提供しています。そちらでポートを設定するか、先に終了してください", @@ -12405,9 +12405,9 @@ const I18N = { "Public address": "Öffentliche Adresse", "MAGPIE_PUBLIC_URL: where other computers reach the gateway, with a gateway key": "MAGPIE_PUBLIC_URL: wo andere Computer das Gateway erreichen, mit einem Gateway-Schlüssel", "Share on local network": "Im lokalen Netzwerk freigeben", - "Gateway port": "Port des Zugangspunkts", - "Agents magpie connected move with it. Now {url}": "Mit magpie verbundene Agenten ziehen mit um. Jetzt {url}", - "MAGPIE_ADDR={addr} sets the gateway’s address: unset it to set the port here": "MAGPIE_ADDR={addr} legt die Adresse des Zugangspunkts fest: entferne die Variable, um den Port hier zu setzen", + "Gateway address": "Adresse des Zugangspunkts", + "Only the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole address instead. Agents magpie connected move with it. Now {url}": "Hier wird nur der Port gesetzt, 1024 bis 65535; MAGPIE_ADDR=Host:Port legt die ganze Adresse fest. Mit magpie verbundene Agenten ziehen mit um. Jetzt {url}", + "MAGPIE_ADDR={addr} sets the gateway’s whole address, host:port: unset it to set the port here": "MAGPIE_ADDR={addr} legt die ganze Adresse des Zugangspunkts fest (Host:Port): entferne die Variable, um den Port hier zu setzen", "A port is a number from 1024 to 65535": "Ein Port ist eine Zahl von 1024 bis 65535", "Port {p} is in use by another program: pick another one": "Port {p} wird von einem anderen Programm verwendet: wähle einen anderen", "Another magpie serves the gateway at {url}: set its port there, or quit it first": "Ein anderes magpie stellt den Zugangspunkt unter {url} bereit: setze den Port dort oder beende es zuerst", diff --git a/internal/gui/port.go b/internal/gui/port.go index d8a32d940..788980a89 100644 --- a/internal/gui/port.go +++ b/internal/gui/port.go @@ -62,8 +62,8 @@ func errPortTaken(p int) error { return fmt.Errorf("port %d is in use by another program: pick another one", p) } -// setPort moves the gateway to port p (0 for the default) — Settings' -// Gateway port (Magic_zero on Discord: 3425 was taken, and a port of one's +// setPort moves the gateway to port p (0 for the default) — the port in +// Settings' Gateway address (Magic_zero on Discord: 3425 was taken, and a port of one's // own is easier to tell apart): it checks nothing listens there, saves it, // moves the gateway this magpie serves (or starts it, when the port it was // on was taken), and then every agent connected to magpie, whose configs diff --git a/internal/gui/tests/gateway-port.test.cjs b/internal/gui/tests/gateway-port.test.cjs index fcc1dab8e..ed1ed0fef 100644 --- a/internal/gui/tests/gateway-port.test.cjs +++ b/internal/gui/tests/gateway-port.test.cjs @@ -1,11 +1,13 @@ // Run with Node's test runner and Playwright on the module path; see README.md. -// Settings › Gateway port (Magic_zero on Discord: 3425 was taken by another +// Settings › Gateway address (Magic_zero on Discord: 3425 was taken by another // program, and a port of one's own is easier to tell apart): any port from // 1024 to 65535 can be typed and applied. One out of range is refused in the // page; one another program has is refused with the gateway's reason, in the // page's language, what was typed kept; a free one moves the gateway and // says how many agents moved with it, and the row then says the new URL. -// With MAGPIE_ADDR set the field is off and says why. The field is an +// With MAGPIE_ADDR set the field is off, shows its host:port and says why; +// the row is titled an address, not a port, since it shows one there +// (Chicring on Discord), and says only the port is typed. The field is an // input, not a native