Commit Graph

1045 Commits

  • refactor(theme): remove circular reveal animation for theme switching
    The View Transitions API used here crashes WebKitGTK with SIGSEGV on
    Linux. Rather than gating document.startViewTransition per platform
    (see PR #2502), drop the animation entirely — it's a low-value visual
    flourish on a low-frequency action that doesn't justify a permanent
    platform branch.
    
    Removes the ::view-transition-* CSS block and the coordinate plumbing
    in setTheme. The optional event parameter is kept on the API surface
    to keep call sites compiling; they'll be cleaned up in a follow-up
    commit.
  • chore(usage): drop Hermes Agent tracking integration
    Hermes aggregates all in-process API calls into a single sessions row
    with the `model` field locked to the initial model, so the usage
    dashboard cannot cleanly surface per-call billing context. Two rounds
    of UI workarounds (raw mapping, then `<model> @ <host>` display) did
    not resolve the user-facing confusion, so the whole tracking
    integration is dropped for now.
    
    Removes session_usage_hermes service (and its 17 tests), sync wiring
    in commands/usage.rs and lib.rs, _hermes_session/hermes_session
    entries in usage_stats SQL (provider_name_coalesce CASE and
    effective_usage_log_filter IN clause), frontend Tab/banner/dropdown/
    icon entries, and four i18n keys per locale.
    
    Hermes app integration outside usage tracking (proxy routing,
    session manager, config) is preserved. Pre-existing hermes rows in
    proxy_request_logs are left as orphans — filtered out by the
    updated SQL and never surfaced in the UI.
  • feat(providers): add Baidu Qianfan Coding Plan for Claude Code (#2322)
    * feat(providers): add baidu qianfan coding plan presets
    
    * refactor(providers): align qianfan presets with existing format
    
    * chore(providers): narrow qianfan coding plan scope
  • feat: support launch warp and execute session (#2466)
    * feat: support launch warp and execute session
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    * other wires
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    * for launch with provider
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    * fixup indirection
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    * clippy
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    * address comments
    
    Signed-off-by: tison <wander4096@gmail.com>
    
    ---------
    
    Signed-off-by: tison <wander4096@gmail.com>
  • feat(usage): add Hermes Agent tracking + fix zero-cost bug + perf
    Hermes:
    - Parse ~/.hermes/state.db sessions (incl. profiles/*/state.db) into
      proxy_request_logs with data_source='hermes_session', WAL-aware
      incremental sync, Hermes-reported cost preferred over model_pricing
      fallback
    
    Zero-cost bug (dashboard showed \$0 totals):
    - GPT-5.5 family default pricing (~83% of affected rows used GPT-5.5)
    - find_model_pricing_row: ASCII-lowercase normalization so
      "OpenAI/GPT-5.5@HIGH" matches seeded "gpt-5.5"
    - Startup cost backfill in async task: scan rows where total_cost <= 0
      but tokens > 0, recompute via model_pricing in a single transaction
    
    Performance:
    - Add (app_type, created_at DESC) covering index for dashboard range
      queries
    - Add expression index on COALESCE(data_source, 'proxy') so dedup EXISTS
      subqueries use index lookup instead of full scan; drop superseded
      idx_request_logs_dedup_lookup
    
    Refactor:
    - row_to_request_log_detail helper (3-way de-dup; fixes cost_multiplier
      \"1\" vs \"1.0\" drift between callers)
    - Promote get_sync_state/update_sync_state to shared session_usage
      module (4 copies -> 1)
    - run_step helper in lib.rs replaces 9 if-let-Err blocks
    - maybe_backfill_log_costs returns bool to skip duplicate total_cost
      parsing in caller
  • chore(kimi): update Kimi For Coding website URL to /code/docs/
    Sync the preset's websiteUrl from the legacy /coding/docs/ path to
    the current /code/docs/ path across all four app presets (claude,
    hermes, openclaw, opencode).
  • chore(codex): hide 1M context window toggle in provider edit form
    Codex models no longer accept model_context_window=1000000, so the
    toggle and its paired auto-compact-limit input are commented out in
    the provider edit form. State hooks, helper imports, and i18n keys
    are preserved so the UI can be restored in one batch if upstream
    support returns. The TOML editor remains visible, allowing manual
    edits if needed.
  • feat(provider-form): soften validation with "save anyway" prompt (#2307)
    * feat(provider-form): soften business-rule validation with "save anyway" prompt
    
    Refactor handleSubmit so empty-field / missing-item validations (provider
    name, endpoint, API key, opencode model, template variables, provider key
    required) no longer hard-reject with toast.error. Instead they are collected
    into an issues list and presented via a ConfirmDialog; the user can cancel
    or choose "Save anyway" to proceed.
    
    Integrity constraints stay as hard rejections:
    - providerKey regex / duplicate (would corrupt other providers)
    - Copilot / Codex OAuth not authenticated (no token, cannot establish)
    - omo Other Fields JSON not an object / parse failure
    
    This aligns the frontend with the backend's existing "relaxed save / strict
    switch" split (see gemini_config.rs: validate_gemini_settings vs
    validate_gemini_settings_strict) and unblocks legitimate configs such as
    AWS Bedrock, Vertex AI, and custom Gemini base URLs that the UI previously
    refused to save.
    
    Refs: #2196, #1204
    
    * fix(provider-form): address review feedback on soft-validation
    
    P1: move empty providerKey back to hard rejection for OpenCode / OpenClaw /
    Hermes. Since providerKey is the primary identity for these apps and the
    mutations layer throws "Provider key is required" when absent, letting users
    click "save anyway" would surface a generic error toast instead of a
    precise, actionable one. Treat empty providerKey as an integrity constraint
    alongside regex / duplicate checks.
    
    P2: give the soft-confirm submit path its own submitting state. The
    confirm-dialog path bypassed react-hook-form's isSubmitting lifecycle, so
    slow or failing saves left the outer submit button responsive and could
    spawn unhandled rejections. Now the confirm handler awaits performSubmit
    inside try/catch/finally, uses an isConfirmSubmitting flag to gate both
    confirm and cancel clicks, and folds the flag into the outer disabled
    state and onSubmittingChange callback.
    
    Refs: #2307 review comments
    
    * chore(clippy): use push for single char '…' in truncate_body
    
    Clippy 1.95 added single_char_add_str which flagged the push_str("…")
    in truncate_body. Rebased onto latest upstream/main and applied the
    suggested fix so the Backend Checks clippy job passes.
    
    Unrelated to this PR's core changes; bundled in so the PR is mergeable
    without waiting for a separate upstream fix.
    
    ---------
    
    Co-authored-by: Allen <allen@AllenMacBook-M4-Pro.local>
  • feat(compshare): add Coding Plan preset across claude/codex/hermes/openclaw
    Introduce a dedicated "Compshare Coding Plan" variant pointing to
    https://cp.compshare.cn (with /v1 for OpenAI-compatible apps). Reuses
    the existing ucloud icon and promotion copy, while adding a new
    providerForm.presets.ucloudCoding key in zh/en/ja.
  • feat(deepseek): switch presets to V4 (flash/pro) and add pricing
    DeepSeek released V4 flash/pro; legacy IDs deepseek-chat / deepseek-reasoner
    now alias to deepseek-v4-flash and will be deprecated.
    
    - Update claude/hermes/opencode/openclaw presets to v4-pro / v4-flash,
      context 128K -> 1M; Claude Anthropic-compat endpoint routes OPUS/SONNET
      to v4-pro and HAIKU to v4-flash, plus an explicit modelsUrl override.
    - Seed deepseek-v4-flash ($0.14/$0.28 per 1M) and deepseek-v4-pro
      ($1.68/$3.36 per 1M) into model_pricing; older v3.x / chat / reasoner
      rows kept for historical usage stats (INSERT OR IGNORE).
    - Refresh user-manual (zh/en/ja) pricing table and note that legacy model
      IDs are billed at v4-flash rates.
  • fix(model-fetch): support /models for Anthropic-compat subpath providers
    Providers like DeepSeek, Kimi, Zhipu GLM and MiniMax expose the
    Anthropic-compatible API on a subpath (e.g. /anthropic) while the
    OpenAI-style /models endpoint lives at the API root. The previous
    heuristic blindly appended /v1/models to the Base URL, so every such
    provider returned 404 and the UI mislabeled it as "provider does not
    support fetching models".
    
    Backend now generates a candidate list and tries them in order:
    preset override -> baseURL /v1/models -> stripped-subpath /v1/models ->
    stripped-subpath /models. Non-404/405 responses (auth, network) stop
    immediately so we never retry against hostile status codes. Known
    compat suffixes are kept in a length-descending constant so the
    longest match wins; response bodies are truncated to 512 chars to
    avoid HTML 404 pages bloating the error string.
    
    Preset type gains an optional modelsUrl (DeepSeek points at
    https://api.deepseek.com/models). Frontend threads the override
    through fetchModelsForConfig when the current Base URL still matches
    the preset default. A new fetchModelsEndpointNotFound i18n key
    replaces the misleading "not supported" toast for exhausted-candidate
    and 404/405 cases (zh/en/ja).
  • fix(copilot): resolve Claude model IDs against live /models list
    Copilot upstream returns model_not_supported when the client sends
    dash-form Claude IDs (claude-sonnet-4-6, claude-sonnet-4-6[1m]) while
    /models only accepts dot form (claude-sonnet-4.6, -1m suffix).
    
    - Add copilot_model_map: syntax normalize (dash->dot, [1m]->-1m) plus
      live /models exact match and family-version fallback, reusing the
      existing 5 min auth cache. Returns None when the whole family is
      absent so upstream surfaces an explicit error instead of silently
      switching families.
    - Wire into forwarder Copilot hook; runs before anthropic_to_openai
      conversion.
    - Default Opus slot in the Copilot preset maps to Sonnet 4.6: Pro
      dropped all Opus on 2026-04-20 and Pro+ bills Opus 4.7 at 7.5x.
      Users who want real Opus can switch manually in the UI.
    
    Refs: https://github.com/farion1231/cc-switch/issues/2016
  • feat(tray): show coding-plan usage for Kimi / Zhipu / MiniMax
    dc04165f surfaced tray usage badges for Claude/Codex/Gemini official
    OAuth only. Chinese coding-plan providers already expose 5h + weekly
    windows through coding_plan::get_coding_plan_quota, but two gaps kept
    the tray from rendering them.
    
    - format_script_summary read only data.first(), truncating the tier-
      flattened UsageResult to a single window. Detect plan_name matching
      TIER_FIVE_HOUR / TIER_WEEKLY_LIMIT and emit the "🟢 h12% w80%" layout
      used by format_subscription_summary; worst utilization drives the
      emoji. Copilot / balance / custom scripts keep the legacy single-
      bucket output via fallback.
    
    - usage_script previously required manual activation through
      UsageScriptModal. Auto-inject meta.usage_script on Claude provider
      creation when ANTHROPIC_BASE_URL matches a known coding plan, so the
      tray lights up without the user opening the modal. Does not overwrite
      existing usage_script on update.
    
    Extract the URL route table out of UsageScriptModal into a shared
    codingPlanProviders module so the modal, the creation hook, and the
    Rust coding_plan::detect_provider mirror all agree on one list.
    Add TIER_WEEKLY_LIMIT alongside TIER_FIVE_HOUR and a createUsageScript()
    factory to collapse the duplicated default fields across four call
    sites and drop the remaining stringly-typed tier names.
  • refactor(hermes): drop config health check scanner
    The Hermes config.yaml schema has stabilized and users have migrated to
    the current provider fields, so the value of scanning for model.provider
    dangling references, custom_providers shape errors, v12 migration residue
    etc. no longer justifies the maintenance surface — and the scan produces
    false positives when users keep some providers under Hermes' v12+
    providers: dict (Hermes' runtime merges both shapes, but CC Switch's
    scanner only looked at the list form).
    
    Removes the whole HermesHealthWarning type, scan_hermes_config_health
    command, HermesHealthBanner React component, useHermesHealth hook,
    warnings field on HermesWriteOutcome, and the three helper functions
    (yaml_as_non_empty_str, collect_mapping_string_keys, hermes_warning)
    that only served the scanner. Drops the matching i18n keys in
    zh/en/ja and the fixInWebUI button label that only the banner used.
  • feat(tray): show cached provider usage in the system tray menu (#2184)
    * feat: add Rust-side write-through usage cache
    
    Introduce an in-memory UsageCache on AppState that the existing usage
    query commands populate on success. The cache is read-only to the rest
    of the app today; the next commit consumes it from the tray menu.
    
    - New services::usage_cache module with split maps: subscription keyed
      by AppType, script keyed by (AppType, provider_id).
    - AppType gains Eq + Hash so it can be used as a HashMap key.
    - commands::subscription::get_subscription_quota now takes State<AppState>
      and writes through on success (signature change is invisible to the
      frontend — Tauri injects State automatically).
    - commands::provider::queryProviderUsage body extracted into an inner
      async fn; the public command wraps it with write-through, covering
      Copilot, coding-plan, balance, and generic script paths uniformly.
    
    Cache is in-memory only; auto-query interval and the upcoming tray
    refresh action rebuild it after restarts.
    
    * feat(tray): surface cached usage in the system tray menu
    
    Read UsageCache populated by the previous commit and render it in three
    places, scoped to whatever TRAY_SECTIONS covers (Claude/Codex/Gemini):
    
    1. Inline suffix on each provider submenu item
       "AnyProvider  · 🟢 5h 18% / 7d 23%"
    2. Disabled summary row per visible app under "Show Main"
       "Claude · Anthropic Official · 🟢 5h 18% / 7d 23%"
    3. "Refresh all usage" menu item that triggers get_subscription_quota +
       queryProviderUsage for every applicable provider, then rebuilds the
       tray menu via the existing refresh_tray_menu path.
    
    Color encoding uses emoji (🟢 <70% / 🟠 70-89% / 🔴 ≥90%) since Tauri 2
    tray labels are plain text. Missing cache entry leaves the label
    unchanged — tray never issues network requests when opened. Three new
    i18n-ready strings live in TrayTexts (en/zh/ja), following the existing
    pattern for tray text.
    
    Closes #2178.
    
    * feat(usage): bridge tray UsageCache writes to frontend React Query
    
    Why: tray hover triggers backend-only refresh that wrote to UsageCache but
    never notified the frontend, leaving main UI stale while tray showed fresh
    numbers. Emit a payload-carrying event after each cache write so React Query
    can setQueryData directly, keeping both views in sync without duplicate fetches.
    
    * fix(tray): skip hidden apps on hover refresh and drop stale disabled-script cache
    
    Address P2 findings from automated review on #2184:
    
    1. refresh_all_usage_in_tray now filters TRAY_SECTIONS by settings.visible_apps
       before scheduling subscription/script queries, matching create_tray_menu and
       preventing wasted external API calls (and rate-limit/auth-error log noise)
       for apps the user has hidden.
    
    2. format_usage_suffix only trusts the script cache when provider.meta.usage_script
       is still enabled; when a script is disabled/removed the cached suffix is now
       invalidated so the tray label no longer shows stale data indefinitely.
    
    * refactor: consolidate codex provider helpers and fix test semantics
    
    - Add Provider::is_codex_oauth() and Provider::codex_fast_mode_enabled()
      to eliminate duplicated meta extraction in claude.rs and stream_check.rs
    - Fix non-codex-oauth tests to pass codex_fast_mode=false (was true, harmless
      but semantically misleading)
    - Remove redundant is_dir() guard after resolve_skill_source_dir already
      guarantees the returned path is a directory
    
    * style: apply cargo fmt
    
    * fix(tray): reflect failed refreshes in cache and support Gemini flash-lite
    
    Follow-up to the tray usage-display feature addressing review feedback:
    
    - Write snapshots for both Ok(success:false) and Err paths in
      queryProviderUsage / get_subscription_quota so stale success data
      no longer persists across failed refreshes; the original Err is
      still returned to the frontend onError handler.
    - Include gemini_flash_lite tier in the tray summary with label "l".
      Matches the frontend SubscriptionQuotaFooter and keeps the worst
      emoji correct when lite is the highest utilization.
    - Add TIER_GEMINI_PRO / _FLASH / _FLASH_LITE constants in
      services/subscription.rs and reuse them in classify_gemini_model
      and sort_order.
    - Extract Provider::has_usage_script_enabled() to remove the
      duplicated meta.usage_script chain at two call sites.
    - Use db.get_provider_by_id in refresh_all_usage_in_tray instead of
      materialising the full provider map, and parallelise subscription
      and script futures via futures::future::join.
    - Narrow refresh_all_usage_in_tray to each section's effective
      current provider (script if enabled, else subscription when the
      provider is official). Hover refreshes now issue at most
      TRAY_SECTIONS.len() outbound requests.
    - Add 10 unit tests in tray::tests covering Claude/Codex h/w dispatch,
      Gemini p/f/l dispatch (including lite-only and lite-worst cases),
      and success/failure guards.
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • Fix/一键配置失效 (#2249)
    * style(FailoverQueueManager): 显示供应商备注信息
    
    * style(FailoverQueueItem): 添加供应商备注字段以支持备注信息显示
    
    * style(FailoverQueueManager): 显示供应商备注信息
    
    * style(FailoverQueueItem): 添加供应商备注字段以支持备注信息显示
    
    * style(FailoverQueueManager): 更新供应商备注信息的显示样式
    
    * style(FailoverQueueItem): 添加条件序列化以优化供应商备注字段
    
    * fix: 优化模型状态管理,确保配置更新时正确引用最新设置
    
    * fix(skill): improve error handling for skill source directory resolution
    
    Co-authored-by: Copilot <copilot@github.com>
    
    * fix(gemini): simplify project directory retrieval in scan_sessions function
    
    * fix(useModelState): optimize latestConfigRef assignment in useModelState hook
    
    * fix(useModelState): remove unnecessary blank line in useModelState hook
    
    ---------
    
    Co-authored-by: Copilot <copilot@github.com>
  • feat: Add Codex OAuth FAST mode toggle (#2210)
    * Add Codex OAuth FAST mode toggle
    
    * fix(codex-oauth): default FAST mode to off to avoid surprise quota burn
    
    service_tier="priority" consumes ChatGPT subscription quota at a higher
    rate. Users must now opt in explicitly rather than inherit FAST mode
    silently when this feature ships.
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • fix(skills): prevent duplicate imports when import button is double-clicked (#2211)
    Closes #2139
    
    Two related defects let the installed-skills count balloon when users
    tap the import confirm button multiple times — either deliberately or
    because the button is still clickable while a slow import is in flight:
    
    - The confirm button only disabled itself while `selected.size === 0`,
      so it stayed clickable during a pending mutation. Each extra click
      triggered another `importFromApps` mutation.
    - `useImportSkillsFromApps` appended the server response to the
      installed cache without deduping, so re-firing the mutation stacked
      the same skills into the list again.
    
    Disable the confirm (and cancel) buttons while the mutation is pending
    — matching the `isRestoring` / `isDeleting` pattern already used by
    `RestoreSkillsDialog` — and merge success payloads by
    `InstalledSkill.id` so repeated results overwrite rather than
    accumulate.
    
    The merge is extracted as a pure `mergeImportedSkills` reducer to make
    the behaviour unit-testable and to short-circuit on an empty payload,
    returning the existing reference so React Query does not notify
    subscribers about a no-op cache update.
  • Style/session manager list UI (#2201)
    * style(FailoverQueueManager): 显示供应商备注信息
    
    * style(FailoverQueueItem): 添加供应商备注字段以支持备注信息显示
    
    * style(FailoverQueueManager): 显示供应商备注信息
    
    * style(FailoverQueueItem): 添加供应商备注字段以支持备注信息显示
    
    * style(FailoverQueueManager): 更新供应商备注信息的显示样式
    
    * style(FailoverQueueItem): 添加条件序列化以优化供应商备注字段
    
    * style(App, SettingsPage, ScrollArea): 调整组件样式以改善布局和视觉效果
    
    * style(App, SettingsPage, ScrollArea): 调整组件样式以改善布局和视觉效果
    
    * style(SettingsPage, useSettings): 统一代码格式,调整样式和变量声明
    
    * style(App): 调整底部内边距以改善布局
  • feat(presets): upgrade Kimi K2.5 to K2.6 in direct Moonshot configs
    Bump model id and display name from K2.5 to K2.6 in Hermes, OpenClaw,
    OpenCode, and Claude (direct api.moonshot.cn) presets. Pricing,
    context window, and base URL are unchanged.
    
    Add kimi-k2.6 row to model_pricing seed; no migration needed since
    seed_model_pricing uses INSERT OR IGNORE and runs on every startup
    via ensure_model_pricing_seeded. Old kimi-k2.5 row is kept to
    preserve historical usage stats.
    
    Nvidia aggregator forwards (moonshotai/kimi-k2.5) intentionally keep
    the K2.5 SKU until Nvidia's catalog confirms K2.6.
  • feat(presets): add DDSHub Codex preset
    DDSHub now exposes a Codex-compatible endpoint at the same host as
    its Claude service. Base URL omits the /v1 suffix since the gateway
    auto-routes OpenAI SDK paths.
  • feat(presets): add LemonData provider across all six apps
    Register LemonData (third-party partner) preset for Claude, Codex,
    Gemini, OpenCode, OpenClaw, and Hermes, plus icon assets and i18n
    partner promotion copy (zh/en/ja). Claude preset uses
    ANTHROPIC_API_KEY auth; OpenAI-compatible apps target gpt-5.4.
  • style(hermes): use dashboard icon and move MCP to toolbar end
    Swap ExternalLink for LayoutDashboard on the Hermes Web UI button —
    clicking it may launch `hermes dashboard` rather than just open a URL,
    so a panel-style glyph reads truer than a generic external-link icon.
    Also reorder the toolbar so MCP sits in the final slot, matching the
    claude/codex/gemini/opencode layout.
  • fix(usage): support Hermes and OpenClaw in usage query modal
    Extend getProviderCredentials to read flat settingsConfig fields for
    Hermes (snake_case base_url / api_key) and OpenClaw (camelCase baseUrl
    / apiKey), so the "official balance" template auto-selects for matching
    providers like SiliconFlow.
    
    Also refactor the BALANCE and TOKEN_PLAN test paths in handleTest to
    reuse the precomputed providerCredentials instead of re-reading
    env.ANTHROPIC_* directly, which previously caused empty key errors for
    non-Claude apps even when the key was configured.
  • feat(hermes): launch dashboard from toolbar when Web UI is offline
    When the Hermes Web UI probe fails, the toolbar entry now opens an info
    confirm dialog offering to run `hermes dashboard` in the user's preferred
    terminal. Accepting spawns it via a temp bash/batch script; `hermes
    dashboard` itself opens the browser once ready, so we do not poll.
    The Memory panel and Health banner keep the existing toast behavior.
    
    Also corrects the stale `hermes web` hint in the offline toast (the real
    command is `hermes dashboard`) and reorders Linux terminal detection to
    try `which` before stat'ing /usr/bin, /bin, /usr/local/bin.
  • style(providers): apply prettier to common-config hooks
    Reformat three hooks brought in from upstream #2191 so that
    format:check passes in CI.
  • fix(header): stop auto-compact from latching after maximize
    useAutoCompact cached normalWidthRef = el.scrollWidth on every
    non-compact resize, but per DOM spec scrollWidth === clientWidth
    when content fits. Maximizing the window (content no longer
    overflows) therefore wrote the container width into
    normalWidthRef, making it impossible to re-enter compact when
    the window was restored to its original size.
    
    Move the assignment inside the overflow branch so the cache is
    only written at the actual compact threshold, where scrollWidth
    reflects the real content width.
  • style(header): unify toolbar icon button width across apps
    Normalize all icon-only ghost buttons in the header toolbar to
    32x32 (w-8 px-2). Previously Hermes/OpenClaw used default sm
    padding (~40px) while Claude's Skills/Sessions used w-8 px-2,
    so switching apps caused a width jump and put useAutoCompact's
    cached normalWidthRef out of sync across apps.
  • feat(skills): enable Hermes in unified Skills management
    Wire hermes through SkillApps struct, DAO SQL, command parser, and
    SKILLS_APP_IDS. Add a Skills entry to the Hermes toolbar. Simplify
    skill_sync test fixtures to use SkillApps::default().
  • feat(hermes): align provider schema with Hermes Agent 0.10.0
    Hermes 0.10.0 tightened custom_providers validation (commit 2cdae233):
    invalid base_urls are rejected, unknown fields produce warnings, and
    new fields (rate_limit_delay, bedrock_converse, key_env) landed.
    
    - Add bedrock_converse to the api_mode selector (and i18n labels)
    - Expose rate_limit_delay in a provider-level advanced panel
    - Validate base_url client-side (URL shape, template-token friendly)
    - Drop per-model max_tokens — not in _VALID_CUSTOM_PROVIDER_FIELDS
    - Round-trip test asserts set_provider preserves rate_limit_delay /
      key_env / any unknown forward-compat field
  • style: apply prettier and rustfmt
    No behavior changes. Brings three files back in line with the project
    formatters (CI runs `pnpm format:check` and `cargo fmt --check`).
  • fix(providers): drop legacy ANTHROPIC_REASONING_MODEL from Claude quick-set
    The model-mapping quick-set button referenced an undefined `reasoningModel`
    prop and wrote `ANTHROPIC_REASONING_MODEL`, which the backend explicitly
    marks as deprecated legacy (see services/provider/mod.rs and
    services/proxy.rs). Remove all three references so typecheck passes and
    the button matches the provider model schema.
  • refactor(hermes): drop "Auto" api_mode and require explicit protocol
    Hermes' built-in api_mode detection only matches a handful of official
    endpoints (api.openai.com, api.anthropic.com, api.x.ai, AWS Bedrock);
    third-party / proxy endpoints silently fall back to chat_completions,
    which causes opaque 401/404s on Anthropic-protocol or Codex-Responses
    providers. The "Auto" option was misleading for the common third-party
    case.
    
    - Drop the "Auto" option from the API Mode dropdown; remove the
      HermesApiModeChoice sentinel type so writes always emit api_mode.
    - Default new providers and legacy entries lacking api_mode to
      chat_completions (only persisted on user save).
    - Deeplink imports now write api_mode: chat_completions explicitly
      instead of relying on URL heuristics; test renamed accordingly.
    - Rename the "Codex Responses (Copilot / OpenCode)" label to
      "OpenAI Responses" to match OpenAI's /v1/responses naming.
  • refactor(hermes): share provider-source marker constants and write guard
    After /simplify review of the P1-3 second wave, two small cleanups:
    
    - Lift the `_cc_source` / `providers_dict` magic strings out of
      ProviderCard into a shared helper (`isHermesReadOnlyProvider`) and
      named constants in hermesProviderPresets.ts. Front-end and back-end
      now document the same marker contract in two mirrored places
      instead of drifting strings.
    
    - Replace the duplicate `is_dict_only_provider` + `format!` branches
      at the top of `set_provider` / `remove_provider` with a single
      `ensure_provider_writable(config, name, verb)` guard. Future error
      copy tweaks only have to happen once.
    
    No behaviour change; all 52 hermes_config tests stay green.
  • feat(hermes): render providers: dict overlays as read-only cards
    ProviderCard now detects Hermes provider entries sourced from the
    v12+ `providers:` dict via the `_cc_source` marker that the backend
    injects, and renders a "Hermes Managed" badge beside the title.
    ProviderActions receives an `isReadOnly` prop that disables the Edit
    and Delete buttons (with a tooltip pointing the user at Hermes Web
    UI) while keeping Switch and Duplicate enabled — switching only
    touches `model.*`, and duplicate lets users fork the overlay into
    their own `custom_providers:` list.
    
    Three-locale i18n keys `provider.managedByHermes` /
    `provider.managedByHermesHint` added.
  • feat(hermes): surface providers: dict entries read-only
    Hermes v12+ migrated some provider entries from the `custom_providers:`
    list into a `providers:` dict (keyed by id). CC Switch previously
    ignored that source entirely, leaving users blind to providers they had
    configured via Hermes' own Web UI; the only feedback was a generic
    migration warning in the health banner.
    
    `get_providers()` now unions both sources, matching upstream
    `get_compatible_custom_providers` dedup order (list wins on name
    collision). Entries coming from the dict carry a `_cc_source =
    "providers_dict"` marker plus the original `provider_key`, which the
    UI layer will use to render them read-only. `set_provider` and
    `remove_provider` now refuse to touch dict-only entries, steering the
    user to Hermes Web UI. `sanitize_hermes_provider_keys` strips the UI
    markers on write so they never reach YAML.
    
    The `schema_migrated_v12` health warning copy reframes the situation:
    entries are shown read-only in CC Switch rather than invisible.
  • fix(hermes): prevent YAML pollution and drop of OAuth mcp auth
    DeepLink Hermes import was emitting camelCase (baseUrl / apiKey /
    apiMode) that the Hermes runtime does not recognise, poisoning
    `custom_providers:` entries on activation. The MCP sync path was
    also stripping `auth: oauth` on round-trip, silently downgrading
    OAuth-type servers to unauthenticated calls.
    
    The Hermes deeplink branch now emits snake_case via a dedicated
    builder; `sanitize_hermes_provider_keys` runs on both `set_provider`
    and `get_providers` so legacy DB records heal on next access.
    `HERMES_EXTRA_FIELDS` preserves `auth`. The `api_mode` dropdown gains
    `codex_responses` (Copilot / OpenCode), and the schema-migrated
    warning copy no longer hard-codes "v12" (upstream `_config_version`
    is now 19).
  • feat(hermes): memory enable switch + clearer migration warning copy
    Replaces the greyed-out "Memory is disabled" banner with a real Switch
    at the top of each memory tab. Users can now toggle Hermes' memory/user
    blobs without leaving CC Switch; the underlying write goes through the
    merge-aware `set_memory_enabled`, so budgets and external-provider
    settings survive toggle operations. The new `useToggleHermesMemoryEnabled`
    mutation invalidates the limits query so the Switch state and the
    amber disabled-hint update in lockstep.
    
    Reworks the `schema_migrated_v12` health banner copy to match the
    simplified "CC Switch only manages custom_providers" posture — it now
    tells users to reconcile migrated dict entries via Hermes Web UI,
    instead of the earlier (and now inaccurate) "CC Switch reads both".
  • feat(settings): add Hermes config dir override with data-driven dispatch
    Adds a dedicated Hermes row to the directory-override settings so users
    can point CC Switch at alternate Hermes config locations (e.g. a second
    profile directory for work/personal split). `get_config_dir` on the
    Rust side already supports hermes; this just wires up the frontend row.
    
    Wiring it through `useDirectorySettings` revealed a scaling problem:
    every supported app required five parallel ternary chains across
    `computeDefaultConfigDir`, `updateDirectory`, `browseDirectory`,
    `resetDirectory`, and `updateDirectoryState`. Replaces those with two
    lookup tables (`APP_DIRECTORY_META`, `DIRECTORY_KEY_TO_SETTINGS_FIELD`)
    so adding the next app is two entries, not fifteen edit sites.
    
    Drive-by cleanup from the same touch:
    * `resetAllDirectories` takes a `ResolvedAppDirectoryOverrides` object
      instead of five positional optional strings.
    * `setResolvedDirs` returns the same reference when the sanitized
      value is unchanged, so no-op edits don't cascade renders.
    
    Also lands all i18n updates for this series (`hermesConfigDir` and
    placeholder, Memory section's enable/disable/toggleFailed copy, and
    the reworded `schemaMigratedV12` warning) in zh/en/ja together.
  • feat(hermes): replace Prompts entry with Memory panel
    Hermes has no slash-prompt concept (templates live as Skills), so the
    Prompts tab for the Hermes app was always empty. Swap the toolbar Book
    button for a Brain button that opens a new Memory panel editing
    ~/.hermes/memories/{MEMORY,USER}.md — Hermes' first-class memory store
    which its Web UI exposes only as on/off toggles, never as an editor.
    
    The panel shows each file in its own tab with a character-budget bar
    read from config.yaml's nested memory.* section (memory_char_limit /
    user_char_limit, default 2200 / 1375). Edits are written atomically;
    Hermes picks them up on the next session start per MemoryStore.
    
    Also extract useDarkMode to src/hooks/useDarkMode.ts — the codebase
    already repeats the same MutationObserver pattern in 12+ places; this
    PR introduces the shared hook and uses it once, leaving the migration
    of the other copies to a follow-up.
  • refactor(hermes): delegate deep config to Hermes Web UI
    Slim the Hermes surface in CC Switch to match its core positioning —
    cross-client provider switching and shared MCP/prompts/skills — and
    delegate deep configuration (model, agent, env, skills, cron, logs)
    to the Hermes Web UI at http://127.0.0.1:9119.
    
    - Drop AgentPanel/EnvPanel/ModelPanel and their mutation commands,
      hooks, types, and i18n keys across zh/en/ja.
    - Add open_hermes_web_ui Tauri command that probes /api/status and
      launches the URL in the system browser. Hermes injects its own
      session token into the returned HTML, so CC Switch doesn't need
      to touch auth.
    - Surface the launcher from the Hermes toolbar and the health banner
      via a shared useOpenHermesWebUI() hook; the offline error code is
      defined once per side and referenced across the contract.
    - Keep read-only access to model.provider so ProviderList can still
      highlight the active supplier; apply_switch_defaults continues to
      write the top-level model section when switching providers.
    
    Net diff: +152 / -1253.
  • fix(presets): refresh stale context windows for DeepSeek and Claude 1M
    - DeepSeek V3.2 / R1 (Hermes, OpenClaw): 64K → 128K context
    - DeepSeek R1 max output: 8K → 64K (includes CoT tokens)
    - Claude Opus 4.7 / Sonnet 4.6 via OpenRouter: 200K → 1M context
  • fix(presets): refresh stale model IDs and backfill Hermes model lists
    - Bump NewAPI universal preset to Claude 4.7 / Sonnet 4.6 / Haiku 4.5 and
      Gemini 3.1; fix opusModel mistakenly pointing to Sonnet
    - Bump Gemini Native (Claude preset) to gemini-3.1-pro / gemini-3-flash
    - Bump TheRouter Gemini preset to gemini-3.1-pro
    - Backfill models[] + suggestedDefaults for 15 Hermes anthropic_messages
      presets:
        * Bailian For Coding: qwen3-coder-plus / qwen3-max
        * Kimi For Coding: kimi-for-coding
        * 13 third-party Claude proxies: claude-opus-4-7 / sonnet-4-6 /
          haiku-4-5-20251001
    - Add Claude Haiku 4.5 entry to Hermes OpenRouter model list
  • feat(hermes): switch eligible presets to chat_completions + GPT-5.4
    Migrate 18 Hermes provider presets from anthropic_messages to
    chat_completions to sidestep known upstream Hermes bugs (model-name
    dot-mangling in normalize_model_name, api_mode drop after v11->v12
    migration, and auxiliary_client OpenAI hardcode).
    
    Native providers now target each vendor's official OpenAI-compatible
    endpoint with correct model IDs: Kimi (kimi-k2.5-preview on /v1),
    Bailian (compatible-mode/v1 with Qwen3 defaults), Xiaomi MiMo, Longcat
    (/openai/v1), Zhipu GLM (/api/paas/v4), ModelScope, MiniMax, SiliconFlow,
    and Novita (/v3/openai).
    
    Aggregators (Shengsuanyun, AiHubMix, DMXAPI, Compshare, TheRouter)
    default to GPT-5.4 on chat_completions, mirroring the Codex preset
    lineup. TheRouter omits gpt-5.4-pro since that variant is Responses-only
    and Hermes implements only chat_completions. OpenRouter's existing
    openai/gpt-5 entry is bumped to openai/gpt-5.4.
    
    Claude-only proxies are left on anthropic_messages; their Codex
    counterparts use wire_api=responses, so there is no evidence their
    chat_completions endpoints serve OpenAI models.
  • chore(hermes): prune unused official presets and fix Nous endpoint
    Remove the Anthropic, OpenAI, and Google AI presets from the Hermes
    preset list. They were placeholder samples introduced when the Hermes
    module first landed and do not match the actual user paths in
    CC Switch (Claude / Codex go through OAuth, Gemini Native is its own
    adapter), and the upstream endpoints are not reachable for most of
    the target users anyway.
    
    Fix the Nous Research preset: its base_url was a fabricated domain
    (inference.nous.hermes.dev) that has never resolved. Point it at the
    real Nous Portal endpoint (inference-api.nousresearch.com/v1) and
    add apiKeyUrl so users can jump straight to portal.nousresearch.com
    to provision a key.
    
    Drop the now-orphan providerForm.presets.{anthropic,openai,googleai}
    i18n keys from zh / en / ja since no preset references them anymore.
  • feat(presets): sync Claude provider presets to Hermes
    Import 38 Claude presets into Hermes by mapping env-style
    ANTHROPIC_BASE_URL/AUTH_TOKEN to flat base_url/api_key, deriving
    api_mode from apiFormat (anthropic_messages or chat_completions),
    deduping ANTHROPIC_*_MODEL into models[], and pointing
    suggestedDefaults at ANTHROPIC_MODEL. Skip OAuth-only presets
    (Codex, Copilot), Bedrock SigV4, Gemini Native, and the three
    already shipped on the Hermes side (OpenRouter, Anthropic,
    DeepSeek). Place Shengsuanyun at the head of the Hermes array so
    the partner shows first in the preset panel.
    
    In the Claude preset list, restore Shengsuanyun back ahead of
    Gemini Native. The Gemini Native preset (#1918) was inserted
    between Claude Official and Shengsuanyun, which made the
    third_party category register first in the reduce-based grouping
    and pushed the aggregator block (and Shengsuanyun) behind it.
    
    Backfill the missing providerForm.presets translations across zh,
    en, and ja (openrouter, anthropic, openai, googleai, deepseek,
    together; plus shengsuanyun for en and ja) so existing Hermes
    preset names no longer render literal i18n keys.
  • fix(hermes): show active provider and wire add/enable/remove actions
    Switching a Hermes provider previously only fired a toast because the frontend treated Hermes as non-additive (unlike backend AppType::is_additive_mode, which lists OpenCode | OpenClaw | Hermes) and relied on the unused is_current DB flag for highlighting. Align the UI model with the backend:
    
    - Include Hermes in ProviderActions' isAdditiveMode so the main button switches between "Add" and "Remove".
    - Drive the "current" highlight from model.provider (via useHermesModelConfig) instead of the DB is_current field; model.provider is Hermes's real SSOT for the active provider.
    - Reuse OpenClaw's set-as-default button slot to expose an "Enable" action on Hermes that calls switchProvider, so providers already in config can be activated without re-adding. switch_normal + apply_switch_defaults already atomically update custom_providers and model.provider, so no backend change is needed.
    - Invalidate liveProviderIds + modelConfig + health in parallel after add/update/delete/switch via a new invalidateHermesProviderCaches helper, replacing four copies of three sequential awaits.