refactor: consolidate hypotheses, agent_signals, and process_logs into action-based smart tools

This commit is contained in:
Riz Ashraf committed 2026-10-07 12:00:20 +01:00
1 parent 79209da711
commit 3b146f91c2
17 files changed
+438 -359

No files matched your search

+46 -37
View File
@@ -338,25 +338,27 @@ pub struct GetNextActionableTasksTool {
pub limit: Option<usize>,
}
/// Log a structured diagnostic hypothesis, tested evidence, and status during problem solving.
#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum HypothesisAction {
Log,
Query,
}
/// Manage diagnostic hypotheses, tested evidence, and status during problem solving.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct LogHypothesisTool {
/// Optional task ID associated with this hypothesis.
pub struct HypothesesTool {
/// Action to perform: 'log' or 'query'.
pub action: HypothesisAction,
/// Optional task ID associated with this hypothesis or to filter hypotheses.
pub task_id: Option<String>,
/// The diagnostic hypothesis or potential root cause.
pub hypothesis: String,
/// The diagnostic hypothesis or potential root cause (required for action 'log').
pub hypothesis: Option<String>,
/// Status: 'unverified', 'verified', or 'rejected'. Defaults to 'unverified'.
pub status: Option<String>,
/// Evidence or test results supporting or disproving the hypothesis.
pub evidence: Option<String>,
}
/// Query previously logged diagnostic hypotheses and test results.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct QueryHypothesesTool {
/// Optional task ID to filter hypotheses for.
pub task_id: Option<String>,
/// Optional search query text.
/// Optional search query text (for action 'query').
pub query: Option<String>,
}
#[cfg(test)]
@@ -397,15 +399,23 @@ mod tests {
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct GetActiveWorktreeContextTool {}
/// Tail a specific log file in the background so it can be queried later.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct WatchProcessLogsTool {
pub file_path: String,
#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ProcessLogAction {
Watch,
Get,
Clear,
}
/// Get the recent logs from a watched file.
/// Monitor, tail, and manage process logs: watch a log file, tail recent output, or clear log files.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct GetRecentLogsTool {
pub struct ProcessLogsTool {
/// Action to perform: 'watch', 'get', or 'clear'.
pub action: ProcessLogAction,
/// Path to the log file.
pub file_path: String,
/// Maximum number of lines to return for action 'get'. Defaults to 100.
pub max_lines: Option<usize>,
}
/// Read a file and return only its AST skeleton (Imports, Structs, Enums, Traits, Functions)
@@ -537,30 +547,29 @@ pub struct SummarizeSubgraphTool {
pub max_tokens: Option<usize>,
}
/// Broadcast a real-time signal or status transition to other subagents on the inter-agent signal bus.
#[derive(Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum AgentSignalAction {
Broadcast,
Query,
}
/// Real-time inter-agent communication bus: broadcast signals or query active signals from peer subagents.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct BroadcastAgentSignalTool {
/// Sender agent ID or role (e.g. 'PrePushAuditor', 'MemoryLibrarian').
pub sender: String,
/// Signal type or event category (e.g. 'AUDIT_PASSED', 'REPRODUCER_READY', 'TESTS_FAILED').
pub signal_type: String,
/// JSON or text payload containing event details or artifact URIs.
pub payload: String,
pub struct AgentSignalsTool {
/// Action to perform: 'broadcast' or 'query'.
pub action: AgentSignalAction,
/// Sender agent ID or role (e.g. 'PrePushAuditor', 'MemoryLibrarian'). Required for broadcast; optional filter for query.
pub sender: Option<String>,
/// Signal type or event category (e.g. 'AUDIT_PASSED', 'REPRODUCER_READY', 'TESTS_FAILED'). Required for broadcast; optional filter for query.
pub signal_type: Option<String>,
/// JSON or text payload containing event details or artifact URIs (required for action 'broadcast').
pub payload: Option<String>,
/// Optional Time-To-Live in seconds for the signal. Defaults to 3600 (1 hour).
pub ttl_seconds: Option<u64>,
}
/// Query active inter-agent signals published by subagents on the inter-agent signal bus.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct QueryAgentSignalsTool {
/// Optional sender filter (e.g. 'PrePushAuditor').
pub sender: Option<String>,
/// Optional signal_type filter (e.g. 'AUDIT_PASSED').
pub signal_type: Option<String>,
/// Optional limit on returned signals. Defaults to 20.
/// Optional limit on returned signals (for action 'query'). Defaults to 20.
pub limit: Option<usize>,
}
/// Trigger an automated context checkpoint, summarizing active tasks, hypotheses, recent commits, and open tech debt into a permanent HandoffMemo.
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
pub struct AutoSessionCheckpointTool {