Skip to content

Add Droid (Factory) as a provider - #227

Open
dancaldera wants to merge 2 commits into
egoist:mainfrom
dancaldera:add-droid-provider
Open

dancaldera wants to merge 2 commits into
egoist:mainfrom
dancaldera:add-droid-provider

Conversation

@dancaldera

Copy link
Copy Markdown

Hello! This is my first pr into this project, and I'd like one of my favorite harnesses to be added to this one. Seeing that this is actually making everything very clean and only creating a good way to wrap different harnesses, I can apply any suggestion, and this pr only is related to adding this provider.

Problem and solution

Droid speaks ACP so it rides the same driver as Cursor, Fx, Grok and Kimi, there is no new transport here. The provider is wired end to end: resume cursors, session list and history import, commit messages, live slash commands and provider marks for desktop, web and mobile. Access modes map to droid's autonomy ladder and model discovery asks droid itself for each model's effort ladder on a local-only session, so there is no hardcoded table that can drift when new models ship.

Checks

  • cargo fmt --check, cargo check, cargo test (978 pass)
  • bun run protocol:check
  • bun run --filter @waku/client check and test (23 pass)
  • web and mobile typecheck, mobile bun test (154 pass)
  • validated live in the debug app: real turn with droid, model picker and effort menus

Limitations and follow-up

  • steering is off until concurrent session/prompt behavior is verified against a live session
  • fork and rewind stay off, same as Fx and Kimi today
  • login problems show as error text for now, a login button flow can come later

Related issue

None yet, happy to open one if the maintainers prefer.

AI disclosure

Used an AI coding agent (T3 Code running GLM) to implement the integration, run the checks and prepare the branch. I reviewed the work, tested it against my local droid, and wrote the intro of this description myself.

Checklist

  • I understand the entire change and take responsibility for the code and all actions taken.
  • I wrote this description myself, without LLM-generated text, and will write PR comments myself.
  • I disclosed all AI usage, including the tools and extent of involvement.

Drive the Factory Droid CLI over its documented ACP transport
(droid exec --output-format acp) through the shared AcpDriver:

- ProviderKind::Droid wired end to end: resume cursors, session
  listing and history import, commit-message generation, live
  slash commands, provider marks for desktop, web, and mobile
- Access modes map onto Droid's autonomy ladder (normal, auto-low,
  auto-medium, auto-high)
- Model discovery walks the account catalog on a local-only session
  (_meta.sessionId skips the Factory-side record) and reads each
  model's effort ladder from session/resume, so new releases and
  BYOK routes need no hardcoded table; a lone-choice answer such as
  the auto router's None gets no selector
- Steering stays off until concurrent session/prompt behavior is
  verified; fork and rewind stay disabled like Fx and Kimi
- Documented in docs/providers.md with the load-bearing quirks

@aleclarson aleclarson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice integration — the enum/cursor wiring, capability flags, and per-model effort discovery all look right, and keeping steering/fork/rewind off until verified is the right call. A few things before merge:

Bugs

  • apps/mobile/src/hooks/use-daemon-data.ts — the PROVIDERS list is missing 'droid', so useProviderCatalog never probes it and Droid can't appear in the mobile provider picker even when installed.
  • packages/waku-client/src/composer-preferences.ts — the PROVIDERS set is missing 'droid'; parsePreferences discards stored prefs when lastProvider isn't in the set, so a Droid user's composer prefs silently reset to codex defaults.
  • crates/waku-core/src/model_catalog.rs (discover_droid_models) — session/resume is sent without cwd, which is a required field in the ACP schema. Works on droid 0.217.0, but adding "cwd": cwd.to_string_lossy() (it's in scope) is free insurance against stricter validation.

Optional

  • SetSessionConfigOptionResponse already returns refreshed configOptions — if Droid populates it there, the per-model session/resume can be dropped and the discovery walk halves. If it doesn't, a one-line comment would help.
  • _meta.sessionId for a local-only session relies on undocumented behavior; if it regresses, every discovery writes a ghost session into the user's Factory history. session/close after the walk would hedge this.
  • src/app/composer.rs bumps provider_mark 10.5 → 12.0 for all providers — probably a correct fix, but it's an unrelated global visual change; worth splitting or calling out.

Verdict: approve once the two TS lists and the cwd are fixed.

- add 'droid' to the mobile daemon-data and client composer-preferences
  provider lists, so the mobile picker probes it and stored preferences
  survive re-parse instead of resetting to codex defaults
- send the ACP-required cwd with the discovery session/resume re-read
- hedge the local-only discovery session with a best-effort session/close
  (droid 0.219.0 answers Method not found today) and document why the
  per-model re-read is needed: set_config_option answers stay empty
- normalize rustfmt drift in driver/acp.rs and driver/mod.rs

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@dancaldera

Copy link
Copy Markdown
Author

Thanks for the careful review! Fixes are in 2a62a32:

  • use-daemon-data.ts and composer-preferences.ts both have 'droid' in their provider lists now, so the mobile picker probes it and stored composer prefs survive
    re-parse.
  • The discovery session/resume re-read now sends cwd alongside sessionId.

On the optional notes:

  • SetSessionConfigOptionResponse: I verified against droid 0.219.0 — session/set_config_option answers with an empty result, no configOptions, so the
    per-model session/resume walk can't be dropped. There's a comment in discover_droid_models saying exactly that now.
  • session/close: droid doesn't implement it yet (answers JSON-RPC "Method not found" today), but I added the best-effort close after the walk with errors
    ignored, so the hedge activates on its own the day droid ships support.
  • provider_mark 10.5 → 12.0: deliberate, and I'm keeping it in this PR rather than splitting — it matches the MenuChip trigger's 12px mark so the composer
    control doesn't visibly resize when a busy session locks the picker. Flagging it here since it does affect every provider.

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