Commit Graph

454 Commits

  • fix: Don't add ?beta=true to OpenAI Chat Completions endpoints (#1052)
    Fixes Nvidia provider and other providers using apiFormat="openai_chat".
    
    The ClaudeAdapter::build_url() method was incorrectly adding ?beta=true
    to both /v1/messages and /v1/chat/completions endpoints. This caused
    the Nvidia provider to fail because:
    
    1. Nvidia uses apiFormat="openai_chat"
    2. Requests are transformed to OpenAI format and sent to /v1/chat/completions
    3. The URL gets ?beta=true appended (Anthropic-specific parameter)
    4. Nvidia's API rejects requests with this parameter
    
    Fix:
    - Only add ?beta=true to /v1/messages endpoint
    - Exclude /v1/chat/completions from getting this parameter
    
    Tested:
    - Anthropic /v1/messages still gets ?beta=true ✓
    - OpenAI Chat Completions /v1/chat/completions does NOT get ?beta=true ✓
    - All 13 Claude adapter tests pass ✓
    
    Co-authored-by: jnorthrup <jnorthrup@example.com>
  • feat(webdav): follow-up 补齐自动同步与大文件防护 (#1043)
    * feat(webdav): add robust auto sync with failure feedback
    
    (cherry picked from commit bb6760124a62a964b36902c004e173534910728f)
    
    * fix(webdav): enforce bounded download and extraction size
    
    (cherry picked from commit 7777d6ec2b9bba07c8bbba9b04fe3ea6b15e0e79)
    
    * fix(webdav): only show auto-sync callout for auto-source errors
    
    * refactor(webdav): remove services->commands auto-sync dependency
  • Fix/skill zip symlink resolution (#1040)
    * fix(skill): resolve symlinks in ZIP extraction for GitHub repos (#1001)
    
    - detect symlink entries via is_symlink() during ZIP extraction and collect target paths
    
    - add resolve_symlinks_in_dir() to copy symlink target content into link location
    
    - canonicalize base_dir to fix macOS /tmp → /private/tmp path comparison issue
    
    - add path traversal safety check to block symlinks pointing outside repo boundary
    
    - apply symlink resolution to both download_and_extract and extract_local_zip paths
    
    Closes https://github.com/farion1231/cc-switch/issues/1001
    
    * fix(skill): change search to match name and repo instead of description
    
    * feat(skill): support importing skills from ~/.agents/skills/ directory
    
    - Scan ~/.agents/skills/ in scan_unmanaged() for skill discovery
    - Parse ~/.agents/.skill-lock.json to extract repo owner/name metadata
    - Auto-add discovered repos to skill_repos management on import
    - Add path field to UnmanagedSkill to show discovered location in UI
    
    Closes #980
    
    * fix(skill): use metadata name or ZIP filename for root-level SKILL.md imports (#1000)
    
    When a ZIP contains SKILL.md at the root without a wrapper directory,
    the install name was derived from the temp directory name (e.g. .tmpDZKGpF).
    Now falls back to SKILL.md frontmatter name, then ZIP filename stem.
    
    * feat(skill): scan ~/.cc-switch/skills/ for unmanaged skill discovery and import
    
    * refactor(skill): unify scan/import logic with lock file skillPath and repo saving
    
    - Deduplicate scan_unmanaged and import_from_apps using shared source list
    - Replace hand-written AppType match with as_str() and AppType::all()
    - Extract read_skill_name_desc, build_repo_info_from_lock, save_repos_from_lock helpers
    - Add SkillApps::from_labels for building enable state from source labels
    - Parse skillPath from .skill-lock.json for correct readme URLs
    - Save skill repos to skill_repos table in both import and migration paths
    
    * fix(skill): resolve symlink and path traversal issues in ZIP skill import
    
    * fix(skill): separate source path validation and add canonicalization for symlink safety
  • fix(opencode): 补齐 install.sh 安装路径检测 (#988)
    补齐 OpenCode 路径扫描来源(按官方 install.sh 优先级):
      OPENCODE_INSTALL_DIR > XDG_BIN_DIR > ~/bin > ~/.opencode/bin
    保留并增强 Go 安装路径扫描(~/go/bin、GOPATH/*/bin)。
    
    区分单值环境变量(push_env_single_dir)与 path-list 环境变量
    (extend_from_path_list),避免对 OPENCODE_INSTALL_DIR 等单值
    变量误用 split_paths。
    
    增加路径去重逻辑(push_unique_path),避免重复扫描。
    
    增加跨平台可执行候选逻辑(tool_executable_candidates):
      Windows: .cmd / .exe / 裸命令
      Unix:    裸命令
    
    将 PATH 拼接提至外层循环,减少重复 syscall。
    
    增加单元测试覆盖路径拼装、去重及 Windows 候选顺序。
    
    Closes #958
    
    Co-authored-by: Warp <agent@warp.dev>
  • fix(openclaw): address code review findings across P0-P3 issues
    - Add 25 missing i18n keys for OpenClawFormFields in all 3 locales (P0)
    - Replace key={index} with stable crypto.randomUUID() keys in EnvPanel,
      ToolsPanel, and OpenClawFormFields to prevent list state bugs (P1)
    - Exclude openclaw from ProxyToggle/FailoverToggle in App.tsx (P1)
    - Add merge_additive_config() for openclaw/opencode deep link imports (P1)
    - Normalize serde(flatten) field naming to `extra` + HashMap (P2)
    - Add directory existence check in remove_openclaw_provider_from_live (P2)
    - Remove dead code in import_default_config and openclaw API methods (P2)
    - Add duplicate key validation in EnvPanel before save (P2)
    - Add openclawConfigDir to Settings type (P2)
    - Add staleTime to OpenClaw query hooks (P3)
    - Fix type-unsafe delete via destructuring in mutations.ts (P3)
  • fix(openclaw): address code review findings for robustness
    - Fix EnvPanel visibleKeys using entry key name instead of array index
      to prevent visibility state corruption after deletion
    - Add NaN guard in AgentsDefaultsPanel numeric field parsing
    - Validate provider id and models before importing from live config
    - Upgrade import failure log level from debug to warn for OpenCode/OpenClaw
  • feat(openclaw): add Env/Tools/Agents config panels
    - Migrate OpenClaw commands from provider.rs to dedicated commands/openclaw.rs
    - Add backend types and read/write for env, tools, agents.defaults sections
    - Create EnvPanel (API key + custom vars KV editor)
    - Create ToolsPanel (profile selector + allow/deny lists)
    - Create AgentsDefaultsPanel (default model + runtime parameters)
    - Extend App.tsx menu bar with Env/Tools/Agents buttons
    - Remove Prompts button for OpenClaw (overlaps with Workspace AGENTS.md)
  • feat(openclaw): extend workspace files with HEARTBEAT/BOOTSTRAP/BOOT
    Add 3 new markdown files to the workspace whitelist and frontend grid:
    - HEARTBEAT.md: activity runlist
    - BOOTSTRAP.md: first-run ritual
    - BOOT.md: gateway restart checklist
    
    Update i18n for all 3 locales (zh, en, ja).
  • feat(openclaw): add Workspace Files panel for managing bootstrap md files
    Add a dedicated panel to read/write OpenClaw's 6 workspace bootstrap files
    (AGENTS.md, SOUL.md, USER.md, IDENTITY.md, TOOLS.md, MEMORY.md) directly
    from ~/.openclaw/workspace/, with a whitelist-secured backend and Markdown
    editor UI. Also fix prompt auto-import missing OpenCode/OpenClaw and the
    PromptFormPanel filenameMap type exclusion.
  • fix(openclaw): prevent creating default provider on first launch
    Add additive mode guard in import_default_config() to skip OpenCode
    and OpenClaw apps, which should use their dedicated import functions.
  • feat(openclaw): add agents.defaults config support
    - Add types for default model config (primary + fallbacks)
    - Add types for model catalog/allowlist with aliases
    - Extend OpenClawModelEntry with cost and contextWindow fields
    - Add Tauri commands: get/set_openclaw_default_model, get/set_openclaw_model_catalog
    - Create frontend API (src/lib/api/openclaw.ts)
    - Add suggestedDefaults to provider presets with model metadata
    - Add i18n translations (zh/en/ja) for openclawConfig.*
  • chore(openclaw): remove dead code functions from openclaw_config
    Remove 6 unused functions marked with #[allow(dead_code)]:
    - get_openclaw_skills_dir: Skills not supported
    - get_env_vars/set_env_var: Environment vars unused
    - get_mcp_servers/set_mcp_server/remove_mcp_server: MCP not supported
    
    OpenClaw integration only requires provider management functionality.
  • fix(tests): add mcp_servers table to v4 migration test fixture
    Also includes OpenClaw icon that was added in previous commits.
  • fix(openclaw): remove MCP/Skills/Prompts support from OpenClaw
    OpenClaw only needs provider management functionality, not MCP, Skills,
    or Prompts features. This commit removes the incorrectly added support:
    
    - Revert SCHEMA_VERSION from 6 to 5 (remove v5->v6 migration)
    - Remove enabled_openclaw field from mcp_servers and skills tables
    - Remove openclaw field from McpApps and SkillApps structs
    - Update DAO queries to exclude enabled_openclaw column
    - Fix frontend components and types to exclude openclaw from MCP/Prompts
    - Update all related test files
  • feat(backend): add OpenClaw support to commands and deeplinks
    - Register openclaw_config module in lib.rs
    - Add OpenClaw commands and provider import on startup
    - Add OpenClaw branches to config and provider commands
    - Add build_openclaw_settings() for deeplink imports
    - Update MCP handlers with openclaw field in McpApps
    - Add OpenClaw prompt file path
  • feat(services): add OpenClaw branches to backend services
    - Add OpenClaw branches to proxy service (not supported)
    - Add OpenClaw to MCP service (skip sync, MCP still in development)
    - Add OpenClaw skills directory path
    - Update ProxyTakeoverStatus with openclaw field
    - Add OpenClaw to stream check (not supported)
  • feat(provider): add OpenClaw provider service support
    - Add import_openclaw_providers_from_live() function
    - Add remove_openclaw_provider_from_live() function
    - Update write_live_snapshot() for OpenClaw
    - Add openclaw fields to VisibleApps and AppSettings
    - Add get_openclaw_override_dir() function
  • feat(openclaw): add OpenClaw configuration module
    - Create openclaw_config.rs for reading/writing OpenClaw config
    - Support JSON5 format (~/.openclaw/openclaw.json)
    - Implement provider CRUD operations for additive mode
    - Add json5 dependency to Cargo.toml
  • feat(core): add OpenClaw to AppType enum and database schema
    - Add OpenClaw variant to AppType enum
    - Update is_additive_mode() to return true for OpenClaw
    - Update McpApps, SkillApps, McpRoot, PromptRoot structs
    - Add database migration v5 to v6 for enabled_openclaw columns
    - Update mcp_servers and skills table definitions
  • Webdav (#923)
    * feat: WebDAV backup/restore
    
    - Add WebDAV test/backup/restore commands and settings\n- Fix ja i18n missing keys; decode PROPFIND href as UTF-8\n- Stabilize Windows prompt auto-import tests via CC_SWITCH_TEST_HOME
    
    * chore: format and minor cleanups
    
    * fix: update build config
    
    * feat(webdav): unify sync UX and hardening fixes
    
    * fix(webdav): harden sync flow and stabilize sync UX/tests
    
    * fix(webdav): add resource limits to skills.zip extraction
    
    Prevent zip bomb / resource exhaustion by enforcing:
    - MAX_EXTRACT_ENTRIES (10,000 files)
    - MAX_EXTRACT_BYTES (512 MB cumulative)
    
    * refactor(webdav): drop deviceId and display deviceName only
    
    ---------
    
    Co-authored-by: small-lovely-cat <77799160+small-lovely-cat@users.noreply.github.com>
    Co-authored-by: saladday <1203511142@qq.com>
  • fix(linux): disable WebKitGTK hardware acceleration to prevent white screen (#986)
    On some Linux systems with AMD GPUs (e.g., AMD Cezanne/Radeon Vega),
    WebKitGTK's GPU process fails to initialize EGL, causing the app to
    show a white screen on startup.
    
    Root cause: `amdgpu_query_info(ACCEL_WORKING)` returns EACCES (-13),
    which causes EGL display creation to fail with EGL_BAD_PARAMETER,
    crashing the GPU process.
    
    Fix: Use WebKitGTK's `set_hardware_acceleration_policy(Never)` API to
    disable GPU acceleration on Linux, falling back to software rendering.
    This is applied at startup via Tauri's `with_webview` API.
    
    Co-authored-by: Naozhong AI <oursnoah@gmail.com>
    Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
  • feat(proxy): fix thinking rectifiers and resolve clippy warnings (#1005)
    * feat(proxy): align thinking rectifiers and resolve clippy warnings
    
    - add thinking budget rectifier flow with single retry on anthropic budget errors
    
    - align thinking signature rectification behavior with adaptive-safe handling
    
    - expose requestThinkingBudget in settings/ui/i18n and default rectifier config to disabled
    
    - fix clippy warnings in model_mapper format args and RectifierConfig default derive
    
    * fix(proxy): thinking rectifiers
  • feat(omo): improve agent model selection UX and fix lowercase keys (#1004)
    * fix(omo): use lowercase keys for builtin agent definitions
    
    OMO config schema expects all agent keys to be lowercase.
    Updated OMO_BUILTIN_AGENTS keys (Sisyphus → sisyphus, Hephaestus →
    hephaestus, etc.) and aligned Rust test fixtures accordingly.
    
    * feat(omo): add i18n support and tooltips for agent/category descriptions
    
    * feat(omo): add preset model variants for thinking level support
    
    Add OPENCODE_PRESET_MODEL_VARIANTS constant with variant definitions
    for Google, OpenAI, and Anthropic models. The omoModelVariantsMap
    builder now falls back to presets when config-defined variants are
    absent, enabling the variant selector for supported models.
    
    * feat(omo): replace model select with searchable combobox and improve fallback handling
    
    * feat(omo): enrich preset model defaults and metadata fallback
    
    * fix(omo): preserve custom fields and align otherFields import/validation
    
    * fix: resolve omo clippy warnings and include app update
  • fix(skill): correct skill doc URL branch and path resolution (#977)
    Use the actual branch returned by download_repo instead of the
    configured branch, fixing 404s when repos default to master but
    the URL was hardcoded to main. Also switch URL format from /tree/
    to /blob/ and always point to the SKILL.md file.
    
    Closes farion1231/cc-switch#968
  • feat(omo): integrate Oh My OpenCode profile management (#972)
    * feat(omo): integrate Oh My OpenCode profile management into Provider system
    
    Adds full-stack OMO support: backend config read/write/import, OMO-specific
    provider CRUD with exclusive switching, frontend profile editor with
    agent/category/model configuration, global config management, and i18n support.
    
    * feat(omo): add model/variant dropdowns from enabled providers
    
    Replace model text inputs with Select dropdowns sourced from enabled
    OpenCode providers, add thinking-level variant selection, and prevent
    auto-enabling newly added OMO providers.
    
    * fix(omo): use standard provider action styles for OMO switch button
    
    * fix(omo): replace hardcoded isZh strings with proper i18n t() calls
  • feat(env): add Volta package manager path detection (#969)
    Add ~/.volta/bin to CLI version scanning paths to support tools
    installed via Volta (claude, codex, gemini, etc.).
  • feat(pricing): add claude-opus-4-6 and gpt-5.3-codex models, use incremental seeding (#943)
    - Add claude-opus-4-6-20260206 pricing (same as opus-4-5)
    - Add gpt-5.3-codex series pricing (same as gpt-5.2-codex)
    - Change seed_model_pricing to INSERT OR IGNORE for incremental upsert
    - Remove count==0 guard in ensure_model_pricing_seeded so new models
      are appended on every startup without overwriting user customizations
  • feat(usage): enhance dashboard with auto-refresh control and robust formatting (#942)
    * style: format code and apply clippy lint fixes
    
    * feat(usage): enhance dashboard with auto-refresh control and robust formatting
    
    - Add configurable auto-refresh interval toggle (off/5s/10s/30s/60s) to usage dashboard
    - Extract shared format utilities (fmtUsd, fmtInt, parseFiniteNumber, getLocaleFromLanguage)
    - Refactor request log time filtering to rolling vs fixed mode with validation
    - Use stable serializable query keys instead of filter objects
    - Handle NaN/Infinity safely in number formatting across all usage components
    - Use RFC 3339 date format in backend trend data
  • refactor(terminal): unify terminal selection using global settings
    - Remove terminal selector from Session Manager page
    - Backend now reads terminal preference from global settings
    - Add terminal name mapping (iterm2 → iterm) for compatibility
    - Add WezTerm support to macOS terminal options
    - Add WezTerm translations for zh/en/ja
  • fix(windows): restore default home dir resolution to prevent data loss
    v3.10.3 introduced HOME env priority on Windows for test isolation,
    which caused database path to change when HOME differs from USERPROFILE
    (common in Git/MSYS environments), making providers appear to disappear.
    
    Changes:
    - Use CC_SWITCH_TEST_HOME for test isolation instead of HOME
    - Add legacy fallback to detect v3.10.3 database location on Windows
    - Add logging for legacy path detection to aid debugging
  • feat: session manger (#867)
    * feat: init session manger
    
    * feat: persist selected app to localStorage
    
    - Save app selection when switching providers
    - Restore last selected app on page load
    
    * feat: persist current view to localStorage
    
    - Save view selection when switching tabs
    - Restore last selected view on page load
    
    * styles: update ui
    
    * feat: Improve macOS Terminal activation and refactor Kitty launch to use  command with user's default shell.
    
    * fix: session view
    
    * feat: toc
    
    * feat: Implement FlexSearch for improved session search functionality.
    
    * feat: Redesign session manager search and filter UI for a more compact and dynamic experience.
    
    * refactor: modularize session manager by extracting components and utility functions into dedicated files.
    
    * feat: Enhance session terminal launching with support for iTerm2, Ghostty, WezTerm, and Alacritty, including UI and custom configuration options.
    
    * feat: Conditionally render terminal selection and resume session buttons only on macOS.
  • fix(stream_check): respect auth_mode for Claude health checks (#824)
    Previously, check_claude_stream always added the x-api-key header,
    ignoring the provider's auth_mode setting. This caused health check
    failures for proxy services that only support Bearer authentication.
    
    Now the function respects the auth.strategy field:
    - AuthStrategy::Anthropic: Authorization Bearer + x-api-key
    - AuthStrategy::ClaudeAuth: Authorization Bearer only
    - AuthStrategy::Bearer: Authorization Bearer only
    
    This aligns with the behavior of ClaudeAdapter::add_auth_headers
    and fixes health checks for proxy providers with auth_mode="bearer_only".
    
    Changes:
    - Modified check_claude_stream to conditionally add x-api-key header
    - Added AuthStrategy import
    - Added test_auth_strategy_imports unit test
    
    Tests: All passing (7/7 for stream_check module)
    
    Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
  • fix(ci): add xdg-utils for ARM64 AppImage and suppress dead_code warnings
    - Add xdg-utils dependency for xdg-mime binary required by AppImage bundler
    - Remove unused McpStatus struct from gemini_mcp.rs (duplicate of claude_mcp.rs)
    - Add #![allow(dead_code)] to proxy models reserved for future type-safe API
  • chore: bump version to 3.10.3
    - Update version in package.json, Cargo.toml, and tauri.conf.json
    - Add missing changelog entries for OpenCode API key link and AICodeMirror preset
    - Fix Prettier formatting for new hook files
  • feat(settings): add OpenCode support to environment check and one-click install
    - Add OpenCode version detection with Go path scanning
    - Add GitHub Releases API for fetching latest OpenCode version
    - Add OpenCode install command to one-click install section
    - Update i18n hints to include OpenCode across all locales
    - Fix SettingsPage indentation formatting
  • refactor(proxy): remove DeepSeek max_tokens clamp from transform layer
    The max_tokens restriction was too aggressive and should be handled
    upstream or by the provider itself. Simplify anthropic_to_openai by
    removing provider parameter since model mapping is already done by
    proxy::model_mapper.
  • fix(proxy): improve URL building and remove redundant model mapping
    - Add model parameter to request logs for better debugging
    - Fix duplicate /v1/v1 in URL when both base_url and endpoint have version
    - Extend ?beta=true parameter to /v1/chat/completions endpoint
    - Remove model mapping from transform layer (now handled by model_mapper)
    - Add DeepSeek max_tokens clamping (1-8192 range)
  • refactor(claude): migrate api_format from settings_config to meta
    Move api_format storage from settings_config to ProviderMeta to prevent
    polluting ~/.claude/settings.json when switching providers.
    
    - Add api_format field to ProviderMeta (Rust + TypeScript)
    - Update ProviderForm to read/write apiFormat from meta
    - Maintain backward compatibility for legacy settings_config.api_format
      and openrouter_compat_mode fields (read-only fallback)
    - Strip api_format from settings_config before writing to live config
  • fix(claude): improve backward compatibility for openrouter_compat_mode
    Extend backward compatibility support for legacy openrouter_compat_mode field:
    - Support number type (1 = enabled, 0 = disabled)
    - Support string type ("true"/"1" = enabled)
    - Add corresponding test cases for number and string types
  • feat(claude): add API format selector for third-party providers
    Replace the OpenRouter-specific compatibility toggle with a generic
    API format selector that allows all Claude providers to choose between:
    
    - Anthropic Messages (native): Direct passthrough, no conversion
    - OpenAI Chat Completions: Enables Anthropic ↔ OpenAI format conversion
    
    Changes:
    - Add ClaudeApiFormat type ("anthropic" | "openai_chat") to types.ts
    - Replace openRouterCompatToggle with apiFormat dropdown in ClaudeFormFields
    - Update ProviderForm to manage apiFormat state via settingsConfig.api_format
    - Refactor claude.rs: add get_api_format() method, update needs_transform()
    - Maintain backward compatibility with legacy openrouter_compat_mode field
    - Update i18n translations (zh, en, ja)
  • feat(skills): add install from ZIP file feature
    - Add open_zip_file_dialog command for selecting ZIP files
    - Add install_from_zip service method with recursive skill scanning
    - Add install_skills_from_zip Tauri command
    - Add frontend API methods and useInstallSkillsFromZip hook
    - Add "Install from ZIP" button in Skills management page
    - Support local skill ID format: local:{directory}
    - Add i18n translations for new feature and error messages
  • feat(settings): prioritize native install path for Claude Code detection
    - Move ~/.local/bin to first position in version scan search paths
    - Update one-click install commands to use official native installation
      (curl script) instead of npm for Claude Code
  • fix(codex): fix 404 errors and connection timeout with custom base_url (#760)
    * fix(proxy): fix Codex 404 errors with custom base_url prefixes
    
    - handlers.rs:268: Remove hardcoded /v1 prefix in Codex forwarding
    - codex.rs:140: Only add /v1 for origin-only base_urls, dedupe /v1/v1
    - stream_check.rs:364: Try /responses first, fallback to /v1/responses
    - provider.rs:427: Don't force /v1 for custom prefix base_urls
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(codex): always add /v1 for custom prefix base_urls
    
    Changed logic to always add /v1 prefix unless base_url already ends with /v1.
    This fixes 504 timeout errors with relay services that expect /v1 in the path.
    
    - Most relay services follow OpenAI standard format: /v1/responses
    - Users can opt-out by adding /v1 to their base_url configuration
    - Updated test case to reflect new behavior
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(proxy): allow system proxy on localhost with different ports
    
    - Only bypass system proxy if it points to CC Switch's own port (15721)
    - Allow other localhost proxies (e.g., Clash on 7890) to be used
    - Add INFO level logging for request URLs to aid debugging
    
    This fixes connection timeout issues when using local proxy tools.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(codex): don't add /v1 for custom prefix base_urls
    
    Reverted logic to not add /v1 for base_urls with custom prefixes.
    Many relay services use custom paths without /v1.
    
    - Pure origin (e.g., https://api.openai.com) → adds /v1
    - With /v1 (e.g., https://api.openai.com/v1) → no change
    - Custom prefix (e.g., https://example.com/openai) → no /v1
    
    This fixes 404 errors with relay services that don't use /v1 in their paths.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(proxy): use dynamic port for system proxy detection
    
    Instead of hardcoding port 15721, now uses the actual configured
    listen_port from proxy settings.
    
    - Added set_proxy_port() to update the port when proxy server starts
    - Added get_proxy_port() to retrieve current port for detection
    - Updated server.rs to call set_proxy_port() on startup
    - Updated tests to reflect new behavior
    
    This allows users to change the proxy port in settings without
    breaking the system proxy detection logic.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(proxy): change default proxy port from 15721 to 5000
    
    Update the default fallback port in get_proxy_port() from 15721 to 5000
    to match the project's standard default port configuration.
    
    Also updated test cases to use port 5000 consistently.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    
    * fix(proxy): revert default port back to 15721
    
    Revert the default fallback port in get_proxy_port() from 5000 back to 15721
    to align with the project's updated default port configuration.
    
    Also updated test cases to use port 15721 consistently.
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: ozbombor <ozbombor@users.noreply.github.com>
    Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
  • Feat/pricing config enhancement (#781)
    * feat(db): add pricing config fields to proxy_config table
    
    - Add default_cost_multiplier field per app type
    - Add pricing_model_source field (request/response)
    - Add request_model field to proxy_request_logs table
    - Implement schema migration v5
    
    * feat(api): add pricing config commands and provider meta fields
    
    - Add get/set commands for default cost multiplier
    - Add get/set commands for pricing model source
    - Extend ProviderMeta with cost_multiplier and pricing_model_source
    - Register new commands in Tauri invoke handler
    
    * fix(proxy): apply cost multiplier to total cost only
    
    - Move multiplier calculation from per-item to total cost
    - Add resolve_pricing_config for provider-level override
    - Include request_model and cost_multiplier in usage logs
    - Return new fields in get_request_logs API
    
    * feat(ui): add pricing config UI and usage log enhancements
    
    - Add pricing config section to provider advanced settings
    - Refactor PricingConfigPanel to compact table layout
    - Display all three apps (Claude/Codex/Gemini) in one view
    - Add multiplier column and request model display to logs
    - Add frontend API wrappers for pricing config
    
    * feat(i18n): add pricing config translations
    
    - Add zh/en/ja translations for pricing defaults config
    - Add translations for multiplier, requestModel, responseModel
    - Add provider pricing config translations
    
    * fix(pricing): align backfill cost calculation with real-time logic
    
    - Fix backfill to deduct cache_read_tokens from input (avoid double billing)
    - Apply multiplier only to total cost, not to each item
    - Add multiplier display in request detail panel with i18n support
    - Use AppError::localized for backend error messages
    - Fix init_proxy_config_rows to use per-app default values
    - Fix silent failure in set_default_cost_multiplier/set_pricing_model_source
    - Add clippy allow annotation for test mutex across await
    
    * style: format code with cargo fmt and prettier
    
    * fix(tests): correct error type assertions in proxy DAO tests
    
    The tests expected AppError::InvalidInput but the DAO functions use
    AppError::localized() which returns AppError::Localized variant.
    Updated assertions to match the correct error type with key validation.
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • feat(opencode): sync all providers to live config on directory change
    Add additive mode support for OpenCode in sync_current_to_live:
    - Add AppType::is_additive_mode() to distinguish switch vs additive mode
    - Add AppType::all() iterator to avoid hardcoding app lists
    - Add sync_all_providers_to_live() for additive mode apps
    - Refactor sync_current_to_live to handle both modes
    
    Frontend changes (directory settings):
    - Track opencodeDirChanged in useDirectorySettings
    - Trigger syncCurrentProvidersLiveSafe when OpenCode dir changes
    - Add i18n strings for OpenCode directory settings