31 Commits
Author SHA1 Message Date
yetone b2b3d488c1 settings: an SSH server as a saved proxy, and a failed proxy says why
@laiuuui on X (tweet 2122704105005314155) was told to put Gemini behind
a proxy in a supported region. Their VPSes give only SSH (address, port,
password or key), and every http:// proxy they added failed with Go's
words alone.

A saved proxy can now be an SSH server. Settings > Network > Add proxy
has Proxy | SSH; SSH asks for the server, the user and the password, and
Advanced (closed) holds a private key and the trusted host key. magpie
logs in itself with golang.org/x/crypto/ssh (no ssh command) and resolves
the @id to a SOCKS5 server of its own on loopback, which takes only its
own random login and carries each CONNECT as a direct-tcpip channel, as
ssh -D does: lazy login, keepalive@openssh.com every 20s, one re-login
when a channel finds the connection dead.
- Save logs in first: a refused login is said there and nothing is kept.
- The host key is trusted on first use, kept in authorized_keys form and
  shown as its SHA256 fingerprint; another key is refused
  (HostKeyChangedError, both fingerprints said) until Trust a new key.
- The key is a secret like the password: left out of backups and
  syncs without keys, kept on a sync that has none.
- ssh:// typed as a plain address is refused: its login goes with a
  saved proxy.

A failed proxy says why (netproxy.Why: an English template the page
translates in all five languages, Go's words after it): an SSH server
typed as http:// or socks5:// ("is an SSH server, not a proxy: add it as
SSH"), a refused login, keyboard-interactive refused (OpenSSH without
PAM, "unexpected message type 51"), nothing listening, not SSH, TLS on a
plain proxy, 407, timeouts, hangups, and a server that logs in but won't
forward (AllowTcpForwarding no, or macOS 27's sshd, which hangs up on
every forward, OpenSSH's own ssh -W too). A check the user asks for
reads the server's first bytes when Go's text can't tell: Go reads a
real OpenSSH banner ("SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.20") as an
HTTP status line with a malformed code, and an SSH server's banner can
reach Go's transport before its request goes out
("readLoopPeekFailLocked", found red 1 of 20 on mica, then 40 of 40
green). Each save is tested at once.

app.js keeps one line (api() hands a proxy_why reply to proxies.js,
where proxyWhy now lives); both script budgets are raised by that line's
52/54 bytes, with the reason in core_budget_test.go.

Run (mica, at this head on origin/main 81c666e1c):
- go test -tags nogui ./internal/netproxy/... ./internal/settings/
  ./internal/davsync/ ./internal/gui/ ./internal/provider/
  ./internal/backup/...: ok
- GOOS=linux and GOOS=windows go vet of netproxy, settings, gui; gofmt -l
  internal: clean
- GUI, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 420px:
  saved-ssh-proxy, saved-proxies, i18n-keys, provider-proxy-missing:
  64/64
- Tests use netproxy/sshtest, an SSH server on loopback that answers
  channels itself; nothing reaches the network.

Broken by hand, each red: accepting any host key
(TestSSHProxyRefusesAChangedHostKey); no login check on the SOCKS end
(TestSSHProxyLocalEndNeedsItsLogin); no SSH banner case and no banner
probe (TestProxyFailureNamesAnSSHServer, its OpenSSH-banner case); no
type-51 case (TestSSHProxySaysWhyItFailed, keyboard-interactive); no
code 2 for a hangup (TestSavedSSHProxyThatWontForward, both cases);
api() not handing proxy_why to proxies.js (saved-ssh-proxy, 20 of 20
cases red: err.why is already a failed move's reason).

Real use: Ubuntu 24.04 OpenSSH_9.6p1 (WSL magpie-desktop, a user sshd
on loopback, key login): the host key was learned, a Cloudflare trace
through the tunnel came back ip=104.194.93.45 loc=US, a wrong password
said "turned the login away", a changed host key said both
fingerprints, and http:// and socks5:// pointed at the sshd both said
"is an SSH server". mote's and mica's sshd (macOS 27, OpenSSH 10.5 and
10.3) log in and refuse every forward, now said as "won't forward
connections".

Not tried: a password login against a real sshd (the user sshd had no
shadow access), a real VPS, and the full go test ./... and full GUI
suite: both mote and mica were running other sessions' GUI suites the
whole time.
2026-11-18 01:01:30 +08:00
yetone 0caa09b3d9 perf: yaml's event queue, TOMLWithout's buffer and the catalog's hash stop holding whole documents
A start with the owner's real accounts (release build, mote) allocated
279 MB in its first seven minutes; three of the largest were buffers
the size of a whole document that nothing needed whole:

- yaml.v3's emitter appends every event to a queue it never empties,
  so encoding dsh's route of a few hundred models held ~24 MB of
  events (dshPutProviders' Node.Encode and dshNodeLines). That round
  runs on the first start of each version and on each catalog change.
  yaml.v3 is vendored in third_party/yaml.v3 (replace in go.mod, as
  jsonschema is) with the queue started again once it is drained;
  MAGPIE.md says what changed. go.yaml.in/yaml/v3 v3.0.5 has the same
  queue.
- edit.TOMLWithout made its output as large as the input: 1.5 MB per
  read of Codex's config, which five readers make, to keep a few KB
  around the projects tables. It now grows to what is kept.
- catalog.fileKey read the ~6 MB catalog whole to hash it; it is now
  hashed as it is read.

Measured with the owner's real accounts (~/r2278/acct, tray only, no
window), release ldflags and the footprint overlay, a version new to
the HOME so dsh's full round runs, on mote:
- allocations in the first 7 minutes 279 MB -> 260 MB;
  yaml_emitter_emit 24.9 MB -> under pprof's cut (1.3 MB),
  dshPutProviders 23.1 -> 8.1 MB, dshNodeLines 12 MB -> under the cut,
  edit.tomlUnder 12.2 -> 4.0 MB
- footprint at +300 s 59 -> 58 MB, live heap 5.5 MB both; peak 84 vs
  89 MB, within the run-to-run spread seen before (84-88 MB)

Run at this tree: upstream yaml.v3's own tests on the patched emitter
(go test ., ok); go test ./internal/agent ./internal/cli ./internal/edit
./internal/library ./internal/pluginrt ./internal/catalog on mica (ok),
and ./internal/sessions on mote before the yaml change (ok); go vet ./...
(mac), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...
ok; gofmt -l on the changed files prints nothing.
Not run: the full suite.
2026-11-14 14:33:16 +08:00
yetone bbce1fc1ab update: the updater checks a download's GitHub build attestation too (ArcticLampyrid on X)
Release CI attests every file (SLSA provenance through Sigstore, v0.1.3891
on). The updater now fetches the bundle for a file's signed SHA-256 from
api.github.com/repos/yetone/magpie-releases/attestations/sha256:<digest>
before it downloads the file, and verifies it with sigstore-go against the
Sigstore trusted root embedded in the binary (attest_root.json, public
good instance): certificate chain, certificate timestamp, Rekor entry,
issuer token.actions.githubusercontent.com, subject release.yml of
yetone/magpie-releases on main or a v* tag, source repository
yetone/magpie-releases, and the digest among the statement's subjects. It is
in addition to the ed25519 check over SHA256SUMS, which still runs first
and still works offline and from the R2 mirror; the attestation is asked
about the digest that signed list gives, so both speak of the same bytes.

When the attestation can't be had (a failed read means "unknown", but an
outage of GitHub must not take updates away):
- a bundle that is there and fails (signature, identity, digest, a chain
  outside the trusted root), GitHub answering 404, or an empty list: the
  file is refused. GitHub was asked and says these bytes weren't built by
  that workflow.
- GitHub unreachable, rate limited (60/hour anonymously), 5xx, a body that
  isn't JSON, or Settings' update source set to the site alone (which never
  goes to GitHub): the update goes on, since the ed25519 check has held, and
  the log says the file went unattested and why. Someone who can only drop
  the API call downgrades an update to the ed25519 check, never below it.
- releases before 0.1.3891 and a MAGPIE_UPDATE_FEED of your own are not
  asked.
The bundle checks itself, so the API call goes through source.Do and may use
a mirror.

Cost: go.mod gains sigstore-go v1.1.4 and its tree (go.sum +350 lines).
The embedded root has to be renewed (gh attestation trusted-root, first
line) when Sigstore rotates its keys; docs/reference.md says so. Until then
a chain under a new key fails as "not attested" and is refused: a known
cost, in the doc.

Run (mote, sandbox HOME via testenv): go test ./internal/update (ok),
site node tests (112 of 114; docker-tags and the sponsors README test fail
because mote-run -C site cannot see ../README.md, unrelated), gofmt -l
empty, go vet darwin, GOOS=linux -tags nogui and GOOS=windows on
internal/update, go build ./... on all three. Fixture: the real answer
api.github.com gave for v0.1.3925's SHA256SUMS (testdata/attest), verified
offline; the whole run reaches no network.
New tests: TestAttestationOfARealBundleHolds, ...OfAnotherDigestRefused,
...TamperedRefused, ...EditedPayloadRefused, ...WrongIdentityRefused (repo,
workflow, ref, source repo, issuer each), ...NoneListedRefused,
...UnknownGoesOnAndSaysSo (403, 429, 502, HTML, nothing listening),
...OnlyWhereItIsOwed, TestVerifyMarksAttestedReleases,
TestDownloadRefusedWithoutAttestation.
Broken by hand: identity check swapped for WithoutIdentitiesUnsafe turns
WrongIdentityRefused red on all five cases; the attestedFile call removed
from download turns DownloadRefusedWithoutAttestation red (the file was
fetched). The first full run of the package, before TestMain pointed the
attestation API at a closed port, had TestSourceSiteAndAutomaticUseTheSite
reach the real GitHub with a made-up digest and be refused: now closed.
Not tried: a real update end to end (needs a release newer than the
running binary; the unit path covers download), Windows box, the
GUI, full suite (starts after the tag).
Docs: docs/reference.md, start.html (en, zh, ja) and llms-full.txt say what
the app checks now.
2026-11-13 00:01:01 +08:00
yetone 772f936272 perf: jsonschema's metaschemas are compiled on first use, not at launch
github.com/santhosh-tekuri/jsonschema/v6's init compiles every draft's
metaschema (4, 6, 7, 2019-09, 2020-12 and their vocabularies): ~1.7 MB
and ~21,000 allocations on every launch, the largest init left in the
binary. magpie compiles a schema only for a Claude TUI answer tool, so
`magpie statusline`, run on each Claude Code message, paid it for
nothing.

v6.0.3's non-test files are now in third_party/jsonschema (go.mod
replace; LICENSE and MAGPIE.md beside them), with one change: init
became loadDrafts behind a sync.Once, which Compiler.Compile calls
first; loadDrafts compiles the metaschemas through the unexported
compile exactly as init did. The Dockerfile copies third_party before
`go mod download`, which needs the replace's directory.

New TestAnswerSchemaCheckedAgainstItsDraft: three schemas that break
their draft (type 5, minLength "x", required "a" under 2020-12) are
refused. Broken by hand (Compile without ensureDrafts) it panics red.

Measured on mote, sandbox HOME, t45 (v0.1.3522) against t46 (this):
- GODEBUG=inittrace=1 sum: 2.98 MB / 28,515 allocs -> 1.28 MB / 7,385
- `magpie statusline`, 3 runs: instructions retired ~135M -> ~101M,
  peak memory footprint 15.5-16.1 MB -> 12.6-12.7 MB

Run: upstream's own tests (`go test .`, GOWORK=off) on the forked
draft.go and compiler.go: ok, as on upstream (36 pass; the official
JSON-Schema-Test-Suite submodule isn't in the module zip, so it wasn't
run). go vet ./... ok; GOOS=windows go vet ./internal/gateway ok;
go test -run 'TestAnswer|TestClaudeTUISchema' ./internal/gateway ok;
root TestNoEagerPackageRegexps, TestAllLazyPatternsCompile ok.
Not tried: a docker build of the Dockerfile.
2026-11-10 13:16:59 +08:00
yetone 273b9f5a99 deps: modernc sqlite v1.61.0 / libc v1.79.0, so /etc/services is parsed on use, not at every start
libc v1.67.6's netdb package had an init() that read and parsed
/etc/protocols and /etc/services on every launch: 3.66 MB and 44k
allocations, ~3-4 ms, with ~1.9 MB kept for the life of the gateway.
libc v1.78.0 and later load it through a sync.Once on first use, and
magpie never looks a service up. `magpie statusline`, which Claude Code
runs on every message, pays this on each launch.

Bumped (all released more than two weeks ago): modernc.org/sqlite
v1.44.3 -> v1.61.0, libc v1.67.6 -> v1.79.0, memory v1.11.0 -> v1.12.1,
golang.org/x/sys v0.46.0 -> v0.49.0, go-humanize, go-isatty and
go-strftime as sqlite's go.mod pins them. go mod tidy.

Measured on mote (M5 Pro), sandbox HOME with a copy of real accounts,
main e697e7ddf vs this change:
- GODEBUG=inittrace=1: init 16.7 MB / 150k allocs -> 13.0 MB / 106k;
  the netdb line is gone.
- `echo {} | magpie statusline` under /usr/bin/time -l, 3 runs each:
  instructions retired 324-330M -> 254-278M (about -20%), peak
  footprint 24.6-25.1 MB -> 22.3-22.6 MB.

Run: go vet ./... (mote); GOOS=linux and GOOS=windows go vet of
internal/sqlitedb, internal/agent, internal/provider; go test
internal/sqlitedb, internal/agent and internal/provider -run
'Cherry|Cindy|Aion|Newmax|Import|SQLite' (the sqlite readers): ok.
Not run: the full go test ./... suite before the push.
2026-11-10 12:26:39 +08:00
yetone cdd99c5578 routing: a re: pattern with a lookahead saves and matches as its preview showed
maer8824 on Discord wrote "re:(?!.*flash).*glm.*" (glm but not flash) in
a routing group. The GUI's preview, which reads patterns with JS's
RegExp, matched the right models, but saving failed: Go's regexp has no
lookaround ("invalid or unsupported Perl syntax: (?!").

compilePattern now reads with Go's regexp first, as before, and only a
pattern Go can't read goes to regexp2 (already in go.sum; now required
directly), with a 100ms bound on one match. A pattern Go reads keeps
exactly the matches it had; one neither reads is still refused with
Go's error. Groups' patterns and providers' auto-include rules both
compile here, so both take it.

Run on mote at this head: go mod verify ok; go vet ./... ok;
GOOS=linux and GOOS=windows go vet ./internal/provider/ ok;
go test -count=1 ./internal/provider/ ok (133s).
Broken by hand: with groupmatch.go/autolist.go/go.mod reverted,
TestRegexpPatternLookahead fails 5 ways (the reporter's error among them).
Not tried: a real group saved in the GUI; the full suite follows the push.

Reported-by: maer8824 (Discord)
2026-11-09 20:06:22 +08:00
yetone 9a00bfed14 deps: moejs v0.1.0
moejs v0.1.0 is out (Ion_Mio_ on X): less memory, about 3x faster than
alpha.11 on V8's benchmark, 2.9x C QuickJS on a 100K-token agent request.
It pulls in github.com/MoeForge/moego (MIT) for base64.

THIRD_PARTY_NOTICES names v0.1.0; sections 1 to 4 of moejs's notices are
the same as at alpha.11 (diffed). go mod tidy also marks gen2brain/h265
and santhosh-tekuri/jsonschema direct, which internal/gateway imports.

Run at 608c1543e plus this change (the rebase onto 93bbcc8bf adds only
that gateway commit):
- mote (macOS): GOOS=windows go vet ./... ok; go test -timeout 45m ./...
  88 packages ok, internal/gui red on TestGatewayModeStatsNameTheGatewaySessions
  alone, 3 of 3 on origin/main b475004d5 too (#5690, first hour of a local
  day; mote ran at 00:37 PST).
- magpie-desktop (Linux): go vet -tags gtk3 ./... ok; agentplug,
  middleware, plugin ok.
Not tried: a real plugin in a running magpie.
2026-11-09 16:57:15 +08:00
yetone a25d3d0815 claude: a JSON schema is answered in the interactive mode, through an answer tool
With the interactive mode on, a request with a JSON schema was refused
with a 400 since v0.1.2592: interactive Claude Code takes --json-schema and does nothing
with it, its StructuredOutput tool being -p's alone. It now runs in the
interactive mode like any other request.

- serveClaudeSubscription compiles the schema (santhosh-tekuri/jsonschema
  v6.0.3, draft-07 unless it says otherwise, as -p reads one; a $ref
  outside the schema is refused, never fetched) and adds an answer tool,
  StructuredOutput or a numbered name apart from the client's tools, with
  the schema as its input schema, through the bridge's MCP server. A
  schema that can't be compiled is a 400 before any run.
- mcpCall checks each call against the schema: one that doesn't fit is
  told why (isError) to be made again, as -p's is; one that fits is kept.
- At the turn's result the kept input is the reply's structured output.
  A turn that ended with no call is told once to call the tool, and
  fails "no answer fitting the schema" if it still doesn't. Neither the
  call nor the words around it reach the client.
- claudePrint no longer lists the schema. The two refusal tests
  (TestClaudeTUIOnRefusesPrint, TestClaudeTUIRefusalIsNoAccountsFault)
  now use the case that is still refused before any run: an image by
  its URL that can't be downloaded (127.0.0.1, which magpie never
  fetches).
- The provider editor's card no longer says -p takes "a JSON schema"
  the interactive mode can't (en, zh-CN, zh-TW, ja, de).
- docs/subsystems/claude-subscription-bridge.md: the refusal list, and
  how a schema is answered.

Run:
- A real run, haiku, the test account in a sandbox HOME, real Claude
  Code 2.1.316 through the helper with --json-schema and a stdio MCP
  server named magpie serving the answer tool and its description: the
  result's structured_output was null (the premise), and the model
  called mcp__magpie__StructuredOutput at once with
  {"color":"Sky blue","hex":"#87CEEB"}, which fits the schema's
  pattern. 7.2s, one turn. Not run: the whole gateway path with a real
  account (the unit tests drive it with Claude Code's real transcript
  rows).
- mote, at this tree (base 14e351378, origin/main just fetched): gofmt,
  go vet (darwin, windows, linux -tags nogui), go mod verify ok;
  go test ./internal/gateway ./internal/claudetui: claudetui ok, gateway
  red in TestCodexPoolSaysTheClientsVersion only, which is #4807 (red in
  a full package run on mote, another test's Codex identity reaches it);
  alone at this tree -count=3 ok. claude-mode 44/44 and i18n-keys 4/4 in
  chromium and webkit.
- Broken by hand: answer() taking every call without checking it made
  TestClaudeTUISchemaAnswer red ("a call that doesn't fit was told
  Answer received.").
2026-11-02 00:35:21 +08:00
yetone d614f21721 gateway: a HEIC photo goes to the vendor as JPEG, or PNG with alpha (qikamatata on X)
Pi and Pi Desktop send an iPhone photo dragged in as image/heic, and
DeepSeek flash on WorkBuddy (a plugin's fetch) turned it away; most
vendors take JPEG, PNG, GIF and WebP only.

What: heicAsJPEG (heic.go) runs at the top of Server.serve, after
offAsNone, so every route below sees the converted image: a provider's
own, a plugin's fetch, the describer, every translation. count_tokens
does the same. It walks images through walkImages, the one image walker,
so it covers Chat image_url (string or object), Responses input_image,
Anthropic image blocks and Gemini inlineData, tool results included. It
goes by the bytes (ftyp + an HEVC still's brand), so a HEIC labelled
image/jpeg or image/png is converted too, and a JPEG labelled heic is
left alone. Other fields of the block (detail, cache_control) are kept.
Transparent images go as PNG, opaque ones as JPEG q90.

Cost: a body with no "image/hei" and no base64 ftyp mark ("eXB" + 5
chars, at the same place in any base64 that starts at the file) is not
walked. Caps: 48 MB of base64, 50 MP, the long side written at 4096 px,
one decode at a time, 30 s wait (a late result is cached for the next
turn), a 64 MB / 32 entry cache by sha256, since agents resend a
conversation's images every turn. Any failure, panic included, leaves
the image as it came. Measured on mote (M5 Pro): 12 MP 0.44 s, 24 MP
0.86 s, 48 MP 1.6 s / ~1 GB held, freed at once with FreeOSMemory.

Why gen2brain/h265 v0.2.4: pure Go (release builds are CGO_ENABLED=0),
MIT, no dependencies, SIMD on amd64 and arm64, maintained (latest
2026-10-29). Not chosen: gen2brain/heic (wazero WASM or a libheif dylib
through purego), jdeng/goheif (cgo libde265), OS converters (Windows
needs the paid HEVC extension, Linux tools are often missing).

Tests (heic_test.go, fixtures made on mote with sips, 1.6 KB each):
12 shapes converted with their kept fields, pixels kept, 7 non-HEIC
cases byte-identical, a cut file / a panicking decoder / a timeout go
as they came, and a plugin's fetch (fake plugin, new FAKE_SEES image
model) gets JPEG on /v1/chat/completions and /v1/messages.

Run at this tree (733fac48f + this change), on mote:
- gofmt -l internal: clean
- GOOS=darwin/linux/windows go vet -tags nogui ./internal/gateway
  ./internal/plugin: ok
- CGO_ENABLED=0 go build ./internal/gateway for darwin, linux, windows
  x amd64, arm64: ok
- go test ./internal/gateway ./internal/plugin -count=1 -timeout 45m:
  ok (774s, 134s)
- win-run (Windows amd64) and wsl-run (Linux amd64, AVX2 path):
  go test ./internal/gateway -run HEIC: ok

Broken by hand, each red, then restored:
- no heicAsJPEG call in serve: TestHEICReachesPluginAsJPEG red
- media_type not set for Anthropic: the messages subtests red
- no base64 mark scan: the "labelled jpeg/png" subtests red

Not tried: a real Pi -> WorkBuddy request with a real account; a real
iPhone gridded HEIC (only sips files and Apple's 26 MB wallpaper); a HEIC
behind an http URL (not fetched, goes as it came); Anthropic document
blocks, Responses input_file and images/edits.
2026-11-01 15:04:28 +08:00
yetone 60520ddb3b moejs: v0.1.0-alpha.11, at its new module path github.com/MoeForge/moejs
Gateway middleware and agent plugins run on moejs. alpha.11 moves the
module to github.com/MoeForge/moejs; every other API change since
alpha.4 is an addition. What magpie gets: faster calls, loops, property
lookups and JSON.parse, allocation-free await, a bytecode verifier, a
correct default.pgo, and Intl / toLocaleString in plugin code.

Checked against both tags' source: every name magpie uses (NewRuntime,
Options, Compile, Link, Hook, Value, Arg, Undefined, NativeFunc,
Referrer, the Promise results, Exception) has the same signature, and
Options' defaults (shared frozen builtins, no timers) are unchanged.
fetch, Streams, URL, node:fs and node:buffer live in the separate
webapi and node packages, installed only on request; magpie installs
neither, so a plugin still reaches no network or file.

Intl's CLDR, Unicode, ICU and V8 material is compiled into every build,
and moejs asks a program that includes it to carry sections 1 to 4 of
its notices. THIRD_PARTY_NOTICES holds them verbatim. Release archives
ship no LICENSE today either; that is not changed here.

Doc and site links (docs/, site/public/docs/{,zh/,ja/}plugins.html)
point at the new repo.

Run on mote at this tree: gofmt; go build -trimpath -s -w (60,670,658
bytes on origin/main 58fb3a778, 62,329,250 now, +1.66MB); go vet of
middleware, jsmod, agentplug for darwin, linux and windows; go test
./internal/middleware/... ./internal/jsmod/... ./internal/agentplug/...
ok; go test -run 'Middleware|Strateg|OnUsage|JSPlugin|Agentplug|AgentPlug'
./internal/gateway ./internal/provider ./internal/plugin ./internal/gui
ok.
Not run: the full suite, the GUI suite, a real request through a
middleware in a running gateway.
2026-10-28 14:36:17 +08:00
yetone 6e9820a3a4 pii/guard: run AstrLink Guard's int8 model in Go (#3578)
AstrLink Guard (QuantumNous/astrlink-guard, Apache-2.0, on Microsoft's
MIT Multilingual-MiniLM-L12-H384) is a 36.9M-parameter BERT token
classifier for Chinese and English: 21 BIO labels (email, phone,
account, payment_card, ip_address, url, common_secret, private_address,
private_date, private_person), 512-token windows overlapping by 128,
a 0.8 score floor. Its int8 ONNX is 37 MB.

This package runs it with no new dependency and nothing native: an ONNX
protobuf reader for the graph and its external data (onnx.go), the
XLM-R Unigram tokenizer from tokenizer.json (tokenizer.go), and the
encoder with int8 x int8 matmuls (bert.go) on NEON/SDOT kernels on
arm64, SSE2 on amd64 and Go elsewhere (kernel*). Word embeddings stay
quantized (15 MB in memory, not 61 MB). uax29 moves from an indirect to
a direct requirement for the tokenizer's pre-split.

Checked against onnxruntime on the publisher's files: the same spans
on 69 of 71 eval texts, 232 of 234 real code segments and 24 of 25
positive samples; the rest differ by a span edge at the score floor.
One 512-token window takes ~0.5s CPU on arm64 and ~1.2s under Rosetta
on amd64, on a box at load ~100.

Run: go test ./internal/pii/guard (kernels against the Go reference,
tokenizer against the publisher's tokenizer on testdata/tokens.json),
gofmt -l, go vet, GOOS=linux go vet -tags nogui and GOOS=windows go
vet on amd64 and arm64, at the pushed head.
2026-10-27 02:01:16 +08:00
yetone 88ac42843d icons: a big picture is sent to the window scaled to 256px (#909, #1956, #2459)
A webview keeps every picture on the page decoded at its own size. The
Plugins page draws 152 icons at 20 to 64 points, and some stored icons
are 1254x1254, so opening Plugins alone added ~122 MiB to the renderer.

GET /api/icons/{name} now sends a PNG, JPEG or WebP longer than 256px
as a PNG copy scaled to 256 on its longest side (CatmullRom), made on
its first ask under the cache dir (icons-small) through temp-and-rename
and kept. SVGs, small pictures, pictures over 64M pixels and anything
that fails to decode are sent as they are. pruneIcons drops a copy
whose original is gone. golang.org/x/image goes from indirect v0.41.0
to direct v0.43.0 (needs only x/text v0.38, nothing else bumped).

Measured in Chromium (WebView2's engine) on a dev backend with a copy
of the real library and its 111 stored icons (6.2 MB):
- renderer RSS after opening Plugins: 369 -> 304 MiB
- renderer after visiting every page, on Settings: 310 -> 290 MiB
- decoded image area on Plugins: 18.5 -> 6.5 megapixels
- 15 scaled copies made, 596 KB in all
What is left on Plugins is SVGs, which rasterise at draw size.

Run at this head (before rebase onto 634cbf587, which touches only
internal/agent):
- go test ./internal/provider -count=1 -timeout 45m
  -skip '^TestUnreadLoginsWriteErrorsKeepCredentials$' (#3632): ok 95s
- go test ./internal/gui -count=1 -run 'Icon|Plugin': ok
- GOOS=linux and GOOS=windows go vet -tags nogui on both packages: ok
- gofmt -l internal/: clean
Broken by hand: with scaling turned off in scaledIcon,
TestBigIconServedScaled goes red ("want a scaled copy").
Not tried: WebView2 itself on Windows, and WebKitGTK.
2026-10-26 17:05:16 +08:00
yetone de49433ff8 filememo: another process's writes to magpie's files are watched for, not polled every 5s (#3185)
An idle magpie still woke a dozen times on each 5s beat: the loops that
follow plugins.yml, settings.json, providers.json, the plugin list, tools
and access each looked at the disk for what the CLI or a second magpie
wrote. The gateway now watches those files' folders (fsnotify: FSEvents,
inotify, ReadDirectoryChangesW), and a change from another process wakes
the same loops at once, as magpie's own writes do (filememo.Written).
With the watch running the loops look for a change they missed only once
a minute (OthersEvery); where the folders can't be watched, or the watch
errs, they go on looking every 5s.

Run at 466cafa0c + this change. The rebase onto 13f9c7fca brought in
internal/gateway's claude bridge and redact files, none of the files here;
after it, go build ./... and the filememo, pluginrt, awake tests ran again ok:
- go test -timeout 45m ./internal/filememo ./internal/pluginrt
  ./internal/middleware ./internal/otlp ./internal/gateway: all ok
  (gateway 384s).
- TestWatchWakesOnOthersWrites -count=3 ok; red with wake() taken out.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the
  changed packages ok.
- Real gateway, sandbox HOME, idle: proc_pid_rusage wakeups over 120s
  after a 90s warm-up, two rounds each: v0.1.1561 2.1 / 2.7 per second,
  this 1.9 / 2.0 (and 1.8 in a third run).
- Same gateway: plugins.yml replaced from outside with broken YAML; the
  gateway logged "plugins: ... doesn't parse" 0.02s after the write
  (it could take up to 5s before). File restored after.

Not tried: Linux and Windows real runs (vet only).
2026-10-26 11:22:20 +08:00
yetone a2e98cd799 gateway: a streamed Codex turn goes to ChatGPT over its WebSocket (brickhao)
brickhao on Discord: long Codex turns through magpie died with "stream
closed before response.completed". Their network (FlClash) cuts a
streamed HTTP reply from chatgpt.com at about 120 s: 120.7 s through
magpie, 121.5 s over HTTP without magpie. Codex's own WebSocket to the
same backend ran to the end twice (124.5 s, 131.4 s). magpie has no
120 s timer of its own (no WriteTimeout, 10 min to the first header).
The cut is on the leg from magpie to chatgpt.com, which was always
HTTP. Codex answers magpie's 426 by falling back to HTTP, and over
loopback that is harmless.

What changed: codexSocket, first in upstreamTransport, sends a POST to
CodexBase/responses with "stream":true over the backend's WebSocket, as
codex-rs does (ResponseCreateWsRequest, build_websocket_headers).
- Handshake: the turn's headers plus OpenAI-Beta:
  responses_websockets=2026-02-06. x-codex-turn-state and the
  responses-lite header go in client_metadata instead. The message is
  the body (zstd decoded) with "type":"response.create" ahead of it.
- Frames come back as the SSE the HTTP route sends.
  codex.rate_limits and codex.response.metadata are also given as the
  x-codex-* and x-codex-turn-state headers. websocket_timing is dropped.
- An error frame ahead of the reply becomes its HTTP status and body,
  so account rests and failover work as before.
- These go over HTTP: a refused handshake (and the host stays on HTTP
  for 10 min, unless the refusal was 401/429/5xx),
  websocket_connection_limit_reached, and a body that isn't a streamed
  turn.
- A socket closed before the end reads as a cut stream.
- Both Codex's own sign-in passthrough and magpie's ChatGPT accounts
  take this path. Codex identity, instructions and prompts are
  unchanged. coder/websocket is now a direct dependency (it was
  indirect).

Run:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- go test -race -count=3 of the five new tests: ok.
- go test -timeout 45m at 1a5911612 (rebased on origin/main c551a2299),
  sandbox HOME: internal/gateway ok 760.9s, internal/agent ok 596.8s,
  internal/provider ok 172.5s. The rest of ./... was not run before the push.
- Real: a sandbox magpie (this tree, 127.0.0.1:3488, sandbox HOME and
  CODEX_HOME, a copy of the Codex access token with the refresh token
  blanked so nothing could rotate). A curl turn on gpt-6-luna came back
  200 with codex.rate_limits in the SSE (which only the socket sends)
  and the x-codex-* headers. Real Codex CLI 0.162.1 (codex exec,
  xhigh) through it: a 6121-word reply over 165 s ended whole, exit 0.
  Codex logged its own 426 from magpie and fell back, as expected.

Broken by hand:
- socket off in the tests: all four socket tests red (the reply cut
  before response.completed, no handshake, 200 not 429).
- error-frame mapping off: TestCodexSocketErrorIsItsStatus red.
- turn-state into client_metadata off: TestCodexTurnGoesOverWebSocket
  red.

Not tried:
- brickhao's network: this network doesn't cut at 120 s, so the 165 s
  turn shows the socket carries a long turn whole, not that it gets
  past their cut.
- A real turn on a magpie-saved ChatGPT account (fake only).
- Through an HTTP or SOCKS proxy for real.
- Windows/Linux runs.
2026-10-23 23:59:55 +08:00
yetone 861bbef2d5 sqlite: an environment entry with no "=" no longer ends magpie at its first SQLite open, where modernc's libc printed TODOTODO and exited (#2327, goodloop)
A magpie started from Alfred under the MacSec DLP tool quit about two
seconds after launch, exit 1, no crash report. Its environment held an
entry with no "=" ("hains/MacSec/libesafenet.dylib", a fragment of the
tool's injected dylib path). The first SQLite open (a session scan)
reads SQLITE_TMPDIR through modernc's libc, whose getenv on darwin,
windows and the BSDs (libc.go, not the musl build Linux uses) hits that
entry, calls todo() and os.Exit(1): "libc.go:1816:getenv: TODOTODO
"SQLITE_TMPDIR" "hains/MacSec/libesafenet.dylib"", the reporter's line.

New package internal/sqlitedb is the one importer of modernc.org/sqlite
in magpie's own code (it replaces the blank imports in
internal/provider/importapps.go and internal/agent/cindy.go, the only
two). Its init hands libc.SetEnviron a copy of os.Environ with the
entries that have no "=" left out, before any open and before any
goroutine, which also keeps libc's unlocked first-use SetEnviron from
racing. modernc.org/libc becomes a direct requirement (v1.67.6, same
version). Snapshot timing: libc's copy is now taken at init, not at the
first open; nothing in magpie sets SQLITE_TMPDIR, TMPDIR or TZ, the
only variables SQLite reads.

Run (worktree at origin/main 01c41e8ba, sandbox HOME, go1.26.8 darwin):
- internal/sqlitedb: TestSQLiteSurvivesMalformedEnv starts the test
  binary again with the reporter's entry first in a raw Env and opens
  and reads a database there; TestWellFormed; and
  TestOnlyThisPackageReachesSQLite (no non-test file outside
  internal/sqlitedb imports modernc.org/sqlite or modernc.org/libc).
- Broken by hand: with init's SetEnviron call removed,
  TestSQLiteSurvivesMalformedEnv goes red with the child's exit 1 and
  the reporter's exact TODOTODO line. With cindy.go importing
  modernc.org/sqlite again, the import guard goes red naming it.
- go test -p 1 -count=1 -tags nogui ./internal/sqlitedb ./internal/agent
  ./internal/provider ./internal/sessions ./internal/proc: all ok.
- gofmt -l: clean. go vet -tags nogui on the three packages for
  GOOS=darwin, linux, windows: clean. go mod verify: ok.
- Real binary: go build -tags nogui, then execve'd (python ctypes, raw
  envp) as `magpie sessions` with the reporter's entry and a sandbox
  HOME holding an opencode.db: exit 0, it listed. The hand-broken
  binary for comparison couldn't be linked (disk full), so that run
  shows only that the fixed binary survives, not that this command
  reached SQLite; the test above is what goes red on the old code.
- Not tried: the reporter's Alfred + MacSec machine, Windows.
- Linux getenv (musl-based) already skips such entries; the test passes
  there either way.

Full suite: SUITE_LINE
2026-10-15 23:08:01 +08:00
yetone 92ac1c878e search: the web search MCP server has a web_fetch tool that reads a page by its URL (#2286, blackrion)
An agent that mounted magpie's web search over MCP (Cursor, Claude Desktop)
found pages it couldn't open: it has no fetch tool of its own. web_fetch
(url, max_chars, offset) reads one.

- The URL is the agent's, so the page is downloaded the way a caller's
  image is (publicClient): public addresses only, every resolved address
  checked and pinned, redirects (at most 5) checked the same, a request
  from this computer included; only http and https. 30 s and 5 MiB at most.
- HTML is decoded from its charset (x/net/html/charset; golang.org/x/net
  added) and given as Markdown: title, headings, lists, links made
  absolute, code and pre; script, style, hidden elements dropped. Other
  text as it is; anything else, or a 4xx/5xx, is the tool's error.
- 20000 characters by default (at most 100000) from offset, with the
  offset the rest starts at.
- Each call reserves the gateway key's limit, as a search does.
- The tool description is neutral (names neither magpie nor a vendor).
- GUI: the MCP row's text names both tools (en, zh, zh-TW, ja, de).
  Docs: gateway-routing's MCP section, README (en, zh-CN).

Run: go test -tags nogui ./internal/gateway -run 'WebFetch|SearchMCP';
GOOS=linux/windows go vet ./internal/gateway; gofmt -l clean. GUI:
search-mcp, i18n-keys, gui-ja, gui-de, gui-zh-tw 32/32 (chromium +
webkit). Broken by hand: webFetchClient = http.DefaultClient turns
TestWebFetchOnlyPublic red (the local test server was reached).
Tried by hand (a throwaway test, not committed) against go.dev/doc,
en.wikipedia.org/wiki/Magpie and http://github.com/yetone (redirected to
https; links come out by name, not the pinned address: the first try gave
https://216.239.34.21:443/..., fixed by taking each redirect's URL from
CheckRedirect), and an httpbin redirect to 127.0.0.1, refused.

Full suite: SUITE_LINE
2026-10-15 23:08:00 +08:00
forever e4882f91de go: 1.26.8, whose race detector leaves a forked child alone before exec on macOS (#1184)
macOS race CI failed now and then with "write |1: file already closed"
on a Claude subscription run's first prompt
(TestClaudeAuthFailureFallsBackWithoutRetryingTheLogin in 37605014029,
TestClaudeLastWordsAreRead in 37464400652; 37612795871 got the same
failure as "broken pipe"). The Claude Code stand-in had already ended
when the first prompt was written, and Wait had closed its stdin.

It never ran. On the fork's macOS runners, a debug build that recorded
the process's status at the failed write caught 8 cases in 10 jobs.
Each was "signal: segmentation fault", under 1ms of CPU, nothing on
stderr, with no magpie abort or group kill. The crash report
(gateway.race-*.ips) says "crashed on child side of fork pre-exec":

  __tsan::TraceSwitchPartImpl
  syscall.rawSyscall
  syscall.forkAndExecInChild
  syscall.forkExec
  os.StartProcess
  exec.(*Cmd).Start
  proc.StartTree
  gateway.(*subscriptionRun).launch

This is golang/go#79804. From Go 1.26.0, darwin's raw syscall wrappers
are instrumented under -race, and forkAndExecInChild calls them in the
child of fork. Go 1.26.5 marks them //go:norace (#79806); go.mod's
1.26.3, which setup-go builds CI with, has the bug. Only -race test
binaries on macOS are affected, so released builds never were. Any
os/exec start in a macOS race test could hit it; the Claude
subscription tests were where it surfaced. Local runs on go1.27.1
couldn't reproduce it, because that release already has the fix.

1.26.8 is the latest 1.26 patch release.
2026-10-08 06:48:55 +08:00
yetone 89825eca1a go.mod: go mod tidy — moejs is required directly (internal/gateway imports it), and go.sum drops testify 1.11.1 and go-spew/go-difflib, which nothing builds with
go mod verify, go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and the gateway and library tests pass.
2026-10-06 04:01:01 +08:00
yetone eebd0b4222 plugin, gateway, gui: a plugin can be gateway middleware — onRequest, onEvent and onResponse run in magpie's gateway on what agents send and get back (moejs) — a plugin could only be a subscription provider, run in the Bun host, a process away from the gateway. A plugin may now declare middleware (package.json magpie.middleware, or a *.middleware.js / .mjs file), run in-process by moejs (pure-Go JS engine): compiled once, one runtime per request from a pool, so every hook of a request shares ctx.state. onRequest(body, ctx) sees the agent's body in its own API before routing; what it returns is the body the next middleware and the gateway get, undefined leaves the bytes as they were, ctx.reject(status, msg) answers with an error in the agent's API's shape. onEvent(ev, ctx) sees each SSE event's JSON (export const events = [...] filters by name; an object changes it, null drops it, undefined passes the bytes through untouched; data: [DONE] is no JSON and passes by). onResponse(body, ctx) sees a whole JSON reply, with ctx.status. ctx has protocol, model, stream, path, agent, the plugin's options and state. A hook that throws, returns a non-object or runs past its limit (250ms request/response, 50ms an event, 1s load; interrupted) leaves the request or reply as it was and is counted and logged (60 lines a minute); a compressed reply passes as-is. Files are reloaded within a second of a change. Only agents' requests run through it (serveAgent at the gateway's agent entry points and the Codex backend), never magpie's own titles, classifier or stand-ins; it sees bodies before redaction. A middleware-only package is skipped by the Bun host. The Plugins page marks a middleware with a chip, its hooks, calls and µs per call (JSON in and out counted), failures in red with the last error, and a load error. en/zh/ja/de; docs/reference.md and usemagpie.ai/docs/plugins#middleware (en/zh/ja) with an alias example. Tested with a real DeepSeek account through magpie web --gateway in a sandbox HOME: an alias middleware served "fast" and named it in message_start, a reject came back as 403 permission_error, a Chat stream uppercased; real Claude Code (sandbox CLAUDE_CONFIG_DIR) did Read, Bash and Glob tool turns through three middlewares with 0 failures: ≈1–1.6µs an event, 0.2–0.7ms an onRequest that parses and rewrites Claude Code's ≈80KB body. Real use found two bugs fixed here: [DONE] parsed as JSON (SyntaxError on every Chat stream) and stats leaving out the JSON time. internal/middleware tests (chain, undefined keeps bytes, reject, fail-open on throw/spin/string with the runtime reused, async hook, load errors, off and Bun skip, reload, split/CRLF/filtered/dropped stream events, [DONE] untouched, whole reply and gzip, 64 in parallel; BenchmarkEvent ≈0.9µs, 11 allocs) and TestMiddlewareThroughGateway (alias routed, events by protocol, redaction still upstream, reject in Anthropic's shape; fails without the change) are new; plugin-middleware.test.cjs (Chromium and WebKit, en and zh: chip, hooks and stats, failures with last error, broken and off, no left border) fails without it. The other plugin GUI tests and click-scroll pass in WebKit. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (internal/provider failed once under load and passes alone). 2026-10-05 19:14:31 +08:00
yetone e698e7dddd claude: adding a Claude account is Claude Code's own claude auth login, and magpie never refreshes a Claude sign-in nor asks Anthropic anything with one (the user: 把 magpie 自己的 Claude 登录改成直接用 claude /login,只要体验上没什么差别就改) — magpie traded the sign-in page's code for tokens with Claude Code's OAuth client, asked Anthropic's profile and model list with them, refreshed saved accounts itself (daily keepalive included) and handed a saved account to Claude Code as CLAUDE_CODE_OAUTH_TOKEN. Now Add account runs claude auth login --claudeai in a config directory of magpie's own: the page Claude Code would open comes to magpie's window (Claude Code is given magpie as its BROWSER, which writes the page down and exits), the browser comes back to Claude Code's own listener, and when the browser can't reach this machine the address it ended on, or the code Claude's page shows, is pasted as before and handed to Claude Code. Who signed in is what Claude Code kept (.claude.json, auth status). A saved account in use beside the signed-in one runs Claude Code with CLAUDE_CONFIG_DIR set to its own directory (claude-accounts/ beside magpie's config), its sign-in put there once from logins.json and read back as Claude Code refreshes it; switching to it moves it into Claude Code's own store and removes the directory, as forgetting it does. Claude's models are the catalog's (models.dev), not asked of Anthropic; an imported Claude login is kept as the file has it, and Claude Code refreshes it on first use. Claude Code is required to add a Claude account. TestClaudeSignInByPaste, TestClaudeSignInByPastedAddress, TestClaudeSavedAccountDir (a fake claude CLI, and a server standing in for Anthropic that fails the test if asked) and the reworked sign-in, import and gateway tests fail without the change. With the real Claude Code 2.1.286 in a sandbox directory, its sign-in page (localhost callback) reached magpie's binary and the sign-in waited for the browser; nothing was left behind once it was canceled. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; claude-risk, plugin-signin, signin-callback, signin-link, signin-paste-codex, routing-signin, own-signin-remove, click-scroll, old-webkit pass. 2026-10-01 16:37:07 +08:00
yetone b0a0165fc9 usage: a notification when a window is nearly used up or a balance runs low (#368) — Settings has Usage alert (off, or a share of 1–100%, 80 by default) and Low balance alert (off, or an amount, 5 by default), and magpie quota alert sets them from the command line. Each subscription or plan window, other than one set aside, is told once a run when it reaches the share, and a balance once until topped up past the amount again; what was said is kept, so a restart doesn't say it again, and a failed or stale reading neither alerts nor clears. The system's notifications are started only when first needed, so a Mac build that can't have them or a Linux desktop without a daemon still starts, and Settings says when they are refused or unavailable; a click opens the Usage page. TestDueAlerts and friends, TestAlertText and usage-alert.test.cjs fail without the change. 2026-10-01 04:16:28 +08:00
yetone 839c762098 app: Magpie is in the Start menu on Windows (#158: Windows 便携版首次运行后,无法在开始菜单 / 系统搜索中找到 Magpie — @Aimer779) — the Windows build is one portable exe with no installer, so nothing put it anywhere Windows search looks. Each start of the desktop app (not the CLI, TUI or serve) now makes sure %APPDATA%\Microsoft\Windows\Start Menu\Programs\Magpie.lnk (the Programs known folder) opens the exe it runs as, symlinks resolved, in its folder, with its icon and "Magpie" as its description; one that already does is left be, one for where the exe was before it was moved is pointed here again. It is the shell's own link, made through WScript.Shell with go-ole (already in the build through Wails, now a direct require), in the background beside the magpie:// registration, and a failure is only logged. An update replaces the exe in place, so the shortcut stays good; a magpie left running from magpie.exe.old(-N) (or .new) points it at magpie.exe, never at what was moved aside. HKCU App Paths\magpie.exe is set to the exe (and its folder) so Win+R magpie opens it too. No uninstall entry, nothing copied. MAGPIE_NO_SHORTCUT=1 skips it (tests, sandboxes); other systems do nothing. Tested with the Windows test built here and run on Windows 11: a shortcut made, left as it was on a second start, pointed at the moved exe. Run on Windows 11 as the desktop app: the shortcut made with the exe's folder and icon, pointed anew after the exe moved, left as it was on a start with nothing changed; App Paths set 2026-09-28 22:44:36 +08:00
Zhizhen He d36dbe46f5 chore: go mod tidy (#66) 2026-09-25 22:11:19 +08:00
yetone dfc2d7fa93 library: MCP servers, skills and instructions are kept once in magpie and given to any agent from one place, with a market to find and add them (#29). Each agent reads MCP servers and skills from files of its own and in a format of its own, so one server was set up again in Claude Code, Codex, Gemini CLI, OpenCode, Pi, Goose, Cursor, Copilot CLI and Crush. The Library view keeps each once: a server is added (stdio, http or sse, its env and headers) and switched on per agent with its icon, and magpie writes it into each agent's config in that agent's format, leaving what the agent has of its own as it is; a server or skill an agent already has is shown, to bring into the library. A skill is a folder with a SKILL.md, kept in the library from GitHub (owner/repo, or a link to a folder in one; updated from it later) or linked from a folder on this machine, and linked into each agent's skills folder. The instructions every agent reads (CLAUDE.md, AGENTS.md, GEMINI.md…) can be kept as one too. The market offers checked MCP servers first, then the official MCP Registry's, filled in from what the registry says each needs (keys asked for in a form, never guessed), and skills.sh's most installed skills with what each says it is for; each shows its real icon (the vendor's own, else its GitHub owner's), fetched through magpie only for the icons the market or the library gave out, and an added server or skill keeps its icon in the library. What magpie changes in an agent's files is backed up first 2026-09-25 14:11:17 +08:00
yetone c3931c91df codex: magpie's models join Codex's own rather than replacing them — signed in (ChatGPT or an API key), Codex keeps its built-in OpenAI provider and sign-in and is pointed at magpie with openai_base_url alone, so its official models still go to OpenAI on the user's own account, its threads (listed per provider) stay together, and the Codex app keeps its model picker; magpie's gateway answers at /backend-api/codex, passing Codex's own models through as they came, serving magpie's (provider/model) itself, and handing out OpenAI's model list with magpie's after it for /model. Compacting a magpie model's conversation is done by that model with Codex's own prompt; Codex's compressed request bodies are read, and usage is counted for both. Not signed in, magpie stays a provider of Codex's as before; a magpie set up that way moves over the next time a magpie model is picked 2026-09-25 02:42:24 +08:00
yetone 41931e2895 agent: omp (oh-my-pi) — its model picked in magpie like any agent's; a model through magpie adds magpie as a keyless provider in ~/.omp/agent/models.yml with the catalog as its models, and sets config.yml's modelRoles.default to magpie/<provider>/<model>; its other roles and the rest of both files stay as they are, comments too, and default takes magpie's entry out unless another role still uses it (#34) 2026-09-24 22:36:15 +08:00
yetone efbe5660b0 backup: everything set up in magpie carried to another machine in one file — magpie backup writes the providers with their keys (or none, with --no-keys), the pictures picked for them, the settings, the profiles and every agent's model, sealed with a passphrase (AES-256-GCM, PBKDF2-SHA256) so nothing in it reads without it; magpie restore puts it in, replacing providers by id, keeping the keys already there for one that came without, and setting models only for the agents installed there; subscriptions stay with the machine they were signed in on (#28) 2026-09-24 20:34:15 +08:00
yetone 0b0f258c0f providers: import from other apps — the add sheet's Import… reads the providers CC Switch (its database, or the older config.json) and Alma have set up, read-only, and lists them to pick from: what magpie has already is marked, a key for a vendor that is already here can join it as another key, an id in use is kept beside or replaced, and sign-ins, Azure, Gemini-protocol relays and entries pointing at magpie itself are shown but not offered; keys are read again on import and only reach the window masked 2026-09-24 18:48:08 +08:00
yetone 4bd3f3a4b5 import: magpie://import links add a provider after the user confirms
A vendor or relay can hand out a ready-made provider as a link. The app
registers the magpie scheme (Info.plist on macOS, HKCU on Windows, a
.desktop handler on Linux), a second launch hands the link to the running
one, and the window shows what the link would add, with the hosts the
prompts and key would go to, before anything is saved. `magpie import`
does the same in a terminal.
2026-09-24 12:17:45 +08:00
yetone 402a96c39d Rename dial to magpie, with a magpie for a logo
The product, module path (github.com/yetone/magpie), binaries, env vars
(MAGPIE_ADDR, MAGPIE_DEV_UI, MAGPIE_THEME, MAGPIE_DEBUG), config and cache
folders (~/.config/magpie, ~/.cache/magpie), bundle id (com.yetone.magpie),
gateway provider id and token, and every UI string now say magpie.

On first run magpie copies ~/.config/dial and ~/.cache/dial to the new
folders when they don't exist yet (copy, not move, so a still-running dial
keeps working; the old folders can be deleted by hand later).

The logo is a small round magpie in profile: one path for the header and
the tray, and the app tile adds the white belly and the blue-green tail.
The header mark is drawn in ink rather than the accent colour, which
fought the text in light mode.
2026-09-23 23:55:11 +08:00
yetoneandClaude 0a234ce41d dial: one dial for every coding agent's model
Wails v3 tray panel and window, TUI and CLI. Switches model, effort and
provider for Claude Code, Codex, Gemini CLI, OpenCode, Pi, Goose, Cursor,
Copilot CLI and Crush with format-preserving config edits. Providers page
and registry, stored keys, live vendor model lists, profiles.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-22 21:47:29 +08:00