(
content: { type: string; name?: string; input?: unknown } | undefined,
tools: Tools,
)
| 242 | * Returns { isSearch, isRead, isREPL } if it's a collapsible search/read, null otherwise. |
| 243 | */ |
| 244 | export function getSearchOrReadFromContent( |
| 245 | content: { type: string; name?: string; input?: unknown } | undefined, |
| 246 | tools: Tools, |
| 247 | ): { |
| 248 | isSearch: boolean |
| 249 | isRead: boolean |
| 250 | isList: boolean |
| 251 | isREPL: boolean |
| 252 | isMemoryWrite: boolean |
| 253 | isAbsorbedSilently: boolean |
| 254 | mcpServerName?: string |
| 255 | isBash?: boolean |
| 256 | } | null { |
| 257 | if (content?.type === 'tool_use' && content.name) { |
| 258 | const info = getToolSearchOrReadInfo(content.name, content.input, tools) |
| 259 | if (info.isCollapsible || info.isREPL) { |
| 260 | return { |
| 261 | isSearch: info.isSearch, |
| 262 | isRead: info.isRead, |
| 263 | isList: info.isList, |
| 264 | isREPL: info.isREPL, |
| 265 | isMemoryWrite: info.isMemoryWrite, |
| 266 | isAbsorbedSilently: info.isAbsorbedSilently, |
| 267 | mcpServerName: info.mcpServerName, |
| 268 | isBash: info.isBash, |
| 269 | } |
| 270 | } |
| 271 | } |
| 272 | return null |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Checks if a tool is a search/read operation (for backwards compatibility). |
no test coverage detected