plan mode: show full plan before the exit prompt (claude ExitPlanMode via bridge, ask_user path)
This commit is contained in:
1 parent
36e99fc8af
commit
8a9d8fe607
6 files changed
+78
-6
No files matched your search
@@ -21,6 +21,8 @@ pub enum Item {
|
||||
started: Instant,
|
||||
took: Option<Duration>,
|
||||
},
|
||||
/// A finished plan, shown in full.
|
||||
Plan(String),
|
||||
Info(String),
|
||||
Error(String),
|
||||
/// Hook reports injected at turn end (`[lens] …`), shown as the lens block.
|
||||
@@ -352,12 +354,9 @@ fn render(it: &Item, expanded: bool, width: usize, out: &mut Vec<Line<'static>>)
|
||||
Item::Lens(texts) => lens_block(texts, expanded, width, out),
|
||||
Item::Error(s) => out.push(Line::styled(format!("{} {s}", th.sym.err), th.err())),
|
||||
Item::Tool { name, args, .. } if name == "exit_plan" => {
|
||||
let mut md = vec![];
|
||||
markdown(args["plan"].as_str().unwrap_or_default(), &mut md);
|
||||
out.push(Line::styled(th.rule("plan", width), th.accent()));
|
||||
lead(md, " ", th.plain(), out);
|
||||
out.push(Line::styled(th.rule("", width), th.dim()));
|
||||
plan_block(args["plan"].as_str().unwrap_or_default(), width, out)
|
||||
}
|
||||
Item::Plan(p) => plan_block(p, width, out),
|
||||
Item::Tool {
|
||||
name,
|
||||
args,
|
||||
@@ -379,6 +378,15 @@ fn render(it: &Item, expanded: bool, width: usize, out: &mut Vec<Line<'static>>)
|
||||
}
|
||||
}
|
||||
|
||||
fn plan_block(plan: &str, width: usize, out: &mut Vec<Line<'static>>) {
|
||||
let th = theme::t();
|
||||
let mut md = vec![];
|
||||
markdown(plan, &mut md);
|
||||
out.push(Line::styled(th.rule("plan", width), th.accent()));
|
||||
lead(md, " ", th.plain(), out);
|
||||
out.push(Line::styled(th.rule("", width), th.dim()));
|
||||
}
|
||||
|
||||
/// `┄ lens ┄┄┄` rule, then per report a summary line (errors red, all-pass green) and,
|
||||
/// collapsed, the first findings; `ctrl-o` shows all.
|
||||
fn lens_block(texts: &[String], expanded: bool, width: usize, out: &mut Vec<Line<'static>>) {
|
||||
|
||||
Reference in new issue
Block a user