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
+9 -1
View File
@@ -1,6 +1,6 @@
import { useTranslation } from "react-i18next";
import type { SettingsFormState } from "@/hooks/useSettings";
import { AppWindow, MonitorUp, Power, EyeOff } from "lucide-react";
import { AppWindow, MonitorUp, Power, EyeOff, Search } from "lucide-react";
import { ToggleRow } from "@/components/ui/toggle-row";
import { AnimatePresence, motion } from "framer-motion";
@@ -66,6 +66,14 @@ export function WindowSettings({ settings, onChange }: WindowSettingsProps) {
onCheckedChange={(value) => onChange({ skipClaudeOnboarding: value })}
/>
<ToggleRow
icon={<Search className="h-4 w-4 text-amber-500" />}
title={t("settings.toolSearchBypass")}
description={t("settings.toolSearchBypassDescription")}
checked={!!settings.toolSearchBypass}
onCheckedChange={(value) => onChange({ toolSearchBypass: value })}
/>
<ToggleRow
icon={<AppWindow className="h-4 w-4 text-blue-500" />}
title={t("settings.minimizeToTray")}