Skip to content

feat: add Factory Droid (droid) agent support#162

Closed
OzeroHAX wants to merge 1 commit into
vakovalskii:mainfrom
OzeroHAX:feat/droid-agent
Closed

feat: add Factory Droid (droid) agent support#162
OzeroHAX wants to merge 1 commit into
vakovalskii:mainfrom
OzeroHAX:feat/droid-agent

Conversation

@OzeroHAX
Copy link
Copy Markdown

@OzeroHAX OzeroHAX commented Apr 9, 2026

Summary

Adds Factory Droid (droid CLI by Factory AI) as a supported agent in CodeDash — session loading, detail view, preview, replay, search, cost estimation, active detection, and full UI integration.

What changed

  • add Droid session discovery from ~/.factory/sessions//*.jsonl with session_start metadata parsing (cwd, sessionTitle) and Claude-compatible message format ({type: "message", message: {role, content:
    [blocks]}})
  • load Droid detail into the unified transcript format used by session detail, preview, replay, search, and export paths
  • include Droid sessions in active process detection (ps aux grep for droid), cache invalidation (mtime monitoring of ~/.factory/sessions/), and terminal launch/resume (droid --resume )
  • extract MCP tool usage from assistant tool_use content blocks using the same extractTools() pipeline as Claude
  • expose Droid throughout the UI: sidebar filter with robot icon, green badge (.tool-droid / --accent-green), filter chip, install command (curl -fsSL https://app.factory.ai/cli | sh), and calendar view toggle
  • add file-size-based cost fallback for sessions without token usage metadata, using claude-sonnet-4-6 pricing as baseline estimate
  • add Droid system message filtering (You are Droid, <factory_config) to isSystemMessage()
  • add WSL support with EXTRA_DROID_DIRS for Windows-side ~/.factory detection

Validation

Manual checks run locally against real ~/.factory data (12 sessions across 4 projects):

  • node -c src/data.js
  • node -c src/terminals.js
  • node -c src/frontend/app.js
  • node -c src/frontend/calendar.js
  • node -e "..." — confirmed 12 Droid sessions loaded with correct project paths, message counts, and session titles
  • loadSessionDetail() — verified 32 messages parsed from a real session with correct role/content extraction
  • getSessionPreview() — returns 10 preview messages
  • computeSessionCost() — returns file-size-based cost estimate
  • node bin/cli.js run — dashboard starts cleanly, Droid sessions visible with green badges

Known limitations

  • Cost is estimated from file size (no per-turn token usage in Droid JSONL), so cost figures are approximate.
  • droid --resume command is assumed but not verified against the actual Droid CLI — may need adjustment to match the real resume flag.
  • history.json (JSON array) is not used for session enrichment — all data comes from session JSONL files directly.

@vakovalskii
Copy link
Copy Markdown
Owner

Looks good structurally — follows the same pattern as other agents. Will merge after resolving conflicts with recent refactoring (app.js was split into modules in v6.15.5). Please rebase on latest main.

@OzeroHAX
Copy link
Copy Markdown
Author

Rebased on the latest main and force-pushed.

I also resolved the post-refactor integration cleanly against the current frontend layout and fixed a couple of follow-up issues I found while verifying:

  • Copy Command now uses droid --resume ...
  • droid is now shown correctly in analytics/heatmap
  • estimated cost handling is wired in for droid as well

Ready for another pass.

@vakovalskii
Copy link
Copy Markdown
Owner

Conflicts after merging recent PRs (#165 Kilo, #177 Linux focus, #172 WSL). Please rebase on latest main.

6th agent: session loading, detail parsing, preview, replay,
cost estimation, active detection, search, sidebar + install UI.
Sessions read from ~/.factory/sessions/<project-key>/*.jsonl.
@OzeroHAX
Copy link
Copy Markdown
Author

Done — rebased this branch on the latest main, resolved the conflicts from #165, #177, and #172, and force-pushed the updated branch.

@vakovalskii
Copy link
Copy Markdown
Owner

Conflicts after merging #180 and #182 (data.js changes). Please rebase on latest main.

Copy link
Copy Markdown
Collaborator

@NovakPAai NovakPAai left a comment

Choose a reason for hiding this comment

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

Code Review

🔴 Merge conflict — PR has conflicts with main and needs a rebase before it can be merged.

⚠️ Cache invalidation misses subdirectory changes_droidDirMtime checks only the mtime of DROID_SESSIONS_DIR (i.e. ~/.factory/sessions/). On most filesystems, the top-level directory mtime changes only when entries are added/removed at that level. If a new JSONL file is written inside a project subdirectory (e.g. ~/.factory/sessions/<proj>/<uuid>.jsonl), the top-level dir mtime does not change, so the session cache will never invalidate. Sessions added during a live run won't appear.

Suggestion: also watch the project subdirectories, or switch to a time-based TTL (the existing 60s SESSIONS_CACHE_TTL would work).

⚠️ UUID validation regex — the filter /^[0-9a-f]{8}-....test(sid)` is correct and good to have. But since Droid uses the same format as Claude Code sessions, consider extracting this regex as a shared constant to keep it consistent across all parsers.

ℹ️ Minor: parseDroidSessionFile silently returns null on any error. A top-level try/catch in the caller already handles it, so this is fine — just noting it for awareness.

@vakovalskii
Copy link
Copy Markdown
Owner

Thanks for the contribution! Closing for now — keeping the agent roster focused this round (adding Qwen + GitHub Copilot Chat only). Factory Droid is niche enough that we'd want a pluggable agent API before taking it on. The branch also has conflicts with main. Feel free to reopen later or discuss in an issue if there's demand.

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.

3 participants