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

window:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -120,6 +122,7 @@ jobs:
run: |
for f in formlit formlit_oc_install backend/oc_install backend/boot_backend frontend/oc_install frontend/boot_frontend setup/*; do
case "$f" in *.bat|*.py) continue ;; esac
[ -f "$f" ] || continue
bash -n "$f"
done
- name: No em dash in tracked markdown, no emoji in tracked text
Expand Down
2 changes: 2 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

formlit is licensed under the Apache License 2.0 (see `LICENSE`). Copyright 2026 NodeAgentc, Inc. It includes, ports or depends on the following works.

This file is the human ledger: what each component is, its licence and why it is there. The full licence texts (copyright lines, conditions and disclaimers) of everything the app ships are in `THIRD-PARTY-NOTICES.txt` at the repository root, written and checked by `setup/notices.py` (`--check` runs in CI). That file ships inside every installer beside `LICENSE` and this file, and is frozen into the engine, which shows it in the About box under Third-party notices, beside Licences and notices.

## Included in this repository

| Work | License | Where |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Code owners are set in [`.github/CODEOWNERS`](.github/CODEOWNERS).

## License

FormLit is licensed under the Apache License 2.0 ([`LICENSE`](LICENSE), SPDX `Apache-2.0`). Copyright 2026 NodeAgentc, Inc. Third-party notices: [`NOTICE.md`](NOTICE.md).
FormLit is licensed under the Apache License 2.0 ([`LICENSE`](LICENSE), SPDX `Apache-2.0`). Copyright 2026 NodeAgentc, Inc. Third-party notices: [`NOTICE.md`](NOTICE.md) (what each component is and why) and [`THIRD-PARTY-NOTICES.txt`](THIRD-PARTY-NOTICES.txt) (their full licence texts).

This product includes DNG technology under license by Adobe Systems Incorporated.

Expand Down
34,428 changes: 34,428 additions & 0 deletions THIRD-PARTY-NOTICES.txt

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,22 @@ On Windows a `.cmd` or `.bat` program went through `cmd.exe /c`, which reads per

Exporting an original, or a DNG whose metadata cannot go into the file, wrote `<stem>.xmp` in the export folder even when a raw file of the same name there owns it. Such a file now takes its metadata in the file (or keeps what it has), and the other sidecar stays. Exporting photos into a new catalog copies a sidecar only beside the photo that owns it, so a JPEG copied without its raw no longer takes the raw's settings with it.

### app/engine/agent_lookup.py at 1.1.0 · setup/agents.py · LOOKUP_HASHES
- refers-to: app/engine/agent_lookup.py :: plain_name, batch_file, shim_target, cmd_safe, start_argv, CommandLineRefused; setup/agents.py :: LOOKUP_HASHES; tests/test_agent_start_windows.py
- kind: fix
- logged: unreleased · 2026-11-29

`agent_lookup.py` is now FormVis's `backend/app/services/agent_lookup.py` at formvis commit 83ea8274, VERSION 1.1.0, SHA-256 `313fcd40541199c920314516026a0b225aeb4915e9a5dc26bf51d1ba05f1da8e`, copied byte for byte and never edited here, so the family has one Windows starter. It is built on 1.0.2: the program name is read the way Windows opens it (any letter case, trailing dots or spaces, a `::$DATA` stream name), pnpm and bun shims are followed as npm shims were, and through `cmd.exe` every word, the program path included, is refused when it holds `& | < > ^ ( ) ! % "` or a control character, as is a spaced program path holding `@` or followed by an empty or spaced word. `cmd_words` is gone; nothing in formlit called it. No formlit wrapper duplicated the hardening, so nothing else changed. `LOOKUP_HASHES` keeps 1.0.0 to 1.0.2 and adds 1.1.0. Three tests are new: a shim named in any letter case, with trailing dots or spaces or a stream name, is followed; a pnpm shim starts its script with the node beside it; a spaced program path followed by an empty or spaced word is refused.

### setup/notices.py, setup/notices_text.py, setup/notices_crates.py · routers/system.py · core/config.py · THIRD-PARTY-NOTICES.txt
- refers-to: setup/notices.py :: generate, check, requirement_roots, root_extras, bootloader_section, data_sections, ffmpeg_section; setup/notices_text.py :: render, parse; setup/notices_crates.py :: locked_crates, describe; app/routers/system.py :: notices; app/core/config.py :: notices_path; setup/freeze_backend, setup/freeze_backend.bat; src-tauri/tauri.conf.json :: bundle.resources; tests/test_notices.py
- kind: feat
- logged: unreleased · 2026-11-29

NOTICE.md says what each component is and why it is there; THIRD-PARTY-NOTICES.txt at the repository root now holds the full licence texts (copyright lines, conditions and disclaimers) of what ships, following FormDAM's generator. `python3 setup/notices.py` writes it. Python: the names in requirements.txt and requirements_macos.txt and everything they require, markers evaluated for macOS, Linux and Windows at Python 3.12 with the union taken, a root's own extras followed (uvicorn[standard] brings uvloop, httptools, websockets, watchfiles, python-dotenv and PyYAML) and other extras left out; pillow-heif is left out because the freeze excludes it. A pin counts only on a line without a marker, so the Intel Mac lines do not override the main pins. Each package carries every licence, copying, notice or authors file its distribution lists, including a licenses folder (rawpy carries LibRaw's that way), and the interpreter's LICENSE.txt is the runtime section. A package needed on another platform and not installed here keeps its section from the previous file and is named on stderr; `--extra-site DIR` reads metadata from unpacked wheels of another platform after this environment (the first file took pywinpty, pywin32-ctypes, jeepney, SecretStorage and PyInstaller that way). PyInstaller 6.22.3, pinned in requirements_desktop.txt, is a bootloader section: only its bootloader and runtime code ship, under its exception. JavaScript: the packages package-lock.json does not mark dev, with the licence files from node_modules. Rust: every crate Cargo.lock reaches from formlit, licence and repository from `cargo metadata --locked` (`--offline` passes it on) or the registry cache, with a note for a crate that carries no licence file or is not in the cache. Data: the Liberation fonts and the Lensfun database in shared/ with their licence files, and the demo credits. Binaries: the ffmpeg build the engine downloads, referenced by its formai-binaries release, which carries its own notices, the LGPL-2.1 text and the source. Identical texts are printed once at the end and referred to by number; bodies are written with one final newline, so the file reads back to the same text and two runs give the same bytes.

`--check` fails when a pinned Python package is listed at another version, a shipped Python package, npm package, crate, the bootloader pin, a data set or the ffmpeg release has no section, a section no longer ships, or a shipped data licence file differs from its text in the file. It runs in CI after the test job's pytest. The engine serves the file as text at `GET /api/notices` (404 when absent, capped at 16 MB); `config.notices_path()` is the frozen engine's resource folder, where both freeze scripts now add the file, or the repository root. The installers carry it as a bundle resource beside LICENSE and NOTICE.md. Six tests: the route serves the file, a missing file is a 404, the check passes on this tree, it names a removed npm and Python section, it names a changed data licence file, and the file reads back as written.

## Files with no entries {#no-entries}

No logged content at v0.1.0 for: `app/__init__.py`, `app/main.py`, `app/engine/events.py`, `app/engine/tasks.py`, `app/engine/query.py`, `app/engine/records.py`, `app/develop/settings.py`, `app/develop/geometry.py`, `app/develop/planes.py`, `app/develop/retouch.py`, `app/develop/colorops.py`, `app/develop/colour.py`, `app/develop/curves.py`, `app/develop/auto.py`, `app/develop/camera_look.py`, `app/develop/lensprofile.py`, `app/develop/fringe.py`, `app/develop/output.py`, `app/ai/models.py`, `app/ai/nets.py`, `app/ai/parts.py`, `app/ai/cull.py`, `app/ai/upright.py`, `app/ai/dng.py`, `app/output/icc.py`, `app/output/web.py`, `app/services/importer.py`, `app/services/metadata.py`, `app/services/xmp_presets.py`, `app/services/xmpwrite.py`, `app/services/xmpembed.py`, `app/services/rename.py`, `app/services/lensdb.py`, `app/services/watch.py`, `app/services/catalog_io.py`, and the remaining routers.
7 changes: 7 additions & 0 deletions backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ def shared_dir() -> Path:
return bundled if bundled.is_dir() else REPO_DIR / "shared"


NOTICES_NAME = "THIRD-PARTY-NOTICES.txt"


def notices_path() -> Path:
return resource_dir() / NOTICES_NAME if getattr(sys, "frozen", False) else REPO_DIR / NOTICES_NAME


def dist_dir() -> Path | None:
raw = os.environ.get("FORMLIT_DIST")
candidate = Path(raw) if raw else REPO_DIR / "frontend" / "dist"
Expand Down
142 changes: 96 additions & 46 deletions backend/app/engine/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 @@ -360,63 +360,113 @@ def _quote(word: str, fish: bool) -> str:


class CommandLineRefused(OSError):
pass


SHIM_TARGET = re.compile(r'"%~?dp0%?\\([^"%\r\n]+)"\s+%\*')
SCRIPT_ENDINGS = (".js", ".cjs", ".mjs")
CMD_REFUSED = re.compile(r'[&|<>^()!%"\x00-\x1f\x7f]')


def shim_target(path: str, env: dict) -> list[str] | None:
"""What an npm style .cmd shim starts, as the words to start it with directly: [node, script] or [program]. None when
the file is not such a shim or its target or node cannot be found."""
shim = Path(path)
"""A word the Windows command interpreter would not pass through to the program as it is."""


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 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:
text = shim.read_text(encoding="utf-8", errors="replace")
text = Path(shim).read_text(encoding="utf-8", errors="replace")[:65536]
except OSError:
return None
hits = SHIM_TARGET.findall(text)
if not hits:
if any(name.lower() not in _SHIM_OWN_VARS for name in _SHIM_SETS.findall(text)):
return None
target = shim.parent.joinpath(*[part for part in re.split(r"[\\/]", hits[-1]) if part])
if not target.is_file():
return None
if target.suffix.lower() not in SCRIPT_ENDINGS:
return [str(target)] if target.suffix.lower() == ".exe" else None
beside = shim.parent / "node.exe"
node = str(beside) if beside.is_file() else shutil.which("node", path=env.get("PATH") or os.environ.get("PATH", ""))
return [node, str(target)] if node else None


def cmd_words(words: list[str]) -> list[str]:
"""The words for cmd.exe /c, refused (CommandLineRefused) when any word holds one of & | < > ^ ( ) ! % " or a control
character, quoted or not, or when the program path holds a space. Quotes do not protect a word here: a batch file
reads its arguments again."""
name = Path(words[0]).name
if " " in words[0]:
raise CommandLineRefused(f"{name} is in a folder whose path has a space, so it cannot be started through the command interpreter")
for word in words:
if CMD_REFUSED.search(word):
raise CommandLineRefused(f"{name} cannot be given the characters & | < > ^ ( ) ! % \" or control characters through the command "
"interpreter; pass long text through standard input or a file if the program supports it")
return words
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:
"""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 on Windows is started as the node script or
program its npm shim names; only a file that is not such a shim goes through the command interpreter, with its words
checked by cmd_words."""
(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
target = shim_target(words[0], env)
if target:
return [*target, *words[1:]]
return [env.get("COMSPEC") or "cmd.exe", "/c", *cmd_words(words)]
direct = shim_target(words[0], env)
if direct and not batch_file(direct[0]):
return [*direct, *words[1:]]
cmd_safe(words)
return [env.get("COMSPEC") or "cmd.exe", "/c", *words]
shell = login_shell(env, platform)
fish = Path(shell).name == "fish"
return [shell, "-l", "-c", "exec " + " ".join(_quote(w, fish) for w in words)]
Expand Down
16 changes: 16 additions & 0 deletions backend/app/routers/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil

from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import PlainTextResponse

from app.core import config, window_key

Expand Down Expand Up @@ -45,6 +46,21 @@ def capabilities() -> dict:
}


NOTICES_CAP = 16 * 1024 * 1024


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


@router.post("/window/key")
def claim_window_key() -> dict:
if window_key.stdout_mode():
Expand Down
Loading
Loading