Skip to content

feat(web): project picker uses v1 ProjectService - #61

Merged
cooper (czxtm) merged 1 commit into
mainfrom
feat/studio-project-picker-v1
Sep 23, 2026
Merged

cooper (czxtm) merged 1 commit into
mainfrom
feat/studio-project-picker-v1

Conversation

@czxtm

Copy link
Copy Markdown
Member

The Studio project picker now lists and adds projects through the agent's v1 ProjectService, called from the browser with connect-query over one shared transport provided in AgentProvider. Before this, it went through the tRPC agent router, which fetched localhost:9876 from the web server and so could not reach a user's agent from the Cloudflare-hosted Studio.

  • Switching projects and reading the current project stay on REST until per-request project selection lands.
  • Projects the agent reports as invalid are marked, and they can't be opened.
  • Demo mode is unchanged and makes no network calls.
  • The tRPC agent proxy router is deleted, along with the dead security-status-card and ProjectIndicator.
  • AgentHttpClient getCurrentProject/openProject now unwrap the agent's { success, data } envelope. They used to return it as-is.
  • @connectrpc/connect-query ^2.3.1 is added. bun.nix was regenerated with bun2nix -o bun.nix, which also drops 26 stale entries.

Verification by the implementer:

  • The normalized tsgo error sets are identical. packages/api goes from 18 errors to 16, because the deleted router held 2.
  • There are 6 new tests, each confirmed to fail when its behaviour is broken.
  • A live browser run against a real agent built from the branch showed ListProjects 200, /api/project/open 200, AddProject 400 with its message shown, and no /api/trpc/agent calls.
  • A CORS preflight from https://stackpanel.com is allowed.
  • bun 1.3.2 (the CI pin) accepts the lockfile with --frozen-lockfile.

Verification after rebasing onto main (the pre-merge foundation commit dropped out as already applied, and the patch is unchanged), in the devshell:

  • tsgo on apps/web gives the same normalized error set as origin/main. packages/api loses only the 2 errors from the deleted router.
  • bun run test in apps/web: 55 pass, 1 known R2 cache failure.
  • bun install --frozen-lockfile (bun 1.4.2) leaves bun.lock unchanged.
  • nix flake check --no-build passes with the regenerated bun.nix.

Refs stackpanel-thq.8.4, ADR 0004

The sidebar project picker listed, validated and opened projects through
the tRPC agent router, which fetches http://localhost:9876 from the web
server and so cannot reach a user's agent from the Cloudflare-hosted
Studio. It now calls the agent's v1 ProjectService from the browser:
ListProjects through connect-query, and AddProject, whose
InvalidArgument message replaces the separate validate step. Projects
the agent reports invalid show the reason and cannot be opened.

AgentProvider creates one Connect transport per host, port and token
and provides it with connect-query's TransportProvider;
useAgentRpcClient reuses it instead of building its own.
@stackpanel/proto exports the v1 generated code as
@stackpanel/proto/agent/v1/*.

Switching and reading the current project stay on REST
(/api/project/open and /api/project/current) until requests select
their project (stackpanel-thq.8.1). AgentHttpClient now unwraps the
agent's { success, data } envelope for both; it returned the envelope
itself, which only the demo's bare fixtures matched, so the setup
wizard's current-project read was also empty against a real agent. The
demo keeps its badge and makes no project requests.

With its last callers gone (the picker, the unused ProjectIndicator and
the dead SecurityStatusCard), the tRPC agent router is deleted. bun.nix
is regenerated with bun2nix, which also drops 26 entries left over from
the last bun.lock change.

Refs: stackpanel-thq.8.4
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Preview pr-61 has been destroyed.

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview pr-61 has been destroyed.

@czxtm
cooper (czxtm) merged commit 1cd4bbb into main Sep 23, 2026
14 checks passed
@czxtm
cooper (czxtm) deleted the feat/studio-project-picker-v1 branch September 23, 2026 14:28
@linear-code

linear-code Bot commented Sep 23, 2026

Copy link
Copy Markdown

ENG-844

This branch was successfully deployed

2 active deployments
pr-61 — cc5dcbf8 Deployed Sep 23, 2026 by czxtm via deploy #217
docs-preview — cc5dcbf8 Deployed Sep 23, 2026 by czxtm via deploy #203
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