fix: 将 pipeIpc 添加到 AppState 类型声明,消除 4 个 as any

- AppStateStore: 添加 pipeIpc?: PipeIpcState 可选字段
- PromptInputFooter: 直接访问 s.pipeIpc
- useBackgroundTaskNavigation: 直接访问 s.pipeIpc
- usePipeRouter: 直接访问 store.getState().pipeIpc
- REPL.tsx: 移除 getPipeIpc(s as any) 中的 as any

precheck 通过
This commit is contained in:
claude-code-best
2026-06-09 23:00:06 +08:00
parent 21c17b4c6e
commit da10c45e76
5 changed files with 7 additions and 4 deletions

View File

@@ -256,7 +256,7 @@ function PipeStatusInline(): React.ReactNode {
if (!feature('UDS_INBOX')) return null;
// All hooks must be called before any conditional return to maintain
// consistent hook count across renders (React rules of hooks).
const pipeIpc = useAppState(s => (s as any).pipeIpc);
const pipeIpc = useAppState(s => s.pipeIpc);
const setAppState = useSetAppState();
const [cursorIndex, setCursorIndex] = useState(0);

View File

@@ -72,7 +72,7 @@ export function useBackgroundTaskNavigation(options?: {
const viewSelectionMode = useAppState(s => s.viewSelectionMode)
const viewingAgentTaskId = useAppState(s => s.viewingAgentTaskId)
const selectedIPAgentIndex = useAppState(s => s.selectedIPAgentIndex)
const pipeIpc = useAppState(s => (s as any).pipeIpc)
const pipeIpc = useAppState(s => s.pipeIpc)
const setAppState = useSetAppState()
// Filter to running teammates and sort alphabetically to match TeammateSpinnerTree display

View File

@@ -37,7 +37,7 @@ export function usePipeRouter({ store, setAppState, addNotification }: Deps): {
if (!input.trim() || input.trim().startsWith('/')) return false
/* eslint-disable @typescript-eslint/no-require-imports */
const pipeState = (store.getState() as any).pipeIpc
const pipeState = store.getState().pipeIpc
const selectedPipes: string[] = pipeState?.selectedPipes ?? []
const routeMode: 'selected' | 'local' = pipeState?.routeMode ?? 'selected'

View File

@@ -4966,7 +4966,7 @@ export function REPL({
useMailboxBridge({ isLoading, onSubmitMessage: handleIncomingPrompt });
useMasterMonitor();
useSlaveNotifications();
const _pipeIpcState = useAppState(s => getPipeIpc(s as any));
const _pipeIpcState = useAppState(s => getPipeIpc(s));
usePipePermissionForward({ store, tools, setMessages, setToolUseConfirmQueue, getToolUseContext, mainLoopModel });
usePipeMuteSync({ setToolUseConfirmQueue });

View File

@@ -36,6 +36,7 @@ import type { PermissionMode } from '../utils/permissions/PermissionMode.js'
import { getInitialSettings } from '../utils/settings/settings.js'
import type { SettingsJson } from '../utils/settings/types.js'
import { shouldEnableThinkingByDefault } from '../utils/thinking.js'
import type { PipeIpcState } from '../utils/pipeTransport.js'
import type { Store } from './store.js'
export type CompletionBoundary =
@@ -159,6 +160,8 @@ export type AppState = DeepImmutable<{
replBridgeInitialName: string | undefined
// Always-on bridge: first-time remote dialog pending (set by /remote-control command)
showRemoteCallout: boolean
// Pipe IPC state — added at runtime when feature('PIPE_IPC') is enabled.
pipeIpc?: PipeIpcState
}> & {
// Unified task state - excluded from DeepImmutable because TaskState contains function types
tasks: { [taskId: string]: TaskState }