({
commands: initialCommands,
debug,
initialTools,
initialMessages,
pendingHookMessages,
initialFileHistorySnapshots,
initialContentReplacements,
initialAgentName,
initialAgentColor,
mcpClients: initialMcpClients,
dynamicMcpConfig: initialDynamicMcpConfig,
autoConnectIdeFlag,
strictMcpConfig = false,
systemPrompt: customSystemPrompt,
appendSystemPrompt,
onBeforeQuery,
onTurnComplete,
disabled = false,
mainThreadAgentDefinition: initialMainThreadAgentDefinition,
disableSlashCommands = false,
taskListId,
remoteSessionConfig,
directConnectConfig,
sshSession,
thinkingConfig
}: Props)
| 570 | }; |
| 571 | export type Screen = 'prompt' | 'transcript'; |
| 572 | export function REPL({ |
| 573 | commands: initialCommands, |
| 574 | debug, |
| 575 | initialTools, |
| 576 | initialMessages, |
| 577 | pendingHookMessages, |
| 578 | initialFileHistorySnapshots, |
| 579 | initialContentReplacements, |
| 580 | initialAgentName, |
| 581 | initialAgentColor, |
| 582 | mcpClients: initialMcpClients, |
| 583 | dynamicMcpConfig: initialDynamicMcpConfig, |
| 584 | autoConnectIdeFlag, |
| 585 | strictMcpConfig = false, |
| 586 | systemPrompt: customSystemPrompt, |
| 587 | appendSystemPrompt, |
| 588 | onBeforeQuery, |
| 589 | onTurnComplete, |
| 590 | disabled = false, |
| 591 | mainThreadAgentDefinition: initialMainThreadAgentDefinition, |
| 592 | disableSlashCommands = false, |
| 593 | taskListId, |
| 594 | remoteSessionConfig, |
| 595 | directConnectConfig, |
| 596 | sshSession, |
| 597 | thinkingConfig |
| 598 | }: Props): React.ReactNode { |
| 599 | const isRemoteSession = !!remoteSessionConfig; |
| 600 | |
| 601 | // Env-var gates hoisted to mount-time — isEnvTruthy does toLowerCase+trim+ |
| 602 | // includes, and these were on the render path (hot during PageUp spam). |
| 603 | const titleDisabled = useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE), []); |
| 604 | const moreRightEnabled = useMemo(() => "external" === 'ant' && isEnvTruthy(process.env.CLAUDE_MORERIGHT), []); |
| 605 | const disableVirtualScroll = useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL), []); |
| 606 | const disableMessageActions = feature('MESSAGE_ACTIONS') ? |
| 607 | // biome-ignore lint/correctness/useHookAtTopLevel: feature() is a compile-time constant |
| 608 | useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_MESSAGE_ACTIONS), []) : false; |
| 609 | |
| 610 | // Log REPL mount/unmount lifecycle |
| 611 | useEffect(() => { |
| 612 | logForDebugging(`[REPL:mount] REPL mounted, disabled=${disabled}`); |
| 613 | return () => logForDebugging(`[REPL:unmount] REPL unmounting`); |
| 614 | }, [disabled]); |
| 615 | |
| 616 | // Agent definition is state so /resume can update it mid-session |
| 617 | const [mainThreadAgentDefinition, setMainThreadAgentDefinition] = useState(initialMainThreadAgentDefinition); |
| 618 | const toolPermissionContext = useAppState(s => s.toolPermissionContext); |
| 619 | const verbose = useAppState(s => s.verbose); |
| 620 | const mcp = useAppState(s => s.mcp); |
| 621 | const plugins = useAppState(s => s.plugins); |
| 622 | const agentDefinitions = useAppState(s => s.agentDefinitions); |
| 623 | const fileHistory = useAppState(s => s.fileHistory); |
| 624 | const initialMessage = useAppState(s => s.initialMessage); |
| 625 | const queuedCommands = useCommandQueue(); |
| 626 | // feature() is a build-time constant — dead code elimination removes the hook |
| 627 | // call entirely in external builds, so this is safe despite looking conditional. |
| 628 | // These fields contain excluded strings that must not appear in external builds. |
| 629 | const spinnerTip = useAppState(s => s.spinnerTip); |
nothing calls this directly
no test coverage detected