harness: add request_next_turn MCP tool — immediate self-continuation (closes #216)
This commit is contained in:
parent
de6ff3da29
commit
c99261b042
3 changed files with 68 additions and 0 deletions
|
|
@ -626,6 +626,30 @@ impl AgentServer {
|
|||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tool(
|
||||
description = "Ask the harness to start another turn immediately after this one \
|
||||
completes, even if the inbox is empty. Use this when you have ongoing work that \
|
||||
spans multiple turns (long builds, multi-step tasks) and you want to continue \
|
||||
without waiting for an external message. The next turn will start with \
|
||||
`from: \"self\"` and `body: \"continue\"`. Has no effect if a new inbox message \
|
||||
arrives before this turn ends — the harness already loops immediately on pending \
|
||||
messages. No args."
|
||||
)]
|
||||
async fn request_next_turn(&self) -> String {
|
||||
run_tool_envelope("request_next_turn", String::new(), async move {
|
||||
let sentinel = crate::paths::state_dir().join("hyperhive-continue");
|
||||
match std::fs::write(&sentinel, b"") {
|
||||
Ok(()) => "ok — harness will start another turn immediately after this one",
|
||||
Err(e) => {
|
||||
tracing::warn!(error = %e, path = %sentinel.display(), "request_next_turn: write failed");
|
||||
return format!("request_next_turn failed: {e}");
|
||||
}
|
||||
}
|
||||
.to_string()
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[tool_handler(
|
||||
|
|
|
|||
Loading…
Reference in a new issue