refactor: delete the v1 desktop surface and the Electron hook server

Merged
KI
10d ago
+1167-98622

Part 1 of #7859, split out so the deletion can merge without the v2 rename. Based on Satya's work in #7859.

What changes

  • Deletes the v1 desktop surface: screens, routes, stores, and the Electron tRPC routers only v1 used.
  • Deletes the v1 terminal runtime and the Electron agent-hook HTTP server. Agent hooks post only to the host-service; the hook scripts move to v22 and drop the fallback to the Electron port.
  • Keeps the v1 importer (V1AutoMigration and the migration router).
  • Saved router entries that point at a v1 route (/workspace…, /workspaces, /project…) restore to the dashboard instead of a missing route.

What does not change

  • v2 routes (/v2-workspace/$id, /v2-workspaces), file and component names, persisted keys, hotkey ids, and every cloud and host-service tRPC procedure name. The rename is #7859, rebased on top of this.
  • No API or database changes.

Known behaviour changes

  • With the Electron hook server gone, an agent hook that reaches no host-service (neither the launch-time URL nor any host manifest answers) is dropped. Before, it fell back to the Electron port and the renderer forwarded it. Normal delivery is unchanged.
  • Every desktop event now carries surface: "v2" from PostHog init, including the ones sent before sign-in.

Fixes found while splitting (these also apply to #7859)

  • Cmd+N on a workspace keeps opening New Workspace through the viewed-project path, as on main.
  • The worktree-location fallback shows ~/.paradev/worktrees, not ~/.superset/worktrees.
  • Branching a chat into a new worktree navigates to the id the host actually created.
  • PostHogSurfaceTagger stays mounted (now always v2), so the surface person properties keep being written.

Verification

  • Typecheck (desktop and dependent packages), lint, sherif and check:i18n pass. Desktop, host-service, agent-setup and shared tests pass, except three that fail the same way on an unchanged checkout here (a cloud-api-client hook timeout, a fish teardown test, a timezone test).
  • Upgrade test on packaged builds: used a packaged origin/main build, quit it, then opened a packaged build of this branch on the same home and profile, and relaunched it once more.
    • The route, the Chat and two Terminal tabs, and the collapsed sidebar section were kept. The live terminal session survived, scrollback included.
    • localStorage is unchanged except the PostHog key.
    • The hooks were rewritten from v21 to v22. A Claude run in the updated terminal recorded its Stop event in the new host-service.
    • All 48 routes render with no error boundaries or console errors. Recently viewed lists workspaces, and the switcher marks the current workspace.

Co-authored-by: Satya Patel satyapatel111@gmail.com


Summary by cubic

Removes the v1 desktop surface — the v1 screens, routes, stores, and the Electron tRPC routers only v1 used — together with the v1 terminal runtime and the Electron agent-hook HTTP server. Agent hooks now post only to the host-service, and the v22 hook scripts drop the fallback to the Electron port. The v1 importer (V1AutoMigration and the migration router) stays, and saved router entries pointing at v1 routes restore to the dashboard. v2 routes, names, persisted keys, hotkey ids, and all cloud and host-service tRPC procedure names are unchanged (the v2 rename is a separate PR), with no API or database changes.

Fixes found while splitting

  • Cmd+N on a workspace keeps opening New Workspace through the viewed-project path, matching main.
  • The worktree-location fallback shows ~/.paradev/worktrees, not ~/.superset/worktrees.
  • Branching a chat into a new worktree navigates to the id the host actually created.
  • PostHogSurfaceTagger stays mounted (now always v2), so the surface person properties keep being written.

Verification

  • Upgrading a packaged build keeps routes, tabs, the collapsed sidebar, and live terminal sessions; hooks rewrite from v21 to v22.
  • Typecheck, lint, sherif, and check:i18n pass; desktop, host-service, and agent tests pass except three that fail identically on an unchanged checkout.