For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [x]) syntax for tracking.
Goal: Add a Desktop remote workspace target that connects to an already running ZCode HTTP/WebSocket server and manages its workspace with the existing App UI.
Architecture: Extend the shared remote target model with kind: "server", then route Desktop remote session creation through the existing utility host process. The host process uses a Node WebSocket connector to the server /ws ChannelServer, wraps it as RemoteServiceAccess, exposes it through the existing MessagePort path, and keeps Desktop as desktop-continuous.
Tech Stack: TypeScript, Electron utilityProcess, ws, @zcode/rpc SocketProtocol, @zcode/client RemoteServiceAccess, existing ServiceCollection and Remote Connection dialog.
docs/remote/server-remote-workspace-connection.md and must stay aligned with implementation.workspaceKey = workspaceIdentity?.trim() || workspacePath remains the identity rule.deliveryKind = continuous; mobile /remote remains web-remote-replayable.DESIGN.md, support light/dark themes, i18n, desktop and mobile-web-safe responsive layout.pnpm typecheck and pnpm lint before final completion.Files:
packages/shared/src/remoteTarget.tspackages/shared/src/protocol.tspackages/shared/src/validation.tspackages/shared/src/platform.tspackages/shared/src/remote-workspace-identity.tspackages/shared/test/serverRemoteTarget.test.tsInterfaces:
ServerConnectOptions, ServerRemoteTargetSnapshot, buildServerRemoteWorkspaceIdentity(params), parseRemoteWorkspaceIdentity() support for server.Consumes: existing remoteTargetSchema, remoteTargetSchema users.
[x] Step 1: Write failing tests
Create packages/shared/test/serverRemoteTarget.test.ts covering schema acceptance, snapshot typing helper behavior through runtime schemas, and server identity parse/build.
Run: pnpm vitest run packages/shared/test/serverRemoteTarget.test.ts
Expected: FAIL because server target and identity builder do not exist.
Add ServerConnectOptions, include it in RemoteTarget, add serverConnectOptionsSchema, include it in remoteTargetSchema, add server snapshot type, update OpenInEditorRemoteTarget only if needed by type exhaustiveness, and update remote identity parser/build helper.
Run: pnpm vitest run packages/shared/test/serverRemoteTarget.test.ts
Expected: PASS.
Files:
packages/server/src/http.tspackages/server/test/serverInfoHttp.test.tsInterfaces:
GET /api/server-info with { serverId, version, protocolVersion, authRequired, workspaces }.Consumes: remote server connector in Task 3.
[x] Step 1: Write failing test
Add a server HTTP test that creates createHttpServer(...), fetches /api/server-info, and asserts stable fields exist.
Run: pnpm vitest run packages/server/test/serverInfoHttp.test.ts
Expected: FAIL with 404.
Add app.get("/api/server-info", ...) returning a minimal JSON body. Use a deterministic server id derived from host/user/home path or a generated process-local fallback only if no stable source exists. Keep workspaces empty for MVP.
Run: pnpm vitest run packages/server/test/serverInfoHttp.test.ts
Expected: PASS.
Files:
packages/desktop/src/host/serverRemoteConnection.tspackages/desktop/src/host/index.tspackages/desktop/test/serverRemoteConnection.test.tsInterfaces:
RemoteTarget kind server, server /api/server-info, server /ws.Produces: connectServerRemote(target, onDidClose) returning { services, dispose, serverInfo }.
[x] Step 1: Write failing connector tests
Test URL normalization (http -> ws, https -> wss, explicit /ws preserved), Authorization header redaction boundary, and that a mock WebSocket ChannelServer can answer a proxied service call.
Run: pnpm vitest run packages/desktop/test/serverRemoteConnection.test.ts
Expected: FAIL because module is missing.
Use ws, SocketProtocol, ChannelClient, and RemoteServiceAccess. Add a Node ISocket wrapper mirroring packages/server/src/http.ts. Fetch /api/server-info before WS. Pass bearer token if target.token exists. Dispose WS on host dispose.
In packages/desktop/src/host/index.ts, when InitRemoteWorkspace has target.kind === "server", call connectServerRemote() instead of setupRemoteConnection(). Use a server-specific service collection strategy that treats remote workspace services as authoritative for runtime/workspace services while keeping local Desktop platform-only services local where existing service contracts require local implementation.
Run: pnpm vitest run packages/desktop/test/serverRemoteConnection.test.ts
Expected: PASS.
Files:
packages/desktop/src/main/desktopRemoteSessions.tspackages/desktop/src/main/desktopHostProcess.tspackages/desktop/test/serverRemoteSessionManager.test.tsInterfaces:
RemoteTarget kind server.Produces: server target labels, target equality, duplicate detection, remote session creation without remote asset deployment assumptions.
[x] Step 1: Write failing tests
Assert server targets compare by normalized URL and workspace context, process label is sanitized from hostname/name, and InitRemoteWorkspace accepts server target.
Run: pnpm vitest run packages/desktop/test/serverRemoteSessionManager.test.ts
Expected: FAIL because server branch is missing.
Add server branches in getRemoteTargetProcessSuffix(), isSameRemoteTarget(), logging labels, and host init typing. Keep taskRealtime as Desktop continuous/relay_bridge behavior equivalent to non-WSL remote unless tests show it should be omitted.
Run: pnpm vitest run packages/desktop/test/serverRemoteSessionManager.test.ts
Expected: PASS.
Files:
packages/ui/src/lib/remoteConnectionWizard.tspackages/ui/src/RemoteConnectionDialogContent.tsxpackages/ui/src/RemoteConnectionFields.tsxpackages/ui/src/i18n/locales/en-US.tspackages/ui/src/i18n/locales/zh-CN.tspackages/ui/test/remoteConnectionWizard.test.tsInterfaces:
Server option in remote kind step and buildRemoteTarget() output { kind: "server", url, token?, workspacePath?, name? }.Consumes: shared RemoteTarget kind server.
[x] Step 1: Write failing wizard tests
Test server URL required, invalid URL rejected, valid URL trims and returns server target, token remains optional.
Run: pnpm vitest run packages/ui/test/remoteConnectionWizard.test.ts
Expected: FAIL because server fields do not exist.
Add compact Server form fields using existing input/button primitives and i18n strings. Keep cards/panels consistent with DESIGN.md; no raw colors.
Run: pnpm vitest run packages/ui/test/remoteConnectionWizard.test.ts
Expected: PASS.
Files:
packages/shared/src/validationAppSettings.tspackages/ui/src/root/reconnectRemoteWorkspaceHistoryEntry.tspackages/ui/src/root/useRemoteWorkspaceHistory.tspackages/ui/src/remote-connection/sshHistorySuggestions.ts or create server equivalent only if needed.packages/ui/test/useRemoteWorkspaceHistory.test.tsInterfaces:
ServerRemoteTargetSnapshot.Produces: persisted server target history and reconnect using stored target and workspace identity.
[x] Step 1: Write failing persistence tests
Add a remote workspace entry with target.kind = "server" and assert reconnect passes the target through unchanged and workspace identity is preserved.
Run: pnpm vitest run packages/ui/test/useRemoteWorkspaceHistory.test.ts --runInBand
Expected: FAIL because schemas/types reject server target.
Add server target snapshot schema and update formatting helpers so history/reconnect labels do not assume SSH/WSL/Docker only.
Run: pnpm vitest run packages/ui/test/useRemoteWorkspaceHistory.test.ts --runInBand
Expected: PASS.
Files:
Interfaces:
Produces: committed feature branch.
[x] Step 1: Run focused tests
Run all tests introduced or modified in Tasks 1-6.
Run: pnpm typecheck and pnpm lint.
Run: git diff --stat and git diff --check.
Commit with Conventional Commit message, for example feat: add server remote workspace target.