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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ jobs:
- name: Engine (pytest)
run: python -m pytest -q -p no:cacheprovider tests
working-directory: backend
- name: Third-party notices cover what ships
run: python setup/notices.py --check

scripts:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Licensed under the Apache License, Version 2.0 (see `LICENSE`).

Every dependency gets a row here with its name, version, licence and where it ships, after it clears the licence policy in `docs/encyclopedia/engines/engine-licensing-matrix.md`. Rust crates resolve exactly through `src-tauri/Cargo.lock`, npm packages through `frontend/package-lock.json`.

The full licence texts (copyright lines, conditions and disclaimers) of everything the app ships, the packages each row pulls in included, are in `THIRD-PARTY-NOTICES.txt`. It ships in every installer and inside the engine, and Settings, About shows it. `python3 setup/notices.py` writes it from the installed packages, the lock files and the cargo registry; `python3 setup/notices.py --check` (also in CI) fails when it does not cover what ships.

| Component | Version | Licence | Ships in |
| --- | --- | --- | --- |
| formvis shared UI files (`themes.ts`, `icons.ts`, `dom.ts`, `caption-buttons.ts`, `tokens.css`, `fonts.css`, `scrollbars.css`, `light-mode.css`, the `index.html` theme boot, the splash and boot sequence, `native-menu.ts` pattern), Copyright (C) 2026 NodeAgentc, Inc. | 1.98.7 | Apache-2.0 | frontend, desktop shell |
Expand Down Expand Up @@ -53,6 +55,10 @@ Every dependency gets a row here with its name, version, licence and where it sh
| pywinpty | 3.0.5 | MIT | engine, the same on Windows (ConPTY) |
| keyring 25.7.0 by Jason R. Coombs, with jaraco.classes 3.4.0, jaraco.context 6.1.2, jaraco.functools 4.6.0 and more-itertools 11.2.1 (on Linux jeepney 0.9.0, on Windows pywin32-ctypes) | 25.7.0 | MIT | engine, keeps the key that seals the outside agents choice in the system keychain; imported only when needed, so an engine without a keychain still starts |
| SecretStorage (Linux), pywin32-ctypes (Windows) | 3.5.0 | BSD-3-Clause | engine, keychain access for keyring |
| cryptography (with its statically linked OpenSSL), cffi, pycparser | 50.x, 2.x, 3.x (resolved at build) | Apache-2.0 OR BSD-3-Clause, MIT-0, BSD-3-Clause | engine on Linux, needed by SecretStorage |
| Packages FastAPI and uvicorn[standard] pull in: Starlette, Pydantic and pydantic-core, AnyIO, h11, httptools, uvloop (not on Windows), watchfiles, websockets, python-dotenv, PyYAML, click, idna, typing-extensions, typing-inspection, annotated-types, annotated-doc, attrs | resolved at build | MIT, BSD-3-Clause, Apache-2.0 OR MIT (per package, listed in `THIRD-PARTY-NOTICES.txt`) | engine |
| Python runtime (CPython) | 3.12 | PSF-2.0 | engine (frozen with it) |
| PyInstaller bootloader | 6.22.3 | GPL-2.0-or-later with the bootloader exception | engine (starts the frozen engine); the exception allows it with a program under any licence |
| Claude Code | the person's own install, not shipped | the person's own terms with its maker | the Claude Code tabs and the Chat tab run the `claude` program already installed on this computer as a separate process; formtools neither bundles it nor reads or stores its sign-in |
| FFmpeg and ffprobe (LGPL build with libvpx and libopus, configured `--disable-gpl --disable-nonfree --disable-version3`) | 7.1.5 (record 7.1.5-2) | LGPL-2.1-or-later | not shipped in the app: an `ffmpeg` on PATH is used first; otherwise the frozen engine downloads the family's pinned build from `nodemode-dev/formai-binaries` (and, when that address does not answer, from the older `nodemode-dev/formcut-binaries` address that builds made before the rename use and that keeps working), checks every file's SHA-256, and keeps it in the per-person folder `formcut-binaries/ffmpeg-7.1.5-2` shared with formcut and formvis; the binaries are run as separate processes. Source: the offer published with formai-binaries and formcut-binaries |
| formvis `ffmpeg_fetch.py` and `ffmpeg_record.py`, ported to `backend/app/tools/media/fetch.py` and `record.py`, Copyright (C) 2026 NodeAgentc, Inc. | 1.98.7 | Apache-2.0 | engine |
Expand Down
30,958 changes: 30,958 additions & 0 deletions THIRD-PARTY-NOTICES.txt

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

Decisions, reasons and anything left out, newest first. Code carries no comments; the context lives here.

## Unreleased (2026-11-29): the engine serves the third-party notices (`app/routers/system.py` :: `notices`, `app/core/config.py` :: `notices_path`)

- **The change.** `GET /api/notices` answers `THIRD-PARTY-NOTICES.txt` as plain text with `no-store` and `nosniff`. `notices_path` is the file at the top of the frozen engine (`sys._MEIPASS`) or at the repository root in a source run. A build without the file answers 404 "The third-party notices are not in this build"; a file over 16 MiB is refused rather than read whole. Like every read, it is open to this computer's own window and agents only (the host and origin guard).
- **The tests.** `tests/core/test_notices.py`: the served text holds FastAPI's licence at the pin in `requirements.txt`, three.js's at the version in `package-lock.json`, the `tauri` crate at its `Cargo.lock` version and the FFmpeg reference; a foreign origin is refused; a missing file is a 404; the committed file passes `setup/notices.py --check`; the check names a removed engine and window package, a crate whose locked version moved, a section with no text, and a missing file; the runtime and bootloader sections carry their texts.

## Unreleased (2026-11-29): one Windows launcher for the family, the shared finder 1.1.0 (`app/services/agent_lookup.py`)

- **The change.** The file is copied byte for byte from FormVis, version 1.1.0, so every app of the family starts agent programs on Windows the same way. formtools had FormVis's 1.0.2 unchanged and no wrapper of its own around it: `claude_code.py` and `agent_programs.py` only call `start_argv`, and turn its `OSError` into the start's error, so no call had to go.
- **What is new for formtools.** A program name is read the way Windows opens it (`plain_name`, `batch_file`): `claude.CMD`, `claude.cmd.` and a `::$DATA` stream name are batch files too. `shim_target` follows pnpm shims (which set `NODE_PATH`; it is allowed but not carried over) and bun shims, and a launcher that sets any other variable of its own is not read as a shim. Through the command interpreter, `cmd_safe` now also holds the program's own path to the refused characters, and a spaced path may not hold `@` or be followed by an empty word.
- **The rename.** The refusal is `CommandLineRefused`, still an `OSError`; the old name `StartRefused` was used only in the tests. Its message still says to pass long text through standard input or a file.
- **The tests.** `tests/agents/test_windows_start.py` now expects `CommandLineRefused` and adds the letter case and trailing dots, pnpm and bun shims, a launcher that sets its own variables, the program path rule, the `@` and empty word rule, and the agent check reporting a refused start as found but not starting. Against the 1.0.2 file, 64 of them fail.

## 0.12.0 (2026-11-20): each Antigravity tab gets a folder of its own (`app/services/agent_programs.py` :: `open_tab_folder`, `close_tab_folder`, `_empty`, `_left_token`)

- **What was wrong.** Every Antigravity tab ran in `AgentTabs/antigravity` and wrote its `formtools_tab` entry into that one `.agents/mcp_config.json`. A second tab open at the same time overwrote the first tab's token, and closing either took the entry away from the other.
Expand Down
7 changes: 7 additions & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def resource_dir() -> Path:
return Path(getattr(sys, "_MEIPASS", BACKEND_DIR))


NOTICES_NAME = "THIRD-PARTY-NOTICES.txt"


def notices_path() -> Path:
return (resource_dir() if frozen() else REPO_DIR) / NOTICES_NAME


def engine_port() -> int:
raw = os.environ.get("FORMTOOLS_PORT", "").strip()
if not raw:
Expand Down
15 changes: 15 additions & 0 deletions backend/app/routers/system.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from fastapi import APIRouter
from fastapi.responses import PlainTextResponse

from app.core import config, registry, window_key
from app.core.errors import ApiError

router = APIRouter(prefix="/api")
NOTICES_CAP = 16 * 1024 * 1024
NOTICES_HEADERS = {"Cache-Control": "no-store", "X-Content-Type-Options": "nosniff"}


@router.get("/health")
Expand All @@ -22,6 +25,18 @@ def capabilities() -> dict:
}


@router.get("/notices", response_class=PlainTextResponse)
def notices() -> PlainTextResponse:
try:
with open(config.notices_path(), encoding="utf-8") as handle:
text = handle.read(NOTICES_CAP + 1)
except OSError:
raise ApiError(404, "The third-party notices are not in this build")
if len(text) > NOTICES_CAP:
raise ApiError(500, "The third-party notices file is larger than expected")
return PlainTextResponse(text, headers=NOTICES_HEADERS)


@router.post("/window/key")
def claim_window_key() -> dict:
if window_key.stdout_mode():
Expand Down
133 changes: 86 additions & 47 deletions backend/app/services/agent_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from dataclasses import dataclass, field
from pathlib import Path

VERSION = "1.0.2"
VERSION = "1.1.0"
PROGRAMS: dict = {
"claude": {"title": "Claude Code", "names": ("claude",), "setting": "claudeBin",
"install": "curl -fsSL https://claude.ai/install.sh | bash", "install_windows": "irm https://claude.ai/install.ps1 | iex",
Expand Down Expand Up @@ -359,72 +359,111 @@ def _quote(word: str, fish: bool) -> str:
return "'" + word.replace("'", "'\"'\"'") + "'"


class StartRefused(OSError):
pass
class CommandLineRefused(OSError):
"""A word the Windows command interpreter would not pass through to the program as it is."""


SHIM_TARGET = re.compile(r'"%~?dp0%?\\([^"%*?<>|\r\n]+)"\s*%\*')
SHIM_BYTES = 65536
CMD_SPECIAL = frozenset('&|<>^()!%"')
CMD_REFUSED = ("this program is started through the Windows command interpreter, which reads {what} as commands even inside quotes, "
"so the start was refused; remove them, or pass long text through standard input or a file if the program supports it")
BATCH_ENDINGS = (".cmd", ".bat")
RUNNERS = ("node", "bun")
_STREAM = re.compile(r"(?:::\$data)?[ .]*$", re.I)
_DP0 = r'"%(?:~dp0|dp0%)\\?([^"%\r\n]+?\.{ext})"'
_RUNNER = r'(?:"%_prog%"|(node|bun)(?:\.exe)?|"%(?:~dp0|dp0%)\\?(node|bun)\.exe")'
_SHIM_SCRIPT = re.compile(r'(?:^|&)[ \t]*@?' + _RUNNER + r'[ \t]+' + _DP0.format(ext="(?:js|cjs|mjs)") + r'[ \t]+%\*[ \t\r]*$', re.I | re.M)
_SHIM_EXE = re.compile(r'(?:^|&)[ \t]*@?' + _DP0.format(ext="exe") + r'[ \t]+%\*[ \t\r]*$', re.I | re.M)
_SHIM_SETS = re.compile(r'\bset[ \t]+"?([A-Za-z_]\w*)=', re.I)
_SHIM_PROG = re.compile(r'\bset[ \t]+"?_prog=([^"\r\n]*)', re.I)
_PROG_VALUE = re.compile(r'(?:%(?:~dp0|dp0%)\\?)?(node|bun)(?:\.exe)?', re.I)
_SHIM_OWN_VARS = frozenset({"dp0", "_prog", "pathext", "node_path"})
_CMD_REFUSED = re.compile(r'[&|<>^()!%"\x00-\x1f\x7f]')
_CMD_QUOTED = re.compile(r'[ \t]')
REFUSAL = ("Windows starts this program through the command interpreter (cmd.exe), which would change or act on the text, so it "
"was not started. Pass long or special text through standard input or a file if the program supports it, or point "
"the setting at the program's .exe or node script so it starts without the command interpreter.")


def shim_target(path: str, env: dict) -> list[str] | None:
"""The program an npm-style .cmd shim starts, so it can be started directly: [node, script] for a script, [program] for
an .exe beside the shim. None when the shim is not one this recognises or its target is missing."""
def plain_name(path: str | os.PathLike) -> str:
"""The file name as Windows opens it: lower case, without trailing dots or spaces or a ::$DATA stream name."""
return _STREAM.sub("", Path(str(path)).name).lower()


def batch_file(path: str | os.PathLike) -> bool:
"""Whether Windows would start this file through the command interpreter (.cmd or .bat in any letter case)."""
return plain_name(path).endswith(BATCH_ENDINGS)


def _beside(folder: Path, rel: str) -> Path:
return folder.joinpath(*[part for part in rel.replace("\\", "/").split("/") if part])


def _runner(text: str, named: list[str]) -> str | None:
"""The one runner (node or bun) every script line of a shim uses, or None when they disagree or one is unknown."""
progs = _SHIM_PROG.findall(text)
stems = {word.lower() for word in named if word}
if any(not word for word in named):
for value in progs:
match = _PROG_VALUE.fullmatch(value.strip())
if not match:
return None
stems.add(match.group(1).lower())
return stems.pop() if len(stems) == 1 else None


def shim_target(shim: str, env: dict | None = None) -> list[str] | None:
"""The program an npm, pnpm or bun .cmd shim runs (its script with node or bun, or its .exe), so it can be started
without the command interpreter; None when the file is not such a shim (it sets anything of its own other than
NODE_PATH, or hands %* to anything else) or its target is missing. pnpm's NODE_PATH is not carried over: node finds a
package's own dependencies from the script's folder."""
env = os.environ if env is None else env
folder = Path(shim).parent
try:
with open(path, "rb") as f:
text = f.read(SHIM_BYTES).decode("utf-8", "replace")
text = Path(shim).read_text(encoding="utf-8", errors="replace")[:65536]
except OSError:
return None
found = SHIM_TARGET.search(text)
if not found:
return None
folder = Path(path).parent
target = folder.joinpath(*found.group(1).split("\\"))
if not target.is_file():
return None
if target.suffix.lower() == ".exe":
return [str(target)]
if target.suffix.lower() not in (".js", ".cjs", ".mjs"):
if any(name.lower() not in _SHIM_OWN_VARS for name in _SHIM_SETS.findall(text)):
return None
beside = folder / "node.exe"
node = str(beside) if beside.is_file() else shutil.which("node", path=env.get("PATH") or None)
return [node, str(target)] if node and not node.lower().endswith((".cmd", ".bat")) else None


def _quoted(word: str) -> bool:
return " " in word or "\t" in word or not word
lines = _SHIM_SCRIPT.findall(text)
scripts = [_beside(folder, rel) for _bare, _dp0, rel in lines]
exes = [_beside(folder, rel) for rel in _SHIM_EXE.findall(text)]
if scripts and not exes and len(set(scripts)) == 1 and scripts[0].is_file():
runner = _runner(text, [bare or dp0 for bare, dp0, _rel in lines])
if runner is None:
return None
beside = folder / f"{runner}.exe"
found = str(beside) if beside.is_file() else shutil.which(runner, path=env.get("PATH", ""))
return [found, str(scripts[0])] if found else None
if exes and not scripts and len(set(exes)) == 1 and plain_name(exes[0]) not in ("node.exe", "bun.exe") and exes[0].is_file():
return [str(exes[0])]
return None


def cmd_safe(words: list[str]) -> None:
"""Refuses any word the command interpreter could read as more than text, quoted or not: a control character or one of
& | < > ^ ( ) ! % and the double quote. When the program itself is quoted, cmd /c keeps the line only when no other
word needs quotes, so that is refused too."""
for word in words:
if any(ord(ch) < 32 or ord(ch) == 127 for ch in word):
raise StartRefused(CMD_REFUSED.format(what="line breaks and control characters"))
if CMD_SPECIAL.intersection(word):
raise StartRefused(CMD_REFUSED.format(what='the characters & | < > ^ ( ) ! % "'))
if _quoted(words[0]) and any(_quoted(word) for word in words[1:]):
raise StartRefused("this program is in a folder with spaces and is started through the Windows command interpreter, which "
"drops the quotes when another word has spaces, so the start was refused; remove the spaces from the other "
"words, move the program to a folder without spaces, or pass long text through standard input or a file "
"if the program supports it")
"""Raises CommandLineRefused unless cmd.exe /c would pass every word, the program's path included, unchanged. No word
may hold & | < > ^ ( ) ! % " or a control character: quotes do not protect a word there, so no word is let through
because it is quoted or has no spaces. A program path that needs quotes (a space or tab) keeps them only when it is
the line's one quoted word and holds no @, so such a path may not be followed by a word that needs quotes."""
words = [str(word) for word in words]
for index, word in enumerate(words):
if _CMD_REFUSED.search(word):
what = "The path of this program" if index == 0 else "A word for this program"
raise CommandLineRefused(f"{what} has one of & | < > ^ ( ) ! % \" or a control character. {REFUSAL}")
program, rest = words[0], words[1:]
if _CMD_QUOTED.search(program) and ("@" in program or any(word == "" or _CMD_QUOTED.search(word) for word in rest)):
raise CommandLineRefused("The path of this program has a space, and the command interpreter would drop its quotes when an "
f"@ is in it or another word has a space or is empty. {REFUSAL}")


def start_argv(cmd: list, env: dict | None = None, platform: str | None = None) -> list[str]:
"""How a program is started, the same for a tab, Chat and a check: through the person's login shell on macOS and Linux
(exec, so the process is the program), directly on Windows. A .cmd or .bat is started as the program its shim names when
it can be read, otherwise through the command interpreter with every word checked by cmd_safe."""
(exec, so the process is the program), directly on Windows. An npm, pnpm or bun .cmd shim is started as the node or bun
script or the program it names, with the words as an argv list; any other .cmd or .bat (any letter case, trailing dots
or spaces) goes through the command interpreter, only with words it passes through unchanged."""
words = [str(c) for c in cmd]
env = os.environ if env is None else env
if windows(platform):
if not words[0].lower().endswith((".cmd", ".bat")):
if not batch_file(words[0]):
return words
direct = shim_target(words[0], env)
if direct:
if direct and not batch_file(direct[0]):
return [*direct, *words[1:]]
cmd_safe(words)
return [env.get("COMSPEC") or "cmd.exe", "/c", *words]
Expand Down
Loading
Loading