| 532 | } |
| 533 | |
| 534 | function getToolSummaryKeys(toolName: string) { |
| 535 | const name = toolName.toLowerCase() |
| 536 | |
| 537 | if (name.includes("read")) { |
| 538 | return [["path", "filePath", "target_file", "absolutePath"], ["offset"], ["limit"]] |
| 539 | } |
| 540 | |
| 541 | if (name.includes("glob")) { |
| 542 | return [["pattern", "glob", "glob_pattern"], ["path", "cwd", "target_directory"]] |
| 543 | } |
| 544 | |
| 545 | if (name.includes("grep") || name.includes("search")) { |
| 546 | return [["pattern", "query"], ["path"], ["glob"], ["type"]] |
| 547 | } |
| 548 | |
| 549 | if (name.includes("shell") || name.includes("terminal") || name.includes("command")) { |
| 550 | return [["command", "cmd"], ["cwd", "working_directory"]] |
| 551 | } |
| 552 | |
| 553 | if (name.includes("edit") || name.includes("write") || name.includes("patch")) { |
| 554 | return [["path", "target_file", "file"], ["instruction"]] |
| 555 | } |
| 556 | |
| 557 | return [ |
| 558 | ["path", "file", "target_file"], |
| 559 | ["pattern", "query", "command"], |
| 560 | ] |
| 561 | } |
| 562 | |
| 563 | function summarizeFirstValue(record: Record<string, unknown>, keys: string[]) { |
| 564 | for (const key of keys) { |