xonecas.io
8447
Co

conveyor / commit 6c86b40

Build status is the library's status widget

The app draws widgets/status.rs over root instead of its own pills and
toasts, so it can be Ctrl+clicked, changed or replaced like any widget.
The inspector picks what it draws and falls through to the content
elsewhere. api: keep_build and Data.connected. conveyord seeds status.rs
into libraries made before it; the preview draws it over root too.

Co-Authored-By: Claude Opus 5.5

sacenox2026-11-09 6c86b404610dfc8b4345d447183918e62d3d48c6 parent e47a7f7

11 files changed

DESIGN.md+3−3
@@ -178,7 +178,7 @@ Measured in spike 1, on the host:
178178
179179 ### The widget builder
180180
181-The library is the whole UI. The window draws the library's `root` widget and nothing else, so the title bar, the panes and the boards are all widgets, and all of them change the same way: hold Ctrl, click one, and say what it should become.
181+The library is the whole UI. The window draws the library's `root` widget, and its `status` widget over it, and nothing else, so the title bar, the panes, the boards and build status are all widgets, and all of them change the same way: hold Ctrl, click one, and say what it should become.
182182
183183 ```
184184 window ─ core draws ─► root (library) core, drawn above the library:
@@ -187,7 +187,7 @@ window ─ core draws ─► root (library) core, drawn above t
187187 └ project_view (library) takes the click, so no control can
188188 ├ activity_strip swallow it
189189 └ kanban | dashboard · prompt form: that kind's conversation
190- · status pills, reply toasts
190+ ─► status (library), over root: build pills, replies, Keep / Discard
191191 Ctrl+click ─► conveyord: widgets ticket (kind, instance chain, tree, shared, thread)
192192 ─► VM: claude starts from the trial, edits widgets/, checks with the preview,
193193 `conveyor place <kind> --in <instance>` for free children, `conveyor done`
@@ -196,7 +196,7 @@ Ctrl+click ─► conveyord: widgets ticket (kind, instance chain, tree, shared,
196196 Discard ─► back to draft, trial rebuilt without it
197197 ```
198198
199-- **The core owns only the building tool.** No frames, title bars, menus or placement in the core. An earlier cut gave every widget a core frame with a title bar, badge and conversation panel. It boxed widgets into leaves, and inner controls swallowed the Ctrl+click.
199+- **The core owns only the building tool.** No frames, title bars, menus or placement in the core. Even build status (pills, replies, Keep and Discard) is the library's `status` widget, which the app draws over `root`. An earlier cut gave every widget a core frame with a title bar, badge and conversation panel. It boxed widgets into leaves, and inner controls swallowed the Ctrl+click.
200200 - **Widgets compose.** `cx.child(kind, key)` renders a widget inside another with its own state and folder. Instance ids are paths (`root.project.board`). `View::mount` lets a widget keep a new kind where the user asked for it. The default canvas keeps a free-floating list; a layout widget usually renders its children itself.
201201 - **Widgets read and act on conveyor.** `cx.data` holds projects, tickets and the latest 200 activity events, refreshed every second. Handlers call `set_state`, `new_ticket` or any `server.rs` op. `share`/`cx.shared` pass values such as the selected project between widgets, and survive restarts.
202202 - **Widgets are programs**: own state, input, files in `cx.dir`, threads, `curl`, and `cx.animate()` for frame-rate redraws.
crates/conveyor-app/src/app.rs+7−6
@@ -1,6 +1,7 @@
11 //! The app's state and loop. It draws the library's `root` widget and three things of its own
2-//! above it: the Ctrl inspector, the prompt form, and build status. Everything else is widgets.
3-use crate::{client, form::{self, Form}, inspect, reload::Loader, status};
2+//! above it: the Ctrl inspector and the prompt form. Over `root` it draws the library's `status`
3+//! widget, build status, so the user can replace that too. Everything else is widgets.
4+use crate::{client, form::{self, Form}, inspect, reload::Loader};
45 use crate::api::{Event, Host, Live};
56 use rune::{El, Tx, Waker, el};
67 use serde_json::Value;
@@ -36,8 +37,7 @@ pub struct State {
3637 pub window: std::cell::Cell<(f32, f32)>,
3738 /// What the form's field binds to in the frame it closes.
3839 pub spare: rune::TextEdit,
39- /// Builds whose reply was dismissed or decided, and builds whose new widgets were placed.
40- pub seen: BTreeSet<u64>,
40+ /// Builds whose new widgets were placed.
4141 placed: BTreeSet<u64>,
4242 widgets: Loader,
4343 }
@@ -65,7 +65,7 @@ pub fn init() -> State {
6565 let _ = std::fs::create_dir_all(&base);
6666 let mut widgets = Loader::new();
6767 let live = Live::new(base.clone(), widgets.poll().unwrap_or(&[]));
68- State { seen: ids(&base, "seen").unwrap_or_default(), placed: ids(&base, "placed").unwrap_or_default(), live, widgets,
68+ State { placed: ids(&base, "placed").unwrap_or_default(), live, widgets,
6969 builds: vec![], connected: false, sent: Instant::now(), started: Instant::now(), inbox: Default::default(), exe: None, built: None, ctrl: false, pointer: (0.0, 0.0),
7070 picked: vec![], element: String::new(), rects: RefCell::new(vec![]), form: None, window: Default::default(), spare: rune::TextEdit::new("") }
7171 }
@@ -93,6 +93,7 @@ pub fn poll(s: &mut State, _t: f64, tx: &mut Tx) -> bool {
9393 s.live.data = client::data(&snap);
9494 s.builds = client::builds(&snap);
9595 }
96+ s.live.data.connected = s.connected;
9697 again = true;
9798 }
9899 if !made && s.started.elapsed() > Duration::from_secs(2) { place(s); } else { tx.wake_after(Duration::from_millis(500)); }
@@ -168,7 +169,7 @@ pub fn view(s: &State, rcx: &mut rune::Cx<State>) -> El {
168169 s.pointer = (e.window_x, e.window_y);
169170 if tx.mods().ctrl { on_modifiers(s, tx.mods(), tx) } else { tx.live_only() }
170171 }));
171- app = app.child(status::view(s));
172+ app = app.child(el().key("status-layer").absolute(0.0, 0.0).w_full().h_full().child(s.live.render("status", "status")));
172173 if s.ctrl && s.form.is_none() { app = app.child(inspect::view(s, rcx)); }
173174 if let Some(f) = &s.form { app = app.child(form::view(s, f, rcx)); }
174175 app
crates/conveyor-app/src/client.rs+1−0
@@ -37,6 +37,7 @@ pub fn data(v: &Value) -> Data {
3737 .map(|e| Activity { at: n(e, "at"), project: s(t, "project"), ticket: n(t, "id") as u32, kind: s(e, "kind"), text: s(e, "text") }).collect(),
3838 }).collect(),
3939 activity: all("activity").iter().map(|a| Activity { at: n(a, "at"), project: s(a, "project"), ticket: n(a, "ticket") as u32, kind: s(a, "kind"), text: s(a, "text") }).collect(),
40+ connected: true,
4041 }
4142 }
4243
crates/conveyor-app/src/inspect.rs+15−7
@@ -6,18 +6,26 @@ use crate::{app::State, form};
66 use rune::{El, Tx, el, text, tok};
77
88 /// Finds the widget instances under the pointer (each renders keyed `w:<id>`), and the keyed
9-/// elements inside the innermost one, as a key path such as `col-done/card-12`.
9+/// elements inside the innermost one, as a key path such as `col-done/card-12`. The status
10+/// widget lies over the content and fills the window, so only what it draws inside counts.
1011 pub fn pick(s: &mut State, tx: &mut Tx) {
1112 let (x, y) = s.pointer;
12- tx.element_at_in("content", x, y, |s: &mut State, picked, _| {
13- let Some(p) = picked else { (s.picked, s.element) = (vec![], String::new()); return };
14- s.picked = p.path().split('/').filter_map(|seg| seg.strip_prefix("w:")).rev().map(String::from).collect();
15- let inner = p.path().rsplit_once("/w:").map_or("", |(_, rest)| rest);
16- let unkeyed = |seg: &&str| seg.starts_with('#') && seg[1..].bytes().all(|b| b.is_ascii_digit());
17- s.element = inner.split('/').skip(1).filter(|seg| !unkeyed(seg)).collect::<Vec<_>>().join("/");
13+ tx.element_at_in("status-layer", x, y, move |s: &mut State, picked, tx| match picked.filter(|p| p.path().contains("/w:status/")) {
14+ Some(p) => picked_at(s, &p),
15+ None => tx.element_at_in("content", x, y, |s: &mut State, picked, _| match picked {
16+ Some(p) => picked_at(s, &p),
17+ None => (s.picked, s.element) = (vec![], String::new()),
18+ }),
1819 });
1920 }
2021
22+fn picked_at(s: &mut State, p: &rune::Picked) {
23+ s.picked = p.path().split('/').filter_map(|seg| seg.strip_prefix("w:")).rev().map(String::from).collect();
24+ let inner = p.path().rsplit_once("/w:").map_or("", |(_, rest)| rest);
25+ let unkeyed = |seg: &&str| seg.starts_with('#') && seg[1..].bytes().all(|b| b.is_ascii_digit());
26+ s.element = inner.split('/').skip(1).filter(|seg| !unkeyed(seg)).collect::<Vec<_>>().join("/");
27+}
28+
2129 pub fn view(s: &State, rcx: &mut rune::Cx<State>) -> El {
2230 let accent = tok::accent(0, true);
2331 let t = tok::theme(true);
crates/conveyor-app/src/lib.rs+0−1
@@ -5,7 +5,6 @@ mod client;
55 mod form;
66 mod inspect;
77 mod reload;
8-mod status;
98 #[path = "../../../templates/library/api.rs"]
109 pub mod api;
1110
crates/conveyor-app/src/status.rs+0−70
@@ -1,70 +0,0 @@
1-//! Build status, bottom right: a pill per build in flight, and the agent's reply when one
2-//! finishes. A build on trial is live in the app until Keep merges it or Discard drops it;
3-//! any other reply goes once it's clicked away.
4-use crate::{app::{State, save_ids}, client};
5-use rune::{El, col, row, text, tok};
6-use serde_json::Value;
7-
8-const FINISHED: [&str; 4] = ["review", "done", "failed", "parked"];
9-
10-fn pill(b: &Value, now: u64) -> El {
11- let t = tok::theme(true);
12- let secs = now.saturating_sub(b["since"].as_u64().unwrap_or(now));
13- row().h(28.0).px(10.0).gap(8.0).center_y().radius(14.0).fill(t.card)
14- .child(text(format!("#{} {}", b["id"], b["state"].as_str().unwrap_or(""))).font(tok::type_::LABEL).color(tok::accent(0, true)))
15- .child(text(b["title"].as_str().unwrap_or("").to_owned()).font(tok::type_::LABEL).color(t.text))
16- .child(text(format!("{}:{:02}", secs / 60, secs % 60)).font(tok::type_::LABEL).color(t.text_secondary))
17-}
18-
19-fn toast(b: &Value) -> El {
20- let t = tok::theme(true);
21- let id = b["id"].as_u64().unwrap_or(0);
22- let last = b["thread"].as_array().into_iter().flatten().rev()
23- .find(|e| matches!(e["kind"].as_str(), Some("reply" | "block" | "error" | "conveyor")));
24- let said = last.and_then(|e| e["text"].as_str()).unwrap_or("").to_owned();
25- let state = b["state"].as_str().unwrap_or("");
26- let color = if state == "done" { tok::accent(0, true) } else { tok::accent(1, true) };
27- let toast = col().key(format!("toast-{id}")).w(380.0).radius(10.0).fill(t.card).padding(12.0).gap(4.0).border(1.0, color);
28- let head = text(format!("#{id} {} · {}", if state == "review" { "on trial" } else { state }, b["title"].as_str().unwrap_or("")))
29- .font(tok::type_::LABEL).color(color).w_full().truncate();
30- if state == "review" {
31- return toast.child(head).child(text(said).color(t.text).w_full().wrap())
32- .child(row().w_full().gap(8.0).center_y()
33- .child(text("Try it, or Ctrl+click it to follow up").font(tok::type_::LABEL).color(t.text_secondary).grow(1.0))
34- .child(decide(id, "discard", "Discard", t.hover))
35- .child(decide(id, "keep", "Keep", tok::accent(0, true))));
36- }
37- toast.role("button").label("Dismiss").hover(t.hover)
38- .on_press_tx(move |s: &mut State, _| { s.seen.insert(id); save_ids(s.live.base(), "seen", &s.seen); })
39- .child(head).child(text(said).color(t.text).w_full().wrap())
40- .child(text(if state == "done" { "Click to dismiss" } else { "Ctrl+click the widget to follow up · click to dismiss" }).font(tok::type_::LABEL).color(t.text_secondary))
41-}
42-
43-/// Keep or Discard a build on trial. A kept build has nothing more to say; a discarded one goes
44-/// back to draft, and speaks again if it's built again.
45-fn decide(id: u64, op: &'static str, label: &'static str, fill: rune::Color) -> El {
46- let t = tok::theme(true);
47- row().key(format!("{op}-{id}")).h(28.0).px(12.0).center_y().radius(6.0).fill(fill).role("button").label(label)
48- .on_press_tx(move |s: &mut State, _| {
49- if op == "keep" { s.seen.insert(id); save_ids(s.live.base(), "seen", &s.seen); }
50- client::send(serde_json::json!({"op": op, "id": id}).to_string());
51- })
52- .child(text(label).font(tok::type_::LABEL).color(if op == "keep" { t.bg } else { t.text }))
53-}
54-
55-pub fn view(s: &State) -> El {
56- let t = tok::theme(true);
57- let now = crate::api::now() as u64;
58- let mut out = col().key("status").absolute(0.0, 0.0).w_full().h_full().padding(12.0).gap(8.0).items_end().justify_end();
59- if !s.connected { out = out.child(text("conveyord isn't running").color(t.text_secondary)); }
60- for b in &s.builds {
61- let state = b["state"].as_str().unwrap_or("");
62- let id = b["id"].as_u64().unwrap_or(0);
63- if FINISHED.contains(&state) {
64- if !s.seen.contains(&id) { out = out.child(toast(b)); }
65- } else if state != "draft" {
66- out = out.child(pill(b, now));
67- }
68- }
69- out
70-}
crates/conveyor/src/library.rs+6−0
@@ -49,6 +49,12 @@ pub fn ensure() -> Result<(), String> {
4949 for f in OWNED.into_iter().filter(|f| fs::read(tpl.join(f)).ok() != fs::read(lib.join(f)).ok()) {
5050 fs::copy(tpl.join(f), lib.join(f)).map_err(|e| e.to_string())?;
5151 }
52+ // The app draws `status` over the window. A library made before it gets the template's,
53+ // unless it had one once and deleted it.
54+ let status = "widgets/status.rs";
55+ if !lib.join(status).exists() && git(&lib, "", &["log", "--all", "-1", "--format=%h", "--", status])?.is_empty() {
56+ fs::copy(tpl.join(status), lib.join(status)).map_err(|e| e.to_string())?;
57+ }
5258 git(&lib, "", &["add", "-A"])?;
5359 if !git(&lib, "", &["status", "--porcelain"])?.is_empty() {
5460 git(&lib, "", &[&COMMIT[..], &["commit", "-qm", "Conveyor's library files"]].concat())?;
templates/library/CLAUDE.md+2−2
@@ -1,6 +1,6 @@
11 # Widget library
22
3-This repo is the user's whole app. The conveyor window draws `widgets/root.rs` and nothing else, so everything the user sees is a widget here: the title bar, the canvas, panes, lists, boards. Conveyor only adds the building tool on top: the user holds Ctrl, clicks any widget, and types what they want. Each ticket is those words.
3+This repo is the user's whole app. The conveyor window draws `widgets/root.rs`, and `widgets/status.rs` over it (build status: what's building, and Keep or Discard for a build on trial), and nothing else. So everything the user sees is a widget here: the title bar, the canvas, panes, lists, boards, build status. Conveyor only adds the building tool on top: the user holds Ctrl, clicks any widget, and types what they want. Each ticket is those words.
44
55 ## What the ticket tells you
66
@@ -26,7 +26,7 @@ A widget is a struct with its own state that renders itself (`api::View`). Read
2626 - **Compose.** `cx.child("kind", "key")` renders another widget inside this one, with its own state and folder. Keep keys stable. A layout widget (root is one) is mostly children.
2727 - **Place new widgets yourself.** For "put an X here", either render X with `cx.child` in the parent you change, or, where a parent holds a free list of children (the canvas), run `conveyor place <kind> --in <instance>`: the app offers it to that instance's `View::mount`, at the user's click when the click was inside it. Nothing is placed unless you say so, so don't do both. A widget that keeps a list of children skips kinds the library no longer has (`cx.kinds()`): a discarded build's widgets g …
2828 - **Conveyor's data.** `cx.data` has the projects, every ticket (with its text, times, attached files and conversation) and the latest activity, refreshed every second. Never read conveyor's own files: if something is missing from `cx.data`, say so with `conveyor deviate`.
29-- **Act on conveyor.** From a handler: `set_state(h, project, id, "ready")` moves a ticket and shows the move at once (ready starts an agent when the project has a free slot; conveyor owns running), `new_ticket(h, project, title, body, state, &files)` writes one with files attached (the agent gets them), `edit_ticket(h, project, id, title, body)` rewrites one in place, `add_project(h, slug, &path)` adds a project, `set_slots(h, project, n)` sets how many tickets run at once (0 pauses it). `tx.op …
29+- **Act on conveyor.** From a handler: `set_state(h, project, id, "ready")` moves a ticket and shows the move at once (ready starts an agent when the project has a free slot; conveyor owns running), `new_ticket(h, project, title, body, state, &files)` writes one with files attached (the agent gets them), `edit_ticket(h, project, id, title, body)` rewrites one in place, `add_project(h, slug, &path)` adds a project, `set_slots(h, project, n)` sets how many tickets run at once (0 pauses it), `keep_ …
3030 - **Act from anywhere.** In `view`, `update` or `event`, where there's no handler, `cx.act(move |l| l.new_ticket(...))` does the same: the `Live` methods of the same names.
3131 - **Draw.** Rune draws vector shapes (`rune::Shape`: lines, paths, arcs) with `.shape(...)`, blurs what's behind an element with `.backdrop_blur(sigma)`, and stacks absolute elements in the order you add them.
3232 - **Share.** `share(h, "project", "dotfiles")` in a handler (or `cx.act(|l| l.share(..))` anywhere), and `cx.shared("project")` in any widget's view: a sidebar picks, a board follows. Shared values survive restarts.
templates/library/api.rs+16−0
@@ -52,6 +52,8 @@ pub struct Data {
5252 pub tickets: Vec<Ticket>,
5353 /// The latest 200 events, oldest first.
5454 pub activity: Vec<Activity>,
55+ /// Whether conveyord answers. Without it, everything above is as it last was.
56+ pub connected: bool,
5557 }
5658
5759 // ── Widgets ─────────────────────────────────────────────────────────────────────────────────
@@ -214,6 +216,11 @@ pub fn set_slots(h: &mut HostState, project: &str, slots: u32) {
214216 Host::live(h).set_slots(project, slots)
215217 }
216218
219+/// Keeps a widget build on trial (merges it into the library) or discards it. See `Live::keep_build`.
220+pub fn keep_build(h: &mut HostState, id: u32, keep: bool) {
221+ Host::live(h).keep_build(id, keep)
222+}
223+
217224 /// A JSON string literal.
218225 pub fn quote(s: &str) -> String {
219226 let mut out = String::from("\"");
@@ -298,6 +305,15 @@ impl Live {
298305 self.call(format!("{{\"op\":\"project\",\"slug\":{},\"path\":{}}}", quote(slug), quote(&path.to_string_lossy())));
299306 }
300307
308+ /// The user's call on a widget build on trial (a `widgets` ticket in review): keep merges it
309+ /// into the library, discard sends it back to draft and the app drops it. Shown at once.
310+ pub fn keep_build(&mut self, id: u32, keep: bool) {
311+ if let Some(t) = self.data.tickets.iter_mut().find(|t| t.project == "widgets" && t.id == id && t.state == "review") {
312+ (t.state, t.since) = ((if keep { "done" } else { "draft" }).to_owned(), now() as u64);
313+ }
314+ self.call(format!("{{\"op\":\"{}\",\"id\":{id}}}", if keep { "keep" } else { "discard" }));
315+ }
316+
301317 /// How many of a project's tickets run at once. 0 pauses it. Shown at once.
302318 pub fn set_slots(&mut self, project: &str, slots: u32) {
303319 if let Some(p) = self.data.projects.iter_mut().find(|p| p.slug == project) { p.slots = slots; }
templates/library/preview/src/main.rs+6−1
@@ -48,9 +48,11 @@ fn sample() -> Data {
4848 t("dotfiles", 8, "done", "Add a git alias for amend", 7200),
4949 t("game", 1, "running", "Player movement", 90),
5050 t("game", 2, "failed", "Sound effects", 10),
51+ t("widgets", 6, "review", "Show the time in the title bar", 30),
5152 ];
5253 tickets[0].thread.push(a(240, "conveyor", 1, "decide", "Use a ring buffer for activity — bounded memory"));
5354 tickets[2].thread.push(a(60, "conveyor", 3, "block", "Needs the signing key — recommends: add it to the vault"));
55+ tickets[9].thread.push(a(30, "widgets", 6, "reply", "The title bar now shows your local time as HH:MM, left of the window buttons."));
5456 Data {
5557 projects: vec![p("conveyor"), p("dotfiles"), p("game")],
5658 activity: vec![
@@ -61,6 +63,7 @@ fn sample() -> Data {
6163 a(10, "game", 2, "state", "failed"),
6264 ],
6365 tickets,
66+ connected: true,
6467 }
6568 }
6669
@@ -71,7 +74,7 @@ fn replay(state: &Path, base: &Path) -> (Data, Option<(String, String)>) {
7174 for f in ["w", "shared.tsv"].map(|f| state.join(f)).iter().filter(|f| f.exists()) {
7275 let _ = std::process::Command::new("cp").arg("-r").arg(f).arg(base).status();
7376 }
74- let data = Data::from_tsv(&std::fs::read_to_string(state.join("data.tsv")).unwrap_or_default());
77+ let data = Data { connected: true, ..Data::from_tsv(&std::fs::read_to_string(state.join("data.tsv")).unwrap_or_default()) };
7578 let click = std::fs::read_to_string(state.join("click")).ok()
7679 .and_then(|c| c.trim_end_matches('\n').split_once('\t').map(|(i, e)| (i.to_owned(), e.to_owned())));
7780 (data, click)
@@ -97,6 +100,8 @@ fn init() -> State {
97100
98101 fn view(s: &State, rcx: &mut rune::Cx<State>) -> El {
99102 let mut window = el().w_full().h_full().child(s.live.render(&s.kind, "root"));
103+ // As in the app: build status over the window.
104+ if s.kind == "root" { window = window.child(el().absolute(0.0, 0.0).w_full().h_full().child(s.live.render("status", "status"))); }
100105 if let Some((id, element)) = &s.click {
101106 let orange = rune::Color { r: 1.0, g: 0.55, b: 0.1, a: 1.0 };
102107 let instance = rcx.layout(&format!("w:{id}"));
templates/library/widgets/status.rs+85−0
@@ -0,0 +1,85 @@
1+//! Widget builds, bottom right: a pill per build in flight, and the agent's reply when one
2+//! finishes. A build on trial is live in the app until Keep merges it or Discard drops it; a
3+//! failed or parked build's reply goes once it's clicked away. The app draws this widget over
4+//! the whole window, so it fills the window and places its own parts.
5+use super::api::*;
6+use rune::{Color, El, col, row, text, tok};
7+use std::{collections::BTreeSet, path::PathBuf};
8+
9+pub const WIDGET: Widget = Widget { title: "Build status", size: (0.0, 0.0), new: |cx| Box::new(Status::load(cx)) };
10+
11+pub struct Status {
12+ /// When this widget first ran (replies older than that aren't news), and replies clicked away.
13+ born: u64,
14+ seen: BTreeSet<u64>,
15+ file: PathBuf,
16+}
17+
18+impl Status {
19+ fn load(cx: &Cx) -> Self {
20+ let file = cx.dir.join("seen");
21+ let saved = std::fs::read_to_string(&file).unwrap_or_else(|_| (now() as u64).to_string());
22+ let mut ids = saved.split_whitespace().filter_map(|w| w.parse().ok());
23+ let s = Status { born: ids.next().unwrap_or(0), seen: ids.collect(), file };
24+ s.save();
25+ s
26+ }
27+
28+ fn save(&self) {
29+ let ids: String = self.seen.iter().map(|i| format!(" {i}")).collect();
30+ let _ = std::fs::write(&self.file, format!("{}{ids}\n", self.born));
31+ }
32+}
33+
34+impl View for Status {
35+ fn view(&self, cx: &Cx) -> El {
36+ let t = tok::theme(true);
37+ let mut out = col().w_full().h_full().padding(12.0).gap(8.0).items_end().justify_end();
38+ if !cx.data.connected { out = out.child(text("conveyord isn't running").color(t.text_secondary)); }
39+ for b in cx.data.tickets.iter().filter(|b| b.project == "widgets") {
40+ out = match b.state.as_str() {
41+ "ready" | "running" => out.child(pill(b, cx.now as u64)),
42+ "review" => out.child(toast(b, cx)),
43+ "failed" | "parked" if b.since > self.born && !self.seen.contains(&(b.id as u64)) => out.child(toast(b, cx)),
44+ _ => out,
45+ };
46+ }
47+ out
48+ }
49+}
50+
51+fn pill(b: &Ticket, now: u64) -> El {
52+ let t = tok::theme(true);
53+ let secs = now.saturating_sub(b.since);
54+ row().key(format!("pill-{}", b.id)).h(28.0).px(10.0).gap(8.0).center_y().radius(14.0).fill(t.card)
55+ .child(text(format!("#{} {}", b.id, b.state)).font(tok::type_::LABEL).color(tok::accent(0, true)))
56+ .child(text(b.title.clone()).font(tok::type_::LABEL).color(t.text))
57+ .child(text(format!("{}:{:02}", secs / 60, secs % 60)).font(tok::type_::LABEL).color(t.text_secondary))
58+}
59+
60+fn toast(b: &Ticket, cx: &Cx) -> El {
61+ let t = tok::theme(true);
62+ let (id, trial, color) = (b.id, b.state == "review", tok::accent(1, true));
63+ let said = b.thread.iter().rev().find(|e| matches!(e.kind.as_str(), "reply" | "block" | "error")).map_or("", |e| &e.text);
64+ let head = text(format!("#{id} {} · {}", if trial { "on trial" } else { &b.state }, b.title))
65+ .font(tok::type_::LABEL).color(color).w_full().truncate();
66+ let toast = col().key(format!("toast-{id}")).w(380.0).radius(10.0).fill(t.card).padding(12.0).gap(4.0).border(1.0, color)
67+ .child(head).child(text(said.to_owned()).color(t.text).w_full().wrap());
68+ if trial {
69+ return toast.child(row().w_full().gap(8.0).center_y()
70+ .child(text("Try it, or Ctrl+click it to follow up").font(tok::type_::LABEL).color(t.text_secondary).grow(1.0))
71+ .child(decide(id, false, t.hover, t.text))
72+ .child(decide(id, true, tok::accent(0, true), t.bg)));
73+ }
74+ toast.role("button").label("Dismiss").hover(t.hover)
75+ .on_press_tx(on(cx.id, move |s: &mut Status, _| { s.seen.insert(id as u64); s.save(); }))
76+ .child(text("Ctrl+click the widget to follow up · click to dismiss").font(tok::type_::LABEL).color(t.text_secondary))
77+}
78+
79+/// Keep merges a build on trial into the library; Discard sends it back to draft.
80+fn decide(id: u32, keep: bool, fill: Color, ink: Color) -> El {
81+ let (key, label) = if keep { ("keep", "Keep") } else { ("discard", "Discard") };
82+ row().key(format!("{key}-{id}")).h(28.0).px(12.0).center_y().radius(6.0).fill(fill).role("button").label(label)
83+ .on_press_tx(move |h: &mut HostState, _| keep_build(h, id, keep))
84+ .child(text(label).font(tok::type_::LABEL).color(ink))
85+}