/** * 会话成本 (session-cost) — what THIS session has cost, in the money of the rule * that priced it, with the rule's provenance printed beside it. * * WHY THE CARD EXISTS: official DeepSeek pricing pays 0.02 CNY/M for a cache HIT * and 1 CNY/M for a MISS — a 50× spread inside ONE session's input. Nothing on the * rail folds a session into money today (会话 Token prints counts only, and money * in this repo has so far belonged to the Command Code plan family, which prints * plan occupancy, not session spend). This card is that missing reading. * * THE FOUR ELEMENTS, AND WHY EACH SITS WHERE IT DOES: * `会话成本` the blue title (the card's name, not the widget's market name); * `≈$0.131` the FIGURE row — the session's amount, or the token total when * no rule would price it (`headAfter.big`, never `value`: a card * with a headAfter head owns exactly one figure, and `value` * would be pushed into the body and printed twice); * `官方价 · …` the grey caption — the amount's PROVENANCE first (`sourceType` * localized) and the model name after it. This is the card's * discipline made visible: money never appears alone; * the three rows the buckets the amount was folded from — 未缓存输入 / 缓存读取 * 输出 — with each bucket's own share of the money in the * renderer's reserved third column. They sit on the card's floor * (`bodyAnchor: 'bottom'`), the posture every detail-row card in * this repo uses. * * THE `≈`: as soon as a rule publishes a peak/off-peak split, folding a whole * session at one band is an ESTIMATE — the session record carries no per-request * timestamps, so "how much of this ran inside 01:00–04:00 UTC" is not knowable from * the data this card is given (see `pricing.ts`). The card marks the figure with `≈` * and puts the full reason on hover (`cardHint`) rather than splitting the session * by an hour it cannot see. WHEN NO RULE MATCHES, the amount column is EMPTY — not * `—`, not `$0.00` — because an empty cell says "there is no number here", while a * zero would claim the session was free. * * TONE DIRECTION — this card is a READING, and it sets NO tone at all: spending more * is not bad, and a free route is not better. Literally nothing here passes a `tone`, * which is the whole statement. (The only colour in the card is the renderer's own * grey for the money column, which is a hierarchy, not a verdict.) */ import { defineWidget } from '../../client/lib/contract/helpers'; import type { WidgetRenderMeta, WidgetStats } from '../../client/lib/contract/types'; /** `Session Cost` — the card, as one pure function of the merged stats. * * The clock is read here (`Date.now()` through `new Date()`), which the contract * allows and the peak verdict needs: the rate band of "now" is part of the answer. * A preview may pin it with `meta.sim.at` (an ISO instant) so a screenshot of a * peak-band fold is reproducible instead of depending on when it was taken. */ declare function sessionCostRender(stats: WidgetStats, meta?: WidgetRenderMeta): ReturnType['render']>>; declare const _default: { id: string; name: () => string; desc: () => string; builtin: true; group: string; sizes: "2x2"[]; simToggle: () => string; render: typeof sessionCostRender; example: { stats: typeof previewStats; sim: { noTable: boolean; at: string; }; simSteps: ({ noTable: boolean; at: string; } | { noTable: boolean; at?: undefined; })[]; }; }; export default _default; /** * The preview's stats — declared HERE, below the descriptor, on purpose. * * `gen-registry` derives a unit's id from the FIRST `id: '…'` literal in * `index.ts` (dir === manifest.id === that literal). The mock rules below need * `id` fields of their own, so this function must not appear above the descriptor's * `id: 'session-cost'` in file order. A function declaration is hoisted, so the * reference in `example` above works. Moving this block up breaks the build. * * The mock mirrors the REAL table's shape (v2 / USD / the shipped V4.1 Flash * official rule) plus three decoys that make the selection visible in a screenshot: * - `example-retired-v4.1-flash-twin`: same provider AND model, retired * `effectiveTo: 2026-09-10`, at DOUBLE rates. If the effective-window sieve ever * stops working, the preview immediately doubles — a visible failure instead of * a silent one; * - `example-reseller-same-model`: the same model on provider `opencode-go` * (a real route on this machine) — proves the provider must match too; * - `example-local-wildcard`: provider `ollama`, model `*` — proves the wildcard * matches only its own provider rather than everything. */ declare function previewStats(): Partial;