Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
ADR 0258: Trusted extensions may provide custom agents
- Status: Accepted for implementation
- Date: 2026-09-15
- Decision: D426
- Related: ADR 0214, ADR 0215,
07-plugins/16-trusted-extensions.md, Issue #401
Context
Trusted extensions run beside the Agent runtime and are the right surface for
providers no built-in pi-ai adapter can represent (issue #401, e.g. Command Code with
its own endpoint and auth). The pinned pi-coding-agent API has registerProvider but
no registerAgent, and its registry assumes coding-agent-owned credentials and model
persistence, which would bypass the product's session binding and secret ownership.
Decision
- Add a
registerAgentExtensionAPI member: an id, bounded model metadata, and either astreamorcompleteimplementation, with the plugin owning endpoint, authentication, request serialization, and response conversion. - Register inside the Agent sidecar. The host receives only the opaque provider
id/model id and persists the binding through
session.configure, so registration is session-scoped, removed with the runtime, and limited to trusted extensions holding the high-riskagent.extensiongrant. - Use namespaced
extension-agent:<encoded-agent-key>provider ids: later turns pass the binding as a placeholder provider, and the sidecar reloads the extension and reactivates that implementation. - Expose a read-only model registry projection — models and auth availability, never host API keys, secret refs, OAuth tokens, provider headers, or internals.
registerProvideraccepts the same plugin-owned streaming shape as a compatibility alias, and the host writes no provider registration into the Host database or global defaults.
Consequences
- Similar integrations ship their own auth and wire protocol without an app release or
new Rust transport, while model selection stays host-owned and observable through
session:modelChanged. - Custom agents stay out of the ordinary provider Settings picker, and
registerAgentbeing PI-Desktop-specific means upstream pi upgrades must preserve or translate it.
Alternatives
- Expose
ModelRegistrydirectly: it leaks credential resolution. - Write custom providers into Rust/SQLite: the plugin owns them.
- Register an executable subagent: deferred; this covers LLM transport only.