Skip to content

Add Droid CLI provider#173

Merged
iamtoruk merged 1 commit intogetagentseal:mainfrom
Aeversil:add-droid-provider
Apr 28, 2026
Merged

Add Droid CLI provider#173
iamtoruk merged 1 commit intogetagentseal:mainfrom
Aeversil:add-droid-provider

Conversation

@Aeversil
Copy link
Copy Markdown
Contributor

@Aeversil Aeversil commented Apr 28, 2026

Adds support for Factory Droid CLI sessions.

What it does:

  • Discovers sessions from ~/.factory/sessions/ (JSONL + companion settings JSON)
  • Skips internal .factory housekeeping sessions
  • Extracts tools, bash commands, and user messages from JSONL entries
  • Distributes session-level cumulative token counts across individual calls
  • Normalizes Droid model wrappers (e.g. custom:GLM-5.1-[Proxy]-0GLM-5.1) before using CodeBurn's existing pricing lookup and user-configured model aliases
  • Derives clean project names from cwd paths (e.g. ~/projects/my-appmy-app)
  • Adds Droid to the macOS menubar provider filter

Files changed:

  • src/providers/droid.ts (new) — full provider implementation
  • src/providers/index.ts — registers Droid as a core provider
  • tests/providers/droid.test.ts — provider fixture tests
  • tests/provider-registry.test.ts — updated expected provider list
  • mac/Sources/CodeBurnMenubar/AppStore.swift — adds Droid provider filter/CLI arg
  • mac/Sources/CodeBurnMenubar/Views/AgentTabStrip.swift — adds Droid tab color

@Aeversil Aeversil force-pushed the add-droid-provider branch from e462eaf to 10b7f00 Compare April 28, 2026 15:28
@iamtoruk iamtoruk self-requested a review April 28, 2026 16:08
Copy link
Copy Markdown
Member

@iamtoruk iamtoruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, a few things to fix before merge:

Must fix:

  1. Merge conflict -- index.ts and provider-registry.test.ts are based on old coreProviders list. Rebase on latest main which now includes openclaw, kiloCode, rooCode.

  2. Dead code -- sanitizeCwd() (line 78) is defined but never called. Remove it.

  3. Empty if block -- lines 190-192 in the tool_result handler:

    if (toolResults.length > 0 && pendingTools.length > 0) {
      // Tools were already collected with the assistant message
    }

    This does nothing. Either remove the block or delete the entire tool_result check since the tools are already captured from assistant messages.

  4. Double file read in discovery -- discoverSessionsInDir calls readSessionFile(filePath) just to check if the first line is session_start. Then createParser reads the entire file again. For large session directories this doubles I/O. Read just the first line in discovery instead of the whole file (e.g. readFile + .split('\n', 1)[0]), or cache the content.

  5. No provider tests -- Only the registry test is updated. Need a tests/providers/droid.test.ts with synthetic fixtures covering: basic parsing, token distribution, dedup, model name stripping, tool extraction, bash command extraction, missing settings file, internal session skipping, empty sessions. See tests/providers/openclaw.test.ts or tests/providers/roo-code.test.ts for the pattern.

  6. Missing menubar integration -- Need ProviderFilter.droid case in AppStore.swift with providerKeys and cliArg, plus a tab color in AgentTabStrip.swift. Check how openclaw/rooCode/kiloCode were added in the latest main.

@Aeversil Aeversil force-pushed the add-droid-provider branch 3 times, most recently from ec88dca to e687c72 Compare April 28, 2026 17:45
@Aeversil
Copy link
Copy Markdown
Contributor Author

Addressed the review feedback:

  • Rebased on latest main including OpenClaw/Roo Code/KiloCode
  • Resolved provider registry/test merge conflicts
  • Removed dead code and empty tool_result block
  • Avoided full-file read during session discovery
  • Added Droid provider tests covering parsing, token distribution, dedup, model stripping, tools/bash extraction, missing settings, internal sessions, and empty sessions
  • Added Droid menubar integration (ProviderFilter, CLI arg, tab color)
  • Updated PR description to remove outdated GLM fallback-pricing wording

Verified:

  • npx tsup --dts
  • npx vitest run (410 passing)
  • swift build
  • Local menubar run with CODEBURN_BIN="node .../dist/cli.js" and Droid tab verified working

@iamtoruk
Copy link
Copy Markdown
Member

All 6 items from the first review are addressed, code looks clean. One thing before merge:

Needs rebase on latest main -- we just merged Qwen provider + LiteLLM snapshot pricing (d043795) and menubar perf fix (607cb46). Your index.ts, provider-registry.test.ts, AppStore.swift, and AgentTabStrip.swift will conflict since they don't include qwen in the provider lists. Quick rebase should be straightforward.

Discovers and parses sessions from ~/.factory/sessions/, reading JSONL
message logs and companion settings.json files for token usage tracking.

- Discovers sessions by scanning per-cwd subdirectories
- Skips internal .factory housekeeping sessions
- Extracts tools, bash commands, and user messages from JSONL
- Distributes session-level cumulative token counts across calls
- Normalizes Droid model wrappers before existing pricing lookup
- Derives clean project names from cwd paths
- Adds menubar provider filtering for Droid
@Aeversil Aeversil force-pushed the add-droid-provider branch from e687c72 to 26ebe75 Compare April 28, 2026 18:22
@Aeversil
Copy link
Copy Markdown
Contributor Author

Rebased on latest main after the Qwen provider and menubar perf changes. Resolved provider list conflicts to include both Droid and Qwen.

Verified again:

  • npx tsup --dts
  • npx vitest run (410 passing)
  • swift build

@iamtoruk iamtoruk merged commit 77d0417 into getagentseal:main Apr 28, 2026
@iamtoruk
Copy link
Copy Markdown
Member

Merged, thanks for the clean rebase!

If you get a chance, could you share a screenshot of the CLI or menubar showing Droid usage? Would love to promote CodeBurn in the Droid community.

@Aeversil
Copy link
Copy Markdown
Contributor Author

Here you go!

CLI Screenshot 2026-04-28 at 21 40 47 Screenshot 2026-04-28 at 21 42 11 Screenshot 2026-04-28 at 21 42 22 Screenshot 2026-04-28 at 21 42 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants