Agent: durable turn and queue state, visible inbox closure, OpenAI phase; prompt fixes; fetch/bench fixes

This commit is contained in:
2026-10-15 11:54:41 +01:00
parent 1cd8971aa3
commit 69cf80a114
7 changed files with 296 additions and 103 deletions
+10 -3
View File
@@ -108,15 +108,17 @@ fn next_id() -> String {
#[cfg(feature = "async")]
pub struct Inbox {
rx: async_channel::Receiver<Message>,
_reader: wstd::runtime::Task<()>,
}
#[cfg(feature = "async")]
impl Inbox {
/// Start a task that reads stdin and returns an inbox for its messages.
/// Start the stdin reader inside the wstd runtime and return its inbox.
/// The inbox owns the reader task and must be dropped to cancel it.
pub fn start() -> Self {
let (tx, rx) = async_channel::unbounded();
wstd::runtime::spawn(read_messages(tx)).detach();
Self { rx }
let reader = wstd::runtime::spawn(read_messages(tx));
Self { rx, _reader: reader }
}
/// Wait for the next message, or return `None` at EOF or shutdown.
@@ -128,6 +130,11 @@ impl Inbox {
pub fn try_recv(&self) -> Option<Message> {
self.rx.try_recv().ok()
}
/// Return whether the reader closed the inbox, even when messages remain buffered.
pub fn is_closed(&self) -> bool {
self.rx.is_closed()
}
}
#[cfg(feature = "async")]