中文 | English
What role does a huge entry component like REPL.tsx actually play inside Claude Code?
l4-ui-inkl5-state-commands
screens/REPL.tsxreplLauncher.tsxcomponents/PromptInput/*
export function REPLprocessInitialMessagependingInitialQueryonSubmit
- why REPL is both a screen controller and an interaction bus
- how initial messages, plan-mode exit messages, and hook-driven messages enter the session
- why user input does not always become a query immediately and may pass through command, hook, history, or buffer handling first
screens/REPL.tsx:572:export function REPLscreens/REPL.tsx:3035:processInitialMessagescreens/REPL.tsx:3140: invocation ofprocessInitialMessage
Do not think of the REPL as “just UI.” In Claude Code it is also an interaction-orchestration layer: it receives user input, processes initial messages, coordinates hooks, manages local UI state, and decides when something should actually be sent into QueryEngine.
- Why are
onSubmitandonQuerynot the same concept? - What kind of non-immediate-input cases does
processInitialMessagesolve? - Why is it acceptable for REPL to own a lot of local state instead of forcing everything into global state?