Skip to content
ai-ecoversePublic

About

Register droid (Factory CLI) as a bb custom ACP provider

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

bb-droid

Adds Factory Droid to bb as an ACP coding-agent provider.

After installation, Factory Droid appears in bb as provider acp-droid.

Prerequisites

  • bb 0.48.1 or newer with its built-in ACP providers plugin enabled.
  • Install and authenticate the Factory Droid CLI.

Install

Until the marketplace entry is merged, install directly from GitHub:

bb plugin install https://github.com/ai-ecoverse/bb-droid

For local development:

npm install
npm run typecheck
npm run build
npm test
bb plugin install .

The plugin locates the CLI and upserts a managed entry in the running ACP adapter's customAgents setting without disturbing other agents. On bb 0.47 and later that is the built-in provider-acp; on bb 0.46 it is the opt-in bb--provider-acp-next ("ACP providers [New adapter]") when that is enabled, and provider-acp otherwise. It uses droid exec --output-format acp over stdio. A leftover customAcpAgents entry in config.json is removed on repair, because bb 0.40 rejects that shape unless modelCli.listArgs is present and 0.41 stops reading it.

ACP uses the interactive droid login when it is valid. Droid stores that login under ~/.factory as auth.v2.keyring, auth.v2.loginkeychain (macOS login keychain), or auth.v2.file, depending on the credential backend; bb droid status accepts any of them, as Droid does. Long-lived ACP children can still drop that token. For a durable credential, set a Factory API key in Extensions → Plugins → Factory Droid, then bb droid repair.

Skills

The managed entry declares the skill directories Droid reads (Factory skills), so bb lists them in the composer next to its own:

  • project: .factory/skills/, .agents/skills/, .agent/skills/
  • user: ~/.factory/skills/, ~/.agents/skills/, ~/.agent/skills/

.agents and .agent are Droid's compatibility roots. Folder-specific .factory/skills trees under a subproject are still Droid's to discover; bb indexes the workspace-relative roots above.

Permission modes

bb's thread permission mode becomes a Droid exec launch flag (inserted after exec, because these options belong to that subcommand):

bb mode Droid flag
Auto none — every tool call comes through ACP for approval
Accept edits --auto low — file creation and edits in non-system directories; system changes still ask
Full access --skip-permissions-unsafe

Droid's ACP initialize response does not advertise manual compaction, so this plugin does not set supportsManualCompaction. Use Droid's own /compress inside a Droid session if you need it.

Check or repair

bb droid status
bb droid repair
bb provider models acp-droid

If the CLI moves after an upgrade, bb droid repair records its new absolute path and reloads bb.

Account usage

The plugin adds Factory Droid to bb's standard Usage panel. Enable bb's built-in usage panel if it is disabled. Each machine has its own resource; credentials are read on that machine, not copied from the server's login. The optional Factory API key plugin setting is used on each selected machine.

For Factory accounts using rolling quota billing, the panel shows Standard and Core usage for the 5-hour, weekly, and monthly windows returned by Factory, including reset times. An unstarted window has no reset time. This is account quota, separate from the context meter in an individual thread. Legacy billing formats and customer-hosted deployments are not supported. Prepaid balances are not shown as percentages because Factory does not provide a corresponding allowance.

Authentication uses the plugin's API key setting, a FACTORY_API_KEY in the managed ACP entry, the machine's FACTORY_API_KEY, or the CLI's saved login under ~/.factory, in that order. The collector reads Droid's encrypted auth.v2.loginkeychain and older auth.v2.keyring files on macOS using the existing Factory CLI Keychain item. On Linux, keyrings require secret-tool (libsecret). The encrypted auth.v2.file / auth.v2.key backend is supported on all platforms; native Windows keyring credentials require an API key instead. FACTORY_DISABLE_KEYRING=1 skips secure-store reads.

Saved login credentials and encryption keys are read only inside the host worker and are never included in usage RPC results, logs, or bb's usage cache. The collector does not write Droid's credentials or rotate its refresh token. If the login expires, open droid on that machine to refresh it, then refresh the usage panel. API keys must have access to Factory's billing-limits endpoint; denied access is shown as an error rather than zero usage.

Successful measurements are cached in memory for up to 60 seconds. The panel's refresh button requests a fresh measurement for that resource. Listing usage resources reads bb's machine/provider metadata only and does not access a credential store or contact Factory. Collection uses a private host worker and discoverable provider-usage.v1 RPCs, without changing bb or the ACP bridge.

Troubleshooting

Internal error: Agent error or No active ACP session

The first is Factory Droid with no access token. The second is bb sending turn/start to a worker that no longer has a session.

Refresh login with droid if needed, then recycle the runtime so the next message resumes (session/load) instead of a bare turn/start:

bb thread stop <thread-id>
bb thread tell --mode auto <thread-id> continue

Optional: set a Factory API key in the plugin settings and run bb droid repair. bb droid status reports whether the key is present without printing it.

Uninstall

Remove the managed provider entry before removing the plugin:

bb droid unregister
bb plugin remove droid

The legacy scripts/install.sh and scripts/uninstall.sh remain available for installations made before this repository became a bb plugin. Do not use them for new installs: they write the customAcpAgents array that bb removes in 0.41. Installing the plugin migrates such an entry to the setting and deletes the legacy one.

How it works

bb's built-in ACP provider supplies the ACP-to-bb runtime. This plugin manages the provider-specific launch profile through that plugin's customAgents setting. bb 0.46 shipped a rebuilt ACP adapter as the opt-in bb--provider-acp-next, which disabled provider-acp when enabled, so the plugin writes to whichever of the two is running; bb droid status names it. From bb 0.47 the rebuilt adapter is provider-acp itself.

Droid's AskUser tool needs the rebuilt adapter, which accepts ACP form elicitations; the older provider-acp of bb 0.46 and earlier declines them, so Droid cancels its own questions there. bb 0.48.1 and later fold Droid's "Other answer" field into its question and show up to 10 questions. Droid 1.x also sends ACP usage_update, which bb shows as the thread's context meter (the size is Droid's auto-compaction limit). Authentication and model availability remain owned by the vendor CLI and the user's account.

The package ID is droid; the provider ID is acp-droid. The compact icon is a currentColor mask so it follows the bb theme.

A community plugin, bentossell/bb-plugin-factory-droid, wraps the same CLI under plugin id factory-droid and provider id acp-factory-droid. Those ids do not collide with this plugin, so this package keeps droid / acp-droid.

Development

npm run typecheck
npm run build
npm test

The plugin requires bb 0.48.1+ and plugin SDK 0.6.104+, the versions used to verify host workers and usage-source discovery. Licensed under MIT.

About

Register droid (Factory CLI) as a bb custom ACP provider

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages