e4e9eb0928becfa4e48484dde85ef5032671d582
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
459d668b35 |
sync: pick what syncs, preview a sync, undo the last one (#6428)
jinpwng (#6428, on X) syncs two computers and wants only Library and memory to go between them: each keeps its own providers, settings and models. They also want to see what a sync would change before it applies, and to roll the last one back. What syncs: providers, settings and profiles now have switches like agents' models, library and memory (Config.Providers/Settings/Profiles, *bool, nil = synced as before, so an existing setup syncs exactly what it did). The sync form shows Providers (and its API keys), Settings and Agents' models up front; Profiles, usage and sign-ins sit under Advanced, closed unless one is set away from its default. The form sends a part's choice only when it is or was off. A part left out stays as it is here and on the server; turning it back on joins it like a first sync (st.Off, rejoin). The sync's line says which parts each computer keeps ("Stays as it is on each computer: ..."). The setup text and the CLI carry it: magpie <webdav|s3|github> set providers=no settings=no profiles=no. Preview: davsync.Preview (plan.go) says, per part, what syncing now would bring in, send up, or leave; library items and memory files by name, sign-ins and plugins gone. Preview... in Settings > Sync shows it, and Sync now from there runs SyncPreviewed(token): if the server or this computer changed since, it says so and shows the new plan instead of syncing something else. CLI: magpie <kind> preview. Undo: a sync that brings parts in records them (st.Applied) and keeps a sealed copy of this computer first (keepSealed, as Restore does). Undo the last sync puts those parts back from that copy, on this computer only (st.Local, so the next sync sends it up rather than fetching the server's again). If one of them changed here since, it asks first (409 changed, Undo anyway). CLI: magpie <kind> undo-sync [anyway]. Restore's own Undo is unchanged. docs/subsystems/sync-backup.md and the site's sync docs (en, zh, ja) have a section on it. i18n: zh, zh-TW, ja, de. Run (worktree at base |
||
|
|
281a7e024f |
sync: a computer can follow the server, taking its setup and sending none (Ramon317317 on X)
Ramon317317 asked for a main profile: one computer the others take their
setup from, so they never drift apart. Sync merged both ways only;
Restore is a one-time pull and an agent's own fields cover agents only.
A computer can now be set to follow the server (Settings -> Sync -> This
computer: Both ways / Follows the server; /api/davsync/follow-server;
`magpie webdav|s3|github follow on|off`). It is chosen per computer and
kept in sync.json (Config.FollowServer, kept by Configure like AutoEvery).
A following computer:
- takes every changed part from the file, whichever side is newer;
- never writes the file: no push, no merged sign-in, no rebuild of a
damaged file;
- keeps a change made on it in the sync folder, as a join does, and the
notice says it was replaced because this computer follows the server
(Notice.Followed; GUI and CLI);
- still keeps an unset part on the server from emptying its own, and own
agent fields and agents only here;
- refuses to follow a server with no file yet, sending nothing.
The computer followed stays two-way; nothing changes for anyone who
doesn't pick it. Usage sharing is unchanged. docs/subsystems/sync-backup.md
says so.
app.js stays inside the core script budget (TestCoreScriptBudget) with
no raise: renderSync's comments are cut down to pay for the row.
Run (mote, at this head):
- go build ./...; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./...; gofmt -l clean.
- go test ./internal/davsync ./internal/cli ./internal/gui: ok (cli
with the route guard fix committed beside this one).
TestFollowServer (empty server, join, own change replaced and kept,
both changed, unchanged sync, Configure keeps it, back to both ways)
and TestFollowServerSendsNoSignIn are new.
- GUI (node --test, Chromium and WebKit): sync-follow-server (new; en and
zh, 900px and 400px: name, sub, picked segment, the post, the notice,
no scroll, no overflow, no select, re-pick posts nothing), plus
sync-auto-restore, sync-note-show, sync-own-fields, sync-not-backup,
sync-other-kind, sync-signins, sync-spin, i18n-keys, i18n-en-no-cjk,
gui-zh-tw, gui-ja, gui-de: all pass.
Broken by hand:
- push guard removed: TestFollowServerSendsNoSignIn red ("sent its
sign-in: 1 puts").
- follow branch off: TestFollowServer red ("b's own change stayed:
[deepseek=k1 kimi=kb2]").
- the row's click not posting: sync-follow-server red, 8 of 8.
Not tried: a real WebDAV, S3 or GitHub server (fake servers only); two
real computers; Windows run of the tests (vet only). The full suite starts
after the tag.
|
||
|
|
900ae0fa51 |
backup, sync: sign-ins go too when picked, sealed, never over a later renewal
qianxunji (#feedback) and curtinp118 on Discord: a VPS restored from a backup, or a new computer joining sync, had to sign in to every subscription again. Sign-ins (subscription accounts in logins.json, Codex's auth.json, plugins' sign-ins in plugin-auth.json) can now go too, in each place only when picked; all are off by default, so an upgrade carries nothing new. - Sync (WebDAV, S3, GitHub): a "Sign-ins" tick in the form, with a line saying anyone with the passphrase and the server's file can use the accounts, and that an account on two computers can be signed out on one when the other renews it. CLI: `magpie webdav|s3|github set sign-ins=yes`. - Export: "With the sign-ins", off; ticked, the passphrase hint says the file holds them. CLI: `magpie backup --sign-ins`. - Import: "Bring in the sign-ins too, when the file has them", on. CLI: `magpie restore --no-sign-ins` leaves them out. - Back up by itself: "Sign-ins in backups", Off/On. On asks for a passphrase (twice) that seals the sign-ins alone (the rest of an automatic backup stays unsealed, as before); it is kept in autobackup.json (0600), never sent in the view. A backup whose sign-ins another passphrase sealed restores without them and says so. What goes (provider.CollectSignIns, plugin.CarriedAuth): magpie's own copies only, not an agent's own account, an agent-home row, a hidden or plugin: row, or a retired built-in. Each record is keyed by agent + email + org (or the account key); ids two rows share go on neither side. Restore/import (RestoreSignIns) adds what is missing and updates only when the incoming copy was renewed later; nothing here is removed. Before writing over a row it counts every row that could be the same account (same login, same refresh token, same id): none adds, several keeps all, one is kept when it isn't magpie's own copy, is held, or is the agent's live account. Codex's auth.json is written temp-and-rename, 0600, only where Codex is signed out. Sync merges per record against the last sync's hashes (MergeSignIns): the later renewal wins; a removal crosses only when the other side still had it as of the last sync; ApplySignIns re-checks each row's hash before writing so a renewal in between is kept. A computer with the tick off sends none, so others remove nothing for it; turning it off, a Restore, or a replaced server file clears the last-sync record. Export's and Import's forms moved out of app.js into syncfiles.js, imported when one opens (as autobackup.js is), so the core is 3.2KB under its budget with no raise (app.js 3.2KB smaller than before). docs/subsystems/sync-backup.md has a "Sign-ins, when picked" section; subscription_signin_test.go's header now says it pins the default. Run at the pushed head (678d28cba on origin/main |
||
|
|
fad96ea0fe |
gui, cli: sync and backup say the synced settings use a subscription not signed in here, and that one not used here needs nothing (悠悠哥 on Discord)
悠悠哥 asked why the sync card said ChatGPT wasn't signed in. The line was
right (the synced settings carry ChatGPT's picks, and this computer has
no ChatGPT account; sync carries no sign-in) but didn't say why ChatGPT
was named or that it can be left alone. It now reads "Your synced
settings use {names}, which isn't signed in on this computer. Sync
carries settings, not sign-ins: to use it here, sign in in Providers →
Add a provider; if you don't, nothing needs doing." The backup import's
sibling says the same of the backup, in en, zh, zh-TW, ja and de, and
the CLI's `magpie webdav` status and `magpie backup import` lines say it
too. Which subscriptions are named is unchanged.
Run:
- sync-sign-in.test.cjs, now with zh-TW and widths 1100/900/440/420:
chromium + webkit, 40/40; screenshots of zh at 420 looked at.
- go test ./internal/cli: ok. go test ./internal/gui: ok except
TestMainWindowCorners killed at its 40s deadline (load average ~180),
which is #1936; alone it passes (36s).
- gofmt -l clean; go vet darwin, windows, linux -tags nogui on cli.
Not tried: the real app with a real WebDAV sync.
|
||
|
|
b8e23db45a |
backup, davsync: an import or a sync installs the plugins and names the subscriptions to sign in to (yapechan)
yapechan on Discord (Windows, Synology WebDAV): after an import or a WebDAV
sync no providers showed on the other computer; adding the same provider by
hand made the synced settings and usage apply. No error, a restart didn't
help.
Cause. A backup and a sync carry providers.json as stored. For a
subscription that is its model picks and settings alone (no endpoint, no
key), and sign-ins are never carried by design; allProviders lists such an
entry only once an account is signed in here. plugins.json was not carried
at all, so a provider served by a plugin (every moved subscription, any
plugin provider) had nothing to come from on the other side. The import
said "N added" and "Needs a key: , " (the picks entries have no name and no
key), and the sync said nothing. API-key providers do come over: tried with
a nogui build in two sandbox HOMEs (DeepSeek, a custom relay, Kimi Code all
listed after `magpie restore`). No Windows-only path issue found.
What changed:
- provider.Carried(keys): the plugins added from npm or git, on/off and
their options (without keys, options whose names look like a key are left
out, as secret headers are). Folder plugins and plugin-auth.json stay.
- backup.Bundle.Plugins (nil from an older magpie). Restore installs the
ones not here through provider.AddPlugins (plugin.Add, then Off and
Options, then HandOver once); it never removes or changes one already
here. A failed install is reported, not a failed restore.
- Result.SignIn / provider.NotSignedIn: the subscriptions brought with no
account here. NeedKey no longer lists picks-only entries (provider.OnlyPicks).
- davsync: the providers part's hash covers the plugins (unchanged for a
setup without any), take/bring carry them, bring installs (logged on
failure), and Status().SignIn names what to sign in to.
- CLI restore and `magpie webdav`/`s3` status print both; the GUI's import
result and the sync row show them (en, zh, zh-TW, ja, de).
- docs/reference.md says what a backup carries now.
Run:
- go test -tags nogui ./internal/provider ./internal/backup ./internal/davsync
./internal/cli ./internal/gui in a sandbox HOME.
- New tests fail with the change broken by hand: TestPluginsCarried
(installed-skip and the HandOver guard), TestNotSignedIn,
TestRestorePluginsAndSignIn ("Needs a key: [ Acme]" without OnlyPicks),
TestSyncPluginsAndSignIn (bring not installing, Status not naming),
sync-sign-in.test.cjs (the lines removed).
- sync-sign-in.test.cjs: Chromium and WebKit, en/zh/ja/de, 900 and 440px,
16/16; it also caught subNames throwing while providers was still null.
sync-*.test.cjs, s3-sync, i18n-keys, gui-ja, gui-de pass.
- gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui on the
touched packages.
Not tried: a real plugin install from a real sync (the installs are stubbed
in tests); a real Synology server.
|
||
|
|
f82aba090b |
davsync, gui, cli: GitHub sync refuses a repository that isn't private (#1130)
The sealed setup is committed on every sync, so a public repository would hand anyone every version of it, the whole history, to try passphrases on offline. prepare now reads the repository's "private" field and refuses before writing when it is false or missing, naming the repository and what to do. The form's hint, the CLI usage and docs/reference.md say the repository must be private; sync-backup.md lists the rule and its verification command now points at ./internal/cli. Run: go test -tags nogui ./internal/davsync/ and the cli tests (TestGitHubCmd|TestWebdavCmd|TestS3Cmd|Help) green; TestGitHubPublicRepositoryRefused goes red with the check removed. GUI: github-sync, s3-sync, webdav-settings-refresh, sync-other-kind, sync-not-backup, i18n-keys, gui-zh-tw, gui-ja, gui-de in Chromium and WebKit, 72/72. Not tried against the real GitHub API. |
||
|
|
1af326806f |
sync: magpie's setup syncs to an encrypted file in a GitHub repository, beside WebDAV and S3 (#1130)
A third sync kind: github://owner/repo[/folder] keeps the same sealed backup WebDAV and S3 keep, as <folder>/magpie/magpie.magpie-backup in a repository the user already has, written through GitHub's Contents API with a fine-grained token of its own (Contents read and write), kept in sync.json apart from the library's GitHub token. The token goes only to api.github.com: a redirect anywhere else is refused, and the passphrase may not equal it. Each update is a commit; an empty repository is initialised by the first backup. Settings › Sync gets a GitHub kind with Repository, Branch, Folder and token; magpie github mirrors magpie s3. Inactive servers of every kind are kept in Config.Servers (Other stays for older clients). Squashed from yetone/magpie#1130 at 6b5b1c693e1a3a23e177b4d376f3f7f70f3bc23d onto main. Merge resolutions: the CLI moved to internal/cli since the PR was cut, so github_cli_test.go moved there (package cli) and the github command, its help line and `magpie help github` were wired in internal/cli/main.go and help_cli.go; README's Sync row kept main's links and took the PR's wording; i18n.js zh-TW kept both sides. |
||
|
|
23e764d0e0 |
cli: magpie's commands move from the root into internal/cli; the root keeps only main.go
The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error |