forked from kent/consciousness
logs: assert non-empty agent names, fix debug.log path
- save_agent_log: assert name is not empty (panic to find the bug)
- AutoAgent:🆕 assert name is not empty
- dbglog: write to daemon/ subdir instead of toplevel logs/
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
bf5def4871
commit
4b710eb7a7
1 changed files with 2 additions and 0 deletions
|
|
@ -85,6 +85,7 @@ pub fn set_stats(name: &str, stats: PersistedStats) {
|
||||||
/// Save agent conversation to JSON log file.
|
/// Save agent conversation to JSON log file.
|
||||||
/// Used by both mind-run agents and CLI-run agents.
|
/// Used by both mind-run agents and CLI-run agents.
|
||||||
pub async fn save_agent_log(name: &str, agent: &std::sync::Arc<Agent>) -> RunStats {
|
pub async fn save_agent_log(name: &str, agent: &std::sync::Arc<Agent>) -> RunStats {
|
||||||
|
assert!(!name.is_empty(), "save_agent_log called with empty name");
|
||||||
let dir = dirs::home_dir().unwrap_or_default()
|
let dir = dirs::home_dir().unwrap_or_default()
|
||||||
.join(format!(".consciousness/logs/{}", name));
|
.join(format!(".consciousness/logs/{}", name));
|
||||||
let ctx = agent.context.lock().await;
|
let ctx = agent.context.lock().await;
|
||||||
|
|
@ -231,6 +232,7 @@ impl AutoAgent {
|
||||||
temperature: f32,
|
temperature: f32,
|
||||||
priority: i32,
|
priority: i32,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
assert!(!name.is_empty(), "AutoAgent::new called with empty name");
|
||||||
Self {
|
Self {
|
||||||
name, tools, steps,
|
name, tools, steps,
|
||||||
current_phase: String::new(),
|
current_phase: String::new(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue