GPUI Box GitHub

Components / agent

AgentPlan builder

A plan, as a run of marks and one line about the item in flight.

A builder is RenderOnce. Construct and mount it in one expression.

use gpui_kit::agent::AgentPlan;

Reviewed in agent-plan.

Construct
new(ident: impl Into<Ident>) -> Self
Options

Chain onto the value.

item(item: PlanItem) -> Self
items(items: impl IntoIterator<Item = PlanItem>) -> Self
on_pick(handler: impl Fn(SharedString, &mut Window, &mut App) + 'static) -> Self
Queries

Only answer; they change nothing.

done() -> usize
Example · agent-plan
fn agent_plan(_window: &mut Window, cx: &mut App) -> AnyElement {
    let theme = cx.theme().clone();
    stack(&theme)
        .w(px(420.0))
        .child(caption(
            &theme,
            "Behind, in flight, ahead — and the two a plan cannot be honest without",
        ))
        .child(
            AgentPlan::new("scene.plan.running")
                .item(PlanItem::new("brief", "Read the brief").done())
                .item(PlanItem::new("search", "Search the workspace").done())
                .item(PlanItem::new("summarise", "Summarise what was found").doing())
                .item(PlanItem::new("publish", "Publish the summary"))
                .item(PlanItem::new("notify", "Notify the reviewers"))
                .on_pick(|_, _, _| {}),
        )
        .child(caption(
            &theme,
            "A plan that stopped, and one the agent decided against",
        ))
        .child(
            AgentPlan::new("scene.plan.stopped")
                .item(PlanItem::new("brief", "Read the brief").done())
                .item(
                    PlanItem::new("notify", "Notify the reviewers")
                        .blocked("The notification service did not respond."),
                )
                .item(
                    PlanItem::new("archive", "Archive the previous run")
                        .dropped("Nothing had been published yet."),
                )
                .item(PlanItem::new("close", "Close the run")),
        )
        .child(caption(&theme, "Nothing in flight, so nothing is said"))
        .child(
            AgentPlan::new("scene.plan.settled")
                .item(PlanItem::new("brief", "Read the brief").done())
                .item(PlanItem::new("close", "Close the run").done()),
        )
        .into_any_element()
}

Source: crates/gpui-kit/src/agent/plan.rs