On FreeBSD process capture was a stub that returned "only available on
Linux and macOS", so a console study kept no runs and a console run check
never ran the build. The nightly FreeBSD job has failed on the two tests
that cover them since they landed (#1679, #1702).
FreeBSD now captures the way Windows does: the program runs through
platform::process (its process group is ended with it) and its output is
read through pipes, which keep what a short program wrote after it exits;
a terminal on FreeBSD loses it. Scripted input, resizes, signals and
watched files still need the terminal capture and are refused there.
The pipe capture now has a Unix test, and capture_and_compare_echo runs on
every Unix rather than only Linux and macOS.
A Windows game's folder copied to Linux or macOS has no file with an executable bit, so no program was found and Deep mode skipped the decompiler. A Windows .exe now counts as the program to study on every system, while runtime study starts only a program this computer can run, in both its window and console runs.
Addresses #1178 (which also consolidates #1277).
## The problem
The website study a build starts with opens a fresh private browser, so a web app behind a login is studied as its sign-in or landing page, and the builder then builds a sign-in page.
## What this adds
- **`web_site_sign_in { url }`** opens a visible browser window on the site. The person signs in there themselves and closes the window. The browser's profile is then saved in Craft Anything's own folder, keyed by the site's host and port. Craft Anything never sees or stores a password and still never reads cookie or storage values.
- **`web_site_open`** uses a saved sign-in for that exact host and port when there is one, by copying it into the usual temporary profile (headless as before, deleted afterwards). `signed_in: false` forces the private profile; `signed_in: true` with nothing saved is a clear error naming the sign-in tool. Nothing else about the private path changes.
- **`web_site_sign_out { url }`** forgets a saved sign-in.
- **A check right after saving.** The sign-in tool reopens the site headless exactly as a later study will, and reports whether it still looks like a sign-in page, plus a screenshot kept in the site's owner-only folder (path, hash and size are returned, not the picture, so the person's account screen is not sent to an agent).
- **Typed facts through to the builder.** `signed_in`, `signed_in_site` and `sign_in_page` are in the open result, the capture result and `capture.json`. The website briefs tell the builder the capture is the signed-in view only when it is signed in and does not look like a sign-in page. A not-signed-in capture with a password field says how to sign in; a signed-in one says the sign-in may have ended.
- The check phase opens the built site with `signed_in: false`.
Because a study already starts with `web_site_open`, a normal build of that site is signed in after one `web_site_sign_in`, with no new build option.
## Decisions for maintainers
These are policy calls I made so the change is usable; each is small to reverse.
1. **Clean room allows the two tools** (two lines in `clean_room.rs`). Reasoning: the person signing in as themselves and looking at pages is watching from outside, as a user would; `visitor_view()` strips exactly what it did before.
2. **A saved sign-in is used by default** for later opens of that site, until `web_site_sign_out`. Saving it is treated as the consent, and the tool text and evidence say so. The alternative is opt-in per study, which needs an option in the Make screen and `rebuild`.
3. **Restricted MCP mode refuses both tools even with `--allow-web`**, since sign-in opens a window on the person's desktop.
4. The saved profile sits on disk (owner-only on Unix; on Windows it relies on the per-user config folder). On Linux it is launched with the basic password store so the visible and headless launches can read the same cookies. The tool text says that anyone who can open the person's files could use the sign-in.
## Trade-offs and limits
- Needs a desktop: on a computer with no display the tool refuses at once with what to do instead.
- Sites that tie a sign-in to the browser, or expire it quickly, will capture signed out; the check after saving and the `sign_in_page` field say so.
- Session-only cookies are kept by setting the profile to continue where it left off; restored tabs are not copied.
- The saved profile can also hold single sign-on providers' sign-ins made in that window. It is used only when that exact host and port is opened.
- Screenshots and page text of a signed-in study contain the person's own account data; the evidence says so. Result URLs drop the query and fragment when a sign-in is used.
- Not in this PR (roadmap lines added under R2.9): a Make-screen button, showing the person the study's first screenshots to confirm before the builder starts, attaching to the person's running browser, refreshing a saved sign-in from a capture, and a live run on a real site and with the Snap browser.
## What was verified
Run locally on Linux (x86-64), on the branch before its final rebase onto `main` (the rebase was clean; after it: `cargo fmt --all --check`, `cargo xtask layers`, `locks`, `secrets`, `tools --check`, `i18n-coverage` pass):
- `cargo test -p craft-anything-engine` (583 passed, 12 ignored), `-p craft-anything-mcp` (22), `-p craft-anything-ai` (580, 3 ignored).
- `cargo clippy -p <crate> --all-targets -- -D warnings` for engine, mcp and ai.
- **Live, with Chromium 157 under a virtual display against a local test site** (the new `#[ignore]` tests in `site_sign_in/tests.rs`; a helper plays the person over the browser's own debugging port and closes the window):
- a sign-in made in the visible window is seen by a later headless open and capture, including an HttpOnly cookie and a session-only cookie (removing the continue-where-you-left-off setting makes that assertion fail, so the setting is what keeps it);
- `signed_in: false` and a signed-out site show the signed-out page with the private-profile limitation;
- a site that forgets the cookie is reported as still a sign-in page by the check after saving;
- two overlapping signed-in opens both work and leave the saved sign-in byte-identical;
- the timeout path stops the browser, keeps what was saved and leaves no process behind;
- with no display the tool refuses immediately.
- The two existing live website tests still pass.
**Not verified:** a real third-party site; a confined Snap or Flatpak browser (reasoned from the existing profile-location code, not run); Windows and macOS behaviour, including the browser-exit signal (the profile lock going away) and cookie decryption there; the workspace-wide `cargo xtask ci` steps and `--features wasm-plugins` (not enough disk locally, so CI is the first run of those); how the egui app shows the new tools.
An independent review pass was done before opening; its findings (copying only after the browser has exited, not treating one slow probe as a closed window, a whole-or-nothing replacement of the saved profile, reserved Windows names in site keys, owner-only permissions) are fixed in the later commits.
The MCP server sent progress notifications whenever a call carried a progressToken field, whatever it held. MCP's token is a string or a number, so a null, object, array or boolean now gets no progress notifications; a valid token still gets them, before the response.
The firmware carver read a PE's header size and certificate directory at fixed offsets without checking the optional header's declared size, so a short header could borrow bytes after it, inflate the region and carve into the next embedded object. Those fields are now read only inside the declared optional header, and a header too short for its fixed fields gives no PE region.
The .NET reader read the data-directory count and the CLI directory at fixed offsets without checking the optional header's declared size, so a file whose header ended earlier could be read as a .NET assembly from section-table bytes, or refused with a misleading section error. It now reads those fields only inside the declared optional header and refuses a short one as truncated.
Four shapes still estimated one or two levels and then overflowed the parser's stack: an else-if chain whose links end with ";", a class extends chain, a run of prefix ++, and brackets hidden in a false regex after an update operator or a member name. The estimate now counts each, and "/" after those tokens is read as division. A regex after yield is read only when it closes on the line; its brackets and operators are counted too, and a source where the regex and division readings can't be told apart takes the lexer fallback.
app_graphs_compare and js_exports_compare dropped the analysis limitations of the graphs they compared (a malformed source map, a truncated inventory, dynamic IPC names), so a comparison read as complete when one side was partial. Each side's limitations, from a path or from saved js_app_map evidence, now go into the comparison's evidence labelled left: or right:.
native_strings_find listed at most 32 references per matching string with no count or flag. Each match now carries its complete reference_count and a references_capped flag, and a search with a cut list adds a references_capped limitation.
An OpenCode builder runs with `--auto`, so it once wrote its notes into `inbox/build-progress.json` and stopped the build. A build's OpenCode config now carries permission rules that deny its edit tool every record Craft Anything keeps in the project (`craft.json`, `feed.json`, `inbox/`, `investigation.cany/`, `reference/`…, from `workspace::OWN_NAMES`), except `checks/`, in either project layout. Chats and questions are unchanged. Its shell and folders outside the project aren't covered (roadmap R2.2).
A pitfall: the roadmap read on an old branch showed work main had already done as open. Read it from `origin/main`, and check the state of a PR a pending line names.
A builder that kept its own notes in inbox/build-progress.json stopped every later run with an unexplained parse error. The run still stops on a progress record it can't read, but now says the file is Craft Anything's record of the build, that something else changed it, and to rename or delete it to go on; a record from a newer version still says to update. Every brief now names craft.json, feed.json and inbox/ as Craft Anything's own records.
CI's stable Rust moved to 1.100, whose Cargo runs a test binary from target/<profile>/build/<package>/<hash>/out instead of target/<profile>/deps, so self_cli_path no longer found the CLI built into target/<profile> and two rebuild tests failed on main and every pull request. It now looks in target/<profile> from that folder too; the earlier checks are unchanged.
core_report_write lists at most 30 distinct limitations; past that, its Markdown and HTML reports now end the list with how many more were omitted, instead of dropping the rest without a word. A report with 30 or fewer is unchanged.
An application graph resolved only the first 2,000 imports of a module and dropped which per-file fact lists were cut, so later dependencies lost their edge and role and nothing said a list was cut. Every retained import is now resolved, the cut lists are named in a facts_truncated limitation, and js_app_map reports partial coverage for such a graph.
app_graphs_compare and js_exports_compare cut added, removed, bundle-module and vendor rows at 2,000 without saying so, and the app comparison's summary reported the cut lengths as totals. Each list now carries its complete total beside the capped rows, the summary uses those totals, and a cut comparison is marked rows_capped with a limitation and partial coverage.
Folder walks read each .gitignore whole, whatever its size. They now read it through the capped, regular-file-checked reader with a 1 MiB limit; one that is too large, not a regular file, not UTF-8 or unreadable is skipped, and app_source_import, js_source_bundle_compare and the managed source reader say so in a gitignore_skipped limitation, since its rules no longer hide files.
core_archives_compare counted every added, removed, changed and moved file but cut each list at max_rows without saying so. It now marks a cut comparison rows_capped, with a limitation that the counts are complete and partial coverage; a comparison that fits keeps its evidence as before.
An application graph dropped edges past 4 x max_nodes without saying so, and js_app_map reported complete coverage even for a graph cut by its node or edge cap. The builder now counts edges the cap turns away and records an edge_cap limitation beside node_cap, and js_app_map marks coverage partial when either cap cut the graph, on every module page.
A source-to-bundle comparison with more scripts than max_rows reported the examined window's counts as if they covered the whole tree, and its count of bundle units without a source was the capped row count. It now says how many scripts were examined beside the total, counts every unclaimed unit while still listing at most max_rows, and marks a capped result with a rows_capped limitation and partial coverage.
The JavaScript analyzer had its own copy of the sourceMappingURL reader, which missed #1731's fix: it now uses the formats one, so the no-space annotation is found, tabs and repeated spaces are accepted, a URL with whitespace is refused, and an annotation up to 64 lines from the end is seen, on the parsed and lexer paths alike.
The shared engine downloader already required an HTTPS starting address but followed a redirect from HTTPS to plain HTTP. Every redirect hop is now held to HTTPS before connecting, and a refused redirect says so without printing the address, which can carry a signed query or credentials. Tested against local TLS servers with certificates made for each run.
When a bundle is too large or can't be parsed, the token-level fallback now caps its fetch calls, URL literals and exposeInMainWorld objects at the same list limit the syntax-tree pass uses, and records endpoints as truncated when a fetch call is dropped, so a huge bundle can't grow those lists without limit.
An index-map section that points at an external map, which is never fetched, adds no sources, so an application graph treated the map's list as complete. Such sections are now counted (through nested index maps), the graph names them in a limitation, and comparing a reference source tree with the bundle reports an otherwise unmatched source as uncertain with partial coverage instead of absent.
Before a backend's first request (and once more while the server hasn't said), the agent asks its server for the context window it has loaded: the model list's context fields for OpenAI-compatible services and OpenRouter, and on this computer or its network llama.cpp's props, llama-swap's upstream (only for a model already loaded), LM Studio's loaded length and Ollama's /api/ps. A local model's budget becomes three quarters of that window instead of a fixed 24k; for a paid service a window read this way only lowers the 150k default. A refusal's window and a budget the person set still win.
A jump through a byte-indexed table of offsets with no bounds check, as Rust's async state machines use, made Ghidra read 256 entries, follow the ones inside other code and decompile without end (#1715). Before decompiling, the bridge now finds such tables, works out where each ends from a linear pass over the function (its .pdata extent on Windows) and gives Ghidra their real targets as a switch override, in memory for this run; guarded tables only get their targets added. A 60-stage Rust async program decompiled in 16 s instead of falling back after 938 s. Fixes#1715.
A folder walk is now limited by the entries it examines and the path bytes it holds, not only the files it keeps, so a tree of empty folders or links or one folder with millions of names no longer walks or loads without end. A cut listing keeps the first names in name order, the same every time; the walk stops at the first file or entry over a limit and says so, cancel is checked inside a long folder listing, and an ASAR's unpacked folder and JavaScript source folders now report when they were cut short.
CRAFT_FONTS_REQUIRED without CRAFT_FONTS_DIR is now a build error naming both, instead of a build with no fallback fonts where non-Latin scripts show as boxes. A manifest listing no fonts counts as a bad folder, and CRAFT_FONTS_REQUIRED set to nothing or 0 means not required. The decision is one tested function in build.rs.
Only a missing config.toml gives plain defaults now. A file another program holds, the account can't read, or that isn't UTF-8 no longer loads as defaults that the next save writes over it: one that can't be understood is set aside under the first free config.toml.broken name (an earlier copy is never replaced), and one that can't be read or set aside stays where it is while saves, deferred saves, settings_set and plugins_add refuse with BadSettings.
A project placed by a relative path gave engines and programs relative paths, but the child already runs inside app/, so Unity's -projectPath, Godot's --path, Unreal's -project and -archivedirectory, option runs (--screenshot, --self-test), console run checks and Play pointed inside app/ a second time. They now resolve the project path first; a program named by a bare PATH command is left as it is.
The source-map parser bounds the inventory it builds, but source recovery's manifest repeated every expanded source path in its outputs, so a long shared sourceRoot could still retain tens of megabytes of paths. Recovery now charges each original's source path and output path to the inventory's entry and byte budget, shared across inputs; once it's reached, further originals are left out, and the manifest, result, summary, a limitation and partial coverage say so. A pitfalls entry records the rule.
When a source map's inventory was cut by its limits, the source-to-bundle comparison searched only the retained names and reported an omitted source as confirmed unmatched. Sources with no observed match now go in a separate uncertain_sources list with the reason source_map_inventory_truncated, the result says the inventory was truncated, and the evidence carries a limitation and partial coverage; positive matches are unchanged.
Distinct source identities such as src//main.js and src/main.js normalize to the same recovery path, so recovery kept the first and dropped the rest; a file and a folder of the same name, and separate inputs with the same name, lost sources the same way. Ordinary paths are unchanged; a source whose path would collide now goes to its own sources-collisions/<input>/<source>/ folder, and the manifest records each one's input and source-map index. A pitfalls entry records the rule.
A small source map could expand to gigabytes when its sourceRoot was copied into every source name, and the full list was built before the application analyzer kept 5,000 of them. Source lists are now built within an entry and byte budget shared across sections and an application's maps, checking each expanded path's length before allocating it; when only a prefix fits, the result says it was truncated and the analysis notes it as a limitation. A pitfalls entry records the rule.
Method fingerprints wrote float constants as JSON numbers, which can't hold NaN or infinity, so methods differing only in such constants got the same fingerprint. Nonfinite constants are now written as their IEEE-754 bits, and single-precision NaNs keep their original operand bits, which widening to double could change.
The DER reader accepted redundant length encodings (a long form under 128, or a leading zero length byte) without saying so. Each element now records whether its length is minimal; certificate, CMS, Authenticode and certificate-chain views keep everything they read and add one note that an element is not strict DER, and signatures over those bytes are checked as before.
A modern .pyc header's flag word defines only its two low bits, and other bits were read without comment. Undefined bits are now reported as a header warning, while the invalidation mode, source fields and code are read from the defined bits as before, so a file from a future Python release that adds a flag stays readable. Legacy headers, which have a timestamp in that position, are unaffected.
POSIX makes everything after = in a ps -o argument the header, so FreeBSD's ps read pid=,ppid= as a single pid column headed ",ppid=". The process tree then had no parents, a runner's child window was never found there, and snapshot_finds_an_owned_child_on_this_host failed on every FreeBSD run since it was added.
A text file outside a build (a script, Markdown, settings, a log) could only be searched byte by byte: the native tools refused it and build_file_read works only in a build. The new core_text_read (Deep mode) reads one as text, a page of lines at a time: UTF-8, or UTF-16 with a byte-order mark, invalid bytes shown as U+FFFD and counted, very long lines cut and named, and a file with zero bytes near its start refused as binary. Nothing is run.
Fixes#539
When a run's time limit or a cancel fired, the program was stopped through a call that then waited for it with no limit (and on Windows for a job message the system doesn't promise to send), so a program that outlived its stop held the run past every deadline, Pause included. The program and whatever it started are still stopped, but the run now waits at most 5 seconds for them to be gone, then logs a warning and carries on.
Refs #1438
A job of unknown length drew its progress bar with egui's animated ProgressBar, which asks for a frame every frame, so the window redrew at the display's rate for as long as the job ran, even in the background (as the spinner did before #579). The jobs list now uses our own progress bar: filled to a known fraction with no frames asked for, or sweeping at the animation's pace (once a second in the background) when the fraction isn't known.
A coding agent's turn ended only when its process exited, so when Claude Code printed its final result and then kept running (a shutdown hook, logging), a finished build stayed on "Building" or "Pausing" for as long as the idle limit allowed, hours for a builder turn. The turn now ends a short grace (5 s) after the stream's own result, without being reported as stopped or failed; a deadline hit before any result still stops the turn as before.
When a tar listing stopped at a GNU long name or link it refused (too long, or cut short), the engine installer still wrote the files listed before it and reported success, which could replace a working engine with part of one. The listing now says why it stopped, and the installer refuses such an archive before writing anything, with a plain-English error. An archive missing only its end marker still installs.
A private browser or driven Electron app was stopped only when its process handle was dropped, which a crash, a kill, a force quit or an MCP server stopped by its client never does, so the browser was left running and its profile stayed in the temp folder. On Unix a small watcher now stops the browser's process group and deletes its `craft-*` profile once the app is gone, and ends by itself as soon as the browser does. Windows children are held by a Job Object; whether one outlives an abrupt exit is left as a roadmap line.
Refs #810
Claude Code reports the whole session's running cost on every turn, and a build resumes the same session each turn, so adding each turn's figure made a long build's estimate grow far past what it cost. The last total of each session is now kept in the config folder, and a resumed turn counts only what it added; a new session's first turn counts its total, and a resumed or forked session with nothing kept counts nothing rather than an inflated figure.
Refs #1187