Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Every release of FormDesign, newest first. Versions follow semver; tags read `v*.*.*`.

## 0.90.0 · 2026-11-19

- The desktop app's engine stops by itself within about two seconds when the app that started it has gone, so no engine is left running after FormDesign is quit or ended.
- An engine that was left running without its app is ended by the next start, which then takes over. A second FormDesign on the same data folder is told that FormDesign is already running there.
- When FormDesign cannot start, it says so before it closes: that another copy of its engine holds its data folder, or the code its engine stopped with, and where the engine's log is. Before, the app could close without a word.
- The desktop app's engine keeps a log, `Logs/formdesign-engine.log` in the FormDesign data folder (the folder `FormDesign` in your home folder unless you chose another). An error that stops the engine is written there.
- Opening the engine program by itself opens FormDesign instead of starting an engine that nothing uses.
- For people who build on the engine: the desktop engine takes `engine.lock` in the data folder and exits with code 2 when another engine holds it, with code 4 when it was started alone and found no app, and with code 5 when it cannot use its data folder. Ended with SIGTERM it exits with code 0. An engine started from source with uvicorn is unchanged.

## 0.89.0 · 2026-11-19

- Google's Antigravity (the program `agy`) is a fourth agent program beside Claude Code, Codex and Cursor. It has a tab of its own in the terminal panel, a button in Agent Connect's set-up row, and `./formdesign agents install antigravity` adds FormDesign to the file Antigravity reads its servers from, keeping everything else in that file.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">
<img alt="version 0.89.0" src="https://img.shields.io/badge/version-0.89.0-eef0f4?style=flat-square">
<img alt="version 0.90.0" src="https://img.shields.io/badge/version-0.90.0-eef0f4?style=flat-square">
<img alt="Rust" src="https://img.shields.io/badge/rust-layout%20core-B7410E?style=flat-square&logo=rust&logoColor=white">
<img alt="TypeScript and Python" src="https://img.shields.io/badge/typescript%20%2B%20python-engine%20and%20window-3178c6?style=flat-square">
<img alt="macOS, Windows and Linux" src="https://img.shields.io/badge/macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-native-2f7bf5?style=flat-square">
Expand Down
34 changes: 32 additions & 2 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,38 @@

Living log for the engine service. Source files stay comment-free; what they would have said lives here, indexed. Read it before editing `backend/`.

Current build version: v0.89.0
Last updated: 2026-11-19 · the family's finder 1.0.1 for the four agent programs · an Antigravity tab and agents install antigravity · the tests find only stand-in agent programs · the engine starts with no output streams · only the app window can change what agents may do, open a terminal or answer an approval; the stored agent choices are sealed; the command line is an agent like any other; agents/manifest.json says what the app offers agents; the use_tool description says 41 layout tools; the engine side of the shared dock's contract; 2026-11-13 · no engine change in 0.87.0 (version string only; the demo covers and browser demo pages are in the frontend log); a recent document's first-page thumbnail; three demos built on demand by Make; counts --check fails if a sparkle icon returns; the desktop extension, attach mode and the plugin manifest; 2026-11-11 · engine commands run in the active document; Save to a folder that cannot be made answers 422; a tools/call name that is not a string gets a JSON-RPC error; PNG and JPEG export count pages from 1; the in-app token reaches Claude Code in a private file; 2026-11-10 · Claude chat keeps only the screenshots its messages still show; Claude chat history is found under a non-ASCII agent folder; a prompt that starts with "-" reaches Claude Code as a prompt; text with a non-ASCII style name is placed; bad input to open, pack edits, make, tabs and media answers 4xx; LibreOffice gets a well-formed profile URL; links found in contact and footer text keep their query strings; fixed-layout EPUB marks every animated page as scripted; images from different sources with the same name stay distinct; book operations run one at a time; malformed agent, plug-in, package and book input gets an error message; Edit Original opens only image, vector and PDF files; counts --check reads only the MCP tool count; Windows Node check and install --lite; clean.bat --all removes each folder on its own; build_frontend.bat restores its caller's folder; agents install codex writes valid TOML on Windows; the MCP stdio bridge runs under Python 3.9; every window socket request gets an answer; a Claude Code launch is quoted for the login shell that runs it; a failed thumbnail leaves no document open; a video's poster file is used only when it is a real image; only the window installs, enables and removes plug-ins; PDF, DXF and PDF comment imports run off the event loop; one-column CSV files are read; a bad or empty zip becomes an intake warning; a wrong-shaped template spec answers problems; phone photos are measured and placed upright; a long paste reaches the terminal whole; intake and PDF reading by agents no longer freeze the engine; review comments posted at the same time all stay; a failing tool or a malformed MCP request gets a JSON-RPC answer; names without Latin letters get their own file; downloads with non-Latin names arrive; an engine on a fallback port tells everyone its real port; non-Latin names save on Windows; save_document asks before overwriting the file it will really write; an uploaded file name cannot leave the pack folder; a website export never deletes files it did not write; published sites and placed assets run sandboxed; a plug-in's fetch checks every redirect hop; document text stays inside a published page's JSON-LD block; run_commands asks for approval wherever run_command does; a template is saved only inside the template library; only the in-app token makes a client the in-app Claude Code; 2026-10-31 · .js, .mjs and .css keep their types on Windows; formdesign-core links the C runtime statically on Windows; 2026-10-30 · the Windows desktop build stops on a failed bundle step; 2026-10-26 · fixes the test suite found (FB-045 to FB-049); 2026-10-25 · LocalGuard; 2026-10-23 · full fonts for the Reserved Font Name families; the ICC profile in the frozen engine
Current build version: v0.90.0
Last updated: 2026-11-19 · the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone and serves nothing when started alone · the family's finder 1.0.1 for the four agent programs · an Antigravity tab and agents install antigravity · the tests find only stand-in agent programs · the engine starts with no output streams · only the app window can change what agents may do, open a terminal or answer an approval; the stored agent choices are sealed; the command line is an agent like any other; agents/manifest.json says what the app offers agents; the use_tool description says 41 layout tools; the engine side of the shared dock's contract; 2026-11-13 · no engine change in 0.87.0 (version string only; the demo covers and browser demo pages are in the frontend log); a recent document's first-page thumbnail; three demos built on demand by Make; counts --check fails if a sparkle icon returns; the desktop extension, attach mode and the plugin manifest; 2026-11-11 · engine commands run in the active document; Save to a folder that cannot be made answers 422; a tools/call name that is not a string gets a JSON-RPC error; PNG and JPEG export count pages from 1; the in-app token reaches Claude Code in a private file; 2026-11-10 · Claude chat keeps only the screenshots its messages still show; Claude chat history is found under a non-ASCII agent folder; a prompt that starts with "-" reaches Claude Code as a prompt; text with a non-ASCII style name is placed; bad input to open, pack edits, make, tabs and media answers 4xx; LibreOffice gets a well-formed profile URL; links found in contact and footer text keep their query strings; fixed-layout EPUB marks every animated page as scripted; images from different sources with the same name stay distinct; book operations run one at a time; malformed agent, plug-in, package and book input gets an error message; Edit Original opens only image, vector and PDF files; counts --check reads only the MCP tool count; Windows Node check and install --lite; clean.bat --all removes each folder on its own; build_frontend.bat restores its caller's folder; agents install codex writes valid TOML on Windows; the MCP stdio bridge runs under Python 3.9; every window socket request gets an answer; a Claude Code launch is quoted for the login shell that runs it; a failed thumbnail leaves no document open; a video's poster file is used only when it is a real image; only the window installs, enables and removes plug-ins; PDF, DXF and PDF comment imports run off the event loop; one-column CSV files are read; a bad or empty zip becomes an intake warning; a wrong-shaped template spec answers problems; phone photos are measured and placed upright; a long paste reaches the terminal whole; intake and PDF reading by agents no longer freeze the engine; review comments posted at the same time all stay; a failing tool or a malformed MCP request gets a JSON-RPC answer; names without Latin letters get their own file; downloads with non-Latin names arrive; an engine on a fallback port tells everyone its real port; non-Latin names save on Windows; save_document asks before overwriting the file it will really write; an uploaded file name cannot leave the pack folder; a website export never deletes files it did not write; published sites and placed assets run sandboxed; a plug-in's fetch checks every redirect hop; document text stays inside a published page's JSON-LD block; run_commands asks for approval wherever run_command does; a template is saved only inside the template library; only the in-app token makes a client the in-app Claude Code; 2026-10-31 · .js, .mjs and .css keep their types on Windows; formdesign-core links the C runtime statically on Windows; 2026-10-30 · the Windows desktop build stops on a failed bundle step; 2026-10-26 · fixes the test suite found (FB-045 to FB-049); 2026-10-25 · LocalGuard; 2026-10-23 · full fonts for the Reserved Font Name families; the ICC profile in the frozen engine

---

## v0.90.0 · the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone, and serves nothing when started alone (2026-11-19)

- refers-to: app/core/startup.py; app/core/runtime.py; formdesign_engine.py :: watch_shell, serve, main; tests/test_startup.py
- kind: feat
- logged: v0.90.0 · 2026-11-19

The family's pattern for starting and stopping cleanly on Windows, as FormTools 0.10.0 has it. It lives in the entry the desktop app freezes, `formdesign_engine.py`; an engine started with `uvicorn app.main:app` (boot scripts, `./formdesign mcp`, the tests' own engines) is untouched and takes no lock.

**startup.py** is FormTools's file, copied with `git show origin/main:backend/app/core/startup.py` and changed only in the names at its top: `APP`, `NAMES`, `SHELL_ENV` (`FORMDESIGN_SHELL_PID`), `ALONE_ENV` (`FORMDESIGN_NO_SHELL`), `ERRORS_NAME`. `PLACES` is unchanged: the frozen engine is a sidecar beside the app's program in all three install layouts, which is the entry `.`. Keep the file the same as the family's; a change belongs in every app.

**runtime.py** is FormDesign's own and small: `start_logging` opens `Logs/formdesign-engine.log` under the data folder (rotating, one megabyte, three kept) on the loggers `formdesign`, `uvicorn` and `uvicorn.access`; `uvicorn.error` reaches the file through `uvicorn`, so it is not listed, or every line would be written twice. A second call for the same file only puts the handler back where it is missing. `claim` and `release` are the lock. FormDesign had no log file and no lock before this.

**The order in `serve`.** The port and the three environment defaults are settled first, as before, because `app.core.config` reads them when it is imported. Then: the log (a data folder that cannot be made is one sentence and exit code 5); `keep_errors`, which sends an absent standard error to `Logs/formdesign-engine-errors.log`; the started-alone branch (a frozen engine with no `FORMDESIGN_SHELL_PID` opens the app beside it and returns 0, or says "formdesign-engine is a part of FormDesign and serves nothing on its own" and returns 4; no lock, nothing served; `FORMDESIGN_NO_SHELL=1` lets a build check serve alone); the lock (a refusal is written to the log and to standard error, exit code 2); the watch on the process in `FORMDESIGN_SHELL_PID` (nothing was watched before, so there is no fallback to the parent); the key line and the server.

**Why `uvicorn.Server` and not `uvicorn.run`.** uvicorn's log setup, done when its `Config` is made, takes the handlers off the `uvicorn` loggers, so `start_logging` is called a second time after the `Config` exists. Without that the file held one line. `run` hid a Ctrl+C and answered exit code 3 for a server that never started; the entry does both itself now.

**SIGTERM.** uvicorn shuts down on SIGTERM and then raises the signal again, which ended the process before the `finally` that gives the lock up (seen: exit 143 and the lock still there). The entry's own handler is what the raised signal now meets: it gives the lock up and exits 0. An engine ended with SIGTERM therefore exits 0 where it exited 143.

**The lock an older engine left.** Released engines wrote no lock, so a new engine cannot know one that was left behind by 0.89.0 or older: it does not end it. If that engine still holds port 8196 the new one serves on a spare port, as it always did. The launcher's cleanup is what removes such a leftover.

**A leftover that holds the port.** The port is chosen before the lock is asked for, so a new engine that ends a leftover serves on a spare port even though 8196 is free a moment later. The shell reads the address from the engine's output, so the window opens all the same.

**Seen on Linux with stand-ins (`sleep` as the shell, a script as the app):** a second engine exits 2 with "formdesign is already running on [folder] (engine process N)." while the first one's shell lives, and the first keeps answering `/api/health`; the engine exits 0 within about a second of its shell ending and the lock is gone; a stopped engine whose shell had gone was ended after five seconds (its exit 137) and replaced, with the warning in the log; a holder whose shell had gone and that could hear SIGTERM exited 143 and was replaced; locks holding `not json at all`, `[1, 2]`, `{"pid": "x"}` and nothing were replaced; a lock naming an unrelated `sleep` was replaced and the `sleep` kept running; a process id with no time at all was obeyed; started alone (the entry through `python -c` with `sys.frozen` set) it opened the stand-in app in each of the four places, exit 0, no lock, and with no app near it exit 4 with the sentence; with its three streams closed it served, descriptors 0, 1 and 2 were the null device, and both log files were there; a data folder under a plain file gave the sentence and exit 5; started normally it printed what it printed before, and the log file held each line once.

**Not run:** Windows and macOS (every `_windows` function in startup.py, the handle branch of `watch`, `taskkill`, the detached start of the app), a really frozen engine, the desktop shell.

**Tests.** `tests/test_startup.py`, FormTools's with FormDesign's names and without the port file FormDesign does not have, plus the refusal of a second engine: 14 tests, added after each behaviour was seen.

---

Expand Down
2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.89.0"
__version__ = "0.90.0"
66 changes: 66 additions & 0 deletions backend/app/core/runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import json
import logging
import os
from logging.handlers import RotatingFileHandler
from pathlib import Path

from app.core import startup

LOG_NAME = "formdesign-engine.log"
LOG_FOLDER = "Logs"
LOG_BYTES = 1_048_576
LOG_KEEP = 3
HANDLER = "formdesign-file"
LOGGERS = ("formdesign", "uvicorn", "uvicorn.access")
FORMAT = "%(asctime)s %(levelname)s %(name)s %(message)s"


AlreadyRunning = startup.Busy


def start_logging(data: Path) -> Path:
folder = data / LOG_FOLDER
folder.mkdir(parents=True, exist_ok=True)
path = folder / LOG_NAME
for held in logging.getLogger("formdesign").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 == "formdesign":
logger.setLevel(logging.INFO)
logging.getLogger("formdesign").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) -> Path:
lock, replaced = startup.claim(data, startup.shell_pid())
if replaced:
logging.getLogger("formdesign").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, TypeError, AttributeError):
pass
Loading
Loading