mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-04 05:41:29 +00:00
Moves the Mistral Vibe rich decode into @codeburn/core behind the bridge: discovery, file I/O and pricing stay CLI-side, the pure record decode (including the even allocation of the session dollar figure and the session token totals across assistant messages) moves byte-exact into core. Seam adjudication: the draft brief said the `session_cost > 0` gate should move into core. It cannot — that gate is the first arm of a three-arm cost resolution whose last arm consults the generic price table, which is forbidden in core. The whole resolution therefore stays host-side in `calculateSessionCost` and core receives a pre-resolved `sessionCost`; core keeps only the pure allocation arithmetic (allocateInteger / allocateCost, allocationIndex / assistantOrdinal), unchanged in rounding, remainder distribution and float operation order. The move is observationally equivalent: the original resolved the cost once per session during parse, with no per-call state. Validator fixes on the draft: - core dropped the `metadata.session_id || basename(sessionDir)` fallback, emitting sessionId '' (and colliding dedup keys `mistral-vibe::<msg>`) for sessions whose meta.json omits session_id. The host now passes `sessionIdFallback`. - `toProviderCall` set `turnId: undefined` unconditionally, adding a key the original omits entirely on the no-assistant session-level arm. - the moved comment block described a seam that no longer exists; adjusted minimally to describe where the resolution actually lives. Parity was verified arm-by-arm against the pre-migration decode checked out in place over a 28-session adversarial fixture matrix (strict equality plus per-call key-presence), and the adversarial allocation arms (7 over 3, 1 over 3, terminal zero-cost, idx-N keys, basename fallback, float-op order) are promoted into the bridge and core decode tests with values captured from the original. |
||
|---|---|---|
| .. | ||
| src | ||
| tests | ||
| package.json | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| vitest.config.ts | ||