fafa1978c5bcb894e01559d2b4bf43b3ccf35ad4
440
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3c9d79d282 |
gateway: a key can set how the routing groups it asks for route (justforlxz on X)
justforlxz asked on X for a routing strategy among a gateway key's options. A key now has Routing: unset follows each group's own (the default), "smart" is the default Quota first, or any built-in routing (order, drain, rotate, usage, pace, weight, free, fast, cheap, expiring, fit) or a plugin's <plugin>/<name>. Manual is refused, and a Manual group still goes to its pick. A provider or nested group with its own routing keeps it (#576), as under the group's own. - access: Key.Routing, Identity.Routing, the routing-key action (CleanRouting). An issued key that sets none follows its issuer's. - provider: GroupRouting is the list of routings a group takes. SaveGroup and CleanRouting both use it. - gateway: keyRouted is applied wherever a request's group is resolved: handle (Chat, Messages, Responses, and the masked-route move), embeddings/rerank, draw, video, a System One decision group and relayed search. count_tokens plans no group. planned carries the routing the plan was made by, so leastHeld weighs members the same way and the trace's group shows it. - CLI: magpie gateway-key routing <id> [follow|smart|...]. - GUI: a "Group routing" badge on the key row, hidden until hover like the tier and masking badges, opens the app's menu (openProtoMenu). The routings the rotation plugin serves are left out when it is off. zh, zh-TW, ja and de strings are included. - docs/subsystems/gateway-routing.md: the paragraph after ServiceTier. Run (at cf5840a37 rebased on |
||
|
|
6635dec7cd |
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 |
||
|
|
6a0afc38a9 |
library: a skill can be removed with no copy kept in the backups (Eternalfate__ on X)
Removing a skill always moved its folder to ~/.magpie/backups/<time>/, and backups that hold skills are never pruned, so they piled up. The sheet that asks first now has one tick under what it says, "Keep a copy in magpie's backups", ticked unless the reader unticked it last time (localStorage magpie.libSkillBackup). Unticked, the sheet says the folder is deleted and Remove posts noBackup: true. The default is unchanged. What is deleted is only magpie's own folder for the skill, or an agent's own skill folder. Never deleted, either way: - a folder a library skill links to (~/.agents/skills or anywhere else): only the link goes, and there's no tick on its sheet; - an entry in ~/.agents/skills, which other tools read too: it still goes to the backups (inSharedDir), and the sheet has no tick for it; - a skill brought in from the agents: it still goes back to them; - a link inside a skill's folder: RemoveAll takes the link, not its target. Every path that removes skills: - GUI: one skill, Remove all / Remove n, Remove gone, an agent's own skill and several of them (skills/remove, remove-all, remove-gone, remove-found, remove-found-some take noBackup); - CLI: magpie library skill rm <name> --no-backup, and --no-backup on rm --all and rm --gone, whose prompt says so; - TUI: d asks, then D deletes with no backup (d d still keeps a copy); the first d's flash says so, on rows with a folder to delete. library: RemoveSkillsHow, RemoveFoundSkillsHow, RemoveGoneSkillsHow (keep bool); RemoveSkill(s) and RemoveFoundSkill(s) keep a copy as before. The sheets with the tick say they hold nothing to lose (modal.dirty false): toggling it made Cancel ask to discard changes. A page reload with such a sheet open still reads the form as changed (beforeunload reads the core's modalFormDirty); not changed here. Existing backups stay where they are, in ~/.magpie/backups/<time>/skills and <time>/<agent>/skills. Nothing clears them; the Library's Backups button opens the folder. docs/subsystems/library.md says so. Run (mote, this tree at base 9494a38b4; rebased onto |
||
|
|
06db81530e |
library: a project's choices exported from the CLI and applied at another folder (#7278)
jinpwng asked to carry one project's Library choices, with what they need, to a new path (a new checkout, another machine) from the CLI. - `magpie library project export <dir> [file|-]` writes ExportProject's JSON (kind magpie-project, version 1): the project's skills, servers, subagents, hooks and plugins by agent, its Claude Code plugins, Pi packages, servers and skills turned off, and its instructions, plus need: each hook's and subagent's definition, each skill's and plugin's remote source; a plugin's own hooks and subagents go by their plugin. No ownership record (Placed, HookRecs, AgentFiles, PiRecs, ClaudeWrote, InstrFiles), key, sign-in or other project goes in; a server goes by name only, since its settings can hold a key. The file is 0600. - `apply <file|-> <dir>` (also `import`) makes the folder a project, saves a hook or subagent the library here lacks from the export (for no agent of its own), and gives each choice through the setters the page uses: the agents the folder has for it kept, the export's added, so a second apply changes nothing and the folder's own entries stay. A Claude plugin or Pi package the folder has already is left as it is; instructions only when it has none. What this library lacks (a skill, server or plugin) is named with its source and exits 1; nothing is fetched. Run (mote): go test ./internal/library -run 'TestProjectExportApply' -count=1: ok; the full suite is in the push record. Real CLI (built binary, two sandbox HOMEs with stub claude and pi on PATH): in A, project add, hook bark and subagent checker for claude, Pi npm:pi-demo, export; A deleted; in B (its own "echo mine" Stop hook in .claude/settings.local.json) apply saved bark and checker and printed "has what the export has", a second import printed the same and added nothing; B's settings.local.json held SessionStart "echo bark" beside "echo mine", .claude/agents/checker.md was written and .pi/settings.json listed npm:pi-demo. Broken by hand: with the hook save in ApplyProject skipped, TestProjectExportApply is red. Not tried: the reporter's own projects; a Windows path in an export. |
||
|
|
bbac3b5a60 |
library: Claude Code's own plugins list their skills, hooks and subagents (#7266)
A plugin installed with `claude plugin install` showed nowhere in the
Library's Skills, Hooks or Subagents, and a project's whole-plugin choice
(Library > Projects, Claude Code plugins) named it with nothing of what it
brings (jinpwng, v0.1.4572). ReadNative had readers for Codex and Pi only.
- claudeNative reads Claude Code's installed_plugins.json (v2): every
record whose installPath is there, user scope as the user's, project and
local scope with their projectPath. Enabled comes from enabledPlugins in
the scope's own settings (settings.json, the project's
.claude/settings.json or settings.local.json); unknown stays unknown.
- Parts come from the plugin's .claude-plugin/plugin.json and Claude's
default places (skills/, hooks/hooks.json, .mcp.json, agents/*.md), the
manifest's own paths added; subagents are a new part kind, read with
the library's subagent reader, a .md with no front matter skipped.
- The GUI lists them read-only on Skills, MCP, Hooks and Subagents with
plugin id and scope (the project's folder for a project one), and a
project card's Claude Code plugin row says what the plugin brings.
magpie writes nothing: Claude Code keeps loading them.
- `magpie library native` names Claude Code too.
Run (mote): go test ./internal/library -run TestNative -count=1: ok.
node --test on 115 GUI files (every library-* and project-* file, plus
builtins, nav, sidebar, phone-no-sideways, i18n-keys and the other files
that reach these tabs), chromium and webkit: 2330 tests, 2320 ok, 10 red. library-open-again is red the same way alone on origin/main
|
||
|
|
1ee41113f5 |
grok: with no size typed, Grok Build compacts at its own 85% of the window (@taktoshilite on X)
@taktoshilite: the Grok config magpie writes says auto_compact_threshold_percent = 25-something and 50-something, so a 1M model compacts at a quarter of its window; they asked for ~90%. Cause: |
||
|
|
6d46859c48 |
provider: a relay key bills at its sub2api group rate times the provider's top-up rate (@YIXIE233 on X)
@YIXIE233 has several sub2api relays. Each reports a key's group rate at GET /v1/sub2api/billing, and each sells its dollars at its own price (¥1 for $1 at one, ¥7 for $100 at another). Until now every key's rate was typed by hand and typed again whenever a relay changed its prices. Now a provider of API keys has a "Top-up rate" under Advanced, next to Price rate (TopUpRate: above 0 up to 1000, at most four decimals). With one set, the gateway's KeepKeyRatesRead asks each key's relay for its rate in the background. It reads at start, every 6h, 30 min after a failed read, and at once on a save that sets a new top-up rate. It is never on a request's path. The relay asked is the origin of its sub2api key query, else of its first base; loopback and vendor hosts are never asked. Readings go to key-rates.json beside providers.json. A key then bills at group rate x top-up rate, and that rate reaches both places a price is used: PriceAt (Cheapest/By price routing) and BaseKeyPriceIn (the ledger, Usage, spend caps). A group rate of 0 prices at 0 (zeroRate), not at the list price. - A key's own KeyPriceRates still wins. - A key never read, or whose reads all failed, is unknown and bills at the provider's PriceRate, never 1x. - A failed reread keeps the last rate it read. The Usage caches key on a hash of the rates read, so a reread that finds the same rates keeps them. /api/providers lists keyGroupRates, which the editor names under the box. An empty per-key line's placeholder shows group rate x top-up rate. `magpie provider key-rate` lists both. i18n: zh, zh-TW, ja, de. Not counted yet: sub2api's peak-hour multiplier (#7286). Run (mote, via mote-run): - At |
||
|
|
54b9516473 |
library: a project's Pi packages, on, off or removed, and adopting its own (#7249)
A project now takes Pi packages: entries of its .pi/settings.json `packages`, matched by piSourceID. A package is on (its source), off but kept (every filter empty, as `pi config` writes it) or removed. Project.Pi is what the project wants, PiRecs what magpie wrote; only an entry still as magpie wrote it is changed or taken out, and a file magpie made goes with its last entry. An entry the project had is its own: refused with a problem until adopted, then switched without a rewrite, and put back as it was (never deleted) when let go; one that picks some resources is refused. Surfaces: POST /api/library/projects/pi (how on|off|removed|adopt), `magpie library project pi [list|add|on|off|rm|adopt] <dir> <source...>`, the project's own packages in Own["pi"], and a Pi packages block on the Claude plugins tab's project card (switch, remove, Take over, add field) in en, zh, zh-TW, ja, de. Pi installs a package itself when it next starts. Run (mote): gofmt, go vet; go test ./internal/library ./internal/cli ./internal/gui (library, cli ok; gui red only in TestBuiltinsTranslated #7257 and TestSettingsSaveKeepsWhatItDoesNotSend #7240, both filed); GUI project-pi (new), project-own, project-plugins, project-hooks, project-claude-plugins, project-servers, i18n-keys in chromium and webkit. Not tried: a real Pi starting in a project with these packages; the whole GUI suite; Windows. |
||
|
|
4ff57b8cbf |
library: a project's own resources are listed apart from what magpie placed, with a source in the CLI's --json (#7245, #7247)
ProjectView.Own reads, per kind, what the folder's own files already give agents and magpie didn't write: skills in the skills folders, servers in each agent's project MCP file (name and transport only, never URL, args or env), hooks in .claude/settings.json, settings.local.json and .codex/hooks.json (an entry is magpie's when it equals a HookRecs entry), and subagent files whose hash isn't in AgentFiles. Read-only: a link out of the folder or a file that can't be read is left out. The cards show them under "Project's own", no chips. `magpie library project server|hook|subagent <dir> --json` gains `items`, each with source "magpie" or "project"; the old maps stay as they were. Not done: Claude plugins, Pi packages and instructions are not read as the project's own yet; the cards have no "Assigned by MagPie" heading, the chips already say it. Run on mote: gofmt, go vet library, cli, gui; go test ./internal/library and ./internal/cli (whole packages, ok); new TestProjectOwnResources and the CLI source check; GUI project-own (new), project-hooks, project-servers, project-skills-*, project-plugins, i18n-keys in both engines, then every library-* and project-* file once: library-bar-more went red in that run and green alone (load, not filed: it did not touch this change). Not tried: a real project with hundreds of skills (the read is on every state poll of a project folder). |
||
|
|
1e174f8f9f |
library: a project gets a single hook, for the agents that read a project's hooks file (#7253)
A project had hooks only through the plugins it took. Now the Hooks tab
lists the projects, and a hook can be given to one on its own, per agent
(Claude Code and Codex; Pi, Goose and the rest read no project hooks
file). Project.Hooks feeds projectHooks, so the write and the HookRecs
ownership records are the ones plugins' hooks already use: withdrawing
removes only what magpie wrote, never the user's own entries. Worktrees
follow through syncTrees; renaming or deleting a hook in the library moves
or drops its project entry. CLI: magpie library project hook.
Also fixes the CLI's problem keys (they lacked the kind prefix for mcp and
subagent) and the empty-project count in syncTrees, which now counts
Hooks and ClaudePlugins.
Run on mote: gofmt; go vet library, cli, gui; go test of the TestProject*,
TestHook* and TestLibraryProject* tests in internal/library and
internal/cli; GUI project-hooks (new, chromium and webkit, en and zh),
project-plugins, project-claude-plugins, i18n-keys. 14 other library GUI
files were red on this base with "nativeView is not iterable"; origin/main
has
|
||
|
|
ab342fa40d |
library: magpie library project server and subagent add, rm and agents (#7248)
The CLI had project skills and instructions only. `server` and `subagent` now list, add (agents= or the agents already used, else every agent here that reads a project's MCP file or subagents folder), take out and re-point a project's library servers and subagents through ProjectServer and ProjectSubagents, the calls the Library page makes. A name the project doesn't have is refused, as is an unknown agent or flag; a part magpie couldn't place exits 1 with why. The command shape follows the reference commit in the reporter's fork (0d3a6de55), rewritten over this tree's calls rather than ported. Run: mote-run go test ./internal/cli -run TestLibraryProject (the new TestLibraryProjectServerAndSubagentCmd: the user's own .mcp.json server survives an add and an rm, Codex's file gets the server, Claude's and Codex's subagent files come and go with their agents). gofmt and go vet ./internal/cli clean. Not tried: the whole Go suite; the package run also prints testenv's docs-index guard (routing-groups pages newer than the search index), which is not about this change; a real agent reading the files. Co-authored-by: Arobotmaster <50254754+Arobotmaster@users.noreply.github.com> |
||
|
|
6d153bffca |
library: list the skills, MCP servers and hooks of plugins installed natively in Codex and Pi (#7244)
The Library now reads Codex's plugin cache (plugins/cache/<marketplace>/<plugin>/<version>,
manifests under .codex-plugin, .claude-plugin or .cursor-plugin; config.toml's
enabled flag) and Pi's packages (settings.json packages, package.json pi.skills,
user and project scope) and lists what they bring on the skills, MCP and hooks
tabs under "Installed in the agents themselves", with origin and scope.
Read-only: nothing is copied, linked or registered; the agent keeps loading it,
load status stays unknown. Paths stay inside the plugin; an unreadable file
means unknown. New GET /api/library/native (lazy, not on the polled
/api/library) and `magpie library native`. Docs row in library.md.
Run (mica, sandbox HOME, nothing of the live ~/.codex or ~/.pi touched):
- go vet darwin; internal/library native tests (6) and the new GUI test
library-native.test.cjs in chromium and webkit, 5 languages, 980 and 380 px.
- Built binary against a sandbox copy of the real Codex cache manifests (74 files).
- Not tried: Claude native plugins, subagents, Pi MCP and hooks, a live Codex
or Pi, Windows and WSL Pi. The whole GUI suite and the full Go suite run after the push.
- Not mine: every package using testenv is red on origin/main
|
||
|
|
c01988e439 |
routing: a group's Small context first sends a request to the smallest window that holds it
yg6888 on X (tweet 2123308968848379920): in a group routed Smart, Cursor Plus's Composer and Grok 4.7 were never used. Not a bug: Smart orders by allowance tier, then soonest renewal, then listed order, and never weighs the context window, so the 1M members listed ahead always answered. The small ones were only ever reached as a fallback. Smart itself is unchanged; changing its order would move every Smart user's traffic. A group gets a new routing instead, `fit` (Small context first; 小上下文优先, 小上下文優先, 小さいコンテキスト優先, Kleiner Kontext zuerst): - routes.SmallFirst takes Smart's order and sorts it stably by band (a provider set to be used first, the rest with room, the all but used up) and then by window, the smaller known first, an unknown one last. - Its strategy sets ByWindow, so weighRouted fills Seat.Window from windowIn (the provider's own Contexts, else the catalog's). - roomy already leaves out every member the request is estimated past, so the first left is the smallest that holds it: a small model is never asked for a request too long for it, and keeps its last-resort place as under every routing. - The trace's rows carry `context`; the Routing page says "its 200K context window is the smallest that holds this request". - A group's only: provider.normalize already drops it from a provider and the CLI refuses it there. GUI menu, hint, why-lines, TUI and CLI (`routing=fit`, small-first) carry it; docs/reference.md, the gateway-routing and plugin-runtime pages and the en/zh/ja start pages say it, with the search index rebuilt (via docs-index.mjs; #7065). Run first at the tree rebased on origin/main |
||
|
|
ef997d186c |
serve: a SIGTERM finishes the requests in flight, for Kubernetes rolling updates
@justforlxz on X runs magpie in Kubernetes and every update cut the
requests in flight. A SIGTERM ended the gateway like Ctrl+C: the
listener closed at once and Shutdown cut what was left after 2s, an
agent's stream included, with no unready phase for the Service to see.
Now a SIGTERM to `magpie serve`, `magpie web` or `serve --web`:
- GET / answers 503 {"draining":true} at once, so `magpie healthcheck`
(the image's HEALTHCHECK, and the readiness probe the docs give) fails
and the pod leaves its Service's endpoints;
- in a pod (KUBERNETES_SERVICE_HOST) it keeps accepting for 5s while
that reaches kube-proxy and the ingress, then stops accepting;
- the requests in flight, streams included, get up to MAGPIE_DRAIN to
finish: unset, 20s in a pod (k8s' default grace is 30s, with room to
save after) and 7s elsewhere (docker stop and Compose kill at 10s,
and a drain past that would lose the state saved at the end);
seconds or a Go duration; 0 ends after 2s as before; an unreadable
value logs and uses the default. magpie web's page port (which
serves /v1 too) shuts down within the same grace.
Ctrl+C and SIGHUP end as before. Nothing to configure.
A request still answering at the end of any drain was logged as "cut"
but kept running, its upstream call too, until the process exited:
Shutdown doesn't close active connections. The gateway now closes them
after a failed Shutdown, so a gateway restarted in-process (the GUI's
restart, a test) leaves nothing holding the provider catalog
(holdCatalog). TestDrainEndsAtItsGrace's cut request, still in flight
after it returned, made the next test, TestGrokGetsAgentMessageAsUser,
read migrations.json through that hold and fail in a full gateway run
on WSL; the test now waits for it to end, and without the Close that
wait fails at 30s.
PID 1: the image's ENTRYPOINT is exec form, so magpie is PID 1 and gets
the SIGTERM itself (it calls signal.Notify). As PID 1 it exits 2 rather
than 143 after the drain, the same on the old code.
/config shared by two pods (a RollingUpdate overlap) is not verified
safe: files are flock'd and written by rename, but the serving magpie's
sign-in renewal, plugin sign-in renewal and check-ins would run in both.
The docs say one pod per volume with strategy: Recreate (an RWO volume
on another node also stalls a RollingUpdate). Requests sent between the
old pod's end and the new one's start are refused; the drain covers what
was in flight.
Docs: a Kubernetes section (Deployment with an exec readiness probe,
terminationGracePeriodSeconds, Recreate, the RWO note) and a
MAGPIE_DRAIN row on docker.html in en, zh and ja; docs/reference.md's
Docker section; site index regenerated.
Run:
- TestDrainedGatewayFinishesItsStream, TestDrainEndsAtItsGrace,
TestHandedOverGatewayFinishesItsStream, TestReadOnlyKeyEveryRoute,
TestDrainGrace, TestDrainOnSignal and the cli Signal tests: ok (mica).
- Broken by hand: without Drain's grace in drainFor,
TestDrainedGatewayFinishesItsStream fails "the gateway ended with a
stream in flight".
- Real binary (before the 7s default, which applies outside a pod
only, and the Close), sandbox HOME, fake SSE upstream streaming 10s, SIGTERM
at +2s, KUBERNETES_SERVICE_HOST set, magpie as PID 1 in its own pid
namespace (unshare) on Linux (WSL magpie-desktop), serve and web:
new: healthcheck fails while draining, a new request 1s after SIGTERM
200, the stream completes at +10s, exit at +11s. origin/main: the new
request is refused, the stream is cut at +4s after 4 chunks. Also
serve on macOS (mica): same, exit status 143.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build: ok (mica), before the 7s default
and the Close.
- Full suite, go test -count=1 -timeout 45m ./..., on Linux (WSL
magpie-desktop; mote and mica were each running another session's
suite) at the first version of this change on
|
||
|
|
3132fa1cd9 |
library: Rules, a folder of rules given to Claude Code, Cline and Kiro CLI (JonahFu on X)
JonahFu asked on X (tweet 2123237371739316685) for Claude's rules folder in the Library. A new Rules tab keeps rules once and gives each to the agents ticked for it, in the folder each reads by itself: - Claude Code: <claude dir>/rules/<name>.md. `paths` is the only front matter key it reads (code.claude.com/docs/en/memory). Checked on real 2.1.327 in a sandbox: it reads every .md under the folder, loads one without paths at launch, and one with paths when Read/Write/Edit touches a matching file. - Cline: <cline dir>/rules (CLINE_DIR, else ~/.cline). Cline 3.0.70 reads every rule always and has no paths key, so a rule with paths isn't written for it; the agent gets a problem and the editor says why under the paths. - Kiro CLI: ~/.kiro/steering, `inclusion: fileMatch` + `fileMatchPattern` for paths, else always. A rule named "agents" is refused there (it would be AGENTS.md on a disk that ignores case). - Not listed: Cursor (user rules live in its settings; .cursor/rules is per project), Codex (its rules are execpolicy), Droid (command permissions), Gemini CLI, Qwen Code and OpenCode (no rules folder). A body starting with --- gets an empty front matter first. Files are recorded with their hash in Applied.Rules through the same syncOwnFiles as subagents and slash commands: a file of the user's own by that name, or one magpie wrote that the user edited, is never written over or taken away. Bundles (backup, WebDAV) carry rules; a bundle from an older magpie leaves this computer's alone. The editor lists each agent's file to reveal. No CLI yet. docs/subsystems/library.md: a Rules row and its tests. Run (mica-run, at this tree): - go vet -tags nogui ./internal/library ./internal/gui ./internal/davsync ./internal/cli: ok. gofmt -l: none. - go test -tags nogui -timeout 45m ./internal/library ./internal/davsync: ok (TestRulesEachAgentsFile, TestRulesKeptToTheirPaths, TestRulesLeaveTheUsersFiles, TestRuleCheck, TestRulesCarried). - node --test library-rules, library-subagents, library-commands, library-hooks, library-loading, library-groups, i18n-keys, i18n-en-no-cjk (Chromium and WebKit, 420 and 1100 wide, en zh zh-TW ja de): 78 of 78. - The full suite and cross-OS vet ran at the next commit, which this one is under. - Real use: Claude Code 2.1.327 in a sandbox HOME loaded a rule without paths at launch and one with paths only on touching a match; a sandbox magpie on mica wrote ~/.claude/rules/go-style.md with paths: ["**/*.go"]. Not tried: Cline and Kiro CLI loading the files for real, project-level rules (.claude/rules in a repository), Copilot and CodeBuddy (not verified, not listed), Windows and Linux. |
||
|
|
7d5db0f29a |
cli: a command that ends ends its plugin hosts, and one that doesn't serve starts none (#7146)
athemeroy (WangYeruo on X) runs `magpie serve` as a LaunchAgent with the
magpie-google-ai-studio browser plugin and 11 accounts. Each
`magpie --version`, `version`, `licenses` or `group <id>` run beside it
left a second magpie-bun host with PPID 1, holding the Chrome profiles
the gateway's host wanted ("Chrome exited before starting WebView").
Their analysis was right on each count:
- plugin.Cached starts a background list of the plugins' providers
whenever this process hasn't listed them (provGood is in memory), so
every short command reaching provider.Catalog (startUp's RenameLegacy,
groups, models, ...) started a host.
- Main ended through os.Exit and never stopped it. A host whose stdin
closes leaves only once nothing is pending, and a plugin holding a
browser keeps Bun up meanwhile, so the host outlived magpie, adopted
by init. SIGTERM (launchd stopping serve) orphaned serve's own host
the same way.
- --version and licenses were answered after startUp.
Now:
- Cached asks the plugins in the background only when
plugin.ListInBackground is on; run sets it from servesPages (app,
web, serve, TUI). Other commands read the list on disk.
- Main ends through exit(), which runs plugin.EndHosts first, on
success and error; die does too on SIGINT/SIGTERM/SIGHUP, bounded by
hostsOnSignal (20s, past the 15s a renewing host gets).
- provider test returns exitError instead of os.Exit(1).
- -v/--version/version and licenses answer before any start-up work.
Audit of the os.Exit calls in internal/cli: data_cli.go:135 and the
CheckEnv exit in Main run before anything can start a host;
claudeLetGo already called EndHosts.
Tests (red on the old code, the non-test sources reverted to
|
||
|
|
598bc45346 |
update: a container's hint names the found version's own image, not :latest (fishmagic80 on X)
In Docker, Settings › About on the Daily channel said "0.1.4479 is out … docker pull ghcr.io/yetone/magpie:latest". :latest is the newest release (docker.yml), daily and stable the Daily and Stable channels' (docker-daily.yml, docker-stable.yml), so :latest held 0.1.4504, not the 0.1.4479 announced; on Stable it is weeks apart. docker.yml writes every release's own tag (ghcr.io/yetone/magpie:0.1.4479; checked on ghcr: 4479, 4395, latest, daily, stable, 0.1 all resolve, daily = 4479's digest). update.Image(version) is that tag, and every place that printed the command names it now, with "recreate the container from it" (a compose file on :latest would otherwise run the old tag again): - the GUI's Version row and Update pill (/api/update's new `image`, stuck "container"; app.js updateStuck); - `magpie update` in a container (internal/cli); - a Remote magpie row's tip for a container: UpdateRemotes now keeps the version it asked for on an "unsupported" answer too, so the tip names that version's image; - i18n zh, zh-TW, ja, de for both strings; - docs/docker (en, zh, ja): Updates says Settings › About names the version's own image and that latest may be ahead of the channel; llms-full and search indexes rebuilt (site/docs-index.mjs). Run at this tree (mica, through mica-run): - red on origin/main |
||
|
|
4e24994a6e |
gateway: a key let use Magpie Memory reaches it from another computer
Niapyaya on X reaches their own MCP servers through the MCP hub from a remote machine, but not magpie-memory: memory answered the agents on this computer alone, on /mcp/magpie/memory ( |
||
|
|
2ab2f69132 |
agent: Codex's status line shows the account's quota or the relay's balance (opt-in)
lyj1115 on X asked for the current account's quota, or the relay key's
balance, under Codex's chat box, off by default. Codex's TUI draws its
footer from a status line provider from 0.171.0-alpha.12 on: a stdio
MCP server whose tool advertises a statusline entrypoint, picked in
[tui] status_line_provider behind [features] tui_extensions_statusline.
Codex reads it about once a second with the thread's id. Nothing is put
into the prompt or the model's reply.
- `magpie statusline --codex` is that server. Each read asks the local
gateway for the thread's latest route and the kept quotas (no vendor
read). It answers `→ provider/model` and that provider's account that
answered last, with its windows or a key's balance. A gateway that is
down gives a null tree, never an error, because an error stops Codex's
reads. The tool's name and words name neither magpie nor a vendor,
since the tool is listed to the model.
- A status line square on Codex's row (`magpie codex statusline on`)
writes the flag, [mcp_servers.quota_line] (this magpie by full path,
args statusline --codex, env_vars = ["MAGPIE_ADDR"]) and the
provider. Every write is read back, and the file is restored on a
mismatch. Off and Disconnect take out only magpie's keys, and the flag
only when the stash says magpie wrote it.
- Nothing of the user's is written over. A provider of their own, a
quota_line of theirs, the flag turned off or an unreadable file keeps
the square away and refuses on.
- The switch is offered only when a Codex CLI here is 0.171.0-alpha.12
or newer (0.170.0 reads the keys and draws nothing), and only on this
computer, not in a WSL distro.
- In the GUI, the status line square's title takes the note of its
field's on option, which Claude Code's field already sent with the
same words TOGGLES kept, so Codex's says its own words in en, zh,
zh-TW, ja and de. TOGGLES' copy of Claude's note went, and app.js
stays under its budget (30 bytes of room) without a raise.
The Codex desktop app has no such footer. cockpit-tools reaches it
through a debug port, and magpie doesn't.
Run (WSL magpie-desktop, since mote's load was over 18):
- go vet -tags nogui ./...; GOOS=windows go vet of agent, cli, provider
and gui; gofmt -l clean.
- go test -tags nogui of ./internal/cli and ./internal/provider: ok.
- ./internal/agent -run "CodexStatus|Statusline|StatusLine|TestCodex|
TestWSLCodex": ok.
- ./internal/gui -run "CoreScript|Budget|I18n|Keys" and node --test of
codex-statusline, claude-statusline and i18n-keys (both engines, every
language, window and panel), with vet (and GOOS=linux and windows
vet) of agent, cli, provider and gui, on mote at the rebased head
(on
|
||
|
|
ff64cb35d3 |
cli: TestSignalSavesTheSessionIndex sets its stubs before the handler runs
The test swapped sessionsSaved and saveOnSignal between two SIGTERMs while endProbesOnSignal's goroutine was alive. A signal a test sends to itself gives the race detector no ordering, so -race reported two DATA RACEs at finishSignalGateway and failed the test, on main |
||
|
|
bfbc22e190 |
claude: an idle session is saved whenever the gateway ends or hands over (#7017)
recih: after magpie web restarted (an update's re-exec, or Quit and
start again) the next Claude turn replayed the whole conversation
instead of resuming its session. Web.Wait closed the page server and
never drained the gateway, so abortAll never ran and claude-shelf.json
was never written.
- Web.Wait drains the gateway (Close: page server, then stopServing)
before the plugin hosts end and before update.Reexec.
- Desktop quit: OnShutdown calls stopServing.
- Signals: web, serve, the TUI and the app register their gateway with
the signal handler (stopGatewayOnSignal). SIGINT, SIGTERM and SIGHUP
drain it, sessions saved, before magpie dies of the signal. The return
path waits for a drain the signal already started. The TUI and the
app take SIGINT/SIGTERM themselves, but SIGHUP (the terminal closing)
stays with magpie. runTUI, runGUI and runPanel now register
tui.StopGateway and gui.StopServing for it (added in review).
- Handover: the successor answered a Claude turn before the predecessor
had saved its shelf. The predecessor now serves
GET /_magpie/claude-ready on its callback socket, answered once
abortAll has run. A Claude turn on the successor waits for it.
- The predecessor saves only after every request it holds has ended,
of any provider, which can take up to handedOffDrain (15m).
- Added in review: the wait is bounded by predecessorWait (90s, inside
Claude Code's ten minutes for a reply). Past that, the turn goes on
as before, as a replay, and no later turn waits
(errPredecessorSlow).
- loadShelf still reads a shelf written later, at the next turn with
no session found.
- A predecessor without the endpoint (404) keeps the old race.
- Sweep: sweepSessions removed session files older than idleLongest.
That included a session kept for hours past a quota 429
(keepForReset) and one moving from the shelf to a run.
- Those are now protected: the shelf file, the in-memory shelf, the
resuming set and active runs.
- An unreadable shelf skips the sweep.
- loadShelf and the sweep's snapshot are serialised by shelfFileMu.
The bridge lock is held only for the shelf maps, never across the
file's reads (added in review: the branch read the file under b.mu,
which every Claude turn takes).
From recih's branch fix/web-restart-session-persistence (7a0261cc1,
fab0ea651), with the review's follow-ups. Not taken from the branch:
the .github/workflows/test.yml change (contributors.md: .github/ stops
for the maintainer), and the test-flake commits in other packages,
which are separate goals.
Red on origin/main
|
||
|
|
78b6d47ccc |
update: a version newer than its channel's says nothing comes until the channel passes it (realfxw on X)
realfxw on X (tweet 2123033167170814171): "升级无效,重启了无数次,一直卡在这个版本", on 0.1.4445. Every release around it has its 17 assets, so nothing was missing to download. Their Update channel is Daily, and Daily's pick (the 11-17 20:00 UTC cut) is 0.1.4395, older than what they run. The app keeps the newer version and installs nothing until Daily passes it, which is right, but the version row said "Up to date on Daily" (每日版已是最新) and, before a check, Automatic updates are off with a bare Restart. They restarted again and again waiting for an update that couldn't come. - update.go: the update JSON says ahead when the state is latest and this version is newer than the channel's. - app.js: the row says "Newer than Daily's 0.1.4395; it updates once Daily passes it", the newest on Every version after it, and Switch to Every version as before; one t() for both channels and the Every version tail shared with Up to date. Translated in zh, zh-TW, ja, de. - update_cli.go: `magpie update check` says the same, with `magpie update channel every` to get it now. - core_budget_test.go: +68 bytes of code on app.js and the core scripts, packed to the shortest form; renderUpdate draws on every window, so there is no page to move it to. - docs/reference.md: the channel section names Daily and the line. Red on the old code (upd-ahead-red, origin/main |
||
|
|
e08dc0fe58 |
provider: OpenAI's own API sends Responses turns over the WebSocket by default, only the new input each turn (KawaiiZapic on X)
KawaiiZapic's screenshot showed 6.4 GB up for 799 MB down: every turn went out whole. What each leg sends, checked in the code: - Codex on a ChatGPT subscription: the kept upstream socket already sends previous_response_id and only the new input (codex_socket*.go). - A Responses provider with socket=auto/on: the same, but socket was off unless someone ticked it, so an OpenAI API key provider sent the whole conversation each turn over HTTP. - A client's own previous_response_id is kept for api.openai.com, Azure and Ark (prevKeeps); other relays get the expanded whole turn, since they can't be trusted to hold the chain. - Claude Messages, Chat Completions and Gemini have no incremental protocol; those always send whole (prompt caching is what saves there). - The ↑ counter (upbytes.go) counts each upstream write once; no double count found. Change: a Responses provider at https://api.openai.com with no socket set now goes over the WebSocket (provider.SocketByDefault, mirroring codex-rs's create_openai_provider supports_websockets: true). socket=off is now stored, so unticking it there sticks; elsewhere unticked is still "". The CLI shows "auto (default)" and takes socket=off|default. The editor's WebSocket row moved into socketrow.js (imported as the editor draws), so app.js and the core shrink by 165 bytes and their budgets drop with them. Caveat: an OpenAI provider saved unticked before this (socket "") now goes over the socket until it is unticked again; the docs say so. Measured (fake api.openai.com over TLS, sandbox HOME, 20 turns of a 4KB user message each): socket off 20 HTTP posts, 876,345 bytes up; default 0 posts, 20 socket turns on one handshake, 84,928 bytes up (Traffic().Up equal to the socket bytes, so no double count). Run (mica). At this head, rebased on origin/main |
||
|
|
9314999a4a |
ccswitchlink: a ccswitch:// link that still reaches magpie goes to CC Switch, and so does the scheme (asombrado_a on X)
@asombrado_a (X, 2122995130097713493) has CC Switch and magpie both installed, and a ccswitch://v1/import link opened magpie. magpie claims magpie:// only since |
||
|
|
74bba1fa67 |
gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie, 都要自己退出再启动麻烦". The Version row now has Restart after Check while no update is on offer (found, downloading, downloaded, blocked, a newer version named or a failed download each have their own buttons, which restart through the update and fill a 420px row), and the tray's Restart magpie is always shown: with an update ready it installs it as before, with none it starts this magpie again as it is. Both go through restartSelfNow (restart.go), the updater's own way of starting again: on macOS and Linux the gateway's socket is handed over (beginHandover), so requests in flight carry on; otherwise the bundle or binary is started again (update.Relaunch, relaunchBinary), and on Windows requests in flight are cut. magpie web runs itself again in place. POST /api/restart answers 204 and then quits, or 400 "magpie couldn't start again: quit it and open it again", and the row says Couldn't restart magpie with the reason and gives its buttons back. /api/update now says its run (the time this process started), so a browser's page reloads once another run answers. The click, its error and the reload are in versionrow.js, imported when Restart is pressed. The mirror's Download from GitHub click moved there too, so app.js stays under its budget with no raise (TestCoreScriptBudget at 1,088,248 and 1,272,581, as they were). The route is named in the CLI's notYet list. Words in en, zh, zh-TW, ja and de. What needed a restart before, besides an edited path plugin (the commit before): most settings already applied live (proxies, OTel, HTTPS/mTLS, LAN from the GUI, allow-lists, CORS, shortcuts, tray, language, name, fonts, port, hand-edited caller-keys, oidc-rules and library.json). Still start-only: LAN switched by hand in settings.json, environment variables, and in-memory routing state such as a rate-limited account's order; Restart is for those. Run: - Full Go suite (mote, -timeout 45m) at the head before the rebase and before versionrow.js: 101 packages ok; the reds were TestEveryRouteHasACommandOrIsNamed, TestEveryRouteIsNamedForTheCLI (the route unnamed) and TestCoreScriptBudget, all fixed here. - At this head (mote): go test ./internal/gui -run 'TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI|TestRestart| TestUpdateSaysItsRun|TestTrayMenu' ok; ./internal/cli -run TestEveryRouteHasACommandOrIsNamed ok. go build, go vet, GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l clean. - GUI (mote, both engines, at this tree): update-*.test.cjs, version-restart, settings-update-source, refresh-page, old-webkit, i18n-keys and i18n-en-no-cjk: 628 pass, then 6 red in update-check (Restart not dimmed while a check runs), fixed here (Restart dims with Check); update-check, version-restart and old-webkit again: 90 pass, 0 fail. - Real restart (mote, sandbox HOME): a built magpie web with MAGPIE_WEB_KEY, signed in through ?k=; POST /api/restart answered 204, the same pid ran again with a new run, and the cookie still signed in. - Broken by hand: restartAppFrom returning true on an error, and TestRestartStartsMagpieAgain is red; version-restart.test.cjs on the old app.js is red (21 on chromium); with Restart shown beside an update on offer again, "no Restart beside an update on offer" is red in all 5 languages and both engines (12 fails). - The whole GUI suite is still running on mica at push time; its reds are compared against origin/main and fixed or filed after. Not tried: the tray item and a restart in the real macOS, Windows and Linux apps (only magpie web was restarted for real). |
||
|
|
6c6d3bc842 |
gateway: Codex's web.run goes to a relay set to search by itself (YIXIE233 on X)
YIXIE233's GPT relay serves /v1/alpha/search itself, but Codex's web.run (<base>/alpha/search) only went upstream for ChatGPT accounts; for every API-key provider magpie ran its own searcher. The per-provider "Searches the web by itself" switch (search=yes, Advanced > Web search, default off) already sent Responses' web_search tool and Claude's WebSearch through as sent; now it covers web.run too. - relaySearchers resolves the model's provider, or a routing group's members in order (the leading candidate decides, as for the request). A provider qualifies when it has search on, is an API-key provider (not a ChatGPT account, not a plugin) and has a Responses base. - The search goes to that base's /alpha/search with the provider's key, Codex's headers, originator and the agent's User-Agent. - If the relay fails, magpie searches in its place and the output says "X's web search failed (why); magpie searched in its place." - Settings' "magpie searches for every model" still overrides it. - GUI help text, every language, names web_search and web.run; the CLI help, docs/reference.md and docs/subsystems/gateway-routing.md say so. Tests: TestCodexWebRunGoesToRelayThatSearches and TestCodexWebRunInGroupFollowsLeadingMember are red on the old code (magpie's searcher answered). TestResponsesWebSearchToolToRelayThatSearches guards the web_search pass-through. provider-search.test.cjs covers en, zh, zh-TW, ja, de in both engines and at 400px (no sideways scroll). Run (mica): gofmt clean; go vet, GOOS=linux and GOOS=windows vet ok. Full go test ./... -timeout 45m before the rebase: 102 packages ok, only internal/gui TestCoreScriptBudget red (app.js 22 bytes over); fixed by shortening the English help key (net -2 bytes), budget not raised. At 64c5e1e0a (on origin/main d4af0ca4f; then rebased over |
||
|
|
ae94571d70 |
library: a project's own instructions, in the file each agent reads
@VictorHong1022 on X asked to manage AGENTS.md per project beside a project's skills, so the shared instructions keep only general rules. A project in the Library now has instructions of its own (the Instructions tab, expand a project; `magpie library project instructions <dir>`). magpie writes them into the project file each picked agent reads there, by that agent's own name for it: Claude Code CLAUDE.md (or .claude/CLAUDE.md when that is the one there), Codex and pi their override first, Gemini GEMINI.md (or its context.fileName), Qwen QWEN.md, CodeBuddy CODEBUDDY.md, the rest AGENTS.md. magpie owns only a marked part (<!-- magpie:begin … --> to <!-- magpie:end -->): the user's own text around it is kept byte for byte, CRLF included, a hand edit of magpie's part stays until the project's text changes, a file magpie made is listed in the repo's .git/info/exclude and removed when emptied, and an agent's user-wide instructions file is refused. Worktrees of the project follow it. A first text goes to the agents the shared instructions are on for, else every agent here that reads a project file. Problems show as the project's "instructions" problem. Tested: - internal/library: 8 new tests (block kept around user text, CRLF, hand edit kept, made file excluded and removed, renamed files, global file refused, worktrees). Four broken by hand, each red. - internal/cli: TestLibraryProjectInstructionsCmd; red with the default agents dropped. - GUI: project-instructions.test.cjs, en and zh, chromium and webkit, 6 of 6. Red when Goose (no project file) was offered, and red when the defaults ignored the agents the instructions are on for. - Real use on mote: the built binary, sandbox HOME and project. add, text, agents; CLAUDE.md kept CRLF with the part appended; AGENTS.md and GEMINI.md made and excluded; the user-wide CLAUDE.md untouched; zed refused; an edited part survived `library sync`; `agents none` put CLAUDE.md back byte for byte, removed the made files and emptied the exclude block. - Full Go suite (go test ./... -timeout 45m) on mote: 103 packages ok, gofmt clean, go vet darwin, linux (nogui) and windows rc=0, at this change on origin/main |
||
|
|
5bfa57e3d3 |
usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something like the "pelican test" to spot one that waters a model down. In a follow-up (2122694296054972815) they said speed, failures and the model's name show whether a relay is fast and stable, not whether the model got weaker. They asked for small tests with known answers, the share of right answers and of right tool calls, and relays compared side by side. On Usage › Requests › Model speed › Providers, each row has a Check… that opens a dialog. Opening it sends nothing; only its Check makes the calls. POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat Completions calls through the gateway, pinned to provider/model as an agent would, three at a time: - write 1 to 40; - 1234 × 5678, 987 × 654 and 2468 × 1357; - weather in Paris and time in Tokyo, each call offering both tools, so the right one has to be picked. Each part says what it found, never a verdict on the provider: - whether the answer was the expected one, and what came back; - the model the reply named, when the ledger would call it another model (usage.Swapped, not SameSpelled or ListedAs); - the provider that answered, when the call was handed on; - how many input tokens the 118-character prompt was counted as; - first token, tok/s and the whole time. The dialog heads the parts with "Answers right: n of m" and "Right tool calls: n of m". The numbers come from the gateway's own usage records (a tap in appendUsage keyed on the request's context), not from each protocol's reply. The tally of each provider's last check is kept in the window's storage. The Providers table then shows Answers and Tool calls columns: sortable, amber when short of all, a dash for providers not checked, so relays are compared side by side. The dialog code is a lazily loaded root script (relaycheck.js), as app.js has no room left. Run, at this head: - mote: go test -timeout 45m ./internal/gateway ./internal/gui ./internal/cli ./internal/usage: ok (the full ./... suite passed at 41d88731c, before the fixed-answer calls; mote and mica were each running another session's GUI suite at this head); - gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: clean; - go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway (5 tests pass); - usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and de at 400px: 12/12; - i18n-keys and old-webkit: their only reds are the three on origin/main, each filed (#6877 ", with an image", #5919 :has(), #6030 headerpresets.js); - TestCoreScriptBudget and the app.js budget: ok, not raised. Broken by hand: - taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked and TestCheckRelaySaysWhatDiffers red; - dropping the tool-name check turns TestCheckRelayCountsEachAnswer red (get_weather for Tokyo read as right); - pressing Check as the dialog opens turns the GUI test red ("opening the dialog sends no call"). Not tried: - the whole GUI suite at this head (both machines busy with another session's suite); - a real relay (fakes only); - a context-window probe; - a comparison with the vendor's own count_tokens; - a periodic check (the check runs only on a press). |
||
|
|
50c5a52dbd |
backup: a backup file carries the usage history, and a restore merges it (JasonLeeForOnly on Discord)
JasonLeeForOnly moved magpie to a new server with magpie backup / magpie
restore and lost every call's usage history: a backup file held the setup
only.
- backup.WithUsage puts usage.jsonl's whole lines (gzipped, usage.LogBackup)
and the quota history (gzipped) in Bundle.Usage. magpie backup and
Settings -> Sync -> Export add it unless --no-usage / the tick says no.
Collect never does, so sync, join and automatic backups are unchanged.
- Restore (Parts.Usage, on in All; magpie restore --no-usage and the Import
tick turn it off) merges: usage.MergeLog appends the lines the log here
doesn't have, compared byte for byte as a multiset, so restoring the same
file twice adds nothing and two equal calls both arrive. It reads most
of the log before the gateway's log lock, the rest under it, and appends
with O_APPEND in 4MB chunks, after a newline when the log ends in an
unfinished line. Quota points merge with provider.MergeQuotaHistory.
A file without usage (older magpie, or --no-usage) restores as before.
- Result.Usage is the calls added; the CLI and the Import form say it.
- Docs: sync-backup.md, reference.md, site sync pages (en, zh, ja) and the
search index/llms-full.txt rebuilt with node docs-index.mjs.
Not changed: where usage is also shared by sync, the old computer's calls
are in usage-others and, after a restore, in this log too: filed #6987.
Run on mote at this head (26f69e85e rebased on origin/main
|
||
|
|
64ad53f6c7 |
sessions: magpie sessions search and show, for agents (yansheng1003 on X)
yansheng1003 asked for a command or skill an agent can call to search
and read its sessions. magpie had the search on the Sessions page and
in the Magpie Sessions MCP server, but not on the command line.
- `magpie sessions search <words…> [--agent] [--days N|today|all]
[--limit N] [--wait] [--json]`: the Sessions page's search
(sessions.SearchSaid over said-v1.db; SearchSaidSince adds the --days
bound), newest first, each hit named agent:id with title, folder,
time and the words round the match. A one-shot command waits for the
index (SaidReady, 60s by default, a progress line on a TTY only).
- `magpie sessions show <agent:id|id> [--find] [--from N] [--max-chars N]
[--json]`: the viewer's reader (TranscriptOf, TranscriptAt) as text,
from where the words were said; --json is the page's transcript.
- One renderer: the MCP server's search_sessions/read_session text moved
to sessions.SaidText/SessionText (said_text.go), with how to ask for
more given by each caller (TextHow). The MCP server's output is
unchanged (its tests pass as before).
- Consent: neither reads, nor makes the index, until the user has
answered which agents magpie may read; it prints notAskedLine and
exits 1. An agent not allowed is ErrNotRead for --agent and show.
- Flags: an unknown flag or a missing value is refused with the usage,
never taken for words or a session id; `--` ends flags; -h/--help
prints the subcommand's own usage (help_cli.go).
- Parity: /api/sessions/said and /api/sessions/transcript now map to
these commands (settings_parity_test.go).
- Library: magpie-sessions is a featured official skill
(magpie-community/plugins skills/magpie-sessions, pushed as plugins
cf5b0312), listed after magpie-quota.
- Docs: usage.html "Search what was said" in en, zh and ja; llms-full,
search indexes and docs-index.sums regenerated (node docs-index.mjs).
Run at 114eb4592 (rebased on
|
||
|
|
3f6a101fe1 |
providers: Images per request in the editor's Advanced, per model, learned from 100milionseek's and Coarena's words (#6849)
Yuu_jiang_ on X (#6849): 100milionseek and Coarena take at most 8 images a request, counted over the whole conversation, tool results included, and every turn after the ninth screenshot failed with no way on but /clear. ID-VerNe's max-images (the commit before) set one number from the CLI. This builds on it: - The cap is per provider, and optionally per model: max-images=8, or max-images=8,gemini-3-flash=10. The exact model is looked up first, then its upstream name, then "*" for all. The provider's cap moves with a model's local id like the other per-model limits. - 100milionseek's "At most 8 images per request (MAX_IMAGES)." and Coarena's "A request may carry at most 8 images." are learned as Copilot's words are, by provider and model, so the first refusal is the last. A user's own number is fitted before any refusal; a learned one that is smaller still lowers it. - Images are counted everywhere, a tool_result's too; the oldest are left out first and the latest user turn keeps its own. Only the request sent changes; session files are not touched. A request with no cap, or within it, goes out byte for byte as it came. - The provider editor's Advanced (folded unless set) has Images per request under Max output, in maximages.js, imported as that field is drawn, in every language. A GUI save keeps the value when the field isn't drawn. An editor opened and closed is not dirty (the draft takes the value only when typed), and the import, like keyrates.js's, draws nothing once the editor has closed: before that, a quick close threw "Cannot read properties of null (reading 'maxImages')" and ('keyPriceRates'), which add-sheet and key-box-once caught. - Budgets: app.js and the core +354, said in core_budget_test.go. What was run: - go test -count=1 -timeout 45m ./... on mote at |
||
|
|
e049b5cd35 |
providers: a user-set cap on the images of one request (max-images)
100milionseek's and Coarena's APIs take at most 8 images a request, counted over the whole conversation, and answer the ninth with a 400 of their own words (#6849): "At most 8 images per request (MAX_IMAGES)." and "A request may carry at most 8 images.". imageCapWords matches Copilot's wording alone, so the cap is never learned there and every turn of a session that has shown nine screens fails, with no way on but /clear. `magpie provider set <id> max-images=<n>` sets the user's own cap. The gateway fits a request over it before it is sent, the oldest images left out for the line imageOverCap stands, exactly as the learned Copilot cap does; no refusal is needed to know it. The user's number stands over a cap Copilot's refusal taught the same provider. 0, the default, keeps the learned path as it was. The provider editor has no field for it: a GUI save keeps what the CLI set, as it keeps usefirst and standin. What was run: - gofmt -l internal/ (clean); go vet ./internal/gateway ./internal/cli ./internal/provider ./internal/gui (clean); GOOS=linux go vet ./... (only wails beta.24's own cross-compile errors, the same 12 as at the base commit |
||
|
|
ff88ec264a |
sync: subscriptions whose sign-ins stay on this computer (Ethereal499 on X)
Sync's sign-ins can now leave chosen subscriptions out on one computer
(`signInsExcept`, provider ids; Ethereal499 on X keeps Claude's accounts
off other computers). On that computer:
- its accounts of those subscriptions never go up;
- the server's accounts of them are never merged in, so a removal or a
new account on another computer changes nothing here;
- the server keeps them as they are for the computers that do sync them
(syncOnce splits the remote set with SignIns.Except and puts the held
part back with With after the merge, so the hash doesn't change);
- the preview and Restore count and restore none of them.
An id names both the built-in and its -plugin id. An old config has no
field and syncs everything as before. The setup text doesn't carry the
choice, since it belongs to one computer.
GUI: Settings > Sync > edit > Advanced, under "Sign-ins", a "Not synced"
row with a multi-select openProtoMenu of the subscriptions with an
account. The row shows only while the sign-ins tick is on. The strings
already existed in en, zh, zh-TW, ja and de. CLI: `sign-ins-except=`
on the WebDAV, S3 and GitHub setups ("none" clears it), and status
shows the excluded ids. docs/subsystems/sync-backup.md says it.
Tests:
- TestSignInsExcept (provider) and TestSyncSignInsExcept (davsync, two
computers on a fake DAV).
- sync-signins-except.test.cjs: both engines, 1100 and 420px, all 5
languages.
Broken by hand, each red and then restored:
- the Except in collect;
- the Except on the remote set before the merge;
- the Except in the preview;
- the With after the merge;
- the GUI form's post of signInsExcept.
Run:
- At
|
||
|
|
ce16633367 |
tune: a Codex card locked by config.toml's own compact limit hands it to magpie on a click (sufeng1894 on X)
sufeng1894 asked why Codex's compaction threshold can no longer be set by hand. The card said config.toml's model_auto_compact_token_limit wins, and the background row said features.async_compaction's model_async_compact_threshold_percent wins: both locked, and nothing on the card did anything about it. Cause. Only the old tune card ( |
||
|
|
dbbb2f26b1 |
groups: free: takes the models a catalog marks free (#5903)
A routing group's pattern may now start with free: (provider.FreePrefix): free:workbuddy/* is, of the models workbuddy/* matches, those whose catalog entry says free (Entry.Free, the vendor's or plugin's own flag as the catalog was last read). The rest after free: is a glob, a re: pattern or an id, matched as on its own, so free:re:workbuddy/hy.* works too. It is expanded where every pattern is (matchesIn, PatternHits) each time the groups are read, from the catalog magpie already keeps: no request to a vendor, and a model the next list marks free joins without a save. Only the flag decides. A $0 price (PricedFree), a rate of 0, an account named Free or "free" in an id never counts; the test holds a deepseek-v4-free id with no flag, a rate-0 model and an or/y priced at $0 out. Existing patterns read as before: openrouter/*:free still means ids ending in :free (that is why the rule is a prefix, not a :free suffix), and a provider's AutoInclude takes no free: (isIDPattern). GUI: the Routing editor's pattern box counts and lists a free: rule live as it does any pattern (patternTest in plugins/routing/client.js, from groups.models' free), refuses "free:" alone, and one hint line says the flag is the last catalog's, not a promise of no charge, in en, zh, zh-TW, ja and de. CLI help, docs/subsystems/providers-accounts.md and the site's routing-groups page (en, zh, ja) say the same. routing-levels.test.cjs: the Advanced hint line made the editor taller, so the second group's Levels row opened under the editor's sticky foot and the click landed on the foot (webkit en). The test already wheels to that row for its first group; it now does for the second too. Run: - TestGroupFreeRule, TestFreeRuleSyntax and the existing pattern tests pass. Broken by hand: with groupmatch.go and autolist.go from origin/main both are red (no members for free:workbuddy/*, IsPattern); with takes() ignoring the flag, TestGroupFreeRule is red (all six WorkBuddy models matched). - group-free-rule.test.cjs (new): chromium and webkit, en and zh, green; red with origin/main's client.js. - go vet ./... (darwin, mica), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. gofmt -l: nothing. - Full suite go test -tags nogui -timeout 45m ./... on Linux (WSL magpie-desktop) at 1e180c630 (this change on |
||
|
|
8707ea7757 |
gateway: Codex's prompt suggestions go on a model set for them (@0xcb198609 on X)
The Codex app's home-page prompt suggestions (thread_source ambient_suggestions, and their safety check, ambient_suggestion_safety; the Routing page's 提示词建议) are a background agentic turn that reads the project and connected apps. The app asks for the model its server config names (codex-app-model-routing's codex_ambient_suggestions_model_slug, gpt-6-luna) with provider model fallback on, so with magpie as Codex's provider they ran on the provider's default model, often auto: @0xcb198609 saw 76.9k tokens in 113s on deepseek-v4-pro. Codex has no config.toml key for that model, only an on/off switch in the app (store key ambient-suggestions-enabled, Settings › Configuration › Homepage suggestions; read from the 26.1106 bundle). magpie now has a setting for it, "Codex prompt suggestions" in Codex's row on the Agents page (Settings, beside Codex composer predictions): - Empty, the default, is Codex's own pick: nothing moves. A value the user set is never overridden. - A model or group of magpie's puts both calls there: in serve as the codex-suggestions move (the Routing page says why), and on the ChatGPT backend's route before the split, carrying the asked model to serve so the trace and ledger keep it. codexOwnOffMagpie leaves a bare gpt-6-luna to magpie while the setting is on (codexSideSet). - A target that is disabled, unserved or not allowed to the gateway key leaves the call as asked, with a log line (compactRefused). - To fit app.js's script budget without raising it, the suggestions and auto-review pickers share codexPick with codexSidePick, and every Codex row's button comes from condButton. The new route is named for the CLI (settings_parity_test.go). agent-prefs and settings-general list the new row. - The row's tooltip and the Routing page's Suggestions story say where Codex turns them off. magpie's old story said "Suggested prompts", which the current app no longer shows; corrected in all five languages from the app's own locale files. Run (mote, at this head rebased on |
||
|
|
19794cc10c |
serve: a headless magpie follows a Remote magpie's agent picks (KoiLx0 on X)
v0.1.4298 made a client magpie follow the models a Remote magpie's agents are on (agent.FollowRemotePicks), but only the app's Library loop (library.KeepLinked) ran it. `magpie serve` and `magpie serve --web` followed the remote's model list and efforts (the long-poll in the gateway) and never a pick changed on the remote. Both now run agent.KeepFollowingRemote, which calls FollowRemotePicks every 30s; it still asks the remote at most every 5 minutes, and only while a Remote magpie is added. Run at this head, on mica: - go test -timeout 45m ./internal/agent/ ./internal/cli/: ok - go vet; GOOS=linux go vet -tags nogui; GOOS=windows go vet: ok - Real use: two sandbox magpies (R with a fake OpenAI upstream and a gateway key, C with R as remote-magpie "office"), both `magpie serve`. Claude Code connected on R to openai/gpt-5.5: C recorded claude.model.remote at start. R's Claude Code moved to openai/gpt-5.4-mini at 15:41; C's ~/.claude/settings.json followed at 15:45:49 (the 5-minute step). Efforts set on R (low,high) and a new upstream model reached C's /v1/models, Codex's magpie-models.json and Claude Code's model list within seconds to about a minute, before and after this change. Not broken by hand: the loop is a ticker around FollowRemotePicks, whose following is covered by remote_picks_test.go. Not tried: Windows and Linux real boxes. |
||
|
|
9dcec67513 |
archive: the request archive in an S3 bucket is kept under a GiB, oldest calls removed
An R2 user on X: the sync bucket grew by 18 GB in under a month. The
backup and usage files are small and rewritten in place; what grew was
the request archive, every call written whole (bodies up to 32 MiB) as
archive/<date>/<id>.json and never removed. The archive on this computer
is capped at a GiB; the one in the bucket had no cap.
Now the bucket's archive is held to RequestArchiveMB (a GiB unless set,
carried by sync), down to a tenth under it past the cap, oldest first:
- only keys of ArchiveName's own shape under <prefix>/magpie/archive/
are counted or removed; the backup, usage, other prefixes and anything
else in the bucket are never touched (a test seeds seven such keys);
- uploads are counted as they go, and the bucket is listed again only
after a tenth of the cap more is uploaded: one LIST for ~1000 calls,
never one per call;
- the serving magpie lists once two minutes after it starts, archive on
or off, so a bucket grown before this update is brought under the cap
without the user doing anything (auto-cleanup chosen over a button:
the objects are magpie's own, already capped locally, and a removal
is logged);
- the Usage page's switch tooltip says the size ("…in <bucket>, up to
1.1 GB"), in every language; the core script budget is kept, not
raised: the two tooltips share one options object and the switch's
aria-checked is set from a boolean.
The Nov 3 rise in Class B reads has no code cause found: archive reads
are click-driven only, and the backup's conditional GET runs every 3
minutes per computer online.
Red on the old logic (bucketAdded and KeepBucketArchiveBounded made
no-ops by hand, on mica): TestRequestArchiveKeptUnderItsSize "after 200
calls the archive holds 248 calls, 7629310 bytes, over its 1048576 (48
from 2020 left); 0 LISTs, 0 DELETEs"; TestBucketArchiveBroughtUnderIts
SizeAtStart keeps 30 calls / 3000 bytes; TestBucketArchiveListedPer
TenthUploaded "0 LISTs". With the fix: "200 calls: 44 kept, 986389
bytes; 4461157 bytes uploaded, 39 LISTs, 203 DELETEs".
Run at this tree (rebased on
|
||
|
|
64c4261582 |
sessions: search what was said in every agent's sessions, from the page and an MCP server
cryingLiu on X asked to search the chat history of every agent magpie
reads sessions from: prompts and replies, from one place.
What the user gets:
- The Sessions page's search also lists, under the agent's own list,
the other agents' sessions whose conversation says the words, each
with a snippet. A hit opens the conversation in the sheet at the
message that said it (transcript?find=), with "N earlier messages
not shown"; the page itself never scrolls. While the index is still
being built the head says "Indexing sessions…" or "Indexing N of M
sessions…", and the page asks again every 3s until it is done.
- Magpie Sessions, a built-in MCP server in Library → MCP (Discover),
opt in per agent like the other magpie servers. Its tools are
search_sessions(query, agent?, limit) and read_session(id, around?),
both returning text. It runs as `magpie mcp sessions` over stdio and
reaches the gateway's /mcp/magpie/sessions, which serves only local
callers that are not browsers.
How it works:
- internal/sessions/said_index.go keeps said-v1.db beside sessions.json:
a contentless SQLite FTS5 index (detail=none) of the words each
session says. It is built from the sessions list sessions already
caches and refreshed at most every 10s: a new or rewritten file is
read once, a grown Claude Code or Codex file only from where it ended,
and a gone one is forgotten. A query asks the index which sessions
have every word, then reads only those files for the snippet, for at
most 6s. A search waits up to 2s for a refresh. While the first
listing is still running the answer says `listing`, so an empty first
answer is not read as "no session says it".
- Privacy: only agents sessions.Reads allows are indexed or searched;
nothing is read until the user has answered the sessions question,
and in gateway mode no agent's own files are read (the page doesn't
ask). Reset forgets the index.
- /api/sessions/said for the page; the CLI parity list names it.
Run, at this tree (rebased on origin/main
|
||
|
|
8f3f7a46af |
provider: Baidu Qianfan's Token Plan Personal shows its month through a console sign-in (yuushabu_buyinn on X, #5860)
A Qianfan Token Plan key tells nothing of the plan's usage: Qianfan's
OpenAPI has no read for it, and the console's own page asks
console.bce.baidu.com/api/qianfan/charge/tokenPlanPersonal/resource with
the signed-in cookie. So the plan is read as StepFun's Step Plan is: the
editor of a provider at qianfan.baidubce.com/v2/tokenplan/personal has a
"Token Plan usage" field, drawn by the same renderStepPlan (now told
whose sign-in it brings) from qianfanplan.js, imported when such an
editor opens. The bookmarklet, run on the console, checks the session
with that same request and copies the console cookie; a raw Cookie
header or a copied cURL is taken too, since document.cookie leaves out
HttpOnly cookies. The paste is checked with a real read before it is
kept, by provider id, in qianfan-auth.json (0600, lastgood-guarded,
moved and dropped with the provider). POST /api/qianfan/{id}/session and
/signout serve it.
The Usage page's card (qianfanPlanQuotas in PlanQuotas) is the running
plan's credits (billingMode credit) or tokens as one Month window up to
expiresAt, the plan's tier as its name and auto-renew beside it;
released and past plans are skipped, and routing reads the same windows
(accountPlanWindows). A redirect, 401, 403, an HTML page or a refusal
naming the login is a signed-out session: an error card saying so, never
0 left; any other failure is an error card too, the last reading kept
only on a passing network error. The per-plan apiKey in the console's
reply is never kept, logged or shown.
Not done: the Enterprise (team) plan has no card. The console has no
tokenPlanTeam/resource; it reads team plans through seat and admin APIs.
Not tried with a real account: no one here is signed in to Baidu Cloud's
console, and #5860 has no reply bytes posted. The fixtures follow the
field names in the console's own script bundle and in the
dsh-qianfan-token-plan reader (planType, resourceStatus, billingMode,
usedCredits/totalCredits, usedTokens/totalTokens as numbers or strings,
expiresAt, autoRenew), not a captured reply.
core budget +35 (app.js and core): the field moved to qianfanplan.js;
what is left in the core is the import and two quotaError lines.
Run (at the pushed tree, rebased on origin/main
|
||
|
|
ec5b96c44f |
cli test: POST /api/quit/disconnect is the window's own (#6786)
|
||
|
|
2649d5d727 |
agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).
Run:
- mica, at this tree (rebased on
|
||
|
|
02f1cee794 |
plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.
A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.
The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.
Run, at this head (rebased on
|
||
|
|
60ebaea033 |
claude: the newest Claude Code on the machine runs, and an old one's sign-in says it is too old (zi_xiang5806 on X)
zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.
- proc.FindTools lists every `claude` (each PATH folder, then where
installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
bridge, bili, keep and `magpie claude-code` all get it) runs the
newest. The first on PATH is passed over only for one whose version
is known and newer; an unreadable version is unknown, not old.
Versions are read first where each is installed, running nothing
(npm package.json via proc.PackageVersion, the native installer's
versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
known that way is another asked --version (VersionOf, kept per file
until it changes, an unknown for a minute). With one claude, or none
known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
says Claude Code is too old, with its version and path, and to run
`claude update` (or npm install -g @anthropic-ai/claude-code@latest).
Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.
Run at base
|
||
|
|
b466aa2803 |
update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.
What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
cron) the newest tag whose commit has a successful Test run and whose
release has all 17 assets is picked and kept in LEDGER "daily". A day
with none keeps the day before's; a failed GitHub read writes nothing.
/api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
kept); the feed is asked channel=daily, never falls back to GitHub's
latest, What's new lists every change since yours. Settings > About >
Update channel has Every version / Daily / Stable; the version row says
"Up to date on Daily (· {v} is out on Every version)". CLI: magpie
update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
Daily words, packed to one t() per choice; Settings and renderUpdate
draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
llms-full.txt, search indexes.
Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.
Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
GOOS=linux -tags nogui.
Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after
|
||
|
|
ec1a1a7a55 |
library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.
- Parsing: frontmatter description plus body; for TOML, description and
prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
$n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
agents is one command; a name with different bodies per agent shows
"Differs by agent" and one of them is picked; a name the library has
with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
each original file byte for byte (Command.Taken): sync writes the same
bytes at the same path, so the file is never doubled or rewritten.
After an edit the agent gets magpie's render at that path; a rename
drops Taken. Taken never leaves the machine (Collect strips it, Put
keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
the library change route. internal/cli's parity test names the probe
as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.
Run at 039e25752 (on origin/main
|
||
|
|
72418591f0 |
cli tests: POST /api/warm-all is named with warm-now, as stage 3 (#6724)
|
||
|
|
142994b21c |
web: magpie web reaps the processes it adopts, as magpie serve does (swang20201 on X)
The Docker docs run `magpie web --addr 0.0.0.0:3430 --no-open`, so in a
container without an init `magpie web` is PID 1 and adopts every orphan.
|
||
|
|
6256d9956a |
gateway keys: a limit can follow a subscription account's own window (ljayic on X)
A key's limit gains the period "account": it names one subscription
account ("<provider>/<user>") and one of its windows (5h, Weekly, Monthly,
...), and starts and resets when that account's window does, at the reset
time in the account's last good reading (quotas.json), never asked of the
vendor on the request's path (provider.AccountWindow).
When the window can't be read (no reading yet, no such window, or its reset
has passed with no reading since), the limit is "reset unknown": it is
neither reset nor lifted. It counts from the latest time the window can't
have begun before (the reset that passed, else when the limit was set), so
it counts at least the window's calls; a refused call gets Retry-After 300
and a 429 saying the window can't be read now, and the accounts are read
again in the background at most once a minute.
GUI: Gateway keys -> a key's limit -> Window -> "An account's window", then
an app-menu picker of the accounts' windows as read (GET
/api/caller-keys/account-windows); the row reads "$x / $y · 5h of
codex/...", and an unknown reset reads "resets with the account's window".
CLI: magpie gateway-key limit <id> account --account codex/me@example.com
--window 5h --tokens 2m. i18n zh, zh-TW, ja, de. reference.md and
gateway-routing.md say it, with the fallback.
Run (at this tree, base
|
||
|
|
07dfd0bb8f |
update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.
A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.
Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
TerminateProcess on itself instead of ExitProcess. Everything magpie
writes is written by then; the kernel closes every handle and no
detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
its thread count every 250ms; one thread for a second is a magpie stuck
in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
what fixes the update from 0.1.4193 and older, which still exit through
ExitProcess.
docs/subsystems/gui-shell.md says how a Windows restart waits and ends.
Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
(os.Exit there hangs with exactly 1 thread left), then that
endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
"the start went on after 20.022s with the old magpie still stuck".
Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
./internal/update all ok but TestPackagedByDpkg, red the same on
origin/main
|