Skip to content

feat: add complete DeepSeek Harness provider management - #500

Open
timeuser4 wants to merge 7 commits into
SaladDay:mainfrom
timeuser4:feat/deepseek-harness-provider-support
Open

timeuser4 wants to merge 7 commits into
SaladDay:mainfrom
timeuser4:feat/deepseek-harness-provider-support

Conversation

@timeuser4

@timeuser4 timeuser4 commented Oct 10, 2026 •

Copy link
Copy Markdown

Closes #501.

Problem and Behavior

DeepSeek Harness is unavailable in CC-Switch, so its providers cannot be managed alongside Claude Code, Codex, and Gemini. This adds --app dsh (aliases deepseek and deepseek-harness) and complete provider management through the existing CLI and TUI: add, edit, copy, delete saved entries, import native configuration, switch, set a default model, discover models, check endpoints, query custom usage scripts, and export private JSON for reimport.

Providers select an initialized DSH profile and configure API key, Base URL, protocol, model catalog, default model, reasoning effort, and native advanced options. The supported protocols are deepseek, openai-completions, openai-responses, and anthropic-messages. All four DSH protocols query the provider API for model discovery. DeepSeek uses Bearer authentication against the OpenAI-compatible models endpoint, stripping a trailing /anthropic. The TUI displays the returned model list and imports selected models individually; CLI provider fetch-models uses the same discovery behavior. DSH has a distinct blue accent in dark/light and truecolor/ANSI256 themes.

Native Configuration and Safety

  • Publish the profile's Cordis patch atomically after storing a fresh native credential reference. Preserve other plugins, comments, dynamic expressions, unrelated provider routes, and browser grants with a lossless YAML editor. Secrets remain outside the profile patch and current-provider output is masked.
  • Coordinate with native credential/profile writer locks and serialize DSH provider operations across processes. Refresh stored snapshots under the operation lock; failed publication restores the previous selection.
  • Import installed bundle, profile, and home layers without evaluating JavaScript. Refuse conflicting home overrides, dynamic managed configuration, plugin identity mismatches, and invalid protocol-specific model/options combinations before publication.
  • Apply changes through DSH HMR for subsequent requests; existing sessions retain their model selection. Legacy API-key-only entries remain supported.
  • Export requires a file path, uses atomic publication and mode 0600 on Unix, and can be reimported with --config-file.

Proxy takeover, failover, MCP, prompts, skills, sessions, and common snippets remain outside DSH provider management. Catalog-backed Pi AI routes require explicit protocol, credential reference, Base URL, and models before import. Remove conflicting launch --patch overrides before management. Dynamic provider expressions use the native DSH editor. Manual app visibility supports enabling the DSH tab in Settings.

Validation

All tests that read or write application state used isolated homes/configuration directories.

  • DSH unit tests: 54 passed, including form round trips, model discovery, native validation, lock recovery/waiting, lossless edits (including comments within managed mappings and model entries), concurrent full writes, omitted optional fields, default-model reasoning capabilities, disabled thinking, and image safe-integer boundaries.
  • DSH integration tests: 26 passed, including CLI add/switch/current/set-default/copy/delete/export/reimport, private permissions, usage/quota scripts, all-profile imports, concurrent switches, invalid native configuration rejection, and failure rollback.
  • TUI regression tests: 1868 passed in isolated serial execution with inherited NO_COLOR removed. Coverage includes DSH Models JSON editor Ctrl+S through the runtime dispatcher, reopen persistence, default-model replacement/preservation, invalid edits, complete API list presentation, single-model selection and duplicate prevention. Model discovery regressions verify protocol routing, Bearer authentication, all returned IDs, and /models to /v1/models fallback using local HTTP fixtures. Pagination accumulates and deduplicates all pages using has_more/last_id or Gemini nextPageToken, rejects missing/repeated cursors, and fails without partial results if a later page fails (41 model-fetch tests passed).
  • Provider add regression: 23 passed; completion command regression: 3 passed after clearing inherited test-home overrides.
  • DSH 0.2.0-rc.2 native compatibility checks passed for all four protocols: layer composition, schemas, credential references, adapter registration, and Pi AI model HMR. These checks used public native functions and did not start the host service.
  • Isolated actual-terminal smoke checks verified the complete DSH form and distinct blue accent.
  • Formatting, whitespace checks, warnings-as-errors library check (cargo check --locked --lib --no-default-features), and release build passed.
  • Independent blind review was performed on the DSH branch; the model-save and API-discovery update is reviewed separately against 674b7bea.

Existing Test/Lint Limitations

The full suite and standard Clippy are not reported as passing. cargo test --no-fail-fast executed every test target. A clean serial run passed 4555 library tests with two ignored and the previously reproduced upstream foreground-migrator failure. DSH additions after that run passed focused verification.

Previously reproduced baseline failures remain unchanged: the foreground migrator, two Codex synchronization tests, three Usage Query official-provider fixtures, and Clippy's reversed_empty_ranges at cli/tui/ui/home_chart.rs:806. Clippy with that single existing lint allowed also completed.

Other environment-sensitive integration failures include two prompt creation tests requiring a configured editor and a daemon lifecycle test timing out waiting for its socket; both also appeared in the earlier pre-expansion run. An inherited test-home override caused a completion failure that passed when removed. Parallel library runs expose shared environment/settings races; clean serial execution removed those failures.

Windows/macOS runtime behavior has not been exercised locally. Shared full-snapshot persistence still permits concurrent commands for different apps to overwrite state; this was reproduced on unchanged upstream paths. This PR serializes DSH operations with one another and does not redesign cross-app persistence.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 02:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@timeuser4 timeuser4 changed the title feat: add DeepSeek Harness provider support feat: add complete DeepSeek Harness provider management Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support complete DeepSeek Harness provider management in CLI and TUI

2 participants