The reporter (Windows) picked an earlier date range; the day menu then
listed today first and the range's last day second, as if no day between
had calls. usage:day's days stop at the date read (usageapi.SpanOf:
h.Date <= date), and the menu put today on top of them. A day or span in
the past now reads today's days for the menu (one more usage:day read,
date "", on opening it) and V.menuDays merges both, newest first, today
on top, the newest 120 and back as far as the day shown. If that read
fails the menu lists only the days it has, with no today above a gap.
Chosen over leaving today out: the menu is how you get back to a later
day, and today was always on it.
Run on mica (mote's load was over 18) at 76cfb7fe + this change:
- HOME=$(mktemp -d) bun test (whole repo): 8717 pass, 0 fail.
- bun scripts/check.mjs: exit 0.
- day-menu.gui.mjs (new, real page, stub bridge answering as SpanOf):
all ok in Chromium and WebKit, day, week and month.
Broken by hand: with the old menu logic moved into V.menuDays unchanged,
the new unit test is red (today then 11-01, 11-06..08 missing); with
origin/main's app.js and view.js, day-menu.gui.mjs FAILs "chromium day to
11-01" with 2026-11-09 2026-11-01 2026-10-20, the reporter's case.
Rebased onto 4170d0e8 (antigravity/agy-cli only, no day-card change).
Not tried: the live magpie window on Windows.
The menu hangs from the Background button's right edge. Where the page is
narrow enough for the toolbar to wrap (about 1000px and less), the button
sits at the left and the 292px menu ran off the page's left edge: at
900px it spanned -105..185, and the first column, the reader's own
picture with its new remove badge among them, couldn't be reached. On
open it now hangs from the button's left edge (#bg-pop.left, origin top
left) when the button's right edge has less room than the menu's width.
Found while checking 0.3.3's badge.
Run on mote at 4191c523 + this change:
- bg-delete.gui.mjs, now at 1200, 900 and 420 wide with a check that the
menu is within the page: 600 ok, all ok (Chromium and WebKit, five
languages, mouse and touch).
- HOME=$(mktemp -d) bun test packages/day-card: 19 pass, 0 fail.
- bun scripts/check.mjs: exit 0.
The whole repo's bun test ran green at 4191c523 (8662 pass); this change
touches only day-card's page and its GUI script.
Broken by hand: without the toggle, "menu within the page" FAILs at
900px (-105..185).
Not tried: the live magpie window.
A picture added in Background stayed for good. Its swatch now carries a
small × badge at the top-right: shown on hover with a mouse (gated by
hover: hover and pointer: fine), on keyboard focus (focus-within), and
always where there is no hover (touch). The badge is its own button
beside the swatch, not inside it. Removing the picture drops it from the
saved plugin options (pick({ image: "" }), the 1.1s debounced
options.set); a card drawn on it goes back to teal through norm, a
picture not in use leaves the backdrop alone. The menu stays open (the
click is stopped before the outside-click closer sees a detached target)
and focus moves to the + button. No confirm dialog: adding it back is one
pick away. Badge fades and grows from scale(.9) in 150ms on the strong
ease-out; reduced motion keeps the fade only. Name in all five
languages.
Run on mote at 4f5d4138 + this change:
- HOME=$(mktemp -d) bun test (whole repo): 8662 pass, 20 skip, 0 fail.
- bun scripts/check.mjs: exit 0.
- new bg-delete.gui.mjs (Chromium and WebKit, en/zh/zh-TW/ja/de, mouse
and touch, 1200x800): 180 ok, all ok. Checks the badge's name, hidden
without hover, shown on hover and on focus, at the corner, always shown
on touch, menu open after, teal picked, focus on +, saved options
without the picture, no page errors.
Broken by hand: without the stopPropagation, "menu stays open" FAILs in
every case; with :focus-visible on the wrapper in place of :focus-within,
"badge shown on focus" FAILs. The script needs the badge, so it fails on
the old page.
Not tried: the live magpie window. Seen on the way: at a page width where
the toolbar wraps (900px), the Background menu runs off the page's left
edge, so the picture's swatch can't be reached; fixed in the next commit.
ZacharyZhang on X: Cindy's logo printed as a black rounded square. Its
icon is a full-colour illustration on a rounded tile with clear corners.
drawIcon took anything under 80% solid and without a light ground for a
mark and filled its shape with the ink, so the whole tile went black.
mlx-serve (a jellyfish on a dark tile) and mothx (a glyph on a pink
disc) did the same.
Now an icon that fills its own box (a square, rounded or not, or a disc:
at least 75% of its bounding box, and the box at least 40% of the icon)
is a tile. A tile with no light ground prints in greys from its own
darkest tone (3rd percentile) to its lightest (97th), ink to paper; a
tile of one flat tone still takes the old near-white threshold. Marks and
pictures on a light ground print as before.
Run: a harness drew 18 icons (magpie's PNG agent icons, several colour
SVG logos and the bundled Amp mark) with the old and new drawIcon at 18px
x3 in Chromium and WebKit (Playwright 1.62.0, wsl-run on magpie-desktop),
no page errors. Changed: cindy, mlx-serve, mothx now show their picture;
atomcode is a grey tile instead of a black one. Every other icon is the
same as before. bun test packages/day-card: 18 pass, 0 fail.
Not tried: the real magpie app's webviews; crush's pixel heart still
prints as a ragged silhouette, as before.
Adds packages/amp-usage (@magpie-community/page-amp-usage 0.1.0). It is a magpie page that reads Amp's local thread files and the gateway's usage.jsonl and shows per-day usage. The service listens on loopback only and requires a per-start service token on every API call. The page that carries the token is served only to a navigation (Sec-Fetch-Mode). The gateway log is read incrementally from a saved offset, whole lines only, and is re-indexed on rotation. The UI words are in ui/words.js (en, zh).
Also bumps packages/day-card to 0.3.1.
Round 3 (13c1f33) adds three things:
- a test that bytes before the gateway-log offset are never re-read;
- ui.test.mjs, which checks that every error code the server can return has words in each language, and that an unknown code falls back;
- words.js, moved out of app.js, served at /words.js and included in the pack.
What ran, at 13c1f33 merged with main 14187408, on mica:
- amp-usage `node --test`: 47/47.
- `bun test packages/amp-usage packages/day-card`: 65 pass, 0 fail.
- `bun scripts/check.mjs`, all packages: ok.
- `npm pack --dry-run`: amp-usage 0.1.0 has 19 files including ui/words.js; day-card 0.3.1 has 17 files.
- Root `bun test` with a temp HOME: 8362 pass, 0 fail (8382 tests, 590 files).
- Render smoke in Chromium and WebKit at 1200 and 420px, en and zh: words.js loads, both languages show their own words, no page errors, no horizontal overflow.
Broken by hand, each run with node and bun:
- collector.mjs:102 made to re-read the whole file every scan: the new offset test goes red.
- `const cut = buf.length`, so a partial line is taken: red.
- Raw error codes shown instead of their words (`w.err[code] || code`): red.
- A zh string deleted: red.
Not tried:
- A real Amp account or the real `amp` CLI.
- Changing the auto-refresh default from 300 to 60 fails no test. The author left it untested and round 2 called it optional.
Rounds 1 and 2 also ran the 1M-line log probe (rss steady at about 363MB, scans of 70 to 114ms after the first), the bad-record and paging probes, and the full render matrix including dark mode.
usage:day takes a from (magpie with usage:day's span read); the page asks for the seven or thirty days ending on the date shown, or all, and prints the period, the days that had calls and the cost of one, in place of the streak against an average day. Arrows step a whole week or month. A magpie that answers a day and no from says to update. 0.3.0.
Run: bun test packages/day-card (17 pass, the new test red before the view change).
randyloop on X pointed out the card looks just like nowdex's share card.
Its foot now has a small muted line under the magpie footer, in every
language the card speaks: "Design inspired by nowdex.app" (设计灵感来自 /
設計靈感來自 / デザインは…に着想を得ています / Design inspiriert von).
The README says so too.
Run: bun test packages/day-card on mote (HOME=$(mktemp -d)): 16 pass; the
new check is red without the credit field. Rendered the page in Playwright
Chromium and WebKit with a stub bridge in en, zh, zh-TW, ja and de and
looked at the PNGs: the line sits centred under the footer, inside the
paper, no page errors.
Not tried: the page inside the real magpie window.
volare18467257: add a no-background option first in the list, and let the
card scale, since it didn't fit one screen.
- Background now starts with "No background": the paper alone on nothing,
a transparent PNG with no margin (the margin slider is hidden for it),
swatched as a chequerboard. Named in all five languages. The default
stays teal.
- The card on the page is sized to the room under the toolbar (B.fit:
width up to 760, no taller than the window, never below 160), on resize
and when the toolbar or status line changes height. The bitmap copied
or saved is unchanged.
Run: bun test packages/day-card in wsl-run, 16 of 16 green; scripts/check
exit 0. A Playwright harness (not committed) with a stub bridge in
Chromium and WebKit: at 1000x600 the card is 403px wide and ends at 568 of
600, with no page scroll; at 1000x900 it is 650 wide, ends at 867; picking
No background gives a 880x1130 bitmap (no margin) and hides the margin
slider, no page errors. Broken by hand: with backgrounds.js from main the
new test is red.
Not tried: magpie's own window on Windows/Linux; the transparent PNG
pasted into an app.
paintPicker called pop.classList.toggle("photo", B.meta(bg.bg).photo).
A pattern's photo was undefined, not false, and toggle(name, undefined)
flips the class. So each input event of the margin or blur slider hid
or showed the blur and dim sliders in turn. The reporter saw both
states with the teal backdrop picked.
Every backdrop's photo is now a boolean, and the toggle asks for
=== true.
Run, on mote:
- bun test packages/day-card: 15 pass. bun scripts/check.mjs: exit 0.
- A Playwright repro (not committed) loads the page with a stub bridge,
picks teal, fires input on the margin slider four times, then picks
alpine and drags blur, then goes back to teal. In Chromium and WebKit
the old page shows blur as false,true,false,true,false. The new page
keeps it hidden on teal and shown on alpine on every tick.
Broken by hand: with backgrounds.js from main, the new test goes red
(1 of 15).
Not tried: in magpie's own window on Windows, where the reporter is.
Reported-by: lbjxr
The card was always a receipt on a wide teal ground. A Background button
in the toolbar now opens a menu of 19 backdrops, all drawn on the canvas
the card is saved from:
- teal (as before), and 14 patterns: gingham, graph paper, kraft,
cyanotype, night dots, deckchair stripes, olive linen, seigaiha waves,
xuan paper, zigzag, terracotta, lilac lines, green velvet, apricot
polka;
- four landscape photos (alpine dawn, misty shore, dunes, forest lake),
1000x1500 JPEGs made for this plugin;
- a picture of the reader's own: pick it, drop it on the page or paste
it.
A slider sets the margin around the paper (24 to 160, 76 by default, in
place of the old fixed 207 a side and 4:3 height). A photo also has blur
and dim. The paper's shadow follows the ground.
The choice is kept in the plugin's options (magpie.options): saved a
moment after a slider settles, since magpie takes one write a second.
The reader's own picture is shrunk to a JPEG of at most ~44KB, within
the 64KB magpie keeps for a plugin's options.
The photos are JPEG data in page/bg/<id>.js, loaded when picked, not
image files: the frame's origin is opaque, so a picture loaded by URL
would taint the canvas, and Copy image and Save PNG would fail.
Thumbnails are in bg/thumbs.js, loaded when the menu first opens.
Run: bun test packages/day-card on the Linux test box (magpie-desktop,
via wsl-run; mote refused SSH at the time): 14 pass, 2 of them new
(names in every language and the photos' data; a saved choice made
sound). A Playwright harness served the page with magpie's plugin-page
CSP (sandbox allow-scripts, img-src own data:, connect-src 'none') and
a fake bridge, in Chromium and WebKit: each of the 19 backdrops drew
and saved a PNG through magpie.image (so the canvas was not tainted),
the menu picked dunes and saved {bg: dunes, pad: 120}, the blur and dim
sliders showed only for a photo, and a 2400px JPEG of one's own was
stored as 36-43KB data and drawn. No page errors in either engine. The
first run showed the menu's sliders over the card while closed
(display: flex beat [hidden]); fixed and run again.
Not tried: the real magpie app (WKWebView, WebKitGTK, WebView2), its
real options store, and the native file picker inside the frame.
Found by trying Copy image and Save PNG in the real app with real usage:
- VS AVERAGE DAY read "0.0×" early in a day ($0.07 against a ~$180
average). Any ratio above 0 and under 0.1 now reads "<0.1×".
- Alma's icon (a drawing on its own light ground) printed as a black
square, because every colour icon was filled with the ink. A picture
that is mostly light with something dark drawn on it now prints in
the ink with its near-white parts left the paper's colour. Mono logos
and colour marks with no ground of their own (Claude, DeepSeek) are
still filled solid.
Run:
- mote-run bun test packages/day-card: 12 pass, 0 fail (two new
versus cases: 0.07/180 → "<0.1×", 0.5/5 → "0.1×").
- Real app: magpie 0.1.3443 (/Applications) in a sandbox HOME on
127.0.0.1:3486, the owner's usage.jsonl copied in, this app.js and
view.js in the installed package. The page shows "<0.1×" and Alma's
drawing; Claude and DeepSeek marks unchanged. Copy image showed
"Copied" and put a 1708x2278 PNG on the clipboard; Save PNG said
"Saved to ~/Downloads/magpie 2026-11-10-2.png" (the first save's
file kept, not overwritten), byte-identical to the clipboard PNG.
Not tried: Windows and Linux webviews.
A user installed the Day card and found it looked nothing like the
receipt in https://x.com/jasonaxb/status/2119432517170430196, and asked
for the same look. The card is now that receipt, with magpie's words in
place of the original's own:
- cream paper over a teal-to-mint ground, a zigzag torn bottom edge
and a soft shadow; heavy monospace, letter-spaced labels and dashed
rules;
- DATE and ISSUED, then the TOTAL API COST (API-equivalent, not an
invoice), then STREAK, REQUESTS, ERRORS (only when there were any)
and VS AVERAGE DAY (cost against the mean of the active days before
this one; tokens when nothing was priced);
- AGENT / MODEL with logos printed in ink, by cost; then TOTAL TOKENS,
INPUT, OUTPUT and CACHE HIT RATE;
- the original's tagline and App Store footer are magpie's own lines,
and its RANK is left out: magpie has no ranking to read.
The frame can't fetch a font file (sandboxed, opaque origin), so the
face is a subset of JetBrains Mono 2.304 (OFL, license beside it) as
woff2 data in page/fonts.js, loaded with FontFace. About 13.5KB per
weight, 400/700/800.
The average now leaves out the day itself, and money(0) reads $0.00.
Run, on mote at this tree:
- bun test packages/day-card: 12 pass (tests rewritten for the receipt:
fields, cost order, versus, dates with a held clock, fonts.js is
woff2 and loads before app.js, only usage:day is read).
- bun test scripts: 22 pass; bun scripts/check.mjs: exit 0.
- The page in a sandboxed frame under the page CSP, with the
reference's numbers and real magpie icons, in Chromium and WebKit
(Playwright 1.62.0), en, zh, de and ja: all three weights load, no
page errors, the long German title shrinks to fit; the English card
checked side by side with the tweet's image.
Not tried: the real magpie app's WKWebView, and Copy/Save from it.
A new page plugin, @magpie-community/page-day-card, for JungleyYeh on X,
who asked for a "daily AI statement".
- It shows a chosen day (today by default, others from a date menu): its
tokens, cost, calls and errors, then each agent with its models and
icons. Below them come the streak, the average active day and the last
two weeks.
- Copy puts the card on the clipboard as an image; Save writes it as a
PNG.
- The design is quiet, with no gradients and no coloured accents, in
light and dark. It speaks en, zh, zh-TW, ja and de.
- It asks for one read, usage:day, and needs magpie 0.1.3427 (623e797fd)
for that read and for magpie.image.copy/save.
What was run (mote):
- bun test packages/day-card: 11 pass, 0 fail. Before engines.magpie
was set, the guard test was red on the placeholder.
- bun scripts/check.mjs: exit 0.
- Real use: the page in magpie's real GUI server with a sandbox HOME
holding a copy of real usage, in Chromium and WebKit, light and dark,
en/zh/zh-TW/ja/de, at 420 and 1100 px, with an earlier day picked and
Copy pressed. No page errors (magpie 623e797fd's body has the rest).