Skip to content

Command relay over Tower (/api/command) #1088

Closed

Description

@amrmelsayed

Summary

A Tower endpoint that relays canonical commands from a controller to the active
editor provider over Tower's existing SSE + REST transport (no new socket, no
project-file scanning). The relay is stateless and dormant until a controller
POSTs, so this is additive infrastructure.

Depends on #1087 (wire contracts).

Functionality

  • Route: /api/command (POST). SSE event: command (fanned to providers).
  • A controller POSTs { verb, args }; Tower validates the verb is present and
    broadcasts it as a command SSE event. The provider maps and allowlists the
    verb (Tower stays a dumb relay — no allowlist, no execution, no per-controller
    state).
  • Lazy, self-routing seam: tower-routes delegates /api/command to the relay,
    which initializes its broadcast dependency from the route context on first hit.

Acceptance

  • A verb POSTed to /api/command reaches providers as a command SSE event; a
    verb-less body is rejected with 400.
  • Everything rides existing transport (no new socket); unit + e2e tests green.

Boundary

Tower holds no controller navigation state and no subscription/presence state —
the relay is a stateless pass-through. Zoom navigation (Tower -> builders ->
builder -> file) is the controller's own concern, driven by the overview API plus
controller-side cursor state, not by Tower.

Known limitation / follow-up (non-blocking)

/api/command inherits Tower's existing route posture: isRequestAllowed is
currently a permissive stub and the origin check is CORS-only, so the route is not
authenticated beyond what the rest of the Tower API already is. This is a
pre-existing, Tower-wide concern, but the command verbs raise the stakes (some are
privileged, e.g. spawn-builder / run-dev), and it is more exposed when the
tunnel/cloud path is active. Tracked as a separate Tower-auth follow-up; not a
blocker for this relay.

Activity

  1. added
    area/tower
    on Jun 21, 2026
  2. self-assigned this
    on Jun 21, 2026
  3. changed the title [-]Editor + command relay over Tower (/api/editor/*, /api/command)[/-] [+]Command relay over Tower (/api/command)[/+] on Jun 21, 2026
  4. amrmelsayed commented on Jun 21, 2026

    @amrmelsayed
    CollaboratorAuthor

    Merged in #1091 (commit fd01505).

  5. added a commit that references this issue on Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/tower

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions