MCPcopy
hub / github.com/codeaashu/claude-code / REPL

Function REPL

src/screens/REPL.tsx:572–5005  ·  view source on GitHub ↗
({
  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)

Source from the content-addressed store, hash-verified

570};
571export type Screen = 'prompt' | 'transcript';
572export 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);

Callers

nothing calls this directly

Calls 15

isEnvTruthyFunction · 0.85
featureFunction · 0.85
logForDebuggingFunction · 0.85
useAppStateFunction · 0.85
useCommandQueueFunction · 0.85
useSetAppStateFunction · 0.85
isLocalAgentTaskFunction · 0.85
getAgentTranscriptFunction · 0.85
asAgentIdFunction · 0.85
useAppStateStoreFunction · 0.85
useTerminalNotificationFunction · 0.85
useMainLoopModelFunction · 0.85

Tested by

no test coverage detected