From fd09972bd813599ca85eaf9b12f48bde3cfbf2fa Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Thu, 19 Nov 2026 22:34:01 -0500 Subject: [PATCH 1/3] feat(engine): one engine per data folder, a log file, and the engine leaves with its app The family's start and stop pattern, as built in FormTools, on the engine side. backend/app/core/startup.py is FormTools's file with the names at its top changed. backend/app/core/runtime.py is new: the log file Logs/formtxt-engine.log in the data folder, and the lock's taking and giving up. backend/formtxt_engine.py serves in this order: the data folder and the log (exit code 5 and one sentence when the folder cannot be made), an absent standard error kept in Logs/formtxt-engine-errors.log, a frozen engine started with no app opens the app beside it or says it serves nothing on its own (exit code 4), the lock engine.lock (a second engine is refused with one sentence and exit code 2 while the first one's app lives, and an engine whose app is gone is ended and replaced), the watch on the app, then the port, the window key line and the server as before. --selfcheck is decided first and is unchanged. Kept: FORMTXT_PARENT_PID, which the shell of 0.35.0 sets, is read after FORMTXT_SHELL_PID for the lock, the watch and the started-alone question. Removed: the entry's own _alive and watch_parent; the family's take their place. A SIGTERM now gives the lock up and exits 0 after the server has shut down. FormTxt had no lock before, so no older lock can be met. Engines started without the entry (./formtxt, uvicorn app.main:app, the test fixtures) take no lock. Seen first on Linux, Python 3.13, engines from source with stand-in shells: the three closed-stream starts answered the health route; the second engine was refused and the first kept answering; the engine left about a second after its shell ended and the lock was gone; a holder whose shell was gone was replaced (SIGTERM, and SIGKILL after five seconds for one that was stopped); damaged locks and locks naming an unrelated process were replaced and that process kept running; started alone it opened the stand-in app in each of the four install layouts and took no lock, and with no app near it exited 4 with the sentence. Tests added after that: backend/tests/test_startup.py, 15 tests, FormTools's file with FormTxt's names; run with tests/test_f5_boot.py: 18 passed. Not run: Windows, macOS, a frozen engine. --- backend/HASHOUT_LOG.md | 13 ++ backend/app/core/runtime.py | 62 +++++++ backend/app/core/startup.py | 335 ++++++++++++++++++++++++++++++++++ backend/formtxt_engine.py | 106 +++++++---- backend/tests/test_startup.py | 213 +++++++++++++++++++++ 5 files changed, 695 insertions(+), 34 deletions(-) create mode 100644 backend/app/core/runtime.py create mode 100644 backend/app/core/startup.py create mode 100644 backend/tests/test_startup.py diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index 1e35eef..5a7bab3 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -7,6 +7,19 @@ Last updated: 2026-11-19 · v0.35.0: the family's finder for the agent programs --- +## after v0.35.0 · the engine starts and stops cleanly: one engine per data folder, a log, and leaving with the app (2026-11-19) + +- core/startup.py (new) · the family's start and stop file, copied from FormTools's `backend/app/core/startup.py` at its main with only the names at its top changed (`APP`, `NAMES`, `SHELL_ENV` = `FORMTXT_SHELL_PID`, `ALONE_ENV` = `FORMTXT_NO_SHELL`, `ERRORS_NAME`). Standard library only, no import of FormTxt. `PLACES` is as FormTools has it: FormTxt's engine sits beside the app's program (the one-file engine) or in a folder `engine` under the install folder or under `Contents/Resources` (`src-tauri/src/packaged.rs`), and both are covered. +- core/runtime.py (new) :: `start_logging`, `stop_logging`, `claim`, `release` · FormTxt had no log file and no lock. The log is `Logs/formtxt-engine.log` in the data folder (1 MB, three older files kept). A second call for the same file adds the handler back to the loggers that lost it. The handler is on `formtxt`, `uvicorn` and `uvicorn.access`; `uvicorn.error` reaches it through `uvicorn`, and with the handler on both each line was written twice (seen). +- formtxt_engine.py :: `started_by`, `watch_shell`, `serve`, `main` · `--selfcheck` is decided first and is unchanged. Serving now goes: the data folder and the log (a folder that cannot be made is one sentence on standard error and exit code 5); `startup.keep_errors` (an absent standard error goes to `Logs/formtxt-engine-errors.log`); a frozen engine started with no app opens the app beside it and returns 0, or says "formtxt-engine is a part of FormTxt and serves nothing on its own" and returns 4, with no lock and no port; the lock `engine.lock` (refused with "formtxt is already running on [folder] (engine process N)." in the log and on standard error, exit code 2); the watch on the app; then the port, the window key line and the server as before. An error that ends the engine is written to the log before it is raised. +- Kept from before: `FORMTXT_PARENT_PID`, the variable the shell of 0.35.0 and older sets. `started_by` reads `FORMTXT_SHELL_PID` first and that one second, for the lock, the watch and the started-alone question, so an engine given only the older variable is not taken for one started alone. Removed: `_alive` and `watch_parent`; `startup.alive` and `startup.watch` take their place. The removed Windows `_alive` opened the process and read its exit code; the family's form waits on the handle with no time, which does not call a finished process alive while something else holds a handle to it. +- The server is `uvicorn.Server(uvicorn.Config(...))` where it was `uvicorn.run(...)`: uvicorn's log setup takes handlers off its loggers when the config is made, so the log is started a second time between the config and the run. A SIGTERM handler set before the run gives the lock up and exits 0: uvicorn shuts down, then raises the signal again, and without the handler the process ended on the signal before the lock was removed (seen: exit -15, lock left). With it: exit 0, lock and `engine.json` gone. +- No older lock exists for FormTxt, so the table's row for a lock left by a released engine has nothing to meet here. An engine of 0.35.0 or older that is still running holds no lock and is not ended by a new one; it leaves by its own watch when its app goes. +- What changes for a second start: two copies of the packaged app on one data folder used to run two engines side by side; the second engine is now refused (exit code 2). Engines started without the entry (`./formtxt`, `uvicorn app.main:app`, the test fixtures) take no lock and are as before. An engine started through the entry with no app (a development run) holds the lock with `shell` 0 and is never ended by another. +- Seen first, on Linux, Python 3.13, engines from source with stand-in shells (`sleep`), scratch scripts not kept: the entry with standard output closed, with output and error closed, and with all three closed answered `/api/health` (descriptors 0, 1 and 2 on the null device; the errors file beside the log in the last two); a second engine with another shell exited 2 with the sentence while the first kept answering, and the log had the refusal; the first exited 0 about a second after its shell was ended and the lock was gone, the same with only `FORMTXT_PARENT_PID`; a holder stopped with SIGSTOP whose shell was gone was replaced after the five seconds (ended by SIGKILL), and one that was running ended on SIGTERM; an engine with no shell holding the lock refused both a second with a shell and one without; locks holding `not json at all`, `[1, 2]`, `{"pid": "x"}` and nothing, and two naming an unrelated `sleep`, were replaced and the `sleep` kept running; a lock with a live process id and no time was obeyed. Started alone (the entry through `python -c` with `sys.frozen` set and `sys.executable` a stand-in path, a stand-in app that writes a mark): the app beside the engine, in the folder above `engine`, in `Contents/MacOS` and in `usr/bin` was opened each time, exit 0, no lock, the port did not answer; with no app near, exit 4 and the sentence; with `FORMTXT_NO_SHELL=1` it served. A data folder under a file: exit 5 and the sentence. +- Tests, added after that: `tests/test_startup.py`, FormTools's file with FormTxt's names (15 tests; the engine tests ask the health route where FormTools's read a port file, and two are added: the older variable, and the second engine refused). +- Not run: Windows and macOS (every Windows line of `startup.py`: `_kernel`, `_open_windows`, `_alive_windows`, `_created_windows`, `_end_windows`, the handle branch of `watch`, and in `open_app` the `SetDllDirectoryW` line and the detached flags), a frozen engine. + ## after v0.34.0 · the supported agent programs are named as four (2026-11-19) - `formtxt` (the launcher's usage text, the `agents` line), `README.md` (the `./formtxt mcp` line under Built for agents), `CLAUDE.md` (the agents kit line), `.claude/skills/formtxt-driving/sub-skills/terminal/SUB-SKILL.md` and `.claude/skills/formtxt-harness/sub-skills/terminal-operator/SUB-SKILL.md` (mirrored to `.agents/skills` by `./formtxt agents sync`) · where the list was Claude Code, Codex and Cursor it is now Claude Code, Codex, Cursor and Antigravity. The harness page's line about `agent_programs.py` also says the programs are found by the family's finder and where an Antigravity tab runs. diff --git a/backend/app/core/runtime.py b/backend/app/core/runtime.py new file mode 100644 index 0000000..3fbc858 --- /dev/null +++ b/backend/app/core/runtime.py @@ -0,0 +1,62 @@ +import json +import logging +import os +from logging.handlers import RotatingFileHandler +from pathlib import Path + +from app.core import startup + +LOG_NAME = "formtxt-engine.log" +LOG_BYTES = 1_048_576 +LOG_KEEP = 3 +LOGGERS = ("formtxt", "uvicorn", "uvicorn.access") +FORMAT = "%(asctime)s %(levelname)s %(name)s %(message)s" +HANDLER = "formtxt-file" + + +def start_logging(data: Path) -> Path: + folder = data / "Logs" + folder.mkdir(parents=True, exist_ok=True) + path = folder / LOG_NAME + for held in logging.getLogger("formtxt").handlers: + if held.get_name() == HANDLER and getattr(held, "baseFilename", "") == os.path.abspath(path): + for name in LOGGERS: + if held not in logging.getLogger(name).handlers: + logging.getLogger(name).addHandler(held) + return path + stop_logging() + handler = RotatingFileHandler(path, maxBytes=LOG_BYTES, backupCount=LOG_KEEP, encoding="utf-8") + handler.setFormatter(logging.Formatter(FORMAT)) + handler.set_name(HANDLER) + for name in LOGGERS: + logger = logging.getLogger(name) + logger.addHandler(handler) + if name == "formtxt": + logger.setLevel(logging.INFO) + logging.getLogger("formtxt").info("engine started, pid %s, data folder %s", os.getpid(), data) + return path + + +def stop_logging() -> None: + for name in LOGGERS: + logger = logging.getLogger(name) + for handler in list(logger.handlers): + if handler.get_name() == HANDLER: + logger.removeHandler(handler) + handler.close() + + +def claim(data: Path, shell: int) -> Path: + lock, replaced = startup.claim(data, shell) + if replaced: + logging.getLogger("formtxt").warning("an engine left running without its app was stopped (process %s)", replaced) + return lock + + +def release(data: Path) -> None: + path = data / startup.LOCK_NAME + try: + if int(json.loads(path.read_text(encoding="utf-8")).get("pid", 0)) == os.getpid(): + path.unlink() + except (OSError, ValueError, AttributeError, TypeError): + pass diff --git a/backend/app/core/startup.py b/backend/app/core/startup.py new file mode 100644 index 0000000..ae27fd8 --- /dev/null +++ b/backend/app/core/startup.py @@ -0,0 +1,335 @@ +import json +import os +import signal +import subprocess +import sys +import threading +import time +from pathlib import Path + +APP = "formtxt" +NAMES = ("formtxt", "FormTxt") +SHELL_ENV = "FORMTXT_SHELL_PID" +ALONE_ENV = "FORMTXT_NO_SHELL" +LOCK_NAME = "engine.lock" +ERRORS_NAME = "formtxt-engine-errors.log" +ERRORS_BYTES = 1_048_576 +STAND_INS = [] +PROC = "/proc" +PLACES = ("..", ".", os.path.join("..", "..", "MacOS"), os.path.join("..", "..", "..", "bin")) +STARTED = time.time() +POLL = 2.0 +END_WAIT = 5.0 +STEP = 0.1 +SLACK = 3.0 +OLD_SLACK = 180.0 +FILETIME_EPOCH = 116_444_736_000_000_000 +WINDOWS = sys.platform == "win32" +SYNCHRONIZE = 0x00100000 +QUERY_LIMITED = 0x1000 +WAIT_TIMEOUT = 0x102 +ACCESS_DENIED = 5 +NO_WINDOW = 0x08000000 +DETACHED = 0x00000008 +NEW_GROUP = 0x00000200 +FREE = "free" +BUSY = "busy" +LEFTOVER = "leftover" + + +class Busy(RuntimeError): + pass + + +def keep_errors(folder: Path) -> Path | None: + if getattr(sys.stderr, "name", None) != os.devnull: + return None + path = folder / ERRORS_NAME + try: + mode = "w" if path.stat().st_size > ERRORS_BYTES else "a" + except OSError: + mode = "a" + try: + kept = open(path, mode, encoding="utf-8", errors="replace", buffering=1) + except OSError: + return None + STAND_INS.append(sys.stderr) + sys.stderr = kept + return path + + +def _kernel(): + import ctypes + + lib = ctypes.WinDLL("kernel32", use_last_error=True) + lib.OpenProcess.restype = ctypes.c_void_p + lib.OpenProcess.argtypes = (ctypes.c_uint32, ctypes.c_int, ctypes.c_uint32) + lib.WaitForSingleObject.restype = ctypes.c_uint32 + lib.WaitForSingleObject.argtypes = (ctypes.c_void_p, ctypes.c_uint32) + lib.CloseHandle.restype = ctypes.c_int + lib.CloseHandle.argtypes = (ctypes.c_void_p,) + lib.GetProcessTimes.restype = ctypes.c_int + lib.GetProcessTimes.argtypes = (ctypes.c_void_p,) + (ctypes.POINTER(ctypes.c_uint64),) * 4 + lib.SetDllDirectoryW.restype = ctypes.c_int + lib.SetDllDirectoryW.argtypes = (ctypes.c_wchar_p,) + return lib + + +def _open_windows(pid: int, access: int): + import ctypes + + handle = _kernel().OpenProcess(access, 0, pid) + if handle: + return handle + if ctypes.get_last_error() == ACCESS_DENIED: + raise PermissionError(pid) + return None + + +def _alive_windows(pid: int) -> bool: + try: + handle = _open_windows(pid, SYNCHRONIZE) + except PermissionError: + return True + if handle is None: + return False + try: + return _kernel().WaitForSingleObject(handle, 0) == WAIT_TIMEOUT + finally: + _kernel().CloseHandle(handle) + + +def _created_windows(pid: int) -> float: + import ctypes + + try: + handle = _open_windows(pid, QUERY_LIMITED) + except PermissionError: + return 0.0 + if handle is None: + return 0.0 + try: + times = [ctypes.c_uint64(0) for _ in range(4)] + if not _kernel().GetProcessTimes(handle, *[ctypes.byref(item) for item in times]): + return 0.0 + return (times[0].value - FILETIME_EPOCH) / 10_000_000 + finally: + _kernel().CloseHandle(handle) + + +def _end_windows(pid: int) -> None: + subprocess.run( + ["taskkill", "/PID", str(pid), "/T", "/F"], + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + creationflags=NO_WINDOW, + timeout=END_WAIT * 2, + check=False, + ) + + +def _alive_posix(pid: int) -> bool: + try: + os.kill(pid, 0) + except ProcessLookupError: + return False + except PermissionError: + return True + try: + with open(f"{PROC}/{pid}/stat") as stat: + return stat.read().rpartition(")")[2].split()[0] != "Z" + except (OSError, IndexError): + return True + + +def _created_posix(pid: int) -> float: + try: + with open(f"{PROC}/{pid}/stat") as stat: + ticks = int(stat.read().rpartition(")")[2].split()[19]) + with open(f"{PROC}/stat") as stat: + boot = int(next(line for line in stat if line.startswith("btime")).split()[1]) + return boot + ticks / os.sysconf("SC_CLK_TCK") + except (OSError, IndexError, ValueError, StopIteration): + pass + found = subprocess.run( + ["ps", "-o", "etime=", "-p", str(pid)], + stdin=subprocess.DEVNULL, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + timeout=END_WAIT, + check=False, + ) + days, _, clock = found.stdout.decode("ascii", "replace").strip().rpartition("-") + parts = [int(part) for part in clock.split(":")] + if not 2 <= len(parts) <= 3: + return 0.0 + seconds = 0 + for part in parts: + seconds = seconds * 60 + part + return time.time() - seconds - int(days or 0) * 86400 + + +def alive(pid: int) -> bool: + if pid <= 0: + return False + return _alive_windows(pid) if WINDOWS else _alive_posix(pid) + + +def created(pid: int) -> float: + if pid <= 0: + return 0.0 + try: + return _created_windows(pid) if WINDOWS else _created_posix(pid) + except (OSError, ValueError, subprocess.SubprocessError): + return 0.0 + + +def moment(value) -> float: + return float(value) if isinstance(value, (int, float)) and not isinstance(value, bool) and value > 0 else 0.0 + + +def same(pid: int, born: float) -> bool: + seen = created(pid) + return alive(pid) and (not born or (seen > 0 and abs(seen - born) <= SLACK)) + + +def gone_by(pid: int, seconds: float) -> bool: + until = time.monotonic() + seconds + while alive(pid): + if time.monotonic() >= until: + return False + time.sleep(STEP) + return True + + +def end(pid: int) -> bool: + try: + if WINDOWS: + _end_windows(pid) + else: + os.kill(pid, signal.SIGTERM) + if gone_by(pid, END_WAIT): + return True + if not WINDOWS: + os.kill(pid, signal.SIGKILL) + except (OSError, subprocess.SubprocessError): + pass + return gone_by(pid, END_WAIT) + + +def number(value) -> int: + return value if isinstance(value, int) and not isinstance(value, bool) and value > 0 else 0 + + +def read_lock(path: Path) -> dict: + try: + found = json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError): + return {} + return found if isinstance(found, dict) else {} + + +def holder(lock: dict, shelled: bool) -> str: + pid = number(lock.get("pid")) + if not pid or pid == os.getpid() or not alive(pid): + return FREE + born, started, seen = moment(lock.get("born")), moment(lock.get("started")), created(pid) + if born: + if not same(pid, born): + return FREE + elif started: + if not seen or not -SLACK <= started - seen <= OLD_SLACK: + return FREE + else: + return BUSY + if "shell" not in lock: + return LEFTOVER if shelled else BUSY + shell = number(lock.get("shell")) + if not shell: + return BUSY + return BUSY if same(shell, moment(lock.get("shellBorn"))) else LEFTOVER + + +def claim(data: Path, shell: int) -> tuple[Path, int]: + path = data / LOCK_NAME + lock = read_lock(path) + held = number(lock.get("pid")) + state = holder(lock, shell > 0) + if state == BUSY: + raise Busy(f"{APP} is already running on {data} (engine process {held}).") + if state == LEFTOVER and not end(held): + raise Busy(f"{APP} could not stop an engine that was left running on {data} (engine process {held}).") + record = {"pid": os.getpid(), "started": int(STARTED), "born": created(os.getpid()), "shell": shell, "shellBorn": created(shell)} + fresh = path.with_name(f"{LOCK_NAME}.{os.getpid()}") + fresh.write_text(json.dumps(record), encoding="utf-8") + os.replace(fresh, path) + return path, held if state == LEFTOVER else 0 + + +def shell_pid() -> int: + raw = os.environ.get(SHELL_ENV, "").strip() + return int(raw) if raw.isascii() and raw.isdigit() else 0 + + +def alone() -> bool: + return bool(getattr(sys, "frozen", False)) and not shell_pid() and os.environ.get(ALONE_ENV) != "1" + + +def app_beside(engine: Path) -> Path | None: + engine = engine.resolve() + suffix = ".exe" if WINDOWS else "" + for place in PLACES: + for name in NAMES: + found = (engine.parent / place / f"{name}{suffix}").resolve() + if found != engine and found.is_file() and os.access(found, os.X_OK): + return found + return None + + +def open_app(app: Path) -> bool: + env = dict(os.environ) + if "LD_LIBRARY_PATH_ORIG" in env: + env["LD_LIBRARY_PATH"] = env.pop("LD_LIBRARY_PATH_ORIG") + elif getattr(sys, "frozen", False): + env.pop("LD_LIBRARY_PATH", None) + try: + if WINDOWS: + _kernel().SetDllDirectoryW(None) + subprocess.Popen( + [str(app)], + cwd=str(app.parent), + env=env, + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + close_fds=True, + creationflags=(DETACHED | NEW_GROUP) if WINDOWS else 0, + start_new_session=not WINDOWS, + ) + except OSError: + return False + return True + + +def watch(pid: int, leave) -> None: + direct = os.getppid() == pid + handle = None + if WINDOWS: + try: + handle = _open_windows(pid, SYNCHRONIZE) + except PermissionError: + return + + def gone() -> bool: + if handle is not None: + return _kernel().WaitForSingleObject(handle, int(POLL * 1000)) != WAIT_TIMEOUT + time.sleep(POLL) + return not alive(pid) or (direct and os.getppid() != pid) + + def run() -> None: + while not gone(): + pass + leave() + + threading.Thread(target=run, name=f"{APP}-shell-watch", daemon=True).start() diff --git a/backend/formtxt_engine.py b/backend/formtxt_engine.py index 0b1fe2c..f3cb00d 100644 --- a/backend/formtxt_engine.py +++ b/backend/formtxt_engine.py @@ -38,47 +38,61 @@ def selfcheck() -> int: return 0 if all(not str(v).startswith("missing") for v in info.values()) else 1 -def _alive(pid: int) -> bool: - if os.name == "nt": - import ctypes - - handle = ctypes.windll.kernel32.OpenProcess(0x1000, False, pid) - if not handle: - return False - code = ctypes.c_ulong() - ctypes.windll.kernel32.GetExitCodeProcess(handle, ctypes.byref(code)) - ctypes.windll.kernel32.CloseHandle(handle) - return code.value == 259 - try: - os.kill(pid, 0) - except ProcessLookupError: - return False - except PermissionError: - return True - return True +def started_by() -> int: + from app.core import startup + + shell = startup.shell_pid() + if shell: + return shell + raw = os.environ.get("FORMTXT_PARENT_PID", "").strip() + return int(raw) if raw.isascii() and raw.isdigit() else 0 -def watch_parent() -> None: - raw = os.environ.get("FORMTXT_PARENT_PID", "") - if not raw.isdigit(): +def watch_shell(data, shell: int) -> None: + if shell <= 1: return - import threading - import time + import logging - pid = int(raw) + from app.core import runtime, startup - def loop() -> None: - while _alive(pid): - time.sleep(2) + def leave() -> None: + logging.getLogger("formtxt").info("the app that started this engine is gone (process %s), stopping", shell) + runtime.release(data) os._exit(0) - threading.Thread(target=loop, name="parent-watch", daemon=True).start() + startup.watch(shell, leave) -def main() -> int: - if "--selfcheck" in sys.argv: - return selfcheck() - watch_parent() +def serve() -> int: + import logging + from pathlib import Path + + from app.core import config, runtime, startup + + try: + data = config.data_dir() + logs = runtime.start_logging(data).parent + except OSError as err: + print(f"formtxt cannot use its data folder: {err}", file=sys.stderr) + return 5 + startup.keep_errors(logs) + log = logging.getLogger("formtxt") + shell = started_by() + if not shell and startup.alone(): + beside = startup.app_beside(Path(sys.executable)) + if beside is not None and startup.open_app(beside): + log.info("started without its app, so it opened %s and stopped", beside) + return 0 + log.error("started without its app, and no app program was found near %s", sys.executable) + print("formtxt-engine is a part of FormTxt and serves nothing on its own. Open FormTxt instead.", file=sys.stderr) + return 4 + try: + runtime.claim(data, shell) + except startup.Busy as err: + log.error("%s", err) + print(err, file=sys.stderr) + return 2 + watch_shell(data, shell) bundled = os.path.join(resource_dir(), "frontend_dist") if os.path.isdir(bundled): os.environ.setdefault("FORMTXT_DIST", bundled) @@ -102,8 +116,32 @@ def main() -> int: if window_key.stdout_mode(): print(window_key.LINE + window_key.KEY, flush=True) - uvicorn.run(app, host="127.0.0.1", port=port, log_level="info") - return 0 + import signal + + def leave(_signum, _frame) -> None: + runtime.release(data) + os._exit(0) + + signal.signal(signal.SIGTERM, leave) + server = uvicorn.Server(uvicorn.Config(app, host="127.0.0.1", port=port, log_level="info")) + runtime.start_logging(data) + try: + server.run() + finally: + runtime.release(data) + return 0 if server.started else 3 + + +def main() -> int: + if "--selfcheck" in sys.argv: + return selfcheck() + try: + return serve() + except Exception: + import logging + + logging.getLogger("formtxt").exception("the engine stopped on an error") + raise if __name__ == "__main__": diff --git a/backend/tests/test_startup.py b/backend/tests/test_startup.py new file mode 100644 index 0000000..3a5d460 --- /dev/null +++ b/backend/tests/test_startup.py @@ -0,0 +1,213 @@ +import json +import os +import socket +import subprocess +import sys +import time +import urllib.request + +import pytest + +from conftest import BACKEND + +pytestmark = pytest.mark.skipif(os.name != "posix", reason="the stand-in programs are POSIX ones") + +FROZEN = "import sys\nsys.frozen = True\nsys.executable = {engine!r}\nsys.argv = ['formtxt-engine']\nimport formtxt_engine as e\nsys.exit(e.main())\n" + + +def stand_in(): + return subprocess.Popen(["sleep", "120"]) + + +def stop(*procs): + for proc in procs: + if proc.poll() is None: + proc.kill() + proc.wait(timeout=10) + + +def free_port(): + with socket.socket() as probe: + probe.bind(("127.0.0.1", 0)) + return probe.getsockname()[1] + + +def engine_env(data, **more): + env = {k: v for k, v in os.environ.items() if not k.startswith("FORMTXT_")} + env.update(FORMTXT_DATA_DIR=str(data), PYTHONUNBUFFERED="1", **more) + return env + + +def wait_for(check, seconds=20.0): + until = time.monotonic() + seconds + while time.monotonic() < until: + if check(): + return True + time.sleep(0.1) + return False + + +def answers(port): + try: + with urllib.request.urlopen(f"http://127.0.0.1:{port}/api/health", timeout=2) as reply: + return reply.status == 200 + except OSError: + return False + + +def record(startup, engine, shell): + return {"pid": engine.pid, "started": int(time.time()), "born": startup.created(engine.pid), "shell": shell.pid, "shellBorn": startup.created(shell.pid)} + + +def test_a_holder_whose_shell_is_alive_is_respected(tmp_path): + from app.core import startup + + engine, shell, mine = stand_in(), stand_in(), stand_in() + try: + (tmp_path / startup.LOCK_NAME).write_text(json.dumps(record(startup, engine, shell))) + with pytest.raises(startup.Busy) as refused: + startup.claim(tmp_path, mine.pid) + assert f"is already running on {tmp_path} (engine process {engine.pid})" in str(refused.value) + assert engine.poll() is None + finally: + stop(engine, shell, mine) + + +def test_a_holder_whose_shell_is_gone_is_ended_and_replaced(tmp_path): + from app.core import startup + + engine, shell, mine = stand_in(), stand_in(), stand_in() + try: + (tmp_path / startup.LOCK_NAME).write_text(json.dumps(record(startup, engine, shell))) + stop(shell) + path, replaced = startup.claim(tmp_path, mine.pid) + assert replaced == engine.pid + assert engine.wait(timeout=10) is not None + now = json.loads(path.read_text()) + assert now["pid"] == os.getpid() and now["shell"] == mine.pid and now["born"] > 0 and now["shellBorn"] > 0 + 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 + + engine, mine = stand_in(), stand_in() + try: + (tmp_path / startup.LOCK_NAME).write_text(json.dumps({"pid": engine.pid, "started": int(time.time())})) + with pytest.raises(startup.Busy): + startup.claim(tmp_path, 0) + assert engine.poll() is None + assert startup.claim(tmp_path, mine.pid)[1] == engine.pid + assert engine.wait(timeout=10) is not None + finally: + stop(engine, mine) + + +@pytest.mark.parametrize("text", ["not json at all", "[1, 2]", '{"pid": "x"}', ""]) +def test_a_damaged_lock_is_replaced(tmp_path, text): + from app.core import startup + + (tmp_path / startup.LOCK_NAME).write_text(text) + path, replaced = startup.claim(tmp_path, 0) + assert replaced == 0 + assert json.loads(path.read_text())["pid"] == os.getpid() + + +def test_a_lock_that_names_a_process_which_is_not_the_engine_is_replaced_and_the_process_is_left_alone(tmp_path): + from app.core import startup + + other, mine = stand_in(), stand_in() + try: + for held in ({"pid": other.pid, "started": int(time.time()) - 86400}, {"pid": other.pid, "started": 5, "born": 12345.5, "shell": 999999, "shellBorn": 5.0}): + (tmp_path / startup.LOCK_NAME).write_text(json.dumps(held)) + assert startup.claim(tmp_path, mine.pid)[1] == 0 + assert other.poll() is None + (tmp_path / startup.LOCK_NAME).write_text(json.dumps({"pid": other.pid})) + with pytest.raises(startup.Busy): + startup.claim(tmp_path, mine.pid) + assert other.poll() is None + finally: + stop(other, mine) + + +def test_the_two_ways_of_reading_a_start_time_agree(monkeypatch): + from app.core import startup + + first = startup.created(os.getpid()) + monkeypatch.setattr(startup, "PROC", "/nonexistent") + second = startup.created(os.getpid()) + assert first > 0 and abs(first - second) <= startup.SLACK + assert startup.created(4_000_000) == 0.0 + + +def test_the_engine_serves_and_logs_with_its_three_streams_closed(tmp_path): + port = free_port() + proc = subprocess.Popen(["sh", "-c", 'exec "$0" formtxt_engine.py <&- >&- 2>&-', sys.executable], cwd=BACKEND, env=engine_env(tmp_path, FORMTXT_PORT=str(port))) + log = tmp_path / "Logs" / "formtxt-engine.log" + try: + assert wait_for(lambda: answers(port)) + lines = log.read_text().splitlines() + assert lines[0].endswith(f"engine started, pid {proc.pid}, data folder {tmp_path}") + assert sum(f"Uvicorn running on http://127.0.0.1:{port}" in line for line in lines) == 1 + assert (tmp_path / "Logs" / "formtxt-engine-errors.log").is_file() + assert json.loads((tmp_path / "engine.lock").read_text())["pid"] == proc.pid + proc.terminate() + assert proc.wait(timeout=10) == 0 + assert not (tmp_path / "engine.lock").exists() + finally: + stop(proc) + + +@pytest.mark.parametrize("variable", ["FORMTXT_SHELL_PID", "FORMTXT_PARENT_PID"]) +def test_the_engine_stops_when_the_shell_it_was_given_ends(tmp_path, variable): + shell, port = stand_in(), free_port() + proc = subprocess.Popen([sys.executable, "formtxt_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMTXT_PORT=str(port), **{variable: str(shell.pid)}), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + try: + assert wait_for(lambda: answers(port)) + assert json.loads((tmp_path / "engine.lock").read_text())["shell"] == shell.pid + stop(shell) + assert proc.wait(timeout=10) == 0 + assert not (tmp_path / "engine.lock").exists() + finally: + stop(shell, proc) + + +def test_a_second_engine_is_refused_while_the_first_ones_shell_lives(tmp_path): + shell, other, port = stand_in(), stand_in(), free_port() + first = subprocess.Popen([sys.executable, "formtxt_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMTXT_PORT=str(port), FORMTXT_SHELL_PID=str(shell.pid)), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + try: + assert wait_for(lambda: answers(port)) + second = subprocess.run([sys.executable, "formtxt_engine.py"], cwd=BACKEND, env=engine_env(tmp_path, FORMTXT_PORT=str(free_port()), FORMTXT_SHELL_PID=str(other.pid)), capture_output=True, text=True, timeout=30) + assert second.returncode == 2 + assert f"formtxt is already running on {tmp_path} (engine process {first.pid})." in second.stderr + assert "is already running on" in (tmp_path / "Logs" / "formtxt-engine.log").read_text() + assert answers(port) + finally: + stop(shell, other, first) + + +def test_a_frozen_engine_started_alone_opens_the_app_beside_it_and_serves_nothing(tmp_path): + install, data, mark = tmp_path / "install", tmp_path / "data", tmp_path / "opened" + install.mkdir() + data.mkdir() + app = install / "formtxt" + app.write_text(f'#!/bin/sh\nprintf "%s" "$(pwd)" > "{mark}"\n') + app.chmod(0o755) + code = FROZEN.format(engine=str(install / "formtxt-engine")) + done = subprocess.run([sys.executable, "-c", code], cwd=BACKEND, env=engine_env(data), capture_output=True, text=True, timeout=30) + assert done.returncode == 0, done.stderr + assert wait_for(mark.is_file, 10) + assert mark.read_text() == str(install.resolve()) + assert not (data / "engine.lock").exists() and not (data / "engine.json").exists() + assert "started without its app" in (data / "Logs" / "formtxt-engine.log").read_text() + + +def test_a_frozen_engine_started_alone_with_no_app_near_it_says_so_and_serves_nothing(tmp_path): + data = tmp_path / "data" + data.mkdir() + code = FROZEN.format(engine=str(tmp_path / "engine" / "formtxt-engine")) + done = subprocess.run([sys.executable, "-c", code], cwd=BACKEND, env=engine_env(data), capture_output=True, text=True, timeout=30) + assert done.returncode == 4 + assert "serves nothing on its own" in done.stderr + assert not (data / "engine.lock").exists() From ca8e4ca200d547411ee99dd614456023421fff6a Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Thu, 19 Nov 2026 22:36:05 -0500 Subject: [PATCH 2/3] fix(shell): the start failure is said before the loading window closes, and the engine gets the shell's process id under the family's name src-tauri/src/main.rs, three small changes in the engine's start. The engine also gets FORMTXT_SHELL_PID beside FORMTXT_PARENT_PID. When the engine gives no address and key, the sentence is shown first and the loading window is closed only after it returns; it was closed first. The sentence says that a copy of FormTxt may already be open, since only one engine can use the data folder now, and where the engine's log is. Not compiled: the desktop shell cannot be built here. One added .env line beside its twin, one string, and two statements in another order. Not run on any system. Held: the rest of the family's shell side (the Windows job object, the failure text with the engine's last lines and exit code, a limit on the wait for the address). backend/HASHOUT_LOG.md says what it needs. --- backend/HASHOUT_LOG.md | 6 ++++++ src-tauri/src/main.rs | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index 5a7bab3..833ad5d 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -7,6 +7,12 @@ Last updated: 2026-11-19 · v0.35.0: the family's finder for the agent programs --- +## 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. +- Three small changes on purpose: one more `.env(...)` line beside its twin, one string, two statements in another order. Not compiled: the desktop shell cannot be built on the build machine. Not run on any system. +- Not done, the rest of the family's shell side, held for a session that can prove it with the scratch crate: `win_job.rs` (the job object that ends the engine with the shell on Windows) and `engine_start.rs` (the failure sentences with the engine's last lines and exit code, and a limit on the wait for the address, which has none today). FormTxt starts its engine through tauri-plugin-shell, which gives no `std::process::Child` for `win_job::hold`; the way to take is FormTools's, moving that one start to `std::process::Command`. Things that session must mind: `kill_backend` asks `kill -0`, which a finished child that was not waited for still answers, so it must ask `try_wait` as FormTools does; the one-file engine is beside the app's program (the plugin's `sidecar` found it there), so `packaged::engine_folder` needs that place; `sidecar.spawn().expect(...)` ends the shell without a word when the engine cannot be started. + ## after v0.35.0 · the engine starts and stops cleanly: one engine per data folder, a log, and leaving with the app (2026-11-19) - core/startup.py (new) · the family's start and stop file, copied from FormTools's `backend/app/core/startup.py` at its main with only the names at its top changed (`APP`, `NAMES`, `SHELL_ENV` = `FORMTXT_SHELL_PID`, `ALONE_ENV` = `FORMTXT_NO_SHELL`, `ERRORS_NAME`). Standard library only, no import of FormTxt. `PLACES` is as FormTools has it: FormTxt's engine sits beside the app's program (the one-file engine) or in a folder `engine` under the install folder or under `Contents/Resources` (`src-tauri/src/packaged.rs`), and both are covered. diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9149715..2931903 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -170,6 +170,7 @@ fn main() { .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"); *app.state::().0.lock().unwrap() = Some(child); @@ -214,11 +215,11 @@ fn main() { open_main(&handle, url, key); } None => { - close_splash(&handle); let _ = handle .dialog() - .message("The FormTxt engine failed to start. Please relaunch the app.") + .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); } From f20ece76b733646af2cdb35c89b64d0d39dc9ce9 Mon Sep 17 00:00:00 2001 From: nodemode-ai Date: Thu, 19 Nov 2026 23:01:32 -0500 Subject: [PATCH 3/3] release: 0.36.0 A minor release, engine side only: one engine per data folder with a lock, the engine's log file in the data folder, a frozen engine started alone opens the app, the engine leaves with its app by the family's watch, and in the shell the start failure is said before the loading window closes. The CHANGELOG entry lists them and says what is not in it: the Windows job object and the failure text with the engine's last lines, which wait for a session that can prove the shell's Rust. Version sites, the same eleven files as 0.35.0: backend/app/__init__.py, frontend/src/version.ts, frontend/package.json, frontend/package-lock.json (the two fields of this project), src-tauri/Cargo.toml, src-tauri/Cargo.lock (package formtxt), src-tauri/tauri.conf.json, README.md (the badge and the version line), CHANGELOG.md (new entry), and the two header lines of backend/HASHOUT_LOG.md and frontend/HASHOUT_LOG.md. Left alone: setup/mcpb/manifest.json (0.0.0, stamped at build), the log entries headed "after v0.35.0", and the three browser demo pages. Checked on a scratch copy of the engine commit, the workflow's jobs as written: compileall, --selfcheck, the boot probe, the engine's suite (222 passed), npm ci, npm run build, npm run typecheck, npm audit (0 vulnerabilities), the window check with Playwright 1.63.0 (2 passed), bash -n, agents check, mcpb check. On this tree: agents check, agents sync --check, mcpb check ("a build stamps version 0.36.0"), the icon rules and the em dash check, all clean. Not run: the engine's suite on this exact tree (the machine's queue did not reach it before the clock; the tree differs from the checked commit by the version strings and three lines of the shell), a desktop build, Windows, macOS, a real agent program. The run was on Python 3.13; the workflow pins 3.12. --- CHANGELOG.md | 9 +++++++++ README.md | 4 ++-- backend/HASHOUT_LOG.md | 4 ++-- backend/app/__init__.py | 2 +- frontend/HASHOUT_LOG.md | 4 ++-- 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, 23 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb216d1..c1e39d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 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. +- An engine of this version that is left running after its app is gone is stopped and replaced the next time FormTxt starts. An engine left behind by 0.35.0 or older is not: it holds nothing FormTxt can recognise it by. +- The engine keeps a log: `Logs/formtxt-engine.log` in the FormTxt folder, with the three files before it. When the engine has nowhere to write its errors, they go to `Logs/formtxt-engine-errors.log` beside it. +- Opening the engine program by itself, for example with a double click in the install folder, opens FormTxt and leaves no engine running. +- When FormTxt cannot start its engine, it says so before its loading window closes, and the sentence says that a copy may already be open and where the log is. +- Not in this release: on Windows, ending FormTxt from Task Manager is not yet made to end everything the engine started, and the sentence for a failed start does not yet carry the engine's own last lines. Nothing in this release was run on Windows or macOS. + ## 0.35.0 · 2026-11-19 - Antigravity, Google's `agy` program, is the fourth agent program FormTxt works with, beside Claude Code, Codex and Cursor. The terminal panel has an Antigravity tab when the program is found on this computer. diff --git a/README.md b/README.md index c213872..0a98ea5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

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

-Version 0.35.0 · Apache-2.0 · macOS, Windows, Linux (browser, or the desktop app built with ./build_app) +Version 0.36.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 833ad5d..4cfa87f 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -2,8 +2,8 @@ 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.35.0 -Last updated: 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 +Current build version: v0.36.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 e0d0ed6..d9f2629 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1 +1 @@ -__version__ = "0.35.0" +__version__ = "0.36.0" diff --git a/frontend/HASHOUT_LOG.md b/frontend/HASHOUT_LOG.md index b28f229..57fabf2 100644 --- a/frontend/HASHOUT_LOG.md +++ b/frontend/HASHOUT_LOG.md @@ -2,8 +2,8 @@ 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.35.0 -Last updated: 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. +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. - 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/package-lock.json b/frontend/package-lock.json index d2c43eb..bfb515e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "formtxt", - "version": "0.35.0", + "version": "0.36.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "formtxt", - "version": "0.35.0", + "version": "0.36.0", "license": "Apache-2.0", "dependencies": { "@fontsource/ibm-plex-sans": "5.3.0", diff --git a/frontend/package.json b/frontend/package.json index 9697983..848c1d2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "formtxt", "private": true, - "version": "0.35.0", + "version": "0.36.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 3475238..599ca7e 100644 --- a/frontend/src/version.ts +++ b/frontend/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.35.0'; +export const VERSION = '0.36.0'; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 7d98665..f3a4394 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -865,7 +865,7 @@ dependencies = [ [[package]] name = "formtxt" -version = "0.35.0" +version = "0.36.0" dependencies = [ "fontdb", "objc2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 952f024..beaf7ee 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "formtxt" -version = "0.35.0" +version = "0.36.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 1defebf..863922a 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.35.0", + "version": "0.36.0", "identifier": "ai.nodemode.formtxt", "build": { "devUrl": "http://localhost:5210",