Expand description
A run drawn as connected steps on a canvas.
This is the shape an agent’s work takes when it stops being a list: steps as cards, connections as paths, and the failures that sent work back drawn as the loops they are rather than flattened into the forward order.
The division of labour is the same one the rest of the library keeps. The caller owns the run, the positions and the actions; the canvas owns the backdrop, the card, the path geometry and the states. There is no layout algorithm here on purpose: where a step belongs is a claim about the run, and a component that placed steps itself would be making that claim on every host’s behalf.
use gpui_kit::prelude::*;
let graph = NodeGraph::new("run.12")
.node(
GraphNode::new("run.12.plan", "Plan")
.state(NodeState::Succeeded)
.metric("tokens", "4.1k")
.metric("took", "2.4s"),
0.0,
0.0,
)
.node(
GraphNode::new("run.12.apply", "Apply")
.state(NodeState::Failed)
.action("write src/main.rs")
.diff(Diff::new(24, 3)),
280.0,
0.0,
)
.edge(GraphEdge::new("run.12.plan", "run.12.apply"))
.edge(GraphEdge::new("run.12.apply", "run.12.plan").feedback());Structs§
- Diff
- How much a step changed, in lines.
- Graph
Edge - A controlled connection between two graph nodes.
- Graph
Endpoint - A caller-owned node and port identity used by connection proposals.
- Graph
Node - A step of a run, as a card on the canvas.
- Graph
Port - A typed connection point on a
GraphNode. - Graph
Viewport - Caller-owned pan and zoom values for a
NodeGraph. - Node
Graph - A run drawn as connected steps.
- Node
Metric - One figure a step reports about itself, such as a token count or an elapsed time. Both halves are the caller’s words.
- Placed
- A node and where its top left corner sits, in canvas coordinates.
Enums§
- Edge
Kind - The routing treatment of an edge.
- Graph
State - What the canvas can currently say about itself.
- Node
Graph Event - A proposed controlled graph change.
- Node
State - How a step ended, or that it has not.
- Port
Direction - Whether a port receives or produces data.
- Port
Side - The side of a node on which a port is placed.
Constants§
- NODE_
WIDTH - The default width of a node, in pixels.