feat: add Tool Search domain restriction bypass with active-installation patching

Resolve the active `claude` command from PATH and apply an equal-length
byte patch to remove the domain whitelist check. Backups are stored in
~/.cc-switch/toolsearch-backups/ (SHA-256 of path) so they survive
Claude Code version upgrades. The patch auto-reapplies on app startup
when the setting is enabled.

Frontend checks PatchResult.success and rolls back the setting on failure.
This commit is contained in:
Jason
2026-03-14 21:20:05 +08:00
parent 7097a0d710
commit 9439153f05
13 changed files with 699 additions and 2 deletions
+2
View File
@@ -19,6 +19,7 @@ mod settings;
pub mod skill;
mod stream_check;
mod sync_support;
mod toolsearch;
mod usage;
mod webdav_sync;
mod workspace;
@@ -41,6 +42,7 @@ pub use session_manager::*;
pub use settings::*;
pub use skill::*;
pub use stream_check::*;
pub use toolsearch::*;
pub use usage::*;
pub use webdav_sync::*;
pub use workspace::*;
+21
View File
@@ -0,0 +1,21 @@
#![allow(non_snake_case)]
/// Check Tool Search patch status for the active Claude Code installation
#[tauri::command]
pub async fn check_toolsearch_status() -> Result<crate::toolsearch_patch::ToolSearchStatus, String>
{
crate::toolsearch_patch::check_toolsearch_status().map_err(|e| e.to_string())
}
/// Apply Tool Search patch (bypass domain restriction) to the active installation
#[tauri::command]
pub async fn apply_toolsearch_patch() -> Result<Vec<crate::toolsearch_patch::PatchResult>, String> {
crate::toolsearch_patch::apply_toolsearch_patch().map_err(|e| e.to_string())
}
/// Restore Tool Search patch (re-enable domain restriction) for the active installation
#[tauri::command]
pub async fn restore_toolsearch_patch() -> Result<Vec<crate::toolsearch_patch::PatchResult>, String>
{
crate::toolsearch_patch::restore_toolsearch_patch().map_err(|e| e.to_string())
}