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.
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.
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).