Skip to content

feat(cli): bxc desktop command for display-v1 streaming - #12

Open
pokgak wants to merge 1 commit into
mainfrom
feat/desktop-command
Open

pokgak wants to merge 1 commit into
mainfrom
feat/desktop-command

Conversation

@pokgak

@pokgak pokgak commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds `bxc desktop [--local-port N] [--json]` (top-level command, per owner direction) — the local viewer path for display-v1 desktop streaming (ADR 0037 amendment "display-v1", ADR 0057). It opens a service-access session mapping one explicit local IPv4-loopback port to the guest's remote port 5900 (the wayvnc listener from the desktop closure), prints the endpoint and expiry, stays in the foreground until Ctrl-C, then closes the session (generation-scoped revoke).

Contents

  • `src/services-session.ts` — byte-identical vendored port of the canonical session (`application/sdk/typescript/src/services.ts` in the internal sandbox repository). Only change: binary resolution via `BOXCOMPUTE_SERVICE_CLIENT` → digest-pinned GitHub release asset (`service-client-v0` on the public boxcompute/sdk repo; null digests until published → actionable error). Header documents the canonical source and the consolidation into `@boxcompute/sdk` ≥ 0.3.0.
  • `src/client.ts` — `createServiceAccess` / `lookupServiceAccess` / `revokeServiceAccess` against the public v2 API (`Idempotency-Key` = operation UUID; body without `operation_id`), following existing request/error patterns.
  • `src/cli.ts` — the command: HTTPS-only connection URLs, local-port-conflict fails before any grant is requested, no IPv6/wildcard/auto-fallback, session expiry reported and exited (no auto-reconnect), revoke-on-SIGINT with the contract's unconfirmed-expiry wording on failure, `--json` mode.

Example output:

Desktop endpoint: 127.0.0.1:15900 (RFB/VNC)
Sandbox: sbx-one
Generation: 3f0a1c2e-...
Expires at: 2026-09-21T08:38:11.000Z (5 minutes remaining)
Press Ctrl-C to close the session and revoke access.
If nothing is listening, run `desktopctl start` inside the sandbox.

Verification

  • `bun test`: 56 pass (9 new desktop tests: help, args, HTTPS enforcement, port-conflict-before-grant, happy path, revoke-on-signal, unconfirmed wording, JSON shape; +1 client HTTP test).
  • `bun run lint` (oxlint --max-warnings 0), `bun run typecheck`, `bun run build`: clean.

Dependencies

  • Needs a running VM sandbox from the desktop-closure image (`desktopctl start`) and port 5900 allowed by the operator's service-access gate.
  • Until the `service-client-v0` release is published on boxcompute/sdk, users must set `BOXCOMPUTE_SERVICE_CLIENT`.
  • Consolidates onto `@boxcompute/sdk` ≥ 0.3.0 (see that repo's service-access PR) once published.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Vendored, byte-identical service session (services-session.ts) with
BOXCOMPUTE_SERVICE_CLIENT / pinned-release binary resolution, service-access
client methods, and the top-level desktop command that maps one local
IPv4-loopback port to remote 5900, prints the endpoint and expiry, and
revokes on exit. ADR 0037 amendment, 2026-09-21.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0c297-b187-7142-a4fe-f8878f75a437
Co-authored-by: Aiman Ismail <m.aimanismail@gmail.com>

This branch has not been deployed

No deployments
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