MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isNavigableMessage

Function isNavigableMessage

source code/components/messageActions.tsx:20–66  ·  view source on GitHub ↗
(msg: NavigableMessage)

Source from the content-addressed store, hash-verified

18
19// Tier-2 blocklist (tier-1 is height > 0) — things that render but aren't actionable.
20export function isNavigableMessage(msg: NavigableMessage): boolean {
21 switch (msg.type) {
22 case 'assistant':
23 {
24 const b = msg.message.content[0];
25 // Text responses (minus AssistantTextMessage's return-null cases — tier-1
26 // misses unmeasured virtual items), or tool calls with extractable input.
27 return b?.type === 'text' && !isEmptyMessageText(b.text) && !SYNTHETIC_MESSAGES.has(b.text) || b?.type === 'tool_use' && b.name in PRIMARY_INPUT;
28 }
29 case 'user':
30 {
31 if (msg.isMeta || msg.isCompactSummary) return false;
32 const b = msg.message.content[0];
33 if (b?.type !== 'text') return false;
34 // Interrupt etc. — synthetic, not user-authored.
35 if (SYNTHETIC_MESSAGES.has(b.text)) return false;
36 // Same filter as VirtualMessageList sticky-prompt: XML-wrapped (command
37 // expansions, bash-stdout, etc.) aren't real prompts.
38 return !stripSystemReminders(b.text).startsWith('<');
39 }
40 case 'system':
41 // biome-ignore lint/nursery/useExhaustiveSwitchCases: blocklist — fallthrough return-true is the design
42 switch (msg.subtype) {
43 case 'api_metrics':
44 case 'stop_hook_summary':
45 case 'turn_duration':
46 case 'memory_saved':
47 case 'agents_killed':
48 case 'away_summary':
49 case 'thinking':
50 return false;
51 }
52 return true;
53 case 'grouped_tool_use':
54 case 'collapsed_read_search':
55 return true;
56 case 'attachment':
57 switch (msg.attachment.type) {
58 case 'queued_command':
59 case 'diagnostics':
60 case 'hook_blocking_error':
61 case 'hook_error_during_execution':
62 return true;
63 }
64 return false;
65 }
66}
67type PrimaryInput = {
68 label: string;
69 extract: (input: Record<string, unknown>) => string | undefined;

Callers 1

VirtualMessageListFunction · 0.85

Calls 3

isEmptyMessageTextFunction · 0.85
stripSystemRemindersFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected