Repository navigation
connect-next 4/5: frp-client and the connect-next plugin - #6050
Merged
Merged
Conversation
SawyerHood
force-pushed
the
connect-next/4-plugin
branch
from
October 21, 2026 16:43
ce3593d to
dea8732
Compare
SawyerHood
force-pushed
the
connect-next/4-plugin
branch
from
October 21, 2026 16:50
dea8732 to
1a64038
Compare
@bb/frp-client (download, verify, configure and supervise frpc) and the builtin bb--connect-next plugin (disabled by default): settings, status, RPC, CLI and skill; it tunnels the server through its ingress and serves the server machine's port shares on the next address. bb-account lets it read the server credential; connect lists next share URLs. Settings copy names no fixed next domain.
SawyerHood
force-pushed
the
connect-next/4-plugin
branch
from
October 21, 2026 16:53
1a64038 to
d6c79a5
Compare
SawyerHood
added a commit
that referenced
this pull request
Oct 21, 2026
…n protocol 247) (#6051) ## Human comments ## What was wrong After PR 4 only the server machine's own ports answer on the next address. Every other enrolled machine shares ports at `https://<machine-label>--<port>.getbb.app` through its host daemon's Cloudflare tunnel, and has no way onto the Fly gate. Two bugs from the live staging test are fixed here too. PR 5 of 5 (stack: account API → server ingress → gate → plugin → machine tunnels). Based on #6050. ## What changed - **Wire change: `HOST_DAEMON_PROTOCOL_VERSION` 246 → 247.** The session-open response carries `connectNext: { generation, config }`; the server pushes `{ type: "connect-next.replace", generation, config }` to each connected daemon with a bb connect machine credential; the daemon answers `{ type: "connect-next.status", status }`. Compatibility with the previously shipped daemon is kept deliberately and tested: `HOST_DAEMON_COMPATIBLE_PROTOCOL_VERSIONS = [246, 247]`; a 246 daemon gets the old session-open response and no `connect-next.*` message, so its Cloudflare machine tunnel works as before (`hostDaemonSupportsConnectNext`). (On the old branch this was 244 → 245; main moved to 246 meanwhile, so ours is 247 and 246 is the accepted previous version.) - `apps/host-daemon/src/connect-next`: runs an `FrpcSupervisor` from `@bb/frp-client` with one proxy per declared shared port at `<machine-label>--<port>.<domain>`, using the machine credential; refuses a config whose domain is not its enrollment's base domain or `next.<base domain>`, whose tunnel host is not `tunnel.<domain>`, or that is not `wss` for an https enrollment; stops after 30 s without a server session (a next-joined machine cannot hear `null` once next is off). - `apps/server`: `host-shared-ports.ts` keeps one next-tunnel config owned by a plugin and sends it; `bb.hosts.internal_DO_NOT_USE_setNextTunnels`, `internal_DO_NOT_USE_nextTunnelStatuses`, `internal_DO_NOT_USE_onNextTunnelStatusChange` (SDK types, fake host, `docs/api_to_audit.md` entry naming `connect-next` as the only caller). `PLUGIN_SDK_VERSION` 0.6.66 → 0.6.67; `connect-next` requires it. - `apps/connect-next`: the gate relays `POST /api/connect/machine-label` (machine credential) to the account API so a machine enrolled through the next address learns its label; a label is held while any of its proxies is open (machine presence, peer routing); a proxy its still-connected client removed answers 503 at once. - `apps/host-daemon/src/connect-tunnel`: machines enrolled through a next address skip the Cloudflare dial. - `plugins/connect-next`: turns machine tunnels on with the plugin, shows each machine's tunnel and shares in settings, status and CLI. `plugins/connect`: other machines' listings get `nextUrl`. - Staging fix: a machine enrolled through the next address listed the same `https://<label>--<port>.next.<domain>` as both `url` and `nextUrl`, so `bb connect expose … --host <machine>` printed it twice. Its listing now has only `url` (the next address) and no `nextUrl`; documented in `plugins/connect/README.md`, the share-server-links skill and `docs/connect-next.md`. - Staging fix (also in PR 4 for the earlier copy): the settings copy names no fixed `next.getbb.app`. - Test fixes from CI: the daemon's real-frpc test dials frps at `127.0.0.1` through a wrapped supervisor (Windows frpc cannot resolve `*.localhost`) and still asserts the runner prepared `tunnel.next.bb.localhost`; `e2e-local.ts` takes the live-test provider from `@bb/test-helpers` (`LIVE_TEST_PROVIDER_ID`) so core gains no provider-id literal (provider-literal ratchet). - `packages/host-daemon-contract` test: added `idleProviderSessionTimeoutMinutes`, which main made required, to the new session-open case. ## How you verified - Local end to end on the top of the stack, `apps/connect-next/scripts/e2e-local.sh` with `BB_E2E_PLAYWRIGHT_DIR` (browser + MCP OAuth) and `BB_E2E_OLD_DAEMON_REPO` (a checkout of main `9fad6b6255`, protocol 246): **single gate 94/94, `--two-gates` 96/96, nothing skipped.** Covers the next-joined machine (join through the gate, a real codex turn, shares, HMR, unexpose, off/on), a Cloudflare-joined machine (share on both addresses, next off stops its frpc), and the 246 daemon (opens a session with protocol 246, its Cloudflare share answers, it gets no next tunnel). - `pnpm exec turbo run typecheck --filter='...[connect-next/4-plugin]'`: all tasks pass. `pnpm exec turbo run test --filter='[connect-next/4-plugin]'`: `@bb/host-daemon-contract` 74/74 (incl. 246/247 compatibility), `@bb/host-daemon` 806 passed / 7 skipped (the two `command-discovery` failures are the stray `/tmp/.git` on bee; 28/28 with `TMPDIR` outside `/tmp`), `@bb/server` 3,646 passed / 1 skipped (incl. a protocol-246 daemon getting its Cloudflare shares and never a next message), `@bb/connect-next` 90/90, `bb-plugin-bb--connect-next` 28/28, `bb-plugin-connect` 143/143 (the new next-enrolled listing test fails before the fix with `nextUrl` present), `@get-bb/plugin-sdk` 390/390. - `oxfmt --check`, `pnpm lint`: clean. - CI: the full `CI` workflow was dispatched on this branch (the stack's top), since stacked PRs not based on main only get the base checks. > AGENT GENERATED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
With the account API (PR 1), the server ingress (PR 2) and the gate (PR 3) in place, nothing on a bb server dials the gate yet. bb needs an opt-in builtin plugin that runs
frpcto the gate with the server's link credential, points it at the tunnel ingress, and serves the server machine's port shares on the next address too.PR 4 of 5 (stack: account API → server ingress → gate → plugin → machine tunnels). Based on #6049.
What changed
packages/frp-client(@bb/frp-client): frpc download and SHA-256 verification (frp 0.71.0), config writing (wss with a trusted CA file and server name, credential in metadatas, proxies), log redaction and anFrpcSupervisor(restart with backoff, hot reload, login-refusal handling);./testingfixtures that run real frps and gate hooks.plugins/connect-next(builtinbb--connect-next, disabled by default; registered inbuiltin-registry.ts, bundled plugins,bb-official.json, the bundled marketplace): requiresbbPluginSdk >=0.6.66(the ingress member from PR 2); settingenabled, RPCstatus/setEnabled, CLIbb connect-next status|on|off, a settings section with state, address and shared ports, and a skill. The next domain follows the bb account:next.<host of the account's base URL>(BB_CONNECT_NEXT_SERVERandBB_CONNECT_FRPCoverride the server and binary). It opens the server's tunnel ingress throughbb.server.internal_DO_NOT_USE_openTunnelIngressand proxies<label>to it and<label>--<port>straight to127.0.0.1:<port>for shares.plugins/bb-account:bb-account.v1.connectCredentialalso answersbb--connect-next(read-only; adopting and refusing a pairing stay connect-only).plugins/connect:connect.internal_DO_NOT_USE.serverShares/waitForServerSharesChange(long poll, answers onlybb--connect-next), and share listings carrynextUrlfor server-machine shares while connect next is on (bb connect exposeprints it on a second line).apps/server: the real-frps tunnel ingress test (moved here from PR 2 because it drives the plugin's frpc).docs/configuration.md(Connect next section),turbo.json(plugin typecheck needs the SDK types).enabledsetting and the plugin description no longer hard-codenext.getbb.app(wrong on staging,next.vibecodethis.site); they saynext.<your bb account's domain>and the section shows the address derived from the account.How you verified
pnpm exec turbo run typecheck --filter='...[connect-next/3-gate]': 109/109 tasks pass.pnpm exec turbo run test --filter='[connect-next/3-gate]'(turbo.json changed, so every package ran): all green except failures that are unrelated to this change and pass on rerun or fail on main for the machine:@bb/servertimeouts under full-repo load intimeline-in-turn-window,plugin-native-server-loading,plugin-service(75/75 when rerun),@bb/host-daemoncommand-discovery(stray/tmp/.giton bee; 28/28 withTMPDIRoutside/tmp),@bb/scriptsci-bun(nozipbinary on bee). Relevant counts:@bb/frp-client38/38,bb-plugin-bb--connect-next26/26 (incl. the new copy test: fails with the old(next.getbb.app)copy),bb-plugin-connect141/141,bb-plugin-bb-account61/61,@bb/server3,637 passed (incl. real frps + plugin frpc through the ingress).oxfmt --check,pnpm lint: clean.