Commit Graph
326 Commits
Author SHA1 Message Date
Kai (Tam Nhu) TranandGitHub 24b03121fd fix(dashboard): cross-browser OAuth with manual callback fallback (#417) (#423)
- Remove destructive /start endpoint call from Dashboard OAuth dialog
  (was killing running CLIProxy Docker instances via killProcessOnPort)
- Use /start-url + polling only (management API, non-destructive)
- Auto-open browser tab via window.open() with manual fallback URL display
- Add paste-callback CLI mode (--paste-callback flag) for headless/SSH
- Use dynamic proxy target with management headers instead of hardcoded localhost
- Extract timeout constants, restore invariant comment
- Move hook-utils tests from src/__tests__/ to tests/unit/ (fixes tsc)
- Add try-catch for preset apply, remove auth URL console.log
2026-02-02 16:11:36 -05:00
kaitranntt 5a308db409 fix(quota): improve 403 error messaging for forbidden accounts
Instead of showing "Quota access forbidden" generic error, now shows:
- Antigravity: "403 Forbidden - No Gemini Code Assist access"
- Codex: "403 Forbidden - No quota API access"

Keeps success=false with isForbidden flag so UI can show distinct
"403" badge (similar to Antigravity-Manager) rather than conflating
with 0% exhausted state.

403 ≠ 0% exhausted - they are semantically different:
- 403: Account lacks API access entirely
- 0%: Account has access but quota is used up (shows reset time)
2026-02-02 11:52:23 -05:00
kaitranntt 3df2619023 test(quota): add extensive test suite for quota caching system
- Add quota-response-cache.test.ts (22 tests):
  - Cache set/get operations
  - TTL expiration handling
  - Provider and account isolation
  - Cache invalidation patterns
  - High-volume concurrent access

- Add quota-caching-integration.test.ts (15 tests):
  - GeminiCliQuotaResult caching with bucket preservation
  - CodexQuotaResult caching with window preservation
  - Cross-provider isolation verification
  - Error state caching for visibility
  - needsReauth flag handling

Total: 37 new tests for quota caching behavior
2026-01-29 23:22:53 -05:00
kaitranntt 606bb72723 feat(cliproxy): add proactive token refresh for Gemini quota (match AGY pattern)
- Add proactive refresh: refresh token 5min before expiry (not just after)
- Add retry on 401: if API returns 401, refresh token and retry once
- Extract fetchWithAuthData helper to reduce code duplication
- Update UI to show better error messages (no more "via CLI" text)
- Falls back gracefully if proactive refresh fails but token not yet expired
2026-01-29 23:09:47 -05:00
kaitranntt 7947a7ac89 feat(cliproxy): add backend caching and reauth indicator for quota endpoints
- Add in-memory quota cache with 2-minute TTL to reduce external API calls
- Add needsReauth flag to CodexQuotaResult and GeminiCliQuotaResult types
- Update quota routes to use caching (codex, gemini, and generic routes)
- Add "Reauth needed" indicator in account-item.tsx with CLI command hint
- Add "Reauth needed" indicator in account-card.tsx for flow visualization
- Cache successful results only (don't cache expired tokens needing reauth)
2026-01-29 23:01:45 -05:00
kaitranntt eeb0dde8ca refactor(ui): extract shared QuotaTooltipContent component
Address PR review feedback:
- Create QuotaTooltipContent component in shared/ for DRY principle
- Use component in account-item.tsx and account-card.tsx
- Use QUOTA_SUPPORTED_PROVIDERS constant in model-config-tab.tsx
- Reduces ~200 lines of duplicated tooltip rendering code
2026-01-29 22:33:07 -05:00
kaitranntt 32ef23314a refactor(ui): address code review feedback
- Consolidate UnifiedQuotaResult type: import from utils.ts, re-export
- Remove unused useCodexQuota/useGeminiQuota hooks (useAccountQuota handles all)
- Remove unnecessary optional chaining where type guards guarantee property
2026-01-29 22:23:53 -05:00
kaitranntt 8ce749581e refactor(ui): extract duplicated quota helpers to shared utils
Address PR review feedback:
- Add type guards (isAgyQuotaResult, isCodexQuotaResult, isGeminiQuotaResult)
- Add unified getProviderMinQuota() and getProviderResetTime() helpers
- Export QUOTA_SUPPORTED_PROVIDERS constant from hooks
- Update account-item.tsx and account-card.tsx to use shared functions
- Eliminate code duplication across provider-specific quota handling

Closes #400 review feedback
2026-01-29 22:17:57 -05:00
kaitranntt 387c010267 feat(ui): display Codex/Gemini quota in dashboard
- update account-card.tsx to show quota for all CLIProxy providers

- update account-item.tsx with provider-specific tooltip rendering

- enable showQuota for codex and gemini in model-config-tab.tsx
2026-01-29 21:51:39 -05:00
kaitranntt 19a57c395c feat(ui): add Codex/Gemini quota API client and hooks
- add CodexQuotaResult and GeminiCliQuotaResult types

- add api.quota.getCodex and api.quota.getGemini API functions

- add useCodexQuota and useGeminiQuota React hooks

- add getMinCodexQuota, getMinGeminiQuota, getCodexResetTime, getGeminiResetTime utils
2026-01-29 21:50:43 -05:00
kaitranntt 25018431a5 fix(copilot): update fallback model ID to match catalog default
Address code review feedback: update outdated fallback model ID
in copilot config form to use claude-sonnet-4-5-20250929
2026-01-29 00:45:49 -05:00
kaitranntt d238a5d43a fix(cliproxy): update Claude model catalog to latest CLIProxy models
- Updated claude-opus-4-5-20250220 → claude-opus-4-5-20251101
- Updated claude-sonnet-4-5-20250514 → claude-sonnet-4-5-20250929
- Updated claude-haiku-4-5-20250514 → claude-haiku-4-5-20251001
- Updated default model to claude-sonnet-4-5-20250929
- Updated all preset mappings to use new model IDs

Closes #392
2026-01-29 00:37:31 -05:00
kaitranntt 31a91f609f feat(ui): add tier badges to account cards
- flow-viz: inline tier badge (ULTRA/PRO) with violet/yellow colors

- provider-editor: tier badge on avatar corner (U/P)

- subtle design with low opacity backgrounds
2026-01-28 16:31:16 -05:00
kaitranntt 890fd140f2 feat(ui): add granular account tier types (pro/ultra/free)
- update AccountTier from binary to granular

- add tier field to AccountRow and AccountData types

- pass tier through hooks data flow
2026-01-28 16:30:41 -05:00
kaitranntt 87cced8195 fix(ui): fix account card layout overflow
- add min-w-0 flex-1 to left content container for proper shrinking

- add gap-2 between content and dropdown menu

- add shrink-0 to dropdown button to prevent overflow
2026-01-28 15:11:17 -05:00
kaitranntt bbad73b554 fix(cliproxy): harden sync against edge cases
Backend:
- Handle config file deletion race condition with try-catch
- Add null check for empty config files in yaml.load()
- Limit profile names to 64 chars, require alphanumeric content
- Add 5s timeout for watcher close() to prevent hangs

Frontend:
- Add 30s fetch timeout with AbortController for sync requests
2026-01-28 13:58:16 -05:00
kaitranntt c3f85bc4a8 fix(cliproxy): correct sync terminology and add unit tests
- Fix "Remote" → "Local" in sync-dialog.tsx and CLI help text
- Add resetWatcherState() export for test cleanup
- Add unit tests for profile-mapper, local-config-sync, auto-sync-watcher
- Remove unused ModelAlias and AliasesResponse types from hooks
2026-01-28 13:26:40 -05:00
kaitranntt ab9bbedfa9 feat(ui): allow custom model names in Quick Setup wizard
- Add "Custom model name..." option to model dropdown
- Show text input when custom selected
- Allow any CLIProxy-supported model name
- Toggle back to presets with link
2026-01-28 11:57:22 -05:00
kaitranntt 85aa747aeb fix(ui): add scroll boundary for account list in Quick Setup
- Add max-h-[320px] and overflow-y-auto to account grid
- Prevents overflow when many accounts exist
2026-01-28 11:57:22 -05:00
kaitranntt f972a4ee80 feat(ui): add toast feedback for sync actions
- Show success toast with synced profile count
- Show info toast when no profiles to sync
- Show error toast on sync failure
2026-01-28 11:57:22 -05:00
kaitranntt 37616348f8 refactor(ui): merge sync into ProxyStatusWidget
- add sync icon button to widget header

- show inline sync status (Ready/No Config)

- remove separate SyncStatusCard from cliproxy page

- reduces vertical space, better UX
2026-01-28 11:57:22 -05:00
kaitranntt 32dbd5e174 refactor(cliproxy): remove model alias functionality
- delete model-alias-config.ts and cliproxy-alias-handler.ts

- simplify sync to use ANTHROPIC_MODEL directly

- remove alias routes, hooks, and UI components
2026-01-28 11:57:22 -05:00
kaitranntt afa3bdafce feat(ui): mount SyncStatusCard to CLIProxy page 2026-01-28 11:57:22 -05:00
kaitranntt e2b9c465e4 fix(ui): update sync card for local sync design
- rename Remote Sync to Profile Sync

- change status from Connected/Disconnected to Ready/No Config

- update icons and messaging for local config sync
2026-01-28 11:57:22 -05:00
kaitranntt 9924b2fb25 fix(cliproxy): address edge cases in sync module
- Reset isSyncing flag in stopAutoSyncWatcher (prevents stale state)
- Validate empty profile names in mapProfileToClaudeKey
- Add whitespace validation in API routes (POST/DELETE /aliases)
- Add Number.isInteger check for port validation
- Wrap response.json() in try-catch for React hooks (handles non-JSON 502)
2026-01-28 11:57:22 -05:00
kaitranntt 75a4e68f95 feat(ui): add CLIProxy sync components
- add SyncStatusCard for sync status display
- add SyncDialog for sync preview and execution
- add useCliproxySync hook for API integration
2026-01-28 11:57:22 -05:00
kaitranntt 5c62e06d02 fix(ui): add iFlow to PROVIDER_ASSETS + sync validation test
- Add iflow.png to PROVIDER_ASSETS map

- Add backend-ui-provider-arrays-sync.test.ts to catch mismatches

- Addresses PR #384 review: dual source of truth + missing iFlow
2026-01-27 22:20:15 -05:00
kaitranntt a9c5520b8b fix(ui): truncate long account emails in provider editor
- Add min-w-0 flex-1 for proper text overflow

- Add truncate class to prevent layout break
2026-01-27 21:40:29 -05:00
kaitranntt 5a4c8e009c refactor(ui): centralize provider list in provider-config.ts (DRY)
- Add CLIPROXY_PROVIDERS array as single source of truth for UI
- Add CLIProxyProvider type and isValidProvider() helper
- Update api-client.ts to use CLIProxyProvider type
- Update cliproxy-dialog.tsx to import from provider-config
- Update cliproxy-header.tsx to use CLIPROXY_PROVIDERS
- Update use-cliproxy-auth-flow.ts to use isValidProvider()
- Update wizard constants to use typed provider info

Adding a new provider now only requires updating:
- Backend: src/auth/profile-detector.ts (CLIPROXY_PROFILES)
- UI: ui/src/lib/provider-config.ts (CLIPROXY_PROVIDERS)
- UI wizard: ui/src/components/setup/wizard/constants.ts (PROVIDER_INFO)
2026-01-27 21:07:26 -05:00
kaitranntt 4a2abc74ca fix: add claude provider to statsProviderMap, UI types, and provider arrays
Fixes remaining edge cases from #382:
- Add anthropic/claude mapping to statsProviderMap in cliproxy-auth-routes
- Add 'claude' case to provider-refreshers switch statement
- Add 'claude' to 4 UI type definitions in api-client.ts
- Add 'claude' to cliproxy-dialog providers array and options
- Add 'claude' to use-cliproxy-auth-flow VALID_PROVIDERS
- Fix wizard index.tsx type cast to include all 8 providers
2026-01-27 21:02:34 -05:00
kaitranntt 2091a90b77 fix(cliproxy): address PR review feedback
- Remove claude from PLUS_ONLY_PROVIDERS (Claude works with normal CLIProxy too)
- Fix color inconsistency: use #D97757 to match SVG brand color
- Add iflow to checkAuthCodePorts (pre-existing issue, fixed opportunistically)
2026-01-27 20:24:01 -05:00
kaitranntt b385ab131d refactor(cliproxy): reorder providers - Antigravity first, then Claude 2026-01-27 20:17:10 -05:00
kaitranntt d2129957d7 fix(cliproxy): add Claude to all provider lists for sidebar display
Claude was missing from:
- getAllAuthStatus() providers array in token-manager.ts
- PROVIDER_ASSETS, PROVIDER_COLORS, PROVIDER_NAMES in provider-config.ts
- PROVIDERS array in setup wizard constants.ts
- PLUS_ONLY_PROVIDERS in proxy settings
2026-01-27 20:14:22 -05:00
kaitranntt 28d8bd84a5 feat(cliproxy): add Claude (Anthropic) OAuth provider support
Add Claude as a first-class OAuth provider in CCS CLI and dashboard.
Backend support already exists in CLIProxyAPIPlus (port 54545).

Changes:
- Add 'claude' to CLIProxyProvider type and profile detector
- Add Claude OAuth config (port 54545, --anthropic-login flag)
- Add Claude to oauth-port-diagnostics flow types
- Add Claude token discovery prefixes (claude-, anthropic-)
- Add Claude model catalog (Opus 4.5, Sonnet 4.5/4, Haiku 4.5)
- Add Claude logo and provider display name
- Update variant config types and adapters

Closes #380
2026-01-27 15:43:21 -05:00
kaitranntt 7fc9ff0d77 feat(ui): persist provider selection in cliproxy and auth-monitor
- save selected provider to localStorage on both pages
- restore selection on page load
- validate saved provider still exists before restoring
- improves UX by eliminating need to re-select provider after reload
2026-01-25 17:34:55 -05:00
kaitranntt e3920e0776 fix(quota): return exhausted models with resetTime from API
- treat models with resetTime but null/missing remainingFraction as 0%
- matches CLIProxy Management Center behavior
- enables accurate Claude reset time display when quota exhausted
- mark primary models at 0% as exhausted for red styling
2026-01-25 17:34:30 -05:00
kaitranntt a84cc036df fix(ui): remove dead 'Account is paused' error handling from flow-viz
Backend now returns quota for paused accounts, no longer returns this error.
2026-01-25 17:15:19 -05:00
kaitranntt 27e8813cae fix(quota): fetch quota for paused accounts + simplify exhausted display
- Remove early return for paused accounts in quota fetcher
- Check both auth/ and auth-paused/ directories when reading auth data
- Allows users to see quota status of paused accounts to know when to unpause
- Remove "Exhausted" text in tooltip, just show 0% in red (saves width)
2026-01-25 17:12:45 -05:00
kaitranntt b2b8a85af6 fix(ui): simplify quota tooltip - delimiter lines only, full model names
- Remove tier group headers, use delimiter lines between tiers
- Show full model names (Claude Opus 4.5 (Thinking), etc.)
- Show "Exhausted" in percentage column instead of appending to name
- Add all known primary models when exhausted
2026-01-25 17:09:59 -05:00
kaitranntt 41d17e7cae fix(ui): improve tier header contrast in quota tooltip 2026-01-25 17:06:44 -05:00
kaitranntt ebfc554f5f feat(ui): add tiered visual grouping to quota tooltip
- Replace generic "Claude/GPT (Exhausted)" with actual model names
- Group models by tier with visual headers:
  - Claude & GPT (primary, weekly limits)
  - Gemini 3 (high capability)
  - Gemini 2.5 (mid tier)
  - Other
- When primary models exhausted, show known models with "(Exhausted)" label
- Add border separators between tier groups for visual clarity
2026-01-25 17:06:06 -05:00
kaitranntt de7138166c fix(ui): improve model quota tooltip tier sorting
Sort models by capability tier instead of just provider:
- Tier 0: Claude + GPT (primary, weekly limits)
- Tier 1: Gemini 3 Pro (high capability)
- Tier 2: Gemini 2.5 Pro/Flash (mid tier)
- Tier 3: Other Gemini models
- Tier 4: Everything else (chat_, tab_, etc.)
2026-01-25 17:03:10 -05:00
kaitranntt ce16517144 fix(ui): display exhausted Claude/GPT models in quota tooltip
When Claude/GPT models are exhausted (0%), API removes them from response.
Added getModelsWithExhaustedIndicator() to prepend synthetic "Claude/GPT
(Exhausted)" entry with 0% when primary models missing. Styled in red for
visibility. Applied to both account-item and flow-viz account-card tooltips.
2026-01-25 16:51:49 -05:00
kaitranntt 1f323f082c fix(ui): show 0% quota when Claude/GPT models exhausted
- include GPT models in primary quota filter (not just Claude)

- return 0% when Claude/GPT missing from API (exhausted, not 100%)

- fallback to all models for reset time when primary exhausted
2026-01-25 16:48:45 -05:00
kaitranntt 9516e71f17 fix(ui): show Claude reset time for quota display (not earliest)
- add getClaudeResetTime to match getMinClaudeQuota logic

- weekly Claude resets now show absolute date (01/27, 12:07)

- daily Gemini resets no longer overshadow Claude weekly limits
2026-01-25 16:38:54 -05:00
kaitranntt 6021c10ddc fix(ui): improve bulk actions UX in provider editor
- move BulkActionBar above account list (was at bottom)

- only show bar when selections exist (cleaner default)

- add selection checkbox to each AccountItem

- highlight selected accounts with ring + background
2026-01-25 16:25:08 -05:00
kaitranntt eb053425c0 fix(ui): improve pause toggle position in flow-viz account cards
- move pause toggle inline with email (was absolute positioned)

- always visible with subtle styling (not hover-only)

- amber highlight when paused for quick visual scan
2026-01-25 16:23:54 -05:00
kaitranntt 56dfada31c fix(ui): add pause toggle to flow viz account cards, remove dropdown redundancy
- Add visible pause/resume toggle button to AccountCard in flow-viz
  (appears on hover or when paused, with tooltip)
- Pass pause toggle props from AuthMonitor through AccountFlowViz
- Remove redundant pause/resume from account-item dropdown menu
  (keeps only "Set as default" and "Remove account")
- Add paused state to AccountData type with opacity indication
2026-01-24 13:01:30 -05:00
kaitranntt 2d42327a89 revert(ui): restore original provider card navigation behavior
Reverts the expandable ProviderCard design back to click-to-navigate.
The pause toggle feature is preserved in AccountItem cards in Provider
Editor, not in the Live Account Monitor overview.

- Remove expandable account list component
- Remove unused pause/resume/solo mutations from AuthMonitor
- Restore original ProviderCard props interface
- Keep acc.paused opacity-50 for visual indication on dots
2026-01-24 12:37:55 -05:00
kaitranntt 56dfb2429b feat(ui): add visible pause toggle button to account item cards
- add pause/play button left of user avatar

- paused accounts show play icon (green) and dimmed card

- active accounts show pause icon

- includes loading spinner and tooltip
2026-01-24 12:33:37 -05:00