Support Mistral Vibe sessions#301
Open
ozymandiashh wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds first-class CodeBurn support for Mistral Vibe sessions.
Mistral Vibe stores usage differently from providers like Claude Code, Codex, Pi, or Qwen. Instead of writing token usage on each assistant turn, Vibe writes a session-level cumulative total in
meta.json, while the actual prompt/tool-call transcript lives inmessages.jsonl. Because of that, this provider intentionally emits one CodeBurn usage record per Vibe session rather than pretending there is per-turn usage that the source data does not contain.Closes #283.
What Changed
mistral-vibeprovider.$VIBE_HOME/logs/session/whenVIBE_HOMEis set~/.vibe/logs/session/by defaultmeta.jsonmessages.jsonlagents/folder.bash->Bashread_file->Readwrite_file->Writesearch_replace->Editgrep->Greptask->Agentweb_search->WebSearchHow Vibe Sessions Are Parsed
A current Vibe session looks like this on disk:
CodeBurn reads
meta.jsonfor usage and session metadata:{ "session_id": "session-abc123", "start_time": "2026-05-11T10:00:00+00:00", "end_time": "2026-05-11T10:05:00+00:00", "environment": { "working_directory": "/Users/test/my-project" }, "stats": { "session_prompt_tokens": 2000, "session_completion_tokens": 3000, "input_price_per_million": 1.5, "output_price_per_million": 7.5 }, "config": { "active_model": "mistral-medium-3.5" } }That becomes one CodeBurn provider call roughly equivalent to:
{ "provider": "mistral-vibe", "model": "mistral-medium-3.5", "inputTokens": 2000, "outputTokens": 3000, "costUSD": 0.0255, "timestamp": "2026-05-11T10:05:00+00:00", "sessionId": "session-abc123" }CodeBurn then reads
messages.jsonlfor the first user prompt and assistant tool calls:{"role":"user","content":"track Mistral Vibe usage"} {"role":"assistant","tool_calls":[{"function":{"name":"bash","arguments":"{\"command\":\"npm test && git status\"}"}}]}From that transcript, CodeBurn extracts:
{ "userMessage": "track Mistral Vibe usage", "tools": ["Bash"], "bashCommands": ["npm", "git"] }Why One Record Per Session
Other providers often attach token usage to each assistant response, so CodeBurn can emit one usage record per assistant turn. Vibe currently does not expose usage that way. It stores cumulative session totals in
meta.json.stats, for example:session_prompt_tokenssession_completion_tokensinput_price_per_millionoutput_price_per_millionSplitting those totals across messages would be guesswork and could make date bucketing, model cost, and tool attribution misleading. This PR keeps the accounting faithful to the source data: one Vibe session folder becomes one CodeBurn usage record.
Edge Cases Covered
VIBE_HOMEoverride is respected.~and~/...are expanded forVIBE_HOMEto match Vibe's own behavior.end_timefalls back tostart_time.mistral-vibe:<session_id>.agents/are discovered and counted separately.statspricesFiles Changed
src/providers/mistral-vibe.ts- provider discovery/parsing/cost/tool extractiontests/providers/mistral-vibe.test.ts- focused fixtures and regression coveragesrc/providers/index.ts- provider registrytests/provider-registry.test.ts- registry expectationdocs/providers/mistral-vibe.md- provider-specific implementation notesdocs/providers/README.md- provider docs indexREADME.md- supported provider table, notes, env var docsCHANGELOG.md- unreleased entryassets/providers/mistral-vibe.svg- provider iconValidation
npm run buildnpx vitest run(48 files / 672 tests)git diff --checkcheckassesssemgrepNote
npx tsc --noEmitstill fails on an existing unrelated error insrc/models-report.ts(151,13):