Skip to content

sdk: restricted controller client — make @cluesmith/codev-sdk/controller a true capability surface #1411

Closed

Description

@amrmelsayed

Problem

@cluesmith/codev-sdk/controller documents itself as 'the curated entry point for outside-in Tower integrations' (a controller READS overview state and ACTS via canonical verbs), but packages/sdk/src/controller.ts:15 re-exports the full TowerClient class. Every public method is therefore reachable from the 'curated' surface: ~39 methods including host/admin operations (addArchitect, killTerminal, sweepHusks, and as of #1401 the canvas view registration trio registerCanvasView/heartbeatCanvasView/unregisterCanvasView). The stated posture and the actual surface disagree.

Surfaced by codex consultation on #1401 phase 5 (evidence: codev/projects/1401-artifact-canvas-remote-command/1401-phase_5-iter1-rebuttals.md). Accepted as-is there because the three new methods are no more exposed than the 36 before them and the real fix is this issue: a breaking change to the subpath, unrelated to canvas commands.

Requirement

Model the controller surface as a capability, not a doc note (house lesson: permissions as roles/capabilities):

  1. Introduce a restricted controller client exposing only the controller capability set — read (overview, workspaces, SSE parsing) and act (sendCommand, sendCanvasCommand), plus the types/constants already exported.
  2. Stop exporting TowerClient from the controller subpath (breaking; the full client remains available from the sdk root for hosts that are not controllers).
  3. Boundary/API-surface test pinning the controller subpath's export list, so the surface can only grow deliberately.
  4. Migrate known consumers: apps/streamdeck (controller-subpath owner reviews; the deck uses only the controller capability set today, so this should be mechanical).

Sequencing

After #1401 merges (touches the same file). Before the sdk's first npm publish if feasible — a breaking subpath change is free while nothing external consumes it; after publish it costs a major/minor dance.

Suggested protocol

AIR.

Activity

  1. added
    area/core
    on Aug 11, 2026
  2. amrmelsayed commented on Aug 12, 2026

    @amrmelsayed
    CollaboratorAuthor

    Architect decision (Amr, 2026-08-12): CLEAN REMOVAL, no deprecation period. Ships in the next minor (3.4.0) with a migration line in the release notes.

    Framing correction for the record: sdk 3.3.0 WAS published 2026-08-09 with ./controller exporting TowerClient (verified against the npm registry and the v3.3.0 tag), so this is technically a semver break of a published subpath - accepted by the owner on blast radius: 3 days of exposure, the only known consumer is apps/streamdeck (updated in the same PR), and the full client remains available at the separate published ./tower-client subpath, making any external migration a one-line import change.

    Requirements for the lane:

    1. ./controller narrows to the capability surface a controller actually needs (what apps/streamdeck consumes today: overview/SSE subscription, sendCommand, sendCanvasCommand, workspace listing, and the associated types). TowerClient and COMMAND_ROUTE/CANVAS_COMMAND_ROUTE stop being re-exported there.
    2. The narrowed surface must keep a construction path with auth injection (the deck constructs with getAuthKey: readLocalKey from ./node) - a factory returning the capability surface, or equivalent.
    3. Export-list pin: a type-test asserting the controller subpath's exact export list, failing CI on any widening (same spirit as the Introduce packages/codev-sdk: client SDK for Tower (server/client dependency isolation) #1189 boundary tests).
    4. Same-PR refactor of apps/streamdeck (plugin.ts, store.ts, actions.ts imports) - behavior unchanged, imports only. ./tower-client itself is untouched.
    5. Release notes carry the migration line (import { TowerClient } from '@cluesmith/codev-sdk/tower-client').

    Runs in parallel with #1428 (different files). PR #1429 (actions.ts) may merge to main mid-lane - merge main before opening the PR.

  3. added 2 commits that reference this issue on Aug 12, 2026
  4. added a commit that references this issue on Aug 12, 2026
  5. amrmelsayed commented on Aug 12, 2026

    @amrmelsayed
    CollaboratorAuthor

    Shipping record: PR #1430 merged 2026-08-12T21:35:42Z (merge e3fa49b) - clean removal per the owner decision on this issue. CMAP: gemini+claude APPROVE; codex REQUEST_CHANGES (type-narrowing without runtime narrowing) resolved by the bound-method facade, independently verified by the architect. Export surface pinned by test; deck migrated in-PR, behavior unchanged. Release-notes entry + migration line: 4c3c2bd on docs/vscode-changelog (./controller no longer exports TowerClient; hosts use ./tower-client; controllers use createControllerClient). Ships with 3.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions