Skip to content

feat(gui): enforce FutureOS sign-in, hide pairing code, cap @-picker, add platform param - #51

Merged
tallcode merged 4 commits into
mainfrom
claude/wizardly-haibt-9f1787
Jul 27, 2026
Merged

tallcode merged 4 commits into
mainfrom
claude/wizardly-haibt-9f1787

Conversation

@tallcode

Copy link
Copy Markdown
Collaborator

Summary

This PR bundles four GUI improvements worked on in this session:

1. Enforce FutureOS sign-in with full-screen login gate

  • When no FutureOS account is signed in (on launch, or after signing out), a full-screen gate overlays the entire app. The rest of the app is unreachable until sign-in succeeds.
  • Gate includes: title, subtitle, sign-in button, and a language switch — all styled with existing design tokens.
  • Clicking "Sign in" starts the device-code login flow directly; the button transitions to "Signing in" with a spinner (no modal).
  • Sign-in success/ sign-out / hand-edited key all broadcast a future-auth-changed event, which drives the gate appearance/clearing via a global useFutureSignedIn hook in AppShell.
  • The login state machine was extracted from FutureLoginDialog into a shared useFutureLoginFlow hook (adds idle phase and cancel). Both the gate and the existing settings login dialogs use it.
  • AppShell early-returns the gate (or a short neutral spinner on first load) after all hooks, preserving the rules-of-hooks invariant.

2. Hide the pairing code during login

  • The authorization page now opens directly in the browser — the user code is no longer shown to the user (no manual copy/paste needed).
  • The login dialog still offers a "Copy link" fallback button in case the browser doesn't open.
  • Copy updates in zh/en settings: removed verifyCode/copyCode/authLink labels; refreshed gettingDeviceCode / waiting / description.

3. Append platform param to the opened authorization URL

  • The login flow appends a platform query param (macOS / Windows / Linux, else empty) to the authorization page URL so the web side can tailor itself.
  • Added login_platform() (compile-time cfg!) and append_login_platform() helpers with tests.

4. Fix @-mention picker: cap results, rank filename matches first

  • The workspace file picker now returns at most 10 results (no scrollbar) to prevent overflow clipping the top row.
  • Rank logic changed to match-type buckets: exact name > name prefix > name substring > path substring > fuzzy. Empty query still recency-ordered.
  • Added file_name helper and a ranking test.

Files changed

Area Files
Login gate components/layout/ForceLoginGate.tsx (new), components/layout/hooks/useFutureSignedIn.ts (new)
Login state machine features/settings/useFutureLoginFlow.ts (new), FutureLoginDialog.tsx (rewritten)
Auth platform param future_login.rs
@-picker fix MentionEditor.tsx, workspace_files.rs
Events & providers futureEvents.ts, providers.ts
App shell wiring AppShell.tsx
i18n layout.json (zh/en) + gate keys; agent.json (zh/en) placeholder; settings.json (zh/en) futureLogin cleanup

Test plan

  • cd gui && npx tsc --noEmit — passes
  • cd gui && npx eslint "src/**/*.{ts,tsx}" — 0 errors
  • cd gui && npx vitest run — 197 passed
  • cd gui/src-tauri && cargo test --lib workspace_files — 4 passed (new + existing)
  • cd gui/src-tauri && cargo test --lib future_login — 6 passed (new + existing)
  • Visual: make run-gui — gate on cold start, gate after sign-out, gate → sign-in → app, @-picker no clipping, @ ranking, settings login dialog regression, language switch on gate

🤖 Generated with Claude Code

tallcode and others added 4 commits July 27, 2026 16:10
- Limit the @ file picker to 10 results (no scrollbar) so the upward popover no longer overflows its container and clips the top row.

- Rank @ search by match bucket (exact name > name prefix > name substring > path substring > fuzzy) so the best match lands on top; empty query still recency-ordered.

- Update composer placeholder copy (zh/en) to describe tasks, @ context, / skills.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Stop displaying the device user code in the login dialog; the authorization page opens directly and the device-code poll loop is unchanged.

Append the client platform (macOS / Windows / Linux, else empty) as a platform query param to the authorization URL opened in the browser, and to the copy-link fallback.

Drop the now-unused verify/copy-code i18n strings and refresh the waiting copy.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
When no FutureOS account is signed in (on launch, or after signing out), a full-screen gate overlays the entire app with a title, subtitle, sign-in button, and language switch — the rest of the app is unreachable until sign-in succeeds. The existing device-code flow opens the browser directly (no pairing-code display, no modal).

Extract the login state machine from FutureLoginDialog into useFutureLoginFlow (adds idle phase, cancel, callers control begin timing). Add useFutureSignedIn (providers search + future-auth-changed event-driven silent reload) and the ForceLoginGate component. AppShell early-returns the gate (or a short neutral spinner on first load) after all hooks, so the rules-of-hooks invariant is preserved. All existing login surfaces (settings Account / Providers dialogs) still work unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@tallcode
tallcode enabled auto-merge (squash) July 27, 2026 09:39
@tallcode
tallcode merged commit b611192 into main Jul 27, 2026
16 checks passed
@tallcode
tallcode deleted the claude/wizardly-haibt-9f1787 branch July 27, 2026 09:42
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