machine mode

This commit is contained in:
Dhanji Prasanna
2025-10-28 14:51:32 +11:00
parent 5e08d6bbba
commit 4b1694b308
4 changed files with 63 additions and 37 deletions

View File

@@ -1145,6 +1145,27 @@ async fn run_interactive_machine(
println!("{}", summary);
continue;
}
"/readme" => {
println!("COMMAND: readme");
match agent.reload_readme() {
Ok(true) => println!("RESULT: README content reloaded successfully"),
Ok(false) => println!("RESULT: No README was loaded at startup, cannot reload"),
Err(e) => println!("ERROR: {}", e),
}
continue;
}
"/stats" => {
println!("COMMAND: stats");
let stats = agent.get_stats();
// Emit stats as structured data (name: value pairs)
println!("{}", stats);
continue;
}
"/help" => {
println!("COMMAND: help");
println!("AVAILABLE_COMMANDS: /compact /thinnify /readme /stats /help");
continue;
}
_ => {
println!("ERROR: Unknown command: {}", input);
continue;

View File

@@ -71,6 +71,7 @@ impl UiWriter for MachineUiWriter {
}
fn print_agent_prompt(&self) {
println!("AGENT_RESPONSE:");
let _ = io::stdout().flush();
}

View File

@@ -2722,7 +2722,8 @@ Template:
// Check if this was a final_output tool call
if tool_call.tool == "final_output" {
full_response.push_str(final_display_content);
// Don't add final_display_content here - it was already added before tool execution
// Adding it again would duplicate the output
if let Some(summary) = tool_call.args.get("summary") {
if let Some(summary_str) = summary.as_str() {
full_response.push_str(&format!("\n\n{}", summary_str));