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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to formlit. Versions are `v*.*.*`; each release lists what it added, what it fixed and what is not verified yet.

## v0.55.0 · 2026-11-20

- Fixed: on macOS, an engine that has just ended is now seen as gone at once, so a quit or a restart of formlit no longer waits on an engine that is already stopped.
- Changed: formlit waits 90 seconds for its engine to start, then says why it could not start. Before, it waited two minutes.
- Changed: on Windows the engine runs without a console window of its own. Its output still goes to its log in the data folder.
- Added: formlit can keep where Codex, Cursor and Antigravity are installed, as it already did for Claude Code, and looks there first. These places are protected the same way as your agent access choice: changed from outside formlit's window, they are ignored and the choice goes back to asking you.
- Changed: the terminal panel's guide says that Codex, Cursor and Antigravity each get a button when they are installed, and the note in Preferences on registering formlit names all four programs, in every language formlit carries.
- Unchanged on update: your agent access choice and the Claude Code path you set stay as they were.
- Known: the places for Codex, Cursor and Antigravity have no field in Preferences yet.
- Checked here, on Linux only, with stand-in programs in place of the agent programs. Nothing was run on Windows or macOS, and the desktop app itself was not built on the machine this was written on.

## v0.54.0 · 2026-11-19

- Fixed: when formlit cannot start, it says why before it closes. The message gives the reason in a sentence (its engine program is missing, could not be started, stopped, or did not answer in time), the engine's last lines, and where the engine's log is. Before, a failed start showed one fixed sentence or closed with nothing at all.
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.54.0" src="https://img.shields.io/badge/version-0.54.0-eef0f4?style=flat-square">
<img alt="version 0.55.0" src="https://img.shields.io/badge/version-0.55.0-eef0f4?style=flat-square">
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-7-3178c6?style=flat-square&logo=typescript&logoColor=white">
<img alt="Python" src="https://img.shields.io/badge/Python-3.12-3776ab?style=flat-square&logo=python&logoColor=white">
<img alt="macOS, Windows, Linux" src="https://img.shields.io/badge/macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-native-2f7bf5?style=flat-square">
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ check whether the problem is still there.

| Version | Supported |
| --- | --- |
| 0.54.x (latest release) | Yes |
| 0.55.x (latest release) | Yes |
| Anything older | No |

## Reporting a vulnerability
Expand Down
44 changes: 43 additions & 1 deletion backend/HASHOUT_LOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""formlit engine: the catalog, the develop pipeline's reference renderer, import, export and the agent surface."""

__version__ = "0.54.0"
__version__ = "0.55.0"
3 changes: 3 additions & 0 deletions backend/app/core/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"outsideAgents": "ask",
"claudeFolder": "",
"claudeBin": "",
"codexBin": "",
"cursorBin": "",
"antigravityBin": "",
"claudeFirstMessage": "",
}
CHOICES: dict[str, tuple] = {"outsideAgents": ("ask", "allowed", "blocked")}
Expand Down
10 changes: 6 additions & 4 deletions backend/app/core/seal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
ACCOUNT = "settings-seal"
FIELD = "seal"
REPORTS = ("seal", "sealBroken")
SEALED = ("outsideAgents", "claudeBin")
PATHS = ("claudeBin", "codexBin", "cursorBin", "antigravityBin")
LATER = ("codexBin", "cursorBin", "antigravityBin")
SEALED = ("outsideAgents",) + PATHS
_CACHE: dict = {"tried": False, "available": False, "key": None}


Expand Down Expand Up @@ -35,12 +37,12 @@ def _load(create: bool) -> bytes | None:


def digest(values: dict, key: bytes) -> str:
body = json.dumps({k: values.get(k) for k in SEALED}, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
body = json.dumps({k: values.get(k) for k in SEALED if k not in LATER or values.get(k)}, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
return hmac.new(key, body.encode("utf-8"), hashlib.sha256).hexdigest()


def loosened(values: dict) -> bool:
return values.get("outsideAgents") == "allowed" or bool(str(values.get("claudeBin") or "").strip())
return values.get("outsideAgents") == "allowed" or any(str(values.get(k) or "").strip() for k in PATHS)


def effective(stored: dict) -> dict:
Expand All @@ -53,7 +55,7 @@ def effective(stored: dict) -> dict:
return {**out, "seal": "ok", "sealBroken": False}
if not loosened(stored):
return {**out, "seal": "unsealed", "sealBroken": False}
out.update(outsideAgents="blocked" if stored.get("outsideAgents") == "blocked" else "ask", claudeBin="")
out.update(outsideAgents="blocked" if stored.get("outsideAgents") == "blocked" else "ask", **{k: "" for k in PATHS})
return {**out, "seal": "broken", "sealBroken": True}


Expand Down
19 changes: 18 additions & 1 deletion backend/app/core/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion backend/app/engine/claude_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def _runnable(path: str) -> bool:


def setting(kind: str) -> str | None:
return _pref("claudeBin") if kind == "claude" else None
key = agent_lookup.PROGRAMS.get(kind, {}).get("setting")
return _pref(key) if key else None


def otherwise(kind: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion backend/app/engine/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Spec:
FROM_WINDOW: contextvars.ContextVar[bool] = contextvars.ContextVar("formlit_from_window", default=False)
WINDOW_GROUPS = {"terminal", "claudecode", "chat"}
WINDOW_IDS = {"agents.respond", "editIn.addApp", "photo.editIn"}
WINDOW_PREFS = {"outsideAgents", "claudeBin", "claudeFirstMessage", "claudeFolder", "editors"}
WINDOW_PREFS = {"outsideAgents", "claudeBin", "codexBin", "cursorBin", "antigravityBin", "claudeFirstMessage", "claudeFolder", "editors"}
WINDOW_REFUSED = "Only the formlit window can do this"


Expand Down
2 changes: 1 addition & 1 deletion backend/app/routers/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
] + [{"name": k, "title": v["title"], "description": v["description"], "arguments": []} for k, v in WORKFLOWS.items()]
ALLOW_DELETE = os.environ.get("FORMLIT_MCP_ALLOW_DELETE") == "1"
BLOCKED = {"photo.delete", "folder.remove", "catalog.open", "catalog.create", "agents.respond", "demo.open"}
PERSON_PREFS = {"outsideAgents", "claudeBin", "claudeFirstMessage", "claudeFolder", "editors"}
PERSON_PREFS = {"outsideAgents", "claudeBin", "codexBin", "cursorBin", "antigravityBin", "claudeFirstMessage", "claudeFolder", "editors"}
WINDOW_ONLY = {"terminal", "claudecode", "chat", "extensions"}
LIST_CACHE = {"ttlMs": 60_000, "cacheScope": "private"}
SESSIONS: dict[str, str] = {}
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/test_dock_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,15 @@ def test_one_call_reports_the_four_agent_programs(client, stand_ins):
assert found[kind] == found[kind] | {"installed": True, "path": str(stand_ins / binary), "version": "9.9.9", "signedIn": signed, "finding": "runs", "how": "path"}
assert found[kind]["install"] and found[kind]["title"]
assert found["antigravity"] == found["antigravity"] | {"installed": False, "path": None, "finding": "missing", "signedIn": None, "title": "Antigravity"}
assert found["antigravity"]["said"].startswith("Antigravity was not found. Looked in: PATH (")
assert found["antigravity"]["said"].startswith("Antigravity was not found. Looked in: your setting (empty); PATH (")


def test_a_missing_program_comes_with_its_install_line(client, none_found):
found = run(client, "terminal.agents", {"fresh": True}).json()["result"]
for kind in ("codex", "cursor", "antigravity"):
assert found[kind] == found[kind] | {"installed": False, "path": None, "version": None, "signedIn": None, "finding": "missing"}
assert found[kind]["install"] and found[kind]["install"] in found[kind]["said"]
assert found[kind]["looked"][0] == "PATH (/usr/bin:/bin)" and "~/.local/bin" in found[kind]["looked"][1]
assert found[kind]["looked"][:2] == ["your setting (empty)", "PATH (/usr/bin:/bin)"] and "~/.local/bin" in found[kind]["looked"][2]
assert found["claude"]["looked"][0] == "your setting (empty)" and found["claude"]["said"].endswith(", or give its path in Preferences.")
reply = run(client, "terminal.openAgent", {"kind": "codex"})
assert reply.status_code == 400 and reply.json()["error"] == found["codex"]["said"]
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/test_dock_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_the_shared_dock_folder_is_the_one_its_manifest_describes():
sync = sync_script()
assert sync.dock_module_drift() == []
held = json.loads((sync.DOCK_MODULE / "MANIFEST.json").read_text(encoding="utf-8"))
assert held["module"] == "dock" and held["version"] == "2.2.0"
assert held["module"] == "dock" and held["version"] == "2.2.1"


def test_a_changed_or_foreign_file_in_the_dock_folder_is_named(tmp_path, monkeypatch):
Expand Down
19 changes: 19 additions & 0 deletions backend/tests/test_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ def test_the_two_ways_of_reading_a_start_time_agree(monkeypatch):
assert startup.created(4_000_000) == 0.0


def test_a_holder_that_has_ended_but_was_not_collected_counts_as_gone_where_there_is_no_proc(tmp_path, monkeypatch):
from app.core import startup

monkeypatch.setattr(startup, "PROC", "/nonexistent")
engine, shell, mine = stand_in(), stand_in(), stand_in()
try:
assert not startup.finished(engine.pid)
(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 startup.finished(engine.pid)
assert json.loads(path.read_text())["pid"] == os.getpid()
monkeypatch.setattr(startup, "PROC", "/proc")
assert not startup.finished(engine.pid)
finally:
stop(engine, shell, mine)


def test_the_engine_serves_and_logs_with_its_three_streams_closed(tmp_path):
proc = subprocess.Popen(["sh", "-c", 'exec "$0" formlit_engine.py <&- >&- 2>&-', sys.executable], cwd=BACKEND, env=engine_env(tmp_path))
log = tmp_path / "Logs" / "formlit-engine.log"
Expand Down
50 changes: 50 additions & 0 deletions backend/tests/test_window_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,56 @@ def test_a_hand_edit_of_agent_access_is_caught(client, stand_in_keyring):
assert prefs.load()["seal"] == "ok"


@pytest.mark.parametrize("key,kind", [("codexBin", "codex"), ("cursorBin", "cursor"), ("antigravityBin", "antigravity")])
def test_the_other_programs_paths_are_sealed_and_given_to_the_finder_first(client, stand_in_keyring, tmp_path, key, kind):
from app.core import config, prefs, seal
from app.engine import claude_code

program = tmp_path / kind
program.write_text("#!/bin/sh\n")
program.chmod(0o755)
prefs.update({"outsideAgents": "ask", "claudeBin": "", key: ""})
path = config.data_dir() / "preferences.json"
stored = json.loads(path.read_text())
assert stored[seal.FIELD] == seal.digest({k: stored.get(k) for k in ("outsideAgents", "claudeBin")}, seal._load(False))
prefs.update({key: str(program)})
assert prefs.load()["seal"] == "ok" and claude_code.setting(kind) == str(program)
found = claude_code.agent_lookup.find(kind, setting=claude_code.setting(kind), env={"PATH": ""}, shell_timeout=0)
assert found.path == str(program) and found.how == "setting"
raw = json.loads(path.read_text())
raw[key] = "/somewhere/else"
path.write_text(json.dumps(raw))
seen = prefs.load()
assert seen["sealBroken"] is True and seen[key] == "" and claude_code.setting(kind) == ""
prefs.update({key: ""})
assert prefs.load()["seal"] == "ok"


def test_a_choice_sealed_by_0_54_0_stays_whole_and_keeps_the_claude_code_path(client, stand_in_keyring, tmp_path):
import hashlib
import hmac

from app.core import config, prefs, seal
from app.engine import claude_code

program = tmp_path / "claude"
program.write_text("#!/bin/sh\n")
program.chmod(0o755)
key = seal._load(True)
old = {"editors": [], "slideshowMusic": "", "outsideAgents": "allowed", "claudeFolder": "", "claudeBin": str(program), "claudeFirstMessage": ""}
body = json.dumps({k: old[k] for k in ("outsideAgents", "claudeBin")}, sort_keys=True, separators=(",", ":"), ensure_ascii=False)
path = config.data_dir() / "preferences.json"
path.write_text(json.dumps({**old, "seal": hmac.new(key, body.encode("utf-8"), hashlib.sha256).hexdigest()}))
seen = prefs.load()
assert seen["seal"] == "ok" and seen["sealBroken"] is False
assert seen["outsideAgents"] == "allowed" and seen["claudeBin"] == str(program) and claude_code.setting("claude") == str(program)
assert [seen[k] for k in ("codexBin", "cursorBin", "antigravityBin")] == ["", "", ""]
prefs.update({"claudeFirstMessage": "hello"})
prefs.update({"codexBin": str(program)})
seen = prefs.load()
assert seen["seal"] == "ok" and seen["outsideAgents"] == "allowed" and seen["claudeBin"] == str(program) and seen["codexBin"] == str(program)


def test_without_a_keychain_the_stored_choice_stands(client, monkeypatch):
import sys

Expand Down
2 changes: 1 addition & 1 deletion demo/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Rationale, decisions and removed or never-written comments for the offline demo. Source files stay comment-free.

Current build version: v0.54.0
Current build version: v0.55.0

## Why a TypeScript port of the pipeline

Expand Down
Loading
Loading