|
| 1 | +# VSCode Guest Mode + Share Links Design |
| 2 | + |
| 3 | +**Date:** 2026-02-06 |
| 4 | + |
| 5 | +## Goal |
| 6 | +Add guest mode and share link workflows to the VSCode extension so users can connect quickly with a share link, while keeping full management features behind PAT login. Improve the Worker Detail view with share link selection and actions. Keep UI copy simple and user-centric. |
| 7 | + |
| 8 | +## Summary of Decisions |
| 9 | +- Guest mode is persisted (global state). No PAT required. |
| 10 | +- In guest mode: only Studio view is visible; vGPU Workers and Machine Hosts are hidden. |
| 11 | +- Onboarding prompt offers "Continue as Guest" or "Login with PAT". |
| 12 | +- Worker Detail panel shows top 10 share links for that vGPU worker, sorted newest-first. |
| 13 | +- Selecting a share shows Connection URL (IP:port), vendor, short code/link, created time, and actions. |
| 14 | +- "Use remote vGPU" opens a VS Code terminal and auto-runs `ggo use <code> -y`. |
| 15 | +- "Create Studio" opens the Create Studio flow with share link prefilled. |
| 16 | +- User-facing terms: vGPU worker, Machine Host, Machine Agent. |
| 17 | + |
| 18 | +## Architecture |
| 19 | +- CLI remains the source of truth. Extension uses `ggo share list -o json`. |
| 20 | +- Share list is grouped by `worker_id` in the extension. Sorting by `created_at` DESC; top 10 per worker. |
| 21 | +- Guest mode stored in `ExtensionContext.globalState` (e.g., `gpugo.guestMode`). |
| 22 | +- Views visibility controlled by context keys (e.g., `gpugo.guestMode`, `gpugo.loggedIn`). |
| 23 | + |
| 24 | +## Data Flow |
| 25 | +1. Extension activation |
| 26 | + - Check auth status via CLI. |
| 27 | + - If not logged in and not guest, show onboarding prompt. |
| 28 | + - Set context keys and refresh views. |
| 29 | +2. Worker Detail view |
| 30 | + - Fetch worker details via CLI. |
| 31 | + - Fetch shares via `shareList()` and filter by worker ID. |
| 32 | + - Sort by `createdAt` DESC, select first by default. |
| 33 | + - Render select list and detail card. |
| 34 | +3. Share actions |
| 35 | + - Use remote vGPU: open terminal, run `ggo use <shortCode> -y`. |
| 36 | + - Create Studio: open Create Studio panel with share link prefilled. |
| 37 | +4. Guest mode |
| 38 | + - Studio view adds "Connect with share link" action. |
| 39 | + - Prompt for share link/code, open terminal and run `ggo use <code> -y`. |
| 40 | + |
| 41 | +## UI / Copy |
| 42 | +- Views: |
| 43 | + - Workers -> "vGPU Workers" |
| 44 | + - Devices -> "Machine Hosts" |
| 45 | +- Worker Detail labels: |
| 46 | + - "vGPU worker ID", "Machine Agent ID", "Listen Port", "vGPU IDs" |
| 47 | +- Share section: |
| 48 | + - Helper text: "Share links let others connect to this vGPU worker." |
| 49 | + - Detail card fields: Connection URL (IP:port), Vendor, Short Link, Created |
| 50 | +- Buttons: |
| 51 | + - "Use remote vGPU" |
| 52 | + - "Create Studio from this share" |
| 53 | +- Guest onboarding: |
| 54 | + - Message: "Use a share link to connect instantly, or sign in to manage vGPU workers." |
| 55 | + - Actions: "Continue as Guest" (default), "Login with PAT" |
| 56 | +- Tooltips: |
| 57 | + - "Share link: a one-time or reusable link that connects to a vGPU worker." |
| 58 | + - "Use remote vGPU opens a terminal and runs ggo use for you." |
| 59 | + |
| 60 | +## Error Handling |
| 61 | +- No shares: show "No share links yet" with hint to use `ggo worker share` in CLI. |
| 62 | +- Missing fields: show "Not available" and disable actions if needed. |
| 63 | +- CLI missing or command failure: show toast and keep terminal open. |
| 64 | +- macOS: show message that remote vGPU use is not supported on macOS before attempting. |
| 65 | + |
| 66 | +## Testing Plan (high value) |
| 67 | +- Unit: share grouping + sorting + top-10 per worker (pure function). |
| 68 | +- Unit: guest mode state transitions (guest -> login, login -> logout -> guest). |
| 69 | +- UI: worker detail renders share select and updates detail card on change. |
| 70 | +- Manual: guest onboarding, hide/show views, terminal auto-run behavior. |
| 71 | + |
| 72 | +## Open Questions (none) |
| 73 | +All requirements resolved with current decisions. |
0 commit comments