codeburn/packages/cli
iamtoruk e11c29937c refactor(core): mistral-vibe decode into core with host-side cost resolution (phase 8, judgment tier)
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.
2026-07-26 23:43:45 -07:00
..
src refactor(core): mistral-vibe decode into core with host-side cost resolution (phase 8, judgment tier) 2026-07-26 23:43:45 -07:00
tests refactor(core): mistral-vibe decode into core with host-side cost resolution (phase 8, judgment tier) 2026-07-26 23:43:45 -07:00
package.json chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
tsconfig.json chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
tsup.config.ts chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
vitest.config.ts chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00