Files
plugins/packages/day-card
yetone 7a28b38870 day-card 0.1.2: a day just begun reads <0.1×, an app's drawn icon prints as a drawing
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.
2026-11-10 02:10:30 +08:00
..

@magpie-community/page-day-card

A page in magpie's window that prints a day of your AI usage as a receipt, a "Daily AI statement" on paper over a teal ground. 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. 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. Pick an earlier day with the arrows or the date's menu.

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.

What it reads

Only usage:day, the one permission its package.json declares (magpie.permissions): a day'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/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 窗口里加一个「每日用量卡」页面,把某一天的用量打印成一张小票(Daily AI Statement):当天按 API 价计的费用、连续使用天数、请求数、错误数、与此前日均的倍数,每个 Agent 及其模型(带图标和费用),以及输入、输出 token 和缓存命中率。可以「复制图片」到剪贴板,或「保存 PNG」到下载文件夹。只读取声明过的 usage:day,运行在无网络的沙盒 frame 里。