Skip to main content

deliver

Function deliver 

Source
pub fn deliver(
    home: &Path,
    caps: Caps,
    event: &str,
    input: &Value,
    started: Option<i64>,
    now: i64,
    out: Option<Value>,
) -> Option<Value>
Expand description

The hook’s call after everything else answered (out): at a prompt or tool call where the harness takes context, the messages for the event’s session not shown yet join the answer’s context, each once. A block (decision) answers the event alone, a prompt sent with "context": false (opencode during a stop) drops what borg answers, and a subagent’s event (agent_id: Claude gives its context to the subagent) is not the session’s: the messages wait. What shows fits the harness’s context budget (Caps::context_chars) less what out already holds (capped), newest first; the rest wait, and the session’s SCANNED stamp is not written while any does. The tells and asks shown are acknowledged (ack), with those an earlier event claimed that no Seen of the session lists (owed), and the answer names the tells and asks it showed ("shown_ids", for adapters: a wake names the same ids, listen.rs say, so an adapter drops a held wake only once every message it names was shown; never a count, since one event may show a newer message and leave a held wake’s). The stamp holds the log’s talk as the call found it, before it read the log (talk): Seen lines written since, its own acknowledgement’s or any other session’s or node’s, leave it, a tell, ask or steer moves it. None is written when the acknowledgement failed, so the next call tries it again. started: the session’s start (presence.rs); None still delivers messages to the session but no broadcast.