Commit Graph
1148 Commits
Author SHA1 Message Date
Oliver Mee 41397fa761 Include explicitly referenced production module files in policy checks 2026-11-16 18:44:09 +08:00
Oliver Mee 59941e75af Check hidden source and report unscannable directory links 2026-11-16 18:44:09 +08:00
Oliver Mee 518b8be76b Keep production source directories in policy checks 2026-11-16 18:44:09 +08:00
Oliver Mee 3df6b38e40 Check complete Rust items in source policy gates (R0.5) 2026-11-16 18:44:09 +08:00
Simon Koch-Sultan 352848bfb6 Leave the service's words out of an API backend's failure log (R5.5)
write_failure_log wrote the error's message, which repeats what the
service or a proxy in front of it answered (up to 1,000 characters of an
HTTP error, all of a stream's error message), so a key or words from the
request repeated there were kept in logs/. The log now keeps Craft
Anything's code for the error, the HTTP status, the context window and
request size, and the service's error code only when it is one of
failure::KNOWN_PROVIDER_ERRORS, written from that list.
2026-11-16 05:26:42 -05:00
Simon Koch-Sultan 777ef76170 Claim leaving the service's words out of an API failure log (R5.5) 2026-11-16 05:23:08 -05:00
Fadlalla-ai 752ccd5e6f Keep the rest of the Linux quick start open on the roadmap (R5.7)
The ticked line covered only what ran: the window on a clean Ubuntu 24.04 and
the snake rebuild on a desktop. The website rebuild examples, a rebuild on a
clean machine, a real screen and Wayland get their own open line.
2026-11-16 14:16:21 +04:00
Fadlalla-ai 946f2522db Add libxkbcommon-x11-0 to the Linux quick start and record the window and rebuild checked (R5.7)
On a clean Ubuntu 24.04 under X11 the app stopped before its window:
"Library libxkbcommon-x11.so could not be loaded". With libxkbcommon-x11-0
installed it opened on its welcome screen. The README's snake-game rebuild
reached Ready with Claude Code. Also notes, as an open line, that the first
build check didn't find the program when Cargo's target-dir pointed elsewhere.
2026-11-16 14:01:18 +04:00
Fadlalla-ai a00aedbff1 Claim the rest of the Linux quick start live check (R5.7) 2026-11-16 13:53:30 +04:00
Fadlalla-ai 11607a91b2 Keep the window and rebuild steps of the Linux quick start open, and say what wasn't run (R5.7) 2026-11-16 12:49:20 +04:00
Fadlalla-ai efe7d74f11 Add build-essential to the Linux quick start and record it checked on clean Ubuntu and Debian (R5.7) 2026-11-16 12:39:42 +04:00
Fadlalla-ai af627b5419 Claim the Linux quick start live check in the roadmap (R5.7) 2026-11-16 12:24:44 +04:00
Trần Quang Đãng 9460af211f Let Claude Code use the model its own settings name by default (#921)
* Let Claude Code use the model its own settings name by default

Claude Code runs are no longer passed a hardcoded --model: with no choice
saved, the agent uses whatever its own settings name (a custom model, an
alias, opusplan…), and `ai model --default` clears a saved override back
to that. The Settings → AI picker lists "Default (its own settings)" first
for Claude Code (saved as `claude-code` or `claude`), choosing it clears
the saved model, and the typed "Another model" field is gone since the
list carries the choice. effort_levels detects Claude Code by adapter id
so the `claude` agent id gets every effort level too.

* Translate "Default (its own settings)" in the remaining eight catalogs

The i18n gate requires every catalog to carry the same key set; the
first commit only added the new picker label to six of them.
2026-11-16 08:59:20 +01:00
BFlat 21ffa656ca Merge pull request #1914 from Plastic-time/bugfix/r3.12-js-line-index-1115
Line numbers in JavaScript facts counted only LF, so anything after a bare CR, U+2028 or U+2029 was reported on the previous line. The line index now counts every ECMAScript line terminator, and CRLF once.
2026-11-16 14:12:01 +07:00
RRFZ 7a452424e9 Merge main into bugfix/r3.12-js-line-index-1115 2026-11-16 01:48:57 -05:00
Justin John 5a3fba9286 Keep the plan-limit advice on the turn's closing error (R5.3) (#1933)
A turn refused by a used-up Claude plan limit ends with a closing result error, which is the one the run keeps, and it carried the generic advice, so "which limit, and when it resets" was lost. The closing error now carries the same plan-limit advice as the error before it. Follow-up to #1931.
2026-11-16 13:46:01 +07:00
Justin John 15972b4fbb Stop the build at a used-up Claude Code plan limit instead of retrying it (R5.3) (#1931)
When a Claude plan's 5-hour or weekly limit was used up, Claude Code's rate_limit error was read as a per-minute rate limit, so the build waited and tried again and failed the same way each time. Claude Code's stream reports each turn's plan limits; when that report says the turn was rejected, the failure is now a usage limit, which isn't retried, and the fix names which limit is used up and roughly when it resets. A rate limit on a turn the plan allowed is still waited for and retried. Fixes #1919.
2026-11-16 13:24:16 +07:00
Justin John d2d52137ea Use the Windows manual proxy for engine downloads when no proxy variable is set (R2.9) (#1930)
Engine downloads (Ghidra and its JDK, Godot, pinned installs) used only the proxy environment variables, so behind a VPN that sets only the Windows system proxy they went direct and timed out. When no proxy variable is set, they now use the person's manual proxy from Windows' settings, read from the registry once per download; this computer and Windows' own exceptions go direct, and a NO_PROXY the person set replaces those exceptions. Settings with credentials, SOCKS only or no port are ignored. AI clients are unchanged. Not run behind a real system proxy. Fixes #1827, #1787.
2026-11-16 12:37:41 +07:00
htjulia 2330f627b7 Say how many response bodies a walkthrough left out, and why (R3.13)
A walkthrough with keep_bodies.response_body kept bodies for the first
200 requests and said nothing about the rest, so a request without a
response_body read as one that had no body (#1811; web_page_show's
outlines were fixed in #1845). The network result now counts the kept
bodies, and a response_bodies_partial limitation says how many were
left out: past the cap, after the run's deadline, or unreadable.

Co-Authored-By: htjulia <htjulia1@gmail.com>
2026-11-16 10:11:39 +09:00
htjulia a0c7c6c8dc Claim the web_page_show body outline cap fix (R3.13)
Co-Authored-By: htjulia <htjulia1@gmail.com>
2026-11-16 10:11:39 +09:00
FuryNocturn ab74a2730e Hide keys in a plugin's arguments in its log, and keep what a server that stopped answering printed (R5.5) 2026-11-16 01:30:50 +01:00
FuryNocturn 1c9a3627ed Claim R5.5: the review notes on #1921 2026-11-16 01:17:05 +01:00
RRFZ 72af4d7676 Correct JavaScript lines facts (R3.12) 2026-11-15 14:28:05 -05:00
RRFZ ebf3353fbc Claim JavaScript lines correctness (R3.12) 2026-11-15 14:27:53 -05:00
FuryNocturnTV (Tare Fernandez) febf096ea4 Keep a failure log when an MCP plugin doesn't start, and say what it printed (R5.5) (#1921)
A local MCP plugin that exited before answering only said "The X plugin exited." It now gives its exit code and the last lines it printed, and a write to a server that has already gone gives the same error. When a local plugin can't be started, exits, or doesn't answer in time, a failure log is written to logs/ in the config folder and named in the error. The plugin's environment is left out of the log, and a remote plugin or a stop writes none. The failure-log writer moves to the engine crate so plugins and agent runs share it.
2026-11-16 01:15:53 +07:00
Alex Joaquim Pereira 983a3013f3 Check Aider's setup on the SSH host (R2.2) (#1912)
Aider's setup check read this computer's environment and home folder even for a run on another computer over SSH, so a working remote setup could be refused and local keys could pass a remote run that would then wait at a sign-in page. The check now runs on the host: one bounded, stoppable ssh command looks at that account's environment and Aider's settings files and returns only an exit status. Only the two definite answers refuse the run (no model or key; an OpenRouter model without its key); a check that can't run lets the run start and logs why. Not run against a real SSH host.
2026-11-16 00:46:03 +07:00
Alex Joaquim Pereira 773ed61443 Fix Codex's approval guidance for the inline tools table (R2.2) (#1918)
The hint for a tool Codex refused told the person to add a [mcp_servers.craft-anything.tools.<tool>] table, but setup writes tools as one inline table, and TOML refuses to extend an inline table that way, so Codex's config stopped parsing. The hint and docs/codex.md now say to add the tool inside tools, and a test checks that the old form fails and both valid forms parse. For #1867.
2026-11-16 00:38:07 +07:00
RRFZ ad9b1c74d1 Keep side-effect imports in JavaScript lexer fallback (R3.12) (#1915)
The lexer fallback, used for sources too large or too deep to parse, dropped side-effect imports such as import "./polyfill.js", which the syntax-tree path records. A string straight after the import keyword is now recorded as a static dependency with its location. Every fallback import goes through one helper that marks the list truncated past its cap and records a .node specifier as a native module, as the syntax-tree pass does.
2026-11-16 00:34:26 +07:00
RRFZ fd9832c7a6 Preserve scoped package names in JavaScript banners (R3.12) (#1916)
A banner such as /*! @scope/pkg@1.2.3 */ was recorded as package pkg, losing its scope. A word that starts with @ now keeps its slash, so @scope/pkg@1.2.3 and @scope/pkg v1.2.3 keep the full name; every other word is still split on slashes, so a banner that names a package by its URL reads as before.
2026-11-16 00:27:48 +07:00
RRFZ bf50b9eb3a Preserve webpack factory parameters used by direct eval (R3.12) (#1913)
Recovering a webpack factory renames its parameters (e, t, n) to module, exports and __webpack_require__, but code inside a direct eval still used the old names, so the recovered factory threw a ReferenceError. A factory with a possible direct eval call now keeps its parameter names; indirect and optional eval calls, and mere mentions of eval, still allow the rename.
2026-11-15 23:48:43 +07:00
Herwin bd405ceeb5 Study websites behind a login: save a sign-in you make in a browser window and reuse it (R2.9) (#1459)
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.
2026-11-15 17:28:04 +01:00
Justin John 5e809edfe8 Drop a saved -v=m from Aider's arguments too (R2.2) (#1900)
Python 3.10's argparse reads -v=m "old task" as -v -m "old task", so a message saved that way in Aider's extra arguments still replaced the request in its file. An = after a single valueless short flag is now read before looking for m: the m and its message go and -v stays. Later Python versions refuse that form.
2026-11-15 18:24:47 +07:00
RRFZ 1097195797 Detect ZIP members through the archive directory (R3.12) (#1822)
zip_has_entry scanned the whole file for central-directory signatures, so a ZIP holding backup.zip whose inner archive had an AndroidManifest.xml, or a comment shaped like a directory entry, was taken for an APK. It now searches the archive's own validated central directory with the existing parser, keeping only the matching entry and decompressing nothing.
2026-11-15 17:46:29 +07:00
RRFZ 3a4edea0a7 Preserve CR-only JSONC configuration formatting (R3.12) (#1823)
The JSONC parser accepted carriage-return line endings, but its editor found lines by LF only, so adding a setting to a CR-only configuration brought in LF and lost the members' indentation, and removing a member left its line behind. CR now ends a line when the editor locates lines and when it removes a whole member's line, and a CR-only document keeps CR; LF and CRLF documents are unchanged.
2026-11-15 17:35:44 +07:00
RRFZ 4fd0742dbe Bound managed PE detection to the optional header (R3.12) (#1821)
pe_is_managed read the CLR directory past the optional header a PE file declares, so a native image with a short optional header and nonzero bytes where the directory usually sits could be taken for .NET. The optional header is now read through a slice bounded by SizeOfOptionalHeader, with the offset addition checked; PE32 and PE32+ keep their directory-count and nonzero RVA and size checks.
2026-11-15 17:35:38 +07:00
Alex Joaquim Pereira 6571238784 Accept only string or number MCP progress tokens (R2.2) (#1899)
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.
2026-11-15 17:28:49 +07:00
Alex Joaquim Pereira f2b86778dd Bound the firmware PE carve by the optional header (R3.12) (#1898)
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.
2026-11-15 16:59:43 +07:00
scks1 1d8a3b4f60 Check the section-by-section signature hash against the test kit's own (R3.11) (#1051)
The hash of a signed Windows program is now checked against a second implementation: the test kit signs its fixtures with its own copy of the steps, covering gaps between sections, section order, data after the last section, sections that share bytes and 97 sections. A file that declares more sections than were read is refused instead of being hashed with some left out.
2026-11-15 16:52:18 +07:00
Alex Joaquim Pereira 2e7dfa5e34 Bound the .NET PE reader by the optional header (R3.12) (#1897)
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.
2026-11-15 16:22:57 +07:00
Justin John 6d80d99272 Drop a grouped -m from Aider's saved arguments too (R2.2) (#1895)
A saved message in a short-option group was still passed to Aider: -vm "old task" means -v -m "old task", so the saved task replaced the request in its file. A group of Aider's valueless flags (-v, -h) followed by m now loses the m and its message and keeps the other flags. Any other short option is kept whole.
2026-11-15 15:13:02 +07:00
Justin John 761f195df5 Check a stack's program for an API builder over SSH too (R2.9) (#1896)
A new build is stopped before its first turn when its stack's program (Cargo, for Rust) isn't on this computer, but the check was skipped for any backend with an SSH host. An API builder over SSH still builds on this computer, so it found the missing program only after a whole turn. Only a coding agent over SSH, which builds on the other computer, skips the check now.
2026-11-15 15:04:23 +07:00
Justin John a5fa1cd739 Stop Ghidra's analysis when the project that started it is deleted (R1.5) (#1893)
In Deep mode a build starts Ghidra's one-time analysis on its own thread, and it kept running after its project was deleted, using a core and about 12 GB of memory until the app closed. The analysis now also stops once the project's record is known to be gone, checked on its existing polls. Pausing is unchanged, and a record that can't be read for a moment doesn't stop it. Fixes #948.
2026-11-15 14:08:51 +07:00
RRFZ 501e6b2da0 Read GraphQL and tRPC endpoints only from a URL's path (R3.12) (#1890)
A URL with no path has its first slash in the query or fragment, so https://auth.example.test?next=/graphql was read as a GraphQL endpoint; and a :// in a query made /api/graphql?next=https://x.test lose its path. A scheme now counts only before any /, ? or #, the host ends at the first of those, and run-time text in a partly literal URL ends neither.
2026-11-15 12:17:05 +07:00
RRFZ d821d01c35 Add numbers and read number literals by value in JavaScript constant text (R3.12) (#1889)
Text read through constants joined both sides of every + as written, so '/v' + (1 + 2) read as /v12 and '/w' + 0x10 as /w0x10, both marked literal. Two numbers now add, a number literal reads as JavaScript turns it into text (0x10 is 16), and a + whose sides are neither known text nor two numbers is no longer reported as literal.
2026-11-15 11:59:54 +07:00
Justin John 78a16be096 Keep a saved Aider --message from replacing the request in its file (R2.2) (#1884)
Aider handles a --message before it reads --message-file, so a --message saved in a backend's extra arguments ran instead of the person's request once the request went in a file. When the message is in a file, saved --message, --msg and -m arguments (and their joined forms) are now left out; other saved arguments are kept. With the message in argv nothing changes: it comes last and wins.
2026-11-15 11:35:38 +07:00
RRFZ 18aa351c73 Read a one-module webpack chunk only with a factory and webpack evidence (R3.12) (#1888)
A push of [[ids], {one property}] was read as a webpack chunk whatever the object held, so ordinary code such as queue.push([[1], { callback }]) became a webpack module and marked the file as bundled. A one-property object now counts only when the property is a module factory and the file names webpack or uses its chunk-global push.
2026-11-15 11:15:09 +07:00
RRFZ 5353f81948 Match export lists to function bindings, wherever the list is (R3.12) (#1887)
An export list marked functions exported by name among those seen so far: a list before the declaration marked nothing, and one after it marked every function of that name, nested ones included. Listed names are now resolved to bindings and matched to functions after the walk, whether the function was declared, initialised a variable or was assigned to one.
2026-11-15 11:15:03 +07:00
RRFZ fc22ad1fee Read .cts files as CommonJS and .mts files as ES modules (R3.12) (#1886)
.cts and .mts got the same source type as .ts, where the parser decides between module and script from the syntax, so their reported source kind could be wrong. As in Node and TypeScript, .cts is now always CommonJS and .mts always an ES module.
2026-11-15 11:14:56 +07:00
Rudy Mizrahi Celekli 63eaef1889 Show how to retry when project approvals refuse a builder action (R2.9) (#1848)
When Auto mode or a project's approval setting refuses an action, the build feed now names the kind and how to be asked next time, for example /approvals publish ask for a refused push. The refusal itself is unchanged. Repeated refusals of one kind share one notice, and the next build clears old notices.
2026-11-15 11:10:08 +07:00
Rudy Mizrahi Celekli b9a0f81d14 Let people set an AI backend's request rate in Settings (#1841)
An API backend's requests per minute could only be set by editing config.toml. Settings → AI now has a field for it on each API backend, and the CLI has ai request-rate <name> [n]; zero removes the limit. Agent apps send their own requests, so they have no such setting. The save runs on a worker through the hub's usual save path.
2026-11-15 11:06:55 +07:00