* Check if a user message is too vague to act on. * Returns true if clarification should be requested.
(message)
| 21 | * Returns true if clarification should be requested. |
| 22 | */ |
| 23 | function needsClarification(message) { |
| 24 | const msg = message.trim(); |
| 25 | |
| 26 | // Never trigger on empty (already handled) or file references |
| 27 | if (!msg || msg.startsWith('@') || msg.startsWith('/')) return false; |
| 28 | |
| 29 | // Never trigger on confirmations (these are answers to prior model questions) |
| 30 | if (/^(yes|no|ok|sure|go|do it|y|n|yep|nope|yeah|nah)$/i.test(msg)) return false; |
| 31 | |
| 32 | // Never trigger on multi-word continuations and follow-ups |
| 33 | if (/^(go ahead|go for it|just do it|do that|do both|read it|show me|that one|sounds good|let's do it|let's go|that works)\b/i.test(msg)) return false; |
| 34 | |
| 35 | // Never trigger on multi-number selections ("1 and 2", "1, 2", "both 1 and 2") |
| 36 | if (/^(both\s+)?\d+(\s*,\s*|\s+and\s+)\d+$/i.test(msg)) return false; |
| 37 | |
| 38 | // Vague patterns that genuinely lack specifics and need clarification |
| 39 | const vaguePatterns = [ |
| 40 | /^(fix|do|make|change|update|improve)\s+(it|this|that|things?)$/i, |
| 41 | /^(help|please|can you|could you)$/i, |
| 42 | /^(make it|do the|fix the)\s+(better|work|thing|stuff)$/i, |
| 43 | /^(same|again|more|another)$/i, |
| 44 | ]; |
| 45 | |
| 46 | return vaguePatterns.some(p => p.test(msg)); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Generate a clarification prompt to inject into the system message. |
no outgoing calls
no test coverage detected