feat(providers): add Codebuff provider#124
feat(providers): add Codebuff provider#124anandghegde wants to merge 2 commits intogetagentseal:mainfrom
Conversation
Adds the Codebuff provider (formerly Manicode) as a single-file plugin under src/providers/codebuff.ts, following the conventions used by the pi and opencode providers. Data source: - Walks ~/.config/manicode/projects/<project>/chats/<chatId>/ - chat-messages.json holds the serialized ChatMessage[] - run-state.json is consulted to recover the real cwd so sessions group by the originating project directory - manicode-dev and manicode-staging channels are walked automatically - Honors CODEBUFF_DATA_DIR for a custom root Cost model: - Codebuff bills in credits, not tokens. Each completed assistant message records credits on message.credits; CodeBurn approximates cost using the public PAYG rate ($0.01 / credit) as a conservative upper bound. - When Codebuff routes a call through an upstream provider and the stashed RunState records real token totals (providerOptions.usage or providerOptions.codebuff.usage in messageHistory), the LiteLLM-based calculation takes precedence. Tool normalization maps Codebuff-native names (read_files, str_replace, run_terminal_command, spawn_agents, etc.) to the canonical set used by the classifier (Read, Edit, Bash, Agent, TodoWrite, ...). Tests: - 18 provider tests covering discovery, parsing, multi-turn sessions, providerOptions fallback, dedup, malformed files, display names - provider-registry.test.ts updated to assert codebuff is registered and its tool/model display names Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
|
Hi, The Codebuff provider sets Severity: action required | Category: correctness How to fix: Include channel in sessionId Agent prompt to fix - you can give this to your LLM of choice:
Found by Qodo code review |
…channel Resolves merge conflicts with main (README.md, src/providers/index.ts, tests/provider-registry.test.ts, package-lock.json) and addresses PR review feedback from Qodo-Free-For-OSS: - Codebuff sessionId now includes the channel root name (manicode, manicode-dev, manicode-staging) derived from the chat directory structure, preventing the same chatId from colliding across channels when downstream aggregation keys by (provider, sessionId, project). - Uses '/' as the channel/chatId separator to avoid clashing with src/parser.ts's colon-delimited session key format. - Adds tests: collision across channels, channel inclusion, and fallback when the path doesn't match the expected shape. - Updates README dedup paragraph to mention Codebuff's strategy.
|
/review Addressed the previous feedback: |
Wires Codebuff (formerly Manicode) into cass as the 20th supported coding-agent connector. The on-disk discovery + parser implementation lives in the upstream franken_agent_detection crate; this PR adds: - src/connectors/codebuff.rs: thin re-export stub for CodebuffConnector, matching the established pattern (see aider.rs / amp.rs). - src/connectors/mod.rs: registers the new module. - README.md: adds Codebuff to the top-line supported-providers blurb and the 'How it reads data' section, documenting the ~/.config/manicode/projects/<project>/chats/<chatId>/chat-messages.json layout, the run-state.json cwd recovery, the manicode-dev/staging channels, and the CODEBUFF_DATA_DIR / MANICODE_DATA_DIR overrides. - CHANGELOG.md: Unreleased entry. Cargo.toml & build.rs note: temporarily pinned at the @anandghegde fork of franken_agent_detection that carries the companion Codebuff connector PR. Once the upstream FAD PR lands, the URL/rev should be flipped back to Dicklesworthstone/franken_agent_detection and bumped to that merge commit. Both files have a TODO comment pointing at the matching change. Storage layout reverse-engineered from getagentseal/codeburn#124. Local 'cargo check' on x86_64-apple-darwin is green.
Wires Codebuff (formerly Manicode) into cass as the 20th supported coding-agent connector. The on-disk discovery + parser implementation lives in the upstream franken_agent_detection crate; this PR adds: - src/connectors/codebuff.rs: thin re-export stub for CodebuffConnector, matching the established pattern (see aider.rs / amp.rs). - src/connectors/mod.rs: registers the new module. - README.md: adds Codebuff to the top-line supported-providers blurb and the 'How it reads data' section, documenting the ~/.config/manicode/projects/<project>/chats/<chatId>/chat-messages.json layout, the run-state.json cwd recovery, the manicode-dev/staging channels, and the CODEBUFF_DATA_DIR / MANICODE_DATA_DIR overrides. - CHANGELOG.md: Unreleased entry. Cargo.toml & build.rs note: temporarily pinned at the @anandghegde fork of franken_agent_detection that carries the companion Codebuff connector PR. Once the upstream FAD PR lands, the URL/rev should be flipped back to Dicklesworthstone/franken_agent_detection and bumped to that merge commit. Both files have a TODO comment pointing at the matching change. Storage layout reverse-engineered from getagentseal/codeburn#124. Local 'cargo check' on x86_64-apple-darwin is green.
Summary
Adds Codebuff (formerly Manicode) as a first-class provider, moving it off the "Planned" row and onto the supported list. Implementation follows the single-file plugin pattern established by the
piandopencodeproviders —src/providers/codebuff.tsis 100% of the new runtime code.Data source
Codebuff persists per-chat history under:
chatIdis the chat's ISO-8601 timestamp with:replaced by-.run-state.jsonto recover the realcwdso sessions group by the originating project directory (not the sanitized folder name).manicode-devandmanicode-stagingchannels are walked automatically when present.CODEBUFF_DATA_DIRoverrides the base directory.Cost model (important caveat)
Codebuff bills in credits, not tokens. The local chat log records
message.creditson completed assistant messages but not token counts (except when Codebuff routed the call through an upstream provider and stashed its RunState with OpenRouter-shaped usage).This provider therefore uses a two-tier cost resolution:
providerOptions.usage— reports real token counts, run those through the existingcalculateCost()/ LiteLLM pricing engine. Exact match with how the other providers work.costUSD = credits * USD_PER_CREDITwhereUSD_PER_CREDIT = 0.01(Codebuff's public pay-as-you-go rate). This is a conservative upper bound — subscription-plan users will see a slight overstatement, which is less misleading than reporting $0 for an obviously-non-free session.The rationale is documented inline in
src/providers/codebuff.ts.Tool normalization
Codebuff-native tool names map to the canonical set so the classifier heuristics (
Edit-implies-coding,Bash+ git pattern impliesgit, etc.) light up consistently:read_filesReadcode_searchGrepglob,find_filesGlobstr_replaceEditwrite_fileWriterun_terminal_commandBashspawn_agentsAgentwrite_todosTodoWritebrowser_logsWebFetchweb_searchWebSearchsuggest_followupsandend_turnare explicitly ignored — they're not useful signals for task classification.Files
src/providers/codebuff.ts— new single-file provider (discovery, parser, tool/model normalization).src/providers/index.ts— registers Codebuff as a core provider (coreProviders).tests/providers/codebuff.test.ts— 18 tests covering discovery, parsing, multi-turn sessions,providerOptionsfallback, dedup, malformed files, and display names.tests/provider-registry.test.ts— updated to assert Codebuff is registered and its tool/model display names.package.json— addscodebuffto the keywords list.README.md— adds Codebuff to the top-line supported-providers blurb, the supported-providers table, the--providerexample list, the "How it reads data" section, and the environment-variables table.Verification
tests/providers/codebuff.test.ts— 18/18 passed.tests/provider-registry.test.ts— 11/11 passed (was 9; added 2 for Codebuff tool + model display names).tests/day-aggregator.test.tsasserting'2026-04-09'vs'2026-04-10') reproduces identically onmainwith no Codebuff code — it's a host-timezone sensitivity.End-to-end against real local data:
10 Codebuff sessions across 5 projects, 56 assistant calls, $19.45 total (1,945 credits × $0.01).
Notes
codebuff:<chatDir>:<messageId|index>; re-parsing the same session yields zero additional calls.