Skip to content

feat(desktop): remote agent backend providers in channel Add Agent dialog#150

Merged
tlongwell-block merged 2 commits intomainfrom
feat/channel-dialog-remote-agents
Mar 21, 2026
Merged

feat(desktop): remote agent backend providers in channel Add Agent dialog#150
tlongwell-block merged 2 commits intomainfrom
feat/channel-dialog-remote-agents

Conversation

@tlongwell-block
Copy link
Collaborator

@tlongwell-block tlongwell-block commented Mar 21, 2026

Summary

The channel-context Add Agent dialog (+ button in the channel header) can now deploy agents to remote infrastructure via backend providers.

Previously this dialog only created local agents. The global Create Agent dialog (Agents view) already had full "Run on" support from #134, but the quick-add channel flow did not. This PR threads backend provider selection through the channel dialog using the same hooks and patterns.

Multi-agent support

Multiple agents can be deployed to the same remote target simultaneously. The desktop calls deploy once per agent — each invocation is independent. Backend providers are responsible for multi-agent coexistence (e.g., per-agent config isolation, process management). The GUI does not know or care about the implementation details — it just sends N deploy requests with the same provider_config, and each returns a unique agent_id.

Each agent runs as an independent sprout-acp process with its own Nostr identity. Stop/shutdown targets individual agents by pubkey via !shutdown.

What it looks like

No backend providers on PATH → dialog is identical to today. Zero behavior change.

Backend providers discovered → a "Run on" selector appears above the Runtime dropdown:

Run on
[This computer ▼]        ← default, local mode (unchanged)
[my-provider    ]        ← select to deploy remotely

Selecting a provider shows:

  • ⚠️ Trust warning (provider receives the agent's private key)
  • Config fields dynamically rendered from the provider's config_schema
  • Full batch support — select multiple personas, teams, or Generic just like local mode

Changes

File What ΔLoC
channelAgents.ts backend field on CreateChannelManagedAgentInput; thread to createManagedAgent with provider-mode flags; spawnError check +14/−1
ChannelMembersBar.tsx Wire useBackendProvidersQuery, pass to dialog +4/−0
AddChannelBotDialog.tsx "Run on" selector, trust warning, probe effect, provider config fields, batch support in provider mode +162/−17
ProviderConfigFields.tsx New — extract shared coerceConfigValues + ProviderConfigFields from CreateAgentDialog +85/−0
CreateAgentDialog.tsx Import from shared module (dedup) +2/−89
check-file-sizes.mjs Narrowly scoped override for AddChannelBotDialog (600 lines) +1/−0

Total: +267/−88 across 6 files.


Design decisions

spawnError check is load-bearing

Tauri's create_managed_agent returns Ok() even on deploy failure — spawnError carries the message. Without the explicit check in createChannelManagedAgent, deploy failures would be silently swallowed and the agent would appear to succeed.

Batch creation works in provider mode

The GUI calls deploy N times with the same provider_config. Each call is an independent invocation of the backend provider binary (stdin/stdout JSON, one-shot). Backend providers are responsible for multi-agent coexistence — the desktop makes no assumptions about how the provider manages multiple agents on the same target.

ACP runtime always required

Unlike CreateAgentDialog (which has Advanced Setup fields that fall back to Rust defaults), the channel dialog has no Advanced Setup. The Runtime dropdown is the only way to specify agentCommand/agentArgs, which flow through the deploy payload to the remote provider.

Deploy-before-attach ordering is safe

The sprout-acp harness subscribes to membership notifications before channel discovery, then calls discover_channels() via REST. So: create → deploy (agent starts, discovers channels) → attach to channel (agent picks up via live notification subscription). No restart required.

Explicit backend: { type: "local" } in local mode

Matches CreateAgentDialog pattern. Rust has Default for BackendKind = Local, so undefined would work, but explicit is safer and consistent.


Testing

  • TypeScript compiles cleanly
  • Biome check passes (warnings match reference CreateAgentDialog)
  • File size check passes
  • Pre-commit hooks pass (biome, clippy, rust tests, desktop build)
  • Pre-push hooks pass (all 6 checks)
  • Manual testing: 5 agents deployed simultaneously to one remote target via backend provider ✅
  • E2E tests deferred (no existing coverage for this dialog's provider mode)

…lBotDialog

Thread backend provider selection through the channel-context 'Add Agent'
dialog so users can deploy agents to remote infrastructure (e.g., Blox
workstations) directly from the channel header.

Changes:
- channelAgents.ts: Add backend field to CreateChannelManagedAgentInput,
  pass through to createManagedAgent with provider-mode flags
  (spawnAfterCreate, startOnAppLaunch), check spawnError on deploy failure
- ChannelMembersBar.tsx: Wire useBackendProvidersQuery and pass results
  to AddChannelBotDialog
- AddChannelBotDialog.tsx: Add 'Run on' selector, trust warning, provider
  config fields from probe, single-agent enforcement in provider mode
  (Teams hidden, persona/Generic mutually exclusive, selectedCount === 1)
- ProviderConfigFields.tsx: Extract shared coerceConfigValues and
  ProviderConfigFields from CreateAgentDialog (deduplication)
- CreateAgentDialog.tsx: Import from shared ProviderConfigFields module

Local mode behavior is completely preserved — the 'Run on' selector only
appears when sprout-backend-* binaries are discovered on PATH.
The backend script now supports multiple simultaneous ACP harnesses on
one workstation (per-agent config/log/pid files, no global pkill).
Remove the single-agent enforcement from the channel dialog:

- Re-enable batch creation (Teams, multi-persona, Generic + personas)
- Restore standard toggle/selection behavior in provider mode
- Restore original dialog description and hint text

Provider mode now works identically to local mode for agent selection —
the only additions are the Run on selector, trust warning, and config fields.
@tlongwell-block tlongwell-block merged commit f3668fd into main Mar 21, 2026
8 checks passed
@tlongwell-block tlongwell-block deleted the feat/channel-dialog-remote-agents branch March 21, 2026 14:55
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.

1 participant