fix(hooks): fix agent-usage-reminder case-sensitivity bug in tool name matching

- Change TARGET_TOOLS and AGENT_TOOLS to Set<string> for O(1) lookup
- Normalize tool names to lowercase for case-insensitive comparison
- Remove unnecessary parentSessionID guard that blocked main session triggers
- Fixes issue where Glob/Grep tool calls weren't showing agent usage reminder

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-13 22:13:02 +09:00
parent 2c6dfeadce
commit f3b2fccba7
2 changed files with 14 additions and 18 deletions

View File

@@ -11,7 +11,6 @@ interface ToolExecuteInput {
tool: string;
sessionID: string;
callID: string;
parentSessionID?: string;
}
interface ToolExecuteOutput {
@@ -60,19 +59,15 @@ export function createAgentUsageReminderHook(_ctx: PluginInput) {
input: ToolExecuteInput,
output: ToolExecuteOutput,
) => {
const { tool, sessionID, parentSessionID } = input;
const { tool, sessionID } = input;
const toolLower = tool.toLowerCase();
// Only run in root sessions (no parent = main session)
if (parentSessionID) {
return;
}
if ((AGENT_TOOLS as readonly string[]).includes(tool)) {
if (AGENT_TOOLS.has(toolLower)) {
markAgentUsed(sessionID);
return;
}
if (!(TARGET_TOOLS as readonly string[]).includes(tool)) {
if (!TARGET_TOOLS.has(toolLower)) {
return;
}