pub struct ToolCalled {
pub id: String,
pub name: ToolName,
pub args: Payload,
pub subject: Option<String>,
pub effect: Option<Effect>,
pub render: Option<RenderIntent>,
}Expand description
tool_called: the call the model asked for, before anything ran.
The arguments, and the subject read from them, reach the ledger
through runtime::turn::ledger::Journal::append_redacted, so a
credential the model quoted into them is replaced before this line
exists.
Fields§
§id: StringThe wire identity both dialects pair a call and its result by.
name: ToolName§args: Payload§subject: Option<String>What the call acted on, in the one reading a person recognises a call by: a path, an address, a program name.
Carried by the record rather than derived from args at each
reader. Two readers deriving it each iterated their own map
order, so one call answered differently on the two sides of the
wire: for {"10": "a", "2": "b"} the ledger’s byte order
gives "a" and a browser’s own-property order gives "b".
ToolCalled::subject_of decides it once, here.
None is a call whose arguments name nothing of that kind,
which is a real state rather than a failure.
effect: Option<Effect>The effect the tool was registered with at the moment of the
call, copied by the tool wave from its ToolMeta (crates/kernel/spec/Event/Record.lean
§8-75). Absent for a tool the bench did not know and on every line
written before the key existed.
render: Option<RenderIntent>How the tool was registered to be drawn at the moment of the
call; absent in the same cases as effect. A Diff’s locations
are the registration’s, empty for every tool today: the file an
edit touched is subject.
Implementations§
Source§impl ToolCalled
impl ToolCalled
Sourcepub fn subject_of(args: &Payload) -> Option<String>
pub fn subject_of(args: &Payload) -> Option<String>
The one argument a person recognises a call by, read from the arguments once, when the call becomes a record.
The preferred keys are tried in their declared order; a call whose tool names none of them still says something rather than falling back to the bare tool name, and the fallback takes the first string in the payload’s own key order so it is the same answer on every machine.