Commit Graph
8 Commits
Author SHA1 Message Date
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
김준호 c95d361218 Read a text source as text outside a build (R3.11) (#1480)
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
2026-11-10 18:13:09 +07:00
Tanish Manku 3122cd1e6d Each project chooses what the builder's approvals get, per kind of action (#1022)
A project can allow, ask about or refuse each kind of builder action (web, commands, outside files, publishing, deletes outside the project, system changes, other tools); a kind it hasn't chosen follows Auto mode as before. `project_approvals_set` sets them, and an agent can only make a kind stricter, including through our CLI from its own shell. "Always" on a push, delete or system card allows that whole kind, and pushes are read word by word in every shell form.
2026-11-07 04:36:10 +08:00
BFlatandFábio Soares cb395ee2c6 Let people fold the builder's plan card away, and keep the fold (#790)
The builder's plan card can be folded away, and the fold is kept in the project's feed until the builder makes a new plan (refs #504).

Supersedes #779.

Co-authored-by: Fábio Soares <fabiodev1123@gmail.com>
2026-11-04 16:01:37 +07:00
Ryan Missel 87174476d9 Add Copilot CLI support and shared agent investigations (#455)
GitHub Copilot CLI can be a coding agent over ACP, with its models chosen through the shared agent model catalogue; options that could bypass the app's tool restrictions are refused, and agents share investigation findings safely.
2026-11-04 00:29:11 +07:00
Matthias Bodsch 1d66a6ba4b Choose OpenCode models and thinking depth locally or over SSH (#413)
OpenCode can be chosen as a coding agent locally or over SSH, with the chat models its installation offers and the thinking depths each supports.
2026-11-03 19:53:16 +07:00
BFlat 4419c674cf "It's done" keeps a build as it is and stops offering to carry on (#221)
A paused, stopped or failed build only offered Continue or Try again; there was no way to say "enough now". project_build_finish marks the project Ready and adds a Done step to its conversation, keeping everything; the project screen shows It's done beside Continue and Try again when nothing is running.

Fixes #210
2026-11-02 11:51:58 +07:00
Brandon ThomasandClaude Opus 5.5 f64ae3bf3c Craft Anything
A native, pure-Rust app that shows anyone how a piece of software works, with
evidence-backed answers, then helps them rebuild it. It ships a desktop app, a
CLI and an MCP server, all driven by one engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:52:14 -04:00