caveat_dispatch
Dispatch new events to a Caveat program while preserving a running ledger across calls: pass the returned save back unchanged with the same source.
Instructions
Keep one running ledger across calls: send events to the program, starting fresh or from the save an earlier caveat_dispatch call returned, and get the new save back. Use when a task records decisions as it goes; pass report.save unchanged as save in the next call, with the same source, and send only the new events. The server keeps nothing between calls. caveat_explain instead replays a whole history from the start each time. report (caveat-dispatch-step/0.1) is the caveat-explain/0.1 report of the state after these events (its events list only this call's events), plus restored and save. exitCode: 0 completed (may include rejected events); 1 fatal event, with the explanation and save of the last good state; 2 source load failure, or a save that does not restore with this exact source (report has error). Returns the same JSON in structuredContent and text: {schema:"caveat-authoring/0.1",operation,sourceSha256,runtime,exitCode,report}. Read exitCode even when isError is false. Bridge failures instead set isError:true with {schema:"caveat-authoring-error/0.1",error:{kind,message}}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source": "<source>"
},
"name": "caveat_dispatch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| save | No | Optional. The report.save text from the previous caveat_dispatch call, passed back unchanged. Omit to start a fresh session. A save restores only with the exact source it came from; it is not repaired or checked for history. At most 2 MiB of UTF-8. | |
| events | No | Events to send in array order after the save is restored, or from a fresh session. Omitted or [] reports the current state and returns an equivalent save. Rejections are recorded and the step continues; a fatal event stops it at the last good state. At most 1,000 entries and 1 MiB of serialized UTF-8 JSON. | |
| source | Yes | Complete inline Caveat program text, available as the virtual file inline.cav. No file path or URL lookup. At most 1 MiB of UTF-8 source; each call uses a fresh runtime. | |
| moduleBindings | No | Optional, only with save, and only after a call refused that save because it needs this. A save that a release up to 1.4.1 wrote, of a bundle whose modules use hold or release, can need its reading named: scoped reads the bundle as a fresh session does, each module's hold and release its own; legacy-hold-capture reads it as releases 1.2.0 to 1.4.1 did, where a hold or release two words before because names the root module's declaration. Name the reading of the release that wrote the save. A save this tool returns names its reading, so later calls omit this; a choice that differs from the save's own is refused. |