Enhance logging and documentation across utility tools and TUI overlays

- Added tracing instrumentation and improved logging messages in the Pong, Todofinish, and Todowrite tools for better debugging and monitoring.
- Enhanced documentation comments for clarity on tool functionalities and workflows.
- Implemented tracing in WorkflowRun, NoteFinding, ReadFindings, and HiveMind tools to track execution phases and findings.
- Updated TUI overlays (e.g., Bash, Clear Confirm, Editor, Effort Level, Help, Key Input, Learning, Loading, MCP, Model Selector, Plan, Quit Confirm, Rewind, Settings, Todo, Usage) with debug logging to capture rendering details.
- Improved the status bar and workflow panel rendering with additional debug information.
- Added tracing to various utility functions to facilitate better performance monitoring and error tracking.
This commit is contained in:
asepharyana
2026-07-20 15:53:43 +07:00
parent f84dfb8476
commit 16494d4b1e
69 changed files with 637 additions and 30 deletions
+13 -1
View File
@@ -1,8 +1,11 @@
//! Agent spawning tools — launch subagents and pipelines.
//!
//! `SpawnAgents` runs multiple subagents in parallel threads. `SpawnPipeline`
//! runs a sequence of agent stages one after another.
use anyhow::Result;
use serde_json::{json, Value};
use tracing::info;
use tracing::{debug, info, instrument, warn};
use zesdex_domain::cms::{AppConfigRepository, SettingsRepository};
use zesdex_domain::core::Store;
@@ -50,6 +53,7 @@ impl Tool for SpawnAgents {
})
}
#[instrument(skip(self, ctx, args))]
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let agents = args
.get("agents")
@@ -57,6 +61,7 @@ impl Tool for SpawnAgents {
.ok_or_else(|| anyhow::anyhow!("missing 'agents' array"))?;
info!("Spawning {} agents", agents.len());
debug!(agent_count = agents.len(), "parsing agents array");
// Load LLM credentials once for all agents
let store = Store::new();
@@ -106,6 +111,7 @@ impl Tool for SpawnAgents {
model.clone(),
);
debug!(agent_index = i, access = %access_str, "spawning subagent");
let handle = spawn_subagent(subagent_ctx, directive.clone(), access, ctx.clone());
handles.push((i, handle));
}
@@ -117,8 +123,10 @@ impl Tool for SpawnAgents {
.join()
.map_err(|e| anyhow::anyhow!("subagent {i} panicked: {e:?}"))??;
results.push(format!("Agent {i}: {result}"));
info!(agent_index = i, "subagent completed");
}
info!("All {} subagents completed", agents.len());
Ok(format!(
"Spawned {} agents.\n\nResults:\n{}",
agents.len(),
@@ -163,6 +171,7 @@ impl Tool for SpawnPipeline {
})
}
#[instrument(skip(self, ctx, args))]
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
let stages = args
.get("stages")
@@ -221,13 +230,16 @@ impl Tool for SpawnPipeline {
model.clone(),
);
debug!(stage_index = i, access = %access_str, "running pipeline stage");
let result = rt.block_on(async {
run_agent(subagent_ctx, &directive, access, ctx.clone()).await
})?;
pipeline_result.push_str(&format!("Stage {}: {}\n", i, result));
info!(stage_index = i, "pipeline stage completed");
}
info!("Pipeline with {} stages completed", stages.len());
Ok(format!(
"Pipeline with {} stages completed.\n\n{}",
stages.len(),