Add list tools; normalize tool names and paths in transcript

This commit is contained in:
Ian Gulliver
2026-10-20 21:05:29 -07:00
parent e5a7fc4c1a
commit 53f20e40d3
9 changed files with 175 additions and 20 deletions
+3 -2
View File
@@ -1031,13 +1031,14 @@ private func toolBrief(_ input: (any Sendable)?, _ root: String) -> String {
guard let i = input as? JSONDict else {
return ""
}
let brief = ["command", "file_path", "pattern", "url", "question", "description"].lazy.compactMap { i[$0] ?? nil }.first
let brief = ["command", "file_path", "pattern", "path", "url", "question", "description"].lazy.compactMap { i[$0] ?? nil }.first
let text = relative(brief.map { jsString($0) } ?? "", root)
return text.count > 120 ? "\(text.prefix(120))…" : text
}
private func toolTarget(_ input: (any Sendable)?, _ root: String) -> String {
guard let path = (input as? JSONDict)?["file_path"] as? String else {
let i = input as? JSONDict
guard let path = (i?["file_path"] ?? i?["path"]) as? String else {
return ""
}
return relative(path, root)