fix: audit findings — test compilation, artifact pipeline, typo
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- C-1: Add event_sender: None to ToolContext in file_write.rs and file_read.rs test helper functions (compilation fix) - I-1: file_write tool now echoes content preview in output JSON, enabling streamStore.ts artifact auto-creation pipeline to work - S-2: Fix typo "LLM 锥应错误" → "LLM 响应错误" in loop_runner.rs
This commit is contained in:
@@ -744,7 +744,7 @@ impl AgentLoop {
|
|||||||
}
|
}
|
||||||
Ok(Some(Err(e))) => {
|
Ok(Some(Err(e))) => {
|
||||||
tracing::error!("[AgentLoop] Chunk error: {}", e);
|
tracing::error!("[AgentLoop] Chunk error: {}", e);
|
||||||
let _ = tx.send(LoopEvent::Error(format!("LLM 锥应错误: {}", e.to_string()))).await;
|
let _ = tx.send(LoopEvent::Error(format!("LLM 响应错误: {}", e.to_string()))).await;
|
||||||
stream_errored = true;
|
stream_errored = true;
|
||||||
}
|
}
|
||||||
Ok(None) => break, // Stream ended normally
|
Ok(None) => break, // Stream ended normally
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ mod tests {
|
|||||||
session_id: None,
|
session_id: None,
|
||||||
skill_executor: None,
|
skill_executor: None,
|
||||||
path_validator,
|
path_validator,
|
||||||
|
event_sender: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let tool = FileReadTool::new();
|
let tool = FileReadTool::new();
|
||||||
|
|||||||
@@ -119,11 +119,24 @@ impl Tool for FileWriteTool {
|
|||||||
file.write_all(&bytes)
|
file.write_all(&bytes)
|
||||||
.map_err(|e| ZclawError::ToolError(format!("Failed to write file: {}", e)))?;
|
.map_err(|e| ZclawError::ToolError(format!("Failed to write file: {}", e)))?;
|
||||||
|
|
||||||
|
// Echo content preview in output for artifact auto-creation in frontend
|
||||||
|
let content_preview: String = if content.len() <= 5000 {
|
||||||
|
content.to_string()
|
||||||
|
} else {
|
||||||
|
let truncation_point = content.char_indices()
|
||||||
|
.take_while(|(i, _)| *i < 5000)
|
||||||
|
.last()
|
||||||
|
.map(|(i, c)| i + c.len_utf8())
|
||||||
|
.unwrap_or(5000.min(content.len()));
|
||||||
|
format!("{}...[truncated, {} total bytes]", &content[..truncation_point], content.len())
|
||||||
|
};
|
||||||
|
|
||||||
Ok(json!({
|
Ok(json!({
|
||||||
"success": true,
|
"success": true,
|
||||||
"bytes_written": bytes.len(),
|
"bytes_written": bytes.len(),
|
||||||
"path": validated_path.to_string_lossy(),
|
"path": validated_path.to_string_lossy(),
|
||||||
"mode": mode
|
"mode": mode,
|
||||||
|
"content": content_preview
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,6 +163,7 @@ mod tests {
|
|||||||
session_id: None,
|
session_id: None,
|
||||||
skill_executor: None,
|
skill_executor: None,
|
||||||
path_validator,
|
path_validator,
|
||||||
|
event_sender: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user