sdk, agent: review fixes (T18R)

- The serve loop ends the process after EOF or exit_after_response,
  also with background tasks or listeners.
- One schema generator per direction for the whole document, so types
  with the same name get distinct names.
- The agent gives the complete error (code, message, data) to the
  model, writes SKIP only after a successful request, caps tool output
  at 64 KiB, writes each history line in one write, and skips a damaged
  line.
- Endpoints skip blank and non-RPC lines. client_rs does not panic.
- #[must_use] on builders and the lock guard; #[schemars] attributes
  and duplicate hooks are compile errors; raw identifiers; -32000 for
  local SDK errors; x-sausage-params only for methods with params.
This commit is contained in:
2026-10-23 02:38:35 +01:00
parent d7b78ed0fd
commit c728429d04
29 changed files with 829 additions and 104 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
//! Outgoing core calls and notification callbacks.
use super::*;
/// An outgoing request builder.
#[must_use = "await the call to send it"]
pub struct Call {
method: String,
params: Value,
@@ -43,7 +44,7 @@ impl IntoFuture for Call {
let mut s = s.borrow_mut();
if !s.active || s.stopping {
return Err(Error::new(
-32002,
-32000,
"no core transport (or stdin reached EOF)",
));
}
@@ -72,7 +73,7 @@ impl IntoFuture for Call {
return Err(e);
}
rx.await
.unwrap_or_else(|_| Err(Error::new(-32002, "core transport closed")))
.unwrap_or_else(|_| Err(Error::new(-32000, "core transport closed")))
})
}
}