Skip to content

Commit 0ad6349

Browse files
chore: 清理 18 处未使用导入、变量和函数
移除未使用的导入(getSubscriptionType、isEnvDefinedFalsy、 getClaudeConfigHomeDir 等)、未使用的常量(ACCENT_COLOR、 NAME_MATCH_BONUS、CLIPBOARD_THRESHOLD)和死函数 (getOpus41Option、pasteViaClipboard), 为未使用参数添加 _ 前缀。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1ac18ae commit 0ad6349

18 files changed

Lines changed: 12 additions & 95 deletions

src/components/PromptInput/Notifications.tsx

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { setEnvHookNotifier } from '../../utils/hooks/fileChangedWatcher.js';
2424
import { toIDEDisplayName } from '../../utils/ide.js';
2525
import { getMessagesAfterCompactBoundary } from '../../utils/messages.js';
2626
import { tokenCountFromLastAPIResponse } from '../../utils/tokens.js';
27-
import { AutoUpdaterWrapper } from '../AutoUpdaterWrapper.js';
2827
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
2928
import { IdeStatusIndicator } from '../IdeStatusIndicator.js';
3029
import { MemoryUsageIndicator } from '../MemoryUsageIndicator.js';
@@ -57,13 +56,13 @@ type Props = {
5756

5857
export function Notifications({
5958
apiKeyStatus,
60-
autoUpdaterResult,
59+
autoUpdaterResult: _autoUpdaterResult,
6160
debug,
62-
isAutoUpdating,
61+
isAutoUpdating: _isAutoUpdating,
6362
verbose,
6463
messages,
65-
onAutoUpdaterResult,
66-
onChangeIsUpdating,
64+
onAutoUpdaterResult: _onAutoUpdaterResult,
65+
onChangeIsUpdating: _onChangeIsUpdating,
6766
ideSelection,
6867
mcpClients,
6968
isInputWrapped = false,
@@ -102,9 +101,6 @@ export function Notifications({
102101
const shouldShowIdeSelection =
103102
ideStatus === 'connected' && (ideSelection?.filePath || (ideSelection?.text && ideSelection.lineCount > 0));
104103

105-
// Hide update installed message when showing IDE selection
106-
const shouldShowAutoUpdater = !shouldShowIdeSelection || isAutoUpdating || autoUpdaterResult?.status !== 'success';
107-
108104
// Check if we're in overage mode for UI indicators
109105
const isInOverageMode = claudeAiLimits.isUsingOverage;
110106
const subscriptionType = getSubscriptionType();
@@ -157,12 +153,6 @@ export function Notifications({
157153
verbose={verbose}
158154
tokenUsage={tokenUsage}
159155
mainLoopModel={mainLoopModel}
160-
shouldShowAutoUpdater={shouldShowAutoUpdater}
161-
autoUpdaterResult={autoUpdaterResult}
162-
isAutoUpdating={isAutoUpdating}
163-
isShowingCompactMessage={isShowingCompactMessage}
164-
onAutoUpdaterResult={onAutoUpdaterResult}
165-
onChangeIsUpdating={onChangeIsUpdating}
166156
/>
167157
</Box>
168158
</SentryErrorBoundary>
@@ -180,12 +170,6 @@ function NotificationContent({
180170
verbose,
181171
tokenUsage,
182172
mainLoopModel,
183-
shouldShowAutoUpdater,
184-
autoUpdaterResult,
185-
isAutoUpdating,
186-
isShowingCompactMessage,
187-
onAutoUpdaterResult,
188-
onChangeIsUpdating,
189173
}: {
190174
ideSelection: IDESelection | undefined;
191175
mcpClients?: MCPServerConnection[];
@@ -200,12 +184,6 @@ function NotificationContent({
200184
verbose: boolean;
201185
tokenUsage: number;
202186
mainLoopModel: string;
203-
shouldShowAutoUpdater: boolean;
204-
autoUpdaterResult: AutoUpdaterResult | null;
205-
isAutoUpdating: boolean;
206-
isShowingCompactMessage: boolean;
207-
onAutoUpdaterResult: (result: AutoUpdaterResult) => void;
208-
onChangeIsUpdating: (isUpdating: boolean) => void;
209187
}): ReactNode {
210188
// Poll apiKeyHelper inflight state to show slow-helper notice.
211189
// Gated on configuration — most users never set apiKeyHelper, so the

src/utils/attachments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import type {
6969
} from '@anthropic-ai/sdk/resources/messages.mjs'
7070
import { maybeResizeAndDownsampleImageBlock } from './imageResizer.js'
7171
import type { PastedContent } from './config.js'
72+
import { getSettings_DEPRECATED } from './settings/settings.js'
7273
import {
7374
getDefaultSonnetModel,
7475
getDefaultHaikuModel,

src/utils/computerUse/gates.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { CoordinateMode, CuSubGates } from '@ant/computer-use-mcp/types'
22

33
import { getDynamicConfig_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
4-
import { getSubscriptionType } from '../auth.js'
54
import { isEnvTruthy } from '../envUtils.js'
65

76
type ChicagoConfig = CuSubGates & {

src/utils/computerUse/win32/inputIndicator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const INDICATOR_HEIGHT = 28
2222
const FADE_AFTER_MS = 2000
2323
const BG_COLOR = '30, 30, 30' // dark background
2424
const TEXT_COLOR = '220, 220, 220' // light text
25-
const ACCENT_COLOR = '80, 200, 80' // green accent for active
2625

2726
let indicatorProc: ReturnType<typeof Bun.spawn> | null = null
2827
let stopFile: string | null = null

src/utils/computerUse/win32/windowMessage.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
import { validateHwnd, runPs, VK_MAP, MODIFIER_KEYS } from './shared.js'
1414

15-
/** Character count above which we switch to clipboard paste */
16-
const CLIPBOARD_THRESHOLD = 32
17-
1815
/** Cache findEditChild results — window structure doesn't change while bound */
1916
const editChildCache = new Map<string, string | null>()
2017

@@ -275,46 +272,6 @@ function buildWmCharLines(hwnd: string, text: string): string[] {
275272
return lines
276273
}
277274

278-
/**
279-
* Paste text via clipboard into the target window.
280-
* Uses Clipboard.SetText() + SendMessageW(Ctrl+V).
281-
* NO global APIs (SendInput/keybd_event/SendKeys) — only window-targeted messages.
282-
*/
283-
function pasteViaClipboard(hwnd: string, text: string): boolean {
284-
// Escape single quotes for PowerShell string literal
285-
const escaped = text.replace(/'/g, "''")
286-
const hwndExpr = `[IntPtr]::new([long]${hwnd})`
287-
const script = `${WINMSG_TYPE}
288-
Add-Type -AssemblyName System.Windows.Forms
289-
290-
# Save current clipboard
291-
$saved = $null
292-
try { $saved = [System.Windows.Forms.Clipboard]::GetText() } catch {}
293-
294-
# Set our text
295-
[System.Windows.Forms.Clipboard]::SetText('${escaped}')
296-
297-
# Ctrl+V via PostMessage to the target window (NOT global keybd_event)
298-
# Must use PostMessage + correct lParam (scan code) for Windows Terminal / ConPTY
299-
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYDOWN, [IntPtr]0x11, [WinMsg]::KeyDownLParam(0x11)) # Ctrl down
300-
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYDOWN, [IntPtr]0x56, [WinMsg]::KeyDownLParam(0x56)) # V down
301-
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYUP, [IntPtr]0x56, [WinMsg]::KeyUpLParam(0x56)) # V up
302-
[WinMsg]::PostMessage(${hwndExpr}, [WinMsg]::WM_KEYUP, [IntPtr]0x11, [WinMsg]::KeyUpLParam(0x11)) # Ctrl up
303-
304-
# Brief wait for paste to complete
305-
Start-Sleep -Milliseconds 50
306-
307-
# Restore clipboard
308-
if ($saved -ne $null -and $saved -ne '') {
309-
try { [System.Windows.Forms.Clipboard]::SetText($saved) } catch {}
310-
} else {
311-
try { [System.Windows.Forms.Clipboard]::Clear() } catch {}
312-
}
313-
Write-Output 'OK'
314-
`
315-
return runPs(script) === 'OK'
316-
}
317-
318275
/**
319276
* Send text to a window via WM_CHAR per Unicode codepoint.
320277
* Always uses the WM_CHAR path — reliable across all window types including

src/utils/lanBeacon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class LanBeacon extends EventEmitter {
8787
// Non-fatal — multicast may not be supported on this network
8888
})
8989

90-
this.socket.on('message', (buf, rinfo) => {
90+
this.socket.on('message', (buf, _rinfo) => {
9191
try {
9292
const msg = JSON.parse(buf.toString()) as LanAnnounce
9393
if (msg.proto !== 'claude-pipe-v1') return

src/utils/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ export function updateMessageLookupsIncremental(
14311431
const msg = messages[i]!
14321432
if (msg.type === 'assistant') {
14331433
const aMsg = msg as AssistantMessage
1434-
const id = aMsg.message.id!
1434+
const _id = aMsg.message.id!
14351435
if (Array.isArray(aMsg.message.content)) {
14361436
const newToolUseIDs: string[] = []
14371437
for (const content of aMsg.message.content) {

src/utils/model/modelOptions.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,6 @@ function getCustomOpusOption(): ModelOption | undefined {
158158
}
159159
}
160160

161-
function getOpus41Option(): ModelOption {
162-
return {
163-
value: 'opus',
164-
label: 'Opus 4.1',
165-
description: `Opus 4.1 · Legacy`,
166-
descriptionForModel: 'Opus 4.1 - legacy version',
167-
}
168-
}
169-
170161
function getOpus47Option(fastMode = false): ModelOption {
171162
const is3P = getAPIProvider() !== 'firstParty'
172163
return {

src/utils/permissions/PermissionMode.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { feature } from 'bun:bundle'
21
import z from 'zod/v4'
32
import { PAUSE_ICON } from '../../constants/figures.js'
43
// Types extracted to src/types/permissions.ts to break import cycles

src/utils/permissions/bypassPermissionsKillswitch.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { feature } from 'bun:bundle'
22
import { useEffect, useRef } from 'react'
3-
import { useNotifications } from 'src/context/notifications.js'
43
import { toError } from '../../utils/errors.js'
54
import { logError } from '../../utils/log.js'
65
import { getIsRemoteMode } from '../../bootstrap/state.js'

0 commit comments

Comments
 (0)