Commit Graph
214 Commits
Author SHA1 Message Date
kaitranntt 86200eb698 fix(ui): enable cancel button during OAuth authentication
Resolves #234 - Cancel button was disabled during authentication flow,
preventing users from canceling the OAuth process.

Changes:
- Add auth-session-manager.ts for tracking active OAuth sessions
- Add POST /cliproxy/auth/:provider/cancel endpoint to abort sessions
- Kill spawned CLIProxy auth process when cancel is triggered
- Enable Cancel button in AddAccountDialog during authentication
- Add cancel support to QuickSetupWizard auth step
- Update useCancelAuth hook to call backend cancel endpoint
2025-12-31 18:29:04 -05:00
kaitranntt 2625389120 fix(cliproxy): propagate port in unified config and UI preset handlers
Edge case fixes identified in codebase review:
- Unified config variant detection: add settingsPath and port fields
- Provider editor: use variant port in handleApplyPreset/handleCustomPresetApply
- preset-utils: add optional port parameter to applyDefaultPreset()
2025-12-30 13:12:54 -05:00
Kai (Tam Nhu) TranandGitHub 388428bba9 fix: validate required config fields before save (#225)
* fix(ui): validate BASE_URL and AUTH_TOKEN before save

- Add validation in use-provider-editor to block save when required
  env vars (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN) are missing
- Show warning banner in raw editor when required fields are absent
- Always apply default preset on account add (not just first account)

This implements defense-in-depth: validation UI prevents confusion,
save-time validation prevents broken configs, auto-preset ensures
new providers start with working configuration.

Fixes #224

* fix: add validation to remaining settings routes and UI hooks

Backend:
- settings-routes.ts: Validate ANTHROPIC_BASE_URL and AUTH_TOKEN on PUT
- profile-routes.ts: Validate baseUrl/apiKey not empty on update
- variant-routes.ts: Require model field for variant creation

Frontend:
- use-profile-editor.ts: Add required field validation + error handling
- use-copilot-config-form.ts: Add required field validation + error handling

Both hooks now expose missingRequiredFields for UI warnings.

Ref #224

* feat(ux): auto-fill missing BASE_URL/AUTH_TOKEN from defaults at runtime

Instead of blocking saves when required env vars are missing, the system now:
- Runtime fills missing values from getClaudeEnvVars() defaults
- Backend returns warning in response (not 400 error)
- UI shows informational toast instead of blocking error
- Yellow warning banner still shown for user awareness

This provides better UX for CLIProxy users - saves always work, and
missing fields automatically use sensible defaults (local proxy URL
and global API key).

* fix(api): validate settings object before write to prevent undefined file content

Add validation to PUT /api/settings/:profile to return 400 if settings
object is undefined/null. Previously JSON.stringify(undefined) would
write literal "undefined" string to settings file.

* fix: add port validation and pre-save warning UI

- Add validatePort() helper (1-65535 range) to config-generator.ts
- Add missing field warning banner to copilot/config-form UI
- Add missing field warning banner to profiles/editor UI
- Wire missingRequiredFields prop through components
2025-12-29 14:09:27 -08:00
kaitranntt ac6f382f6a fix(quota,error-logs): match CLIProxyAPI headers and enhance error log display
Quota fetcher:
- loadCodeAssist headers now match antigravity.go exactly
- fetchAvailableModels uses empty body {} and correct User-Agent
- Prevents accounts being flagged for anomalous requests

Error logs:
- Extract status code from end of log (RESPONSE section)
- Display full model names instead of abbreviated
- Show status badges (500/429/4xx) with color coding
- Add provider icons with white background
2025-12-29 15:48:37 -05:00
kaitranntt 19550b28f0 fix(error-logs): fix endpoint regex for v1/messages URL format 2025-12-29 13:53:24 -05:00
kaitranntt e3a71fc893 feat(error-logs): extract model and quota reset info from error logs
- Add model, quotaResetDelay, quotaResetTimestamp fields to ParsedErrorLog
- Extract model from requestBody JSON
- Parse quota reset delay/timestamp from 429 response bodies
- Display model prominently in Overview tab with violet highlight
- Show quota reset countdown for rate limit errors
- Improve actionable suggestions with color-coded error types
2025-12-29 13:40:17 -05:00
kaitranntt 4233415095 fix(ui): replace misleading 'Expires' with 'Last used' in credential health
- credential-health-list.tsx showed 'Expires: Expired' based on stale
  file state (CLIProxyAPIPlus intentionally doesn't persist refreshed
  token expiry to disk)
- Now shows runtime-based 'Last used: Xm/h/d ago' from useCliproxyStats
- Consistent with account-item.tsx changes from previous commit
2025-12-29 13:15:51 -05:00
kaitranntt 6ccf6c5e13 feat(ui): replace misleading token expiry with runtime-based status
- Remove "Token expired" warning (showed stale file state, not runtime)
- Add "Active/Last used" status based on CLIProxyAPI runtime stats
- Show green checkmark for recently used accounts (within 1h)
- Show "Not used yet" for accounts without usage stats
- Remove expired warning from flow-viz account cards
- Add model quota sorting (Claude > Gemini > GPT > other)
- Add quota reset time display in tooltips
- Fix re-auth button to use correct CCS endpoint
- Reduce quota cache staleness (30s stale, 1m refresh)

CLIProxyAPI intentionally doesn't persist refreshed tokens to disk
(to prevent refresh loops), so file-based expiry was misleading.
Dashboard now shows truthful operational state from runtime stats.
2025-12-29 13:03:37 -05:00
kaitranntt 3531991b5d fix(ui): remove duplicate provider prop in ModelConfigTab 2025-12-29 10:07:45 -05:00
kaitranntt 7861b63a5d fix(cliproxy): resolve merge conflicts and add edge case fixes
Merge changes from dev:
- Kiro incognito toggle feature
- Auth profile management
- Setup wizard updates

Edge case fixes:
- Add fs.existsSync check before readdirSync in quota-fetcher
- Add isFinite check for quota values
- Clamp percentage to 0-100 range
- Wrap error response JSON parsing in try-catch
2025-12-29 09:56:55 -05:00
kaitranntt 205b5ab71f feat(cliproxy): add account quota display for Antigravity provider
- Add quota-fetcher.ts for Google Cloud Code API integration
- Add REST endpoint GET /api/cliproxy/quota/:provider/:accountId
- Add useAccountQuota hook with React Query caching
- Display quota bar in AccountItem with per-model tooltip
- Create reusable Progress component
- Consolidate quota types in api-client.ts
2025-12-28 19:24:12 -05:00
Kai (Tam Nhu) TranandGitHub d386ea7c3d Merge pull request #216 from kaitranntt/feat/dashboard-parity-auth-crud
feat(ui): add auth profile management to Dashboard
2025-12-27 13:39:39 -08:00
kaitranntt 5f59d710a6 feat(dashboard): add Import from Kiro IDE button
Add "Import from IDE" button to Dashboard AddAccountDialog for Kiro provider:
- POST /api/cliproxy/auth/kiro/import endpoint using tryKiroImport()
- useKiroImport() React Query hook with cache invalidation
- UI button shown alongside OAuth authenticate for Kiro only
- Applies default preset when importing first account
- Fix UI typecheck script (remove incompatible --build flag)
2025-12-27 12:04:52 -05:00
kaitranntt fa8830e1ce feat(ui): add auth profile management to Dashboard
- Add create profile dialog with CLI command copy-paste
- Add delete profile with confirmation dialog
- Add reset to CCS default button
- Add DELETE endpoints for /accounts/:name and /accounts/reset-default
- Achieve CLI/Dashboard parity per design philosophy

Refs: plans/251227-0114-ccs-cli-dashboard-parity-audit
2025-12-27 11:20:10 -05:00
kaitranntt 7a6341f0d9 feat(ui): add Settings link to control panel key hint
Adds a gear icon link next to the masked key hint that navigates
to Settings > Auth, improving UX for users who need to manage
their auth tokens.
2025-12-26 12:23:24 -05:00
kaitranntt a762563f1b fix(ui): use effective management secret in control panel embed
- Fetch auth tokens from /api/settings/auth/tokens/raw
- Use effective management secret for local mode auto-login
- Remove hardcoded CCS_CONTROL_PANEL_SECRET constant
- Key hint now shows correct secret (custom or default)
2025-12-25 17:15:00 -05:00
kaitranntt 7e031b5097 fix(ui): simplify config header and add explicit save button
- Reduce config.yaml header from 26 lines to 2 lines
- Replace auto-save on blur with explicit Save button in Auth section
- Add hasChanges detection to enable/disable Save button
- Remove unused saveApiKey and saveSecret functions
2025-12-25 17:02:14 -05:00
kaitranntt 71335a6193 feat(ui): add auth tokens settings tab
- Add AuthSection component with API key and management secret inputs
- Show/hide toggle, copy to clipboard, regenerate secret button
- Reset to defaults action with disabled state when using defaults
- Add Auth tab to settings navigation with KeyRound icon
- Update SettingsTab type to include 'auth'
2025-12-25 14:37:03 -05:00
Kai (Tam Nhu) TranandGitHub 459d730029 Merge pull request #184 from kaitranntt/kai/feat/variant-port-isolation
feat(cliproxy): add variant port isolation
2025-12-25 05:19:06 -05:00
Kai (Tam Nhu) TranandGitHub b52e6d69d6 Merge pull request #193 from kaitranntt/kai/fix/kiro-incognito
fix(kiro): add --no-incognito option for normal browser auth
2025-12-24 21:59:19 -05:00
kaitranntt f2a4200625 fix(core): address all code review issues from PR #199
Critical fixes:
- CRIT-1: Fix placeholder detection case sensitivity in api-key-validator
- CRIT-2: Add TOCTOU protection via loadMigrationCheckData() for atomic config reads
- CRIT-3: Restore fs.existsSync mock in profile-detector tests

High priority fixes:
- H1-H3: API validator HTTP/HTTPS support, timeout abort, debug log
- H4-H6: OAuth explicit flow type, signal handling, TTY detection
- H7-H8: Profile collision warning, config-first save order
- H9-H11: expandPath consistency, preset sync CLI/UI
2025-12-24 20:18:57 -05:00
Kai (Tam Nhu) TranandGitHub 40aa6de72a Merge pull request #198 from kaitranntt/feat/add-more-models
feat(api): add Minimax, DeepSeek, Qwen provider presets
2025-12-24 18:47:33 -05:00
kaitranntt db3662b479 fix(ui): respect initialMode in profile create dialog
- Fix "Create Custom API Profile" button to open Custom tab instead of OpenRouter
- Improve Custom button visibility with dashed border and better contrast
- Improve Quick Templates styling with better spacing and font weight
- Enhance CompactPresetCard with larger icons and clearer badge styling
2025-12-24 18:43:41 -05:00
kaitranntt e7066b9997 feat(api): add Minimax, DeepSeek, Qwen provider presets
Add three new Anthropic-compatible API providers as presets:
- Minimax: M2.1/M2.1-lightning/M2 models with 1M context
- DeepSeek: V3.2 and R1 reasoning model (128K context)
- Qwen: Alibaba Cloud qwen3-coder-plus (256K context)

Closes #123
2025-12-24 18:32:07 -05:00
kaitranntt 50653d1054 fix(ui): add gemini-3-flash-preview to model dropdowns
Added gemini-3-flash-preview model to agy and gemini provider catalogs
in the UI. This enables users to select the fast Gemini 3 Flash model
from dropdown menus.

Closes #194
2025-12-24 17:07:56 -05:00
kaitranntt df0c94781e feat(kiro): improve auth UX with normal browser default and URL display
- Change default to noIncognito=true (normal browser) for reliability
- Always print OAuth URL to terminal for VS Code popup detection
- Move incognito toggle from Proxy settings to Kiro provider page
- Add --incognito flag to opt into incognito mode (was --no-incognito)
- Update help text to reflect new defaults
2025-12-24 06:17:17 -05:00
kaitranntt 083e67426c feat(kiro): add UI toggle and auth hint for --no-incognito option
- Add "Kiro: Use normal browser" toggle in config dashboard (Proxy section)
- Add --no-incognito documentation to ccs --help output
- Show hint after successful Kiro auth about saving AWS credentials
2025-12-24 05:26:02 -05:00
kaitranntt 0bcaf4bc68 feat(cliproxy): add variant port isolation for concurrent proxy instances
Enables running multiple CLIProxy variants simultaneously on different
ports. Each variant now gets a unique port in the 18100-18199 range,
allowing concurrent use of providers like Gemini + Codex + custom variants.

Key changes:
- Add port field to variant config schema
- Implement automatic port allocation (18100 + variant index)
- Support variant-specific settings paths in config generator
- Display port in dashboard UI for debugging
- Show all models in variant editor dropdown
- Add comprehensive tests for port allocation edge cases

Closes related variant isolation work.
2025-12-24 04:15:04 -05:00
kaitranntt 5de6cccee0 refactor(ghcp): remove unused device code session management
- Remove unused functions: registerDeviceCode, completeDeviceCode,
  failDeviceCode, getActiveDeviceCode, hasActiveDeviceCode,
  getAllActiveDeviceCodes, ActiveSession interface, activeSessions Map
- Reduce device-code-handler.ts from 168 to 33 lines (YAGNI)
- Add ARIA labels to copy button for accessibility
- Fix timer to stop at 0 seconds instead of continuing negative
- Add "(Code expired)" visual indicator with destructive styling
- Change void sessionId to data-session-id attribute for debugging

Code review findings applied. Gemini OAuth unaffected (uses separate
project-selection-handler.ts with Authorization Code Flow).
2025-12-24 03:15:57 -05:00
kaitranntt 46f1699b1c fix(ghcp): display device code during OAuth device code flow
When authenticating with GitHub Copilot using device code flow,
the user code was not being displayed. This fix:

- Parses device codes from CLIProxy output in oauth-process.ts
- Displays code prominently in CLI terminal with box formatting
- Broadcasts device code events via WebSocket for UI display
- Creates DeviceCodeDialog component for web UI (ccs config)
- Follows same pattern as Gemini project selection dialog

Closes #189
2025-12-24 03:02:36 -05:00
kaitranntt a827b73eef feat(glm): add GLM 4.7 model support
- Update default GLM/GLMT model from glm-4.6 to glm-4.7
- Add glm-4.7 pricing entry
- Sync UI presets with CLI changes

Closes #179
2025-12-22 16:13:19 -05:00
kaitrannttandMinhOmega 31bafaab8d feat(api): add Azure Foundry preset
Add Microsoft Azure AI Foundry as a provider preset for `ccs api create`.

Usage: `ccs api create --preset foundry`

This is a cleaner implementation than the postinstall-based approach,
leveraging the existing preset system.

Co-authored-by: MinhOmega <49482201+MinhOmega@users.noreply.github.com>
2025-12-22 15:34:27 -05:00
kaitranntt 92215457f0 feat(ui): add kiro and ghcp to wizard, auth flow, and settings
- update PROVIDERS in wizard constants with ghcp

- add AUTH_ENDPOINTS for qwen, iflow, kiro, ghcp

- update globalenv description text
2025-12-22 00:48:10 -05:00
kaitranntt 099b712d4a feat(ui): update cliproxy components with kiro and ghcp providers
- add ghcp to PROVIDER_IMAGES and PROVIDER_CONFIG in provider-logo

- update providers array and options in cliproxy-dialog

- add kiro and ghcp to providerLabels in cliproxy-table

- complete providers list in cliproxy-header

- update ownerMap key from copilot to ghcp in provider-editor
2025-12-22 00:47:34 -05:00
kaitranntt bf3d51ade3 feat(ui): add kiro and ghcp to provider types and configs
- update Variant, CreateVariant, UpdateVariant, OAuthAccount types

- add ghcp to PROVIDER_ASSETS, PROVIDER_COLORS, PROVIDER_NAMES

- add ghcp catalog with model configurations
2025-12-22 00:46:51 -05:00
kaitranntt af92bc30bf refactor: complete CLIProxy Plus branding across CLI and UI
CLI changes:
- platform-commands.ts: Update taskkill/pkill to use cli-proxy-api-plus binary name
- help-command.ts: Fix binary path display to show cli-proxy-api-plus
- oauth-process.ts: Update auth error message
- binary-manager.ts: Update removal message
- cliproxy-executor.ts: Update startup failure messages
- cliproxy-command.ts: Update variant creation messages
- service-manager.ts: Update startup error message
- cliproxy-stats-routes.ts: Update all API error messages

UI changes:
- proxy/index.tsx: Update connection mode descriptions
- cliproxy-stats-overview.tsx: Update metrics description
- model-preferences-grid.tsx: Update models description
2025-12-21 23:17:04 -05:00
kaitranntt 670993d364 refactor: rename CLIProxyAPI to CLIProxy Plus across UI and CLI
- Update cliproxy-command.ts status output and install messages
- Update help-command.ts with Plus branding and new kiro/copilot providers
- Update doctor.ts header to show CLIPROXY PLUS
- Update cliproxy-check.ts binary check output
- Update proxy-status-widget.tsx label to CLIProxy Plus
- Point release URLs to CLIProxyAPIPlus repository
2025-12-21 22:57:03 -05:00
kaitranntt 0f029f960a feat(ui): integrate Kiro and Copilot providers, rename to CLIProxy Plus
- Rename sidebar/header from CLIProxy to CLIProxy Plus
- Add Kiro and Copilot to all provider lists and type unions
- Add provider logos and color configs
- Add model catalogs with upstream CLIProxyAPIPlus models
- Update Quick Setup Wizard with new providers
2025-12-21 22:27:36 -05:00
kaitranntt 9ca20e70de feat(ui): add Kiro and Copilot provider icons
- Add kiro.png icon for Kiro (AWS) provider
- Add copilot.svg icon for GitHub Copilot provider
2025-12-21 22:26:53 -05:00
kaitranntt 28c62625b3 fix(cliproxy): merge dev with proper remote mode integration
Resolve conflicts in cliproxy-auth-routes.ts by combining:
- Dev's improved error handling with try-catch patterns
- Branch's remote mode routing logic

All 638 tests pass.
2025-12-21 19:21:29 -05:00
kaitranntt e84df00740 fix(ui): correct cliproxy account API paths
- Change /cliproxy/accounts/* to /cliproxy/auth/accounts/*
- Fix 404 errors when managing CLIProxy accounts from dashboard
- Root cause: frontend called wrong endpoints for account management
2025-12-21 18:02:38 -05:00
kaitranntt 3bf9ebe32a feat(ui): add remote mode indicator to provider editor header
Shows "Remote" badge with Globe icon and "Traffic auto-routed to
remote server" message when remote CLIProxy mode is active.
2025-12-21 04:34:29 -05:00
kaitranntt f15b989508 fix(hooks): memoize return objects to prevent infinite render loops
Apply useMemo to hook returns that create new object references on each
render. This prevents downstream useEffect/useCallback dependencies from
detecting false changes and triggering re-execution.

Fixed hooks:
- PrivacyProvider: memoize context value and toggle callback
- useCopilot: wrap large return object with all dependencies
- useWebSocket: memoize status/connect/disconnect object
- useProjectSelection: memoize state and handlers object
- useCliproxyAuthFlow: memoize spread state with auth functions
- useAnalyticsPage: memoize apiOptions to stabilize query params
2025-12-21 04:17:32 -05:00
kaitranntt d86dfab2e7 feat(ui): show remote server info in ProxyStatusWidget
- Add remote mode detection via cliproxy-server-config query
- Display blue-themed "Remote Proxy" widget when remote enabled
- Show remote host and "Traffic auto-routed" message
- Hide local start/stop/restart controls in remote mode
2025-12-21 04:14:55 -05:00
kaitranntt 4f75e105a9 fix(settings): memoize useSettingsActions to prevent infinite render loop
- wrap return object in useMemo with all action callbacks as deps

- prevents new object reference on every render

- fixes Maximum update depth exceeded error on settings page
2025-12-21 04:09:13 -05:00
kaitranntt 3fca9338f9 test(ui): add vitest testing infrastructure with 99 unit tests
- add vitest, jsdom, testing-library, msw dependencies
- create test setup: vitest-setup.ts, test-utils.tsx, msw-handlers.ts
- add 99 unit tests covering settings, analytics, auth-monitor utils
- configure 90% coverage thresholds on pure-logic files
- add test scripts: test, test:run, test:coverage, test:ui
2025-12-21 03:28:34 -05:00
kaitranntt 8ead6fa0bf refactor(ui): modularize auth-monitor into directory structure
- split auth-monitor.tsx (465 lines) into modular components
- extract provider-card, summary-card, live-pulse, inline-stats-badge
- separate hooks, types, and utils for better maintainability
- export types from monitoring barrel
2025-12-21 03:27:53 -05:00
kaitranntt 03d9bf76c4 refactor(ui): modularize analytics page into directory structure
- split analytics.tsx (420 lines) into modular components
- extract analytics-header, charts-grid, cost-by-model-card
- add analytics-skeleton for loading states
- separate hooks, types, and utils
2025-12-21 03:27:15 -05:00
kaitranntt 104a404144 refactor(ui): modularize settings page into directory structure
- split settings.tsx (1,781 lines) into modular components
- extract hooks into separate files (context-hooks, use-*-config)
- create sections: websearch, proxy, globalenv with subcomponents
- add tab-navigation and section-skeleton components
- add settings-context.ts for state management
2025-12-21 03:26:40 -05:00
kaitranntt 883d9fa585 fix(ui): hide local paths in remote CLIProxy mode 2025-12-21 02:56:24 -05:00