fix(tui): narrow tool inventory query detection
This commit is contained in:
@@ -213,7 +213,7 @@ describe('getCommandCompletions', () => {
|
||||
|
||||
describe('isToolInventoryQuery', () => {
|
||||
it('detects common capability/tool-list prompts', () => {
|
||||
expect(isToolInventoryQuery('Check out your new tools')).toBe(true);
|
||||
expect(isToolInventoryQuery('check your new tools')).toBe(true);
|
||||
expect(isToolInventoryQuery('what tools do you have?')).toBe(true);
|
||||
expect(isToolInventoryQuery('show capabilities')).toBe(true);
|
||||
});
|
||||
@@ -221,5 +221,6 @@ describe('isToolInventoryQuery', () => {
|
||||
it('does not match unrelated prompts', () => {
|
||||
expect(isToolInventoryQuery('write a shell script')).toBe(false);
|
||||
expect(isToolInventoryQuery('summarize this doc')).toBe(false);
|
||||
expect(isToolInventoryQuery('The json by default is up to you, same as for gemini, codex is your tool, so decide what format is best for you to deal with.')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,20 +25,22 @@ export function isToolInventoryQuery(input: string): boolean {
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
const hasToolsWord = /\btools?\b/.test(normalized);
|
||||
const hasInventoryIntent = /\b(check|show|list|what|which|available|new|have)\b/.test(normalized);
|
||||
return (
|
||||
if (
|
||||
normalized.includes('available tools')
|
||||
|| normalized.includes('what tools')
|
||||
|| normalized.includes('which tools')
|
||||
|| normalized.includes('tool list')
|
||||
|| normalized.includes('list tools')
|
||||
|| normalized.includes('new tools')
|
||||
|| normalized.includes('your tools')
|
||||
|| normalized.includes('what can you do')
|
||||
|| normalized.includes('can you do')
|
||||
|| normalized.includes('capabilities')
|
||||
|| (hasToolsWord && hasInventoryIntent)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
/\b(?:show|list|check)\s+(?:me\s+)?(?:your\s+)?(?:available\s+|new\s+)?tools?\b/.test(normalized)
|
||||
|| /\b(?:what|which)\s+tools?\b/.test(normalized)
|
||||
|| /\btools?\s+(?:do\s+you\s+have|are\s+available)\b/.test(normalized)
|
||||
|| /\b(?:show|list|what\s+are)\s+(?:your\s+)?capabilities\b/.test(normalized)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user