feat(workspaces): implement ssh tunneling and workspace connect command

This commit is contained in:
mkorwel
2026-03-19 08:50:42 -07:00
parent bd523c8d48
commit 22ff923100
7 changed files with 209 additions and 3 deletions
+32
View File
@@ -0,0 +1,32 @@
# Milestone 3 Sub-plan: Connectivity & Persistence
## 1. Objective
Enable the "Teleport" experience by allowing users to securely connect to their remote workspaces with persistent terminal sessions.
## 2. Tasks
### Task 3.1: SSH Tunneling Logic (IAP)
Implement the mechanism to securely tunnel SSH traffic through Google Identity-Aware Proxy.
- [ ] Implement `SSHService` in `packages/core/src/services/sshService.ts`.
- [ ] Logic to execute `gcloud compute ssh --tunnel-through-iap`.
- [ ] Handle SSH key generation and OS Login checks.
### Task 3.2: Workspace Connect Command
Implement the primary `wsr connect <id>` command.
- [ ] Add `workspace connect` subcommand to `packages/cli/src/commands/workspace/connect.ts`.
- [ ] Logic to fetch instance details (name, zone) from the Hub before connecting.
- [ ] Pass necessary SSH flags (Agent Forwarding, Environment variables).
### Task 3.3: Persistence Integration (shpool)
Ensure the remote session survives disconnects.
- [ ] Update `remoteCli.ts` to wrap the shell in `shpool attach`.
- [ ] Verify `shpool` daemon is running correctly via the container entrypoint.
- [ ] Logic to handle terminal resizing across local/remote.
## 3. Verification & Success Criteria
- **Connect:** `gemini wsr connect [ID]` successfully drops the user into a remote shell.
- **Persistence:** User can disconnect (Ctrl+C or close terminal), reconnect, and find their previous state intact.
- **Security:** Connection only works for the workspace owner and requires a valid `gcloud` session.
## 4. Next Steps
- Implement Task 3.1: Create the `SSHService` in the core package.
+2 -2
View File
@@ -25,10 +25,10 @@ Enable developers to manage their remote fleet from the local CLI. See
- [x] Add local configuration for Hub discovery (`settings.json`).
### Milestone 3: Connectivity & Persistence (Phase 3)
Enable the "Teleport" experience with session persistence.
See [Milestone 3 Sub-plan](./milestone-3-connectivity.md) for details.
- [ ] Implement `gemini workspace connect`.
- [ ] Setup `gcloud compute ssh --tunnel-through-iap` logic in the client.
- [ ] Integrate `shpool` into the container entrypoint for session detachment.