← Commit history
Merge PR #641: 0.2.130: find a localized KiCad editor by its pid (#274) (localized-editor-0.2.130 -> main) merge
Showing changes introduced by the merge (against its first parent).
7 files changed
+50−15
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -27,7 +27,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "serde",@@ -37,7 +37,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.129"+version = "0.2.130" dependencies = [ "roxmltree", "serde",@@ -46,7 +46,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "serde",@@ -55,7 +55,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "aiflow-grid",@@ -65,7 +65,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "serde",@@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "serde",@@ -83,7 +83,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "aiflow-copper",@@ -93,7 +93,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.129"+version = "0.2.130" dependencies = [ "aiflow-board", "aiflow-grid",@@ -104,7 +104,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.129"+version = "0.2.130" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.129"+version = "0.2.130" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
crates/adom-aiflow/src/main.rs+11−1@@ -547,6 +547,16 @@ fn err(msg: &str, hints: &[String]) -> ! { /// Hints that depend on this board at a step (0.2.18): power-input voltage labels and test-point /// labels at silkscreen, LED on/off states at schematic, silkscreen and finish, and the programming /// interface of a programmable board at schematic and placement.+/// Issue #274 (Jinwon Kim): the run's KiCad editor found by the pid its open returned, when no window was+/// remembered and none is titled in English ("<board> — PCB 편집기" on a Korean KiCad): any window of that+/// process whose title names the board, on screen or not.+fn editor_by_pid(r: &Run, br: &aiflow_bridge::Bridge, eda: &str) -> Option<i64> {+ if eda != "kicad" { return None; }+ let pid = r.data["kicadIsolated"]["pid"].as_i64().filter(|p| *p > 0)?;+ let board = r.data["kicadIsolated"]["board"].as_str()?;+ br.board_window_any(board, Some(pid)).map(|w| w.0)+}+ fn board_step_hints(r: &Run, step: &str) -> Vec<String> { if !matches!(step, "schematic" | "placement" | "silkscreen" | "finish" | "current" | "thermal") { return Vec::new(); } let path = r.current_board();@@ -9207,7 +9217,7 @@ fn main() { // window, never an idle editor; nothing meaningful on screen is a recorded skip let pre_cam = (name != "fields" && clipwatch::preboard_step(name)).then(|| clipwatch::choose_preboard(&br, &*cam, name, r.data["engine"].as_str().unwrap_or(""))); if let Some(clipwatch::Camera::Window { what, .. }) = &pre_cam { if what.starts_with("Hydrogen") { ensure_dashboard(&dir, &thread(&cli), true); } }- let hwnd = match &pre_cam { Some(clipwatch::Camera::Window { hwnd, .. }) => Some(*hwnd), Some(clipwatch::Camera::Skip(_)) => None, None => if name == "fields" { None } else { cam.camera_window(&tx, name, cached) } };+ let hwnd = match &pre_cam { Some(clipwatch::Camera::Window { hwnd, .. }) => Some(*hwnd), Some(clipwatch::Camera::Skip(_)) => None, None => if name == "fields" { None } else { cam.camera_window(&tx, name, cached).or_else(|| editor_by_pid(&r, &br, cam.id())) } }; // issue #106: a box whose Adom Bridge has no recorder is said once, then each step keeps screenshots let (can_record, rec_notice) = clipwatch::recorder(&mut r, &br); if let Some(n) = &rec_notice { clip_note.push_str(&format!("{n}; ")); }
crates/aiflow-bridge/src/lib.rs+15−1@@ -625,7 +625,8 @@ impl Bridge { let r = self.call("kicad_open_board", &args); let mut iso = isolated::isolated_of(&r)?; if !raise { let _ = self.follow_focus_rule(&r); }- if iso.hwnd.is_none() { iso.hwnd = self.wait_board_window(remote_board, &json!({"success": true})).map(|w| w.0); }+ // issue #274 (Jinwon Kim): the editor's pid finds its window whatever language KiCad titles it in+ if iso.hwnd.is_none() { iso.hwnd = self.wait_board_window(remote_board, &json!({"success": true, "pid": iso.pid})).map(|w| w.0); } if let (true, Some(h)) = (raise, iso.hwnd) { self.call("desktop_ui_window", &json!({"hwnd": h, "action": "maximize", "reason": "aiflow capture: fill the monitor"})); self.call("desktop_bring_to_front", &json!({"hwnd": h, "reason": "aiflow capture: keep the PCB editor on screen on the test box"}));@@ -1514,6 +1515,19 @@ mod not_as_planned_tests { mod board_window_tests { use super::*; + /// Issue #274 (Jinwon Kim): a Korean KiCad titles its editor "<board> — PCB 편집기". With the pid the open+ /// returned it is found by process and board name; without it, nothing English names it.+ #[test]+ fn a_localized_editor_is_found_by_its_pid() {+ let list = json!({"data": {"windows": [+ {"hwnd": 11, "title": "PCB 편집기", "ownerPid": 4242, "isOnscreen": true},+ {"hwnd": 12, "title": "esc — PCB 편집기", "ownerPid": 4242, "isOnscreen": true},+ {"hwnd": 13, "title": "esc — 회로도 편집기", "ownerPid": 5151, "isOnscreen": true}]}});+ assert_eq!(offscreen_board_window_in(&list, "esc", Some(4242)), Some((12, true)), "the bare strip names no board");+ assert_eq!(offscreen_board_window_in(&list, "esc", None), None, "no pid: no English title, no process name to go by");+ assert_eq!(offscreen_board_window_in(&list, "esc", Some(9999)), None, "another process is not the run's editor");+ }+ /// Issue #253 (Drew Owens): macOS, the editor opened behind a full-screen app is on another Space: found among /// the off-screen windows (by its title, or the pid the open launched), and said to be off screen. #[test]
docs/release-0.2.130.mdadded+11@@ -0,0 +1,11 @@+# adom-aiflow 0.2.130++## Step clips find a localized KiCad editor by its process (#274)++On a KiCad in another display language the board editor's title is translated ("<board> — PCB 편집기" in Korean), and the window kinds the KiCad bridge reports come from the English title too. When the open answered without a window handle, AI Flow looked for the editor by its English title, found none, and every step's clip was skipped ("no PCB editor of <board> open").++- `capture open --isolated`: when the bridge returns no window handle, AI Flow now looks for the editor by the process the open started (its pid) and a title that names the board, in any language, on screen or off.+- `step <name>`: when no editor window was remembered and none is titled in English, the step finds the run's editor the same way, by the isolated editor's pid, and films it.+- The English title and the bridge's window kinds are still used first, unchanged.++KiCad Bridge is adding a language-independent window kind on Windows and Linux; on macOS it comes with a later 2.0.x build. AI Flow already prefers that kind, so nothing more is needed here when it lands. English remains the supported KiCad language: this only keeps the run from losing its own editor window.
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.129",+ "version": "0.2.130", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
page.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.129",+ "version": "0.2.130", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",