swarm: /clear starts an agent's next turn on a fresh session
This commit is contained in:
parent
7b62f2c22a
commit
fb9d4b5040
1 changed files with 155 additions and 22 deletions
|
|
@ -18,11 +18,15 @@ use crate::routes::AppState;
|
|||
|
||||
/// The commands the swarm UI offers every agent: the name without the slash,
|
||||
/// and what it does.
|
||||
const COMMANDS: [(&str, &str); 2] = [
|
||||
const COMMANDS: [(&str, &str); 3] = [
|
||||
(
|
||||
"compact",
|
||||
"Compact this agent's context after the current turn",
|
||||
),
|
||||
(
|
||||
"clear",
|
||||
"Start the next turn on a fresh session, dropping this one's context",
|
||||
),
|
||||
("clear-todos", "Mark all of this agent's todos done"),
|
||||
];
|
||||
|
||||
|
|
@ -164,7 +168,7 @@ mod tests {
|
|||
#[test]
|
||||
fn the_swarms_commands_come_first_and_always() {
|
||||
let list = build(None);
|
||||
assert_eq!(names(&list), ["compact", "clear-todos"]);
|
||||
assert_eq!(names(&list), ["compact", "clear", "clear-todos"]);
|
||||
assert!(list.iter().all(|e| e.kind == CommandKind::Command));
|
||||
}
|
||||
|
||||
|
|
@ -173,8 +177,11 @@ mod tests {
|
|||
let list = build(Some(Skills {
|
||||
skills: vec![skill("zeta", "z"), skill("alpha", "a")],
|
||||
}));
|
||||
assert_eq!(names(&list), ["compact", "clear-todos", "alpha", "zeta"]);
|
||||
assert_eq!(list[2].kind, CommandKind::Skill);
|
||||
assert_eq!(
|
||||
names(&list),
|
||||
["compact", "clear", "clear-todos", "alpha", "zeta"]
|
||||
);
|
||||
assert_eq!(list[3].kind, CommandKind::Skill);
|
||||
}
|
||||
|
||||
/// What the agent publishes is untrusted: a skill cannot take a command's
|
||||
|
|
@ -184,15 +191,16 @@ mod tests {
|
|||
let list = build(Some(Skills {
|
||||
skills: vec![
|
||||
skill("compact", "pretends to be the command"),
|
||||
skill("clear", "so does this"),
|
||||
skill("good", "one"),
|
||||
skill("good", "two"),
|
||||
skill("two words", "not a word"),
|
||||
skill("", "empty"),
|
||||
],
|
||||
}));
|
||||
assert_eq!(names(&list), ["compact", "clear-todos", "good"]);
|
||||
assert_eq!(names(&list), ["compact", "clear", "clear-todos", "good"]);
|
||||
assert_eq!(list[0].kind, CommandKind::Command);
|
||||
assert_eq!(list[2].description, "one");
|
||||
assert_eq!(list[3].description, "one");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue