Add cmux.com team-vault APIs for local Subrouter egress
Merged
LA
4mo ago+2836+2836+0123456789012345678901234567890123456789-439-439-012345678901234567890123456789
Summary
Adds the authenticated cmux.com control plane for shared Subrouter credentials. Every macOS or Linux client runs a loopback proxy and sends provider traffic from that machine. cmux.com selects the team account and brokers an access-only five-minute lease. Provider refresh tokens remain in the central Worker.
- Stack device sessions authenticate
sr loginand team membership. subrouter:useleases credentials;subrouter:manage_accountsuploads, repairs, and deletes them.- Upload and repair force one central refresh before success, transferring refresh-chain custody.
- Native bearer failures cannot fall back to browser cookies. Browser mutations require same-origin CSRF checks.
- API responses whitelist account metadata and never return provider refresh tokens, ID tokens, tenant keys, raw upstream errors, or provider endpoint overrides.
- CLI authentication needs Stack Auth plus Postgres, and no longer depends on transcript S3 configuration.
- Private beta access is restricted by
SUBROUTER_ALLOWED_TEAM_IDS. - Safe operation/status logging makes control-plane failures diagnosable without logging credentials.
Depends on https://github.com/manaflow-ai/subrouter/pull/99.
Deployment and canary
- Durable staging control plane: https://cmux-staging.vercel.app
- PR preview: https://cmux-hsjp16d1a-manaflow.vercel.app
- Staging deployment:
dpl_D3q6spAKA8vnL3Wsr3JkdR4ThceD - Production Worker:
subrouter.cmux.dev, version467267f5-fb1c-4d25-bacc-730a566a42ff - Worker staging:
subrouter-staging.cmux.dev, versionde30e48e-aa7d-4bb1-8704-a27dcd9d2e71 - Real canary:
sr loginselected the Stack team,sr doctorpassed, andsr codex execreturned exactlyOKthrough the local daemon. The central account remainedauth_valid: truewith no refresh failure.
Verification
bun run typecheckbun test tests/vault-route-helpers.test.ts tests/subrouter-accounts-route.test.ts tests/vm-route-auth.test.ts(82 pass)- Biome checks on touched files
Summary by CodeRabbit
- New Features
- Added credential lease creation and outcome reporting, plus lease events handling.
- Added account repair support and refreshed team listing/selection with account-management permissions.
- Added native-session logout for the subrouter.
- Bug Fixes
- Improved request validation and bounded payload handling across subrouter endpoints.
- Prevented invalid native credentials from falling back to browser sessions.
- Enhanced account listing/health details while avoiding credential exposure.
- Documentation
- Updated CLI auth route wiring to work correctly when vault storage configuration is absent.