xonecas.io
8447
Co

conveyor / commit 7e2cc40

Builder v5: builds go on trial, explicit placement, actions anywhere

- A finished widget build goes on trial: the app runs from a worktree of
  main plus every build in review. Keep merges it, Discard sends it back
  to draft. New builds start from the trial.
- Placement is the agent's call: conveyor place <kind> --in <instance>.
  The heuristics (created kinds, child("kind" grep, zero size) are gone.
- cx.act(|live| ..) acts from view, update and event; the free handler
  functions delegate to the same Live methods.
- cx.keep_running() brings an instance back after a restart while it has
  hidden work, such as music playing.
- An edit op and edit_ticket rewrite a ticket that isn't running.
- set_state ignores moves to the state a ticket is already in.
- DESIGN.md records that widgets run with all of the user's permissions.

Co-Authored-By: Claude Opus 5.5

sacenox2026-11-09 7e2cc40e2869631f092e84e6b0bfc007d142f3b3 parent 217a0f9

12 files changed

DESIGN.md+10−4
@@ -189,9 +189,11 @@ window ─ core draws ─► root (library) core, drawn above t
189189 └ kanban | dashboard · prompt form: that kind's conversation
190190 · status pills, reply toasts
191191 Ctrl+click ─► conveyord: widgets ticket (kind, instance chain, tree, shared, thread)
192- ─► VM: claude edits widgets/, checks with the preview, `conveyor done`
193- ─► merge ─► cargo build ─► (fails: reset) ─► app exec()s itself
194- ─► new kinds nobody renders are offered to the clicked instance, then its parents
192+ ─► VM: claude starts from the trial, edits widgets/, checks with the preview,
193+ `conveyor place <kind> --in <instance>` for free children, `conveyor done`
194+ ─► review: trial = main + every build in review ─► cargo build ─► app exec()s itself
195+ ─► the user tries it: Keep ─► merged into main, done
196+ Discard ─► back to draft, trial rebuilt without it
195197 ```
196198
197199 - **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,7 +201,11 @@ Ctrl+click ─► conveyord: widgets ticket (kind, instance chain, tree, shared,
199201 - **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.
200202 - **Widgets are programs**: own state, input, files in `cx.dir`, threads, `curl`, and `cx.animate()` for frame-rate redraws.
201203 - **The click is the context.** A build ticket carries the clicked kind, the instance and its parents with the point in each, every instance on screen, the shared values, and the conversation about that kind so far. The form shows the same conversation, so following up is one more Ctrl+click.
202-- **Main always builds.** Tickets may change only `widgets/`. A merge whose app doesn't compile is reset.
204+- **Merges are the user's.** A finished build goes on trial: the app runs from a worktree (`~/.local/share/conveyor/trial`) of main plus every build in review, so a temporary widget lives in the real app until its toast's Keep merges it or Discard sends it back to draft. A build that doesn't compile, or conflicts with those on trial, never goes on trial. A build made while others are on trial starts from them, so keeping it keeps what it was built on.
205+- **Placement is explicit.** The app places nothing unless the agent ran `conveyor place`. Guessing placed widgets twice, four times over.
206+- **Widgets act from anywhere.** `cx.act(|live| ..)` does from `view`, `update` and `event` what the free functions do from handlers.
207+- **Hidden work survives restarts.** Instances exist once rendered; `cx.keep_running()` from `update` makes the app bring one back after a restart even when nothing shows it.
208+- **Widgets run with every permission the user has.** They are native code in the app, on the host: any file, any program, the network. The agent that writes them is sandboxed in a VM, the code it writes is not. That's deliberate for now, and may be a feature (a widget can drive the whole machine). Revisit before anyone runs someone else's library.
203209 - **`api.rs` is conveyor's contract**, copied into the library on every start along with `gen.rs`, `CLAUDE.md` and the preview. The preview is the app's own host (`api::Live`) with sample data, so the agent checks exactly what the app runs.
204210 - The app restarts with `exec` on the path it read at launch, and conveyord copies itself into VMs from `/proc/self/exe`: after cargo replaces a binary, `current_exe()` names the deleted file.
205211 - The base image carries the pinned toolchain and a warm `~/.cache/conveyor-target`, so the agent's first preview build is incremental.
crates/conveyor-app/src/app.rs+12−17
@@ -16,8 +16,7 @@ pub struct State {
1616 /// When widgets last sent conveyord a request: a snapshot asked for before it is stale,
1717 /// and would undo what `set_state` already shows.
1818 sent: Instant,
19- /// When this process started rendering: new kinds are placed only once every instance has
20- /// had time to appear, or a kind its parent already renders would be placed twice.
19+ /// When this process started rendering: new widgets are placed once their parents exist.
2120 started: Instant,
2221 /// The binary at launch and its mtime. Read once: after cargo replaces it,
2322 /// current_exe() names the deleted file.
@@ -37,7 +36,7 @@ pub struct State {
3736 pub window: std::cell::Cell<(f32, f32)>,
3837 /// What the form's field binds to in the frame it closes.
3938 pub spare: rune::TextEdit,
40- /// Builds whose reply was dismissed, and builds whose new widgets were placed.
39+ /// Builds whose reply was dismissed or decided, and builds whose new widgets were placed.
4140 pub seen: BTreeSet<u64>,
4241 placed: BTreeSet<u64>,
4342 }
@@ -93,11 +92,11 @@ pub fn poll(s: &mut State, _t: f64, tx: &mut Tx) -> bool {
9392 again = true;
9493 }
9594 if !made && s.started.elapsed() > Duration::from_secs(2) { place(s); } else { tx.wake_after(Duration::from_millis(500)); }
95+ again |= s.live.update();
9696 for r in s.live.take_outbox() {
9797 s.sent = Instant::now();
9898 client::send(r);
9999 }
100- s.live.update();
101100 s.live.save();
102101 if s.live.animating() { tx.wake_after(Duration::from_millis(16)); }
103102 restart(s);
@@ -106,22 +105,18 @@ pub fn poll(s: &mut State, _t: f64, tx: &mut Tx) -> bool {
106105 again || ctrl != s.ctrl
107106 }
108107
109-/// Gives each new widget kind a finished build made a place: the widget clicked takes it, or
110-/// one of its parents. Kinds already on screen (a parent the build changed shows them) are
111-/// left alone.
108+/// Places the new widgets each build on trial asked for (`conveyor place <kind> --in <id>`),
109+/// once: at the click, when that instance was clicked or is one of its parents.
112110 fn place(s: &mut State) {
113111 if s.builds.is_empty() || s.live.kind("root").is_none() { return; }
114- let builds = s.builds.clone();
115112 let first_run = !s.live.base().join("placed").exists();
116- for b in builds.iter().filter(|b| b["state"] == "done") {
117- let id = b["id"].as_u64().unwrap_or(0);
118- if !s.placed.insert(id) || first_run { continue; }
119- let targets: Vec<(String, (f32, f32))> = b["targets"].as_array().into_iter().flatten()
120- .filter_map(|t| Some((t[0].as_str()?.to_owned(), (t[1].as_f64()? as f32, t[2].as_f64()? as f32)))).collect();
121- for kind in b["created"].as_array().into_iter().flatten().filter_map(Value::as_str) {
122- if s.live.ids(kind).is_empty() && s.live.mount(&targets, kind).is_none() {
123- eprintln!("no widget kept the new `{kind}`");
124- }
113+ for b in s.builds.clone().iter().filter(|b| b["state"] == "review" || b["state"] == "done") {
114+ if !s.placed.insert(b["id"].as_u64().unwrap_or(0)) || first_run { continue; }
115+ let at = |id: &str| b["targets"].as_array().into_iter().flatten().find(|t| t[0] == id)
116+ .map_or((40.0, 40.0), |t| (t[1].as_f64().unwrap_or(40.0) as f32, t[2].as_f64().unwrap_or(40.0) as f32));
117+ for p in b["place"].as_array().into_iter().flatten() {
118+ let (kind, id) = (p[0].as_str().unwrap_or(""), p[1].as_str().unwrap_or(""));
119+ if !s.live.mount(id, at(id), kind) { eprintln!("`{id}` didn't keep the new `{kind}`"); }
125120 }
126121 }
127122 save_ids(s.live.base(), "placed", &s.placed);
crates/conveyor-app/src/status.rs+28−7
@@ -1,10 +1,11 @@
11 //! Build status, bottom right: a pill per build in flight, and the agent's reply when one
2-//! finishes, until it's clicked away. Nothing of it stays on screen once read.
3-use crate::app::{State, save_ids};
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};
45 use rune::{El, col, row, text, tok};
56 use serde_json::Value;
67
7-const FINISHED: [&str; 3] = ["done", "failed", "parked"];
8+const FINISHED: [&str; 4] = ["review", "done", "failed", "parked"];
89
910 fn pill(b: &Value, now: u64) -> El {
1011 let t = tok::theme(true);
@@ -23,14 +24,34 @@ fn toast(b: &Value) -> El {
2324 let said = last.and_then(|e| e["text"].as_str()).unwrap_or("").to_owned();
2425 let state = b["state"].as_str().unwrap_or("");
2526 let color = if state == "done" { tok::accent(0, true) } else { tok::accent(1, true) };
26- col().key(format!("toast-{id}")).w(380.0).radius(10.0).fill(t.card).padding(12.0).gap(4.0).role("button").label("Dismiss")
27- .border(1.0, color).hover(t.hover)
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)
2838 .on_press_tx(move |s: &mut State, _| { s.seen.insert(id); save_ids(s.live.base(), "seen", &s.seen); })
29- .child(text(format!("#{id} {state} · {}", b["title"].as_str().unwrap_or(""))).font(tok::type_::LABEL).color(color).w_full().truncate())
30- .child(text(said).color(t.text).w_full().wrap())
39+ .child(head).child(text(said).color(t.text).w_full().wrap())
3140 .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))
3241 }
3342
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+
3455 pub fn view(s: &State) -> El {
3556 let t = tok::theme(true);
3657 let now = crate::widgets::api::now() as u64;
crates/conveyor/src/agent.rs+4−9
@@ -35,7 +35,8 @@ fn run(p: &Project, id: u32) -> Result<String, String> {
3535 vm.sh("git init -q -b main ~/work && cd ~/work && git config receive.denyCurrentBranch updateInstead \
3636 && git config user.name conveyor && git config user.email conveyor@localhost", b"")?;
3737 let (url, git_ssh) = vm.git_remote("/home/sacenox/work");
38- git(&p.path, &git_ssh, &["push", "-q", &url, "main:main"])?;
38+ // A widget build starts from what the user sees: the library with every build on trial.
39+ git(&p.path, &git_ssh, &["push", "-q", &url, if p.library { library::BASE } else { "main:main" }])?;
3940 vm.sh(&format!("cd ~/work && git switch -qc {branch}"), b"")?;
4041 let files = give_files(&vm, p, id)?;
4142
@@ -66,15 +67,9 @@ fn run(p: &Project, id: u32) -> Result<String, String> {
6667 Ok(match outcome {
6768 Outcome::Blocked => "parked".into(),
6869 Outcome::None => "failed".into(),
70+ Outcome::Done(_) if p.library => { library::try_out(p, id, &branch)?; "review".into() }
6971 Outcome::Done(_) if !p.auto_merge => "review".into(),
70- Outcome::Done(_) => {
71- if p.library {
72- library::install(p, id, &branch)?;
73- } else {
74- git(&p.path, "", &["merge", "-q", "--no-edit", &branch])?;
75- }
76- "done".into()
77- }
72+ Outcome::Done(_) => { git(&p.path, "", &["merge", "-q", "--no-edit", &branch])?; "done".into() }
7873 })
7974 }
8075
crates/conveyor/src/library.rs+65−32
@@ -1,11 +1,14 @@
11 //! The widget library: the `widgets` project. A Ctrl+click in the app becomes a build ticket
2-//! there, carrying what was clicked; a done ticket is merged and the app rebuilt with it.
2+//! there, carrying what was clicked. A finished build goes on trial: the app is rebuilt from
3+//! main plus every build in review, and the user keeps (merges) or discards each one.
34 use crate::{agent::git, paths, store::{self, Project}, thread, vm};
45 use serde::{Deserialize, Serialize};
56 use serde_json::{Value, json};
6-use std::{fs, process::Command, sync::Mutex};
7+use std::{fs, path::Path, process::Command, sync::Mutex};
78
89 pub const SLUG: &str = "widgets";
10+/// What a widget build's agent starts from: the library as the user sees it, with the trial.
11+pub const BASE: &str = "trial:main";
912 static BUILD: Mutex<()> = Mutex::new(());
1013
1114 /// Conveyor's side of the library: kept in step with the template on every start.
@@ -20,11 +23,12 @@ pub struct Build {
2023 pub kind: String,
2124 /// The instance clicked and then its parents, each with the point clicked in its own points.
2225 pub targets: Vec<(String, f32, f32)>,
23- /// Widget kinds the merged branch added, and every kind it touched.
24- #[serde(default)]
25- pub created: Vec<String>,
26+ /// Every kind the branch touched.
2627 #[serde(default)]
2728 pub changed: Vec<String>,
29+ /// New widgets the agent asked to have placed (`conveyor place`), as (kind, instance).
30+ #[serde(default)]
31+ pub place: Vec<(String, String)>,
2832 }
2933
3034 fn build(id: u32) -> Option<Build> {
@@ -50,8 +54,10 @@ pub fn ensure() -> Result<(), String> {
5054 git(&lib, "", &[&COMMIT[..], &["commit", "-qm", "Conveyor's library files"]].concat())?;
5155 }
5256 if store::project(SLUG).is_none() {
53- store::save_project(&Project { slug: SLUG.into(), path: lib, slots: 2, auto_merge: true, library: true });
57+ store::save_project(&Project { slug: SLUG.into(), path: lib, slots: 2, auto_merge: false, library: true });
5458 }
59+ // main may have moved (conveyor's files above): the trial and the app follow it.
60+ std::thread::spawn(|| if let Err(e) = trial(None) { eprintln!("library trial: {e}") });
5561 Ok(())
5662 }
5763
@@ -102,41 +108,68 @@ fn title(prompt: &str) -> String {
102108 if t.is_empty() { "widget".into() } else { t }
103109 }
104110
105-/// Merges a done build ticket into the library, then rebuilds the app with it.
106-pub fn install(p: &Project, id: u32, branch: &str) -> Result<(), String> {
107- let range = format!("main...{branch}");
108- let changed = git(&p.path, "", &["diff", "--name-only", &range])?;
111+/// A finished build: checks it only touches widgets/, records what it changed and where it
112+/// asked its new widgets placed, then puts it on trial.
113+pub fn try_out(p: &Project, id: u32, branch: &str) -> Result<(), String> {
114+ let changed = git(&p.path, "", &["diff", "--name-only", &format!("main...{branch}")])?;
109115 if let Some(f) = changed.lines().find(|f| !f.starts_with("widgets/")) {
110116 return Err(format!("the branch changes {f}, which is conveyor's; only widgets/ is the library's"));
111117 }
112- let kinds = |list: String| list.lines().filter_map(|f| f.strip_prefix("widgets/")?.strip_suffix(".rs").map(String::from)).collect::<Vec<_>>();
113- let created = kinds(git(&p.path, "", &["diff", "--name-only", "--diff-filter=A", &range])?);
114- git(&p.path, "", &[&COMMIT[..], &["merge", "-q", "--no-edit", branch]].concat())?;
115- store::event(SLUG, id, json!({"kind": "conveyor", "msg": "merged; rebuilding the app"}));
116- // A library that doesn't build never stays on main: the app could not restart into it.
117- if let Err(e) = rebuild_app() {
118- git(&p.path, "", &["reset", "-q", "--hard", "ORIG_HEAD"])?;
119- return Err(format!("the app doesn't build with this branch, so it was not merged:\n{e}"));
120- }
121118 let mut b = build(id).unwrap_or_default();
122- let created = created.into_iter().filter(|k| !rendered(&p.path, k)).collect();
123- (b.created, b.changed) = (created, kinds(changed));
119+ b.changed = changed.lines().filter_map(|f| f.strip_prefix("widgets/")?.strip_suffix(".rs").map(String::from)).collect();
120+ b.place = store::events(SLUG, id).iter().filter(|e| e["verb"] == "place")
121+ .filter_map(|e| Some((e["args"]["text"].as_str()?.to_owned(), e["args"]["in"].as_str()?.to_owned()))).collect();
124122 save_build(id, &b);
125- Ok(())
123+ trial(Some(id)).inspect_err(|_| { let _ = trial(None); })
126124 }
127125
128-/// Some widget renders this kind itself (`child("kind"`), so the app must not place it too,
129-/// even while that parent keeps it off screen.
130-fn rendered(library: &std::path::Path, kind: &str) -> bool {
131- let call = format!("child(\"{kind}\"");
132- std::fs::read_dir(library.join("widgets")).into_iter().flatten().flatten()
133- .any(|f| std::fs::read_to_string(f.path()).is_ok_and(|src| src.contains(&call)))
126+/// Keeps a build on trial: merges it into main. What it was built on comes with it.
127+pub fn keep(id: u32) -> Result<(), String> {
128+ store::ticket(SLUG, id).filter(|t| t.state == "review").ok_or("that build isn't on trial")?;
129+ let lib = paths::library();
130+ if let Err(e) = git(&lib, "", &[&COMMIT[..], &["merge", "-q", "--no-edit", &format!("t-{id}")]].concat()) {
131+ let _ = git(&lib, "", &["merge", "--abort"]);
132+ return Err(e);
133+ }
134+ store::set_state(SLUG, id, "done");
135+ store::event(SLUG, id, json!({"kind": "conveyor", "msg": "kept: merged into the library"}));
136+ trial(None)
134137 }
135138
136-/// The app restarts itself when its binary changes.
137-fn rebuild_app() -> Result<(), String> {
139+/// Discards a build on trial: back to draft, out of the app. Ready builds it again.
140+pub fn discard(id: u32) -> Result<(), String> {
141+ store::ticket(SLUG, id).filter(|t| t.state == "review").ok_or("that build isn't on trial")?;
142+ store::set_state(SLUG, id, "draft");
143+ store::event(SLUG, id, json!({"kind": "conveyor", "msg": "discarded: back to draft"}));
144+ trial(None)
145+}
146+
147+/// Rebuilds the app from main plus every build in review, then `fresh`, oldest first. A build
148+/// that conflicts with those before it is left off and told so. The app restarts itself when
149+/// its binary changes.
150+fn trial(fresh: Option<u32>) -> Result<(), String> {
138151 let _one = BUILD.lock().unwrap();
139- vm::run(Command::new("cargo").current_dir(paths::source()).env("CONVEYOR_LIBRARY", paths::library())
152+ let (lib, dir) = (paths::library(), paths::trial());
153+ if !dir.exists() { git(&lib, "", &["worktree", "add", "-q", "--detach", &dir.to_string_lossy(), "main"])?; }
154+ git(&dir, "", &["reset", "-q", "--hard", "main"])?;
155+ let ids: Vec<u32> = store::tickets(SLUG).iter().filter(|t| t.state == "review").map(|t| t.id).chain(fresh).collect();
156+ for id in ids {
157+ if let Err(e) = git(&dir, "", &[&COMMIT[..], &["merge", "-q", "--no-edit", &format!("t-{id}")]].concat()) {
158+ let _ = git(&dir, "", &["merge", "--abort"]);
159+ let why = format!("it conflicts with the builds on trial before it; keep or discard those first\n{e}");
160+ if Some(id) == fresh { return Err(why); }
161+ store::event(SLUG, id, json!({"kind": "error", "msg": format!("left off the trial: {why}")}));
162+ }
163+ }
164+ git(&dir, "", &["update-ref", "refs/heads/trial", "HEAD"])?;
165+ build_app(&dir).map_err(|e| format!("the app doesn't build with this branch:\n{e}"))?;
166+ // Still under the lock, so the next trial includes it.
167+ if let Some(id) = fresh { store::set_state(SLUG, id, "review"); }
168+ Ok(())
169+}
170+
171+fn build_app(library: &Path) -> Result<(), String> {
172+ vm::run(Command::new("cargo").current_dir(paths::source()).env("CONVEYOR_LIBRARY", library)
140173 .args(["build", "--release", "-q", "-p", "conveyor-app"])).map(|_| ())
141174 }
142175
@@ -144,6 +177,6 @@ fn rebuild_app() -> Result<(), String> {
144177 pub fn builds() -> Vec<Value> {
145178 store::tickets(SLUG).into_iter().filter_map(|t| {
146179 let b = build(t.id)?;
147- Some(json!({"id": t.id, "kind": b.kind, "targets": b.targets, "created": b.created, "changed": b.changed}))
180+ Some(json!({"id": t.id, "kind": b.kind, "targets": b.targets, "changed": b.changed, "place": b.place}))
148181 }).collect()
149182 }
crates/conveyor/src/paths.rs+5−0
@@ -18,6 +18,11 @@ pub fn library() -> PathBuf {
1818 data().join("library")
1919 }
2020
21+/// A worktree of the library: main plus every widget build on trial. The app is built from it.
22+pub fn trial() -> PathBuf {
23+ data().join("trial")
24+}
25+
2126 pub fn base_image() -> PathBuf {
2227 data().join("images/base.qcow2")
2328 }
crates/conveyor/src/server.rs+6−0
@@ -5,6 +5,9 @@
55 //! {"op":"ticket","project":"…","title":"…","body":"…","state":"draft","files":["/abs/path"]}
66 //! state defaults to ready; files are copied in
77 //! {"op":"set","project":"…","id":3,"state":"review"} move a ticket; `running` is conveyor's
8+//! {"op":"edit","project":"…","id":3,"title":"…","body":"…"} rewrite a ticket that isn't running
9+//! {"op":"keep","id":5} / {"op":"discard","id":5} a widget build on trial: merge it into the
10+//! library, or send it back to draft
811 //! {"op":"project","slug":"…","path":"/abs/dir"} add a project: a git repo, or a new or empty
912 //! folder, which becomes one
1013 //! {"op":"project","slug":"…","slots":0} how many tickets run at once; 0 pauses it
@@ -42,6 +45,9 @@ fn handle(r: &Value) -> Value {
4245 store::attach(s("project"), id, &files).map(|_| json!({"id": id}))
4346 }
4447 "set" => set(s("project"), id, s("state")),
48+ "edit" => store::edit(s("project"), id, s("title"), s("body")).map(|_| json!({"ok": true})),
49+ "keep" => library::keep(id).map(|_| json!({"ok": true})),
50+ "discard" => library::discard(id).map(|_| json!({"ok": true})),
4551 "project" => project(s("slug"), r),
4652 _ => Err("bad request".into()),
4753 };
crates/conveyor/src/store.rs+13−1
@@ -96,13 +96,25 @@ pub fn create(project: &str, title: &str, body: &str, state: &str) -> u32 {
9696
9797 pub fn set_state(project: &str, id: u32, state: &str) {
9898 let _w = WRITE.lock().unwrap();
99- let Some(mut t) = ticket(project, id) else { return };
99+ let Some(mut t) = ticket(project, id).filter(|t| t.state != state) else { return };
100100 t.state = state.into();
101101 write(&t);
102102 drop(_w);
103103 event(project, id, json!({"kind": "state", "state": state}));
104104 }
105105
106+/// Rewrites a ticket's title and body. A running ticket's text is the agent's, so it's refused.
107+pub fn edit(project: &str, id: u32, title: &str, body: &str) -> Result<(), String> {
108+ let _w = WRITE.lock().unwrap();
109+ let mut t = ticket(project, id).ok_or("no such ticket")?;
110+ if t.state == "running" { return Err("an agent is working this ticket: edit it once it settles".into()); }
111+ (t.title, t.body) = (title.replace('\n', " "), body.into());
112+ write(&t);
113+ drop(_w);
114+ event(project, id, json!({"kind": "conveyor", "msg": "edited"}));
115+ Ok(())
116+}
117+
106118 /// Appends one event, stamped with the time, to the ticket's timeline.
107119 pub fn event(project: &str, id: u32, mut ev: Value) {
108120 let secs = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs();
crates/conveyor/src/verbs.rs+3−1
@@ -12,7 +12,7 @@ use std::{
1212 time::Duration,
1313 };
1414
15-pub const VERBS: [&str; 5] = ["note", "decide", "deviate", "block", "done"];
15+pub const VERBS: [&str; 6] = ["note", "decide", "deviate", "block", "place", "done"];
1616
1717 /// Flags each verb must have, besides its text.
1818 fn required(verb: &str) -> &'static [&'static str] {
@@ -20,6 +20,7 @@ fn required(verb: &str) -> &'static [&'static str] {
2020 "decide" => &["why"],
2121 "deviate" => &["recommend"],
2222 "block" => &["reason", "recommend"],
23+ "place" => &["in"],
2324 _ => &[],
2425 }
2526 }
@@ -27,6 +28,7 @@ fn required(verb: &str) -> &'static [&'static str] {
2728 fn reply(verb: &str) -> &'static str {
2829 match verb {
2930 "note" => "Noted.",
31+ "place" => "Recorded: the app offers it to that instance when your branch goes on trial.",
3032 "decide" => "Recorded. Continue on your choice.",
3133 "deviate" => "Recorded and shown to the user. Continue on your recommended path; the user can overrule it later.",
3234 "block" => "Ticket parked and shown to the user. Do not work around the blocker. Finish anything that does not depend on it, then stop.",
templates/library/CLAUDE.md+7−5
@@ -24,14 +24,16 @@ Only `widgets/`. Everything else is conveyor's (`api.rs`, `gen.rs`, `preview/`,
2424 A widget is a struct with its own state that renders itself (`api::View`). Read `api.rs`: it's short and it's the whole contract.
2525
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.
27-- **New widgets placed for you.** When your branch adds a widget kind and nothing on screen shows it yet, the app offers it to the widget the user clicked (`View::mount`, at the click, in its own points), then to each parent. A widget that holds a list of children (the canvas) keeps it there. So for "put an X here": write the X, and either let mount place it, or render it yourself with `cx.child` in the parent you change. Don't do both.
27+- **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), `add_project(h, slug, &path)` adds a project, `set_slots(h, project, n)` sets how many tickets run at once (0 pauses it). `tx.open_folder(...)` and `tx.open_file(...)` show the system's dialogs.
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 …
30+- **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.
3031 - **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.
31-- **Share.** `share(h, "project", "dotfiles")` in a handler, and `cx.shared("project")` in any widget's view: a sidebar picks, a board follows. Shared values survive restarts.
32+- **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.
3233 - **Input.** Buttons, fields, keys, drags, file drops on an element (`on_drop_files`). Reach the widget's state from a handler with `on`, `edit` or `get`.
3334 - **Window-wide events.** A paste with no text field focused, or files dropped on the window, arrive at `View::event` (pasted images are saved as PNGs first). Every instance is offered it, innermost first.
34-- **Writable state each frame.** `View::update(&mut self, cx)` runs before every render: note what changed in `cx.data`, step an animation's state. Keep `view` a pure drawing of state.
35+- **Writable state each frame.** `View::update(&mut self, cx)` runs before every render, for every instance, shown or not: note what changed in `cx.data`, step an animation's state. Keep `view` a pure drawing of state.
36+- **Work that goes on off screen.** An instance exists once something renders it, and the app restarts on every library change. If it must keep going while hidden, such as music playing, call `cx.keep_running()` in `update` while it does: the app then brings it back after a restart even when no parent shows it.
3537 - **Key what a user can point at.** Give cards, buttons, columns and panes stable, meaningful keys (`card-{id}`, `col-done`, `add-project`). The Ctrl+click outline and the ticket's element path come from keys; unkeyed parts are invisible to the builder.
3638 - **Animate.** Call `cx.animate()` in `view` while something moves, and draw from `cx.now`. Without it the app renders once a second.
3739 - **Files.** `cx.dir` is the instance's own folder and survives restarts. The app restarts whenever the library changes, so save what the user typed or arranged, as it changes.
@@ -93,6 +95,6 @@ Rune's docs are in the cargo git checkout: `~/.cargo/git/checkouts/rune-*/*/crat
9395
9496 ## Finish
9597
96-Commit your changes to `widgets/`, then run `conveyor done "<kinds>: <one line>"`.
98+Commit your changes to `widgets/`, then run `conveyor done "<kinds>: <one line>"`. Your branch then goes on trial: the user's app runs with it, and they keep it (it's merged) or discard it. You started from what they see, builds still on trial included.
9799
98100 The user reads your last message in a small toast. Write two short lines at most: what they'll see, and anything they should know. No headings, no lists.
templates/library/api.rs+126−47
@@ -1,8 +1,8 @@
11 //! The contract between this library and conveyor. Conveyor owns this file and replaces it
22 //! when it changes. Everything in widgets/ is the library's, starting with root.rs: the app
33 //! draws `root` and nothing else, so the whole UI is widgets.
4-use rune::{El, TextEdit, Tx, col, text, tok};
5-use std::{any::Any, cell::{Cell, RefCell}, collections::{BTreeMap, HashMap}, path::{Path, PathBuf}};
4+use rune::{El, TextEdit, Tx, col};
5+use std::{any::Any, cell::{Cell, RefCell}, collections::{BTreeMap, BTreeSet, HashMap}, path::{Path, PathBuf}};
66
77 // ── What widgets read: conveyor's state ─────────────────────────────────────────────────────
88
@@ -77,9 +77,9 @@ pub trait View: Any {
7777 fn event(&mut self, _event: &Event, _cx: &Cx) -> bool {
7878 false
7979 }
80- /// The user Ctrl+clicked inside this widget at `at` (its own points) and asked for
81- /// something that became a new widget `kind`. Keep it as a child and return true, or
82- /// return false and root gets it.
80+ /// A build asked (`conveyor place <kind> --in <this instance>`) to have the new widget
81+ /// `kind` placed here, at `at` in this widget's points: where the user Ctrl+clicked, when
82+ /// that was inside it. Keep it as a child and return true.
8383 fn mount(&mut self, _kind: &str, _at: (f32, f32), _cx: &Cx) -> bool {
8484 false
8585 }
@@ -128,6 +128,20 @@ impl Cx<'_> {
128128 pub fn kinds(&self) -> &'static [(&'static str, &'static Widget)] {
129129 super::ALL
130130 }
131+
132+ /// Acts on the app from anywhere a widget runs (view, update, event), not only handlers:
133+ /// `cx.act(move |l| l.share("note", &path))`. From update and event it runs right after
134+ /// them; from view, at the next update.
135+ pub fn act(&self, f: impl FnOnce(&mut Live) + 'static) {
136+ self.live.later.borrow_mut().push(Box::new(f));
137+ }
138+
139+ /// Call it from `update` while this instance has work that must go on when nothing shows
140+ /// it, such as music playing: the app brings it back after a restart (every library change
141+ /// restarts the app), even when no parent renders it. Stop calling it when the work stops.
142+ pub fn keep_running(&self) {
143+ self.live.running.borrow_mut().insert(self.id.to_owned());
144+ }
131145 }
132146
133147 // ── Handlers: reaching state and conveyor from a press, a key, an edit ──────────────────────
@@ -164,48 +178,37 @@ pub fn edit<W: View>(id: &str, f: impl Fn(&mut W) -> &mut TextEdit + 'static) ->
164178
165179 /// Sets a shared value; every widget sees it on its next render. Kept across restarts.
166180 pub fn share(h: &mut HostState, key: &str, value: &str) {
167- let live = Host::live(h);
168- live.shared.insert(key.to_owned(), value.to_owned());
169- live.dirty = true;
181+ Host::live(h).share(key, value)
170182 }
171183
172-/// Sends one request to conveyord, as `conveyor call` does. The ops are in conveyor's
173-/// server.rs: ticket (create), set (move a ticket to a state), state. Results show up in
174-/// `cx.data` within a second.
184+/// Sends one request to conveyord. The ops are in conveyor's server.rs.
175185 pub fn call(h: &mut HostState, request: String) {
176- Host::live(h).outbox.push(request);
186+ Host::live(h).call(request)
177187 }
178188
179-/// Moves a ticket: `set_state(h, "conveyor", 3, "review")`.
180-/// Shown at once: `cx.data` changes now, and conveyor's next snapshot confirms it.
181-/// Conveyor refuses moves into or out of running.
189+/// Moves a ticket: `set_state(h, "conveyor", 3, "review")`. See `Live::set_state`.
182190 pub fn set_state(h: &mut HostState, project: &str, id: u32, state: &str) {
183- let live = Host::live(h);
184- if let Some(t) = live.data.tickets.iter_mut().find(|t| t.project == project && t.id == id && t.state != "running") {
185- (t.state, t.since) = (state.to_owned(), now() as u64);
186- }
187- call(h, format!("{{\"op\":\"set\",\"project\":{},\"id\":{id},\"state\":{}}}", quote(project), quote(state)));
191+ Host::live(h).set_state(project, id, state)
188192 }
189193
190-/// Writes a ticket: `new_ticket(h, "conveyor", "Title", "What and why", "draft", &[])`.
191-/// `files` are copied into the ticket, and the agent working it gets them.
192-/// `ready` starts an agent on it as soon as a slot is free.
194+/// Writes a ticket: `new_ticket(h, "conveyor", "Title", "What and why", "draft", &[])`. See `Live::new_ticket`.
193195 pub fn new_ticket(h: &mut HostState, project: &str, title: &str, body: &str, state: &str, files: &[PathBuf]) {
194- let files: Vec<String> = files.iter().map(|f| quote(&f.to_string_lossy())).collect();
195- call(h, format!("{{\"op\":\"ticket\",\"project\":{},\"title\":{},\"body\":{},\"state\":{},\"files\":[{}]}}",
196- quote(project), quote(title), quote(body), quote(state), files.join(",")));
196+ Host::live(h).new_ticket(project, title, body, state, files)
197+}
198+
199+/// Rewrites a ticket's title and body. See `Live::edit_ticket`.
200+pub fn edit_ticket(h: &mut HostState, project: &str, id: u32, title: &str, body: &str) {
201+ Host::live(h).edit_ticket(project, id, title, body)
197202 }
198203
199-/// Adds a project: `slug` names it, `path` is its folder, made (with an empty git repo) if missing.
200-/// Pick a folder with `tx.open_folder(...)` (Rune's portal dialog).
204+/// Adds a project. See `Live::add_project`.
201205 pub fn add_project(h: &mut HostState, slug: &str, path: &Path) {
202- call(h, format!("{{\"op\":\"project\",\"slug\":{},\"path\":{}}}", quote(slug), quote(&path.to_string_lossy())));
206+ Host::live(h).add_project(slug, path)
203207 }
204208
205209 /// How many of a project's tickets run at once. 0 pauses it.
206210 pub fn set_slots(h: &mut HostState, project: &str, slots: u32) {
207- if let Some(p) = Host::live(h).data.projects.iter_mut().find(|p| p.slug == project) { p.slots = slots; }
208- call(h, format!("{{\"op\":\"project\",\"slug\":{},\"slots\":{slots}}}", quote(project)));
211+ Host::live(h).set_slots(project, slots)
209212 }
210213
211214 /// A JSON string literal.
@@ -237,6 +240,65 @@ pub struct Live {
237240 outbox: Vec<String>,
238241 spare: TextEdit,
239242 dirty: bool,
243+ /// What widgets asked to do with `cx.act`, run after each update, event and render.
244+ later: RefCell<Vec<Box<dyn FnOnce(&mut Live)>>>,
245+ /// Instances that called `cx.keep_running` in the last update, and the set last saved.
246+ running: RefCell<BTreeSet<String>>,
247+ kept: BTreeSet<String>,
248+}
249+
250+// ── What widgets can do: from handlers with the free functions above, from anywhere with `cx.act`
251+
252+impl Live {
253+ /// Sets a shared value; every widget sees it on its next render. Kept across restarts.
254+ pub fn share(&mut self, key: &str, value: &str) {
255+ self.shared.insert(key.to_owned(), value.to_owned());
256+ self.dirty = true;
257+ }
258+
259+ /// Sends one request to conveyord, as `conveyor call` does. The ops are in conveyor's
260+ /// server.rs. Results show up in `cx.data` within a second.
261+ pub fn call(&mut self, request: String) {
262+ self.outbox.push(request);
263+ }
264+
265+ /// Moves a ticket. Shown at once: `cx.data` changes now, and conveyor's next snapshot
266+ /// confirms it. Conveyor refuses moves into or out of running.
267+ pub fn set_state(&mut self, project: &str, id: u32, state: &str) {
268+ if let Some(t) = self.data.tickets.iter_mut().find(|t| t.project == project && t.id == id && t.state != "running") {
269+ (t.state, t.since) = (state.to_owned(), now() as u64);
270+ }
271+ self.call(format!("{{\"op\":\"set\",\"project\":{},\"id\":{id},\"state\":{}}}", quote(project), quote(state)));
272+ }
273+
274+ /// Writes a ticket. `files` are copied into it, and the agent working it gets them.
275+ /// `ready` starts an agent on it as soon as a slot is free.
276+ pub fn new_ticket(&mut self, project: &str, title: &str, body: &str, state: &str, files: &[PathBuf]) {
277+ let files: Vec<String> = files.iter().map(|f| quote(&f.to_string_lossy())).collect();
278+ self.call(format!("{{\"op\":\"ticket\",\"project\":{},\"title\":{},\"body\":{},\"state\":{},\"files\":[{}]}}",
279+ quote(project), quote(title), quote(body), quote(state), files.join(",")));
280+ }
281+
282+ /// Rewrites a ticket's title and body, in place. Shown at once. Conveyor refuses it while
283+ /// the ticket is running.
284+ pub fn edit_ticket(&mut self, project: &str, id: u32, title: &str, body: &str) {
285+ if let Some(t) = self.data.tickets.iter_mut().find(|t| t.project == project && t.id == id && t.state != "running") {
286+ (t.title, t.body) = (title.to_owned(), body.to_owned());
287+ }
288+ self.call(format!("{{\"op\":\"edit\",\"project\":{},\"id\":{id},\"title\":{},\"body\":{}}}", quote(project), quote(title), quote(body)));
289+ }
290+
291+ /// Adds a project: `slug` names it, `path` is its folder: a git repo, or a new or empty
292+ /// folder that becomes one. Pick a folder with `tx.open_folder(...)`.
293+ pub fn add_project(&mut self, slug: &str, path: &Path) {
294+ self.call(format!("{{\"op\":\"project\",\"slug\":{},\"path\":{}}}", quote(slug), quote(&path.to_string_lossy())));
295+ }
296+
297+ /// How many of a project's tickets run at once. 0 pauses it. Shown at once.
298+ pub fn set_slots(&mut self, project: &str, slots: u32) {
299+ if let Some(p) = self.data.projects.iter_mut().find(|p| p.slug == project) { p.slots = slots; }
300+ self.call(format!("{{\"op\":\"project\",\"slug\":{},\"slots\":{slots}}}", quote(project)));
301+ }
240302 }
241303
242304 impl Live {
@@ -245,8 +307,12 @@ impl Live {
245307 let shared = std::fs::read_to_string(base.join("shared.tsv")).unwrap_or_default().lines()
246308 .filter_map(|l| l.split_once('\t').map(|(k, v)| (k.to_owned(), v.replace("\\n", "\n"))))
247309 .collect();
248- Live { data: Data::default(), base, instances: HashMap::new(), shared, wanted: RefCell::new(vec![]),
249- animate: Cell::new(false), outbox: vec![], spare: TextEdit::new(""), dirty: false }
310+ // Instances that were keeping work going come back now, shown or not.
311+ let wanted: Vec<(String, String)> = std::fs::read_to_string(base.join("running.tsv")).unwrap_or_default().lines()
312+ .filter_map(|l| l.split_once('\t').map(|(id, kind)| (id.to_owned(), kind.to_owned()))).collect();
313+ Live { data: Data::default(), base, instances: HashMap::new(), shared, wanted: RefCell::new(wanted),
314+ animate: Cell::new(false), outbox: vec![], spare: TextEdit::new(""), dirty: false,
315+ later: RefCell::new(vec![]), running: RefCell::new(BTreeSet::new()), kept: BTreeSet::new() }
250316 }
251317
252318 fn cx<'a>(&'a self, id: &'a str, now: f64) -> Cx<'a> {
@@ -257,12 +323,11 @@ impl Live {
257323 pub fn render(&self, kind: &str, id: &str) -> El {
258324 match self.instances.get(id) {
259325 Some((k, w)) if k == kind => w.view(&self.cx(id, now())).key(format!("w:{id}")),
326+ // Made before the next render. A kind the library doesn't have (a discarded build's)
327+ // draws nothing.
260328 _ => {
261329 self.wanted.borrow_mut().push((id.to_owned(), kind.to_owned()));
262- let missing = !super::ALL.iter().any(|(n, _)| *n == kind);
263- let t = tok::theme(true);
264- col().key(format!("w:{id}")).w_full().h_full().center()
265- .child(text(if missing { format!("no widget `{kind}`") } else { String::new() }).color(t.text_secondary))
330+ col().key(format!("w:{id}")).w_full().h_full()
266331 }
267332 }
268333 }
@@ -283,13 +348,9 @@ impl Live {
283348 made
284349 }
285350
286- /// Offers a new widget to each instance in turn, at its own point: the one clicked first,
287- /// then its parents. The id of the one that kept it. A kind with no size of its own (a
288- /// layout, which only fills its parent) is never placed.
289- pub fn mount(&mut self, targets: &[(String, (f32, f32))], kind: &str) -> Option<String> {
290- let (w, h) = super::ALL.iter().find(|(n, _)| *n == kind)?.1.size;
291- if w == 0.0 || h == 0.0 { return None; }
292- targets.iter().find(|(id, at)| self.with(id, |w, cx| w.mount(kind, *at, cx)) == Some(true)).map(|(id, _)| id.clone())
351+ /// Offers new widget `kind` to instance `id`, at `at` in its points. Whether it kept it.
352+ pub fn mount(&mut self, id: &str, at: (f32, f32), kind: &str) -> bool {
353+ super::ALL.iter().any(|(n, _)| *n == kind) && self.with(id, |w, cx| w.mount(kind, at, cx)) == Some(true)
293354 }
294355
295356 /// Instances of `kind`, or any instance if `kind` is empty.
@@ -297,16 +358,34 @@ impl Live {
297358 self.instances.iter().filter(|(_, (k, _))| kind.is_empty() || k == kind).map(|(id, _)| id.clone()).collect()
298359 }
299360
300- /// Runs `update` on every instance.
301- pub fn update(&mut self) {
361+ /// Runs `update` on every instance, then what they asked with `cx.act`. Saves which
362+ /// instances keep work running, so a restart brings them back. True if anything acted.
363+ pub fn update(&mut self) -> bool {
364+ self.running.get_mut().clear();
302365 for id in self.ids("") { self.with(&id, |w, cx| w.update(cx)); }
366+ if *self.running.get_mut() != self.kept {
367+ self.kept = self.running.get_mut().clone();
368+ let lines: String = self.kept.iter().filter_map(|id| Some(format!("{id}\t{}\n", self.kind(id)?))).collect();
369+ let _ = std::fs::write(self.base.join("running.tsv"), lines);
370+ }
371+ self.apply()
303372 }
304373
305374 /// Offers an event to every instance, innermost first. True when one took it.
306375 pub fn event(&mut self, event: &Event) -> bool {
307376 let mut ids = self.ids("");
308377 ids.sort_by_key(|id| std::cmp::Reverse(id.matches('.').count()));
309- ids.iter().any(|id| self.with(id, |w, cx| w.event(event, cx)).unwrap_or(false))
378+ let took = ids.iter().any(|id| self.with(id, |w, cx| w.event(event, cx)).unwrap_or(false));
379+ self.apply();
380+ took
381+ }
382+
383+ /// Runs what widgets asked with `cx.act`, in order. True if there was anything.
384+ pub fn apply(&mut self) -> bool {
385+ let acts = std::mem::take(self.later.get_mut());
386+ let any = !acts.is_empty();
387+ for f in acts { f(self); }
388+ any
310389 }
311390
312391 /// Instance `id`'s state, writable, beside a Cx for it.
templates/library/preview/src/main.rs+3−4
@@ -2,7 +2,7 @@
22 //! cargo run --release -p preview -- [--state DIR] <kind> [child kinds…] --snap /tmp/x.png --tree /tmp/x.json --size 1400x900
33 //! It's the app's own host: children, shared values, handlers, update, events, animation and
44 //! instance folders (/tmp/preview/w/<id>) all work. Child kinds after the first are mounted,
5-//! innermost instance first, as the app does after a build. Requests for conveyord are printed.
5+//! offered to each instance innermost first, as `conveyor place` asks the app to. Requests for conveyord are printed.
66 //!
77 //! --state DIR replays the user's app: its data, shared values and instance folders, copied so
88 //! the run can't change them, with what they Ctrl+clicked outlined in orange.
@@ -115,13 +115,12 @@ fn poll(s: &mut State, _: f64, tx: &mut Tx) -> bool {
115115 if !again && !s.mounts.is_empty() && s.live.kind("root").is_some() {
116116 let mut ids = s.live.ids("");
117117 ids.sort_by_key(|id| std::cmp::Reverse(id.matches('.').count()));
118- let targets: Vec<_> = ids.into_iter().map(|id| (id, (40.0, 40.0))).collect();
119118 for kind in std::mem::take(&mut s.mounts) {
120- if s.live.mount(&targets, &kind).is_none() { eprintln!("preview: no widget kept `{kind}`"); }
119+ if !ids.iter().any(|id| s.live.mount(id, (40.0, 40.0), &kind)) { eprintln!("preview: no widget kept `{kind}`"); }
121120 }
122121 again = true;
123122 }
124- s.live.update();
123+ again |= s.live.update();
125124 for r in s.live.take_outbox() { eprintln!("preview: would send to conveyord: {r}"); }
126125 s.live.save();
127126 if s.live.animating() { tx.wake_after(Duration::from_millis(16)); }