Files
plugins/packages/day-card
yetone 7da596030e day-card 0.3.5: the day menu lists every day after a past day or span, not today above it (shangyuan0818 on X)
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.
2026-11-14 09:14:12 +08:00
..

@magpie-community/page-day-card

A page in magpie's window that prints a day of your AI usage (or a week, a month or all of it) as a receipt, a "Daily AI statement" on paper over a backdrop of your choice. It has the day's API-equivalent cost, your streak, requests, errors and the day against your average day before it, then each agent and its models with their logos and costs, and the day's tokens: input, output and the cache hit rate. Its foot credits nowdex, whose share card the receipt's design follows. Background picks what the paper lies on: nothing (the paper alone, a transparent PNG), teal, fifteen patterns (gingham, graph paper, kraft, cyanotype, seigaiha waves, xuan paper and more), four landscape photos, or a picture of your own (pick one, drop it on the page or paste it; the × at its corner removes it). A slider sets the margin around the paper; a photo also has blur and dim. The choice is kept in the plugin's options. Copy image puts the card on the clipboard; Save PNG saves it in Downloads.

Install it from magpie's Plugins › Discover, or with magpie plugin add @magpie-community/page-day-card. It then has a tab, Day card (titled in the window's language: 每日用量卡, 1日の使用量カード, Tageskarte), under Plugins in the sidebar, in the app and in magpie web. The switch at the left picks Day, Week (the seven days ending on the date shown), Month (the thirty) or All (every day with calls, up to today); a week's or a month's card has its period, the days that had calls and the cost of one such day in place of the streak against an average day. Pick an earlier day, or the date a week or month ends on, with the arrows (which step a whole week or month) or the date's menu. The card is shown as large as fits under the toolbar, so a whole day is on one screen; the picture you copy or save is full size.

It needs a magpie with the usage:day read and magpie.image (see engines.magpie). An older magpie refuses the read, and the page says to update; one from before the week, month and all-time spans (a from in usage:day) shows days only, and says to update when you pick another.

What it reads

Only usage:day, the one permission its package.json declares (magpie.permissions): a day's (or a span's) totals, each agent's and model's, the days before it that had calls, and the agents' and providers' logos. Nothing in it is a key, an account, a session or a prompt.

Like every plugin page, it runs in a sandboxed frame with no network (connect-src 'none') and no inline scripts. The card is drawn on a canvas, the same in a light or dark theme, and its PNG goes to magpie through _magpie/bridge.js. In magpie web the browser copies or downloads it itself.

Files

  • page/index.html, page/style.css: the page.
  • page/view.js: what the card says, in English, 简体中文, 繁體中文, 日本語 and Deutsch, with no DOM. The test loads it.
  • page/app.js: reads through the bridge, draws the card, copies and saves it, and refreshes today's every minute.
  • page/backgrounds.js: the backdrops, drawn on the canvas, and what a saved choice may be.
  • page/bg/: the four photos and their thumbnails, as JPEG data in scripts the page loads when it needs them. A picture the frame loads from a URL would taint the canvas, and the card could no longer be copied or saved.
  • page/fonts.js: the receipt's face, a subset of JetBrains Mono 2.304 as woff2 data (page/fonts.LICENSE.txt, SIL OFL 1.1). The frame can't fetch a font file, so the page loads these bytes with FontFace.

Test

bun test packages/day-card

中文:在 magpie 窗口里加一个「每日用量卡」页面,把某一天(或最近 7 天、30 天、全部)的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。小票底部注明设计灵感来自 nowdex。「背景」可以换成 15 种图案、4 张风景照片或自己的图片(选择、拖入或粘贴,角上的 × 可删除),边距可调,照片还可调模糊和压暗。左上角的开关切换「日 / 周 / 月 / 全部」。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 usage:day,运行在无网络的沙盒 frame 里。