Skip to content

feat(remote): run CLI bots in daemon and expose agent controls - #3639

Merged
bobleer merged 5 commits into
openBitFun:mainfrom
bobleer:bob/cli-remote-control
Oct 31, 2026
Merged

bobleer merged 5 commits into
openBitFun:mainfrom
bobleer:bob/cli-remote-control

Conversation

@bobleer

@bobleer bobleer commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

CLI Claw could obtain WeChat/iLink credentials, but the CLI daemon did not own the bot listeners or route incoming messages to the Agent. This adds daemon-owned WeChat, Telegram and Feishu listeners and exposes Remote Connect management through the existing OpenBitFunControl tool on CLI and Desktop. Closing the interactive CLI no longer ends bot listening; paired, enabled connections resume after daemon restart.

Type and Areas

Type: feature / bug fix

Areas: CLI daemon, shared Remote Connect lifecycle and persistence, Desktop ProductControl adapter, Agent capability catalog, Peer capability negotiation, focused Windows CI, documentation.

Motivation / Impact

  • Share bot configuration, start/stop, restore, QR login and status in the existing Core owner. Retain saved credentials and sessions when disabling a channel; tolerate legacy records and preserve unreadable data.
  • Give each provider listener a process ownership lease and a tracked task, so Desktop and the CLI daemon cannot consume the same channel concurrently. Wait for task release before restarting it.
  • Route CLI management through an authenticated, versioned, bounded loopback endpoint owned by the daemon. Validate the executing account, avoid replaying mutations with unknown outcomes, and support headless shutdown/account retirement.
  • Add status, channel start/stop, private credential-file configuration, WeChat login and verbose-output operations to OpenBitFunControl. Its existing Agent availability remains unchanged; no Claw-only restriction is introduced.
  • Render iLink QR content as an actual PNG and terminal QR. The TUI renders the structured QR directly in an always-expanded tool card with a black/white quiet zone; narrow terminals ask for a resize instead of wrapping it. Image-only/invalid payloads have an explicit graphical-client fallback. Provider credentials are kept out of Agent responses.
  • Report expired WeChat credentials as login_required even while the polling task remains alive; retain that state until authentication succeeds. Recover stale daemon endpoint files after acquiring the exclusive process lease, including Windows crash recovery. Keep that lease until all bot/account cleanup finishes, even after management discovery is withdrawn, so a replacement daemon cannot start during shutdown.
  • Negotiate remote_connect_control_v1 for Peer hosts. Reject host credential paths in remote-workspace scope and reject direct Peer RPC operations that would disconnect their own reply transport. CLI LAN Relay remains explicitly unsupported; Mobile Web uses the configured account Relay.

Verification

Passed locally:

cargo build --locked -p openbitfun-cli --bin openbitfun
cargo test --locked -p openbitfun-cli --bin openbitfun -- daemon:: peer_host::commands::product_control::
cargo test --locked -p openbitfun-product-domains --no-default-features --lib -- remote_control:: product_control:: remote_surface::
cargo test --locked -p openbitfun-services-integrations --no-default-features --features remote-connect --lib remote_connect::bot::
cargo test --locked -p openbitfun-services-integrations --no-default-features --features remote-connect --lib remote_connect::qr_generator::
cargo test --locked -p openbitfun-core --no-default-features --features remote-connect --lib -- service::remote_connect::control:: listener_lifecycle_tests service::remote_connect::bot::
cargo test --locked -p openbitfun-core --no-default-features --features remote-connect --lib remote_connect_management_preserves_permissions_and_remote_path_scope
cargo test --locked -p openbitfun-desktop --lib openbitfun_control_host::tests
cargo check --locked -p openbitfun-desktop
cargo test --locked -p openbitfun-agent-content --test prompt_catalog_contracts
pnpm run check:web
pnpm run check:core-boundaries
pnpm run capabilities:test
pnpm run capabilities:check
pnpm run fmt:rs
git diff --check

The final shutdown-owner regression also passed with the 11 focused daemon tests. Windows CI now explicitly runs the daemon and QR unit-test filters in addition to its existing ConPTY target; Linux/macOS already run those in their complete CLI suite. GitHub configuration validation passed (54 checks, one platform-specific skip), and catalog freshness passed after rebasing on current main. Additional review verification passed: CLI tool-card + daemon regressions (15 tests), provider expiry regressions, Core Remote Connect control/listener/WeChat tests (27 tests), prompt contracts (9 tests), a fresh CLI executable build, generated catalog freshness, and pnpm run theme:color-audit:all. TUI QR checks use the actual Ratatui buffer across dark/light/monochrome themes, collapsed/expanded cards, history-style metadata, narrow/resize and malformed/image-only payloads. A live native Terminal QR scan has not been repeated.

The focused Web UI Peer adapter/connection-manager tests also passed (107 tests).

User-assisted live macOS verification: WeChat QR confirmation, bot pairing, inbound message → Claw → WeChat reply, continued operation after closing Terminal, channel stop/start, and paired listener restoration after daemon restart. Mobile Web account Relay reported connected. No live SSH workspace, physical Peer, Mobile Web browser or Detached Dispatch round trip was claimed; those paths have the focused scope/compatibility fixtures described above.

Windows CI used the repository’s existing Tauri #13419 pre-test loader exception for the Desktop library harness. The separate Windows daemon/QR suite ran and passed 12 tests, and the native Computer Use and product-control contracts passed. Linux/macOS Desktop tests passed. This PR does not change that existing exception.

Reviewer Notes

AI-assisted implementation; testing level: focused automated checks plus the live WeChat exercise above. CI for the final head passed: all 13 jobs succeeded, covering the three OS matrices, Web UI/Mobile Web, Windows DSH packaging, Linux x64/ARM64 CLI and Relay binaries, installer verification, and Relay runtime image checks. Repository Object Sizes also passed. The existing Windows Desktop loader exception is documented above.

No Cargo dependency expansion or new Tauri command is introduced. Persisted bot disablement defaults to empty for older installs; stopping a bot no longer deletes its saved connection. Auto-start service installation remains an explicit user action.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer
bobleer force-pushed the bob/cli-remote-control branch from b1f7e6d to 2abb4fb Compare October 31, 2026 03:22
@bobleer
bobleer merged commit 3b9a14c into openBitFun:main Oct 31, 2026
14 checks passed
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