From cf32196f8d5fcbf6db713504d5575ee00f6b1682 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 02:29:36 -0500 Subject: [PATCH 1/6] fix(engine): an engine that has ended but was not yet collected counts as gone where there is no /proc Ending a leftover engine waits until it is gone. On macOS a process that has ended and that its parent has not collected still answers a signal, and there is no /proc to tell it apart, so the wait ran out and the start was refused with "could not stop an engine that was left running" (FormCut's macOS job showed it in the same file). Where there is no /proc, the wait now asks ps for the process's state and takes an ended one as gone. Linux and Windows are untouched. backend/app/core/startup.py: finished(pid), and its use in gone_by. backend/tests/test_startup.py: one test that points PROC at a folder that does not exist; it failed with that sentence before the change in gone_by and passes after it. backend/HASHOUT_LOG.md has the reason. Run: tests/test_startup.py, 16 tests; 15 passed and one, the engine with its three streams closed, missed its 20 second wait on a loaded machine and passed when run again alone. Not run on macOS. --- backend/HASHOUT_LOG.md | 5 +++++ backend/app/core/startup.py | 19 ++++++++++++++++++- backend/tests/test_startup.py | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index 4cfa87f..92e8c40 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -7,6 +7,11 @@ Last updated: 2026-11-19 · v0.36.0: one engine per data folder, the engine's lo --- +## after v0.36.0 · an engine that has ended but was not yet collected counts as gone where there is no /proc (2026-11-20) + +- backend/app/core/startup.py :: `finished`, `gone_by` · ending a leftover engine waits until it is gone. `_alive_posix` asks `kill(pid, 0)`, which still answers for a process that has ended and that its parent has not collected, and it tells such a process apart only by reading `/proc`, which macOS does not have. There the wait ran out and the start was refused with "could not stop an engine that was left running" (FormCut's macOS job showed it; this is the same file under FormTxt's names). `finished(pid)` asks `ps -o stat= -p ` where there is no `/proc` (never on Windows, never on Linux) and answers true for a state that starts with `Z`. `gone_by` stops waiting when the process is not alive or is finished. `alive` itself is unchanged, so the two second watch on the app starts no program. +- backend/tests/test_startup.py :: `test_a_holder_that_has_ended_and_was_not_collected_counts_as_gone_where_there_is_no_proc` · seen on Linux with `PROC` pointed at a folder that does not exist: before the change in `gone_by` the test failed with that sentence, after it the holder is replaced. Not run on macOS. + ## after v0.35.0 · the shell: its process id under the family's name, and the failure sentence before the loading window closes (2026-11-19) - src-tauri/src/main.rs :: `main` (the engine's start in `setup`) · the engine also gets `FORMTXT_SHELL_PID`, the shell's own process id, beside `FORMTXT_PARENT_PID`, which stays. When no address and key came, the sentence is shown first and the loading window is closed only after it returns; before, the loading window was closed first, and closing the last window before a dialog is the silent end a tester saw in another Form app. The sentence now says what the lock makes the likely cause, a copy that is already open, and where the engine's log is. This entry is in the engine's log because the shell has no log of its own. diff --git a/backend/app/core/startup.py b/backend/app/core/startup.py index ae27fd8..e08ddb3 100644 --- a/backend/app/core/startup.py +++ b/backend/app/core/startup.py @@ -194,9 +194,26 @@ def same(pid: int, born: float) -> bool: return alive(pid) and (not born or (seen > 0 and abs(seen - born) <= SLACK)) +def finished(pid: int) -> bool: + if WINDOWS or os.path.isdir(PROC): + return False + try: + told = subprocess.run( + ["ps", "-o", "stat=", "-p", str(pid)], + stdin=subprocess.DEVNULL, + capture_output=True, + text=True, + timeout=END_WAIT, + check=False, + ) + except (OSError, subprocess.SubprocessError): + return False + return told.stdout.strip().startswith("Z") + + def gone_by(pid: int, seconds: float) -> bool: until = time.monotonic() + seconds - while alive(pid): + while alive(pid) and not finished(pid): if time.monotonic() >= until: return False time.sleep(STEP) diff --git a/backend/tests/test_startup.py b/backend/tests/test_startup.py index 3a5d460..dee21ad 100644 --- a/backend/tests/test_startup.py +++ b/backend/tests/test_startup.py @@ -89,6 +89,25 @@ def test_a_holder_whose_shell_is_gone_is_ended_and_replaced(tmp_path): stop(engine, shell, mine) +def test_a_holder_that_has_ended_and_was_not_collected_counts_as_gone_where_there_is_no_proc(tmp_path, monkeypatch): + from app.core import startup + + engine, shell, mine = stand_in(), stand_in(), stand_in() + try: + held = record(startup, engine, shell) + stop(shell) + assert startup.finished(engine.pid) is False + monkeypatch.setattr(startup, "PROC", str(tmp_path / "no-proc")) + assert startup.finished(engine.pid) is False + (tmp_path / startup.LOCK_NAME).write_text(json.dumps(held)) + path, replaced = startup.claim(tmp_path, mine.pid) + assert replaced == engine.pid + assert startup.finished(engine.pid) is True + assert json.loads(path.read_text())["pid"] == os.getpid() + finally: + stop(engine, shell, mine) + + def test_a_holder_that_recorded_no_shell_is_replaced_only_by_an_engine_with_a_shell(tmp_path): from app.core import startup From 4d7c08da86d97208f0fbdc68d4be879fee49b282 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 02:47:14 -0500 Subject: [PATCH 2/6] feat(shell): on Windows the engine ends with the app, a failed start says why, and the wait for the address has a limit The shell side of the family's start, held in 0.36.0. src-tauri/src/win_job.rs (new, Windows only) puts the engine into a job object that ends it when the shell ends, however the shell ends; the engine is still started through tauri-plugin-shell, as FormVis's is, so the job takes it by its process id. src-tauri/src/engine_start.rs (new) holds the failure sentences, the engine's last twelve lines (never the window key line), its exit code and the log's path: a second copy of FormTxt now reads that another copy holds the data folder with the engine's own line under it, where it read one general sentence. The wait for the engine's address is 90 seconds (it had no limit), the wait for the key stays 10. A missing engine program or one that cannot be started is the dialog too, where the shell ended without a word. src-tauri/src/main.rs: start_limit, engine_failed, the start in setup, kill_backend ends the job on Windows, open_main says whether its window was built. src-tauri/Cargo.toml and Cargo.lock: windows-sys 0.61.2 under the Windows target, one line added by hand to the lock. backend/HASHOUT_LOG.md has the reasons. Run: the two new files in a scratch crate, cargo check for x86_64-pc-windows-msvc and x86_64-pc-windows-gnu with no error and no warning, cargo test 4 passed; cargo update --workspace --offline on a copy of the old lock gave the hand-edited lock exactly. main.rs was not compiled: the shell cannot be built here. --- backend/HASHOUT_LOG.md | 7 ++ src-tauri/Cargo.lock | 1 + src-tauri/Cargo.toml | 3 + src-tauri/src/engine_start.rs | 181 ++++++++++++++++++++++++++++++++++ src-tauri/src/main.rs | 148 ++++++++++++++++++--------- src-tauri/src/win_job.rs | 59 +++++++++++ 6 files changed, 353 insertions(+), 46 deletions(-) create mode 100644 src-tauri/src/engine_start.rs create mode 100644 src-tauri/src/win_job.rs diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index 92e8c40..bef9a81 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -7,6 +7,13 @@ Last updated: 2026-11-19 · v0.36.0: one engine per data folder, the engine's lo --- +## after v0.36.0 · the shell side: the job object on Windows, the failure text, a limit on the wait for the address (2026-11-20) + +- src-tauri/src/win_job.rs (new, Windows only) :: `hold_pid`, `end` · FormVis's file at its main less `hold(&child)`, which takes a `std::process::Child` that FormTxt's shell never has. The job is made on first use with kill-on-close and kept for the life of the shell; nothing closes its handle, so Windows ends the engine and all it started when the shell ends, however it ends. Only the engine goes in, by its process id, right after the start. +- src-tauri/src/engine_start.rs (new) :: `Failure`, `Wait`, `Tail`, `sentence`, `message`, `log_path`, `engine_log` · FormVis's and FormTools's file under FormTxt's names. `ADDRESS_WAIT` is 90 seconds (the owner's D1; there was no limit), `KEY_WAIT` 10 seconds as 0.34.0 had it, `EXIT_WAIT` one second for the last lines after the engine ends. Exit code 2 (`BUSY_CODE`) is the engine's refusal of a second copy: its sentence says that another copy holds the data folder, and the engine's own line ("formtxt is already running on [folder] (engine process N).") is under it with the log's path, where 0.36.0 showed one general sentence. The log path is the engine's own rule (`FORMTXT_DATA_DIR`, else `FormTxt` in the home folder, then `Logs/formtxt-engine.log`). Lines that hold the window key never go into the tail. +- src-tauri/src/main.rs :: `start_limit`, `engine_failed`, `kill_backend`, `open_main`, `main` · the engine is still started through tauri-plugin-shell, as FormVis's is, so the job takes it by id; the wave 5 note above pointed at FormTools's way (moving the start to `std::process::Command`), which is not needed for the job and would have changed how the start works. Missing sidecar and a start that fails are now the dialog, where `expect` ended the shell without a word. The events go through one channel with the two time limits, as in FormVis; the window key is still read from either stream as before. A window that cannot be built is the dialog too. `kill_backend` ends the job before its forced kill on Windows. `kill -0` there is safe here: the plugin's own thread collects the child. +- src-tauri/Cargo.toml, Cargo.lock · `windows-sys` 0.61.2 under the Windows target with the four features, the version most of the lock already has; one line added by hand to `formtxt`'s list. Proved: `cargo update --workspace --offline` on a scratch copy of the old lock with this `Cargo.toml` locked 0 packages and its lock is the same as the hand edit. `cargo check --target x86_64-pc-windows-msvc` and `x86_64-pc-windows-gnu` of the two new files in a scratch crate: no error, no warning; `cargo test` 4 passed. `main.rs` was not compiled: the shell cannot be built here. + ## after v0.36.0 · an engine that has ended but was not yet collected counts as gone where there is no /proc (2026-11-20) - backend/app/core/startup.py :: `finished`, `gone_by` · ending a leftover engine waits until it is gone. `_alive_posix` asks `kill(pid, 0)`, which still answers for a process that has ended and that its parent has not collected, and it tells such a process apart only by reading `/proc`, which macOS does not have. There the wait ran out and the start was refused with "could not stop an engine that was left running" (FormCut's macOS job showed it; this is the same file under FormTxt's names). `finished(pid)` asks `ps -o stat= -p ` where there is no `/proc` (never on Windows, never on Linux) and answers true for a state that starts with `Z`. `gone_by` stops waiting when the process is not alive or is finished. `alive` itself is unchanged, so the two second watch on the app starts no program. diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index f3a4394..ccbb461 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -878,6 +878,7 @@ dependencies = [ "tauri-build", "tauri-plugin-dialog", "tauri-plugin-shell", + "windows-sys 0.61.2", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index beaf7ee..cc8bcc5 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -19,6 +19,9 @@ regex = "1" serde_json = "1" serde = { version = "1", features = ["derive"] } +[target.'cfg(windows)'.dependencies] +windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Security", "Win32_System_JobObjects", "Win32_System_Threading"] } + [target.'cfg(target_os = "macos")'.dependencies] objc2 = "0.6" objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSWindow", "NSButton", "NSControl", "NSView", "NSResponder", "objc2-core-foundation", "NSColor"] } diff --git a/src-tauri/src/engine_start.rs b/src-tauri/src/engine_start.rs new file mode 100644 index 0000000..e438b5a --- /dev/null +++ b/src-tauri/src/engine_start.rs @@ -0,0 +1,181 @@ +use std::collections::VecDeque; +use std::path::{Path, PathBuf}; +use std::time::Duration; + +pub const APP: &str = "FormTxt"; +pub const SHELL_ENV: &str = "FORMTXT_SHELL_PID"; +pub const PARENT_ENV: &str = "FORMTXT_PARENT_PID"; +pub const ADDRESS_WAIT: Duration = Duration::from_secs(90); +pub const KEY_WAIT: Duration = Duration::from_secs(10); +pub const EXIT_WAIT: Duration = Duration::from_secs(1); +pub const BUSY_CODE: i32 = 2; +const DATA_NAME: &str = "FormTxt"; +const DATA_ENV: &str = "FORMTXT_DATA_DIR"; +const LOG_NAME: &str = "formtxt-engine.log"; +const KEY_MARK: &str = "window-key"; +const TAIL_LINES: usize = 12; +const LINE_CHARS: usize = 300; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum Wait { + Address, + Key, +} + +impl Wait { + pub fn limit(self) -> Duration { + match self { + Wait::Address => ADDRESS_WAIT, + Wait::Key => KEY_WAIT, + } + } + + pub fn what(self) -> &'static str { + match self { + Wait::Address => "its engine to say which address it serves on", + Wait::Key => "its engine to hand over the key for the window", + } + } +} + +#[derive(Debug, PartialEq)] +pub enum Failure { + Missing, + NotStarted(String), + Stopped(Option), + TimedOut(Wait), + Window, +} + +#[derive(Default)] +pub struct Tail(VecDeque); + +impl Tail { + pub fn push(&mut self, line: &str) { + if line.contains(KEY_MARK) { + return; + } + let clean: String = line.chars().filter(|c| !c.is_control()).take(LINE_CHARS).collect(); + if clean.trim().is_empty() { + return; + } + if self.0.len() == TAIL_LINES { + self.0.pop_front(); + } + self.0.push_back(clean); + } + + pub fn lines(&self) -> Vec { + self.0.iter().cloned().collect() + } +} + +pub fn sentence(failure: &Failure) -> String { + match failure { + Failure::Missing => format!("{APP} could not start: its engine program is missing from the install. Installing {APP} again puts it back."), + Failure::NotStarted(reason) => format!("{APP} could not start its engine: {reason}"), + Failure::Stopped(Some(BUSY_CODE)) => { + format!("{APP} could not start: another copy of its engine holds its data folder. If {APP} is already open, use that window.") + } + Failure::Stopped(Some(code)) => format!("{APP} could not start: its engine stopped with code {code} before the window could open."), + Failure::Stopped(None) => format!("{APP} could not start: its engine stopped before the window could open."), + Failure::TimedOut(wait) => format!("{APP} could not start: it waited {} seconds for {} and that did not happen.", wait.limit().as_secs(), wait.what()), + Failure::Window => format!("{APP} could not open its window."), + } +} + +pub fn message(failure: &Failure, tail: &[String], log: Option<&Path>) -> String { + let mut text = sentence(failure); + if !tail.is_empty() { + text.push_str("\n\nThe engine's last lines:\n"); + text.push_str(&tail.join("\n")); + } else if matches!(failure, Failure::Stopped(_) | Failure::TimedOut(_)) { + text.push_str("\n\nThe engine wrote nothing before that."); + } + if let Some(path) = log { + text.push_str("\n\nThe engine's log: "); + text.push_str(&path.to_string_lossy()); + } + text +} + +pub fn data_folder(var: &dyn Fn(&str) -> Option, home: Option<&Path>) -> Option { + if let Some(raw) = var(DATA_ENV).filter(|value| !value.is_empty()) { + return match (raw.strip_prefix('~'), home) { + (Some(rest), Some(home)) if rest.is_empty() || rest.starts_with('/') || rest.starts_with('\\') => { + Some(home.join(rest.trim_start_matches(['/', '\\']))) + } + _ => Some(PathBuf::from(raw)), + }; + } + Some(home?.join(DATA_NAME)) +} + +pub fn log_path(var: &dyn Fn(&str) -> Option, home: Option<&Path>) -> Option { + data_folder(var, home).map(|folder| folder.join("Logs").join(LOG_NAME)) +} + +pub fn engine_log() -> Option { + log_path(&|name: &str| std::env::var(name).ok(), std::env::home_dir().as_deref()) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn only(name: &'static str, value: &'static str) -> impl Fn(&str) -> Option { + move |asked| (asked == name).then(|| value.to_string()) + } + + #[test] + fn the_tail_keeps_the_last_lines_and_never_the_window_key() { + let mut tail = Tail::default(); + for n in 0..15 { + tail.push(&format!("line {n}")); + } + tail.push("formtxt-window-key: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + tail.push(" "); + tail.push(&"x".repeat(1000)); + let lines = tail.lines(); + assert_eq!(lines.len(), TAIL_LINES); + assert_eq!(lines[0], "line 4"); + assert_eq!(lines[TAIL_LINES - 1].len(), LINE_CHARS); + assert!(lines.iter().all(|line| !line.contains("window-key"))); + } + + #[test] + fn every_failure_has_its_sentence_the_last_lines_and_the_log() { + let log = Path::new("/data/Logs/formtxt-engine.log"); + let said = vec!["formtxt is already running on /data (engine process 7).".to_string()]; + let busy = message(&Failure::Stopped(Some(BUSY_CODE)), &said, Some(log)); + assert!(busy.starts_with("FormTxt could not start: another copy of its engine holds its data folder. If FormTxt is already open, use that window.")); + assert!(busy.contains("The engine's last lines:\nformtxt is already running on /data (engine process 7).")); + assert!(busy.ends_with("The engine's log: /data/Logs/formtxt-engine.log")); + assert!(message(&Failure::Stopped(Some(3)), &[], Some(log)).contains("stopped with code 3")); + assert!(message(&Failure::Stopped(None), &[], None).ends_with("The engine wrote nothing before that.")); + assert!(message(&Failure::Missing, &[], None).ends_with("puts it back.")); + assert!(sentence(&Failure::NotStarted("Access is denied.".to_string())).ends_with("its engine: Access is denied.")); + assert_eq!(sentence(&Failure::Window), "FormTxt could not open its window."); + } + + #[test] + fn a_wait_that_runs_out_says_how_long_and_for_what() { + assert_eq!(ADDRESS_WAIT, Duration::from_secs(90)); + assert!(sentence(&Failure::TimedOut(Wait::Address)).contains("waited 90 seconds for its engine to say which address it serves on")); + assert!(sentence(&Failure::TimedOut(Wait::Key)).contains("waited 10 seconds for its engine to hand over the key for the window")); + } + + #[test] + fn the_log_is_where_the_engine_writes_it() { + let home = Path::new("/home/u"); + let none = |_: &str| None; + let tail = Path::new("Logs").join("formtxt-engine.log"); + assert_eq!(log_path(&none, Some(home)), Some(home.join("FormTxt").join(&tail))); + assert_eq!(log_path(&only("FORMTXT_DATA_DIR", ""), Some(home)), Some(home.join("FormTxt").join(&tail))); + assert_eq!(log_path(&only("FORMTXT_DATA_DIR", "/d/x"), None), Some(Path::new("/d/x").join(&tail))); + assert_eq!(log_path(&only("FORMTXT_DATA_DIR", "~/x"), Some(home)), Some(home.join("x").join(&tail))); + assert_eq!(log_path(&only("FORMTXT_DATA_DIR", "~"), Some(home)), Some(home.join(&tail))); + assert_eq!(log_path(&only("FORMTXT_DATA_DIR", "~other/x"), Some(home)), Some(Path::new("~other/x").join(&tail))); + assert_eq!(log_path(&none, None), None); + } +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 2931903..8594111 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -21,14 +21,41 @@ fn system_fonts() -> Vec { names } +mod engine_start; mod packaged; mod reveal; mod text_edit; mod traffic_lights; +#[cfg(windows)] +mod win_job; mod window_state; struct Backend(Mutex>); +type EngineStep = Result>; + +fn start_limit(late: &tauri::async_runtime::Sender, limit: std::time::Duration, wait: Option) { + let late = late.clone(); + std::thread::spawn(move || { + std::thread::sleep(limit); + let _ = late.blocking_send(Err(wait)); + }); +} + +fn engine_failed(handle: &tauri::AppHandle, failure: engine_start::Failure, tail: &engine_start::Tail) { + let text = engine_start::message(&failure, &tail.lines(), engine_start::engine_log().as_deref()); + eprintln!("formtxt: {text}"); + let _ = handle + .dialog() + .message(text) + .title(engine_start::APP) + .kind(tauri_plugin_dialog::MessageDialogKind::Error) + .blocking_show(); + close_splash(handle); + kill_backend(handle); + handle.exit(1); +} + const FALLBACK_SIZE: (f64, f64) = (1280.0, 820.0); const MIN_SIZE: (f64, f64) = (900.0, 600.0); const SCREEN_FRACTION: f64 = 0.9; @@ -57,6 +84,8 @@ fn kill_backend(handle: &tauri::AppHandle) { } } } + #[cfg(windows)] + win_job::end(); let _ = child.kill(); } } @@ -75,7 +104,7 @@ fn dev_url(handle: &tauri::AppHandle) -> Option { } } -fn open_main(handle: &tauri::AppHandle, url: tauri::Url, key: Option) { +fn open_main(handle: &tauri::AppHandle, url: tauri::Url, key: Option) -> bool { let place = window_state::load(handle); let (width, height) = if place.width > 0.0 { (place.width, place.height) @@ -120,8 +149,10 @@ fn open_main(handle: &tauri::AppHandle, url: tauri::Url, key: Option) { reveal::conceal(&window); traffic_lights::place(&window.as_ref().window()); window_state::restore(&window, &place); + true } else { close_splash(handle); + false } } @@ -160,69 +191,94 @@ fn main() { return Ok(()); } let engine = match packaged::engine_folder() { - Some(program) => app.shell().command(program), - None => app - .shell() - .sidecar("formtxt-engine") - .expect("the FormTxt engine sidecar is missing; bundle its binary"), + Some(program) => Ok(app.shell().command(program)), + None => app.shell().sidecar("formtxt-engine").map_err(|_| engine_start::Failure::Missing), }; - let sidecar = engine - .env("FORMTXT_PORT", "0") - .env("FORMTXT_ENGINE_PORT", "0") - .env("FORMTXT_PARENT_PID", std::process::id().to_string()) - .env("FORMTXT_SHELL_PID", std::process::id().to_string()) - .env("FORMTXT_WINDOW_KEY_STDOUT", "1"); - let (mut rx, child) = sidecar.spawn().expect("the FormTxt engine failed to spawn"); + let started = engine.and_then(|engine| { + engine + .env("FORMTXT_PORT", "0") + .env("FORMTXT_ENGINE_PORT", "0") + .env(engine_start::PARENT_ENV, std::process::id().to_string()) + .env(engine_start::SHELL_ENV, std::process::id().to_string()) + .env("FORMTXT_WINDOW_KEY_STDOUT", "1") + .spawn() + .map_err(|err| engine_start::Failure::NotStarted(err.to_string())) + }); + let (mut rx, child) = match started { + Ok(pair) => pair, + Err(failure) => { + std::thread::spawn(move || engine_failed(&handle, failure, &engine_start::Tail::default())); + return Ok(()); + } + }; + #[cfg(windows)] + win_job::hold_pid(child.pid()); *app.state::().0.lock().unwrap() = Some(child); tauri::async_runtime::spawn(async move { let pattern = regex::Regex::new(r"http://127\.0\.0\.1:(\d+)").unwrap(); let key_pattern = regex::Regex::new(r"formtxt-window-key: ([A-Za-z0-9_-]{32,})").unwrap(); + let (tx, mut events) = tauri::async_runtime::channel::(64); + let late = tx.clone(); + tauri::async_runtime::spawn(async move { + while let Some(event) = rx.recv().await { + if tx.send(Ok(event)).await.is_err() { + break; + } + } + let _ = tx.send(Err(None)).await; + }); + start_limit(&late, engine_start::Wait::Address.limit(), Some(engine_start::Wait::Address)); let mut port: Option = None; let mut key: Option = None; - while let Some(event) = rx.recv().await { - let text = match event { - CommandEvent::Stdout(bytes) | CommandEvent::Stderr(bytes) => String::from_utf8_lossy(&bytes).into_owned(), - CommandEvent::Terminated(_) => break, - _ => continue, + let mut waiting = false; + let mut stopped = false; + let mut tail = engine_start::Tail::default(); + let mut failure = engine_start::Failure::Stopped(None); + while let Some(step) = events.recv().await { + let text = match step { + Ok(CommandEvent::Stdout(bytes)) | Ok(CommandEvent::Stderr(bytes)) => String::from_utf8_lossy(&bytes).into_owned(), + Ok(CommandEvent::Terminated(ended)) => { + failure = engine_start::Failure::Stopped(ended.code); + stopped = true; + start_limit(&late, engine_start::EXIT_WAIT, None); + continue; + } + Ok(_) => continue, + Err(None) => break, + Err(Some(_)) if stopped => break, + Err(Some(engine_start::Wait::Address)) if port.is_some() => continue, + Err(Some(wait)) => { + failure = engine_start::Failure::TimedOut(wait); + break; + } }; if key.is_none() { - key = key_pattern.captures(&text).map(|c| c[1].to_string()); + key = key_pattern.captures(&text).map(|found| found[1].to_string()); + } + for line in text.lines() { + tail.push(line); } - if let Some(found) = pattern.captures(&text).and_then(|c| c[1].parse::().ok()) { - port = Some(found); + if port.is_none() { + port = pattern.captures(&text).and_then(|c| c[1].parse::().ok()); + } + if port.is_some() && key.is_some() { break; } - } - let grace = std::time::Instant::now() + std::time::Duration::from_secs(10); - while port.is_some() && key.is_none() && std::time::Instant::now() < grace { - match rx.try_recv() { - Ok(CommandEvent::Stdout(bytes)) | Ok(CommandEvent::Stderr(bytes)) => { - key = key_pattern.captures(&String::from_utf8_lossy(&bytes)).map(|c| c[1].to_string()); - } - Ok(_) => {} - Err(_) => { - let _ = tauri::async_runtime::spawn_blocking(|| std::thread::sleep(std::time::Duration::from_millis(20))).await; - } + if port.is_some() && !waiting { + waiting = true; + start_limit(&late, engine_start::Wait::Key.limit(), Some(engine_start::Wait::Key)); } } - if key.is_none() { - port = None; - } - match port { + drop(late); + match port.filter(|_| key.is_some()) { Some(port) => { let url: tauri::Url = format!("http://127.0.0.1:{port}").parse().unwrap(); - open_main(&handle, url, key); - } - None => { - let _ = handle - .dialog() - .message("FormTxt could not start its engine. If FormTxt is already open, use that window: only one copy can use its data folder at a time. Otherwise open FormTxt again. The engine's log is Logs/formtxt-engine.log in the FormTxt data folder.") - .blocking_show(); - close_splash(&handle); - kill_backend(&handle); - handle.exit(1); + if !open_main(&handle, url, key) { + engine_failed(&handle, engine_start::Failure::Window, &engine_start::Tail::default()); + } } + None => engine_failed(&handle, failure, &tail), } }); Ok(()) diff --git a/src-tauri/src/win_job.rs b/src-tauri/src/win_job.rs new file mode 100644 index 0000000..1fb27ea --- /dev/null +++ b/src-tauri/src/win_job.rs @@ -0,0 +1,59 @@ +use std::sync::OnceLock; + +use windows_sys::Win32::Foundation::{CloseHandle, HANDLE}; +use windows_sys::Win32::System::JobObjects::{ + AssignProcessToJobObject, CreateJobObjectW, JobObjectExtendedLimitInformation, SetInformationJobObject, TerminateJobObject, + JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, +}; +use windows_sys::Win32::System::Threading::{OpenProcess, PROCESS_SET_QUOTA, PROCESS_TERMINATE}; + +static JOB: OnceLock = OnceLock::new(); + +fn create() -> usize { + unsafe { + let handle = CreateJobObjectW(std::ptr::null(), std::ptr::null()); + if handle.is_null() { + return 0; + } + let mut limits: JOBOBJECT_EXTENDED_LIMIT_INFORMATION = std::mem::zeroed(); + limits.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; + let set = SetInformationJobObject( + handle, + JobObjectExtendedLimitInformation, + std::ptr::addr_of!(limits).cast(), + std::mem::size_of::() as u32, + ); + if set == 0 { + CloseHandle(handle); + return 0; + } + handle as usize + } +} + +fn job() -> Option { + let raw = *JOB.get_or_init(create); + (raw != 0).then_some(raw as HANDLE) +} + +pub fn hold_pid(pid: u32) -> bool { + let Some(handle) = job() else { + return false; + }; + unsafe { + let process = OpenProcess(PROCESS_SET_QUOTA | PROCESS_TERMINATE, 0, pid); + if process.is_null() { + return false; + } + let held = AssignProcessToJobObject(handle, process) != 0; + CloseHandle(process); + held + } +} + +pub fn end() -> bool { + match JOB.get().copied() { + Some(raw) if raw != 0 => unsafe { TerminateJobObject(raw as HANDLE, 1) != 0 }, + _ => false, + } +} From 8a22c165ce405a6da1e31eaa8c850891730a45a4 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 02:48:14 -0500 Subject: [PATCH 3/6] build(windows): the engine is packaged with no console window unless FORMTXT_ENGINE_WINDOWED is 0 By the owner's decision for every app of the family, a Windows build of the engine gives PyInstaller --noconsole, as FormWeb's does. FormTxt had no switch; FORMTXT_ENGINE_WINDOWED is the family's name, on unless it is 0. On macOS and Linux nothing changes. The engine entry already puts the null device where a stream is missing, so --selfcheck and serving work with no standard output. setup/freeze_backend: one line. setup/freeze_backend.bat: two lines before the PyInstaller line and the variable in it. backend/HASHOUT_LOG.md has the reason. Run: bash -n on setup/freeze_backend; the batch file read line by line, its line endings unchanged. No Windows build has shown it. --- backend/HASHOUT_LOG.md | 6 ++++++ setup/freeze_backend | 1 + setup/freeze_backend.bat | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index bef9a81..a6401e3 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -7,6 +7,12 @@ Last updated: 2026-11-19 · v0.36.0: one engine per data folder, the engine's lo --- +## after v0.36.0 · the Windows engine is built with no console window unless FORMTXT_ENGINE_WINDOWED is 0 (2026-11-20) + +- setup/freeze_backend :: the line after `FORMTXT_PYI_ARCH`; setup/freeze_backend.bat :: the two lines before the PyInstaller line and `%WINDOWED%` in it · by the owner's decision for every app of the family, a Windows build gives PyInstaller `--noconsole`, as FormWeb's does, unless `FORMTXT_ENGINE_WINDOWED=0`. FormTxt had no switch before; this is the family's name for it, on by default. On macOS and Linux the variable does nothing. The shell reads the engine's address and key from its pipes, which a window program still has when its parent gives them. +- The engine entry already replaces missing streams with the null device (`formtxt_engine.py`, its first lines, since 0.35.0), so `--selfcheck` and serving still work when `sys.stdout` is None; `--selfcheck` at the end of the build still returns its exit code, and its words are seen only when its output goes to a file or a pipe. For the old console build, to read the engine's words in its window, set `FORMTXT_ENGINE_WINDOWED=0`. +- Checked with `bash -n` and by reading the batch file. No Windows build has shown it. + ## after v0.36.0 · the shell side: the job object on Windows, the failure text, a limit on the wait for the address (2026-11-20) - src-tauri/src/win_job.rs (new, Windows only) :: `hold_pid`, `end` · FormVis's file at its main less `hold(&child)`, which takes a `std::process::Child` that FormTxt's shell never has. The job is made on first use with kill-on-close and kept for the life of the shell; nothing closes its handle, so Windows ends the engine and all it started when the shell ends, however it ends. Only the engine goes in, by its process id, right after the start. diff --git a/setup/freeze_backend b/setup/freeze_backend index aca3285..1c213f8 100755 --- a/setup/freeze_backend +++ b/setup/freeze_backend @@ -22,6 +22,7 @@ if [ "$os" = windows ]; then ext=".exe"; sep=";"; fi cd "$FORMTXT_ROOT/backend" extra=() [ -z "${FORMTXT_PYI_ARCH:-}" ] || extra+=(--target-arch "$FORMTXT_PYI_ARCH") +if [ "$os" = windows ] && [ "${FORMTXT_ENGINE_WINDOWED:-1}" != 0 ]; then extra+=(--noconsole); fi mode=--onefile if [ "$os" = macos ]; then mode=--onedir diff --git a/setup/freeze_backend.bat b/setup/freeze_backend.bat index 1cee241..ee6cabb 100644 --- a/setup/freeze_backend.bat +++ b/setup/freeze_backend.bat @@ -12,7 +12,9 @@ if "%TRIPLE%"=="" ( echo [formtxt] rustc not found, install Rust from https://ru cd backend if exist build\pyinstaller rmdir /s /q build\pyinstaller if exist dist-engine rmdir /s /q dist-engine -pyinstaller --noconfirm --clean --onefile --name formtxt-engine --distpath dist-engine --workpath build\pyinstaller --specpath build\pyinstaller ^ +set "WINDOWED=--noconsole" +if "%FORMTXT_ENGINE_WINDOWED%"=="0" set "WINDOWED=" +pyinstaller --noconfirm --clean --onefile %WINDOWED% --name formtxt-engine --distpath dist-engine --workpath build\pyinstaller --specpath build\pyinstaller ^ --add-data "%ROOT%\frontend\dist;frontend_dist" ^ --add-data "%ROOT%\frontend\node_modules\@fontsource;fonts" ^ --add-data "%ROOT%\frontend\node_modules\wordnet-db\dict;wordnet" ^ From 872439683375c35c88389461a7c16e692a8716b1 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 03:02:08 -0500 Subject: [PATCH 4/6] fix(prefs): the note on outside agents names Antigravity beside Claude Code, Codex and Cursor An Antigravity tab in the terminal dock is given its own key by the engine, as the Codex and Cursor tabs are, so it is already allowed without asking; the sentence under Outside agents in Preferences now says so, with the four programs in the family's order. FormTxt carries no translations of Preferences. Program path: FormTxt has no Preferences field or stored value for where Claude Code is (the finder's setting is always None; the environment overrides already cover all four programs), so there is nothing to add for the other three. frontend/src/ui/prefs/dialog.ts: one sentence. frontend/HASHOUT_LOG.md has the reason. --- frontend/HASHOUT_LOG.md | 4 +++- frontend/src/ui/prefs/dialog.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 57fabf2..290814b 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -3,7 +3,9 @@ Living log of comment content, rationale and removed code for the frontend. Source files stay comment-free; read this first, then edit surgically. Current build version: v0.36.0 -Last updated: 2026-11-19 · v0.36.0 has no change in the frontend; the engine's start and stop are in the backend log. Before: 2026-11-19 · v0.35.0: the family's dock module 2.2.0 with Antigravity as the fourth agent tab, and the finder's sentences read as a missing program (entries below, headed "after v0.34.0" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-19 · v0.34.0: the family's terminal dock at the bottom or the right, its question about outside agents, Block all agents, database merge data, repeating rows, groups and totals, report run (entries below, headed "v0.34.0, not released yet" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-17 · v0.33.0: AMOLED Black, a true-black theme, and Dark Page at full inversion under it (entries below); the three browser demo pages were not rebuilt, so they still say 0.32.0 and do not offer the theme. Before: 2026-11-14 · v0.32.1 has no change in the window; the macOS freeze fix is in the backend log, and the three browser demo pages were not rebuilt, so they still say 0.32.0. Before: 2026-11-13 · v0.32.0: Read and Focus mode show the document again, the sparkle ban covers insertable icons and emoji, the inline mark in the title bar and About, browser demo pages (entries below). Before: 2026-11-13 · the v0.31.0 family release pass: Home, the terminal dock with Claude Code, demos, no sparkle icon (entries below). Before: 2026-11-13 · the v0.30.8 review fixes, second pass. +Last updated: 2026-11-20 · after v0.36.0: Preferences' sentence on outside agents names all four agent programs (entry below, headed "after v0.36.0"). Before: 2026-11-19 · v0.36.0 has no change in the frontend; the engine's start and stop are in the backend log. Before: 2026-11-19 · v0.35.0: the family's dock module 2.2.0 with Antigravity as the fourth agent tab, and the finder's sentences read as a missing program (entries below, headed "after v0.34.0" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-19 · v0.34.0: the family's terminal dock at the bottom or the right, its question about outside agents, Block all agents, database merge data, repeating rows, groups and totals, report run (entries below, headed "v0.34.0, not released yet" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-17 · v0.33.0: AMOLED Black, a true-black theme, and Dark Page at full inversion under it (entries below); the three browser demo pages were not rebuilt, so they still say 0.32.0 and do not offer the theme. Before: 2026-11-14 · v0.32.1 has no change in the window; the macOS freeze fix is in the backend log, and the three browser demo pages were not rebuilt, so they still say 0.32.0. Before: 2026-11-13 · v0.32.0: Read and Focus mode show the document again, the sparkle ban covers insertable icons and emoji, the inline mark in the title bar and About, browser demo pages (entries below). Before: 2026-11-13 · the v0.31.0 family release pass: Home, the terminal dock with Claude Code, demos, no sparkle icon (entries below). Before: 2026-11-13 · the v0.30.8 review fixes, second pass. + +- after v0.36.0 (the agent programs named in Preferences). `ui/prefs/dialog.ts` :: the note under Outside agents · the sentence that lists the programs allowed without asking now reads "Claude Code, Codex, Cursor, Antigravity and Chat in the terminal dock": an Antigravity tab gets its own key from the engine as the Codex and Cursor tabs do (`agent_programs.open_terminal`), so it was allowed already and the sentence left it out. FormTxt carries no translations of Preferences, so there is no table to change. Found with a search for "Cursor" across the frontend's strings; the dock's own sentences are the shared module's. - after v0.34.0 (family dock, module 2.2.0, and Antigravity as the fourth agent tab). `dock/` (the family's shared module 2.2.0, copied whole and byte for byte from FormVis ddc893ae `frontend/src/dock/`: 16 entries with `MANIFEST.json`, `agents.ts` is new, `MANIFEST.json` and 9 others changed), `dock-adapter.ts` :: `formtxtDock`. - The module takes its agent kinds from the adapter. The adapter is typed `DockAdapter<'antigravity'>` and `tabs().builtin` ends with `'antigravity'`. Nothing else in the adapter changed: `agentStatus()` already passes on the engine's `/agents/status` answer, which has the `antigravity` key (`installed`, `version`, `install`, `signedIn: null`), and `terminal.open` already sends every kind that is not `shell` or `claude` to `POST /terminal/agent`, which now takes `antigravity`. `app.ts` holds the dock without a written type, so it is inferred. diff --git a/frontend/src/ui/prefs/dialog.ts b/frontend/src/ui/prefs/dialog.ts index 6e146f4..f4716ef 100644 --- a/frontend/src/ui/prefs/dialog.ts +++ b/frontend/src/ui/prefs/dialog.ts @@ -285,7 +285,7 @@ class PrefsDialog { this.add('Privacy', grp('Online features', this.stockRow.el, this.previewRow.el, nt('Stock pictures contact Openverse and, with a key, Pexels, through the engine. Link previews fetch the title of a page you link to. Nothing else leaves this computer unless you turn on AI or cloud storage.')), grp('Pexels', this.pexelsRow.el, this.pexelsForget.el, this.privacyNote), - grp('Outside agents', this.agentsRow.el, this.blockRow.el, nt('Agents you run outside FormTxt, such as Claude Code in your own terminal, reach the open window through FormTxt\'s MCP server on this computer. While Allow outside agents is off, each command such an agent runs asks you in the window. Claude Code, Codex, Cursor and Chat in the terminal dock are allowed without asking. Block all agents refuses every agent, the ones in the terminal dock included; the dock and its plain shell still open.'))); + grp('Outside agents', this.agentsRow.el, this.blockRow.el, nt('Agents you run outside FormTxt, such as Claude Code in your own terminal, reach the open window through FormTxt\'s MCP server on this computer. While Allow outside agents is off, each command such an agent runs asks you in the window. Claude Code, Codex, Cursor, Antigravity and Chat in the terminal dock are allowed without asking. Block all agents refuses every agent, the ones in the terminal dock included; the dock and its plain shell still open.'))); const wrap = el('
'); wrap.append(this.pages); From 80eb980a3cfda9f4b9391074263412ab4ef871d1 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 03:06:18 -0500 Subject: [PATCH 5/6] feat(dock): the shared panel module is 2.2.1, its guide names Codex, Cursor and Antigravity frontend/src/dock/ is copied whole from FormVis 23b01889, every file with MANIFEST.json. The guide's two sentences about Claude Code now say that Codex, Cursor and Antigravity each get a button of their own when they are on this computer. FormTxt pins no module version in its checks and has no translations of the panel's sentences. frontend/HASHOUT_LOG.md has the entry. Run: backend/tests/test_dock_manifest.py, 7 passed; setup/agents.py check clean. --- frontend/HASHOUT_LOG.md | 2 ++ frontend/src/dock/CONTRACT.md | 6 +++++- frontend/src/dock/MANIFEST.json | 6 +++--- frontend/src/dock/strings.ts | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index 290814b..e03b61f 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -5,6 +5,8 @@ Living log of comment content, rationale and removed code for the frontend. Sour Current build version: v0.36.0 Last updated: 2026-11-20 · after v0.36.0: Preferences' sentence on outside agents names all four agent programs (entry below, headed "after v0.36.0"). Before: 2026-11-19 · v0.36.0 has no change in the frontend; the engine's start and stop are in the backend log. Before: 2026-11-19 · v0.35.0: the family's dock module 2.2.0 with Antigravity as the fourth agent tab, and the finder's sentences read as a missing program (entries below, headed "after v0.34.0" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-19 · v0.34.0: the family's terminal dock at the bottom or the right, its question about outside agents, Block all agents, database merge data, repeating rows, groups and totals, report run (entries below, headed "v0.34.0, not released yet" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-17 · v0.33.0: AMOLED Black, a true-black theme, and Dark Page at full inversion under it (entries below); the three browser demo pages were not rebuilt, so they still say 0.32.0 and do not offer the theme. Before: 2026-11-14 · v0.32.1 has no change in the window; the macOS freeze fix is in the backend log, and the three browser demo pages were not rebuilt, so they still say 0.32.0. Before: 2026-11-13 · v0.32.0: Read and Focus mode show the document again, the sparkle ban covers insertable icons and emoji, the inline mark in the title bar and About, browser demo pages (entries below). Before: 2026-11-13 · the v0.31.0 family release pass: Home, the terminal dock with Claude Code, demos, no sparkle icon (entries below). Before: 2026-11-13 · the v0.30.8 review fixes, second pass. +- after v0.36.0 (family dock, module 2.2.1). `dock/` copied whole and byte for byte from FormVis 23b01889 `frontend/src/dock/`, every file with `MANIFEST.json`: `strings.ts` (the guide's two sentences about Claude Code now say that Codex, Cursor and Antigravity each get a button when they are on this computer), `CONTRACT.md` and `MANIFEST.json` changed, the rest the same bytes. FormTxt's checks pin no module version and FormTxt has no translations of the panel's sentences, so nothing else changed. Checked: `tests/test_dock_manifest.py` 7 passed, `setup/agents.py check` clean. + - after v0.36.0 (the agent programs named in Preferences). `ui/prefs/dialog.ts` :: the note under Outside agents · the sentence that lists the programs allowed without asking now reads "Claude Code, Codex, Cursor, Antigravity and Chat in the terminal dock": an Antigravity tab gets its own key from the engine as the Codex and Cursor tabs do (`agent_programs.open_terminal`), so it was allowed already and the sentence left it out. FormTxt carries no translations of Preferences, so there is no table to change. Found with a search for "Cursor" across the frontend's strings; the dock's own sentences are the shared module's. - after v0.34.0 (family dock, module 2.2.0, and Antigravity as the fourth agent tab). `dock/` (the family's shared module 2.2.0, copied whole and byte for byte from FormVis ddc893ae `frontend/src/dock/`: 16 entries with `MANIFEST.json`, `agents.ts` is new, `MANIFEST.json` and 9 others changed), `dock-adapter.ts` :: `formtxtDock`. diff --git a/frontend/src/dock/CONTRACT.md b/frontend/src/dock/CONTRACT.md index a52a17e..81f3a05 100644 --- a/frontend/src/dock/CONTRACT.md +++ b/frontend/src/dock/CONTRACT.md @@ -1,6 +1,6 @@ # The dock's engine contract -Module version 2.2.0. This file travels with the shared dock folder and is the same in every app. +Module version 2.2.1. This file travels with the shared dock folder and is the same in every app. The dock's frontend never talks to an engine. It calls the functions of `DockAdapter` (adapter.ts), and each app's adapter turns them into its engine's routes, sockets or event streams. This file says what an engine has to provide so that an adapter can deliver each function, in words that do not depend on the engine's language. Paths, header names and transports are each app's own. Where a clause says "the adapter", the engine may do the work instead; where it says "the engine", the adapter cannot make it up. @@ -68,6 +68,10 @@ An adapter written for 2.1.0 compiles and behaves as before: copying the 2.2.0 f - **Part names.** Every control of the module carries `data-dock-part`; the attribute and the names are `DOCK_PUBLIC.partAttribute`, `parts` and `partsByKind` (`launch.[kind]`, `menu.launch.[kind]`, `tab.[kind]`). Automation and command layers use these and no class name. - **A status line for a tab.** A terminal record may carry `status`, and a channel may give `onStatus(handler)` and call the handler with new text ("reconnecting", an exit code). The text of the tab in front shows in the head between the tabs and the buttons, clipped; an empty string clears it. +## Module 2.2.1 + +The guide's two sentences for a computer that has Claude Code (`tourInstalledBody` and `tourReadyBody`) now end by naming the other three programs: "Codex, Cursor and Antigravity each get a button of their own here when they are on this computer." Nothing else in the folder changed, and an adapter written for 2.2.0 needs no change; an app that translates the module's sentences translates these two again. + ## The manifest `MANIFEST.json` in this folder lists the module version and the SHA-256 of every other file here, this one included. The source app (FormVis) writes it; every other app only checks it: read the file names and hashes from the manifest, hash each file's bytes, and fail naming any file that differs, is missing or is extra. The check is small enough to write in any language an app's tools use. diff --git a/frontend/src/dock/MANIFEST.json b/frontend/src/dock/MANIFEST.json index 819f4ea..c2ee1fa 100644 --- a/frontend/src/dock/MANIFEST.json +++ b/frontend/src/dock/MANIFEST.json @@ -1,8 +1,8 @@ { "module": "dock", - "version": "2.2.0", + "version": "2.2.1", "files": { - "CONTRACT.md": "ccef67fcf0017569c0bf68df0eae2e1e3ddf376117ac929789b803713c427df6", + "CONTRACT.md": "9791fa9d5eb7ef7e09543d34c2d097cfe6559b7fa1792f251afb9abfa7ac0bd7", "adapter.ts": "1128c16892424485fe68bb2bf92ebc7229a9c2ff749db2fcd2419662d9c3ada9", "agents.ts": "db666d1042555f8bbda4a697dbfc475df23779d0c5a25abd532bcfa43ae81043", "chat.ts": "994878030b9fbff729734d34e2baa5b018e7d0b8555c24bfb7c98962c50446fa", @@ -14,7 +14,7 @@ "keys.ts": "1adfc7daefa35b0e6eb8957250dca3926ded1c59fd51db7d60da6346caf0d561", "placement.ts": "0f7e03ef0b720af07995111f30dcb5ed124529d44cf5cb67ae4bfb1f96c7f880", "state.ts": "bef508e8343737f67adfbd7ae8cb8efb446968dfd4e7e0aff37da11f996955d7", - "strings.ts": "19a6a32f235b61dfed6179e2271a6d599f4357c9a6b9c09118bb65990d1e114f", + "strings.ts": "3654a59c4d005125e248dd322f467d4ad3c513f4fd86f6dfe76f5565408ac50e", "terminal.ts": "8bf886a7ad4dc69323e803acc13641a66e1d8614e9b85a6a60977fa30d8a56fc", "tour.ts": "2f83994051f4370c5d1630a827b4539eb12fd50e7fe9531f5641a4bf75615782" } diff --git a/frontend/src/dock/strings.ts b/frontend/src/dock/strings.ts index 1aae816..ec8296c 100644 --- a/frontend/src/dock/strings.ts +++ b/frontend/src/dock/strings.ts @@ -84,13 +84,13 @@ export const STRINGS = { tourChatTitle: 'Ask for something in plain words', tourChatBody: 'Type what you want in this line, for example "{example}", and press Enter. Claude does it in {app}.', tourInstalledTitle: 'Claude Code is installed', - tourInstalledBody: 'Claude Code is installed. The robot button here opens it; the first time, it may ask you to sign in.', + tourInstalledBody: 'Claude Code is installed. The robot button here opens it; the first time, it may ask you to sign in. Codex, Cursor and Antigravity each get a button of their own here when they are on this computer.', tourMissingTitle: 'Claude Code is not on this computer yet', tourMissingBody: 'For the bigger jobs, {app} uses a free program called Claude Code. To add it, copy the line below, open your computer\'s command window, paste it and press Enter.', tourSignInTitle: 'Sign in to Claude Code once', tourSignInBody: 'Claude Code is installed but not signed in. Press the robot button here: a window opens where you type /login and follow the steps. You only do this once.', tourReadyTitle: 'Claude Code is ready', - tourReadyBody: 'Claude Code is installed and signed in. The robot button here opens it when you want it to take on a bigger job.', + tourReadyBody: 'Claude Code is installed and signed in. The robot button here opens it when you want it to take on a bigger job. Codex, Cursor and Antigravity each get a button of their own here when they are on this computer.', tourAskTitle: 'You decide what other programs may change', tourAskBody: 'If another AI program on this computer wants to change your {noun}, {app} asks you first in a box in the middle of the window. Choose Deny, Allow once or Always allow. You can change your answer later under Outside agents in the menu here.', tourSideTitle: 'Put the panel where you like it', From cc011a7c10399fe6cccde719b15ff5a9507a3b42 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Fri, 20 Nov 2026 03:19:24 -0500 Subject: [PATCH 6/6] release: 0.37.0 Version sites, as 0.36.0 did them: README.md (badge and line), backend/app/__init__.py, frontend/package.json, frontend/package-lock.json (the project's two fields), frontend/src/version.ts, src-tauri/Cargo.toml, src-tauri/Cargo.lock (formtxt's own version), src-tauri/tauri.conf.json, the current build version in backend/HASHOUT_LOG.md and frontend/HASHOUT_LOG.md, and the CHANGELOG entry. Run on the tip before this commit: backend suite 223 passed; npm ci --dry-run, npm audit 0 vulnerabilities, typecheck and build passed; compileall, --selfcheck and the engine probe passed; shell syntax, agents check, mcpb check, icon rules and the markdown check clean; the window check 2 passed; the Windows type check of the shell exit 0, no error, no warning. After the bump: tests/test_f5_boot.py, test_f4_versions.py, test_versions_protection.py and test_dock_manifest.py passed, mcpb check stamps 0.37.0, agents check clean. --- CHANGELOG.md | 10 ++++++++++ README.md | 4 ++-- backend/HASHOUT_LOG.md | 2 +- backend/app/__init__.py | 2 +- frontend/HASHOUT_LOG.md | 2 +- frontend/package-lock.json | 4 ++-- frontend/package.json | 2 +- frontend/src/version.ts | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 11 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e39d7..cfbfdd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.37.0 · 2026-11-20 + +- On Windows, the engine now ends with FormTxt however FormTxt ends, Task Manager included, and takes everything it started with it. +- When FormTxt cannot start its engine, the message now says what happened, shows the engine's last lines and its exit code, and says where its log is. A second copy of FormTxt on the same folder shows the engine's own line saying that FormTxt is already running there. +- FormTxt waits at most 90 seconds for its engine to start and then says so, where before it could wait without end. A missing or unstartable engine program is now a message too, where FormTxt closed without a word. +- On Windows the engine is built with no console window. Setting `FORMTXT_ENGINE_WINDOWED=0` before a build gives the old console build. +- On macOS, an engine left running that has already ended is now recognised as gone, so the next start no longer refuses with "could not stop an engine that was left running". +- Preferences names Antigravity beside Claude Code, Codex and Cursor among the agents in the terminal panel that are allowed without asking, and the terminal panel's guide says that Codex, Cursor and Antigravity each get a button when they are on this computer. +- Nothing in this release was run on Windows or macOS, and the desktop app was not built. + ## 0.36.0 · 2026-11-19 - Only one FormTxt engine uses a data folder at a time. A second copy of FormTxt started on the same folder is told that FormTxt is already running there, and the first copy carries on undisturbed. diff --git a/README.md b/README.md index 0a98ea5..8412627 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- version 0.36.0 + version 0.37.0 TypeScript and Vite Python and FastAPI macOS, Windows, Linux @@ -24,7 +24,7 @@ Run it from source

-Version 0.36.0 · Apache-2.0 · macOS, Windows, Linux (browser, or the desktop app built with ./build_app) +Version 0.37.0 · Apache-2.0 · macOS, Windows, Linux (browser, or the desktop app built with ./build_app)
diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index a6401e3..a1e306b 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of comment content, rationale and removed code for the engine. Source files stay comment-free; read this first, then edit surgically. -Current build version: v0.36.0 +Current build version: v0.37.0 Last updated: 2026-11-19 · v0.36.0: one engine per data folder, the engine's log file, an engine started alone opens the app, the engine leaving with its app by the family's watch, and in the shell the failure sentence before the loading window closes (sections below, headed "after v0.35.0" as they were written). Before: 2026-11-19 · v0.35.0: the family's finder for the agent programs at 1.0.1, an Antigravity tab, agents install for Antigravity, tests that find only stand-ins, the engine starting with no output streams (sections below, headed "after v0.34.0" as they were written). Before: 2026-11-19 · v0.34.0: database merge data, list reports and report run, changes only from the window, the outside-agent question with Allow once and Block all agents, Codex and Cursor tabs (sections below, headed "v0.34.0, not released yet" as they were written). Before: 2026-11-17 · v0.33.0 has no change in the engine; the AMOLED Black theme is in the frontend log. Before: 2026-11-14 · v0.32.1: the macOS freeze keeps the Python library loadable inside the app bundle (section below). Before: 2026-11-13 · v0.32.0 has no change in the engine; `setup/icon_rules.py` also checks the insertable icon and emoji data (frontend log). Before: 2026-11-13 · v0.31.0: MCP, terminals and Claude Code in the engine, the agent kit (section below). Before: 2026-11-13 · the v0.30.8 fixes to the engine entry and scripts (section below). Before: 2026-11-12 · the v0.30.7 review fixes. Before: 2026-10-31 · .js, .mjs and .css keep their types on Windows; the Linux packages pull in the media plugins. Before: macOS engine signed for notarization --- diff --git a/backend/app/__init__.py b/backend/app/__init__.py index d9f2629..2d93b0c 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1 +1 @@ -__version__ = "0.36.0" +__version__ = "0.37.0" diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index e03b61f..3a313fb 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -2,7 +2,7 @@ Living log of comment content, rationale and removed code for the frontend. Source files stay comment-free; read this first, then edit surgically. -Current build version: v0.36.0 +Current build version: v0.37.0 Last updated: 2026-11-20 · after v0.36.0: Preferences' sentence on outside agents names all four agent programs (entry below, headed "after v0.36.0"). Before: 2026-11-19 · v0.36.0 has no change in the frontend; the engine's start and stop are in the backend log. Before: 2026-11-19 · v0.35.0: the family's dock module 2.2.0 with Antigravity as the fourth agent tab, and the finder's sentences read as a missing program (entries below, headed "after v0.34.0" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-19 · v0.34.0: the family's terminal dock at the bottom or the right, its question about outside agents, Block all agents, database merge data, repeating rows, groups and totals, report run (entries below, headed "v0.34.0, not released yet" as they were written); the three browser demo pages were not rebuilt, so they still say 0.32.0 and carry the old dock. Before: 2026-11-17 · v0.33.0: AMOLED Black, a true-black theme, and Dark Page at full inversion under it (entries below); the three browser demo pages were not rebuilt, so they still say 0.32.0 and do not offer the theme. Before: 2026-11-14 · v0.32.1 has no change in the window; the macOS freeze fix is in the backend log, and the three browser demo pages were not rebuilt, so they still say 0.32.0. Before: 2026-11-13 · v0.32.0: Read and Focus mode show the document again, the sparkle ban covers insertable icons and emoji, the inline mark in the title bar and About, browser demo pages (entries below). Before: 2026-11-13 · the v0.31.0 family release pass: Home, the terminal dock with Claude Code, demos, no sparkle icon (entries below). Before: 2026-11-13 · the v0.30.8 review fixes, second pass. - after v0.36.0 (family dock, module 2.2.1). `dock/` copied whole and byte for byte from FormVis 23b01889 `frontend/src/dock/`, every file with `MANIFEST.json`: `strings.ts` (the guide's two sentences about Claude Code now say that Codex, Cursor and Antigravity each get a button when they are on this computer), `CONTRACT.md` and `MANIFEST.json` changed, the rest the same bytes. FormTxt's checks pin no module version and FormTxt has no translations of the panel's sentences, so nothing else changed. Checked: `tests/test_dock_manifest.py` 7 passed, `setup/agents.py check` clean. diff --git a/frontend/package-lock.json b/frontend/package-lock.json index bfb515e..16b16b4 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "formtxt", - "version": "0.36.0", + "version": "0.37.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "formtxt", - "version": "0.36.0", + "version": "0.37.0", "license": "Apache-2.0", "dependencies": { "@fontsource/ibm-plex-sans": "5.3.0", diff --git a/frontend/package.json b/frontend/package.json index 848c1d2..328922f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "formtxt", "private": true, - "version": "0.36.0", + "version": "0.37.0", "description": "FormTxt: documents in the form family, an open alternative to Word and Google Docs", "license": "Apache-2.0", "type": "module", diff --git a/frontend/src/version.ts b/frontend/src/version.ts index 599ca7e..b209abe 100644 --- a/frontend/src/version.ts +++ b/frontend/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.36.0'; +export const VERSION = '0.37.0'; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index ccbb461..cdbd0d8 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -865,7 +865,7 @@ dependencies = [ [[package]] name = "formtxt" -version = "0.36.0" +version = "0.37.0" dependencies = [ "fontdb", "objc2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index cc8bcc5..401505d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formtxt" -version = "0.36.0" +version = "0.37.0" description = "FormTxt desktop shell" authors = ["nodemode-ai"] license = "Apache-2.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 863922a..1944761 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "FormTxt", - "version": "0.36.0", + "version": "0.37.0", "identifier": "ai.nodemode.formtxt", "build": { "devUrl": "http://localhost:5210",