use serde_json::Value;
use super::Verb;
pub const INTERRUPT: Verb = Verb {
word: "interrupt",
params: &["workspace", "agent", "content"],
flags: &[],
summary: "cut a conversation off mid-work and say this instead",
detail: "The driver is killed and the content deposited, both stamped as \
one gesture, and the deposit's own driver-start is what carries \
the turn on — so nothing else has to be asked for afterwards. The \
content crosses verbatim, so quote it as one argument. The cascade \
onto descendants is deliberately not offered: this gesture's \
subject is the conversation being talked to, and taking a subtree \
down is `stop`'s question, not this one's.",
};
pub const CHILDREN: &str = "children";
pub const STOP: Verb = Verb {
word: "stop",
params: &["workspace", "agent"],
flags: &[CHILDREN],
summary: "kill the driver held on a conversation; `children` takes the subtree with it",
detail: "It kills the driver and leaves everything else standing: the \
conversation's history, its worktree and its inbox are untouched, \
and `nudge` starts a driver on it again. SAY `children` AS THE \
THIRD WORD and the agents it spawned go down with it. On a \
conversation that has children the bare form does not stop it: \
the root's driver dies, a child's driver deposits into it, and it \
is running again seconds later — which is what bl-9fd1 measured, \
on two conversations in two workspaces, at 796,522 further tokens. \
The engine says which forms it is offering on the conversation \
itself (`lernie agent <workspace> <agent>` prints its offers), so \
a seat need not guess whether there is a subtree under there.",
};
pub const RETARGET: Verb = Verb {
word: "retarget",
params: &["workspace", "agent"],
flags: &[],
summary: "settle a conversation onto the head of the config lineage governing it",
detail: "Marks the conversation to be re-forked onto the head of the \
config lineage that governs it, which its own executor lands at \
the next step boundary. Nothing is rewritten now: what comes back \
is the captured run of the marking, and the conversation keeps \
running whatever it was running.",
};
pub const DELETE_AGENT: Verb = Verb {
word: "delete-agent",
params: &["workspace", "agent", "typed"],
flags: &[],
summary: "delete a conversation; the typed name arms taking its children too",
detail: "Removes the conversation and everything the engine holds for it — \
its ref, worktree, steps and inbox. Refused while it is live, so a \
conversation still working is not deleted out from under itself. \
An EMPTY `typed` deletes the one conversation; typing its name \
exactly is what arms taking its descendants with it, and without \
that the substrate declines a subtree nobody confirmed.",
};
pub fn interrupt(workspace: String, agent: String, content: String) -> Value {
INTERRUPT.built(vec![workspace, agent, content], &[])
}
pub fn stop(workspace: String, agent: String, children: bool) -> Value {
let raised: Vec<&str> = children.then_some(CHILDREN).into_iter().collect();
STOP.built(vec![workspace, agent], &raised)
}
pub fn retarget(workspace: String, agent: String) -> Value {
RETARGET.built(vec![workspace, agent], &[])
}
pub fn delete_agent(workspace: String, agent: String, typed: String) -> Value {
DELETE_AGENT.built(vec![workspace, agent, typed], &[])
}