feat: added a .fork command to fork a new session from a running conversation
CI / All (ubuntu-latest) (push) Failing after 24s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-21 14:54:55 -06:00
parent d8ae9e25d9
commit 9606d7f8aa
3 changed files with 102 additions and 3 deletions
+11 -3
View File
@@ -52,7 +52,7 @@ pub const DEFAULT_CONTINUATION_PROMPT: &str = indoc! {"
4. Continue with the next pending item now. Call tools immediately."
};
static REPL_COMMANDS: LazyLock<[ReplCommand; 57]> = LazyLock::new(|| {
static REPL_COMMANDS: LazyLock<[ReplCommand; 58]> = LazyLock::new(|| {
[
ReplCommand::new(".help", "Show this help guide", AssertState::pass()),
ReplCommand::new(".info", "Show system info", AssertState::pass()),
@@ -175,6 +175,11 @@ static REPL_COMMANDS: LazyLock<[ReplCommand; 57]> = LazyLock::new(|| {
"Exit active session",
AssertState::True(StateFlags::SESSION_EMPTY | StateFlags::SESSION),
),
ReplCommand::new(
".fork",
"Fork the active session into a new named copy",
AssertState::True(StateFlags::SESSION),
),
ReplCommand::new(".agent", "Use an agent", AssertState::bare()),
ReplCommand::new(
".starter",
@@ -1018,6 +1023,9 @@ pub async fn run_repl_command(
ctx.app.config.print_markdown(&banner)?;
}
},
".fork" => {
ctx.fork_session(args)?;
}
".save" => match split_first_arg(args) {
Some(("role", name)) => {
ctx.save_role(name)?;
@@ -1744,8 +1752,8 @@ mod tests {
}
#[test]
fn repl_commands_has_57_entries() {
assert_eq!(REPL_COMMANDS.len(), 57);
fn repl_commands_has_58_entries() {
assert_eq!(REPL_COMMANDS.len(), 58);
}
#[test]