huskies: merge 1023

This commit is contained in:
dave
2026-05-14 11:19:15 +00:00
parent 8e996e2bd3
commit c64deca7c2
4 changed files with 263 additions and 17 deletions
+12 -1
View File
@@ -16,9 +16,20 @@ pub(crate) fn tool_get_server_logs(args: &Value) -> Result<String, String> {
let lines_count = args
.get("lines")
.and_then(|v| v.as_u64())
.map(|n| n.min(1000) as usize)
.map(|n| n.min(10_000) as usize)
.unwrap_or(100);
let filter = args.get("filter").and_then(|v| v.as_str());
let from_file = args
.get("from_file")
.and_then(|v| v.as_bool())
.unwrap_or(false);
if from_file {
let offset = args.get("offset").and_then(|v| v.as_u64()).unwrap_or(0) as usize;
let lines = log_buffer::global().read_from_disk(filter, offset, lines_count);
return Ok(lines.join("\n"));
}
let severity = args
.get("severity")
.and_then(|v| v.as_str())
+12 -4
View File
@@ -7,21 +7,29 @@ pub(super) fn system_tools() -> Vec<Value> {
vec![
json!({
"name": "get_server_logs",
"description": "Return recent server log lines captured in the in-process ring buffer. Useful for diagnosing runtime behaviour such as WebSocket events, MCP call flow, and filesystem watcher activity.",
"description": "Return server log lines. By default reads from the in-process ring buffer (last 1000 entries). Pass from_file: true to read from the on-disk daily log files, which retain history beyond the ring buffer. The file path supports offset for pagination.",
"inputSchema": {
"type": "object",
"properties": {
"lines": {
"type": "integer",
"description": "Number of recent lines to return (default 100, max 1000)"
"description": "Number of lines to return (default 100; ring-buffer max 1000, file max 10000)"
},
"filter": {
"type": "string",
"description": "Optional substring filter (e.g. 'watcher', 'mcp', 'permission')"
"description": "Optional substring filter applied to each log line (e.g. 'watcher', 'mcp', 'ERROR')"
},
"severity": {
"type": "string",
"description": "Filter by severity level: ERROR, WARN, or INFO. Returns only entries at that level."
"description": "Ring-buffer only: filter by severity level ERROR, WARN, or INFO"
},
"from_file": {
"type": "boolean",
"description": "If true, read from on-disk daily log files instead of the in-memory ring. Supports older history and the offset parameter."
},
"offset": {
"type": "integer",
"description": "File mode only: skip the first N matching lines before returning results (for pagination)"
}
}
}