limits: unified 1 KiB cap on send/ask + reminder auto-file on overflow

This commit is contained in:
damocles 2026-05-17 11:36:12 +02:00
parent 753409a5ef
commit 0e6bac8388
6 changed files with 180 additions and 42 deletions

View file

@ -152,9 +152,11 @@ pub struct RecvArgs {
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct RemindArgs {
/// Body that lands in your inbox when the reminder fires (sender
/// will appear as `reminder`). Capped at 4096 bytes when
/// `file_path` is unset — anything bigger should be persisted to
/// disk and pointed at via `file_path`.
/// will appear as `reminder`). Soft cap at 1 KiB inline — anything
/// larger gets auto-persisted to a file under
/// `/agents/<you>/state/reminders/auto-<ts>.md` and the inbox
/// message becomes a short pointer. Pass `file_path` if you want
/// to control the destination yourself.
pub message: String,
/// Fire `delay_seconds` from now (relative). Set this OR
/// `at_unix_timestamp`, not both.
@ -288,10 +290,11 @@ impl AgentServer {
time (sender will appear as `reminder`). Use for self-paced follow-ups: 'check task \
status in 60s', 'retry failed deploy at 14:00 UTC', 'nudge me when the operator's \
deploy window opens'. Set EXACTLY ONE of `delay_seconds` (fire N seconds from now) \
or `at_unix_timestamp` (fire at absolute epoch second). Body is capped at 4096 bytes \
when `file_path` is unset; for larger payloads write them to a file under your \
`/agents/<you>/state/` dir and pass the path in `file_path`. Returns immediately \
the reminder lives in the broker until due."
or `at_unix_timestamp` (fire at absolute epoch second). Body soft-caps at 1 KiB \
inline anything larger gets auto-persisted to a file under your \
`/agents/<you>/state/reminders/` dir and the inbox message becomes a short pointer; \
pass `file_path` if you want to control the destination yourself. Returns \
immediately the reminder lives in the broker until due."
)]
async fn remind(&self, Parameters(args): Parameters<RemindArgs>) -> String {
let log = format!("{args:?}");