chore: handle Monitor tool in stream parsing (closes #258)

This commit is contained in:
2026-04-13 10:07:20 -07:00
committed by Naomi Carrigan
parent 5846b30529
commit 54b3a524c4
+9 -1
View File
@@ -37,7 +37,10 @@ struct PendingToolUse {
tool_input: serde_json::Value,
}
const SEARCH_TOOLS: [&str; 5] = ["Read", "Glob", "Grep", "WebSearch", "WebFetch"];
// "Monitor" added in Claude Code v2.1.98 — it streams events and is observational in nature,
// so it maps to the Searching character state. It may appear as name "Monitor" in tool_use
// blocks (confirmed by CLI source inspection; it is a local_bash with kind="monitor" internally).
const SEARCH_TOOLS: [&str; 6] = ["Read", "Glob", "Grep", "WebSearch", "WebFetch", "Monitor"];
const CODING_TOOLS: [&str; 3] = ["Edit", "Write", "NotebookEdit"];
fn detect_wsl() -> bool {
@@ -2756,6 +2759,11 @@ mod tests {
get_tool_state("WebFetch"),
CharacterState::Searching
));
// Monitor tool added in v2.1.98 — observational/streaming, maps to Searching
assert!(matches!(
get_tool_state("Monitor"),
CharacterState::Searching
));
}
#[test]