Commit graph

6 commits

Author SHA1 Message Date
Resham Joshi
4d1da1a6f0
feat(sessions): mark sessions kept after their transcript was removed (#1868)
* feat(sessions): mark sessions kept after their transcript was deleted

When a write refresh keeps a cached session whose source file is gone
(a Claude session with PR links, or a copilot or quickdesk entry inside
its 90-day window), the cache entry now records retainedSince, the local
date of the first refresh that found the file missing. It is set once and
kept on later refreshes. Offline WSL roots are not deletions and stay
unmarked.

Sessions served from such an entry carry retained.since. The sessions
JSON rows include it, the sessions table puts * after the start time with
a legend line, and the export adds a last retained column to records and
sessions in JSON and CSV. The desktop Sessions list and drawer show a
muted note naming the tool and the date.

Behaviour does not change: the same entries are kept and evicted, and
every total and the by-PR numbers are unchanged. The field is optional,
so the cache version stays.

* fix(sessions): say when the transcript was found missing, not deleted

The desktop note, the sessions table legend, the export readme and the docs no longer give a deletion date. retainedSince is the day CodeBurn first found the transcript missing, so the note now reads that the transcript has been missing since that date.
2026-11-05 02:38:09 +01:00
Resham Joshi
a88dffe7aa
fix(export): give the JSON export stable keys (#1864)
* fix(export): give the JSON export stable keys

The JSON export reused the CSV row builders, so its keys were display
headers with spaces and parentheses, and the money keys changed name
with the configured currency. A program had to reshape the file before
it could read it.

The builders now produce one camelCase row, and a single key to header
map writes the CSV, so every CSV header line stays byte-identical. The
JSON schema moves to codeburn.export.v3; the currency is stated once in
currency.code and the money values stay converted to it.

Before (v2, EUR):
{"Period":"7 Days","Date":"2026-11-02","Cost (EUR)":1.1,"Saved (EUR)":0,"API Calls":1,"Sessions":1,"Input Tokens":100000,"Output Tokens":50000,"Cache Read Tokens":200000,"Cache Write Tokens":30000,"costBasis":{"calculated":1}}

After (v3, EUR):
{"period":"7 Days","date":"2026-11-02","cost":1.1,"saved":0,"apiCalls":1,"sessions":1,"inputTokens":100000,"outputTokens":50000,"cacheReadTokens":200000,"cacheWriteTokens":30000,"costBasis":{"calculated":1}}

v2 consumers must rename keys. New keys can still appear under v3.

* docs: changelog entry for the v3 export JSON

* test: read the v3 export keys
2026-11-05 00:49:36 +01:00
Resham Joshi
615b2ee732
feat(export): say where every dollar comes from (#1863)
Every served call now carries a costBasis: recorded when the tool wrote
its own figure, calculated when CodeBurn priced measured tokens,
estimated when the tokens or price are a guess, included when a
subscription covered it at $0, and unpriced when the model has no known
price. It is derived from fields the cache already stores, so no parse
or cache version moves.

The export JSON gives each record its basis and gives sessions and days
the share of cost from recorded, calculated and estimated; records.csv
gets the column. sessions --format json, the menubar payload and MCP
get_usage carry the same shares. Sync now sets ai.cost_estimated from
the basis instead of guessing from the provider name.
2026-11-05 00:10:27 +01:00
ozymandiashh
c166e69e46
Track peak vs off-peak usage for first-party DeepSeek and Z.ai routes (#1561)
Consumption-share split in `codeburn models`, reworked per review:

- First-party routes only: the split applies to `dsh` (DeepSeek API) and
  `zcode` (Z.ai plan) calls. The same model behind a gateway never had
  the vendor discount, and reported-cost providers may already carry it;
  the gate set stays disjoint from REPORTED_COST_PROVIDERS.
- The numbers agree by construction: both legs are shares of the stored
  list-rate cost (peakUSD + offPeakUSD == costUSD, pinned in tests).
  The 0.5x off-peak discount stays on the vendors' bills; nothing is
  repriced here. peakCostMultiplier and OFF_PEAK_MULTIPLIER are gone.
- Calendars: unverified 2027 projections dropped; the Z.ai
  2026-09-25..10-07 all-day off-peak promotion is honored as a temporary
  range; deepSeekHolidayCoverageYears() plus a test fail when the
  current year falls out of the holiday list.
- Output shape: JSON carries the five peak keys only on rows with a
  split, so a report without DeepSeek/Z.ai first-party usage keeps its
  exact historical shape; the Z.ai quota note is removed.
- The `codeburn peak` live-status command is left out (scheduling tool,
  not usage tracking); it survives on a separate branch for its own PR.
2026-09-28 18:48:38 +02:00
Resham Joshi
2a7d9588d8
fix: mouse tracking off by default so text selection works, m toggles it (#1562)
Some checks failed
CI / semgrep (push) Has been cancelled
Tests / test-platforms (windows-latest) (push) Has been cancelled
Tests / desktop (push) Has been cancelled
Tests / test (22) (push) Has been cancelled
Tests / test (22.13.0) (push) Has been cancelled
Tests / test (24) (push) Has been cancelled
Tests / test (26) (push) Has been cancelled
Tests / test-platforms (macos-latest) (push) Has been cancelled
2026-09-25 20:17:07 +02:00
Resham Joshi
f54345a5c3
README: tell the story first, keep the manual in docs (#1527)
Some checks are pending
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
* docs: move the README reference manual into docs/

* assets: designed README images and their sources

* README: tell the story first, keep the manual in docs
2026-09-22 16:28:27 +02:00